* [PATCH 1/2] drm/nouveau/kms/nv50-: Disable AUX bus for disconnected DP ports [not found] <20240404233736.7946-1-lyude@redhat.com> @ 2024-04-04 23:35 ` Lyude Paul 2024-04-08 22:28 ` Dave Airlie 2024-04-04 23:35 ` [PATCH 2/2] drm/nouveau/dp: Don't probe eDP ports twice harder Lyude Paul 1 sibling, 1 reply; 3+ messages in thread From: Lyude Paul @ 2024-04-04 23:35 UTC (permalink / raw) To: nouveau, dri-devel Cc: Karol Herbst, Danilo Krummrich, David Airlie, Daniel Vetter, open list GSP has its own state for keeping track of whether or not a given display connector is plugged in or not, and enforces this state on the driver. In particular, AUX transactions on a DisplayPort connector which GSP says is disconnected can never succeed - and can in some cases even cause unexpected timeouts, which can trickle up to cause other problems. A good example of this is runtime power management: where we can actually get stuck trying to resume the GPU if a userspace application like fwupd tries accessing a drm_aux_dev for a disconnected port. This was an issue I hit a few times with my Slimbook Executive 16 - where trying to offload something to the discrete GPU would wake it up, and then potentially cause it to timeout as fwupd tried to immediately access the dp_aux_dev nodes for nouveau. Likewise: we don't really have any cases I know of where we'd want to ignore this state and try an aux transaction anyway - and failing pointless aux transactions immediately can even speed things up. So - let's start enabling/disabling the aux bus in nouveau_dp_detect() to fix this. We enable the aux bus during connector probing, and leave it enabled if we discover something is actually on the connector. Otherwise, we just shut it off. This should fix some people's runtime PM issues (like myself), and also get rid of quite of a lot of GSP error spam in dmesg. Signed-off-by: Lyude Paul <lyude@redhat.com> --- drivers/gpu/drm/nouveau/nouveau_dp.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c b/drivers/gpu/drm/nouveau/nouveau_dp.c index fb06ee17d9e54..8b1be7dd64ebe 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dp.c +++ b/drivers/gpu/drm/nouveau/nouveau_dp.c @@ -232,6 +232,9 @@ nouveau_dp_detect(struct nouveau_connector *nv_connector, dpcd[DP_DPCD_REV] != 0) return NOUVEAU_DP_SST; + // Ensure that the aux bus is enabled for probing + drm_dp_dpcd_set_powered(&nv_connector->aux, true); + mutex_lock(&nv_encoder->dp.hpd_irq_lock); if (mstm) { /* If we're not ready to handle MST state changes yet, just @@ -293,6 +296,13 @@ nouveau_dp_detect(struct nouveau_connector *nv_connector, if (mstm && !mstm->suspended && ret != NOUVEAU_DP_MST) nv50_mstm_remove(mstm); + /* GSP doesn't like when we try to do aux transactions on a port it considers disconnected, + * and since we don't really have a usecase for that anyway - just disable the aux bus here + * if we've decided the connector is disconnected + */ + if (ret == NOUVEAU_DP_NONE) + drm_dp_dpcd_set_powered(&nv_connector->aux, false); + mutex_unlock(&nv_encoder->dp.hpd_irq_lock); return ret; } -- 2.44.0 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] drm/nouveau/kms/nv50-: Disable AUX bus for disconnected DP ports 2024-04-04 23:35 ` [PATCH 1/2] drm/nouveau/kms/nv50-: Disable AUX bus for disconnected DP ports Lyude Paul @ 2024-04-08 22:28 ` Dave Airlie 0 siblings, 0 replies; 3+ messages in thread From: Dave Airlie @ 2024-04-08 22:28 UTC (permalink / raw) To: Lyude Paul Cc: nouveau, dri-devel, Karol Herbst, Danilo Krummrich, Daniel Vetter, open list On Fri, 5 Apr 2024 at 09:37, Lyude Paul <lyude@redhat.com> wrote: > > GSP has its own state for keeping track of whether or not a given display > connector is plugged in or not, and enforces this state on the driver. In > particular, AUX transactions on a DisplayPort connector which GSP says is > disconnected can never succeed - and can in some cases even cause > unexpected timeouts, which can trickle up to cause other problems. A good > example of this is runtime power management: where we can actually get > stuck trying to resume the GPU if a userspace application like fwupd tries > accessing a drm_aux_dev for a disconnected port. This was an issue I hit a > few times with my Slimbook Executive 16 - where trying to offload something > to the discrete GPU would wake it up, and then potentially cause it to > timeout as fwupd tried to immediately access the dp_aux_dev nodes for > nouveau. > > Likewise: we don't really have any cases I know of where we'd want to > ignore this state and try an aux transaction anyway - and failing pointless > aux transactions immediately can even speed things up. So - let's start > enabling/disabling the aux bus in nouveau_dp_detect() to fix this. We > enable the aux bus during connector probing, and leave it enabled if we > discover something is actually on the connector. Otherwise, we just shut it > off. > > This should fix some people's runtime PM issues (like myself), and also get > rid of quite of a lot of GSP error spam in dmesg. > > Signed-off-by: Lyude Paul <lyude@redhat.com> For the two patches, Reviewed-by: Dave Airlie <airlied@redhat.com> > --- > drivers/gpu/drm/nouveau/nouveau_dp.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c b/drivers/gpu/drm/nouveau/nouveau_dp.c > index fb06ee17d9e54..8b1be7dd64ebe 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_dp.c > +++ b/drivers/gpu/drm/nouveau/nouveau_dp.c > @@ -232,6 +232,9 @@ nouveau_dp_detect(struct nouveau_connector *nv_connector, > dpcd[DP_DPCD_REV] != 0) > return NOUVEAU_DP_SST; > > + // Ensure that the aux bus is enabled for probing > + drm_dp_dpcd_set_powered(&nv_connector->aux, true); > + > mutex_lock(&nv_encoder->dp.hpd_irq_lock); > if (mstm) { > /* If we're not ready to handle MST state changes yet, just > @@ -293,6 +296,13 @@ nouveau_dp_detect(struct nouveau_connector *nv_connector, > if (mstm && !mstm->suspended && ret != NOUVEAU_DP_MST) > nv50_mstm_remove(mstm); > > + /* GSP doesn't like when we try to do aux transactions on a port it considers disconnected, > + * and since we don't really have a usecase for that anyway - just disable the aux bus here > + * if we've decided the connector is disconnected > + */ > + if (ret == NOUVEAU_DP_NONE) > + drm_dp_dpcd_set_powered(&nv_connector->aux, false); > + > mutex_unlock(&nv_encoder->dp.hpd_irq_lock); > return ret; > } > -- > 2.44.0 > ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] drm/nouveau/dp: Don't probe eDP ports twice harder [not found] <20240404233736.7946-1-lyude@redhat.com> 2024-04-04 23:35 ` [PATCH 1/2] drm/nouveau/kms/nv50-: Disable AUX bus for disconnected DP ports Lyude Paul @ 2024-04-04 23:35 ` Lyude Paul 1 sibling, 0 replies; 3+ messages in thread From: Lyude Paul @ 2024-04-04 23:35 UTC (permalink / raw) To: nouveau, dri-devel Cc: Karol Herbst, Danilo Krummrich, David Airlie, Daniel Vetter, open list I didn't pay close enough attention the last time I tried to fix this problem - while we currently do correctly take care to make sure we don't probe a connected eDP port more then once, we don't do the same thing for eDP ports we found to be disconnected. So, fix this and make sure we only ever probe eDP ports once and then leave them at that connector state forever (since without HPD, it's not going to change on its own anyway). This should get rid of the last few GSP errors getting spit out during runtime suspend and resume on some machines, as we tried to reprobe eDP ports in response to ACPI hotplug probe events. Signed-off-by: Lyude Paul <lyude@redhat.com> --- drivers/gpu/drm/nouveau/nouveau_dp.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c b/drivers/gpu/drm/nouveau/nouveau_dp.c index 8b1be7dd64ebe..8b27d372e86da 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dp.c +++ b/drivers/gpu/drm/nouveau/nouveau_dp.c @@ -225,12 +225,16 @@ nouveau_dp_detect(struct nouveau_connector *nv_connector, u8 *dpcd = nv_encoder->dp.dpcd; int ret = NOUVEAU_DP_NONE, hpd; - /* If we've already read the DPCD on an eDP device, we don't need to - * reread it as it won't change + /* eDP ports don't support hotplugging - so there's no point in probing eDP ports unless we + * haven't probed them once before. */ - if (connector->connector_type == DRM_MODE_CONNECTOR_eDP && - dpcd[DP_DPCD_REV] != 0) - return NOUVEAU_DP_SST; + if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { + if (connector->status == connector_status_connected) { + return NOUVEAU_DP_SST; + } else if (connector->status == connector_status_disconnected) { + return NOUVEAU_DP_NONE; + } + } // Ensure that the aux bus is enabled for probing drm_dp_dpcd_set_powered(&nv_connector->aux, true); -- 2.44.0 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-08 22:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20240404233736.7946-1-lyude@redhat.com>
2024-04-04 23:35 ` [PATCH 1/2] drm/nouveau/kms/nv50-: Disable AUX bus for disconnected DP ports Lyude Paul
2024-04-08 22:28 ` Dave Airlie
2024-04-04 23:35 ` [PATCH 2/2] drm/nouveau/dp: Don't probe eDP ports twice harder Lyude Paul
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®