From e5cb13588baf9cb6fca5891521e6b5f729eb1f94 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 17 Mar 2022 12:33:04 +0000 Subject: [PATCH] vmm: cpu: Add concept of making CpuManager dynamic If the CpuManager is dynamic it devices CPUs can be hotplugged/unplugged. Since TDX does not support CPU hotplug this is currently the only determinator as to whether the CpuManager is dynamic. Signed-off-by: Rob Bradford --- vmm/src/cpu.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index 67161def9..6cf9b300b 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -418,6 +418,7 @@ pub struct CpuManager { #[cfg(feature = "acpi")] proximity_domain_per_cpu: BTreeMap, affinity: BTreeMap>, + dynamic: bool, } const CPU_ENABLE_FLAG: usize = 0; @@ -626,6 +627,11 @@ impl CpuManager { BTreeMap::new() }; + #[cfg(feature = "tdx")] + let dynamic = !tdx_enabled; + #[cfg(not(feature = "tdx"))] + let dynamic = true; + let cpu_manager = Arc::new(Mutex::new(CpuManager { config: config.clone(), interrupt_controller: device_manager.interrupt_controller().clone(), @@ -649,6 +655,7 @@ impl CpuManager { #[cfg(feature = "acpi")] proximity_domain_per_cpu, affinity, + dynamic, })); #[cfg(feature = "acpi")]