Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1779823rdb; Wed, 31 Jan 2024 08:50:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IEAQmy7Ml3q/JP+MJTwxIk7+emUtuZQq/IWfW5mRie7c+bjAqLgRws83tEhyBY6nlwdsFbf X-Received: by 2002:a05:6a20:a2a5:b0:19e:2d22:c3ec with SMTP id a37-20020a056a20a2a500b0019e2d22c3ecmr2125389pzl.13.1706719831496; Wed, 31 Jan 2024 08:50:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706719831; cv=pass; d=google.com; s=arc-20160816; b=IKL43VwADL66hsicVlqGbKfmoh0lQywKqGReubbui9Rl/s08wEsrSN0Gxi66jB1gPW A2a/9dwQLluKeo+hg0kny8geqGmgOBWkvfWAjWM37/TkDBZreQ4whFY2xMCfcU0fubU1 Mo0L4HeBu0sIubeiuWqchdGyKHNTBhHsqL1yi8AMqVtHPATEVlSOdPDjIXg7pKil9zWy sZNi2teZalnst3pxeE43XTHAVQHGd8iaXGP094NxiOiAXRZ1m7GDyj3fvDLmbo0ITiIl U6Ywp1ti0XqBWSyVJtASfx5shCk4bx2ey17rDkeTo+x3tThx+YNS0klzIFn5hD8aUL5t jkkQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:sender:message-id:content-transfer-encoding :content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:subject:cc:to:from:references:in-reply-to :dkim-signature; bh=4FviDP8LNcs5OH9XS9Lgt79F5tF9VpTSbqPgMlkIJeQ=; fh=O8Nq7gbKvPXWosrLiDCcrMxJk639tzR/lm2Hi5YXZYo=; b=JhM5ne7Z92duWwNGn2GDjuM0YOyRaFw2XmKxdZYV624bhQTuCeX4XpnF/EnNWZQZWf R1nw5nDcI8N9mUluK1S4VzNq8q9YAa9gDrDMvXsOPhJe6rFMelm+R/MwPLioQE4miMnb aDXIQHxoOHrC83dFeAfAsoM0qqiykriKS7YbODT0k395Rtrjs9CyTBo2sQbxJW6lkGrW BXjQaVL1vS1jNFBgiVo2nGKJhsLAqqRHrJRl9OabYJ4wQJosz3nJh4HERnxYHKIp+Zkp v2Me3Oe76QUm3G225DVtt7bGmE3+IhXiIJzUwsCF6bIKQUCIRQigOzH17bl3YdEPZzSh /ehA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=a8T9+UFZ; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-46827-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46827-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk X-Forwarded-Encrypted: i=1; AJvYcCUDO2rv0myXc8Kn2W32fjjwOrx59k+1RfPs+rTYHwOJiO9aHQ5HKMrqcsDeLUKow8VZf4/8B1w3BIaXalFwJuLegMRQXF2WIMXhMSvdTQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s82-20020a632c55000000b005cd786d8e3bsi9838211pgs.249.2024.01.31.08.50.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 08:50:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46827-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=a8T9+UFZ; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-46827-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46827-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2F0A4284E7E for ; Wed, 31 Jan 2024 16:50:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1176612CD8F; Wed, 31 Jan 2024 16:50:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="a8T9+UFZ" Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 947BE12C536; Wed, 31 Jan 2024 16:49:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706719799; cv=none; b=jRWhM/5xumzIQ/Y6tX3slI2cX73Mwe8iikgB37TG9h/4MVmD573GbDDYN2B3Vvv4aMMHG17N34ZRxUBE3+Fyl+VavPYF2DRjkEvsx7nV9Q2P567xaJp2Al+wbgzQ3wh6/gKY2APdlmgxy4LRvGgJlnmqw5wCT2ZRT2e6id7MFjY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706719799; c=relaxed/simple; bh=oglPI5j4SalFovZELHhLOqqFlAFobwCTFUVvb9MFaqQ=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=FmVzCQ/0GI7ClN2NYUMN0Yiqrit1sSvbKN/Hu8LDRjng36Nko9carSiLUqV9KOpZjnadWATRoUHG+bAwW3e0HZsFee2o47S0CRKvh3C9eif6Z6KeJeL66Bu5HjgeaL+vD57GwOBtzayxotvEVBdmu3kaH6LcPKCu0142JLBgpAg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=a8T9+UFZ; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk 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=4FviDP8LNcs5OH9XS9Lgt79F5tF9VpTSbqPgMlkIJeQ=; b=a8T9+UFZh5Erxcl19hYu8LnPoN l8jkJTCH5Aga8DZg+RD7ezbHyq4OQdeKkSD6hzIRhev0EyFHx6P+dy6aq64Behg6QOGcwrXp31PcU 6AfPX8Jas4MhwqjfgDzG/9B7RObj1s/1widKHmpuiUi0IxczEPWs+On8ceu+z7LWHVipSzrH9j+MH aVvsx/9nVkddyN/EWYjMHlRk9wKElTZSmbUv2SfQdepcYbj+SFzv+s4g5BVbd1CpZAAuNL4pp1eWO 8kBc76pSd4xlVd4TjgTaVkulutmldzJsN1KRBnCwIlrQ+A3b+5ptlUeZJLMI+uVTpzpitQ9YbzG+U gmLrm9EQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:36844 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 1rVDmV-0003Tf-2S; Wed, 31 Jan 2024 16:49:47 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1rVDmU-0027YP-Jz; Wed, 31 Jan 2024 16:49:46 +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 , Jonathan Cameron , "Rafael J. Wysocki" Subject: [PATCH RFC v4 02/15] ACPI: processor: Register all CPUs from acpi_processor_get_info() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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, 31 Jan 2024 16:49:46 +0000 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 Reviewed-by: Jonathan Cameron 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 cf7c1cca69dd..a68c475cdea5 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