brintos

brintos / linux-shallow public Read only

0
0
Text · 3.8 KiB · 0109866 Raw
124 lines · c
1/* SPDX-License-Identifier: MIT */2/*3 * Copyright © 2020 Intel Corporation4 */5 6#ifndef _XE_MIGRATE_7#define _XE_MIGRATE_8 9#include <linux/types.h>10 11struct dma_fence;12struct iosys_map;13struct ttm_resource;14 15struct xe_bo;16struct xe_gt;17struct xe_exec_queue;18struct xe_migrate;19struct xe_migrate_pt_update;20struct xe_sync_entry;21struct xe_pt;22struct xe_tile;23struct xe_vm;24struct xe_vm_pgtable_update;25struct xe_vma;26 27/**28 * struct xe_migrate_pt_update_ops - Callbacks for the29 * xe_migrate_update_pgtables() function.30 */31struct 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 the43	 * page-table system to populate command buffers or shared44	 * 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 the61	 * page-table system to populate command buffers or shared62	 * 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 the71	 * 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 the81 * struct xe_migrate_pt_update_ops callbacks.82 *83 * Intended to be subclassed to support additional arguments if necessary.84 */85struct 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 96struct xe_migrate *xe_migrate_init(struct xe_tile *tile);97 98struct 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)109struct dma_fence *xe_migrate_clear(struct xe_migrate *m,110				   struct xe_bo *bo,111				   struct ttm_resource *dst,112				   u32 clear_flags);113 114struct xe_vm *xe_migrate_get_vm(struct xe_migrate *m);115 116struct dma_fence *117xe_migrate_update_pgtables(struct xe_migrate *m,118			   struct xe_migrate_pt_update *pt_update);119 120void xe_migrate_wait(struct xe_migrate *m);121 122struct xe_exec_queue *xe_tile_migrate_exec_queue(struct xe_tile *tile);123#endif124