[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2] vvmx: replace vmreturn() by vmsucceed() and vmfail*()



On 12/15/16 12:18 +0000, Andrew Cooper wrote:
On 15/12/16 12:06, Haozhong Zhang wrote:
Replace vmreturn() by vmsucceed(), vmfail(), vmfail_valid() and
vmfail_invalid(), which are consistent to the pseudo code on Intel
SDM, and allow to return VM instruction error numbers to L1
hypervisor.

Signed-off-by: Haozhong Zhang <haozhong.zhang@xxxxxxxxx>
---
Changes in v2:
 * Fix the incorrect eflags in vmfail_invalid().
---
 xen/arch/x86/hvm/vmx/vvmx.c        | 107 +++++++++++++++++++++----------------
 xen/include/asm-x86/hvm/vmx/vmcs.h |  15 ++++--
 2 files changed, 74 insertions(+), 48 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index c4f19a0..361620d 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -479,28 +479,37 @@ gp_fault:
     return X86EMUL_EXCEPTION;
 }

-static void vmreturn(struct cpu_user_regs *regs, enum vmx_ops_result ops_res)
+#define VMSUCCEED_EFLAGS_MASK \
+    (X86_EFLAGS_CF | X86_EFLAGS_PF | X86_EFLAGS_AF | \
+     X86_EFLAGS_ZF | X86_EFLAGS_SF | X86_EFLAGS_OF)

Apologies to nitpick, but this these aren't vmx specific, and we have
had a similar patten in the x86 instruction emulator.

Would you mind incorporating:

andrewcoop@andrewcoop:/local/xen.git/xen$ git diff
diff --git a/xen/include/asm-x86/processor.h
b/xen/include/asm-x86/processor.h
index eae4af2..01fc446 100644
--- a/xen/include/asm-x86/processor.h
+++ b/xen/include/asm-x86/processor.h
@@ -53,6 +53,10 @@
#define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */
#define X86_EFLAGS_ID  0x00200000 /* CPUID detection flag */

+#define X86_EFLAGS_ARITH_MASK                           \
+    ((X86_EFLAGS_CF | X86_EFLAGS_PF | X86_EFLAGS_AF |   \
+      X86_EFLAGS_ZF | X86_EFLAGS_SF | X86_EFLAGS_OF))
+

Sure. And any reason to use double parentheses?

Haozhong

/*
 * Intel CPU flags in CR0
 */

and using that?  If so, Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

~Andrew

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.