Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1963120rda; Tue, 24 Oct 2023 08:21:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEkTwu5tbViPLeuOd68GlytiXsAqTELz64lh6ltiXUSNzsT4d7aECiiZjnjAcuyenIMgD+5 X-Received: by 2002:a05:6a21:66c6:b0:174:2a38:9d9c with SMTP id ze6-20020a056a2166c600b001742a389d9cmr3192043pzb.57.1698160890768; Tue, 24 Oct 2023 08:21:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698160890; cv=none; d=google.com; s=arc-20160816; b=I/p1xADbyv8hYV8e26y6qpxKHfhbyH55PVIP68SetMtzCPwW/dl0JRWNgUETqzQxfH hl2KSj3S5jqMHwYhQPiBNYO5plkWOzNazJl4LB7vlG1+7VpK/yXui016ZEo17hTG3WN7 DmYJ9uZsh2t2P3ktuZ9Zuk8POVMmxyMZT1atUfqHarZMJ3B6bumhBgCfbK/4PL1IQFfW nqKESXnrCmeporhXaAe+Ml6/+LYloRy/ra3VJ629WBmuhjh1UTQGVWADsirVrrFJIvNx 52yATIfis6/FX8/fv0vgsUYrMlXV1vFTSe0WErQBJYJrdGE4v4dEzhYtEQ8oy/zOUOii jNTg== 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=43MF1NLwRNfhTgg1mkqqRfKprjgdwDcm6G/emV9tDl0=; fh=NvUsgK7EzfFIiHlwnLV2p+yWoGuANMAKh7icb/OIc3I=; b=Y/6WjgLXfuFZU7G7fiaKU9DpVPONsNAb9nlAqoYyhaLP4STD7A34Yg9XihER/Ns2ua 6GGJtd3xDRQ7nIpS1rPDl3gjEQnA8rmUOa4uLP+Ny/c9pT9Tn6UNSa77sn+fLDC1GcJu TpcrKRhlH7cNg9YGW5FaNS1+WcfQcrWN8L6sqtrcUuxuPUJGkZEuz05ECCX/SyeYt4q9 P5MQLKl993GSiJCkQlTuGPxiDIn6vwWTd9wopGec7/Rq7sBWAodtxwNPsvDMlk78523z 0tV634EhrgAi8lOD0gL9jid3cHUjc6WIxXc3XJCA/8q0AKgbPCg1EUg3aRphF+fq7kG2 UxuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=g7ptT6Qi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id lk2-20020a17090b33c200b002744e9b7a22si11084933pjb.9.2023.10.24.08.21.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 08:21:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=g7ptT6Qi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id A4762809EC89; Tue, 24 Oct 2023 08:21:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343774AbjJXPVC (ORCPT + 99 others); Tue, 24 Oct 2023 11:21:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234860AbjJXPTl (ORCPT ); Tue, 24 Oct 2023 11:19:41 -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 4A6DD26B0; Tue, 24 Oct 2023 08:18:05 -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=43MF1NLwRNfhTgg1mkqqRfKprjgdwDcm6G/emV9tDl0=; b=g7ptT6QiSfF8xD2ND6deIcduSx 1oWNNs2RIYv1m/RJRwbVluHdBvhGUL4sFxBJbBarfzI9j3A0AaPicP3V7vnTwiC+1Crz5pD4H6Nft FRD4WrEAWEOoIdWEHVMlecdkHW4pnDuYuRlMEVHxzA9OEEcYXVpMxsLek0LaMaMDK+VDh/vgUmmVl zt1jroD3eg5bIY/ABoCikdb7n56d6qlDOk6G/yAspE2zGPnfET5SjHWeEl4ofjtNMiKpuYh+27w8l wT87KnyhkgzH6q2bYlY2sJbjZuQQa4MPj1xYVxqhh/Xfh1q/51K2Ghc/azqacAC5+y+ZbcaJQFw5V hQsCbhfA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:50178 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 1qvJAJ-0004S0-2s; Tue, 24 Oct 2023 16:17:55 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qvJAL-00AqQs-BF; Tue, 24 Oct 2023 16:17:57 +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 , "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman Subject: [PATCH 21/39] ACPI: processor: Register all CPUs from acpi_processor_get_info() 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:57 +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 agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 24 Oct 2023 08:21:17 -0700 (PDT) From: James Morse To allow ACPI to skip the call to arch_register_cpu() when the _STA value indicates the CPU can't be brought online right now, move the arch_register_cpu() call into acpi_processor_get_info(). Systems can still be booted with 'acpi=off', or not include an ACPI description at all. For these, the CPUs continue to be registered by cpu_dev_register_generic(). This moves the CPU register logic back to a subsys_initcall(), while the memory nodes will have been registered earlier. Signed-off-by: James Morse Reviewed-by: Gavin Shan Signed-off-by: Russell King (Oracle) --- Changes since RFC v2: * Fixup comment in acpi_processor_get_info() (Gavin Shan) * Add comment in cpu_dev_register_generic() (Gavin Shan) --- drivers/acpi/acpi_processor.c | 12 ++++++++++++ drivers/base/cpu.c | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 0511f2bc10bc..e7ed4730cbbe 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -314,6 +314,18 @@ static int acpi_processor_get_info(struct acpi_device *device) cpufreq_add_device("acpi-cpufreq"); } + /* + * Register CPUs that are present. get_cpu_device() is used to skip + * duplicate CPU descriptions from firmware. + */ + if (!invalid_logical_cpuid(pr->id) && cpu_present(pr->id) && + !get_cpu_device(pr->id)) { + int ret = arch_register_cpu(pr->id); + + if (ret) + return ret; + } + /* * Extra Processor objects may be enumerated on MP systems with * less than the max # of CPUs. They should be ignored _iff diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index d31c936f0955..6c70a004c198 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -537,7 +537,11 @@ static void __init cpu_dev_register_generic(void) { int i, ret; - if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES)) + /* + * When ACPI is enabled, CPUs are registered via + * acpi_processor_get_info(). + */ + if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES) || !acpi_disabled) return; for_each_present_cpu(i) { -- 2.30.2