提交 ec25d5e6 编写于 作者: G Gleb Natapov 提交者: Avi Kivity

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: NGleb Natapov <gleb@redhat.com>
Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
上级 2eec7343
...@@ -239,6 +239,7 @@ enum vmcs_field { ...@@ -239,6 +239,7 @@ enum vmcs_field {
#define EXIT_REASON_TASK_SWITCH 9 #define EXIT_REASON_TASK_SWITCH 9
#define EXIT_REASON_CPUID 10 #define EXIT_REASON_CPUID 10
#define EXIT_REASON_HLT 12 #define EXIT_REASON_HLT 12
#define EXIT_REASON_INVD 13
#define EXIT_REASON_INVLPG 14 #define EXIT_REASON_INVLPG 14
#define EXIT_REASON_RDPMC 15 #define EXIT_REASON_RDPMC 15
#define EXIT_REASON_RDTSC 16 #define EXIT_REASON_RDTSC 16
......
...@@ -3349,6 +3349,11 @@ static int handle_vmx_insn(struct kvm_vcpu *vcpu) ...@@ -3349,6 +3349,11 @@ static int handle_vmx_insn(struct kvm_vcpu *vcpu)
return 1; 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) static int handle_invlpg(struct kvm_vcpu *vcpu)
{ {
unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION); unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
...@@ -3649,6 +3654,7 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = { ...@@ -3649,6 +3654,7 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = {
[EXIT_REASON_MSR_WRITE] = handle_wrmsr, [EXIT_REASON_MSR_WRITE] = handle_wrmsr,
[EXIT_REASON_PENDING_INTERRUPT] = handle_interrupt_window, [EXIT_REASON_PENDING_INTERRUPT] = handle_interrupt_window,
[EXIT_REASON_HLT] = handle_halt, [EXIT_REASON_HLT] = handle_halt,
[EXIT_REASON_INVD] = handle_invd,
[EXIT_REASON_INVLPG] = handle_invlpg, [EXIT_REASON_INVLPG] = handle_invlpg,
[EXIT_REASON_VMCALL] = handle_vmcall, [EXIT_REASON_VMCALL] = handle_vmcall,
[EXIT_REASON_VMCLEAR] = handle_vmx_insn, [EXIT_REASON_VMCLEAR] = handle_vmx_insn,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册