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

Method create_cpu_manager

vmm/src/vm.rs:753–810  ·  view source on GitHub ↗
(
        config: &Arc<Mutex<VmConfig>>,
        vm: Arc<dyn hypervisor::Vm>,
        exit_evt: EventFd,
        reset_evt: EventFd,
        #[cfg(feature = "guest_debug")] vm_debug_evt: EventFd,
    

Source from the content-addressed store, hash-verified

751 /// Create and configure the CPU manager.
752 #[allow(clippy::too_many_arguments)]
753 fn create_cpu_manager(
754 config: &Arc<Mutex<VmConfig>>,
755 vm: Arc<dyn hypervisor::Vm>,
756 exit_evt: EventFd,
757 reset_evt: EventFd,
758 #[cfg(feature = "guest_debug")] vm_debug_evt: EventFd,
759 hypervisor: &Arc<dyn hypervisor::Hypervisor>,
760 seccomp_action: SeccompAction,
761 vm_ops: Arc<dyn VmOps>,
762 numa_nodes: &NumaNodes,
763 ) -> Result<Arc<Mutex<cpu::CpuManager>>> {
764 #[cfg(feature = "tdx")]
765 let tdx_enabled = config.lock().unwrap().is_tdx_enabled();
766 #[cfg(feature = "sev_snp")]
767 let sev_snp_enabled = config.lock().unwrap().is_sev_snp_enabled();
768 #[cfg(feature = "igvm")]
769 let igvm_enabled = config
770 .lock()
771 .unwrap()
772 .payload
773 .as_ref()
774 .and_then(|p| p.igvm.as_ref())
775 .is_some();
776
777 let cpus_config = config.lock().unwrap().cpus.clone();
778 let cpu_manager = cpu::CpuManager::new(
779 &cpus_config,
780 vm,
781 exit_evt,
782 reset_evt,
783 #[cfg(feature = "guest_debug")]
784 vm_debug_evt,
785 hypervisor.clone(),
786 seccomp_action,
787 vm_ops,
788 #[cfg(feature = "tdx")]
789 tdx_enabled,
790 numa_nodes,
791 #[cfg(feature = "sev_snp")]
792 sev_snp_enabled,
793 #[cfg(feature = "igvm")]
794 igvm_enabled,
795 )
796 .map_err(Error::CpuManager)?;
797
798 #[cfg(target_arch = "x86_64")]
799 cpu_manager
800 .lock()
801 .unwrap()
802 .populate_cpuid(
803 hypervisor.as_ref(),
804 #[cfg(feature = "tdx")]
805 tdx_enabled,
806 )
807 .map_err(Error::CpuManager)?;
808
809 Ok(cpu_manager)
810 }

Callers

nothing calls this directly

Calls 5

newFunction · 0.85
is_tdx_enabledMethod · 0.80
is_sev_snp_enabledMethod · 0.80
populate_cpuidMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected