(
config: &Arc<Mutex<VmConfig>>,
vm: &Arc<dyn hypervisor::Vm>,
cpu_manager: &Arc<Mutex<cpu::CpuManager>>,
)
| 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)] |
nothing calls this directly
no test coverage detected