From: Andrew Cooper Date: Fri, 15 Jul 2016 09:02:29 +0000 (+0100) Subject: Add Xen ABI for update_va_mapping flags, and replace opencoded constants X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=8f9955a48326d067bf0f18079755dc961eaa499d;p=xtf.git Add Xen ABI for update_va_mapping flags, and replace opencoded constants Signed-off-by: Andrew Cooper --- diff --git a/arch/x86/pv/traps.c b/arch/x86/pv/traps.c index 392459a..fa741b3 100644 --- a/arch/x86/pv/traps.c +++ b/arch/x86/pv/traps.c @@ -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); diff --git a/include/xen/xen.h b/include/xen/xen.h index 302e20a..3c3876d 100644 --- a/include/xen/xen.h +++ b/include/xen/xen.h @@ -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 */ /* diff --git a/include/xtf/hypercall.h b/include/xtf/hypercall.h index dd3285b..a37ebc2 100644 --- a/include/xtf/hypercall.h +++ b/include/xtf/hypercall.h @@ -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);