From: David Gibson <david@gibson.dropbear.id.au>
To: Greg Kurz <groug@kaod.org>
Cc: qemu-ppc@nongnu.org, "Cédric Le Goater" <clg@kaod.org>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] spapr_pci: Fix DRC owner in spapr_dt_pci_bus()
Date: Tue, 18 Jun 2019 18:46:07 +1000 [thread overview]
Message-ID: <20190618084607.GD3673@umbus.BigPond> (raw)
In-Reply-To: <156084737348.512412.3552825999605902691.stgit@bahia.lan>
[-- Attachment #1: Type: text/plain, Size: 2163 bytes --]
On Tue, Jun 18, 2019 at 10:42:53AM +0200, Greg Kurz wrote:
> spapr_dt_drc() scans the aliases of all DRConnector objects and filters
> the ones that it will use to generate OF properties according to their
> owner and type.
>
> Passing bus->parent_dev _works_ if bus belongs to a PCI bridge, but it is
> NULL if it is the PHB's root bus. This causes all allocated PCI DRCs to
> be associated to all PHBs (visible in their "ibm,drc-types" properties).
> As a consequence, hot unplugging a PHB results in PCI devices from the
> other PHBs to be unplugged as well, and likely confuses the guest.
>
> Use the same logic as in add_drcs() to ensure the correct owner is passed
> to spapr_dt_drc().
>
> Fixes: 14e714900f6b "spapr: Allow hot plug/unplug of PCI bridges and devices under PCI bridges"
> Signed-off-by: Greg Kurz <groug@kaod.org>
Applied, thanks.
> ---
> hw/ppc/spapr_pci.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
> index fbeb1c90ee6c..2dca1e57f36c 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -1343,6 +1343,7 @@ static void spapr_dt_pci_device_cb(PCIBus *bus, PCIDevice *pdev,
> static int spapr_dt_pci_bus(SpaprPhbState *sphb, PCIBus *bus,
> void *fdt, int offset)
> {
> + Object *owner;
> PciWalkFdt cbinfo = {
> .fdt = fdt,
> .offset = offset,
> @@ -1363,7 +1364,13 @@ static int spapr_dt_pci_bus(SpaprPhbState *sphb, PCIBus *bus,
> return cbinfo.err;
> }
>
> - ret = spapr_dt_drc(fdt, offset, OBJECT(bus->parent_dev),
> + if (pci_bus_is_root(bus)) {
> + owner = OBJECT(sphb);
> + } else {
> + owner = OBJECT(pci_bridge_get_device(bus));
> + }
> +
> + ret = spapr_dt_drc(fdt, offset, owner,
> SPAPR_DR_CONNECTOR_TYPE_PCI);
> if (ret) {
> return ret;
>
--
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2019-06-18 10:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-18 8:42 [Qemu-devel] [PATCH] spapr_pci: Fix DRC owner in spapr_dt_pci_bus() Greg Kurz
2019-06-18 8:46 ` David Gibson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190618084607.GD3673@umbus.BigPond \
--to=david@gibson.dropbear.id.au \
--cc=clg@kaod.org \
--cc=groug@kaod.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).