mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu: Validate address type for virtio-iommu
virtio-iommu is a PCI device and attempts to use a different address type should be rejected. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
f119336162
commit
fc6cde6cb1
@ -4888,6 +4888,13 @@ qemuValidateDomainDeviceDefIOMMU(const virDomainIOMMUDef *iommu,
|
|||||||
virDomainIOMMUModelTypeToString(iommu->model));
|
virDomainIOMMUModelTypeToString(iommu->model));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (iommu->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
|
||||||
|
iommu->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("IOMMU device: '%s' needs a PCI address"),
|
||||||
|
virDomainIOMMUModelTypeToString(iommu->model));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_IOMMU_MODEL_LAST:
|
case VIR_DOMAIN_IOMMU_MODEL_LAST:
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
unsupported configuration: IOMMU device: 'virtio' needs a PCI address
|
20
tests/qemuxml2argvdata/virtio-iommu-invalid-address-type.xml
Normal file
20
tests/qemuxml2argvdata/virtio-iommu-invalid-address-type.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'>
|
||||||
|
<address type='virtio-mmio'/>
|
||||||
|
</iommu>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
@ -3252,6 +3252,7 @@ mymain(void)
|
|||||||
DO_TEST_CAPS_ARCH_LATEST("virtio-iommu-aarch64", "aarch64");
|
DO_TEST_CAPS_ARCH_LATEST("virtio-iommu-aarch64", "aarch64");
|
||||||
DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-iommu-wrong-machine");
|
DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-iommu-wrong-machine");
|
||||||
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("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);
|
DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);
|
||||||
DO_TEST_PARSE_ERROR("cpu-hotplug-granularity",
|
DO_TEST_PARSE_ERROR("cpu-hotplug-granularity",
|
||||||
|
Loading…
Reference in New Issue
Block a user