KVM: s390: irq delivery should not rely on icptcode
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Wed, 4 Nov 2015 15:46:55 +0000 (16:46 +0100)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Wed, 10 Feb 2016 12:12:53 +0000 (13:12 +0100)
Program irq injection during program irq intercepts is the last candidates
that injects nullifying irqs and relies on delivery to do the right thing.

As we should not rely on the icptcode during any delivery (because that
value will not be migrated), let's add a flag, telling prog IRQ delivery
to not rewind the PSW in case of nullifying prog IRQs.

Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/s390/kvm/intercept.c
arch/s390/kvm/interrupt.c
include/uapi/linux/kvm.h

index 6b4e5b5ff06cac8d9c65084b10f7f98e3b084d5c..2e6b54e4d3f955d1c7971fce4ad02551eeac3846 100644 (file)
@@ -140,6 +140,8 @@ static int inject_prog_on_prog_intercept(struct kvm_vcpu *vcpu)
 {
        struct kvm_s390_pgm_info pgm_info = {
                .code = vcpu->arch.sie_block->iprcc,
+               /* the PSW has already been rewound */
+               .flags = KVM_S390_PGM_FLAGS_NO_REWIND,
        };
 
        switch (vcpu->arch.sie_block->iprcc & ~PGM_PER) {
index e594a783002223d00716cc471b47038c77246896..87e2d1a89d74eaba5e398392ee2bcd86cdbb0acb 100644 (file)
@@ -665,7 +665,7 @@ static int __must_check __deliver_prog(struct kvm_vcpu *vcpu)
                                   (u8 *) __LC_PER_ACCESS_ID);
        }
 
-       if (nullifying && vcpu->arch.sie_block->icptcode == ICPT_INST)
+       if (nullifying && !(pgm_info.flags & KVM_S390_PGM_FLAGS_NO_REWIND))
                kvm_s390_rewind_psw(vcpu, ilen);
 
        /* bit 1+2 of the target are the ilc, so we can directly use ilen */
index 4e20a40bb10f5578bac320db593c3a59cc5ed911..a2fe0ac1d61ac89dcbd950db16f1224b9fd1625e 100644 (file)
@@ -545,6 +545,7 @@ struct kvm_s390_pgm_info {
 #define KVM_S390_PGM_FLAGS_ILC_0       0x02
 #define KVM_S390_PGM_FLAGS_ILC_1       0x04
 #define KVM_S390_PGM_FLAGS_ILC_MASK    0x06
+#define KVM_S390_PGM_FLAGS_NO_REWIND   0x08
        __u8 flags;
        __u8 pad[2];
 };