From nobody Sun Nov 9 15:57:24 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; dkim=fail; spf=pass (zoho.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 1551159577580329.24339528710937; Mon, 25 Feb 2019 21:39:37 -0800 (PST) Received: from localhost ([127.0.0.1]:49691 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyVSn-00064z-CY for importer@patchew.org; Tue, 26 Feb 2019 00:39:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyUmI-0006PH-US for qemu-devel@nongnu.org; Mon, 25 Feb 2019 23:55:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gyUmD-0003l9-8E for qemu-devel@nongnu.org; Mon, 25 Feb 2019 23:55:36 -0500 Received: from ozlabs.org ([203.11.71.1]:43245) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gyUlx-0002zk-8g; Mon, 25 Feb 2019 23:55:22 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 447mfQ5tykz9sPK; Tue, 26 Feb 2019 15:53:16 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1551156798; bh=3AhKYUq/PAOvrpLgE9p1DHnxiBb7gdHxukUcoldE4Tw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RGV02p+CeDPFbPjpgpoLlfNQHbD4uZL/0Ybr/WSAm9+G4fn3gKbOOxBUPDswB1+q1 23m00/hfaBeUZL4kDL4oQXTjtCvIdU6Evq0OKYUFcN+0sUh1LojPkpgfRq7Zl0P1e7 HZLJBL51jdsASq5K/jc4H8HAsHHQxn/qJLe0d01k= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 26 Feb 2019 15:52:55 +1100 Message-Id: <20190226045304.25618-42-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190226045304.25618-1-david@gibson.dropbear.id.au> References: <20190226045304.25618-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 41/50] spapr_pci: provide node start offset via spapr_populate_pci_dt() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, gkurz@kaod.org, Michael Roth , qemu-devel@nongnu.org, Greg Kurz , qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Michael Roth PHB hotplug re-uses PHB device tree generation code and passes it to a guest via RTAS. Doing this requires knowledge of where exactly in the device tree the node describing the PHB begins. Provide this via a new optional pointer that can be used to store the PHB node's start offset. Signed-off-by: Michael Roth Reviewed-by: David Gibson Signed-off-by: Greg Kurz Message-Id: <155059671912.1466090.10891589403973703473.stgit@bahia.lab.toul= ouse-stg.fr.ibm.com> Signed-off-by: David Gibson --- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_pci.c | 5 ++++- include/hw/pci-host/spapr.h | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index fcda177090..76b3c15d59 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1312,7 +1312,7 @@ static void *spapr_build_fdt(sPAPRMachineState *spapr) =20 QLIST_FOREACH(phb, &spapr->phbs, list) { ret =3D spapr_populate_pci_dt(phb, PHANDLE_INTC, fdt, - spapr->irq->nr_msis); + spapr->irq->nr_msis, NULL); if (ret < 0) { error_report("couldn't setup PCI devices in fdt"); exit(1); diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index ede928b0bf..a0e1769439 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -2153,7 +2153,7 @@ static void spapr_phb_pci_enumerate(sPAPRPHBState *ph= b) } =20 int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t intc_phandle, void = *fdt, - uint32_t nr_msis) + uint32_t nr_msis, int *node_offset) { int bus_off, i, j, ret; gchar *nodename; @@ -2208,6 +2208,9 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_= t intc_phandle, void *fdt, nodename =3D g_strdup_printf("pci@%" PRIx64, phb->buid); _FDT(bus_off =3D fdt_add_subnode(fdt, 0, nodename)); g_free(nodename); + if (node_offset) { + *node_offset =3D bus_off; + } =20 /* Write PHB properties */ _FDT(fdt_setprop_string(fdt, bus_off, "device_type", "pci")); diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h index 4b0443f4cf..ab0e3a0a6f 100644 --- a/include/hw/pci-host/spapr.h +++ b/include/hw/pci-host/spapr.h @@ -113,7 +113,7 @@ static inline qemu_irq spapr_phb_lsi_qirq(struct sPAPRP= HBState *phb, int pin) } =20 int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t intc_phandle, void = *fdt, - uint32_t nr_msis); + uint32_t nr_msis, int *node_offset); =20 void spapr_pci_rtas_init(void); =20 --=20 2.20.1