From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lyude Paul Subject: [PATCH v5 09/14] drm/nouveau: Don't grab runtime PM refs for HPD IRQs Date: Mon, 21 Oct 2019 22:36:04 -0400 Message-ID: <20191022023641.8026-10-lyude@redhat.com> References: <20191022023641.8026-1-lyude@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20191022023641.8026-1-lyude@redhat.com> Sender: linux-kernel-owner@vger.kernel.org To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: Juston Li , Imre Deak , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Harry Wentland , Daniel Vetter , Sean Paul , Ben Skeggs , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org List-Id: intel-gfx@lists.freedesktop.org In order for suspend/resume reprobing to work, we need to be able to perform sideband communications during suspend/resume, along with runtime PM suspend/resume. In order to do so, we also need to make sure that nouveau doesn't bother grabbing a runtime PM reference to do so, since otherwise we'll start deadlocking runtime PM again. Note that we weren't able to do this before, because of the DP MST helpers processing UP requests from topologies in the same context as drm_dp_mst_hpd_irq() which would have caused us to open ourselves up to receiving hotplug events and deadlocking with runtime suspend/resume. Now that those requests are handled asynchronously, this change should be completely safe. Cc: Juston Li Cc: Imre Deak Cc: Ville Syrj=C3=A4l=C3=A4 Cc: Harry Wentland Cc: Daniel Vetter Reviewed-by: Sean Paul Signed-off-by: Lyude Paul --- drivers/gpu/drm/nouveau/nouveau_connector.c | 33 +++++++++++---------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/= nouveau/nouveau_connector.c index 3a5db17bc5c7..5b413588b823 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -1130,6 +1130,16 @@ nouveau_connector_hotplug(struct nvif_notify *notify= ) =09const char *name =3D connector->name; =09struct nouveau_encoder *nv_encoder; =09int ret; +=09bool plugged =3D (rep->mask !=3D NVIF_NOTIFY_CONN_V0_UNPLUG); + +=09if (rep->mask & NVIF_NOTIFY_CONN_V0_IRQ) { +=09=09NV_DEBUG(drm, "service %s\n", name); +=09=09drm_dp_cec_irq(&nv_connector->aux); +=09=09if ((nv_encoder =3D find_encoder(connector, DCB_OUTPUT_DP))) +=09=09=09nv50_mstm_service(nv_encoder->dp.mstm); + +=09=09return NVIF_NOTIFY_KEEP; +=09} =20 =09ret =3D pm_runtime_get(drm->dev->dev); =09if (ret =3D=3D 0) { @@ -1150,25 +1160,16 @@ nouveau_connector_hotplug(struct nvif_notify *notif= y) =09=09return NVIF_NOTIFY_DROP; =09} =20 -=09if (rep->mask & NVIF_NOTIFY_CONN_V0_IRQ) { -=09=09NV_DEBUG(drm, "service %s\n", name); -=09=09drm_dp_cec_irq(&nv_connector->aux); -=09=09if ((nv_encoder =3D find_encoder(connector, DCB_OUTPUT_DP))) -=09=09=09nv50_mstm_service(nv_encoder->dp.mstm); -=09} else { -=09=09bool plugged =3D (rep->mask !=3D NVIF_NOTIFY_CONN_V0_UNPLUG); - +=09if (!plugged) +=09=09drm_dp_cec_unset_edid(&nv_connector->aux); +=09NV_DEBUG(drm, "%splugged %s\n", plugged ? "" : "un", name); +=09if ((nv_encoder =3D find_encoder(connector, DCB_OUTPUT_DP))) { =09=09if (!plugged) -=09=09=09drm_dp_cec_unset_edid(&nv_connector->aux); -=09=09NV_DEBUG(drm, "%splugged %s\n", plugged ? "" : "un", name); -=09=09if ((nv_encoder =3D find_encoder(connector, DCB_OUTPUT_DP))) { -=09=09=09if (!plugged) -=09=09=09=09nv50_mstm_remove(nv_encoder->dp.mstm); -=09=09} - -=09=09drm_helper_hpd_irq_event(connector->dev); +=09=09=09nv50_mstm_remove(nv_encoder->dp.mstm); =09} =20 +=09drm_helper_hpd_irq_event(connector->dev); + =09pm_runtime_mark_last_busy(drm->dev->dev); =09pm_runtime_put_autosuspend(drm->dev->dev); =09return NVIF_NOTIFY_KEEP; --=20 2.21.0