summary refs log tree commit diff stats
path: root/backends/iommufd.c
diff options
context:
space:
mode:
authorJoao Martins <joao.m.martins@oracle.com>2024-07-22 22:13:19 +0100
committerCédric Le Goater <clg@redhat.com>2024-07-23 17:14:52 +0200
commit6c635326425091e164b563a7ce96408ef74ff2ec (patch)
treea1271a3483c277bd1095891769c0b4521ae0f50a /backends/iommufd.c
parent5b1e96e654036a65d3edb2671281e1a30c6f5ce7 (diff)
downloadfocaccia-qemu-6c635326425091e164b563a7ce96408ef74ff2ec.tar.gz
focaccia-qemu-6c635326425091e164b563a7ce96408ef74ff2ec.zip
vfio/{iommufd,container}: Remove caps::aw_bits
Remove caps::aw_bits which requires the bcontainer::iova_ranges being
initialized after device is actually attached. Instead defer that to
.get_cap() and call vfio_device_get_aw_bits() directly.

This is in preparation for HostIOMMUDevice::realize() being called early
during attach_device().

Suggested-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Diffstat (limited to 'backends/iommufd.c')
-rw-r--r--backends/iommufd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/backends/iommufd.c b/backends/iommufd.c
index 60a3d14bfa..06b135111f 100644
--- a/backends/iommufd.c
+++ b/backends/iommufd.c
@@ -18,6 +18,7 @@
 #include "qemu/error-report.h"
 #include "monitor/monitor.h"
 #include "trace.h"
+#include "hw/vfio/vfio-common.h"
 #include <sys/ioctl.h>
 #include <linux/iommufd.h>
 
@@ -269,7 +270,7 @@ static int hiod_iommufd_get_cap(HostIOMMUDevice *hiod, int cap, Error **errp)
     case HOST_IOMMU_DEVICE_CAP_IOMMU_TYPE:
         return caps->type;
     case HOST_IOMMU_DEVICE_CAP_AW_BITS:
-        return caps->aw_bits;
+        return vfio_device_get_aw_bits(hiod->agent);
     default:
         error_setg(errp, "%s: unsupported capability %x", hiod->name, cap);
         return -EINVAL;