From 0fa31539eb85804d34f527a6350e7e153c8da37e Mon Sep 17 00:00:00 2001 From: Michael Zhao Date: Sat, 19 Feb 2022 15:01:51 +0800 Subject: [PATCH] vmm: Add default VCPU topology in PPTT on AArch64 When VCPU topology is not specified, fill the PPTT with default setting. Signed-off-by: Michael Zhao --- vmm/src/cpu.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index 6f371f96d..be5239ff3 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -1286,9 +1286,11 @@ impl CpuManager { let pptt_start = 0; let mut cpus = 0; let mut uid = 0; - let threads_per_core = self.get_vcpu_topology().unwrap_or_default().0 as u8; - let cores_per_package = self.get_vcpu_topology().unwrap_or_default().1 as u8; - let packages = self.get_vcpu_topology().unwrap_or_default().2 as u8; + // If topology is not specified, the default setting is: + // 1 package, multiple cores, 1 thread per core + // This is also the behavior when PPTT is missing. + let (threads_per_core, cores_per_package, packages) = + self.get_vcpu_topology().unwrap_or((1, self.max_vcpus(), 1)); let mut pptt = Sdt::new(*b"PPTT", 36, 2, *b"CLOUDH", *b"CHPPTT ", 1);