]> Git Repo - J-linux.git/blob - drivers/gpu/drm/xe/xe_migrate.h
Merge tag 'vfs-6.13-rc7.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
[J-linux.git] / drivers / gpu / drm / xe / xe_migrate.h
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2020 Intel Corporation
4  */
5
6 #ifndef _XE_MIGRATE_
7 #define _XE_MIGRATE_
8
9 #include <linux/types.h>
10
11 struct dma_fence;
12 struct iosys_map;
13 struct ttm_resource;
14
15 struct xe_bo;
16 struct xe_gt;
17 struct xe_exec_queue;
18 struct xe_migrate;
19 struct xe_migrate_pt_update;
20 struct xe_sync_entry;
21 struct xe_pt;
22 struct xe_tile;
23 struct xe_vm;
24 struct xe_vm_pgtable_update;
25 struct xe_vma;
26
27 /**
28  * struct xe_migrate_pt_update_ops - Callbacks for the
29  * xe_migrate_update_pgtables() function.
30  */
31 struct xe_migrate_pt_update_ops {
32         /**
33          * @populate: Populate a command buffer or page-table with ptes.
34          * @pt_update: Embeddable callback argument.
35          * @tile: The tile for the current operation.
36          * @map: struct iosys_map into the memory to be populated.
37          * @pos: If @map is NULL, map into the memory to be populated.
38          * @ofs: qword offset into @map, unused if @map is NULL.
39          * @num_qwords: Number of qwords to write.
40          * @update: Information about the PTEs to be inserted.
41          *
42          * This interface is intended to be used as a callback into the
43          * page-table system to populate command buffers or shared
44          * page-tables with PTEs.
45          */
46         void (*populate)(struct xe_migrate_pt_update *pt_update,
47                          struct xe_tile *tile, struct iosys_map *map,
48                          void *pos, u32 ofs, u32 num_qwords,
49                          const struct xe_vm_pgtable_update *update);
50         /**
51          * @clear: Clear a command buffer or page-table with ptes.
52          * @pt_update: Embeddable callback argument.
53          * @tile: The tile for the current operation.
54          * @map: struct iosys_map into the memory to be populated.
55          * @pos: If @map is NULL, map into the memory to be populated.
56          * @ofs: qword offset into @map, unused if @map is NULL.
57          * @num_qwords: Number of qwords to write.
58          * @update: Information about the PTEs to be inserted.
59          *
60          * This interface is intended to be used as a callback into the
61          * page-table system to populate command buffers or shared
62          * page-tables with PTEs.
63          */
64         void (*clear)(struct xe_migrate_pt_update *pt_update,
65                       struct xe_tile *tile, struct iosys_map *map,
66                       void *pos, u32 ofs, u32 num_qwords,
67                       const struct xe_vm_pgtable_update *update);
68
69         /**
70          * @pre_commit: Callback to be called just before arming the
71          * sched_job.
72          * @pt_update: Pointer to embeddable callback argument.
73          *
74          * Return: 0 on success, negative error code on error.
75          */
76         int (*pre_commit)(struct xe_migrate_pt_update *pt_update);
77 };
78
79 /**
80  * struct xe_migrate_pt_update - Argument to the
81  * struct xe_migrate_pt_update_ops callbacks.
82  *
83  * Intended to be subclassed to support additional arguments if necessary.
84  */
85 struct xe_migrate_pt_update {
86         /** @ops: Pointer to the struct xe_migrate_pt_update_ops callbacks */
87         const struct xe_migrate_pt_update_ops *ops;
88         /** @vops: VMA operations */
89         struct xe_vma_ops *vops;
90         /** @job: The job if a GPU page-table update. NULL otherwise */
91         struct xe_sched_job *job;
92         /** @tile_id: Tile ID of the update */
93         u8 tile_id;
94 };
95
96 struct xe_migrate *xe_migrate_init(struct xe_tile *tile);
97
98 struct dma_fence *xe_migrate_copy(struct xe_migrate *m,
99                                   struct xe_bo *src_bo,
100                                   struct xe_bo *dst_bo,
101                                   struct ttm_resource *src,
102                                   struct ttm_resource *dst,
103                                   bool copy_only_ccs);
104
105 #define XE_MIGRATE_CLEAR_FLAG_BO_DATA           BIT(0)
106 #define XE_MIGRATE_CLEAR_FLAG_CCS_DATA          BIT(1)
107 #define XE_MIGRATE_CLEAR_FLAG_FULL      (XE_MIGRATE_CLEAR_FLAG_BO_DATA | \
108                                         XE_MIGRATE_CLEAR_FLAG_CCS_DATA)
109 struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
110                                    struct xe_bo *bo,
111                                    struct ttm_resource *dst,
112                                    u32 clear_flags);
113
114 struct xe_vm *xe_migrate_get_vm(struct xe_migrate *m);
115
116 struct dma_fence *
117 xe_migrate_update_pgtables(struct xe_migrate *m,
118                            struct xe_migrate_pt_update *pt_update);
119
120 void xe_migrate_wait(struct xe_migrate *m);
121
122 struct xe_exec_queue *xe_tile_migrate_exec_queue(struct xe_tile *tile);
123 #endif
This page took 0.032878 seconds and 4 git commands to generate.