Skip to content

Commit 7b6db17

Browse files
committed
drm/xe: Normalize default param values
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lucas De Marchi <[email protected]>
1 parent 81e139d commit 7b6db17

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

drivers/gpu/drm/xe/xe_module.c

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,40 @@
1919
#include "xe_sched_job.h"
2020

2121
#if IS_ENABLED(CONFIG_DRM_XE_DEBUG)
22-
#define DEFAULT_GUC_LOG_LEVEL 3
22+
#define DEFAULT_GUC_LOG_LEVEL 3
2323
#else
24-
#define DEFAULT_GUC_LOG_LEVEL 1
24+
#define DEFAULT_GUC_LOG_LEVEL 1
2525
#endif
2626

27+
#define DEFAULT_PROBE_DISPLAY true
28+
#define DEFAULT_VRAM_BAR_SIZE 0
29+
#define DEFAULT_FORCE_PROBE CONFIG_DRM_XE_FORCE_PROBE
30+
#define DEFAULT_WEDGED_MODE 1
31+
#define DEFAULT_SVM_NOTIFIER_SIZE 512
32+
2733
struct xe_modparam xe_modparam = {
28-
.probe_display = true,
29-
.guc_log_level = DEFAULT_GUC_LOG_LEVEL,
30-
.force_probe = CONFIG_DRM_XE_FORCE_PROBE,
31-
.wedged_mode = 1,
32-
.svm_notifier_size = 512,
34+
.probe_display = DEFAULT_PROBE_DISPLAY,
35+
.guc_log_level = DEFAULT_GUC_LOG_LEVEL,
36+
.force_probe = DEFAULT_FORCE_PROBE,
37+
.wedged_mode = DEFAULT_WEDGED_MODE,
38+
.svm_notifier_size = DEFAULT_SVM_NOTIFIER_SIZE,
3339
/* the rest are 0 by default */
3440
};
3541

3642
module_param_named(svm_notifier_size, xe_modparam.svm_notifier_size, uint, 0600);
37-
MODULE_PARM_DESC(svm_notifier_size, "Set the svm notifier size(in MiB), must be power of 2");
43+
MODULE_PARM_DESC(svm_notifier_size, "Set the svm notifier size in MiB, must be power of 2 "
44+
"[default=" __stringify(DEFAULT_SVM_NOTIFIER_SIZE) "]");
3845

3946
module_param_named_unsafe(force_execlist, xe_modparam.force_execlist, bool, 0444);
4047
MODULE_PARM_DESC(force_execlist, "Force Execlist submission");
4148

4249
module_param_named(probe_display, xe_modparam.probe_display, bool, 0444);
43-
MODULE_PARM_DESC(probe_display, "Probe display HW, otherwise it's left untouched (default: true)");
50+
MODULE_PARM_DESC(probe_display, "Probe display HW, otherwise it's left untouched "
51+
"[default=" __stringify(DEFAULT_PROBE_DISPLAY) "])");
4452

4553
module_param_named(vram_bar_size, xe_modparam.force_vram_bar_size, int, 0600);
46-
MODULE_PARM_DESC(vram_bar_size, "Set the vram bar size (in MiB) - <0=disable-resize, 0=max-needed-size[default], >0=force-size");
54+
MODULE_PARM_DESC(vram_bar_size, "Set the vram bar size in MiB (<0=disable-resize, 0=max-needed-size, >0=force-size "
55+
"[default=" __stringify(DEFAULT_VRAM_BAR_SIZE) "])");
4756

4857
module_param_named(guc_log_level, xe_modparam.guc_log_level, int, 0600);
4958
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,
6372

6473
module_param_named_unsafe(force_probe, xe_modparam.force_probe, charp, 0400);
6574
MODULE_PARM_DESC(force_probe,
66-
"Force probe options for specified devices. See CONFIG_DRM_XE_FORCE_PROBE for details.");
75+
"Force probe options for specified devices. See CONFIG_DRM_XE_FORCE_PROBE for details "
76+
"[default=" DEFAULT_FORCE_PROBE "])");
6777

6878
#ifdef CONFIG_PCI_IOV
6979
module_param_named(max_vfs, xe_modparam.max_vfs, uint, 0400);
@@ -74,7 +84,8 @@ MODULE_PARM_DESC(max_vfs,
7484

7585
module_param_named_unsafe(wedged_mode, xe_modparam.wedged_mode, int, 0600);
7686
MODULE_PARM_DESC(wedged_mode,
77-
"Module's default policy for the wedged mode - 0=never, 1=upon-critical-errors[default], 2=upon-any-hang");
87+
"Module's default policy for the wedged mode (0=never, 1=upon-critical-errors, 2=upon-any-hang "
88+
"[default=" __stringify(DEFAULT_WEDGED_MODE) "])");
7889

7990
static int xe_check_nomodeset(void)
8091
{

0 commit comments

Comments
 (0)