diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a_allocator.h')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a_allocator.h | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_allocator.h b/drivers/gpu/nvgpu/gk20a/gk20a_allocator.h index dba397e2..cd72ec9c 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_allocator.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a_allocator.h | |||
@@ -25,8 +25,6 @@ | |||
25 | 25 | ||
26 | /* #define ALLOCATOR_DEBUG */ | 26 | /* #define ALLOCATOR_DEBUG */ |
27 | 27 | ||
28 | struct allocator_block; | ||
29 | |||
30 | /* main struct */ | 28 | /* main struct */ |
31 | struct gk20a_allocator { | 29 | struct gk20a_allocator { |
32 | 30 | ||
@@ -61,17 +59,9 @@ struct gk20a_allocator { | |||
61 | 59 | ||
62 | int (*alloc)(struct gk20a_allocator *allocator, | 60 | int (*alloc)(struct gk20a_allocator *allocator, |
63 | u32 *addr, u32 len); | 61 | u32 *addr, u32 len); |
64 | int (*alloc_nc)(struct gk20a_allocator *allocator, | ||
65 | u32 *addr, u32 len, | ||
66 | struct gk20a_alloc_block **pblock); | ||
67 | int (*free)(struct gk20a_allocator *allocator, | 62 | int (*free)(struct gk20a_allocator *allocator, |
68 | u32 addr, u32 len); | 63 | u32 addr, u32 len); |
69 | void (*free_nc)(struct gk20a_allocator *allocator, | ||
70 | struct gk20a_alloc_block *block); | ||
71 | 64 | ||
72 | int (*constrain)(struct gk20a_allocator *a, | ||
73 | bool enable, | ||
74 | u32 base, u32 limit); | ||
75 | }; | 65 | }; |
76 | 66 | ||
77 | /* a block of linear space range [start, end) */ | 67 | /* a block of linear space range [start, end) */ |
@@ -103,14 +93,9 @@ void gk20a_allocator_destroy(struct gk20a_allocator *allocator); | |||
103 | 93 | ||
104 | int gk20a_allocator_block_alloc(struct gk20a_allocator *allocator, | 94 | int gk20a_allocator_block_alloc(struct gk20a_allocator *allocator, |
105 | u32 *addr, u32 len); | 95 | u32 *addr, u32 len); |
106 | int gk20a_allocator_block_alloc_nc(struct gk20a_allocator *allocator, | ||
107 | u32 *addr, u32 len, | ||
108 | struct gk20a_alloc_block **pblock); | ||
109 | 96 | ||
110 | int gk20a_allocator_block_free(struct gk20a_allocator *allocator, | 97 | int gk20a_allocator_block_free(struct gk20a_allocator *allocator, |
111 | u32 addr, u32 len); | 98 | u32 addr, u32 len); |
112 | void gk20a_allocator_block_free_nc(struct gk20a_allocator *allocator, | ||
113 | struct gk20a_alloc_block *block); | ||
114 | 99 | ||
115 | #if defined(ALLOCATOR_DEBUG) | 100 | #if defined(ALLOCATOR_DEBUG) |
116 | 101 | ||
@@ -121,53 +106,6 @@ do { \ | |||
121 | alloctor->name, __func__, ##arg);\ | 106 | alloctor->name, __func__, ##arg);\ |
122 | } while (0) | 107 | } while (0) |
123 | 108 | ||
124 | static inline void | ||
125 | gk20a_allocator_dump(struct gk20a_allocator *allocator) { | ||
126 | struct gk20a_alloc_block *block; | ||
127 | u32 count = 0; | ||
128 | |||
129 | down_read(&allocator->rw_sema); | ||
130 | for (block = allocator->block_first; block; block = block->next) { | ||
131 | allocator_dbg(allocator, "block %d - %d:%d, nc %d", | ||
132 | count++, block->start, block->end, block->nc_block); | ||
133 | |||
134 | if (block->prev) | ||
135 | BUG_ON(block->prev->end > block->start); | ||
136 | if (block->next) | ||
137 | BUG_ON(block->next->start < block->end); | ||
138 | } | ||
139 | allocator_dbg(allocator, "tracked count %d, actual count %d", | ||
140 | allocator->block_count, count); | ||
141 | allocator_dbg(allocator, "first block %d:%d", | ||
142 | allocator->block_first ? allocator->block_first->start : -1, | ||
143 | allocator->block_first ? allocator->block_first->end : -1); | ||
144 | allocator_dbg(allocator, "first free addr %d", | ||
145 | allocator->first_free_addr); | ||
146 | allocator_dbg(allocator, "last free addr %d", | ||
147 | allocator->last_free_addr); | ||
148 | allocator_dbg(allocator, "cached hole size %d", | ||
149 | allocator->cached_hole_size); | ||
150 | up_read(&allocator->rw_sema); | ||
151 | |||
152 | BUG_ON(count != allocator->block_count); | ||
153 | } | ||
154 | |||
155 | static inline void | ||
156 | gk20a_allocator_dump_nc_list( | ||
157 | struct gk20a_allocator *allocator, | ||
158 | struct gk20a_alloc_block *block) | ||
159 | { | ||
160 | down_read(&allocator->rw_sema); | ||
161 | while (block) { | ||
162 | pr_debug("non-contiguous block %d:%d\n", | ||
163 | block->start, block->end); | ||
164 | block = block->nc_next; | ||
165 | } | ||
166 | up_read(&allocator->rw_sema); | ||
167 | } | ||
168 | |||
169 | void gk20a_allocator_test(void); | ||
170 | |||
171 | #else /* ALLOCATOR_DEBUG */ | 109 | #else /* ALLOCATOR_DEBUG */ |
172 | 110 | ||
173 | #define allocator_dbg(format, arg...) | 111 | #define allocator_dbg(format, arg...) |