Skip to content

Commit

Permalink
drm/i915: pass a pointer for tlb seqno at vma_invalidate_tlb()
Browse files Browse the repository at this point in the history
WRITE_ONCE() should happen at the original var, not on a local
copy of it.

Cc: [email protected]
Fixes: 5d36acb ("drm/i915/gt: Batch TLB invalidations")
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Signed-off-by: Rodrigo Vivi <[email protected]>
[added cc-stable while merging it]
Link: https://patchwork.freedesktop.org/patch/msgid/f9550e6bacea10131ff40dd8981b69eb9251cdcd.1659598090.git.mchehab@kernel.org
  • Loading branch information
mchehab authored and rodrigovivi committed Aug 8, 2022
1 parent 7dd5c56 commit 3d037d9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/gt/intel_ppgtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void ppgtt_unbind_vma(struct i915_address_space *vm,

vm->clear_range(vm, vma_res->start, vma_res->vma_size);
if (vma_res->tlb)
vma_invalidate_tlb(vm, *vma_res->tlb);
vma_invalidate_tlb(vm, vma_res->tlb);
}

static unsigned long pd_count(u64 size, int shift)
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/i915/i915_vma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ I915_SELFTEST_EXPORT int i915_vma_get_pages(struct i915_vma *vma)
return err;
}

void vma_invalidate_tlb(struct i915_address_space *vm, u32 tlb)
void vma_invalidate_tlb(struct i915_address_space *vm, u32 *tlb)
{
/*
* Before we release the pages that were bound by this vma, we
Expand All @@ -1318,7 +1318,7 @@ void vma_invalidate_tlb(struct i915_address_space *vm, u32 tlb)
* the most recent TLB invalidation seqno, and if we have not yet
* flushed the TLBs upon release, perform a full invalidation.
*/
WRITE_ONCE(tlb, intel_gt_next_invalidate_tlb_full(vm->gt));
WRITE_ONCE(*tlb, intel_gt_next_invalidate_tlb_full(vm->gt));
}

static void __vma_put_pages(struct i915_vma *vma, unsigned int count)
Expand Down Expand Up @@ -1971,7 +1971,7 @@ struct dma_fence *__i915_vma_evict(struct i915_vma *vma, bool async)
dma_fence_put(unbind_fence);
unbind_fence = NULL;
}
vma_invalidate_tlb(vma->vm, vma->obj->mm.tlb);
vma_invalidate_tlb(vma->vm, &vma->obj->mm.tlb);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_vma.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ bool i915_vma_misplaced(const struct i915_vma *vma,
u64 size, u64 alignment, u64 flags);
void __i915_vma_set_map_and_fenceable(struct i915_vma *vma);
void i915_vma_revoke_mmap(struct i915_vma *vma);
void vma_invalidate_tlb(struct i915_address_space *vm, u32 tlb);
void vma_invalidate_tlb(struct i915_address_space *vm, u32 *tlb);
struct dma_fence *__i915_vma_evict(struct i915_vma *vma, bool async);
int __i915_vma_unbind(struct i915_vma *vma);
int __must_check i915_vma_unbind(struct i915_vma *vma);
Expand Down

0 comments on commit 3d037d9

Please sign in to comment.