qemu: capabilities: fill in domcaps <rng>

The model logic is taken from qemuDomainRNGDefValidate

Reviewed-by: Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2019-03-31 17:19:40 -04:00
parent 9828b6e7fe
commit 928508f669
22 changed files with 259 additions and 0 deletions

View File

@ -5370,6 +5370,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
@ -5512,6 +5540,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);
@ -5542,6 +5571,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;

View File

@ -116,6 +116,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'/>

View File

@ -120,6 +120,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'>

View File

@ -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'/>

View File

@ -176,6 +176,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'/>

View File

@ -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'/>

View File

@ -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='yes'>

View File

@ -115,6 +115,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'/>

View File

@ -88,6 +88,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'/>

View File

@ -123,6 +123,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'/>

View File

@ -81,6 +81,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'/>

View File

@ -124,6 +124,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'/>

View File

@ -162,6 +162,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'/>

View File

@ -124,6 +124,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'/>

View File

@ -133,6 +133,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'/>

View File

@ -156,6 +156,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'/>

View File

@ -133,6 +133,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'/>

View File

@ -182,6 +182,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'/>

View File

@ -151,6 +151,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'/>

View File

@ -188,6 +188,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'/>

View File

@ -151,6 +151,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'/>

View File

@ -155,6 +155,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'/>