Lines Matching refs:cur

70 				struct xe_res_cursor *cur)  in xe_res_first()  argument
72 cur->sgl = NULL; in xe_res_first()
78 cur->mem_type = res->mem_type; in xe_res_first()
80 switch (cur->mem_type) { in xe_res_first()
105 cur->mm = mm; in xe_res_first()
106 cur->start = drm_buddy_block_offset(block) + start; in xe_res_first()
107 cur->size = min(drm_buddy_block_size(mm, block) - start, in xe_res_first()
109 cur->remaining = size; in xe_res_first()
110 cur->node = block; in xe_res_first()
120 cur->start = start; in xe_res_first()
121 cur->size = size; in xe_res_first()
122 cur->remaining = size; in xe_res_first()
123 cur->node = NULL; in xe_res_first()
124 cur->mem_type = XE_PL_TT; in xe_res_first()
128 static inline void __xe_res_sg_next(struct xe_res_cursor *cur) in __xe_res_sg_next() argument
130 struct scatterlist *sgl = cur->sgl; in __xe_res_sg_next()
131 u64 start = cur->start; in __xe_res_sg_next()
139 cur->start = start; in __xe_res_sg_next()
140 cur->size = sg_dma_len(sgl) - start; in __xe_res_sg_next()
141 cur->sgl = sgl; in __xe_res_sg_next()
156 struct xe_res_cursor *cur) in xe_res_first_sg() argument
159 cur->node = NULL; in xe_res_first_sg()
160 cur->start = start; in xe_res_first_sg()
161 cur->remaining = size; in xe_res_first_sg()
162 cur->size = 0; in xe_res_first_sg()
163 cur->sgl = sg->sgl; in xe_res_first_sg()
164 cur->mem_type = XE_PL_TT; in xe_res_first_sg()
165 __xe_res_sg_next(cur); in xe_res_first_sg()
176 static inline void xe_res_next(struct xe_res_cursor *cur, u64 size) in xe_res_next() argument
182 XE_WARN_ON(size > cur->remaining); in xe_res_next()
184 cur->remaining -= size; in xe_res_next()
185 if (!cur->remaining) in xe_res_next()
188 if (cur->size > size) { in xe_res_next()
189 cur->size -= size; in xe_res_next()
190 cur->start += size; in xe_res_next()
194 if (cur->sgl) { in xe_res_next()
195 cur->start += size; in xe_res_next()
196 __xe_res_sg_next(cur); in xe_res_next()
200 switch (cur->mem_type) { in xe_res_next()
204 start = size - cur->size; in xe_res_next()
205 block = cur->node; in xe_res_next()
211 while (start >= drm_buddy_block_size(cur->mm, block)) { in xe_res_next()
212 start -= drm_buddy_block_size(cur->mm, block); in xe_res_next()
218 cur->start = drm_buddy_block_offset(block) + start; in xe_res_next()
219 cur->size = min(drm_buddy_block_size(cur->mm, block) - start, in xe_res_next()
220 cur->remaining); in xe_res_next()
221 cur->node = block; in xe_res_next()
233 static inline u64 xe_res_dma(const struct xe_res_cursor *cur) in xe_res_dma() argument
235 return cur->sgl ? sg_dma_address(cur->sgl) + cur->start : cur->start; in xe_res_dma()