drm/suballoc: Extract amdgpu_sa.c as generic suballocation helper
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Fri, 24 Feb 2023 09:51:50 +0000 (10:51 +0100)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Wed, 1 Mar 2023 16:18:19 +0000 (17:18 +0100)
commit849ee8a2f0df7a4ed4d281e19d3c9824b8e60bc2
tree6224f0ecb29d26a5af5f70de0b5c8157ca52510f
parentca62297b2085b5b3168bd891ca24862242c635a1
drm/suballoc: Extract amdgpu_sa.c as generic suballocation helper

Suballocating a buffer object is something that is not driver-specific
and useful for many drivers.

Use a slightly modified version of amdgpu_sa.c

v2:
- Style cleanups.
- Added / Modified documentation.
- Use u64 for the sizes and offset. The code dates back to 2012 and
  using unsigned int will probably soon come back to bite us.
  We can consider size_t as well for better 32-bit efficiency.
- Add and document gfp, intr and align arguments to drm_suballoc_new().
- Use drm_printer for debug output.

v3:
- Remove stale author info (Christian König)

v4:
- Avoid 64-bit integer divisions (kernel test robot <lkp@intel.com>)
- Use size_t rather than u64 for the managed range. (Thomas)

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Co-developed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Acked-by: Alex Deucher <alexdeucher@gmail.com>
Acked-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230224095152.30134-2-thomas.hellstrom@linux.intel.com
drivers/gpu/drm/Kconfig
drivers/gpu/drm/Makefile
drivers/gpu/drm/drm_suballoc.c [new file with mode: 0644]
include/drm/drm_suballoc.h [new file with mode: 0644]