• Lyude Paul's avatar
    drm/dp_mst: Handle UP requests asynchronously · 9408cc94
    Lyude Paul authored
    Once upon a time, hotplugging devices on MST branches actually worked in
    DRM. Now, it only works in amdgpu (likely because of how it's hotplug
    handlers are implemented). On both i915 and nouveau, hotplug
    notifications from MST branches are noticed - but trying to respond to
    them causes messaging timeouts and causes the whole topology state to go
    out of sync with reality, usually resulting in the user needing to
    replug the entire topology in hopes that it actually fixes things.
    
    The reason for this is because the way we currently handle UP requests
    in MST is completely bogus. drm_dp_mst_handle_up_req() is called from
    drm_dp_mst_hpd_irq(), which is usually called from the driver's hotplug
    handler. Because we handle sending the hotplug event from this function,
    we actually cause the driver's hotplug handler (and in turn, all
    sideband transactions) to block on
    drm_device->mode_config.connection_mutex. This makes it impossible to
    send any sideband messages from the driver's connector probing
    functions, resulting in the aforementioned sideband message timeout.
    
    There's even more problems with this beyond breaking hotplugging on MST
    branch devices. It also makes it almost impossible to protect
    drm_dp_mst_port struct members under a lock because we then have to
    worry about dealing with all of the lock dependency issues that ensue.
    
    So, let's finally actually fix this issue by handling the processing of
    up requests asyncronously. This way we can send sideband messages from
    most contexts without having to deal with getting blocked if we hold
    connection_mutex. This also fixes MST branch device hotplugging on i915,
    finally!
    
    Cc: Juston Li <juston.li@intel.com>
    Cc: Imre Deak <imre.deak@intel.com>
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Cc: Harry Wentland <hwentlan@amd.com>
    Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
    Reviewed-by: default avatarSean Paul <sean@poorly.run>
    Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20191022023641.8026-5-lyude@redhat.com
    9408cc94
drm_dp_mst_helper.h 22.6 KB