]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/selftest: Fix MOCS selftest for GuC submission
authorRahul Kumar Singh <rahul.kumar.singh@intel.com>
Tue, 27 Jul 2021 00:23:43 +0000 (17:23 -0700)
committerJohn Harrison <John.C.Harrison@Intel.com>
Wed, 28 Jul 2021 00:32:21 +0000 (17:32 -0700)
When GuC submission is enabled, the GuC controls engine resets. Rather
than explicitly triggering a reset, the driver must submit a hanging
context to GuC and wait for the reset to occur.

Signed-off-by: Rahul Kumar Singh <rahul.kumar.singh@intel.com>
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210727002348.97202-29-matthew.brost@intel.com
drivers/gpu/drm/i915/gt/selftest_mocs.c

index 8763bbeca0f7779ade539f64ca4fd695054e8181..b7314739ee4020fb6676d27d3f56d575e9ccae5a 100644 (file)
@@ -10,6 +10,7 @@
 #include "gem/selftests/mock_context.h"
 #include "selftests/igt_reset.h"
 #include "selftests/igt_spinner.h"
+#include "selftests/intel_scheduler_helpers.h"
 
 struct live_mocs {
        struct drm_i915_mocs_table table;
@@ -318,7 +319,8 @@ static int live_mocs_clean(void *arg)
 }
 
 static int active_engine_reset(struct intel_context *ce,
-                              const char *reason)
+                              const char *reason,
+                              bool using_guc)
 {
        struct igt_spinner spin;
        struct i915_request *rq;
@@ -335,9 +337,13 @@ static int active_engine_reset(struct intel_context *ce,
        }
 
        err = request_add_spin(rq, &spin);
-       if (err == 0)
+       if (err == 0 && !using_guc)
                err = intel_engine_reset(ce->engine, reason);
 
+       /* Ensure the reset happens and kills the engine */
+       if (err == 0)
+               err = intel_selftest_wait_for_rq(rq);
+
        igt_spinner_end(&spin);
        igt_spinner_fini(&spin);
 
@@ -345,21 +351,23 @@ static int active_engine_reset(struct intel_context *ce,
 }
 
 static int __live_mocs_reset(struct live_mocs *mocs,
-                            struct intel_context *ce)
+                            struct intel_context *ce, bool using_guc)
 {
        struct intel_gt *gt = ce->engine->gt;
        int err;
 
        if (intel_has_reset_engine(gt)) {
-               err = intel_engine_reset(ce->engine, "mocs");
-               if (err)
-                       return err;
-
-               err = check_mocs_engine(mocs, ce);
-               if (err)
-                       return err;
+               if (!using_guc) {
+                       err = intel_engine_reset(ce->engine, "mocs");
+                       if (err)
+                               return err;
+
+                       err = check_mocs_engine(mocs, ce);
+                       if (err)
+                               return err;
+               }
 
-               err = active_engine_reset(ce, "mocs");
+               err = active_engine_reset(ce, "mocs", using_guc);
                if (err)
                        return err;
 
@@ -395,19 +403,32 @@ static int live_mocs_reset(void *arg)
 
        igt_global_reset_lock(gt);
        for_each_engine(engine, gt, id) {
+               bool using_guc = intel_engine_uses_guc(engine);
+               struct intel_selftest_saved_policy saved;
                struct intel_context *ce;
+               int err2;
+
+               err = intel_selftest_modify_policy(engine, &saved);
+               if (err)
+                       break;
 
                ce = mocs_context_create(engine);
                if (IS_ERR(ce)) {
                        err = PTR_ERR(ce);
-                       break;
+                       goto restore;
                }
 
                intel_engine_pm_get(engine);
-               err = __live_mocs_reset(&mocs, ce);
-               intel_engine_pm_put(engine);
 
+               err = __live_mocs_reset(&mocs, ce, using_guc);
+
+               intel_engine_pm_put(engine);
                intel_context_put(ce);
+
+restore:
+               err2 = intel_selftest_restore_policy(engine, &saved);
+               if (err == 0)
+                       err = err2;
                if (err)
                        break;
        }