Skip to contentSkip to conversation

drm/helpers: Make the suballocation manager drm generic

PATCH Superseded Thomas Hellström 3 participants 9 messages Feb 23, 2023

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover drm/helpers: Make the suballocation manager drm generic

This series (or at least the suballocator helper) is a prerequisite for the new Xe driver.

There was an unresolved issue when the series was last up for review, and that was the per allocation aligment. Last message was from Maarten Lankhorst arguing that the larger per-driver alignment used would only incur a small memory cost. This new variant resolves that.

The generic suballocator has been tested with the Xe driver, and a kunit test is under development.
The amd- and radeon adaptations are only compile-tested.

v3:
- Remove stale author information (Christian König)
- Update Radeon Kconfig (Thomas Hellström)

Maarten Lankhorst (3):
drm/suballoc: Extract amdgpu_sa.c as generic suballocation helper drm/amd: Convert amdgpu to use suballocation helper. drm/radeon: Use the drm suballocation manager implementation.

 drivers/gpu/drm/Kconfig                    |   5 +
 drivers/gpu/drm/Makefile                   |   3 +
 drivers/gpu/drm/amd/amdgpu/Kconfig         |   1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  26 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c     |   5 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h |  23 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h   |   3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c     | 324 +--------------
 drivers/gpu/drm/drm_suballoc.c             | 453 +++++++++++++++++++++
 drivers/gpu/drm/radeon/Kconfig             |   1 +
 drivers/gpu/drm/radeon/radeon.h            |  55 +--
 drivers/gpu/drm/radeon/radeon_ib.c         |  12 +-
 drivers/gpu/drm/radeon/radeon_object.h     |  25 +-
 drivers/gpu/drm/radeon/radeon_sa.c         | 316 ++------------
 drivers/gpu/drm/radeon/radeon_semaphore.c  |   4 +-
 include/drm/drm_suballoc.h                 | 106 +++++
 16 files changed, 669 insertions(+), 693 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_suballoc.c
 create mode 100644 include/drm/drm_suballoc.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 1/3 drm/suballoc: Extract amdgpu_sa.c as generic suballocation helper

From: Maarten Lankhorst <[email protected]>

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)

---
 drivers/gpu/drm/Kconfig        |   4 +
 drivers/gpu/drm/Makefile       |   3 +
 drivers/gpu/drm/drm_suballoc.c | 453 +++++++++++++++++++++++++++++++++
 include/drm/drm_suballoc.h     | 106 ++++++++
 4 files changed, 566 insertions(+)
 create mode 100644 drivers/gpu/drm/drm_suballoc.c
 create mode 100644 include/drm/drm_suballoc.h
drivers/gpu/drm/Kconfig +4 -0
index dc0f94f02a82..8fbe57407c60 100644
@@ -232,6 +232,10 @@ config DRM_GEM_SHMEM_HELPER
 	help
 	  Choose this if you need the GEM shmem helper functions
 
+config DRM_SUBALLOC_HELPER
+	tristate
+	depends on DRM
+
 config DRM_SCHED
 	tristate
 	depends on DRM
drivers/gpu/drm/Makefile +3 -0
index ab4460fcd63f..1e04d135e866 100644
@@ -88,6 +88,9 @@ obj-$(CONFIG_DRM_GEM_DMA_HELPER) += drm_dma_helper.o
 drm_shmem_helper-y := drm_gem_shmem_helper.o
 obj-$(CONFIG_DRM_GEM_SHMEM_HELPER) += drm_shmem_helper.o
 
+drm_suballoc_helper-y := drm_suballoc.o
+obj-$(CONFIG_DRM_SUBALLOC_HELPER) += drm_suballoc_helper.o
+
 drm_vram_helper-y := drm_gem_vram_helper.o
 obj-$(CONFIG_DRM_VRAM_HELPER) += drm_vram_helper.o
 
drivers/gpu/drm/drm_suballoc.c new file +453 -0

453 lines not on this page · raw message

include/drm/drm_suballoc.h new file +106 -0

106 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

PATCH v3 2/3 drm/amd: Convert amdgpu to use suballocation helper.

In reply to Thomas Hellström

From: Maarten Lankhorst <[email protected]>

Now that we have a generic suballocation helper, Use it in amdgpu. For lines that get moved or changed, also fix up pre-existing style issues.

---
 drivers/gpu/drm/Kconfig                    |   1 +
 drivers/gpu/drm/amd/amdgpu/Kconfig         |   1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  26 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c     |   5 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h |  23 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h   |   3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c     | 324 ++-------------------
 7 files changed, 46 insertions(+), 337 deletions(-)
drivers/gpu/drm/Kconfig +1 -0
index 8fbe57407c60..73ddfdf3a894 100644
@@ -77,6 +77,7 @@ config DRM_KUNIT_TEST
 	select DRM_DISPLAY_HELPER
 	select DRM_LIB_RANDOM
 	select DRM_KMS_HELPER
+	select DRM_SUBALLOC_HELPER
 	select DRM_BUDDY
 	select DRM_EXPORT_FOR_TESTS if m
 	select DRM_KUNIT_TEST_HELPERS
drivers/gpu/drm/amd/amdgpu/Kconfig +1 -0
index 5341b6b242c3..0ed12171450b 100644
@@ -18,6 +18,7 @@ config DRM_AMDGPU
 	select BACKLIGHT_CLASS_DEVICE
 	select INTERVAL_TREE
 	select DRM_BUDDY
+	select DRM_SUBALLOC_HELPER
 	# amdgpu depends on ACPI_VIDEO when ACPI is enabled, for select to work
 	# ACPI_VIDEO's dependencies must also be selected.
 	select INPUT if ACPI
drivers/gpu/drm/amd/amdgpu/amdgpu.h +4 -22
index 164141bc8b4a..dda88090f044 100644
@@ -424,29 +424,11 @@ struct amdgpu_clock {
  * alignment).
  */
 
-#define AMDGPU_SA_NUM_FENCE_LISTS	32
-
 struct amdgpu_sa_manager {
-	wait_queue_head_t	wq;
-	struct amdgpu_bo	*bo;
-	struct list_head	*hole;
-	struct list_head	flist[AMDGPU_SA_NUM_FENCE_LISTS];
-	struct list_head	olist;
-	unsigned		size;
-	uint64_t		gpu_addr;
-	void			*cpu_ptr;
-	uint32_t		domain;
-	uint32_t		align;
-};
-
-/* sub-allocation buffer */
-struct amdgpu_sa_bo {
-	struct list_head		olist;
-	struct list_head		flist;
-	struct amdgpu_sa_manager	*manager;
-	unsigned			soffset;
-	unsigned			eoffset;
-	struct dma_fence	        *fence;
+	struct drm_suballoc_manager	base;
+	struct amdgpu_bo		*bo;
+	uint64_t			gpu_addr;
+	void				*cpu_ptr;
 };
 
 int amdgpu_fence_slab_init(void);
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +2 -3
index bcccc348dbe2..df7eb0b7c4b9 100644
@@ -69,7 +69,7 @@ int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 
 	if (size) {
 		r = amdgpu_sa_bo_new(&adev->ib_pools[pool_type],
-				      &ib->sa_bo, size, 256);
+				     &ib->sa_bo, size);
 		if (r) {
 			dev_err(adev->dev, "failed to get a new IB (%d)\n", r);
 			return r;
@@ -309,8 +309,7 @@ int amdgpu_ib_pool_init(struct amdgpu_device *adev)
 
 	for (i = 0; i < AMDGPU_IB_POOL_MAX; i++) {
 		r = amdgpu_sa_bo_manager_init(adev, &adev->ib_pools[i],
-					      AMDGPU_IB_POOL_SIZE,
-					      AMDGPU_GPU_PAGE_SIZE,
+					      AMDGPU_IB_POOL_SIZE, 256,
 					      AMDGPU_GEM_DOMAIN_GTT);
 		if (r)
 			goto error;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +15 -8
index 93207badf83f..5a85726ce853 100644
@@ -336,15 +336,22 @@ uint32_t amdgpu_bo_get_preferred_domain(struct amdgpu_device *adev,
 /*
  * sub allocation
  */
+static inline struct amdgpu_sa_manager *
+to_amdgpu_sa_manager(struct drm_suballoc_manager *manager)
+{
+	return container_of(manager, struct amdgpu_sa_manager, base);
+}
 
-static inline uint64_t amdgpu_sa_bo_gpu_addr(struct amdgpu_sa_bo *sa_bo)
+static inline uint64_t amdgpu_sa_bo_gpu_addr(struct drm_suballoc *sa_bo)
 {
-	return sa_bo->manager->gpu_addr + sa_bo->soffset;
+	return to_amdgpu_sa_manager(sa_bo->manager)->gpu_addr +
+		drm_suballoc_soffset(sa_bo);
 }
 
-static inline void * amdgpu_sa_bo_cpu_addr(struct amdgpu_sa_bo *sa_bo)
+static inline void *amdgpu_sa_bo_cpu_addr(struct drm_suballoc *sa_bo)
 {
-	return sa_bo->manager->cpu_ptr + sa_bo->soffset;
+	return to_amdgpu_sa_manager(sa_bo->manager)->cpu_ptr +
+		drm_suballoc_soffset(sa_bo);
 }
 
 int amdgpu_sa_bo_manager_init(struct amdgpu_device *adev,
@@ -355,11 +362,11 @@ void amdgpu_sa_bo_manager_fini(struct amdgpu_device *adev,
 int amdgpu_sa_bo_manager_start(struct amdgpu_device *adev,
 				      struct amdgpu_sa_manager *sa_manager);
 int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager,
-		     struct amdgpu_sa_bo **sa_bo,
-		     unsigned size, unsigned align);
+		     struct drm_suballoc **sa_bo,
+		     unsigned int size);
 void amdgpu_sa_bo_free(struct amdgpu_device *adev,
-			      struct amdgpu_sa_bo **sa_bo,
-			      struct dma_fence *fence);
+		       struct drm_suballoc **sa_bo,
+		       struct dma_fence *fence);
 #if defined(CONFIG_DEBUG_FS)
 void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager,
 					 struct seq_file *m);
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +2 -1
index 3989e755a5b4..018f36b10de8 100644
@@ -27,6 +27,7 @@
 #include <drm/amdgpu_drm.h>
 #include <drm/gpu_scheduler.h>
 #include <drm/drm_print.h>
+#include <drm/drm_suballoc.h>
 
 struct amdgpu_device;
 struct amdgpu_ring;
@@ -92,7 +93,7 @@ enum amdgpu_ib_pool_type {
 };
 
 struct amdgpu_ib {
-	struct amdgpu_sa_bo		*sa_bo;
+	struct drm_suballoc		*sa_bo;
 	uint32_t			length_dw;
 	uint64_t			gpu_addr;
 	uint32_t			*ptr;
drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c +21 -303

374 lines not on this page · raw message

Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH v3 2/3] drm/amd: Convert amdgpu to use suballocation helper.

I love your patch! Yet something to improve:

Hi Thomas,

I love your patch! Yet something to improve:

[auto build test ERROR on drm-tip/drm-tip]

url:    https://github.com/intel-lab-lkp/linux/commits/Thomas-Hellstr-m/drm-suballoc-Extract-amdgpu_sa-c-as-generic-suballocation-helper/20230223-225547
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
patch link:    https://lore.kernel.org/r/20230223142531.8446-3-thomas.hellstrom%40linux.intel.com
patch subject: [PATCH v3 2/3] drm/amd: Convert amdgpu to use suballocation helper.
config: m68k-randconfig-r005-20230222 (https://download.01.org/0day-ci/archive/20230224/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 12.1.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/566352490ef7a031bd23f9d6524057fd7b31330c
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Thomas-Hellstr-m/drm-suballoc-Extract-amdgpu_sa-c-as-generic-suballocation-helper/20230223-225547 git checkout 566352490ef7a031bd23f9d6524057fd7b31330c
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

m68k-linux-ld: drivers/gpu/drm/drm_suballoc.o: in function `drm_suballoc_try_alloc':

>> drivers/gpu/drm/drm_suballoc.c:168: undefined reference to `__umoddi3'

m68k-linux-ld: drivers/gpu/drm/drm_suballoc.o: in function `__drm_suballoc_event':
drivers/gpu/drm/drm_suballoc.c:196: undefined reference to `__umoddi3'
m68k-linux-ld: drivers/media/i2c/tc358746.o: in function `tc358746_setup_mclk_provider':
drivers/media/i2c/tc358746.c:1257: undefined reference to `devm_clk_hw_register'
m68k-linux-ld: drivers/media/i2c/tc358746.c:1263: undefined reference to `of_clk_hw_simple_get'
m68k-linux-ld: drivers/media/i2c/tc358746.c:1263: undefined reference to `devm_of_clk_add_hw_provider'

vim +168 drivers/gpu/drm/drm_suballoc.c

d550f4b8345a4b Maarten Lankhorst 2023-02-23  159  
d550f4b8345a4b Maarten Lankhorst 2023-02-23  160  static bool drm_suballoc_try_alloc(struct drm_suballoc_manager *sa_manager,
d550f4b8345a4b Maarten Lankhorst 2023-02-23  161  				   struct drm_suballoc *sa,
d550f4b8345a4b Maarten Lankhorst 2023-02-23  162  				   u64 size, u64 align)
d550f4b8345a4b Maarten Lankhorst 2023-02-23  163  {
d550f4b8345a4b Maarten Lankhorst 2023-02-23  164  	u64 soffset, eoffset, wasted;
d550f4b8345a4b Maarten Lankhorst 2023-02-23  165  
d550f4b8345a4b Maarten Lankhorst 2023-02-23  166  	soffset = drm_suballoc_hole_soffset(sa_manager);
d550f4b8345a4b Maarten Lankhorst 2023-02-23  167  	eoffset = drm_suballoc_hole_eoffset(sa_manager);
d550f4b8345a4b Maarten Lankhorst 2023-02-23 @168  	wasted = (align - (soffset % align)) % align;
d550f4b8345a4b Maarten Lankhorst 2023-02-23  169  
d550f4b8345a4b Maarten Lankhorst 2023-02-23  170  	if ((eoffset - soffset) >= (size + wasted)) {
d550f4b8345a4b Maarten Lankhorst 2023-02-23  171  		soffset += wasted;
d550f4b8345a4b Maarten Lankhorst 2023-02-23  172  
d550f4b8345a4b Maarten Lankhorst 2023-02-23  173  		sa->manager = sa_manager;
d550f4b8345a4b Maarten Lankhorst 2023-02-23  174  		sa->soffset = soffset;
d550f4b8345a4b Maarten Lankhorst 2023-02-23  175  		sa->eoffset = soffset + size;
d550f4b8345a4b Maarten Lankhorst 2023-02-23  176  		list_add(&sa->olist, sa_manager->hole);
d550f4b8345a4b Maarten Lankhorst 2023-02-23  177  		INIT_LIST_HEAD(&sa->flist);
d550f4b8345a4b Maarten Lankhorst 2023-02-23  178  		sa_manager->hole = &sa->olist;
d550f4b8345a4b Maarten Lankhorst 2023-02-23  179  		return true;
d550f4b8345a4b Maarten Lankhorst 2023-02-23  180  	}
d550f4b8345a4b Maarten Lankhorst 2023-02-23  181  	return false;
d550f4b8345a4b Maarten Lankhorst 2023-02-23  182  }
d550f4b8345a4b Maarten Lankhorst 2023-02-23  183  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
#4 lore raw

Re: [PATCH v3 2/3] drm/amd: Convert amdgpu to use suballocation helper.

In reply to Thomas Hellström
I love your patch! Yet something to improve:

Hi Thomas,

I love your patch! Yet something to improve:

[auto build test ERROR on drm-tip/drm-tip]

url:    https://github.com/intel-lab-lkp/linux/commits/Thomas-Hellstr-m/drm-suballoc-Extract-amdgpu_sa-c-as-generic-suballocation-helper/20230223-225547
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
patch link:    https://lore.kernel.org/r/20230223142531.8446-3-thomas.hellstrom%40linux.intel.com
patch subject: [PATCH v3 2/3] drm/amd: Convert amdgpu to use suballocation helper.
config: hexagon-randconfig-r041-20230223 (https://download.01.org/0day-ci/archive/20230224/[email protected]/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project db89896bbbd2251fff457699635acbbedeead27f)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/566352490ef7a031bd23f9d6524057fd7b31330c
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Thomas-Hellstr-m/drm-suballoc-Extract-amdgpu_sa-c-as-generic-suballocation-helper/20230223-225547 git checkout 566352490ef7a031bd23f9d6524057fd7b31330c
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> ld.lld: error: undefined symbol: __hexagon_umoddi3
   >>> referenced by drm_suballoc.c
   >>>               drivers/gpu/drm/drm_suballoc.o:(drm_suballoc_new) in archive vmlinux.a
   >>> referenced by drm_suballoc.c
   >>>               drivers/gpu/drm/drm_suballoc.o:(drm_suballoc_new) in archive vmlinux.a
   >>> referenced by drm_suballoc.c
   >>>               drivers/gpu/drm/drm_suballoc.o:(drm_suballoc_new) in archive vmlinux.a
   >>> referenced 17 more times
   >>> did you mean: __hexagon_umodsi3
   >>> defined in: vmlinux.a(arch/hexagon/lib/umodsi3.o)
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
#5 lore raw

Re: [PATCH v3 2/3] drm/amd: Convert amdgpu to use suballocation helper.

In reply to Thomas Hellström
I love your patch! Yet something to improve:

Hi Thomas,

I love your patch! Yet something to improve:

[auto build test ERROR on drm-tip/drm-tip]

url:    https://github.com/intel-lab-lkp/linux/commits/Thomas-Hellstr-m/drm-suballoc-Extract-amdgpu_sa-c-as-generic-suballocation-helper/20230223-225547
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
patch link:    https://lore.kernel.org/r/20230223142531.8446-3-thomas.hellstrom%40linux.intel.com
patch subject: [PATCH v3 2/3] drm/amd: Convert amdgpu to use suballocation helper.
config: hexagon-randconfig-r045-20230222 (https://download.01.org/0day-ci/archive/20230224/[email protected]/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project db89896bbbd2251fff457699635acbbedeead27f)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/566352490ef7a031bd23f9d6524057fd7b31330c
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Thomas-Hellstr-m/drm-suballoc-Extract-amdgpu_sa-c-as-generic-suballocation-helper/20230223-225547 git checkout 566352490ef7a031bd23f9d6524057fd7b31330c
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "__hexagon_umoddi3" [drivers/gpu/drm/drm_suballoc_helper.ko] undefined!
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
#6 lore raw

PATCH v3 3/3 drm/radeon: Use the drm suballocation manager implementation.

In reply to Thomas Hellström

From: Maarten Lankhorst <[email protected]>

Use the generic suballocation helper for radeon.

v3:
- Select the suballoc helper in Kconfig (Thomas).

---
 drivers/gpu/drm/radeon/Kconfig            |   1 +
 drivers/gpu/drm/radeon/radeon.h           |  55 +---
 drivers/gpu/drm/radeon/radeon_ib.c        |  12 +-
 drivers/gpu/drm/radeon/radeon_object.h    |  25 +-
 drivers/gpu/drm/radeon/radeon_sa.c        | 316 ++--------------------
 drivers/gpu/drm/radeon/radeon_semaphore.c |   4 +-
 6 files changed, 57 insertions(+), 356 deletions(-)
drivers/gpu/drm/radeon/Kconfig +1 -0
index 62a596d3a891..e19d77d58810 100644
@@ -8,6 +8,7 @@ config DRM_RADEON
 	select DRM_DISPLAY_DP_HELPER
 	select DRM_DISPLAY_HELPER
         select DRM_KMS_HELPER
+	select DRM_SUBALLOC_HELPER
         select DRM_TTM
 	select DRM_TTM_HELPER
 	select SND_HDA_COMPONENT if SND_HDA_CORE
drivers/gpu/drm/radeon/radeon.h +8 -47

80 lines not on this page · raw message

drivers/gpu/drm/radeon/radeon_ib.c +5 -7
index 62b116727b4f..6a45a72488f9 100644
@@ -61,7 +61,7 @@ int radeon_ib_get(struct radeon_device *rdev, int ring,
 {
 	int r;
 
-	r = radeon_sa_bo_new(rdev, &rdev->ring_tmp_bo, &ib->sa_bo, size, 256);
+	r = radeon_sa_bo_new(&rdev->ring_tmp_bo, &ib->sa_bo, size, 256);
 	if (r) {
 		dev_err(rdev->dev, "failed to get a new IB (%d)\n", r);
 		return r;
@@ -77,7 +77,7 @@ int radeon_ib_get(struct radeon_device *rdev, int ring,
 		/* ib pool is bound at RADEON_VA_IB_OFFSET in virtual address
 		 * space and soffset is the offset inside the pool bo
 		 */
-		ib->gpu_addr = ib->sa_bo->soffset + RADEON_VA_IB_OFFSET;
+		ib->gpu_addr = drm_suballoc_soffset(ib->sa_bo) + RADEON_VA_IB_OFFSET;
 	} else {
 		ib->gpu_addr = radeon_sa_bo_gpu_addr(ib->sa_bo);
 	}
@@ -97,7 +97,7 @@ int radeon_ib_get(struct radeon_device *rdev, int ring,
 void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib *ib)
 {
 	radeon_sync_free(rdev, &ib->sync, ib->fence);
-	radeon_sa_bo_free(rdev, &ib->sa_bo, ib->fence);
+	radeon_sa_bo_free(&ib->sa_bo, ib->fence);
 	radeon_fence_unref(&ib->fence);
 }
 
@@ -201,8 +201,7 @@ int radeon_ib_pool_init(struct radeon_device *rdev)
 
 	if (rdev->family >= CHIP_BONAIRE) {
 		r = radeon_sa_bo_manager_init(rdev, &rdev->ring_tmp_bo,
-					      RADEON_IB_POOL_SIZE*64*1024,
-					      RADEON_GPU_PAGE_SIZE,
+					      RADEON_IB_POOL_SIZE*64*1024, 256,
 					      RADEON_GEM_DOMAIN_GTT,
 					      RADEON_GEM_GTT_WC);
 	} else {
@@ -210,8 +209,7 @@ int radeon_ib_pool_init(struct radeon_device *rdev)
 		 * to the command stream checking
 		 */
 		r = radeon_sa_bo_manager_init(rdev, &rdev->ring_tmp_bo,
-					      RADEON_IB_POOL_SIZE*64*1024,
-					      RADEON_GPU_PAGE_SIZE,
+					      RADEON_IB_POOL_SIZE*64*1024, 256,
 					      RADEON_GEM_DOMAIN_GTT, 0);
 	}
 	if (r) {
drivers/gpu/drm/radeon/radeon_object.h +15 -10
index 0a6ef49e990a..39cc87a59a9a 100644
@@ -169,15 +169,22 @@ extern void radeon_bo_fence(struct radeon_bo *bo, struct radeon_fence *fence,
 /*
  * sub allocation
  */
+static inline struct radeon_sa_manager *
+to_radeon_sa_manager(struct drm_suballoc_manager *manager)
+{
+	return container_of(manager, struct radeon_sa_manager, base);
+}
 
-static inline uint64_t radeon_sa_bo_gpu_addr(struct radeon_sa_bo *sa_bo)
+static inline uint64_t radeon_sa_bo_gpu_addr(struct drm_suballoc *sa_bo)
 {
-	return sa_bo->manager->gpu_addr + sa_bo->soffset;
+	return to_radeon_sa_manager(sa_bo->manager)->gpu_addr +
+		drm_suballoc_soffset(sa_bo);
 }
 
-static inline void * radeon_sa_bo_cpu_addr(struct radeon_sa_bo *sa_bo)
+static inline void *radeon_sa_bo_cpu_addr(struct drm_suballoc *sa_bo)
 {
-	return sa_bo->manager->cpu_ptr + sa_bo->soffset;
+	return to_radeon_sa_manager(sa_bo->manager)->cpu_ptr +
+		drm_suballoc_soffset(sa_bo);
 }
 
 extern int radeon_sa_bo_manager_init(struct radeon_device *rdev,
@@ -190,12 +197,10 @@ extern int radeon_sa_bo_manager_start(struct radeon_device *rdev,
 				      struct radeon_sa_manager *sa_manager);
 extern int radeon_sa_bo_manager_suspend(struct radeon_device *rdev,
 					struct radeon_sa_manager *sa_manager);
-extern int radeon_sa_bo_new(struct radeon_device *rdev,
-			    struct radeon_sa_manager *sa_manager,
-			    struct radeon_sa_bo **sa_bo,
-			    unsigned size, unsigned align);
-extern void radeon_sa_bo_free(struct radeon_device *rdev,
-			      struct radeon_sa_bo **sa_bo,
+extern int radeon_sa_bo_new(struct radeon_sa_manager *sa_manager,
+			    struct drm_suballoc **sa_bo,
+			    unsigned int size, unsigned int align);
+extern void radeon_sa_bo_free(struct drm_suballoc **sa_bo,
 			      struct radeon_fence *fence);
 #if defined(CONFIG_DEBUG_FS)
 extern void radeon_sa_bo_dump_debug_info(struct radeon_sa_manager *sa_manager,
drivers/gpu/drm/radeon/radeon_sa.c +26 -290

364 lines not on this page · raw message

drivers/gpu/drm/radeon/radeon_semaphore.c +2 -2
index 221e59476f64..1f0a9a4ff5ae 100644
@@ -40,7 +40,7 @@ int radeon_semaphore_create(struct radeon_device *rdev,
 	if (*semaphore == NULL) {
 		return -ENOMEM;
 	}
-	r = radeon_sa_bo_new(rdev, &rdev->ring_tmp_bo,
+	r = radeon_sa_bo_new(&rdev->ring_tmp_bo,
 			     &(*semaphore)->sa_bo, 8, 8);
 	if (r) {
 		kfree(*semaphore);
@@ -100,7 +100,7 @@ void radeon_semaphore_free(struct radeon_device *rdev,
 		dev_err(rdev->dev, "semaphore %p has more waiters than signalers,"
 			" hardware lockup imminent!\n", *semaphore);
 	}
-	radeon_sa_bo_free(rdev, &(*semaphore)->sa_bo, fence);
+	radeon_sa_bo_free(&(*semaphore)->sa_bo, fence);
 	kfree(*semaphore);
 	*semaphore = NULL;
 }
Signature · 1 line
2.34.1
#8 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/helpers: Make the suballocation manager drm generic

In reply to Thomas Hellström
== Series Details ==

== Series Details ==

Series: drm/helpers: Make the suballocation manager drm generic
URL : https://patchwork.freedesktop.org/series/114299/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_12773 -> Patchwork_114299v1
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_114299v1 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_114299v1, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/index.html

Participating hosts (37 -> 39)
------------------------------

Additional (3): fi-kbl-soraka bat-adlp-6 fi-pnv-d510
Missing (1): fi-snb-2520m

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_114299v1:

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live@gt_timelines:
- bat-atsm-1: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12773/bat-atsm-1/igt@i915_selftest@live@gt_timelines.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-atsm-1/igt@i915_selftest@live@gt_timelines.html

Known issues
------------

Here are the changes found in Patchwork_114299v1 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@debugfs_test@basic-hwmon:
- bat-adlp-6: NOTRUN -> [SKIP][3] ([i915#7456])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-adlp-6/igt@[email protected]

* igt@gem_huc_copy@huc-copy:
- fi-kbl-soraka: NOTRUN -> [SKIP][4] ([fdo#109271] / [i915#2190])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/fi-kbl-soraka/igt@[email protected]

* igt@gem_lmem_swapping@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][5] ([fdo#109271] / [i915#4613]) +3 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/fi-kbl-soraka/igt@[email protected]

* igt@gem_lmem_swapping@random-engines:
- bat-adlp-6: NOTRUN -> [SKIP][6] ([i915#4613]) +3 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-adlp-6/igt@[email protected]

* igt@gem_tiled_pread_basic:
- bat-adlp-6: NOTRUN -> [SKIP][7] ([i915#3282])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-adlp-6/igt@gem_tiled_pread_basic.html

* igt@i915_pm_rps@basic-api:
- bat-adlp-6: NOTRUN -> [SKIP][8] ([i915#6621])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-adlp-6/igt@[email protected]

* igt@i915_selftest@live@gt_heartbeat:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][9] ([i915#5334] / [i915#7872])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/fi-kbl-soraka/igt@i915_selftest@live@gt_heartbeat.html

* igt@i915_selftest@live@gt_lrc:
- bat-dg2-11: [PASS][10] -> [INCOMPLETE][11] ([i915#7609] / [i915#7913])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12773/bat-dg2-11/igt@i915_selftest@live@gt_lrc.html
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-dg2-11/igt@i915_selftest@live@gt_lrc.html

* igt@i915_selftest@live@gt_pm:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][12] ([i915#1886])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html

* igt@i915_selftest@live@hangcheck:
- fi-kbl-soraka: NOTRUN -> [INCOMPLETE][13] ([i915#7913])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/fi-kbl-soraka/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@reset:
- bat-rpls-1: [PASS][14] -> [ABORT][15] ([i915#4983])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12773/bat-rpls-1/igt@i915_selftest@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-rpls-1/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@slpc:
- bat-rpls-2: NOTRUN -> [DMESG-FAIL][16] ([i915#6367])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-rpls-2/igt@i915_selftest@[email protected]
- bat-adln-1: NOTRUN -> [DMESG-FAIL][17] ([i915#6997])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-adln-1/igt@i915_selftest@[email protected]

* igt@i915_suspend@basic-s3-without-i915:
- bat-adln-1: NOTRUN -> [DMESG-WARN][18] ([i915#2867])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-adln-1/igt@[email protected]

* igt@kms_chamelium_frames@hdmi-crc-fast:
- fi-kbl-soraka: NOTRUN -> [SKIP][19] ([fdo#109271]) +16 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/fi-kbl-soraka/igt@[email protected]

* igt@kms_chamelium_hpd@common-hpd-after-suspend:
- bat-rpls-2: NOTRUN -> [SKIP][20] ([i915#7828])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-rpls-2/igt@[email protected]
- bat-adln-1: NOTRUN -> [SKIP][21] ([i915#7828])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-adln-1/igt@[email protected]

* igt@kms_chamelium_hpd@dp-hpd-fast:
- bat-adlp-6: NOTRUN -> [SKIP][22] ([i915#7828]) +8 similar issues
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-adlp-6/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- bat-adlp-6: NOTRUN -> [SKIP][23] ([i915#4103]) +1 similar issue
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-adlp-6/igt@[email protected]

* igt@kms_force_connector_basic@force-load-detect:
- bat-adlp-6: NOTRUN -> [SKIP][24] ([fdo#109285])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-adlp-6/igt@[email protected]

* igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence:
- bat-dg2-11: NOTRUN -> [SKIP][25] ([i915#5354]) +2 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-dg2-11/igt@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc:
- bat-rpls-2: NOTRUN -> [SKIP][26] ([i915#1845])
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-rpls-2/igt@[email protected]

* igt@kms_psr@primary_page_flip:
- fi-pnv-d510: NOTRUN -> [SKIP][27] ([fdo#109271]) +38 similar issues
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/fi-pnv-d510/igt@kms_psr@primary_page_flip.html

* igt@kms_setmode@basic-clone-single-crtc:
- bat-adlp-6: NOTRUN -> [SKIP][28] ([i915#3555] / [i915#4579])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-adlp-6/igt@[email protected]

* igt@prime_vgem@basic-fence-read:
- bat-adlp-6: NOTRUN -> [SKIP][29] ([fdo#109295] / [i915#3291] / [i915#3708]) +2 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-adlp-6/igt@[email protected]

* igt@prime_vgem@basic-userptr:
- bat-adlp-6: NOTRUN -> [SKIP][30] ([fdo#109295] / [i915#3301] / [i915#3708])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-adlp-6/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live@gt_lrc:
- bat-adln-1: [INCOMPLETE][31] ([i915#7609]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12773/bat-adln-1/igt@i915_selftest@live@gt_lrc.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-adln-1/igt@i915_selftest@live@gt_lrc.html

* igt@i915_selftest@live@reset:
- bat-rpls-2: [ABORT][33] ([i915#4983]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12773/bat-rpls-2/igt@i915_selftest@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/bat-rpls-2/igt@i915_selftest@[email protected]

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2867]: https://gitlab.freedesktop.org/drm/intel/issues/2867
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
[i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6997]: https://gitlab.freedesktop.org/drm/intel/issues/6997
[i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
[i915#7609]: https://gitlab.freedesktop.org/drm/intel/issues/7609
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#7872]: https://gitlab.freedesktop.org/drm/intel/issues/7872
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913

Build changes
-------------

* Linux: CI_DRM_12773 -> Patchwork_114299v1

CI-20190529: 20190529
CI_DRM_12773: f6ae81bcb627d2c528675f0207a052868ca2857e @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7170: e6d15f2d2f299ce70206a40609bebf661f7fdc65 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_114299v1: f6ae81bcb627d2c528675f0207a052868ca2857e @ git://anongit.freedesktop.org/gfx-ci/linux

### Linux commits

03ae521e8da6 drm/radeon: Use the drm suballocation manager implementation. 384587f0d33d drm/amd: Convert amdgpu to use suballocation helper. 07522e766c9c drm/suballoc: Extract amdgpu_sa.c as generic suballocation helper

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_114299v1/index.html