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

Re: [Xen-devel] [PATCH] xsm_remove_from_physmap is (so far) only defined for X86 architecture, not for ARM



On Fri, 2013-01-11 at 16:36 +0000, Keir Fraser wrote:
> On 11/01/2013 16:24, "Lars Rasmusson" <lra@xxxxxxx> wrote:
> 
> >> On 11/01/2013 13:32, "lra@xxxxxxx" <lra@xxxxxxx> wrote:
> >> 
> >>> From: Lars Rasmusson <Lars.Rasmusson@xxxxxxx>
> >>> 
> >>> Signed-off-by: Lars Rasmusson <Lars.Rasmusson@xxxxxxx>
> >> 
> >> If this is a build fix after my checkins this morning then:
> >> Acked-by: Keir Fraser <keir@xxxxxxx>
> > 
> > Yes, the XEN_TARGET_ARCH=arm32 make  breaks when compiling memory.c
> > 
> > In xen/include/xsm/dummy.h where many of the functions are used, some are
> > declared only for X86, so I picked the same #ifdef CONFIG_X86
> > as the header file uses.
> > 
> > As Ian said, it's not pretty, but since ARM doesn't have xsm (yet?) I think
> > adding a dummy xsm_remove_from_physmap for arm also is ugly.
> > 
> > Is there some other way to write memory.c so that it doesn't need
> > xsm_remove...?  (I mean, it does't need xsm_add....)
> 
> The XSM infrastructure is not architecture dependent. It's probably a
> mistake that xsm_remove_from_physmap() is ifdef CONFIG_X86.

Agreed.

8<---------------------

>From fb57be285e956cadea51dc48a28fba77d752044d Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Fri, 11 Jan 2013 16:44:14 +0000
Subject: [PATCH] xen arm: add XSM hooks to arch_memory_op

Treat XENMEM_add_to_physmap_range the same as
XENMEM_add_to_physmap.

Reported-by: Lars Rasmusson <Lars.Rasmusson@xxxxxxx>
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
---
 xen/arch/arm/mm.c       |   13 +++++++++++++
 xen/include/xsm/dummy.h |   24 ++++++++++++------------
 2 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index d97b3ea..311ec97 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -35,6 +35,7 @@
 #include <asm/current.h>
 #include <public/memory.h>
 #include <xen/sched.h>
+#include <xsm/xsm.h>
 
 struct domain *dom_xen, *dom_io, *dom_cow;
 
@@ -651,6 +652,12 @@ long arch_memory_op(int op, XEN_GUEST_HANDLE_PARAM(void) 
arg)
         if ( rc != 0 )
             return rc;
 
+        if ( xsm_add_to_physmap(XSM_TARGET, current->domain, d) )
+        {
+            rcu_unlock_domain(d);
+            return -EPERM;
+        }
+
         rc = xenmem_add_to_physmap_one(d, xatp.space, DOMID_INVALID,
                                        xatp.idx, xatp.gpfn);
 
@@ -671,6 +678,12 @@ long arch_memory_op(int op, XEN_GUEST_HANDLE_PARAM(void) 
arg)
         if ( rc != 0 )
             return rc;
 
+        if ( xsm_add_to_physmap(XSM_TARGET, current->domain, d) )
+        {
+            rcu_unlock_domain(d);
+            return -EPERM;
+        }
+
         rc = xenmem_add_to_physmap_range(d, &xatpr);
 
         rcu_unlock_domain(d);
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 1ca82b0..870bd67 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -443,6 +443,18 @@ static XSM_INLINE int 
xsm_pci_config_permission(XSM_DEFAULT_ARG struct domain *d
     return xsm_default_action(action, current->domain, d);
 }
 
+static XSM_INLINE int xsm_add_to_physmap(XSM_DEFAULT_ARG struct domain *d1, 
struct domain *d2)
+{
+    XSM_ASSERT_ACTION(XSM_TARGET);
+    return xsm_default_action(action, d1, d2);
+}
+
+static XSM_INLINE int xsm_remove_from_physmap(XSM_DEFAULT_ARG struct domain 
*d1, struct domain *d2)
+{
+    XSM_ASSERT_ACTION(XSM_TARGET);
+    return xsm_default_action(action, d1, d2);
+}
+
 #ifdef CONFIG_X86
 static XSM_INLINE int xsm_shadow_control(XSM_DEFAULT_ARG struct domain *d, 
uint32_t op)
 {
@@ -544,18 +556,6 @@ static XSM_INLINE int 
xsm_update_va_mapping(XSM_DEFAULT_ARG struct domain *d, st
     return xsm_default_action(action, d, f);
 }
 
-static XSM_INLINE int xsm_add_to_physmap(XSM_DEFAULT_ARG struct domain *d1, 
struct domain *d2)
-{
-    XSM_ASSERT_ACTION(XSM_TARGET);
-    return xsm_default_action(action, d1, d2);
-}
-
-static XSM_INLINE int xsm_remove_from_physmap(XSM_DEFAULT_ARG struct domain 
*d1, struct domain *d2)
-{
-    XSM_ASSERT_ACTION(XSM_TARGET);
-    return xsm_default_action(action, d1, d2);
-}
-
 static XSM_INLINE int xsm_bind_pt_irq(XSM_DEFAULT_ARG struct domain *d, struct 
xen_domctl_bind_pt_irq *bind)
 {
     XSM_ASSERT_ACTION(XSM_HOOK);
-- 
1.7.9.1




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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