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

[Xen-devel] [PATCH RFC v2 11/12] xen/arm: Enable the compilation of mem_access and mem_event on ARM.



This patch sets up the infrastructure to support mem_access and mem_event
on ARM and turns on compilation. We define the required XSM functions.

Signed-off-by: Tamas K Lengyel <tklengyel@xxxxxxxxxxxxx>
---
v2: Add CONFIG_MEM_PAGING and CONFIG_MEM_SHARING definitions and
       use them instead of CONFIG_X86.
    Split domctl copy-back and p2m type definitions into separate
       patches and move this patch to the end of the series.

Signed-off-by: Tamas K Lengyel <tklengyel@xxxxxxxxxxxxx>
---
 xen/common/mem_access.c      |  7 +++++-
 xen/common/mem_event.c       | 28 ++++++++++++++++++---
 xen/include/asm-arm/config.h |  3 +++
 xen/include/asm-x86/config.h |  3 +++
 xen/include/xen/mem_access.h | 19 ---------------
 xen/include/xen/mem_event.h  | 58 ++++----------------------------------------
 xen/include/xsm/dummy.h      | 24 +++++++++---------
 xen/include/xsm/xsm.h        | 24 +++++++++---------
 xen/xsm/dummy.c              |  4 +--
 9 files changed, 68 insertions(+), 102 deletions(-)

diff --git a/xen/common/mem_access.c b/xen/common/mem_access.c
index 2bb3171..421f150 100644
--- a/xen/common/mem_access.c
+++ b/xen/common/mem_access.c
@@ -36,6 +36,12 @@ static inline bool_t mem_access_sanity_check(struct domain 
*d)
         return 0;
     return 1;
 }
+#elif CONFIG_ARM
+static inline bool_t mem_access_sanity_check(struct domain *d)
+{
+    return 1;
+}
+#endif
 
 int mem_access_memop(unsigned long cmd,
                      XEN_GUEST_HANDLE_PARAM(xen_mem_access_op_t) arg)
@@ -133,7 +139,6 @@ int mem_access_send_req(struct domain *d, 
mem_event_request_t *req)
     return 0;
 }
 
-#endif /* CONFIG_X86 */
 
 /*
  * Local variables:
diff --git a/xen/common/mem_event.c b/xen/common/mem_event.c
index 8bf0cf1..1d8a281 100644
--- a/xen/common/mem_event.c
+++ b/xen/common/mem_event.c
@@ -20,16 +20,22 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef CONFIG_X86
-
+#include <xen/sched.h>
 #include <asm/domain.h>
 #include <xen/event.h>
 #include <xen/wait.h>
 #include <asm/p2m.h>
 #include <xen/mem_event.h>
 #include <xen/mem_access.h>
+
+#if CONFIG_MEM_PAGING==1
 #include <asm/mem_paging.h>
+#endif
+
+#if CONFIG_MEM_SHARING==1
 #include <asm/mem_sharing.h>
+#endif
+
 #include <xsm/xsm.h>
 
 /* for public/io/ring.h macros */
@@ -424,6 +430,7 @@ int __mem_event_claim_slot(struct domain *d, struct 
mem_event_domain *med,
         return mem_event_grab_slot(med, (current->domain != d));
 }
 
+#ifdef CONFIG_X86
 static inline bool_t mem_event_sanity_check(struct domain *d)
 {
     /* Only HAP is supported */
@@ -436,13 +443,21 @@ static inline bool_t mem_event_sanity_check(struct domain 
*d)
 
     return 1;
 }
+#elif CONFIG_ARM
+static inline bool_t mem_event_sanity_check(struct domain *d)
+{
+    return 1;
+}
+#endif
 
+#if CONFIG_MEM_PAGING==1
 /* Registered with Xen-bound event channel for incoming notifications. */
 static void mem_paging_notification(struct vcpu *v, unsigned int port)
 {
     if ( likely(v->domain->mem_event->paging.ring_page != NULL) )
         p2m_mem_paging_resume(v->domain);
 }
+#endif
 
 /* Registered with Xen-bound event channel for incoming notifications. */
 static void mem_access_notification(struct vcpu *v, unsigned int port)
@@ -451,13 +466,16 @@ static void mem_access_notification(struct vcpu *v, 
unsigned int port)
         p2m_mem_access_resume(v->domain);
 }
 
+#if CONFIG_MEM_SHARING==1
 /* Registered with Xen-bound event channel for incoming notifications. */
 static void mem_sharing_notification(struct vcpu *v, unsigned int port)
 {
     if ( likely(v->domain->mem_event->share.ring_page != NULL) )
         mem_sharing_sharing_resume(v->domain);
 }
+#endif
 
+#if CONFIG_MEM_PAGING==1 || CONFIG_MEM_SHARING==1
 int do_mem_event_op(int op, uint32_t domain, void *arg)
 {
     int ret;
@@ -487,6 +505,7 @@ int do_mem_event_op(int op, uint32_t domain, void *arg)
     rcu_unlock_domain(d);
     return ret;
 }
+#endif
 
 /* Clean up on domain destruction */
 void mem_event_cleanup(struct domain *d)
@@ -546,6 +565,7 @@ int mem_event_domctl(struct domain *d, 
xen_domctl_mem_event_op_t *mec,
 
     switch ( mec->mode )
     {
+#if CONFIG_MEM_PAGING==1
     case XEN_DOMCTL_MEM_EVENT_OP_PAGING:
     {
         struct mem_event_domain *med = &d->mem_event->paging;
@@ -597,6 +617,7 @@ int mem_event_domctl(struct domain *d, 
xen_domctl_mem_event_op_t *mec,
         }
     }
     break;
+#endif
 
     case XEN_DOMCTL_MEM_EVENT_OP_ACCESS:
     {
@@ -633,6 +654,7 @@ int mem_event_domctl(struct domain *d, 
xen_domctl_mem_event_op_t *mec,
     }
     break;
 
+#if CONFIG_MEM_SHARING==1
     case XEN_DOMCTL_MEM_EVENT_OP_SHARING:
     {
         struct mem_event_domain *med = &d->mem_event->share;
@@ -671,6 +693,7 @@ int mem_event_domctl(struct domain *d, 
xen_domctl_mem_event_op_t *mec,
         }
     }
     break;
+#endif
 
     default:
         rc = -ENOSYS;
@@ -710,7 +733,6 @@ void mem_event_vcpu_unpause(struct vcpu *v)
 
     vcpu_unpause(v);
 }
-#endif
 
 /*
  * Local variables:
diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h
index 1c3abcf..537727a 100644
--- a/xen/include/asm-arm/config.h
+++ b/xen/include/asm-arm/config.h
@@ -55,6 +55,9 @@
 #define __LINUX_ARM_ARCH__ 7
 #define CONFIG_AEABI
 
+#define CONFIG_MEM_SHARING 0
+#define CONFIG_MEM_PAGING 0
+
 /* Linkage for ARM */
 #define __ALIGN .align 2
 #define __ALIGN_STR ".align 2"
diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h
index 210ff57..525ac44 100644
--- a/xen/include/asm-x86/config.h
+++ b/xen/include/asm-x86/config.h
@@ -57,6 +57,9 @@
 #define CONFIG_LATE_HWDOM 1
 #endif
 
+#define CONFIG_MEM_SHARING 1
+#define CONFIG_MEM_PAGING 1
+
 #define HZ 100
 
 #define OPT_CONSOLE_STR "vga"
diff --git a/xen/include/xen/mem_access.h b/xen/include/xen/mem_access.h
index c7dfc48..22e469f 100644
--- a/xen/include/xen/mem_access.h
+++ b/xen/include/xen/mem_access.h
@@ -23,29 +23,10 @@
 #ifndef _XEN_ASM_MEM_ACCESS_H
 #define _XEN_ASM_MEM_ACCESS_H
 
-#ifdef CONFIG_X86
-
 int mem_access_memop(unsigned long cmd,
                      XEN_GUEST_HANDLE_PARAM(xen_mem_access_op_t) arg);
 int mem_access_send_req(struct domain *d, mem_event_request_t *req);
 
-#else
-
-static inline
-int mem_access_memop(unsigned long cmd,
-                     XEN_GUEST_HANDLE_PARAM(xen_mem_access_op_t) arg)
-{
-    return -ENOSYS;
-}
-
-static inline
-int mem_access_send_req(struct domain *d, mem_event_request_t *req)
-{
-    return -ENOSYS;
-}
-
-#endif /* CONFIG_X86 */
-
 #endif /* _XEN_ASM_MEM_ACCESS_H */
 
 /*
diff --git a/xen/include/xen/mem_event.h b/xen/include/xen/mem_event.h
index 774909e..cb68463 100644
--- a/xen/include/xen/mem_event.h
+++ b/xen/include/xen/mem_event.h
@@ -24,8 +24,6 @@
 #ifndef __MEM_EVENT_H__
 #define __MEM_EVENT_H__
 
-#ifdef CONFIG_X86
-
 /* Clean up on domain destruction */
 void mem_event_cleanup(struct domain *d);
 
@@ -67,66 +65,20 @@ void mem_event_put_request(struct domain *d, struct 
mem_event_domain *med,
 int mem_event_get_response(struct domain *d, struct mem_event_domain *med,
                            mem_event_response_t *rsp);
 
+#if CONFIG_MEM_PAGING==1 || CONFIG_MEM_SHARING==1
 int do_mem_event_op(int op, uint32_t domain, void *arg);
-int mem_event_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
-                     XEN_GUEST_HANDLE_PARAM(void) u_domctl);
-
-void mem_event_vcpu_pause(struct vcpu *v);
-void mem_event_vcpu_unpause(struct vcpu *v);
-
 #else
-
-static inline void mem_event_cleanup(struct domain *d) {}
-
-static inline bool_t mem_event_check_ring(struct mem_event_domain *med)
-{
-    return 0;
-}
-
-static inline int mem_event_claim_slot(struct domain *d,
-                                        struct mem_event_domain *med)
-{
-    return -ENOSYS;
-}
-
-static inline int mem_event_claim_slot_nosleep(struct domain *d,
-                                        struct mem_event_domain *med)
-{
-    return -ENOSYS;
-}
-
-static inline
-void mem_event_cancel_slot(struct domain *d, struct mem_event_domain *med)
-{}
-
-static inline
-void mem_event_put_request(struct domain *d, struct mem_event_domain *med,
-                            mem_event_request_t *req)
-{}
-
-static inline
-int mem_event_get_response(struct domain *d, struct mem_event_domain *med,
-                           mem_event_response_t *rsp)
-{
-    return -ENOSYS;
-}
-
 static inline int do_mem_event_op(int op, uint32_t domain, void *arg)
 {
     return -ENOSYS;
 }
+#endif
 
-static inline
 int mem_event_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
-                     XEN_GUEST_HANDLE_PARAM(void) u_domctl)
-{
-    return -ENOSYS;
-}
-
-static inline void mem_event_vcpu_pause(struct vcpu *v) {}
-static inline void mem_event_vcpu_unpause(struct vcpu *v) {}
+                     XEN_GUEST_HANDLE_PARAM(void) u_domctl);
 
-#endif /* CONFIG_X86 */
+void mem_event_vcpu_pause(struct vcpu *v);
+void mem_event_vcpu_unpause(struct vcpu *v);
 
 #endif /* __MEM_EVENT_H__ */
 
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index c5aa316..61677ea 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -507,6 +507,18 @@ static XSM_INLINE int xsm_hvm_param_nested(XSM_DEFAULT_ARG 
struct domain *d)
     return xsm_default_action(action, current->domain, d);
 }
 
+static XSM_INLINE int xsm_mem_event_control(XSM_DEFAULT_ARG struct domain *d, 
int mode, int op)
+{
+    XSM_ASSERT_ACTION(XSM_PRIV);
+    return xsm_default_action(action, current->domain, d);
+}
+
+static XSM_INLINE int xsm_mem_event_op(XSM_DEFAULT_ARG struct domain *d, int 
op)
+{
+    XSM_ASSERT_ACTION(XSM_DM_PRIV);
+    return xsm_default_action(action, current->domain, d);
+}
+
 #ifdef CONFIG_X86
 static XSM_INLINE int xsm_do_mca(XSM_DEFAULT_VOID)
 {
@@ -550,18 +562,6 @@ static XSM_INLINE int xsm_hvm_ioreq_server(XSM_DEFAULT_ARG 
struct domain *d, int
     return xsm_default_action(action, current->domain, d);
 }
 
-static XSM_INLINE int xsm_mem_event_control(XSM_DEFAULT_ARG struct domain *d, 
int mode, int op)
-{
-    XSM_ASSERT_ACTION(XSM_PRIV);
-    return xsm_default_action(action, current->domain, d);
-}
-
-static XSM_INLINE int xsm_mem_event_op(XSM_DEFAULT_ARG struct domain *d, int 
op)
-{
-    XSM_ASSERT_ACTION(XSM_DM_PRIV);
-    return xsm_default_action(action, current->domain, d);
-}
-
 static XSM_INLINE int xsm_mem_sharing_op(XSM_DEFAULT_ARG struct domain *d, 
struct domain *cd, int op)
 {
     XSM_ASSERT_ACTION(XSM_DM_PRIV);
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index a85045d..0b77a4b 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -139,6 +139,8 @@ struct xsm_operations {
     int (*hvm_param) (struct domain *d, unsigned long op);
     int (*hvm_control) (struct domain *d, unsigned long op);
     int (*hvm_param_nested) (struct domain *d);
+    int (*mem_event_control) (struct domain *d, int mode, int op);
+    int (*mem_event_op) (struct domain *d, int op);
 
 #ifdef CONFIG_X86
     int (*do_mca) (void);
@@ -148,8 +150,6 @@ struct xsm_operations {
     int (*hvm_set_pci_link_route) (struct domain *d);
     int (*hvm_inject_msi) (struct domain *d);
     int (*hvm_ioreq_server) (struct domain *d, int op);
-    int (*mem_event_control) (struct domain *d, int mode, int op);
-    int (*mem_event_op) (struct domain *d, int op);
     int (*mem_sharing_op) (struct domain *d, struct domain *cd, int op);
     int (*apic) (struct domain *d, int cmd);
     int (*memtype) (uint32_t access);
@@ -534,6 +534,16 @@ static inline int xsm_hvm_param_nested (xsm_default_t def, 
struct domain *d)
     return xsm_ops->hvm_param_nested(d);
 }
 
+static inline int xsm_mem_event_control (xsm_default_t def, struct domain *d, 
int mode, int op)
+{
+    return xsm_ops->mem_event_control(d, mode, op);
+}
+
+static inline int xsm_mem_event_op (xsm_default_t def, struct domain *d, int 
op)
+{
+    return xsm_ops->mem_event_op(d, op);
+}
+
 #ifdef CONFIG_X86
 static inline int xsm_do_mca(xsm_default_t def)
 {
@@ -570,16 +580,6 @@ static inline int xsm_hvm_ioreq_server (xsm_default_t def, 
struct domain *d, int
     return xsm_ops->hvm_ioreq_server(d, op);
 }
 
-static inline int xsm_mem_event_control (xsm_default_t def, struct domain *d, 
int mode, int op)
-{
-    return xsm_ops->mem_event_control(d, mode, op);
-}
-
-static inline int xsm_mem_event_op (xsm_default_t def, struct domain *d, int 
op)
-{
-    return xsm_ops->mem_event_op(d, op);
-}
-
 static inline int xsm_mem_sharing_op (xsm_default_t def, struct domain *d, 
struct domain *cd, int op)
 {
     return xsm_ops->mem_sharing_op(d, cd, op);
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index c95c803..9df9d81 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -116,6 +116,8 @@ void xsm_fixup_ops (struct xsm_operations *ops)
     set_to_dummy_if_null(ops, add_to_physmap);
     set_to_dummy_if_null(ops, remove_from_physmap);
     set_to_dummy_if_null(ops, map_gmfn_foreign);
+    set_to_dummy_if_null(ops, mem_event_control);
+    set_to_dummy_if_null(ops, mem_event_op);
 
 #ifdef CONFIG_X86
     set_to_dummy_if_null(ops, do_mca);
@@ -125,8 +127,6 @@ void xsm_fixup_ops (struct xsm_operations *ops)
     set_to_dummy_if_null(ops, hvm_set_pci_link_route);
     set_to_dummy_if_null(ops, hvm_inject_msi);
     set_to_dummy_if_null(ops, hvm_ioreq_server);
-    set_to_dummy_if_null(ops, mem_event_control);
-    set_to_dummy_if_null(ops, mem_event_op);
     set_to_dummy_if_null(ops, mem_sharing_op);
     set_to_dummy_if_null(ops, apic);
     set_to_dummy_if_null(ops, platform_op);
-- 
2.1.0.rc1


_______________________________________________
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®.