Do not call __deliver_io() for adapter interruptions already pending in the IPM. That is a double effort. They will be processed as soon the vcpu control is given to SIE. Signed-off-by: Michael Mueller <mimu@xxxxxxxxxxxxx> --- arch/s390/kvm/interrupt.c | 54 ++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c index fcb55b02990e..1f4c0c7286f7 100644 --- a/arch/s390/kvm/interrupt.c +++ b/arch/s390/kvm/interrupt.c @@ -271,14 +271,9 @@ static unsigned long disable_iscs(struct kvm_vcpu *vcpu, return active_mask; } -static unsigned long deliverable_irqs(struct kvm_vcpu *vcpu) +static unsigned long __deliverable_irqs(struct kvm_vcpu *vcpu, + unsigned long active_mask) { - unsigned long active_mask; - - active_mask = pending_irqs(vcpu); - if (!active_mask) - return 0; - if (psw_extint_disabled(vcpu)) active_mask &= ~IRQ_PEND_EXT_MASK; if (psw_ioint_disabled(vcpu)) @@ -315,6 +310,28 @@ static unsigned long deliverable_irqs(struct kvm_vcpu *vcpu) return active_mask; } +static unsigned long deliverable_irqs_no_gisa(struct kvm_vcpu *vcpu) +{ + unsigned long active_mask; + + active_mask = pending_irqs_no_gisa(vcpu); + if (!active_mask) + return 0; + + return __deliverable_irqs(vcpu, active_mask); +} + +static unsigned long deliverable_irqs(struct kvm_vcpu *vcpu) +{ + unsigned long active_mask; + + active_mask = pending_irqs(vcpu); + if (!active_mask) + return 0; + + return __deliverable_irqs(vcpu, active_mask); +} + static void __set_cpu_idle(struct kvm_vcpu *vcpu) { kvm_s390_set_cpuflags(vcpu, CPUSTAT_WAIT); @@ -957,7 +974,6 @@ static int __must_check __deliver_io(struct kvm_vcpu *vcpu, struct list_head *isc_list; struct kvm_s390_float_interrupt *fi; struct kvm_s390_interrupt_info *inti = NULL; - struct kvm_s390_io_info io; u32 isc; int rc = 0; @@ -995,28 +1011,8 @@ static int __must_check __deliver_io(struct kvm_vcpu *vcpu, if (inti) { rc = __do_deliver_io(vcpu, &(inti->io)); kfree(inti); - goto out; } - if (vcpu->kvm->arch.gisa && - kvm_s390_gisa_tac_ipm_gisc(vcpu->kvm->arch.gisa, isc)) { - /* - * in case an adapter interrupt was not delivered - * in SIE context KVM will handle the delivery - */ - VCPU_EVENT(vcpu, 4, "%s isc %u", "deliver: I/O (AI/gisa)", isc); - memset(&io, 0, sizeof(io)); - io.io_int_word = isc_to_int_word(isc); - vcpu->stat.deliver_io++; - trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, - KVM_S390_INT_IO(1, 0, 0, 0), - ((__u32)io.subchannel_id << 16) | - io.subchannel_nr, - ((__u64)io.io_int_parm << 32) | - io.io_int_word); - rc = __do_deliver_io(vcpu, &io); - } -out: return rc; } @@ -1205,7 +1201,7 @@ int __must_check kvm_s390_deliver_pending_interrupts(struct kvm_vcpu *vcpu) if (cpu_timer_irq_pending(vcpu)) set_bit(IRQ_PEND_EXT_CPU_TIMER, &li->pending_irqs); - while ((irqs = deliverable_irqs(vcpu)) && !rc) { + while ((irqs = deliverable_irqs_no_gisa(vcpu)) && !rc) { /* bits are in the reverse order of interrupt priority */ irq_type = find_last_bit(&irqs, IRQ_PEND_COUNT); switch (irq_type) { -- 2.13.4