All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Krowiak <akrowiak@linux.ibm.com>
To: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org
Cc: jjherne@linux.ibm.com, freude@linux.ibm.com,
	borntraeger@de.ibm.com, cohuck@redhat.com,
	mjrosato@linux.ibm.com, pasic@linux.ibm.com,
	alex.williamson@redhat.com, kwankhede@nvidia.com,
	fiuczy@linux.ibm.com, Viktor Mihajlovski <mihajlov@linux.ibm.com>
Subject: [PATCH 09/12] s390/vfio-ap: check for TAPQ response codes 0x35 and 0x36
Date: Tue, 15 Aug 2023 14:43:30 -0400	[thread overview]
Message-ID: <20230815184333.6554-10-akrowiak@linux.ibm.com> (raw)
In-Reply-To: <20230815184333.6554-1-akrowiak@linux.ibm.com>

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>
---
 drivers/s390/crypto/vfio_ap_ops.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
index 43dea259fe23..8bda52c46df0 100644
--- a/drivers/s390/crypto/vfio_ap_ops.c
+++ b/drivers/s390/crypto/vfio_ap_ops.c
@@ -1612,6 +1612,16 @@ static int apq_status_check(int apqn, struct ap_queue_status *status)
 	case AP_RESPONSE_RESET_IN_PROGRESS:
 	case AP_RESPONSE_BUSY:
 		return -EBUSY;
+	case AP_RESPONSE_ASSOC_SECRET_NOT_UNIQUE:
+	case AP_RESPONSE_ASSOC_FAILED:
+		/*
+		 * These asynchronous response codes indicate a PQAP(AAPQ)
+		 * instruction to associate a secret with the guest failed. All
+		 * subsequent AP instructions will end with the asynchronous
+		 * response code until the AP queue is reset; so, let's return
+		 * a value indicating a reset needs to be performed again.
+		 */
+		return -EAGAIN;
 	default:
 		WARN(true,
 		     "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)
 		} else {
 			if (q->reset_status.response_code == AP_RESPONSE_RESET_IN_PROGRESS ||
 			    q->reset_status.response_code == AP_RESPONSE_BUSY ||
-			    q->reset_status.response_code == AP_RESPONSE_STATE_CHANGE_IN_PROGRESS) {
+			    q->reset_status.response_code == AP_RESPONSE_STATE_CHANGE_IN_PROGRESS ||
+			    ret == -EAGAIN) {
 				status = ap_zapq(q->apqn, 0);
 				memcpy(&q->reset_status, &status, sizeof(status));
 				continue;
-- 
2.39.3


  parent reply	other threads:[~2023-08-15 18:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-15 18:43 [PATCH 00/12] s390/vfio_ap: crypto pass-through for SE guests Tony Krowiak
2023-08-15 18:43 ` [PATCH 01/12] s390/vfio-ap: No need to check the 'E' and 'I' bits in APQSW after TAPQ Tony Krowiak
2023-08-15 18:43 ` [PATCH 02/12] s390/vfio-ap: clean up irq resources if possible Tony Krowiak
2023-08-15 18:43 ` [PATCH 03/12] s390/vfio-ap: wait for response code 05 to clear on queue reset Tony Krowiak
2023-08-15 18:43 ` [PATCH 04/12] s390/vfio-ap: allow deconfigured queue to be passed through to a guest Tony Krowiak
2023-08-15 18:43 ` [PATCH 05/12] s390/vfio-ap: remove upper limit on wait for queue reset to complete Tony Krowiak
2023-08-15 18:43 ` [PATCH 06/12] s390/vfio-ap: store entire AP queue status word with the queue object Tony Krowiak
2023-08-15 18:43 ` [PATCH 07/12] s390/vfio-ap: use work struct to verify queue reset Tony Krowiak
2023-08-15 18:43 ` [PATCH 08/12] s390/vfio-ap: handle queue state change in progress on reset Tony Krowiak
2023-08-15 18:43 ` Tony Krowiak [this message]
2023-08-15 18:43 ` [PATCH 10/12] s390/uv: export uv_pin_shared for direct usage Tony Krowiak
2023-08-15 18:43 ` [PATCH 11/12] kvm: s390: export kvm_s390_pv*_is_protected functions Tony Krowiak
2023-08-15 18:43 ` [PATCH 12/12] s390/vfio-ap: Make sure nib is shared Tony Krowiak
2023-08-16 11:39 ` [PATCH 00/12] s390/vfio_ap: crypto pass-through for SE guests Janosch Frank
2023-08-16 12:12   ` Janosch Frank
2023-08-18 13:35     ` Heiko Carstens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230815184333.6554-10-akrowiak@linux.ibm.com \
    --to=akrowiak@linux.ibm.com \
    --cc=alex.williamson@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=fiuczy@linux.ibm.com \
    --cc=freude@linux.ibm.com \
    --cc=jjherne@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mihajlov@linux.ibm.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.