drm/i915/guc: Relax CTB response timeout
authorMatthew Brost <matthew.brost@intel.com>
Thu, 8 Jul 2021 16:20:49 +0000 (09:20 -0700)
committerJohn Harrison <John.C.Harrison@Intel.com>
Tue, 13 Jul 2021 20:49:58 +0000 (13:49 -0700)
In upcoming patch we will allow more CTB requests to be sent in
parallel to the GuC for processing, so we shouldn't assume any more
that GuC will always reply without 10ms.

Use bigger value hardcoded value of 1s instead.

v2: Add CONFIG_DRM_I915_GUC_CTB_TIMEOUT config option
v3:
 (Daniel Vetter)
  - Use hardcoded value of 1s rather than config option
v4:
 (Michal)
  - Use defines for timeout values

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210708162055.129996-2-matthew.brost@intel.com
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c

index 4340904..b86575b 100644 (file)
@@ -474,14 +474,18 @@ static int wait_for_ct_request_update(struct ct_request *req, u32 *status)
        /*
         * Fast commands should complete in less than 10us, so sample quickly
         * up to that length of time, then switch to a slower sleep-wait loop.
-        * No GuC command should ever take longer than 10ms.
+        * No GuC command should ever take longer than 10ms but many GuC
+        * commands can be inflight at time, so use a 1s timeout on the slower
+        * sleep-wait loop.
         */
+#define GUC_CTB_RESPONSE_TIMEOUT_SHORT_MS 10
+#define GUC_CTB_RESPONSE_TIMEOUT_LONG_MS 1000
 #define done \
        (FIELD_GET(GUC_HXG_MSG_0_ORIGIN, READ_ONCE(req->status)) == \
         GUC_HXG_ORIGIN_GUC)
-       err = wait_for_us(done, 10);
+       err = wait_for_us(done, GUC_CTB_RESPONSE_TIMEOUT_SHORT_MS);
        if (err)
-               err = wait_for(done, 10);
+               err = wait_for(done, GUC_CTB_RESPONSE_TIMEOUT_LONG_MS);
 #undef done
 
        if (unlikely(err))