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

Method init_tdx_if_enabled

vmm/src/vm.rs:814–826  ·  view source on GitHub ↗
(
        config: &Arc<Mutex<VmConfig>>,
        vm: &Arc<dyn hypervisor::Vm>,
        cpu_manager: &Arc<Mutex<cpu::CpuManager>>,
    )

Source from the content-addressed store, hash-verified

812 /// Initialize TDX if enabled.
813 #[cfg(feature = "tdx")]
814 fn init_tdx_if_enabled(
815 config: &Arc<Mutex<VmConfig>>,
816 vm: &Arc<dyn hypervisor::Vm>,
817 cpu_manager: &Arc<Mutex<cpu::CpuManager>>,
818 ) -> Result<()> {
819 if config.lock().unwrap().is_tdx_enabled() {
820 let cpuid = cpu_manager.lock().unwrap().common_cpuid();
821 let max_vcpus = cpu_manager.lock().unwrap().max_vcpus();
822 vm.tdx_init(&cpuid, max_vcpus)
823 .map_err(Error::InitializeTdxVm)?;
824 }
825 Ok(())
826 }
827
828 /// Create and configure the device manager.
829 #[allow(clippy::too_many_arguments)]

Callers

nothing calls this directly

Calls 4

is_tdx_enabledMethod · 0.80
common_cpuidMethod · 0.80
max_vcpusMethod · 0.80
tdx_initMethod · 0.45

Tested by

no test coverage detected