From 93237f0106ccbb4dd34e65d3c3afb0dd7f25c379 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Fri, 1 Jul 2022 17:41:00 +0100 Subject: [PATCH] vmm: Set MADT "Online Capable" flag The Linux kernel now checks for this before marking CPUs as hotpluggable: commit aa06e20f1be628186f0c2dcec09ea0009eb69778 Author: Mario Limonciello Date: Wed Sep 8 16:41:46 2021 -0500 x86/ACPI: Don't add CPUs that are not online capable A number of systems are showing "hotplug capable" CPUs when they are not really hotpluggable. This is because the MADT has extra CPU entries to support different CPUs that may be inserted into the socket with different numbers of cores. Starting with ACPI 6.3 the spec has an Online Capable bit in the MADT used to determine whether or not a CPU is hotplug capable when the enabled bit is not set. Link: https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/05_ACPI_Software_Programming_Model/ACPI_Software_Programming_Model.html?#local-apic-flags Signed-off-by: Mario Limonciello Signed-off-by: Rafael J. Wysocki Signed-off-by: Rob Bradford --- vmm/src/cpu.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index 898d4d974..c8595f12a 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -1271,7 +1271,7 @@ impl CpuManager { 1 << MADT_CPU_ENABLE_FLAG } else { 0 - }, + } | 1 << MADT_CPU_ONLINE_CAPABLE_FLAG, }; madt.append(lapic); } @@ -1524,6 +1524,9 @@ struct Cpu { #[cfg(target_arch = "x86_64")] const MADT_CPU_ENABLE_FLAG: usize = 0; +#[cfg(target_arch = "x86_64")] +const MADT_CPU_ONLINE_CAPABLE_FLAG: usize = 1; + impl Cpu { #[cfg(target_arch = "x86_64")] fn generate_mat(&self) -> Vec {