diff options
author | Mihai Caraman <mihai.caraman@freescale.com> | 2014-07-23 12:06:21 -0400 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2014-07-28 09:23:14 -0400 |
commit | 51f047261e717b74b226f837a16455994b61ae30 (patch) | |
tree | e94a57703fed176a72acef425cea442a8395746b /arch/powerpc/kvm/powerpc.c | |
parent | 9a26af64d6bba72c9dfd62cc0cab0e79f8a66d7b (diff) |
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/powerpc.c')
-rw-r--r-- | arch/powerpc/kvm/powerpc.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index fe0257a8e335..cfa6cfabf4a3 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -280,6 +280,9 @@ int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu) | |||
280 | * actually modified. */ | 280 | * actually modified. */ |
281 | r = RESUME_GUEST_NV; | 281 | r = RESUME_GUEST_NV; |
282 | break; | 282 | break; |
283 | case EMULATE_AGAIN: | ||
284 | r = RESUME_GUEST; | ||
285 | break; | ||
283 | case EMULATE_DO_MMIO: | 286 | case EMULATE_DO_MMIO: |
284 | run->exit_reason = KVM_EXIT_MMIO; | 287 | run->exit_reason = KVM_EXIT_MMIO; |
285 | /* We must reload nonvolatiles because "update" load/store | 288 | /* We must reload nonvolatiles because "update" load/store |
@@ -289,11 +292,15 @@ int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu) | |||
289 | r = RESUME_HOST_NV; | 292 | r = RESUME_HOST_NV; |
290 | break; | 293 | break; |
291 | case EMULATE_FAIL: | 294 | case EMULATE_FAIL: |
295 | { | ||
296 | u32 last_inst; | ||
297 | |||
298 | kvmppc_get_last_inst(vcpu, false, &last_inst); | ||
292 | /* XXX Deliver Program interrupt to guest. */ | 299 | /* XXX Deliver Program interrupt to guest. */ |
293 | printk(KERN_EMERG "%s: emulation failed (%08x)\n", __func__, | 300 | pr_emerg("%s: emulation failed (%08x)\n", __func__, last_inst); |
294 | kvmppc_get_last_inst(vcpu)); | ||
295 | r = RESUME_HOST; | 301 | r = RESUME_HOST; |
296 | break; | 302 | break; |
303 | } | ||
297 | default: | 304 | default: |
298 | WARN_ON(1); | 305 | WARN_ON(1); |
299 | r = RESUME_GUEST; | 306 | r = RESUME_GUEST; |