The model logic is taken from qemuDomainRNGDefValidate Signed-off-by: Cole Robinson <crobinso@redhat.com> --- src/qemu/qemu_capabilities.c | 30 +++++++++++++++++++ .../qemu_1.7.0.x86_64.xml | 9 ++++++ .../qemu_2.12.0-virt.aarch64.xml | 11 +++++++ .../qemu_2.12.0.ppc64.xml | 11 +++++++ .../qemu_2.12.0.s390x.xml | 11 +++++++ .../qemu_2.12.0.x86_64.xml | 11 +++++++ .../qemu_2.6.0-virt.aarch64.xml | 11 +++++++ .../qemu_2.6.0.aarch64.xml | 11 +++++++ .../domaincapsschemadata/qemu_2.6.0.ppc64.xml | 11 +++++++ .../qemu_2.6.0.x86_64.xml | 11 +++++++ .../domaincapsschemadata/qemu_2.7.0.s390x.xml | 11 +++++++ .../qemu_2.8.0-tcg.x86_64.xml | 11 +++++++ .../domaincapsschemadata/qemu_2.8.0.s390x.xml | 11 +++++++ .../qemu_2.8.0.x86_64.xml | 11 +++++++ .../qemu_2.9.0-q35.x86_64.xml | 11 +++++++ .../qemu_2.9.0-tcg.x86_64.xml | 11 +++++++ .../qemu_2.9.0.x86_64.xml | 11 +++++++ .../domaincapsschemadata/qemu_3.0.0.s390x.xml | 11 +++++++ .../qemu_4.0.0.x86_64.xml | 11 +++++++ 19 files changed, 226 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 71d4c01296..46ba5e30b5 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5165,6 +5165,34 @@ virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps, } +static int +virQEMUCapsFillDomainDeviceRNGCaps(virQEMUCapsPtr qemuCaps, + virDomainCapsDeviceRNGPtr rng) +{ + rng->supported = VIR_TRISTATE_BOOL_YES; + rng->model.report = true; + rng->backendModel.report = true; + + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG)) { + VIR_DOMAIN_CAPS_ENUM_SET(rng->model, VIR_DOMAIN_RNG_MODEL_VIRTIO); + + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL) || + virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY)) { + VIR_DOMAIN_CAPS_ENUM_SET(rng->model, + VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL, + VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANSITIONAL); + } + } + + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_RNG_EGD)) + VIR_DOMAIN_CAPS_ENUM_SET(rng->backendModel, VIR_DOMAIN_RNG_BACKEND_EGD); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_RNG_RANDOM)) + VIR_DOMAIN_CAPS_ENUM_SET(rng->backendModel, VIR_DOMAIN_RNG_BACKEND_RANDOM); + + return 0; +} + + /** * virQEMUCapsSupportsGICVersion: * @qemuCaps: QEMU capabilities @@ -5306,6 +5334,7 @@ virQEMUCapsFillDomainCaps(virCapsPtr caps, virDomainCapsDeviceHostdevPtr hostdev = &domCaps->hostdev; virDomainCapsDeviceGraphicsPtr graphics = &domCaps->graphics; virDomainCapsDeviceVideoPtr video = &domCaps->video; + virDomainCapsDeviceRNGPtr rng = &domCaps->rng; domCaps->maxvcpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, domCaps->machine); @@ -5332,6 +5361,7 @@ virQEMUCapsFillDomainCaps(virCapsPtr caps, virQEMUCapsFillDomainDeviceGraphicsCaps(qemuCaps, graphics) < 0 || virQEMUCapsFillDomainDeviceVideoCaps(qemuCaps, video) < 0 || virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0 || + virQEMUCapsFillDomainDeviceRNGCaps(qemuCaps, rng) < 0 || virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps) < 0 || virQEMUCapsFillDomainFeatureSEVCaps(qemuCaps, domCaps) < 0) return -1; diff --git a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml index 497363bbe9..a9b0efdbdb 100644 --- a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml @@ -109,6 +109,15 @@ <value>vfio</value> </enum> </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml b/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml index 7639df44c6..654ce1f538 100644 --- a/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml +++ b/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml @@ -114,6 +114,17 @@ <value>vfio</value> </enum> </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + <value>virtio-transitional</value> + <value>virtio-non-transitional</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> </devices> <features> <gic supported='yes'> diff --git a/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml b/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml index f10d361359..2ac32fcb3b 100644 --- a/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml +++ b/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml @@ -80,6 +80,17 @@ <value>vfio</value> </enum> </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + <value>virtio-transitional</value> + <value>virtio-non-transitional</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml b/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml index 41a81ff02f..fa377d33a0 100644 --- a/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml +++ b/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml @@ -172,6 +172,17 @@ <value>vfio</value> </enum> </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + <value>virtio-transitional</value> + <value>virtio-non-transitional</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml index 5913e7fc63..712b83f443 100644 --- a/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml @@ -142,6 +142,17 @@ <value>vfio</value> </enum> </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + <value>virtio-transitional</value> + <value>virtio-non-transitional</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml index 9ee801092e..26bd16788a 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml @@ -111,6 +111,17 @@ <value>vfio</value> </enum> </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + <value>virtio-transitional</value> + <value>virtio-non-transitional</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> </devices> <features> <gic supported='yes'> diff --git a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml index 4dd0b52ed3..3aa5474e64 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml @@ -111,6 +111,17 @@ <value>vfio</value> </enum> </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + <value>virtio-transitional</value> + <value>virtio-non-transitional</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml b/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml index aa982d237e..cb179b34af 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml @@ -84,6 +84,17 @@ <value>vfio</value> </enum> </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + <value>virtio-transitional</value> + <value>virtio-non-transitional</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml index 6aa3f52ee4..5a675e205f 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml @@ -116,6 +116,17 @@ <value>vfio</value> </enum> </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + <value>virtio-transitional</value> + <value>virtio-non-transitional</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml b/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml index 8daa15ab9d..f601922d5e 100644 --- a/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml +++ b/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml @@ -77,6 +77,17 @@ <value>vfio</value> </enum> </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + <value>virtio-transitional</value> + <value>virtio-non-transitional</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml b/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml index 081805aa4a..4d48e7d251 100644 --- a/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml @@ -117,6 +117,17 @@ <value>vfio</value> </enum> </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + <value>virtio-transitional</value> + <value>virtio-non-transitional</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml b/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml index 62c51e4087..f18dc262b4 100644 --- a/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml +++ b/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml @@ -158,6 +158,17 @@ <value>vfio</value> </enum> </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + <value>virtio-transitional</value> + <value>virtio-non-transitional</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml index 1bb034aa4f..46d398949a 100644 --- a/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml @@ -117,6 +117,17 @@ <value>vfio</value> </enum> </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + <value>virtio-transitional</value> + <value>virtio-non-transitional</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml b/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml index 67c6d5e77e..a7392c0929 100644 --- a/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml @@ -125,6 +125,17 @@ <value>vfio</value> </enum> </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + <value>virtio-transitional</value> + <value>virtio-non-transitional</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml b/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml index 588ef08199..f94f805b81 100644 --- a/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml @@ -149,6 +149,17 @@ <value>vfio</value> </enum> </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + <value>virtio-transitional</value> + <value>virtio-non-transitional</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml index 598937a971..b0039c8246 100644 --- a/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml @@ -126,6 +126,17 @@ <value>vfio</value> </enum> </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + <value>virtio-transitional</value> + <value>virtio-non-transitional</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml b/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml index 1d97f1f344..b33ff6a09d 100644 --- a/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml +++ b/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml @@ -178,6 +178,17 @@ <value>vfio</value> </enum> </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + <value>virtio-transitional</value> + <value>virtio-non-transitional</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> </devices> <features> <gic supported='no'/> diff --git a/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml b/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml index df66be9e29..7596e414d6 100644 --- a/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml @@ -143,6 +143,17 @@ <value>vfio</value> </enum> </hostdev> + <rng supported='yes'> + <enum name='model'> + <value>virtio</value> + <value>virtio-transitional</value> + <value>virtio-non-transitional</value> + </enum> + <enum name='backendModel'> + <value>random</value> + <value>egd</value> + </enum> + </rng> </devices> <features> <gic supported='no'/>