From nobody Fri May 16 10:31:51 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 1496419784338591.5319745074052; Fri, 2 Jun 2017 09:09:44 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F6B8C057FA6; Fri, 2 Jun 2017 16:09:39 +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 0B9DB87947; Fri, 2 Jun 2017 16:09:39 +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 397E018521C1; Fri, 2 Jun 2017 16:08:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v52G8Hp6011574 for ; Fri, 2 Jun 2017 12:08:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 386877D551; Fri, 2 Jun 2017 16:08:17 +0000 (UTC) Received: from inaba.usersys.redhat.com (dhcp129-60.brq.redhat.com [10.34.129.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B44038442F for ; Fri, 2 Jun 2017 16:08:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3F6B8C057FA6 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.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 3F6B8C057FA6 From: Andrea Bolognani To: libvir-list@redhat.com Date: Fri, 2 Jun 2017 18:07:42 +0200 Message-Id: <1496419671-7600-18-git-send-email-abologna@redhat.com> In-Reply-To: <1496419671-7600-1-git-send-email-abologna@redhat.com> References: <1496419671-7600-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 17/26] qemu: Deal with PHB naming convention 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 02 Jun 2017 16:09:40 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Usually, a controller with alias 'x' will create a bus with the same name; however, the bus created by a PHBs with alias 'x' will be named 'x.0' instead, so we need to account for that. As an exception to the exception, the implicit PHB that's added automatically to every pSeries guest creates the 'pci.0' bus. --- src/qemu/qemu_command.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 082ffa9..1bc3093 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -301,6 +301,9 @@ qemuBuildDeviceAddressStr(virBufferPtr buf, int ret =3D -1; char *devStr =3D NULL; const char *contAlias =3D NULL; + virDomainControllerModelPCI contModel; + virDomainControllerPCIModelName contModelName; + int contIndex; =20 if (info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { size_t i; @@ -313,6 +316,9 @@ qemuBuildDeviceAddressStr(virBufferPtr buf, if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI && cont->idx =3D=3D info->addr.pci.bus) { contAlias =3D cont->info.alias; + contModel =3D cont->model; + contModelName =3D cont->opts.pciopts.modelName; + contIndex =3D cont->opts.pciopts.idx; if (!contAlias) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Device alias was not set for PCI " @@ -348,7 +354,19 @@ qemuBuildDeviceAddressStr(virBufferPtr buf, } } =20 - virBufferAsprintf(buf, ",bus=3D%s", contAlias); + if (contModel =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT && + contModelName =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_SPAP= R_PCI_HOST_BRIDGE && + contIndex > 0) { + /* The PCI bus created by a spapr-pci-host-bridge device with + * alias 'x' will be called 'x.0' rather than 'x'; however, + * this does not apply to the implicit PHB in a pSeries guest, + * which always has the hardcoded name 'pci.0' */ + virBufferAsprintf(buf, ",bus=3D%s.0", contAlias); + } else { + /* For all other controllers, the bus name matches the alias + * of the corresponding controller */ + virBufferAsprintf(buf, ",bus=3D%s", contAlias); + } =20 if (info->addr.pci.multi =3D=3D VIR_TRISTATE_SWITCH_ON) virBufferAddLit(buf, ",multifunction=3Don"); --=20 2.7.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list