summaryrefslogtreecommitdiffstats
path: root/arch/s390/kvm/kvm-s390.c
diff options
context:
space:
mode:
authorDavid Hildenbrand2016-01-12 17:40:54 +0100
committerChristian Borntraeger2016-02-10 13:12:54 +0100
commit9b0d721a07a2d92c79362dda8e6d896b2c107ce6 (patch)
tree29e60dd05d596536633ea7788b39f24ab73899a1 /arch/s390/kvm/kvm-s390.c
parentKVM: s390: provide prog irq ilc on SIE faults (diff)
downloadkernel-qcow2-linux-9b0d721a07a2d92c79362dda8e6d896b2c107ce6.tar.gz
kernel-qcow2-linux-9b0d721a07a2d92c79362dda8e6d896b2c107ce6.tar.xz
kernel-qcow2-linux-9b0d721a07a2d92c79362dda8e6d896b2c107ce6.zip
KVM: s390: instruction-fetching exceptions on SIE faults
On instruction-fetch exceptions, we have to forward the PSW by any valid ilc and correctly use that ilc when injecting the irq. Injection will already take care of rewinding the PSW if we injected a nullifying program irq, so we don't need special handling prior to injection. Until now, autodetection would have guessed an ilc of 0. Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'arch/s390/kvm/kvm-s390.c')
-rw-r--r--arch/s390/kvm/kvm-s390.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 12cec63eda27..d0dcf73f36bc 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -2181,9 +2181,17 @@ static int vcpu_post_run_fault_in_sie(struct kvm_vcpu *vcpu)
* to be able to forward the PSW.
*/
rc = read_guest_instr(vcpu, &opcode, 1);
- if (rc)
- return kvm_s390_inject_prog_cond(vcpu, rc);
ilen = insn_length(opcode);
+ if (rc < 0) {
+ return rc;
+ } else if (rc) {
+ /* Instruction-Fetching Exceptions - we can't detect the ilen.
+ * Forward by arbitrary ilc, injection will take care of
+ * nullification if necessary.
+ */
+ pgm_info = vcpu->arch.pgm;
+ ilen = 4;
+ }
pgm_info.flags = ilen | KVM_S390_PGM_FLAGS_ILC_VALID;
kvm_s390_forward_psw(vcpu, ilen);
return kvm_s390_inject_prog_irq(vcpu, &pgm_info);