Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3361906rdb; Wed, 13 Sep 2023 09:41:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF5iwXm+fl7d56blVtMe+ulqCE/0aKTPUgwliuFPWmprxZ28td1sMhKVuESo3AwmL4fe+u/ X-Received: by 2002:a05:6a20:3956:b0:14c:5dc3:f1c9 with SMTP id r22-20020a056a20395600b0014c5dc3f1c9mr3281710pzg.49.1694623275247; Wed, 13 Sep 2023 09:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694623275; cv=none; d=google.com; s=arc-20160816; b=tFuMmyBGPn2fLTq83/sffzbYL8uvnbFuDSXtNopUt3rE8C7U/8eiT0NJhRxng84jMk KB27562ifE5gttnuz0aVejOkbV0rHpsA/lwr83NnsPLemjFc2t7iJA8EDE0HUTlMOc2L 3JrGypUF2qPoWp+LMCxRJfCG3DvkVCqw8Yuzg/ejJd3CnhGmgRK9wkvErXtHvcQ+3uVa 8m51u968QgYHVsytlV2D8kudM4/eoCK/LVpFn19tE+pm9Oo6zBrP2Ew+ECaOHWcOJ+o/ casSj93dPwVs+0ndA3tVca6bp1qMGiXaVbgnVl4ui5qOqK0AAVD03Vedi4ti/TVjVCK4 pATg== 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=RTzee0Qx7a7uEcqAJMxv/nMw7O30YuR+udrjnvXPYxE=; fh=2nhVWB0fZ+8YH0lLFpnF/Mo8eq+n1VMLe+b+IpvS0g0=; b=PLqNbBDN8eLOTub2zbNwG80z4+iM+8YSgQ+vAfMtpW9YcP8h7RNvtMYT36/95L4rjh /kYpWO7StSiCeqrTDIAnjTLSCmPyqoaPZZwH2YBgZF08E5BqCUlMMma638RPPtPwozKH 91AMVH2uEgl3gILH65frdbnlFr1e5gVbvwoKqhC4bgjHRtmUfODFNThx2A+r7AmrcJUd hVfOALi/4TKUdy77KeT2/aE7tGNQYZZYXM9ejBasRBnEB+pdt3qYmDFOxm63+QCD2GB/ Do1jU0bkpbGv4paF3/sgKXADva2OMO/twgRvL+IQn/WILwa7taXW5jUq4HoZ4/YF3t2e UgMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id fz8-20020a17090b024800b00268414272d1si1819099pjb.156.2023.09.13.09.40.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 09:41:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id A4AF681ECCCC; Wed, 13 Sep 2023 09:40:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230432AbjIMQkP (ORCPT + 99 others); Wed, 13 Sep 2023 12:40:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231165AbjIMQjn (ORCPT ); Wed, 13 Sep 2023 12:39:43 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3695B2112; Wed, 13 Sep 2023 09:39:23 -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 36BFD1FB; Wed, 13 Sep 2023 09:40:00 -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 3BFF83F5A1; Wed, 13 Sep 2023 09:39:21 -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 15/35] ACPI: processor: Add support for processors described as container packages Date: Wed, 13 Sep 2023 16:38:03 +0000 Message-Id: <20230913163823.7880-16-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 (agentk.vger.email [0.0.0.0]); Wed, 13 Sep 2023 09:40:23 -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 agentk.vger.email 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 c0839bcf78c1..b4bde78121bb 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -625,9 +625,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.39.2