diff mbox series

[1/3] drm/display/dp_mst: Fix down/up message handling after sink disconnect

Message ID 20221214184258.2869417-1-imre.deak@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/3] drm/display/dp_mst: Fix down/up message handling after sink disconnect | expand

Commit Message

Imre Deak Dec. 14, 2022, 6:42 p.m. UTC
If the sink gets disconnected during receiving a multi-packet DP MST AUX
down-reply/up-request sideband message, the state keeping track of which
packets have been received already is not reset. This results in a failed
sanity check for the subsequent message packet received after a sink is
reconnected (due to the pending message not yet completed with an
end-of-message-transfer packet), indicated by the

"sideband msg set header failed"

error.

Fix the above by resetting the up/down message reception state after a
disconnect event.

Cc: Lyude Paul <lyude@redhat.com>
Cc: <stable@vger.kernel.org> # v3.17+
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/display/drm_dp_mst_topology.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Lyude Paul Dec. 14, 2022, 9:41 p.m. UTC | #1
For the whole series:

Reviewed-by: Lyude Paul <lyude@redhat.com>

Thanks!

On Wed, 2022-12-14 at 20:42 +0200, Imre Deak wrote:
> If the sink gets disconnected during receiving a multi-packet DP MST AUX
> down-reply/up-request sideband message, the state keeping track of which
> packets have been received already is not reset. This results in a failed
> sanity check for the subsequent message packet received after a sink is
> reconnected (due to the pending message not yet completed with an
> end-of-message-transfer packet), indicated by the
> 
> "sideband msg set header failed"
> 
> error.
> 
> Fix the above by resetting the up/down message reception state after a
> disconnect event.
> 
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: <stable@vger.kernel.org> # v3.17+
> Signed-off-by: Imre Deak <imre.deak@intel.com>
> ---
>  drivers/gpu/drm/display/drm_dp_mst_topology.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c
> index 51a46689cda70..90819fff2c9ba 100644
> --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c
> @@ -3641,6 +3641,9 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms
>  		drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL, 0);
>  		ret = 0;
>  		mgr->payload_id_table_cleared = false;
> +
> +		memset(&mgr->down_rep_recv, 0, sizeof(mgr->down_rep_recv));
> +		memset(&mgr->up_req_recv, 0, sizeof(mgr->up_req_recv));
>  	}
>  
>  out_unlock:
Imre Deak Dec. 16, 2022, 3:10 p.m. UTC | #2
On Wed, Dec 14, 2022 at 04:41:42PM -0500, Lyude Paul wrote:
> For the whole series:
> 
> Reviewed-by: Lyude Paul <lyude@redhat.com>

Thanks for the review, pushed it to drm-misc-next.

> Thanks!
> 
> On Wed, 2022-12-14 at 20:42 +0200, Imre Deak wrote:
> > If the sink gets disconnected during receiving a multi-packet DP MST AUX
> > down-reply/up-request sideband message, the state keeping track of which
> > packets have been received already is not reset. This results in a failed
> > sanity check for the subsequent message packet received after a sink is
> > reconnected (due to the pending message not yet completed with an
> > end-of-message-transfer packet), indicated by the
> > 
> > "sideband msg set header failed"
> > 
> > error.
> > 
> > Fix the above by resetting the up/down message reception state after a
> > disconnect event.
> > 
> > Cc: Lyude Paul <lyude@redhat.com>
> > Cc: <stable@vger.kernel.org> # v3.17+
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > ---
> >  drivers/gpu/drm/display/drm_dp_mst_topology.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c
> > index 51a46689cda70..90819fff2c9ba 100644
> > --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c
> > +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c
> > @@ -3641,6 +3641,9 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms
> >  		drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL, 0);
> >  		ret = 0;
> >  		mgr->payload_id_table_cleared = false;
> > +
> > +		memset(&mgr->down_rep_recv, 0, sizeof(mgr->down_rep_recv));
> > +		memset(&mgr->up_req_recv, 0, sizeof(mgr->up_req_recv));
> >  	}
> >  
> >  out_unlock:
> 
> -- 
> Cheers,
>  Lyude Paul (she/her)
>  Software Engineer at Red Hat
>
Jani Nikula Dec. 16, 2022, 4:10 p.m. UTC | #3
On Fri, 16 Dec 2022, Imre Deak <imre.deak@intel.com> wrote:
> On Wed, Dec 14, 2022 at 04:41:42PM -0500, Lyude Paul wrote:
>> For the whole series:
>> 
>> Reviewed-by: Lyude Paul <lyude@redhat.com>
>
> Thanks for the review, pushed it to drm-misc-next.

Hmm, with the drm-misc *not* cherry-picking patches from drm-misc-next
to drm-misc-fixes, these will only get backported to stable kernels
after they hit Linus' tree in the next (as opposed to current) merge
window after a full development cycle. Wonder if they should be
expedited.

BR,
Jani.

>
>> Thanks!
>> 
>> On Wed, 2022-12-14 at 20:42 +0200, Imre Deak wrote:
>> > If the sink gets disconnected during receiving a multi-packet DP MST AUX
>> > down-reply/up-request sideband message, the state keeping track of which
>> > packets have been received already is not reset. This results in a failed
>> > sanity check for the subsequent message packet received after a sink is
>> > reconnected (due to the pending message not yet completed with an
>> > end-of-message-transfer packet), indicated by the
>> > 
>> > "sideband msg set header failed"
>> > 
>> > error.
>> > 
>> > Fix the above by resetting the up/down message reception state after a
>> > disconnect event.
>> > 
>> > Cc: Lyude Paul <lyude@redhat.com>
>> > Cc: <stable@vger.kernel.org> # v3.17+
>> > Signed-off-by: Imre Deak <imre.deak@intel.com>
>> > ---
>> >  drivers/gpu/drm/display/drm_dp_mst_topology.c | 3 +++
>> >  1 file changed, 3 insertions(+)
>> > 
>> > diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c
>> > index 51a46689cda70..90819fff2c9ba 100644
>> > --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c
>> > +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c
>> > @@ -3641,6 +3641,9 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms
>> >  		drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL, 0);
>> >  		ret = 0;
>> >  		mgr->payload_id_table_cleared = false;
>> > +
>> > +		memset(&mgr->down_rep_recv, 0, sizeof(mgr->down_rep_recv));
>> > +		memset(&mgr->up_req_recv, 0, sizeof(mgr->up_req_recv));
>> >  	}
>> >  
>> >  out_unlock:
>> 
>> -- 
>> Cheers,
>>  Lyude Paul (she/her)
>>  Software Engineer at Red Hat
>>
Imre Deak Dec. 16, 2022, 4:33 p.m. UTC | #4
On Fri, Dec 16, 2022 at 06:10:39PM +0200, Jani Nikula wrote:
> On Fri, 16 Dec 2022, Imre Deak <imre.deak@intel.com> wrote:
> > On Wed, Dec 14, 2022 at 04:41:42PM -0500, Lyude Paul wrote:
> >> For the whole series:
> >> 
> >> Reviewed-by: Lyude Paul <lyude@redhat.com>
> >
> > Thanks for the review, pushed it to drm-misc-next.
> 
> Hmm, with the drm-misc *not* cherry-picking patches from drm-misc-next
> to drm-misc-fixes, these will only get backported to stable kernels
> after they hit Linus' tree in the next (as opposed to current) merge
> window after a full development cycle. Wonder if they should be
> expedited.

Ok, it should've been pushed to -fixes then, will do that next time.
Yes, I think sending them already before the next merge window would be
good.

> 
> BR,
> Jani.
> 
> >
> >> Thanks!
> >> 
> >> On Wed, 2022-12-14 at 20:42 +0200, Imre Deak wrote:
> >> > If the sink gets disconnected during receiving a multi-packet DP MST AUX
> >> > down-reply/up-request sideband message, the state keeping track of which
> >> > packets have been received already is not reset. This results in a failed
> >> > sanity check for the subsequent message packet received after a sink is
> >> > reconnected (due to the pending message not yet completed with an
> >> > end-of-message-transfer packet), indicated by the
> >> > 
> >> > "sideband msg set header failed"
> >> > 
> >> > error.
> >> > 
> >> > Fix the above by resetting the up/down message reception state after a
> >> > disconnect event.
> >> > 
> >> > Cc: Lyude Paul <lyude@redhat.com>
> >> > Cc: <stable@vger.kernel.org> # v3.17+
> >> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> >> > ---
> >> >  drivers/gpu/drm/display/drm_dp_mst_topology.c | 3 +++
> >> >  1 file changed, 3 insertions(+)
> >> > 
> >> > diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c
> >> > index 51a46689cda70..90819fff2c9ba 100644
> >> > --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c
> >> > +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c
> >> > @@ -3641,6 +3641,9 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms
> >> >  		drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL, 0);
> >> >  		ret = 0;
> >> >  		mgr->payload_id_table_cleared = false;
> >> > +
> >> > +		memset(&mgr->down_rep_recv, 0, sizeof(mgr->down_rep_recv));
> >> > +		memset(&mgr->up_req_recv, 0, sizeof(mgr->up_req_recv));
> >> >  	}
> >> >  
> >> >  out_unlock:
> >> 
> >> -- 
> >> Cheers,
> >>  Lyude Paul (she/her)
> >>  Software Engineer at Red Hat
> >> 
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center
Jani Nikula Dec. 16, 2022, 4:49 p.m. UTC | #5
On Fri, 16 Dec 2022, Imre Deak <imre.deak@intel.com> wrote:
> On Fri, Dec 16, 2022 at 06:10:39PM +0200, Jani Nikula wrote:
>> On Fri, 16 Dec 2022, Imre Deak <imre.deak@intel.com> wrote:
>> > On Wed, Dec 14, 2022 at 04:41:42PM -0500, Lyude Paul wrote:
>> >> For the whole series:
>> >> 
>> >> Reviewed-by: Lyude Paul <lyude@redhat.com>
>> >
>> > Thanks for the review, pushed it to drm-misc-next.
>> 
>> Hmm, with the drm-misc *not* cherry-picking patches from drm-misc-next
>> to drm-misc-fixes, these will only get backported to stable kernels
>> after they hit Linus' tree in the next (as opposed to current) merge
>> window after a full development cycle. Wonder if they should be
>> expedited.
>
> Ok, it should've been pushed to -fixes then, will do that next time.
> Yes, I think sending them already before the next merge window would be
> good.

Cc: drm-misc maintainers, I think this is for you to figure out.

BR,
Jani.


>
>> 
>> BR,
>> Jani.
>> 
>> >
>> >> Thanks!
>> >> 
>> >> On Wed, 2022-12-14 at 20:42 +0200, Imre Deak wrote:
>> >> > If the sink gets disconnected during receiving a multi-packet DP MST AUX
>> >> > down-reply/up-request sideband message, the state keeping track of which
>> >> > packets have been received already is not reset. This results in a failed
>> >> > sanity check for the subsequent message packet received after a sink is
>> >> > reconnected (due to the pending message not yet completed with an
>> >> > end-of-message-transfer packet), indicated by the
>> >> > 
>> >> > "sideband msg set header failed"
>> >> > 
>> >> > error.
>> >> > 
>> >> > Fix the above by resetting the up/down message reception state after a
>> >> > disconnect event.
>> >> > 
>> >> > Cc: Lyude Paul <lyude@redhat.com>
>> >> > Cc: <stable@vger.kernel.org> # v3.17+
>> >> > Signed-off-by: Imre Deak <imre.deak@intel.com>
>> >> > ---
>> >> >  drivers/gpu/drm/display/drm_dp_mst_topology.c | 3 +++
>> >> >  1 file changed, 3 insertions(+)
>> >> > 
>> >> > diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c
>> >> > index 51a46689cda70..90819fff2c9ba 100644
>> >> > --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c
>> >> > +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c
>> >> > @@ -3641,6 +3641,9 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms
>> >> >  		drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL, 0);
>> >> >  		ret = 0;
>> >> >  		mgr->payload_id_table_cleared = false;
>> >> > +
>> >> > +		memset(&mgr->down_rep_recv, 0, sizeof(mgr->down_rep_recv));
>> >> > +		memset(&mgr->up_req_recv, 0, sizeof(mgr->up_req_recv));
>> >> >  	}
>> >> >  
>> >> >  out_unlock:
>> >> 
>> >> -- 
>> >> Cheers,
>> >>  Lyude Paul (she/her)
>> >>  Software Engineer at Red Hat
>> >> 
>> 
>> -- 
>> Jani Nikula, Intel Open Source Graphics Center
diff mbox series

Patch

diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c
index 51a46689cda70..90819fff2c9ba 100644
--- a/drivers/gpu/drm/display/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c
@@ -3641,6 +3641,9 @@  int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms
 		drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL, 0);
 		ret = 0;
 		mgr->payload_id_table_cleared = false;
+
+		memset(&mgr->down_rep_recv, 0, sizeof(mgr->down_rep_recv));
+		memset(&mgr->up_req_recv, 0, sizeof(mgr->up_req_recv));
 	}
 
 out_unlock: