s390/vfio-ap: allow hot plug/unplug of AP devices when assigned/unassigned
authorTony Krowiak <akrowiak@linux.ibm.com>
Mon, 31 Jan 2022 23:35:47 +0000 (18:35 -0500)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Tue, 19 Jul 2022 14:18:10 +0000 (16:18 +0200)
commit51dc562af09dfb1a0d3cc806f64f0d72704647b5
treed50145fef94d78578040cec1b09335e2d8a89d44
parent2c1ee8983aa377fef4f725162f4f3aa5f9575d4a
s390/vfio-ap: allow hot plug/unplug of AP devices when assigned/unassigned

Let's hot plug an adapter, domain or control domain into the guest when it
is assigned to a matrix mdev that is attached to a KVM guest. Likewise,
let's hot unplug an adapter, domain or control domain from the guest when
it is unassigned from a matrix_mdev that is attached to a KVM guest.

Whenever an assignment or unassignment of an adapter, domain or control
domain is performed, the APQNs and control domains assigned to the matrix
mdev will be filtered and assigned to the AP control block
(APCB) that supplies the AP configuration to the guest so that no
adapter, domain or control domain that is not in the host's AP
configuration nor any APQN that does not reference a queue device bound
to the vfio_ap device driver is assigned.

After updating the APCB, if the mdev is in use by a KVM guest, it is
hot plugged into the guest to dynamically provide access to the adapters,
domains and control domains provided via the newly refreshed APCB.

Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
drivers/s390/crypto/vfio_ap_ops.c