diff --git a/hypervisor/src/lib.rs b/hypervisor/src/lib.rs index 72fa0c508..d22e7b2b3 100644 --- a/hypervisor/src/lib.rs +++ b/hypervisor/src/lib.rs @@ -206,6 +206,8 @@ pub enum VcpuInit { pub enum RegList { #[cfg(all(feature = "kvm", any(target_arch = "aarch64", target_arch = "riscv64")))] Kvm(kvm_bindings::RegList), + #[cfg(all(feature = "mshv", target_arch = "aarch64"))] + Mshv(mshv_bindings::MshvRegList), } pub enum Register { diff --git a/hypervisor/src/mshv/mod.rs b/hypervisor/src/mshv/mod.rs index d9d0dba28..a31461ef3 100644 --- a/hypervisor/src/mshv/mod.rs +++ b/hypervisor/src/mshv/mod.rs @@ -191,6 +191,25 @@ impl From for mshv_user_irq_entry { } } +#[cfg(target_arch = "aarch64")] +impl From for crate::RegList { + fn from(s: mshv_bindings::MshvRegList) -> Self { + crate::RegList::Mshv(s) + } +} + +#[cfg(target_arch = "aarch64")] +impl From for mshv_bindings::MshvRegList { + fn from(e: crate::RegList) -> Self { + match e { + crate::RegList::Mshv(e) => e, + /* Needed in case other hypervisors are enabled */ + #[allow(unreachable_patterns)] + _ => panic!("RegList is not valid"), + } + } +} + struct MshvDirtyLogSlot { guest_pfn: u64, memory_size: u64,