Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1962092rda; Tue, 24 Oct 2023 08:19:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGPTGksG+HcS0K0yp8UqYMh8D5s0d4vIUqjlcMIrLiAj/lD0y3MnX52xX/k971QmW7oPaCQ X-Received: by 2002:a17:90a:a413:b0:277:68c3:64b9 with SMTP id y19-20020a17090aa41300b0027768c364b9mr20872348pjp.5.1698160796928; Tue, 24 Oct 2023 08:19:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698160796; cv=none; d=google.com; s=arc-20160816; b=OU5kw1stdbXl2AgXo2ZKpJmKZvdn1/iGmZaTXR2Jl1dTuNIFJTkrJ1l4TMiTLaIymx vbU9Fyn7+4xoWPSTbD4NHj8qFz8WMLSI/axL4/B3v1Tsglz7YmPqNZvR8iflQ2cmQiLi G27s3Wqg9Olrx+SO0/jqGavVZgnESvc/pdcbdLzg1DhGL6UzV5e2KAuIy75ZC5z4LRmm km8PK5u7ztGMBf1J9kT77AbOLZzIgR/UjoGBGdEhhr+AoujkGveaDNPoPjpCAvl3XOjS 29OHQ8JxLlOf6sAwF+XwQq/Yphxln88ot8P6xtzUVyt1gGTNBE43RRiAdaKJqEYt4Q4a IcCw== 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=f8OrWLTaCGNbyVq/WoK3vwhwe5TfGCU6KyuaNwPXnrU=; fh=SkTV5xOrq7hxTIOggvbIOXu+48dqXijvMNKji0VGfy8=; b=G5hALUKoLWYWbzG7mNH0mVVbcTM6JfYPG4DhT+OBusKnajuBUC1JWSj8oP5C3eWfVp llMbhtdVR1y607KY23Qhug1Bd/SZVR4NMaoLxlieli65vHAO3voYYuqF2YptH3gpO7M5 5t1KTg0sPCp5hyu1yc0+12Jm8VvQI8fvqHq+O+Gkeu1XkRXtXEv24YnGUM/xp0+xVP0C bdNYMST8bBjlnNgkvfARPEgbyhd4MT29x9J1l53TxTAQ1wsAqIzsK8sRjQG9UOhcbODh yfRjF9rb3ip54VtzFTrESovJ5N7DWI90t3+Jn/ccllt/ZQSvWzi+7cJAQSc/NDgsqFx1 80pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=bJbyRc7V; 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=armlinux.org.uk Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id n6-20020a635906000000b005859c255ce9si8672228pgb.861.2023.10.24.08.19.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 08:19: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; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=bJbyRc7V; 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=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 CB320802B04D; Tue, 24 Oct 2023 08:19:55 -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 S1343797AbjJXPTw (ORCPT + 99 others); Tue, 24 Oct 2023 11:19:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343896AbjJXPTO (ORCPT ); Tue, 24 Oct 2023 11:19:14 -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 6FB802133; Tue, 24 Oct 2023 08:17:52 -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=f8OrWLTaCGNbyVq/WoK3vwhwe5TfGCU6KyuaNwPXnrU=; b=bJbyRc7Voy4fwHRY8NIy9J4xJZ mwUWqP+2nWJKN3W9uCIOui8ux2O5HcsT3RVb3xiBJuAqTY2cNcK5nzoBqWE4/ycvmFAJpNnf4bA8h qS6+8DejaAkeGViUjqfLxXl334/8VTictns9i6JOFpScnbqtwK7nzVYjJxhK0vtzPsxQR7Xl+c2ZG RiEBG3yjV5XpdpPgkL0inVPG3lrvSMldmrmg1hPEzzpZk/ioVj1/7TccroSc0LlgLoFDynWb1vnk7 2EXkm6UTat1uwOSl61TpruZcEB7rwSFQ0RgHz+uNmUJMvzbyTeimw9+06WbX6cud7MpbLSg0idSZo 8RrA77Zw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:36706 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 1qvJA9-0004RY-1o; Tue, 24 Oct 2023 16:17:45 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qvJAB-00AqQg-1h; Tue, 24 Oct 2023 16:17:47 +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 19/39] ACPI: processor: Add support for processors described as container packages 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:47 +0100 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 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]); Tue, 24 Oct 2023 08:19:56 -0700 (PDT) From: James Morse ACPI has two ways of describing processors in the DSDT. Either as a device object with HID ACPI0007, or as a type 'C' package inside a Processor Container. The ACPI processor driver probes CPUs described as devices, but not those described as packages. Duplicate descriptions are not allowed, the ACPI processor driver already parses the UID from both devices and containers. acpi_processor_get_info() returns an error if the UID exists twice in the DSDT. The missing probe for CPUs described as packages creates a problem for moving the cpu_register() calls into the acpi_processor driver, as CPUs described like this don't get registered, leading to errors from other subsystems when they try to add new sysfs entries to the CPU node. (e.g. topology_sysfs_init()'s use of topology_add_dev() via cpuhp) To fix this, parse the processor container and call acpi_processor_add() for each processor that is discovered like this. The processor container handler is added with acpi_scan_add_handler(), so no detach call will arrive. Qemu TCG describes CPUs using packages in a processor container. Signed-off-by: James Morse --- drivers/acpi/acpi_processor.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 4fe2ef54088c..6a542e0ce396 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -626,9 +626,31 @@ static struct acpi_scan_handler processor_handler = { }, }; +static acpi_status acpi_processor_container_walk(acpi_handle handle, + u32 lvl, + void *context, + void **rv) +{ + struct acpi_device *adev; + acpi_status status; + + adev = acpi_get_acpi_dev(handle); + if (!adev) + return AE_ERROR; + + status = acpi_processor_add(adev, &processor_device_ids[0]); + acpi_put_acpi_dev(adev); + + return status; +} + static int acpi_processor_container_attach(struct acpi_device *dev, const struct acpi_device_id *id) { + acpi_walk_namespace(ACPI_TYPE_PROCESSOR, dev->handle, + ACPI_UINT32_MAX, acpi_processor_container_walk, + NULL, NULL, NULL); + return 1; } -- 2.30.2