]> xenbits.xensource.com Git - xtf.git/commitdiff
Add Xen ABI for update_va_mapping flags, and replace opencoded constants
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 15 Jul 2016 09:02:29 +0000 (10:02 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 18 Jul 2016 10:46:46 +0000 (11:46 +0100)
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
arch/x86/pv/traps.c
include/xen/xen.h
include/xtf/hypercall.h

index 392459afc33829fea8c71846ecc50e2cc3f458c5..fa741b3401e6a450e0a3a37b82b88afbfe18e6d8 100644 (file)
@@ -75,7 +75,7 @@ void arch_init_traps(void)
     write_gs(__USER_DS);
 
     /* Unmap page at 0 to catch errors with NULL pointers. */
-    rc = hypercall_update_va_mapping(NULL, 0, 2);
+    rc = hypercall_update_va_mapping(NULL, 0, UVMF_INVLPG);
     if ( rc )
         panic("Failed to unmap page at NULL: %d\n", rc);
 
@@ -148,7 +148,8 @@ void arch_init_traps(void)
 
         if ( !(l1[i1] & _PAGE_USER) )
         {
-            rc = hypercall_update_va_mapping(_p(va), l1[i1] | _PAGE_USER, 2);
+            rc = hypercall_update_va_mapping(_p(va), l1[i1] | _PAGE_USER,
+                                             UVMF_INVLPG);
             if ( rc )
                 panic("update_va_mapping(%p, 0x%016"PRIx64") failed: %d\n",
                       _p(va), l1[i1] | _PAGE_USER, rc);
index 302e20a444ffc933789ed0a8d51b8f8a144b970b..3c3876d7cf97595b54349de3c5886ec4790d60e2 100644 (file)
@@ -240,6 +240,21 @@ struct mmuext_op {
 typedef struct mmuext_op mmuext_op_t;
 #endif
 
+/* These are passed as 'flags' to update_va_mapping. They can be ORed. */
+/* When specifying UVMF_MULTI, also OR in a pointer to a CPU bitmap.   */
+/* UVMF_LOCAL is merely UVMF_MULTI with a NULL bitmap pointer.         */
+#ifndef __ASSEMBLY__
+enum XEN_UVMF {
+    UVMF_NONE             = 0 << 0, /* No flushing at all.   */
+    UVMF_TLB_FLUSH        = 1 << 0, /* Flush entire TLB(s).  */
+    UVMF_INVLPG           = 2 << 0, /* Flush only one entry. */
+    UVMF_FLUSHTYPE_MASK   = 3 << 0,
+    UVMF_MULTI            = 0 << 2, /* Flush subset of TLBs. */
+    UVMF_LOCAL            = 0 << 2, /* Flush local TLB.      */
+    UVMF_ALL              = 1 << 2, /* Flush all TLBs.       */
+};
+#endif
+
 #endif /* XEN_PUBLIC_XEN_H */
 
 /*
index dd3285b9675b97d6ee27727825833087f4a57877..a37ebc2d257d9318b8d249300ab70b266bde6811 100644 (file)
@@ -70,7 +70,7 @@ static inline long hypercall_xen_version(unsigned cmd, void *arg)
 }
 
 static inline long hypercall_update_va_mapping(void *va, uint64_t npte,
-                                               unsigned int flags)
+                                               enum XEN_UVMF flags)
 {
 #ifdef __x86_64__
     return HYPERCALL3(long, __HYPERVISOR_update_va_mapping, va, npte, flags);