hypervisor: use memory size during VM creation

For SEV-SNP VM on MSHV we need to request page access during
IO, we want to avoid such request for the page that have already
been requested. In order to maintain the bitmap we need the memory size
during bitmap creation.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
Muminul Islam
2024-09-05 15:25:53 -07:00
committed by Wei Liu
parent 1001d807ff
commit 4054a49e2d
3 changed files with 114 additions and 47 deletions

View File

@@ -118,6 +118,17 @@ pub trait Hypervisor: Send + Sync {
fn create_vm_with_type(&self, _vm_type: u64) -> Result<Arc<dyn Vm>> {
unreachable!()
}
///
/// Create a Vm of a specific type using the underlying hypervisor, passing memory size
/// Return a hypervisor-agnostic Vm trait object
///
fn create_vm_with_type_and_memory(
&self,
_vm_type: u64,
#[cfg(feature = "sev_snp")] _mem_size: u64,
) -> Result<Arc<dyn Vm>> {
unreachable!()
}
#[cfg(target_arch = "x86_64")]
///
/// Get the supported CpuID