2023-11-29 14:54:41

by Anthony Krowiak

[permalink] [raw]
Subject: [PATCH v4 0/3] a couple of corrections to the IRQ enablement function

This series corrects two issues related to enablement of interrupts in
response to interception of the PQAP(AQIC) command:

1. Returning a status response code 06 (Invalid address of AP-queue
notification byte) when the call to register a guest ISC fails makes no
sense.

2. The pages containing the interrupt notification-indicator byte are not
freed after a failure to register the guest ISC fails.

Change log v3 ==> v4:
--------------------
* Improved commit message in patch 2/3 (Halil)

Anthony Krowiak (2):
s390/vfio-ap: unpin pages on gisc registration failure
s390/vfio-ap: set status response code to 06 on gisc registration
failure

Tony Krowiak (1):
s390/vfio-ap: improve reaction to response code 07 from PQAP(AQIC)
command

drivers/s390/crypto/vfio_ap_ops.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

--
2.41.0


2023-11-29 14:54:46

by Anthony Krowiak

[permalink] [raw]
Subject: [PATCH v4 3/3] s390/vfio-ap: improve reaction to response code 07 from PQAP(AQIC) command

Let's improve the vfio_ap driver's reaction to reception of response code
07 from the PQAP(AQIC) command when enabling interrupts on behalf of a
guest:

* Unregister the guest's ISC before the pages containing the notification
indicator bytes are unpinned.

* Capture the return code from the kvm_s390_gisc_unregister function and
log a DBF warning if it fails.

Suggested-by: Matthew Rosato <[email protected]>
Signed-off-by: Tony Krowiak <[email protected]>
Reviewed-by: Matthew Rosato <[email protected]>
---
drivers/s390/crypto/vfio_ap_ops.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
index 25d7ce2094f8..4e80c211ba47 100644
--- a/drivers/s390/crypto/vfio_ap_ops.c
+++ b/drivers/s390/crypto/vfio_ap_ops.c
@@ -476,8 +476,11 @@ static struct ap_queue_status vfio_ap_irq_enable(struct vfio_ap_queue *q,
break;
case AP_RESPONSE_OTHERWISE_CHANGED:
/* We could not modify IRQ settings: clear new configuration */
+ ret = kvm_s390_gisc_unregister(kvm, isc);
+ if (ret)
+ VFIO_AP_DBF_WARN("%s: kvm_s390_gisc_unregister: rc=%d isc=%d, apqn=%#04x\n",
+ __func__, ret, isc, q->apqn);
vfio_unpin_pages(&q->matrix_mdev->vdev, nib, 1);
- kvm_s390_gisc_unregister(kvm, isc);
break;
default:
pr_warn("%s: apqn %04x: response: %02x\n", __func__, q->apqn,
--
2.41.0

2023-12-01 10:00:00

by Christian Borntraeger

[permalink] [raw]
Subject: Re: [PATCH v4 3/3] s390/vfio-ap: improve reaction to response code 07 from PQAP(AQIC) command



Am 29.11.23 um 15:54 schrieb Tony Krowiak:
> Let's improve the vfio_ap driver's reaction to reception of response code
> 07 from the PQAP(AQIC) command when enabling interrupts on behalf of a
> guest:
>
> * Unregister the guest's ISC before the pages containing the notification
> indicator bytes are unpinned.
>
> * Capture the return code from the kvm_s390_gisc_unregister function and
> log a DBF warning if it fails.
>
> Suggested-by: Matthew Rosato <[email protected]>
> Signed-off-by: Tony Krowiak <[email protected]>
> Reviewed-by: Matthew Rosato <[email protected]>

Acked-by: Christian Borntraeger <[email protected]>

should go via the s390 tree

> ---
> drivers/s390/crypto/vfio_ap_ops.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
> index 25d7ce2094f8..4e80c211ba47 100644
> --- a/drivers/s390/crypto/vfio_ap_ops.c
> +++ b/drivers/s390/crypto/vfio_ap_ops.c
> @@ -476,8 +476,11 @@ static struct ap_queue_status vfio_ap_irq_enable(struct vfio_ap_queue *q,
> break;
> case AP_RESPONSE_OTHERWISE_CHANGED:
> /* We could not modify IRQ settings: clear new configuration */
> + ret = kvm_s390_gisc_unregister(kvm, isc);
> + if (ret)
> + VFIO_AP_DBF_WARN("%s: kvm_s390_gisc_unregister: rc=%d isc=%d, apqn=%#04x\n",
> + __func__, ret, isc, q->apqn);
> vfio_unpin_pages(&q->matrix_mdev->vdev, nib, 1);
> - kvm_s390_gisc_unregister(kvm, isc);
> break;
> default:
> pr_warn("%s: apqn %04x: response: %02x\n", __func__, q->apqn,