]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Use ww pinning for intel_context_create_request()
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Wed, 19 Aug 2020 14:09:00 +0000 (16:09 +0200)
committerJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Mon, 7 Sep 2020 11:31:59 +0000 (14:31 +0300)
We want to get rid of intel_context_pin(), convert
intel_context_create_request() first. :)

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200819140904.1708856-21-maarten.lankhorst@linux.intel.com
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
drivers/gpu/drm/i915/gt/intel_context.c

index 671081b0e4d636ba79368b5a2da02ea9005202b2..61b05cd4c47aef8e26f9960bcef54f52eae289b1 100644 (file)
@@ -449,15 +449,25 @@ int intel_context_prepare_remote_request(struct intel_context *ce,
 
 struct i915_request *intel_context_create_request(struct intel_context *ce)
 {
+       struct i915_gem_ww_ctx ww;
        struct i915_request *rq;
        int err;
 
-       err = intel_context_pin(ce);
-       if (unlikely(err))
-               return ERR_PTR(err);
+       i915_gem_ww_ctx_init(&ww, true);
+retry:
+       err = intel_context_pin_ww(ce, &ww);
+       if (!err) {
+               rq = i915_request_create(ce);
+               intel_context_unpin(ce);
+       } else if (err == -EDEADLK) {
+               err = i915_gem_ww_ctx_backoff(&ww);
+               if (!err)
+                       goto retry;
+       } else {
+               rq = ERR_PTR(err);
+       }
 
-       rq = i915_request_create(ce);
-       intel_context_unpin(ce);
+       i915_gem_ww_ctx_fini(&ww);
 
        if (IS_ERR(rq))
                return rq;