mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
vmm: pass memory size during VM creation
Pass memory size from vmm crate to hypervisor VM creation API so use for creating Bitmap for SEV-SNP guest. Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
parent
4054a49e2d
commit
149c342867
@ -786,6 +786,8 @@ impl Vmm {
|
|||||||
false,
|
false,
|
||||||
#[cfg(feature = "sev_snp")]
|
#[cfg(feature = "sev_snp")]
|
||||||
false,
|
false,
|
||||||
|
#[cfg(feature = "sev_snp")]
|
||||||
|
config.lock().unwrap().memory.total_size(),
|
||||||
)
|
)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
MigratableError::MigrateReceive(anyhow!(
|
MigratableError::MigrateReceive(anyhow!(
|
||||||
|
@ -827,6 +827,8 @@ impl Vm {
|
|||||||
tdx_enabled,
|
tdx_enabled,
|
||||||
#[cfg(feature = "sev_snp")]
|
#[cfg(feature = "sev_snp")]
|
||||||
sev_snp_enabled,
|
sev_snp_enabled,
|
||||||
|
#[cfg(feature = "sev_snp")]
|
||||||
|
vm_config.lock().unwrap().memory.total_size(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let phys_bits = physical_bits(&hypervisor, vm_config.lock().unwrap().cpus.max_phys_bits);
|
let phys_bits = physical_bits(&hypervisor, vm_config.lock().unwrap().cpus.max_phys_bits);
|
||||||
@ -885,6 +887,7 @@ impl Vm {
|
|||||||
hypervisor: &Arc<dyn hypervisor::Hypervisor>,
|
hypervisor: &Arc<dyn hypervisor::Hypervisor>,
|
||||||
#[cfg(feature = "tdx")] tdx_enabled: bool,
|
#[cfg(feature = "tdx")] tdx_enabled: bool,
|
||||||
#[cfg(feature = "sev_snp")] sev_snp_enabled: bool,
|
#[cfg(feature = "sev_snp")] sev_snp_enabled: bool,
|
||||||
|
#[cfg(feature = "sev_snp")] mem_size: u64,
|
||||||
) -> Result<Arc<dyn hypervisor::Vm>> {
|
) -> Result<Arc<dyn hypervisor::Vm>> {
|
||||||
hypervisor.check_required_extensions().unwrap();
|
hypervisor.check_required_extensions().unwrap();
|
||||||
|
|
||||||
@ -901,7 +904,7 @@ impl Vm {
|
|||||||
// Otherwise SEV_SNP_DISABLED: 0
|
// Otherwise SEV_SNP_DISABLED: 0
|
||||||
// value of sev_snp_enabled is mapped to SEV_SNP_ENABLED for true or SEV_SNP_DISABLED for false
|
// value of sev_snp_enabled is mapped to SEV_SNP_ENABLED for true or SEV_SNP_DISABLED for false
|
||||||
let vm = hypervisor
|
let vm = hypervisor
|
||||||
.create_vm_with_type(u64::from(sev_snp_enabled))
|
.create_vm_with_type_and_memory(u64::from(sev_snp_enabled), mem_size)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
} else {
|
} else {
|
||||||
let vm = hypervisor.create_vm().unwrap();
|
let vm = hypervisor.create_vm().unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user