From patchwork Sun Jan 13 23:12:08 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 155383
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3040443jaa;
Sun, 13 Jan 2019 15:13:20 -0800 (PST)
X-Google-Smtp-Source: ALg8bN4nNSNCZFJMU2qDNcZfbph3h7OC3EV1+/k5r1+n/oLHM1T/PKFyDA01cac3wYMpATqOe2SW
X-Received: by 2002:aed:39e8:: with SMTP id
m95mr21637787qte.317.1547421200250;
Sun, 13 Jan 2019 15:13:20 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1547421200; cv=none;
d=google.com; s=arc-20160816;
b=oen2Ym8/3DG8YJ1qh7aXmg0KNQNvNABWby1kajaWVuVpgwgfC0PkXwxhc/aoXEIxYO
jSEb+NsMe8X1+APHwXruD9sXJgDUuER/mm9rHrGp2dnBdW7Cm8LxCC7z5GW/lLqduEZK
VC7blABECdOAZyn8EvHhNri0VKOixOTZxAc5llNtHr+XbvQzZex6JZcM8XWWlsXAefmV
ycV5PNcBPT7lIOqMGH4GS0qsynyiCRB5qISXt1Utw/2KX39y/VtfBqDUHnRbMBUfYY5R
kk/43E9U32MJEBlN1YGGwdkkGZKcaFU5RIWk5iPjCgkH8Ax6k2sDvyH+6VrpPB4b5iMP
izjg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help
:list-post:list-archive:list-unsubscribe:list-id:precedence:subject
:mime-version:references:in-reply-to:message-id:date:to:from
:delivered-to;
bh=bm/pB7aHZH2Uym8/dteXnN9vVSPxKl8/LKe2FvZZmHU=;
b=MxawFQGEtSv7ivcsrr1bVCOD+AQtW0qi0dFzwITuNRRdFvDLtXdGSCsHvNhtV8bru+
FfTVM+HdsZHns8TJyNTu5RiOEa1sB21pR/wP1/oy9i00feJzta/1VYwz6n5s9+HDl9fe
QEH88TK5cv95RBn5z3CuBoB/Ive120xXeyJLbK8PHU4yc0UvBkBPYrjlRd9ft/3gf2ev
cA1p4GvaL74YX/M4OWYj6KmIePOtUHT6fM661zfUg3ep+FtA/vL3QHCecub2mIZWkpsy
6V+qjrS4kcr4Je9hSdCqYXXRl8BSJzklOf6uyOTjh2C0K60HwSi2iXNphqo7MFaGCLPM
wIOw==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28])
by mx.google.com with ESMTPS id
g13si855867qkg.240.2019.01.13.15.13.20
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Sun, 13 Jan 2019 15:13:20 -0800 (PST)
Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
client-ip=209.132.183.28;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of libvir-list-bounces@redhat.com
designates 209.132.183.28 as permitted sender)
smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com
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 95CF480F7B;
Sun, 13 Jan 2019 23:13:18 +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 5A1DC83777;
Sun, 13 Jan 2019 23:13:18 +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 E89173F7D5;
Sun, 13 Jan 2019 23:13:17 +0000 (UTC)
Received: from smtp.corp.redhat.com
(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with
ESMTP
id x0DNDDU6028645 for ;
Sun, 13 Jan 2019 18:13:13 -0500
Received: by smtp.corp.redhat.com (Postfix)
id 4DA4D17A9F; Sun, 13 Jan 2019 23:13:13 +0000 (UTC)
Delivered-To: libvirt-list@redhat.com
Received: from worklaptop.redhat.com (ovpn-120-202.rdu2.redhat.com
[10.10.120.202])
by smtp.corp.redhat.com (Postfix) with ESMTP id 8B7AF17A6A;
Sun, 13 Jan 2019 23:13:12 +0000 (UTC)
From: Cole Robinson
To: libvirt-list@redhat.com
Date: Sun, 13 Jan 2019 18:12:08 -0500
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH 6/6] 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: ,
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.27]);
Sun, 13 Jan 2019 23:13:19 +0000 (UTC)
Add new model values for virtio transitional devices
* "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 | 4 +++-
src/conf/domain_conf.h | 2 ++
src/qemu/qemu_capabilities.c | 6 ++++++
src/qemu/qemu_capabilities.h | 4 ++++
src/qemu/qemu_command.c | 12 +++++++++---
src/qemu/qemu_domain_address.c | 6 ++++--
tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml | 2 ++
.../virtio-non-transitional.x86_64-latest.args | 2 ++
tests/qemuxml2argvdata/virtio-non-transitional.xml | 3 +++
.../virtio-transitional.x86_64-latest.args | 3 +++
tests/qemuxml2argvdata/virtio-transitional.xml | 3 +++
tests/qemuxml2xmloutdata/virtio-non-transitional.xml | 4 ++++
tests/qemuxml2xmloutdata/virtio-transitional.xml | 9 +++++++++
15 files changed, 61 insertions(+), 7 deletions(-)
--
2.20.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 5220e19417..5765f31048 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7966,6 +7966,8 @@ qemu-kvm -net nic,model=? /dev/null
- 'virtio' - supported by qemu and virtio-rng kernel module
+ - 'virtio-transitional' Since 5.1.0
+ - 'virtio-non-transitional' Since 5.1.0
rate
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 425d7f851a..d247170aeb 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5442,7 +5442,11 @@
- virtio
+
+ virtio
+ virtio-transitional
+ virtio-non-transitional
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f847fb0487..ec3cb226c1 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -851,7 +851,9 @@ VIR_ENUM_IMPL(virDomainDiskTray, VIR_DOMAIN_DISK_TRAY_LAST,
VIR_ENUM_IMPL(virDomainRNGModel,
VIR_DOMAIN_RNG_MODEL_LAST,
- "virtio");
+ "virtio",
+ "virtio-transitional",
+ "virtio-non-transitional");
VIR_ENUM_IMPL(virDomainRNGBackend,
VIR_DOMAIN_RNG_BACKEND_LAST,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 0c1879da0f..0b8b49ec30 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2112,6 +2112,8 @@ struct _virBlkioDevice {
typedef enum {
VIR_DOMAIN_RNG_MODEL_VIRTIO,
+ VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL,
+ VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL,
VIR_DOMAIN_RNG_MODEL_LAST
} virDomainRNGModel;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 24031579cd..84e8bc7863 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -522,6 +522,10 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"nvdimm.unarmed",
"virtio-blk-pci-transitional",
"virtio-blk-pci-non-transitional",
+ "virtio-rng-pci-transitional",
+
+ /* 330 */
+ "virtio-rng-pci-non-transitional",
);
@@ -1112,6 +1116,8 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{ "memory-backend-memfd", QEMU_CAPS_OBJECT_MEMORY_MEMFD },
{"virtio-blk-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_BLK_TRANSITIONAL},
{"virtio-blk-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_BLK_NON_TRANSITIONAL},
+ {"virtio-rng-pci-transitional", QEMU_CAPS_DEVICE_VIRTIO_RNG_TRANSITIONAL},
+ {"virtio-rng-pci-non-transitional", QEMU_CAPS_DEVICE_VIRTIO_RNG_NON_TRANSITIONAL},
};
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 34265d7cc0..86be890beb 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -506,6 +506,10 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
QEMU_CAPS_DEVICE_NVDIMM_UNARMED, /* -device nvdimm,unarmed= */
QEMU_CAPS_DEVICE_VIRTIO_BLK_TRANSITIONAL, /* -device virtio-blk-pci-transitional */
QEMU_CAPS_DEVICE_VIRTIO_BLK_NON_TRANSITIONAL, /* -device virtio-blk-pci-non-transitional */
+ QEMU_CAPS_DEVICE_VIRTIO_RNG_TRANSITIONAL, /* -device virtio-blk-rng-transitional */
+
+ /* 330 */
+ QEMU_CAPS_DEVICE_VIRTIO_RNG_NON_TRANSITIONAL, /* -device virtio-rng-pci-non-transitional */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ca6abea227..3f6f63f33d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5916,8 +5916,12 @@ qemuBuildRNGDevStr(const virDomainDef *def,
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
- if (dev->model != VIR_DOMAIN_RNG_MODEL_VIRTIO ||
- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG)) {
+ if (!((dev->model == VIR_DOMAIN_RNG_MODEL_VIRTIO &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG)) ||
+ (dev->model == VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG_TRANSITIONAL)) ||
+ (dev->model == VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL &&
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG_NON_TRANSITIONAL)))) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("this qemu doesn't support RNG device type '%s'"),
virDomainRNGModelTypeToString(dev->model));
@@ -5928,7 +5932,9 @@ qemuBuildRNGDevStr(const virDomainDef *def,
dev->source.file))
goto error;
- if (qemuBuildVirtioDevStr(&buf, "virtio-rng", dev->info.type) < 0)
+ if (qemuBuildVirtioTransitional(&buf, "virtio-rng", dev->info.type,
+ dev->model == VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL,
+ dev->model == VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL) < 0)
goto error;
virBufferAsprintf(&buf, ",rng=obj%s,id=%s",
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 1a77b74ad1..cbf7a0556b 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -856,7 +856,10 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
case VIR_DOMAIN_DEVICE_RNG:
switch ((virDomainRNGModel) dev->data.rng->model) {
case VIR_DOMAIN_RNG_MODEL_VIRTIO:
+ case VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL:
return virtioFlags;
+ case VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL:
+ return pciFlags;
case VIR_DOMAIN_RNG_MODEL_LAST:
return 0;
@@ -2285,8 +2288,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
/* VirtIO RNG */
for (i = 0; i < def->nrngs; i++) {
- if (def->rngs[i]->model != VIR_DOMAIN_RNG_MODEL_VIRTIO ||
- !virDeviceInfoPCIAddressIsWanted(&def->rngs[i]->info))
+ if (!virDeviceInfoPCIAddressIsWanted(&def->rngs[i]->info))
continue;
if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->rngs[i]->info) < 0)
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
index 8cf9083035..35cb40c24c 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
@@ -214,6 +214,8 @@
+
+
3001050
0
446361
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
index a8f878c99c..805b564ee2 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -30,6 +30,8 @@ addr=0x1 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.2,addr=0x1,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
+-object rng-random,id=objrng0,filename=/dev/urandom \
+-device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x2 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml
index 2b9b82f473..1d131a6255 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-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index 7730b177e7..803b4042ca 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -26,9 +26,12 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-device pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
addr=0x1 \
-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
+-device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci-transitional,scsi=off,bus=pci.1,addr=0x0,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
+-object rng-random,id=objrng0,filename=/dev/urandom \
+-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x0 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml
index c6b3fca760..aca4f9f8fa 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/qemuxml2xmloutdata/virtio-non-transitional.xml
index a64a84d145..47ed1a65a6 100644
--- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
@@ -42,5 +42,9 @@
+
+ /dev/urandom
+
+
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml
index 87d8ff4a25..4f84f09ccc 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -35,8 +35,17 @@
+
+
+
+
+
+
+ /dev/urandom
+
+