[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1561776155-38975-4-git-send-email-wangxiongfeng2@huawei.com>
Date: Sat, 29 Jun 2019 10:42:35 +0800
From: Xiongfeng Wang <wangxiongfeng2@...wei.com>
To: <rjw@...ysocki.net>, <catalin.marinas@....com>,
<james.morse@....com>
CC: <linux-acpi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <guohanjun@...wei.com>,
<xiexiuqi@...wei.com>, <huawei.libin@...wei.com>,
<john.garry@...wei.com>, <jonathan.cameron@...wei.com>,
<wangxiongfeng2@...wei.com>
Subject: [RFC PATCH v2 3/3] arm64: Add CPU hotplug support
To support CPU hotplug, we need to implement 'acpi_(un)map_cpu()' and
'arch_(un)register_cpu()' for ARM64. These functions are called in
'acpi_processor_hotadd_init()/acpi_processor_remove()' when the CPU is hot
added into or hot removed from the system.
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@...wei.com>
---
arch/arm64/kernel/acpi.c | 22 ++++++++++++++++++++++
arch/arm64/kernel/setup.c | 17 +++++++++++++++++
2 files changed, 39 insertions(+)
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 2804330..57835fa 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -25,6 +25,7 @@
#include <linux/serial_core.h>
#include <acpi/ghes.h>
+#include <acpi/processor.h>
#include <asm/cputype.h>
#include <asm/cpu_ops.h>
#include <asm/daifflags.h>
@@ -284,3 +285,24 @@ int apei_claim_sea(struct pt_regs *regs)
return err;
}
+
+int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id,
+ int *pcpu)
+{
+ int cpu;
+
+ cpu = acpi_map_cpuid(physid, acpi_id);
+ *pcpu = cpu;
+ set_cpu_present(cpu, true);
+
+ return 0;
+}
+EXPORT_SYMBOL(acpi_map_cpu);
+
+int acpi_unmap_cpu(int cpu)
+{
+ set_cpu_present(cpu, false);
+
+ return 0;
+}
+EXPORT_SYMBOL(acpi_unmap_cpu);
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 7f4d12a..f2a881e 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -398,3 +398,20 @@ static int __init register_kernel_offset_dumper(void)
return 0;
}
__initcall(register_kernel_offset_dumper);
+
+int arch_register_cpu(int num)
+{
+ struct cpu *cpu = &per_cpu(cpu_data.cpu, num);
+
+ cpu->hotpluggable = 1;
+ return register_cpu(cpu, num);
+}
+EXPORT_SYMBOL(arch_register_cpu);
+
+void arch_unregister_cpu(int num)
+{
+ struct cpu *cpu = &per_cpu(cpu_data.cpu, num);
+
+ unregister_cpu(cpu);
+}
+EXPORT_SYMBOL(arch_unregister_cpu);
--
1.7.12.4
Powered by blists - more mailing lists