From dc68a6e30f70b9929445e66a2f2c13a57fb18388 Mon Sep 17 00:00:00 2001 From: Muminul Islam Date: Tue, 12 Dec 2023 16:06:25 -0800 Subject: [PATCH] vmm: igvm: complete isolated import Complete the isolated import, telling the Microsoft hypervisor that import is done so that MSHV can issue SNP_LAUNCH_FINISH command. Signed-off-by: Muminul Islam --- vmm/src/igvm/igvm_loader.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/vmm/src/igvm/igvm_loader.rs b/vmm/src/igvm/igvm_loader.rs index caec48f85..3eacd6d43 100644 --- a/vmm/src/igvm/igvm_loader.rs +++ b/vmm/src/igvm/igvm_loader.rs @@ -423,7 +423,7 @@ pub fn load_igvm( { use std::time::Instant; - let now = Instant::now(); + let mut now = Instant::now(); // Sort the gpas to group them by the page type gpas.sort_by(|a, b| a.gpa.cmp(&b.gpa)); @@ -472,6 +472,21 @@ pub fn load_igvm( now.elapsed(), gpas.len() ); + + now = Instant::now(); + // Call Complete Isolated Import since we are done importing isolated pages + let host_data: [u8; 32] = [0; 32]; + memory_manager + .lock() + .unwrap() + .vm + .complete_isolated_import(loaded_info.snp_id_block, host_data, 1) + .map_err(Error::CompleteIsolatedImport)?; + + info!( + "Time it took to for launch complete command {:.2?}", + now.elapsed() + ); } debug!("Dumping the contents of VMSA page: {:x?}", loaded_info.vmsa);