Commit 280bc0ce authored by Chris Wilson's avatar Chris Wilson

drm/i915/selftests: Fixup naked 64b divide

drivers/gpu/drm/i915/intel_memory_region.o: in function `igt_mock_contiguous':
drivers/gpu/drm/i915/selftests/intel_memory_region.c:166: undefined reference to `__umoddi3'

v2: promote target to u64 for consistency across all builds
Reported-by: default avatarkbuild test robot <lkp@intel.com>
Fixes: 2f0b97ca ("drm/i915/region: support contiguous allocations")
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191013114509.3405-1-chris@chris-wilson.co.uk
parent c2fba936
...@@ -128,9 +128,9 @@ static int igt_mock_contiguous(void *arg) ...@@ -128,9 +128,9 @@ static int igt_mock_contiguous(void *arg)
LIST_HEAD(objects); LIST_HEAD(objects);
LIST_HEAD(holes); LIST_HEAD(holes);
I915_RND_STATE(prng); I915_RND_STATE(prng);
resource_size_t target;
resource_size_t total; resource_size_t total;
resource_size_t min; resource_size_t min;
u64 target;
int err = 0; int err = 0;
total = resource_size(&mem->region); total = resource_size(&mem->region);
...@@ -163,7 +163,9 @@ static int igt_mock_contiguous(void *arg) ...@@ -163,7 +163,9 @@ static int igt_mock_contiguous(void *arg)
igt_object_release(obj); igt_object_release(obj);
/* Internal fragmentation should not bleed into the object size */ /* Internal fragmentation should not bleed into the object size */
target = round_up(prandom_u32_state(&prng) % total, PAGE_SIZE); target = i915_prandom_u64_state(&prng);
div64_u64_rem(target, total, &target);
target = round_up(target, PAGE_SIZE);
target = max_t(u64, PAGE_SIZE, target); target = max_t(u64, PAGE_SIZE, target);
obj = igt_object_create(mem, &objects, target, obj = igt_object_create(mem, &objects, target,
...@@ -172,8 +174,8 @@ static int igt_mock_contiguous(void *arg) ...@@ -172,8 +174,8 @@ static int igt_mock_contiguous(void *arg)
return PTR_ERR(obj); return PTR_ERR(obj);
if (obj->base.size != target) { if (obj->base.size != target) {
pr_err("%s obj->base.size(%llx) != target(%llx)\n", __func__, pr_err("%s obj->base.size(%zx) != target(%llx)\n", __func__,
(u64)obj->base.size, (u64)target); obj->base.size, target);
err = -EINVAL; err = -EINVAL;
goto err_close_objects; goto err_close_objects;
} }
...@@ -236,7 +238,7 @@ static int igt_mock_contiguous(void *arg) ...@@ -236,7 +238,7 @@ static int igt_mock_contiguous(void *arg)
I915_BO_ALLOC_CONTIGUOUS); I915_BO_ALLOC_CONTIGUOUS);
if (should_fail != IS_ERR(obj)) { if (should_fail != IS_ERR(obj)) {
pr_err("%s target allocation(%llx) mismatch\n", pr_err("%s target allocation(%llx) mismatch\n",
__func__, (u64)target); __func__, target);
err = -EINVAL; err = -EINVAL;
goto err_close_objects; goto err_close_objects;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment