From: David Gibson <david@gibson.dropbear.id.au>
To: Greg Kurz <groug@kaod.org>
Cc: qemu-devel@nongnu.org, Alexey Kardashevskiy <aik@ozlabs.ru>,
Michael Roth <mdroth@linux.vnet.ibm.com>,
qemu-ppc@nongnu.org, Bharata B Rao <bharata@linux.vnet.ibm.com>,
Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [for-2.10 PATCH 3/3] spapr: error out if PHB fails to setup PCI DRCs
Date: Tue, 8 Aug 2017 16:16:36 +1000 [thread overview]
Message-ID: <20170808061636.GB25081@umbus.fritz.box> (raw)
In-Reply-To: <150212670348.12227.5534815630591997333.stgit@bahia>
[-- Attachment #1: Type: text/plain, Size: 3613 bytes --]
On Mon, Aug 07, 2017 at 07:25:03PM +0200, Greg Kurz wrote:
> It is currently possible to start QEMU with two PHBs without using the
> index property:
>
> -device spapr-pci-host-bridge,id=pci1,\
> buid=0x800000020000001,\
> liobn=0x80000100,\
> liobn64=0x80000101,\
> mem_win_addr=0x200100000000,\
> mem64_win_addr=0x220000000000,\
> io_win_addr=0x200000010000 \
> -device spapr-pci-host-bridge,id=pci2,\
> buid=0x800000020000002,\
> liobn=0x80000200,\
> liobn64=0x80000201,\
> mem_win_addr=0x200180000000,\
> mem64_win_addr=0x230000000000,\
> io_win_addr=0x200000020000 \
>
> Each PHB has its index property equal to -1. As a consequence, each PHB
> will want to create PCI DRCs with the same ids:
>
> /* allocate connectors for child PCI devices */
> if (sphb->dr_enabled) {
> for (i = 0; i < PCI_SLOT_MAX * 8; i++) {
> spapr_dr_connector_new(OBJECT(phb), TYPE_SPAPR_DRC_PCI,
> (sphb->index << 16) | i);
> }
> }
>
> When DRC objects are added to the composition tree, an alias using the
> DRC id is created in the "/dr-connector" path. But DRC ids are supposed
> to be globally unique and the alias creation fails, leaving the DRC
> object unrealized, which isn't expected by the rest of the DR logic.
>
> This has the effect of silently turning-off PCI hotplug support (ie, PCI
> hotplug no longer works on any PHB and no error message is printed).
>
> This bug always existed and would even cause a non-fatal error to be
> reported on the console (until recent commit bf26ae32a92a). This patch
> causes the error message to be printed again and QEMU to exit.
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
Given that the bug isn't a regression, I'm a bit disinclined to merge
patches 2&3 this late in 2.10.
It just seems bogus to have all this code to (supposedly) allow
bridges without an index, but then have it error out if there's more
than one of them.
I think skip straight to the real fix of making index madatory in 2.11.
> ---
> 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 4b7882e3613d..4a1e6c5f697c 100644
> --- a/hw/ppc/spapr_pci.c
> +++ b/hw/ppc/spapr_pci.c
> @@ -1731,9 +1731,16 @@ static void spapr_phb_realize(DeviceState *dev, Error **errp)
>
> /* allocate connectors for child PCI devices */
> if (sphb->dr_enabled) {
> + Error *local_err = NULL;
> +
> for (i = 0; i < PCI_SLOT_MAX * 8; i++) {
> spapr_dr_connector_new(OBJECT(phb), TYPE_SPAPR_DRC_PCI,
> - (sphb->index << 16) | i, NULL);
> + (sphb->index << 16) | i, &local_err);
> + if (local_err) {
> + error_propagate(errp, local_err);
> + error_prepend(errp, "Failed to create DRC: ");
> + return;
> + }
> }
> }
>
>
--
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 --]
next prev parent reply other threads:[~2017-08-08 6:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-07 17:24 [Qemu-devel] [for-2.10 PATCH 0/3] spapr: fix PCI hotplug issue when PHBs don't have index Greg Kurz
2017-08-07 17:24 ` [Qemu-devel] [for-2.10 PATCH 1/3] spapr_drc: abort if object_property_add_child() fails Greg Kurz
2017-08-08 6:09 ` David Gibson
2017-08-07 17:24 ` [Qemu-devel] [for-2.10 PATCH 2/3] spapr_drc: add Error ** argument to spapr_dr_connector_new() Greg Kurz
2017-08-07 17:25 ` [Qemu-devel] [for-2.10 PATCH 3/3] spapr: error out if PHB fails to setup PCI DRCs Greg Kurz
2017-08-08 6:16 ` David Gibson [this message]
2017-08-08 9:18 ` Greg Kurz
2017-08-09 3:33 ` David Gibson
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=20170808061636.GB25081@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=aik@ozlabs.ru \
--cc=bharata@linux.vnet.ibm.com \
--cc=danielhb@linux.vnet.ibm.com \
--cc=groug@kaod.org \
--cc=mdroth@linux.vnet.ibm.com \
--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).