s390/vfio-ap: reset queues associated with adapter for queue unbound from driver
authorTony Krowiak <akrowiak@linux.ibm.com>
Mon, 15 Jan 2024 18:54:35 +0000 (13:54 -0500)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Wed, 17 Jan 2024 12:53:05 +0000 (13:53 +0100)
commitf009cfa466558b7dfe97f167ba1875d6f9ea4c07
tree1f071bf92870818acd026f1d74c25b65afdd49ab
parentf848cba767e59f8d5c54984b1d45451aae040d50
s390/vfio-ap: reset queues associated with adapter for queue unbound from driver

When a queue is unbound from the vfio_ap device driver, if that queue is
assigned to a guest's AP configuration, its associated adapter is removed
because queues are defined to a guest via a matrix of adapters and
domains; so, it is not possible to remove a single queue.

If an adapter is removed from the guest's AP configuration, all associated
queues must be reset to prevent leaking crypto data should any of them be
assigned to a different guest or device driver. The one caveat is that if
the queue is being removed because the adapter or domain has been removed
from the host's AP configuration, then an attempt to reset the queue will
fail with response code 01, AP-queue number not valid; so resetting these
queues should be skipped.

Acked-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
Fixes: 09d31ff78793 ("s390/vfio-ap: hot plug/unplug of AP devices when probed/removed")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240115185441.31526-6-akrowiak@linux.ibm.com
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
drivers/s390/crypto/vfio_ap_ops.c