From: Sergey Dyasli Date: Mon, 13 Feb 2017 14:21:08 +0000 (+0000) Subject: x86/vmx: introduce VMX_INSN_SUCCEED X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~2799 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=195ca0e1de85163cb6a5d547d424f3f7c70f40d3;p=xen.git x86/vmx: introduce VMX_INSN_SUCCEED The new value corresponds to VMsucceed status of VMX instructions. This will replace usage of literal zeroes in related functions. Update vmfail(), vmread_safe() and vmwrite_safe(). Signed-off-by: Sergey Dyasli Reviewed-by: Jan Beulich Acked-by: Kevin Tian --- diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index 9c61b5bbac..7172621a41 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -483,6 +483,9 @@ static void vmfail_invalid(struct cpu_user_regs *regs) static void vmfail(struct cpu_user_regs *regs, enum vmx_insn_errno errno) { + if ( errno == VMX_INSN_SUCCEED ) + return; + if ( vcpu_nestedhvm(current).nv_vvmcxaddr != INVALID_PADDR && errno != VMX_INSN_FAIL_INVALID ) vmfail_valid(regs, errno); diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/asm-x86/hvm/vmx/vmcs.h index b6b665b77f..35b0430942 100644 --- a/xen/include/asm-x86/hvm/vmx/vmcs.h +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h @@ -513,6 +513,7 @@ enum vmcs_field { /* VM Instruction error numbers */ enum vmx_insn_errno { + VMX_INSN_SUCCEED = 0, VMX_INSN_VMCLEAR_INVALID_PHYADDR = 2, VMX_INSN_VMLAUNCH_NONCLEAR_VMCS = 4, VMX_INSN_VMRESUME_NONLAUNCHED_VMCS = 5, diff --git a/xen/include/asm-x86/hvm/vmx/vmx.h b/xen/include/asm-x86/hvm/vmx/vmx.h index f4183d9615..17e6342402 100644 --- a/xen/include/asm-x86/hvm/vmx/vmx.h +++ b/xen/include/asm-x86/hvm/vmx/vmx.h @@ -404,7 +404,7 @@ static always_inline void __vmwrite(unsigned long field, unsigned long value) static inline enum vmx_insn_errno vmread_safe(unsigned long field, unsigned long *value) { - unsigned long ret = 0; + unsigned long ret = VMX_INSN_SUCCEED; bool fail_invalid, fail_valid; asm volatile ( GAS_VMX_OP("vmread %[field], %[value]\n\t", @@ -427,7 +427,7 @@ static inline enum vmx_insn_errno vmread_safe(unsigned long field, static inline enum vmx_insn_errno vmwrite_safe(unsigned long field, unsigned long value) { - unsigned long ret = 0; + unsigned long ret = VMX_INSN_SUCCEED; bool fail_invalid, fail_valid; asm volatile ( GAS_VMX_OP("vmwrite %[value], %[field]\n\t",