From patchwork Wed Jan 23 21:32:44 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Cole Robinson
X-Patchwork-Id: 156414
Delivered-To: patch@linaro.org
Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1202151jaa;
Wed, 23 Jan 2019 13:34:15 -0800 (PST)
X-Google-Smtp-Source: ALg8bN5sL2QCcTwpsDyc0h8hOVMH3587kID7tEGvahrdnH3PayMt2uis2xwYrG89o7wzguQa2ui7
X-Received: by 2002:a0c:a3e2:: with SMTP id v89mr3539637qvv.226.1548279255136;
Wed, 23 Jan 2019 13:34:15 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1548279255; cv=none;
d=google.com; s=arc-20160816;
b=JLf+vP6g2Gpce3Pkk3fSPi6IJmjP1OrULBZ5IBi26UPqj19IexN59sgixoQC6hOdKH
GOhXqpRyLufntX63C4fbm3q98xqP0UXO1UcUNRpAI7ZupxiS5//p3gWZAaeucICW+ucB
VNLlT5v8QodlvG0Kkl+ReFoEkEE1k9gQPRkZlqUmG1BXMP4VTofNebFAJQC2PPfH6tiK
qQU+ntG+8KKC/PBNeFeUZl8OFsnnQzpYpa4bHXkvQtvW90JPOcC8Q20OFlJnEui3VDUZ
chrqXI+RhUXZkjWl6vkyTIV1PXV76ZkLLKmxvu9kGTUqS1NMdnrO8yVGOLd6G0+oUH4r
ncEw==
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=fR7W38rq5uenq7GOGJ2Nz4RL8ats5rGDZU1f9ZcvjJs=;
b=pLEWFOPGlBi2uclvdLN14X5e+bpFKsb5Y6IrXLFUDFEcPsk+BEOqgNQEA9NmWnZGFD
oVxOa/f8Ye+bBf8G2lOOXitHZT3L+PAl/mctpmJuXZdK3D+WVgJb2CB8tOE/Rp0zUZTz
yGqnAY38jtvveWqYmGOKfupqcZfLXstHKGVBGyBE0wB1nb24LNSUIRFyR8Mw1ePaZMoS
/yNrsdrqkoTZ7df+mwFqQq4D94e1fvA/sXyP2YRe0IWP/Ef8nCL0nDdhNiTyzIbvk9so
eSf4L5E7SfDGepjvH87E/C2n/BR3vmIv969moxv3vkQcnoT06YB0dcOi9TFveDkvFs5N
I19g==
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
y36si3159358qtd.218.2019.01.23.13.34.14
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 23 Jan 2019 13:34:15 -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-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)
Delivered-To: libvirt-list@redhat.com
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: ,
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)
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(-)
--
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 c4a4639300..bf64bf9feb 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7971,6 +7971,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 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,
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 4812339163..d73fcd1221 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2127,6 +2127,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_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 = QEMU_CAPS_DEVICE_VHOST_SCSI_PCI_NON_TRANSITIONAL;
break;
+ case VIR_DOMAIN_DEVICE_RNG:
+ has_tmodel = device.data.rng->model == VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL;
+ has_ntmodel = device.data.rng->model == VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL;
+ tmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_TRANSITIONAL;
+ ntmodel_cap = QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_NON_TRANSITIONAL;
+ 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 = virQEMUCapsGet(qemuCaps,
QEMU_CAPS_DEVICE_VIRTIO_RNG);
break;
+ case VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL:
+ model_supported = (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_TRANSITIONAL) ||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY));
+ break;
+ case VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL:
+ model_supported = (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG_PCI_NON_TRANSITIONAL) ||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_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(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_NON_TRANSITIONAL:
return virtioFlags;
+ case VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL:
+ /* Transitional devices only work in conventional PCI slots */
+ return pciFlags;
case VIR_DOMAIN_RNG_MODEL_LAST:
return 0;
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args 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=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 \
-device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \
+-device pcie-root-port,port=0xc,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4 \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.2,\
addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
@@ -36,6 +37,9 @@ addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
id=net0,mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \
-device vhost-scsi-pci,disable-legacy=on,disable-modern=off,\
wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.3,addr=0x0 \
+-object rng-random,id=objrng0,filename=/dev/urandom \
+-device virtio-rng-pci,disable-legacy=on,disable-modern=off,rng=objrng0,\
+id=rng0,bus=pci.4,addr=0x0 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args 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=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 \
-device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \
+-device pcie-root-port,port=0xc,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4 \
-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=0x0,\
drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
@@ -36,6 +37,8 @@ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
mac=00:11:22:33:44:55,bus=pci.1,addr=0x0 \
-device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
id=hostdev0,bus=pci.3,addr=0x0 \
+-object rng-random,id=objrng0,filename=/dev/urandom \
+-device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.4,addr=0x0 \
-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 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=virtio-disk0,bootindex=1 \
addr=0x1 \
-device vhost-scsi-pci,wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,\
bus=pci.2,addr=0x3 \
+-object rng-random,id=objrng0,filename=/dev/urandom \
+-device virtio-rng-pci,rng=objrng0,id=rng0,bus=pci.2,addr=0x4 \
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
resourcecontrol=deny \
-msg timestamp=on
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=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
mac=00:11:22:33:44:55,bus=pci.2,addr=0x1 \
-device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
id=hostdev0,bus=pci.2,addr=0x3 \
+-object rng-random,id=objrng0,filename=/dev/urandom \
+-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x4 \
-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 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/qemuxml2xmloutdata/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/qemuxml2xmloutdata/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
+
+