mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
hypervisor: Add get_msr_index_list method to the hypervisor trait
CPU profiles will describe a list of MSRs they require when applying the profile we want to check that the host has all the required MSRs otherwise we have an incompatibility issue. In order to check which MSRs the host supports we start by exposing the hypervisor's get_msr_index_list method. The MSRs required by a chosen CPU profile will be checked against the output of the get_msr_index_list and get_feature_msrs on the hypervisor in a follow up commit. The get_msr_index_list method does not have an obvious implementation for MSHV, because in that case one needs to obtain MSR indices from the VM fd, after the VM has been initialized. Since CPU profiles are only intended for the KVM hypervisor to begin with, we leave the MSHV implementation as unimplemented for now. A proper solution for MSHV should rather be found if/when CPU profiles are also desired in that context. Signed-off-by: Oliver Anderson <oliver.anderson@cyberus-technology.de> On-behalf-of: SAP oliver.anderson@sap.com
This commit is contained in:
committed by
Rob Bradford
parent
9f5590fe6c
commit
2aff169533
@@ -146,6 +146,11 @@ pub trait Hypervisor: Send + Sync {
|
||||
/// Get feature MSRs supported by the hardware and hypervisor
|
||||
///
|
||||
fn get_feature_msrs(&self) -> Result<Vec<MsrEntry>>;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
///
|
||||
/// Get the MSR indices supported by the hardware and hypervisor
|
||||
///
|
||||
fn get_msr_index_list(&self) -> Result<Vec<u32>>;
|
||||
///
|
||||
/// Check particular extensions if any
|
||||
///
|
||||
|
||||
@@ -1861,6 +1861,11 @@ impl hypervisor::Hypervisor for KvmHypervisor {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
fn get_msr_index_list(&self) -> hypervisor::Result<Vec<u32>> {
|
||||
self.get_msr_list().map(|list| list.as_slice().to_vec())
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
///
|
||||
/// Retrieve AArch64 host maximum IPA size supported by KVM.
|
||||
|
||||
@@ -399,6 +399,12 @@ impl hypervisor::Hypervisor for MshvHypervisor {
|
||||
}
|
||||
Ok(cpuid)
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
fn get_msr_index_list(&self) -> hypervisor::Result<Vec<u32>> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
fn get_feature_msrs(&self) -> hypervisor::Result<Vec<MsrEntry>> {
|
||||
unimplemented!()
|
||||
|
||||
Reference in New Issue
Block a user