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 5A9D8C5B549 for ; Fri, 30 May 2025 10:05:59 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uKwc1-0004QB-DU; Fri, 30 May 2025 06:05:17 -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 1uKwbw-0004NX-4O; Fri, 30 May 2025 06:05:12 -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 1uKwbt-0000NF-Mm; Fri, 30 May 2025 06:05:11 -0400 Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4b7zPV20tWz6GFWw; Fri, 30 May 2025 18:05:02 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id AC69C1402FC; Fri, 30 May 2025 18:05:07 +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:05:07 +0200 Date: Fri, 30 May 2025 11:05:05 +0100 To: Eric Auger CC: , , , , , , , , , , , Subject: Re: [PATCH v2 09/25] hw/pci-host/gpex-acpi: Use build_pci_host_bridge_osc_method Message-ID: <20250530110505.00007430@huawei.com> In-Reply-To: <20250527074224.1197793-10-eric.auger@redhat.com> References: <20250527074224.1197793-1-eric.auger@redhat.com> <20250527074224.1197793-10-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:11 +0200 Eric Auger wrote: > gpex build_host_bridge_osc() and x86 originated > build_pci_host_bridge_osc_method() are mostly identical. > > In GPEX, SUPP is set to CDW2 but is not further used. CTRL > is same as Local0. > > So let gpex code reuse build_pci_host_bridge_osc_method() > and remove build_host_bridge_osc(). > > The disassembled DSDT difference is given below: > > * Original Table Header: > * Signature "DSDT" > - * Length 0x00001A4F (6735) > + * Length 0x00001A35 (6709) > * Revision 0x02 > - * Checksum 0xBF > + * Checksum 0xDD > * OEM ID "BOCHS " > * OEM Table ID "BXPC " > * OEM Revision 0x00000001 (1) > @@ -1849,27 +1849,26 @@ DefinitionBlock ("", "DSDT", 2, "BOCHS ", "BXPC ", 0x00000001) > { > CreateDWordField (Arg3, 0x04, CDW2) > CreateDWordField (Arg3, 0x08, CDW3) > - SUPP = CDW2 /* \_SB_.PCI0._OSC.CDW2 */ > - CTRL = CDW3 /* \_SB_.PCI0._OSC.CDW3 */ > - CTRL &= 0x1F > + Local0 = CDW3 /* \_SB_.PCI0._OSC.CDW3 */ > + Local0 &= 0x1F > If ((Arg1 != One)) > { > CDW1 |= 0x08 > } > > - If ((CDW3 != CTRL)) > + If ((CDW3 != Local0)) > { > CDW1 |= 0x10 > } > > - CDW3 = CTRL /* \_SB_.PCI0.CTRL */ > - Return (Arg3) > + CDW3 = Local0 > } > Else > { > CDW1 |= 0x04 > - Return (Arg3) > } > + > + Return (Arg3) > } > > Method (_DSM, 4, NotSerialized) // _DSM: Device-Specific Method > > Signed-off-by: Eric Auger > > --- > > v1 -> v2: > - move in the dsdt.dsl diff in the commit message and remove useless > info (Gustavi, Michael) > --- > hw/pci-host/gpex-acpi.c | 60 +++-------------------------------------- > 1 file changed, 4 insertions(+), 56 deletions(-) > > diff --git a/hw/pci-host/gpex-acpi.c b/hw/pci-host/gpex-acpi.c > index f1ab30f3d5..98c9868c3f 100644 > --- a/hw/pci-host/gpex-acpi.c > +++ b/hw/pci-host/gpex-acpi.c > @@ -50,60 +50,7 @@ static void acpi_dsdt_add_pci_route_table(Aml *dev, uint32_t irq, > } > } > > -static Aml *build_host_bridge_osc(bool enable_native_pcie_hotplug) > -{ > - Aml *method, *UUID, *ifctx, *ifctx1, *elsectx; > - > - method = aml_method("_OSC", 4, AML_NOTSERIALIZED); > - aml_append(method, > - aml_create_dword_field(aml_arg(3), aml_int(0), "CDW1")); > - > - /* PCI Firmware Specification 3.0 > - * 4.5.1. _OSC Interface for PCI Host Bridge Devices > - * The _OSC interface for a PCI/PCI-X/PCI Express hierarchy is > - * identified by the Universal Unique IDentifier (UUID) > - * 33DB4D5B-1FF7-401C-9657-7441C03DD766 > - */ > - UUID = aml_touuid("33DB4D5B-1FF7-401C-9657-7441C03DD766"); > - ifctx = aml_if(aml_equal(aml_arg(0), UUID)); > - aml_append(ifctx, > - aml_create_dword_field(aml_arg(3), aml_int(4), "CDW2")); > - aml_append(ifctx, > - aml_create_dword_field(aml_arg(3), aml_int(8), "CDW3")); > - aml_append(ifctx, aml_store(aml_name("CDW2"), aml_name("SUPP"))); > - aml_append(ifctx, aml_store(aml_name("CDW3"), aml_name("CTRL"))); > - > - /* > - * Allow OS control for SHPCHotplug, PME, AER, PCIeCapability, > - * and PCIeHotplug depending on enable_native_pcie_hotplug > - */ > - aml_append(ifctx, aml_and(aml_name("CTRL"), > - aml_int(0x1E | (enable_native_pcie_hotplug ? 0x1 : 0x0)), > - aml_name("CTRL"))); > - > - ifctx1 = aml_if(aml_lnot(aml_equal(aml_arg(1), aml_int(0x1)))); > - aml_append(ifctx1, aml_or(aml_name("CDW1"), aml_int(0x08), > - aml_name("CDW1"))); > - aml_append(ifctx, ifctx1); > - > - ifctx1 = aml_if(aml_lnot(aml_equal(aml_name("CDW3"), aml_name("CTRL")))); > - aml_append(ifctx1, aml_or(aml_name("CDW1"), aml_int(0x10), > - aml_name("CDW1"))); > - aml_append(ifctx, ifctx1); > - > - aml_append(ifctx, aml_store(aml_name("CTRL"), aml_name("CDW3"))); > - aml_append(ifctx, aml_return(aml_arg(3))); > - aml_append(method, ifctx); > - > - elsectx = aml_else(); > - aml_append(elsectx, aml_or(aml_name("CDW1"), aml_int(4), > - aml_name("CDW1"))); > - aml_append(elsectx, aml_return(aml_arg(3))); > - aml_append(method, elsectx); > - return method; > -} > - > -static Aml *build_host_bridge_dsm(void) > +static Aml *build_pci_host_bridge_dsm_method(void) > { > Aml *method = aml_method("_DSM", 4, AML_NOTSERIALIZED); > Aml *UUID, *ifctx, *ifctx1, *buf; > @@ -134,8 +81,9 @@ static void acpi_dsdt_add_host_bridge_methods(Aml *dev, > aml_append(dev, aml_name_decl("SUPP", aml_int(0))); > aml_append(dev, aml_name_decl("CTRL", aml_int(0))); This is where they become unused I think... > /* Declare an _OSC (OS Control Handoff) method */ > - aml_append(dev, build_host_bridge_osc(enable_native_pcie_hotplug)); > - aml_append(dev, build_host_bridge_dsm()); > + aml_append(dev, > + build_pci_host_bridge_osc_method(enable_native_pcie_hotplug)); > + aml_append(dev, build_pci_host_bridge_dsm_method()); > } > > void acpi_dsdt_add_gpex(Aml *scope, struct GPEXConfig *cfg)