mem_event: abstract architecture specific sanity checks
authorTamas K Lengyel <tklengyel@sec.in.tum.de>
Fri, 26 Sep 2014 14:30:37 +0000 (16:30 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 26 Sep 2014 14:30:37 +0000 (16:30 +0200)
Move architecture specific sanity checks into its own function
which is called when enabling mem_event.

Signed-off-by: Tamas K Lengyel <tklengyel@sec.in.tum.de>
Acked-by: Tim Deegan <tim@xen.org>
xen/common/mem_event.c
xen/include/asm-x86/p2m.h

index a0f75b2ac3502275598be7af8d4713ad7f9f0f8d..16ebdb5d7851980e53fd0d72caddbb41358b315e 100644 (file)
@@ -620,12 +620,7 @@ int mem_event_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
         case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE_INTROSPECTION:
         {
             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,
index f2842e53780c1d98f9db361513d8e95c7e0550d9..f6136f9a49eb4b29545dacdf4f4fddd559c0310b 100644 (file)
@@ -592,6 +592,12 @@ void p2m_mem_event_emulate_check(struct vcpu *v,
 /* Enable arch specific introspection options (such as MSR interception). */
 void p2m_setup_introspection(struct domain *d);
 
+/* 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;
+}
+
 /* 
  * Internal functions, only called by other p2m code
  */