Skip to content

Commit 5dff172

Browse files
mwasiakintAndi Shyti
authored andcommitted
drm/i915/selftest: allow larger memory allocation
Due to changes in allocator, the size of the allocation for contiguous region is not rounded up to a power-of-two and instead allocated as is. Thus, change the part of test that expected the allocation to fail. Signed-off-by: Mikolaj Wasiak <[email protected]> Reviewed-by: Krzysztof Karas <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Reviewed-by: Krzysztof Niemiec <[email protected]> Signed-off-by: Andi Shyti <[email protected]> Link: https://lore.kernel.org/r/fptevdfbclvg2lbfuys5ibffbl2baouywkutnr7vdsy5tzcqfk@mpflwlh6jxfd
1 parent ff86866 commit 5dff172

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

drivers/gpu/drm/i915/selftests/intel_memory_region.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -413,24 +413,16 @@ static int igt_mock_splintered_region(void *arg)
413413

414414
close_objects(mem, &objects);
415415

416-
/*
417-
* While we should be able allocate everything without any flag
418-
* restrictions, if we consider I915_BO_ALLOC_CONTIGUOUS then we are
419-
* actually limited to the largest power-of-two for the region size i.e
420-
* max_order, due to the inner workings of the buddy allocator. So make
421-
* sure that does indeed hold true.
422-
*/
423-
424-
obj = igt_object_create(mem, &objects, size, I915_BO_ALLOC_CONTIGUOUS);
416+
obj = igt_object_create(mem, &objects, roundup_pow_of_two(size),
417+
I915_BO_ALLOC_CONTIGUOUS);
425418
if (!IS_ERR(obj)) {
426419
pr_err("%s too large contiguous allocation was not rejected\n",
427420
__func__);
428421
err = -EINVAL;
429422
goto out_close;
430423
}
431424

432-
obj = igt_object_create(mem, &objects, rounddown_pow_of_two(size),
433-
I915_BO_ALLOC_CONTIGUOUS);
425+
obj = igt_object_create(mem, &objects, size, I915_BO_ALLOC_CONTIGUOUS);
434426
if (IS_ERR(obj)) {
435427
pr_err("%s largest possible contiguous allocation failed\n",
436428
__func__);

0 commit comments

Comments
 (0)