drm/i915: Bail out early if WA batch is not available for given Gen
authorArun Siluvery <arun.siluvery@linux.intel.com>
Tue, 23 Jun 2015 14:50:44 +0000 (15:50 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 23 Jun 2015 15:26:16 +0000 (17:26 +0200)
To initialize WA batch, at the moment we first allocate batch and then check
whether we have any WA to be initialized for the given Gen; if we don't have
any WA then we WARN the user, destroy the batch and return but this is causing
another WARN in cleanup code complaining about sleeping in atomic context.
Till we understand this better and to keep things simpler, bail out early
if we don't have WA.

Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Arun Siluvery <arun.siluvery@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_lrc.c

index 8d1c66debb2b0cb56f35fad2bdb7bcf4186522b0..500ae5139f517f495b8d722f321db03da2ba6fcc 100644 (file)
@@ -1260,6 +1260,12 @@ static int intel_init_workaround_bb(struct intel_engine_cs *ring)
 
        WARN_ON(ring->id != RCS);
 
+       /* update this when WA for higher Gen are added */
+       if (WARN(INTEL_INFO(ring->dev)->gen > 8,
+                "WA batch buffer is not initialized for Gen%d\n",
+                INTEL_INFO(ring->dev)->gen))
+               return 0;
+
        /* some WA perform writes to scratch page, ensure it is valid */
        if (ring->scratch.obj == NULL) {
                DRM_ERROR("scratch page not allocated for %s\n", ring->name);
@@ -1290,11 +1296,6 @@ static int intel_init_workaround_bb(struct intel_engine_cs *ring)
                                          &offset);
                if (ret)
                        goto out;
-       } else {
-               WARN(INTEL_INFO(ring->dev)->gen >= 8,
-                    "WA batch buffer is not initialized for Gen%d\n",
-                    INTEL_INFO(ring->dev)->gen);
-               lrc_destroy_wa_ctx_obj(ring);
        }
 
 out: