hypervisor: Introduce get_guest_debug_hw_bps()

Added `Hypervisor::get_guest_debug_hw_bps()` for fetching the number of
supported hardware breakpoints.

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
This commit is contained in:
Michael Zhao 2022-08-23 11:21:56 +08:00 committed by Sebastien Boeuf
parent 3126b351c1
commit 223b1f6c51
3 changed files with 22 additions and 2 deletions

2
Cargo.lock generated
View File

@ -472,7 +472,7 @@ dependencies = [
[[package]]
name = "kvm-ioctls"
version = "0.11.0"
source = "git+https://github.com/rust-vmm/kvm-ioctls?branch=main#63f2f1231d49478197e15b8e9ff5d4e827aa288f"
source = "git+https://github.com/rust-vmm/kvm-ioctls?branch=main#6705a619970fb0b2be47f1781f2ccf856cd5ce6a"
dependencies = [
"kvm-bindings",
"libc",

View File

@ -117,7 +117,7 @@ pub trait Hypervisor: Send + Sync {
}
#[cfg(target_arch = "aarch64")]
///
/// Retrieve AArch64 host maximum IPA size supported by KVM.
/// Retrieve AArch64 host maximum IPA size supported by KVM
///
fn get_host_ipa_limit(&self) -> i32;
///
@ -125,4 +125,10 @@ pub trait Hypervisor: Send + Sync {
///
#[cfg(feature = "tdx")]
fn tdx_capabilities(&self) -> Result<TdxCapabilities>;
///
/// Get the number of supported hardware breakpoints
///
fn get_guest_debug_hw_bps(&self) -> usize {
unimplemented!()
}
}

View File

@ -1076,6 +1076,20 @@ impl hypervisor::Hypervisor for KvmHypervisor {
Ok(data)
}
///
/// Get the number of supported hardware breakpoints
///
fn get_guest_debug_hw_bps(&self) -> usize {
#[cfg(target_arch = "x86_64")]
{
4
}
#[cfg(target_arch = "aarch64")]
{
self.kvm.get_guest_debug_hw_bps() as usize
}
}
}
/// Vcpu struct for KVM
pub struct KvmVcpu {