If in doubt, say "N".
 
+config DRM_USE_DYNAMIC_DEBUG
+       bool "use dynamic debug to implement drm.debug"
+       default y
+       depends on DRM
+       depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE
+       depends on JUMP_LABEL
+       help
+         Use dynamic-debug to avoid drm_debug_enabled() runtime overheads.
+         Due to callsite counts in DRM drivers (~4k in amdgpu) and 56
+         bytes per callsite, the .data costs can be substantial, and
+         are therefore configurable.
+
 config DRM_DEBUG_SELFTEST
        tristate "kselftests for DRM"
        depends on DRM
 
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
+CFLAGS-$(CONFIG_DRM_USE_DYNAMIC_DEBUG) += -DDYNAMIC_DEBUG_MODULE
+
 drm-y       := drm_aperture.o drm_auth.o drm_cache.o \
                drm_file.o drm_gem.o drm_ioctl.o \
                drm_drv.o \
 
        }                                                               \
 })
 
+#if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
 #define drm_dev_dbg(dev, cat, fmt, ...)                                \
        __drm_dev_dbg(dev, cat, fmt, ##__VA_ARGS__)
+#else
+#define drm_dev_dbg(dev, cat, fmt, ...)                                \
+       _dynamic_func_call_no_desc(fmt, __drm_dev_dbg,                  \
+                                  dev, cat, fmt, ##__VA_ARGS__)
+#endif
 
 /**
  * DRM_DEV_DEBUG() - Debug output for generic drm code
 __printf(1, 2)
 void __drm_err(const char *format, ...);
 
+#if !defined(CONFIG_DRM_USE_DYNAMIC_DEBUG)
 #define __drm_dbg(fmt, ...)            ___drm_dbg(fmt, ##__VA_ARGS__)
+#else
+#define __drm_dbg(cat, fmt, ...)                                       \
+       _dynamic_func_call_no_desc(fmt, ___drm_dbg,                     \
+                                  cat, fmt, ##__VA_ARGS__)
+#endif
 
 /* Macros to make printk easier */