diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-07-17 00:55:04 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-07-17 05:49:21 -0400 |
commit | 35c95375f69ceec721fea67a0532bc17ceb5cf64 (patch) | |
tree | 1e945ac2620bac5489425125bea2f49c9197aab0 /drivers/gpu/drm/i915/intel_display.c | |
parent | 7dcd2677ea912573d9ed4bcd629b0023b2d11505 (diff) |
drm/i915: Sanitize shared dpll state
There seems to be no limit to the amount of gunk the firmware can
leave behind. Some platforms leave pch dplls on which are not in
active use at all. The example in the bug report is a Apple Macbook
Pro.
Note that this escape scrunity of the hw state checker until we've
tried to use this enabled, but unused pll since we did only check for
the inverse case of a in-used, but disabled pll.
v2: Add a WARN in the pll state checker which would have caught this
case.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66952
Reported-and-tested-by: shui yangwei <yangweix.shui@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index c59335ce84f4..76b01c16a0e8 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -8314,6 +8314,8 @@ check_shared_dpll_state(struct drm_device *dev) | |||
8314 | pll->active, pll->refcount); | 8314 | pll->active, pll->refcount); |
8315 | WARN(pll->active && !pll->on, | 8315 | WARN(pll->active && !pll->on, |
8316 | "pll in active use but not on in sw tracking\n"); | 8316 | "pll in active use but not on in sw tracking\n"); |
8317 | WARN(pll->on && !pll->active, | ||
8318 | "pll in on but not on in use in sw tracking\n"); | ||
8317 | WARN(pll->on != active, | 8319 | WARN(pll->on != active, |
8318 | "pll on state mismatch (expected %i, found %i)\n", | 8320 | "pll on state mismatch (expected %i, found %i)\n", |
8319 | pll->on, active); | 8321 | pll->on, active); |
@@ -9814,8 +9816,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) | |||
9814 | } | 9816 | } |
9815 | pll->refcount = pll->active; | 9817 | pll->refcount = pll->active; |
9816 | 9818 | ||
9817 | DRM_DEBUG_KMS("%s hw state readout: refcount %i\n", | 9819 | DRM_DEBUG_KMS("%s hw state readout: refcount %i, on %i\n", |
9818 | pll->name, pll->refcount); | 9820 | pll->name, pll->refcount, pll->on); |
9819 | } | 9821 | } |
9820 | 9822 | ||
9821 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, | 9823 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, |
@@ -9866,6 +9868,7 @@ void intel_modeset_setup_hw_state(struct drm_device *dev, | |||
9866 | struct drm_plane *plane; | 9868 | struct drm_plane *plane; |
9867 | struct intel_crtc *crtc; | 9869 | struct intel_crtc *crtc; |
9868 | struct intel_encoder *encoder; | 9870 | struct intel_encoder *encoder; |
9871 | int i; | ||
9869 | 9872 | ||
9870 | intel_modeset_readout_hw_state(dev); | 9873 | intel_modeset_readout_hw_state(dev); |
9871 | 9874 | ||
@@ -9881,6 +9884,18 @@ void intel_modeset_setup_hw_state(struct drm_device *dev, | |||
9881 | intel_dump_pipe_config(crtc, &crtc->config, "[setup_hw_state]"); | 9884 | intel_dump_pipe_config(crtc, &crtc->config, "[setup_hw_state]"); |
9882 | } | 9885 | } |
9883 | 9886 | ||
9887 | for (i = 0; i < dev_priv->num_shared_dpll; i++) { | ||
9888 | struct intel_shared_dpll *pll = &dev_priv->shared_dplls[i]; | ||
9889 | |||
9890 | if (!pll->on || pll->active) | ||
9891 | continue; | ||
9892 | |||
9893 | DRM_DEBUG_KMS("%s enabled but not in use, disabling\n", pll->name); | ||
9894 | |||
9895 | pll->disable(dev_priv, pll); | ||
9896 | pll->on = false; | ||
9897 | } | ||
9898 | |||
9884 | if (force_restore) { | 9899 | if (force_restore) { |
9885 | /* | 9900 | /* |
9886 | * We need to use raw interfaces for restoring state to avoid | 9901 | * We need to use raw interfaces for restoring state to avoid |