[PATCH] drm/i915/selftest: allow larger memory allocation
Mikolaj Wasiak
mikolaj.wasiak at intel.com
Fri Mar 14 14:42:23 UTC 2025
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.
Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/9311
Signed-off-by: Mikolaj Wasiak <mikolaj.wasiak at intel.com>
---
.../gpu/drm/i915/selftests/intel_memory_region.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/i915/selftests/intel_memory_region.c b/drivers/gpu/drm/i915/selftests/intel_memory_region.c
index f08f6674911e..ce848ae878c8 100644
--- a/drivers/gpu/drm/i915/selftests/intel_memory_region.c
+++ b/drivers/gpu/drm/i915/selftests/intel_memory_region.c
@@ -413,22 +413,17 @@ static int igt_mock_splintered_region(void *arg)
close_objects(mem, &objects);
- /*
- * While we should be able allocate everything without any flag
- * restrictions, if we consider I915_BO_ALLOC_CONTIGUOUS then we are
- * actually limited to the largest power-of-two for the region size i.e
- * max_order, due to the inner workings of the buddy allocator. So make
- * sure that does indeed hold true.
- */
-
obj = igt_object_create(mem, &objects, size, I915_BO_ALLOC_CONTIGUOUS);
- if (!IS_ERR(obj)) {
- pr_err("%s too large contiguous allocation was not rejected\n",
+ if (!IS_ERR(obj) && !is_contiguous(obj)) {
+ pr_err("%s large allocation was not contiguous\n",
__func__);
err = -EINVAL;
goto out_close;
}
+ if (!IS_ERR(obj))
+ close_objects(mem, &objects);
+
obj = igt_object_create(mem, &objects, rounddown_pow_of_two(size),
I915_BO_ALLOC_CONTIGUOUS);
if (IS_ERR(obj)) {
--
2.43.0
More information about the Intel-gfx
mailing list