From cb6a14dec94b9bc892f9e010e46efac1c11e316c Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Wed, 20 Jul 2022 21:55:55 +0000 Subject: [PATCH] hypervisor: drop check_extension from Vm trait Signed-off-by: Wei Liu --- hypervisor/src/kvm/mod.rs | 8 ++++---- hypervisor/src/vm.rs | 5 ----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/hypervisor/src/kvm/mod.rs b/hypervisor/src/kvm/mod.rs index fbbc53cb5..bf80ae318 100644 --- a/hypervisor/src/kvm/mod.rs +++ b/hypervisor/src/kvm/mod.rs @@ -325,6 +325,10 @@ impl KvmVm { .map_err(|e| vm::HypervisorVmError::CreateDevice(e.into()))?; Ok(VfioDeviceFd::new_from_kvm(device_fd)) } + /// Checks if a particular `Cap` is available. + fn check_extension(&self, c: Cap) -> bool { + self.fd.check_extension(c) + } } /// @@ -681,10 +685,6 @@ 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) - } /// Create a device that is used for passthrough fn create_passthrough_device(&self) -> vm::Result { let mut vfio_dev = kvm_create_device { diff --git a/hypervisor/src/vm.rs b/hypervisor/src/vm.rs index 055ee5f77..db1e6bf73 100644 --- a/hypervisor/src/vm.rs +++ b/hypervisor/src/vm.rs @@ -19,8 +19,6 @@ use crate::cpu::Vcpu; use crate::ClockData; use crate::UserMemoryRegion; use crate::{IoEventAddress, IrqRoutingEntry}; -#[cfg(feature = "kvm")] -use kvm_ioctls::Cap; use std::any::Any; #[cfg(target_arch = "x86_64")] use std::fs::File; @@ -326,9 +324,6 @@ pub trait Vm: Send + Sync + Any { /// Set guest clock. #[cfg(target_arch = "x86_64")] fn set_clock(&self, data: &ClockData) -> Result<()>; - #[cfg(feature = "kvm")] - /// Checks if a particular `Cap` is available. - fn check_extension(&self, c: Cap) -> bool; /// Create a device that is used for passthrough fn create_passthrough_device(&self) -> Result; /// Start logging dirty pages