aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2010-11-01 09:35:01 -0400
committerAvi Kivity <avi@redhat.com>2011-01-12 04:28:53 -0500
commitec25d5e66ee152e371fd7046f3f8441859579aea (patch)
tree5edb00a4f7cb73758492efc7b013e17e841fdd7e /arch
parent2eec73437487aa690882cafddca6e4d93df46f26 (diff)
KVM: handle exit due to INVD in VMX
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> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/include/asm/vmx.h1
-rw-r--r--arch/x86/kvm/vmx.c6
2 files changed, 7 insertions, 0 deletions
diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
index 9f0cbd987d50..42d959056f97 100644
--- a/arch/x86/include/asm/vmx.h
+++ b/arch/x86/include/asm/vmx.h
@@ -239,6 +239,7 @@ enum vmcs_field {
239#define EXIT_REASON_TASK_SWITCH 9 239#define EXIT_REASON_TASK_SWITCH 9
240#define EXIT_REASON_CPUID 10 240#define EXIT_REASON_CPUID 10
241#define EXIT_REASON_HLT 12 241#define EXIT_REASON_HLT 12
242#define EXIT_REASON_INVD 13
242#define EXIT_REASON_INVLPG 14 243#define EXIT_REASON_INVLPG 14
243#define EXIT_REASON_RDPMC 15 244#define EXIT_REASON_RDPMC 15
244#define EXIT_REASON_RDTSC 16 245#define EXIT_REASON_RDTSC 16
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index e42727b305cb..12c30733e239 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3349,6 +3349,11 @@ static int handle_vmx_insn(struct kvm_vcpu *vcpu)
3349 return 1; 3349 return 1;
3350} 3350}
3351 3351
3352static int handle_invd(struct kvm_vcpu *vcpu)
3353{
3354 return emulate_instruction(vcpu, 0, 0, 0) == EMULATE_DONE;
3355}
3356
3352static int handle_invlpg(struct kvm_vcpu *vcpu) 3357static int handle_invlpg(struct kvm_vcpu *vcpu)
3353{ 3358{
3354 unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION); 3359 unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
@@ -3649,6 +3654,7 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = {
3649 [EXIT_REASON_MSR_WRITE] = handle_wrmsr, 3654 [EXIT_REASON_MSR_WRITE] = handle_wrmsr,
3650 [EXIT_REASON_PENDING_INTERRUPT] = handle_interrupt_window, 3655 [EXIT_REASON_PENDING_INTERRUPT] = handle_interrupt_window,
3651 [EXIT_REASON_HLT] = handle_halt, 3656 [EXIT_REASON_HLT] = handle_halt,
3657 [EXIT_REASON_INVD] = handle_invd,
3652 [EXIT_REASON_INVLPG] = handle_invlpg, 3658 [EXIT_REASON_INVLPG] = handle_invlpg,
3653 [EXIT_REASON_VMCALL] = handle_vmcall, 3659 [EXIT_REASON_VMCALL] = handle_vmcall,
3654 [EXIT_REASON_VMCLEAR] = handle_vmx_insn, 3660 [EXIT_REASON_VMCLEAR] = handle_vmx_insn,