summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorJoerg Roedel2010-09-10 17:30:56 +0200
committerAvi Kivity2010-10-24 10:52:41 +0200
commitd47f00a62b2e14b4a811b87bdb9ea1809693a377 (patch)
tree85f0697d0714818c8f0d92047905782f275c9ce3 /arch/x86/kvm/x86.c
parentKVM: MMU: Propagate the right fault back to the guest after gva_to_gpa (diff)
downloadkernel-qcow2-linux-d47f00a62b2e14b4a811b87bdb9ea1809693a377.tar.gz
kernel-qcow2-linux-d47f00a62b2e14b4a811b87bdb9ea1809693a377.tar.xz
kernel-qcow2-linux-d47f00a62b2e14b4a811b87bdb9ea1809693a377.zip
KVM: X86: Propagate fetch faults
KVM currently ignores fetch faults in the instruction emulator. With nested-npt we could have such faults. This patch adds the code to handle these. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 0281d920e9ed..3101060033ae 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4247,6 +4247,9 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
vcpu->arch.emulate_ctxt.perm_ok = false;
r = x86_decode_insn(&vcpu->arch.emulate_ctxt);
+ if (r == X86EMUL_PROPAGATE_FAULT)
+ goto done;
+
trace_kvm_emulate_insn_start(vcpu);
/* Only allow emulation of specific instructions on #UD
@@ -4305,6 +4308,7 @@ restart:
return handle_emulation_failure(vcpu);
}
+done:
if (vcpu->arch.emulate_ctxt.exception >= 0) {
inject_emulated_exception(vcpu);
r = EMULATE_DONE;