]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe: Normalize default param values
authorLucas De Marchi <lucas.demarchi@intel.com>
Thu, 26 Jun 2025 21:25:53 +0000 (14:25 -0700)
committerLucas De Marchi <lucas.demarchi@intel.com>
Fri, 11 Jul 2025 19:56:38 +0000 (12:56 -0700)
Document xe module params with the default values following a similar
strategy for all of them:

1) Define a DEFAULT_* macro with the default value. When the
   value can't be directly stringified, also define a *_STR
   variant
2) Use __stringify() or the _STR variant to make sure the
   default value shows up in the param description

This allows us to show the correct default according to the
configuration. max_vfs for example was wrongly documented for
CONFIG_DRM_XE_DEBUG and svm_notifier_size didn't have its default
documented.

Reviewed-by: John Harrison <John.C.Harrison@Intel.com>
Link: https://lore.kernel.org/r/20250626-guc-log-level-v3-1-c3ed8b452e91@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
drivers/gpu/drm/xe/xe_module.c

index e332f3142435e2efc279b1ef44346fadbcfce7c4..107ffe87808c54229b308047f03d0d65651517bb 100644 (file)
 #include "xe_sched_job.h"
 
 #if IS_ENABLED(CONFIG_DRM_XE_DEBUG)
-#define DEFAULT_GUC_LOG_LEVEL  3
+#define DEFAULT_GUC_LOG_LEVEL          3
 #else
-#define DEFAULT_GUC_LOG_LEVEL  1
+#define DEFAULT_GUC_LOG_LEVEL          1
 #endif
 
+#define DEFAULT_PROBE_DISPLAY          true
+#define DEFAULT_VRAM_BAR_SIZE          0
+#define DEFAULT_FORCE_PROBE            CONFIG_DRM_XE_FORCE_PROBE
+#define DEFAULT_WEDGED_MODE            1
+#define DEFAULT_SVM_NOTIFIER_SIZE      512
+
 struct xe_modparam xe_modparam = {
-       .probe_display = true,
-       .guc_log_level = DEFAULT_GUC_LOG_LEVEL,
-       .force_probe = CONFIG_DRM_XE_FORCE_PROBE,
-       .wedged_mode = 1,
-       .svm_notifier_size = 512,
+       .probe_display =        DEFAULT_PROBE_DISPLAY,
+       .guc_log_level =        DEFAULT_GUC_LOG_LEVEL,
+       .force_probe =          DEFAULT_FORCE_PROBE,
+       .wedged_mode =          DEFAULT_WEDGED_MODE,
+       .svm_notifier_size =    DEFAULT_SVM_NOTIFIER_SIZE,
        /* the rest are 0 by default */
 };
 
 module_param_named(svm_notifier_size, xe_modparam.svm_notifier_size, uint, 0600);
-MODULE_PARM_DESC(svm_notifier_size, "Set the svm notifier size(in MiB), must be power of 2");
+MODULE_PARM_DESC(svm_notifier_size, "Set the svm notifier size in MiB, must be power of 2 "
+                "[default=" __stringify(DEFAULT_SVM_NOTIFIER_SIZE) "]");
 
 module_param_named_unsafe(force_execlist, xe_modparam.force_execlist, bool, 0444);
 MODULE_PARM_DESC(force_execlist, "Force Execlist submission");
 
 module_param_named(probe_display, xe_modparam.probe_display, bool, 0444);
-MODULE_PARM_DESC(probe_display, "Probe display HW, otherwise it's left untouched (default: true)");
+MODULE_PARM_DESC(probe_display, "Probe display HW, otherwise it's left untouched "
+                "[default=" __stringify(DEFAULT_PROBE_DISPLAY) "])");
 
 module_param_named(vram_bar_size, xe_modparam.force_vram_bar_size, int, 0600);
-MODULE_PARM_DESC(vram_bar_size, "Set the vram bar size (in MiB) - <0=disable-resize, 0=max-needed-size[default], >0=force-size");
+MODULE_PARM_DESC(vram_bar_size, "Set the vram bar size in MiB (<0=disable-resize, 0=max-needed-size, >0=force-size "
+                "[default=" __stringify(DEFAULT_VRAM_BAR_SIZE) "])");
 
 module_param_named(guc_log_level, xe_modparam.guc_log_level, int, 0600);
 MODULE_PARM_DESC(guc_log_level, "GuC firmware logging level (0=disable, 1=normal, 2..5=verbose-levels "
@@ -63,7 +72,8 @@ MODULE_PARM_DESC(gsc_firmware_path,
 
 module_param_named_unsafe(force_probe, xe_modparam.force_probe, charp, 0400);
 MODULE_PARM_DESC(force_probe,
-                "Force probe options for specified devices. See CONFIG_DRM_XE_FORCE_PROBE for details.");
+                "Force probe options for specified devices. See CONFIG_DRM_XE_FORCE_PROBE for details "
+                "[default=" DEFAULT_FORCE_PROBE "])");
 
 #ifdef CONFIG_PCI_IOV
 module_param_named(max_vfs, xe_modparam.max_vfs, uint, 0400);
@@ -74,7 +84,8 @@ MODULE_PARM_DESC(max_vfs,
 
 module_param_named_unsafe(wedged_mode, xe_modparam.wedged_mode, int, 0600);
 MODULE_PARM_DESC(wedged_mode,
-                "Module's default policy for the wedged mode - 0=never, 1=upon-critical-errors[default], 2=upon-any-hang");
+                "Module's default policy for the wedged mode (0=never, 1=upon-critical-errors, 2=upon-any-hang "
+                "[default=" __stringify(DEFAULT_WEDGED_MODE) "])");
 
 static int xe_check_nomodeset(void)
 {