patch-5.15.79-rt54.patch
[platform/kernel/linux-rpi.git] / drivers / gpu / drm / i915 / gt / intel_engine_pm.c
index 1f07ac4..73e96ca 100644 (file)
@@ -80,39 +80,6 @@ static int __engine_unpark(struct intel_wakeref *wf)
        return 0;
 }
 
-#if IS_ENABLED(CONFIG_LOCKDEP)
-
-static unsigned long __timeline_mark_lock(struct intel_context *ce)
-{
-       unsigned long flags;
-
-       local_irq_save(flags);
-       mutex_acquire(&ce->timeline->mutex.dep_map, 2, 0, _THIS_IP_);
-
-       return flags;
-}
-
-static void __timeline_mark_unlock(struct intel_context *ce,
-                                  unsigned long flags)
-{
-       mutex_release(&ce->timeline->mutex.dep_map, _THIS_IP_);
-       local_irq_restore(flags);
-}
-
-#else
-
-static unsigned long __timeline_mark_lock(struct intel_context *ce)
-{
-       return 0;
-}
-
-static void __timeline_mark_unlock(struct intel_context *ce,
-                                  unsigned long flags)
-{
-}
-
-#endif /* !IS_ENABLED(CONFIG_LOCKDEP) */
-
 static void duration(struct dma_fence *fence, struct dma_fence_cb *cb)
 {
        struct i915_request *rq = to_request(fence);
@@ -159,7 +126,6 @@ static bool switch_to_kernel_context(struct intel_engine_cs *engine)
 {
        struct intel_context *ce = engine->kernel_context;
        struct i915_request *rq;
-       unsigned long flags;
        bool result = true;
 
        /* GPU is pointing to the void, as good as in the kernel context. */
@@ -201,7 +167,7 @@ static bool switch_to_kernel_context(struct intel_engine_cs *engine)
         * engine->wakeref.count, we may see the request completion and retire
         * it causing an underflow of the engine->wakeref.
         */
-       flags = __timeline_mark_lock(ce);
+       set_bit(CONTEXT_IS_PARKED, &ce->flags);
        GEM_BUG_ON(atomic_read(&ce->timeline->active_count) < 0);
 
        rq = __i915_request_create(ce, GFP_NOWAIT);
@@ -233,7 +199,7 @@ static bool switch_to_kernel_context(struct intel_engine_cs *engine)
 
        result = false;
 out_unlock:
-       __timeline_mark_unlock(ce, flags);
+       clear_bit(CONTEXT_IS_PARKED, &ce->flags);
        return result;
 }
 
@@ -298,6 +264,29 @@ void intel_engine_init__pm(struct intel_engine_cs *engine)
        intel_engine_init_heartbeat(engine);
 }
 
+/**
+ * intel_engine_reset_pinned_contexts - Reset the pinned contexts of
+ * an engine.
+ * @engine: The engine whose pinned contexts we want to reset.
+ *
+ * Typically the pinned context LMEM images lose or get their content
+ * corrupted on suspend. This function resets their images.
+ */
+void intel_engine_reset_pinned_contexts(struct intel_engine_cs *engine)
+{
+       struct intel_context *ce;
+
+       list_for_each_entry(ce, &engine->pinned_contexts_list,
+                           pinned_contexts_link) {
+               /* kernel context gets reset at __engine_unpark() */
+               if (ce == engine->kernel_context)
+                       continue;
+
+               dbg_poison_ce(ce);
+               ce->ops->reset(ce);
+       }
+}
+
 #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
 #include "selftest_engine_pm.c"
 #endif