]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
arm64: Kconfig: Enable hotplug CPU on arm64 if ACPI_PROCESSOR is enabled.
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 29 May 2024 13:34:44 +0000 (14:34 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 28 Jun 2024 17:38:32 +0000 (18:38 +0100)
In order to move arch_register_cpu() to be called via the same path
for initially present CPUs described by ACPI and hotplugged CPUs
ACPI_HOTPLUG_CPU needs to be enabled.

The protection against invalid IDs in acpi_map_cpu() is needed as
at least one production BIOS is in the wild which reports entries
in DSDT (with no _STA method, so assumed enabled and present)
that don't match MADT.

Tested-by: Miguel Luis <miguel.luis@oracle.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20240529133446.28446-18-Jonathan.Cameron@huawei.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/Kconfig
arch/arm64/kernel/acpi.c

index 5d91259ee7b53a36f32b84512706c9f9a09d6620..e8f2ef2312db87a237bac7a6e5fa4a0abc31d11c 100644 (file)
@@ -5,6 +5,7 @@ config ARM64
        select ACPI_CCA_REQUIRED if ACPI
        select ACPI_GENERIC_GSI if ACPI
        select ACPI_GTDT if ACPI
+       select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR
        select ACPI_IORT if ACPI
        select ACPI_REDUCED_HARDWARE_ONLY if ACPI
        select ACPI_MCFG if (ACPI && PCI)
index e0e7b93c16cc430f5e60be3ebc23f58818c89d48..9360ba86678bf89cf0d7358f27e423789fe6be54 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/pgtable.h>
 
 #include <acpi/ghes.h>
+#include <acpi/processor.h>
 #include <asm/cputype.h>
 #include <asm/cpu_ops.h>
 #include <asm/daifflags.h>
@@ -423,6 +424,27 @@ void arch_reserve_mem_area(acpi_physical_address addr, size_t size)
        memblock_mark_nomap(addr, size);
 }
 
+#ifdef CONFIG_ACPI_HOTPLUG_CPU
+int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 apci_id,
+                int *pcpu)
+{
+       /* If an error code is passed in this stub can't fix it */
+       if (*pcpu < 0) {
+               pr_warn_once("Unable to map CPU to valid ID\n");
+               return *pcpu;
+       }
+
+       return 0;
+}
+EXPORT_SYMBOL(acpi_map_cpu);
+
+int acpi_unmap_cpu(int cpu)
+{
+       return 0;
+}
+EXPORT_SYMBOL(acpi_unmap_cpu);
+#endif /* CONFIG_ACPI_HOTPLUG_CPU */
+
 #ifdef CONFIG_ACPI_FFH
 /*
  * Implements ARM64 specific callbacks to support ACPI FFH Operation Region as