All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/dp/mst: Restore primary hub guid on resume
@ 2016-04-13 20:50 ` Lyude
  0 siblings, 0 replies; 4+ messages in thread
From: Lyude @ 2016-04-13 20:50 UTC (permalink / raw)
  To: dri-devel; +Cc: Lyude, David Airlie, open list

Some hubs are forgetful, and end up forgetting whatever GUID we set
previously after we do a suspend/resume cycle. This can lead to
hotplugging breaking (along with probably other things) since the hub
will start sending connection notifications with the wrong GUID. As
such, we need to check on resume whether or not the GUID the hub is
giving us is valid.

Signed-off-by: Lyude <cpaul@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 27fbd79..d2efd78 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -2121,6 +2121,8 @@ int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr)
 
 	if (mgr->mst_primary) {
 		int sret;
+		u8 guid[16];
+
 		sret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, mgr->dpcd, DP_RECEIVER_CAP_SIZE);
 		if (sret != DP_RECEIVER_CAP_SIZE) {
 			DRM_DEBUG_KMS("dpcd read failed - undocked during suspend?\n");
@@ -2135,6 +2137,16 @@ int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr)
 			ret = -1;
 			goto out_unlock;
 		}
+
+		/* Some hubs forget their guids after they resume */
+		sret = drm_dp_dpcd_read(mgr->aux, DP_GUID, guid, 16);
+		if (sret != 16) {
+			DRM_DEBUG_KMS("dpcd read failed - undocked during suspend?\n");
+			ret = -1;
+			goto out_unlock;
+		}
+		drm_dp_check_mstb_guid(mgr->mst_primary, guid);
+
 		ret = 0;
 	} else
 		ret = -1;
-- 
2.5.5

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

* [PATCH] drm/dp/mst: Restore primary hub guid on resume
@ 2016-04-13 20:50 ` Lyude
  0 siblings, 0 replies; 4+ messages in thread
From: Lyude @ 2016-04-13 20:50 UTC (permalink / raw)
  To: dri-devel; +Cc: Lyude, open list

Some hubs are forgetful, and end up forgetting whatever GUID we set
previously after we do a suspend/resume cycle. This can lead to
hotplugging breaking (along with probably other things) since the hub
will start sending connection notifications with the wrong GUID. As
such, we need to check on resume whether or not the GUID the hub is
giving us is valid.

Signed-off-by: Lyude <cpaul@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 27fbd79..d2efd78 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -2121,6 +2121,8 @@ int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr)
 
 	if (mgr->mst_primary) {
 		int sret;
+		u8 guid[16];
+
 		sret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, mgr->dpcd, DP_RECEIVER_CAP_SIZE);
 		if (sret != DP_RECEIVER_CAP_SIZE) {
 			DRM_DEBUG_KMS("dpcd read failed - undocked during suspend?\n");
@@ -2135,6 +2137,16 @@ int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr)
 			ret = -1;
 			goto out_unlock;
 		}
+
+		/* Some hubs forget their guids after they resume */
+		sret = drm_dp_dpcd_read(mgr->aux, DP_GUID, guid, 16);
+		if (sret != 16) {
+			DRM_DEBUG_KMS("dpcd read failed - undocked during suspend?\n");
+			ret = -1;
+			goto out_unlock;
+		}
+		drm_dp_check_mstb_guid(mgr->mst_primary, guid);
+
 		ret = 0;
 	} else
 		ret = -1;
-- 
2.5.5

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/dp/mst: Restore primary hub guid on resume
  2016-04-13 20:50 ` Lyude
  (?)
@ 2016-04-15 12:41 ` Harry Wentland
  2016-04-15 13:01   ` Daniel Vetter
  -1 siblings, 1 reply; 4+ messages in thread
From: Harry Wentland @ 2016-04-15 12:41 UTC (permalink / raw)
  To: dri-devel

Patch makes sense to me. It looks like when the receiver detects an 
upstream disconnect it will reset its internal state, at least somewhat. 
We've seen that happen when system enters S3 and GPU loses power.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Harry

On 2016-04-13 04:50 PM, Lyude wrote:
> Some hubs are forgetful, and end up forgetting whatever GUID we set
> previously after we do a suspend/resume cycle. This can lead to
> hotplugging breaking (along with probably other things) since the hub
> will start sending connection notifications with the wrong GUID. As
> such, we need to check on resume whether or not the GUID the hub is
> giving us is valid.
>
> Signed-off-by: Lyude <cpaul@redhat.com>
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>   drivers/gpu/drm/drm_dp_mst_topology.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 27fbd79..d2efd78 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -2121,6 +2121,8 @@ int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr)
>   
>   	if (mgr->mst_primary) {
>   		int sret;
> +		u8 guid[16];
> +
>   		sret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, mgr->dpcd, DP_RECEIVER_CAP_SIZE);
>   		if (sret != DP_RECEIVER_CAP_SIZE) {
>   			DRM_DEBUG_KMS("dpcd read failed - undocked during suspend?\n");
> @@ -2135,6 +2137,16 @@ int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr)
>   			ret = -1;
>   			goto out_unlock;
>   		}
> +
> +		/* Some hubs forget their guids after they resume */
> +		sret = drm_dp_dpcd_read(mgr->aux, DP_GUID, guid, 16);
> +		if (sret != 16) {
> +			DRM_DEBUG_KMS("dpcd read failed - undocked during suspend?\n");
> +			ret = -1;
> +			goto out_unlock;
> +		}
> +		drm_dp_check_mstb_guid(mgr->mst_primary, guid);
> +
>   		ret = 0;
>   	} else
>   		ret = -1;

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/dp/mst: Restore primary hub guid on resume
  2016-04-15 12:41 ` Harry Wentland
@ 2016-04-15 13:01   ` Daniel Vetter
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2016-04-15 13:01 UTC (permalink / raw)
  To: Harry Wentland; +Cc: dri-devel

On Fri, Apr 15, 2016 at 08:41:30AM -0400, Harry Wentland wrote:
> Patch makes sense to me. It looks like when the receiver detects an upstream
> disconnect it will reset its internal state, at least somewhat. We've seen
> that happen when system enters S3 and GPU loses power.
> 
> Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Applied to drm-misc, thanks for patch&review.
-Daniel

> 
> Harry
> 
> On 2016-04-13 04:50 PM, Lyude wrote:
> >Some hubs are forgetful, and end up forgetting whatever GUID we set
> >previously after we do a suspend/resume cycle. This can lead to
> >hotplugging breaking (along with probably other things) since the hub
> >will start sending connection notifications with the wrong GUID. As
> >such, we need to check on resume whether or not the GUID the hub is
> >giving us is valid.
> >
> >Signed-off-by: Lyude <cpaul@redhat.com>
> >Signed-off-by: Dave Airlie <airlied@redhat.com>
> >---
> >  drivers/gpu/drm/drm_dp_mst_topology.c | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> >
> >diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
> >index 27fbd79..d2efd78 100644
> >--- a/drivers/gpu/drm/drm_dp_mst_topology.c
> >+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> >@@ -2121,6 +2121,8 @@ int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr)
> >  	if (mgr->mst_primary) {
> >  		int sret;
> >+		u8 guid[16];
> >+
> >  		sret = drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, mgr->dpcd, DP_RECEIVER_CAP_SIZE);
> >  		if (sret != DP_RECEIVER_CAP_SIZE) {
> >  			DRM_DEBUG_KMS("dpcd read failed - undocked during suspend?\n");
> >@@ -2135,6 +2137,16 @@ int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr)
> >  			ret = -1;
> >  			goto out_unlock;
> >  		}
> >+
> >+		/* Some hubs forget their guids after they resume */
> >+		sret = drm_dp_dpcd_read(mgr->aux, DP_GUID, guid, 16);
> >+		if (sret != 16) {
> >+			DRM_DEBUG_KMS("dpcd read failed - undocked during suspend?\n");
> >+			ret = -1;
> >+			goto out_unlock;
> >+		}
> >+		drm_dp_check_mstb_guid(mgr->mst_primary, guid);
> >+
> >  		ret = 0;
> >  	} else
> >  		ret = -1;
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2016-04-15 13:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-13 20:50 [PATCH] drm/dp/mst: Restore primary hub guid on resume Lyude
2016-04-13 20:50 ` Lyude
2016-04-15 12:41 ` Harry Wentland
2016-04-15 13:01   ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.