All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Durrant <paul.durrant@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Paul Durrant <paul.durrant@citrix.com>, Jan Beulich <jbeulich@suse.com>
Subject: [PATCH v7 4/7] iommu: introduce iommu_map_page_nocrash
Date: Mon, 15 Oct 2018 11:35:56 +0100	[thread overview]
Message-ID: <20181015103559.22075-5-paul.durrant@citrix.com> (raw)
In-Reply-To: <20181015103559.22075-1-paul.durrant@citrix.com>

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@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>

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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-10-15 10:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-15 10:35 [PATCH v7 0/7] Paravirtual IOMMU Interface Paul Durrant
2018-10-15 10:35 ` [PATCH v7 1/7] public / x86: introduce __HYPERCALL_iommu_op Paul Durrant
2018-11-09 11:23   ` Jan Beulich
2018-10-15 10:35 ` [PATCH v7 2/7] iommu: track reserved ranges using a rangeset Paul Durrant
2018-11-09 11:46   ` Jan Beulich
2018-10-15 10:35 ` [PATCH v7 3/7] x86: add xen_iommu_op to query reserved ranges Paul Durrant
2018-11-09 12:01   ` Jan Beulich
2018-10-15 10:35 ` Paul Durrant [this message]
2018-11-12 13:26   ` [PATCH v7 4/7] iommu: introduce iommu_map_page_nocrash Jan Beulich
2018-10-15 10:35 ` [PATCH v7 5/7] iommu / vtd: introduce a new 'refcount' flag Paul Durrant
2018-11-12 13:37   ` Jan Beulich
2018-10-15 10:35 ` [PATCH v7 6/7] x86: add xen_iommu_ops to modify IOMMU mappings Paul Durrant
2018-11-12 14:29   ` Jan Beulich
2018-10-15 10:35 ` [PATCH v7 7/7] x86: extend the map and unmap xen_iommu_ops to support grant references Paul Durrant
2018-11-12 15:06   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181015103559.22075-5-paul.durrant@citrix.com \
    --to=paul.durrant@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.