• Tony Krowiak's avatar
    s390/vfio-ap: manage link between queue struct and matrix mdev · 11cb2419
    Tony Krowiak authored
    Let's create links between each queue device bound to the vfio_ap device
    driver and the matrix mdev to which the queue's APQN is assigned. The idea
    is to facilitate efficient retrieval of the objects representing the queue
    devices and matrix mdevs as well as to verify that a queue assigned to
    a matrix mdev is bound to the driver.
    
    The links will be created as follows:
    
     * When the queue device is probed, if its APQN is assigned to a matrix
       mdev, the structures representing the queue device and the matrix mdev
       will be linked.
    
     * When an adapter or domain is assigned to a matrix mdev, for each new
       APQN assigned that references a queue device bound to the vfio_ap
       device driver, the structures representing the queue device and the
       matrix mdev will be linked.
    
    The links will be removed as follows:
    
     * When the queue device is removed, if its APQN is assigned to a matrix
       mdev, the link from the structure representing the matrix mdev to the
       structure representing the queue will be removed. Since the storage
       allocated for the vfio_ap_queue will be freed, there is no need to
       remove the link to the matrix_mdev to which the queue's APQN is
       assigned.
    
     * When an adapter or domain is unassigned from a matrix mdev, for each
       APQN unassigned that references a queue device bound to the vfio_ap
       device driver, the structures representing the queue device and the
       matrix mdev will be unlinked.
    
     * When an mdev is removed, the link from any queues assigned to the mdev
       to the mdev will be removed.
    Signed-off-by: default avatarTony Krowiak <akrowiak@linux.ibm.com>
    Reviewed-by: default avatarHalil Pasic <pasic@linux.ibm.com>
    Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
    11cb2419
vfio_ap_ops.c 45.3 KB