drm/i915/guc: Force a reset on internal GuC error
authorJohn Harrison <John.C.Harrison@Intel.com>
Wed, 16 Aug 2023 00:39:57 +0000 (17:39 -0700)
committerJohn Harrison <John.C.Harrison@Intel.com>
Tue, 22 Aug 2023 18:38:47 +0000 (11:38 -0700)
commitb2edc4148ad90c906275329711810721719a0c2d
tree01bb8612f9077f3417a924450a3a33cce18cd35c
parent14128d64090fa88445376cb8ccf91c50c08bd410
drm/i915/guc: Force a reset on internal GuC error

If GuC hits an internal error (and survives long enough to report it
to the KMD), it is basically toast and will stop until a GT reset and
subsequent GuC reload is performed. Previously, the KMD just printed
an error message and then waited for the heartbeat to eventually kick
in and trigger a reset (assuming the heartbeat had not been disabled).
Instead, force the reset immediately to guarantee that it happens and
to eliminate the very long heartbeat delay. The captured error state
is also more likely to be useful if captured at the time of the error
rather than many seconds later.

Note that it is not possible to trigger a reset from with the G2H
handler itself. The reset prepare process involves flushing
outstanding G2H contents. So a deadlock could result. Instead, the G2H
handler queues a worker thread to do the reset asynchronously.

v2: Flush the worker on suspend and shutdown. Add rate limiting to
prevent spam from a totally dead system (review feedback from Daniele).

Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230816003957.3572654-1-John.C.Harrison@Intel.com
drivers/gpu/drm/i915/gt/uc/intel_guc.c
drivers/gpu/drm/i915/gt/uc/intel_guc.h
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c