xref: /linux/drivers/gpu/drm/xe/xe_pt.h (revision de848da12f752170c2ebe114804a985314fd5a6a)
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;
16dd08ebf6SMatthew Brost struct xe_sync_entry;
17876611c2SMatt Roper struct xe_tile;
18dd08ebf6SMatthew Brost struct xe_vm;
19dd08ebf6SMatthew Brost struct xe_vma;
20*e8babb28SMatthew Brost struct xe_vma_ops;
21dd08ebf6SMatthew Brost 
22e84d716dSThomas Hellström /* Largest huge pte is currently 1GiB. May become device dependent. */
23e84d716dSThomas Hellström #define MAX_HUGEPTE_LEVEL 2
24e84d716dSThomas Hellström 
25dd08ebf6SMatthew Brost #define xe_pt_write(xe, map, idx, data) \
26dd08ebf6SMatthew Brost 	xe_map_wr(xe, map, (idx) * sizeof(u64), u64, data)
27dd08ebf6SMatthew Brost 
28dd08ebf6SMatthew Brost unsigned int xe_pt_shift(unsigned int level);
29dd08ebf6SMatthew Brost 
30876611c2SMatt Roper struct xe_pt *xe_pt_create(struct xe_vm *vm, struct xe_tile *tile,
31dd08ebf6SMatthew Brost 			   unsigned int level);
32dd08ebf6SMatthew Brost 
33876611c2SMatt Roper void xe_pt_populate_empty(struct xe_tile *tile, struct xe_vm *vm,
34dd08ebf6SMatthew Brost 			  struct xe_pt *pt);
35dd08ebf6SMatthew Brost 
36dd08ebf6SMatthew Brost void xe_pt_destroy(struct xe_pt *pt, u32 flags, struct llist_head *deferred);
37dd08ebf6SMatthew Brost 
38*e8babb28SMatthew Brost int xe_pt_update_ops_prepare(struct xe_tile *tile, struct xe_vma_ops *vops);
39*e8babb28SMatthew Brost struct dma_fence *xe_pt_update_ops_run(struct xe_tile *tile,
40*e8babb28SMatthew Brost 				       struct xe_vma_ops *vops);
41*e8babb28SMatthew Brost void xe_pt_update_ops_fini(struct xe_tile *tile, struct xe_vma_ops *vops);
42*e8babb28SMatthew Brost void xe_pt_update_ops_abort(struct xe_tile *tile, struct xe_vma_ops *vops);
43dd08ebf6SMatthew Brost 
44876611c2SMatt Roper bool xe_pt_zap_ptes(struct xe_tile *tile, struct xe_vma *vma);
45dd08ebf6SMatthew Brost 
46dd08ebf6SMatthew Brost #endif
47