Skip to content

Commit 55ac6ea

Browse files
Jonathan-CavittAndi Shyti
authored andcommitted
drm/i915: No TLB invalidation on wedged GT
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 <[email protected]> Signed-off-by: Jonathan Cavitt <[email protected]> CC: John Harrison <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Acked-by: Tvrtko Ursulin <[email protected]> Acked-by: Nirmoy Das <[email protected]> Signed-off-by: Andi Shyti <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 2202eca commit 55ac6ea

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

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
/**
@@ -1935,6 +1936,12 @@ void intel_guc_submission_cancel_requests(struct intel_guc *guc)
19351936

19361937
/* GuC is blown away, drop all references to contexts */
19371938
xa_destroy(&guc->context_lookup);
1939+
1940+
/*
1941+
* Wedged GT won't respond to any TLB invalidation request. Simply
1942+
* release all the blocked waiters.
1943+
*/
1944+
wake_up_all_tlb_invalidate(guc);
19381945
}
19391946

19401947
void intel_guc_submission_reset_finish(struct intel_guc *guc)
@@ -4749,10 +4756,19 @@ static long must_wait_woken(struct wait_queue_entry *wq_entry, long timeout)
47494756
return timeout;
47504757
}
47514758

4759+
static bool intel_gt_is_enabled(const struct intel_gt *gt)
4760+
{
4761+
/* Check if GT is wedged or suspended */
4762+
if (intel_gt_is_wedged(gt) || !intel_irqs_enabled(gt->i915))
4763+
return false;
4764+
return true;
4765+
}
4766+
47524767
static int guc_send_invalidate_tlb(struct intel_guc *guc,
47534768
enum intel_guc_tlb_invalidation_type type)
47544769
{
47554770
struct intel_guc_tlb_wait _wq, *wq = &_wq;
4771+
struct intel_gt *gt = guc_to_gt(guc);
47564772
DEFINE_WAIT_FUNC(wait, woken_wake_function);
47574773
int err;
47584774
u32 seqno;
@@ -4766,6 +4782,13 @@ static int guc_send_invalidate_tlb(struct intel_guc *guc,
47664782
};
47674783
u32 size = ARRAY_SIZE(action);
47684784

4785+
/*
4786+
* Early guard against GT enablement. TLB invalidation should not be
4787+
* attempted if the GT is disabled due to suspend/wedge.
4788+
*/
4789+
if (!intel_gt_is_enabled(gt))
4790+
return -EINVAL;
4791+
47694792
init_waitqueue_head(&_wq.wq);
47704793

47714794
if (xa_alloc_cyclic_irq(&guc->tlb_lookup, &seqno, wq,
@@ -4798,7 +4821,14 @@ static int guc_send_invalidate_tlb(struct intel_guc *guc,
47984821
if (err)
47994822
goto out;
48004823

4801-
if (!must_wait_woken(&wait, intel_guc_ct_max_queue_time_jiffies())) {
4824+
/*
4825+
* Late guard against GT enablement. It is not an error for the TLB
4826+
* invalidation to time out if the GT is disabled during the process
4827+
* due to suspend/wedge. In fact, the TLB invalidation is cancelled
4828+
* in this case.
4829+
*/
4830+
if (!must_wait_woken(&wait, intel_guc_ct_max_queue_time_jiffies()) &&
4831+
intel_gt_is_enabled(gt)) {
48024832
guc_err(guc,
48034833
"TLB invalidation response timed out for seqno %u\n", seqno);
48044834
err = -ETIME;

0 commit comments

Comments
 (0)