0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 #include <linux/string_helpers.h>
0026
0027 #include <drm/drm_print.h>
0028
0029 #include "i915_params.h"
0030 #include "i915_drv.h"
0031
0032 #define i915_param_named(name, T, perm, desc) \
0033 module_param_named(name, i915_modparams.name, T, perm); \
0034 MODULE_PARM_DESC(name, desc)
0035 #define i915_param_named_unsafe(name, T, perm, desc) \
0036 module_param_named_unsafe(name, i915_modparams.name, T, perm); \
0037 MODULE_PARM_DESC(name, desc)
0038
0039 struct i915_params i915_modparams __read_mostly = {
0040 #define MEMBER(T, member, value, ...) .member = (value),
0041 I915_PARAMS_FOR_EACH(MEMBER)
0042 #undef MEMBER
0043 };
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054 i915_param_named(modeset, int, 0400,
0055 "Use kernel modesetting [KMS] (0=disable, "
0056 "1=on, -1=force vga console preference [default])");
0057
0058 i915_param_named_unsafe(enable_dc, int, 0400,
0059 "Enable power-saving display C-states. "
0060 "(-1=auto [default]; 0=disable; 1=up to DC5; 2=up to DC6; "
0061 "3=up to DC5 with DC3CO; 4=up to DC6 with DC3CO)");
0062
0063 i915_param_named_unsafe(enable_fbc, int, 0400,
0064 "Enable frame buffer compression for power savings "
0065 "(default: -1 (use per-chip default))");
0066
0067 i915_param_named_unsafe(lvds_channel_mode, int, 0400,
0068 "Specify LVDS channel mode "
0069 "(0=probe BIOS [default], 1=single-channel, 2=dual-channel)");
0070
0071 i915_param_named_unsafe(panel_use_ssc, int, 0400,
0072 "Use Spread Spectrum Clock with panels [LVDS/eDP] "
0073 "(default: auto from VBT)");
0074
0075 i915_param_named_unsafe(vbt_sdvo_panel_type, int, 0400,
0076 "Override/Ignore selection of SDVO panel mode in the VBT "
0077 "(-2=ignore, -1=auto [default], index in VBT BIOS table)");
0078
0079 i915_param_named_unsafe(reset, uint, 0400,
0080 "Attempt GPU resets (0=disabled, 1=full gpu reset, 2=engine reset [default])");
0081
0082 i915_param_named_unsafe(vbt_firmware, charp, 0400,
0083 "Load VBT from specified file under /lib/firmware");
0084
0085 #if IS_ENABLED(CONFIG_DRM_I915_CAPTURE_ERROR)
0086 i915_param_named(error_capture, bool, 0400,
0087 "Record the GPU state following a hang. "
0088 "This information in /sys/class/drm/card<N>/error is vital for "
0089 "triaging and debugging hangs.");
0090 #endif
0091
0092 i915_param_named_unsafe(enable_hangcheck, bool, 0400,
0093 "Periodically check GPU activity for detecting hangs. "
0094 "WARNING: Disabling this can cause system wide hangs. "
0095 "(default: true)");
0096
0097 i915_param_named_unsafe(enable_psr, int, 0400,
0098 "Enable PSR "
0099 "(0=disabled, 1=enable up to PSR1, 2=enable up to PSR2) "
0100 "Default: -1 (use per-chip default)");
0101
0102 i915_param_named(psr_safest_params, bool, 0400,
0103 "Replace PSR VBT parameters by the safest and not optimal ones. This "
0104 "is helpful to detect if PSR issues are related to bad values set in "
0105 " VBT. (0=use VBT parameters, 1=use safest parameters)");
0106
0107 i915_param_named_unsafe(enable_psr2_sel_fetch, bool, 0400,
0108 "Enable PSR2 selective fetch "
0109 "(0=disabled, 1=enabled) "
0110 "Default: 0");
0111
0112 i915_param_named_unsafe(force_probe, charp, 0400,
0113 "Force probe the driver for specified devices. "
0114 "See CONFIG_DRM_I915_FORCE_PROBE for details.");
0115
0116 i915_param_named_unsafe(disable_power_well, int, 0400,
0117 "Disable display power wells when possible "
0118 "(-1=auto [default], 0=power wells always on, 1=power wells disabled when possible)");
0119
0120 i915_param_named_unsafe(enable_ips, int, 0400, "Enable IPS (default: true)");
0121
0122 i915_param_named(fastboot, int, 0400,
0123 "Try to skip unnecessary mode sets at boot time "
0124 "(0=disabled, 1=enabled) "
0125 "Default: -1 (use per-chip default)");
0126
0127 i915_param_named_unsafe(load_detect_test, bool, 0400,
0128 "Force-enable the VGA load detect code for testing (default:false). "
0129 "For developers only.");
0130
0131 i915_param_named_unsafe(force_reset_modeset_test, bool, 0400,
0132 "Force a modeset during gpu reset for testing (default:false). "
0133 "For developers only.");
0134
0135 i915_param_named_unsafe(invert_brightness, int, 0400,
0136 "Invert backlight brightness "
0137 "(-1 force normal, 0 machine defaults, 1 force inversion), please "
0138 "report PCI device ID, subsystem vendor and subsystem device ID "
0139 "to dri-devel@lists.freedesktop.org, if your machine needs it. "
0140 "It will then be included in an upcoming module version.");
0141
0142 i915_param_named(disable_display, bool, 0400,
0143 "Disable display (default: false)");
0144
0145 i915_param_named(memtest, bool, 0400,
0146 "Perform a read/write test of all device memory on module load (default: off)");
0147
0148 i915_param_named(mmio_debug, int, 0400,
0149 "Enable the MMIO debug code for the first N failures (default: off). "
0150 "This may negatively affect performance.");
0151
0152
0153 i915_param_named(verbose_state_checks, bool, 0600,
0154 "Enable verbose logs (ie. WARN_ON()) in case of unexpected hw state conditions.");
0155
0156 i915_param_named_unsafe(nuclear_pageflip, bool, 0400,
0157 "Force enable atomic functionality on platforms that don't have full support yet.");
0158
0159
0160 i915_param_named_unsafe(edp_vswing, int, 0400,
0161 "Ignore/Override vswing pre-emph table selection from VBT "
0162 "(0=use value from vbt [default], 1=low power swing(200mV),"
0163 "2=default swing(400mV))");
0164
0165 i915_param_named_unsafe(enable_guc, int, 0400,
0166 "Enable GuC load for GuC submission and/or HuC load. "
0167 "Required functionality can be selected using bitmask values. "
0168 "(-1=auto [default], 0=disable, 1=GuC submission, 2=HuC load)");
0169
0170 i915_param_named(guc_log_level, int, 0400,
0171 "GuC firmware logging level. Requires GuC to be loaded. "
0172 "(-1=auto [default], 0=disable, 1..4=enable with verbosity min..max)");
0173
0174 i915_param_named_unsafe(guc_firmware_path, charp, 0400,
0175 "GuC firmware path to use instead of the default one");
0176
0177 i915_param_named_unsafe(huc_firmware_path, charp, 0400,
0178 "HuC firmware path to use instead of the default one");
0179
0180 i915_param_named_unsafe(dmc_firmware_path, charp, 0400,
0181 "DMC firmware path to use instead of the default one");
0182
0183 i915_param_named_unsafe(enable_dp_mst, bool, 0400,
0184 "Enable multi-stream transport (MST) for new DisplayPort sinks. (default: true)");
0185
0186 #if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
0187 i915_param_named_unsafe(inject_probe_failure, uint, 0400,
0188 "Force an error after a number of failure check points (0:disabled (default), N:force failure at the Nth failure check point)");
0189 #endif
0190
0191 i915_param_named(enable_dpcd_backlight, int, 0400,
0192 "Enable support for DPCD backlight control"
0193 "(-1=use per-VBT LFP backlight type setting [default], 0=disabled, 1=enable, 2=force VESA interface, 3=force Intel interface)");
0194
0195 #if IS_ENABLED(CONFIG_DRM_I915_GVT)
0196 i915_param_named(enable_gvt, bool, 0400,
0197 "Enable support for Intel GVT-g graphics virtualization host support(default:false)");
0198 #endif
0199
0200 #if CONFIG_DRM_I915_REQUEST_TIMEOUT
0201 i915_param_named_unsafe(request_timeout_ms, uint, 0600,
0202 "Default request/fence/batch buffer expiration timeout.");
0203 #endif
0204
0205 i915_param_named_unsafe(lmem_size, uint, 0400,
0206 "Set the lmem size(in MiB) for each region. (default: 0, all memory)");
0207 i915_param_named_unsafe(lmem_bar_size, uint, 0400,
0208 "Set the lmem bar size(in MiB).");
0209
0210 static __always_inline void _print_param(struct drm_printer *p,
0211 const char *name,
0212 const char *type,
0213 const void *x)
0214 {
0215 if (!__builtin_strcmp(type, "bool"))
0216 drm_printf(p, "i915.%s=%s\n", name,
0217 str_yes_no(*(const bool *)x));
0218 else if (!__builtin_strcmp(type, "int"))
0219 drm_printf(p, "i915.%s=%d\n", name, *(const int *)x);
0220 else if (!__builtin_strcmp(type, "unsigned int"))
0221 drm_printf(p, "i915.%s=%u\n", name, *(const unsigned int *)x);
0222 else if (!__builtin_strcmp(type, "unsigned long"))
0223 drm_printf(p, "i915.%s=%lu\n", name, *(const unsigned long *)x);
0224 else if (!__builtin_strcmp(type, "char *"))
0225 drm_printf(p, "i915.%s=%s\n", name, *(const char **)x);
0226 else
0227 WARN_ONCE(1, "no printer defined for param type %s (i915.%s)\n",
0228 type, name);
0229 }
0230
0231
0232
0233
0234
0235
0236
0237
0238 void i915_params_dump(const struct i915_params *params, struct drm_printer *p)
0239 {
0240 #define PRINT(T, x, ...) _print_param(p, #x, #T, ¶ms->x);
0241 I915_PARAMS_FOR_EACH(PRINT);
0242 #undef PRINT
0243 }
0244
0245 static __always_inline void dup_param(const char *type, void *x)
0246 {
0247 if (!__builtin_strcmp(type, "char *"))
0248 *(void **)x = kstrdup(*(void **)x, GFP_ATOMIC);
0249 }
0250
0251 void i915_params_copy(struct i915_params *dest, const struct i915_params *src)
0252 {
0253 *dest = *src;
0254 #define DUP(T, x, ...) dup_param(#T, &dest->x);
0255 I915_PARAMS_FOR_EACH(DUP);
0256 #undef DUP
0257 }
0258
0259 static __always_inline void free_param(const char *type, void *x)
0260 {
0261 if (!__builtin_strcmp(type, "char *")) {
0262 kfree(*(void **)x);
0263 *(void **)x = NULL;
0264 }
0265 }
0266
0267
0268 void i915_params_free(struct i915_params *params)
0269 {
0270 #define FREE(T, x, ...) free_param(#T, ¶ms->x);
0271 I915_PARAMS_FOR_EACH(FREE);
0272 #undef FREE
0273 }