From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 2002:a17:504:1b46:b0:1be9:327d:8ee3 with SMTP id t6csp1033883njh; Fri, 30 May 2025 03:17:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVy5Uc/FZNcMMzwSjCAv/RHPP8KCqkXR/uPBGq+FuDpJz3VtEWukjvY7ehZ7mBqsJ+iGuyut3G7iIknLg==@linaro.org X-Google-Smtp-Source: AGHT+IHzizXUtTHSO904iIv1nFZdV2myvupFM2rycGeDEcyo7KxVbDZW6roG15M50VMsJuqGpROX X-Received: by 2002:a05:600c:5126:b0:450:cde3:f266 with SMTP id 5b1f17b1804b1-450d6550e19mr23607525e9.22.1748600242274; Fri, 30 May 2025 03:17:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1748600242; cv=none; d=google.com; s=arc-20240605; b=IgBv04upWzoVjYfms9bEVoL2JzKAxLzrRNUcNHBriQEHkViMQ4Z6c976kpY3+kCGSQ uvLWvbKuTppkowOjpM7Lq5FejbwKzqEny68R/KvOJbGNlDdoEeiprHzmlRBhZXrEo6xc QHWdLCkdOVR9YFDeCNF1ketEY7H162JrPUjuCIdrog3dbVH8Uif5E1U8XYjBojXQS4tX pNBmYVkTEn8CfzMbAPthXZICn6Ywl18LoowXMmqiEzwkvG//IiL7qxosD13T1UUXnBjk CWubmdJdmyJbLPFjDoZ5XSAk3U8oob5ovHmhcYf5Nc/z7uWupBCKLKkYlKxt9bjHrgmb 7HaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date; bh=Lfkh+im8spZp4yYszLlqc5iJQY3+ovLm5TwurLFA/s0=; fh=De5j/+RFiHp5oysg/kfBHcT9O0ASuV5hpNukEk4skqM=; b=ZqAi71ONtMaRp1ph2GQqncQ79O7qWMipTwVmY4LzCw+wt1nssJwJDIU9hLTEOxF7DK qanp3hcFFoJ2Wwjis6aas3s+3xqXGeAVN7Eb1cgWHVtp30grTaJYJBCO/iQPRavdltNR pm4UctpIpwfgF8gEs4fkIXXTP/WncXs3rkznPcfVftRVn+AtSX2Ty4Fd9O0pNGRF3b4R ermNlbzzRyVysPCu84n/AisDxVRbm2z+4KCh0qxPRNSrtHwU/UgxoguKZYeQtBBGLa/f YrNERQYbQW86EKwv4F9uZVDi41Ao4U3sQWB78Mvbjz/WtfeK/Ytdt+0wJtPXny8OafMP vj5Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of jonathan.cameron@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=jonathan.cameron@huawei.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from frasgout.his.huawei.com (frasgout.his.huawei.com. [185.176.79.56]) by mx.google.com with ESMTPS id 5b1f17b1804b1-450d63ac39bsi13361515e9.88.2025.05.30.03.17.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 May 2025 03:17:22 -0700 (PDT) Received-SPF: pass (google.com: domain of jonathan.cameron@huawei.com designates 185.176.79.56 as permitted sender) client-ip=185.176.79.56; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jonathan.cameron@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=jonathan.cameron@huawei.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4b7zbV0BVSz6K5n7; Fri, 30 May 2025 18:13:42 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 88A1D1402FC; Fri, 30 May 2025 18:17:21 +0800 (CST) Received: from localhost (10.203.177.66) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 30 May 2025 12:17:20 +0200 Date: Fri, 30 May 2025 11:17:19 +0100 From: Jonathan Cameron To: Eric Auger CC: , , , , , , , , , , , Subject: Re: [PATCH v2 11/25] hw/i386/acpi-build: Introduce build_append_pcihp_resources() helper Message-ID: <20250530111719.00005714@huawei.com> In-Reply-To: <20250527074224.1197793-12-eric.auger@redhat.com> References: <20250527074224.1197793-1-eric.auger@redhat.com> <20250527074224.1197793-12-eric.auger@redhat.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.177.66] X-ClientProxiedBy: lhrpeml100006.china.huawei.com (7.191.160.224) To frapeml500008.china.huawei.com (7.182.85.71) X-TUID: Oa1Zj/lcCgk/ On Tue, 27 May 2025 09:40:13 +0200 Eric Auger wrote: > Extract the code that reserves resources for ACPI PCI hotplug > into a new helper named build_append_pcihp_resources() and > move it to pcihp.c. We will reuse it on ARM. > > Signed-off-by: Eric Auger > Reviewed-by: Gustavo Romero Trivial comment inline. Reviewed-by: Jonathan Cameron > --- > include/hw/acpi/pcihp.h | 2 ++ > hw/acpi/pcihp.c | 20 ++++++++++++++++++++ > hw/i386/acpi-build.c | 15 ++------------- > 3 files changed, 24 insertions(+), 13 deletions(-) > > diff --git a/include/hw/acpi/pcihp.h b/include/hw/acpi/pcihp.h > index 971451e8ea..8a46a414cc 100644 > --- a/include/hw/acpi/pcihp.h > +++ b/include/hw/acpi/pcihp.h > @@ -75,6 +75,8 @@ void acpi_pcihp_device_unplug_request_cb(HotplugHandler *hotplug_dev, > > void build_acpi_pci_hotplug(Aml *table, uint64_t pcihp_addr); > void build_append_pci_dsm_func0_common(Aml *ctx, Aml *retvar); > +void build_append_pcihp_resources(Aml *table, > + uint64_t io_addr, uint64_t io_len); > > /* Called on reset */ > void acpi_pcihp_reset(AcpiPciHpState *s); > diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c > index e0260f67e6..fb54c31f77 100644 > --- a/hw/acpi/pcihp.c > +++ b/hw/acpi/pcihp.c > @@ -685,6 +685,26 @@ void build_acpi_pci_hotplug(Aml *table, uint64_t pcihp_addr) > aml_append(table, scope); > } > > +/* Reserve PCIHP resources */ > +void build_append_pcihp_resources(Aml *scope /* \\_SB.PCI0 */, > + uint64_t io_addr, uint64_t io_len) > +{ > + Aml *dev, *crs; > + > + dev = aml_device("PHPR"); > + aml_append(dev, aml_name_decl("_HID", aml_string("PNP0A06"))); > + aml_append(dev, > + aml_name_decl("_UID", aml_string("PCI Hotplug resources"))); > + /* device present, functioning, decoding, not shown in UI */ > + aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); > + crs = aml_resource_template(); > + aml_append(crs, > + aml_io(AML_DECODE16, io_addr, io_addr, 1, io_len) > + ); Trivial but this doesn't match local style. It is even inconsistent with the _UID line above. > + aml_append(crs, > + aml_io(AML_DECODE16, io_addr, io_addr, 1, io_len)); maybe? > + aml_append(dev, aml_name_decl("_CRS", crs)); > + aml_append(scope, dev); > +} > + > const VMStateDescription vmstate_acpi_pcihp_pci_status = { > .name = "acpi_pcihp_pci_status", > .version_id = 1, > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > index 91945f716c..52cef834ed 100644 > --- a/hw/i386/acpi-build.c > +++ b/hw/i386/acpi-build.c > @@ -1432,19 +1432,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, > > /* reserve PCIHP resources */ > if (pm->pcihp_io_len && (pm->pcihp_bridge_en || pm->pcihp_root_en)) { > - dev = aml_device("PHPR"); > - aml_append(dev, aml_name_decl("_HID", aml_string("PNP0A06"))); > - aml_append(dev, > - aml_name_decl("_UID", aml_string("PCI Hotplug resources"))); > - /* device present, functioning, decoding, not shown in UI */ > - aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); > - crs = aml_resource_template(); > - aml_append(crs, > - aml_io(AML_DECODE16, pm->pcihp_io_base, pm->pcihp_io_base, 1, > - pm->pcihp_io_len) > - ); > - aml_append(dev, aml_name_decl("_CRS", crs)); > - aml_append(scope, dev); > + build_append_pcihp_resources(scope, > + pm->pcihp_io_base, pm->pcihp_io_len); > } > aml_append(dsdt, scope); > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4ED08C5B552 for ; Fri, 30 May 2025 10:17:58 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uKwo0-0007vp-PP; Fri, 30 May 2025 06:17:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uKwno-0007uu-MT; Fri, 30 May 2025 06:17:28 -0400 Received: from [185.176.79.56] (helo=frasgout.his.huawei.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uKwnk-0001PB-7b; Fri, 30 May 2025 06:17:26 -0400 Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4b7zbV0BVSz6K5n7; Fri, 30 May 2025 18:13:42 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 88A1D1402FC; Fri, 30 May 2025 18:17:21 +0800 (CST) Received: from localhost (10.203.177.66) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 30 May 2025 12:17:20 +0200 Date: Fri, 30 May 2025 11:17:19 +0100 To: Eric Auger CC: , , , , , , , , , , , Subject: Re: [PATCH v2 11/25] hw/i386/acpi-build: Introduce build_append_pcihp_resources() helper Message-ID: <20250530111719.00005714@huawei.com> In-Reply-To: <20250527074224.1197793-12-eric.auger@redhat.com> References: <20250527074224.1197793-1-eric.auger@redhat.com> <20250527074224.1197793-12-eric.auger@redhat.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.177.66] X-ClientProxiedBy: lhrpeml100006.china.huawei.com (7.191.160.224) To frapeml500008.china.huawei.com (7.182.85.71) X-Host-Lookup-Failed: Reverse DNS lookup failed for 185.176.79.56 (deferred) Received-SPF: pass client-ip=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Jonathan Cameron From: Jonathan Cameron via Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On Tue, 27 May 2025 09:40:13 +0200 Eric Auger wrote: > Extract the code that reserves resources for ACPI PCI hotplug > into a new helper named build_append_pcihp_resources() and > move it to pcihp.c. We will reuse it on ARM. > > Signed-off-by: Eric Auger > Reviewed-by: Gustavo Romero Trivial comment inline. Reviewed-by: Jonathan Cameron > --- > include/hw/acpi/pcihp.h | 2 ++ > hw/acpi/pcihp.c | 20 ++++++++++++++++++++ > hw/i386/acpi-build.c | 15 ++------------- > 3 files changed, 24 insertions(+), 13 deletions(-) > > diff --git a/include/hw/acpi/pcihp.h b/include/hw/acpi/pcihp.h > index 971451e8ea..8a46a414cc 100644 > --- a/include/hw/acpi/pcihp.h > +++ b/include/hw/acpi/pcihp.h > @@ -75,6 +75,8 @@ void acpi_pcihp_device_unplug_request_cb(HotplugHandler *hotplug_dev, > > void build_acpi_pci_hotplug(Aml *table, uint64_t pcihp_addr); > void build_append_pci_dsm_func0_common(Aml *ctx, Aml *retvar); > +void build_append_pcihp_resources(Aml *table, > + uint64_t io_addr, uint64_t io_len); > > /* Called on reset */ > void acpi_pcihp_reset(AcpiPciHpState *s); > diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c > index e0260f67e6..fb54c31f77 100644 > --- a/hw/acpi/pcihp.c > +++ b/hw/acpi/pcihp.c > @@ -685,6 +685,26 @@ void build_acpi_pci_hotplug(Aml *table, uint64_t pcihp_addr) > aml_append(table, scope); > } > > +/* Reserve PCIHP resources */ > +void build_append_pcihp_resources(Aml *scope /* \\_SB.PCI0 */, > + uint64_t io_addr, uint64_t io_len) > +{ > + Aml *dev, *crs; > + > + dev = aml_device("PHPR"); > + aml_append(dev, aml_name_decl("_HID", aml_string("PNP0A06"))); > + aml_append(dev, > + aml_name_decl("_UID", aml_string("PCI Hotplug resources"))); > + /* device present, functioning, decoding, not shown in UI */ > + aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); > + crs = aml_resource_template(); > + aml_append(crs, > + aml_io(AML_DECODE16, io_addr, io_addr, 1, io_len) > + ); Trivial but this doesn't match local style. It is even inconsistent with the _UID line above. > + aml_append(crs, > + aml_io(AML_DECODE16, io_addr, io_addr, 1, io_len)); maybe? > + aml_append(dev, aml_name_decl("_CRS", crs)); > + aml_append(scope, dev); > +} > + > const VMStateDescription vmstate_acpi_pcihp_pci_status = { > .name = "acpi_pcihp_pci_status", > .version_id = 1, > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > index 91945f716c..52cef834ed 100644 > --- a/hw/i386/acpi-build.c > +++ b/hw/i386/acpi-build.c > @@ -1432,19 +1432,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, > > /* reserve PCIHP resources */ > if (pm->pcihp_io_len && (pm->pcihp_bridge_en || pm->pcihp_root_en)) { > - dev = aml_device("PHPR"); > - aml_append(dev, aml_name_decl("_HID", aml_string("PNP0A06"))); > - aml_append(dev, > - aml_name_decl("_UID", aml_string("PCI Hotplug resources"))); > - /* device present, functioning, decoding, not shown in UI */ > - aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); > - crs = aml_resource_template(); > - aml_append(crs, > - aml_io(AML_DECODE16, pm->pcihp_io_base, pm->pcihp_io_base, 1, > - pm->pcihp_io_len) > - ); > - aml_append(dev, aml_name_decl("_CRS", crs)); > - aml_append(scope, dev); > + build_append_pcihp_resources(scope, > + pm->pcihp_io_base, pm->pcihp_io_len); > } > aml_append(dsdt, scope); >