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

[Xen-devel] [PATCH for-4.5 v7 12/21] xen/mem_event: Abstract architecture specific sanity checks



Move architecture specific sanity checks into its own function
which is called when enabling mem_event.

Signed-off-by: Tamas K Lengyel <tklengyel@xxxxxxxxxxxxx>
---
v5: Style fix.
v4: Style fix.
v2: Move sanity check function into architecture specific p2m.h
---
 xen/common/mem_event.c    | 7 +------
 xen/include/asm-x86/p2m.h | 6 ++++++
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/xen/common/mem_event.c b/xen/common/mem_event.c
index 9eca687..4d0a27b 100644
--- a/xen/common/mem_event.c
+++ b/xen/common/mem_event.c
@@ -593,12 +593,7 @@ int mem_event_domctl(struct domain *d, 
xen_domctl_mem_event_op_t *mec,
         case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE:
         {
             rc = -ENODEV;
-            /* Only HAP is supported */
-            if ( !hap_enabled(d) )
-                break;
-
-            /* Currently only EPT is supported */
-            if ( !cpu_has_vmx )
+            if ( !p2m_mem_event_sanity_check(d) )
                 break;
 
             rc = mem_event_enable(d, mec, med, _VPF_mem_access,
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/asm-x86/p2m.h
index e29743e..11a99c3 100644
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -585,6 +585,12 @@ long p2m_set_mem_access(struct domain *d, unsigned long 
start_pfn, uint32_t nr,
 int p2m_get_mem_access(struct domain *d, unsigned long pfn,
                        xenmem_access_t *access);
 
+/* Sanity check for mem_event hardware support */
+static inline bool_t p2m_mem_event_sanity_check(struct domain *d)
+{
+    return hap_enabled(d) && cpu_has_vmx;
+}
+
 /* Used by mem_access_check in mem_access common. */
 static inline void p2m_gpfn_lock(struct p2m_domain *p2m, unsigned long gpfn)
 {
-- 
2.1.0


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