* [PATCHv2] KVM: handle exit due to INVD in VMX
@ 2010-11-01 13:35 Gleb Natapov
2010-11-01 17:58 ` Marcelo Tosatti
0 siblings, 1 reply; 2+ messages in thread
From: Gleb Natapov @ 2010-11-01 13:35 UTC (permalink / raw)
To: mtosatti, avi; +Cc: kvm
Currently the exit is unhandled, so guest halts with error if it tries
to execute INVD instruction. Call into emulator when INVD instruction
is executed by a guest instead. This instruction is not needed by ordinary
guests, but firmware (like OpenBIOS) use it and fail.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
ChangeLog:
v1->v2
- New and improved patch description
diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
index 9f0cbd9..42d9590 100644
--- a/arch/x86/include/asm/vmx.h
+++ b/arch/x86/include/asm/vmx.h
@@ -239,6 +239,7 @@ enum vmcs_field {
#define EXIT_REASON_TASK_SWITCH 9
#define EXIT_REASON_CPUID 10
#define EXIT_REASON_HLT 12
+#define EXIT_REASON_INVD 13
#define EXIT_REASON_INVLPG 14
#define EXIT_REASON_RDPMC 15
#define EXIT_REASON_RDTSC 16
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 993e332..200533e 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3350,6 +3350,11 @@ static int handle_vmx_insn(struct kvm_vcpu *vcpu)
return 1;
}
+static int handle_invd(struct kvm_vcpu *vcpu)
+{
+ return emulate_instruction(vcpu, 0, 0, 0) == EMULATE_DONE;
+}
+
static int handle_invlpg(struct kvm_vcpu *vcpu)
{
unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
@@ -3650,6 +3655,7 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = {
[EXIT_REASON_MSR_WRITE] = handle_wrmsr,
[EXIT_REASON_PENDING_INTERRUPT] = handle_interrupt_window,
[EXIT_REASON_HLT] = handle_halt,
+ [EXIT_REASON_INVD] = handle_invd,
[EXIT_REASON_INVLPG] = handle_invlpg,
[EXIT_REASON_VMCALL] = handle_vmcall,
[EXIT_REASON_VMCLEAR] = handle_vmx_insn,
--
Gleb.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCHv2] KVM: handle exit due to INVD in VMX
2010-11-01 13:35 [PATCHv2] KVM: handle exit due to INVD in VMX Gleb Natapov
@ 2010-11-01 17:58 ` Marcelo Tosatti
0 siblings, 0 replies; 2+ messages in thread
From: Marcelo Tosatti @ 2010-11-01 17:58 UTC (permalink / raw)
To: Gleb Natapov; +Cc: avi, kvm
On Mon, Nov 01, 2010 at 03:35:01PM +0200, Gleb Natapov wrote:
> Currently the exit is unhandled, so guest halts with error if it tries
> to execute INVD instruction. Call into emulator when INVD instruction
> is executed by a guest instead. This instruction is not needed by ordinary
> guests, but firmware (like OpenBIOS) use it and fail.
>
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> ---
> ChangeLog:
> v1->v2
> - New and improved patch description
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-11-01 18:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-01 13:35 [PATCHv2] KVM: handle exit due to INVD in VMX Gleb Natapov
2010-11-01 17:58 ` Marcelo Tosatti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox