@@ -7966,6 +7966,8 @@ qemu-kvm -net nic,model=? /dev/null
</p>
<ul>
<li>'virtio' - supported by qemu and virtio-rng kernel module</li>
+ <li>'virtio-transitional' <span class='since'>Since 5.1.0</span></li>
+ <li>'virtio-non-transitional' <span class='since'>Since 5.1.0</span></li>
</ul>
</dd>
<dt><code>rate</code></dt>
@@ -5442,7 +5442,11 @@
<define name="rng">
<element name="rng">
<attribute name="model">
- <value>virtio</value>
+ <choice>
+ <value>virtio</value>
+ <value>virtio-transitional</value>
+ <value>virtio-non-transitional</value>
+ </choice>
</attribute>
<interleave>
<ref name="rng-backend"/>
@@ -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,
@@ -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;
@@ -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[] = {
@@ -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;
@@ -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",
@@ -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)
@@ -214,6 +214,8 @@
<flag name='nvdimm.unarmed'/>
<flag name='virtio-blk-pci-transitional'/>
<flag name='virtio-blk-pci-non-transitional'/>
+ <flag name='virtio-rng-pci-transitional'/>
+ <flag name='virtio-rng-pci-non-transitional'/>
<version>3001050</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>446361</microcodeVersion>
@@ -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
@@ -19,6 +19,9 @@
<target dev='vda' bus='virtio'/>
</disk>
<controller type='usb' index='0' model='none'/>
+ <rng model='virtio-non-transitional'>
+ <backend model='random'>/dev/urandom</backend>
+ </rng>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<memballoon model='none'/>
@@ -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
@@ -19,6 +19,9 @@
<target dev='vda' bus='virtio'/>
</disk>
<controller type='usb' index='0' model='none'/>
+ <rng model='virtio-transitional'>
+ <backend model='random'>/dev/urandom</backend>
+ </rng>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<memballoon model='none'/>
@@ -42,5 +42,9 @@
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<memballoon model='none'/>
+ <rng model='virtio-non-transitional'>
+ <backend model='random'>/dev/urandom</backend>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
+ </rng>
</devices>
</domain>
@@ -35,8 +35,17 @@
<target chassis='2' port='0x9'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
+ <controller type='pci' index='3' model='pcie-root-port'>
+ <model name='pcie-root-port'/>
+ <target chassis='3' port='0xa'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<memballoon model='none'/>
+ <rng model='virtio-transitional'>
+ <backend model='random'>/dev/urandom</backend>
+ <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
+ </rng>
</devices>
</domain>
Add new <rng> 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 <crobinso@redhat.com> --- 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