KVM: s390: add GISA interrupts to FLIC ioctl interface

"Linux Kernel Mailing List" <[email protected]> Sat, 10 Feb 2018 22:00:23 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/24160af6cb289ace9bde980b33d11713c8fc8192
Commit:     24160af6cb289ace9bde980b33d11713c8fc8192
Parent:     2496c8e7fe9270bde5e125729c193120e7fa8c67
Refname:    refs/heads/master
Author:     Michael Mueller <[email protected]>
AuthorDate: Wed Jun 14 13:21:32 2017 +0200
Committer:  Christian Borntraeger <[email protected]>
CommitDate: Fri Jan 26 11:12:10 2018 +0100

    KVM: s390: add GISA interrupts to FLIC ioctl interface
    
    Pending interrupts marked in the GISA IPM are required to
    become part of the answer of ioctl KVM_DEV_FLIC_GET_ALL_IRQS.
    
    The ioctl KVM_DEV_FLIC_ENQUEUE is already capable to enqueue
    adapter interrupts when a GISA is present.
    
    With ioctl KVM_DEV_FLIC_CLEAR_IRQS the GISA IPM wil be cleared
    now as well.
    
    Signed-off-by: Michael Mueller <[email protected]>
    Reviewed-by: Halil Pasic <[email protected]>
    Reviewed-by: Pierre Morel <[email protected]>
    Reviewed-by: Christian Borntraeger <[email protected]>
    Reviewed-by: Cornelia Huck <[email protected]>
    Signed-off-by: Christian Borntraeger <[email protected]>
---
 arch/s390/kvm/interrupt.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index a0ded3a23a5e..dd4c50b82a53 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -1879,6 +1879,7 @@ void kvm_s390_clear_float_irqs(struct kvm *kvm)
 	for (i = 0; i < FIRQ_MAX_COUNT; i++)
 		fi->counters[i] = 0;
 	spin_unlock(&fi->lock);
+	kvm_s390_gisa_clear(kvm);
 };
 
 static int get_all_floating_irqs(struct kvm *kvm, u8 __user *usrbuf, u64 len)
@@ -1906,6 +1907,22 @@ static int get_all_floating_irqs(struct kvm *kvm, u8 __user *usrbuf, u64 len)
 
 	max_irqs = len / sizeof(struct kvm_s390_irq);
 
+	if (kvm->arch.gisa &&
+	    kvm_s390_gisa_get_ipm(kvm->arch.gisa)) {
+		for (i = 0; i <= MAX_ISC; i++) {
+			if (n == max_irqs) {
+				/* signal userspace to try again */
+				ret = -ENOMEM;
+				goto out_nolock;
+			}
+			if (kvm_s390_gisa_tac_ipm_gisc(kvm->arch.gisa, i)) {
+				irq = (struct kvm_s390_irq *) &buf[n];
+				irq->type = KVM_S390_INT_IO(1, 0, 0, 0);
+				irq->u.io.io_int_word = isc_to_int_word(i);
+				n++;
+			}
+		}
+	}
 	fi = &kvm->arch.float_int;
 	spin_lock(&fi->lock);
 	for (i = 0; i < FIRQ_LIST_COUNT; i++) {
@@ -1944,6 +1961,7 @@ static int get_all_floating_irqs(struct kvm *kvm, u8 __user *usrbuf, u64 len)
 
 out:
 	spin_unlock(&fi->lock);
+out_nolock:
 	if (!ret && n > 0) {
 		if (copy_to_user(usrbuf, buf, sizeof(struct kvm_s390_irq) * n))
 			ret = -EFAULT;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html