Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3368991rdb; Wed, 13 Sep 2023 09:54:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEoDhdIJLpFmo+CWfl0krbKcx0gDJfqzKPVwsNAGm0W+GzD1gN3/+BKS6OURRvzPFXksAFP X-Received: by 2002:a17:902:e5c6:b0:1c3:c5b5:8a94 with SMTP id u6-20020a170902e5c600b001c3c5b58a94mr3395568plf.18.1694624042414; Wed, 13 Sep 2023 09:54:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694624042; cv=none; d=google.com; s=arc-20160816; b=nWnUuCnK/f5oEtwopm2mbHVtk5A6AeVQvbRjfuOsejIrZyTgpcWr43YootKcih/bBQ nB+cprpPZJm6T7HzsW0Jygmf9WDknyiw0P0JOn1+lCeP79nGk90UKMpVJhAQsVi2cWqp GT0lDzvm4TECahTvZ2rRsMpDRUXcKurRA9qeYkXOLGHFyQ0i4nZnAeBUQGxONfG5Q7cE F66Li1A3yLHLA3touxn4pfcZXrilxDbvvclf0PF8ChAiEimfKGI7OMqDLtE2Z8ggIldO y2pPETDZxiSmXO0hzGQ6gjLlaftcLHzl80D7V5ktq4zhFXUP3ZJ8v0ynrKWSu8oVMc1F 9MaQ== 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=cef7MF5f3I17g0157LoKvxFl/FQw5el5kskhTeMcejU=; fh=2nhVWB0fZ+8YH0lLFpnF/Mo8eq+n1VMLe+b+IpvS0g0=; b=zHg5AB9BHU2Db6Ston+MlMq3cYcuFcOZlD3eXR65kusXEWJG85a/9IRs6RXrTBLgpQ CnON+yZ6qYiPbxJQk9rSgr6DCc1m3yXeaiTBCpHr0sulFtYGFDb0iBpfd4hrDgAQqKRO yy0rqTUNl8Xq9Dm07N26HBM1im4vv6ltWNFdLurblCbLLuyMR+3mtLB0/SrB59223oyH kAo6hF/kjYYcZWMOkrvt67zM0jgqsW+ahLB35JttJN37eszz0N1L2mOtu0NHpHdu2EAB UAyUuqHNEqGv2ET+rh8wFBqlUneRoH4isWmH0XQxlDoWAjtPBD8X5jfLg9S06HJneCOP wPYA== ARC-Authentication-Results: i=1; mx.google.com; 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=arm.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id u8-20020a17090341c800b001bbfbe6bf3esi10627735ple.504.2023.09.13.09.54.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 09:54:02 -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; 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=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 3B139810EC08; Wed, 13 Sep 2023 09:40:35 -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 S231197AbjIMQkb (ORCPT + 99 others); Wed, 13 Sep 2023 12:40:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230493AbjIMQjs (ORCPT ); Wed, 13 Sep 2023 12:39:48 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 34C7419B1; Wed, 13 Sep 2023 09:39:25 -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 35227FEC; Wed, 13 Sep 2023 09:40:02 -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 3A6373F5A1; Wed, 13 Sep 2023 09:39:23 -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 16/35] ACPI: processor: Register CPUs that are online, but not described in the DSDT Date: Wed, 13 Sep 2023 16:38:04 +0000 Message-Id: <20230913163823.7880-17-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 (lipwig.vger.email [0.0.0.0]); Wed, 13 Sep 2023 09:40:35 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=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 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 --- 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 b4bde78121bb..a01e315aa16a 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -790,6 +790,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.39.2