drm/xe: Restrict huge PTEs to 1GiB
[linux-2.6-microblaze.git] / drivers / gpu / drm / xe / xe_pt.h
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2022 Intel Corporation
4  */
5 #ifndef _XE_PT_H_
6 #define _XE_PT_H_
7
8 #include <linux/types.h>
9
10 #include "xe_pt_types.h"
11
12 struct dma_fence;
13 struct xe_bo;
14 struct xe_device;
15 struct xe_exec_queue;
16 struct xe_sync_entry;
17 struct xe_tile;
18 struct xe_vm;
19 struct xe_vma;
20
21 /* Largest huge pte is currently 1GiB. May become device dependent. */
22 #define MAX_HUGEPTE_LEVEL 2
23
24 #define xe_pt_write(xe, map, idx, data) \
25         xe_map_wr(xe, map, (idx) * sizeof(u64), u64, data)
26
27 unsigned int xe_pt_shift(unsigned int level);
28
29 struct xe_pt *xe_pt_create(struct xe_vm *vm, struct xe_tile *tile,
30                            unsigned int level);
31
32 int xe_pt_create_scratch(struct xe_device *xe, struct xe_tile *tile,
33                          struct xe_vm *vm);
34
35 void xe_pt_populate_empty(struct xe_tile *tile, struct xe_vm *vm,
36                           struct xe_pt *pt);
37
38 void xe_pt_destroy(struct xe_pt *pt, u32 flags, struct llist_head *deferred);
39
40 struct dma_fence *
41 __xe_pt_bind_vma(struct xe_tile *tile, struct xe_vma *vma, struct xe_exec_queue *q,
42                  struct xe_sync_entry *syncs, u32 num_syncs,
43                  bool rebind);
44
45 struct dma_fence *
46 __xe_pt_unbind_vma(struct xe_tile *tile, struct xe_vma *vma, struct xe_exec_queue *q,
47                    struct xe_sync_entry *syncs, u32 num_syncs);
48
49 bool xe_pt_zap_ptes(struct xe_tile *tile, struct xe_vma *vma);
50
51 #endif