Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp85651rdh; Mon, 18 Dec 2023 12:18:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHVivPGEhSLwwpD1557YmcOobMwOIo6CmNzstWuPY6CWfRXt/hrKpxs6t911YNrx/gPb7Rk X-Received: by 2002:a05:6214:c6d:b0:67f:2be6:303c with SMTP id t13-20020a0562140c6d00b0067f2be6303cmr4187316qvj.88.1702930682563; Mon, 18 Dec 2023 12:18:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702930682; cv=none; d=google.com; s=arc-20160816; b=bDN/sz+S1hv09CKa2OFWCZYkhiCTFgyNK+jpzpFgvwgek5icgQG4IetO3xQtDXZl/9 VjikwBFy14We3/oFH6WJD9fO7WuZ/vVNqkaeIC9D0wwbvDui7JiiSdTc/8xsAI7SvOZH tJXZp7NCyTKzmw0502xr9GC82Ig27jqjx1jNdS8ioBQm9l3E3t5OtaqIx5hibE2m2mSr OAmOFIt3g6zDSE5DJwLxchWFlSe8wCi7y59iNS9+hL6jSDZyPI2btA5bW6BfJR3lXvAo pJr3gYpETBnBZyPkLWoWAPa1r5f4cj49WMHeQnptyMZTx1sIJBwgm3pOLjxy3tUbNBHn eTjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=BVggm/k7h51uGokCDrYG9yM8ij6+ByTlCjSSiz9AMHU=; fh=FdKLH5Lkv+cCalk9mliJbP8ks5hX326lBveelCIbs6Y=; b=L3U2+smGi3qU8lKK9TSII1IDJ4VRHxPhqgcZNKvtZokdHyP8OxTSQ2+dLoU11TRGTi VYDNKaLSP2Ax9EM14PDiWoNFfC5B5XteRQwMsu5ycmuo//P4Ote4ugmYxwqu0xOuG8rs vwoVvtigDP8aDzW/4mmbhjUCZ/rVjPF2qz0batPLuEvUVgc6KxGKE6EXJGIBswQMYsfX CfhRoxTEYKBO2vKuqVC6zRfiPeUCZwzPMJAIrvQHHYqr+hpDgN+bQiG1+jGP1eL4CEqe GmoszA5KriPsetJnLvYYtNhQoh4pykyzpTP1uTXDoIb8LnIXFWsEjUoZUEybmSk0X+NH gnKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-4331-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4331-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id p7-20020a0c8c87000000b0067f32ca300esi4717063qvb.394.2023.12.18.12.18.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 12:18:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4331-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-4331-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4331-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 4BD381C231A2 for ; Mon, 18 Dec 2023 20:18:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C0CA73468; Mon, 18 Dec 2023 20:17:49 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 429C67146E; Mon, 18 Dec 2023 20:17:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-20394042a45so279477fac.0; Mon, 18 Dec 2023 12:17:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702930666; x=1703535466; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BVggm/k7h51uGokCDrYG9yM8ij6+ByTlCjSSiz9AMHU=; b=j+cpQAhZ5EEyQhYmHr0vMjlkHiWBOE0Q/mGiu/JrTWX3qqoOAf6hORYIKIinCVwTs5 yGKbLcrk1gb1WNZXe2/vxOagVXtwV/rS5PCw7qIxss954TuXeTvQTCjQedRKZo6ax/iF ixU/rvy+geguv/CA8mXBpdmLFWJVZX/cyuWXHVxTtvHBtc33H4PCnzO1BQBlVXYs/RyI pWuro8Q0MgyN8tTfY+/BvgDPYnC8Nz2ryFqJa4oluvzZD4bU+OOk3IIF5vWD/rYPJFxE DDx5EvLJEPMuzC7wtX77BRNscywfc+PvfMViCfUK2XIBGgrcvu/tar1LDm9MJboLITK7 Qk9Q== X-Gm-Message-State: AOJu0YxMLBTv2B7NYmm5chKSElGEU03qGjummiquhPRJIYWOWFm7GmnM WqtLANJtUi/8XlT8a9wv5575rJGDGHpuEsNZY1U= X-Received: by 2002:a05:6870:9591:b0:203:e5bc:154a with SMTP id k17-20020a056870959100b00203e5bc154amr834085oao.2.1702930665760; Mon, 18 Dec 2023 12:17:45 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: "Rafael J. Wysocki" Date: Mon, 18 Dec 2023 21:17:34 +0100 Message-ID: Subject: Re: [PATCH RFC v3 02/21] ACPI: processor: Add support for processors described as container packages To: Russell King Cc: 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, Salil Mehta , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com, James Morse Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Dec 13, 2023 at 1:49=E2=80=AFPM Russell King wrote: > > From: James Morse > > ACPI has two ways of describing processors in the DSDT. From ACPI v6.5, > 5.2.12: > > "Starting with ACPI Specification 6.3, the use of the Processor() object > was deprecated. Only legacy systems should continue with this usage. On > the Itanium architecture only, a _UID is provided for the Processor() > that is a string object. This usage of _UID is also deprecated since it > can preclude an OSPM from being able to match a processor to a > non-enumerable device, such as those defined in the MADT. From ACPI > Specification 6.3 onward, all processor objects for all architectures > except Itanium must now use Device() objects with an _HID of ACPI0007, > and use only integer _UID values." > > Also see https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_C= ontrol.html#declaring-processors > > 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. I'm not really sure how the above is related to the actual patch. > The missing probe for CPUs described as packages It is unclear what exactly is meant by "CPUs described as packages". From the patch, it looks like those would be Processor() objects defined under a processor container device. > 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. Discovered like what? > The processor container > handler is added with acpi_scan_add_handler(), so no detach call will > arrive. The above requires clarification too. > Qemu TCG describes CPUs using processor devices in a processor container. > For more information, see build_cpus_aml() in Qemu hw/acpi/cpu.c and > https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.ht= ml#processor-container-device > > Signed-off-by: James Morse > Tested-by: Miguel Luis > Tested-by: Vishnu Pajjuri > Tested-by: Jianyong Wu > --- > Outstanding comments: > https://lore.kernel.org/r/20230914145353.000072e2@Huawei.com > https://lore.kernel.org/r/50571c2f-aa3c-baeb-3add-cd59e0eddc02@redhat.co= m > --- > 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 = =3D { > }, > }; > > +static acpi_status acpi_processor_container_walk(acpi_handle handle, > + u32 lvl, > + void *context, > + void **rv) > +{ > + struct acpi_device *adev; > + acpi_status status; > + > + adev =3D acpi_get_acpi_dev(handle); > + if (!adev) > + return AE_ERROR; Why is the reference counting needed here? Wouldn't acpi_fetch_acpi_dev() suffice? Also, should the walk really be terminated on the first error? > + > + status =3D 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 *i= d) > { > + acpi_walk_namespace(ACPI_TYPE_PROCESSOR, dev->handle, > + ACPI_UINT32_MAX, acpi_processor_container_wal= k, > + NULL, NULL, NULL); This covers processor objects only, so why is this not needed for processor devices defined under a processor container object? It is not obvious, so it would be nice to add a comment explaining the difference. > + > return 1; > } > > --