drm/i915: Update the helper to set correct mapping
[linux-2.6-microblaze.git] / drivers / gpu / drm / i915 / gt / intel_engine_pm.c
index e67d092..47f4397 100644 (file)
@@ -1,6 +1,5 @@
+// SPDX-License-Identifier: MIT
 /*
- * SPDX-License-Identifier: MIT
- *
  * Copyright © 2019 Intel Corporation
  */
 
@@ -24,15 +23,19 @@ static void dbg_poison_ce(struct intel_context *ce)
 
        if (ce->state) {
                struct drm_i915_gem_object *obj = ce->state->obj;
-               int type = i915_coherent_map_type(ce->engine->i915);
+               int type = i915_coherent_map_type(ce->engine->i915, obj, true);
                void *map;
 
+               if (!i915_gem_object_trylock(obj))
+                       return;
+
                map = i915_gem_object_pin_map(obj, type);
                if (!IS_ERR(map)) {
                        memset(map, CONTEXT_REDZONE, obj->base.size);
                        i915_gem_object_flush_map(obj);
                        i915_gem_object_unpin_map(obj);
                }
+               i915_gem_object_unlock(obj);
        }
 }