]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
cpu/hotplug, x86/acpi: Disable CPU offlining for ACPI MADT wakeup
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Fri, 14 Jun 2024 09:58:49 +0000 (12:58 +0300)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 17 Jun 2024 15:45:34 +0000 (17:45 +0200)
ACPI MADT doesn't allow to offline a CPU after it has been woken up.

Currently, CPU hotplug is prevented based on the confidential computing
attribute which is set for Intel TDX. But TDX is not the only possible user of
the wake up method. Any platform that uses ACPI MADT wakeup method cannot
offline CPU.

Disable CPU offlining on ACPI MADT wakeup enumeration.

This has no visible effects for users: currently, TDX guest is the only platform
that uses the ACPI MADT wakeup method.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Tao Liu <ltao@redhat.com>
Link: https://lore.kernel.org/r/20240614095904.1345461-5-kirill.shutemov@linux.intel.com
arch/x86/coco/core.c
arch/x86/kernel/acpi/madt_wakeup.c
include/linux/cc_platform.h
kernel/cpu.c

index b31ef2424d194b96d07b601d4eeac4b23d637d27..0f81f70aca822e7d798b48e149a853004638b7b0 100644 (file)
@@ -29,7 +29,6 @@ static bool noinstr intel_cc_platform_has(enum cc_attr attr)
 {
        switch (attr) {
        case CC_ATTR_GUEST_UNROLL_STRING_IO:
-       case CC_ATTR_HOTPLUG_DISABLED:
        case CC_ATTR_GUEST_MEM_ENCRYPT:
        case CC_ATTR_MEM_ENCRYPT:
                return true;
index cf79ea6f3007134602d8cd086bfe2dc839c2670d..d222be8d7a07155e1191f4ab33486ff612d56c10 100644 (file)
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 #include <linux/acpi.h>
+#include <linux/cpu.h>
 #include <linux/io.h>
 #include <asm/apic.h>
 #include <asm/barrier.h>
@@ -76,6 +77,8 @@ int __init acpi_parse_mp_wake(union acpi_subtable_headers *header,
 
        acpi_mp_wake_mailbox_paddr = mp_wake->base_address;
 
+       cpu_hotplug_disable_offlining();
+
        apic_update_callback(wakeup_secondary_cpu_64, acpi_wakeup_cpu);
 
        return 0;
index 60693a1458946223f791aae517210cb67ba13050..caa4b443063469e9d5f48d56b1c24a3659d78384 100644 (file)
@@ -81,16 +81,6 @@ enum cc_attr {
         */
        CC_ATTR_GUEST_SEV_SNP,
 
-       /**
-        * @CC_ATTR_HOTPLUG_DISABLED: Hotplug is not supported or disabled.
-        *
-        * The platform/OS is running as a guest/virtual machine does not
-        * support CPU hotplug feature.
-        *
-        * Examples include TDX Guest.
-        */
-       CC_ATTR_HOTPLUG_DISABLED,
-
        /**
         * @CC_ATTR_HOST_SEV_SNP: AMD SNP enabled on the host.
         *
index 4c15b478e2bc72226793e0b808f3d1e2220a900f..a609385c7f99a73aaa14e0625707dadbd92878fd 100644 (file)
@@ -1481,8 +1481,7 @@ static int cpu_down_maps_locked(unsigned int cpu, enum cpuhp_state target)
         * If the platform does not support hotplug, report it explicitly to
         * differentiate it from a transient offlining failure.
         */
-       if (cc_platform_has(CC_ATTR_HOTPLUG_DISABLED) ||
-           cpu_hotplug_offline_disabled)
+       if (cpu_hotplug_offline_disabled)
                return -EOPNOTSUPP;
        if (cpu_hotplug_disabled)
                return -EBUSY;