Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1961328rda; Tue, 24 Oct 2023 08:18:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE7CgiAudxsgrQ+MOYplzmV6IsGzENZ+1noPx72/zr28aSAaHuHqtnYKTt1xM9ooQ087HQY X-Received: by 2002:a05:6a20:da9e:b0:174:7f7:d049 with SMTP id iy30-20020a056a20da9e00b0017407f7d049mr3404321pzb.9.1698160727016; Tue, 24 Oct 2023 08:18:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698160727; cv=none; d=google.com; s=arc-20160816; b=J0WEGz7Rix+cuv2ZMfvb9HfuCR7icd116TYpEpKEG22OZI75FLaRMNs5g06TGgkSGL MM84twbOLuBupBjKwMFgLeAxwq3rsdJcQkI4Qli8R66tuQ51KSGT72hD/+jsU59mQBuK cvU5gtG9OxykVa/hnDXmNbACj5A4a+KZCRHF6enZv5K14+43p8JokU9MyBpqf1hBo7I+ tXY9wP3rQtfFoGA7+09/3m2ilMF2oZDOZdUUl3dRN+Gqluu/ZA3LZRnC3LuwedCQp6K0 2oZlaOdMluH+rwiZdq3ERZWSfsTp9av67KO7XIwamjjCdn8Lsd4bHxM6CazHd7jUT3cf kHuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:sender:message-id:content-transfer-encoding :content-disposition:mime-version:subject:cc:to:from:references :in-reply-to:dkim-signature; bh=BN0vsLWemtYAq9+Im9GUXPxMyA6YabHvnG3SH5iIqk8=; fh=TLHmviFev59JGLubWtuNqtQ8Hm4/QBoiyXiI5fiLVDk=; b=dMCwh8D51bjqS7d0s/lgFYBwaiJP2xdEojjlBccW5t+0MjRmuGi0nhAt1EBoDoNeSB nM36Lv4jueultmAzUan0cpgbdOWjmwGS/NGKrerdNKODrqSnmxmqKOqOJhAMtgbJGHn9 tewhMFrxjz6cgTK9xHsi48s2LvioFQLcClkiplh57I4RahIsljwela1/J+4p46Jmk4uY A8ntCM5UhU940SutIumhGk93gOcPaGdFw1uK28ti7Hus/NMNNkiRMdblF9BVqIRklKPg VXeD8c63I4bm8zjeMUqCUzhZY5NB+FDQ3eHKQw5/18VuQjCy8WC8SaSFaPo6xW5kOeLx hjuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=rS8lQO9r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id bd33-20020a056a0027a100b006bdb7c5f75dsi8658605pfb.357.2023.10.24.08.18.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 08:18:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=rS8lQO9r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 86D23807D997; Tue, 24 Oct 2023 08:18:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343731AbjJXPSd (ORCPT + 99 others); Tue, 24 Oct 2023 11:18:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234774AbjJXPR4 (ORCPT ); Tue, 24 Oct 2023 11:17:56 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2417D1712; Tue, 24 Oct 2023 08:17:17 -0700 (PDT) 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:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=BN0vsLWemtYAq9+Im9GUXPxMyA6YabHvnG3SH5iIqk8=; b=rS8lQO9r3WZ09VV1OqVNusV9SL ujSkNet/X+0I6cmL0TrLgnv50krvNgaY0VFGFzWKKsT7K4lkz2nbe3mn+Z21r5lB2O7fhEVrZIVqD 8z6Vm12X48ckRwNT7PMCI3rtIBOk77rgMbNIJHZ7eefPEFSCLBCq3d8D5AwacGvNgfe54OEzJq0tn fCXc1xPO0Cx7BZYefjESxgu39c05XNiF0G6e6rfeFr0/yzeoK1Tf3NX07gWPgzXXn87qujSy6F+wy OAFNitwQxJCxc0/dB7FAN7KK2BEA9IlijizK8vfcAgb3AvrY+mbRsXierpJduNKYbKmZlvvb+NjMW 5wO4nCeg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:40922 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 1qvJ9b-0004Og-0J; Tue, 24 Oct 2023 16:17:11 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qvJ9b-00AqPz-1E; Tue, 24 Oct 2023 16:17:11 +0100 In-Reply-To: References: From: Russell King (Oracle) To: linux-pm@vger.kernel.org, loongarch@lists.linux.dev, linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, kvmarm@lists.linux.dev, x86@kernel.org, linux-csky@vger.kernel.org, linux-doc@vger.kernel.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org Cc: Salil Mehta , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com, James Morse Subject: [PATCH 12/39] ia64/topology: Switch over to GENERIC_CPU_DEVICES MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Tue, 24 Oct 2023 16:17:11 +0100 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 24 Oct 2023 08:18:43 -0700 (PDT) From: James Morse ia64 has its own arch specific data structure for cpus: struct ia64_cpu. This has one member, making ia64's cpu_devices the same as that provided be GENERIC_CPU_DEVICES. ia64 craetes a percpu struct ia64_cpu called cpu_devices, which has no users. Instead it uses the struct ia64_cpu named sysfs_cpus allocated at boot. Remove the arch specific structure allocation and initialisation. ia64's arch_register_cpu() now overrides the weak version from GENERIC_CPU_DEVICES, and uses the percpu cpu_devices defined by core code. All uses of sysfs_cpus are changed to use the percpu cpu_devices. This is an intermediate step to the logic being moved to drivers/acpi, where GENERIC_CPU_DEVICES will do the work when booting with acpi=off. This patch also has the effect of moving the registration of CPUs from subsys to driver core initialisation, prior to any initcalls running. Signed-off-by: James Morse Signed-off-by: Russell King (Oracle) --- Changes since RFC v2: * Add note about initialisation order change. --- arch/ia64/Kconfig | 1 + arch/ia64/include/asm/cpu.h | 6 ------ arch/ia64/kernel/topology.c | 35 +++++------------------------------ 3 files changed, 6 insertions(+), 36 deletions(-) diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index a3bfd42467ab..06692e1c7c62 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig @@ -42,6 +42,7 @@ config IA64 select HAVE_FUNCTION_DESCRIPTORS select HAVE_VIRT_CPU_ACCOUNTING select HUGETLB_PAGE_SIZE_VARIABLE if HUGETLB_PAGE + select GENERIC_CPU_DEVICES select GENERIC_IRQ_PROBE select GENERIC_PENDING_IRQ if SMP select GENERIC_IRQ_SHOW diff --git a/arch/ia64/include/asm/cpu.h b/arch/ia64/include/asm/cpu.h index 642d71675ddb..3b36c6a382bb 100644 --- a/arch/ia64/include/asm/cpu.h +++ b/arch/ia64/include/asm/cpu.h @@ -7,12 +7,6 @@ #include #include -struct ia64_cpu { - struct cpu cpu; -}; - -DECLARE_PER_CPU(struct ia64_cpu, cpu_devices); - DECLARE_PER_CPU(int, cpu_state); #endif /* _ASM_IA64_CPU_H_ */ diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c index 741863a187a6..8f5cafde2bc9 100644 --- a/arch/ia64/kernel/topology.c +++ b/arch/ia64/kernel/topology.c @@ -26,8 +26,6 @@ #include #include -static struct ia64_cpu *sysfs_cpus; - void arch_fix_phys_package_id(int num, u32 slot) { #ifdef CONFIG_SMP @@ -41,50 +39,27 @@ EXPORT_SYMBOL_GPL(arch_fix_phys_package_id); #ifdef CONFIG_HOTPLUG_CPU int __ref arch_register_cpu(int num) { + struct cpu *cpu = &per_cpu(cpu_devices, num); + /* * If CPEI can be re-targeted or if this is not * CPEI target, then it is hotpluggable */ if (can_cpei_retarget() || !is_cpu_cpei_target(num)) - sysfs_cpus[num].cpu.hotpluggable = 1; + cpu->hotpluggable = 1; map_cpu_to_node(num, node_cpuid[num].nid); - return register_cpu(&sysfs_cpus[num].cpu, num); + return register_cpu(cpu, num); } EXPORT_SYMBOL(arch_register_cpu); void __ref arch_unregister_cpu(int num) { - unregister_cpu(&sysfs_cpus[num].cpu); + unregister_cpu(&per_cpu(cpu_devices, num)); unmap_cpu_from_node(num, cpu_to_node(num)); } EXPORT_SYMBOL(arch_unregister_cpu); -#else -int __init arch_register_cpu(int num) -{ - return register_cpu(&sysfs_cpus[num].cpu, num); -} #endif /*CONFIG_HOTPLUG_CPU*/ - -static int __init topology_init(void) -{ - int i, err = 0; - - sysfs_cpus = kcalloc(NR_CPUS, sizeof(struct ia64_cpu), GFP_KERNEL); - if (!sysfs_cpus) - panic("kzalloc in topology_init failed - NR_CPUS too big?"); - - for_each_present_cpu(i) { - if((err = arch_register_cpu(i))) - goto out; - } -out: - return err; -} - -subsys_initcall(topology_init); - - /* * Export cpu cache information through sysfs */ -- 2.30.2