From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ypcb2-0000Ua-Sf for qemu-devel@nongnu.org; Tue, 05 May 2015 09:09:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ypcb1-0001AZ-GL for qemu-devel@nongnu.org; Tue, 05 May 2015 09:09:12 -0400 Date: Tue, 5 May 2015 23:09:05 +1000 From: David Gibson Message-ID: <20150505130905.GV14090@voom.redhat.com> References: <1430816036-26408-1-git-send-email-nikunj@linux.vnet.ibm.com> <1430816036-26408-6-git-send-email-nikunj@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="koL31lyvAMI81oAr" Content-Disposition: inline In-Reply-To: <1430816036-26408-6-git-send-email-nikunj@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH v3 5/6] spapr_pci: fix boot-time device tree fields for pci hotplug List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikunj A Dadhania Cc: aik@ozlabs.ru, mdroth@linux.vnet.ibm.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, agraf@suse.de --koL31lyvAMI81oAr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 05, 2015 at 02:23:55PM +0530, Nikunj A Dadhania wrote: > From: Michael Roth >=20 > We need to set the proper drc_index values in ibm,my-drc-index > fields in order to allow a PCI device that was present at > boot-time to be unplugged. >=20 > Previously SLOF handles this, but with QEMU handling the DT we > need to do it there as well. >=20 > This patch slightly changes how SLOF handled it in the past, > which was to allows add an ibm,my-drc-index value based on > PCI slot/devices topology. Now we only add it when the slot > supports hotplug and has a DR connector, which is more inline > with PAPR. >=20 > Signed-off-by: Michael Roth > Signed-off-by: Nikunj A Dadhania > --- > hw/ppc/spapr_pci.c | 21 +++++++++++++++++++-- > 1 file changed, 19 insertions(+), 2 deletions(-) >=20 > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c > index 103284a..cbd5661 100644 > --- a/hw/ppc/spapr_pci.c > +++ b/hw/ppc/spapr_pci.c > @@ -951,7 +951,9 @@ static int spapr_populate_pci_child_dt(PCIDevice *dev= , void *fdt, int offset, > _FDT(fdt_setprop(fdt, offset, "ibm,loc-code", drc_name, > strlen(drc_name))); > } > - _FDT(fdt_setprop_cell(fdt, offset, "ibm,my-drc-index", drc_index)); > + if (drc_index) { > + _FDT(fdt_setprop_cell(fdt, offset, "ibm,my-drc-index", drc_index= )); > + } > =20 > _FDT(fdt_setprop_cell(fdt, offset, "#address-cells", > RESOURCE_CELLS_ADDRESS)); > @@ -1483,6 +1485,20 @@ PCIHostState *spapr_create_phb(sPAPREnvironment *s= papr, int index) > return PCI_HOST_BRIDGE(dev); > } > =20 > +static uint32_t spapr_phb_get_pci_drc_index(sPAPRPHBState *phb, > + PCIDevice *pdev) > +{ > + sPAPRDRConnector *drc =3D spapr_phb_get_pci_drc(phb, pdev); > + sPAPRDRConnectorClass *drck; > + > + if (!drc) { > + return 0; > + } > + > + drck =3D SPAPR_DR_CONNECTOR_GET_CLASS(drc); > + return drck->get_index(drc); > +} > + > typedef struct sPAPRFDT { > void *fdt; > int node_off; > @@ -1499,6 +1515,7 @@ static void spapr_populate_pci_devices_dt(PCIBus *b= us, PCIDevice *pdev, > int func =3D PCI_FUNC(pdev->devfn); > char nodename[512]; > sPAPRFDT s_fdt; > + uint32_t drc_index =3D spapr_phb_get_pci_drc_index(p->sphb, pdev); The line above causes a compile error, since sPAPRFDT doesn't have an sphb member. Its fixed in the next patch, but can you adjust the series so it won't break bisection. > if (func) { > sprintf(nodename, "pci@%d,%d", slot, func); > @@ -1506,7 +1523,7 @@ static void spapr_populate_pci_devices_dt(PCIBus *b= us, PCIDevice *pdev, > sprintf(nodename, "pci@%d", slot); > } > offset =3D fdt_add_subnode(p->fdt, p->node_off, nodename); > - ret =3D spapr_populate_pci_child_dt(pdev, p->fdt, offset, p->index, = 0, NULL); > + ret =3D spapr_populate_pci_child_dt(pdev, p->fdt, offset, p->index, = drc_index, NULL); > g_assert(!ret); > =20 > if ((pci_default_read_config(pdev, PCI_HEADER_TYPE, 1) !=3D --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --koL31lyvAMI81oAr Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVSMDxAAoJEGw4ysog2bOS5REP/jKzTM2XT9XV03PqlWUwTvbu xipoE3RqK3hiZRlCiDgh9rq64aPpMGZSBzMzNxfDPlvMlKTjwRPeeJ/ID2Jr60Jk g+GaJHrtus1Ut0dd7pz8nWHPZ+ntodn21/5d070pXDoRgkh2IAta+MTJnAGRdRCl ZjK0486fmoqlX6zPDCVCAysf2q4AwYKQNbUZd0WdwuPBoOlWk0NBoKZqoR7dKajW /2/q4qv0r9SL4LlUOqoyxpliEOqoCN84Zvcc9HtHHE6OIVr6OIDiZ5NAuYWQ8TCn WttKgYwUBZiR5JjrsLsGxMGwrKFKtyi+FVDOmcJuWKV91OeXhC0AUchAO9oWBAFf aq3XdzTdQ4tgG3IzqGVBtcO9aggqnGgVaw75l1RH5x3oDWreR7onXehM1Bcn78R7 0VBdT4msF6RJLL9P+jNxlF1U3B+7VNjO6yrOJTySh245aFMELz+C2ZdqljR55d0h 2zJDeM/aohSqloarUIgnXx4u6yK5xTnRsl77YTkmFTrYCTIEPwAyN/FtO+kihC/9 aYenTkWDy3NFgnaVxGdMbKoySKFwacPntWzYhVoJwYhdwHaz2IhEITZlNsaJRTOb MoDX1UFLqudWKDceedS0+Q4qIB72ARd0Xm8M3I+4A/TLlJItJnA0iopuJVIbkqAt fPsbG/GeRQi4ImCiXEjI =TOvu -----END PGP SIGNATURE----- --koL31lyvAMI81oAr--