1 /* SPDX-License-Identifier: MIT */
3 * Copyright © 2020 Intel Corporation
9 #include <drm/drm_mm.h>
19 struct xe_migrate_pt_update;
23 struct xe_vm_pgtable_update;
27 * struct xe_migrate_pt_update_ops - Callbacks for the
28 * xe_migrate_update_pgtables() function.
30 struct xe_migrate_pt_update_ops {
32 * @populate: Populate a command buffer or page-table with ptes.
33 * @pt_update: Embeddable callback argument.
34 * @gt: The gt for the current operation.
35 * @map: struct iosys_map into the memory to be populated.
36 * @pos: If @map is NULL, map into the memory to be populated.
37 * @ofs: qword offset into @map, unused if @map is NULL.
38 * @num_qwords: Number of qwords to write.
39 * @update: Information about the PTEs to be inserted.
41 * This interface is intended to be used as a callback into the
42 * page-table system to populate command buffers or shared
43 * page-tables with PTEs.
45 void (*populate)(struct xe_migrate_pt_update *pt_update,
46 struct xe_gt *gt, struct iosys_map *map,
47 void *pos, u32 ofs, u32 num_qwords,
48 const struct xe_vm_pgtable_update *update);
51 * @pre_commit: Callback to be called just before arming the
53 * @pt_update: Pointer to embeddable callback argument.
55 * Return: 0 on success, negative error code on error.
57 int (*pre_commit)(struct xe_migrate_pt_update *pt_update);
61 * struct xe_migrate_pt_update - Argument to the
62 * struct xe_migrate_pt_update_ops callbacks.
64 * Intended to be subclassed to support additional arguments if necessary.
66 struct xe_migrate_pt_update {
67 /** @ops: Pointer to the struct xe_migrate_pt_update_ops callbacks */
68 const struct xe_migrate_pt_update_ops *ops;
69 /** @vma: The vma we're updating the pagetable for. */
73 struct xe_migrate *xe_migrate_init(struct xe_gt *gt);
75 struct dma_fence *xe_migrate_copy(struct xe_migrate *m,
77 struct ttm_resource *src,
78 struct ttm_resource *dst);
80 struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
82 struct ttm_resource *dst,
85 struct xe_vm *xe_migrate_get_vm(struct xe_migrate *m);
88 xe_migrate_update_pgtables(struct xe_migrate *m,
91 struct xe_engine *eng,
92 const struct xe_vm_pgtable_update *updates,
94 struct xe_sync_entry *syncs, u32 num_syncs,
95 struct xe_migrate_pt_update *pt_update);
97 void xe_migrate_wait(struct xe_migrate *m);
99 struct xe_engine *xe_gt_migrate_engine(struct xe_gt *gt);