diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index a49374eb6..30a49f339 100644 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -509,13 +509,6 @@ impl Vm { .validate() .map_err(Error::ConfigValidation)?; - #[cfg(not(feature = "igvm"))] - let load_payload_handle = if snapshot.is_none() { - Self::load_payload_async(&memory_manager, &config)? - } else { - None - }; - info!("Booting VM from config: {:?}", &config); // Create NUMA nodes based on NumaConfig. @@ -580,25 +573,6 @@ impl Vm { ) .map_err(Error::CpuManager)?; - // Loading the igvm file is pushed down here because - // igvm parser needs cpu_manager to retrieve cpuid leaf. - // For the regular case, we can start loading early, but for - // igvm case we have to wait until cpu_manager is created. - // Currently, Microsoft Hypervisor does not provide any - // Hypervisor specific common cpuid, we need to call get_cpuid_values - // per cpuid through cpu_manager. - #[cfg(feature = "igvm")] - let load_payload_handle = if snapshot.is_none() { - Self::load_payload_async( - &memory_manager, - &config, - &cpu_manager, - #[cfg(feature = "sev_snp")] - sev_snp_enabled, - )? - } else { - None - }; // The initial TDX configuration must be done before the vCPUs are // created #[cfg(feature = "tdx")] @@ -672,6 +646,24 @@ impl Vm { } } + // Loading the igvm file is pushed down here because + // igvm parser needs cpu_manager to retrieve cpuid leaf. + // Currently, Microsoft Hypervisor does not provide any + // Hypervisor specific common cpuid, we need to call get_cpuid_values + // per cpuid through cpu_manager. + let load_payload_handle = if snapshot.is_none() { + Self::load_payload_async( + &memory_manager, + &config, + #[cfg(feature = "igvm")] + &cpu_manager, + #[cfg(feature = "sev_snp")] + sev_snp_enabled, + )? + } else { + None + }; + cpu_manager .lock() .unwrap()