qemu-devel
[Top][All Lists]
Advanced

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

[PATCH v3 01/10] vfio/iommufd: Don't fail to realize on IOMMU_GET_HW_INF


From: Joao Martins
Subject: [PATCH v3 01/10] vfio/iommufd: Don't fail to realize on IOMMU_GET_HW_INFO failure
Date: Mon, 8 Jul 2024 15:34:11 +0100

mdevs aren't "physical" devices and when asking for backing IOMMU info, it
fails the entire provisioning of the guest. Fix that by filling caps info
when IOMMU_GET_HW_INFO succeeds plus discarding the error we would get into
iommufd_backend_get_device_info().

Cc: Zhenzhong Duan <zhenzhong.duan@intel.com> 
Fixes: 930589520128 ("vfio/iommufd: Implement HostIOMMUDeviceClass::realize() 
handler")
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
---
 hw/vfio/iommufd.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
index c2f158e60386..a4d23f488b01 100644
--- a/hw/vfio/iommufd.c
+++ b/hw/vfio/iommufd.c
@@ -631,15 +631,13 @@ static bool hiod_iommufd_vfio_realize(HostIOMMUDevice 
*hiod, void *opaque,
 
     hiod->agent = opaque;
 
-    if (!iommufd_backend_get_device_info(vdev->iommufd, vdev->devid,
-                                         &type, &data, sizeof(data), errp)) {
-        return false;
+    if (iommufd_backend_get_device_info(vdev->iommufd, vdev->devid,
+                                         &type, &data, sizeof(data), NULL)) {
+        hiod->name = g_strdup(vdev->name);
+        caps->type = type;
+        caps->aw_bits = vfio_device_get_aw_bits(vdev);
     }
 
-    hiod->name = g_strdup(vdev->name);
-    caps->type = type;
-    caps->aw_bits = vfio_device_get_aw_bits(vdev);
-
     return true;
 }
 
-- 
2.17.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]