Skip to content

Commit

Permalink
drm/i915/params: switch to device specific parameters
Browse files Browse the repository at this point in the history
Start using device specific parameters instead of module parameters for
most things. The module parameters become the immutable initial values
for i915 parameters. The device specific parameters in i915->params
start life as a copy of i915_modparams. Any later changes are only
reflected in the debugfs.

The stragglers are:

* i915.force_probe and i915.modeset. Needed before dev_priv is
  available. This is fine because the parameters are read-only and never
  modified.

* i915.verbose_state_checks. Passing dev_priv to I915_STATE_WARN and
  I915_STATE_WARN_ON would result in massive and ugly churn. This is
  handled by not exposing the parameter via debugfs, and leaving the
  parameter writable in sysfs. This may be fixed up in follow-up work.

* i915.inject_probe_failure. Only makes sense in terms of the module,
  not the device. This is handled by not exposing the parameter via
  debugfs.

v2: Fix uc i915 lookup code (Michał Winiarski)

Cc: Juha-Pekka Heikkilä <[email protected]>
Cc: Venkata Sandeep Dhanalakota <[email protected]>
Cc: Michał Winiarski <[email protected]>
Reviewed-by: Rodrigo Vivi <[email protected]>
Acked-by: Michał Winiarski <[email protected]>
Signed-off-by: Jani Nikula <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
jnikula committed Jun 22, 2020
1 parent cf46143 commit 8a25c4b
Show file tree
Hide file tree
Showing 30 changed files with 120 additions and 109 deletions.
6 changes: 3 additions & 3 deletions drivers/gpu/drm/i915/display/intel_bios.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ parse_sdvo_panel_data(struct drm_i915_private *dev_priv,
struct drm_display_mode *panel_fixed_mode;
int index;

index = i915_modparams.vbt_sdvo_panel_type;
index = dev_priv->params.vbt_sdvo_panel_type;
if (index == -2) {
drm_dbg_kms(&dev_priv->drm,
"Ignore SDVO panel mode from BIOS VBT tables.\n");
Expand Down Expand Up @@ -829,9 +829,9 @@ parse_edp(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
u8 vswing;

/* Don't read from VBT if module parameter has valid value*/
if (i915_modparams.edp_vswing) {
if (dev_priv->params.edp_vswing) {
dev_priv->vbt.edp.low_vswing =
i915_modparams.edp_vswing == 1;
dev_priv->params.edp_vswing == 1;
} else {
vswing = (edp->edp_vswing_preemph >> (panel_type * 4)) & 0xF;
dev_priv->vbt.edp.low_vswing = vswing == 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/display/intel_crt.c
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ intel_crt_detect(struct drm_connector *connector,
connector->base.id, connector->name,
force);

if (i915_modparams.load_detect_test) {
if (dev_priv->params.load_detect_test) {
wakeref = intel_display_power_get(dev_priv,
intel_encoder->power_domain);
goto load_detect;
Expand Down Expand Up @@ -889,7 +889,7 @@ intel_crt_detect(struct drm_connector *connector,
else if (INTEL_GEN(dev_priv) < 4)
status = intel_crt_load_detect(crt,
to_intel_crtc(connector->state->crtc)->pipe);
else if (i915_modparams.load_detect_test)
else if (dev_priv->params.load_detect_test)
status = connector_status_disconnected;
else
status = connector_status_unknown;
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/i915/display/intel_csr.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,15 +723,15 @@ void intel_csr_ucode_init(struct drm_i915_private *dev_priv)
csr->max_fw_size = BXT_CSR_MAX_FW_SIZE;
}

if (i915_modparams.dmc_firmware_path) {
if (strlen(i915_modparams.dmc_firmware_path) == 0) {
if (dev_priv->params.dmc_firmware_path) {
if (strlen(dev_priv->params.dmc_firmware_path) == 0) {
csr->fw_path = NULL;
drm_info(&dev_priv->drm,
"Disabling CSR firmware and runtime PM\n");
return;
}

csr->fw_path = i915_modparams.dmc_firmware_path;
csr->fw_path = dev_priv->params.dmc_firmware_path;
/* Bypass version check for firmware override. */
csr->required_version = 0;
}
Expand Down
12 changes: 6 additions & 6 deletions drivers/gpu/drm/i915/display/intel_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -4886,7 +4886,7 @@ void intel_prepare_reset(struct drm_i915_private *dev_priv)
int ret;

/* reset doesn't touch the display */
if (!i915_modparams.force_reset_modeset_test &&
if (!dev_priv->params.force_reset_modeset_test &&
!gpu_reset_clobbers_display(dev_priv))
return;

Expand Down Expand Up @@ -7882,7 +7882,7 @@ bool hsw_crtc_state_ips_capable(const struct intel_crtc_state *crtc_state)
if (!hsw_crtc_supports_ips(crtc))
return false;

if (!i915_modparams.enable_ips)
if (!dev_priv->params.enable_ips)
return false;

if (crtc_state->pipe_bpp > 24)
Expand Down Expand Up @@ -8153,8 +8153,8 @@ static void intel_panel_sanitize_ssc(struct drm_i915_private *dev_priv)

static bool intel_panel_use_ssc(struct drm_i915_private *dev_priv)
{
if (i915_modparams.panel_use_ssc >= 0)
return i915_modparams.panel_use_ssc != 0;
if (dev_priv->params.panel_use_ssc >= 0)
return dev_priv->params.panel_use_ssc != 0;
return dev_priv->vbt.lvds_use_ssc
&& !(dev_priv->quirks & QUIRK_LVDS_SSC_DISABLE);
}
Expand Down Expand Up @@ -13585,8 +13585,8 @@ pipe_config_mismatch(bool fastset, const struct intel_crtc *crtc,

static bool fastboot_enabled(struct drm_i915_private *dev_priv)
{
if (i915_modparams.fastboot != -1)
return i915_modparams.fastboot;
if (dev_priv->params.fastboot != -1)
return dev_priv->params.fastboot;

/* Enable fastboot by default on Skylake and newer */
if (INTEL_GEN(dev_priv) >= 9)
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/display/intel_display_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static int i915_ips_status(struct seq_file *m, void *unused)
wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm);

seq_printf(m, "Enabled by kernel parameter: %s\n",
yesno(i915_modparams.enable_ips));
yesno(dev_priv->params.enable_ips));

if (INTEL_GEN(dev_priv) >= 8) {
seq_puts(m, "Currently: unknown\n");
Expand Down
14 changes: 7 additions & 7 deletions drivers/gpu/drm/i915/display/intel_display_power.c
Original file line number Diff line number Diff line change
Expand Up @@ -4513,7 +4513,7 @@ static u32 get_allowed_dc_mask(const struct drm_i915_private *dev_priv,
mask = 0;
}

if (!i915_modparams.disable_power_well)
if (!dev_priv->params.disable_power_well)
max_dc = 0;

if (enable_dc >= 0 && enable_dc <= max_dc) {
Expand Down Expand Up @@ -4602,11 +4602,11 @@ int intel_power_domains_init(struct drm_i915_private *dev_priv)
struct i915_power_domains *power_domains = &dev_priv->power_domains;
int err;

i915_modparams.disable_power_well =
dev_priv->params.disable_power_well =
sanitize_disable_power_well_option(dev_priv,
i915_modparams.disable_power_well);
dev_priv->params.disable_power_well);
dev_priv->csr.allowed_dc_mask =
get_allowed_dc_mask(dev_priv, i915_modparams.enable_dc);
get_allowed_dc_mask(dev_priv, dev_priv->params.enable_dc);

dev_priv->csr.target_dc_state =
sanitize_target_dc_state(dev_priv, DC_STATE_EN_UPTO_DC6);
Expand Down Expand Up @@ -5568,7 +5568,7 @@ void intel_power_domains_init_hw(struct drm_i915_private *i915, bool resume)
intel_display_power_get(i915, POWER_DOMAIN_INIT);

/* Disable power support if the user asked so. */
if (!i915_modparams.disable_power_well)
if (!i915->params.disable_power_well)
intel_display_power_get(i915, POWER_DOMAIN_INIT);
intel_power_domains_sync_hw(i915);

Expand All @@ -5592,7 +5592,7 @@ void intel_power_domains_driver_remove(struct drm_i915_private *i915)
fetch_and_zero(&i915->power_domains.wakeref);

/* Remove the refcount we took to keep power well support disabled. */
if (!i915_modparams.disable_power_well)
if (!i915->params.disable_power_well)
intel_display_power_put_unchecked(i915, POWER_DOMAIN_INIT);

intel_display_power_flush_work_sync(i915);
Expand Down Expand Up @@ -5681,7 +5681,7 @@ void intel_power_domains_suspend(struct drm_i915_private *i915,
* Even if power well support was disabled we still want to disable
* power wells if power domains must be deinitialized for suspend.
*/
if (!i915_modparams.disable_power_well)
if (!i915->params.disable_power_well)
intel_display_power_put_unchecked(i915, POWER_DOMAIN_INIT);

intel_display_power_flush_work(i915);
Expand Down
8 changes: 5 additions & 3 deletions drivers/gpu/drm/i915/display/intel_dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4707,7 +4707,9 @@ intel_dp_sink_can_mst(struct intel_dp *intel_dp)
static bool
intel_dp_can_mst(struct intel_dp *intel_dp)
{
return i915_modparams.enable_dp_mst &&
struct drm_i915_private *i915 = dp_to_i915(intel_dp);

return i915->params.enable_dp_mst &&
intel_dp->can_mst &&
intel_dp_sink_can_mst(intel_dp);
}
Expand All @@ -4724,13 +4726,13 @@ intel_dp_configure_mst(struct intel_dp *intel_dp)
"[ENCODER:%d:%s] MST support: port: %s, sink: %s, modparam: %s\n",
encoder->base.base.id, encoder->base.name,
yesno(intel_dp->can_mst), yesno(sink_can_mst),
yesno(i915_modparams.enable_dp_mst));
yesno(i915->params.enable_dp_mst));

if (!intel_dp->can_mst)
return;

intel_dp->is_mst = sink_can_mst &&
i915_modparams.enable_dp_mst;
i915->params.enable_dp_mst;

drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr,
intel_dp->is_mst);
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector)
struct intel_dp *intel_dp = enc_to_intel_dp(intel_connector->encoder);
struct drm_i915_private *i915 = dp_to_i915(intel_dp);

if (i915_modparams.enable_dpcd_backlight == 0 ||
if (i915->params.enable_dpcd_backlight == 0 ||
!intel_dp_aux_display_control_capable(intel_connector))
return -ENODEV;

Expand All @@ -358,7 +358,7 @@ int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector)
*/
if (i915->vbt.backlight.type !=
INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE &&
i915_modparams.enable_dpcd_backlight != 1 &&
i915->params.enable_dpcd_backlight != 1 &&
!drm_dp_has_quirk(&intel_dp->desc, intel_dp->edid_quirks,
DP_QUIRK_FORCE_DPCD_BACKLIGHT)) {
drm_info(&i915->drm,
Expand Down
12 changes: 6 additions & 6 deletions drivers/gpu/drm/i915/display/intel_fbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ static bool intel_fbc_can_enable(struct drm_i915_private *dev_priv)
return false;
}

if (!i915_modparams.enable_fbc) {
if (!dev_priv->params.enable_fbc) {
fbc->no_fbc_reason = "disabled per module param or by default";
return false;
}
Expand Down Expand Up @@ -1017,7 +1017,7 @@ static void __intel_fbc_post_update(struct intel_crtc *crtc)

fbc->flip_pending = false;

if (!i915_modparams.enable_fbc) {
if (!dev_priv->params.enable_fbc) {
intel_fbc_deactivate(dev_priv, "disabled at runtime per module param");
__intel_fbc_disable(dev_priv);

Expand Down Expand Up @@ -1370,8 +1370,8 @@ void intel_fbc_handle_fifo_underrun_irq(struct drm_i915_private *dev_priv)
*/
static int intel_sanitize_fbc_option(struct drm_i915_private *dev_priv)
{
if (i915_modparams.enable_fbc >= 0)
return !!i915_modparams.enable_fbc;
if (dev_priv->params.enable_fbc >= 0)
return !!dev_priv->params.enable_fbc;

if (!HAS_FBC(dev_priv))
return 0;
Expand Down Expand Up @@ -1415,9 +1415,9 @@ void intel_fbc_init(struct drm_i915_private *dev_priv)
if (need_fbc_vtd_wa(dev_priv))
mkwrite_device_info(dev_priv)->display.has_fbc = false;

i915_modparams.enable_fbc = intel_sanitize_fbc_option(dev_priv);
dev_priv->params.enable_fbc = intel_sanitize_fbc_option(dev_priv);
drm_dbg_kms(&dev_priv->drm, "Sanitized enable_fbc value: %d\n",
i915_modparams.enable_fbc);
dev_priv->params.enable_fbc);

if (!HAS_FBC(dev_priv)) {
fbc->no_fbc_reason = "unsupported by this chipset";
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/display/intel_lvds.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,8 +784,8 @@ static bool compute_is_dual_link_lvds(struct intel_lvds_encoder *lvds_encoder)
struct drm_i915_private *dev_priv = to_i915(dev);

/* use the module option value if specified */
if (i915_modparams.lvds_channel_mode > 0)
return i915_modparams.lvds_channel_mode == 2;
if (dev_priv->params.lvds_channel_mode > 0)
return dev_priv->params.lvds_channel_mode == 2;

/* single channel LVDS is limited to 112 MHz */
if (lvds_encoder->attached_connector->panel.fixed_mode->clock > 112999)
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/display/intel_opregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ static int intel_load_vbt_firmware(struct drm_i915_private *dev_priv)
{
struct intel_opregion *opregion = &dev_priv->opregion;
const struct firmware *fw = NULL;
const char *name = i915_modparams.vbt_firmware;
const char *name = dev_priv->params.vbt_firmware;
int ret;

if (!name || !*name)
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/display/intel_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,10 @@ static u32 intel_panel_compute_brightness(struct intel_connector *connector,

drm_WARN_ON(&dev_priv->drm, panel->backlight.max == 0);

if (i915_modparams.invert_brightness < 0)
if (dev_priv->params.invert_brightness < 0)
return val;

if (i915_modparams.invert_brightness > 0 ||
if (dev_priv->params.invert_brightness > 0 ||
dev_priv->quirks & QUIRK_INVERT_BRIGHTNESS) {
return panel->backlight.max - val + panel->backlight.min;
}
Expand Down
10 changes: 5 additions & 5 deletions drivers/gpu/drm/i915/display/intel_psr.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ static bool psr_global_enabled(struct drm_i915_private *i915)
{
switch (i915->psr.debug & I915_PSR_DEBUG_MODE_MASK) {
case I915_PSR_DEBUG_DEFAULT:
return i915_modparams.enable_psr;
return i915->params.enable_psr;
case I915_PSR_DEBUG_DISABLE:
return false;
default:
Expand Down Expand Up @@ -426,7 +426,7 @@ static u32 intel_psr1_get_tp_time(struct intel_dp *intel_dp)
if (INTEL_GEN(dev_priv) >= 11)
val |= EDP_PSR_TP4_TIME_0US;

if (i915_modparams.psr_safest_params) {
if (dev_priv->params.psr_safest_params) {
val |= EDP_PSR_TP1_TIME_2500us;
val |= EDP_PSR_TP2_TP3_TIME_2500us;
goto check_tp3_sel;
Expand Down Expand Up @@ -507,7 +507,7 @@ static u32 intel_psr2_get_tp_time(struct intel_dp *intel_dp)
struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
u32 val = 0;

if (i915_modparams.psr_safest_params)
if (dev_priv->params.psr_safest_params)
return EDP_PSR2_TP2_TIME_2500us;

if (dev_priv->vbt.psr.psr2_tp2_tp3_wakeup_time_us >= 0 &&
Expand Down Expand Up @@ -1500,9 +1500,9 @@ void intel_psr_init(struct drm_i915_private *dev_priv)
*/
dev_priv->hsw_psr_mmio_adjust = _SRD_CTL_EDP - _HSW_EDP_PSR_BASE;

if (i915_modparams.enable_psr == -1)
if (dev_priv->params.enable_psr == -1)
if (INTEL_GEN(dev_priv) < 9 || !dev_priv->vbt.psr.enable)
i915_modparams.enable_psr = 0;
dev_priv->params.enable_psr = 0;

/* Set link_standby x link_off defaults */
if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/gem/i915_gem_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ static void context_close(struct i915_gem_context *ctx)
* context close.
*/
if (!i915_gem_context_is_persistent(ctx) ||
!i915_modparams.enable_hangcheck)
!ctx->i915->params.enable_hangcheck)
kill_context(ctx);

i915_gem_context_put(ctx);
Expand All @@ -667,7 +667,7 @@ static int __context_set_persistence(struct i915_gem_context *ctx, bool state)
* reset] are allowed to survive past termination. We require
* hangcheck to ensure that the persistent requests are healthy.
*/
if (!i915_modparams.enable_hangcheck)
if (!ctx->i915->params.enable_hangcheck)
return -EINVAL;

i915_gem_context_set_persistence(ctx);
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Copyright © 2019 Intel Corporation
*/

#include "i915_drv.h"
#include "i915_request.h"

#include "intel_context.h"
Expand Down Expand Up @@ -133,7 +134,7 @@ static void heartbeat(struct work_struct *wrk)
goto unlock;

idle_pulse(engine, rq);
if (i915_modparams.enable_hangcheck)
if (engine->i915->params.enable_hangcheck)
engine->heartbeat.systole = i915_request_get(rq);

__i915_request_commit(rq);
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/i915/gt/intel_reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,15 +638,15 @@ int __intel_gt_reset(struct intel_gt *gt, intel_engine_mask_t engine_mask)

bool intel_has_gpu_reset(const struct intel_gt *gt)
{
if (!i915_modparams.reset)
if (!gt->i915->params.reset)
return NULL;

return intel_get_gpu_reset(gt);
}

bool intel_has_reset_engine(const struct intel_gt *gt)
{
if (i915_modparams.reset < 2)
if (gt->i915->params.reset < 2)
return false;

return INTEL_INFO(gt->i915)->has_reset_engine;
Expand Down Expand Up @@ -1038,7 +1038,7 @@ void intel_gt_reset(struct intel_gt *gt,
awake = reset_prepare(gt);

if (!intel_has_gpu_reset(gt)) {
if (i915_modparams.reset)
if (gt->i915->params.reset)
drm_err(&gt->i915->drm, "GPU reset not supported\n");
else
drm_dbg(&gt->i915->drm, "GPU reset disabled\n");
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,12 @@ int intel_heartbeat_live_selftests(struct drm_i915_private *i915)
if (intel_gt_is_wedged(&i915->gt))
return 0;

saved_hangcheck = i915_modparams.enable_hangcheck;
i915_modparams.enable_hangcheck = INT_MAX;
saved_hangcheck = i915->params.enable_hangcheck;
i915->params.enable_hangcheck = INT_MAX;

err = intel_gt_live_subtests(tests, &i915->gt);

i915_modparams.enable_hangcheck = saved_hangcheck;
i915->params.enable_hangcheck = saved_hangcheck;
return err;
}

Expand Down
Loading

0 comments on commit 8a25c4b

Please sign in to comment.