@@ -25,6 +25,7 @@
typedef struct HostIOMMUDeviceCaps {
uint32_t type;
uint8_t aw_bits;
+ bool dirty_tracking;
} HostIOMMUDeviceCaps;
#define TYPE_HOST_IOMMU_DEVICE "host-iommu-device"
@@ -97,6 +98,7 @@ struct HostIOMMUDeviceClass {
*/
#define HOST_IOMMU_DEVICE_CAP_IOMMU_TYPE 0
#define HOST_IOMMU_DEVICE_CAP_AW_BITS 1
+#define HOST_IOMMU_DEVICE_CAP_DIRTY_TRACKING 2
#define HOST_IOMMU_DEVICE_CAP_AW_BITS_MAX 64
#endif
@@ -314,6 +314,8 @@ static int hiod_iommufd_get_cap(HostIOMMUDevice *hiod, int cap, Error **errp)
switch (cap) {
case HOST_IOMMU_DEVICE_CAP_IOMMU_TYPE:
return caps->type;
+ case HOST_IOMMU_DEVICE_CAP_DIRTY_TRACKING:
+ return caps->dirty_tracking;
case HOST_IOMMU_DEVICE_CAP_AW_BITS:
return caps->aw_bits;
default:
@@ -832,6 +832,7 @@ static bool hiod_iommufd_vfio_realize(HostIOMMUDevice *hiod, void *opaque,
hiod->name = g_strdup(vdev->name);
caps->type = type;
caps->aw_bits = vfio_device_get_aw_bits(vdev);
+ caps->dirty_tracking = (hw_caps & IOMMU_HW_CAP_DIRTY_TRACKING);
}
return true;
Fetch capabilities from IOMMU device and add a capability to host-iommu-device to reflect whether backing IOMMU has dirty tracking. This is in preparation to relax the migration eligibility when device doesn't have dirty tracking. Signed-off-by: Joao Martins <joao.m.martins@oracle.com> --- include/sysemu/host_iommu_device.h | 2 ++ backends/iommufd.c | 2 ++ hw/vfio/iommufd.c | 1 + 3 files changed, 5 insertions(+)