From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1548279202255771.575643508521;
Wed, 23 Jan 2019 13:33:22 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com
[10.5.11.23])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 698CB2CD80F;
Wed, 23 Jan 2019 21:33:20 +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 7C2BD26348;
Wed, 23 Jan 2019 21:33: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 9FC3E3F7D0;
Wed, 23 Jan 2019 21:33:17 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLXFl1032243 for ;
Wed, 23 Jan 2019 16:33:15 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 88CA1BA50; Wed, 23 Jan 2019 21:33:15 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id C1AD167141;
Wed, 23 Jan 2019 21:33:14 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:29 -0500
Message-Id:
<3ef0b006becbb1912099ab98ce77f5b4de7232bf.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 01/25] conf: Set net->model earlier
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: ,
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]);
Wed, 23 Jan 2019 21:33:21 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
So later code can more easily access def->model
Signed-off-by: Cole Robinson
Reviewed-by: Andrea Bolognani
---
src/conf/domain_conf.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 54d6364f4f..564248e021 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11305,6 +11305,22 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlo=
pt,
goto error;
}
=20
+ /* NIC model (see -net nic,model=3D?). We only check that it looks
+ * reasonable, not that it is a supported NIC type. FWIW kvm
+ * supports these types as of April 2008:
+ * i82551 i82557b i82559er ne2k_pci pcnet rtl8139 e1000 virtio
+ * QEMU PPC64 supports spapr-vlan
+ */
+ if (model !=3D NULL) {
+ if (strspn(model, NET_MODEL_CHARS) < strlen(model)) {
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Model name contains invalid characters"));
+ goto error;
+ }
+ def->model =3D model;
+ model =3D NULL;
+ }
+
switch (def->type) {
case VIR_DOMAIN_NET_TYPE_NETWORK:
if (network =3D=3D NULL) {
@@ -11322,7 +11338,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop=
t,
break;
=20
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
- if (STRNEQ_NULLABLE(model, "virtio")) {
+ if (STRNEQ_NULLABLE(def->model, "virtio")) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Wrong or no 'type' attribute "
"specified with . "
@@ -11550,22 +11566,6 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlo=
pt,
ifname_guest_actual =3D NULL;
}
=20
- /* NIC model (see -net nic,model=3D?). We only check that it looks
- * reasonable, not that it is a supported NIC type. FWIW kvm
- * supports these types as of April 2008:
- * i82551 i82557b i82559er ne2k_pci pcnet rtl8139 e1000 virtio
- * QEMU PPC64 supports spapr-vlan
- */
- if (model !=3D NULL) {
- if (strspn(model, NET_MODEL_CHARS) < strlen(model)) {
- virReportError(VIR_ERR_INVALID_ARG, "%s",
- _("Model name contains invalid characters"));
- goto error;
- }
- def->model =3D model;
- model =3D NULL;
- }
-
if (def->type !=3D VIR_DOMAIN_NET_TYPE_HOSTDEV &&
STREQ_NULLABLE(def->model, "virtio")) {
if (backend !=3D NULL) {
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1548279210070320.9992525745638;
Wed, 23 Jan 2019 13:33:30 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id C2E1512F91F;
Wed, 23 Jan 2019 21:33:27 +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 91FF565F72;
Wed, 23 Jan 2019 21:33:27 +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 4BF4B180BAAC;
Wed, 23 Jan 2019 21:33:27 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLXGYP032253 for ;
Wed, 23 Jan 2019 16:33:16 -0500
Received: by smtp.corp.redhat.com (Postfix)
id AB4B3BA8B; Wed, 23 Jan 2019 21:33:16 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id E993DBA50;
Wed, 23 Jan 2019 21:33:15 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:30 -0500
Message-Id:
<47ddb9fa42a14fdb72e1dfd8d4a66752ebee00ea.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 02/25] conf: Add virDomainNetIsVirtioModel
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: ,
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.12
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]);
Wed, 23 Jan 2019 21:33:28 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
This will be extended in the future, so let's simplify things by
centralizing the checks.
Signed-off-by: Cole Robinson
Reviewed-by: Andrea Bolognani
---
src/conf/domain_conf.c | 15 +++++++++++----
src/conf/domain_conf.h | 1 +
src/libvirt_private.syms | 1 +
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_domain_address.c | 2 +-
src/qemu/qemu_hotplug.c | 2 +-
src/qemu/qemu_interface.c | 8 ++++----
src/security/virt-aa-helper.c | 2 +-
tests/qemuxml2argvmock.c | 2 +-
10 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 564248e021..bcdb6b0a3a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4732,7 +4732,7 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDefP=
tr dev,
=20
if (dev->type =3D=3D VIR_DOMAIN_DEVICE_NET) {
virDomainNetDefPtr net =3D dev->data.net;
- if (STRNEQ_NULLABLE(net->model, "virtio") &&
+ if (!virDomainNetIsVirtioModel(net) &&
virDomainCheckVirtioOptions(net->virtio) < 0)
return -1;
}
@@ -11338,7 +11338,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop=
t,
break;
=20
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
- if (STRNEQ_NULLABLE(def->model, "virtio")) {
+ if (!virDomainNetIsVirtioModel(def)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Wrong or no 'type' attribute "
"specified with . "
@@ -11567,7 +11567,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop=
t,
}
=20
if (def->type !=3D VIR_DOMAIN_NET_TYPE_HOSTDEV &&
- STREQ_NULLABLE(def->model, "virtio")) {
+ virDomainNetIsVirtioModel(def)) {
if (backend !=3D NULL) {
if ((val =3D virDomainNetBackendTypeFromString(backend)) < 0 ||
val =3D=3D VIR_DOMAIN_NET_BACKEND_TYPE_DEFAULT) {
@@ -25462,7 +25462,7 @@ virDomainNetDefFormat(virBufferPtr buf,
if (def->model) {
virBufferEscapeString(buf, "\n",
def->model);
- if (STREQ(def->model, "virtio")) {
+ if (virDomainNetIsVirtioModel(def)) {
char *str =3D NULL, *gueststr =3D NULL, *hoststr =3D NULL;
int rc =3D 0;
=20
@@ -29716,6 +29716,13 @@ virDomainNetGetActualTrustGuestRxFilters(virDomain=
NetDefPtr iface)
}
=20
=20
+bool
+virDomainNetIsVirtioModel(const virDomainNetDef *net)
+{
+ return STREQ_NULLABLE(net->model, "virtio");
+}
+
+
/* Return listens[i] from the appropriate union for the graphics
* type, or NULL if this is an unsuitable type, or the index is out of
* bounds. If force0 is TRUE, i =3D=3D 0, and there is no listen array,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 7776a3afb2..218aa4dd94 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3217,6 +3217,7 @@ virNetDevBandwidthPtr
virDomainNetGetActualBandwidth(virDomainNetDefPtr iface);
virNetDevVlanPtr virDomainNetGetActualVlan(virDomainNetDefPtr iface);
bool virDomainNetGetActualTrustGuestRxFilters(virDomainNetDefPtr iface);
+bool virDomainNetIsVirtioModel(const virDomainNetDef *net);
int virDomainNetAppendIPAddress(virDomainNetDefPtr def,
const char *address,
int family,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index c3d6306809..6f4809a68a 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -469,6 +469,7 @@ virDomainNetGetActualType;
virDomainNetGetActualVirtPortProfile;
virDomainNetGetActualVlan;
virDomainNetInsert;
+virDomainNetIsVirtioModel;
virDomainNetNotifyActualDevice;
virDomainNetReleaseActualDevice;
virDomainNetRemove;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2fb7d32dd4..128cf331b3 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3654,7 +3654,7 @@ qemuBuildNicDevStr(virDomainDefPtr def,
bool usingVirtio =3D false;
char macaddr[VIR_MAC_STRING_BUFLEN];
=20
- if (STREQ(net->model, "virtio")) {
+ if (virDomainNetIsVirtioModel(net)) {
if (qemuBuildVirtioDevStr(&buf, "virtio-net", net->info.type) < 0)
goto error;
=20
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 32a43f2064..1376819020 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4665,7 +4665,7 @@ qemuDomainDeviceDefValidateNetwork(const virDomainNet=
Def *net)
return -1;
}
=20
- if (STREQ_NULLABLE(net->model, "virtio")) {
+ if (virDomainNetIsVirtioModel(net)) {
if (net->driver.virtio.rx_queue_size & (net->driver.virtio.rx_queu=
e_size - 1)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("rx_queue_size has to be a power of two"));
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 9e0b50d41e..cb1e5f9e40 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -320,7 +320,7 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr de=
f,
for (i =3D 0; i < def->nnets; i++) {
virDomainNetDefPtr net =3D def->nets[i];
=20
- if (STREQ_NULLABLE(net->model, "virtio") &&
+ if (virDomainNetIsVirtioModel(net) &&
net->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
net->info.type =3D type;
}
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 1df80fcab6..5894c3dd49 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3710,7 +3710,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
goto cleanup;
}
=20
- if (olddev->model && STREQ(olddev->model, "virtio") &&
+ if (virDomainNetIsVirtioModel(olddev) &&
(olddev->driver.virtio.name !=3D newdev->driver.virtio.name ||
olddev->driver.virtio.txmode !=3D newdev->driver.virtio.txmode ||
olddev->driver.virtio.ioeventfd !=3D newdev->driver.virtio.ioeven=
tfd ||
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
index 2607dea1f5..2816db908a 100644
--- a/src/qemu/qemu_interface.c
+++ b/src/qemu/qemu_interface.c
@@ -261,7 +261,7 @@ qemuInterfaceDirectConnect(virDomainDefPtr def,
virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver);
unsigned int macvlan_create_flags =3D VIR_NETDEV_MACVLAN_CREATE_WITH_T=
AP;
=20
- if (net->model && STREQ(net->model, "virtio"))
+ if (virDomainNetIsVirtioModel(net))
macvlan_create_flags |=3D VIR_NETDEV_MACVLAN_VNET_HDR;
=20
if (virNetDevMacVLanCreateWithVPortProfile(net->ifname,
@@ -434,7 +434,7 @@ qemuInterfaceEthernetConnect(virDomainDefPtr def,
template_ifname =3D true;
}
=20
- if (net->model && STREQ(net->model, "virtio"))
+ if (virDomainNetIsVirtioModel(net))
tap_create_flags |=3D VIR_NETDEV_TAP_CREATE_VNET_HDR;
=20
if (virNetDevTapCreate(&net->ifname, tunpath, tapfd, tapfdSize,
@@ -533,7 +533,7 @@ qemuInterfaceBridgeConnect(virDomainDefPtr def,
template_ifname =3D true;
}
=20
- if (net->model && STREQ(net->model, "virtio"))
+ if (virDomainNetIsVirtioModel(net))
tap_create_flags |=3D VIR_NETDEV_TAP_CREATE_VNET_HDR;
=20
if (virQEMUDriverIsPrivileged(driver)) {
@@ -653,7 +653,7 @@ qemuInterfaceOpenVhostNet(virDomainDefPtr def,
}
=20
/* If the nic model isn't virtio, don't try to open. */
- if (!(net->model && STREQ(net->model, "virtio"))) {
+ if (!virDomainNetIsVirtioModel(net)) {
if (net->driver.virtio.name =3D=3D VIR_DOMAIN_NET_BACKEND_TYPE_VHO=
ST) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("vhost-net is only supported for "
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 46443a3153..56d7cfadf1 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -1255,7 +1255,7 @@ get_files(vahControl * ctl)
if (net && net->model) {
if (net->driver.virtio.name =3D=3D VIR_DOMAIN_NET_BACKEND_=
TYPE_QEMU)
continue;
- if (STRNEQ(net->model, "virtio"))
+ if (!virDomainNetIsVirtioModel(net))
continue;
}
needsvhost =3D true;
diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c
index b300793732..3f0c1c3fef 100644
--- a/tests/qemuxml2argvmock.c
+++ b/tests/qemuxml2argvmock.c
@@ -228,7 +228,7 @@ qemuInterfaceOpenVhostNet(virDomainDefPtr def ATTRIBUTE=
_UNUSED,
{
size_t i;
=20
- if (!(net->model && STREQ(net->model, "virtio"))) {
+ if (!virDomainNetIsVirtioModel(net)) {
*vhostfdSize =3D 0;
return 0;
}
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1548279209845813.0764234333727;
Wed, 23 Jan 2019 13:33:29 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com
[10.5.11.11])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id D8BC77FDE6;
Wed, 23 Jan 2019 21:33:27 +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 9BAB360469;
Wed, 23 Jan 2019 21:33:27 +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 54CAB18033A1;
Wed, 23 Jan 2019 21:33:27 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLXHXK032261 for ;
Wed, 23 Jan 2019 16:33:17 -0500
Received: by smtp.corp.redhat.com (Postfix)
id B09A8BA8B; Wed, 23 Jan 2019 21:33:17 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id EE851BA50;
Wed, 23 Jan 2019 21:33:16 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:31 -0500
Message-Id:
<4125ca8687d60bf72f717b5642adf6cf95739759.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 03/25] qemu: Move validation out
of qemu_command.c
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: ,
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.11
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]);
Wed, 23 Jan 2019 21:33:28 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
If we validate that memballoon is NONE|VIRTIO at parse time,
we can drop similar checks elsewhere in the qemu driver
Signed-off-by: Cole Robinson
---
src/qemu/qemu_command.c | 17 ----------------
src/qemu/qemu_domain.c | 36 +++++++++++++++++++++++++++++++++-
src/qemu/qemu_domain_address.c | 10 ++++------
src/qemu/qemu_driver.c | 17 +++++++---------
src/qemu/qemu_process.c | 3 +--
5 files changed, 47 insertions(+), 36 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 128cf331b3..2d05b4a93b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4046,20 +4046,9 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd,
{
virBuffer buf =3D VIR_BUFFER_INITIALIZER;
=20
- if (STRPREFIX(def->os.machine, "s390-virtio") &&
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) && def->memballoon)
- def->memballoon->model =3D VIR_DOMAIN_MEMBALLOON_MODEL_NONE;
-
if (!virDomainDefHasMemballoon(def))
return 0;
=20
- if (def->memballoon->model !=3D VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Memory balloon device type '%s' is not supported=
by this version of qemu"),
- virDomainMemballoonModelTypeToString(def->memballoo=
n->model));
- return -1;
- }
-
if (qemuBuildVirtioDevStr(&buf, "virtio-balloon",
def->memballoon->info.type) < 0) {
goto error;
@@ -4070,12 +4059,6 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd,
goto error;
=20
if (def->memballoon->autodeflate !=3D VIR_TRISTATE_SWITCH_ABSENT) {
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE=
)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("deflate-on-oom is not supported by this QEMU=
binary"));
- goto error;
- }
-
virBufferAsprintf(&buf, ",deflate-on-oom=3D%s",
virTristateSwitchTypeToString(def->memballoon->a=
utodeflate));
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 1376819020..a0ab55d5db 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3481,6 +3481,10 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def,
def->memballoon =3D memballoon;
}
=20
+ if (STRPREFIX(def->os.machine, "s390-virtio") &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) && def->memballoon)
+ def->memballoon->model =3D VIR_DOMAIN_MEMBALLOON_MODEL_NONE;
+
if (addDefaultUSBKBD &&
def->ngraphics > 0 &&
virDomainDefMaybeAddInput(def,
@@ -5980,6 +5984,33 @@ qemuDomainDeviceDefValidateInput(const virDomainInpu=
tDef *input,
}
=20
=20
+static int
+qemuDomainDeviceDefValidateMemballoon(const virDomainMemballoonDef *membal=
loon,
+ virQEMUCapsPtr qemuCaps)
+{
+ if (!memballoon ||
+ memballoon->model =3D=3D VIR_DOMAIN_MEMBALLOON_MODEL_NONE) {
+ return 0;
+ }
+
+ if (memballoon->model !=3D VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Memory balloon device type '%s' is not supported=
by this version of qemu"),
+ virDomainMemballoonModelTypeToString(memballoon->mo=
del));
+ return -1;
+ }
+
+ if (memballoon->autodeflate !=3D VIR_TRISTATE_SWITCH_ABSENT &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("deflate-on-oom is not supported by this QEMU bin=
ary"));
+ return -1;
+ }
+
+ return 0;
+}
+
+
static int
qemuDomainDeviceDefValidateZPCIAddress(virDomainDeviceInfoPtr info,
virQEMUCapsPtr qemuCaps)
@@ -6088,11 +6119,14 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDe=
f *dev,
ret =3D qemuDomainDeviceDefValidateInput(dev->data.input, def, qem=
uCaps);
break;
=20
+ case VIR_DOMAIN_DEVICE_MEMBALLOON:
+ ret =3D qemuDomainDeviceDefValidateMemballoon(dev->data.memballoon=
, qemuCaps);
+ break;
+
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_FS:
case VIR_DOMAIN_DEVICE_SOUND:
case VIR_DOMAIN_DEVICE_HUB:
- case VIR_DOMAIN_DEVICE_MEMBALLOON:
case VIR_DOMAIN_DEVICE_NVRAM:
case VIR_DOMAIN_DEVICE_SHMEM:
case VIR_DOMAIN_DEVICE_MEMORY:
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index cb1e5f9e40..1802c36b86 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -358,8 +358,8 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr de=
f,
def->hostdevs[i]->info->type =3D type;
}
=20
- if (def->memballoon &&
- def->memballoon->model =3D=3D VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO &&
+ /* All memballoon devices accepted by the qemu driver are virtio */
+ if (virDomainDefHasMemballoon(def) &&
def->memballoon->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_N=
ONE)
def->memballoon->info.type =3D type;
=20
@@ -2268,11 +2268,9 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
goto error;
}
=20
- /* VirtIO balloon */
- if (def->memballoon &&
- def->memballoon->model =3D=3D VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO &&
+ /* memballoon. the qemu driver only accepts virtio memballoon devices =
*/
+ if (virDomainDefHasMemballoon(def) &&
virDeviceInfoPCIAddressIsWanted(&def->memballoon->info)) {
-
if (qemuDomainPCIAddressReserveNextAddr(addrs,
&def->memballoon->info) < =
0)
goto error;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 90319261ff..26a83a754b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2439,11 +2439,10 @@ static int qemuDomainSetMemoryStatsPeriod(virDomain=
Ptr dom, int period,
priv =3D vm->privateData;
=20
if (def) {
- if (!def->memballoon ||
- def->memballoon->model !=3D VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO=
) {
+ if (!virDomainDefHasMemballoon(def)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Memory balloon model must be virtio to set t=
he"
- " collection period"));
+ _("No memory balloon device configured, "
+ "can not set the collection period"));
goto endjob;
}
=20
@@ -2463,11 +2462,10 @@ static int qemuDomainSetMemoryStatsPeriod(virDomain=
Ptr dom, int period,
}
=20
if (persistentDef) {
- if (!persistentDef->memballoon ||
- persistentDef->memballoon->model !=3D VIR_DOMAIN_MEMBALLOON_MO=
DEL_VIRTIO) {
+ if (!virDomainDefHasMemballoon(def)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Memory balloon model must be virtio to set t=
he"
- " collection period"));
+ _("No memory balloon device configured, "
+ "can not set the collection period"));
goto endjob;
}
persistentDef->memballoon->period =3D period;
@@ -11964,8 +11962,7 @@ qemuDomainMemoryStatsInternal(virQEMUDriverPtr driv=
er,
if (virDomainObjCheckActive(vm) < 0)
return -1;
=20
- if (vm->def->memballoon &&
- vm->def->memballoon->model =3D=3D VIR_DOMAIN_MEMBALLOON_MODEL_VIRT=
IO) {
+ if (virDomainDefHasMemballoon(vm->def)) {
qemuDomainObjEnterMonitor(driver, vm);
ret =3D qemuMonitorGetMemoryStats(qemuDomainGetMonitor(vm),
vm->def->memballoon, stats, nr_sta=
ts);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 8120201eb6..9ccc3601a2 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7593,8 +7593,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UN=
USED,
if (running) {
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
VIR_DOMAIN_RUNNING_UNPAUSED);
- if (vm->def->memballoon &&
- vm->def->memballoon->model =3D=3D VIR_DOMAIN_MEMBALLOON_MODEL_=
VIRTIO &&
+ if (virDomainDefHasMemballoon(vm->def) &&
vm->def->memballoon->period) {
qemuDomainObjEnterMonitor(driver, vm);
qemuMonitorSetMemoryStatsPeriod(priv->mon, vm->def->memballoon,
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1548279214128486.69602950524995;
Wed, 23 Jan 2019 13:33:34 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 186D87FDF3;
Wed, 23 Jan 2019 21:33:32 +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 C746B6C212;
Wed, 23 Jan 2019 21:33:31 +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 731B318033A1;
Wed, 23 Jan 2019 21:33:31 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLXIhj032268 for ;
Wed, 23 Jan 2019 16:33:18 -0500
Received: by smtp.corp.redhat.com (Postfix)
id CFC00BA8B; Wed, 23 Jan 2019 21:33:18 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id F2EA8BA96;
Wed, 23 Jan 2019 21:33:17 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:32 -0500
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 04/25] qemu: Move validation out of
qemu_command.c
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: ,
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.14
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]);
Wed, 23 Jan 2019 21:33:32 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Move the rng->model =3D=3D VIRTIO check to parse time. This also
allows us to remove similar checks throughout the qemu driver
Signed-off-by: Cole Robinson
---
src/qemu/qemu_command.c | 8 --------
src/qemu/qemu_domain.c | 23 +++++++++++++++++++++--
src/qemu/qemu_domain_address.c | 9 ++++-----
tests/qemuxml2xmltest.c | 9 ++++++---
4 files changed, 31 insertions(+), 18 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2d05b4a93b..bbc85e75f0 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5871,14 +5871,6 @@ qemuBuildRNGDevStr(const virDomainDef *def,
{
virBuffer buf =3D VIR_BUFFER_INITIALIZER;
=20
- if (dev->model !=3D VIR_DOMAIN_RNG_MODEL_VIRTIO ||
- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("this qemu doesn't support RNG device type '%s'"),
- virDomainRNGModelTypeToString(dev->model));
- goto error;
- }
-
if (!qemuDomainCheckCCWS390AddressSupport(def, dev->info, qemuCaps,
dev->source.file))
goto error;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a0ab55d5db..27cdb30ca2 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4536,12 +4536,31 @@ qemuDomainSmartcardDefValidate(const virDomainSmart=
cardDef *def)
=20
=20
static int
-qemuDomainRNGDefValidate(const virDomainRNGDef *def)
+qemuDomainRNGDefValidate(const virDomainRNGDef *def,
+ virQEMUCapsPtr qemuCaps)
{
+ bool model_supported =3D false;
+
if (def->backend =3D=3D VIR_DOMAIN_RNG_BACKEND_EGD &&
qemuDomainChrSourceDefValidate(def->source.chardev) < 0)
return -1;
=20
+ switch ((virDomainRNGModel) def->model) {
+ case VIR_DOMAIN_RNG_MODEL_VIRTIO:
+ model_supported =3D virQEMUCapsGet(qemuCaps,
+ QEMU_CAPS_DEVICE_VIRTIO_RNG);
+ break;
+ case VIR_DOMAIN_RNG_MODEL_LAST:
+ break;
+ }
+
+ if (!model_supported) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("this qemu doesn't support RNG device type '%s'"),
+ virDomainRNGModelTypeToString(def->model));
+ return -1;
+ }
+
return 0;
}
=20
@@ -6073,7 +6092,7 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef =
*dev,
break;
=20
case VIR_DOMAIN_DEVICE_RNG:
- ret =3D qemuDomainRNGDefValidate(dev->data.rng);
+ ret =3D qemuDomainRNGDefValidate(dev->data.rng, qemuCaps);
break;
=20
case VIR_DOMAIN_DEVICE_REDIRDEV:
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 1802c36b86..f2ae0804a8 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -364,8 +364,8 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr de=
f,
def->memballoon->info.type =3D type;
=20
for (i =3D 0; i < def->nrngs; i++) {
- if (def->rngs[i]->model =3D=3D VIR_DOMAIN_RNG_MODEL_VIRTIO &&
- def->rngs[i]->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_=
NONE)
+ /* All devices accepted by the qemu driver are virtio */
+ if (def->rngs[i]->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_=
NONE)
def->rngs[i]->info.type =3D type;
}
=20
@@ -2276,10 +2276,9 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
goto error;
}
=20
- /* VirtIO RNG */
+ /* rng. the qemu driver only accepts virtio rng devices */
for (i =3D 0; i < def->nrngs; i++) {
- if (def->rngs[i]->model !=3D VIR_DOMAIN_RNG_MODEL_VIRTIO ||
- !virDeviceInfoPCIAddressIsWanted(&def->rngs[i]->info))
+ if (!virDeviceInfoPCIAddressIsWanted(&def->rngs[i]->info))
continue;
=20
if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->rngs[i]->info=
) < 0)
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 82e2c0ee0f..b2c0c8505d 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -585,8 +585,10 @@ mymain(void)
=20
DO_TEST("disk-serial", NONE);
=20
- DO_TEST("virtio-rng-random", NONE);
- DO_TEST("virtio-rng-egd", NONE);
+ DO_TEST("virtio-rng-random",
+ QEMU_CAPS_DEVICE_VIRTIO_RNG);
+ DO_TEST("virtio-rng-egd",
+ QEMU_CAPS_DEVICE_VIRTIO_RNG);
=20
DO_TEST("pseries-nvram",
QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE);
@@ -1019,7 +1021,8 @@ mymain(void)
DO_TEST("disk-backing-chains-index", NONE);
DO_TEST("disk-backing-chains-noindex", NONE);
=20
- DO_TEST("chardev-label", NONE);
+ DO_TEST("chardev-label",
+ QEMU_CAPS_DEVICE_VIRTIO_RNG);
=20
DO_TEST("cpu-numa1", NONE);
DO_TEST("cpu-numa2", NONE);
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1548279217614545.6473799730106;
Wed, 23 Jan 2019 13:33:37 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com
[10.5.11.22])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 023532CD814;
Wed, 23 Jan 2019 21:33:36 +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 C43EF1048104;
Wed, 23 Jan 2019 21:33:35 +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 7769D18033A1;
Wed, 23 Jan 2019 21:33:35 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLXJD7032282 for ;
Wed, 23 Jan 2019 16:33:19 -0500
Received: by smtp.corp.redhat.com (Postfix)
id EC9AEBA8B; Wed, 23 Jan 2019 21:33:19 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id 20C5CBA50;
Wed, 23 Jan 2019 21:33:19 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:33 -0500
Message-Id:
<31eaef0e389c7a33846a473fcf6b0676961b530a.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 05/25] qemu: command: Make vhost-scsi device
string depend on address
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: ,
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]);
Wed, 23 Jan 2019 21:33:36 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
The vhost-scsi device string should depend on the requested
address type, not strictly on the emulated arch. This is the
same logic used by qemuBuildVirtioDevStr, and this particular
path is already tested in the hostdev-scsi-vhost-scsi-ccw tests
Signed-off-by: Cole Robinson
Reviewed-by: Andrea Bolognani
---
src/qemu/qemu_command.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index bbc85e75f0..a1d991cefc 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4925,7 +4925,7 @@ qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *d=
ef,
goto cleanup;
}
=20
- if (ARCH_IS_S390(def->os.arch))
+ if (dev->info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)
virBufferAddLit(&buf, "vhost-scsi-ccw");
else
virBufferAddLit(&buf, "vhost-scsi-pci");
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 154827922272259.25359494019506;
Wed, 23 Jan 2019 13:33:42 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id CCB9719F34;
Wed, 23 Jan 2019 21:33:39 +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 9380CBA96;
Wed, 23 Jan 2019 21:33: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 30BF73F608;
Wed, 23 Jan 2019 21:33:39 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLXLMX032289 for ;
Wed, 23 Jan 2019 16:33:21 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 321F2BA6D; Wed, 23 Jan 2019 21:33:21 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id 55FD2BA50;
Wed, 23 Jan 2019 21:33:20 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:34 -0500
Message-Id:
<066d7b1e62cd29e74604d00c8a5940bec53e84db.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 06/25] qemu: command: Convert vhost-{vsock,
scsi} to qemuBuildVirtioDevStr
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: ,
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.12
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]);
Wed, 23 Jan 2019 21:33:41 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Current code essentially duplicates the same logic, but misses
some cases (like vhost-vsock-device).
Signed-off-by: Cole Robinson
Reviewed-by: Andrea Bolognani
---
src/qemu/qemu_command.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index a1d991cefc..2dde4b9125 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4925,10 +4925,8 @@ qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *=
def,
goto cleanup;
}
=20
- if (dev->info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)
- virBufferAddLit(&buf, "vhost-scsi-ccw");
- else
- virBufferAddLit(&buf, "vhost-scsi-pci");
+ if (qemuBuildVirtioDevStr(&buf, "vhost-scsi", dev->info->type) < 0)
+ goto cleanup;
=20
virBufferAsprintf(&buf, ",wwpn=3D%s,vhostfd=3D%s,id=3D%s",
hostsrc->wwpn,
@@ -10347,11 +10345,9 @@ qemuBuildVsockDevStr(virDomainDefPtr def,
virBuffer buf =3D VIR_BUFFER_INITIALIZER;
char *ret =3D NULL;
=20
- if (vsock->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
- virBufferAddLit(&buf, "vhost-vsock-ccw");
- } else {
- virBufferAddLit(&buf, "vhost-vsock-pci");
- }
+
+ if (qemuBuildVirtioDevStr(&buf, "vhost-vsock", vsock->info.type) < 0)
+ goto cleanup;
=20
virBufferAsprintf(&buf, ",id=3D%s", vsock->info.alias);
virBufferAsprintf(&buf, ",guest-cid=3D%u", vsock->guest_cid);
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1548279208671404.31616697323534;
Wed, 23 Jan 2019 13:33:28 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com
[10.5.11.23])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id CC18B80511;
Wed, 23 Jan 2019 21:33:26 +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 9A8E458B2;
Wed, 23 Jan 2019 21:33:26 +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 5151C3F605;
Wed, 23 Jan 2019 21:33:26 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLXMe0032297 for ;
Wed, 23 Jan 2019 16:33:22 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 68961BA8B; Wed, 23 Jan 2019 21:33:22 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id 8E6D9BA50;
Wed, 23 Jan 2019 21:33:21 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:35 -0500
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 07/25] conf: Add virDomainDeviceSetData
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: ,
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]);
Wed, 23 Jan 2019 21:33:27 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
This is essentially a wrapper for easily setting the variable
name in virDomainDeviceDef that matches its associated
VIR_DOMAIN_DEVICE_TYPE.
Signed-off-by: Cole Robinson
---
src/conf/domain_conf.c | 93 ++++++++++++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 3 ++
src/libvirt_private.syms | 1 +
3 files changed, 97 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index bcdb6b0a3a..8af1a4ae73 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3702,6 +3702,99 @@ virDomainSkipBackcompatConsole(virDomainDefPtr def,
}
=20
=20
+/**
+ * virDomainDeviceSetData
+ * @device: virDomainDeviceDefPtr with ->type filled in
+ * @data: *DefPtr data for a device. Ex: virDomainDiskDefPtr
+ *
+ * Set the data.X variable for the device->type value. Basically
+ * a mapping of virDomainDeviceType to the associated name in
+ * the virDomainDeviceDef union
+ */
+void
+virDomainDeviceSetData(virDomainDeviceDefPtr device,
+ void *devicedata)
+{
+ switch ((virDomainDeviceType) device->type) {
+ case VIR_DOMAIN_DEVICE_DISK:
+ device->data.disk =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_NET:
+ device->data.net =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_SOUND:
+ device->data.sound =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_HOSTDEV:
+ device->data.hostdev =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_VIDEO:
+ device->data.video =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_CONTROLLER:
+ device->data.controller =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_GRAPHICS:
+ device->data.graphics =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_SMARTCARD:
+ device->data.smartcard =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_CHR:
+ device->data.chr =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_INPUT:
+ device->data.input =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_FS:
+ device->data.fs =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_WATCHDOG:
+ device->data.watchdog =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_MEMBALLOON:
+ device->data.memballoon =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_RNG:
+ device->data.rng =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_NVRAM:
+ device->data.nvram =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_HUB:
+ device->data.hub =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_SHMEM:
+ device->data.shmem =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_TPM:
+ device->data.tpm =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_PANIC:
+ device->data.panic =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_MEMORY:
+ device->data.memory =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_REDIRDEV:
+ device->data.redirdev =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_VSOCK:
+ device->data.vsock =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_IOMMU:
+ device->data.iommu =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_LEASE:
+ device->data.lease =3D devicedata;
+ break;
+ case VIR_DOMAIN_DEVICE_NONE:
+ case VIR_DOMAIN_DEVICE_LAST:
+ break;
+ }
+}
+
+
enum {
DOMAIN_DEVICE_ITERATE_ALL_CONSOLES =3D 1 << 0,
DOMAIN_DEVICE_ITERATE_GRAPHICS =3D 1 << 1
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 218aa4dd94..536b02ad3d 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2937,6 +2937,9 @@ virDomainDeviceDefPtr virDomainDeviceDefCopy(virDomai=
nDeviceDefPtr src,
virDomainDeviceInfoPtr virDomainDeviceGetInfo(virDomainDeviceDefPtr device=
);
void virDomainTPMDefFree(virDomainTPMDefPtr def);
=20
+void virDomainDeviceSetData(virDomainDeviceDefPtr device,
+ void *devicedata);
+
typedef int (*virDomainDeviceInfoCallback)(virDomainDefPtr def,
virDomainDeviceDefPtr dev,
virDomainDeviceInfoPtr info,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 6f4809a68a..89b8ca3b4f 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -307,6 +307,7 @@ virDomainDeviceDefParse;
virDomainDeviceFindSCSIController;
virDomainDeviceGetInfo;
virDomainDeviceInfoIterate;
+virDomainDeviceSetData;
virDomainDeviceTypeToString;
virDomainDeviceValidateAliasForHotplug;
virDomainDiskBusTypeToString;
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1548279226945848.1625173756483;
Wed, 23 Jan 2019 13:33:46 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 7850DC07F66B;
Wed, 23 Jan 2019 21:33:44 +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 428E4BA9E;
Wed, 23 Jan 2019 21:33:44 +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 F26C318033A8;
Wed, 23 Jan 2019 21:33:43 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLXNOd032309 for ;
Wed, 23 Jan 2019 16:33:23 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 73368BA8D; Wed, 23 Jan 2019 21:33:23 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id C4E68BA50;
Wed, 23 Jan 2019 21:33:22 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:36 -0500
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 08/25] qemu: command: Make BuildVirtioDevStr
more generic
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: ,
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.12
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]);
Wed, 23 Jan 2019 21:33:45 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Switch qemuBuildVirtioDevStr to use virDomainDeviceSetData: callers
pass in the virDomainDeviceType and the void * DefPtr. This will
save us from having to repeatedly extend the function argument
list in subsequent patches.
Signed-off-by: Cole Robinson
---
src/qemu/qemu_command.c | 82 ++++++++++++++++++++++++++++++++---------
1 file changed, 64 insertions(+), 18 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2dde4b9125..3a9e9def78 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -396,14 +396,34 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
}
=20
=20
+/**
+ * qemuBuildVirtioDevStr
+ * @buf: virBufferPtr to append the built string
+ * @baseName: qemu virtio device basename string. Ex: virtio-rng for
+ * @devtype: virDomainDeviceType of the device. Ex: VIR_DOMAIN_DEVICE_TYPE=
_RNG
+ * @devdata: *DefPtr of the device definition
+ *
+ * Build the qemu virtio -device name from the passed parameters. Currently
+ * this is mostly about attaching the correct string prefix to @baseName f=
or
+ * the passed @type. So for @baseName "virtio-rng" and devdata->info.type
+ * VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI, generate "virtio-rng-pci"
+ *
+ * Returns: -1 on failure, 0 on success
+ */
static int
qemuBuildVirtioDevStr(virBufferPtr buf,
const char *baseName,
- virDomainDeviceAddressType type)
+ virDomainDeviceType devtype,
+ void *devdata)
{
const char *implName =3D NULL;
+ virDomainDeviceDef device =3D { .type =3D devtype };
+ virDomainDeviceInfoPtr info;
=20
- switch (type) {
+ virDomainDeviceSetData(&device, devdata);
+ info =3D virDomainDeviceGetInfo(&device);
+
+ switch (info->type) {
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
implName =3D "pci";
break;
@@ -434,7 +454,7 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE:
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST:
default:
- virReportEnumRangeError(virDomainDeviceAddressType, type);
+ virReportEnumRangeError(virDomainDeviceAddressType, info->type);
return -1;
}
=20
@@ -443,7 +463,6 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
return 0;
}
=20
-
static int
qemuBuildVirtioOptionsStr(virBufferPtr buf,
virDomainVirtioOptionsPtr virtio,
@@ -2050,8 +2069,10 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
break;
=20
case VIR_DOMAIN_DISK_BUS_VIRTIO:
- if (qemuBuildVirtioDevStr(&opt, "virtio-blk", disk->info.type) < 0)
+ if (qemuBuildVirtioDevStr(&opt, "virtio-blk",
+ VIR_DOMAIN_DEVICE_DISK, disk) < 0) {
goto error;
+ }
=20
if (disk->iothread)
virBufferAsprintf(&opt, ",iothread=3Diothread%u", disk->iothre=
ad);
@@ -2639,8 +2660,10 @@ qemuBuildFSDevStr(const virDomainDef *def,
goto error;
}
=20
- if (qemuBuildVirtioDevStr(&opt, "virtio-9p", fs->info.type) < 0)
+ if (qemuBuildVirtioDevStr(&opt, "virtio-9p",
+ VIR_DOMAIN_DEVICE_FS, fs) < 0) {
goto error;
+ }
=20
virBufferAsprintf(&opt, ",id=3D%s", fs->info.alias);
virBufferAsprintf(&opt, ",fsdev=3D%s%s",
@@ -2845,8 +2868,10 @@ qemuBuildControllerDevStr(const virDomainDef *domain=
Def,
case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
switch ((virDomainControllerModelSCSI) def->model) {
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI:
- if (qemuBuildVirtioDevStr(&buf, "virtio-scsi", def->info.type)=
< 0)
+ if (qemuBuildVirtioDevStr(&buf, "virtio-scsi",
+ VIR_DOMAIN_DEVICE_CONTROLLER, def) <=
0) {
goto error;
+ }
=20
if (def->iothread) {
virBufferAsprintf(&buf, ",iothread=3Diothread%u",
@@ -2886,8 +2911,10 @@ qemuBuildControllerDevStr(const virDomainDef *domain=
Def,
break;
=20
case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL:
- if (qemuBuildVirtioDevStr(&buf, "virtio-serial", def->info.type) <=
0)
+ if (qemuBuildVirtioDevStr(&buf, "virtio-serial",
+ VIR_DOMAIN_DEVICE_CONTROLLER, def) < 0) {
goto error;
+ }
=20
virBufferAsprintf(&buf, ",id=3D%s", def->info.alias);
if (def->opts.vioserial.ports !=3D -1) {
@@ -3655,8 +3682,10 @@ qemuBuildNicDevStr(virDomainDefPtr def,
char macaddr[VIR_MAC_STRING_BUFLEN];
=20
if (virDomainNetIsVirtioModel(net)) {
- if (qemuBuildVirtioDevStr(&buf, "virtio-net", net->info.type) < 0)
+ if (qemuBuildVirtioDevStr(&buf, "virtio-net",
+ VIR_DOMAIN_DEVICE_NET, net) < 0) {
goto error;
+ }
=20
usingVirtio =3D true;
} else {
@@ -4050,7 +4079,8 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd,
return 0;
=20
if (qemuBuildVirtioDevStr(&buf, "virtio-balloon",
- def->memballoon->info.type) < 0) {
+ VIR_DOMAIN_DEVICE_MEMBALLOON,
+ def->memballoon) < 0) {
goto error;
}
=20
@@ -4148,20 +4178,28 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def,
=20
switch ((virDomainInputType)dev->type) {
case VIR_DOMAIN_INPUT_TYPE_MOUSE:
- if (qemuBuildVirtioDevStr(&buf, "virtio-mouse", dev->info.type) < =
0)
+ if (qemuBuildVirtioDevStr(&buf, "virtio-mouse",
+ VIR_DOMAIN_DEVICE_INPUT, dev) < 0) {
goto error;
+ }
break;
case VIR_DOMAIN_INPUT_TYPE_TABLET:
- if (qemuBuildVirtioDevStr(&buf, "virtio-tablet", dev->info.type) <=
0)
+ if (qemuBuildVirtioDevStr(&buf, "virtio-tablet",
+ VIR_DOMAIN_DEVICE_INPUT, dev) < 0) {
goto error;
+ }
break;
case VIR_DOMAIN_INPUT_TYPE_KBD:
- if (qemuBuildVirtioDevStr(&buf, "virtio-keyboard", dev->info.type)=
< 0)
+ if (qemuBuildVirtioDevStr(&buf, "virtio-keyboard",
+ VIR_DOMAIN_DEVICE_INPUT, dev) < 0) {
goto error;
+ }
break;
case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
- if (qemuBuildVirtioDevStr(&buf, "virtio-input-host", dev->info.typ=
e) < 0)
+ if (qemuBuildVirtioDevStr(&buf, "virtio-input-host",
+ VIR_DOMAIN_DEVICE_INPUT, dev) < 0) {
goto error;
+ }
break;
case VIR_DOMAIN_INPUT_TYPE_LAST:
default:
@@ -4479,8 +4517,10 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
}
=20
if (STREQ(model, "virtio-gpu")) {
- if (qemuBuildVirtioDevStr(&buf, "virtio-gpu", video->info.type) < =
0)
+ if (qemuBuildVirtioDevStr(&buf, "virtio-gpu",
+ VIR_DOMAIN_DEVICE_VIDEO, video) < 0) {
goto error;
+ }
} else {
virBufferAsprintf(&buf, "%s", model);
}
@@ -4925,8 +4965,10 @@ qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *=
def,
goto cleanup;
}
=20
- if (qemuBuildVirtioDevStr(&buf, "vhost-scsi", dev->info->type) < 0)
+ if (qemuBuildVirtioDevStr(&buf, "vhost-scsi",
+ VIR_DOMAIN_DEVICE_HOSTDEV, dev) < 0) {
goto cleanup;
+ }
=20
virBufferAsprintf(&buf, ",wwpn=3D%s,vhostfd=3D%s,id=3D%s",
hostsrc->wwpn,
@@ -5873,8 +5915,10 @@ qemuBuildRNGDevStr(const virDomainDef *def,
dev->source.file))
goto error;
=20
- if (qemuBuildVirtioDevStr(&buf, "virtio-rng", dev->info.type) < 0)
+ if (qemuBuildVirtioDevStr(&buf, "virtio-rng",
+ VIR_DOMAIN_DEVICE_RNG, dev) < 0) {
goto error;
+ }
=20
virBufferAsprintf(&buf, ",rng=3Dobj%s,id=3D%s",
dev->info.alias, dev->info.alias);
@@ -10346,8 +10390,10 @@ qemuBuildVsockDevStr(virDomainDefPtr def,
char *ret =3D NULL;
=20
=20
- if (qemuBuildVirtioDevStr(&buf, "vhost-vsock", vsock->info.type) < 0)
+ if (qemuBuildVirtioDevStr(&buf, "vhost-vsock",
+ VIR_DOMAIN_DEVICE_VSOCK, vsock) < 0) {
goto cleanup;
+ }
=20
virBufferAsprintf(&buf, ",id=3D%s", vsock->info.alias);
virBufferAsprintf(&buf, ",guest-cid=3D%u", vsock->guest_cid);
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 15482792308730.4986105637563014;
Wed, 23 Jan 2019 13:33:50 -0800 (PST)
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 BF5097F3FA;
Wed, 23 Jan 2019 21:33:48 +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 7E4EC5D75F;
Wed, 23 Jan 2019 21:33:48 +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 262AF3F60C;
Wed, 23 Jan 2019 21:33:48 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLXOH7032319 for ;
Wed, 23 Jan 2019 16:33:24 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 8C318BA8D; Wed, 23 Jan 2019 21:33:24 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id B7A7A65F72;
Wed, 23 Jan 2019 21:33:23 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:37 -0500
Message-Id:
<4a44cafbddd520ecb3214afc1b334546de2d8441.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 09/25] qemu: command: Add qemuCaps to
BuildVirtioStr
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: ,
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.25]);
Wed, 23 Jan 2019 21:33:49 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
It will be used in future patches
Signed-off-by: Cole Robinson
Reviewed-by: Andrea Bolognani
---
src/qemu/qemu_command.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3a9e9def78..659274f25a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -400,6 +400,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
* qemuBuildVirtioDevStr
* @buf: virBufferPtr to append the built string
* @baseName: qemu virtio device basename string. Ex: virtio-rng for
+ * @qemuCaps: virQEMUCapPtr
* @devtype: virDomainDeviceType of the device. Ex: VIR_DOMAIN_DEVICE_TYPE=
_RNG
* @devdata: *DefPtr of the device definition
*
@@ -413,6 +414,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
static int
qemuBuildVirtioDevStr(virBufferPtr buf,
const char *baseName,
+ virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED,
virDomainDeviceType devtype,
void *devdata)
{
@@ -2069,7 +2071,7 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
break;
=20
case VIR_DOMAIN_DISK_BUS_VIRTIO:
- if (qemuBuildVirtioDevStr(&opt, "virtio-blk",
+ if (qemuBuildVirtioDevStr(&opt, "virtio-blk", qemuCaps,
VIR_DOMAIN_DEVICE_DISK, disk) < 0) {
goto error;
}
@@ -2660,7 +2662,7 @@ qemuBuildFSDevStr(const virDomainDef *def,
goto error;
}
=20
- if (qemuBuildVirtioDevStr(&opt, "virtio-9p",
+ if (qemuBuildVirtioDevStr(&opt, "virtio-9p", qemuCaps,
VIR_DOMAIN_DEVICE_FS, fs) < 0) {
goto error;
}
@@ -2868,7 +2870,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainD=
ef,
case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
switch ((virDomainControllerModelSCSI) def->model) {
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI:
- if (qemuBuildVirtioDevStr(&buf, "virtio-scsi",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-scsi", qemuCaps,
VIR_DOMAIN_DEVICE_CONTROLLER, def) <=
0) {
goto error;
}
@@ -2911,7 +2913,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainD=
ef,
break;
=20
case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL:
- if (qemuBuildVirtioDevStr(&buf, "virtio-serial",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-serial", qemuCaps,
VIR_DOMAIN_DEVICE_CONTROLLER, def) < 0) {
goto error;
}
@@ -3682,7 +3684,7 @@ qemuBuildNicDevStr(virDomainDefPtr def,
char macaddr[VIR_MAC_STRING_BUFLEN];
=20
if (virDomainNetIsVirtioModel(net)) {
- if (qemuBuildVirtioDevStr(&buf, "virtio-net",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-net", qemuCaps,
VIR_DOMAIN_DEVICE_NET, net) < 0) {
goto error;
}
@@ -4078,7 +4080,7 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd,
if (!virDomainDefHasMemballoon(def))
return 0;
=20
- if (qemuBuildVirtioDevStr(&buf, "virtio-balloon",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-balloon", qemuCaps,
VIR_DOMAIN_DEVICE_MEMBALLOON,
def->memballoon) < 0) {
goto error;
@@ -4178,25 +4180,25 @@ qemuBuildVirtioInputDevStr(const virDomainDef *def,
=20
switch ((virDomainInputType)dev->type) {
case VIR_DOMAIN_INPUT_TYPE_MOUSE:
- if (qemuBuildVirtioDevStr(&buf, "virtio-mouse",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-mouse", qemuCaps,
VIR_DOMAIN_DEVICE_INPUT, dev) < 0) {
goto error;
}
break;
case VIR_DOMAIN_INPUT_TYPE_TABLET:
- if (qemuBuildVirtioDevStr(&buf, "virtio-tablet",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-tablet", qemuCaps,
VIR_DOMAIN_DEVICE_INPUT, dev) < 0) {
goto error;
}
break;
case VIR_DOMAIN_INPUT_TYPE_KBD:
- if (qemuBuildVirtioDevStr(&buf, "virtio-keyboard",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-keyboard", qemuCaps,
VIR_DOMAIN_DEVICE_INPUT, dev) < 0) {
goto error;
}
break;
case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
- if (qemuBuildVirtioDevStr(&buf, "virtio-input-host",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-input-host", qemuCaps,
VIR_DOMAIN_DEVICE_INPUT, dev) < 0) {
goto error;
}
@@ -4517,7 +4519,7 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
}
=20
if (STREQ(model, "virtio-gpu")) {
- if (qemuBuildVirtioDevStr(&buf, "virtio-gpu",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-gpu", qemuCaps,
VIR_DOMAIN_DEVICE_VIDEO, video) < 0) {
goto error;
}
@@ -4965,7 +4967,7 @@ qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *d=
ef,
goto cleanup;
}
=20
- if (qemuBuildVirtioDevStr(&buf, "vhost-scsi",
+ if (qemuBuildVirtioDevStr(&buf, "vhost-scsi", qemuCaps,
VIR_DOMAIN_DEVICE_HOSTDEV, dev) < 0) {
goto cleanup;
}
@@ -5915,7 +5917,7 @@ qemuBuildRNGDevStr(const virDomainDef *def,
dev->source.file))
goto error;
=20
- if (qemuBuildVirtioDevStr(&buf, "virtio-rng",
+ if (qemuBuildVirtioDevStr(&buf, "virtio-rng", qemuCaps,
VIR_DOMAIN_DEVICE_RNG, dev) < 0) {
goto error;
}
@@ -10390,7 +10392,7 @@ qemuBuildVsockDevStr(virDomainDefPtr def,
char *ret =3D NULL;
=20
=20
- if (qemuBuildVirtioDevStr(&buf, "vhost-vsock",
+ if (qemuBuildVirtioDevStr(&buf, "vhost-vsock", qemuCaps,
VIR_DOMAIN_DEVICE_VSOCK, vsock) < 0) {
goto cleanup;
}
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1548279234980443.70965024072575;
Wed, 23 Jan 2019 13:33:54 -0800 (PST)
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 F3C9987645;
Wed, 23 Jan 2019 21:33:52 +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 B18C46BF7B;
Wed, 23 Jan 2019 21:33:52 +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 5F6313F60D;
Wed, 23 Jan 2019 21:33:52 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLXPmw032324 for ;
Wed, 23 Jan 2019 16:33:25 -0500
Received: by smtp.corp.redhat.com (Postfix)
id C70A5BA6D; Wed, 23 Jan 2019 21:33:25 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id EBD4EBA50;
Wed, 23 Jan 2019 21:33:24 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:38 -0500
Message-Id:
<4410eb25e13925ff94a0a71cd9de86971bf2dc1e.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 10/25] qemu: capabilities: Add virtio/vhost
{non-}transitional
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: ,
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.26]);
Wed, 23 Jan 2019 21:33:53 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
This adds QEMU_CAPS flags for the following devices
virtio-blk-pci-transitional
virtio-blk-pci-non-transitional
virtio-net-pci-transitional
virtio-net-pci-non-transitional
vhost-scsi-pci-transitional
vhost-scsi-pci-non-transitional
virtio-rng-pci-transitional
virtio-rng-pci-non-transitional
virtio-9p-pci-transitional
virtio-9p-pci-non-transitional
virtio-balloon-pci-transitional
virtio-balloon-pci-non-transitional
vhost-vsock-pci-transitional
vhost-vsock-pci-non-transitional
virtio-input-host-pci-transitional
virtio-input-host-pci-non-transitional
virtio-scsi-pci-transitional
virtio-scsi-pci-non-transitional
virtio-serial-pci-transitional
virtio-serial-pci-non-transitional
Signed-off-by: Cole Robinson
Reviewed-by: Andrea Bolognani
---
src/qemu/qemu_capabilities.c | 48 +++++++++++++++++++
src/qemu/qemu_capabilities.h | 28 +++++++++++
.../caps_4.0.0.x86_64.xml | 20 ++++++++
3 files changed, 96 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index f504db7d05..ee471787d9 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -520,6 +520,34 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
/* 325 */
"memory-backend-file.pmem",
"nvdimm.unarmed",
+ "virtio-blk-pci-transitional",
+ "virtio-blk-pci-non-transitional",
+ "virtio-net-pci-transitional",
+
+ /* 330 */
+ "virtio-net-pci-non-transitional",
+ "vhost-scsi-pci-transitional",
+ "vhost-scsi-pci-non-transitional",
+ "virtio-rng-pci-transitional",
+ "virtio-rng-pci-non-transitional",
+
+ /* 335 */
+ "virtio-9p-pci-transitional",
+ "virtio-9p-pci-non-transitional",
+ "virtio-balloon-pci-transitional",
+ "virtio-balloon-pci-non-transitional",
+ "vhost-vsock-pci-transitional",
+
+ /* 340 */
+ "vhost-vsock-pci-non-transitional",
+ "virtio-input-host-pci-transitional",
+ "virtio-input-host-pci-non-transitional",
+ "virtio-scsi-pci-transitional",
+ "virtio-scsi-pci-non-transitional",
+
+ /* 345 */
+ "virtio-serial-pci-transitional",
+ "virtio-serial-pci-non-transitional",
);
=20
=20
@@ -1108,6 +1136,26 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes=
[] =3D {
{ "vfio-ap", QEMU_CAPS_DEVICE_VFIO_AP },
{ "zpci", QEMU_CAPS_DEVICE_ZPCI },
{ "memory-backend-memfd", QEMU_CAPS_OBJECT_MEMORY_MEMFD },
+ { "virtio-blk-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_TRANS=
ITIONAL },
+ { "virtio-blk-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_N=
ON_TRANSITIONAL },
+ { "virtio-net-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_TRANS=
ITIONAL },
+ { "virtio-net-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_N=
ON_TRANSITIONAL },
+ { "vhost-scsi-pci-transitional", QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_TRANS=
ITIONAL },
+ { "vhost-scsi-pci-non-transitional", QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_N=
ON_TRANSITIONAL },
+ { "virtio-rng-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_TRANS=
ITIONAL },
+ { "virtio-rng-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_N=
ON_TRANSITIONAL },
+ { "virtio-9p-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_9P_PCI_TRANSIT=
IONAL },
+ { "virtio-9p-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_9P_PCI_NON=
_TRANSITIONAL },
+ { "virtio-balloon-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_BALLOON_P=
CI_TRANSITIONAL },
+ { "virtio-balloon-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_BALLO=
ON_PCI_NON_TRANSITIONAL },
+ { "vhost-vsock-pci-transitional", QEMU_CAPS_DEVICE_VHOST_VSOCK_PCI_TRA=
NSITIONAL },
+ { "vhost-vsock-pci-non-transitional", QEMU_CAPS_DEVICE_VHOST_VSOCK_PCI=
_NON_TRANSITIONAL },
+ { "virtio-input-host-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_INPUT_=
HOST_PCI_TRANSITIONAL },
+ { "virtio-input-host-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_IN=
PUT_HOST_PCI_NON_TRANSITIONAL },
+ { "virtio-scsi-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_SCSI_PCI_TRA=
NSITIONAL },
+ { "virtio-scsi-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_SCSI_PCI=
_NON_TRANSITIONAL },
+ { "virtio-serial-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI=
_TRANSITIONAL },
+ { "virtio-serial-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_SERIAL=
_PCI_NON_TRANSITIONAL },
};
=20
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[]=
=3D {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 6d5ed8a3cc..cff3506355 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -504,6 +504,34 @@ typedef enum { /* virQEMUCapsFlags grouping marker for=
syntax-check */
/* 325 */
QEMU_CAPS_OBJECT_MEMORY_FILE_PMEM, /* -object memory-backend-file,pmem=
=3D */
QEMU_CAPS_DEVICE_NVDIMM_UNARMED, /* -device nvdimm,unarmed=3D */
+ QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_TRANSITIONAL, /* -device virtio-blk-pc=
i-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_NON_TRANSITIONAL, /* -device virtio-bl=
k-pci-non-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_TRANSITIONAL, /* -device virtio-net-pc=
i-transitional */
+
+ /* 330 */
+ QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_NON_TRANSITIONAL, /* -device virtio-ne=
t-pci-non-transitional */
+ QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_TRANSITIONAL, /* -device vhost-scsi-pc=
i-transitional */
+ QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_NON_TRANSITIONAL, /* -device vhost-scs=
i-pci-non-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_TRANSITIONAL, /* -device virtio-blk-rn=
g-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_NON_TRANSITIONAL, /* -device virtio-rn=
g-pci-non-transitional */
+
+ /* 335 */
+ QEMU_CAPS_DEVICE_VIRTIO_9P_PCI_TRANSITIONAL, /* -device virtio-9p-pci-=
transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_9P_PCI_NON_TRANSITIONAL, /* -device virtio-9p-=
pci-non-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_BALLOON_PCI_TRANSITIONAL, /* -device virtio-ba=
lloon-pci-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_BALLOON_PCI_NON_TRANSITIONAL, /* -device virti=
o-balloon-pci-transitional */
+ QEMU_CAPS_DEVICE_VHOST_VSOCK_PCI_TRANSITIONAL, /* -device vhost-vsock-=
pci-transitional */
+
+ /* 340 */
+ QEMU_CAPS_DEVICE_VHOST_VSOCK_PCI_NON_TRANSITIONAL, /* -device vhost-vs=
ock-pci-non-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_TRANSITIONAL, /* -device virtio=
-input-host-pci-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_NON_TRANSITIONAL, /* -device vi=
rtio-input-host-pci-non-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_SCSI_PCI_TRANSITIONAL, /* -device virtio-scsi-=
pci-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_SCSI_PCI_NON_TRANSITIONAL, /* -device virtio-s=
csi-pci-non-transitional */
+
+ /* 345 */
+ QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_TRANSITIONAL, /* -device virtio-ser=
ial-pci-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_SERIAL_PCI_NON_TRANSITIONAL, /* -device virtio=
-serial-pci-non-transitional */
=20
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemuc=
apabilitiesdata/caps_4.0.0.x86_64.xml
index c2db392e83..aaf7d404eb 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
@@ -212,6 +212,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 30010500446361
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1548279215852730.4824238283701;
Wed, 23 Jan 2019 13:33:35 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com
[10.5.11.16])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 00DA2AD896;
Wed, 23 Jan 2019 21:33:32 +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 A9FAB58824;
Wed, 23 Jan 2019 21:33:31 +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 5CBBC3F606;
Wed, 23 Jan 2019 21:33:31 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLXRtY032340 for ;
Wed, 23 Jan 2019 16:33:27 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 6F787BA96; Wed, 23 Jan 2019 21:33:27 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id 2D48EBA50;
Wed, 23 Jan 2019 21:33:25 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:39 -0500
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Cc: Andrea Bolognani
Subject: [libvirt] [PATCH v2 11/25] conf: Add
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: ,
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.16
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]);
Wed, 23 Jan 2019 21:33:33 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
devices lack the model=3D attribute which is used by
most other device types. bus=3D mostly acts as one, but it
serves other purposes too like determing what target=3D
prefix to use, and for matching against controller type=3D
values.
Extending bus=3D to handle additional virtio transitional
devices will complicate apps lives, and it isn't a clean
mapping anyways. So let's bite the bullet and add a new
attribute, and wire up common handling
for virtio and virtio-{non-}transitional
Reviewed-by: Andrea Bolognani
Signed-off-by: Cole Robinson
---
docs/formatdomain.html.in | 10 +++++
docs/schemas/domaincommon.rng | 9 ++++
src/conf/domain_conf.c | 40 ++++++++++++++++++
src/conf/domain_conf.h | 11 +++++
src/libvirt_private.syms | 2 +
.../virtio-non-transitional.x86_64-3.1.0.args | 34 +++++++++++++++
...virtio-non-transitional.x86_64-latest.args | 34 +++++++++++++++
.../virtio-non-transitional.xml | 18 ++++++++
.../virtio-transitional.x86_64-3.1.0.args | 34 +++++++++++++++
.../virtio-transitional.x86_64-latest.args | 34 +++++++++++++++
.../qemuxml2argvdata/virtio-transitional.xml | 18 ++++++++
tests/qemuxml2argvtest.c | 6 +++
.../virtio-non-transitional.xml | 42 +++++++++++++++++++
.../virtio-transitional.xml | 42 +++++++++++++++++++
tests/qemuxml2xmltest.c | 11 +++++
15 files changed, 345 insertions(+)
create mode 100644 tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3=
.1.0.args
create mode 100644 tests/qemuxml2argvdata/virtio-non-transitional.x86_64-l=
atest.args
create mode 100644 tests/qemuxml2argvdata/virtio-non-transitional.xml
create mode 100644 tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0=
.args
create mode 100644 tests/qemuxml2argvdata/virtio-transitional.x86_64-lates=
t.args
create mode 100644 tests/qemuxml2argvdata/virtio-transitional.xml
create mode 100644 tests/qemuxml2xmloutdata/virtio-non-transitional.xml
create mode 100644 tests/qemuxml2xmloutdata/virtio-transitional.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 7f07bb7f55..0f66b5a1fc 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2922,6 +2922,16 @@
Since 0.1.4
+
model
+
+ Indicates the emulated device model of the disk. Typically
+ this is indicated solely by the bus property but
+ for bus "virtio" the model can be specified furth=
er
+ with "virtio-transitional", "virtio-non-transitional", or
+ "virtio" which matches the old behavior. These settings are
+ only applicable when using controller bus type "pci".
+ Since 5.1.0
+
rawio
Indicates whether the disk needs rawio capability. Valid
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index aa50eac424..7af6e2532b 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1506,6 +1506,15 @@
+
+
+
+ virtio
+ virtio-transitional
+ virtio-non-transitional
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8af1a4ae73..eeb1191677 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -889,6 +889,13 @@ VIR_ENUM_IMPL(virDomainDiskDetectZeroes, VIR_DOMAIN_DI=
SK_DETECT_ZEROES_LAST,
"on",
"unmap")
=20
+VIR_ENUM_IMPL(virDomainDiskModel, VIR_DOMAIN_DISK_MODEL_LAST,
+ "default",
+ "virtio",
+ "virtio-transitional",
+ "virtio-non-transitional",
+);
+
VIR_ENUM_IMPL(virDomainDiskMirrorState, VIR_DOMAIN_DISK_MIRROR_STATE_LAST,
"none",
"yes",
@@ -5525,6 +5532,17 @@ virDomainDiskDefValidate(const virDomainDiskDef *dis=
k)
return -1;
}
=20
+ if (disk->bus !=3D VIR_DOMAIN_DISK_BUS_VIRTIO &&
+ (disk->model =3D=3D VIR_DOMAIN_DISK_MODEL_VIRTIO ||
+ disk->model =3D=3D VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL ||
+ disk->model =3D=3D VIR_DOMAIN_DISK_MODEL_VIRTIO_NON_TRANSITIONAL)=
) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("disk model '%s' not supported for bus '%s'"),
+ virDomainDiskModelTypeToString(disk->model),
+ virDomainDiskBusTypeToString(disk->bus));
+ return -1;
+ }
+
return 0;
}
=20
@@ -9612,6 +9630,14 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlop=
t,
}
VIR_FREE(tmp);
=20
+ if ((tmp =3D virXMLPropString(node, "model")) &&
+ (def->model =3D virDomainDiskModelTypeFromString(tmp)) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown disk model '%s'"), tmp);
+ goto error;
+ }
+ VIR_FREE(tmp);
+
snapshot =3D virXMLPropString(node, "snapshot");
=20
rawio =3D virXMLPropString(node, "rawio");
@@ -21861,6 +21887,14 @@ virDomainDiskDefCheckABIStability(virDomainDiskDef=
Ptr src,
return false;
}
=20
+ if (src->model !=3D dst->model) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Target disk model %s does not match source %s"),
+ virDomainDiskModelTypeToString(dst->model),
+ virDomainDiskModelTypeToString(src->model));
+ return false;
+ }
+
if (src->virtio && dst->virtio &&
!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
return false;
@@ -24426,6 +24460,12 @@ virDomainDiskDefFormat(virBufferPtr buf,
virBufferAsprintf(buf,
"model) {
+ virBufferAsprintf(buf, " model=3D'%s'",
+ virDomainDiskModelTypeToString(def->model));
+ }
+
if (def->rawio) {
virBufferAsprintf(buf, " rawio=3D'%s'",
virTristateBoolTypeToString(def->rawio));
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 536b02ad3d..644dde3dd3 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -567,6 +567,15 @@ typedef enum {
VIR_DOMAIN_DISK_DETECT_ZEROES_LAST
} virDomainDiskDetectZeroes;
=20
+typedef enum {
+ VIR_DOMAIN_DISK_MODEL_DEFAULT =3D 0,
+ VIR_DOMAIN_DISK_MODEL_VIRTIO,
+ VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL,
+ VIR_DOMAIN_DISK_MODEL_VIRTIO_NON_TRANSITIONAL,
+
+ VIR_DOMAIN_DISK_MODEL_LAST
+} virDomainDiskModel;
+
typedef struct _virDomainBlockIoTuneInfo virDomainBlockIoTuneInfo;
struct _virDomainBlockIoTuneInfo {
unsigned long long total_bytes_sec;
@@ -674,6 +683,7 @@ struct _virDomainDiskDef {
int detect_zeroes; /* enum virDomainDiskDetectZeroes */
char *domain_name; /* backend domain name */
unsigned int queues;
+ int model; /* enum virDomainDiskModel */
virDomainVirtioOptionsPtr virtio;
};
=20
@@ -3417,6 +3427,7 @@ VIR_ENUM_DECL(virDomainDeviceSGIO)
VIR_ENUM_DECL(virDomainDiskTray)
VIR_ENUM_DECL(virDomainDiskDiscard)
VIR_ENUM_DECL(virDomainDiskDetectZeroes)
+VIR_ENUM_DECL(virDomainDiskModel)
VIR_ENUM_DECL(virDomainDiskMirrorState)
VIR_ENUM_DECL(virDomainController)
VIR_ENUM_DECL(virDomainControllerModelPCI)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 89b8ca3b4f..8d27d507cc 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -344,6 +344,8 @@ virDomainDiskIoTypeFromString;
virDomainDiskIoTypeToString;
virDomainDiskMirrorStateTypeFromString;
virDomainDiskMirrorStateTypeToString;
+virDomainDiskModelTypeFromString;
+virDomainDiskModelTypeToString;
virDomainDiskPathByName;
virDomainDiskRemove;
virDomainDiskRemoveByName;
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.ar=
gs b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
new file mode 100644
index 0000000000..9e11e900da
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
@@ -0,0 +1,34 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/home/test \
+USER=3Dtest \
+LOGNAME=3Dtest \
+QEMU_AUDIO_DRV=3Dnone \
+/usr/bin/qemu-system-x86_64 \
+-name guest=3DQEMUGuest1,debug-threads=3Don \
+-S \
+-object secret,id=3DmasterKey0,format=3Draw,\
+file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
+-machine pc-q35-3.1,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \
+-m 214 \
+-realtime mlock=3Doff \
+-smp 1,sockets=3D1,cores=3D1,threads=3D1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \
+-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \
+-rtc base=3Dutc \
+-no-shutdown \
+-no-acpi \
+-boot strict=3Don \
+-device pcie-root-port,port=3D0x8,chassis=3D1,id=3Dpci.1,bus=3Dpcie.0,mult=
ifunction=3Don,\
+addr=3D0x1 \
+-device pcie-root-port,port=3D0x9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
+-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
+-device virtio-blk-pci,scsi=3Doff,bus=3Dpci.1,addr=3D0x0,drive=3Ddrive-vir=
tio-disk0,\
+id=3Dvirtio-disk0,bootindex=3D1 \
+-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
+resourcecontrol=3Ddeny \
+-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.a=
rgs b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
new file mode 100644
index 0000000000..070b4b8334
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -0,0 +1,34 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/home/test \
+USER=3Dtest \
+LOGNAME=3Dtest \
+QEMU_AUDIO_DRV=3Dnone \
+/usr/bin/qemu-system-x86_64 \
+-name guest=3DQEMUGuest1,debug-threads=3Don \
+-S \
+-object secret,id=3DmasterKey0,format=3Draw,\
+file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
+-machine q35,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \
+-m 214 \
+-realtime mlock=3Doff \
+-smp 1,sockets=3D1,cores=3D1,threads=3D1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \
+-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \
+-rtc base=3Dutc \
+-no-shutdown \
+-no-acpi \
+-boot strict=3Don \
+-device pcie-root-port,port=3D0x8,chassis=3D1,id=3Dpci.1,bus=3Dpcie.0,mult=
ifunction=3Don,\
+addr=3D0x1 \
+-device pcie-root-port,port=3D0x9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
+-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
+-device virtio-blk-pci,scsi=3Doff,bus=3Dpci.1,addr=3D0x0,drive=3Ddrive-vir=
tio-disk0,\
+id=3Dvirtio-disk0,bootindex=3D1 \
+-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
+resourcecontrol=3Ddeny \
+-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qem=
uxml2argvdata/virtio-non-transitional.xml
new file mode 100644
index 0000000000..7899994622
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml
@@ -0,0 +1,18 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+
+ hvm
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b=
/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
new file mode 100644
index 0000000000..9e11e900da
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -0,0 +1,34 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/home/test \
+USER=3Dtest \
+LOGNAME=3Dtest \
+QEMU_AUDIO_DRV=3Dnone \
+/usr/bin/qemu-system-x86_64 \
+-name guest=3DQEMUGuest1,debug-threads=3Don \
+-S \
+-object secret,id=3DmasterKey0,format=3Draw,\
+file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
+-machine pc-q35-3.1,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \
+-m 214 \
+-realtime mlock=3Doff \
+-smp 1,sockets=3D1,cores=3D1,threads=3D1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \
+-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \
+-rtc base=3Dutc \
+-no-shutdown \
+-no-acpi \
+-boot strict=3Don \
+-device pcie-root-port,port=3D0x8,chassis=3D1,id=3Dpci.1,bus=3Dpcie.0,mult=
ifunction=3Don,\
+addr=3D0x1 \
+-device pcie-root-port,port=3D0x9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
+-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
+-device virtio-blk-pci,scsi=3Doff,bus=3Dpci.1,addr=3D0x0,drive=3Ddrive-vir=
tio-disk0,\
+id=3Dvirtio-disk0,bootindex=3D1 \
+-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
+resourcecontrol=3Ddeny \
+-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args =
b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
new file mode 100644
index 0000000000..070b4b8334
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -0,0 +1,34 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/home/test \
+USER=3Dtest \
+LOGNAME=3Dtest \
+QEMU_AUDIO_DRV=3Dnone \
+/usr/bin/qemu-system-x86_64 \
+-name guest=3DQEMUGuest1,debug-threads=3Don \
+-S \
+-object secret,id=3DmasterKey0,format=3Draw,\
+file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
+-machine q35,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \
+-m 214 \
+-realtime mlock=3Doff \
+-smp 1,sockets=3D1,cores=3D1,threads=3D1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \
+-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \
+-rtc base=3Dutc \
+-no-shutdown \
+-no-acpi \
+-boot strict=3Don \
+-device pcie-root-port,port=3D0x8,chassis=3D1,id=3Dpci.1,bus=3Dpcie.0,mult=
ifunction=3Don,\
+addr=3D0x1 \
+-device pcie-root-port,port=3D0x9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
+-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
+-device virtio-blk-pci,scsi=3Doff,bus=3Dpci.1,addr=3D0x0,drive=3Ddrive-vir=
tio-disk0,\
+id=3Dvirtio-disk0,bootindex=3D1 \
+-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
+resourcecontrol=3Ddeny \
+-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml=
2argvdata/virtio-transitional.xml
new file mode 100644
index 0000000000..678a7b9132
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-transitional.xml
@@ -0,0 +1,18 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+
+ hvm
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index ba6fd4db35..4f7adf18f5 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -3073,6 +3073,12 @@ mymain(void)
DO_TEST("riscv64-virt",
QEMU_CAPS_DEVICE_VIRTIO_MMIO);
=20
+ /* Older version checks disable-legacy usage */
+ DO_TEST_CAPS_VER("virtio-transitional", "3.1.0");
+ DO_TEST_CAPS_VER("virtio-non-transitional", "3.1.0");
+ DO_TEST_CAPS_LATEST("virtio-transitional");
+ DO_TEST_CAPS_LATEST("virtio-non-transitional");
+
/* Simple headless guests for various architectures */
DO_TEST_CAPS_ARCH_LATEST("aarch64-virt-headless", "aarch64");
DO_TEST_CAPS_ARCH_LATEST("ppc64-pseries-headless", "ppc64");
diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/q=
emuxml2xmloutdata/virtio-non-transitional.xml
new file mode 100644
index 0000000000..7e4aa16b32
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
@@ -0,0 +1,42 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemux=
ml2xmloutdata/virtio-transitional.xml
new file mode 100644
index 0000000000..1d28af9abb
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -0,0 +1,42 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index b2c0c8505d..a84f9241d6 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1268,6 +1268,17 @@ mymain(void)
DO_TEST("riscv64-virt",
QEMU_CAPS_DEVICE_VIRTIO_MMIO);
=20
+ DO_TEST("virtio-transitional",
+ QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+ QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
+ QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY);
+ DO_TEST("virtio-non-transitional",
+ QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+ QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
+ QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
+ QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY);
+
if (getenv("LIBVIRT_SKIP_CLEANUP") =3D=3D NULL)
virFileDeleteTree(fakerootdir);
=20
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1548279238904879.8342678472634;
Wed, 23 Jan 2019 13:33:58 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com
[10.5.11.22])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 0784B1451FD;
Wed, 23 Jan 2019 21:33:57 +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 BBF711059592;
Wed, 23 Jan 2019 21:33:56 +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 6F8FC18033CA;
Wed, 23 Jan 2019 21:33:56 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLXSXa032349 for ;
Wed, 23 Jan 2019 16:33:28 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 8979CBA96; Wed, 23 Jan 2019 21:33:28 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id B0A0EBA50;
Wed, 23 Jan 2019 21:33:27 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:40 -0500
Message-Id:
<8a63a2f5e7d1a30d0cc8389790dfb1a799762aa2.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 12/25] qemu: Support disk
model=virtio-{non-}transitional
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: ,
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]);
Wed, 23 Jan 2019 21:33:57 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Add new model values for virtio transitional devices. When
combined with bus=3D'virtio':
* "virtio-transitional" maps to qemu "virtio-blk-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-blk-pci-non-transitional"
Signed-off-by: Cole Robinson
---
src/qemu/qemu_command.c | 71 +++++++++++++++++++
src/qemu/qemu_domain_address.c | 3 +
.../virtio-non-transitional.x86_64-3.1.0.args | 4 +-
...virtio-non-transitional.x86_64-latest.args | 4 +-
.../virtio-transitional.x86_64-3.1.0.args | 5 +-
.../virtio-transitional.x86_64-latest.args | 7 +-
.../virtio-transitional.xml | 10 ++-
7 files changed, 92 insertions(+), 12 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 659274f25a..3cf0f5b13e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -421,6 +421,8 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
const char *implName =3D NULL;
virDomainDeviceDef device =3D { .type =3D devtype };
virDomainDeviceInfoPtr info;
+ int tmodel_cap, ntmodel_cap;
+ bool has_tmodel, has_ntmodel;
=20
virDomainDeviceSetData(&device, devdata);
info =3D virDomainDeviceGetInfo(&device);
@@ -462,9 +464,78 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
=20
virBufferAsprintf(buf, "%s-%s", baseName, implName);
=20
+ switch (devtype) {
+ case VIR_DOMAIN_DEVICE_DISK:
+ has_tmodel =3D device.data.disk->model =3D=3D VIR_DOMAIN_DISK_=
MODEL_VIRTIO_TRANSITIONAL;
+ has_ntmodel =3D device.data.disk->model =3D=3D VIR_DOMAIN_DISK=
_MODEL_VIRTIO_NON_TRANSITIONAL;
+ tmodel_cap =3D QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_TRANSITIONAL;
+ ntmodel_cap =3D QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_NON_TRANSITION=
AL;
+ break;
+
+ case VIR_DOMAIN_DEVICE_LEASE:
+ case VIR_DOMAIN_DEVICE_FS:
+ case VIR_DOMAIN_DEVICE_NET:
+ case VIR_DOMAIN_DEVICE_INPUT:
+ case VIR_DOMAIN_DEVICE_SOUND:
+ case VIR_DOMAIN_DEVICE_VIDEO:
+ case VIR_DOMAIN_DEVICE_HOSTDEV:
+ case VIR_DOMAIN_DEVICE_WATCHDOG:
+ case VIR_DOMAIN_DEVICE_CONTROLLER:
+ case VIR_DOMAIN_DEVICE_GRAPHICS:
+ case VIR_DOMAIN_DEVICE_HUB:
+ case VIR_DOMAIN_DEVICE_REDIRDEV:
+ case VIR_DOMAIN_DEVICE_NONE:
+ case VIR_DOMAIN_DEVICE_SMARTCARD:
+ case VIR_DOMAIN_DEVICE_CHR:
+ case VIR_DOMAIN_DEVICE_MEMBALLOON:
+ case VIR_DOMAIN_DEVICE_NVRAM:
+ case VIR_DOMAIN_DEVICE_SHMEM:
+ case VIR_DOMAIN_DEVICE_TPM:
+ case VIR_DOMAIN_DEVICE_PANIC:
+ case VIR_DOMAIN_DEVICE_RNG:
+ case VIR_DOMAIN_DEVICE_MEMORY:
+ case VIR_DOMAIN_DEVICE_IOMMU:
+ case VIR_DOMAIN_DEVICE_VSOCK:
+ case VIR_DOMAIN_DEVICE_LAST:
+ default:
+ return 0;
+ }
+
+ if (info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
+ (has_tmodel || has_ntmodel)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("virtio (non-)transitional models are not "
+ "supported for address type=3D%s"),
+ virDomainDeviceAddressTypeToString(info->type));
+ return -1;
+ }
+
+ if (has_tmodel) {
+ if (virQEMUCapsGet(qemuCaps, tmodel_cap))
+ virBufferAddLit(buf, "-transitional");
+
+ /* No error for if -transitional is not supported: our address
+ * allocation will force the device into plain PCI bus, which
+ * is functionally identical to standard 'virtio-XXX' behavior
+ */
+ } else if (has_ntmodel) {
+ if (virQEMUCapsGet(qemuCaps, ntmodel_cap)) {
+ virBufferAddLit(buf, "-non-transitional");
+ } else if (virQEMUCapsGet(qemuCaps,
+ QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY)) {
+ virBufferAddLit(buf, ",disable-legacy=3Don,disable-modern=3Dof=
f");
+ } else {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("virtio non-transitional model not supported "
+ "for this qemu"));
+ return -1;
+ }
+ }
+
return 0;
}
=20
+
static int
qemuBuildVirtioOptionsStr(virBufferPtr buf,
virDomainVirtioOptionsPtr virtio,
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index f2ae0804a8..808e551b9c 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -720,6 +720,9 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevic=
eDefPtr dev,
case VIR_DOMAIN_DEVICE_DISK:
switch ((virDomainDiskBus) dev->data.disk->bus) {
case VIR_DOMAIN_DISK_BUS_VIRTIO:
+ /* Transitional devices only work in conventional PCI slots */
+ if (dev->data.disk->model =3D=3D VIR_DOMAIN_DISK_MODEL_VIRTIO_=
TRANSITIONAL)
+ return pciFlags;
return virtioFlags; /* only virtio disks use PCI */
=20
case VIR_DOMAIN_DISK_BUS_IDE:
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.ar=
gs b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
index 9e11e900da..70446f16f2 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
@@ -27,8 +27,8 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=3D0x1 \
-device pcie-root-port,port=3D0x9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
--device virtio-blk-pci,scsi=3Doff,bus=3Dpci.1,addr=3D0x0,drive=3Ddrive-vir=
tio-disk0,\
-id=3Dvirtio-disk0,bootindex=3D1 \
+-device virtio-blk-pci,disable-legacy=3Don,disable-modern=3Doff,scsi=3Doff=
,bus=3Dpci.1,\
+addr=3D0x0,drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,bootindex=3D1 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.a=
rgs b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
index 070b4b8334..37078765bc 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -27,8 +27,8 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=3D0x1 \
-device pcie-root-port,port=3D0x9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
--device virtio-blk-pci,scsi=3Doff,bus=3Dpci.1,addr=3D0x0,drive=3Ddrive-vir=
tio-disk0,\
-id=3Dvirtio-disk0,bootindex=3D1 \
+-device virtio-blk-pci-non-transitional,scsi=3Doff,bus=3Dpci.1,addr=3D0x0,\
+drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,bootindex=3D1 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b=
/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
index 9e11e900da..356e8fdf4c 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -25,9 +25,10 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-boot strict=3Don \
-device pcie-root-port,port=3D0x8,chassis=3D1,id=3Dpci.1,bus=3Dpcie.0,mult=
ifunction=3Don,\
addr=3D0x1 \
--device pcie-root-port,port=3D0x9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
+-device pcie-pci-bridge,id=3Dpci.2,bus=3Dpci.1,addr=3D0x0 \
+-device pcie-root-port,port=3D0x9,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
--device virtio-blk-pci,scsi=3Doff,bus=3Dpci.1,addr=3D0x0,drive=3Ddrive-vir=
tio-disk0,\
+-device virtio-blk-pci,scsi=3Doff,bus=3Dpci.2,addr=3D0x1,drive=3Ddrive-vir=
tio-disk0,\
id=3Dvirtio-disk0,bootindex=3D1 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args =
b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index 070b4b8334..e78223eac8 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -25,10 +25,11 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-boot strict=3Don \
-device pcie-root-port,port=3D0x8,chassis=3D1,id=3Dpci.1,bus=3Dpcie.0,mult=
ifunction=3Don,\
addr=3D0x1 \
--device pcie-root-port,port=3D0x9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
+-device pcie-pci-bridge,id=3Dpci.2,bus=3Dpci.1,addr=3D0x0 \
+-device pcie-root-port,port=3D0x9,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
--device virtio-blk-pci,scsi=3Doff,bus=3Dpci.1,addr=3D0x0,drive=3Ddrive-vir=
tio-disk0,\
-id=3Dvirtio-disk0,bootindex=3D1 \
+-device virtio-blk-pci-transitional,scsi=3Doff,bus=3Dpci.2,addr=3D0x1,\
+drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,bootindex=3D1 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemux=
ml2xmloutdata/virtio-transitional.xml
index 1d28af9abb..c19e133bb3 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -18,7 +18,7 @@
-
+
@@ -30,9 +30,13 @@
-
+
+
+
+
+
-
+
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1548279244436588.5949623869922;
Wed, 23 Jan 2019 13:34:04 -0800 (PST)
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 A3E1B43A2B;
Wed, 23 Jan 2019 21:34:02 +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 6CC876BF6F;
Wed, 23 Jan 2019 21:34:02 +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 0BA283F604;
Wed, 23 Jan 2019 21:34:02 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLXcIW032385 for ;
Wed, 23 Jan 2019 16:33:38 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 2DB61BA78; Wed, 23 Jan 2019 21:33:38 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id B774367141;
Wed, 23 Jan 2019 21:33:28 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:41 -0500
Message-Id:
<272f56b10751db3c58d90813ec59ab34f6a661fa.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 13/25] qemu: Support interface
model=virtio-{non-}transitional
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: ,
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.30]);
Wed, 23 Jan 2019 21:34:03 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Add new model handling for virtio transitional devices. Ex:
* "virtio-transitional" maps to qemu "virtio-net-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-net-pci-non-transitional"
Signed-off-by: Cole Robinson
Reviewed-by: Andrea Bolognani
---
src/conf/domain_conf.c | 4 +++-
src/qemu/qemu_command.c | 8 +++++++-
src/qemu/qemu_domain_address.c | 9 +++++++--
.../virtio-non-transitional.x86_64-3.1.0.args | 6 +++++-
.../virtio-non-transitional.x86_64-latest.args | 6 +++++-
tests/qemuxml2argvdata/virtio-non-transitional.xml | 4 ++++
.../virtio-transitional.x86_64-3.1.0.args | 5 ++++-
.../virtio-transitional.x86_64-latest.args | 5 ++++-
tests/qemuxml2argvdata/virtio-transitional.xml | 4 ++++
tests/qemuxml2xmloutdata/virtio-non-transitional.xml | 12 +++++++++++-
tests/qemuxml2xmloutdata/virtio-transitional.xml | 7 ++++++-
11 files changed, 60 insertions(+), 10 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index eeb1191677..0a59a4e91f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -29852,7 +29852,9 @@ virDomainNetGetActualTrustGuestRxFilters(virDomainN=
etDefPtr iface)
bool
virDomainNetIsVirtioModel(const virDomainNetDef *net)
{
- return STREQ_NULLABLE(net->model, "virtio");
+ return (STREQ_NULLABLE(net->model, "virtio") ||
+ STREQ_NULLABLE(net->model, "virtio-transitional") ||
+ STREQ_NULLABLE(net->model, "virtio-non-transitional"));
}
=20
=20
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3cf0f5b13e..6ddfe2703c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -472,9 +472,15 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
ntmodel_cap =3D QEMU_CAPS_DEVICE_VIRTIO_BLK_PCI_NON_TRANSITION=
AL;
break;
=20
+ case VIR_DOMAIN_DEVICE_NET:
+ has_tmodel =3D STREQ_NULLABLE(device.data.net->model, "virtio-=
transitional");
+ has_ntmodel =3D STREQ_NULLABLE(device.data.net->model, "virtio=
-non-transitional");
+ tmodel_cap =3D QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_TRANSITIONAL;
+ ntmodel_cap =3D QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_NON_TRANSITION=
AL;
+ break;
+
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_FS:
- case VIR_DOMAIN_DEVICE_NET:
case VIR_DOMAIN_DEVICE_INPUT:
case VIR_DOMAIN_DEVICE_SOUND:
case VIR_DOMAIN_DEVICE_VIDEO:
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 808e551b9c..9f1a2dc9b8 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -692,8 +692,13 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevi=
ceDefPtr dev,
return 0;
}
=20
- if (STREQ_NULLABLE(net->model, "virtio"))
- return virtioFlags;
+ if (STREQ_NULLABLE(net->model, "virtio") ||
+ STREQ_NULLABLE(net->model, "virtio-non-transitional"))
+ return virtioFlags;
+
+ /* Transitional devices only work in conventional PCI slots */
+ if (STREQ_NULLABLE(net->model, "virtio-transitional"))
+ return pciFlags;
=20
if (STREQ_NULLABLE(net->model, "e1000e"))
return pcieFlags;
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.ar=
gs b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
index 70446f16f2..827b4070d4 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
@@ -26,9 +26,13 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-device pcie-root-port,port=3D0x8,chassis=3D1,id=3Dpci.1,bus=3Dpcie.0,mult=
ifunction=3Don,\
addr=3D0x1 \
-device pcie-root-port,port=3D0x9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
+-device pcie-root-port,port=3D0xa,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=
=3D0x1.0x2 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
--device virtio-blk-pci,disable-legacy=3Don,disable-modern=3Doff,scsi=3Doff=
,bus=3Dpci.1,\
+-device virtio-blk-pci,disable-legacy=3Don,disable-modern=3Doff,scsi=3Doff=
,bus=3Dpci.2,\
addr=3D0x0,drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,bootindex=3D1 \
+-netdev user,id=3Dhostnet0 \
+-device virtio-net-pci,disable-legacy=3Don,disable-modern=3Doff,netdev=3Dh=
ostnet0,\
+id=3Dnet0,mac=3D00:11:22:33:44:55,bus=3Dpci.1,addr=3D0x0 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.a=
rgs b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
index 37078765bc..9a0eb9a1f3 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -26,9 +26,13 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-device pcie-root-port,port=3D0x8,chassis=3D1,id=3Dpci.1,bus=3Dpcie.0,mult=
ifunction=3Don,\
addr=3D0x1 \
-device pcie-root-port,port=3D0x9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
+-device pcie-root-port,port=3D0xa,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=
=3D0x1.0x2 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
--device virtio-blk-pci-non-transitional,scsi=3Doff,bus=3Dpci.1,addr=3D0x0,\
+-device virtio-blk-pci-non-transitional,scsi=3Doff,bus=3Dpci.2,addr=3D0x0,\
drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,bootindex=3D1 \
+-netdev user,id=3Dhostnet0 \
+-device virtio-net-pci-non-transitional,netdev=3Dhostnet0,id=3Dnet0,\
+mac=3D00:11:22:33:44:55,bus=3Dpci.1,addr=3D0x0 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qem=
uxml2argvdata/virtio-non-transitional.xml
index 7899994622..a1b35d1c07 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml
@@ -12,6 +12,10 @@
+
+
+
+
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b=
/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
index 356e8fdf4c..9b80cd893a 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -28,8 +28,11 @@ addr=3D0x1 \
-device pcie-pci-bridge,id=3Dpci.2,bus=3Dpci.1,addr=3D0x0 \
-device pcie-root-port,port=3D0x9,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
--device virtio-blk-pci,scsi=3Doff,bus=3Dpci.2,addr=3D0x1,drive=3Ddrive-vir=
tio-disk0,\
+-device virtio-blk-pci,scsi=3Doff,bus=3Dpci.2,addr=3D0x2,drive=3Ddrive-vir=
tio-disk0,\
id=3Dvirtio-disk0,bootindex=3D1 \
+-netdev user,id=3Dhostnet0 \
+-device virtio-net-pci,netdev=3Dhostnet0,id=3Dnet0,mac=3D00:11:22:33:44:55=
,bus=3Dpci.2,\
+addr=3D0x1 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args =
b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index e78223eac8..46e139d492 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -28,8 +28,11 @@ addr=3D0x1 \
-device pcie-pci-bridge,id=3Dpci.2,bus=3Dpci.1,addr=3D0x0 \
-device pcie-root-port,port=3D0x9,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
--device virtio-blk-pci-transitional,scsi=3Doff,bus=3Dpci.2,addr=3D0x1,\
+-device virtio-blk-pci-transitional,scsi=3Doff,bus=3Dpci.2,addr=3D0x2,\
drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,bootindex=3D1 \
+-netdev user,id=3Dhostnet0 \
+-device virtio-net-pci-transitional,netdev=3Dhostnet0,id=3Dnet0,\
+mac=3D00:11:22:33:44:55,bus=3Dpci.2,addr=3D0x1 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml=
2argvdata/virtio-transitional.xml
index 678a7b9132..18f665577a 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-transitional.xml
@@ -12,6 +12,10 @@
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/q=
emuxml2xmloutdata/virtio-non-transitional.xml
index 7e4aa16b32..f0dc7c0833 100644
--- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
@@ -18,7 +18,7 @@
-
+
@@ -35,6 +35,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemux=
ml2xmloutdata/virtio-transitional.xml
index c19e133bb3..f9729391a5 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -18,7 +18,7 @@
-
+
@@ -39,6 +39,11 @@
+
+
+
+
+
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1548279251231768.8819842569603;
Wed, 23 Jan 2019 13:34:11 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 208D37BDC4;
Wed, 23 Jan 2019 21:34:08 +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 AEC8260C6E;
Wed, 23 Jan 2019 21:34:07 +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 1CAF43F60F;
Wed, 23 Jan 2019 21:34:07 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLXkTu032423 for ;
Wed, 23 Jan 2019 16:33:46 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 8514067141; Wed, 23 Jan 2019 21:33:46 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id B1527BA8B;
Wed, 23 Jan 2019 21:33:38 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:42 -0500
Message-Id:
<4cce1b7008b8dd44ae7eb05eecb48cebaa0f41ee.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Cc: Andrea Bolognani
Subject: [libvirt] [PATCH v2 14/25] conf: Add
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: ,
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.12
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]);
Wed, 23 Jan 2019 21:34:09 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
qemu vhost-scsi devices map to XML roughly like:
To support vhost-scsi-pci-{non-}traditional in qemu, we
need to to extend the SCSI Host hostdev XML to handle
model=3D value. This matches the XML model=3D format used
for mediated devices. This is just the domain_conf bits
and some XML test cases.
Use of virtio-X naming here does not match the hostdev
protocol=3Dvhost nor does it match the qemu vhost-X device
naming, however it's more consistent with all other
model=3D names in this area, and also matches the
inconsistency of devices which use model=3Dvirtio
but map to vhost-vsock on the qemu commandline
Reviewed-by: Andrea Bolognani
Signed-off-by: Cole Robinson
---
docs/formatdomain.html.in | 5 ++-
docs/schemas/domaincommon.rng | 9 +++++
src/conf/domain_conf.c | 38 ++++++++++++++++---
src/conf/domain_conf.h | 12 ++++++
src/libvirt_private.syms | 2 +
.../virtio-non-transitional.x86_64-3.1.0.args | 3 ++
...virtio-non-transitional.x86_64-latest.args | 3 ++
.../virtio-non-transitional.xml | 3 ++
.../virtio-transitional.x86_64-3.1.0.args | 3 ++
.../virtio-transitional.x86_64-latest.args | 3 ++
.../qemuxml2argvdata/virtio-transitional.xml | 3 ++
.../virtio-non-transitional.xml | 9 +++++
.../virtio-transitional.xml | 9 +++++
13 files changed, 96 insertions(+), 6 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0f66b5a1fc..c4a4639300 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4680,7 +4680,10 @@
since 2.5.0For SCSI devices, us=
er
is responsible to make sure the device is not used by host. Th=
is
type passes all LUNs presented by a single HBA to
- the guest.
+ the guest. Since 5.1.0, the
+ model attribute can be specified further
+ with "virtio-transitional", "virtio-non-transitional", or
+ "virtio" which matches the old behavior.
mdev
For mediated devices (Since 3.2.0)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 7af6e2532b..2b20a60edd 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4627,6 +4627,15 @@
scsi_host
+
+
+
+ virtio
+ virtio-transitional
+ virtio-non-transitional
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0a59a4e91f..8db54daeeb 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -714,6 +714,14 @@ VIR_ENUM_IMPL(virDomainHostdevSubsysSCSIHostProtocol,
"none",
"vhost")
=20
+VIR_ENUM_IMPL(virDomainHostdevSubsysSCSIVHostModel,
+ VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_LAST,
+ "default",
+ "virtio",
+ "virtio-transitional",
+ "virtio-non-transitional",
+);
+
VIR_ENUM_IMPL(virDomainHostdevCaps, VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST,
"storage",
"misc",
@@ -7692,6 +7700,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
int ret =3D -1;
virDomainHostdevSubsysPCIPtr pcisrc =3D &def->source.subsys.u.pci;
virDomainHostdevSubsysSCSIPtr scsisrc =3D &def->source.subsys.u.scsi;
+ virDomainHostdevSubsysSCSIVHostPtr scsihostsrc =3D &def->source.subsys=
.u.scsi_host;
virDomainHostdevSubsysMediatedDevPtr mdevsrc =3D &def->source.subsys.u=
.mdev;
=20
/* @managed can be read from the xml document - it is always an
@@ -7774,14 +7783,26 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
}
}
=20
- if (def->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV) {
+ if (def->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV &&
+ def->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_H=
OST) {
if (model) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("'model' attribute in is only suppo=
rted "
- "when type=3D'mdev'"));
+ virReportError(VIR_ERR_XML_ERROR,
+ _("'model' attribute in is not suppor=
ted "
+ "for type=3D'%s'"),
+ virDomainHostdevSubsysTypeToString(def->source.=
subsys.type));
goto cleanup;
}
- } else {
+ }
+
+ if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI=
_HOST) {
+ if (model &&
+ ((scsihostsrc->model =3D virDomainHostdevSubsysSCSIVHostModelT=
ypeFromString(model)) < 0)) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("unknown hostdev model '%s'"),
+ model);
+ goto cleanup;
+ }
+ } else if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TY=
PE_MDEV) {
if (!model) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("Missing 'model' attribute in mediated device=
's "
@@ -27210,6 +27231,7 @@ virDomainHostdevDefFormat(virBufferPtr buf,
const char *mode =3D virDomainHostdevModeTypeToString(def->mode);
virDomainHostdevSubsysSCSIPtr scsisrc =3D &def->source.subsys.u.scsi;
virDomainHostdevSubsysMediatedDevPtr mdevsrc =3D &def->source.subsys.u=
.mdev;
+ virDomainHostdevSubsysSCSIVHostPtr scsihostsrc =3D &def->source.subsys=
.u.scsi_host;
const char *type;
=20
if (!mode) {
@@ -27260,6 +27282,12 @@ virDomainHostdevDefFormat(virBufferPtr buf,
virTristateBoolTypeToString(scsisrc->rawio));
}
=20
+ if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_=
SCSI_HOST &&
+ scsihostsrc->model) {
+ virBufferAsprintf(buf, " model=3D'%s'",
+ virDomainHostdevSubsysSCSIVHostModelTypeToSt=
ring(scsihostsrc->model));
+ }
+
if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_=
MDEV) {
virBufferAsprintf(buf, " model=3D'%s'",
virMediatedDeviceModelTypeToString(mdevsrc->=
model));
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 644dde3dd3..4812339163 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -394,11 +394,23 @@ typedef enum {
=20
VIR_ENUM_DECL(virDomainHostdevSubsysSCSIHostProtocol)
=20
+typedef enum {
+ VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_DEFAULT,
+ VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO,
+ VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_TRANSITIONAL,
+ VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_NON_TRANSITIONA=
L,
+
+ VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_LAST,
+} virDomainHostdevSubsysSCSIVHostModelType;
+
+VIR_ENUM_DECL(virDomainHostdevSubsysSCSIVHostModel)
+
typedef struct _virDomainHostdevSubsysSCSIVHost virDomainHostdevSubsysSCSI=
VHost;
typedef virDomainHostdevSubsysSCSIVHost *virDomainHostdevSubsysSCSIVHostPt=
r;
struct _virDomainHostdevSubsysSCSIVHost {
int protocol; /* enum virDomainHostdevSubsysSCSIHostProtocolType */
char *wwpn;
+ int model; /* enum virDomainHostdevSubsysSCSIVHostModelType */
};
=20
typedef struct _virDomainHostdevSubsys virDomainHostdevSubsys;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 8d27d507cc..25038b4e92 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -408,6 +408,8 @@ virDomainHostdevInsert;
virDomainHostdevModeTypeToString;
virDomainHostdevRemove;
virDomainHostdevSubsysPCIBackendTypeToString;
+virDomainHostdevSubsysSCSIVHostModelTypeFromString;
+virDomainHostdevSubsysSCSIVHostModelTypeToString;
virDomainHostdevSubsysTypeToString;
virDomainHPTResizingTypeToString;
virDomainHubTypeFromString;
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.ar=
gs b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
index 827b4070d4..9c38d713b2 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
@@ -27,12 +27,15 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=3D0x1 \
-device pcie-root-port,port=3D0x9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
-device pcie-root-port,port=3D0xa,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=
=3D0x1.0x2 \
+-device pcie-root-port,port=3D0xb,chassis=3D4,id=3Dpci.4,bus=3Dpcie.0,addr=
=3D0x1.0x3 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
-device virtio-blk-pci,disable-legacy=3Don,disable-modern=3Doff,scsi=3Doff=
,bus=3Dpci.2,\
addr=3D0x0,drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,bootindex=3D1 \
-netdev user,id=3Dhostnet0 \
-device virtio-net-pci,disable-legacy=3Don,disable-modern=3Doff,netdev=3Dh=
ostnet0,\
id=3Dnet0,mac=3D00:11:22:33:44:55,bus=3Dpci.1,addr=3D0x0 \
+-device vhost-scsi-pci,wwpn=3Dnaa.5123456789abcde0,vhostfd=3D3,id=3Dhostde=
v0,\
+bus=3Dpci.3,addr=3D0x0 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.a=
rgs b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
index 9a0eb9a1f3..82255909c4 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -27,12 +27,15 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=3D0x1 \
-device pcie-root-port,port=3D0x9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
-device pcie-root-port,port=3D0xa,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=
=3D0x1.0x2 \
+-device pcie-root-port,port=3D0xb,chassis=3D4,id=3Dpci.4,bus=3Dpcie.0,addr=
=3D0x1.0x3 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
-device virtio-blk-pci-non-transitional,scsi=3Doff,bus=3Dpci.2,addr=3D0x0,\
drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,bootindex=3D1 \
-netdev user,id=3Dhostnet0 \
-device virtio-net-pci-non-transitional,netdev=3Dhostnet0,id=3Dnet0,\
mac=3D00:11:22:33:44:55,bus=3Dpci.1,addr=3D0x0 \
+-device vhost-scsi-pci,wwpn=3Dnaa.5123456789abcde0,vhostfd=3D3,id=3Dhostde=
v0,\
+bus=3Dpci.3,addr=3D0x0 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qem=
uxml2argvdata/virtio-non-transitional.xml
index a1b35d1c07..32d2bdc638 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml
@@ -16,6 +16,9 @@
+
+
+
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b=
/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
index 9b80cd893a..4e991d6187 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -27,12 +27,15 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=3D0x1 \
-device pcie-pci-bridge,id=3Dpci.2,bus=3Dpci.1,addr=3D0x0 \
-device pcie-root-port,port=3D0x9,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
+-device pcie-root-port,port=3D0xa,chassis=3D4,id=3Dpci.4,bus=3Dpcie.0,addr=
=3D0x1.0x2 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
-device virtio-blk-pci,scsi=3Doff,bus=3Dpci.2,addr=3D0x2,drive=3Ddrive-vir=
tio-disk0,\
id=3Dvirtio-disk0,bootindex=3D1 \
-netdev user,id=3Dhostnet0 \
-device virtio-net-pci,netdev=3Dhostnet0,id=3Dnet0,mac=3D00:11:22:33:44:55=
,bus=3Dpci.2,\
addr=3D0x1 \
+-device vhost-scsi-pci,wwpn=3Dnaa.5123456789abcde0,vhostfd=3D3,id=3Dhostde=
v0,\
+bus=3Dpci.3,addr=3D0x0 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args =
b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index 46e139d492..dab25ba2e8 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -27,12 +27,15 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=3D0x1 \
-device pcie-pci-bridge,id=3Dpci.2,bus=3Dpci.1,addr=3D0x0 \
-device pcie-root-port,port=3D0x9,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
+-device pcie-root-port,port=3D0xa,chassis=3D4,id=3Dpci.4,bus=3Dpcie.0,addr=
=3D0x1.0x2 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
-device virtio-blk-pci-transitional,scsi=3Doff,bus=3Dpci.2,addr=3D0x2,\
drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,bootindex=3D1 \
-netdev user,id=3Dhostnet0 \
-device virtio-net-pci-transitional,netdev=3Dhostnet0,id=3Dnet0,\
mac=3D00:11:22:33:44:55,bus=3Dpci.2,addr=3D0x1 \
+-device vhost-scsi-pci,wwpn=3Dnaa.5123456789abcde0,vhostfd=3D3,id=3Dhostde=
v0,\
+bus=3Dpci.3,addr=3D0x0 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml=
2argvdata/virtio-transitional.xml
index 18f665577a..eddc1ce9f5 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-transitional.xml
@@ -16,6 +16,9 @@
+
+
+
diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/q=
emuxml2xmloutdata/virtio-non-transitional.xml
index f0dc7c0833..2af5195dfd 100644
--- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
@@ -40,6 +40,11 @@
+
+
+
+
+
@@ -47,6 +52,10 @@
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemux=
ml2xmloutdata/virtio-transitional.xml
index f9729391a5..ce7b109845 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -39,6 +39,11 @@
+
+
+
+
+
@@ -46,6 +51,10 @@
+
+
+
+
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1548279236208565.5543595816359;
Wed, 23 Jan 2019 13:33:56 -0800 (PST)
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 4BEE8432D4;
Wed, 23 Jan 2019 21:33:54 +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 18C706BF7B;
Wed, 23 Jan 2019 21:33:54 +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 BFEDB18033AA;
Wed, 23 Jan 2019 21:33:53 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLXrGD032482 for ;
Wed, 23 Jan 2019 16:33:53 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 24D91BA8B; Wed, 23 Jan 2019 21:33:53 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id D07CCBA50;
Wed, 23 Jan 2019 21:33:46 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:43 -0500
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 15/25] qemu: Support hostdev
model=virtio-{non-}transitional
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: ,
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.30]);
Wed, 23 Jan 2019 21:33:54 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Add protocol=3Dvhost model handling for virtio transitional
devices. Ex:
* "virtio-transitional" maps to qemu "vhost-scsi-pci-transitional"
* "virtio-non-transitional" maps to qemu "vhost-scsi-pci-non-transitional"
Signed-off-by: Cole Robinson
---
src/qemu/qemu_command.c | 10 +++++++++-
src/qemu/qemu_domain_address.c | 9 ++++++---
.../virtio-non-transitional.x86_64-3.1.0.args | 4 ++--
.../virtio-non-transitional.x86_64-latest.args | 4 ++--
.../virtio-transitional.x86_64-3.1.0.args | 3 +--
.../virtio-transitional.x86_64-latest.args | 5 ++---
tests/qemuxml2xmloutdata/virtio-transitional.xml | 7 +------
7 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6ddfe2703c..eced41a98f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -479,12 +479,20 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
ntmodel_cap =3D QEMU_CAPS_DEVICE_VIRTIO_NET_PCI_NON_TRANSITION=
AL;
break;
=20
+ case VIR_DOMAIN_DEVICE_HOSTDEV:
+ if (device.data.hostdev->source.subsys.type !=3D VIR_DOMAIN_HO=
STDEV_SUBSYS_TYPE_SCSI_HOST)
+ return 0;
+ has_tmodel =3D device.data.hostdev->source.subsys.u.scsi_host.=
model =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_TRANSIT=
IONAL;
+ has_ntmodel =3D device.data.hostdev->source.subsys.u.scsi_host=
.model =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_NON_TR=
ANSITIONAL;
+ tmodel_cap =3D QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_TRANSITIONAL;
+ ntmodel_cap =3D QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_NON_TRANSITION=
AL;
+ break;
+
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_FS:
case VIR_DOMAIN_DEVICE_INPUT:
case VIR_DOMAIN_DEVICE_SOUND:
case VIR_DOMAIN_DEVICE_VIDEO:
- case VIR_DOMAIN_DEVICE_HOSTDEV:
case VIR_DOMAIN_DEVICE_WATCHDOG:
case VIR_DOMAIN_DEVICE_CONTROLLER:
case VIR_DOMAIN_DEVICE_GRAPHICS:
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 9f1a2dc9b8..993f33299f 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -785,11 +785,14 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDev=
iceDefPtr dev,
return pcieFlags;
=20
/* according to pbonzini, from the guest PoV vhost-scsi devices
- * are the same as virtio-scsi, so they should use virtioFlags
- * (same as virtio-scsi) to determine Express vs. legacy placement
+ * are the same as virtio-scsi, so they should follow virtio logic
*/
- if (hostdev->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_T=
YPE_SCSI_HOST)
+ if (hostdev->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_T=
YPE_SCSI_HOST) {
+ /* Transitional devices only work in conventional PCI slots */
+ if (hostdev->source.subsys.u.scsi_host.model =3D=3D VIR_DOMAIN=
_HOSTDEV_SUBSYS_SCSI_VHOST_MODEL_TYPE_VIRTIO_TRANSITIONAL)
+ return pciFlags;
return virtioFlags;
+ }
=20
if (!(pciDev =3D virPCIDeviceNew(hostAddr->domain,
hostAddr->bus,
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.ar=
gs b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
index 9c38d713b2..500c03bdc3 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
@@ -34,8 +34,8 @@ addr=3D0x0,drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,b=
ootindex=3D1 \
-netdev user,id=3Dhostnet0 \
-device virtio-net-pci,disable-legacy=3Don,disable-modern=3Doff,netdev=3Dh=
ostnet0,\
id=3Dnet0,mac=3D00:11:22:33:44:55,bus=3Dpci.1,addr=3D0x0 \
--device vhost-scsi-pci,wwpn=3Dnaa.5123456789abcde0,vhostfd=3D3,id=3Dhostde=
v0,\
-bus=3Dpci.3,addr=3D0x0 \
+-device vhost-scsi-pci,disable-legacy=3Don,disable-modern=3Doff,\
+wwpn=3Dnaa.5123456789abcde0,vhostfd=3D3,id=3Dhostdev0,bus=3Dpci.3,addr=3D0=
x0 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.a=
rgs b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
index 82255909c4..c8dbffda65 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -34,8 +34,8 @@ drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,bootindex=3D=
1 \
-netdev user,id=3Dhostnet0 \
-device virtio-net-pci-non-transitional,netdev=3Dhostnet0,id=3Dnet0,\
mac=3D00:11:22:33:44:55,bus=3Dpci.1,addr=3D0x0 \
--device vhost-scsi-pci,wwpn=3Dnaa.5123456789abcde0,vhostfd=3D3,id=3Dhostde=
v0,\
-bus=3Dpci.3,addr=3D0x0 \
+-device vhost-scsi-pci-non-transitional,wwpn=3Dnaa.5123456789abcde0,vhostf=
d=3D3,\
+id=3Dhostdev0,bus=3Dpci.3,addr=3D0x0 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b=
/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
index 4e991d6187..38a9e348b3 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -27,7 +27,6 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=3D0x1 \
-device pcie-pci-bridge,id=3Dpci.2,bus=3Dpci.1,addr=3D0x0 \
-device pcie-root-port,port=3D0x9,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
--device pcie-root-port,port=3D0xa,chassis=3D4,id=3Dpci.4,bus=3Dpcie.0,addr=
=3D0x1.0x2 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
-device virtio-blk-pci,scsi=3Doff,bus=3Dpci.2,addr=3D0x2,drive=3Ddrive-vir=
tio-disk0,\
id=3Dvirtio-disk0,bootindex=3D1 \
@@ -35,7 +34,7 @@ id=3Dvirtio-disk0,bootindex=3D1 \
-device virtio-net-pci,netdev=3Dhostnet0,id=3Dnet0,mac=3D00:11:22:33:44:55=
,bus=3Dpci.2,\
addr=3D0x1 \
-device vhost-scsi-pci,wwpn=3Dnaa.5123456789abcde0,vhostfd=3D3,id=3Dhostde=
v0,\
-bus=3Dpci.3,addr=3D0x0 \
+bus=3Dpci.2,addr=3D0x3 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args =
b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index dab25ba2e8..ab2c35514d 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -27,15 +27,14 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=3D0x1 \
-device pcie-pci-bridge,id=3Dpci.2,bus=3Dpci.1,addr=3D0x0 \
-device pcie-root-port,port=3D0x9,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
--device pcie-root-port,port=3D0xa,chassis=3D4,id=3Dpci.4,bus=3Dpcie.0,addr=
=3D0x1.0x2 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
-device virtio-blk-pci-transitional,scsi=3Doff,bus=3Dpci.2,addr=3D0x2,\
drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,bootindex=3D1 \
-netdev user,id=3Dhostnet0 \
-device virtio-net-pci-transitional,netdev=3Dhostnet0,id=3Dnet0,\
mac=3D00:11:22:33:44:55,bus=3Dpci.2,addr=3D0x1 \
--device vhost-scsi-pci,wwpn=3Dnaa.5123456789abcde0,vhostfd=3D3,id=3Dhostde=
v0,\
-bus=3Dpci.3,addr=3D0x0 \
+-device vhost-scsi-pci-transitional,wwpn=3Dnaa.5123456789abcde0,vhostfd=3D=
3,\
+id=3Dhostdev0,bus=3Dpci.2,addr=3D0x3 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemux=
ml2xmloutdata/virtio-transitional.xml
index ce7b109845..8c1baced0e 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -39,11 +39,6 @@
-
-
-
-
-
@@ -53,7 +48,7 @@
-
+
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1548279255438448.0578097630631;
Wed, 23 Jan 2019 13:34:15 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 8C7E41441B9;
Wed, 23 Jan 2019 21:34:13 +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 953C96C212;
Wed, 23 Jan 2019 21:34:12 +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 311EB18033CA;
Wed, 23 Jan 2019 21:34:12 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLY4Ug032571 for ;
Wed, 23 Jan 2019 16:34:04 -0500
Received: by smtp.corp.redhat.com (Postfix)
id A48B46715E; Wed, 23 Jan 2019 21:34:04 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id 2ECE4BA50;
Wed, 23 Jan 2019 21:33:53 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:44 -0500
Message-Id:
<6ec24ad917b9b9d8da1a64d4e4fbfd6d77bdb712.1548278585.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 16/25] qemu: Support rng
model=virtio-{non-}transitional
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: ,
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.14
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]);
Wed, 23 Jan 2019 21:34:14 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Add new model values for virtio transitional devices. Ex:
...
* "virtio-transitional" maps to qemu "virtio-rng-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-rng-pci-non-transitional"
Signed-off-by: Cole Robinson
---
docs/formatdomain.html.in | 2 ++
docs/schemas/domaincommon.rng | 6 +++++-
src/conf/domain_conf.c | 5 ++++-
src/conf/domain_conf.h | 2 ++
src/qemu/qemu_command.c | 8 +++++++-
src/qemu/qemu_domain.c | 8 ++++++++
src/qemu/qemu_domain_address.c | 4 ++++
.../virtio-non-transitional.x86_64-3.1.0.args | 4 ++++
.../virtio-non-transitional.x86_64-latest.args | 3 +++
tests/qemuxml2argvdata/virtio-non-transitional.xml | 3 +++
.../virtio-transitional.x86_64-3.1.0.args | 2 ++
.../virtio-transitional.x86_64-latest.args | 2 ++
tests/qemuxml2argvdata/virtio-transitional.xml | 3 +++
tests/qemuxml2xmloutdata/virtio-non-transitional.xml | 9 +++++++++
tests/qemuxml2xmloutdata/virtio-transitional.xml | 4 ++++
15 files changed, 62 insertions(+), 3 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index c4a4639300..bf64bf9feb 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7971,6 +7971,8 @@ qemu-kvm -net nic,model=3D? /dev/null
'virtio' - supported by qemu and virtio-rng kernel module
+
'virtio-transitional' Since 5.1.0
+
'virtio-non-transitional' Since 5.1.0<=
/span>
rate
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 2b20a60edd..58ae874dfd 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5452,7 +5452,11 @@
- virtio
+
+ virtio
+ virtio-transitional
+ virtio-non-transitional
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8db54daeeb..fa772da52f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -859,7 +859,10 @@ VIR_ENUM_IMPL(virDomainDiskTray, VIR_DOMAIN_DISK_TRAY_=
LAST,
=20
VIR_ENUM_IMPL(virDomainRNGModel,
VIR_DOMAIN_RNG_MODEL_LAST,
- "virtio");
+ "virtio",
+ "virtio-transitional",
+ "virtio-non-transitional",
+);
=20
VIR_ENUM_IMPL(virDomainRNGBackend,
VIR_DOMAIN_RNG_BACKEND_LAST,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 4812339163..d73fcd1221 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2127,6 +2127,8 @@ struct _virBlkioDevice {
=20
typedef enum {
VIR_DOMAIN_RNG_MODEL_VIRTIO,
+ VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL,
+ VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL,
=20
VIR_DOMAIN_RNG_MODEL_LAST
} virDomainRNGModel;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index eced41a98f..bf59ed72e1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -488,6 +488,13 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
ntmodel_cap =3D QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_NON_TRANSITION=
AL;
break;
=20
+ case VIR_DOMAIN_DEVICE_RNG:
+ has_tmodel =3D device.data.rng->model =3D=3D VIR_DOMAIN_RNG_MO=
DEL_VIRTIO_TRANSITIONAL;
+ has_ntmodel =3D device.data.rng->model =3D=3D VIR_DOMAIN_RNG_M=
ODEL_VIRTIO_NON_TRANSITIONAL;
+ tmodel_cap =3D QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_TRANSITIONAL;
+ ntmodel_cap =3D QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_NON_TRANSITION=
AL;
+ break;
+
case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_FS:
case VIR_DOMAIN_DEVICE_INPUT:
@@ -506,7 +513,6 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
case VIR_DOMAIN_DEVICE_SHMEM:
case VIR_DOMAIN_DEVICE_TPM:
case VIR_DOMAIN_DEVICE_PANIC:
- case VIR_DOMAIN_DEVICE_RNG:
case VIR_DOMAIN_DEVICE_MEMORY:
case VIR_DOMAIN_DEVICE_IOMMU:
case VIR_DOMAIN_DEVICE_VSOCK:
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 27cdb30ca2..52c73df9ea 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4550,6 +4550,14 @@ qemuDomainRNGDefValidate(const virDomainRNGDef *def,
model_supported =3D virQEMUCapsGet(qemuCaps,
QEMU_CAPS_DEVICE_VIRTIO_RNG);
break;
+ case VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL:
+ model_supported =3D (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIR=
TIO_RNG_PCI_TRANSITIONAL) ||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_D=
ISABLE_LEGACY));
+ break;
+ case VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL:
+ model_supported =3D (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIR=
TIO_RNG_PCI_NON_TRANSITIONAL) ||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_D=
ISABLE_LEGACY));
+ break;
case VIR_DOMAIN_RNG_MODEL_LAST:
break;
}
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 993f33299f..8880c946f6 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -862,7 +862,11 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevi=
ceDefPtr dev,
case VIR_DOMAIN_DEVICE_RNG:
switch ((virDomainRNGModel) dev->data.rng->model) {
case VIR_DOMAIN_RNG_MODEL_VIRTIO:
+ case VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL:
return virtioFlags;
+ case VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL:
+ /* Transitional devices only work in conventional PCI slots */
+ return pciFlags;
=20
case VIR_DOMAIN_RNG_MODEL_LAST:
return 0;
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.ar=
gs b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
index 500c03bdc3..10cc6236cb 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
@@ -28,6 +28,7 @@ addr=3D0x1 \
-device pcie-root-port,port=3D0x9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
-device pcie-root-port,port=3D0xa,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=
=3D0x1.0x2 \
-device pcie-root-port,port=3D0xb,chassis=3D4,id=3Dpci.4,bus=3Dpcie.0,addr=
=3D0x1.0x3 \
+-device pcie-root-port,port=3D0xc,chassis=3D5,id=3Dpci.5,bus=3Dpcie.0,addr=
=3D0x1.0x4 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
-device virtio-blk-pci,disable-legacy=3Don,disable-modern=3Doff,scsi=3Doff=
,bus=3Dpci.2,\
addr=3D0x0,drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,bootindex=3D1 \
@@ -36,6 +37,9 @@ addr=3D0x0,drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,b=
ootindex=3D1 \
id=3Dnet0,mac=3D00:11:22:33:44:55,bus=3Dpci.1,addr=3D0x0 \
-device vhost-scsi-pci,disable-legacy=3Don,disable-modern=3Doff,\
wwpn=3Dnaa.5123456789abcde0,vhostfd=3D3,id=3Dhostdev0,bus=3Dpci.3,addr=3D0=
x0 \
+-object rng-random,id=3Dobjrng0,filename=3D/dev/urandom \
+-device virtio-rng-pci,disable-legacy=3Don,disable-modern=3Doff,rng=3Dobjr=
ng0,\
+id=3Drng0,bus=3Dpci.4,addr=3D0x0 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.a=
rgs b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
index c8dbffda65..a0fc475c2f 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -28,6 +28,7 @@ addr=3D0x1 \
-device pcie-root-port,port=3D0x9,chassis=3D2,id=3Dpci.2,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
-device pcie-root-port,port=3D0xa,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=
=3D0x1.0x2 \
-device pcie-root-port,port=3D0xb,chassis=3D4,id=3Dpci.4,bus=3Dpcie.0,addr=
=3D0x1.0x3 \
+-device pcie-root-port,port=3D0xc,chassis=3D5,id=3Dpci.5,bus=3Dpcie.0,addr=
=3D0x1.0x4 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
-device virtio-blk-pci-non-transitional,scsi=3Doff,bus=3Dpci.2,addr=3D0x0,\
drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,bootindex=3D1 \
@@ -36,6 +37,8 @@ drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,bootindex=3D=
1 \
mac=3D00:11:22:33:44:55,bus=3Dpci.1,addr=3D0x0 \
-device vhost-scsi-pci-non-transitional,wwpn=3Dnaa.5123456789abcde0,vhostf=
d=3D3,\
id=3Dhostdev0,bus=3Dpci.3,addr=3D0x0 \
+-object rng-random,id=3Dobjrng0,filename=3D/dev/urandom \
+-device virtio-rng-pci-non-transitional,rng=3Dobjrng0,id=3Drng0,bus=3Dpci.=
4,addr=3D0x0 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qem=
uxml2argvdata/virtio-non-transitional.xml
index 32d2bdc638..2075ccbf57 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml
@@ -19,6 +19,9 @@
+
+ /dev/urandom
+
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b=
/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
index 38a9e348b3..dc830d21b1 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -35,6 +35,8 @@ id=3Dvirtio-disk0,bootindex=3D1 \
addr=3D0x1 \
-device vhost-scsi-pci,wwpn=3Dnaa.5123456789abcde0,vhostfd=3D3,id=3Dhostde=
v0,\
bus=3Dpci.2,addr=3D0x3 \
+-object rng-random,id=3Dobjrng0,filename=3D/dev/urandom \
+-device virtio-rng-pci,rng=3Dobjrng0,id=3Drng0,bus=3Dpci.2,addr=3D0x4 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args =
b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index ab2c35514d..64fb4153fd 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -35,6 +35,8 @@ drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,bootindex=3D=
1 \
mac=3D00:11:22:33:44:55,bus=3Dpci.2,addr=3D0x1 \
-device vhost-scsi-pci-transitional,wwpn=3Dnaa.5123456789abcde0,vhostfd=3D=
3,\
id=3Dhostdev0,bus=3Dpci.2,addr=3D0x3 \
+-object rng-random,id=3Dobjrng0,filename=3D/dev/urandom \
+-device virtio-rng-pci-transitional,rng=3Dobjrng0,id=3Drng0,bus=3Dpci.2,ad=
dr=3D0x4 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml=
2argvdata/virtio-transitional.xml
index eddc1ce9f5..82535c84d6 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-transitional.xml
@@ -19,6 +19,9 @@
+
+ /dev/urandom
+
diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/q=
emuxml2xmloutdata/virtio-non-transitional.xml
index 2af5195dfd..4a315050ab 100644
--- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
@@ -45,6 +45,11 @@
+
+
+
+
+
@@ -57,5 +62,9 @@
+
+ /dev/urandom
+
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemux=
ml2xmloutdata/virtio-transitional.xml
index 8c1baced0e..ae3789ad93 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -51,5 +51,9 @@
+
+ /dev/urandom
+
+
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1548279250959545.0352104175947;
Wed, 23 Jan 2019 13:34:10 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com
[10.5.11.11])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 30C48432A0;
Wed, 23 Jan 2019 21:34:09 +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 F086E600C6;
Wed, 23 Jan 2019 21:34:08 +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 99306180339D;
Wed, 23 Jan 2019 21:34:08 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLY7Tx032594 for ;
Wed, 23 Jan 2019 16:34:07 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 443A060C6E; Wed, 23 Jan 2019 21:34:07 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id 064E767144;
Wed, 23 Jan 2019 21:34:04 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:45 -0500
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 17/25] conf: Add
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: ,
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.11
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]);
Wed, 23 Jan 2019 21:34:09 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
devices lack the model=3D attribute which is used by
most other device types. To eventually support
virtio-9p-pci-{non-}traditional in qemu, let's add a standard
model=3D attribute. The accepted values are:
- virtio-9p
- virtio-9p-transitional
- virtio-9p-non-transitional
The divergence in naming from other *-transitional values is
because we expect to support virtio-fs in the future.
Signed-off-by: Cole Robinson
---
docs/formatdomain.html.in | 4 +++
docs/schemas/domaincommon.rng | 9 +++++
src/conf/domain_conf.c | 33 +++++++++++++++++--
src/conf/domain_conf.h | 11 +++++++
.../virtio-non-transitional.x86_64-3.1.0.args | 11 ++++---
...virtio-non-transitional.x86_64-latest.args | 11 ++++---
.../virtio-non-transitional.xml | 4 +++
.../virtio-transitional.x86_64-3.1.0.args | 15 +++++----
.../virtio-transitional.x86_64-latest.args | 15 +++++----
.../qemuxml2argvdata/virtio-transitional.xml | 4 +++
.../virtio-non-transitional.xml | 18 +++++++---
.../virtio-transitional.xml | 26 ++++++++++-----
12 files changed, 127 insertions(+), 34 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index bf64bf9feb..1f39601749 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3880,6 +3880,10 @@
=20
+ Since 5.1.0, the filesystem element
+ has an optional attribute model with supported values
+ "virtio-9p-transitional", "virtio-9p-non-transitional", or
+ "virtio-9p" which matches the default behavior of the QEMU driver.
=20
+
+
+
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b=
/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
index d2429d2d2c..06fe70bb11 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -27,6 +27,7 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=3D0x1 \
-device pcie-pci-bridge,id=3Dpci.2,bus=3Dpci.1,addr=3D0x0 \
-device pcie-root-port,port=3D0x9,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
+-device pcie-root-port,port=3D0xa,chassis=3D4,id=3Dpci.4,bus=3Dpcie.0,addr=
=3D0x1.0x2 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
-device virtio-blk-pci,scsi=3Doff,bus=3Dpci.2,addr=3D0x3,drive=3Ddrive-vir=
tio-disk0,\
id=3Dvirtio-disk0,bootindex=3D1 \
@@ -35,6 +36,8 @@ id=3Dvirtio-disk0,bootindex=3D1 \
-netdev user,id=3Dhostnet0 \
-device virtio-net-pci,netdev=3Dhostnet0,id=3Dnet0,mac=3D00:11:22:33:44:55=
,bus=3Dpci.2,\
addr=3D0x2 \
+-device virtio-input-host-pci,id=3Dinput0,evdev=3D/dev/input/event1234,bus=
=3Dpci.3,\
+addr=3D0x0 \
-device vhost-scsi-pci,wwpn=3Dnaa.5123456789abcde0,vhostfd=3D3,id=3Dhostde=
v0,\
bus=3Dpci.2,addr=3D0x4 \
-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.2,addr=3D0x5 \
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args =
b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index f3a4e0804e..24b49e6009 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -27,6 +27,7 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=3D0x1 \
-device pcie-pci-bridge,id=3Dpci.2,bus=3Dpci.1,addr=3D0x0 \
-device pcie-root-port,port=3D0x9,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
+-device pcie-root-port,port=3D0xa,chassis=3D4,id=3Dpci.4,bus=3Dpcie.0,addr=
=3D0x1.0x2 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
-device virtio-blk-pci-transitional,scsi=3Doff,bus=3Dpci.2,addr=3D0x3,\
drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,bootindex=3D1 \
@@ -36,6 +37,8 @@ bus=3Dpci.2,addr=3D0x1 \
-netdev user,id=3Dhostnet0 \
-device virtio-net-pci-transitional,netdev=3Dhostnet0,id=3Dnet0,\
mac=3D00:11:22:33:44:55,bus=3Dpci.2,addr=3D0x2 \
+-device virtio-input-host-pci,id=3Dinput0,evdev=3D/dev/input/event1234,bus=
=3Dpci.3,\
+addr=3D0x0 \
-device vhost-scsi-pci-transitional,wwpn=3Dnaa.5123456789abcde0,vhostfd=3D=
3,\
id=3Dhostdev0,bus=3Dpci.2,addr=3D0x4 \
-device virtio-balloon-pci-transitional,id=3Dballoon0,bus=3Dpci.2,addr=3D0=
x5 \
diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml=
2argvdata/virtio-transitional.xml
index dd33071eb9..5daea19ada 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-transitional.xml
@@ -26,6 +26,9 @@
+
+
+
diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/q=
emuxml2xmloutdata/virtio-non-transitional.xml
index 5ba39ea30f..32c57a27f1 100644
--- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
@@ -65,6 +65,11 @@
+
+
+
+
+
@@ -75,6 +80,10 @@
+
+
+
+
@@ -90,7 +99,7 @@
-
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemux=
ml2xmloutdata/virtio-transitional.xml
index 5cb6568cc8..b0da885c79 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -39,6 +39,11 @@
+
+
+
+
+
@@ -49,6 +54,10 @@
+
+
+
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index c5ad3ba4b6..be8ef921ee 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1273,13 +1273,15 @@ mymain(void)
QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
- QEMU_CAPS_DEVICE_VHOST_VSOCK);
+ QEMU_CAPS_DEVICE_VHOST_VSOCK,
+ QEMU_CAPS_VIRTIO_INPUT_HOST);
DO_TEST("virtio-non-transitional",
QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
- QEMU_CAPS_DEVICE_VHOST_VSOCK);
+ QEMU_CAPS_DEVICE_VHOST_VSOCK,
+ QEMU_CAPS_VIRTIO_INPUT_HOST);
=20
if (getenv("LIBVIRT_SKIP_CLEANUP") =3D=3D NULL)
virFileDeleteTree(fakerootdir);
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1548279260849668.5267478368459;
Wed, 23 Jan 2019 13:34:20 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 288587EBC5;
Wed, 23 Jan 2019 21:34:18 +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 DB4D86C1F1;
Wed, 23 Jan 2019 21:34:17 +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 716B918033A1;
Wed, 23 Jan 2019 21:34:17 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLYF5k032670 for ;
Wed, 23 Jan 2019 16:34:15 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 422B1BA9E; Wed, 23 Jan 2019 21:34:15 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id A236065F72;
Wed, 23 Jan 2019 21:34:13 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:50 -0500
Message-Id:
<3b52eb01e5c90f4c1ada71a5eefe63e5acd72c2e.1548278586.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 22/25] qemu: Support input
model=virtio-{non-}transitional
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: ,
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.14
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]);
Wed, 23 Jan 2019 21:34:18 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Add model handling for virtio transitional devices. Ex:
...
* "virtio-transitional" maps to qemu "virtio-input-host-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-input-host-non-transitiona=
l"
Signed-off-by: Cole Robinson
Reviewed-by: Andrea Bolognani
---
src/qemu/qemu_command.c | 10 +++++++++-
src/qemu/qemu_domain_address.c | 13 ++++++++++++-
.../virtio-non-transitional.x86_64-3.1.0.args | 4 ++--
.../virtio-non-transitional.x86_64-latest.args | 4 ++--
.../virtio-transitional.x86_64-3.1.0.args | 7 +++----
.../virtio-transitional.x86_64-latest.args | 7 +++----
tests/qemuxml2xmloutdata/virtio-transitional.xml | 9 ++-------
7 files changed, 33 insertions(+), 21 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 9d64c7d7b0..a5c11956ed 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -516,8 +516,16 @@ qemuBuildVirtioDevStr(virBufferPtr buf,
ntmodel_cap =3D QEMU_CAPS_DEVICE_VHOST_VSOCK_PCI_NON_TRANSITIO=
NAL;
break;
=20
- case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_INPUT:
+ if (device.data.input->type !=3D VIR_DOMAIN_INPUT_TYPE_PASSTHR=
OUGH)
+ return 0;
+ has_tmodel =3D device.data.input->model =3D=3D VIR_DOMAIN_INPU=
T_MODEL_VIRTIO_TRANSITIONAL;
+ has_ntmodel =3D device.data.input->model =3D=3D VIR_DOMAIN_INP=
UT_MODEL_VIRTIO_NON_TRANSITIONAL;
+ tmodel_cap =3D QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_TRANSITI=
ONAL;
+ ntmodel_cap =3D QEMU_CAPS_DEVICE_VIRTIO_INPUT_HOST_PCI_NON_TRA=
NSITIONAL;
+ break;
+
+ case VIR_DOMAIN_DEVICE_LEASE:
case VIR_DOMAIN_DEVICE_SOUND:
case VIR_DOMAIN_DEVICE_VIDEO:
case VIR_DOMAIN_DEVICE_WATCHDOG:
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 4767b7aadc..7878d827de 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -919,7 +919,18 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevi=
ceDefPtr dev,
case VIR_DOMAIN_DEVICE_INPUT:
switch ((virDomainInputBus) dev->data.input->bus) {
case VIR_DOMAIN_INPUT_BUS_VIRTIO:
- return virtioFlags;
+ switch ((virDomainInputModel) dev->data.input->model) {
+ case VIR_DOMAIN_INPUT_MODEL_VIRTIO_TRANSITIONAL:
+ /* Transitional devices only work in conventional PCI slot=
s */
+ return pciFlags;
+ case VIR_DOMAIN_INPUT_MODEL_VIRTIO:
+ case VIR_DOMAIN_INPUT_MODEL_VIRTIO_NON_TRANSITIONAL:
+ case VIR_DOMAIN_INPUT_MODEL_DEFAULT:
+ return virtioFlags;
+ case VIR_DOMAIN_INPUT_MODEL_LAST:
+ break;
+ }
+ return 0;
=20
case VIR_DOMAIN_INPUT_BUS_PS2:
case VIR_DOMAIN_INPUT_BUS_USB:
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.ar=
gs b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
index 9130572abe..0f5de86315 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
@@ -42,8 +42,8 @@ fsdev=3Dfsdev-fs0,mount_tag=3Dfs1,bus=3Dpci.1,addr=3D0x0 \
-netdev user,id=3Dhostnet0 \
-device virtio-net-pci,disable-legacy=3Don,disable-modern=3Doff,netdev=3Dh=
ostnet0,\
id=3Dnet0,mac=3D00:11:22:33:44:55,bus=3Dpci.2,addr=3D0x0 \
--device virtio-input-host-pci,id=3Dinput0,evdev=3D/dev/input/event1234,bus=
=3Dpci.7,\
-addr=3D0x0 \
+-device virtio-input-host-pci,disable-legacy=3Don,disable-modern=3Doff,id=
=3Dinput0,\
+evdev=3D/dev/input/event1234,bus=3Dpci.7,addr=3D0x0 \
-device vhost-scsi-pci,disable-legacy=3Don,disable-modern=3Doff,\
wwpn=3Dnaa.5123456789abcde0,vhostfd=3D3,id=3Dhostdev0,bus=3Dpci.4,addr=3D0=
x0 \
-device virtio-balloon-pci,disable-legacy=3Don,disable-modern=3Doff,id=3Db=
alloon0,\
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.a=
rgs b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
index 8e0709816b..383b29f629 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -42,8 +42,8 @@ bus=3Dpci.1,addr=3D0x0 \
-netdev user,id=3Dhostnet0 \
-device virtio-net-pci-non-transitional,netdev=3Dhostnet0,id=3Dnet0,\
mac=3D00:11:22:33:44:55,bus=3Dpci.2,addr=3D0x0 \
--device virtio-input-host-pci,id=3Dinput0,evdev=3D/dev/input/event1234,bus=
=3Dpci.7,\
-addr=3D0x0 \
+-device virtio-input-host-pci-non-transitional,id=3Dinput0,\
+evdev=3D/dev/input/event1234,bus=3Dpci.7,addr=3D0x0 \
-device vhost-scsi-pci-non-transitional,wwpn=3Dnaa.5123456789abcde0,vhostf=
d=3D3,\
id=3Dhostdev0,bus=3Dpci.4,addr=3D0x0 \
-device virtio-balloon-pci-non-transitional,id=3Dballoon0,bus=3Dpci.5,addr=
=3D0x0 \
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b=
/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
index 06fe70bb11..8046e5c102 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -27,7 +27,6 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=3D0x1 \
-device pcie-pci-bridge,id=3Dpci.2,bus=3Dpci.1,addr=3D0x0 \
-device pcie-root-port,port=3D0x9,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
--device pcie-root-port,port=3D0xa,chassis=3D4,id=3Dpci.4,bus=3Dpcie.0,addr=
=3D0x1.0x2 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
-device virtio-blk-pci,scsi=3Doff,bus=3Dpci.2,addr=3D0x3,drive=3Ddrive-vir=
tio-disk0,\
id=3Dvirtio-disk0,bootindex=3D1 \
@@ -36,8 +35,8 @@ id=3Dvirtio-disk0,bootindex=3D1 \
-netdev user,id=3Dhostnet0 \
-device virtio-net-pci,netdev=3Dhostnet0,id=3Dnet0,mac=3D00:11:22:33:44:55=
,bus=3Dpci.2,\
addr=3D0x2 \
--device virtio-input-host-pci,id=3Dinput0,evdev=3D/dev/input/event1234,bus=
=3Dpci.3,\
-addr=3D0x0 \
+-device virtio-input-host-pci,id=3Dinput0,evdev=3D/dev/input/event1234,bus=
=3Dpci.2,\
+addr=3D0x7 \
-device vhost-scsi-pci,wwpn=3Dnaa.5123456789abcde0,vhostfd=3D3,id=3Dhostde=
v0,\
bus=3Dpci.2,addr=3D0x4 \
-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.2,addr=3D0x5 \
@@ -45,5 +44,5 @@ bus=3Dpci.2,addr=3D0x4 \
-device virtio-rng-pci,rng=3Dobjrng0,id=3Drng0,bus=3Dpci.2,addr=3D0x6 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
--device vhost-vsock-pci,id=3Dvsock0,guest-cid=3D4,vhostfd=3D6789,bus=3Dpci=
.2,addr=3D0x7 \
+-device vhost-vsock-pci,id=3Dvsock0,guest-cid=3D4,vhostfd=3D6789,bus=3Dpci=
.2,addr=3D0x8 \
-msg timestamp=3Don
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args =
b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index 24b49e6009..410eb28f0a 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -27,7 +27,6 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
addr=3D0x1 \
-device pcie-pci-bridge,id=3Dpci.2,bus=3Dpci.1,addr=3D0x0 \
-device pcie-root-port,port=3D0x9,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=
=3D0x1.0x1 \
--device pcie-root-port,port=3D0xa,chassis=3D4,id=3Dpci.4,bus=3Dpcie.0,addr=
=3D0x1.0x2 \
-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir=
tio-disk0 \
-device virtio-blk-pci-transitional,scsi=3Doff,bus=3Dpci.2,addr=3D0x3,\
drive=3Ddrive-virtio-disk0,id=3Dvirtio-disk0,bootindex=3D1 \
@@ -37,8 +36,8 @@ bus=3Dpci.2,addr=3D0x1 \
-netdev user,id=3Dhostnet0 \
-device virtio-net-pci-transitional,netdev=3Dhostnet0,id=3Dnet0,\
mac=3D00:11:22:33:44:55,bus=3Dpci.2,addr=3D0x2 \
--device virtio-input-host-pci,id=3Dinput0,evdev=3D/dev/input/event1234,bus=
=3Dpci.3,\
-addr=3D0x0 \
+-device virtio-input-host-pci-transitional,id=3Dinput0,\
+evdev=3D/dev/input/event1234,bus=3Dpci.2,addr=3D0x7 \
-device vhost-scsi-pci-transitional,wwpn=3Dnaa.5123456789abcde0,vhostfd=3D=
3,\
id=3Dhostdev0,bus=3Dpci.2,addr=3D0x4 \
-device virtio-balloon-pci-transitional,id=3Dballoon0,bus=3Dpci.2,addr=3D0=
x5 \
@@ -47,5 +46,5 @@ id=3Dhostdev0,bus=3Dpci.2,addr=3D0x4 \
-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\
resourcecontrol=3Ddeny \
-device vhost-vsock-pci-transitional,id=3Dvsock0,guest-cid=3D4,vhostfd=3D6=
789,\
-bus=3Dpci.2,addr=3D0x7 \
+bus=3Dpci.2,addr=3D0x8 \
-msg timestamp=3Don
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemux=
ml2xmloutdata/virtio-transitional.xml
index b0da885c79..c944f0d9f8 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -39,11 +39,6 @@
-
-
-
-
-
@@ -56,7 +51,7 @@
-
+
@@ -73,7 +68,7 @@
-
+
--=20
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sat Feb 7 09:55:26 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.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1548279260045197.27259733910364;
Wed, 23 Jan 2019 13:34:20 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 3A958145206;
Wed, 23 Jan 2019 21:34:18 +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 EE1666C20A;
Wed, 23 Jan 2019 21:34:17 +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 892D8180339F;
Wed, 23 Jan 2019 21:34:17 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x0NLYG5t032694 for ;
Wed, 23 Jan 2019 16:34:16 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 7C42ABA9E; Wed, 23 Jan 2019 21:34:16 +0000 (UTC)
Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com
[10.10.120.34])
by smtp.corp.redhat.com (Postfix) with ESMTP id 851EEBAA5;
Wed, 23 Jan 2019 21:34:15 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Wed, 23 Jan 2019 16:32:51 -0500
Message-Id:
<19ade9466bcfe2b5e3da94c22aa564d7f9c6711c.1548278586.git.crobinso@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v2 23/25] qemu: Support virtio-serial controller
model=virtio-{non-}transitional
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: ,
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.14
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]);
Wed, 23 Jan 2019 21:34:18 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Add controller type=3D'virtio-serial' model handling for virtio
transitional devices. Ex:
* "virtio-transitional" maps to qemu "virtio-serial-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-serial-pci-non-transitiona=
l"
Signed-off-by: Cole Robinson
---
docs/formatdomain.html.in | 4 +++-
docs/schemas/domaincommon.rng | 9 ++++++++
src/conf/domain_conf.c | 11 ++++++++++
src/conf/domain_conf.h | 10 +++++++++
src/qemu/qemu_command.c | 12 +++++++++-
src/qemu/qemu_domain_address.c | 15 ++++++++++++-
.../virtio-non-transitional.x86_64-3.1.0.args | 18 +++++++++------
...virtio-non-transitional.x86_64-latest.args | 18 +++++++++------
.../virtio-non-transitional.xml | 1 +
.../virtio-transitional.x86_64-3.1.0.args | 13 ++++++-----
.../virtio-transitional.x86_64-latest.args | 13 ++++++-----
.../qemuxml2argvdata/virtio-transitional.xml | 1 +
.../virtio-non-transitional.xml | 22 +++++++++++++------
.../virtio-transitional.xml | 15 ++++++++-----
14 files changed, 120 insertions(+), 42 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 6838774c74..b820adbc8a 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4135,7 +4135,9 @@
The virtio-serial controller has two additional
optional attributes ports and vectors,
which control how many devices can be connected through the
- controller.
+ controller. Since 5.1.0, it
+ supports an optional attribute model which can
+ be 'virtio', 'virtio-transitional', or 'virtio-non-transitional'=
dd>
A scsi controller has an optional attribute
model, which is one of 'auto', 'buslogic', 'ibmvscsi',
- 'lsilogic', 'lsisas1068', 'lsisas1078', 'virtio-scsi' or
- 'vmpvscsi'.