Skip to content

Commit 66e48e4

Browse files
kirylbp3tk0v
authored andcommitted
cpu/hotplug, x86/acpi: Disable CPU offlining for ACPI MADT wakeup
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
1 parent 1037e4c commit 66e48e4

4 files changed

Lines changed: 4 additions & 13 deletions

File tree

arch/x86/coco/core.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ static bool noinstr intel_cc_platform_has(enum cc_attr attr)
2929
{
3030
switch (attr) {
3131
case CC_ATTR_GUEST_UNROLL_STRING_IO:
32-
case CC_ATTR_HOTPLUG_DISABLED:
3332
case CC_ATTR_GUEST_MEM_ENCRYPT:
3433
case CC_ATTR_MEM_ENCRYPT:
3534
return true;

arch/x86/kernel/acpi/madt_wakeup.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
22
#include <linux/acpi.h>
3+
#include <linux/cpu.h>
34
#include <linux/io.h>
45
#include <asm/apic.h>
56
#include <asm/barrier.h>
@@ -76,6 +77,8 @@ int __init acpi_parse_mp_wake(union acpi_subtable_headers *header,
7677

7778
acpi_mp_wake_mailbox_paddr = mp_wake->base_address;
7879

80+
cpu_hotplug_disable_offlining();
81+
7982
apic_update_callback(wakeup_secondary_cpu_64, acpi_wakeup_cpu);
8083

8184
return 0;

include/linux/cc_platform.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,6 @@ enum cc_attr {
8181
*/
8282
CC_ATTR_GUEST_SEV_SNP,
8383

84-
/**
85-
* @CC_ATTR_HOTPLUG_DISABLED: Hotplug is not supported or disabled.
86-
*
87-
* The platform/OS is running as a guest/virtual machine does not
88-
* support CPU hotplug feature.
89-
*
90-
* Examples include TDX Guest.
91-
*/
92-
CC_ATTR_HOTPLUG_DISABLED,
93-
9484
/**
9585
* @CC_ATTR_HOST_SEV_SNP: AMD SNP enabled on the host.
9686
*

kernel/cpu.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,8 +1481,7 @@ static int cpu_down_maps_locked(unsigned int cpu, enum cpuhp_state target)
14811481
* If the platform does not support hotplug, report it explicitly to
14821482
* differentiate it from a transient offlining failure.
14831483
*/
1484-
if (cc_platform_has(CC_ATTR_HOTPLUG_DISABLED) ||
1485-
cpu_hotplug_offline_disabled)
1484+
if (cpu_hotplug_offline_disabled)
14861485
return -EOPNOTSUPP;
14871486
if (cpu_hotplug_disabled)
14881487
return -EBUSY;

0 commit comments

Comments
 (0)