1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#ifndef TTM_PAGE_ALLOC
27#define TTM_PAGE_ALLOC
28
29#include <drm/ttm/ttm_bo_driver.h>
30#include <drm/ttm/ttm_memory.h>
31
32struct device;
33
34
35
36
37int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages);
38
39
40
41void ttm_page_alloc_fini(void);
42
43
44
45
46
47
48
49
50int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx);
51
52
53
54
55
56
57
58
59void ttm_pool_unpopulate(struct ttm_tt *ttm);
60
61
62
63
64int ttm_populate_and_map_pages(struct device *dev, struct ttm_dma_tt *tt,
65 struct ttm_operation_ctx *ctx);
66
67
68
69
70void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_dma_tt *tt);
71
72
73
74
75int ttm_page_alloc_debugfs(struct seq_file *m, void *data);
76
77#if defined(CONFIG_SWIOTLB) || defined(CONFIG_INTEL_IOMMU)
78
79
80
81int ttm_dma_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages);
82
83
84
85
86void ttm_dma_page_alloc_fini(void);
87
88
89
90
91int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data);
92
93int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev,
94 struct ttm_operation_ctx *ctx);
95void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev);
96
97#else
98static inline int ttm_dma_page_alloc_init(struct ttm_mem_global *glob,
99 unsigned max_pages)
100{
101 return -ENODEV;
102}
103
104static inline void ttm_dma_page_alloc_fini(void) { return; }
105
106static inline int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data)
107{
108 return 0;
109}
110static inline int ttm_dma_populate(struct ttm_dma_tt *ttm_dma,
111 struct device *dev,
112 struct ttm_operation_ctx *ctx)
113{
114 return -ENOMEM;
115}
116static inline void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma,
117 struct device *dev)
118{
119}
120#endif
121
122#endif
123