(
vm: &Arc<dyn hypervisor::Vm>,
memory_manager: &Arc<Mutex<MemoryManager>>,
cpu_manager: &Arc<Mutex<cpu::CpuManager>>,
device_manager: &Arc<Mutex<DeviceManager>>,
| 994 | #[cfg(feature = "sev_snp")] |
| 995 | #[allow(clippy::too_many_arguments)] |
| 996 | fn init_sev_snp( |
| 997 | vm: &Arc<dyn hypervisor::Vm>, |
| 998 | memory_manager: &Arc<Mutex<MemoryManager>>, |
| 999 | cpu_manager: &Arc<Mutex<cpu::CpuManager>>, |
| 1000 | device_manager: &Arc<Mutex<DeviceManager>>, |
| 1001 | config: &Arc<Mutex<VmConfig>>, |
| 1002 | console_info: Option<&ConsoleInfo>, |
| 1003 | console_resize_pipe: Option<&Arc<File>>, |
| 1004 | original_termios: &Arc<Mutex<Option<termios>>>, |
| 1005 | snapshot: Option<&Snapshot>, |
| 1006 | #[cfg(feature = "igvm")] igvm_file: Option<IgvmFile>, |
| 1007 | ) -> Result<Option<thread::JoinHandle<Result<EntryPoint>>>> { |
| 1008 | // Create boot vCPUs before SEV-SNP initialization |
| 1009 | cpu_manager |
| 1010 | .lock() |
| 1011 | .unwrap() |
| 1012 | .create_boot_vcpus(snapshot_from_id(snapshot, CPU_MANAGER_SNAPSHOT_ID)) |
| 1013 | .map_err(Error::CpuManager)?; |
| 1014 | |
| 1015 | // Extract guest policy from IGVM if available, otherwise use default. |
| 1016 | #[cfg(feature = "igvm")] |
| 1017 | let guest_policy = igvm_file |
| 1018 | .as_ref() |
| 1019 | .and_then(igvm_loader::extract_guest_policy) |
| 1020 | .unwrap_or_else(Self::get_default_sev_snp_guest_policy); |
| 1021 | #[cfg(not(feature = "igvm"))] |
| 1022 | let guest_policy = Self::get_default_sev_snp_guest_policy(); |
| 1023 | |
| 1024 | vm.sev_snp_init(guest_policy) |
| 1025 | .map_err(Error::InitializeSevSnpVm)?; |
| 1026 | |
| 1027 | // Load payload for SEV-SNP (IGVM parser needs cpu_manager for cpuid) |
| 1028 | let load_payload_handle = if snapshot.is_none() { |
| 1029 | Self::load_payload_async( |
| 1030 | memory_manager, |
| 1031 | config, |
| 1032 | #[cfg(feature = "igvm")] |
| 1033 | cpu_manager, |
| 1034 | #[cfg(feature = "igvm")] |
| 1035 | igvm_file, |
| 1036 | )? |
| 1037 | } else { |
| 1038 | None |
| 1039 | }; |
| 1040 | |
| 1041 | // Create interrupt controller and devices for MSHV |
| 1042 | let ic = device_manager |
| 1043 | .lock() |
| 1044 | .unwrap() |
| 1045 | .create_interrupt_controller() |
| 1046 | .map_err(Error::DeviceManager)?; |
| 1047 | |
| 1048 | #[cfg(target_arch = "aarch64")] |
| 1049 | vm.init().map_err(Error::InitializeVm)?; |
| 1050 | |
| 1051 | device_manager |
| 1052 | .lock() |
| 1053 | .unwrap() |
nothing calls this directly
no test coverage detected