From nobody Fri May 16 06:34:47 2025 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 1497606621277913.5948514595192; Fri, 16 Jun 2017 02:50:21 -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 D6C8A80C2B; Fri, 16 Jun 2017 09:50:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A8B848B981; Fri, 16 Jun 2017 09:50:19 +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 55105180BAF9; Fri, 16 Jun 2017 09:50:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5G9oEK5031492 for ; Fri, 16 Jun 2017 05:50:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id D14297F355; Fri, 16 Jun 2017 09:50:14 +0000 (UTC) Received: from inaba.usersys.redhat.com (ovpn-12-86.pek2.redhat.com [10.72.12.86]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C54C37F35C for ; Fri, 16 Jun 2017 09:50:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D6C8A80C2B Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.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 D6C8A80C2B From: Andrea Bolognani To: libvir-list@redhat.com Date: Fri, 16 Jun 2017 17:49:04 +0800 Message-Id: <1497606548-18870-21-git-send-email-abologna@redhat.com> In-Reply-To: <1497606548-18870-1-git-send-email-abologna@redhat.com> References: <1497606548-18870-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 20/24] 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.26]); Fri, 16 Jun 2017 09:50:20 +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 --- 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 03290c1..34aab4a 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 a122464..ce8e60f 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -695,7 +695,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