From nobody Thu May 2 03:43:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 1488298564393962.6797046903893; Tue, 28 Feb 2017 08:16:04 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGCphW019148; Tue, 28 Feb 2017 11:12:51 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGCm9m004437 for ; Tue, 28 Feb 2017 11:12:48 -0500 Received: from inaba.usersys.redhat.com (ovpn-204-32.brq.redhat.com [10.40.204.32]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SGCk4o020819 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 28 Feb 2017 11:12:48 -0500 From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Feb 2017 17:12:33 +0100 Message-Id: <1488298364-16896-2-git-send-email-abologna@redhat.com> In-Reply-To: <1488298364-16896-1-git-send-email-abologna@redhat.com> References: <1488298364-16896-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 01/12] qemu: Allow qemuBuildControllerDevStr() to return NULL 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We will soon need to be able to return a NULL pointer without the caller considering that an error: to make it possible, change the return type to int and use an out parameter for the string instead. Add some documentation for the function as well. --- src/qemu/qemu_command.c | 53 ++++++++++++++++++++++++++++++++++++---------= ---- src/qemu/qemu_command.h | 9 +++++---- src/qemu/qemu_hotplug.c | 5 ++++- 3 files changed, 48 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 41eecfd..73767fb 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2520,10 +2520,31 @@ qemuBuildUSBControllerDevStr(virDomainControllerDef= Ptr def, } =20 =20 -char * +/** + * qemuBuildControllerDevStr: + * @domainDef: domain definition + * @def: controller definition + * @qemuCaps: QEMU binary capabilities + * @devstr: device string + * @nusbcontroller: number of USB controllers + * + * Turn @def into a description of the controller that QEMU will understan= d, + * to be used either on the command line or through the monitor. + * + * The description will be returned in @devstr and can be NULL, eg. when + * passing in one of the built-in controllers. The returned string must be + * freed by the caller. + * + * The number pointed to by @nusbcontroller will be increased by one every + * time the description for a USB controller has been generated successful= ly. + * + * Returns: 0 on success, <0 on failure + */ +int qemuBuildControllerDevStr(const virDomainDef *domainDef, virDomainControllerDefPtr def, virQEMUCapsPtr qemuCaps, + char **devstr, int *nusbcontroller) { virBuffer buf =3D VIR_BUFFER_INITIALIZER; @@ -2532,11 +2553,11 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, =20 if (!qemuCheckCCWS390AddressSupport(domainDef, def->info, qemuCaps, "controller")) - return NULL; + return -1; =20 if (def->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { if ((qemuDomainSetSCSIControllerModel(domainDef, qemuCaps, &model)= ) < 0) - return NULL; + return -1; } =20 if (!(def->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_SCSI && @@ -2544,22 +2565,22 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, if (def->queues) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("'queues' is only supported by virtio-scsi co= ntroller")); - return NULL; + return -1; } if (def->cmd_per_lun) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("'cmd_per_lun' is only supported by virtio-sc= si controller")); - return NULL; + return -1; } if (def->max_sectors) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("'max_sectors' is only supported by virtio-sc= si controller")); - return NULL; + return -1; } if (def->ioeventfd) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("'ioeventfd' is only supported by virtio-scsi= controller")); - return NULL; + return -1; } } =20 @@ -2954,11 +2975,12 @@ qemuBuildControllerDevStr(const virDomainDef *domai= nDef, if (virBufferCheckError(&buf) < 0) goto error; =20 - return virBufferContentAndReset(&buf); + *devstr =3D virBufferContentAndReset(&buf); + return 0; =20 error: virBufferFreeAndReset(&buf); - return NULL; + return -1; } =20 =20 @@ -3053,12 +3075,15 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd, continue; } =20 - virCommandAddArg(cmd, "-device"); - if (!(devstr =3D qemuBuildControllerDevStr(def, cont, qemuCaps, - &usbcontroller))) + if (qemuBuildControllerDevStr(def, cont, qemuCaps, + &devstr, &usbcontroller) < 0) return -1; - virCommandAddArg(cmd, devstr); - VIR_FREE(devstr); + + if (devstr) { + virCommandAddArg(cmd, "-device"); + virCommandAddArg(cmd, devstr); + VIR_FREE(devstr); + } } } =20 diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 69fe846..d8478f8 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -119,10 +119,11 @@ char *qemuBuildDriveDevStr(const virDomainDef *def, virQEMUCapsPtr qemuCaps); =20 /* Current, best practice */ -char *qemuBuildControllerDevStr(const virDomainDef *domainDef, - virDomainControllerDefPtr def, - virQEMUCapsPtr qemuCaps, - int *nusbcontroller); +int qemuBuildControllerDevStr(const virDomainDef *domainDef, + virDomainControllerDefPtr def, + virQEMUCapsPtr qemuCaps, + char **devstr, + int *nusbcontroller); =20 int qemuBuildMemoryBackendStr(unsigned long long size, unsigned long long pagesize, diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 97fb272..8a23238 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -523,7 +523,10 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr = driver, if (qemuAssignDeviceControllerAlias(vm->def, priv->qemuCaps, controlle= r) < 0) goto cleanup; =20 - if (!(devstr =3D qemuBuildControllerDevStr(vm->def, controller, priv->= qemuCaps, NULL))) + if (qemuBuildControllerDevStr(vm->def, controller, priv->qemuCaps, &de= vstr, NULL) < 0) + goto cleanup; + + if (!devstr) goto cleanup; =20 if (VIR_REALLOC_N(vm->def->controllers, vm->def->ncontrollers+1) < 0) --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 03:43:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1488298606751512.5333637398826; Tue, 28 Feb 2017 08:16:46 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGDhkO013215; Tue, 28 Feb 2017 11:13:44 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGCna9004443 for ; Tue, 28 Feb 2017 11:12:49 -0500 Received: from inaba.usersys.redhat.com (ovpn-204-32.brq.redhat.com [10.40.204.32]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SGCk4p020819 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 28 Feb 2017 11:12:48 -0500 From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Feb 2017 17:12:34 +0100 Message-Id: <1488298364-16896-3-git-send-email-abologna@redhat.com> In-Reply-To: <1488298364-16896-1-git-send-email-abologna@redhat.com> References: <1488298364-16896-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 02/12] qemu: Tweak index number checking 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Moving the check and rewriting it this way doesn't alter the current behavior, but will allow us to special-case pci-root down the line. --- src/qemu/qemu_command.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 73767fb..462a598 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2680,6 +2680,26 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, case VIR_DOMAIN_CONTROLLER_TYPE_PCI: switch ((virDomainControllerModelPCI) def->model) { case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: + case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS: + if (def->idx =3D=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("index for pci controllers of model '%s' = must be > 0"), + virDomainControllerModelPCITypeToString(def= ->model)); + goto error; + } + break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: + break; + } + switch ((virDomainControllerModelPCI) def->model) { + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: if (def->opts.pciopts.modelName =3D=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE || def->opts.pciopts.chassisNr =3D=3D -1) { @@ -2926,12 +2946,6 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, _("wrong function called")); goto error; } - if (def->idx =3D=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("index for pci controllers of model '%s' must= be > 0"), - virDomainControllerModelPCITypeToString(def->mo= del)); - goto error; - } break; =20 case VIR_DOMAIN_CONTROLLER_TYPE_IDE: --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 03:43:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 14882985702306.695613865756172; Tue, 28 Feb 2017 08:16:10 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGCpoC019145; Tue, 28 Feb 2017 11:12:51 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGCoMB004450 for ; Tue, 28 Feb 2017 11:12:50 -0500 Received: from inaba.usersys.redhat.com (ovpn-204-32.brq.redhat.com [10.40.204.32]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SGCk4q020819 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 28 Feb 2017 11:12:49 -0500 From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Feb 2017 17:12:35 +0100 Message-Id: <1488298364-16896-4-git-send-email-abologna@redhat.com> In-Reply-To: <1488298364-16896-1-git-send-email-abologna@redhat.com> References: <1488298364-16896-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 03/12] conf: Move index number checking to drivers 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" pSeries guests will soon be allowed to have multiple PHBs (pci-root controllers), which of course means that all but one of them will have a non-zero index; hence, we'll need to relax the current check. However, right now the check is performed in the conf module, which is generic rather than tied to the QEMU driver, and where we don't have information such as the guest machine type available. To make this change of behavior possible down the line, we need to move the check from the XML parser to the driver. Unfortunately, this means duplicating code :( --- src/bhyve/bhyve_domain.c | 15 +++++++++++++++ src/conf/domain_conf.c | 6 ------ src/libxl/libxl_domain.c | 14 ++++++++++++++ src/lxc/lxc_domain.c | 14 ++++++++++++++ src/openvz/openvz_driver.c | 14 ++++++++++++++ src/qemu/qemu_domain.c | 10 ++++++++++ src/uml/uml_driver.c | 14 ++++++++++++++ src/vz/vz_driver.c | 14 ++++++++++++++ src/xen/xen_driver.c | 14 ++++++++++++++ 9 files changed, 109 insertions(+), 6 deletions(-) diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c index 76b4fac..05c1508 100644 --- a/src/bhyve/bhyve_domain.c +++ b/src/bhyve/bhyve_domain.c @@ -122,6 +122,21 @@ bhyveDomainDeviceDefPostParse(virDomainDeviceDefPtr de= v, bhyveDomainDiskDefAssignAddress(driver, disk, def) < 0) return -1; } + + if (dev->type =3D=3D VIR_DOMAIN_DEVICE_CONTROLLER) { + virDomainControllerDefPtr cont =3D dev->data.controller; + + if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI && + (cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT || + cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) && + cont->idx !=3D 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("pci-root and pcie-root controllers " + "should have index 0")); + return -1; + } + } + return 0; } =20 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 97d42fe..fb33e9c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8844,12 +8844,6 @@ virDomainControllerDefParseXML(xmlNodePtr node, "have an address")); goto error; } - if (def->idx > 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("pci-root and pcie-root controllers " - "should have index 0")); - goto error; - } if ((rc =3D virDomainParseScaledValue("./pcihole64", NULL, ctxt, &bytes, 1024, 1024ULL * ULONG_MAX, false= )) < 0) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index ea28c93..844295f 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -379,6 +379,20 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr de= v, virDomainDiskSetFormat(disk, VIR_STORAGE_FILE_RAW); } =20 + if (dev->type =3D=3D VIR_DOMAIN_DEVICE_CONTROLLER) { + virDomainControllerDefPtr cont =3D dev->data.controller; + + if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI && + (cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT || + cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) && + cont->idx !=3D 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("pci-root and pcie-root controllers " + "should have index 0")); + return -1; + } + } + return 0; } =20 diff --git a/src/lxc/lxc_domain.c b/src/lxc/lxc_domain.c index 3a7404f..a50f6fe 100644 --- a/src/lxc/lxc_domain.c +++ b/src/lxc/lxc_domain.c @@ -389,6 +389,20 @@ virLXCDomainDeviceDefPostParse(virDomainDeviceDefPtr d= ev, dev->data.chr->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARGET_TYP= E_NONE) dev->data.chr->targetType =3D VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_L= XC; =20 + if (dev->type =3D=3D VIR_DOMAIN_DEVICE_CONTROLLER) { + virDomainControllerDefPtr cont =3D dev->data.controller; + + if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI && + (cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT || + cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) && + cont->idx !=3D 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("pci-root and pcie-root controllers " + "should have index 0")); + return -1; + } + } + return 0; } =20 diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index eaa9ef6..62732f3 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -128,6 +128,20 @@ openvzDomainDeviceDefPostParse(virDomainDeviceDefPtr d= ev, return -1; } =20 + if (dev->type =3D=3D VIR_DOMAIN_DEVICE_CONTROLLER) { + virDomainControllerDefPtr cont =3D dev->data.controller; + + if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI && + (cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT || + cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) && + cont->idx !=3D 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("pci-root and pcie-root controllers " + "should have index 0")); + return -1; + } + } + return 0; } =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c187214..3cc827e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3207,6 +3207,16 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr d= ev, virDomainNumaGetNodeCount(def->numa)); goto cleanup; } + + if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI && + (cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT || + cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT)= && + cont->idx !=3D 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("pci-root and pcie-root controllers " + "should have index 0")); + goto cleanup; + } } else if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_USB && cont->model =3D=3D -1) { /* Pick a suitable default model for the USB controller if none diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index f0c0ad3..0d4b937 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -427,6 +427,20 @@ umlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, return -1; } =20 + if (dev->type =3D=3D VIR_DOMAIN_DEVICE_CONTROLLER) { + virDomainControllerDefPtr cont =3D dev->data.controller; + + if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI && + (cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT || + cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) && + cont->idx !=3D 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("pci-root and pcie-root controllers " + "should have index 0")); + return -1; + } + } + return 0; } =20 diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index 1ca9fd7..35c63b4 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -295,6 +295,20 @@ vzDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, VIR_STRDUP(dev->data.net->model, "e1000") < 0) return -1; =20 + if (dev->type =3D=3D VIR_DOMAIN_DEVICE_CONTROLLER) { + virDomainControllerDefPtr cont =3D dev->data.controller; + + if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI && + (cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT || + cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) && + cont->idx !=3D 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("pci-root and pcie-root controllers " + "should have index 0")); + return -1; + } + } + return 0; } =20 diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index 3f9bfa7..10d8f5a 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -363,6 +363,20 @@ xenDomainDeviceDefPostParse(virDomainDeviceDefPtr dev, } } =20 + if (dev->type =3D=3D VIR_DOMAIN_DEVICE_CONTROLLER) { + virDomainControllerDefPtr cont =3D dev->data.controller; + + if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI && + (cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT || + cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) && + cont->idx !=3D 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("pci-root and pcie-root controllers " + "should have index 0")); + return -1; + } + } + return 0; } =20 --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 03:43:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 148829860768346.25143112179535; Tue, 28 Feb 2017 08:16:47 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGDird013234; Tue, 28 Feb 2017 11:13:45 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGCplg004459 for ; Tue, 28 Feb 2017 11:12:51 -0500 Received: from inaba.usersys.redhat.com (ovpn-204-32.brq.redhat.com [10.40.204.32]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SGCk4r020819 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 28 Feb 2017 11:12:50 -0500 From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Feb 2017 17:12:36 +0100 Message-Id: <1488298364-16896-5-git-send-email-abologna@redhat.com> In-Reply-To: <1488298364-16896-1-git-send-email-abologna@redhat.com> References: <1488298364-16896-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 04/12] qemu: Relax pci-root index requirement for pSeries guests 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" pSeries guests will soon be allowed to have multiple PHBs (pci-root controllers), meaning the current check on the controller index no longer applies to them. --- src/qemu/qemu_domain.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 3cc827e..77d1107 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3208,7 +3208,10 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr d= ev, goto cleanup; } =20 - if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI && + /* pSeries guests can have multiple pci-root controllers, + * but other machine types only support a single one */ + if (!qemuDomainMachineIsPSeries(def) && + cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI && (cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT || cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT)= && cont->idx !=3D 0) { --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 03:43:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 1488298645277229.46286639225832; Tue, 28 Feb 2017 08:17:25 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGEMmg019235; Tue, 28 Feb 2017 11:14:22 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGCqcQ004464 for ; Tue, 28 Feb 2017 11:12:52 -0500 Received: from inaba.usersys.redhat.com (ovpn-204-32.brq.redhat.com [10.40.204.32]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SGCk4s020819 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 28 Feb 2017 11:12:51 -0500 From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Feb 2017 17:12:37 +0100 Message-Id: <1488298364-16896-6-git-send-email-abologna@redhat.com> In-Reply-To: <1488298364-16896-1-git-send-email-abologna@redhat.com> References: <1488298364-16896-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 05/12] schema: Allow 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- docs/schemas/domaincommon.rng | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index c64544a..f2f5c3a 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1931,6 +1931,11 @@ + + + + + --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 03:43:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 1488298680247136.2296502674111; Tue, 28 Feb 2017 08:18:00 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGF0YW019310; Tue, 28 Feb 2017 11:15:00 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGCqCF004474 for ; Tue, 28 Feb 2017 11:12:52 -0500 Received: from inaba.usersys.redhat.com (ovpn-204-32.brq.redhat.com [10.40.204.32]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SGCk4t020819 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 28 Feb 2017 11:12:52 -0500 From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Feb 2017 17:12:38 +0100 Message-Id: <1488298364-16896-7-git-send-email-abologna@redhat.com> In-Reply-To: <1488298364-16896-1-git-send-email-abologna@redhat.com> References: <1488298364-16896-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 06/12] schema: Add 'spapr-pci-host-bridge' controller model 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- docs/schemas/domaincommon.rng | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index f2f5c3a..38b4b80 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -1889,6 +1889,8 @@ + + spapr-pci-host-bridge pci-bridge --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 03:43:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1488298723401140.8608191906086; Tue, 28 Feb 2017 08:18:43 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SGFc7V037448; Tue, 28 Feb 2017 11:15:38 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGCr5J004484 for ; Tue, 28 Feb 2017 11:12:53 -0500 Received: from inaba.usersys.redhat.com (ovpn-204-32.brq.redhat.com [10.40.204.32]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SGCk4u020819 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 28 Feb 2017 11:12:53 -0500 From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Feb 2017 17:12:39 +0100 Message-Id: <1488298364-16896-8-git-send-email-abologna@redhat.com> In-Reply-To: <1488298364-16896-1-git-send-email-abologna@redhat.com> References: <1488298364-16896-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 07/12] conf: Parse and format 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- src/conf/domain_conf.c | 24 ++++++++++++++++++++++++ src/conf/domain_conf.h | 1 + 2 files changed, 25 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index fb33e9c..93e706c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1774,6 +1774,7 @@ virDomainControllerDefNew(virDomainControllerType typ= e) def->opts.pciopts.chassis =3D -1; def->opts.pciopts.port =3D -1; def->opts.pciopts.busNr =3D -1; + def->opts.pciopts.idx =3D -1; def->opts.pciopts.numaNode =3D -1; break; case VIR_DOMAIN_CONTROLLER_TYPE_IDE: @@ -8694,6 +8695,7 @@ virDomainControllerDefParseXML(xmlNodePtr node, goto error; } def->idx =3D idxVal; + VIR_FREE(idx); } =20 cur =3D node->children; @@ -8725,6 +8727,7 @@ virDomainControllerDefParseXML(xmlNodePtr node, chassis =3D virXMLPropString(cur, "chassis"); port =3D virXMLPropString(cur, "port"); busNr =3D virXMLPropString(cur, "busNr"); + idx =3D virXMLPropString(cur, "index"); processedTarget =3D true; } } @@ -8940,6 +8943,23 @@ virDomainControllerDefParseXML(xmlNodePtr node, goto error; } } + if (idx) { + if (virStrToLong_i(idx, NULL, 0, + &def->opts.pciopts.idx) < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("Invalid index '%s' in PCI controller"), + idx); + goto error; + } + if (def->opts.pciopts.idx < 0 || + def->opts.pciopts.idx > 31) { + virReportError(VIR_ERR_XML_ERROR, + _("PCI controller index '%s' out of range " + "- must be 0-31"), + idx); + goto error; + } + } if (numaNode >=3D 0) def->opts.pciopts.numaNode =3D numaNode; break; @@ -20967,6 +20987,7 @@ virDomainControllerDefFormat(virBufferPtr buf, def->opts.pciopts.chassis !=3D -1 || def->opts.pciopts.port !=3D -1 || def->opts.pciopts.busNr !=3D -1 || + def->opts.pciopts.idx !=3D -1 || def->opts.pciopts.numaNode !=3D -1) pciTarget =3D true; break; @@ -21007,6 +21028,9 @@ virDomainControllerDefFormat(virBufferPtr buf, if (def->opts.pciopts.busNr !=3D -1) virBufferAsprintf(buf, " busNr=3D'%d'", def->opts.pciopts.busNr); + if (def->opts.pciopts.idx !=3D -1) + virBufferAsprintf(buf, " index=3D'%d'", + def->opts.pciopts.idx); if (def->opts.pciopts.numaNode =3D=3D -1) { virBufferAddLit(buf, "/>\n"); } else { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 1e53cc3..0cf9c58 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -768,6 +768,7 @@ struct _virDomainPCIControllerOpts { int chassis; int port; int busNr; /* used by pci-expander-bus, -1 =3D=3D unspecified */ + int idx; /* used by spapr-pci-host-bridge, -1 =3D=3D unspecified */ /* numaNode is a *subelement* of target (to match existing * item in memory target config) -1 =3D=3D unspecified */ --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 03:43:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1488298756279504.6284361082097; Tue, 28 Feb 2017 08:19:16 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SGGGMT046654; Tue, 28 Feb 2017 11:16:16 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGCsC4004489 for ; Tue, 28 Feb 2017 11:12:54 -0500 Received: from inaba.usersys.redhat.com (ovpn-204-32.brq.redhat.com [10.40.204.32]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SGCk4v020819 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 28 Feb 2017 11:12:54 -0500 From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Feb 2017 17:12:40 +0100 Message-Id: <1488298364-16896-9-git-send-email-abologna@redhat.com> In-Reply-To: <1488298364-16896-1-git-send-email-abologna@redhat.com> References: <1488298364-16896-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 08/12] conf: Add 'spapr-pci-host-bridge' controller model 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Adding it to the virDomainControllerPCIModelName enumeration is enough for existing code to handle it, so parsing and formatting will work without further tweaking. --- src/conf/domain_conf.c | 4 +++- src/conf/domain_conf.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 93e706c..14afd0d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -338,7 +338,9 @@ VIR_ENUM_IMPL(virDomainControllerPCIModelName, "x3130-upstream", "xio3130-downstream", "pxb", - "pxb-pcie") + "pxb-pcie", + "spapr-pci-host-bridge", +); =20 VIR_ENUM_IMPL(virDomainControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SC= SI_LAST, "auto", diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 0cf9c58..948aaa2 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -694,6 +694,7 @@ typedef enum { VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_XIO3130_DOWNSTREAM, VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PXB, VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PXB_PCIE, + VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_SPAPR_PCI_HOST_BRIDGE, =20 VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_LAST } virDomainControllerPCIModelName; --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 03:43:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1488298651052462.3329120679607; Tue, 28 Feb 2017 08:17:31 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGELxU013269; Tue, 28 Feb 2017 11:14:21 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGCtTa004496 for ; Tue, 28 Feb 2017 11:12:55 -0500 Received: from inaba.usersys.redhat.com (ovpn-204-32.brq.redhat.com [10.40.204.32]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SGCk4w020819 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 28 Feb 2017 11:12:54 -0500 From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Feb 2017 17:12:41 +0100 Message-Id: <1488298364-16896-10-git-send-email-abologna@redhat.com> In-Reply-To: <1488298364-16896-1-git-send-email-abologna@redhat.com> References: <1488298364-16896-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 09/12] qemu: Automatically pick index and model for pci-root controllers 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" pSeries guests will soon need the new information; luckily, we can figure it out automatically most of the time, so users won't have to bother with it. --- src/qemu/qemu_domain_address.c | 47 ++++++++++++++++++= ++-- .../qemuargv2xmldata/qemuargv2xml-pseries-disk.xml | 5 ++- .../qemuargv2xml-pseries-nvram.xml | 5 ++- .../qemuxml2xmlout-panic-pseries.xml | 5 ++- .../qemuxml2xmlout-ppc64-usb-controller-legacy.xml | 5 ++- .../qemuxml2xmlout-ppc64-usb-controller.xml | 5 ++- .../qemuxml2xmlout-pseries-nvram.xml | 5 ++- .../qemuxml2xmlout-pseries-panic-missing.xml | 5 ++- .../qemuxml2xmlout-pseries-panic-no-address.xml | 5 ++- 9 files changed, 76 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 20f4ba2..6f7f4ef 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -1845,13 +1845,15 @@ qemuDomainSupportsPCI(virDomainDefPtr def, =20 =20 static void -qemuDomainPCIControllerSetDefaultModelName(virDomainControllerDefPtr cont) +qemuDomainPCIControllerSetDefaultModelName(virDomainControllerDefPtr cont, + virDomainDefPtr def) { int *modelName =3D &cont->opts.pciopts.modelName; =20 /* make sure it's not already set */ if (*modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE) return; + switch ((virDomainControllerModelPCI)cont->model) { case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: *modelName =3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PCI_BRIDGE; @@ -1875,6 +1877,9 @@ qemuDomainPCIControllerSetDefaultModelName(virDomainC= ontrollerDefPtr cont) *modelName =3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PXB_PCIE; break; case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: + if (qemuDomainMachineIsPSeries(def)) + *modelName =3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_SPAPR_PCI_= HOST_BRIDGE; + break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: break; @@ -1883,6 +1888,29 @@ qemuDomainPCIControllerSetDefaultModelName(virDomain= ControllerDefPtr cont) =20 =20 static int +qemuDomainAddressFindNewIndex(virDomainDefPtr def) +{ + int ret =3D -1; + size_t i; + + for (i =3D 0; i < def->ncontrollers; i++) { + virDomainControllerDefPtr cont =3D def->controllers[i]; + + if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI) { + if (cont->opts.pciopts.idx > ret) + ret =3D cont->opts.pciopts.idx; + } + } + + ret++; + if (ret < 0 || ret > 31) + ret =3D -1; + + return ret; +} + + +static int qemuDomainAddressFindNewBusNr(virDomainDefPtr def) { /* Try to find a nice default for busNr for a new pci-expander-bus. @@ -2142,7 +2170,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, * device in qemu) for any controller that doesn't yet * have it set. */ - qemuDomainPCIControllerSetDefaultModelName(cont); + qemuDomainPCIControllerSetDefaultModelName(cont, def); =20 /* set defaults for any other auto-generated config * options for this controller that haven't been @@ -2179,9 +2207,22 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, goto cleanup; } break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: + if (!qemuDomainMachineIsPSeries(def)) + break; + if (options->idx =3D=3D -1) + options->idx =3D qemuDomainAddressFindNewIndex(def); + if (options->idx =3D=3D -1) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("No valid index is available to " + "auto-assign to bus %d. Must be " + "manually assigned"), + addr->bus); + goto cleanup; + } + break; case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: - case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: break; diff --git a/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml b/tests/q= emuargv2xmldata/qemuargv2xml-pseries-disk.xml index 1bad8ee..601d0f7 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml @@ -30,7 +30,10 @@
- + + + +
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-pseries-nvram.xml b/tests/= qemuargv2xmldata/qemuargv2xml-pseries-nvram.xml index 7e9f864..7787847 100644 --- a/tests/qemuargv2xmldata/qemuargv2xml-pseries-nvram.xml +++ b/tests/qemuargv2xmldata/qemuargv2xml-pseries-nvram.xml @@ -17,7 +17,10 @@
- + + + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml b/te= sts/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml index 1ed11ce..7fb49fe 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-pseries.xml @@ -17,7 +17,10 @@
- + + + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller-l= egacy.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller-le= gacy.xml index 33e7810..6d3d51e 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller-legacy.x= ml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller-legacy.x= ml @@ -22,7 +22,10 @@
- + + + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller.x= ml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller.xml index 30932e5..659cabe 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-ppc64-usb-controller.xml @@ -22,7 +22,10 @@
- + + + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-nvram.xml b/te= sts/qemuxml2xmloutdata/qemuxml2xmlout-pseries-nvram.xml index 713f31c..f89b23b 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-nvram.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-nvram.xml @@ -17,7 +17,10 @@
- + + + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.= xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml index 1ed11ce..7fb49fe 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-missing.xml @@ -17,7 +17,10 @@
- + + + +
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-addre= ss.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.x= ml index 1ed11ce..7fb49fe 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml @@ -17,7 +17,10 @@
- + + + +
--=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 03:43:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1488298613684777.8505820472485; Tue, 28 Feb 2017 08:16:53 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SGDiZJ046095; Tue, 28 Feb 2017 11:13:44 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGCuld004501 for ; Tue, 28 Feb 2017 11:12:56 -0500 Received: from inaba.usersys.redhat.com (ovpn-204-32.brq.redhat.com [10.40.204.32]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SGCk4x020819 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 28 Feb 2017 11:12:55 -0500 From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Feb 2017 17:12:42 +0100 Message-Id: <1488298364-16896-11-git-send-email-abologna@redhat.com> In-Reply-To: <1488298364-16896-1-git-send-email-abologna@redhat.com> References: <1488298364-16896-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 10/12] qemu: Introduce QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This new capability can be used to detect whether a QEMU binary supports the spapr-pci-host-bridge controller. --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml | 1 + 3 files changed, 4 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 6f60a00..21fc089 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -358,6 +358,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "query-cpu-model-expansion", /* 245 */ "virtio-net.host_mtu", "spice-rendernode", + "spapr-pci-host-bridge", ); =20 =20 @@ -1625,6 +1626,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[= ] =3D { { "ivshmem-plain", QEMU_CAPS_DEVICE_IVSHMEM_PLAIN }, { "ivshmem-doorbell", QEMU_CAPS_DEVICE_IVSHMEM_DOORBELL }, { "vhost-scsi", QEMU_CAPS_DEVICE_VHOST_SCSI }, + { "spapr-pci-host-bridge", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE }, }; =20 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[]= =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 0f998c4..ee51088 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -394,6 +394,7 @@ typedef enum { QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION, /* qmp query-cpu-model-expansion = */ QEMU_CAPS_VIRTIO_NET_HOST_MTU, /* virtio-net-*.host_mtu */ QEMU_CAPS_SPICE_RENDERNODE, /* -spice rendernode */ + QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, /* -device spapr-pci-host-brid= ge */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml b/tests/qemu= capabilitiesdata/caps_2.6.0.ppc64le.xml index 92e2781..ae174d2 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml @@ -159,6 +159,7 @@ + 2006000 0 --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 03:43:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1488298651093789.7751858518089; Tue, 28 Feb 2017 08:17:31 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SGELG2046126; Tue, 28 Feb 2017 11:14:21 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGCvRU004509 for ; Tue, 28 Feb 2017 11:12:57 -0500 Received: from inaba.usersys.redhat.com (ovpn-204-32.brq.redhat.com [10.40.204.32]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SGCk50020819 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 28 Feb 2017 11:12:56 -0500 From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Feb 2017 17:12:43 +0100 Message-Id: <1488298364-16896-12-git-send-email-abologna@redhat.com> In-Reply-To: <1488298364-16896-1-git-send-email-abologna@redhat.com> References: <1488298364-16896-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 11/12] qemu: Use multiple PHBs for pSeries guests 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Additional PHBs (pci-root controllers) will be created for the guest using the spapr-pci-host-bridge QEMU device, if available; the implicit default PHB, while present in the guest configuration, will be skipped. --- src/qemu/qemu_command.c | 47 ++++++++++++++++++++++++++++++++++++++++++++-= -- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 462a598..412a918 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2940,6 +2940,40 @@ qemuBuildControllerDevStr(const virDomainDef *domain= Def, def->opts.pciopts.numaNode); break; case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: + if (def->opts.pciopts.modelName =3D=3D VIR_DOMAIN_CONTROLLER_P= CI_MODEL_NAME_NONE || + def->opts.pciopts.idx =3D=3D -1) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("autogenerated pci-root options not set")= ); + goto error; + } + + /* Skip the implicit one */ + if (def->opts.pciopts.idx =3D=3D 0) + goto done; + + modelName =3D virDomainControllerPCIModelNameTypeToString(def-= >opts.pciopts.modelName); + if (!modelName) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unknown pci-root model name value %d"), + def->opts.pciopts.modelName); + goto error; + } + if (def->opts.pciopts.modelName !=3D VIR_DOMAIN_CONTROLLER_PCI= _MODEL_NAME_SPAPR_PCI_HOST_BRIDGE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("PCI controller model name '%s' is not va= lid for a pci-root"), + modelName); + goto error; + } + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_= BRIDGE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the spapr-pci-host-bridge controller " + "is not supported in this QEMU binary")); + goto error; + } + virBufferAsprintf(&buf, "%s,index=3D%d,id=3D%s", + modelName, def->opts.pciopts.idx, + def->info.alias); + break; case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -2989,6 +3023,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainD= ef, if (virBufferCheckError(&buf) < 0) goto error; =20 + done: *devstr =3D virBufferContentAndReset(&buf); return 0; =20 @@ -3046,10 +3081,16 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd, continue; } =20 - /* skip pci-root/pcie-root */ + /* skip pcie-root */ if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI && - (cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT || - cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT)) + cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) + continue; + + /* Skip pci-root, except for pSeries guests (which actually + * support more than one PCI Host Bridge per guest) */ + if (!qemuDomainMachineIsPSeries(def) && + cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI && + cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) continue; =20 /* first SATA controller on Q35 machines is implicit */ --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 03:43:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1488298687960727.5124372129965; Tue, 28 Feb 2017 08:18:07 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGF03r013341; Tue, 28 Feb 2017 11:15:00 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1SGCvqi004514 for ; Tue, 28 Feb 2017 11:12:58 -0500 Received: from inaba.usersys.redhat.com (ovpn-204-32.brq.redhat.com [10.40.204.32]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1SGCk51020819 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 28 Feb 2017 11:12:57 -0500 From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 28 Feb 2017 17:12:44 +0100 Message-Id: <1488298364-16896-13-git-send-email-abologna@redhat.com> In-Reply-To: <1488298364-16896-1-git-send-email-abologna@redhat.com> References: <1488298364-16896-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 12/12] tests: Add tests for pSeries guests with multiple PHBs 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-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- .../qemuxml2argv-pseries-phb-simple.args | 26 +++++++++++++ .../qemuxml2argv-pseries-phb-simple.xml | 20 ++++++++++ tests/qemuxml2argvtest.c | 5 +++ .../qemuxml2xmlout-pseries-phb-simple.xml | 43 ++++++++++++++++++= ++++ tests/qemuxml2xmltest.c | 4 ++ 5 files changed, 98 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-simple.= args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-simple.= xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-sim= ple.xml diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-simple.args b/= tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-simple.args new file mode 100644 index 0000000..fa7d1ee --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-simple.args @@ -0,0 +1,26 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-ppc64 \ +-name QEMUGuest1 \ +-S \ +-M pseries \ +-m 512 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-nographic \ +-nodefconfig \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-no-acpi \ +-boot c \ +-device spapr-pci-host-bridge,index=3D1,id=3Dpci \ +-device spapr-pci-host-bridge,index=3D2,id=3Dpci \ +-usb \ +-chardev pty,id=3Dcharserial0 \ +-device spapr-vty,chardev=3Dcharserial0,reg=3D0x30000000 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-simple.xml b/t= ests/qemuxml2argvdata/qemuxml2argv-pseries-phb-simple.xml new file mode 100644 index 0000000..c25ec0e --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-phb-simple.xml @@ -0,0 +1,20 @@ + + QEMUGuest1 + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 1 + + hvm + + + + /usr/bin/qemu-system-ppc64 + + + + +
+ + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index ad9ce8e..ae79bcc 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1666,6 +1666,11 @@ mymain(void) QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG); DO_TEST_FAILURE("pseries-panic-address", QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG); + + DO_TEST("pseries-phb-simple", + QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE); + DO_TEST("disk-ide-drive-split", QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_IDE_CD); diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-simple.xml= b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-simple.xml new file mode 100644 index 0000000..6604151 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-phb-simple.xml @@ -0,0 +1,43 @@ + + QEMUGuest1 + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 524288 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-ppc64 + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 4353ad2..93fa476 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -656,6 +656,10 @@ mymain(void) DO_TEST("pseries-panic-missing", NONE); DO_TEST("pseries-panic-no-address", NONE); =20 + DO_TEST("pseries-phb-simple", + QEMU_CAPS_CHARDEV, QEMU_CAPS_NODEFCONFIG, + QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE); + DO_TEST("balloon-device-auto", NONE); DO_TEST("balloon-device-period", NONE); DO_TEST("channel-virtio-auto", NONE); --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list