From nobody Fri May 17 05:50:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1580265152914768.124834477216; Tue, 28 Jan 2020 18:32:32 -0800 (PST) Received: from localhost ([::1]:39950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwd9a-0001vK-Sw for importer@patchew.org; Tue, 28 Jan 2020 21:32:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51973) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwd8v-0001O3-6B for qemu-devel@nongnu.org; Tue, 28 Jan 2020 21:31:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iwd8t-0008OD-75 for qemu-devel@nongnu.org; Tue, 28 Jan 2020 21:31:48 -0500 Received: from [107.174.27.60] (port=33910 helo=ozlabs.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iwd8t-0008Cb-13; Tue, 28 Jan 2020 21:31:47 -0500 Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 20E11AE80021; Tue, 28 Jan 2020 21:29:49 -0500 (EST) From: Alexey Kardashevskiy To: qemu-devel@nongnu.org Subject: [PATCH qemu] spapr_pci: Create assigned properties for bridges Date: Wed, 29 Jan 2020 13:31:11 +1100 Message-Id: <20200129023111.1699-1-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 107.174.27.60 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexey Kardashevskiy , qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" QEMU assigns bus numbers so tell the guest about assigned values. This also adds an empty "ranges" to let the existing linux kernels proceed far enough to trigger resource reassignment (which is rather a hack). Signed-off-by: Alexey Kardashevskiy --- This is a part of the "kill CAS reboot" effort, the SLOF's side of it was posted as "[PATCH slof] fdt: Fix creating new nodes at H_CAS" --- hw/ppc/spapr_pci.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 723373de732c..877ff1d0d5fa 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1336,7 +1336,23 @@ static int spapr_dt_pci_bus(SpaprPhbState *sphb, PCI= Bus *bus, if (pci_bus_is_root(bus)) { owner =3D OBJECT(sphb); } else { - owner =3D OBJECT(pci_bridge_get_device(bus)); + PCIDevice *pdev =3D pci_bridge_get_device(bus); + uint8_t pri =3D pci_default_read_config(pdev, PCI_PRIMARY_BUS, 1); + uint8_t sec =3D pci_default_read_config(pdev, PCI_SECONDARY_BUS, = 1); + uint8_t sub =3D pci_default_read_config(pdev, PCI_SUBORDINATE_BUS= , 1); + uint32_t range[] =3D { cpu_to_be32(sec), cpu_to_be32(sub) }; + + /* + * Create these to get existing Linux kernels proceed far enough to + * trigger resource reassignment. We creates these for vPHB alread= y. + */ + _FDT(fdt_setprop_cell(fdt, offset, "primary-bus", pri)); + _FDT(fdt_setprop_cell(fdt, offset, "secondary-bus", sec)); + _FDT(fdt_setprop_cell(fdt, offset, "subordinate-bus", sub)); + _FDT(fdt_setprop(fdt, offset, "bus-range", range, sizeof(range))); + _FDT(fdt_setprop_string(fdt, offset, "device_type", "pci")); + _FDT(fdt_setprop(fdt, offset, "ranges", NULL, 0)); + owner =3D OBJECT(pdev); } =20 ret =3D spapr_dt_drc(fdt, offset, owner, --=20 2.17.1