Skip to main content

openvmm_defs/
config.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! Configuration for the VM worker.
5
6use guid::Guid;
7use input_core::InputData;
8use memory_range::MemoryRange;
9use mesh::MeshPayload;
10use mesh::payload::Protobuf;
11use net_backend_resources::mac_address::MacAddress;
12use openvmm_pcat_locator::RomFileLocation;
13use std::fs::File;
14use vm_resource::Resource;
15use vm_resource::kind::PciDeviceHandleKind;
16use vm_resource::kind::VirtioDeviceHandle;
17use vm_resource::kind::VmbusDeviceHandleKind;
18use vmgs_resources::VmgsResource;
19use vmotherboard::ChipsetDeviceHandle;
20use vmotherboard::LegacyPciChipsetDeviceHandle;
21use vmotherboard::options::BaseChipsetManifest;
22use vmotherboard::options::VmChipsetCapabilities;
23
24#[derive(MeshPayload, Debug)]
25pub struct Config {
26    pub load_mode: LoadMode,
27    pub floppy_disks: Vec<floppy_resources::FloppyDiskConfig>,
28    pub ide_disks: Vec<ide_resources::IdeDeviceConfig>,
29    pub pcie_root_complexes: Vec<PcieRootComplexConfig>,
30    pub pcie_devices: Vec<PcieDeviceConfig>,
31    pub pcie_switches: Vec<PcieSwitchConfig>,
32    pub pcie_generic_initiators: Vec<PcieGenericInitiatorConfig>,
33    pub vpci_devices: Vec<VpciDeviceConfig>,
34    pub numa: NumaTopology,
35    pub processor_topology: ProcessorTopologyConfig,
36    pub hypervisor: HypervisorConfig,
37    pub chipset: BaseChipsetManifest,
38    pub vmbus: Option<VmbusConfig>,
39    pub vtl2_vmbus: Option<VmbusConfig>,
40    #[cfg(windows)]
41    pub kernel_vmnics: Vec<KernelVmNicConfig>,
42    pub input: mesh::Receiver<InputData>,
43    pub framebuffer: Option<framebuffer::Framebuffer>,
44    pub vga_firmware: Option<RomFileLocation>,
45    pub vtl2_gfx: bool,
46    pub virtio_devices: Vec<(VirtioBus, Resource<VirtioDeviceHandle>)>,
47    #[cfg(windows)]
48    pub vpci_resources: Vec<virt_whp::device::DeviceHandle>,
49    pub vmgs: Option<VmgsResource>,
50    // TODO: move FirmwareEvent somewhere not GED-specific.
51    pub firmware_event_send: Option<mesh::Sender<get_resources::ged::FirmwareEvent>>,
52    pub debugger_rpc: Option<mesh::Receiver<vmm_core_defs::debug_rpc::DebugRequest>>,
53    pub vmbus_devices: Vec<(DeviceVtl, Resource<VmbusDeviceHandleKind>)>,
54    pub chipset_devices: Vec<ChipsetDeviceHandle>,
55    pub pci_chipset_devices: Vec<LegacyPciChipsetDeviceHandle>,
56    pub isa_dma_controller: Option<Resource<vm_resource::kind::IsaDmaControllerHandleKind>>,
57    pub chipset_capabilities: VmChipsetCapabilities,
58    /// Memory layout sizing for the layout engine. Determines chipset MMIO
59    /// range sizes; addresses are allocated dynamically by the resolver.
60    pub layout: vmm_core_defs::LayoutConfig,
61    // This is used for testing. TODO: resourcify, and also store this in VMGS.
62    pub rtc_delta_milliseconds: i64,
63}
64
65pub const DEFAULT_GIC_DISTRIBUTOR_BASE: u64 = 0xFFFF_0000;
66// The KVM in-kernel vGICv3 requires the distributor and redistributor bases be 64KiB aligned.
67pub const DEFAULT_GIC_REDISTRIBUTORS_BASE: u64 = if cfg!(target_os = "linux") {
68    0xEFFF_0000
69} else {
70    0xEFFE_E000
71};
72
73/// Base address of the guest-visible GIC v2m MSI frame (exposed via the MADT
74/// and used by the software v2m SETSPI decoder for emulated devices). This is
75/// OpenVMM-emulated MMIO (one 4 KiB page), not shadowed by the hypervisor, so
76/// it stays at the conventional address.
77pub const DEFAULT_GIC_V2M_MSI_FRAME_BASE: u64 = 0xEFFE_8000;
78/// Size of the v2m MSI frame (one 4KB page is the architectural minimum).
79pub const GIC_V2M_MSI_FRAME_SIZE: u64 = 0x1000;
80
81/// Base address of the GIC v2m MSI doorbell used for passthrough on the
82/// MSHV root/arm64 backend. Registered with the hypervisor as
83/// GITS_TRANSLATER_BASE_ADDRESS.
84/// The hypervisor shadows a ~64 KiB region at this base,
85/// so it uses the Hyper-V convention address 0xEFF6_8000.
86pub const DEFAULT_GIC_V2M_DOORBELL_BASE: u64 = 0xEFF6_8000;
87
88/// Base address of the GICv3 ITS MMIO region. Must be 64 KiB aligned,
89/// below the v2m frame address, and not overlap other devices.
90/// The region extends from this base to base + GIC_ITS_SIZE (128 KiB).
91pub const DEFAULT_GIC_ITS_BASE: u64 = 0xEFFC_0000;
92/// Size of the ITS MMIO region (control frame + translation frame, 2×64 KiB).
93pub const GIC_ITS_SIZE: u64 = 0x2_0000;
94
95/// Default virtual timer PPI (GIC INTID). PPI 4 = INTID 16 + 4 = 20.
96/// This is the EL1 virtual timer interrupt used across Hyper-V, KVM, and HVF.
97pub const DEFAULT_VIRT_TIMER_PPI: u32 = 20;
98
99/// Default total number of GIC interrupts (SGIs + PPIs + SPIs).
100/// Must satisfy KVM constraints: 64 <= n <= 1023, multiple of 32.
101/// 992 = 31 × 32 is the largest valid value.
102pub const DEFAULT_GIC_NR_IRQS: u32 = 992;
103
104/// Default VMBus PPI (GIC INTID). PPI 2 = INTID 16 + 2 = 18.
105pub const DEFAULT_VMBUS_PPI: u32 = 18;
106
107/// How firmware tables are presented to the guest in Linux direct boot.
108///
109/// On x86, `DeviceTree` is not supported and will be rejected. On aarch64,
110/// this selects between a full device tree or an ACPI boot path.
111#[derive(MeshPayload, Debug, Clone, Copy, PartialEq, Eq)]
112pub enum LinuxDirectBootMode {
113    /// Full device tree with all devices described in DT nodes (aarch64 only).
114    DeviceTree,
115    /// ACPI tables for device discovery. On aarch64, this also synthesizes
116    /// an EFI system table so the kernel enters its ACPI code path. On x86,
117    /// ACPI tables are always provided via the zero page.
118    Acpi,
119}
120
121#[derive(MeshPayload, Debug)]
122pub enum LoadMode {
123    Linux {
124        kernel: File,
125        initrd: Option<File>,
126        cmdline: String,
127        enable_serial: bool,
128        boot_mode: LinuxDirectBootMode,
129    },
130    Uefi {
131        firmware: File,
132        enable_debugging: bool,
133        enable_memory_protections: bool,
134        disable_frontpage: bool,
135        enable_tpm: bool,
136        enable_battery: bool,
137        enable_serial: bool,
138        enable_vpci_boot: bool,
139        uefi_console_mode: Option<UefiConsoleMode>,
140        default_boot_always_attempt: bool,
141        bios_guid: Guid,
142        enable_vmbus: bool,
143        force_dma_bounce: bool,
144    },
145    Pcat {
146        firmware: RomFileLocation,
147        boot_order: [PcatBootDevice; 4],
148    },
149    Igvm {
150        file: File,
151        cmdline: String,
152        vtl2_base_address: Vtl2BaseAddressType,
153        com_serial: Option<SerialInformation>,
154    },
155    None,
156}
157
158#[derive(Debug, Clone, Copy, MeshPayload)]
159pub struct SerialInformation {
160    pub io_port: u16,
161    pub irq: u32,
162}
163
164/// Different types to specify the base address for the VTL2 region of the IGVM
165/// file.
166#[derive(Debug, Clone, Copy, MeshPayload)]
167pub enum Vtl2BaseAddressType {
168    /// Use the addresses specified in the file. The IGVM file does not need to
169    /// support relocations.
170    File,
171    /// Put VTL2 at the specified address. The IGVM file must support
172    /// relocations.
173    Absolute(u64),
174    /// Use the specified range in the supplied MemoryLayout, as the caller has
175    /// created a specific range for VTL2. The IGVM file must support
176    /// relocations.
177    ///
178    /// An optional size may be specified to override the size describing VTL2
179    /// provided in the IGVM file. It must be larger than the IGVM file provided
180    /// size.
181    MemoryLayout { size: Option<u64> },
182    /// Tell VTL2 to allocate out it's own memory. This will load the file at
183    /// the base address specified in the file, and the host will tell VTL2 the
184    /// size of memory to allocate for itself.
185    ///
186    /// An optional size may be specified to override the size describing VTL2
187    /// provided in the IGVM file. It must be larger than the IGVM file provided
188    /// size.
189    Vtl2Allocate { size: Option<u64> },
190}
191
192/// Specifies a PCIe MMIO BAR window, either by size (the resolver allocates) or
193/// by a fixed location. Fixed locations exist for assigned-device, IOMMU, and
194/// physical-topology compatibility.
195#[derive(Debug, MeshPayload)]
196pub enum PcieMmioRangeConfig {
197    /// Dynamically allocate a range of the given size.
198    Dynamic {
199        /// Size of the range in bytes.
200        size: u64,
201    },
202    /// Use the specified fixed memory range.
203    Fixed(MemoryRange),
204}
205
206#[derive(Debug, MeshPayload)]
207pub struct RootComplexCxlConfig {
208    /// HDM window size in bytes for this CXL root complex.
209    pub hdm_size: u64,
210    /// CFMWS HDM window restrictions bitmask.
211    pub hdm_window_restrictions: u16,
212}
213
214#[derive(Debug, MeshPayload)]
215pub struct PcieRootComplexConfig {
216    pub index: u32,
217    pub name: String,
218    pub segment: u16,
219    pub start_bus: u8,
220    pub end_bus: u8,
221    pub low_mmio: PcieMmioRangeConfig,
222    pub high_mmio: PcieMmioRangeConfig,
223    pub ports: Vec<PciePortConfig>,
224    /// Optional CXL configuration for root-complex CXL mode.
225    pub cxl: Option<RootComplexCxlConfig>,
226    /// Optional IOMMU for this root complex.
227    pub iommu: Option<PcieIommuConfig>,
228    /// NUMA node affinity for this root complex. Used to generate `_PXM` in
229    /// the ACPI SSDT so the guest OS sees correct NUMA locality for devices
230    /// under this root complex.
231    pub vnode: Option<u32>,
232    /// When true, treat non-zero BAR values found during probing as pinned
233    /// addresses. Used for P2P DMA with GPA = HPA.
234    pub preserve_bars: bool,
235}
236
237/// Configuration for a single PCIe port — either a root-complex root port or a
238/// switch downstream port.
239#[derive(Debug, MeshPayload)]
240pub struct PciePortConfig {
241    /// Port name used for topology wiring and lookup.
242    pub name: String,
243    /// The device/function (`device << 3 | function`) to place this port at on
244    /// its bus.
245    ///
246    /// When `None`, the port is assigned the lowest available devfn. Ports are
247    /// assigned in order, so an explicit devfn that collides with a
248    /// previously-assigned port (including one assigned automatically) is an
249    /// error. Honored for both root-complex root ports and switch downstream
250    /// ports.
251    pub devfn: Option<u8>,
252    /// Enables PCIe hotplug capabilities for this port.
253    pub hotplug: bool,
254    /// Optional ACS capability bitmask to expose on this port.
255    pub acs_capabilities_supported: Option<u16>,
256    /// Marks this port as CXL-capable.
257    ///
258    /// Runtime port construction derives required BAR/subregion layout from
259    /// this flag (currently CXL component registers for BAR0).
260    pub cxl: bool,
261    /// Enables PASID support for functions downstream of this port.
262    pub pasid: bool,
263}
264
265#[derive(Debug, MeshPayload)]
266pub struct PcieSwitchConfig {
267    pub name: String,
268    pub parent_port: String,
269    /// The downstream ports of this switch.
270    pub ports: Vec<PciePortConfig>,
271}
272
273/// Declares that the device directly behind a named PCIe port (a root port or
274/// a switch downstream port) is a generic initiator (GI) for the given NUMA
275/// node. Used to generate an SRAT Generic Initiator Affinity structure so the
276/// guest attaches the device's memory to that (typically CPU-less) proximity
277/// domain.
278///
279/// The port is resolved against the live topology by port name after switch
280/// downstream ports have been enumerated, so it can target devices that sit
281/// behind a switch.
282#[derive(Debug, MeshPayload)]
283pub struct PcieGenericInitiatorConfig {
284    /// Name of the PCIe port (root port or switch downstream port) behind
285    /// which the generic-initiator device resides.
286    pub port_name: String,
287    /// NUMA node the device is a generic initiator for.
288    pub node: u32,
289}
290
291#[derive(Debug, MeshPayload)]
292pub struct PcieDeviceConfig {
293    pub port_name: String,
294    pub resource: Resource<PciDeviceHandleKind>,
295}
296
297#[derive(Debug, MeshPayload)]
298pub struct VpciDeviceConfig {
299    pub vtl: DeviceVtl,
300    /// The ID of the device. Vpci devices are identified by a portion of `data2` and `data3` of the
301    /// instance ID, which is used to generate the guest-visible device ID.
302    pub instance_id: Guid,
303    pub resource: Resource<PciDeviceHandleKind>,
304    /// NUMA node affinity for this VPCI device.
305    pub vnode: Option<u32>,
306}
307
308#[derive(Debug, Protobuf)]
309pub struct ProcessorTopologyConfig {
310    pub proc_count: u32,
311    pub vps_per_socket: Option<u32>,
312    pub enable_smt: Option<bool>,
313    pub arch: Option<ArchTopologyConfig>,
314}
315
316#[derive(Debug, Protobuf, Default, Clone)]
317pub struct X86TopologyConfig {
318    pub apic_id_offset: u32,
319    pub x2apic: X2ApicConfig,
320}
321
322#[derive(Debug, Default, Copy, Clone, Protobuf)]
323pub enum X2ApicConfig {
324    #[default]
325    /// Support the X2APIC if recommended by the hypervisor or if needed by the
326    /// topology configuration.
327    Auto,
328    /// Support the X2APIC, and automatically enable it if needed to address all
329    /// processors.
330    Supported,
331    /// Do not support the X2APIC.
332    Unsupported,
333    /// Support and enable the X2APIC.
334    Enabled,
335}
336
337#[derive(Debug, Protobuf, Default, Clone)]
338pub enum PmuGsivConfig {
339    #[default]
340    /// Use the hypervisor's platform GSIV value for the PMU.
341    Platform,
342    /// Use the specified GSIV value for the PMU.
343    Gsiv(u32),
344    /// Disable the PMU.
345    Disabled,
346}
347
348/// MSI controller selection for aarch64 PCIe interrupt delivery.
349#[derive(Debug, Protobuf, Default, Clone)]
350pub enum GicMsiConfig {
351    /// Automatically select the best available MSI controller:
352    /// ITS when the hypervisor supports it, otherwise GICv2m.
353    #[default]
354    Auto,
355    /// Force GICv3 ITS for MSI delivery via LPIs.
356    Its,
357    /// Force GICv2m for MSI delivery via SPIs.
358    V2m {
359        /// Number of SPIs to reserve for PCIe MSIs. Defaults to a
360        /// platform-specific value when `None`.
361        spi_count: Option<u32>,
362    },
363}
364
365/// IOMMU configuration for a single PCIe root complex.
366#[derive(Debug, MeshPayload, Clone)]
367pub enum PcieIommuConfig {
368    /// AMD IOMMU (AMD-Vi) for x86_64 guests.
369    AmdVi,
370    /// Arm SMMUv3 for aarch64 guests.
371    Smmu {
372        /// Enable HW-accelerated nested translation (iommufd). Requires VFIO
373        /// devices with `iommu=` behind this SMMU.
374        accel: bool,
375        /// Output address size (OAS) resolution policy.
376        oas: SmmuOas,
377    },
378    /// Intel VT-d for x86_64 guests.
379    IntelVtd,
380}
381
382/// Output address size (OAS) policy for an emulated SMMUv3.
383#[derive(Debug, MeshPayload, Clone, Copy)]
384pub enum SmmuOas {
385    /// Advertise a fixed default OAS. See `DEFAULT_AUTO_OAS_BITS` for the
386    /// sizing policy and its limits.
387    Auto,
388    /// Use a fixed OAS in bits (one of 32, 36, 40, 42, 44, 48, 52).
389    Fixed(u8),
390}
391
392#[derive(Debug, Protobuf, Default, Clone)]
393pub struct Aarch64TopologyConfig {
394    pub gic_config: Option<GicConfig>,
395    pub pmu_gsiv: PmuGsivConfig,
396    pub gic_msi: GicMsiConfig,
397}
398
399/// GIC configuration for the virtual machine.
400///
401/// The variant selects the GIC version. `None` inner config means use
402/// defaults for that version's addresses.
403#[derive(Debug, Protobuf, Clone)]
404pub enum GicConfig {
405    /// GICv2 with optional address overrides.
406    V2(Option<GicV2Config>),
407    /// GICv3 with optional address overrides.
408    V3(Option<GicV3Config>),
409}
410
411/// GICv2-specific address configuration.
412#[derive(Debug, Protobuf, Clone)]
413pub struct GicV2Config {
414    pub gic_distributor_base: u64,
415    pub cpu_interface_base: u64,
416}
417
418/// GICv3-specific address configuration.
419#[derive(Debug, Protobuf, Clone)]
420pub struct GicV3Config {
421    pub gic_distributor_base: u64,
422    pub gic_redistributors_base: u64,
423}
424
425#[derive(Debug, Protobuf, Clone)]
426pub enum ArchTopologyConfig {
427    X86(X86TopologyConfig),
428    Aarch64(Aarch64TopologyConfig),
429}
430
431/// Per-node memory allocation configuration.
432#[derive(Debug, Clone, Copy, MeshPayload)]
433pub struct MemoryConfig {
434    pub mem_size: u64,
435    pub prefetch_memory: bool,
436    pub private_memory: bool,
437    pub transparent_hugepages: bool,
438    pub hugepages: bool,
439    pub hugepage_size: Option<u64>,
440    /// Host physical NUMA node to bind this allocation to (Linux:
441    /// `mbind(MPOL_BIND)`). `None` means OS default placement.
442    pub host_numa_node: Option<u32>,
443}
444
445/// Virtual NUMA topology for the VM.
446#[derive(Debug, MeshPayload)]
447pub struct NumaTopology {
448    /// NUMA nodes. The vnode ID is the index into this vector.
449    pub nodes: Vec<NumaNode>,
450    /// Inter-node distances for the SLIT. If empty, defaults are used
451    /// (10 for self, 20 for cross-node).
452    pub distances: Vec<NumaDistance>,
453}
454
455/// A single virtual NUMA node.
456#[derive(Debug, MeshPayload)]
457pub struct NumaNode {
458    /// Memory allocation for this node. `None` means a CPU-only or
459    /// device-only node.
460    pub mem: Option<MemoryConfig>,
461    /// VP assignment for this node.
462    pub vps: VpAssignment,
463}
464
465/// How VPs are assigned to a NUMA node.
466#[derive(Debug, MeshPayload)]
467pub enum VpAssignment {
468    /// Assign VPs to nodes by round-robining sockets over the CPU-bearing
469    /// nodes only: a VP with socket ID `vp_index / vps_per_socket` belongs to
470    /// the `(vp_index / vps_per_socket) % num_cpu_nodes`-th `FromTopology`
471    /// node. `vps_per_socket` comes from `ProcessorTopologyConfig`;
472    /// `num_cpu_nodes` is the number of `FromTopology` nodes, so `Empty`
473    /// (CPU-less) nodes are skipped and do not affect the distribution.
474    FromTopology,
475    /// Explicit VP indices assigned to this node.
476    Explicit(Vec<u32>),
477    /// A CPU-less node: no VPs are assigned to it. Unlike `Explicit`, this
478    /// may be combined with `FromTopology` nodes, so a memory- or
479    /// device-only node can be declared without forcing every other node to
480    /// spell out its VP set.
481    Empty,
482}
483
484/// An inter-node distance entry for the ACPI SLIT.
485#[derive(Debug, MeshPayload)]
486pub struct NumaDistance {
487    /// Source node index.
488    pub src: u32,
489    /// Destination node index.
490    pub dst: u32,
491    /// Distance value (10 = local, 20 = default cross-node, 255 = unreachable).
492    pub distance: u8,
493}
494
495#[derive(Debug, MeshPayload, Default)]
496pub struct VmbusConfig {
497    pub vsock_listener: Option<unix_socket::UnixListener>,
498    pub vsock_path: Option<String>,
499    pub vmbus_max_version: Option<u32>,
500    #[cfg(windows)]
501    pub vmbusproxy_handle: Option<vmbus_proxy::ProxyHandle>,
502    pub vtl2_redirect: bool,
503}
504
505#[derive(Debug, MeshPayload, Default)]
506pub struct HypervisorConfig {
507    pub with_hv: bool,
508    pub with_vtl2: Option<Vtl2Config>,
509    pub with_isolation: Option<IsolationType>,
510    /// Expose hardware virtualization (VMX/SVM) to the guest so that it can run
511    /// its own hypervisor. A backend that does not recognize this request
512    /// rejects it rather than silently ignoring it (see
513    /// `virt::Hypervisor::recognizes_nested_virt`).
514    pub nested_virt: bool,
515}
516
517#[derive(Debug, MeshPayload)]
518pub struct KernelVmNicConfig {
519    pub instance_id: Guid,
520    pub mac_address: MacAddress,
521    pub switch_port_id: SwitchPortId,
522}
523
524#[derive(Clone, Debug, MeshPayload)]
525pub struct SwitchPortId {
526    pub switch: Guid,
527    pub port: Guid,
528}
529
530pub const DEFAULT_PCAT_BOOT_ORDER: [PcatBootDevice; 4] = [
531    PcatBootDevice::Optical,
532    PcatBootDevice::HardDrive,
533    PcatBootDevice::Network,
534    PcatBootDevice::Floppy,
535];
536
537#[derive(MeshPayload, Debug, Clone, Copy, PartialEq)]
538pub enum PcatBootDevice {
539    Floppy,
540    HardDrive,
541    Optical,
542    Network,
543}
544
545#[derive(Eq, PartialEq, Debug, Copy, Clone, MeshPayload)]
546pub enum VirtioBus {
547    Mmio,
548    Pci,
549}
550
551/// Policy for the partition when mapping VTL0 memory late.
552#[derive(Eq, PartialEq, Debug, Copy, Clone, MeshPayload)]
553pub enum LateMapVtl0MemoryPolicy {
554    /// Halt execution of the VP if VTL0 memory is accessed.
555    Halt,
556    /// Log the error but emulate the access with the instruction emulator.
557    Log,
558    /// Inject an exception into the guest.
559    InjectException,
560}
561
562impl From<LateMapVtl0MemoryPolicy> for virt::LateMapVtl0MemoryPolicy {
563    fn from(value: LateMapVtl0MemoryPolicy) -> Self {
564        match value {
565            LateMapVtl0MemoryPolicy::Halt => virt::LateMapVtl0MemoryPolicy::Halt,
566            LateMapVtl0MemoryPolicy::Log => virt::LateMapVtl0MemoryPolicy::Log,
567            LateMapVtl0MemoryPolicy::InjectException => {
568                virt::LateMapVtl0MemoryPolicy::InjectException
569            }
570        }
571    }
572}
573
574/// Configuration for VTL2.
575///
576/// NOTE: This is distinct from `virt::Vtl2Config` to keep an abstraction
577/// between the virt crate and this crate. Users should not be specifying
578/// virt crate configuration directly.
579#[derive(Debug, Clone, MeshPayload)]
580pub struct Vtl2Config {
581    /// Enable the VTL0 alias map. This maps VTL0's view of memory in VTL2 at
582    /// the highest legal physical address bit.
583    pub vtl0_alias_map: bool,
584    /// If set, map VTL0 memory late after VTL2 has started. The current
585    /// heuristic is to defer mapping VTL0 memory until the first
586    /// `HvModifyVtlProtectionMask` hypercall is made.
587    pub late_map_vtl0_memory: Option<LateMapVtl0MemoryPolicy>,
588}
589
590// Isolation type for a partition.
591#[derive(Eq, PartialEq, Debug, Copy, Clone, MeshPayload)]
592pub enum IsolationType {
593    Vbs,
594    Snp,
595    Cca,
596}
597
598impl From<IsolationType> for virt::IsolationType {
599    fn from(value: IsolationType) -> Self {
600        match value {
601            IsolationType::Vbs => Self::Vbs,
602            IsolationType::Snp => Self::Snp,
603            IsolationType::Cca => Self::Cca,
604        }
605    }
606}
607
608/// Which VTL to assign a particular device to.
609#[derive(Copy, Clone, Debug, PartialEq, Eq, MeshPayload)]
610pub enum DeviceVtl {
611    Vtl0,
612    Vtl1,
613    Vtl2,
614}
615
616#[derive(Copy, Clone, Debug, MeshPayload)]
617pub enum UefiConsoleMode {
618    Default,
619    Com1,
620    Com2,
621    None,
622}