]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: extract engine WA programming to common resume function
authorDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Fri, 31 Jan 2020 07:57:15 +0000 (07:57 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 31 Jan 2020 23:54:12 +0000 (23:54 +0000)
The workarounds are a common "feature" across gens and submission
mechanisms and we already call the other WA related functions from
common engine ones (<setup/cleanup>_common), so it makes sense to
do the same with WA application. Medium-term, This will help us
reduce the duplication once the GuC resume function is added, but short
term it will also allow us to use the workaround lists for pre-gen8
engine workarounds.

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20200131075716.2212299-2-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gt/intel_engine.h
drivers/gpu/drm/i915/gt/intel_engine_cs.c
drivers/gpu/drm/i915/gt/intel_gt_pm.c
drivers/gpu/drm/i915/gt/intel_lrc.c
drivers/gpu/drm/i915/gt/intel_reset.c

index 5df003061e442a17898e1e6b6343a042413c33d8..b36ec1fddc3d81584d1bf025afd290bbc3210633 100644 (file)
@@ -192,6 +192,8 @@ void intel_engines_free(struct intel_gt *gt);
 int intel_engine_init_common(struct intel_engine_cs *engine);
 void intel_engine_cleanup_common(struct intel_engine_cs *engine);
 
+int intel_engine_resume(struct intel_engine_cs *engine);
+
 int intel_ring_submission_setup(struct intel_engine_cs *engine);
 
 int intel_engine_stop_cs(struct intel_engine_cs *engine);
index 86af5edd693366eef1c1cc1e11dee5ce2fe3171d..b1c7b1ed6149663aa455ee10d2bbe0126617a8db 100644 (file)
@@ -841,6 +841,20 @@ void intel_engine_cleanup_common(struct intel_engine_cs *engine)
        intel_wa_list_free(&engine->whitelist);
 }
 
+/**
+ * intel_engine_resume - re-initializes the HW state of the engine
+ * @engine: Engine to resume.
+ *
+ * Returns zero on success or an error code on failure.
+ */
+int intel_engine_resume(struct intel_engine_cs *engine)
+{
+       intel_engine_apply_workarounds(engine);
+       intel_engine_apply_whitelist(engine);
+
+       return engine->resume(engine);
+}
+
 u64 intel_engine_get_active_head(const struct intel_engine_cs *engine)
 {
        struct drm_i915_private *i915 = engine->i915;
index d1c2f034296aca8d65caa89a965c3bd1163f5dc4..8b653c0f5e5f91e364c65ef97cddc580491badd3 100644 (file)
@@ -216,7 +216,7 @@ int intel_gt_resume(struct intel_gt *gt)
                intel_engine_pm_get(engine);
 
                engine->serial++; /* kernel context lost */
-               err = engine->resume(engine);
+               err = intel_engine_resume(engine);
 
                intel_engine_pm_put(engine);
                if (err) {
index 28cbe5f3a7d740893c6b75e7d6dae5837f4dd757..5a5b4062421afc6355033fa690e2f96d80db8d13 100644 (file)
@@ -3427,9 +3427,6 @@ static bool unexpected_starting_state(struct intel_engine_cs *engine)
 
 static int execlists_resume(struct intel_engine_cs *engine)
 {
-       intel_engine_apply_workarounds(engine);
-       intel_engine_apply_whitelist(engine);
-
        intel_mocs_init_engine(engine);
 
        intel_engine_reset_breadcrumbs(engine);
index d77a1a32da78567571c18236dbe86dfae0b44b4d..a8317e046f81d3cba400eab604f85d8d61f99ee8 100644 (file)
@@ -986,7 +986,7 @@ static int resume(struct intel_gt *gt)
        int ret;
 
        for_each_engine(engine, gt, id) {
-               ret = engine->resume(engine);
+               ret = intel_engine_resume(engine);
                if (ret)
                        return ret;
        }
@@ -1161,7 +1161,7 @@ int intel_engine_reset(struct intel_engine_cs *engine, const char *msg)
         * have been reset to their default values. Follow the init_ring
         * process to program RING_MODE, HWSP and re-enable submission.
         */
-       ret = engine->resume(engine);
+       ret = intel_engine_resume(engine);
 
 out:
        intel_engine_cancel_stop_cs(engine);