drm: buddy_allocator: Fix buddy allocator init on 32-bit systems
authorjsg <jsg@openbsd.org>
Thu, 27 Apr 2023 02:32:24 +0000 (02:32 +0000)
committerjsg <jsg@openbsd.org>
Thu, 27 Apr 2023 02:32:24 +0000 (02:32 +0000)
From David Gow
fb766acce3cf1c9637a79c1ffb3cebc61fd9d859 in linux-6.1.y/6.1.26
4453545b5b4c3eff941f69a5530f916d899db025 in mainline linux

sys/dev/pci/drm/drm_buddy.c

index 083aec8..f18e7a7 100644 (file)
@@ -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)