From: Janosch Frank <frankja@linux.ibm.com>
To: pbonzini@redhat.com
Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com,
borntraeger@linux.ibm.com, cohuck@redhat.com,
linux-s390@vger.kernel.org, imbrenda@linux.ibm.com,
hca@linux.ibm.com, mihajlov@linux.ibm.com, seiden@linux.ibm.com,
akrowiak@linux.ibm.com
Subject: [GIT PULL 08/22] s390/vfio-ap: clean up irq resources if possible
Date: Thu, 24 Aug 2023 14:43:17 +0200 [thread overview]
Message-ID: <20230824124522.75408-9-frankja@linux.ibm.com> (raw)
In-Reply-To: <20230824124522.75408-1-frankja@linux.ibm.com>
From: Tony Krowiak <akrowiak@linux.ibm.com>
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>
---
drivers/s390/crypto/vfio_ap_ops.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
index 3fd80533194b..be92ba45226d 100644
--- a/drivers/s390/crypto/vfio_ap_ops.c
+++ b/drivers/s390/crypto/vfio_ap_ops.c
@@ -1654,9 +1654,13 @@ static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q)
switch (status.response_code) {
case AP_RESPONSE_NORMAL:
ret = 0;
- /* if the reset has not completed, wait for it to take effect */
- if (!status.queue_empty || status.irq_enabled)
+ if (!status.irq_enabled)
+ vfio_ap_free_aqic_resources(q);
+ if (!status.queue_empty || status.irq_enabled) {
ret = apq_reset_check(q);
+ if (status.irq_enabled && ret == 0)
+ vfio_ap_free_aqic_resources(q);
+ }
break;
case AP_RESPONSE_RESET_IN_PROGRESS:
/*
@@ -1675,6 +1679,7 @@ static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q)
* completed successfully.
*/
ret = 0;
+ vfio_ap_free_aqic_resources(q);
break;
default:
WARN(true,
@@ -1684,8 +1689,6 @@ static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q)
return -EIO;
}
- vfio_ap_free_aqic_resources(q);
-
return ret;
}
--
2.41.0
next prev parent reply other threads:[~2023-08-24 13:40 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-24 12:43 [GIT PULL 00/22] KVM: s390: Changes for 6.6 Janosch Frank
2023-08-24 12:43 ` [GIT PULL 01/22] KVM: s390: interrupt: Fix single-stepping into interrupt handlers Janosch Frank
2023-08-24 12:43 ` [GIT PULL 02/22] KVM: s390: interrupt: Fix single-stepping into program " Janosch Frank
2023-08-24 12:43 ` [GIT PULL 03/22] KVM: s390: interrupt: Fix single-stepping kernel-emulated instructions Janosch Frank
2023-08-24 12:43 ` [GIT PULL 04/22] KVM: s390: interrupt: Fix single-stepping userspace-emulated instructions Janosch Frank
2023-08-24 12:43 ` [GIT PULL 05/22] KVM: s390: interrupt: Fix single-stepping keyless mode exits Janosch Frank
2023-08-24 12:43 ` [GIT PULL 06/22] KVM: s390: selftests: Add selftest for single-stepping Janosch Frank
2023-08-24 12:43 ` [GIT PULL 07/22] s390/vfio-ap: no need to check the 'E' and 'I' bits in APQSW after TAPQ Janosch Frank
2023-08-24 12:43 ` Janosch Frank [this message]
2023-08-24 12:43 ` [GIT PULL 09/22] s390/vfio-ap: wait for response code 05 to clear on queue reset Janosch Frank
2023-08-24 12:43 ` [GIT PULL 10/22] s390/vfio-ap: allow deconfigured queue to be passed through to a guest Janosch Frank
2023-08-24 12:43 ` [GIT PULL 11/22] s390/vfio-ap: remove upper limit on wait for queue reset to complete Janosch Frank
2023-08-24 12:43 ` [GIT PULL 12/22] s390/vfio-ap: store entire AP queue status word with the queue object Janosch Frank
2023-08-24 12:43 ` [GIT PULL 13/22] s390/vfio-ap: use work struct to verify queue reset Janosch Frank
2023-08-24 12:43 ` [GIT PULL 14/22] s390/vfio-ap: handle queue state change in progress on reset Janosch Frank
2023-08-24 12:43 ` [GIT PULL 15/22] s390/vfio-ap: check for TAPQ response codes 0x35 and 0x36 Janosch Frank
2023-08-24 12:43 ` [GIT PULL 16/22] s390/uv: export uv_pin_shared for direct usage Janosch Frank
2023-08-24 12:43 ` [GIT PULL 17/22] KVM: s390: export kvm_s390_pv*_is_protected functions Janosch Frank
2023-08-24 12:43 ` [GIT PULL 18/22] s390/vfio-ap: make sure nib is shared Janosch Frank
2023-08-24 12:43 ` [GIT PULL 19/22] KVM: s390: pv: relax WARN_ONCE condition for destroy fast Janosch Frank
2023-08-24 12:43 ` [GIT PULL 20/22] s390/uv: UV feature check utility Janosch Frank
2023-08-24 12:43 ` [GIT PULL 21/22] KVM: s390: Add UV feature negotiation Janosch Frank
2023-08-24 12:43 ` [GIT PULL 22/22] KVM: s390: pv: Allow AP-instructions for pv-guests Janosch Frank
2023-08-25 13:56 ` [GIT PULL 00/22] KVM: s390: Changes for 6.6 Janosch Frank
2023-08-25 15:58 ` Sean Christopherson
2023-08-28 12:34 ` Janosch Frank
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=20230824124522.75408-9-frankja@linux.ibm.com \
--to=frankja@linux.ibm.com \
--cc=akrowiak@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=hca@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mihajlov@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=seiden@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox