drm/i915/guc: Don't complain about reset races
authorJohn Harrison <John.C.Harrison@Intel.com>
Tue, 27 Jul 2021 00:23:31 +0000 (17:23 -0700)
committerJohn Harrison <John.C.Harrison@Intel.com>
Wed, 28 Jul 2021 00:31:57 +0000 (17:31 -0700)
It is impossible to seal all race conditions of resets occurring
concurrent to other operations. At least, not without introducing
excesive mutex locking. Instead, don't complain if it occurs. In
particular, don't complain if trying to send a H2G during a reset.
Whatever the H2G was about should get redone once the reset is over.

Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Signed-off-by: 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-17-matthew.brost@intel.com
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
drivers/gpu/drm/i915/gt/uc/intel_uc.c
drivers/gpu/drm/i915/gt/uc/intel_uc.h

index 18917b443f0594dc7d07225e8341ad145688c43d..22b4733b55e2b39100bf01b8bb29b35b6a960914 100644 (file)
@@ -760,7 +760,10 @@ int intel_guc_ct_send(struct intel_guc_ct *ct, const u32 *action, u32 len,
        int ret;
 
        if (unlikely(!ct->enabled)) {
-               WARN(1, "Unexpected send: action=%#x\n", *action);
+               struct intel_guc *guc = ct_to_guc(ct);
+               struct intel_uc *uc = container_of(guc, struct intel_uc, guc);
+
+               WARN(!uc->reset_in_progress, "Unexpected send: action=%#x\n", *action);
                return -ENODEV;
        }
 
index e07c989968f917dd974eff85879247882c89927f..77c1fe2ed88376162192a291f42caa0ae6e5adcb 100644 (file)
@@ -550,6 +550,8 @@ void intel_uc_reset_prepare(struct intel_uc *uc)
 {
        struct intel_guc *guc = &uc->guc;
 
+       uc->reset_in_progress = true;
+
        /* Nothing to do if GuC isn't supported */
        if (!intel_uc_supports_guc(uc))
                return;
@@ -578,6 +580,8 @@ void intel_uc_reset_finish(struct intel_uc *uc)
 {
        struct intel_guc *guc = &uc->guc;
 
+       uc->reset_in_progress = false;
+
        /* Firmware expected to be running when this function is called */
        if (intel_guc_is_fw_running(guc) && intel_uc_uses_guc_submission(uc))
                intel_guc_submission_reset_finish(guc);
index eaa3202192ac56df0b62f6a2a453ae11ec9d5850..91315e3f1c58a6b68e1f09d5a71e3e26e045f6da 100644 (file)
@@ -30,6 +30,8 @@ struct intel_uc {
 
        /* Snapshot of GuC log from last failed load */
        struct drm_i915_gem_object *load_err_log;
+
+       bool reset_in_progress;
 };
 
 void intel_uc_init_early(struct intel_uc *uc);