From: Joerg Roedel on
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(a)amd.com>
---
arch/x86/kvm/emulate.c | 2 +-
arch/x86/kvm/x86.c | 4 ++++
2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 171e1c7..bb90307 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -1260,7 +1260,7 @@ done_prefixes:
}

done:
- return (rc == X86EMUL_UNHANDLEABLE) ? -1 : 0;
+ return rc;
}

static int pio_in_emulated(struct x86_emulate_ctxt *ctxt,
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 4d3a698..d159319 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3856,6 +3856,10 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
? X86EMUL_MODE_PROT32 : X86EMUL_MODE_PROT16;

r = x86_decode_insn(&vcpu->arch.emulate_ctxt, &emulate_ops);
+ if (r == X86EMUL_PROPAGATE_FAULT) {
+ kvm_propagate_fault(vcpu);
+ return EMULATE_DONE;
+ }
trace_kvm_emulate_insn_start(vcpu);

/* Only allow emulation of specific instructions on #UD
--
1.7.0.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/