History

iommufd: Add IOMMU_HWPT_SET_DIRTY_TRACKING

Every IOMMU driver should be able to implement the needed iommu domain ops to control dirty tracking. Connect a hw_pagetable to the IOMMU core dirty tracking ops, specifically the ability to enable/disable dirty tracking on an IOMMU domain (hw_pagetable id). To that end add an io_pagetable kernel API to toggle dirty tracking: * iopt_set_dirty_tracking(iopt, [domain], state) The intended caller of this is via the hw_pagetable object that is created. Internally it will ensure the leftover dirty state is cleared /right before/ dirty tracking starts. This is also useful for iommu drivers which may decide that dirty tracking is always-enabled at boot without wanting to toggle dynamically via corresponding iommu domain op.

Joao Martins committed 3 years ago

Commit e2a4b291 parent 5f9bdbf5 files · +121 −0Browse files

Showing the changes to include/uapi (1 of 5 files). Show all

Unified · Split

include/uapi/linux/iommufd.h+28−0
@@ -47,6 +47,7 @@ enum { · 46 unmodified lines
4747 IOMMUFD_CMD_VFIO_IOAS,
4848 IOMMUFD_CMD_HWPT_ALLOC,
4949 IOMMUFD_CMD_GET_HW_INFO,
50+ IOMMUFD_CMD_HWPT_SET_DIRTY_TRACKING,
5051 };
5152
5253 /**
@@ -453,4 +454,31 @@ struct iommu_hw_info { · 400 unmodified lines
453454 __u32 __reserved;
454455 };
455456 #define IOMMU_GET_HW_INFO _IO(IOMMUFD_TYPE, IOMMUFD_CMD_GET_HW_INFO)
457+
458+/*
459+ * enum iommufd_hwpt_set_dirty_tracking_flags - Flags for steering dirty
460+ * tracking
461+ * @IOMMU_HWPT_DIRTY_TRACKING_ENABLE: Enable dirty tracking
462+ */
463+enum iommufd_hwpt_set_dirty_tracking_flags {
464+ IOMMU_HWPT_DIRTY_TRACKING_ENABLE = 1,
465+};
466+
467+/**
468+ * struct iommu_hwpt_set_dirty_tracking - ioctl(IOMMU_HWPT_SET_DIRTY_TRACKING)
469+ * @size: sizeof(struct iommu_hwpt_set_dirty_tracking)
470+ * @flags: Combination of enum iommufd_hwpt_set_dirty_tracking_flags
471+ * @hwpt_id: HW pagetable ID that represents the IOMMU domain
472+ * @__reserved: Must be 0
473+ *
474+ * Toggle dirty tracking on an HW pagetable.
475+ */
476+struct iommu_hwpt_set_dirty_tracking {
477+ __u32 size;
478+ __u32 flags;
479+ __u32 hwpt_id;
480+ __u32 __reserved;
481+};
482+#define IOMMU_HWPT_SET_DIRTY_TRACKING _IO(IOMMUFD_TYPE, \
483+ IOMMUFD_CMD_HWPT_SET_DIRTY_TRACKING)
456484 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t