MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / hypervisor_specific_init

Method hypervisor_specific_init

vmm/src/vm.rs:883–991  ·  view source on GitHub ↗
(
        vm: &Arc<dyn hypervisor::Vm>,
        memory_manager: &Arc<Mutex<MemoryManager>>,
        cpu_manager: &Arc<Mutex<cpu::CpuManager>>,
        device_manager: &Arc<Mutex<DeviceManager>>,
     

Source from the content-addressed store, hash-verified

881 /// - SEV-SNP (MSHV with confidential computing)
882 #[allow(clippy::too_many_arguments)]
883 fn hypervisor_specific_init(
884 vm: &Arc<dyn hypervisor::Vm>,
885 memory_manager: &Arc<Mutex<MemoryManager>>,
886 cpu_manager: &Arc<Mutex<cpu::CpuManager>>,
887 device_manager: &Arc<Mutex<DeviceManager>>,
888 config: &Arc<Mutex<VmConfig>>,
889 hypervisor: &Arc<dyn hypervisor::Hypervisor>,
890 console_info: Option<&ConsoleInfo>,
891 console_resize_pipe: Option<&Arc<File>>,
892 original_termios: &Arc<Mutex<Option<termios>>>,
893 snapshot: Option<&Snapshot>,
894 #[cfg(feature = "igvm")] igvm_file: Option<IgvmFile>,
895 ) -> Result<Option<thread::JoinHandle<Result<EntryPoint>>>> {
896 #[cfg(feature = "mshv")]
897 let is_mshv = matches!(
898 hypervisor.hypervisor_type(),
899 hypervisor::HypervisorType::Mshv
900 );
901 #[cfg(feature = "kvm")]
902 let is_kvm = matches!(
903 hypervisor.hypervisor_type(),
904 hypervisor::HypervisorType::Kvm
905 );
906
907 #[cfg(feature = "sev_snp")]
908 let sev_snp_enabled = config.lock().unwrap().is_sev_snp_enabled();
909
910 // MSHV-specific initialization (non-aarch64)
911 #[cfg(all(feature = "mshv", not(target_arch = "aarch64")))]
912 if is_mshv {
913 vm.init().map_err(Error::InitializeVm)?;
914 }
915
916 // SEV-SNP specific initialization
917 #[cfg(feature = "sev_snp")]
918 if sev_snp_enabled {
919 return Self::init_sev_snp(
920 vm,
921 memory_manager,
922 cpu_manager,
923 device_manager,
924 config,
925 console_info,
926 console_resize_pipe,
927 original_termios,
928 snapshot,
929 #[cfg(feature = "igvm")]
930 igvm_file,
931 );
932 }
933
934 // MSHV initialization (create interrupt controller and devices)
935 #[cfg(feature = "mshv")]
936 if is_mshv {
937 Self::init_mshv(
938 vm,
939 device_manager,
940 console_info,

Callers

nothing calls this directly

Calls 6

snapshot_from_idFunction · 0.85
is_sev_snp_enabledMethod · 0.80
create_boot_vcpusMethod · 0.80
initMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected