guest_emulation_transport/
api.rs1pub use get_protocol::CreateRamGpaRangeFlags;
9pub use get_protocol::EventLogId;
10pub use get_protocol::GSP_CIPHERTEXT_MAX;
11pub use get_protocol::GspCiphertextContent;
12pub use get_protocol::GspCleartextContent;
13pub use get_protocol::GspExtendedStatusFlags;
14pub use get_protocol::IGVM_ATTEST_MSG_REQ_AGENT_DATA_MAX_SIZE;
15pub use get_protocol::MAX_TRANSFER_SIZE;
16pub use get_protocol::NUMBER_GSP;
17pub use get_protocol::ProtocolVersion;
18pub use get_protocol::SaveGuestVtl2StateFlags;
19pub use get_protocol::VmgsIoStatus;
20use zerocopy::FromZeros;
21
22use guid::Guid;
23
24#[expect(missing_docs)]
26pub mod platform_settings {
27 pub use get_protocol::dps_json::PcatBootDevice;
28
29 use get_protocol::dps_json::GuestStateLifetime;
30 use guid::Guid;
31 use inspect::Inspect;
32
33 #[derive(Debug, Inspect)]
35 pub struct DevicePlatformSettings {
36 pub smbios: Smbios,
37 pub general: General,
38 #[inspect(with = "inspect::iter_by_index")]
39 pub acpi_tables: Vec<Vec<u8>>,
40 }
41
42 #[derive(Debug, Inspect)]
44 pub struct Smbios {
45 pub serial_number: Vec<u8>,
46 pub base_board_serial_number: Vec<u8>,
47 pub chassis_serial_number: Vec<u8>,
48 pub chassis_asset_tag: Vec<u8>,
49
50 pub system_manufacturer: Vec<u8>,
51 pub system_product_name: Vec<u8>,
52 pub system_version: Vec<u8>,
53 pub system_sku_number: Vec<u8>,
54 pub system_family: Vec<u8>,
55 pub bios_lock_string: Vec<u8>,
56 pub memory_device_serial_number: Vec<u8>,
57
58 pub processor_manufacturer: Vec<u8>,
59 pub processor_version: Vec<u8>,
60 pub processor_id: u64,
61 pub external_clock: u16,
62 pub max_speed: u16,
63 pub current_speed: u16,
64 pub processor_characteristics: u16,
65 pub processor_family2: u16,
66 pub processor_type: u8,
67 pub voltage: u8,
68 pub status: u8,
69 pub processor_upgrade: u8,
70 }
71
72 #[derive(Debug, Inspect)]
76 pub struct General {
77 pub secure_boot_enabled: bool,
78 pub secure_boot_template: SecureBootTemplateType,
79 pub bios_guid: Guid,
80 pub console_mode: UefiConsoleMode,
81 pub battery_enabled: bool,
82 pub processor_idle_enabled: bool,
83 pub tpm_enabled: bool,
84 pub com1_enabled: bool,
85 pub com1_debugger_mode: bool,
86 pub com1_vmbus_redirector: bool,
87 pub com2_enabled: bool,
88 pub com2_debugger_mode: bool,
89 pub com2_vmbus_redirector: bool,
90 pub firmware_debugging_enabled: bool,
91 pub hibernation_enabled: bool,
92
93 pub suppress_attestation: Option<bool>,
94 pub generation_id: Option<[u8; 16]>,
95
96 pub legacy_memory_map: bool,
97 pub pause_after_boot_failure: bool,
98 pub pxe_ip_v6: bool,
99 pub measure_additional_pcrs: bool,
100 pub disable_frontpage: bool,
101 pub disable_sha384_pcr: bool,
102 pub media_present_enabled_by_default: bool,
103 pub vpci_boot_enabled: bool,
104 pub memory_protection_mode: MemoryProtectionMode,
105 pub default_boot_always_attempt: bool,
106 pub num_lock_enabled: bool,
107 #[inspect(with = "|x| inspect::iter_by_index(x).map_value(inspect::AsDebug)")]
108 pub pcat_boot_device_order: [PcatBootDevice; 4],
109
110 pub vpci_instance_filter: Option<Guid>,
111 pub nvdimm_count: u16,
112 pub psp_enabled: bool,
113
114 pub vmbus_redirection_enabled: bool,
115 pub always_relay_host_mmio: bool,
116 pub vtl2_settings: Option<underhill_config::Vtl2Settings>,
117
118 pub is_servicing_scenario: bool,
119 pub watchdog_enabled: bool,
120 pub firmware_mode_is_pcat: bool,
121 pub imc_enabled: bool,
122 pub cxl_memory_enabled: bool,
123
124 #[inspect(debug)]
125 pub guest_state_lifetime: GuestStateLifetime,
126 }
127
128 #[derive(Copy, Clone, Debug, Inspect)]
129 pub enum MemoryProtectionMode {
130 Disabled = 0,
131 Default = 1,
132 Strict = 2,
133 Relaxed = 3,
134 }
135
136 #[derive(Debug, Inspect)]
137 pub enum UefiConsoleMode {
138 Default = 0,
140 COM1 = 1,
142 COM2 = 2,
144 None = 3,
146 }
147
148 #[derive(Debug, Inspect)]
149 pub enum SecureBootTemplateType {
150 None,
152 MicrosoftWindows,
154 MicrosoftUefiCertificateAuthority,
156 }
157}
158
159pub struct GuestStateProtection {
161 pub encrypted_gsp: GspCiphertextContent,
163 pub decrypted_gsp: [GspCleartextContent; NUMBER_GSP as usize],
165 pub extended_status_flags: GspExtendedStatusFlags,
167 pub new_gsp: GspCleartextContent,
170}
171
172#[derive(Copy, Clone)]
174pub struct GuestStateProtectionById {
175 pub seed: GspCleartextContent,
177 pub extended_status_flags: GspExtendedStatusFlags,
179}
180
181impl GuestStateProtectionById {
182 pub fn new_zeroed() -> GuestStateProtectionById {
184 GuestStateProtectionById {
185 seed: GspCleartextContent::new_zeroed(),
186 extended_status_flags: GspExtendedStatusFlags::new_zeroed(),
187 }
188 }
189}
190
191#[derive(Clone)]
193pub struct IgvmAttest {
194 pub response: Vec<u8>,
196}
197
198pub struct VmgsGetDeviceInfo {
200 pub status: VmgsIoStatus,
202 pub capacity: u64,
204 pub bytes_per_logical_sector: u16,
206 pub bytes_per_physical_sector: u16,
208 pub maximum_transfer_size_bytes: u32,
210}
211
212#[derive(Debug, Copy, Clone)]
214pub struct Time {
215 pub utc: i64,
219 pub time_zone: i16,
221}
222
223#[derive(Debug)]
226pub struct RemoteRamGpaRangeHandle(u32);
227
228impl RemoteRamGpaRangeHandle {
229 pub fn as_raw(&self) -> u32 {
231 self.0
232 }
233
234 pub fn from_raw(handle: u32) -> Self {
237 RemoteRamGpaRangeHandle(handle)
238 }
239}
240
241pub struct GuestSaveRequest {
243 pub correlation_id: Guid,
245 pub deadline: std::time::Instant,
247 pub capabilities_flags: SaveGuestVtl2StateFlags,
249}