mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
domain_validate: Validate dma_translation for iommu models
The attribute dma_translation is only supported by intel-iommu device.
Report an error when it is used for the other iommu devices.
Fixes: 6866f958c1
Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
8105426d8f
commit
3b296a98aa
@ -2980,7 +2980,8 @@ virDomainIOMMUDefValidate(const virDomainIOMMUDef *iommu)
|
|||||||
iommu->caching_mode != VIR_TRISTATE_SWITCH_ABSENT ||
|
iommu->caching_mode != VIR_TRISTATE_SWITCH_ABSENT ||
|
||||||
iommu->eim != VIR_TRISTATE_SWITCH_ABSENT ||
|
iommu->eim != VIR_TRISTATE_SWITCH_ABSENT ||
|
||||||
iommu->iotlb != VIR_TRISTATE_SWITCH_ABSENT ||
|
iommu->iotlb != VIR_TRISTATE_SWITCH_ABSENT ||
|
||||||
iommu->aw_bits != 0) {
|
iommu->aw_bits != 0 ||
|
||||||
|
iommu->dma_translation != VIR_TRISTATE_SWITCH_ABSENT) {
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("iommu model '%1$s' doesn't support additional attributes"),
|
_("iommu model '%1$s' doesn't support additional attributes"),
|
||||||
virDomainIOMMUModelTypeToString(iommu->model));
|
virDomainIOMMUModelTypeToString(iommu->model));
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
XML error: iommu model 'virtio' doesn't support additional attributes
|
20
tests/qemuxmlconfdata/virtio-iommu-dma-translation.xml
Normal file
20
tests/qemuxmlconfdata/virtio-iommu-dma-translation.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<domain type='qemu'>
|
||||||
|
<name>QEMUGuest1</name>
|
||||||
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
|
<memory unit='KiB'>219100</memory>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='x86_64' machine='q35'>hvm</type>
|
||||||
|
</os>
|
||||||
|
<features>
|
||||||
|
<acpi/>
|
||||||
|
</features>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||||
|
<controller type='usb' model='none'/>
|
||||||
|
<memballoon model='none'/>
|
||||||
|
<iommu model='virtio'>
|
||||||
|
<driver dma_translation='on'/>
|
||||||
|
</iommu>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
@ -2766,6 +2766,7 @@ mymain(void)
|
|||||||
DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-iommu-no-acpi");
|
DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-iommu-no-acpi");
|
||||||
DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-iommu-invalid-address-type");
|
DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-iommu-invalid-address-type");
|
||||||
DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-iommu-invalid-address");
|
DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-iommu-invalid-address");
|
||||||
|
DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-iommu-dma-translation");
|
||||||
|
|
||||||
DO_TEST_CAPS_LATEST("cpu-hotplug-startup");
|
DO_TEST_CAPS_LATEST("cpu-hotplug-startup");
|
||||||
DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("cpu-hotplug-granularity", "ppc64");
|
DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("cpu-hotplug-granularity", "ppc64");
|
||||||
|
Loading…
Reference in New Issue
Block a user