On 2022/4/29 05:09, Joao Martins wrote:
+int iopt_set_dirty_tracking(struct io_pagetable *iopt,
+                           struct iommu_domain *domain, bool enable)
+{
+       struct iommu_domain *dom;
+       unsigned long index;
+       int ret = -EOPNOTSUPP;
+
+       down_write(&iopt->iova_rwsem);
+       if (!domain) {
+               down_write(&iopt->domains_rwsem);
+               xa_for_each(&iopt->domains, index, dom) {
+                       ret = iommu_set_dirty_tracking(dom, iopt, enable);
+                       if (ret < 0)
+                               break;

Do you need to roll back to the original state before return failure?
Partial domains have already had dirty bit tracking enabled.

+               }
+               up_write(&iopt->domains_rwsem);
+       } else {
+               ret = iommu_set_dirty_tracking(domain, iopt, enable);
+       }
+
+       up_write(&iopt->iova_rwsem);
+       return ret;
+}

Best regards,
baolu
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to