Re: [Xen-devel] [PATCH v4 1/3] x86/vmx: introduce VMX_INSN_SUCCEED

2017-02-13 Thread Tian, Kevin
> From: Sergey Dyasli [mailto:sergey.dya...@citrix.com]
> Sent: Monday, February 13, 2017 10:21 PM
> 
> 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 

Acked-by: Kevin Tian 

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v4 1/3] x86/vmx: introduce VMX_INSN_SUCCEED

2017-02-13 Thread Jan Beulich
>>> On 13.02.17 at 15:21,  wrote:
> 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 



___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v4 1/3] x86/vmx: introduce VMX_INSN_SUCCEED

2017-02-13 Thread Sergey Dyasli
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 
---
 xen/arch/x86/hvm/vmx/vvmx.c| 3 +++
 xen/include/asm-x86/hvm/vmx/vmcs.h | 1 +
 xen/include/asm-x86/hvm/vmx/vmx.h  | 4 ++--
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 9c61b5b..7172621 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 3eb11e7..005e7e1 100644
--- a/xen/include/asm-x86/hvm/vmx/vmcs.h
+++ b/xen/include/asm-x86/hvm/vmx/vmcs.h
@@ -514,6 +514,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 f4183d9..17e6342 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",
-- 
2.9.3


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel