[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1541009577-29656-7-git-send-email-pmorel@linux.ibm.com>
Date: Wed, 31 Oct 2018 19:12:56 +0100
From: Pierre Morel <pmorel@...ux.ibm.com>
To: borntraeger@...ibm.com
Cc: alex.williamson@...hat.com, cohuck@...hat.com,
linux-kernel@...r.kernel.org, linux-s390@...r.kernel.org,
kvm@...r.kernel.org, frankja@...ux.ibm.com, akrowiak@...ux.ibm.com,
pasic@...ux.ibm.com, david@...hat.com, schwidefsky@...ibm.com,
heiko.carstens@...ibm.com, freude@...ux.ibm.com, mimu@...ux.ibm.com
Subject: [PATCH v1 6/7] vfio: ap: register guest ISC with GISA and GIB
Register to the GIB Alert list and retrieve the GAL_ISC
to pass to the GISA registration.
Unregister on error and when clearing the interrupt.
Signed-off-by: Pierre Morel <pmorel@...ux.ibm.com>
Signed-off-by: Michael Mueller <mimu@...ux.ibm.com>
---
drivers/s390/crypto/vfio_ap_ops.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
index f68102163bf4..232168797fb8 100644
--- a/drivers/s390/crypto/vfio_ap_ops.c
+++ b/drivers/s390/crypto/vfio_ap_ops.c
@@ -903,16 +903,20 @@ static int ap_ioctl_setirq(struct ap_matrix_mdev *matrix_mdev,
struct ap_status ap_status = reg2status(0);
unsigned long p;
int ret = -1;
- int apqn;
+ int apqn, gal_isc;
uint32_t gd;
+ gal_isc = kvm_s390_gisc_register(matrix_mdev->kvm, matrix_mdev->gisc);
+ if (gal_isc < 0)
+ return -EIO;
+
apqn = (int)(parm->cmd & 0xffff);
gd = matrix_mdev->kvm->vcpus[0]->arch.sie_block->gd;
if (gd & 0x01)
aqic_gisa.f = 1;
aqic_gisa.gisc = matrix_mdev->gisc;
- aqic_gisa.isc = GAL_ISC;
+ aqic_gisa.isc = gal_isc;
aqic_gisa.ir = 1;
aqic_gisa.gisao = gisa->next_alert >> 4;
@@ -923,7 +927,11 @@ static int ap_ioctl_setirq(struct ap_matrix_mdev *matrix_mdev,
parm->status = ret;
ap_status = reg2status(ret);
- return (ap_status.rc) ? -EIO : 0;
+ if (ap_status.rc) {
+ kvm_s390_gisc_unregister(matrix_mdev->kvm, matrix_mdev->gisc);
+ return -EIO;
+ }
+ return 0;
}
static int ap_ioctl_clrirq(struct ap_matrix_mdev *matrix_mdev,
@@ -946,6 +954,8 @@ static int ap_ioctl_clrirq(struct ap_matrix_mdev *matrix_mdev,
parm->status = retval;
ap_status = reg2status(retval);
+ /* unregister the IAM from the GIB anyway! */
+ kvm_s390_gisc_unregister(matrix_mdev->kvm, matrix_mdev->gisc);
return (ap_status.rc) ? -EIO : 0;
}
--
2.17.0
Powered by blists - more mailing lists