All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: stable@kernel.org, Chris Wilson <chris@chris-wilson.co.uk>
Subject: [PATCH 04/17] drm/i915/dp: Be paranoid in case we disable a DP before it is attached
Date: Thu, 21 Apr 2011 22:18:19 +0100	[thread overview]
Message-ID: <1303420712-6369-5-git-send-email-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <1303420712-6369-1-git-send-email-chris@chris-wilson.co.uk>

Given that the hardware may be left in a random condition by the BIOS,
it is conceivable that we then attempt to clear the DP_PIPEB_SELECT bit
without us ever enabling/attaching the DP encoder to a pipe. Thus
causing a NULL deference when we attempt to wait for a vblank on that
crtc.

Reported-and-tested-by: Bryan Christ <bryan.christ@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=36314
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
---
 drivers/gpu/drm/i915/intel_dp.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index cb8578b..a4d8031 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1470,7 +1470,8 @@ intel_dp_link_down(struct intel_dp *intel_dp)
 
 	if (!HAS_PCH_CPT(dev) &&
 	    I915_READ(intel_dp->output_reg) & DP_PIPEB_SELECT) {
-		struct intel_crtc *intel_crtc = to_intel_crtc(intel_dp->base.base.crtc);
+		struct drm_crtc *crtc = intel_dp->base.base.crtc;
+
 		/* Hardware workaround: leaving our transcoder select
 		 * set to transcoder B while it's off will prevent the
 		 * corresponding HDMI output on transcoder A.
@@ -1485,7 +1486,19 @@ intel_dp_link_down(struct intel_dp *intel_dp)
 		/* Changes to enable or select take place the vblank
 		 * after being written.
 		 */
-		intel_wait_for_vblank(dev, intel_crtc->pipe);
+		if (crtc == NULL) {
+			/* We can arrive here never having been attached
+			 * to a CRTC, for instance, due to inheriting
+			 * random state from the BIOS.
+			 *
+			 * If the pipe is not running, play safe and
+			 * wait for the clocks to stabilise before
+			 * continuing.
+			 */
+			POSTING_READ(intel_dp->output_reg);
+			msleep(50);
+		} else
+			intel_wait_for_vblank(dev, to_intel_crtc(crtc)->pipe);
 	}
 
 	I915_WRITE(intel_dp->output_reg, DP & ~DP_PORT_EN);
-- 
1.7.4.1

_______________________________________________
stable mailing list
stable@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/stable

  parent reply	other threads:[~2011-04-21 21:18 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-21 21:18 Pending i915 fixes Chris Wilson
2011-04-21 21:18 ` [PATCH 01/17] drm/i915: Move the irq wait queue initialisation into the ring init Chris Wilson
2011-04-21 22:26   ` Jesse Barnes
2011-04-21 21:18 ` [PATCH 02/17] drm/i915: Disable all outputs early, before KMS takeover Chris Wilson
2011-04-21 21:18 ` [PATCH 03/17] drm/i915: Release object along create user fb error path Chris Wilson
2011-04-22 18:21   ` Ben Widawsky
2011-04-21 21:18 ` Chris Wilson [this message]
2011-04-21 21:18 ` [PATCH 05/17] drm/i915/tv: Clear state sense detection for Cantiga Chris Wilson
2011-04-21 23:36   ` Eric Anholt
2011-04-22  5:28     ` Chris Wilson
2011-04-22 21:44     ` Peter Clifton
2011-05-20  9:16       ` Niccolò Belli
2011-05-20 10:00         ` Keith Packard
2011-05-20 13:37           ` Niccolò Belli
2011-04-21 21:18 ` [PATCH 06/17] drm/i915: Check that the plane points to the pipe's framebuffer before enabling Chris Wilson
2011-04-21 21:18 ` [PATCH 07/17] drm/i915: Only enable the plane after setting the fb base (pre-ILK) Chris Wilson
2011-04-21 22:27   ` Jesse Barnes
2011-04-21 21:18 ` [PATCH 08/17] drm/i915: Move the tracking of dpms_mode down into crtc enable/disable Chris Wilson
2011-05-04 19:10   ` Keith Packard
2011-05-04 19:40     ` Chris Wilson
2011-05-04 21:20       ` Keith Packard
2011-05-04 21:59         ` Chris Wilson
2011-04-21 21:18 ` [PATCH 09/17] drm/i915: Simplify return value from intel_get_load_detect_pipe Chris Wilson
2011-04-21 21:18 ` [PATCH 10/17] drm/i915: Propagate failure to set mode for load-detect pipe Chris Wilson
2011-04-21 21:18 ` [PATCH 11/17] drm/i915: Don't store temporary load-detect variables in the generic encoder Chris Wilson
2011-04-21 21:18 ` [PATCH 12/17] drm/i915: Remove unused supported_crtc from intel_load_detect_pipe Chris Wilson
2011-04-21 21:18 ` [PATCH 13/17] drm/i915: Pass the saved adjusted_mode when adding to the load-detect crtc Chris Wilson
2011-04-21 21:18 ` [PATCH 14/17] drm/i915: Remove dead code from intel_get_load_detect_pipe() Chris Wilson
2011-04-21 21:18 ` [PATCH 15/17] drm/i915: Remove dead code from intel_release_load_detect_pipe() Chris Wilson
2011-04-21 21:18 ` [PATCH 16/17] drm/i915: Attach a fb to the load-detect pipe Chris Wilson
2011-04-21 21:18 ` [PATCH 17/17] drm/i915: restore only the mode of this driver on lastclose (v2) Chris Wilson
2011-04-21 21:56 ` Pending i915 fixes Keith Packard
2011-04-21 22:01   ` Dave Airlie
2011-04-22  0:06     ` Keith Packard
2011-04-22  5:33       ` Chris Wilson
2011-04-21 22:40   ` Chris Wilson

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=1303420712-6369-5-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=stable@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.