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 EF53CC71155 for ; Fri, 20 Jun 2025 09:36:45 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uSYAD-0008LU-K7; Fri, 20 Jun 2025 05:36:01 -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 1uSYAB-0008Kq-0d; Fri, 20 Jun 2025 05:35:59 -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 1uSYA4-0000Pl-Dt; Fri, 20 Jun 2025 05:35:57 -0400 Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4bNsfQ3wZTz6L64B; Fri, 20 Jun 2025 17:30:54 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id 98A8C140446; Fri, 20 Jun 2025 17:35:40 +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, 20 Jun 2025 11:35:40 +0200 Date: Fri, 20 Jun 2025 10:35:38 +0100 To: Eric Auger CC: , , , , , , , , , , , Subject: Re: [PATCH v3 17/29] hw/arm/virt-acpi-build: Modify the DSDT ACPI table to enable ACPI PCI hotplug Message-ID: <20250620103538.000021c1@huawei.com> In-Reply-To: <20250616094903.885753-18-eric.auger@redhat.com> References: <20250616094903.885753-1-eric.auger@redhat.com> <20250616094903.885753-18-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: lhrpeml100009.china.huawei.com (7.191.174.83) 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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 Mon, 16 Jun 2025 11:46:46 +0200 Eric Auger wrote: > Modify the DSDT ACPI table to enable ACPI PCI hotplug. > > Signed-off-by: Eric Auger > > --- > v2 -> v3: > - use ACPI_PCIHP_SIZE instead of 0x1000 (Igor) > - use cihp_state->use_acpi_hotplug_bridge pcihp_state Takes a bit of searching to find the various bits of the same support on x86 but this seems to match up. Exactly when things are built does vary but not I think in a way that matters. e.g. I think on x86 the EDSM stuff is built whether or not we have pcihp enabled whereas here you've made it conditional on using acpi hp. Perhaps a tiny bit more description on that would be useful if you do a v4? Reviewed-by: Jonathan Cameron > --- > include/hw/acpi/pcihp.h | 2 ++ > include/hw/arm/virt.h | 1 + > hw/arm/virt-acpi-build.c | 22 ++++++++++++++++++++++ > hw/arm/virt.c | 2 ++ > hw/arm/Kconfig | 2 ++ > 5 files changed, 29 insertions(+) > > diff --git a/include/hw/acpi/pcihp.h b/include/hw/acpi/pcihp.h > index 5506a58862..9ff548650b 100644 > --- a/include/hw/acpi/pcihp.h > +++ b/include/hw/acpi/pcihp.h > @@ -38,6 +38,8 @@ > #define ACPI_PCIHP_SEJ_BASE 0x8 > #define ACPI_PCIHP_BNMR_BASE 0x10 > > +#define ACPI_PCIHP_SIZE 0x0018 > + > typedef struct AcpiPciHpPciStatus { > uint32_t up; > uint32_t down; > diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h > index 9a1b0f53d2..0ed2e6b732 100644 > --- a/include/hw/arm/virt.h > +++ b/include/hw/arm/virt.h > @@ -79,6 +79,7 @@ enum { > VIRT_ACPI_GED, > VIRT_NVDIMM_ACPI, > VIRT_PVTIME, > + VIRT_ACPI_PCIHP, > VIRT_LOWMEMMAP_LAST, > }; > > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > index d7547c8d3b..a2e58288f8 100644 > --- a/hw/arm/virt-acpi-build.c > +++ b/hw/arm/virt-acpi-build.c > @@ -34,6 +34,7 @@ > #include "hw/core/cpu.h" > #include "hw/acpi/acpi-defs.h" > #include "hw/acpi/acpi.h" > +#include "hw/acpi/pcihp.h" > #include "hw/nvram/fw_cfg_acpi.h" > #include "hw/acpi/bios-linker-loader.h" > #include "hw/acpi/aml-build.h" > @@ -809,6 +810,8 @@ static void > build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) > { > VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms); > + AcpiGedState *acpi_ged_state = ACPI_GED(vms->acpi_dev); > + AcpiPciHpState *pcihp_state = &acpi_ged_state->pcihp_state; > Aml *scope, *dsdt; > MachineState *ms = MACHINE(vms); > const MemMapEntry *memmap = vms->memmap; > @@ -868,6 +871,25 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) > > aml_append(dsdt, scope); > > + if (pcihp_state->use_acpi_hotplug_bridge) { > + Aml *pci0_scope = aml_scope("\\_SB.PCI0"); > + > + aml_append(pci0_scope, aml_pci_edsm()); > + build_acpi_pci_hotplug(dsdt, AML_SYSTEM_MEMORY, > + memmap[VIRT_ACPI_PCIHP].base); > + build_append_pcihp_resources(pci0_scope, > + memmap[VIRT_ACPI_PCIHP].base, > + memmap[VIRT_ACPI_PCIHP].size); > + > + /* Scan all PCI buses. Generate tables to support hotplug. */ > + build_append_pci_bus_devices(pci0_scope, vms->bus); > + if (object_property_find(OBJECT(vms->bus), ACPI_PCIHP_PROP_BSEL)) { > + build_append_pcihp_slots(pci0_scope, vms->bus); > + } > + build_append_notification_callback(pci0_scope, vms->bus); > + aml_append(dsdt, pci0_scope); > + } > + > /* copy AML table into ACPI tables blob */ > g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len); >