From: Imre Deak <imre.deak@intel.com>
To: "Hogander, Jouni" <jouni.hogander@intel.com>
Cc: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 01/12] drm/i915: Init DRM connector polled field early
Date: Fri, 5 Jan 2024 15:12:00 +0200 [thread overview]
Message-ID: <ZZgAICxajop85NKL@ideak-desk.fi.intel.com> (raw)
In-Reply-To: <9ac27342f4402fe90c1233b88ed92c89580e206e.camel@intel.com>
On Fri, Jan 05, 2024 at 02:54:06PM +0200, Hogander, Jouni wrote:
> On Thu, 2024-01-04 at 10:29 +0200, Imre Deak wrote:
> > After an HPD IRQ storm on a connector intel_hpd_irq_storm_detect()
> > will
> > set the connector's HPD pin state to HPD_MARK_DISABLED and the IRQ
> > gets
> > disabled. Subsequently intel_hpd_irq_storm_switch_to_polling() will
> > enable polling for these connectors, setting the pin state to
> > HPD_DISABLED, but only if the connector's base.polled field is set to
> > DRM_CONNECTOR_POLL_HPD. intel_hpd_irq_storm_reenable_work() will
> > reenable the IRQ - after 2 minutes - if the pin state is
> > HPD_DISABLED.
> >
> > The connectors will be created with their base.polled field set to 0,
> > which gets initialized only later in i915_hpd_poll_init_work() (using
> > intel_connector::polled). If a storm is detected on a connector after
> > it's created and IRQs are enabled on it - by intel_hpd_init() - and
> > before its bease.polled field is initialized in the above work, the
> > connector's HPD pin will stay in the HPD_MARK_DISABLED state -
> > leaving
> > the IRQ disabled indefinitely - and polling will not get enabled on
> > it as
> > intended.
> >
> > I can't see a reason for initializing base.polled in a delayed
> > manner,
> > so do this already when creating the connector, to prevent the above
> > race condition.
>
> To me it looks like intel_connector::polled is used just to store
> original drm_connector::polled value and restore it in
> intel_hpd_irq_storm_reenable_work:
>
> if (connector->base.polled != connector->polled)
> drm_dbg(&dev_priv->drm,
> "Reenabling HPD on connector %s\n",
> connector->base.name);
> connector->base.polled = connector->polled;
Correct and restored similarly in i915_hpd_poll_init_work(). Originaly
intel_connector::polled was added to avoid misconfiguring a connector's
polled state in these two places if the two connectors share an HPD pin
(one of them needing polling the other one using the HPD pin; not sure
the exact scenario where this is actually possible). But I can't see why
at this moment we couldn't initialize the original base.polled value
early.
> From this perspective it is right thing to do to initialize connector-
> base.polled as you are doing in this patch.
>
> Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
>
> >
> > Signed-off-by: Imre Deak <imre.deak@intel.com>
> > ---
> > drivers/gpu/drm/i915/display/intel_crt.c | 1 +
> > drivers/gpu/drm/i915/display/intel_dp.c | 1 +
> > drivers/gpu/drm/i915/display/intel_dvo.c | 1 +
> > drivers/gpu/drm/i915/display/intel_hdmi.c | 1 +
> > drivers/gpu/drm/i915/display/intel_sdvo.c | 2 ++
> > drivers/gpu/drm/i915/display/intel_tv.c | 1 +
> > 6 files changed, 7 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_crt.c
> > b/drivers/gpu/drm/i915/display/intel_crt.c
> > index abaacea5c2cc4..b330337b842a4 100644
> > --- a/drivers/gpu/drm/i915/display/intel_crt.c
> > +++ b/drivers/gpu/drm/i915/display/intel_crt.c
> > @@ -1069,6 +1069,7 @@ void intel_crt_init(struct drm_i915_private
> > *dev_priv)
> > } else {
> > intel_connector->polled = DRM_CONNECTOR_POLL_CONNECT;
> > }
> > + intel_connector->base.polled = intel_connector->polled;
> >
> > if (HAS_DDI(dev_priv)) {
> > assert_port_valid(dev_priv, PORT_E);
> > diff --git a/drivers/gpu/drm/i915/display/intel_dp.c
> > b/drivers/gpu/drm/i915/display/intel_dp.c
> > index 9ff0cbd9c0df5..fed649af8fc85 100644
> > --- a/drivers/gpu/drm/i915/display/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> > @@ -6469,6 +6469,7 @@ intel_dp_init_connector(struct
> > intel_digital_port *dig_port,
> > connector->interlace_allowed = true;
> >
> > intel_connector->polled = DRM_CONNECTOR_POLL_HPD;
> > + intel_connector->base.polled = intel_connector->polled;
> >
> > intel_connector_attach_encoder(intel_connector,
> > intel_encoder);
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_dvo.c
> > b/drivers/gpu/drm/i915/display/intel_dvo.c
> > index 9111e9d46486d..83898ba493d16 100644
> > --- a/drivers/gpu/drm/i915/display/intel_dvo.c
> > +++ b/drivers/gpu/drm/i915/display/intel_dvo.c
> > @@ -536,6 +536,7 @@ void intel_dvo_init(struct drm_i915_private
> > *i915)
> > if (intel_dvo->dev.type == INTEL_DVO_CHIP_TMDS)
> > connector->polled = DRM_CONNECTOR_POLL_CONNECT |
> > DRM_CONNECTOR_POLL_DISCONNECT;
> > + connector->base.polled = connector->polled;
> >
> > drm_connector_init_with_ddc(&i915->drm, &connector->base,
> > &intel_dvo_connector_funcs,
> > diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c
> > b/drivers/gpu/drm/i915/display/intel_hdmi.c
> > index eedef8121ff7c..55048c56bc527 100644
> > --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
> > +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
> > @@ -3017,6 +3017,7 @@ void intel_hdmi_init_connector(struct
> > intel_digital_port *dig_port,
> > connector->ycbcr_420_allowed = true;
> >
> > intel_connector->polled = DRM_CONNECTOR_POLL_HPD;
> > + intel_connector->base.polled = intel_connector->polled;
> >
> > if (HAS_DDI(dev_priv))
> > intel_connector->get_hw_state =
> > intel_ddi_connector_get_hw_state;
> > diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c
> > b/drivers/gpu/drm/i915/display/intel_sdvo.c
> > index 9218047495fb4..4e4a87f841787 100644
> > --- a/drivers/gpu/drm/i915/display/intel_sdvo.c
> > +++ b/drivers/gpu/drm/i915/display/intel_sdvo.c
> > @@ -2805,6 +2805,7 @@ intel_sdvo_dvi_init(struct intel_sdvo
> > *intel_sdvo, u16 type)
> > } else {
> > intel_connector->polled = DRM_CONNECTOR_POLL_CONNECT
> > | DRM_CONNECTOR_POLL_DISCONNECT;
> > }
> > + intel_connector->base.polled = intel_connector->polled;
> > encoder->encoder_type = DRM_MODE_ENCODER_TMDS;
> > connector->connector_type = DRM_MODE_CONNECTOR_DVID;
> >
> > @@ -2880,6 +2881,7 @@ intel_sdvo_analog_init(struct intel_sdvo
> > *intel_sdvo, u16 type)
> > intel_connector = &intel_sdvo_connector->base;
> > connector = &intel_connector->base;
> > intel_connector->polled = DRM_CONNECTOR_POLL_CONNECT;
> > + intel_connector->base.polled = intel_connector->polled;
> > encoder->encoder_type = DRM_MODE_ENCODER_DAC;
> > connector->connector_type = DRM_MODE_CONNECTOR_VGA;
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_tv.c
> > b/drivers/gpu/drm/i915/display/intel_tv.c
> > index d4386cb3569e0..f3598fe39fda5 100644
> > --- a/drivers/gpu/drm/i915/display/intel_tv.c
> > +++ b/drivers/gpu/drm/i915/display/intel_tv.c
> > @@ -1990,6 +1990,7 @@ intel_tv_init(struct drm_i915_private
> > *dev_priv)
> > * More recent chipsets favour HDMI rather than integrated S-
> > Video.
> > */
> > intel_connector->polled = DRM_CONNECTOR_POLL_CONNECT;
> > + intel_connector->base.polled = intel_connector->polled;
> >
> > drm_connector_init(&dev_priv->drm, connector,
> > &intel_tv_connector_funcs,
> > DRM_MODE_CONNECTOR_SVIDEO);
>
next prev parent reply other threads:[~2024-01-05 13:11 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-04 8:29 [PATCH 00/12] drm/i915: Fix HPD handling during driver init/shutdown Imre Deak
2024-01-04 8:29 ` [PATCH 01/12] drm/i915: Init DRM connector polled field early Imre Deak
2024-01-05 12:54 ` Hogander, Jouni
2024-01-05 13:12 ` Imre Deak [this message]
2024-01-04 8:29 ` [PATCH 02/12] drm/i915: Keep the connector polled state disabled after storm Imre Deak
2024-01-05 13:23 ` Hogander, Jouni
2024-01-05 13:38 ` Imre Deak
2024-01-05 14:08 ` Hogander, Jouni
2024-01-05 14:22 ` Imre Deak
2024-01-04 8:29 ` [PATCH 03/12] drm/i915: Move audio deinit after disabling polling Imre Deak
2024-01-05 13:42 ` Hogander, Jouni
2024-01-04 8:30 ` [PATCH 04/12] drm/i915: Disable intel HPD poll after DRM poll init/enable Imre Deak
2024-01-08 6:23 ` Hogander, Jouni
2024-01-04 8:30 ` [PATCH 05/12] drm/i915: Suspend the framebuffer console during driver shutdown Imre Deak
2024-01-08 7:51 ` Hogander, Jouni
2024-01-04 8:30 ` [PATCH 06/12] drm/i915: Suspend the framebuffer console earlier during system suspend Imre Deak
2024-01-08 7:51 ` Hogander, Jouni
2024-01-04 8:30 ` [PATCH 07/12] drm/i915: Prevent modesets during driver init/shutdown Imre Deak
2024-01-04 13:23 ` [PATCH v2 " Imre Deak
2024-01-08 8:31 ` [PATCH " Hogander, Jouni
2024-01-08 9:20 ` Imre Deak
2024-01-08 9:44 ` Hogander, Jouni
2024-01-08 12:34 ` Hogander, Jouni
2024-01-04 8:30 ` [PATCH 08/12] drm/i915: Disable hotplug detection works " Imre Deak
2024-01-08 9:40 ` Hogander, Jouni
2024-01-04 8:30 ` [PATCH 09/12] drm/i915: Disable hotplug detection handlers " Imre Deak
2024-01-08 9:59 ` Hogander, Jouni
2024-01-04 8:30 ` [PATCH 10/12] drm/i915: Add intel_digital_port lock/unlock hooks Imre Deak
2024-01-08 10:08 ` Hogander, Jouni
2024-01-04 8:30 ` [PATCH 11/12] drm/i915: Filter out glitches on HPD lines during hotplug detection Imre Deak
2024-01-08 10:25 ` Hogander, Jouni
2024-01-04 8:30 ` [PATCH 12/12] drm/i915/dp: Abort AUX on disconnected native DP ports Imre Deak
2024-01-08 10:33 ` Hogander, Jouni
2024-01-04 12:39 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Fix HPD handling during driver init/shutdown Patchwork
2024-01-04 12:39 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-01-04 12:57 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-01-04 13:50 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Fix HPD handling during driver init/shutdown (rev2) Patchwork
2024-01-04 13:50 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-01-04 14:08 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-01-04 16:00 ` Imre Deak
2024-01-05 7:12 ` Illipilli, TejasreeX
2024-01-05 7:11 ` ✓ Fi.CI.BAT: success " Patchwork
2024-01-05 8:38 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-01-08 18:19 ` Imre Deak
2024-01-10 11:40 ` Illipilli, TejasreeX
2024-01-10 9:45 ` Patchwork
2024-01-10 10:03 ` Patchwork
2024-01-10 11:11 ` ✓ Fi.CI.IGT: success " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZZgAICxajop85NKL@ideak-desk.fi.intel.com \
--to=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jouni.hogander@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox