Commit 17b0c1f7 authored by Imre Deak's avatar Imre Deak Committed by Jani Nikula

drm/i915: vlv: reserve GT power context early

We reserve the space for the power context in stolen memory at a fixed
address from a delayed work. This races with the subsequent driver
init/resume code which could allocate something at that address, so the
reservation for the power context fails. Reserve the space up-front, so
this can't happen. This also adds a missing struct_mutex lock around the
stolen allocation, which wasn't taken in the delayed work path.
Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
Reviewed-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent bcdb72ac
...@@ -3493,6 +3493,8 @@ static void valleyview_setup_pctx(struct drm_device *dev) ...@@ -3493,6 +3493,8 @@ static void valleyview_setup_pctx(struct drm_device *dev)
u32 pcbr; u32 pcbr;
int pctx_size = 24*1024; int pctx_size = 24*1024;
WARN_ON(!mutex_is_locked(&dev->struct_mutex));
pcbr = I915_READ(VLV_PCBR); pcbr = I915_READ(VLV_PCBR);
if (pcbr) { if (pcbr) {
/* BIOS set it up already, grab the pre-alloc'd space */ /* BIOS set it up already, grab the pre-alloc'd space */
...@@ -3542,8 +3544,6 @@ static void valleyview_enable_rps(struct drm_device *dev) ...@@ -3542,8 +3544,6 @@ static void valleyview_enable_rps(struct drm_device *dev)
I915_WRITE(GTFIFODBG, gtfifodbg); I915_WRITE(GTFIFODBG, gtfifodbg);
} }
valleyview_setup_pctx(dev);
/* If VLV, Forcewake all wells, else re-direct to regular path */ /* If VLV, Forcewake all wells, else re-direct to regular path */
gen6_gt_force_wake_get(dev_priv, FORCEWAKE_ALL); gen6_gt_force_wake_get(dev_priv, FORCEWAKE_ALL);
...@@ -4395,6 +4395,8 @@ void intel_enable_gt_powersave(struct drm_device *dev) ...@@ -4395,6 +4395,8 @@ void intel_enable_gt_powersave(struct drm_device *dev)
ironlake_enable_rc6(dev); ironlake_enable_rc6(dev);
intel_init_emon(dev); intel_init_emon(dev);
} else if (IS_GEN6(dev) || IS_GEN7(dev)) { } else if (IS_GEN6(dev) || IS_GEN7(dev)) {
if (IS_VALLEYVIEW(dev))
valleyview_setup_pctx(dev);
/* /*
* PCU communication is slow and this doesn't need to be * PCU communication is slow and this doesn't need to be
* done at any specific time, so do this out of our fast path * done at any specific time, so do this out of our fast path
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment