| .. | .. |
|---|
| 35 | 35 | MODULE_PARM_DESC(name, desc) |
|---|
| 36 | 36 | |
|---|
| 37 | 37 | struct i915_params i915_modparams __read_mostly = { |
|---|
| 38 | | -#define MEMBER(T, member, value) .member = (value), |
|---|
| 38 | +#define MEMBER(T, member, value, ...) .member = (value), |
|---|
| 39 | 39 | I915_PARAMS_FOR_EACH(MEMBER) |
|---|
| 40 | 40 | #undef MEMBER |
|---|
| 41 | 41 | }; |
|---|
| 42 | + |
|---|
| 43 | +/* |
|---|
| 44 | + * Note: As a rule, keep module parameter sysfs permissions read-only |
|---|
| 45 | + * 0400. Runtime changes are only supported through i915 debugfs. |
|---|
| 46 | + * |
|---|
| 47 | + * For any exceptions requiring write access and runtime changes through module |
|---|
| 48 | + * parameter sysfs, prevent debugfs file creation by setting the parameter's |
|---|
| 49 | + * debugfs mode to 0. |
|---|
| 50 | + */ |
|---|
| 42 | 51 | |
|---|
| 43 | 52 | i915_param_named(modeset, int, 0400, |
|---|
| 44 | 53 | "Use kernel modesetting [KMS] (0=disable, " |
|---|
| .. | .. |
|---|
| 46 | 55 | |
|---|
| 47 | 56 | i915_param_named_unsafe(enable_dc, int, 0400, |
|---|
| 48 | 57 | "Enable power-saving display C-states. " |
|---|
| 49 | | - "(-1=auto [default]; 0=disable; 1=up to DC5; 2=up to DC6)"); |
|---|
| 58 | + "(-1=auto [default]; 0=disable; 1=up to DC5; 2=up to DC6; " |
|---|
| 59 | + "3=up to DC5 with DC3CO; 4=up to DC6 with DC3CO)"); |
|---|
| 50 | 60 | |
|---|
| 51 | | -i915_param_named_unsafe(enable_fbc, int, 0600, |
|---|
| 61 | +i915_param_named_unsafe(enable_fbc, int, 0400, |
|---|
| 52 | 62 | "Enable frame buffer compression for power savings " |
|---|
| 53 | 63 | "(default: -1 (use per-chip default))"); |
|---|
| 54 | 64 | |
|---|
| .. | .. |
|---|
| 56 | 66 | "Specify LVDS channel mode " |
|---|
| 57 | 67 | "(0=probe BIOS [default], 1=single-channel, 2=dual-channel)"); |
|---|
| 58 | 68 | |
|---|
| 59 | | -i915_param_named_unsafe(panel_use_ssc, int, 0600, |
|---|
| 69 | +i915_param_named_unsafe(panel_use_ssc, int, 0400, |
|---|
| 60 | 70 | "Use Spread Spectrum Clock with panels [LVDS/eDP] " |
|---|
| 61 | 71 | "(default: auto from VBT)"); |
|---|
| 62 | 72 | |
|---|
| .. | .. |
|---|
| 64 | 74 | "Override/Ignore selection of SDVO panel mode in the VBT " |
|---|
| 65 | 75 | "(-2=ignore, -1=auto [default], index in VBT BIOS table)"); |
|---|
| 66 | 76 | |
|---|
| 67 | | -i915_param_named_unsafe(reset, int, 0600, |
|---|
| 77 | +i915_param_named_unsafe(reset, uint, 0400, |
|---|
| 68 | 78 | "Attempt GPU resets (0=disabled, 1=full gpu reset, 2=engine reset [default])"); |
|---|
| 69 | 79 | |
|---|
| 70 | 80 | i915_param_named_unsafe(vbt_firmware, charp, 0400, |
|---|
| 71 | 81 | "Load VBT from specified file under /lib/firmware"); |
|---|
| 72 | 82 | |
|---|
| 73 | 83 | #if IS_ENABLED(CONFIG_DRM_I915_CAPTURE_ERROR) |
|---|
| 74 | | -i915_param_named(error_capture, bool, 0600, |
|---|
| 84 | +i915_param_named(error_capture, bool, 0400, |
|---|
| 75 | 85 | "Record the GPU state following a hang. " |
|---|
| 76 | 86 | "This information in /sys/class/drm/card<N>/error is vital for " |
|---|
| 77 | 87 | "triaging and debugging hangs."); |
|---|
| 78 | 88 | #endif |
|---|
| 79 | 89 | |
|---|
| 80 | | -i915_param_named_unsafe(enable_hangcheck, bool, 0644, |
|---|
| 90 | +i915_param_named_unsafe(enable_hangcheck, bool, 0400, |
|---|
| 81 | 91 | "Periodically check GPU activity for detecting hangs. " |
|---|
| 82 | 92 | "WARNING: Disabling this can cause system wide hangs. " |
|---|
| 83 | 93 | "(default: true)"); |
|---|
| 84 | 94 | |
|---|
| 85 | | -i915_param_named_unsafe(enable_ppgtt, int, 0400, |
|---|
| 86 | | - "Override PPGTT usage. " |
|---|
| 87 | | - "(-1=auto [default], 0=disabled, 1=aliasing, 2=full, 3=full with extended address space)"); |
|---|
| 88 | | - |
|---|
| 89 | | -i915_param_named_unsafe(enable_psr, int, 0600, |
|---|
| 95 | +i915_param_named_unsafe(enable_psr, int, 0400, |
|---|
| 90 | 96 | "Enable PSR " |
|---|
| 91 | 97 | "(0=disabled, 1=enabled) " |
|---|
| 92 | 98 | "Default: -1 (use per-chip default)"); |
|---|
| 93 | 99 | |
|---|
| 94 | | -i915_param_named_unsafe(alpha_support, bool, 0400, |
|---|
| 95 | | - "Enable alpha quality driver support for latest hardware. " |
|---|
| 96 | | - "See also CONFIG_DRM_I915_ALPHA_SUPPORT."); |
|---|
| 100 | +i915_param_named(psr_safest_params, bool, 0400, |
|---|
| 101 | + "Replace PSR VBT parameters by the safest and not optimal ones. This " |
|---|
| 102 | + "is helpful to detect if PSR issues are related to bad values set in " |
|---|
| 103 | + " VBT. (0=use VBT parameters, 1=use safest parameters)"); |
|---|
| 104 | + |
|---|
| 105 | +i915_param_named_unsafe(enable_psr2_sel_fetch, bool, 0400, |
|---|
| 106 | + "Enable PSR2 selective fetch " |
|---|
| 107 | + "(0=disabled, 1=enabled) " |
|---|
| 108 | + "Default: 0"); |
|---|
| 109 | + |
|---|
| 110 | +i915_param_named_unsafe(force_probe, charp, 0400, |
|---|
| 111 | + "Force probe the driver for specified devices. " |
|---|
| 112 | + "See CONFIG_DRM_I915_FORCE_PROBE for details."); |
|---|
| 97 | 113 | |
|---|
| 98 | 114 | i915_param_named_unsafe(disable_power_well, int, 0400, |
|---|
| 99 | 115 | "Disable display power wells when possible " |
|---|
| 100 | 116 | "(-1=auto [default], 0=power wells always on, 1=power wells disabled when possible)"); |
|---|
| 101 | 117 | |
|---|
| 102 | | -i915_param_named_unsafe(enable_ips, int, 0600, "Enable IPS (default: true)"); |
|---|
| 118 | +i915_param_named_unsafe(enable_ips, int, 0400, "Enable IPS (default: true)"); |
|---|
| 103 | 119 | |
|---|
| 104 | | -i915_param_named(fastboot, bool, 0600, |
|---|
| 105 | | - "Try to skip unnecessary mode sets at boot time (default: false)"); |
|---|
| 120 | +i915_param_named(fastboot, int, 0400, |
|---|
| 121 | + "Try to skip unnecessary mode sets at boot time " |
|---|
| 122 | + "(0=disabled, 1=enabled) " |
|---|
| 123 | + "Default: -1 (use per-chip default)"); |
|---|
| 106 | 124 | |
|---|
| 107 | | -i915_param_named_unsafe(prefault_disable, bool, 0600, |
|---|
| 108 | | - "Disable page prefaulting for pread/pwrite/reloc (default:false). " |
|---|
| 109 | | - "For developers only."); |
|---|
| 110 | | - |
|---|
| 111 | | -i915_param_named_unsafe(load_detect_test, bool, 0600, |
|---|
| 125 | +i915_param_named_unsafe(load_detect_test, bool, 0400, |
|---|
| 112 | 126 | "Force-enable the VGA load detect code for testing (default:false). " |
|---|
| 113 | 127 | "For developers only."); |
|---|
| 114 | 128 | |
|---|
| 115 | | -i915_param_named_unsafe(force_reset_modeset_test, bool, 0600, |
|---|
| 129 | +i915_param_named_unsafe(force_reset_modeset_test, bool, 0400, |
|---|
| 116 | 130 | "Force a modeset during gpu reset for testing (default:false). " |
|---|
| 117 | 131 | "For developers only."); |
|---|
| 118 | 132 | |
|---|
| 119 | | -i915_param_named_unsafe(invert_brightness, int, 0600, |
|---|
| 133 | +i915_param_named_unsafe(invert_brightness, int, 0400, |
|---|
| 120 | 134 | "Invert backlight brightness " |
|---|
| 121 | 135 | "(-1 force normal, 0 machine defaults, 1 force inversion), please " |
|---|
| 122 | 136 | "report PCI device ID, subsystem vendor and subsystem device ID " |
|---|
| .. | .. |
|---|
| 126 | 140 | i915_param_named(disable_display, bool, 0400, |
|---|
| 127 | 141 | "Disable display (default: false)"); |
|---|
| 128 | 142 | |
|---|
| 129 | | -i915_param_named(mmio_debug, int, 0600, |
|---|
| 143 | +i915_param_named(mmio_debug, int, 0400, |
|---|
| 130 | 144 | "Enable the MMIO debug code for the first N failures (default: off). " |
|---|
| 131 | 145 | "This may negatively affect performance."); |
|---|
| 132 | 146 | |
|---|
| 147 | +/* Special case writable file */ |
|---|
| 133 | 148 | i915_param_named(verbose_state_checks, bool, 0600, |
|---|
| 134 | 149 | "Enable verbose logs (ie. WARN_ON()) in case of unexpected hw state conditions."); |
|---|
| 135 | 150 | |
|---|
| .. | .. |
|---|
| 160 | 175 | i915_param_named_unsafe(dmc_firmware_path, charp, 0400, |
|---|
| 161 | 176 | "DMC firmware path to use instead of the default one"); |
|---|
| 162 | 177 | |
|---|
| 163 | | -i915_param_named_unsafe(enable_dp_mst, bool, 0600, |
|---|
| 178 | +i915_param_named_unsafe(enable_dp_mst, bool, 0400, |
|---|
| 164 | 179 | "Enable multi-stream transport (MST) for new DisplayPort sinks. (default: true)"); |
|---|
| 165 | 180 | |
|---|
| 166 | 181 | #if IS_ENABLED(CONFIG_DRM_I915_DEBUG) |
|---|
| 167 | | -i915_param_named_unsafe(inject_load_failure, uint, 0400, |
|---|
| 182 | +i915_param_named_unsafe(inject_probe_failure, uint, 0400, |
|---|
| 168 | 183 | "Force an error after a number of failure check points (0:disabled (default), N:force failure at the Nth failure check point)"); |
|---|
| 169 | 184 | #endif |
|---|
| 170 | 185 | |
|---|
| 171 | | -i915_param_named(enable_dpcd_backlight, bool, 0600, |
|---|
| 172 | | - "Enable support for DPCD backlight control (default:false)"); |
|---|
| 186 | +i915_param_named(enable_dpcd_backlight, int, 0400, |
|---|
| 187 | + "Enable support for DPCD backlight control" |
|---|
| 188 | + "(-1=use per-VBT LFP backlight type setting [default], 0=disabled, 1=enabled)"); |
|---|
| 173 | 189 | |
|---|
| 190 | +#if IS_ENABLED(CONFIG_DRM_I915_GVT) |
|---|
| 174 | 191 | i915_param_named(enable_gvt, bool, 0400, |
|---|
| 175 | 192 | "Enable support for Intel GVT-g graphics virtualization host support(default:false)"); |
|---|
| 193 | +#endif |
|---|
| 194 | + |
|---|
| 195 | +#if IS_ENABLED(CONFIG_DRM_I915_UNSTABLE_FAKE_LMEM) |
|---|
| 196 | +i915_param_named_unsafe(fake_lmem_start, ulong, 0400, |
|---|
| 197 | + "Fake LMEM start offset (default: 0)"); |
|---|
| 198 | +#endif |
|---|
| 176 | 199 | |
|---|
| 177 | 200 | static __always_inline void _print_param(struct drm_printer *p, |
|---|
| 178 | 201 | const char *name, |
|---|
| .. | .. |
|---|
| 185 | 208 | drm_printf(p, "i915.%s=%d\n", name, *(const int *)x); |
|---|
| 186 | 209 | else if (!__builtin_strcmp(type, "unsigned int")) |
|---|
| 187 | 210 | drm_printf(p, "i915.%s=%u\n", name, *(const unsigned int *)x); |
|---|
| 211 | + else if (!__builtin_strcmp(type, "unsigned long")) |
|---|
| 212 | + drm_printf(p, "i915.%s=%lu\n", name, *(const unsigned long *)x); |
|---|
| 188 | 213 | else if (!__builtin_strcmp(type, "char *")) |
|---|
| 189 | 214 | drm_printf(p, "i915.%s=%s\n", name, *(const char **)x); |
|---|
| 190 | 215 | else |
|---|
| 191 | | - BUILD_BUG(); |
|---|
| 216 | + WARN_ONCE(1, "no printer defined for param type %s (i915.%s)\n", |
|---|
| 217 | + type, name); |
|---|
| 192 | 218 | } |
|---|
| 193 | 219 | |
|---|
| 194 | 220 | /** |
|---|
| .. | .. |
|---|
| 204 | 230 | I915_PARAMS_FOR_EACH(PRINT); |
|---|
| 205 | 231 | #undef PRINT |
|---|
| 206 | 232 | } |
|---|
| 233 | + |
|---|
| 234 | +static __always_inline void dup_param(const char *type, void *x) |
|---|
| 235 | +{ |
|---|
| 236 | + if (!__builtin_strcmp(type, "char *")) |
|---|
| 237 | + *(void **)x = kstrdup(*(void **)x, GFP_ATOMIC); |
|---|
| 238 | +} |
|---|
| 239 | + |
|---|
| 240 | +void i915_params_copy(struct i915_params *dest, const struct i915_params *src) |
|---|
| 241 | +{ |
|---|
| 242 | + *dest = *src; |
|---|
| 243 | +#define DUP(T, x, ...) dup_param(#T, &dest->x); |
|---|
| 244 | + I915_PARAMS_FOR_EACH(DUP); |
|---|
| 245 | +#undef DUP |
|---|
| 246 | +} |
|---|
| 247 | + |
|---|
| 248 | +static __always_inline void free_param(const char *type, void *x) |
|---|
| 249 | +{ |
|---|
| 250 | + if (!__builtin_strcmp(type, "char *")) { |
|---|
| 251 | + kfree(*(void **)x); |
|---|
| 252 | + *(void **)x = NULL; |
|---|
| 253 | + } |
|---|
| 254 | +} |
|---|
| 255 | + |
|---|
| 256 | +/* free the allocated members, *not* the passed in params itself */ |
|---|
| 257 | +void i915_params_free(struct i915_params *params) |
|---|
| 258 | +{ |
|---|
| 259 | +#define FREE(T, x, ...) free_param(#T, ¶ms->x); |
|---|
| 260 | + I915_PARAMS_FOR_EACH(FREE); |
|---|
| 261 | +#undef FREE |
|---|
| 262 | +} |
|---|