• Wayne Lin's avatar
    drm/dp_mst: Clear MSG_RDY flag before sending new message · 72f1de49
    Wayne Lin authored
    [Why]
    The sequence for collecting down_reply from source perspective should
    be:
    
    Request_n->repeat (get partial reply of Request_n->clear message ready
    flag to ack DPRX that the message is received) till all partial
    replies for Request_n are received->new Request_n+1.
    
    Now there is chance that drm_dp_mst_hpd_irq() will fire new down
    request in the tx queue when the down reply is incomplete. Source is
    restricted to generate interveleaved message transactions so we should
    avoid it.
    
    Also, while assembling partial reply packets, reading out DPCD DOWN_REP
    Sideband MSG buffer + clearing DOWN_REP_MSG_RDY flag should be
    wrapped up as a complete operation for reading out a reply packet.
    Kicking off a new request before clearing DOWN_REP_MSG_RDY flag might
    be risky. e.g. If the reply of the new request has overwritten the
    DPRX DOWN_REP Sideband MSG buffer before source writing one to clear
    DOWN_REP_MSG_RDY flag, source then unintentionally flushes the reply
    for the new request. Should handle the up request in the same way.
    
    [How]
    Separete drm_dp_mst_hpd_irq() into 2 steps. After acking the MST IRQ
    event, driver calls drm_dp_mst_hpd_irq_send_new_request() and might
    trigger drm_dp_mst_kick_tx() only when there is no on going message
    transaction.
    
    Changes since v1:
    * Reworked on review comments received
    -> Adjust the fix to let driver explicitly kick off new down request
    when mst irq event is handled and acked
    -> Adjust the commit message
    
    Changes since v2:
    * Adjust the commit message
    * Adjust the naming of the divided 2 functions and add a new input
      parameter "ack".
    * Adjust code flow as per review comments.
    
    Changes since v3:
    * Update the function description of drm_dp_mst_hpd_irq_handle_event
    
    Changes since v4:
    * Change ack of drm_dp_mst_hpd_irq_handle_event() to be an array align
      the size of esi[]
    Signed-off-by: default avatarWayne Lin <Wayne.Lin@amd.com>
    Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
    Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    72f1de49
drm_dp_mst_helper.h 31.4 KB