Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5999013rdb; Mon, 18 Sep 2023 00:11:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGgZNhd2tGAzkycEnnyeKoxLq43c03Bt7rBrHeIDC/SQmxmRBvDGMcNLBEO9WNWRSOKjMUs X-Received: by 2002:a17:902:e881:b0:1bc:3944:9391 with SMTP id w1-20020a170902e88100b001bc39449391mr7411776plg.25.1695021073562; Mon, 18 Sep 2023 00:11:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695021073; cv=none; d=google.com; s=arc-20160816; b=hGtQIkhfow5M4dF2/wUeiBEx8Sc0SgDlNl0GIpMT+EldDn6oqHkW7TdtKTMyVCZENC XcQnMJLlWMFhdY+A0EZjvU/TB1gb27Lv8oRdFdwhvXo+YcvfDeewo+HBkso9y4RvUWYN IExAHxrO3j1YeEWDymsbN8m3SbqMAEfiIsWpSo0CUorGbHlstj7GEXDpS/kruEzkPA6f m8JrYu4AHIhjfLcUPdhSdWY6dOTWW/AHB1RWH+OZbBxJh0xwCkyZRnyk/C1/9naX6AzH TfMuMsV+LgPg9r7q9nqh9haLOlxpLaMBv+Cm/r3dwUPURJLy84pPUM23lGmgAVKhneQU Ql/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=hCDoXZnQJiBgGjXOi0ciKhKqeO4OfqPdXpxnEdvp7mI=; fh=PXJ1nrAkwnzNPHtj0xILXFW28d5sEdNuBWEBRL0T4wA=; b=UyshnzDEbTXJwgBYTcuRFn70FjGG+SpcGJRFVT1R8UxPzyjBcjc9IkQQm3NJQ3fW4h j8p9U7xI/XBIX3bm6y5RgZXr+ZwQiWEY/twt4Bat60xiTDtWFWrRCc88fKju1MBmXr3/ EHK3VnWYwyx+dWtrFNFM0LjkXh9MjTnD1Sbdv1a5oget3NikWbXEod2euQXoPl1IjH77 nN4mCMcFLY2DKOCWgomM1oNXFLB6tv2ZuaV8RZGrd+SvfyY3bInDMVg1KfF7F4YMf90J L/jljq/ZuNxWnyJuyWccLOuazzcFeFonJoPwgBUEZjUH3h8u13w3cJ4vVIHnYfdK9HWz 9iJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HK7O0Psy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id i16-20020a17090332d000b001bbcf3bc9d3si7752671plr.384.2023.09.18.00.11.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 00:11:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HK7O0Psy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 5B3F480D6AFD; Sun, 17 Sep 2023 22:05:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231883AbjIRFEH (ORCPT + 99 others); Mon, 18 Sep 2023 01:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231475AbjIRFDv (ORCPT ); Mon, 18 Sep 2023 01:03:51 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68423120 for ; Sun, 17 Sep 2023 22:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695013388; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hCDoXZnQJiBgGjXOi0ciKhKqeO4OfqPdXpxnEdvp7mI=; b=HK7O0PsyH5oVXvcJAI/R3Mba7UUeTnc9hH4nIBeowIGJnCqUwZStD5+IZSpDVboxMOJ9NA s+Hsx4chuSe2hg9Wv4ZXZvrz9G41hKOIIsA5E625JdtyDQkI+laORX98mSSr/nOuL4CbIo GI0YbGlkI3mlxKPXP+THFm82PsX1taE= Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-593-fIUz5AUxOJ-wFupaJiyNbg-1; Mon, 18 Sep 2023 01:03:02 -0400 X-MC-Unique: fIUz5AUxOJ-wFupaJiyNbg-1 Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-68faf55989cso4085206b3a.3 for ; Sun, 17 Sep 2023 22:03:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695013381; x=1695618181; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hCDoXZnQJiBgGjXOi0ciKhKqeO4OfqPdXpxnEdvp7mI=; b=dVLw1ABcmsJUFc5vadhl9M5Eko3f2FuSX4R90/wmjld4oL6omSfHoT8J4Fu65O7/0+ XsB84dO52f9Sjk5Jy/iqPm2WRvzEo5tKPBlBO4HXytOe97F5Vnj7V6DaeksKMTlMsl+F MVke+zyy9+EYcU+Ae2dAPn2tVth13rnYZPYzpcTZDAH5zFDGddSxYqEH1FdqRc1gsTTl FhtSF7QmAcDfp5RzZUVzL/XO/Hc9z473EzFH5/9GnqZsrQCR6sj+V6OyACcywKeBNoWh drD/rjXvXEKex/Q7tl0vqthC2XD5dNv9bdhUB+53fy4JyRcgk917v+6So3pFZF/VIAlf Umaw== X-Gm-Message-State: AOJu0YyE9zMGPwYZciI8rfaU1wA2VRlcqAdtggfao4fe6hMq9yCSw60C QMdgSCyGsk09HwE3/nXyjGF96eJkbcnKLA0LQEesSnygn5ynbWyeVbYOOVlt5ksUBEBuzcnYoJW 74VShy5+pudZJ/cNmFVwA/F0H X-Received: by 2002:a05:6a00:2344:b0:68e:43ed:d30b with SMTP id j4-20020a056a00234400b0068e43edd30bmr6879611pfj.21.1695013381113; Sun, 17 Sep 2023 22:03:01 -0700 (PDT) X-Received: by 2002:a05:6a00:2344:b0:68e:43ed:d30b with SMTP id j4-20020a056a00234400b0068e43edd30bmr6879587pfj.21.1695013380748; Sun, 17 Sep 2023 22:03:00 -0700 (PDT) Received: from ?IPV6:2001:8003:e5b0:9f00:dbbc:1945:6e65:ec5? ([2001:8003:e5b0:9f00:dbbc:1945:6e65:ec5]) by smtp.gmail.com with ESMTPSA id j26-20020aa783da000000b00687a4b70d1esm6322062pfn.218.2023.09.17.22.02.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 17 Sep 2023 22:03:00 -0700 (PDT) Message-ID: <50571c2f-aa3c-baeb-3add-cd59e0eddc02@redhat.com> Date: Mon, 18 Sep 2023 15:02:53 +1000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [RFC PATCH v2 15/35] ACPI: processor: Add support for processors described as container packages Content-Language: en-US To: James Morse , 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 References: <20230913163823.7880-1-james.morse@arm.com> <20230913163823.7880-16-james.morse@arm.com> From: Gavin Shan In-Reply-To: <20230913163823.7880-16-james.morse@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,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 groat.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 (groat.vger.email [0.0.0.0]); Sun, 17 Sep 2023 22:05:09 -0700 (PDT) On 9/14/23 02:38, James Morse wrote: > 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(+) > I don't understand the last sentence of the commit log. QEMU always have "ACPI0007" for the processor devices. #define ACPI_PROCESSOR_DEVICE_HID "ACPI0007" #define ACPI_PROCESSOR_OBJECT_HID "LNXCPU" [gshan@gshan q]$ git grep ACPI0007 hw/acpi/cpu.c: aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007"))); hw/arm/virt-acpi-build.c: aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007"))); hw/riscv/virt-acpi-build.c: aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007"))); [gshan@gshan q]$ git grep LNXCPU > 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; > } > Thanks, Gavin