From patchwork Wed Apr 29 19:20:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 466250 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8AAF9140308 for ; Thu, 30 Apr 2015 05:21:57 +1000 (AEST) Received: from localhost ([::1]:40681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnXYR-0002lE-BG for incoming@patchwork.ozlabs.org; Wed, 29 Apr 2015 15:21:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnXXh-0001H7-6a for qemu-devel@nongnu.org; Wed, 29 Apr 2015 15:21:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YnXXb-00069r-DK for qemu-devel@nongnu.org; Wed, 29 Apr 2015 15:21:09 -0400 Received: from e17.ny.us.ibm.com ([129.33.205.207]:51065) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YnXXb-00069d-AB for qemu-devel@nongnu.org; Wed, 29 Apr 2015 15:21:03 -0400 Received: from /spool/local by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 29 Apr 2015 15:21:03 -0400 Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e17.ny.us.ibm.com (146.89.104.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 29 Apr 2015 15:21:01 -0400 Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 0640CC90045; Wed, 29 Apr 2015 15:12:09 -0400 (EDT) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t3TJL0Nb53739690; Wed, 29 Apr 2015 19:21:00 GMT Received: from d01av04.pok.ibm.com (localhost [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t3TJKxkH019629; Wed, 29 Apr 2015 15:21:00 -0400 Received: from localhost ([9.80.84.126]) by d01av04.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t3TJKx4H019568; Wed, 29 Apr 2015 15:20:59 -0400 From: Michael Roth To: qemu-devel@nongnu.org Date: Wed, 29 Apr 2015 14:20:22 -0500 Message-Id: <1430335224-6716-14-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430335224-6716-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1430335224-6716-1-git-send-email-mdroth@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15042919-0041-0000-0000-00000031030D X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 129.33.205.207 Cc: aik@ozlabs.ru, nfont@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Subject: [Qemu-devel] [RFC PATCH 13/15] spapr_pci: provide node start offset via spapr_populate_pci_dt() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- hw/ppc/spapr.c | 2 +- hw/ppc/spapr_pci.c | 6 +++++- include/hw/pci-host/spapr.h | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 042e7a9..ecf40e4 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -767,7 +767,7 @@ static void spapr_finalize_fdt(sPAPREnvironment *spapr, } QLIST_FOREACH(phb, &spapr->phbs, list) { - ret = spapr_populate_pci_dt(phb, PHANDLE_XICP, fdt); + ret = spapr_populate_pci_dt(phb, PHANDLE_XICP, fdt, NULL); } if (ret < 0) { diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index e37de28..66fe85f 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1534,7 +1534,8 @@ PCIHostState *spapr_create_phb(sPAPREnvironment *spapr, int index) int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t xics_phandle, - void *fdt) + void *fdt, + int *node_offset) { int bus_off, i, j, ret; char nodename[256]; @@ -1578,6 +1579,9 @@ int spapr_populate_pci_dt(sPAPRPHBState *phb, if (bus_off < 0) { return bus_off; } + if (node_offset) { + *node_offset = bus_off; + } /* 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 9dca388..32a9213 100644 --- a/include/hw/pci-host/spapr.h +++ b/include/hw/pci-host/spapr.h @@ -126,7 +126,8 @@ PCIHostState *spapr_create_phb(sPAPREnvironment *spapr, int index); int spapr_populate_pci_dt(sPAPRPHBState *phb, uint32_t xics_phandle, - void *fdt); + void *fdt, + int *node_offset); void spapr_pci_msi_init(sPAPREnvironment *spapr, hwaddr addr);