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 <[email protected]> Suggested-by: Halil Pasic <[email protected]> Reviewed-by: Jason J. Herne <[email protected]> Acked-by: Halil Pasic <[email protected]> Acked-by: Janosch Frank <[email protected]> Tested-by: Viktor Mihajlovski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Heiko Carstens <[email protected]>
1 parent 680b7dd commit 7aa7b2a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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)