[Intel-gfx] [PATCH 2/8] drm/i915/bdw: If we are in reset, switch the GEN8 ppgtt synchronously

oscar.mateo at intel.com oscar.mateo at intel.com
Wed Jun 18 18:15:36 CEST 2014


From: Oscar Mateo <oscar.mateo at intel.com>

If this comment is true for GEN6 and GEN7, I imagine it is for GEN8 as well:

    If we're in reset, we can assume the GPU is sufficiently idle to
    manually frob these bits. Ideally we could use the ring functions,
    except our error handling makes it quite difficult (can't use
    intel_ring_begin, ring->flush, or intel_ring_advance).

This exception was lost (wrongly, I suspect) in:

commit eeb9488e751a0a6401e7516a893efaf9d1f77fb5
Author: Ben Widawsky <ben at bwidawsk.net>
Date:   Fri Dec 6 14:11:10 2013 -0800

    drm/i915: Extract mm switching to function

    In order to do the full context switch with address space, it's
    convenient to have a way to switch the address space. We already have
    this in our code - just pull it out to be called by the context switch
    code later.

    v2: Rebased on BDW support. Required adding BDW.

Signed-off-by: Oscar Mateo <oscar.mateo at intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index ad5c85b..49f103f 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -263,10 +263,23 @@ static int gen8_mm_sync_switch(struct i915_hw_ppgtt *ppgtt,
 static int gen8_mm_switch(struct i915_hw_ppgtt *ppgtt,
 			  struct intel_engine_cs *ring)
 {
+	struct drm_device *dev = ppgtt->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	int used_pd;
 	int i, ret;
 
+	/* If we're in reset, we can assume the GPU is sufficiently idle to
+	 * manually frob these bits. Ideally we could use the ring functions,
+	 * except our error handling makes it quite difficult (can't use
+	 * intel_ring_begin, ring->flush, or intel_ring_advance)
+	 *
+	 * FIXME: We should try not to special case reset
+	 */
+	if (i915_reset_in_progress(&dev_priv->gpu_error))
+		return ppgtt->sync_switch_mm(ppgtt, ring);
+
 	/* bit of a hack to find the actual last used pd */
-	int used_pd = ppgtt->num_pd_entries / GEN8_PDES_PER_PAGE;
+	used_pd = ppgtt->num_pd_entries / GEN8_PDES_PER_PAGE;
 
 	for (i = used_pd - 1; i >= 0; i--) {
 		dma_addr_t addr = ppgtt->pd_dma_addr[i];
-- 
1.9.0




More information about the Intel-gfx mailing list