qemu: Assign PCI address to virtio-iommu

The device is configured to be an integrated endpoint, as is
necessary for it to function correctly.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Andrea Bolognani 2021-09-23 19:29:07 +02:00
parent b0eb1e193f
commit f119336162
3 changed files with 11 additions and 3 deletions

View File

@ -1005,7 +1005,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDef *dev,
case VIR_DOMAIN_DEVICE_IOMMU:
switch ((virDomainIOMMUModel) dev->data.iommu->model) {
case VIR_DOMAIN_IOMMU_MODEL_VIRTIO:
return 0;
return virtioFlags | VIR_PCI_CONNECT_INTEGRATED;
case VIR_DOMAIN_IOMMU_MODEL_INTEL:
case VIR_DOMAIN_IOMMU_MODEL_SMMUV3:
@ -2386,6 +2386,10 @@ qemuDomainAssignDevicePCISlots(virDomainDef *def,
switch ((virDomainIOMMUModel) iommu->model) {
case VIR_DOMAIN_IOMMU_MODEL_VIRTIO:
if (virDeviceInfoPCIAddressIsWanted(&iommu->info) &&
qemuDomainPCIAddressReserveNextAddr(addrs, &iommu->info) < 0) {
return -1;
}
break;
case VIR_DOMAIN_IOMMU_MODEL_INTEL:

View File

@ -27,6 +27,8 @@
<controller type='pci' index='0' model='pcie-root'/>
<audio id='1' type='none'/>
<memballoon model='none'/>
<iommu model='virtio'/>
<iommu model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</iommu>
</devices>
</domain>

View File

@ -29,6 +29,8 @@
<input type='keyboard' bus='ps2'/>
<audio id='1' type='none'/>
<memballoon model='none'/>
<iommu model='virtio'/>
<iommu model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</iommu>
</devices>
</domain>