From 3e7f292e51eab4a7b426647d5bcb85a8455e96bb Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 27 Apr 2023 02:32:24 +0000 Subject: [PATCH] drm: buddy_allocator: Fix buddy allocator init on 32-bit systems From David Gow fb766acce3cf1c9637a79c1ffb3cebc61fd9d859 in linux-6.1.y/6.1.26 4453545b5b4c3eff941f69a5530f916d899db025 in mainline linux --- sys/dev/pci/drm/drm_buddy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/drm/drm_buddy.c b/sys/dev/pci/drm/drm_buddy.c index 083aec8cc49..f18e7a72248 100644 --- a/sys/dev/pci/drm/drm_buddy.c +++ b/sys/dev/pci/drm/drm_buddy.c @@ -156,8 +156,8 @@ int drm_buddy_init(struct drm_buddy *mm, u64 size, u64 chunk_size) unsigned int order; u64 root_size; - root_size = rounddown_pow_of_two(size); - order = ilog2(root_size) - ilog2(chunk_size); + order = ilog2(size) - ilog2(chunk_size); + root_size = chunk_size << order; root = drm_block_alloc(mm, NULL, order, offset); if (!root) -- 2.20.1