1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2020 Intel Corporation
4  */
5 
6 #ifndef __INTEL_MIGRATE__
7 #define __INTEL_MIGRATE__
8 
9 #include <linux/types.h>
10 
11 #include "intel_migrate_types.h"
12 
13 struct dma_fence;
14 struct i915_request;
15 struct i915_gem_ww_ctx;
16 struct intel_gt;
17 struct scatterlist;
18 enum i915_cache_level;
19 
20 int intel_migrate_init(struct intel_migrate *m, struct intel_gt *gt);
21 
22 struct intel_context *intel_migrate_create_context(struct intel_migrate *m);
23 
24 int intel_migrate_copy(struct intel_migrate *m,
25 		       struct i915_gem_ww_ctx *ww,
26 		       struct dma_fence *await,
27 		       struct scatterlist *src,
28 		       enum i915_cache_level src_cache_level,
29 		       bool src_is_lmem,
30 		       struct scatterlist *dst,
31 		       enum i915_cache_level dst_cache_level,
32 		       bool dst_is_lmem,
33 		       struct i915_request **out);
34 
35 int intel_context_migrate_copy(struct intel_context *ce,
36 			       struct dma_fence *await,
37 			       struct scatterlist *src,
38 			       enum i915_cache_level src_cache_level,
39 			       bool src_is_lmem,
40 			       struct scatterlist *dst,
41 			       enum i915_cache_level dst_cache_level,
42 			       bool dst_is_lmem,
43 			       struct i915_request **out);
44 
45 int
46 intel_migrate_clear(struct intel_migrate *m,
47 		    struct i915_gem_ww_ctx *ww,
48 		    struct dma_fence *await,
49 		    struct scatterlist *sg,
50 		    enum i915_cache_level cache_level,
51 		    bool is_lmem,
52 		    u32 value,
53 		    struct i915_request **out);
54 int
55 intel_context_migrate_clear(struct intel_context *ce,
56 			    struct dma_fence *await,
57 			    struct scatterlist *sg,
58 			    enum i915_cache_level cache_level,
59 			    bool is_lmem,
60 			    u32 value,
61 			    struct i915_request **out);
62 
63 void intel_migrate_fini(struct intel_migrate *m);
64 
65 #endif /* __INTEL_MIGRATE__ */
66