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

[Xen-devel] [PATCH v7 4/7] iommu: introduce iommu_map_page_nocrash



To allow a subsequent patch to map DFNs specified by hypercall, there
needs to be iommu_op wrapper function that does not contain an implicit
domain_crash. This patch introduces that function.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
Cc: Jan Beulich <jbeulich@xxxxxxxx>

v7:
 - New in v7.
---
 xen/drivers/passthrough/iommu.c | 15 +++++++++++----
 xen/include/xen/iommu.h         |  2 ++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 9f07112367..bc67cfe843 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -313,16 +313,23 @@ void iommu_domain_destroy(struct domain *d)
     hd->reserved_ranges = NULL;
 }
 
-int iommu_map_page(struct domain *d, dfn_t dfn, mfn_t mfn,
-                   unsigned int flags)
+int iommu_map_page_nocrash(struct domain *d, dfn_t dfn, mfn_t mfn,
+                           unsigned int flags)
 {
     const struct domain_iommu *hd = dom_iommu(d);
-    int rc;
 
     if ( !iommu_enabled || !hd->platform_ops )
         return 0;
 
-    rc = hd->platform_ops->map_page(d, dfn, mfn, flags);
+    return hd->platform_ops->map_page(d, dfn, mfn, flags);
+}
+
+int iommu_map_page(struct domain *d, dfn_t dfn, mfn_t mfn,
+                   unsigned int flags)
+{
+    int rc;
+
+    rc = iommu_map_page_nocrash(d, dfn, mfn, flags);
     if ( unlikely(rc) )
     {
         if ( !d->is_shutting_down && printk_ratelimit() )
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 9113f37b85..1bf311624c 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -89,6 +89,8 @@ void iommu_teardown(struct domain *d);
 #define IOMMUF_readable  (1u<<_IOMMUF_readable)
 #define _IOMMUF_writable 1
 #define IOMMUF_writable  (1u<<_IOMMUF_writable)
+int __must_check iommu_map_page_nocrash(struct domain *d, dfn_t dfn,
+                                        mfn_t mfn, unsigned int flags);
 int __must_check iommu_map_page(struct domain *d, dfn_t dfn,
                                 mfn_t mfn, unsigned int flags);
 int __must_check iommu_unmap_page(struct domain *d, dfn_t dfn);
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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