From nobody Wed Feb 11 04:39:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1498230340666191.3669458641956; Fri, 23 Jun 2017 08:05:40 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06E6C7C839; Fri, 23 Jun 2017 15:05:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D19F66F9CA; Fri, 23 Jun 2017 15:05:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7E6F2267; Fri, 23 Jun 2017 15:05:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5NF5a0F004510 for ; Fri, 23 Jun 2017 11:05:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id D35B96E8D3; Fri, 23 Jun 2017 15:05:36 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-12-57.pek2.redhat.com [10.72.12.57]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E8A166F9CD for ; Fri, 23 Jun 2017 15:05:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 06E6C7C839 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 06E6C7C839 From: Andrea Bolognani To: libvir-list@redhat.com Date: Fri, 23 Jun 2017 23:03:23 +0800 Message-Id: <1498230208-14144-22-git-send-email-abologna@redhat.com> In-Reply-To: <1498230208-14144-1-git-send-email-abologna@redhat.com> References: <1498230208-14144-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 21/26] qemu: Use PHBs to fill holes in PCI bus numbering X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 23 Jun 2017 15:05:39 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" PCI bus has to be numbered sequentially, and no index can be missing, so libvirt will fill in the blanks automatically for the user. Up until now, it has done so using either pci-bridge, for machine types based on legacy PCI, or pcie-root-port, for machine types based on PCI Express. Neither choice is good for pSeries guests, where PHBs (pci-root) should be used instead. Signed-off-by: Andrea Bolognani Reviewed-by: Laine Stump --- src/qemu/qemu_domain_address.c | 16 ++++++++++++= +--- .../qemuxml2argv-pseries-many-buses-2.args | 2 +- tests/qemuxml2argvtest.c | 1 - .../qemuxml2xmlout-pseries-many-buses-2.xml | 7 +++---- tests/qemuxml2xmltest.c | 1 - 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 960ea04..082cb72 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -1097,10 +1097,14 @@ qemuDomainPCIAddressSetCreate(virDomainDefPtr def, * that don't yet have a corresponding controller in the domain * config. */ - if (hasPCIeRoot) + if (qemuDomainIsPSeries(def)) { + /* pSeries guests should use PHBs (pci-root controllers) */ + defaultModel =3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT; + } else if (hasPCIeRoot) { defaultModel =3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT; - else + } else { defaultModel =3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE; + } =20 for (i =3D 1; i < addrs->nbuses; i++) { =20 @@ -2182,7 +2186,13 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, dev.data.controller =3D def->controllers[contIndex]; /* set connect flags so it will be properly addressed */ qemuDomainFillDevicePCIConnectFlags(def, &dev, qemuCaps, drive= r); - if (qemuDomainPCIAddressReserveNextAddr(addrs, + + /* Reserve an address for the controller. pci-root and pcie-ro= ot + * controllers don't plug into any other PCI controller, hence + * they should skip this step */ + if (bus->model !=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT && + bus->model !=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT && + qemuDomainPCIAddressReserveNextAddr(addrs, &dev.data.controller->= info) < 0) { goto cleanup; } diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-many-buses-2.args = b/tests/qemuxml2argvdata/qemuxml2argv-pseries-many-buses-2.args index 1cb5831..13fed02 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pseries-many-buses-2.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-many-buses-2.args @@ -19,4 +19,4 @@ server,nowait \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ -boot c \ -device spapr-pci-host-bridge,index=3D1,id=3Dpci.2 \ --device pci-bridge,chassis_nr=3D1,id=3Dpci.1,bus=3Dpci.0,addr=3D0x1 +-device spapr-pci-host-bridge,index=3D2,id=3Dpci.1 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 137f59a..f1720cb 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1730,7 +1730,6 @@ mymain(void) DO_TEST("pseries-many-buses-2", QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_VIRTIO_SCSI); DO_TEST("pseries-hostdevs-1", QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-many-buses-2.x= ml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-many-buses-2.xml index 75dfabf..14f3e36 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-many-buses-2.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-many-buses-2.xml @@ -23,10 +23,9 @@ - - - -
+ + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 312e2b1..378cd85 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -696,7 +696,6 @@ mymain(void) DO_TEST("pseries-many-buses-2", QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, - QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_VIRTIO_SCSI); DO_TEST("pseries-hostdevs-1", QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, --=20 2.7.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list