IOMMU: simplify unmap-on-error in iommu_map()
authorJan Beulich <jbeulich@suse.com>
Fri, 20 May 2022 10:21:49 +0000 (12:21 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 20 May 2022 10:21:49 +0000 (12:21 +0200)
As of 68a8aa5d7264 ("iommu: make map and unmap take a page count,
similar to flush") there's no need anymore to have a loop here.

Suggested-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/drivers/passthrough/iommu.c

index 67ffe6635e98c1767e5501bdc9dec3e3576306d8..3762d0bd865d1dda273ee18094fe90302239d006 100644 (file)
@@ -308,11 +308,9 @@ int iommu_map(struct domain *d, dfn_t dfn, mfn_t mfn,
                    d->domain_id, dfn_x(dfn_add(dfn, i)),
                    mfn_x(mfn_add(mfn, i)), rc);
 
-        while ( i-- )
-            /* if statement to satisfy __must_check */
-            if ( iommu_call(hd->platform_ops, unmap_page, d, dfn_add(dfn, i),
-                            flush_flags) )
-                continue;
+        /* while statement to satisfy __must_check */
+        while ( iommu_unmap(d, dfn, i, flush_flags) )
+            break;
 
         if ( !is_hardware_domain(d) )
             domain_crash(d);