Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3639607rdb; Wed, 13 Sep 2023 19:58:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE62bMP+7sW9JM+1EMaYccXz8GFimCSA7a5pFqkm6+05VK5vNBckqHseFRsKbWPizbf9Zoh X-Received: by 2002:a17:902:e552:b0:1b8:2ba0:c9a8 with SMTP id n18-20020a170902e55200b001b82ba0c9a8mr4955606plf.2.1694660336933; Wed, 13 Sep 2023 19:58:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694660336; cv=none; d=google.com; s=arc-20160816; b=wQqbtdXAxUt4l0Lc6ltR78gFEvYAzzHsOkZwkqHezEsA0ogrT4EDGQD6NDdaEDy86f h83ERkSFt+tAVp+AMEsiyCEZfgUTYEI1eEa2oOr7k+x9qpVu/YJT5DKacY+rOT1RnwgF 0NakLKL3eP/ewFt3IS6I8ZMiWLh0vVYP0u5ObaNLt0Eo408cQuoIiyQoSrDZzWN2Pt09 zXhu0luB57unUtRlvVddT9BiJNfrsooOR7DptUXkPYCWbHbi2uqKenKf5C45yQurVHR/ uSntVD5BNz1yMhcHuojp/i+3tQcBt/yHFDP0PasxxxJcwP0xA1k3iUcguDYM48E4NKIl ivCQ== 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=8Zw53qf70tlT158AshvZQHY21j9vTri8CUxJTblOQgE=; fh=2nhVWB0fZ+8YH0lLFpnF/Mo8eq+n1VMLe+b+IpvS0g0=; b=eAdPA4EtzJTgdhHZXLNmEtP5lxUDQM7Zp8I4naJdFZ50wfi7DqeitjTv9u2ZKGVJI+ GlVauO1DgzxIliqiDRFYJh3jUoW07eaIZmR+hI+0C2lH9UmAz4c15XHVcElzAKloIaTr 41q2C98PX0udv5rNTAkigW73dojQ/ds0fvyB/FE7ixCP7IXMqjlLtGXoABYU6UvKVH17 45JqtIm8k8WuWqKFDZSJX8mTg53jaC2lpHwieinC+a15VulJeFXETWlTCNtfxamwe8MC olJwa79c5rVjgleiq/hvw0Fakq3gSVGDn8hohICDTjY7VHPp9gcCoIQ8UhmQqKA8BfAx TP8g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id y10-20020a170903010a00b001bb907f3981si645963plc.302.2023.09.13.19.58.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 19:58:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 0D24581DC7BE; Wed, 13 Sep 2023 09:40:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231349AbjIMQkj (ORCPT + 99 others); Wed, 13 Sep 2023 12:40:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230526AbjIMQjw (ORCPT ); Wed, 13 Sep 2023 12:39:52 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 34AA1212A; Wed, 13 Sep 2023 09:39:27 -0700 (PDT) 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 33FD11FB; Wed, 13 Sep 2023 09:40:04 -0700 (PDT) Received: from merodach.members.linode.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3895B3F5A1; Wed, 13 Sep 2023 09:39:25 -0700 (PDT) From: James Morse 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 Cc: x86@kernel.org, Salil Mehta , Russell King , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com Subject: [RFC PATCH v2 17/35] ACPI: processor: Register all CPUs from acpi_processor_get_info() Date: Wed, 13 Sep 2023 16:38:05 +0000 Message-Id: <20230913163823.7880-18-james.morse@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230913163823.7880-1-james.morse@arm.com> References: <20230913163823.7880-1-james.morse@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Sep 2023 09:40:40 -0700 (PDT) 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 --- drivers/acpi/acpi_processor.c | 13 +++++++++++++ drivers/base/cpu.c | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index a01e315aa16a..867782bc50b0 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -313,6 +313,19 @@ static int acpi_processor_get_info(struct acpi_device *device) cpufreq_add_device("acpi-cpufreq"); } + /* + * Register CPUs that are present. + * Use get_cpu_device() 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..677f963e02ce 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -537,7 +537,7 @@ static void __init cpu_dev_register_generic(void) { int i, ret; - if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES)) + if (!IS_ENABLED(CONFIG_GENERIC_CPU_DEVICES) || !acpi_disabled) return; for_each_present_cpu(i) { -- 2.39.2