xen: Simplify the space of spaces supported by XENMEM_add_to_physmap(_range)
authorIan Campbell <ian.campbell@citrix.com>
Thu, 24 Jan 2013 12:47:56 +0000 (12:47 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 24 Jan 2013 12:47:56 +0000 (12:47 +0000)
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>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/mm.c
xen/include/public/memory.h

index 88615543e26f5330d925eb9f574d81f3bb90e4c8..9c5c33448a2a54e81b94014096b1da6276a5785f 100644 (file)
@@ -680,7 +680,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;
 
@@ -711,6 +711,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;
index 62acabd021cb7da2af01df20a39a539e3857ce49..a248c07be414a52714760cdf8bd0648089745a18 100644 (file)
@@ -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.
+                                    */
 /* ` } */
 
 /*