]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/i915: Assert the engine is idle before overwiting the HWS
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 5 Apr 2017 15:30:54 +0000 (16:30 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 7 Apr 2017 09:10:13 +0000 (10:10 +0100)
When we update the global seqno (on the engine timeline), we modify HW
state (both registers and mapped pages). As we do this, we should be
sure that the HW is idle and we are not causing a conflict. The caller
is supposed to wait_for_idle before calling us to update the seqno, so
let's assert they have and the engine is indeed idle.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20170405153055.28123-1-chris@chris-wilson.co.uk
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
drivers/gpu/drm/i915/i915_gem_request.c
drivers/gpu/drm/i915/intel_engine_cs.c

index 6348353b91ec9702827f3d50a1421518953755ca..2f8c5132b54e5adad8fe1977d15814c0d7dbb5db 100644 (file)
@@ -214,8 +214,8 @@ static int reset_all_global_seqno(struct drm_i915_private *i915, u32 seqno)
                }
 
                /* Finally reset hw state */
-               tl->seqno = seqno;
                intel_engine_init_global_seqno(engine, seqno);
+               tl->seqno = seqno;
 
                list_for_each_entry(timeline, &i915->gt.timelines, link)
                        memset(timeline->engine[id].sync_seqno, 0,
index 854e8e0c836bd2099c1cfcb72e12e3ec5ff21915..92f871cf32652e2a590d2df5537aa51ba37fbcb9 100644 (file)
@@ -223,6 +223,8 @@ void intel_engine_init_global_seqno(struct intel_engine_cs *engine, u32 seqno)
 {
        struct drm_i915_private *dev_priv = engine->i915;
 
+       GEM_BUG_ON(!intel_engine_is_idle(engine));
+
        /* Our semaphore implementation is strictly monotonic (i.e. we proceed
         * so long as the semaphore value in the register/page is greater
         * than the sync value), so whenever we reset the seqno,
@@ -260,6 +262,8 @@ void intel_engine_init_global_seqno(struct intel_engine_cs *engine, u32 seqno)
         * there are any waiters for that seqno.
         */
        intel_engine_wakeup(engine);
+
+       GEM_BUG_ON(intel_engine_get_seqno(engine) != seqno);
 }
 
 static void intel_engine_init_timeline(struct intel_engine_cs *engine)