Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1963173rda; Tue, 24 Oct 2023 08:21:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE2/vbnQ5zggjlCjEi/cWoXfisWk3mY5AfBffOOcIyIhtk3BTA6LRXNeuL2OK6aYkVTZWpr X-Received: by 2002:a05:6a21:3289:b0:16b:cc6c:d728 with SMTP id yt9-20020a056a21328900b0016bcc6cd728mr3343005pzb.44.1698160895630; Tue, 24 Oct 2023 08:21:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698160895; cv=none; d=google.com; s=arc-20160816; b=axl+7tY9xlO57pSQqiZiB1TufbJKhRR6yvY6SIjm4c1Q85uXtPydYR7sJh0GqMyDGg U8rxIRZX0XCAfLxKEv+6aka8FCO+mbJdgfRXqpLZqEQd7mLfjFyWOIUw+V7ztUh13VZ4 Cyw0CssBHOeP8bUK9JX8pQMYk16NXfuwdJ/gS9qK8pTQwryg+X/z6pzOLAt2BjssX6/9 yuVXXdMaToJlOv3PMKTZOCoODpnuLG+czVZTxBLeBvMFRTldEZenzdLkT+1gD7IBQT4c aZ0MS3aXAXMIoXrnd/xtRskUiz2DViI1oSjh4n9QVsmPsh6J2XGTy8HIZC4nJAEl1nQ6 Wd0A== 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=WbkJcP8EfdoxIJZCXfcMKFVW/i0XQ0H+6U5ilPscurM=; fh=SkTV5xOrq7hxTIOggvbIOXu+48dqXijvMNKji0VGfy8=; b=HOBs5kHlbtsFpxSsQO2YSD0tpT76QRi+y4bqI+nHdqnJ1VHnTBJsTI8tdDN67EAcGf bGwFCD0SfARqsKBrPft0u7vD8puao1jVcn5c/0Or4KdrBWgBd97+p4SL9oTVMXG0nl+P luuOuYirWReDf3B7/Lr28H7TPFLpEd62tQDL2z1VDZiqwcriWVAB+uUQCOTG+6ItcOd/ cQpvVwZPMAblVBhuuBBy6y1S1t/fYIoPLpy+R2wK85zeILSIOkc9ndjuQh0mcyjfI1BC M6cvZp4WtKHdJCpMygsqq51d0gJc/jK6DJcXFn0QyQFvJ2dzCVllixxaW1EjnjC1vE8W WHvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=UFpyf7IB; 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 v22-20020a63f216000000b0059f0cebd046si8322932pgh.729.2023.10.24.08.21.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 08:21:35 -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=UFpyf7IB; 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 DC7758063012; Tue, 24 Oct 2023 08:21:05 -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 S1343595AbjJXPU5 (ORCPT + 99 others); Tue, 24 Oct 2023 11:20:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234846AbjJXPTk (ORCPT ); Tue, 24 Oct 2023 11:19:40 -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 8A98126AB; Tue, 24 Oct 2023 08:18:04 -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=WbkJcP8EfdoxIJZCXfcMKFVW/i0XQ0H+6U5ilPscurM=; b=UFpyf7IBgalvU1WbMK4uFsjopi n3QYxKYZyHK3GPF00+ghNLXiOFCtl6pp8wlAjZdeBBo+1hsVMpqhTFYqVSDnaXMgPqZAaLKwUQiDG 9uvr3egTxe1FOV02vpFPdUDsfkp9i6U6JHam5QzXbOYxN7X33nA9s439YqSld4/s9jCJov8XGKHL+ JNp7n/Wabc3e93CgHUO+oxPhtxw4O4WRPce1ABFGYGzKuH5/kRJqlr0K6ewJyURrQiZVlLdhSRdP7 w3C055XibslaZrjOpVNLKJDdeaJjqxnvqA4rMmD9NMA6hA95tQ/sT/XqTlIor9TKsrxuKAy4xVBXP pfpMPhIg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:36712 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 1qvJAE-0004Rl-2N; Tue, 24 Oct 2023 16:17:50 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qvJAG-00AqQm-6R; Tue, 24 Oct 2023 16:17:52 +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 Subject: [PATCH 20/39] ACPI: processor: Register CPUs that are online, but not described in the DSDT 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:52 +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:21:06 -0700 (PDT) From: James Morse ACPI has two descriptions of CPUs, one in the MADT/APIC table, the other in the DSDT. Both are required. (ACPI 6.5's 8.4 "Declaring Processors" says "Each processor in the system must be declared in the ACPI namespace"). Having two descriptions allows firmware authors to get this wrong. If CPUs are described in the MADT/APIC, they will be brought online early during boot. Once the register_cpu() calls are moved to ACPI, they will be based on the DSDT description of the CPUs. When CPUs are missing from the DSDT description, they will end up online, but not registered. Add a helper that runs after acpi_init() has completed to register CPUs that are online, but weren't found in the DSDT. Any CPU that is registered by this code triggers a firmware-bug warning and kernel taint. Qemu TCG only describes the first CPU in the DSDT, unless cpu-hotplug is configured. Signed-off-by: James Morse Reviewed-by: Jonathan Cameron Reviewed-by: Gavin Shan Signed-off-by: Russell King (Oracle) --- drivers/acpi/acpi_processor.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 6a542e0ce396..0511f2bc10bc 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -791,6 +791,25 @@ void __init acpi_processor_init(void) acpi_pcc_cpufreq_init(); } +static int __init acpi_processor_register_missing_cpus(void) +{ + int cpu; + + if (acpi_disabled) + return 0; + + for_each_online_cpu(cpu) { + if (!get_cpu_device(cpu)) { + pr_err_once(FW_BUG "CPU %u has no ACPI namespace description!\n", cpu); + add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); + arch_register_cpu(cpu); + } + } + + return 0; +} +subsys_initcall_sync(acpi_processor_register_missing_cpus); + #ifdef CONFIG_ACPI_PROCESSOR_CSTATE /** * acpi_processor_claim_cst_control - Request _CST control from the platform. -- 2.30.2