Re: [PATCH 2/6] Nested VMX patch 2 implements vmclear
Avi Kivity a...@redhat.com wrote on 02/09/2009 22:38:22: From: Avi Kivity a...@redhat.com To: Orit Wasserman/Haifa/i...@ibmil Cc: kvm@vger.kernel.org, Ben-Ami Yassour1/Haifa/i...@ibmil, Muli Ben- Yehuda/Haifa/i...@ibmil, Abel Gordon/Haifa/i...@ibmil, aligu...@us.ibm.com, mm...@us.ibm.com Date: 02/09/2009 23:01 Subject: Re: [PATCH 2/6] Nested VMX patch 2 implements vmclear On 09/02/2009 06:38 PM, or...@il.ibm.com wrote: From: Orit Wassermanor...@il.ibm.com --- arch/x86/kvm/vmx.c | 24 +++- 1 files changed, 23 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index abba325..2b1fc3b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -70,6 +70,8 @@ struct vmcs { struct nested_vmx { /* Has the level1 guest done vmon? */ bool vmon; + /* Has the level1 guest done vmclear? */ + bool vmclear; }; Doesn't seem these two belong in the same structure - vmclear is per-vmcs... but you're probably aware of that with the multi-guest support coming. You are right vmclear flag is part of the L2 guest state. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/6] Nested VMX patch 2 implements vmclear
From: Orit Wasserman or...@il.ibm.com --- arch/x86/kvm/vmx.c | 24 +++- 1 files changed, 23 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index abba325..2b1fc3b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -70,6 +70,8 @@ struct vmcs { struct nested_vmx { /* Has the level1 guest done vmon? */ bool vmon; + /* Has the level1 guest done vmclear? */ + bool vmclear; }; struct vcpu_vmx { @@ -3229,6 +3231,26 @@ static int nested_vmx_check_permission(struct kvm_vcpu *vcpu) return 1; } +static void clear_rflags_cf_zf(struct kvm_vcpu *vcpu) +{ + unsigned long rflags; + rflags = vmx_get_rflags(vcpu); + rflags = ~(X86_EFLAGS_CF | X86_EFLAGS_ZF); + vmx_set_rflags(vcpu, rflags); +} + +static int handle_vmclear(struct kvm_vcpu *vcpu) +{ + if (!nested_vmx_check_permission(vcpu)) + return 1; + + to_vmx(vcpu)-nested.vmclear = 1; + + skip_emulated_instruction(vcpu); + clear_rflags_cf_zf(vcpu); + + return 1; +} static int handle_vmx_insn(struct kvm_vcpu *vcpu) { @@ -3552,7 +3574,7 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = { [EXIT_REASON_HLT] = handle_halt, [EXIT_REASON_INVLPG] = handle_invlpg, [EXIT_REASON_VMCALL] = handle_vmcall, - [EXIT_REASON_VMCLEAR] = handle_vmx_insn, + [EXIT_REASON_VMCLEAR] = handle_vmclear, [EXIT_REASON_VMLAUNCH]= handle_vmx_insn, [EXIT_REASON_VMPTRLD] = handle_vmx_insn, [EXIT_REASON_VMPTRST] = handle_vmx_insn, -- 1.6.0.4 -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/6] Nested VMX patch 2 implements vmclear
On 09/02/2009 06:38 PM, or...@il.ibm.com wrote: From: Orit Wassermanor...@il.ibm.com --- arch/x86/kvm/vmx.c | 24 +++- 1 files changed, 23 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index abba325..2b1fc3b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -70,6 +70,8 @@ struct vmcs { struct nested_vmx { /* Has the level1 guest done vmon? */ bool vmon; + /* Has the level1 guest done vmclear? */ + bool vmclear; }; Doesn't seem these two belong in the same structure - vmclear is per-vmcs... but you're probably aware of that with the multi-guest support coming. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html