> From: Joao Martins <joao.m.martins@xxxxxxxxxx> > Sent: Thursday, October 19, 2023 4:27 AM > > + > +int iopt_set_dirty_tracking(struct io_pagetable *iopt, > + struct iommu_domain *domain, bool enable) > +{ > + const struct iommu_dirty_ops *ops = domain->dirty_ops; > + int ret = 0; > + > + if (!ops) > + return -EOPNOTSUPP; > + > + down_read(&iopt->iova_rwsem); > + > + /* Clear dirty bits from PTEs to ensure a clean snapshot */ > + if (enable) { > + ret = iopt_clear_dirty_data(iopt, domain); > + if (ret) > + goto out_unlock; > + } why not leaving this to the actual driver which wants to always enable dirty instead of making it a general burden for all? > + > +/* > + * enum iommufd_set_dirty_flags - Flags for steering dirty tracking > + * @IOMMU_DIRTY_TRACKING_ENABLE: Enables dirty tracking s/Enables/Enable/ > + */ > +enum iommufd_hwpt_set_dirty_flags { > + IOMMU_DIRTY_TRACKING_ENABLE = 1, IOMMU_HWPT_DIRTY_TRACKING_ENABLE > + > +/** > + * struct iommu_hwpt_set_dirty - ioctl(IOMMU_HWPT_SET_DIRTY) IOMMU_HWPT_SET_DIRTY_TRACKING