linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/dp_mst: Fix drm_dp_send_dpcd_write() return code
@ 2020-04-24 19:07 Lyude Paul
  2020-04-24 19:16 ` Alex Deucher
  2020-04-27 13:58 ` Sean Paul
  0 siblings, 2 replies; 3+ messages in thread
From: Lyude Paul @ 2020-04-24 19:07 UTC (permalink / raw)
  To: dri-devel
  Cc: Benjamin Gaignard, Sean Paul, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Daniel Vetter, linux-kernel

drm_dp_mst_wait_tx_reply() returns > 1 if time elapsed in
wait_event_timeout() before check_txmsg_state(mgr, txmsg) evaluated to
true. However, we make the mistake of returning this time from
drm_dp_send_dpcd_write() on success instead of returning the number of
bytes written - causing spontaneous failures during link probing:

[drm:drm_dp_send_link_address [drm_kms_helper]] *ERROR* GUID check on
10:01 failed: 3975

Yikes! So, fix this by returning the number of bytes written on success
instead.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Fixes: cb897542c6d2 ("drm/dp_mst: Fix W=1 warnings")
Cc: Benjamin Gaignard <benjamin.gaignard@st.com>
Cc: Sean Paul <sean@poorly.run>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 03a1496f6120..21dc78cb4ba6 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -3436,8 +3436,12 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
 	drm_dp_queue_down_tx(mgr, txmsg);
 
 	ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
-	if (ret > 0 && txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
-		ret = -EIO;
+	if (ret > 0) {
+		if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
+			ret = -EIO;
+		else
+			ret = size;
+	}
 
 	kfree(txmsg);
 fail_put:
-- 
2.25.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/dp_mst: Fix drm_dp_send_dpcd_write() return code
  2020-04-24 19:07 [PATCH] drm/dp_mst: Fix drm_dp_send_dpcd_write() return code Lyude Paul
@ 2020-04-24 19:16 ` Alex Deucher
  2020-04-27 13:58 ` Sean Paul
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2020-04-24 19:16 UTC (permalink / raw)
  To: Lyude Paul
  Cc: Maling list - DRI developers, Benjamin Gaignard, David Airlie,
	LKML, Thomas Zimmermann, Sean Paul

On Fri, Apr 24, 2020 at 3:07 PM Lyude Paul <lyude@redhat.com> wrote:
>
> drm_dp_mst_wait_tx_reply() returns > 1 if time elapsed in
> wait_event_timeout() before check_txmsg_state(mgr, txmsg) evaluated to
> true. However, we make the mistake of returning this time from
> drm_dp_send_dpcd_write() on success instead of returning the number of
> bytes written - causing spontaneous failures during link probing:
>
> [drm:drm_dp_send_link_address [drm_kms_helper]] *ERROR* GUID check on
> 10:01 failed: 3975
>
> Yikes! So, fix this by returning the number of bytes written on success
> instead.
>
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Fixes: cb897542c6d2 ("drm/dp_mst: Fix W=1 warnings")
> Cc: Benjamin Gaignard <benjamin.gaignard@st.com>
> Cc: Sean Paul <sean@poorly.run>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/drm_dp_mst_topology.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 03a1496f6120..21dc78cb4ba6 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -3436,8 +3436,12 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
>         drm_dp_queue_down_tx(mgr, txmsg);
>
>         ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
> -       if (ret > 0 && txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
> -               ret = -EIO;
> +       if (ret > 0) {
> +               if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
> +                       ret = -EIO;
> +               else
> +                       ret = size;
> +       }
>
>         kfree(txmsg);
>  fail_put:
> --
> 2.25.3
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/dp_mst: Fix drm_dp_send_dpcd_write() return code
  2020-04-24 19:07 [PATCH] drm/dp_mst: Fix drm_dp_send_dpcd_write() return code Lyude Paul
  2020-04-24 19:16 ` Alex Deucher
@ 2020-04-27 13:58 ` Sean Paul
  1 sibling, 0 replies; 3+ messages in thread
From: Sean Paul @ 2020-04-27 13:58 UTC (permalink / raw)
  To: Lyude Paul
  Cc: dri-devel, Benjamin Gaignard, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Daniel Vetter, LKML

On Fri, Apr 24, 2020 at 3:07 PM Lyude Paul <lyude@redhat.com> wrote:
>
> drm_dp_mst_wait_tx_reply() returns > 1 if time elapsed in
> wait_event_timeout() before check_txmsg_state(mgr, txmsg) evaluated to
> true. However, we make the mistake of returning this time from
> drm_dp_send_dpcd_write() on success instead of returning the number of
> bytes written - causing spontaneous failures during link probing:
>
> [drm:drm_dp_send_link_address [drm_kms_helper]] *ERROR* GUID check on
> 10:01 failed: 3975
>
> Yikes! So, fix this by returning the number of bytes written on success
> instead.
>
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Fixes: cb897542c6d2 ("drm/dp_mst: Fix W=1 warnings")
> Cc: Benjamin Gaignard <benjamin.gaignard@st.com>
> Cc: Sean Paul <sean@poorly.run>

Reviewed-by: Sean Paul <sean@poorly.run>

> ---
>  drivers/gpu/drm/drm_dp_mst_topology.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 03a1496f6120..21dc78cb4ba6 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -3436,8 +3436,12 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
>         drm_dp_queue_down_tx(mgr, txmsg);
>
>         ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
> -       if (ret > 0 && txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
> -               ret = -EIO;
> +       if (ret > 0) {
> +               if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
> +                       ret = -EIO;
> +               else
> +                       ret = size;
> +       }
>
>         kfree(txmsg);
>  fail_put:
> --
> 2.25.3
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-27 13:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-24 19:07 [PATCH] drm/dp_mst: Fix drm_dp_send_dpcd_write() return code Lyude Paul
2020-04-24 19:16 ` Alex Deucher
2020-04-27 13:58 ` Sean Paul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).