Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 09/12] drm/i915: Disable hotplug detection handlers during driver init/shutdown
Date: Thu,  4 Jan 2024 10:30:05 +0200	[thread overview]
Message-ID: <20240104083008.2715733-10-imre.deak@intel.com> (raw)
In-Reply-To: <20240104083008.2715733-1-imre.deak@intel.com>

As described in the previous two patches an unexpected connector
detection can happen during the init/shutdown sequences. Prevent these
by returning the connector's current status from the detection handlers.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/display/intel_crt.c    | 4 ++++
 drivers/gpu/drm/i915/display/intel_dp.c     | 8 ++++++++
 drivers/gpu/drm/i915/display/intel_dp_mst.c | 4 ++++
 drivers/gpu/drm/i915/display/intel_dvo.c    | 4 ++++
 drivers/gpu/drm/i915/display/intel_hdmi.c   | 7 +++++++
 drivers/gpu/drm/i915/display/intel_panel.c  | 4 ++++
 drivers/gpu/drm/i915/display/intel_sdvo.c   | 4 ++++
 drivers/gpu/drm/i915/display/intel_tv.c     | 4 ++++
 8 files changed, 39 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_crt.c b/drivers/gpu/drm/i915/display/intel_crt.c
index b330337b842a4..b9733a73e21d4 100644
--- a/drivers/gpu/drm/i915/display/intel_crt.c
+++ b/drivers/gpu/drm/i915/display/intel_crt.c
@@ -42,6 +42,7 @@
 #include "intel_ddi.h"
 #include "intel_ddi_buf_trans.h"
 #include "intel_de.h"
+#include "intel_display_driver.h"
 #include "intel_display_types.h"
 #include "intel_fdi.h"
 #include "intel_fdi_regs.h"
@@ -846,6 +847,9 @@ intel_crt_detect(struct drm_connector *connector,
 	if (!intel_display_device_enabled(dev_priv))
 		return connector_status_disconnected;
 
+	if (!intel_display_driver_check_access(dev_priv))
+		return connector->status;
+
 	if (dev_priv->display.params.load_detect_test) {
 		wakeref = intel_display_power_get(dev_priv,
 						  intel_encoder->power_domain);
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 96ec6f1554c60..61c11f475f54a 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -56,6 +56,7 @@
 #include "intel_cx0_phy.h"
 #include "intel_ddi.h"
 #include "intel_de.h"
+#include "intel_display_driver.h"
 #include "intel_display_types.h"
 #include "intel_dp.h"
 #include "intel_dp_aux.h"
@@ -5642,6 +5643,9 @@ intel_dp_detect(struct drm_connector *connector,
 	if (!intel_display_device_enabled(dev_priv))
 		return connector_status_disconnected;
 
+	if (!intel_display_driver_check_access(dev_priv))
+		return connector->status;
+
 	/* Can't disconnect eDP */
 	if (intel_dp_is_edp(intel_dp))
 		status = edp_detect(intel_dp);
@@ -5742,6 +5746,10 @@ intel_dp_force(struct drm_connector *connector)
 
 	drm_dbg_kms(&dev_priv->drm, "[CONNECTOR:%d:%s]\n",
 		    connector->base.id, connector->name);
+
+	if (!intel_display_driver_check_access(dev_priv))
+		return;
+
 	intel_dp_unset_edid(intel_dp);
 
 	if (connector->status != connector_status_connected)
diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
index 8a94323350303..5fa25a5a36b55 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
@@ -37,6 +37,7 @@
 #include "intel_crtc.h"
 #include "intel_ddi.h"
 #include "intel_de.h"
+#include "intel_display_driver.h"
 #include "intel_display_types.h"
 #include "intel_dp.h"
 #include "intel_dp_hdcp.h"
@@ -1410,6 +1411,9 @@ intel_dp_mst_detect(struct drm_connector *connector,
 	if (drm_connector_is_unregistered(connector))
 		return connector_status_disconnected;
 
+	if (!intel_display_driver_check_access(i915))
+		return connector->status;
+
 	return drm_dp_mst_detect_port(connector, ctx, &intel_dp->mst_mgr,
 				      intel_connector->port);
 }
diff --git a/drivers/gpu/drm/i915/display/intel_dvo.c b/drivers/gpu/drm/i915/display/intel_dvo.c
index 83898ba493d16..8ca9ae4798a89 100644
--- a/drivers/gpu/drm/i915/display/intel_dvo.c
+++ b/drivers/gpu/drm/i915/display/intel_dvo.c
@@ -35,6 +35,7 @@
 #include "i915_reg.h"
 #include "intel_connector.h"
 #include "intel_de.h"
+#include "intel_display_driver.h"
 #include "intel_display_types.h"
 #include "intel_dvo.h"
 #include "intel_dvo_dev.h"
@@ -328,6 +329,9 @@ intel_dvo_detect(struct drm_connector *_connector, bool force)
 	if (!intel_display_device_enabled(i915))
 		return connector_status_disconnected;
 
+	if (!intel_display_driver_check_access(i915))
+		return connector->base.status;
+
 	return intel_dvo->dev.dev_ops->detect(&intel_dvo->dev);
 }
 
diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c
index 55048c56bc527..7020e58061092 100644
--- a/drivers/gpu/drm/i915/display/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
@@ -49,6 +49,7 @@
 #include "intel_cx0_phy.h"
 #include "intel_ddi.h"
 #include "intel_de.h"
+#include "intel_display_driver.h"
 #include "intel_display_types.h"
 #include "intel_dp.h"
 #include "intel_gmbus.h"
@@ -2505,6 +2506,9 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
 	if (!intel_display_device_enabled(dev_priv))
 		return connector_status_disconnected;
 
+	if (!intel_display_driver_check_access(dev_priv))
+		return connector->status;
+
 	wakeref = intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
 
 	if (DISPLAY_VER(dev_priv) >= 11 &&
@@ -2533,6 +2537,9 @@ intel_hdmi_force(struct drm_connector *connector)
 	drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s]\n",
 		    connector->base.id, connector->name);
 
+	if (!intel_display_driver_check_access(i915))
+		return;
+
 	intel_hdmi_unset_edid(connector);
 
 	if (connector->status != connector_status_connected)
diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
index 0d8e5320a4f88..073ea3166c360 100644
--- a/drivers/gpu/drm/i915/display/intel_panel.c
+++ b/drivers/gpu/drm/i915/display/intel_panel.c
@@ -37,6 +37,7 @@
 #include "intel_backlight.h"
 #include "intel_connector.h"
 #include "intel_de.h"
+#include "intel_display_driver.h"
 #include "intel_display_types.h"
 #include "intel_drrs.h"
 #include "intel_lvds_regs.h"
@@ -683,6 +684,9 @@ intel_panel_detect(struct drm_connector *connector, bool force)
 	if (!intel_display_device_enabled(i915))
 		return connector_status_disconnected;
 
+	if (!intel_display_driver_check_access(i915))
+		return connector->status;
+
 	return connector_status_connected;
 }
 
diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i915/display/intel_sdvo.c
index 4e4a87f841787..a086d5f51e612 100644
--- a/drivers/gpu/drm/i915/display/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/display/intel_sdvo.c
@@ -44,6 +44,7 @@
 #include "intel_connector.h"
 #include "intel_crtc.h"
 #include "intel_de.h"
+#include "intel_display_driver.h"
 #include "intel_display_types.h"
 #include "intel_fdi.h"
 #include "intel_fifo_underrun.h"
@@ -2140,6 +2141,9 @@ intel_sdvo_detect(struct drm_connector *connector, bool force)
 	if (!intel_display_device_enabled(i915))
 		return connector_status_disconnected;
 
+	if (!intel_display_driver_check_access(i915))
+		return connector->status;
+
 	if (!intel_sdvo_set_target_output(intel_sdvo,
 					  intel_sdvo_connector->output_flag))
 		return connector_status_unknown;
diff --git a/drivers/gpu/drm/i915/display/intel_tv.c b/drivers/gpu/drm/i915/display/intel_tv.c
index f3598fe39fda5..af99b22332adf 100644
--- a/drivers/gpu/drm/i915/display/intel_tv.c
+++ b/drivers/gpu/drm/i915/display/intel_tv.c
@@ -40,6 +40,7 @@
 #include "intel_crtc.h"
 #include "intel_de.h"
 #include "intel_display_irq.h"
+#include "intel_display_driver.h"
 #include "intel_display_types.h"
 #include "intel_dpll.h"
 #include "intel_hotplug.h"
@@ -1723,6 +1724,9 @@ intel_tv_detect(struct drm_connector *connector,
 	if (!intel_display_device_enabled(i915))
 		return connector_status_disconnected;
 
+	if (!intel_display_driver_check_access(i915))
+		return connector->status;
+
 	if (force) {
 		struct drm_atomic_state *state;
 
-- 
2.39.2


  parent reply	other threads:[~2024-01-04  8:30 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
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 ` Imre Deak [this message]
2024-01-08  9:59   ` [PATCH 09/12] drm/i915: Disable hotplug detection handlers " 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=20240104083008.2715733-10-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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