Skip to content

Commit 7aa7b2a

Browse files
Tony Krowiakhcahca
authored andcommitted
s390/vfio-ap: clean up irq resources if possible
The architecture does not specify whether interrupts are disabled as part of the asynchronous reset or upon return from the PQAP/ZAPQ instruction. If, however, PQAP/ZAPQ completes with APQSW response code 0 and the interrupt bit in the status word is also 0, we know the interrupts are disabled and we can go ahead and clean up the corresponding resources; otherwise, we must wait until the asynchronous reset has completed. Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com> Suggested-by: Halil Pasic <pasic@linux.ibm.com> Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com> Acked-by: Halil Pasic <pasic@linux.ibm.com> Acked-by: Janosch Frank <frankja@linux.ibm.com> Tested-by: Viktor Mihajlovski <mihajlov@linux.ibm.com> Link: https://lore.kernel.org/r/20230815184333.6554-3-akrowiak@linux.ibm.com Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
1 parent 680b7dd commit 7aa7b2a

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

drivers/s390/crypto/vfio_ap_ops.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,9 +1654,13 @@ static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q)
16541654
switch (status.response_code) {
16551655
case AP_RESPONSE_NORMAL:
16561656
ret = 0;
1657-
/* if the reset has not completed, wait for it to take effect */
1658-
if (!status.queue_empty || status.irq_enabled)
1657+
if (!status.irq_enabled)
1658+
vfio_ap_free_aqic_resources(q);
1659+
if (!status.queue_empty || status.irq_enabled) {
16591660
ret = apq_reset_check(q);
1661+
if (status.irq_enabled && ret == 0)
1662+
vfio_ap_free_aqic_resources(q);
1663+
}
16601664
break;
16611665
case AP_RESPONSE_RESET_IN_PROGRESS:
16621666
/*
@@ -1675,6 +1679,7 @@ static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q)
16751679
* completed successfully.
16761680
*/
16771681
ret = 0;
1682+
vfio_ap_free_aqic_resources(q);
16781683
break;
16791684
default:
16801685
WARN(true,
@@ -1684,8 +1689,6 @@ static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q)
16841689
return -EIO;
16851690
}
16861691

1687-
vfio_ap_free_aqic_resources(q);
1688-
16891692
return ret;
16901693
}
16911694

0 commit comments

Comments
 (0)