Linux Audio

Check our new training course

Loading...
  1/* SPDX-License-Identifier: MIT */
  2/*
  3 * Copyright © 2020 Intel Corporation
  4 */
  5
  6#ifndef _XE_MIGRATE_
  7#define _XE_MIGRATE_
  8
  9#include <drm/drm_mm.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 the
 29 * 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 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	/**
 52	 * @pre_commit: Callback to be called just before arming the
 53	 * sched_job.
 54	 * @pt_update: Pointer to embeddable callback argument.
 55	 *
 56	 * Return: 0 on success, negative error code on error.
 57	 */
 58	int (*pre_commit)(struct xe_migrate_pt_update *pt_update);
 59};
 60
 61/**
 62 * struct xe_migrate_pt_update - Argument to the
 63 * struct xe_migrate_pt_update_ops callbacks.
 64 *
 65 * Intended to be subclassed to support additional arguments if necessary.
 66 */
 67struct 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. */
 71	struct xe_vma *vma;
 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 */
 75	u64 start;
 76	/** @last: Last of update for the range fence */
 77	u64 last;
 78	/** @tile_id: Tile ID of the update */
 79	u8 tile_id;
 80};
 81
 82struct xe_migrate *xe_migrate_init(struct xe_tile *tile);
 83
 84struct dma_fence *xe_migrate_copy(struct xe_migrate *m,
 85				  struct xe_bo *src_bo,
 86				  struct xe_bo *dst_bo,
 87				  struct ttm_resource *src,
 88				  struct ttm_resource *dst,
 89				  bool copy_only_ccs);
 90
 91struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
 92				   struct xe_bo *bo,
 93				   struct ttm_resource *dst);
 94
 95struct xe_vm *xe_migrate_get_vm(struct xe_migrate *m);
 96
 97struct dma_fence *
 98xe_migrate_update_pgtables(struct xe_migrate *m,
 99			   struct xe_vm *vm,
100			   struct xe_bo *bo,
101			   struct xe_exec_queue *q,
102			   const struct xe_vm_pgtable_update *updates,
103			   u32 num_updates,
104			   struct xe_sync_entry *syncs, u32 num_syncs,
105			   struct xe_migrate_pt_update *pt_update);
106
107void xe_migrate_wait(struct xe_migrate *m);
108
109struct xe_exec_queue *xe_tile_migrate_engine(struct xe_tile *tile);
110#endif