[PATCH v4 57/58] amdxdna: add -DDYNAMIC_DEBUG_MODULE to cflags - RFC

Jim Cromie jim.cromie at gmail.com
Sun Aug 3 03:58:15 UTC 2025


with DRM_USE_DYNAMIC_DEBUG=y now un-BROKEN

for configs like:

  CONFIG_DRM_USE_DYNAMIC_DEBUG=y
  # CONFIG_DYNAMIC_DEBUG is not set
  CONFIG_DYNAMIC_DEBUG_CORE=y

this module gets macro breakage:

                 from ../drivers/accel/amdxdna/aie2_ctx.c:8:
../drivers/accel/amdxdna/aie2_ctx.c: In function ‘aie2_hwctx_restart’:
../include/drm/drm_print.h:578:9: error: implicit declaration of function ‘_dynamic_func_call_cls’ [-Wimplicit-function-declaration]
  578 |         _dynamic_func_call_cls(cat, fmt, __drm_dev_dbg,         \
      |         ^~~~~~~~~~~~~~~~~~~~~~
../include/drm/drm_print.h:663:9: note: in expansion of macro ‘drm_dev_dbg’
  663 |         drm_dev_dbg(__drm_to_dev(drm), DRM_UT_DRIVER, fmt, ##__VA_ARGS__)
      |         ^~~~~~~~~~~
../include/drm/drm_print.h:681:33: note: in expansion of macro ‘drm_dbg_driver’
  681 | #define drm_dbg(drm, fmt, ...)  drm_dbg_driver(drm, fmt, ##__VA_ARGS__)
      |                                 ^~~~~~~~~~~~~~
../drivers/accel/amdxdna/amdxdna_pci_drv.h:15:41: note: in expansion of macro ‘drm_dbg’
   15 | #define XDNA_DBG(xdna, fmt, args...)    drm_dbg(&(xdna)->ddev, fmt, ##args)
      |                                         ^~~~~~~
../drivers/accel/amdxdna/aie2_ctx.c:76:17: note: in expansion of macro ‘XDNA_DBG’
   76 |                 XDNA_DBG(xdna, "hwctx is not ready, status %d", hwctx->status);
      |                 ^~~~~~~~

These sources include drm_print.h, which includes dynamic_debug.h and
then checks DRM_USE_DYNAMIC_DEBUG, to decide if drm_dbg() rides on
dynamic-debug underneath.

DRM_USE_DYNAMIC_DEBUG is possible with DYNAMIC_DEBUG_CORE alone, but
dynamic_debug.h also requires DYNAMIC_DEBUG_MODULE before defining
those macros above.

drm/Makefile adds this to cflags on behalf of all drivers, do so for
this driver.  TBC: do subdir-cflags in drivers/accel/Makefile instead,
for all accel/* modules.

RFC: Maybe decouple from DRM, at least the DRM_USE_DYNAMIC_DEBUG
itself (ie just CONFIG_DYNAMIC_DEBUG_CORE).  Its not obvious that
XDNA_DBG should be categorized with DRM_UT_DRIVER by default.

Do we need a new DRM_UT_ACCEL category ?

Reported-by: kernel test robot <lkp at intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202508012015.2l89ZOLg-lkp@intel.com/
CC: Jason Baron <jbaron at akamai.com>
CC: Min Ma <min.ma at amd.com>
CC: Lizhi Hou <lizhi.hou at amd.com>
CC: Oded Gabbay <ogabbay at kernel.org>
CC: dri-devel at lists.freedesktop.org
CC: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
CC: Maxime Ripard <mripard at kernel.org>
CC: Thomas Zimmermann <tzimmermann at suse.de>
CC: David Airlie <airlied at gmail.com>
CC: Simona Vetter <simona at ffwll.ch>

Signed-off-by: Jim Cromie <jim.cromie at gmail.com>
---
 drivers/accel/amdxdna/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/accel/amdxdna/Makefile b/drivers/accel/amdxdna/Makefile
index 0e9adf6890a01..800f81f5a7023 100644
--- a/drivers/accel/amdxdna/Makefile
+++ b/drivers/accel/amdxdna/Makefile
@@ -1,5 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
+ccflags-$(CONFIG_DYNAMIC_DEBUG_CORE) += -DDYNAMIC_DEBUG_MODULE
+
 amdxdna-y := \
 	aie2_ctx.o \
 	aie2_error.o \
-- 
2.50.1



More information about the amd-gfx mailing list