From patchwork Thu Sep 14 14:47:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13385534 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AA0A8EEAA4F for ; Thu, 14 Sep 2023 14:48:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:MIME-Version:Subject:Cc :From:To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=z5jtvlmzGHIPPDcJ7uny5ciuKrmNkdA5ZxCvpk/2z48=; b=nmtITbeBPxgIbS f8mSS72EHNMlLFApxM1GNXzSGAVNQpO93DpE1QKRgJpBoeR3sOXujXScyM5UA2XpHhqmZNfPaC4U9 UFOMLg8iklIo18qJV/n9ZeLHFu0Zpa6mJ5RPszw2woDZIxxrouEGZk/j/iSRrzCzK+npoevpR8z5x MsqzOktaYP3zcP7uoVkhwsK4xOakmyZH4y9F1NHuBVHCsymjY6gnlO1ACrg3X6Rn63Wa/p/YK8NMy a+sR3Y9tAGmUbxFJNWvGLmnRfyMbPDDUiEFmT0Cqw6j8iAJQTOfWrwk4Yn8V7WdusSmG2gKVXdHBi ygoQpIq93yHSOuUin4lg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qgndF-008gAL-1b; Thu, 14 Sep 2023 14:47:49 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qgndB-008g91-1X for linux-arm-kernel@lists.infradead.org; Thu, 14 Sep 2023 14:47:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:From:To:Reply-To:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=k/kzubGMoF55SY8q/NSTULYXd8nOQVDVaZO5jElyano=; b=dBVhc8oknmbKL8K6SMVUV7f8Iq x/L3g6I+OXnEQzlek24sVI6zZt3F1Mp//EWFJENAl5DLknigcxE+wIFrBH4QtwaBOvy4kQzw86szc bspe08fwfuPk4ezDVX49czJQqmZKnI4d5Yq+j9k/dhj0JlOzL+9CTy9JBMIRs7JlxeOkzQNBHi8iX iIHg/PccSEOhvYpUzMo5EHC0DHTh1fWWX4N3HCewZ62JfQThx5971APFS7Q5KOwuruOFp4Pt5rSf+ V16Nl7DCjt1Bsm4r8eZaOKsAlIRsOGEiKCsiS+Ncm//5HeiShoBkg9Nnp/HlLl+8aC41Y38BzufZN hLUi7wcg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:46516 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qgnd2-0004Nf-2B; Thu, 14 Sep 2023 15:47:36 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qgnd3-007ZQF-Ds; Thu, 14 Sep 2023 15:47:37 +0100 From: "Russell King (Oracle)" To: linux-acpi@vger.kernel.org, James Morse Subject: [PATCH RFC] cpu-hotplug: provide prototypes for arch CPU registration MIME-Version: 1.0 From: "Russell King (Oracle)" Cc: loongarch@lists.linux.dev, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com, Borislav Petkov , Dave Hansen , Salil Mehta , x86@kernel.org, "H. Peter Anvin" , Peter Zijlstra , linux-ia64@vger.kernel.org Subject: [PATCH] cpu-hotplug: provide prototypes for arch CPU registration MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Thu, 14 Sep 2023 15:47:37 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230914_074745_659353_26E846DF X-CRM114-Status: GOOD ( 17.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Provide common prototypes for arch_register_cpu() and arch_unregister_cpu(). These are called by acpi_processor.c, with weak versions, so the prototype for this is already set. It is generally not necessary for function prototypes to be conditional on preprocessor macros. Some architectures (e.g. Loongarch) are missing the prototype for this, and rather than add it to Loongarch's asm/cpu.h, lets do the job once for everyone. Since this covers everyone, remove the now unnecessary prototypes in asm/cpu.h, and we also need to remove the 'static' from one of ia64's arch_register_cpu() definitions. Signed-off-by: Russell King (Oracle) --- Spotted during the review of James Morse's patches, I think rather than adding prototypes for loongarch to its asm/cpu.h, it would make more sense to provide the prototypes in a non-arch specific header file so everyone can benefit, rather than having each architecture do its own thing. I'm sending this as RFC as James has yet to comment on my proposal, and also to a wider audience, and although it makes a little more work for James (to respin his series) it does mean that his series should get a little smaller. See: https://lore.kernel.org/r/20230913163823.7880-2-james.morse@arm.com https://lore.kernel.org/r/20230913163823.7880-4-james.morse@arm.com https://lore.kernel.org/r/20230913163823.7880-23-james.morse@arm.com arch/ia64/include/asm/cpu.h | 5 ----- arch/ia64/kernel/topology.c | 2 +- arch/x86/include/asm/cpu.h | 2 -- include/linux/cpu.h | 2 ++ 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/arch/ia64/include/asm/cpu.h b/arch/ia64/include/asm/cpu.h index db125df9e088..642d71675ddb 100644 --- a/arch/ia64/include/asm/cpu.h +++ b/arch/ia64/include/asm/cpu.h @@ -15,9 +15,4 @@ DECLARE_PER_CPU(struct ia64_cpu, cpu_devices); DECLARE_PER_CPU(int, cpu_state); -#ifdef CONFIG_HOTPLUG_CPU -extern int arch_register_cpu(int num); -extern void arch_unregister_cpu(int); -#endif - #endif /* _ASM_IA64_CPU_H_ */ diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c index 94a848b06f15..741863a187a6 100644 --- a/arch/ia64/kernel/topology.c +++ b/arch/ia64/kernel/topology.c @@ -59,7 +59,7 @@ void __ref arch_unregister_cpu(int num) } EXPORT_SYMBOL(arch_unregister_cpu); #else -static int __init arch_register_cpu(int num) +int __init arch_register_cpu(int num) { return register_cpu(&sysfs_cpus[num].cpu, num); } diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h index 3a233ebff712..25050d953eee 100644 --- a/arch/x86/include/asm/cpu.h +++ b/arch/x86/include/asm/cpu.h @@ -28,8 +28,6 @@ struct x86_cpu { }; #ifdef CONFIG_HOTPLUG_CPU -extern int arch_register_cpu(int num); -extern void arch_unregister_cpu(int); extern void soft_restart_cpu(void); #endif diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 0abd60a7987b..eb768a866fe3 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -80,6 +80,8 @@ extern __printf(4, 5) struct device *cpu_device_create(struct device *parent, void *drvdata, const struct attribute_group **groups, const char *fmt, ...); +extern int arch_register_cpu(int cpu); +extern void arch_unregister_cpu(int cpu); #ifdef CONFIG_HOTPLUG_CPU extern void unregister_cpu(struct cpu *cpu); extern ssize_t arch_cpu_probe(const char *, size_t); -- 2.30.2 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Provide common prototypes for arch_register_cpu() and arch_unregister_cpu(). These are called by acpi_processor.c, with weak versions, so the prototype for this is already set. It is generally not necessary for function prototypes to be conditional on preprocessor macros. Some architectures (e.g. Loongarch) are missing the prototype for this, and rather than add it to Loongarch's asm/cpu.h, lets do the job once for everyone. Since this covers everyone, remove the now unnecessary prototypes in asm/cpu.h Signed-off-by: Russell King (Oracle) --- arch/ia64/include/asm/cpu.h | 5 ----- arch/x86/include/asm/cpu.h | 2 -- include/linux/cpu.h | 2 ++ 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/ia64/include/asm/cpu.h b/arch/ia64/include/asm/cpu.h index db125df9e088..642d71675ddb 100644 --- a/arch/ia64/include/asm/cpu.h +++ b/arch/ia64/include/asm/cpu.h @@ -15,9 +15,4 @@ DECLARE_PER_CPU(struct ia64_cpu, cpu_devices); DECLARE_PER_CPU(int, cpu_state); -#ifdef CONFIG_HOTPLUG_CPU -extern int arch_register_cpu(int num); -extern void arch_unregister_cpu(int); -#endif - #endif /* _ASM_IA64_CPU_H_ */ diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h index 3a233ebff712..25050d953eee 100644 --- a/arch/x86/include/asm/cpu.h +++ b/arch/x86/include/asm/cpu.h @@ -28,8 +28,6 @@ struct x86_cpu { }; #ifdef CONFIG_HOTPLUG_CPU -extern int arch_register_cpu(int num); -extern void arch_unregister_cpu(int); extern void soft_restart_cpu(void); #endif diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 0abd60a7987b..eb768a866fe3 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -80,6 +80,8 @@ extern __printf(4, 5) struct device *cpu_device_create(struct device *parent, void *drvdata, const struct attribute_group **groups, const char *fmt, ...); +extern int arch_register_cpu(int cpu); +extern void arch_unregister_cpu(int cpu); #ifdef CONFIG_HOTPLUG_CPU extern void unregister_cpu(struct cpu *cpu); extern ssize_t arch_cpu_probe(const char *, size_t);