aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorMatthew Auld <[email protected]>2023-05-05 15:49:10 +0100
committerRodrigo Vivi <[email protected]>2023-12-19 18:33:50 -0500
commita2db3192115d8cafa3dcae024873957929a4eae0 (patch)
treecfd67f9ba69a4ddf64241e1c2a9718c72457979f /drivers/gpu
parent50f1f0591638ec43eb041e27ab5e4eae47882cbc (diff)
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: Matthew Auld <[email protected]> Cc: Thomas Hellström <[email protected]> Cc: Matthew Brost <[email protected]> Reviewed-by: Matthew Brost <[email protected]> Signed-off-by: Rodrigo Vivi <[email protected]>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
index 9e7fe8d9bca4..c815a42e2cdb 100644
--- a/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
+++ b/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c
@@ -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)
{
- if (gt->tlb_invalidation.seqno_recv >= seqno)
- return true;
+ if (seqno - gt->tlb_invalidation.seqno_recv <
+ -(TLB_INVALIDATION_SEQNO_MAX / 2))
+ return false;
if (seqno - gt->tlb_invalidation.seqno_recv >
(TLB_INVALIDATION_SEQNO_MAX / 2))
return true;
- return false;
+ return gt->tlb_invalidation.seqno_recv >= seqno;
}
/**