hypervisor: Export check_extension() API from hypervisor::Vm

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
This commit is contained in:
Michael Zhao 2020-07-07 14:19:15 +08:00 committed by Rob Bradford
parent f2e484750a
commit 82a0e29c7a
2 changed files with 7 additions and 0 deletions

View File

@ -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 {

View File

@ -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;
}