Skip to content

Commit d4dbe77

Browse files
Jonathan-Cavittopsiff
authored andcommitted
drm/i915: No TLB invalidation on wedged GT
mainline inclusion commit 55ac6ea from mainline v6.7-rc1 category: bugfix [ Upstream commit 55ac6ea ] It is not an error for GuC TLB invalidations to fail when the GT is wedged or disabled, so do not process a wait failure as one in guc_send_invalidate_tlb. Signed-off-by: Fei Yang <fei.yang@intel.com> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com> CC: John Harrison <john.c.harrison@intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Acked-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Acked-by: Nirmoy Das <nirmoy.das@intel.com> Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231017180806.3054290-6-jonathan.cavitt@intel.com (cherry picked from commit 55ac6ea) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent 0ca2c31 commit d4dbe77

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
#include "i915_drv.h"
3434
#include "i915_reg.h"
35+
#include "i915_irq.h"
3536
#include "i915_trace.h"
3637

3738
/**
@@ -1972,6 +1973,12 @@ void intel_guc_submission_cancel_requests(struct intel_guc *guc)
19721973

19731974
/* GuC is blown away, drop all references to contexts */
19741975
xa_destroy(&guc->context_lookup);
1976+
1977+
/*
1978+
* Wedged GT won't respond to any TLB invalidation request. Simply
1979+
* release all the blocked waiters.
1980+
*/
1981+
wake_up_all_tlb_invalidate(guc);
19751982
}
19761983

19771984
void intel_guc_submission_reset_finish(struct intel_guc *guc)
@@ -4786,10 +4793,19 @@ static long must_wait_woken(struct wait_queue_entry *wq_entry, long timeout)
47864793
return timeout;
47874794
}
47884795

4796+
static bool intel_gt_is_enabled(const struct intel_gt *gt)
4797+
{
4798+
/* Check if GT is wedged or suspended */
4799+
if (intel_gt_is_wedged(gt) || !intel_irqs_enabled(gt->i915))
4800+
return false;
4801+
return true;
4802+
}
4803+
47894804
static int guc_send_invalidate_tlb(struct intel_guc *guc,
47904805
enum intel_guc_tlb_invalidation_type type)
47914806
{
47924807
struct intel_guc_tlb_wait _wq, *wq = &_wq;
4808+
struct intel_gt *gt = guc_to_gt(guc);
47934809
DEFINE_WAIT_FUNC(wait, woken_wake_function);
47944810
int err;
47954811
u32 seqno;
@@ -4803,6 +4819,13 @@ static int guc_send_invalidate_tlb(struct intel_guc *guc,
48034819
};
48044820
u32 size = ARRAY_SIZE(action);
48054821

4822+
/*
4823+
* Early guard against GT enablement. TLB invalidation should not be
4824+
* attempted if the GT is disabled due to suspend/wedge.
4825+
*/
4826+
if (!intel_gt_is_enabled(gt))
4827+
return -EINVAL;
4828+
48064829
init_waitqueue_head(&_wq.wq);
48074830

48084831
if (xa_alloc_cyclic_irq(&guc->tlb_lookup, &seqno, wq,
@@ -4835,7 +4858,14 @@ static int guc_send_invalidate_tlb(struct intel_guc *guc,
48354858
if (err)
48364859
goto out;
48374860

4838-
if (!must_wait_woken(&wait, intel_guc_ct_max_queue_time_jiffies())) {
4861+
/*
4862+
* Late guard against GT enablement. It is not an error for the TLB
4863+
* invalidation to time out if the GT is disabled during the process
4864+
* due to suspend/wedge. In fact, the TLB invalidation is cancelled
4865+
* in this case.
4866+
*/
4867+
if (!must_wait_woken(&wait, intel_guc_ct_max_queue_time_jiffies()) &&
4868+
intel_gt_is_enabled(gt)) {
48394869
guc_err(guc,
48404870
"TLB invalidation response timed out for seqno %u\n", seqno);
48414871
err = -ETIME;

0 commit comments

Comments
 (0)