Commit ba110db8 authored by Joel Fernandes's avatar Joel Fernandes Committed by Dave Airlie
Browse files

gpu: Move DRM buddy allocator one level up (part two)



Move the DRM buddy allocator one level up so that it can be used by GPU
drivers (example, nova-core) that have usecases other than DRM (such as
VFIO vGPU support). Modify the API, structures and Kconfigs to use
"gpu_buddy" terminology. Adapt the drivers and tests to use the new API.

The commit cannot be split due to bisectability, however no functional
change is intended. Verified by running K-UNIT tests and build tested
various configurations.

Signed-off-by: default avatarJoel Fernandes <joelagnelf@nvidia.com>
Reviewed-by: default avatarDave Airlie <airlied@redhat.com>
[airlied: I've split this into two so git can find copies easier.
I've also just nuked drm_random library, that stuff needs to be done
elsewhere and only the buddy tests seem to be using it].
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 4a9671a0
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -532,6 +532,12 @@ Buddy Allocator Function References (GPU buddy)
.. kernel-doc:: drivers/gpu/buddy.c
   :export:

DRM Buddy Specific Logging Function References
----------------------------------------------

.. kernel-doc:: drivers/gpu/drm/drm_buddy.c
   :export:

DRM Cache Handling and Fast WC memcpy()
=======================================

+5 −3
Original line number Diff line number Diff line
@@ -8797,15 +8797,17 @@ T: git https://gitlab.freedesktop.org/drm/misc/kernel.git
F:	drivers/gpu/drm/ttm/
F:	include/drm/ttm/
DRM BUDDY ALLOCATOR
GPU BUDDY ALLOCATOR
M:	Matthew Auld <matthew.auld@intel.com>
M:	Arun Pravin <arunpravin.paneerselvam@amd.com>
R:	Christian Koenig <christian.koenig@amd.com>
L:	dri-devel@lists.freedesktop.org
S:	Maintained
T:	git https://gitlab.freedesktop.org/drm/misc/kernel.git
F:	drivers/gpu/drm/drm_buddy.c
F:	drivers/gpu/drm/tests/drm_buddy_test.c
F:	drivers/gpu/drm_buddy.c
F:	drivers/gpu/buddy.c
F:	drivers/gpu/tests/gpu_buddy_test.c
F:	include/linux/gpu_buddy.h
F:	include/drm/drm_buddy.h
DRM AUTOMATED TESTING

drivers/gpu/Kconfig

0 → 100644
+13 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0

config GPU_BUDDY
       bool
       help
         A page based buddy allocator for GPU memory.

config GPU_BUDDY_KUNIT_TEST
       tristate "KUnit tests for GPU buddy allocator" if !KUNIT_ALL_TESTS
       depends on GPU_BUDDY && KUNIT
       default KUNIT_ALL_TESTS
       help
         KUnit tests for the GPU buddy allocator.
+1 −0
Original line number Diff line number Diff line
@@ -6,3 +6,4 @@ obj-y += host1x/ drm/ vga/ tests/
obj-$(CONFIG_IMX_IPUV3_CORE)	+= ipu-v3/
obj-$(CONFIG_TRACE_GPU_MEM)		+= trace/
obj-$(CONFIG_NOVA_CORE)		+= nova-core/
obj-$(CONFIG_GPU_BUDDY)		+= buddy.o
+271 −285

File changed.

Preview size limit exceeded, changes collapsed.

Loading