From nobody Thu Apr 18 23:24:22 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1555068120; cv=none; d=zoho.com; s=zohoarc; b=fJs9LsvuXurBslRTGliPsR5hZ3R1OrD2GK+kFWUyRt6VQN0l/SgsnUY+4OinNCdTVjSwHdOKdCcS2msB29BZKYmTCECQEUy+rXxyN5HQGtwcPViP1REPKdnqx4/b1wD38GB2SfX6IwDJQ1Lzp/tDz25Fk+EDIpeaHh+egcDE39g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555068120; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=BG9BwEJaY4Pr1ruyObCdng/jrKCJowyn3iO1W3393sw=; b=mK8qpaYWTx03Rs9m4zt9CPb1Jhle60haxd6E9rqFPLxg1Lp0zpU8EoE6JZQJfxYBkwB3y8iw1mpLRaq6h8AdZVGfeuiKw6saNJHaUBjcr0Tx0AeOX1cHNfQ9A1reoBrRCoSAOuO+zgdPi6lC4ajazmtaIT+tfzWXmj2FhVMkEuk= ARC-Authentication-Results: i=1; mx.zoho.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 1555068118807347.3264675800218; Fri, 12 Apr 2019 04:21:58 -0700 (PDT) Received: from localhost ([127.0.0.1]:34509 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEuFn-00085H-Sb for importer@patchew.org; Fri, 12 Apr 2019 07:21:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEuEu-0007gC-EX for qemu-devel@nongnu.org; Fri, 12 Apr 2019 07:21:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hEuEq-0001HO-ST for qemu-devel@nongnu.org; Fri, 12 Apr 2019 07:20:58 -0400 Received: from ozlabs.org ([203.11.71.1]:45925) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hEuEm-0001Au-DV; Fri, 12 Apr 2019 07:20:54 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44gb6l528Lz9s9y; Fri, 12 Apr 2019 21:20:47 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1555068047; bh=uxOHtX70uw6UrGIGIWWT6Bc2UG05pFqcNPJm2NQAR/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nFWHk9bEKRclQtrDGBhiW9vOy2Bw27DU7vFC1X8ULDJJBnB6xovYY+KrkD6BOatZY VYcE5RYY9BGmUwWFc/+tL+kSy2HFNbHaHycXJxb0dbJ3d/QE5qrTlXs5WlltMtBIQt Z2ttzhmzzuzY9uUWcNclKHzTAJf89xSWKqGQ9FEs= From: David Gibson To: peter.maydell@linaro.org Date: Fri, 12 Apr 2019 21:20:44 +1000 Message-Id: <20190412112044.15361-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190412112044.15361-1-david@gibson.dropbear.id.au> References: <20190412112044.15361-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 1/1] spapr_pci: Fix broken naming of PCI bus 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, mst@redhat.com, clg@redhat.com, qemu-devel@nongnu.org, groug@kaod.org, alex.williamson@redhat.com, spopovyc@redhat.com, qemu-ppc@nongnu.org, marcel@redhat.com, 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: Greg Kurz Recent commit 5cf0d326a0fe fixed a regression which was preventing the guest to access the extended config space of a PCIe device. This was done by introducing a new PCI bus subtype for PAPR. The original fix was causing PCI busses to be named "spapr-pci-host-bridge-root-bus.N" instead of "pci.N", which was making upper layers unhappy of course. This got worked around by hardcoding the PCI bus name to "pci.0", but this only works for the default PHB. And we're now hitting: # qemu-system-ppc64 \ -device spapr-pci-host-bridge,index=3D1 \ -device e1000e,bus=3Dpci.0 \ -device e1000e,bus=3Dpci.1 qemu-system-ppc64: -device e1000e,bus=3Dpci.1: Bus 'pci.1' not found David already posted some patches [1] to control PCI extended config space accesses with a new flag in the base PCI bus class instead of subtyping. These patches are a bit more intrusive though, and are targetted for 4.1. When no name is passed to pci_register_bus(), the core device code generates a lowercase name based on the QOM typename. The typename for the base PCI bus class is "PCI", hence the "pci.0", "pci.1" bus names. Rename the type of the PAPR PCI bus to "pci", so that the QOM code can generate proper names. This is a hack but it is enough to fix the regression. And all this will be reworked properly in 4.1. [1] https://patchwork.ozlabs.org/project/qemu-devel/list/?series=3D100486 Fixes: 5cf0d326a0fe Signed-off-by: Greg Kurz Message-Id: <155500034416.646888.1307366522340665522.stgit@bahia.lab.toulou= se-stg.fr.ibm.com> Signed-off-by: David Gibson --- hw/ppc/spapr_pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index f0b6b23afc..f62e6833b8 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1652,7 +1652,7 @@ static void spapr_phb_root_bus_class_init(ObjectClass= *klass, void *data) pbc->allows_extended_config_space =3D spapr_phb_allows_extended_config= _space; } =20 -#define TYPE_SPAPR_PHB_ROOT_BUS "spapr-pci-host-bridge-root-bus" +#define TYPE_SPAPR_PHB_ROOT_BUS "pci" =20 static const TypeInfo spapr_phb_root_bus_info =3D { .name =3D TYPE_SPAPR_PHB_ROOT_BUS, @@ -1761,7 +1761,7 @@ static void spapr_phb_realize(DeviceState *dev, Error= **errp) memory_region_add_subregion(get_system_memory(), sphb->io_win_addr, &sphb->iowindow); =20 - bus =3D pci_register_root_bus(dev, "pci.0", + bus =3D pci_register_root_bus(dev, NULL, pci_spapr_set_irq, pci_spapr_map_irq, sphb, &sphb->memspace, &sphb->iospace, PCI_DEVFN(0, 0), PCI_NUM_PINS, --=20 2.20.1