[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v4 02/21] IOMMU: simplify unmap-on-error in iommu_map()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 25 Apr 2022 10:32:10 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rjdSQtedmMFCh8llXOYSf/g3U8VFnBdTE7dsIXoukzk=; b=WsFxqEPx2zlx2PsD33HJ1WnxZ2pguQ9u43ppwthKVBozbTx/1oioyitOrsQ1m76GmqlZvBpXSA9uAMtxVtEUTXLeaEIqr+xiFiMeJFeRbZvmeoFF39+hu4GH3vx52/h/QXwZ1CLcDWmWhen1+sTcCuS2DEdW5kHG4ifLnQP75WQ5nuC2dAf2OXKUZ4/4scDVnexkRFkl+UYNsnxhKmG5P+cKhvSzgwH9BcA0SygWVTqRkS3/7p+Xg7LCudqG/HkbCd2YrRiHKo5XfRutP/SP4sIEKxy9mXcUeOmgsLmTPpRCWYhwMJmRBenX88w32HKh4/65BKytgtP4qwkrPSEP6A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JHI0KfcCU2uigwWDWFkCx6UQb18qfCQvO4Xtbxp02SKFpdwTu8bwWyGGuWZqshO0KX31eFKZ2n4ZifoUlYNNTTlY65ffS4ZS2QSK49+3R/IRuX1I12hgNnlr4O5jcC5gtglVAqdb/ZhxNJO5n+TDxsc3FWu9lAFhIvQae2tsWgkGgrU5jx40LMxAnK4wifPHdU/GICO6wX6NB7hTYDeZPHguap0WLuKxDl1a56GFcwZGIlPkN4cnmED3QllQuQVlor1tfsaRfvgu4XcRhGGEMO8/osZr8Y4PgSa9t4RRC+uM3IOfsnMkVhg6my/A+wAjVMnsAd9WqHG9OJi3wNyjHg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 25 Apr 2022 08:32:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
v3: New.

--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -308,11 +308,9 @@ int iommu_map(struct domain *d, dfn_t df
                    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);




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.