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::GuestStateEncryptionPolicy;
30 use get_protocol::dps_json::GuestStateLifetime;
31 use get_protocol::dps_json::ManagementVtlFeatures;
32 use guid::Guid;
33 use inspect::Inspect;
34
35 #[derive(Debug, Inspect)]
37 pub struct DevicePlatformSettings {
38 pub smbios: Smbios,
39 pub general: General,
40 #[inspect(with = "inspect::iter_by_index")]
41 pub acpi_tables: Vec<Vec<u8>>,
42 }
43
44 #[derive(Debug, Inspect)]
46 pub struct Smbios {
47 pub serial_number: Vec<u8>,
48 pub base_board_serial_number: Vec<u8>,
49 pub chassis_serial_number: Vec<u8>,
50 pub chassis_asset_tag: Vec<u8>,
51
52 pub system_manufacturer: Vec<u8>,
53 pub system_product_name: Vec<u8>,
54 pub system_version: Vec<u8>,
55 pub system_sku_number: Vec<u8>,
56 pub system_family: Vec<u8>,
57 pub bios_lock_string: Vec<u8>,
58 pub memory_device_serial_number: Vec<u8>,
59
60 pub processor_manufacturer: Vec<u8>,
61 pub processor_version: Vec<u8>,
62 pub processor_id: u64,
63 pub external_clock: u16,
64 pub max_speed: u16,
65 pub current_speed: u16,
66 pub processor_characteristics: u16,
67 pub processor_family2: u16,
68 pub processor_type: u8,
69 pub voltage: u8,
70 pub status: u8,
71 pub processor_upgrade: u8,
72 }
73
74 #[derive(Debug, Inspect)]
78 pub struct General {
79 pub secure_boot_enabled: bool,
80 pub secure_boot_template: SecureBootTemplateType,
81 pub bios_guid: Guid,
82 pub console_mode: UefiConsoleMode,
83 pub battery_enabled: bool,
84 pub processor_idle_enabled: bool,
85 pub tpm_enabled: bool,
86 pub com1_enabled: bool,
87 pub com1_debugger_mode: bool,
88 pub com1_vmbus_redirector: bool,
89 pub com2_enabled: bool,
90 pub com2_debugger_mode: bool,
91 pub com2_vmbus_redirector: bool,
92 pub firmware_debugging_enabled: bool,
93 pub hibernation_enabled: bool,
94
95 pub suppress_attestation: Option<bool>,
96 pub generation_id: Option<[u8; 16]>,
97
98 pub legacy_memory_map: bool,
99 pub pause_after_boot_failure: bool,
100 pub pxe_ip_v6: bool,
101 pub measure_additional_pcrs: bool,
102 pub disable_frontpage: bool,
103 pub disable_sha384_pcr: bool,
104 pub media_present_enabled_by_default: bool,
105 pub vpci_boot_enabled: bool,
106 pub memory_protection_mode: MemoryProtectionMode,
107 pub default_boot_always_attempt: bool,
108 pub num_lock_enabled: bool,
109 #[inspect(with = "|x| inspect::iter_by_index(x).map_value(inspect::AsDebug)")]
110 pub pcat_boot_device_order: [PcatBootDevice; 4],
111
112 pub vpci_instance_filter: Option<Guid>,
113 pub nvdimm_count: u16,
114 pub psp_enabled: bool,
115
116 pub vmbus_redirection_enabled: bool,
117 pub always_relay_host_mmio: bool,
118 pub vtl2_settings: Option<underhill_config::Vtl2Settings>,
119
120 pub is_servicing_scenario: bool,
121 pub watchdog_enabled: bool,
122 pub firmware_mode_is_pcat: bool,
123 pub imc_enabled: bool,
124 pub cxl_memory_enabled: bool,
125
126 #[inspect(debug)]
127 pub guest_state_lifetime: GuestStateLifetime,
128 #[inspect(debug)]
129 pub guest_state_encryption_policy: GuestStateEncryptionPolicy,
130 #[inspect(debug)]
131 pub management_vtl_features: ManagementVtlFeatures,
132 }
133
134 #[derive(Copy, Clone, Debug, Inspect)]
135 pub enum MemoryProtectionMode {
136 Disabled = 0,
137 Default = 1,
138 Strict = 2,
139 Relaxed = 3,
140 }
141
142 #[derive(Debug, Inspect)]
143 pub enum UefiConsoleMode {
144 Default = 0,
146 COM1 = 1,
148 COM2 = 2,
150 None = 3,
152 }
153
154 #[derive(Debug, Inspect)]
155 pub enum SecureBootTemplateType {
156 None,
158 MicrosoftWindows,
160 MicrosoftUefiCertificateAuthority,
162 }
163}
164
165pub struct GuestStateProtection {
167 pub encrypted_gsp: GspCiphertextContent,
169 pub decrypted_gsp: [GspCleartextContent; NUMBER_GSP as usize],
171 pub extended_status_flags: GspExtendedStatusFlags,
173 pub new_gsp: GspCleartextContent,
176}
177
178#[derive(Copy, Clone)]
180pub struct GuestStateProtectionById {
181 pub seed: GspCleartextContent,
183 pub extended_status_flags: GspExtendedStatusFlags,
185}
186
187impl GuestStateProtectionById {
188 pub fn new_zeroed() -> GuestStateProtectionById {
190 GuestStateProtectionById {
191 seed: GspCleartextContent::new_zeroed(),
192 extended_status_flags: GspExtendedStatusFlags::new_zeroed(),
193 }
194 }
195}
196
197#[derive(Clone)]
199pub struct IgvmAttest {
200 pub response: Vec<u8>,
202}
203
204pub struct VmgsGetDeviceInfo {
206 pub status: VmgsIoStatus,
208 pub capacity: u64,
210 pub bytes_per_logical_sector: u16,
212 pub bytes_per_physical_sector: u16,
214 pub maximum_transfer_size_bytes: u32,
216}
217
218#[derive(Debug, Copy, Clone)]
220pub struct Time {
221 pub utc: i64,
225 pub time_zone: i16,
227}
228
229#[derive(Debug)]
232pub struct RemoteRamGpaRangeHandle(u32);
233
234impl RemoteRamGpaRangeHandle {
235 pub fn as_raw(&self) -> u32 {
237 self.0
238 }
239
240 pub fn from_raw(handle: u32) -> Self {
243 RemoteRamGpaRangeHandle(handle)
244 }
245}
246
247pub struct GuestSaveRequest {
249 pub correlation_id: Guid,
251 pub deadline: std::time::Instant,
253 pub capabilities_flags: SaveGuestVtl2StateFlags,
255}