mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-01 11:05:46 +00:00
hypervisor, vmm: Add default Hypervisor::check_required_extensions()
This allows the removal of KVM specific compile time checks on this function. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
2439625785
commit
0cf9218d3f
@ -83,11 +83,12 @@ pub trait Hypervisor: Send + Sync {
|
|||||||
/// Get the supported CpuID
|
/// Get the supported CpuID
|
||||||
///
|
///
|
||||||
fn get_cpuid(&self) -> Result<CpuId>;
|
fn get_cpuid(&self) -> Result<CpuId>;
|
||||||
#[cfg(not(feature = "mshv"))]
|
|
||||||
///
|
///
|
||||||
/// Check particular extensions if any
|
/// Check particular extensions if any
|
||||||
///
|
///
|
||||||
fn check_required_extensions(&self) -> Result<()>;
|
fn check_required_extensions(&self) -> Result<()> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
///
|
///
|
||||||
/// Retrieve the list of MSRs supported by the hypervisor.
|
/// Retrieve the list of MSRs supported by the hypervisor.
|
||||||
|
@ -674,7 +674,7 @@ impl Vm {
|
|||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
#[cfg(feature = "tdx")]
|
#[cfg(feature = "tdx")]
|
||||||
let tdx_enabled = config.lock().unwrap().tdx.is_some();
|
let tdx_enabled = config.lock().unwrap().tdx.is_some();
|
||||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
#[cfg(target_arch = "x86_64")]
|
||||||
hypervisor.check_required_extensions().unwrap();
|
hypervisor.check_required_extensions().unwrap();
|
||||||
#[cfg(feature = "tdx")]
|
#[cfg(feature = "tdx")]
|
||||||
let vm = hypervisor
|
let vm = hypervisor
|
||||||
@ -746,7 +746,7 @@ impl Vm {
|
|||||||
hypervisor: Arc<dyn hypervisor::Hypervisor>,
|
hypervisor: Arc<dyn hypervisor::Hypervisor>,
|
||||||
activate_evt: EventFd,
|
activate_evt: EventFd,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
#[cfg(target_arch = "x86_64")]
|
||||||
hypervisor.check_required_extensions().unwrap();
|
hypervisor.check_required_extensions().unwrap();
|
||||||
let vm = hypervisor.create_vm().unwrap();
|
let vm = hypervisor.create_vm().unwrap();
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
@ -799,7 +799,7 @@ impl Vm {
|
|||||||
hypervisor: Arc<dyn hypervisor::Hypervisor>,
|
hypervisor: Arc<dyn hypervisor::Hypervisor>,
|
||||||
activate_evt: EventFd,
|
activate_evt: EventFd,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
#[cfg(target_arch = "x86_64")]
|
||||||
hypervisor.check_required_extensions().unwrap();
|
hypervisor.check_required_extensions().unwrap();
|
||||||
let vm = hypervisor.create_vm().unwrap();
|
let vm = hypervisor.create_vm().unwrap();
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
Loading…
Reference in New Issue
Block a user