Files
linux/drivers/gpu/drm
George Spelvin c43a87f537 drm/i915/selftests: Avoid passing a random 0 into ilog2
igt_mm_config() calls ilog2() on the (pseudo)random 21-bit number
s>>12.  Once in 2 million seeds, this is zero and ilog2 summons
the nasal demons.

There was an attempt to handle this case with a max(), but that's
too late; ms could already be something bizarre.

Given that the low 12 bits of s and ms are always zero, it's a lot
simpler just to divide them by 4096, then everything fits into 32
bits, and we can easily generate a random number 1 <= s <= 0x1fffff.

Fixes: 14d1b9a624 ("drm/i915: buddy allocator")
Signed-off-by: George Spelvin <lkml@sdf.org>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20200325192429.GA8865@SDF.ORG
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
(cherry picked from commit 21118e8e56)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2020-08-19 15:23:36 +03:00
..
2020-07-24 08:48:05 +10:00
2020-08-11 11:58:31 +10:00
2020-08-11 11:58:31 +10:00
2020-07-24 08:48:05 +10:00
2020-08-11 11:58:31 +10:00
2020-08-11 11:58:31 +10:00
2020-07-24 08:48:05 +10:00
2020-08-11 11:58:31 +10:00
2020-08-11 11:58:31 +10:00
2020-04-03 17:11:41 +02:00
2020-07-24 08:48:05 +10:00
2020-08-11 11:58:31 +10:00
2020-06-24 09:17:34 +02:00
2020-05-27 14:31:42 +03:00
2020-04-03 17:11:41 +02:00
2020-07-27 22:06:13 +02:00
2020-08-11 11:58:31 +10:00
2020-07-16 18:16:31 -04:00
2020-05-29 12:58:11 +02:00
2020-08-11 11:58:31 +10:00
2020-08-11 11:58:31 +10:00