From 4a47cdcebde584989d3b0d09ee5138a1207c5429 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Fri, 17 Dec 2021 12:14:52 +0100 Subject: [PATCH] vmm: tdx: Make sure a TDX enabled binary can be used for non-TDX It's important to maintain the ability to run in a non-TDX environment a Cloud Hypervisor binary with the 'tdx' feature enabled. Signed-off-by: Sebastien Boeuf --- vmm/src/vm.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index 728fbc9e4..ee9d39997 100644 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -1989,7 +1989,11 @@ impl Vm { .map_err(Error::CpuManager)?; #[cfg(feature = "tdx")] - let sections = self.extract_tdvf_sections()?; + let sections = if self.config.lock().unwrap().tdx.is_some() { + self.extract_tdvf_sections()? + } else { + Vec::new() + }; #[cfg(feature = "acpi")] let rsdp_addr = {