From patchwork Fri Feb 3 13:50:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Morse X-Patchwork-Id: 52508 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp850808wrn; Fri, 3 Feb 2023 05:57:42 -0800 (PST) X-Google-Smtp-Source: AK7set+j8Pl/TljtIfwqWhCZ89O2WwdDhrUfxhTviJoAwUmnSrKG+B3sTnUur/DQPfEn/9z3wyS6 X-Received: by 2002:a50:fb81:0:b0:498:b9ea:1894 with SMTP id e1-20020a50fb81000000b00498b9ea1894mr11012518edq.15.1675432662172; Fri, 03 Feb 2023 05:57:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675432662; cv=none; d=google.com; s=arc-20160816; b=vBc4TZJ7aSeD8Iz5jrIjvVe43O8jQ614XX0XOXasUbKxi6ntgVe4VGr1uvQ1UCewW6 BRdnPDL1AKGhB2Gonk/QdLCERGGLR3Mr3ZuF/ro5chr4PG/f1WRdhmkT5RbD2Pq467ym qbLPlJTsEJKD1CzOvs7ZIOi8UClEEQNtlI0+iOnra1v3U4P7i9ANVvQiYhWI03Uw7kI2 7Ke0nksvHQ/CPJhgeATJt8Gek2V6KTVTBDGRWVN5Xao/hhtJWSRujP26ILRuFJMuQzaH Hemo2Cd0cwzXeOT7bL5SXE2g6Zhe6DXHrh9/+Tfg7nVzdWxCFYkyUMPMyiMUyFRGRiza uGZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=yQ/OIl8FlmeasMNRtAfLOw0XHFeTHWeaKVUDn7F7d5g=; b=TTSfStLD8f3WQz0zpM2z0dFxFJw9MINCimCL99sy2+aoU2lua6NCx7nQfjm2rUWTjX 2wCGYXWPZ8CYRwYEPTdvizNI+C47wsMN1iu4oHzak2nhB/qI7vxqDN6/Twoo+SWRUiVJ eXM4gFa4dEsEAg1FNTuQKL1Ujk6pDDnX6NbevPQU9kRyc3WDbHxXKa7FvlwMSGPL+OB9 U+FpGOgmWUmslgRHzXlM2VW8GQZBSmluqmutUFThaICC3DJYpDF4XD4WD7rhQJ0povkW +X73JxwhrMjNr8Xp4ci7Y+7OwAvlYvJbCuOmYr3jkQkGrouDLDfLBr4m9vI1+gp3JOUu 88PA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f5-20020aa7d845000000b004a0ada3435esi2878897eds.414.2023.02.03.05.57.17; Fri, 03 Feb 2023 05:57:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233149AbjBCN4l (ORCPT + 99 others); Fri, 3 Feb 2023 08:56:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233647AbjBCN4H (ORCPT ); Fri, 3 Feb 2023 08:56:07 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1041EA77BC; Fri, 3 Feb 2023 05:54:01 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 789391682; Fri, 3 Feb 2023 05:54:01 -0800 (PST) Received: from eglon.cambridge.arm.com (eglon.cambridge.arm.com [10.1.196.177]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AA6F23F71E; Fri, 3 Feb 2023 05:53:15 -0800 (PST) From: James Morse To: linux-pm@vger.kernel.org, loongarch@lists.linux.dev, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org Cc: Marc Zyngier , Thomas Gleixner , Lorenzo Pieralisi , Mark Rutland , Sudeep Holla , Borislav Petkov , H Peter Anvin , Dave Hansen , Ingo Molnar , Will Deacon , Catalin Marinas , Huacai Chen , James Morse , Suzuki K Poulose , Oliver Upton , Len Brown , Rafael Wysocki , WANG Xuerui , Salil Mehta , Russell King , Jean-Philippe Brucker Subject: [RFC PATCH 20/32] drivers: base: Implement weak arch_unregister_cpu() Date: Fri, 3 Feb 2023 13:50:31 +0000 Message-Id: <20230203135043.409192-21-james.morse@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230203135043.409192-1-james.morse@arm.com> References: <20230203135043.409192-1-james.morse@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756818479118901017?= X-GMAIL-MSGID: =?utf-8?q?1756818479118901017?= Add arch_unregister_cpu() to allow the ACPI machinery to call unregister_cpu(). This is enough for arm64, but needs to be overridden by x86 and ia64 who need to do more work. CC: Jean-Philippe Brucker Signed-off-by: James Morse --- arch/ia64/include/asm/cpu.h | 4 ---- arch/loongarch/include/asm/cpu.h | 6 ------ arch/x86/include/asm/cpu.h | 1 - drivers/base/cpu.c | 5 +++++ 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/arch/ia64/include/asm/cpu.h b/arch/ia64/include/asm/cpu.h index 6e9786c6ec98..3b36c6a382bb 100644 --- a/arch/ia64/include/asm/cpu.h +++ b/arch/ia64/include/asm/cpu.h @@ -9,8 +9,4 @@ DECLARE_PER_CPU(int, cpu_state); -#ifdef CONFIG_HOTPLUG_CPU -extern void arch_unregister_cpu(int); -#endif - #endif /* _ASM_IA64_CPU_H_ */ diff --git a/arch/loongarch/include/asm/cpu.h b/arch/loongarch/include/asm/cpu.h index 1e2c7c61dbea..754f28506791 100644 --- a/arch/loongarch/include/asm/cpu.h +++ b/arch/loongarch/include/asm/cpu.h @@ -124,10 +124,4 @@ enum cpu_type_enum { #define LOONGARCH_CPU_GUESTID BIT_ULL(CPU_FEATURE_GUESTID) #define LOONGARCH_CPU_HYPERVISOR BIT_ULL(CPU_FEATURE_HYPERVISOR) -#if !defined(__ASSEMBLY__) -#ifdef CONFIG_HOTPLUG_CPU -extern void arch_unregister_cpu(int); -#endif -#endif /* ! __ASSEMBLY__ */ - #endif /* _ASM_CPU_H */ diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h index 2955541abebb..e5d820be3b72 100644 --- a/arch/x86/include/asm/cpu.h +++ b/arch/x86/include/asm/cpu.h @@ -24,7 +24,6 @@ static inline void prefill_possible_map(void) {} #endif /* CONFIG_SMP */ #ifdef CONFIG_HOTPLUG_CPU -extern void arch_unregister_cpu(int); extern void start_cpu0(void); #ifdef CONFIG_DEBUG_HOTPLUG_CPU0 extern int _debug_hotplug_cpu(int cpu, int action); diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 0ba646022a5e..bc2ce8c7f383 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -498,6 +498,11 @@ int __weak arch_register_cpu(int cpu) { return register_cpu(&per_cpu(cpu_devices, cpu), cpu); } + +void __weak arch_unregister_cpu(int num) +{ + unregister_cpu(&per_cpu(cpu_devices, num)); +} #endif static void __init cpu_dev_register_generic(void)