• Tony Krowiak's avatar
    s390/ap: notify drivers on config changed and scan complete callbacks · 28391585
    Tony Krowiak authored
    This patch introduces an extension to the ap bus to notify device drivers
    when the host AP configuration changes - i.e., adapters, domains or
    control domains are added or removed. When an adapter or domain is added to
    the host's AP configuration, the AP bus will create the associated queue
    devices in the linux sysfs device model. Each new type 10 (i.e., CEX4) or
    newer queue device with an APQN that is not reserved for the default device
    driver will get bound to the vfio_ap device driver. Likewise, whan an
    adapter or domain is removed from the host's AP configuration, the AP bus
    will remove the associated queue devices from the sysfs device model. Each
    of the queues that is bound to the vfio_ap device driver will get unbound.
    
    With the introduction of hot plug support, binding or unbinding of a
    queue device will result in plugging or unplugging one or more queues from
    a guest that is using the queue. If there are multiple changes to the
    host's AP configuration, it could result in the probe and remove callbacks
    getting invoked multiple times. Each time queues are plugged into or
    unplugged from a guest, the guest's VCPUs must be taken out of SIE.
    If this occurs multiple times due to changes in the host's AP
    configuration, that can have an undesirable negative affect on the guest's
    performance.
    
    To alleviate this problem, this patch introduces two new callbacks: one to
    notify the vfio_ap device driver when the AP bus scan routine detects a
    change to the host's AP configuration; and, one to notify the driver when
    the AP bus is done scanning. This will allow the vfio_ap driver to do
    bulk processing of all affected adapters, domains and control domains for
    affected guests rather than plugging or unplugging them one at a time when
    the probe or remove callback is invoked. The two new callbacks are:
    
    void (*on_config_changed)(struct ap_config_info *new_config_info,
                              struct ap_config_info *old_config_info);
    
    This callback is invoked at the start of the AP bus scan
    function when it determines that the host AP configuration information
    has changed since the previous scan. This is done by storing
    an old and current QCI info struct and comparing them. If there is any
    difference, the callback is invoked.
    
    void (*on_scan_complete)(struct ap_config_info *new_config_info,
                             struct ap_config_info *old_config_info);
    
    The on_scan_complete callback is invoked after the ap bus scan is
    completed if the host AP configuration data has changed.
    Signed-off-by: default avatarTony Krowiak <akrowiak@linux.ibm.com>
    Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
    28391585
ap_bus.h 12.3 KB