All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xen.org
Cc: tim@xen.org, keir@xen.org, stefano.stabellini@citrix.com,
	Ian Campbell <ian.campbell@citrix.com>,
	konrad.wilk@oracle.com
Subject: [PATCH] xen: Simplify the space of spaces supported by XENMEM_add_to_physmap(_range)
Date: Tue, 22 Jan 2013 11:39:13 +0000	[thread overview]
Message-ID: <1358854753-11633-1-git-send-email-ian.campbell@citrix.com> (raw)

XENMAPSPACE_gmfn_foreign is not supported by XENMEM_add_to_physmap.

Although in theory XENMEM_add_to_physmap_range could support
XENMAPSPACE_gmfn_range this is no different to
XENMAPSPACE_gmfn in the context of the ranged hypercall so disallow it
to avoid any confusion.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 xen/arch/arm/mm.c           |    6 +++++-
 xen/include/public/memory.h |    6 ++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index eb5213e..faa9742 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -648,7 +648,7 @@ long arch_memory_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg)
         if ( copy_from_guest(&xatp, arg, 1) )
             return -EFAULT;
 
-        /* This one is only supported by add_to_physmap_range */
+        /* Foreign mapping is only supported by add_to_physmap_range */
         if ( xatp.space == XENMAPSPACE_gmfn_foreign )
             return -EINVAL;
 
@@ -679,6 +679,10 @@ long arch_memory_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg)
         if ( copy_from_guest(&xatpr, arg, 1) )
             return -EFAULT;
 
+        /* This mapspace is redundant for this hypercall */
+        if ( xatpr.space == XENMAPSPACE_gmfn_range )
+            return -EINVAL;
+
         rc = rcu_lock_target_domain_by_id(xatpr.domid, &d);
         if ( rc != 0 )
             return rc;
diff --git a/xen/include/public/memory.h b/xen/include/public/memory.h
index 62acabd..a248c07 100644
--- a/xen/include/public/memory.h
+++ b/xen/include/public/memory.h
@@ -203,8 +203,10 @@ DEFINE_XEN_GUEST_HANDLE(xen_machphys_mapping_t);
 #define XENMAPSPACE_shared_info  0 /* shared info page */
 #define XENMAPSPACE_grant_table  1 /* grant table page */
 #define XENMAPSPACE_gmfn         2 /* GMFN */
-#define XENMAPSPACE_gmfn_range   3 /* GMFN range */
-#define XENMAPSPACE_gmfn_foreign 4 /* GMFN from another dom */
+#define XENMAPSPACE_gmfn_range   3 /* GMFN range, XENMEM_add_to_physmap only. */
+#define XENMAPSPACE_gmfn_foreign 4 /* GMFN from another dom,
+                                    * XENMEM_add_to_physmap_range only.
+                                    */
 /* ` } */
 
 /*
-- 
1.7.9.1

             reply	other threads:[~2013-01-22 11:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-22 11:39 Ian Campbell [this message]
2013-01-22 12:17 ` [PATCH] xen: Simplify the space of spaces supported by XENMEM_add_to_physmap(_range) Stefano Stabellini
2013-01-22 20:04 ` Keir Fraser
2013-01-24 13:18   ` Ian Campbell

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=1358854753-11633-1-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=keir@xen.org \
    --cc=konrad.wilk@oracle.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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.