On Wed, Oct 18, 2023 at 09:27:03PM +0100, Joao Martins wrote: > 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. > > Signed-off-by: Joao Martins <joao.m.martins@xxxxxxxxxx> > --- > drivers/iommu/iommufd/hw_pagetable.c | 24 +++++++++++ > drivers/iommu/iommufd/io_pagetable.c | 55 +++++++++++++++++++++++++ > drivers/iommu/iommufd/iommufd_private.h | 12 ++++++ > drivers/iommu/iommufd/main.c | 3 ++ > include/uapi/linux/iommufd.h | 25 +++++++++++ > 5 files changed, 119 insertions(+) Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Jason