[libvirt PATCH v4 11/16] qemu: Assign PCI address to virtio-iommu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/qemu/qemu_domain_address.c                              | 6 +++++-
 .../virtio-iommu-aarch64.aarch64-latest.xml                 | 4 +++-
 .../virtio-iommu-x86_64.x86_64-latest.xml                   | 4 +++-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 205610c53e..753733d1b9 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -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:
diff --git a/tests/qemuxml2xmloutdata/virtio-iommu-aarch64.aarch64-latest.xml b/tests/qemuxml2xmloutdata/virtio-iommu-aarch64.aarch64-latest.xml
index 336f99d539..c6560e9a91 100644
--- a/tests/qemuxml2xmloutdata/virtio-iommu-aarch64.aarch64-latest.xml
+++ b/tests/qemuxml2xmloutdata/virtio-iommu-aarch64.aarch64-latest.xml
@@ -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>
diff --git a/tests/qemuxml2xmloutdata/virtio-iommu-x86_64.x86_64-latest.xml b/tests/qemuxml2xmloutdata/virtio-iommu-x86_64.x86_64-latest.xml
index 0b6c2d0eaf..ad3a702b0b 100644
--- a/tests/qemuxml2xmloutdata/virtio-iommu-x86_64.x86_64-latest.xml
+++ b/tests/qemuxml2xmloutdata/virtio-iommu-x86_64.x86_64-latest.xml
@@ -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>
-- 
2.35.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux