s390/vfio-ap: improve reaction to response code 07 from PQAP(AQIC) command
authorTony Krowiak <akrowiak@linux.ibm.com>
Thu, 9 Nov 2023 16:44:22 +0000 (11:44 -0500)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Thu, 30 Nov 2023 15:24:23 +0000 (16:24 +0100)
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 <mjrosato@linux.ibm.com>
Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Link: https://lore.kernel.org/r/20231109164427.460493-4-akrowiak@linux.ibm.com
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
drivers/s390/crypto/vfio_ap_ops.c

index 25d7ce2094f88f9422807c7e69de52e03937eb52..4e80c211ba4718aced4316a66b26cfd0c29d9071 100644 (file)
@@ -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,