Commit 33512693 authored by Matthew Auld's avatar Matthew Auld Committed by Christian König

drm/tests/drm_buddy: fix 32b build

Doesn't seem to compile on 32b, presumably due to u64 mod/division.
Simplest is to just switch over to u32 here. Also make print modifiers
consistent with that.

Fixes: a64056bb ("drm/tests/drm_buddy: add alloc_contiguous test")
Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
Cc: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Maxime Ripard <mripard@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240215174431.285069-7-matthew.auld@intel.comSigned-off-by: default avatarChristian König <christian.koenig@amd.com>
parent bd915ae7
...@@ -21,7 +21,7 @@ static inline u64 get_size(int order, u64 chunk_size) ...@@ -21,7 +21,7 @@ static inline u64 get_size(int order, u64 chunk_size)
static void drm_test_buddy_alloc_contiguous(struct kunit *test) static void drm_test_buddy_alloc_contiguous(struct kunit *test)
{ {
u64 mm_size, ps = SZ_4K, i, n_pages, total; u32 mm_size, ps = SZ_4K, i, n_pages, total;
struct drm_buddy_block *block; struct drm_buddy_block *block;
struct drm_buddy mm; struct drm_buddy mm;
LIST_HEAD(left); LIST_HEAD(left);
...@@ -56,30 +56,30 @@ static void drm_test_buddy_alloc_contiguous(struct kunit *test) ...@@ -56,30 +56,30 @@ static void drm_test_buddy_alloc_contiguous(struct kunit *test)
KUNIT_ASSERT_FALSE_MSG(test, KUNIT_ASSERT_FALSE_MSG(test,
drm_buddy_alloc_blocks(&mm, 0, mm_size, drm_buddy_alloc_blocks(&mm, 0, mm_size,
ps, ps, list, 0), ps, ps, list, 0),
"buddy_alloc hit an error size=%d\n", "buddy_alloc hit an error size=%u\n",
ps); ps);
} while (++i < n_pages); } while (++i < n_pages);
KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size,
3 * ps, ps, &allocated, 3 * ps, ps, &allocated,
DRM_BUDDY_CONTIGUOUS_ALLOCATION), DRM_BUDDY_CONTIGUOUS_ALLOCATION),
"buddy_alloc didn't error size=%d\n", 3 * ps); "buddy_alloc didn't error size=%u\n", 3 * ps);
drm_buddy_free_list(&mm, &middle); drm_buddy_free_list(&mm, &middle);
KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size,
3 * ps, ps, &allocated, 3 * ps, ps, &allocated,
DRM_BUDDY_CONTIGUOUS_ALLOCATION), DRM_BUDDY_CONTIGUOUS_ALLOCATION),
"buddy_alloc didn't error size=%llu\n", 3 * ps); "buddy_alloc didn't error size=%u\n", 3 * ps);
KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size,
2 * ps, ps, &allocated, 2 * ps, ps, &allocated,
DRM_BUDDY_CONTIGUOUS_ALLOCATION), DRM_BUDDY_CONTIGUOUS_ALLOCATION),
"buddy_alloc didn't error size=%llu\n", 2 * ps); "buddy_alloc didn't error size=%u\n", 2 * ps);
drm_buddy_free_list(&mm, &right); drm_buddy_free_list(&mm, &right);
KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size,
3 * ps, ps, &allocated, 3 * ps, ps, &allocated,
DRM_BUDDY_CONTIGUOUS_ALLOCATION), DRM_BUDDY_CONTIGUOUS_ALLOCATION),
"buddy_alloc didn't error size=%llu\n", 3 * ps); "buddy_alloc didn't error size=%u\n", 3 * ps);
/* /*
* At this point we should have enough contiguous space for 2 blocks, * At this point we should have enough contiguous space for 2 blocks,
* however they are never buddies (since we freed middle and right) so * however they are never buddies (since we freed middle and right) so
...@@ -88,13 +88,13 @@ static void drm_test_buddy_alloc_contiguous(struct kunit *test) ...@@ -88,13 +88,13 @@ static void drm_test_buddy_alloc_contiguous(struct kunit *test)
KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size,
2 * ps, ps, &allocated, 2 * ps, ps, &allocated,
DRM_BUDDY_CONTIGUOUS_ALLOCATION), DRM_BUDDY_CONTIGUOUS_ALLOCATION),
"buddy_alloc hit an error size=%d\n", 2 * ps); "buddy_alloc hit an error size=%u\n", 2 * ps);
drm_buddy_free_list(&mm, &left); drm_buddy_free_list(&mm, &left);
KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size, KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, 0, mm_size,
3 * ps, ps, &allocated, 3 * ps, ps, &allocated,
DRM_BUDDY_CONTIGUOUS_ALLOCATION), DRM_BUDDY_CONTIGUOUS_ALLOCATION),
"buddy_alloc hit an error size=%d\n", 3 * ps); "buddy_alloc hit an error size=%u\n", 3 * ps);
total = 0; total = 0;
list_for_each_entry(block, &allocated, link) list_for_each_entry(block, &allocated, link)
......
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