xref: /linux/drivers/gpu/drm/xe/xe_pt.h (revision 4f9786035f9e519db41375818e1d0b5f20da2f10)
1dd08ebf6SMatthew Brost /* SPDX-License-Identifier: MIT */
2dd08ebf6SMatthew Brost /*
3dd08ebf6SMatthew Brost  * Copyright © 2022 Intel Corporation
4dd08ebf6SMatthew Brost  */
5dd08ebf6SMatthew Brost #ifndef _XE_PT_H_
6dd08ebf6SMatthew Brost #define _XE_PT_H_
7dd08ebf6SMatthew Brost 
8dd08ebf6SMatthew Brost #include <linux/types.h>
9dd08ebf6SMatthew Brost 
10dd08ebf6SMatthew Brost #include "xe_pt_types.h"
11dd08ebf6SMatthew Brost 
12dd08ebf6SMatthew Brost struct dma_fence;
13dd08ebf6SMatthew Brost struct xe_bo;
14dd08ebf6SMatthew Brost struct xe_device;
159b9529ceSFrancois Dugast struct xe_exec_queue;
16074e40d9SMatthew Brost struct xe_svm_range;
17dd08ebf6SMatthew Brost struct xe_sync_entry;
18876611c2SMatt Roper struct xe_tile;
19dd08ebf6SMatthew Brost struct xe_vm;
20dd08ebf6SMatthew Brost struct xe_vma;
21e8babb28SMatthew Brost struct xe_vma_ops;
22dd08ebf6SMatthew Brost 
23e84d716dSThomas Hellström /* Largest huge pte is currently 1GiB. May become device dependent. */
24e84d716dSThomas Hellström #define MAX_HUGEPTE_LEVEL 2
25e84d716dSThomas Hellström 
26dd08ebf6SMatthew Brost #define xe_pt_write(xe, map, idx, data) \
27dd08ebf6SMatthew Brost 	xe_map_wr(xe, map, (idx) * sizeof(u64), u64, data)
28dd08ebf6SMatthew Brost 
29dd08ebf6SMatthew Brost unsigned int xe_pt_shift(unsigned int level);
30dd08ebf6SMatthew Brost 
31876611c2SMatt Roper struct xe_pt *xe_pt_create(struct xe_vm *vm, struct xe_tile *tile,
32dd08ebf6SMatthew Brost 			   unsigned int level);
33dd08ebf6SMatthew Brost 
34876611c2SMatt Roper void xe_pt_populate_empty(struct xe_tile *tile, struct xe_vm *vm,
35dd08ebf6SMatthew Brost 			  struct xe_pt *pt);
36dd08ebf6SMatthew Brost 
37dd08ebf6SMatthew Brost void xe_pt_destroy(struct xe_pt *pt, u32 flags, struct llist_head *deferred);
38dd08ebf6SMatthew Brost 
39074e40d9SMatthew Brost void xe_pt_clear(struct xe_device *xe, struct xe_pt *pt);
40074e40d9SMatthew Brost 
41e8babb28SMatthew Brost int xe_pt_update_ops_prepare(struct xe_tile *tile, struct xe_vma_ops *vops);
42e8babb28SMatthew Brost struct dma_fence *xe_pt_update_ops_run(struct xe_tile *tile,
43e8babb28SMatthew Brost 				       struct xe_vma_ops *vops);
44e8babb28SMatthew Brost void xe_pt_update_ops_fini(struct xe_tile *tile, struct xe_vma_ops *vops);
45e8babb28SMatthew Brost void xe_pt_update_ops_abort(struct xe_tile *tile, struct xe_vma_ops *vops);
46dd08ebf6SMatthew Brost 
47876611c2SMatt Roper bool xe_pt_zap_ptes(struct xe_tile *tile, struct xe_vma *vma);
48*ab498828SMatthew Brost bool xe_pt_zap_ptes_range(struct xe_tile *tile, struct xe_vm *vm,
49*ab498828SMatthew Brost 			  struct xe_svm_range *range);
50dd08ebf6SMatthew Brost 
51dd08ebf6SMatthew Brost #endif
52