mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau: Grab runtime PM ref in nv50_mstc_detect()
@ 2018-09-14 20:44 Lyude Paul
  2018-09-21 19:12 ` [Nouveau] " Karol Herbst
  0 siblings, 1 reply; 2+ messages in thread
From: Lyude Paul @ 2018-09-14 20:44 UTC (permalink / raw)
  To: nouveau
  Cc: stable, Ben Skeggs, David Airlie, Daniel Vetter,
	Ville Syrjälä,
	Sean Paul, Ilia Mirkin, dri-devel, linux-kernel

While we currently grab a runtime PM ref in nouveau's normal connector
detection code, we apparently don't do this for MST. This means if we're
in a scenario where the GPU is suspended and userspace attempts to do a
connector probe on an MSTC connector, the probe will fail entirely due
to the DP aux channel and GPU not being woken up:

[  316.633489] nouveau 0000:01:00.0: i2c: aux 000a: begin idle timeout ffffffff
[  316.635713] nouveau 0000:01:00.0: i2c: aux 000a: begin idle timeout ffffffff
[  316.637785] nouveau 0000:01:00.0: i2c: aux 000a: begin idle timeout ffffffff
...

So, grab a runtime PM ref here.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/nouveau/dispnv50/disp.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index c94b7f42d62d..9da0bdfe1e1c 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -938,9 +938,22 @@ static enum drm_connector_status
 nv50_mstc_detect(struct drm_connector *connector, bool force)
 {
 	struct nv50_mstc *mstc = nv50_mstc(connector);
+	enum drm_connector_status conn_status;
+	int ret;
+
 	if (!mstc->port)
 		return connector_status_disconnected;
-	return drm_dp_mst_detect_port(connector, mstc->port->mgr, mstc->port);
+
+	ret = pm_runtime_get_sync(connector->dev->dev);
+	if (ret < 0 && ret != -EACCES)
+		return connector_status_disconnected;
+
+	conn_status = drm_dp_mst_detect_port(connector, mstc->port->mgr,
+					     mstc->port);
+
+	pm_runtime_mark_last_busy(connector->dev->dev);
+	pm_runtime_put_autosuspend(connector->dev->dev);
+	return conn_status;
 }
 
 static void
-- 
2.17.1


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

* Re: [Nouveau] [PATCH] drm/nouveau: Grab runtime PM ref in nv50_mstc_detect()
  2018-09-14 20:44 [PATCH] drm/nouveau: Grab runtime PM ref in nv50_mstc_detect() Lyude Paul
@ 2018-09-21 19:12 ` Karol Herbst
  0 siblings, 0 replies; 2+ messages in thread
From: Karol Herbst @ 2018-09-21 19:12 UTC (permalink / raw)
  To: Lyude Paul
  Cc: nouveau, David Airlie, dri-devel, LKML, stable, Sean Paul,
	Ben Skeggs, Ville Syrjälä

Reviewed-by: Karol Herbst <kherbst@redhat.com>

On Fri, Sep 14, 2018 at 10:44 PM, Lyude Paul <lyude@redhat.com> wrote:
> While we currently grab a runtime PM ref in nouveau's normal connector
> detection code, we apparently don't do this for MST. This means if we're
> in a scenario where the GPU is suspended and userspace attempts to do a
> connector probe on an MSTC connector, the probe will fail entirely due
> to the DP aux channel and GPU not being woken up:
>
> [  316.633489] nouveau 0000:01:00.0: i2c: aux 000a: begin idle timeout ffffffff
> [  316.635713] nouveau 0000:01:00.0: i2c: aux 000a: begin idle timeout ffffffff
> [  316.637785] nouveau 0000:01:00.0: i2c: aux 000a: begin idle timeout ffffffff
> ...
>
> So, grab a runtime PM ref here.
>
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Cc: stable@vger.kernel.org
> ---
>  drivers/gpu/drm/nouveau/dispnv50/disp.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> index c94b7f42d62d..9da0bdfe1e1c 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> @@ -938,9 +938,22 @@ static enum drm_connector_status
>  nv50_mstc_detect(struct drm_connector *connector, bool force)
>  {
>         struct nv50_mstc *mstc = nv50_mstc(connector);
> +       enum drm_connector_status conn_status;
> +       int ret;
> +
>         if (!mstc->port)
>                 return connector_status_disconnected;
> -       return drm_dp_mst_detect_port(connector, mstc->port->mgr, mstc->port);
> +
> +       ret = pm_runtime_get_sync(connector->dev->dev);
> +       if (ret < 0 && ret != -EACCES)
> +               return connector_status_disconnected;
> +
> +       conn_status = drm_dp_mst_detect_port(connector, mstc->port->mgr,
> +                                            mstc->port);
> +
> +       pm_runtime_mark_last_busy(connector->dev->dev);
> +       pm_runtime_put_autosuspend(connector->dev->dev);
> +       return conn_status;
>  }
>
>  static void
> --
> 2.17.1
>
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau

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

end of thread, other threads:[~2018-09-21 19:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-14 20:44 [PATCH] drm/nouveau: Grab runtime PM ref in nv50_mstc_detect() Lyude Paul
2018-09-21 19:12 ` [Nouveau] " Karol Herbst

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®