Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

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: Joel Fernandes <joelagnelf@nvidia.com>
Reviewed-by: Dave 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: Dave Airlie <airlied@redhat.com>

authored by

Joel Fernandes and committed by
Dave Airlie
4a9671a0 779ec12c

+19 -26
+3 -3
Documentation/gpu/drm-mm.rst
··· 526 526 DRM Buddy Allocator 527 527 =================== 528 528 529 - DRM Buddy Function References 530 - ----------------------------- 529 + Buddy Allocator Function References (GPU buddy) 530 + ----------------------------------------------- 531 531 532 - .. kernel-doc:: drivers/gpu/drm/drm_buddy.c 532 + .. kernel-doc:: drivers/gpu/buddy.c 533 533 :export: 534 534 535 535 DRM Cache Handling and Fast WC memcpy()
+1 -1
drivers/gpu/Makefile
··· 2 2 # drm/tegra depends on host1x, so if both drivers are built-in care must be 3 3 # taken to initialize them in the correct order. Link order is the only way 4 4 # to ensure this currently. 5 - obj-y += host1x/ drm/ vga/ 5 + obj-y += host1x/ drm/ vga/ tests/ 6 6 obj-$(CONFIG_IMX_IPUV3_CORE) += ipu-v3/ 7 7 obj-$(CONFIG_TRACE_GPU_MEM) += trace/ 8 8 obj-$(CONFIG_NOVA_CORE) += nova-core/
-4
drivers/gpu/drm/Kconfig
··· 269 269 config DRM_PANEL_BACKLIGHT_QUIRKS 270 270 tristate 271 271 272 - config DRM_LIB_RANDOM 273 - bool 274 - default n 275 - 276 272 config DRM_PRIVACY_SCREEN 277 273 bool 278 274 default n
-1
drivers/gpu/drm/Kconfig.debug
··· 69 69 select DRM_EXPORT_FOR_TESTS if m 70 70 select DRM_GEM_SHMEM_HELPER 71 71 select DRM_KUNIT_TEST_HELPERS 72 - select DRM_LIB_RANDOM 73 72 select DRM_SYSFB_HELPER 74 73 select PRIME_NUMBERS 75 74 default KUNIT_ALL_TESTS
+1 -2
drivers/gpu/drm/Makefile
··· 79 79 drm_client_event.o \ 80 80 drm_client_modeset.o \ 81 81 drm_client_sysrq.o 82 - drm-$(CONFIG_DRM_LIB_RANDOM) += lib/drm_random.o 83 82 drm-$(CONFIG_COMPAT) += drm_ioc32.o 84 83 drm-$(CONFIG_DRM_PANEL) += drm_panel.o 85 84 drm-$(CONFIG_OF) += drm_of.o ··· 114 115 115 116 obj-$(CONFIG_DRM_GPUSVM) += drm_gpusvm_helper.o 116 117 117 - obj-$(CONFIG_DRM_BUDDY) += drm_buddy.o 118 + obj-$(CONFIG_DRM_BUDDY) += ../buddy.o 118 119 119 120 drm_dma_helper-y := drm_gem_dma_helper.o 120 121 drm_dma_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fbdev_dma.o
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
··· 24 24 #ifndef __AMDGPU_VRAM_MGR_H__ 25 25 #define __AMDGPU_VRAM_MGR_H__ 26 26 27 - #include <drm/drm_buddy.h> 27 + #include <linux/gpu_buddy.h> 28 28 29 29 struct amdgpu_vram_mgr { 30 30 struct ttm_resource_manager manager;
+1 -1
drivers/gpu/drm/drm_buddy.c drivers/gpu/buddy.c
··· 10 10 #include <linux/module.h> 11 11 #include <linux/sizes.h> 12 12 13 - #include <drm/drm_buddy.h> 13 + #include <linux/gpu_buddy.h> 14 14 #include <drm/drm_print.h> 15 15 16 16 enum drm_buddy_free_tree {
+1 -1
drivers/gpu/drm/i915/gem/i915_gem_ttm.c
··· 5 5 6 6 #include <linux/shmem_fs.h> 7 7 8 - #include <drm/drm_buddy.h> 8 + #include <linux/gpu_buddy.h> 9 9 #include <drm/drm_print.h> 10 10 #include <drm/ttm/ttm_placement.h> 11 11 #include <drm/ttm/ttm_tt.h>
+1 -1
drivers/gpu/drm/i915/i915_scatterlist.c
··· 7 7 #include "i915_scatterlist.h" 8 8 #include "i915_ttm_buddy_manager.h" 9 9 10 - #include <drm/drm_buddy.h> 10 + #include <linux/gpu_buddy.h> 11 11 #include <drm/drm_mm.h> 12 12 13 13 #include <linux/slab.h>
+1 -1
drivers/gpu/drm/i915/i915_ttm_buddy_manager.c
··· 5 5 6 6 #include <linux/slab.h> 7 7 8 - #include <drm/drm_buddy.h> 8 + #include <linux/gpu_buddy.h> 9 9 #include <drm/drm_print.h> 10 10 #include <drm/ttm/ttm_placement.h> 11 11 #include <drm/ttm/ttm_bo.h>
+1 -1
drivers/gpu/drm/lib/drm_random.c drivers/gpu/tests/gpu_random.c
··· 6 6 #include <linux/slab.h> 7 7 #include <linux/types.h> 8 8 9 - #include "drm_random.h" 9 + #include "gpu_random.h" 10 10 11 11 u32 drm_prandom_u32_max_state(u32 ep_ro, struct rnd_state *state) 12 12 {
drivers/gpu/drm/lib/drm_random.h drivers/gpu/tests/gpu_random.h
-1
drivers/gpu/drm/tests/Makefile
··· 7 7 drm_atomic_test.o \ 8 8 drm_atomic_state_test.o \ 9 9 drm_bridge_test.o \ 10 - drm_buddy_test.o \ 11 10 drm_cmdline_parser_test.o \ 12 11 drm_connector_test.o \ 13 12 drm_damage_helper_test.o \
+2 -2
drivers/gpu/drm/tests/drm_buddy_test.c drivers/gpu/tests/gpu_buddy_test.c
··· 10 10 #include <linux/sched/signal.h> 11 11 #include <linux/sizes.h> 12 12 13 - #include <drm/drm_buddy.h> 13 + #include <linux/gpu_buddy.h> 14 14 15 - #include "../lib/drm_random.h" 15 + #include "gpu_random.h" 16 16 17 17 static unsigned int random_seed; 18 18
-2
drivers/gpu/drm/tests/drm_exec_test.c
··· 16 16 #include <drm/drm_gem.h> 17 17 #include <drm/drm_kunit_helpers.h> 18 18 19 - #include "../lib/drm_random.h" 20 - 21 19 struct drm_exec_priv { 22 20 struct device *dev; 23 21 struct drm_device *drm;
-2
drivers/gpu/drm/tests/drm_mm_test.c
··· 16 16 #include <drm/drm_mm.h> 17 17 #include <drm/drm_print.h> 18 18 19 - #include "../lib/drm_random.h" 20 - 21 19 enum { 22 20 BEST, 23 21 BOTTOMUP,
+1 -1
drivers/gpu/drm/ttm/tests/ttm_mock_manager.h
··· 5 5 #ifndef TTM_MOCK_MANAGER_H 6 6 #define TTM_MOCK_MANAGER_H 7 7 8 - #include <drm/drm_buddy.h> 8 + #include <linux/gpu_buddy.h> 9 9 10 10 struct ttm_mock_manager { 11 11 struct ttm_resource_manager man;
+1 -1
drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h
··· 6 6 #ifndef _XE_TTM_VRAM_MGR_TYPES_H_ 7 7 #define _XE_TTM_VRAM_MGR_TYPES_H_ 8 8 9 - #include <drm/drm_buddy.h> 9 + #include <linux/gpu_buddy.h> 10 10 #include <drm/ttm/ttm_device.h> 11 11 12 12 /**
+4
drivers/gpu/tests/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + 3 + gpu_buddy_tests-y = gpu_buddy_test.o gpu_random.o 4 + obj-$(CONFIG_DRM_KUNIT_TEST) += gpu_buddy_tests.o
include/drm/drm_buddy.h include/linux/gpu_buddy.h