diff --git a/hypervisor/src/hypervisor.rs b/hypervisor/src/hypervisor.rs index e71d64d8e..1ea7fb08f 100644 --- a/hypervisor/src/hypervisor.rs +++ b/hypervisor/src/hypervisor.rs @@ -146,6 +146,11 @@ pub trait Hypervisor: Send + Sync { /// Get feature MSRs supported by the hardware and hypervisor /// fn get_feature_msrs(&self) -> Result>; + #[cfg(target_arch = "x86_64")] + /// + /// Get the MSR indices supported by the hardware and hypervisor + /// + fn get_msr_index_list(&self) -> Result>; /// /// Check particular extensions if any /// diff --git a/hypervisor/src/kvm/mod.rs b/hypervisor/src/kvm/mod.rs index a69cecf4f..fe393d5d8 100644 --- a/hypervisor/src/kvm/mod.rs +++ b/hypervisor/src/kvm/mod.rs @@ -1861,6 +1861,11 @@ impl hypervisor::Hypervisor for KvmHypervisor { } } + #[cfg(target_arch = "x86_64")] + fn get_msr_index_list(&self) -> hypervisor::Result> { + self.get_msr_list().map(|list| list.as_slice().to_vec()) + } + #[cfg(target_arch = "aarch64")] /// /// Retrieve AArch64 host maximum IPA size supported by KVM. diff --git a/hypervisor/src/mshv/mod.rs b/hypervisor/src/mshv/mod.rs index d9cbbf186..d1b8e4c7c 100644 --- a/hypervisor/src/mshv/mod.rs +++ b/hypervisor/src/mshv/mod.rs @@ -399,6 +399,12 @@ impl hypervisor::Hypervisor for MshvHypervisor { } Ok(cpuid) } + + #[cfg(target_arch = "x86_64")] + fn get_msr_index_list(&self) -> hypervisor::Result> { + unimplemented!() + } + #[cfg(target_arch = "x86_64")] fn get_feature_msrs(&self) -> hypervisor::Result> { unimplemented!()