diff mbox series

[04/12] drm/i915: Disable intel HPD poll after DRM poll init/enable

Message ID 20240104083008.2715733-5-imre.deak@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Fix HPD handling during driver init/shutdown | expand

Commit Message

Imre Deak Jan. 4, 2024, 8:30 a.m. UTC
The only purpose of intel_hpd_poll_disable() during driver loading and
system resume - at which point polling should be disabled anyway, except
for connectors in an IRQ storm, for which the polling will stay enabled -
is to force-detect all the connectors. However this detection in
i915_hpd_poll_init_work() depends on drm.mode_config.poll_enabled, which
will get set in drm_kms_helper_poll_init(), possibly after
i915_hpd_poll_init_work() is scheduled. Hence the initial detection of
connectors during driver loading may not happen.

Fix the above by moving intel_hpd_poll_disable() after
i915_hpd_poll_init_work(), the proper place anyway for doing the above
detection after all the HW initialization steps are complete. Change the
order the same way during system resume as well. The above race
condition shouldn't matter here - as drm.mode_config.poll_enabled will
be set - but the detection should happen here as well after the HW init
steps are done.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display_driver.c | 2 +-
 drivers/gpu/drm/i915/i915_driver.c                  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Hogander, Jouni Jan. 8, 2024, 6:23 a.m. UTC | #1
On Thu, 2024-01-04 at 10:30 +0200, Imre Deak wrote:
> The only purpose of intel_hpd_poll_disable() during driver loading
> and
> system resume - at which point polling should be disabled anyway,
> except
> for connectors in an IRQ storm, for which the polling will stay
> enabled -
> is to force-detect all the connectors. However this detection in
> i915_hpd_poll_init_work() depends on drm.mode_config.poll_enabled,
> which
> will get set in drm_kms_helper_poll_init(), possibly after
> i915_hpd_poll_init_work() is scheduled. Hence the initial detection
> of
> connectors during driver loading may not happen.
> 
> Fix the above by moving intel_hpd_poll_disable() after
> i915_hpd_poll_init_work(), the proper place anyway for doing the
> above
> detection after all the HW initialization steps are complete. Change
> the
> order the same way during system resume as well. The above race
> condition shouldn't matter here - as drm.mode_config.poll_enabled
> will
> be set - but the detection should happen here as well after the HW
> init
> steps are done.
> 
> Signed-off-by: Imre Deak <imre.deak@intel.com>

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_display_driver.c | 2 +-
>  drivers/gpu/drm/i915/i915_driver.c                  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c
> b/drivers/gpu/drm/i915/display/intel_display_driver.c
> index da549962feccd..1974f2394a518 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_driver.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
> @@ -374,7 +374,6 @@ int intel_display_driver_probe(struct
> drm_i915_private *i915)
>  
>         /* Only enable hotplug handling once the fbdev is fully set
> up. */
>         intel_hpd_init(i915);
> -       intel_hpd_poll_disable(i915);
>  
>         skl_watermark_ipc_init(i915);
>  
> @@ -412,6 +411,7 @@ void intel_display_driver_register(struct
> drm_i915_private *i915)
>          * fbdev->async_cookie.
>          */
>         drm_kms_helper_poll_init(&i915->drm);
> +       intel_hpd_poll_disable(i915);
>  
>         intel_display_device_info_print(DISPLAY_INFO(i915),
>                                         DISPLAY_RUNTIME_INFO(i915),
> &p);
> diff --git a/drivers/gpu/drm/i915/i915_driver.c
> b/drivers/gpu/drm/i915/i915_driver.c
> index c7d7c3b7ecc63..be86596a8904d 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -1249,9 +1249,9 @@ static int i915_drm_resume(struct drm_device
> *dev)
>         intel_dp_mst_resume(dev_priv);
>         intel_display_driver_resume(dev_priv);
>  
> -       intel_hpd_poll_disable(dev_priv);
>         if (HAS_DISPLAY(dev_priv))
>                 drm_kms_helper_poll_enable(dev);
> +       intel_hpd_poll_disable(dev_priv);
>  
>         intel_opregion_resume(dev_priv);
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c
index da549962feccd..1974f2394a518 100644
--- a/drivers/gpu/drm/i915/display/intel_display_driver.c
+++ b/drivers/gpu/drm/i915/display/intel_display_driver.c
@@ -374,7 +374,6 @@  int intel_display_driver_probe(struct drm_i915_private *i915)
 
 	/* Only enable hotplug handling once the fbdev is fully set up. */
 	intel_hpd_init(i915);
-	intel_hpd_poll_disable(i915);
 
 	skl_watermark_ipc_init(i915);
 
@@ -412,6 +411,7 @@  void intel_display_driver_register(struct drm_i915_private *i915)
 	 * fbdev->async_cookie.
 	 */
 	drm_kms_helper_poll_init(&i915->drm);
+	intel_hpd_poll_disable(i915);
 
 	intel_display_device_info_print(DISPLAY_INFO(i915),
 					DISPLAY_RUNTIME_INFO(i915), &p);
diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
index c7d7c3b7ecc63..be86596a8904d 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -1249,9 +1249,9 @@  static int i915_drm_resume(struct drm_device *dev)
 	intel_dp_mst_resume(dev_priv);
 	intel_display_driver_resume(dev_priv);
 
-	intel_hpd_poll_disable(dev_priv);
 	if (HAS_DISPLAY(dev_priv))
 		drm_kms_helper_poll_enable(dev);
+	intel_hpd_poll_disable(dev_priv);
 
 	intel_opregion_resume(dev_priv);