Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp281832ybd; Fri, 28 Jun 2019 19:45:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGJpLfXfUH1nZCkkCrESTUTp9M9V/cxADZmYxO5/ONGYzbXfwvH61rNRadeou4shBVsIkd X-Received: by 2002:a63:1a03:: with SMTP id a3mr11676133pga.397.1561776352390; Fri, 28 Jun 2019 19:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561776352; cv=none; d=google.com; s=arc-20160816; b=bHNAkSLK8/GDblPYz/+2xWIr0C4ujL8jdiSkH0LVpDjA+UE18EAA5bjtfGEt8SFgsj TvSLOoW1fond1PwuDnKLWleasuQs/Yc4aB5FCCoGJqS1AgWUqg9oJ+fSjvjNJqu6rDwu vGg3kjl9OA8We79FjNr0ZRRzHcaXvdf6UmU66x7Uc5F0nJozsmecnG5jZfkBTDHtfUlK 6xFWX5GWeQU7xK5BYtTjZq5Dv54bQlcUi6N4RehN2iNuYq9hT1soBq961GA1Ks3aaF/s Di40wsZCAaiH+jp0RwWFdL2ru/t3hEFYl+F5WMzQZ3msfch09nG/MjIRGiYRd6ul21LK youg== 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=Nz0Vw6IG26Lc0iJHGF9Y2J2jhR3n+PNe/w+sPrlA1J0=; b=l7HojU0ANqsd5tKFtA1+xH9b0mofBrVy7SYD25PJymypr12Fk9FkXZpQnjG8C2A71E VHvpPisbJZWkQA3INSymR5WHQ2feGtJifwLYUlLukpwq02dXD/oK1KRLeFwZFtLLTgvw qdoklDae0J+UQAqqLo5+T3kXHUD2mhPmBuxI/xh2wMrfbSbeAfIWWltcOn5LMvPOaFTn KQMdzVsEq6OjiJrJ/po4oQ/6CSbafEU6Kkw1OZ1m8HqtxAQwp2Z9JI4PjjvzskoYQcNb 7KqdhiLWZzvC/HbJ5fw6OvALog67xGqoJZKmjqyIaSg0igD4S9Zig7i9vw76JWQS9S03 3dhw== 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 l21si3491480pgb.409.2019.06.28.19.45.36; Fri, 28 Jun 2019 19:45: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 S1726809AbfF2Cox (ORCPT + 99 others); Fri, 28 Jun 2019 22:44:53 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8241 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726708AbfF2Cox (ORCPT ); Fri, 28 Jun 2019 22:44:53 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 24138748E1AEC8CEF4C4; Sat, 29 Jun 2019 10:44:51 +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; Sat, 29 Jun 2019 10:44:43 +0800 From: Xiongfeng Wang To: , , CC: , , , , , , , , Subject: [RFC PATCH v2 3/3] arm64: Add CPU hotplug support Date: Sat, 29 Jun 2019 10:42:35 +0800 Message-ID: <1561776155-38975-4-git-send-email-wangxiongfeng2@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1561776155-38975-1-git-send-email-wangxiongfeng2@huawei.com> References: <1561776155-38975-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 2804330..57835fa 100644 --- a/arch/arm64/kernel/acpi.c +++ b/arch/arm64/kernel/acpi.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -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