xref: /linux/drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h (revision 6e7fd890f1d6ac83805409e9c346240de2705584)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2023 Intel Corporation
4  */
5 
6 #ifndef _XE_GT_TLB_INVALIDATION_H_
7 #define _XE_GT_TLB_INVALIDATION_H_
8 
9 #include <linux/types.h>
10 
11 #include "xe_gt_tlb_invalidation_types.h"
12 
13 struct xe_gt;
14 struct xe_guc;
15 struct xe_vma;
16 
17 int xe_gt_tlb_invalidation_init(struct xe_gt *gt);
18 void xe_gt_tlb_invalidation_reset(struct xe_gt *gt);
19 int xe_gt_tlb_invalidation_ggtt(struct xe_gt *gt);
20 int xe_gt_tlb_invalidation_vma(struct xe_gt *gt,
21 			       struct xe_gt_tlb_invalidation_fence *fence,
22 			       struct xe_vma *vma);
23 int xe_gt_tlb_invalidation_range(struct xe_gt *gt,
24 				 struct xe_gt_tlb_invalidation_fence *fence,
25 				 u64 start, u64 end, u32 asid);
26 int xe_guc_tlb_invalidation_done_handler(struct xe_guc *guc, u32 *msg, u32 len);
27 
28 void xe_gt_tlb_invalidation_fence_init(struct xe_gt *gt,
29 				       struct xe_gt_tlb_invalidation_fence *fence,
30 				       bool stack);
31 void xe_gt_tlb_invalidation_fence_fini(struct xe_gt_tlb_invalidation_fence *fence);
32 
33 static inline void
34 xe_gt_tlb_invalidation_fence_wait(struct xe_gt_tlb_invalidation_fence *fence)
35 {
36 	dma_fence_wait(&fence->base, false);
37 }
38 
39 #endif	/* _XE_GT_TLB_INVALIDATION_ */
40