[libvirt] [PATCH 6/8] conf: Add IOMMU support to virDomainDeviceInfoIterate()

Andrea Bolognani posted 8 patches 6 years, 8 months ago
[libvirt] [PATCH 6/8] conf: Add IOMMU support to virDomainDeviceInfoIterate()
Posted by Andrea Bolognani 6 years, 8 months ago
Now that we can safely iterate over devices that don't have
an associated virDomainDeviceInfo, supporting IOMMU devices
is no longer a problem.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 src/conf/domain_conf.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 16820424be..eda424dbef 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4252,6 +4252,13 @@ virDomainDeviceInfoIterateInternal(virDomainDefPtr def,
             return rc;
     }
 
+    if (def->iommu) {
+        device.type = VIR_DOMAIN_DEVICE_IOMMU;
+        device.data.iommu = def->iommu;
+        if ((rc = cb(def, &device, NULL, opaque)) != 0)
+            return rc;
+    }
+
     /* Coverity is not very happy with this - all dead_error_condition */
 #if !STATIC_ANALYSIS
     /* This switch statement is here to trigger compiler warning when adding
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 6/8] conf: Add IOMMU support to virDomainDeviceInfoIterate()
Posted by Ján Tomko 6 years, 8 months ago
On Mon, May 20, 2019 at 01:37:51PM +0200, Andrea Bolognani wrote:
>Now that we can safely iterate over devices that don't have
>an associated virDomainDeviceInfo, supporting IOMMU devices
>is no longer a problem.
>

Actually, not having a DeviceInfo for the IOMMU device might be a bug
here. I omitted it because there's no address to be specified, but
there might be a use for an alias here.

Jano

>Signed-off-by: Andrea Bolognani <abologna@redhat.com>
>---
> src/conf/domain_conf.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
>diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>index 16820424be..eda424dbef 100644
>--- a/src/conf/domain_conf.c
>+++ b/src/conf/domain_conf.c
>@@ -4252,6 +4252,13 @@ virDomainDeviceInfoIterateInternal(virDomainDefPtr def,
>             return rc;
>     }
>
>+    if (def->iommu) {
>+        device.type = VIR_DOMAIN_DEVICE_IOMMU;
>+        device.data.iommu = def->iommu;
>+        if ((rc = cb(def, &device, NULL, opaque)) != 0)
>+            return rc;
>+    }
>+
>     /* Coverity is not very happy with this - all dead_error_condition */
> #if !STATIC_ANALYSIS
>     /* This switch statement is here to trigger compiler warning when adding
>-- 
>2.21.0
>
>--
>libvir-list mailing list
>libvir-list@redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 6/8] conf: Add IOMMU support to virDomainDeviceInfoIterate()
Posted by Andrea Bolognani 6 years, 8 months ago
On Mon, 2019-05-20 at 15:03 +0200, Ján Tomko wrote:
> On Mon, May 20, 2019 at 01:37:51PM +0200, Andrea Bolognani wrote:
> > Now that we can safely iterate over devices that don't have
> > an associated virDomainDeviceInfo, supporting IOMMU devices
> > is no longer a problem.
> 
> Actually, not having a DeviceInfo for the IOMMU device might be a bug
> here. I omitted it because there's no address to be specified, but
> there might be a use for an alias here.

What would be the point of having an alias for IOMMU devices, when
there can only be one per guest?

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list