Commit a2db3192 authored by Matthew Auld's avatar Matthew Auld Committed by Rodrigo Vivi

drm/xe: fix tlb_invalidation_seqno_past()

Checking seqno_recv >= seqno looks like it will incorrectly report true
when the seqno has wrapped (not unlikely given
TLB_INVALIDATION_SEQNO_MAX). Calling xe_gt_tlb_invalidation_wait() might
then return before the flush has been completed by the GuC.

Fix this by treating a large negative delta as an indication that the
seqno has wrapped around. Similar to how we treat a large positive delta
as an indication that the seqno_recv must have wrapped around, but in
that case the seqno has likely also signalled.

It looks like we could also potentially make the seqno use the full
32bits as supported by the GuC.
Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: default avatarMatthew Brost <matthew.brost@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 50f1f059
...@@ -251,14 +251,15 @@ int xe_gt_tlb_invalidation_vma(struct xe_gt *gt, ...@@ -251,14 +251,15 @@ int xe_gt_tlb_invalidation_vma(struct xe_gt *gt,
static bool tlb_invalidation_seqno_past(struct xe_gt *gt, int seqno) static bool tlb_invalidation_seqno_past(struct xe_gt *gt, int seqno)
{ {
if (gt->tlb_invalidation.seqno_recv >= seqno) if (seqno - gt->tlb_invalidation.seqno_recv <
return true; -(TLB_INVALIDATION_SEQNO_MAX / 2))
return false;
if (seqno - gt->tlb_invalidation.seqno_recv > if (seqno - gt->tlb_invalidation.seqno_recv >
(TLB_INVALIDATION_SEQNO_MAX / 2)) (TLB_INVALIDATION_SEQNO_MAX / 2))
return true; return true;
return false; return gt->tlb_invalidation.seqno_recv >= seqno;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment