Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
s390/vfio-ap: hot plug/unplug queues on bind/unbind of queue device
In response to the probe or remove of a queue device, if a KVM guest is using the matrix mdev to which the APQN of the queue device is assigned, the vfio_ap device driver must respond accordingly. In an ideal world, the queue device being probed would be hot plugged into the guest. Likewise, the queue corresponding to the queue device being removed would be hot unplugged from the guest. Unfortunately, the AP architecture precludes plugging or unplugging individual queues. We must also consider the fact that the linux device model precludes us from passing a queue device through to a KVM guest that is not bound to the driver facilitating the pass-through. Consequently, we are left with the choice of plugging/unplugging the adapter or the domain. In the latter case, this would result in taking access to the domain away for each adapter the guest is using. In either case, the operation will alter a KVM guest's access to one or more queues, so let's plug/unplug the adapter on bind/unbind of the queue device since this corresponds to the hardware entity that may be physically plugged/unplugged - i.e., a domain is not a piece of hardware. Example: ======= Queue devices bound to vfio_ap device driver: 04.0004 04.0047 04.0054 05.0005 05.0047 Adapters and domains assigned to matrix mdev: Adapters Domains -> Queues 04 0004 04.0004 05 0047 04.0047 0054 04.0054 05.0004 05.0047 05.0054 KVM guest matrix at is startup: Adapters Domains -> Queues 04 0004 04.0004 0047 04.0047 0054 04.0054 Adapter 05 is filtered because queue 05.0054 is not bound. KVM guest matrix after queue 05.0054 is bound to the vfio_ap driver: Adapters Domains -> Queues 04 0004 04.0004 05 0047 04.0047 0054 04.0054 05.0004 05.0047 05.0054 All queues assigned to the matrix mdev are now bound. KVM guest matrix after queue 04.0004 is unbound: Adapters Domains -> Queues 05 0004 05.0004 0047 05.0047 0054 05.0054 Adapter 04 is filtered because 04.0004 is no longer bound. Signed-off-by: Tony Krowiak <akrowiak@linux.ibm.com>
- Loading branch information