• Wayne Lin's avatar
    drm/dp_mst: Avoid to mess up payload table by ports in stale topology · 3769e4c0
    Wayne Lin authored
    [Why]
    After unplug/hotplug hub from the system, userspace might start to
    clear stale payloads gradually. If we call drm_dp_mst_deallocate_vcpi()
    to release stale VCPI of those ports which are not relating to current
    topology, we have chane to wrongly clear active payload table entry for
    current topology.
    
    E.g.
    We have allocated VCPI 1 in current payload table and we call
    drm_dp_mst_deallocate_vcpi() to clean VCPI 1 in stale topology. In
    drm_dp_mst_deallocate_vcpi(), it will call drm_dp_mst_put_payload_id()
    tp put VCPI 1 and which means ID 1 is available again. Thereafter, if we
    want to allocate a new payload stream, it will find ID 1 is available by
    drm_dp_mst_assign_payload_id(). However, ID 1 is being used
    
    [How]
    Check target sink is relating to current topology or not before doing
    any payload table update.
    Searching upward to find the target sink's relevant root branch device.
    If the found root branch device is not the same root of current
    topology, don't update payload table.
    
    Changes since v1:
    * Change debug macro to use drm_dbg_kms() instead
    * Amend the commit message to add Cc tag.
    Signed-off-by: default avatarWayne Lin <Wayne.Lin@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210616035501.3776-3-Wayne.Lin@amd.comReviewed-by: default avatarLyude Paul <lyude@redhat.com>
    3769e4c0
drm_dp_mst_topology.c 163 KB