Commit c8b56cd0 authored by Chris Wilson's avatar Chris Wilson

drm/i915/selftests: Avoid choosing zero for phys_sz

Make sure we avoid ending up with a phys_sz of 0, or for phys_sz to be
larger than the actual size.

Closes: https://patchwork.freedesktop.org/series/73320/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/20200212085432.1250807-1-chris@chris-wilson.co.uk
parent 37305ede
...@@ -247,10 +247,11 @@ static int igt_fill_blt_thread(void *arg) ...@@ -247,10 +247,11 @@ static int igt_fill_blt_thread(void *arg)
total = min(total, max); total = min(total, max);
sz = i915_prandom_u32_max_state(total, prng) + 1; sz = i915_prandom_u32_max_state(total, prng) + 1;
phys_sz = sz % max_phys_size; phys_sz = sz % max_phys_size + 1;
sz = round_up(sz, PAGE_SIZE); sz = round_up(sz, PAGE_SIZE);
phys_sz = round_up(phys_sz, PAGE_SIZE); phys_sz = round_up(phys_sz, PAGE_SIZE);
phys_sz = min(phys_sz, sz);
pr_debug("%s with phys_sz= %x, sz=%x, val=%x\n", __func__, pr_debug("%s with phys_sz= %x, sz=%x, val=%x\n", __func__,
phys_sz, sz, val); phys_sz, sz, val);
...@@ -364,10 +365,11 @@ static int igt_copy_blt_thread(void *arg) ...@@ -364,10 +365,11 @@ static int igt_copy_blt_thread(void *arg)
total = min(total, max); total = min(total, max);
sz = i915_prandom_u32_max_state(total, prng) + 1; sz = i915_prandom_u32_max_state(total, prng) + 1;
phys_sz = sz % max_phys_size; phys_sz = sz % max_phys_size + 1;
sz = round_up(sz, PAGE_SIZE); sz = round_up(sz, PAGE_SIZE);
phys_sz = round_up(phys_sz, PAGE_SIZE); phys_sz = round_up(phys_sz, PAGE_SIZE);
phys_sz = min(phys_sz, sz);
pr_debug("%s with phys_sz= %x, sz=%x, val=%x\n", __func__, pr_debug("%s with phys_sz= %x, sz=%x, val=%x\n", __func__,
phys_sz, sz, val); phys_sz, sz, val);
......
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