Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5289162rdb; Wed, 13 Dec 2023 04:49:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IEVWvXFAps64n0/K1CsvSk3tglHr4cHuGhyU88KbRhBiw1y2jT9lXejbEHs1oHjxagFYa4H X-Received: by 2002:a17:902:728e:b0:1d0:98bf:f9ff with SMTP id d14-20020a170902728e00b001d098bff9ffmr7707606pll.117.1702471790094; Wed, 13 Dec 2023 04:49:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702471790; cv=none; d=google.com; s=arc-20160816; b=APDLt1fTNr4d4WZKRdlod4CQTKREllF9UL6HoSxTG9rljKjZukqorq4IlzFJcRJCw6 Sa5gLhgmKkMIFJYqZfkKDkr5BzEcD6XY5BccX/aFAfaZUzdAmKqROUX2GDjxFOvpFxGx zZPhNKy/txLYdkmr1cS5BDnO1K7qDflj/lCGiox35NfoTxp1uz00eQ2dvnPZ1Zy734xa mTzmSRdlooLDagcae4JUdT85vMZNIz+dJ8NBJvk9vp11eMNmKZp1It0L7Y8Xo86vWLw+ KO1vxZ6slP+vunfYWpNazA/4rOPE0gtHAJlXfUWn7O0CAov3KD0UIZXEnrmqZ9Fhcik9 Er9Q== 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=ZKS6pxC2YYfNhWwg82WjEwf9+rWwSBqqkCpc9wbmrvU=; fh=YWIBRcP8cdLYR894sEToaan3lN1VSUITe+B678IO0WY=; b=qDohqHCSzCCawekDm+dut3AkQPyhYpKI4QYrSP/y1D8eXbYTt7T0rZp6QKYAxWltG5 MWOx7PUK79+SLTubMjEilGji1HJ71Pb6MR9aBCqcUEHSIQmxsUHTy7P/IeMzX+i94CIx +TaB6rxx3BzjVArVcdVru74AtGVme0Yh22S7yCZArtYkyC1mwP0dQimDfN5Y+ZSDSpt+ vJa2uFwYgLQEIud48dwzFWAx23dED23RtVxtijL6r4yElk0YCx9cZDJqJ4ge9Y+Pt7v4 dRstdzStoy/Uy94dqukltZ71hWad6GHH4w1WNPcBGTP3GZn96fWY5WKMjn6WH5WyxHue itpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b="Jf/e7+SM"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id d18-20020a170903231200b001d096bcfc22si9871569plh.340.2023.12.13.04.49.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 04:49:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b="Jf/e7+SM"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 1A1AF80C0A4E; Wed, 13 Dec 2023 04:49:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378904AbjLMMtf (ORCPT + 99 others); Wed, 13 Dec 2023 07:49:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378893AbjLMMte (ORCPT ); Wed, 13 Dec 2023 07:49:34 -0500 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 BA309E4; Wed, 13 Dec 2023 04:49:37 -0800 (PST) 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=ZKS6pxC2YYfNhWwg82WjEwf9+rWwSBqqkCpc9wbmrvU=; b=Jf/e7+SMOBjpGIMb6Uk/wbjene LjN9KE/FW0snbFyWyMg6pDKsB+5IvmUU5qN5LnEIjVwaaA5a9S9TaSUdqA0JE4nxCdtkeW6f6yJHb Hpc+dvKih6ImW7DLJIuhosO/yJrIojS6z7MetDq6D4qLRtlFNRtkyCLtoH/8s7HGj46i9aqItRpnM jIgdW7rw8xlYZl80cDI26htD87Prb0hKAY5Up92iSfUG3f3NoIX5VHMpIzaLyhydFkSMyyeXzsocJ lgGarR0gEODrCWvRZO4uKb4MDZSwGZabqarJ6yQTqSXPxUFiSDdq2FTl2Zlz/IElIPZUXQQy49IWc Ci+FbtPw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:43378 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 1rDOg5-0008DO-2J; Wed, 13 Dec 2023 12:49:30 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1rDOg7-00Dvjq-VZ; Wed, 13 Dec 2023 12:49:32 +0000 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, acpica-devel@lists.linuxfoundation.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 RFC v3 04/21] 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: Wed, 13 Dec 2023 12:49:31 +0000 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Dec 2023 04:49:49 -0800 (PST) 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 Tested-by: Miguel Luis Tested-by: Vishnu Pajjuri Tested-by: Jianyong Wu 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 47de0f140ba6..13d052bf13f4 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -553,7 +553,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