mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
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>
This commit is contained in:
parent
779ec12c85
commit
4a9671a03f
|
|
@ -526,10 +526,10 @@ DRM GPUVM Function References
|
|||
DRM Buddy Allocator
|
||||
===================
|
||||
|
||||
DRM Buddy Function References
|
||||
-----------------------------
|
||||
Buddy Allocator Function References (GPU buddy)
|
||||
-----------------------------------------------
|
||||
|
||||
.. kernel-doc:: drivers/gpu/drm/drm_buddy.c
|
||||
.. kernel-doc:: drivers/gpu/buddy.c
|
||||
:export:
|
||||
|
||||
DRM Cache Handling and Fast WC memcpy()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# drm/tegra depends on host1x, so if both drivers are built-in care must be
|
||||
# taken to initialize them in the correct order. Link order is the only way
|
||||
# to ensure this currently.
|
||||
obj-y += host1x/ drm/ vga/
|
||||
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/
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/sizes.h>
|
||||
|
||||
#include <drm/drm_buddy.h>
|
||||
#include <linux/gpu_buddy.h>
|
||||
#include <drm/drm_print.h>
|
||||
|
||||
enum drm_buddy_free_tree {
|
||||
|
|
@ -269,10 +269,6 @@ config DRM_SCHED
|
|||
config DRM_PANEL_BACKLIGHT_QUIRKS
|
||||
tristate
|
||||
|
||||
config DRM_LIB_RANDOM
|
||||
bool
|
||||
default n
|
||||
|
||||
config DRM_PRIVACY_SCREEN
|
||||
bool
|
||||
default n
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ config DRM_KUNIT_TEST
|
|||
select DRM_EXPORT_FOR_TESTS if m
|
||||
select DRM_GEM_SHMEM_HELPER
|
||||
select DRM_KUNIT_TEST_HELPERS
|
||||
select DRM_LIB_RANDOM
|
||||
select DRM_SYSFB_HELPER
|
||||
select PRIME_NUMBERS
|
||||
default KUNIT_ALL_TESTS
|
||||
|
|
|
|||
|
|
@ -79,7 +79,6 @@ drm-$(CONFIG_DRM_CLIENT) += \
|
|||
drm_client_event.o \
|
||||
drm_client_modeset.o \
|
||||
drm_client_sysrq.o
|
||||
drm-$(CONFIG_DRM_LIB_RANDOM) += lib/drm_random.o
|
||||
drm-$(CONFIG_COMPAT) += drm_ioc32.o
|
||||
drm-$(CONFIG_DRM_PANEL) += drm_panel.o
|
||||
drm-$(CONFIG_OF) += drm_of.o
|
||||
|
|
@ -115,7 +114,7 @@ drm_gpusvm_helper-$(CONFIG_ZONE_DEVICE) += \
|
|||
|
||||
obj-$(CONFIG_DRM_GPUSVM) += drm_gpusvm_helper.o
|
||||
|
||||
obj-$(CONFIG_DRM_BUDDY) += drm_buddy.o
|
||||
obj-$(CONFIG_DRM_BUDDY) += ../buddy.o
|
||||
|
||||
drm_dma_helper-y := drm_gem_dma_helper.o
|
||||
drm_dma_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fbdev_dma.o
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef __AMDGPU_VRAM_MGR_H__
|
||||
#define __AMDGPU_VRAM_MGR_H__
|
||||
|
||||
#include <drm/drm_buddy.h>
|
||||
#include <linux/gpu_buddy.h>
|
||||
|
||||
struct amdgpu_vram_mgr {
|
||||
struct ttm_resource_manager manager;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include <linux/shmem_fs.h>
|
||||
|
||||
#include <drm/drm_buddy.h>
|
||||
#include <linux/gpu_buddy.h>
|
||||
#include <drm/drm_print.h>
|
||||
#include <drm/ttm/ttm_placement.h>
|
||||
#include <drm/ttm/ttm_tt.h>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include "i915_scatterlist.h"
|
||||
#include "i915_ttm_buddy_manager.h"
|
||||
|
||||
#include <drm/drm_buddy.h>
|
||||
#include <linux/gpu_buddy.h>
|
||||
#include <drm/drm_mm.h>
|
||||
|
||||
#include <linux/slab.h>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <drm/drm_buddy.h>
|
||||
#include <linux/gpu_buddy.h>
|
||||
#include <drm/drm_print.h>
|
||||
#include <drm/ttm/ttm_placement.h>
|
||||
#include <drm/ttm/ttm_bo.h>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ obj-$(CONFIG_DRM_KUNIT_TEST) += \
|
|||
drm_atomic_test.o \
|
||||
drm_atomic_state_test.o \
|
||||
drm_bridge_test.o \
|
||||
drm_buddy_test.o \
|
||||
drm_cmdline_parser_test.o \
|
||||
drm_connector_test.o \
|
||||
drm_damage_helper_test.o \
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
#include <drm/drm_gem.h>
|
||||
#include <drm/drm_kunit_helpers.h>
|
||||
|
||||
#include "../lib/drm_random.h"
|
||||
|
||||
struct drm_exec_priv {
|
||||
struct device *dev;
|
||||
struct drm_device *drm;
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
#include <drm/drm_mm.h>
|
||||
#include <drm/drm_print.h>
|
||||
|
||||
#include "../lib/drm_random.h"
|
||||
|
||||
enum {
|
||||
BEST,
|
||||
BOTTOMUP,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#ifndef TTM_MOCK_MANAGER_H
|
||||
#define TTM_MOCK_MANAGER_H
|
||||
|
||||
#include <drm/drm_buddy.h>
|
||||
#include <linux/gpu_buddy.h>
|
||||
|
||||
struct ttm_mock_manager {
|
||||
struct ttm_resource_manager man;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#ifndef _XE_TTM_VRAM_MGR_TYPES_H_
|
||||
#define _XE_TTM_VRAM_MGR_TYPES_H_
|
||||
|
||||
#include <drm/drm_buddy.h>
|
||||
#include <linux/gpu_buddy.h>
|
||||
#include <drm/ttm/ttm_device.h>
|
||||
|
||||
/**
|
||||
|
|
|
|||
4
drivers/gpu/tests/Makefile
Normal file
4
drivers/gpu/tests/Makefile
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
gpu_buddy_tests-y = gpu_buddy_test.o gpu_random.o
|
||||
obj-$(CONFIG_DRM_KUNIT_TEST) += gpu_buddy_tests.o
|
||||
|
|
@ -10,9 +10,9 @@
|
|||
#include <linux/sched/signal.h>
|
||||
#include <linux/sizes.h>
|
||||
|
||||
#include <drm/drm_buddy.h>
|
||||
#include <linux/gpu_buddy.h>
|
||||
|
||||
#include "../lib/drm_random.h"
|
||||
#include "gpu_random.h"
|
||||
|
||||
static unsigned int random_seed;
|
||||
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
#include <linux/slab.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#include "drm_random.h"
|
||||
#include "gpu_random.h"
|
||||
|
||||
u32 drm_prandom_u32_max_state(u32 ep_ro, struct rnd_state *state)
|
||||
{
|
||||
Loading…
Reference in New Issue
Block a user