hypervisor: Add get_host_ipa_limit for AArch64

This commit adds a helper `get_host_ipa_limit` to the AArch64
`KvmHypervisor` struct. This helper can be used to get the
`Host_IPA_Limit`, which is the maximum possible value for
IPA_Bits on the host and is dependent on the CPU capability
and the kernel configuration.

Signed-off-by: Henry Wang <Henry.Wang@arm.com>
This commit is contained in:
Henry Wang 2021-06-09 21:31:49 +08:00 committed by Sebastien Boeuf
parent 97307a7fc1
commit 805cb303d5
2 changed files with 12 additions and 0 deletions

View File

@ -100,4 +100,9 @@ pub trait Hypervisor: Send + Sync {
/// Retrieve the list of MSRs supported by the hypervisor.
///
fn get_msr_list(&self) -> Result<MsrList>;
#[cfg(target_arch = "aarch64")]
///
/// Retrieve AArch64 host maximum IPA size supported by KVM.
///
fn get_host_ipa_limit(&self) -> i32;
}

View File

@ -584,6 +584,13 @@ impl hypervisor::Hypervisor for KvmHypervisor {
.get_msr_index_list()
.map_err(|e| hypervisor::HypervisorError::GetMsrList(e.into()))
}
#[cfg(target_arch = "aarch64")]
///
/// Retrieve AArch64 host maximum IPA size supported by KVM.
///
fn get_host_ipa_limit(&self) -> i32 {
self.kvm.get_host_ipa_limit()
}
}
/// Vcpu struct for KVM
pub struct KvmVcpu {