Lines Matching +full:sync +full:- +full:2

41 		for (d = 0; d < depth - 1; d++) {  in __sync_print()
42 if (last & BIT(depth - d - 1)) in __sync_print()
47 *sz -= len; in __sync_print()
49 len = scnprintf(buf, *sz, "%x-> ", idx); in __sync_print()
51 *sz -= len; in __sync_print()
55 len = scnprintf(buf, *sz, "0x%016llx", p->prefix << p->height << SHIFT); in __sync_print()
57 *sz -= len; in __sync_print()
58 X = (p->height + SHIFT) / 4; in __sync_print()
59 scnprintf(buf - X, *sz + X, "%*s", X, "XXXXXXXXXXXXXXXXX"); in __sync_print()
61 if (!p->height) { in __sync_print()
62 for_each_set_bit(i, (unsigned long *)&p->bitmap, KSYNCMAP) { in __sync_print()
66 *sz -= len; in __sync_print()
68 buf -= 1; in __sync_print()
74 *sz -= len; in __sync_print()
76 if (p->height) { in __sync_print()
77 for_each_set_bit(i, (unsigned long *)&p->bitmap, KSYNCMAP) { in __sync_print()
80 last << 1 | ((p->bitmap >> (i + 1)) ? 1 : 0), in __sync_print()
94 while (p->parent) in i915_syncmap_print_to_buf()
95 p = p->parent; in i915_syncmap_print_to_buf()
101 static int check_syncmap_free(struct i915_syncmap **sync) in check_syncmap_free() argument
103 i915_syncmap_free(sync); in check_syncmap_free()
104 if (*sync) { in check_syncmap_free()
105 pr_err("sync not cleared after free\n"); in check_syncmap_free()
106 return -EINVAL; in check_syncmap_free()
112 static int dump_syncmap(struct i915_syncmap *sync, int err) in dump_syncmap() argument
117 return check_syncmap_free(&sync); in dump_syncmap()
123 if (i915_syncmap_print_to_buf(sync, buf, PAGE_SIZE)) in dump_syncmap()
129 i915_syncmap_free(&sync); in dump_syncmap()
135 struct i915_syncmap *sync = (void *)~0ul; in igt_syncmap_init() local
142 i915_syncmap_init(&sync); in igt_syncmap_init()
143 return check_syncmap_free(&sync); in igt_syncmap_init()
148 if (leaf->height) { in check_seqno()
150 __func__, leaf->height); in check_seqno()
151 return -EINVAL; in check_seqno()
157 return -EINVAL; in check_seqno()
163 static int check_one(struct i915_syncmap **sync, u64 context, u32 seqno) in check_one() argument
167 err = i915_syncmap_set(sync, context, seqno); in check_one()
171 if ((*sync)->height) { in check_one()
173 context, (*sync)->height, (*sync)->prefix); in check_one()
174 return -EINVAL; in check_one()
177 if ((*sync)->parent) { in check_one()
180 return -EINVAL; in check_one()
183 if (hweight32((*sync)->bitmap) != 1) { in check_one()
185 (*sync)->bitmap, hweight32((*sync)->bitmap)); in check_one()
186 return -EINVAL; in check_one()
189 err = check_seqno((*sync), ilog2((*sync)->bitmap), seqno); in check_one()
193 if (!i915_syncmap_is_later(sync, context, seqno)) { in check_one()
196 return -EINVAL; in check_one()
206 struct i915_syncmap *sync; in igt_syncmap_one() local
214 i915_syncmap_init(&sync); in igt_syncmap_one()
220 err = check_syncmap_free(&sync); in igt_syncmap_one()
225 err = check_one(&sync, context, in igt_syncmap_one()
233 __func__, max * (max - 1) / 2); in igt_syncmap_one()
235 return dump_syncmap(sync, err); in igt_syncmap_one()
238 static int check_leaf(struct i915_syncmap **sync, u64 context, u32 seqno) in check_leaf() argument
242 err = i915_syncmap_set(sync, context, seqno); in check_leaf()
246 if ((*sync)->height) { in check_leaf()
248 context, (*sync)->height, (*sync)->prefix); in check_leaf()
249 return -EINVAL; in check_leaf()
252 if (hweight32((*sync)->bitmap) != 1) { in check_leaf()
254 context, (*sync)->bitmap, hweight32((*sync)->bitmap)); in check_leaf()
255 return -EINVAL; in check_leaf()
258 err = check_seqno((*sync), ilog2((*sync)->bitmap), seqno); in check_leaf()
262 if (!i915_syncmap_is_later(sync, context, seqno)) { in check_leaf()
265 return -EINVAL; in check_leaf()
273 struct i915_syncmap *sync; in igt_syncmap_join_above() local
277 i915_syncmap_init(&sync); in igt_syncmap_join_above()
284 * 2: 0x00000010 in igt_syncmap_join_above()
300 err = check_leaf(&sync, context, 0); in igt_syncmap_join_above()
304 join = sync->parent; in igt_syncmap_join_above()
308 if (!join->height) { in igt_syncmap_join_above()
310 err = -EINVAL; in igt_syncmap_join_above()
314 if (hweight32(join->bitmap) != 2) { in igt_syncmap_join_above()
315 pr_err("Join does not have 2 children: %x (%d)\n", in igt_syncmap_join_above()
316 join->bitmap, hweight32(join->bitmap)); in igt_syncmap_join_above()
317 err = -EINVAL; in igt_syncmap_join_above()
321 if (__sync_child(join)[__sync_branch_idx(join, context)] != sync) { in igt_syncmap_join_above()
323 err = -EINVAL; in igt_syncmap_join_above()
329 return dump_syncmap(sync, err); in igt_syncmap_join_above()
334 struct i915_syncmap *sync; in igt_syncmap_join_below() local
336 int err = -ENODEV; in igt_syncmap_join_below()
338 i915_syncmap_init(&sync); in igt_syncmap_join_below()
345 for (order = 64 - SHIFT; order > 0; order -= SHIFT) { in igt_syncmap_join_below()
348 err = i915_syncmap_set(&sync, context, 0); in igt_syncmap_join_below()
352 if (sync->height) { in igt_syncmap_join_below()
354 context, order, step, sync->height, sync->prefix); in igt_syncmap_join_below()
355 err = -EINVAL; in igt_syncmap_join_below()
365 if (!i915_syncmap_is_later(&sync, context, 0)) { in igt_syncmap_join_below()
368 err = -EINVAL; in igt_syncmap_join_below()
373 if (i915_syncmap_is_later(&sync, context + idx, 0)) { in igt_syncmap_join_below()
376 err = -EINVAL; in igt_syncmap_join_below()
387 if (!i915_syncmap_is_later(&sync, context, 0)) { in igt_syncmap_join_below()
388 pr_err("2: context %llx (order=%d, step=%d) not found\n", in igt_syncmap_join_below()
390 err = -EINVAL; in igt_syncmap_join_below()
397 return dump_syncmap(sync, err); in igt_syncmap_join_below()
404 struct i915_syncmap *sync; in igt_syncmap_neighbours() local
405 int err = -ENODEV; in igt_syncmap_neighbours()
412 i915_syncmap_init(&sync); in igt_syncmap_neighbours()
417 if (i915_syncmap_is_later(&sync, context, 0)) /* Skip repeats */ in igt_syncmap_neighbours()
421 err = i915_syncmap_set(&sync, context + idx, 0); in igt_syncmap_neighbours()
425 if (sync->height) { in igt_syncmap_neighbours()
427 context, sync->height, sync->prefix); in igt_syncmap_neighbours()
428 err = -EINVAL; in igt_syncmap_neighbours()
432 if (sync->bitmap != BIT(idx + 1) - 1) { in igt_syncmap_neighbours()
435 sync->bitmap, hweight32(sync->bitmap), in igt_syncmap_neighbours()
436 BIT(idx + 1) - 1, idx + 1); in igt_syncmap_neighbours()
437 err = -EINVAL; in igt_syncmap_neighbours()
443 return dump_syncmap(sync, err); in igt_syncmap_neighbours()
448 struct i915_syncmap *sync; in igt_syncmap_compact() local
450 int err = -ENODEV; in igt_syncmap_compact()
452 i915_syncmap_init(&sync); in igt_syncmap_compact()
455 * The syncmap are "space efficient" compressed radix trees - any in igt_syncmap_compact()
458 * If we construct a tree with ids that are neighbouring at a non-zero in igt_syncmap_compact()
463 err = check_syncmap_free(&sync); in igt_syncmap_compact()
471 err = i915_syncmap_set(&sync, context, 0); in igt_syncmap_compact()
475 if (sync->height) { in igt_syncmap_compact()
478 sync->height, sync->prefix); in igt_syncmap_compact()
479 err = -EINVAL; in igt_syncmap_compact()
484 sync = sync->parent; in igt_syncmap_compact()
485 if (sync->parent) { in igt_syncmap_compact()
486 pr_err("Parent (join) of last leaf was not the sync!\n"); in igt_syncmap_compact()
487 err = -EINVAL; in igt_syncmap_compact()
491 if (sync->height != order) { in igt_syncmap_compact()
493 sync->height, order); in igt_syncmap_compact()
494 err = -EINVAL; in igt_syncmap_compact()
498 if (sync->bitmap != BIT(KSYNCMAP) - 1) { in igt_syncmap_compact()
500 sync->bitmap, hweight32(sync->bitmap), in igt_syncmap_compact()
501 BIT(KSYNCMAP) - 1, KSYNCMAP); in igt_syncmap_compact()
502 err = -EINVAL; in igt_syncmap_compact()
508 struct i915_syncmap *leaf = __sync_child(sync)[idx]; in igt_syncmap_compact()
510 if (leaf->height) { in igt_syncmap_compact()
512 err = -EINVAL; in igt_syncmap_compact()
516 if (leaf->parent != sync) { in igt_syncmap_compact()
519 err = -EINVAL; in igt_syncmap_compact()
523 if (!is_power_of_2(leaf->bitmap)) { in igt_syncmap_compact()
525 idx, leaf->bitmap, hweight32(leaf->bitmap)); in igt_syncmap_compact()
526 err = -EINVAL; in igt_syncmap_compact()
530 if (leaf->bitmap != BIT(idx)) { in igt_syncmap_compact()
532 idx, ilog2(leaf->bitmap), idx); in igt_syncmap_compact()
533 err = -EINVAL; in igt_syncmap_compact()
539 return dump_syncmap(sync, err); in igt_syncmap_compact()
546 struct i915_syncmap *sync; in igt_syncmap_random() local
551 i915_syncmap_init(&sync); in igt_syncmap_random()
564 err = i915_syncmap_set(&sync, context, 0); in igt_syncmap_random()
584 if (i915_syncmap_is_later(&sync, context, seqno) != expect) { in igt_syncmap_random()
587 err = -EINVAL; in igt_syncmap_random()
591 err = i915_syncmap_set(&sync, context, seqno); in igt_syncmap_random()
600 return dump_syncmap(sync, err); in igt_syncmap_random()