diff options
Diffstat (limited to 'drivers/gpu/drm/i915/gt/intel_ring_submission.c')
-rw-r--r-- | drivers/gpu/drm/i915/gt/intel_ring_submission.c | 87 |
1 files changed, 32 insertions, 55 deletions
diff --git a/drivers/gpu/drm/i915/gt/intel_ring_submission.c b/drivers/gpu/drm/i915/gt/intel_ring_submission.c index bc44fe8e5ffa..f70b903a98bc 100644 --- a/drivers/gpu/drm/i915/gt/intel_ring_submission.c +++ b/drivers/gpu/drm/i915/gt/intel_ring_submission.c @@ -568,7 +568,8 @@ static void flush_cs_tlb(struct intel_engine_cs *engine) return; /* ring should be idle before issuing a sync flush*/ - WARN_ON((ENGINE_READ(engine, RING_MI_MODE) & MODE_IDLE) == 0); + drm_WARN_ON(&dev_priv->drm, + (ENGINE_READ(engine, RING_MI_MODE) & MODE_IDLE) == 0); ENGINE_WRITE(engine, RING_INSTPM, _MASKED_BIT_ENABLE(INSTPM_TLB_INVALIDATE | @@ -626,6 +627,27 @@ static bool stop_ring(struct intel_engine_cs *engine) return (ENGINE_READ(engine, RING_HEAD) & HEAD_ADDR) == 0; } +static struct i915_address_space *vm_alias(struct i915_address_space *vm) +{ + if (i915_is_ggtt(vm)) + vm = &i915_vm_to_ggtt(vm)->alias->vm; + + return vm; +} + +static void set_pp_dir(struct intel_engine_cs *engine) +{ + struct i915_address_space *vm = vm_alias(engine->gt->vm); + + if (vm) { + struct i915_ppgtt *ppgtt = i915_vm_to_ppgtt(vm); + + ENGINE_WRITE(engine, RING_PP_DIR_DCLV, PP_DIR_DCLV_2G); + ENGINE_WRITE(engine, RING_PP_DIR_BASE, + px_base(ppgtt->pd)->ggtt_offset << 10); + } +} + static int xcs_resume(struct intel_engine_cs *engine) { struct drm_i915_private *dev_priv = engine->i915; @@ -684,6 +706,8 @@ static int xcs_resume(struct intel_engine_cs *engine) GEM_BUG_ON(!intel_ring_offset_valid(ring, ring->tail)); intel_ring_update_space(ring); + set_pp_dir(engine); + /* First wake the ring up to an empty/idle ring */ ENGINE_WRITE(engine, RING_HEAD, ring->head); ENGINE_WRITE(engine, RING_TAIL, ring->head); @@ -857,43 +881,6 @@ static int rcs_resume(struct intel_engine_cs *engine) intel_uncore_write(uncore, ECOSKPD, _MASKED_BIT_ENABLE(ECO_CONSTANT_BUFFER_SR_DISABLE)); - /* WaTimedSingleVertexDispatch:cl,bw,ctg,elk,ilk,snb */ - if (IS_GEN_RANGE(i915, 4, 6)) - intel_uncore_write(uncore, MI_MODE, - _MASKED_BIT_ENABLE(VS_TIMER_DISPATCH)); - - /* We need to disable the AsyncFlip performance optimisations in order - * to use MI_WAIT_FOR_EVENT within the CS. It should already be - * programmed to '1' on all products. - * - * WaDisableAsyncFlipPerfMode:snb,ivb,hsw,vlv - */ - if (IS_GEN_RANGE(i915, 6, 7)) - intel_uncore_write(uncore, MI_MODE, - _MASKED_BIT_ENABLE(ASYNC_FLIP_PERF_DISABLE)); - - /* Required for the hardware to program scanline values for waiting */ - /* WaEnableFlushTlbInvalidationMode:snb */ - if (IS_GEN(i915, 6)) - intel_uncore_write(uncore, GFX_MODE, - _MASKED_BIT_ENABLE(GFX_TLB_INVALIDATE_EXPLICIT)); - - /* WaBCSVCSTlbInvalidationMode:ivb,vlv,hsw */ - if (IS_GEN(i915, 7)) - intel_uncore_write(uncore, GFX_MODE_GEN7, - _MASKED_BIT_ENABLE(GFX_TLB_INVALIDATE_EXPLICIT) | - _MASKED_BIT_ENABLE(GFX_REPLAY_MODE)); - - if (IS_GEN(i915, 6)) { - /* From the Sandybridge PRM, volume 1 part 3, page 24: - * "If this bit is set, STCunit will have LRA as replacement - * policy. [...] This bit must be reset. LRA replacement - * policy is not supported." - */ - intel_uncore_write(uncore, CACHE_MODE_0, - _MASKED_BIT_DISABLE(CM0_STC_EVICT_DISABLE_LRA_SNB)); - } - if (IS_GEN_RANGE(i915, 6, 7)) intel_uncore_write(uncore, INSTPM, _MASKED_BIT_ENABLE(INSTPM_FORCE_ORDERING)); @@ -1197,23 +1184,12 @@ static void ring_context_destroy(struct kref *ref) intel_context_free(ce); } -static struct i915_address_space *vm_alias(struct intel_context *ce) -{ - struct i915_address_space *vm; - - vm = ce->vm; - if (i915_is_ggtt(vm)) - vm = &i915_vm_to_ggtt(vm)->alias->vm; - - return vm; -} - static int __context_pin_ppgtt(struct intel_context *ce) { struct i915_address_space *vm; int err = 0; - vm = vm_alias(ce); + vm = vm_alias(ce->vm); if (vm) err = gen6_ppgtt_pin(i915_vm_to_ppgtt((vm))); @@ -1224,7 +1200,7 @@ static void __context_unpin_ppgtt(struct intel_context *ce) { struct i915_address_space *vm; - vm = vm_alias(ce); + vm = vm_alias(ce->vm); if (vm) gen6_ppgtt_unpin(i915_vm_to_ppgtt(vm)); } @@ -1581,7 +1557,7 @@ static int switch_context(struct i915_request *rq) GEM_BUG_ON(HAS_EXECLISTS(rq->i915)); - ret = switch_mm(rq, vm_alias(ce)); + ret = switch_mm(rq, vm_alias(ce->vm)); if (ret) return ret; @@ -1662,7 +1638,8 @@ static void gen6_bsd_submit_request(struct i915_request *request) GEN6_BSD_SLEEP_INDICATOR, 0, 1000, 0, NULL)) - DRM_ERROR("timed out waiting for the BSD ring to wake up\n"); + drm_err(&uncore->i915->drm, + "timed out waiting for the BSD ring to wake up\n"); /* Now that the ring is fully powered up, update the tail */ i9xx_submit_request(request); @@ -1787,8 +1764,8 @@ static void ring_release(struct intel_engine_cs *engine) { struct drm_i915_private *dev_priv = engine->i915; - WARN_ON(INTEL_GEN(dev_priv) > 2 && - (ENGINE_READ(engine, RING_MI_MODE) & MODE_IDLE) == 0); + drm_WARN_ON(&dev_priv->drm, INTEL_GEN(dev_priv) > 2 && + (ENGINE_READ(engine, RING_MI_MODE) & MODE_IDLE) == 0); intel_engine_cleanup_common(engine); |