Skip to content

Commit 7847a19

Browse files
Tony Krowiakhcahca
authored andcommitted
s390/vfio-ap: check for TAPQ response codes 0x35 and 0x36
Check for response codes 0x35 and 0x36 which are asynchronous return codes indicating a failure of the guest to associate a secret with a queue. Since there can be no interaction with this queue from the guest (i.e., the vcpus are out of SIE for hot unplug, the guest is being shut down or an emulated subsystem reset of the guest is taking place), let's go ahead and re-issue the ZAPQ to reset and zeroize the queue. Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com> Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com> Reviewed-by: Halil Pasic <pasic@linux.ibm.com> Tested-by: Viktor Mihajlovski <mihajlov@linux.ibm.com> Link: https://lore.kernel.org/r/20230815184333.6554-10-akrowiak@linux.ibm.com Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
1 parent e1f17f8 commit 7847a19

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/s390/crypto/vfio_ap_ops.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,16 @@ static int apq_status_check(int apqn, struct ap_queue_status *status)
16121612
case AP_RESPONSE_RESET_IN_PROGRESS:
16131613
case AP_RESPONSE_BUSY:
16141614
return -EBUSY;
1615+
case AP_RESPONSE_ASSOC_SECRET_NOT_UNIQUE:
1616+
case AP_RESPONSE_ASSOC_FAILED:
1617+
/*
1618+
* These asynchronous response codes indicate a PQAP(AAPQ)
1619+
* instruction to associate a secret with the guest failed. All
1620+
* subsequent AP instructions will end with the asynchronous
1621+
* response code until the AP queue is reset; so, let's return
1622+
* a value indicating a reset needs to be performed again.
1623+
*/
1624+
return -EAGAIN;
16151625
default:
16161626
WARN(true,
16171627
"failed to verify reset of queue %02x.%04x: TAPQ rc=%u\n",
@@ -1648,7 +1658,8 @@ static void apq_reset_check(struct work_struct *reset_work)
16481658
} else {
16491659
if (q->reset_status.response_code == AP_RESPONSE_RESET_IN_PROGRESS ||
16501660
q->reset_status.response_code == AP_RESPONSE_BUSY ||
1651-
q->reset_status.response_code == AP_RESPONSE_STATE_CHANGE_IN_PROGRESS) {
1661+
q->reset_status.response_code == AP_RESPONSE_STATE_CHANGE_IN_PROGRESS ||
1662+
ret == -EAGAIN) {
16521663
status = ap_zapq(q->apqn, 0);
16531664
memcpy(&q->reset_status, &status, sizeof(status));
16541665
continue;

0 commit comments

Comments
 (0)