Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3178216ybd; Fri, 28 Jun 2019 04:16:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqyiaiPOo55VBXRl+gQG+SjEkCpHnTOWXcSCKtpLaTfkQzO+vfIii5Yl4UkQxsmZN832d6+r X-Received: by 2002:a17:902:22e:: with SMTP id 43mr4792220plc.272.1561720612147; Fri, 28 Jun 2019 04:16:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561720612; cv=none; d=google.com; s=arc-20160816; b=CSFTwzx8cjr7vJtGcwBiSMVaaIQYB+750ciH5cuhjq/D535DsHxdC8YkE2jSJvYPmU B4QpDTQ2FuHJJQZSZ27GBvhcYjeMIkEMy1IlOIcYK0umlQta08NDIvf1y5OYmYXrCNLF IvXtHkWBSr1NFyTlABPQgoRFYAvZz2P5S4cRAnAPHnotkdIsY93D93+MF5Is7OJW0zkL EPzEazdmvU0RXs/ByeivVcs1HSi1s/jXlsUDKiElDoe2BV1GWb1kFBtQtZm8nfNBd6Fa JlpWRnkZ86SqSAE3IOPxKJcLTCiR+K2AudYi9LvdnuTCJVqjfhhNgeW12cN1nKw+Xvrx 1eTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=Lko1I2YSaf4Ijym09nTDKdLjvFoo/eLVhUff/BSyRj8=; b=rxxAcPFq3dp5NudDh5kqTT7DbEnPWDiw0sjVaQWTWRa5t3Rig7+KdnBnVrKnNSd3Vu gDPmIicuEEGhoVW0CSXFoFf7MmETngQNiJyPwxryiVNs0QRfHVVXcVEoWe1gZ/Xwgzmt jXvwZU+WeAxE5/OPJS3jwF72bPIzeZrAAYMaK1wfEy53AryxFzxxSauCSTvS3eopsA8j g/LZNxFfFMNJSybtiJdq16xEZZDLfksXcC58cHp+72jQBjWUxg08rPovZZANBnDJAr6l RCu49qPRXz3q1YJzLvQKEeONPwYcXqHNhtrqJS4MrtDu6FS/DeXxp3OPhsRUfuggwCcB CN+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a6si1949487pjo.91.2019.06.28.04.16.35; Fri, 28 Jun 2019 04:16:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726812AbfF1LQI (ORCPT + 99 others); Fri, 28 Jun 2019 07:16:08 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:7671 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726502AbfF1LQC (ORCPT ); Fri, 28 Jun 2019 07:16:02 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 0E03344E5B2ADD913F67; Fri, 28 Jun 2019 19:16:01 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.439.0; Fri, 28 Jun 2019 19:15:51 +0800 From: Xiongfeng Wang To: , , CC: , , , , , , , , Subject: [PATCH RFC 3/3] arm64: Add CPU hotplug support Date: Fri, 28 Jun 2019 19:13:12 +0800 Message-ID: <1561720392-45907-4-git-send-email-wangxiongfeng2@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1561720392-45907-1-git-send-email-wangxiongfeng2@huawei.com> References: <1561720392-45907-1-git-send-email-wangxiongfeng2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 ed46dc1..0e7b4f5 100644 --- a/arch/arm64/kernel/acpi.c +++ b/arch/arm64/kernel/acpi.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -257,3 +258,24 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr) return __pgprot(PROT_NORMAL_NC); return __pgprot(PROT_DEVICE_nGnRnE); } + +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 a82d0c2..7b1a675 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -429,3 +429,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