summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/book3s.c
diff options
context:
space:
mode:
authorMihai Caraman <mihai.caraman@freescale.com>2014-07-23 19:06:21 +0300
committerAlexander Graf <agraf@suse.de>2014-07-28 15:23:14 +0200
commit51f047261e717b74b226f837a16455994b61ae30 (patch)
treee94a57703fed176a72acef425cea442a8395746b /arch/powerpc/kvm/book3s.c
parent9a26af64d6bba72c9dfd62cc0cab0e79f8a66d7b (diff)
downloadlinux-stable-51f047261e717b74b226f837a16455994b61ae30.tar.gz
linux-stable-51f047261e717b74b226f837a16455994b61ae30.tar.bz2
linux-stable-51f047261e717b74b226f837a16455994b61ae30.zip
KVM: PPC: Allow kvmppc_get_last_inst() to fail
On book3e, guest last instruction is read on the exit path using load external pid (lwepx) dedicated instruction. This load operation may fail due to TLB eviction and execute-but-not-read entries. This patch lay down the path for an alternative solution to read the guest last instruction, by allowing kvmppc_get_lat_inst() function to fail. Architecture specific implmentations of kvmppc_load_last_inst() may read last guest instruction and instruct the emulation layer to re-execute the guest in case of failure. Make kvmppc_get_last_inst() definition common between architectures. Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm/book3s.c')
-rw-r--r--arch/powerpc/kvm/book3s.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 31facfc1314b..37ca8a0897c3 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -488,6 +488,23 @@ mmio:
}
EXPORT_SYMBOL_GPL(kvmppc_ld);
+int kvmppc_load_last_inst(struct kvm_vcpu *vcpu, enum instruction_type type,
+ u32 *inst)
+{
+ ulong pc = kvmppc_get_pc(vcpu);
+ int r;
+
+ if (type == INST_SC)
+ pc -= 4;
+
+ r = kvmppc_ld(vcpu, &pc, sizeof(u32), inst, false);
+ if (r == EMULATE_DONE)
+ return r;
+ else
+ return EMULATE_AGAIN;
+}
+EXPORT_SYMBOL_GPL(kvmppc_load_last_inst);
+
int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
{
return 0;