diff --git a/hypervisor/src/kvm/mod.rs b/hypervisor/src/kvm/mod.rs index b99ddc339..87b25a741 100644 --- a/hypervisor/src/kvm/mod.rs +++ b/hypervisor/src/kvm/mod.rs @@ -250,6 +250,10 @@ impl vm::Vm for KvmVm { .set_clock(data) .map_err(|e| vm::HypervisorVmError::SetClock(e.into())) } + /// Checks if a particular `Cap` is available. + fn check_extension(&self, c: Cap) -> bool { + self.fd.check_extension(c) + } } /// Wrapper over KVM system ioctls. pub struct KvmHypervisor { diff --git a/hypervisor/src/vm.rs b/hypervisor/src/vm.rs index 0a5b3fd22..7e2d74e86 100644 --- a/hypervisor/src/vm.rs +++ b/hypervisor/src/vm.rs @@ -14,6 +14,7 @@ use crate::cpu::Vcpu; #[cfg(target_arch = "x86_64")] use crate::ClockData; use crate::{CreateDevice, DeviceFd, IoEventAddress, IrqRouting, MemoryRegion}; +use kvm_ioctls::Cap; use std::sync::Arc; use thiserror::Error; use vmm_sys_util::eventfd::EventFd; @@ -168,4 +169,6 @@ pub trait Vm: Send + Sync { /// Set guest clock. #[cfg(target_arch = "x86_64")] fn set_clock(&self, data: &ClockData) -> Result<()>; + /// Checks if a particular `Cap` is available. + fn check_extension(&self, c: Cap) -> bool; }