1 /* SPDX-License-Identifier: MIT */
3 * Copyright © 2020 Intel Corporation
9 #include <drm/drm_mm.h>
19 struct xe_migrate_pt_update;
24 struct xe_vm_pgtable_update;
28 * struct xe_migrate_pt_update_ops - Callbacks for the
29 * xe_migrate_update_pgtables() function.
31 struct xe_migrate_pt_update_ops {
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.
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.
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);
52 * @pre_commit: Callback to be called just before arming the
54 * @pt_update: Pointer to embeddable callback argument.
56 * Return: 0 on success, negative error code on error.
58 int (*pre_commit)(struct xe_migrate_pt_update *pt_update);
62 * struct xe_migrate_pt_update - Argument to the
63 * struct xe_migrate_pt_update_ops callbacks.
65 * Intended to be subclassed to support additional arguments if necessary.
67 struct xe_migrate_pt_update {
68 /** @ops: Pointer to the struct xe_migrate_pt_update_ops callbacks */
69 const struct xe_migrate_pt_update_ops *ops;
70 /** @vma: The vma we're updating the pagetable for. */
72 /** @job: The job if a GPU page-table update. NULL otherwise */
73 struct xe_sched_job *job;
74 /** @start: Start of update for the range fence */
76 /** @last: Last of update for the range fence */
78 /** @tile_id: Tile ID of the update */
82 struct xe_migrate *xe_migrate_init(struct xe_tile *tile);
84 struct dma_fence *xe_migrate_copy(struct xe_migrate *m,
87 struct ttm_resource *src,
88 struct ttm_resource *dst,
91 struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
93 struct ttm_resource *dst);
95 struct xe_vm *xe_migrate_get_vm(struct xe_migrate *m);
98 xe_migrate_update_pgtables(struct xe_migrate *m,
101 struct xe_exec_queue *q,
102 const struct xe_vm_pgtable_update *updates,
104 struct xe_sync_entry *syncs, u32 num_syncs,
105 struct xe_migrate_pt_update *pt_update);
107 void xe_migrate_wait(struct xe_migrate *m);
109 struct xe_exec_queue *xe_tile_migrate_engine(struct xe_tile *tile);