Commit e2c719b7 authored by Rob Clark's avatar Rob Clark Committed by Daniel Vetter

drm/i915: tame the chattermouth (v2)

Many distro's have mechanism in place to collect and automatically file
bugs for failed WARN()s.  And since i915 has a lot of hw state sanity
checks which result in WARN(), it generates quite a lot of noise which
is somewhat disconcerting to the end user.

Separate out the internal hw-is-in-the-state-I-expected checks into
I915_STATE_WARN()s and allow configuration via i915.verbose_checks module
param about whether this will generate a full blown stacktrace or just
DRM_ERROR().  The new moduleparam defaults to true, so by default there
is no change in behavior.  And even when disabled, you will still get
an error message logged.

v2: paint the macro names blue, clarify that the default behavior
    remains the same as before
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent e6c1abb7
...@@ -72,6 +72,35 @@ ...@@ -72,6 +72,35 @@
#define MISSING_CASE(x) WARN(1, "Missing switch case (%lu) in %s\n", \ #define MISSING_CASE(x) WARN(1, "Missing switch case (%lu) in %s\n", \
(long) (x), __func__); (long) (x), __func__);
/* Use I915_STATE_WARN(x) and I915_STATE_WARN_ON() (rather than WARN() and
* WARN_ON()) for hw state sanity checks to check for unexpected conditions
* which may not necessarily be a user visible problem. This will either
* WARN() or DRM_ERROR() depending on the verbose_checks moduleparam, to
* enable distros and users to tailor their preferred amount of i915 abrt
* spam.
*/
#define I915_STATE_WARN(condition, format...) ({ \
int __ret_warn_on = !!(condition); \
if (unlikely(__ret_warn_on)) { \
if (i915.verbose_state_checks) \
__WARN_printf(format); \
else \
DRM_ERROR(format); \
} \
unlikely(__ret_warn_on); \
})
#define I915_STATE_WARN_ON(condition) ({ \
int __ret_warn_on = !!(condition); \
if (unlikely(__ret_warn_on)) { \
if (i915.verbose_state_checks) \
__WARN_printf("WARN_ON(" #condition ")\n"); \
else \
DRM_ERROR("WARN_ON(" #condition ")\n"); \
} \
unlikely(__ret_warn_on); \
})
enum pipe { enum pipe {
INVALID_PIPE = -1, INVALID_PIPE = -1,
PIPE_A = 0, PIPE_A = 0,
...@@ -2401,6 +2430,7 @@ struct i915_params { ...@@ -2401,6 +2430,7 @@ struct i915_params {
bool disable_vtd_wa; bool disable_vtd_wa;
int use_mmio_flip; int use_mmio_flip;
bool mmio_debug; bool mmio_debug;
bool verbose_state_checks;
}; };
extern struct i915_params i915 __read_mostly; extern struct i915_params i915 __read_mostly;
......
...@@ -51,6 +51,7 @@ struct i915_params i915 __read_mostly = { ...@@ -51,6 +51,7 @@ struct i915_params i915 __read_mostly = {
.disable_vtd_wa = 0, .disable_vtd_wa = 0,
.use_mmio_flip = 0, .use_mmio_flip = 0,
.mmio_debug = 0, .mmio_debug = 0,
.verbose_state_checks = 1,
}; };
module_param_named(modeset, i915.modeset, int, 0400); module_param_named(modeset, i915.modeset, int, 0400);
...@@ -173,3 +174,7 @@ module_param_named(mmio_debug, i915.mmio_debug, bool, 0600); ...@@ -173,3 +174,7 @@ module_param_named(mmio_debug, i915.mmio_debug, bool, 0600);
MODULE_PARM_DESC(mmio_debug, MODULE_PARM_DESC(mmio_debug,
"Enable the MMIO debug code (default: false). This may negatively " "Enable the MMIO debug code (default: false). This may negatively "
"affect performance."); "affect performance.");
module_param_named(verbose_state_checks, i915.verbose_state_checks, bool, 0600);
MODULE_PARM_DESC(verbose_state_checks,
"Enable verbose logs (ie. WARN_ON()) in case of unexpected hw state conditions.");
...@@ -1024,7 +1024,7 @@ void assert_pll(struct drm_i915_private *dev_priv, ...@@ -1024,7 +1024,7 @@ void assert_pll(struct drm_i915_private *dev_priv,
reg = DPLL(pipe); reg = DPLL(pipe);
val = I915_READ(reg); val = I915_READ(reg);
cur_state = !!(val & DPLL_VCO_ENABLE); cur_state = !!(val & DPLL_VCO_ENABLE);
WARN(cur_state != state, I915_STATE_WARN(cur_state != state,
"PLL state assertion failure (expected %s, current %s)\n", "PLL state assertion failure (expected %s, current %s)\n",
state_string(state), state_string(cur_state)); state_string(state), state_string(cur_state));
} }
...@@ -1040,7 +1040,7 @@ static void assert_dsi_pll(struct drm_i915_private *dev_priv, bool state) ...@@ -1040,7 +1040,7 @@ static void assert_dsi_pll(struct drm_i915_private *dev_priv, bool state)
mutex_unlock(&dev_priv->dpio_lock); mutex_unlock(&dev_priv->dpio_lock);
cur_state = val & DSI_PLL_VCO_EN; cur_state = val & DSI_PLL_VCO_EN;
WARN(cur_state != state, I915_STATE_WARN(cur_state != state,
"DSI PLL state assertion failure (expected %s, current %s)\n", "DSI PLL state assertion failure (expected %s, current %s)\n",
state_string(state), state_string(cur_state)); state_string(state), state_string(cur_state));
} }
...@@ -1071,7 +1071,7 @@ void assert_shared_dpll(struct drm_i915_private *dev_priv, ...@@ -1071,7 +1071,7 @@ void assert_shared_dpll(struct drm_i915_private *dev_priv,
return; return;
cur_state = pll->get_hw_state(dev_priv, pll, &hw_state); cur_state = pll->get_hw_state(dev_priv, pll, &hw_state);
WARN(cur_state != state, I915_STATE_WARN(cur_state != state,
"%s assertion failure (expected %s, current %s)\n", "%s assertion failure (expected %s, current %s)\n",
pll->name, state_string(state), state_string(cur_state)); pll->name, state_string(state), state_string(cur_state));
} }
...@@ -1095,7 +1095,7 @@ static void assert_fdi_tx(struct drm_i915_private *dev_priv, ...@@ -1095,7 +1095,7 @@ static void assert_fdi_tx(struct drm_i915_private *dev_priv,
val = I915_READ(reg); val = I915_READ(reg);
cur_state = !!(val & FDI_TX_ENABLE); cur_state = !!(val & FDI_TX_ENABLE);
} }
WARN(cur_state != state, I915_STATE_WARN(cur_state != state,
"FDI TX state assertion failure (expected %s, current %s)\n", "FDI TX state assertion failure (expected %s, current %s)\n",
state_string(state), state_string(cur_state)); state_string(state), state_string(cur_state));
} }
...@@ -1112,7 +1112,7 @@ static void assert_fdi_rx(struct drm_i915_private *dev_priv, ...@@ -1112,7 +1112,7 @@ static void assert_fdi_rx(struct drm_i915_private *dev_priv,
reg = FDI_RX_CTL(pipe); reg = FDI_RX_CTL(pipe);
val = I915_READ(reg); val = I915_READ(reg);
cur_state = !!(val & FDI_RX_ENABLE); cur_state = !!(val & FDI_RX_ENABLE);
WARN(cur_state != state, I915_STATE_WARN(cur_state != state,
"FDI RX state assertion failure (expected %s, current %s)\n", "FDI RX state assertion failure (expected %s, current %s)\n",
state_string(state), state_string(cur_state)); state_string(state), state_string(cur_state));
} }
...@@ -1135,7 +1135,7 @@ static void assert_fdi_tx_pll_enabled(struct drm_i915_private *dev_priv, ...@@ -1135,7 +1135,7 @@ static void assert_fdi_tx_pll_enabled(struct drm_i915_private *dev_priv,
reg = FDI_TX_CTL(pipe); reg = FDI_TX_CTL(pipe);
val = I915_READ(reg); val = I915_READ(reg);
WARN(!(val & FDI_TX_PLL_ENABLE), "FDI TX PLL assertion failure, should be active but is disabled\n"); I915_STATE_WARN(!(val & FDI_TX_PLL_ENABLE), "FDI TX PLL assertion failure, should be active but is disabled\n");
} }
void assert_fdi_rx_pll(struct drm_i915_private *dev_priv, void assert_fdi_rx_pll(struct drm_i915_private *dev_priv,
...@@ -1148,7 +1148,7 @@ void assert_fdi_rx_pll(struct drm_i915_private *dev_priv, ...@@ -1148,7 +1148,7 @@ void assert_fdi_rx_pll(struct drm_i915_private *dev_priv,
reg = FDI_RX_CTL(pipe); reg = FDI_RX_CTL(pipe);
val = I915_READ(reg); val = I915_READ(reg);
cur_state = !!(val & FDI_RX_PLL_ENABLE); cur_state = !!(val & FDI_RX_PLL_ENABLE);
WARN(cur_state != state, I915_STATE_WARN(cur_state != state,
"FDI RX PLL assertion failure (expected %s, current %s)\n", "FDI RX PLL assertion failure (expected %s, current %s)\n",
state_string(state), state_string(cur_state)); state_string(state), state_string(cur_state));
} }
...@@ -1190,7 +1190,7 @@ void assert_panel_unlocked(struct drm_i915_private *dev_priv, ...@@ -1190,7 +1190,7 @@ void assert_panel_unlocked(struct drm_i915_private *dev_priv,
((val & PANEL_UNLOCK_MASK) == PANEL_UNLOCK_REGS)) ((val & PANEL_UNLOCK_MASK) == PANEL_UNLOCK_REGS))
locked = false; locked = false;
WARN(panel_pipe == pipe && locked, I915_STATE_WARN(panel_pipe == pipe && locked,
"panel assertion failure, pipe %c regs locked\n", "panel assertion failure, pipe %c regs locked\n",
pipe_name(pipe)); pipe_name(pipe));
} }
...@@ -1206,7 +1206,7 @@ static void assert_cursor(struct drm_i915_private *dev_priv, ...@@ -1206,7 +1206,7 @@ static void assert_cursor(struct drm_i915_private *dev_priv,
else else
cur_state = I915_READ(CURCNTR(pipe)) & CURSOR_MODE; cur_state = I915_READ(CURCNTR(pipe)) & CURSOR_MODE;
WARN(cur_state != state, I915_STATE_WARN(cur_state != state,
"cursor on pipe %c assertion failure (expected %s, current %s)\n", "cursor on pipe %c assertion failure (expected %s, current %s)\n",
pipe_name(pipe), state_string(state), state_string(cur_state)); pipe_name(pipe), state_string(state), state_string(cur_state));
} }
...@@ -1236,7 +1236,7 @@ void assert_pipe(struct drm_i915_private *dev_priv, ...@@ -1236,7 +1236,7 @@ void assert_pipe(struct drm_i915_private *dev_priv,
cur_state = !!(val & PIPECONF_ENABLE); cur_state = !!(val & PIPECONF_ENABLE);
} }
WARN(cur_state != state, I915_STATE_WARN(cur_state != state,
"pipe %c assertion failure (expected %s, current %s)\n", "pipe %c assertion failure (expected %s, current %s)\n",
pipe_name(pipe), state_string(state), state_string(cur_state)); pipe_name(pipe), state_string(state), state_string(cur_state));
} }
...@@ -1251,7 +1251,7 @@ static void assert_plane(struct drm_i915_private *dev_priv, ...@@ -1251,7 +1251,7 @@ static void assert_plane(struct drm_i915_private *dev_priv,
reg = DSPCNTR(plane); reg = DSPCNTR(plane);
val = I915_READ(reg); val = I915_READ(reg);
cur_state = !!(val & DISPLAY_PLANE_ENABLE); cur_state = !!(val & DISPLAY_PLANE_ENABLE);
WARN(cur_state != state, I915_STATE_WARN(cur_state != state,
"plane %c assertion failure (expected %s, current %s)\n", "plane %c assertion failure (expected %s, current %s)\n",
plane_name(plane), state_string(state), state_string(cur_state)); plane_name(plane), state_string(state), state_string(cur_state));
} }
...@@ -1271,7 +1271,7 @@ static void assert_planes_disabled(struct drm_i915_private *dev_priv, ...@@ -1271,7 +1271,7 @@ static void assert_planes_disabled(struct drm_i915_private *dev_priv,
if (INTEL_INFO(dev)->gen >= 4) { if (INTEL_INFO(dev)->gen >= 4) {
reg = DSPCNTR(pipe); reg = DSPCNTR(pipe);
val = I915_READ(reg); val = I915_READ(reg);
WARN(val & DISPLAY_PLANE_ENABLE, I915_STATE_WARN(val & DISPLAY_PLANE_ENABLE,
"plane %c assertion failure, should be disabled but not\n", "plane %c assertion failure, should be disabled but not\n",
plane_name(pipe)); plane_name(pipe));
return; return;
...@@ -1283,7 +1283,7 @@ static void assert_planes_disabled(struct drm_i915_private *dev_priv, ...@@ -1283,7 +1283,7 @@ static void assert_planes_disabled(struct drm_i915_private *dev_priv,
val = I915_READ(reg); val = I915_READ(reg);
cur_pipe = (val & DISPPLANE_SEL_PIPE_MASK) >> cur_pipe = (val & DISPPLANE_SEL_PIPE_MASK) >>
DISPPLANE_SEL_PIPE_SHIFT; DISPPLANE_SEL_PIPE_SHIFT;
WARN((val & DISPLAY_PLANE_ENABLE) && pipe == cur_pipe, I915_STATE_WARN((val & DISPLAY_PLANE_ENABLE) && pipe == cur_pipe,
"plane %c assertion failure, should be off on pipe %c but is still active\n", "plane %c assertion failure, should be off on pipe %c but is still active\n",
plane_name(i), pipe_name(pipe)); plane_name(i), pipe_name(pipe));
} }
...@@ -1299,7 +1299,7 @@ static void assert_sprites_disabled(struct drm_i915_private *dev_priv, ...@@ -1299,7 +1299,7 @@ static void assert_sprites_disabled(struct drm_i915_private *dev_priv,
if (INTEL_INFO(dev)->gen >= 9) { if (INTEL_INFO(dev)->gen >= 9) {
for_each_sprite(pipe, sprite) { for_each_sprite(pipe, sprite) {
val = I915_READ(PLANE_CTL(pipe, sprite)); val = I915_READ(PLANE_CTL(pipe, sprite));
WARN(val & PLANE_CTL_ENABLE, I915_STATE_WARN(val & PLANE_CTL_ENABLE,
"plane %d assertion failure, should be off on pipe %c but is still active\n", "plane %d assertion failure, should be off on pipe %c but is still active\n",
sprite, pipe_name(pipe)); sprite, pipe_name(pipe));
} }
...@@ -1307,20 +1307,20 @@ static void assert_sprites_disabled(struct drm_i915_private *dev_priv, ...@@ -1307,20 +1307,20 @@ static void assert_sprites_disabled(struct drm_i915_private *dev_priv,
for_each_sprite(pipe, sprite) { for_each_sprite(pipe, sprite) {
reg = SPCNTR(pipe, sprite); reg = SPCNTR(pipe, sprite);
val = I915_READ(reg); val = I915_READ(reg);
WARN(val & SP_ENABLE, I915_STATE_WARN(val & SP_ENABLE,
"sprite %c assertion failure, should be off on pipe %c but is still active\n", "sprite %c assertion failure, should be off on pipe %c but is still active\n",
sprite_name(pipe, sprite), pipe_name(pipe)); sprite_name(pipe, sprite), pipe_name(pipe));
} }
} else if (INTEL_INFO(dev)->gen >= 7) { } else if (INTEL_INFO(dev)->gen >= 7) {
reg = SPRCTL(pipe); reg = SPRCTL(pipe);
val = I915_READ(reg); val = I915_READ(reg);
WARN(val & SPRITE_ENABLE, I915_STATE_WARN(val & SPRITE_ENABLE,
"sprite %c assertion failure, should be off on pipe %c but is still active\n", "sprite %c assertion failure, should be off on pipe %c but is still active\n",
plane_name(pipe), pipe_name(pipe)); plane_name(pipe), pipe_name(pipe));
} else if (INTEL_INFO(dev)->gen >= 5) { } else if (INTEL_INFO(dev)->gen >= 5) {
reg = DVSCNTR(pipe); reg = DVSCNTR(pipe);
val = I915_READ(reg); val = I915_READ(reg);
WARN(val & DVS_ENABLE, I915_STATE_WARN(val & DVS_ENABLE,
"sprite %c assertion failure, should be off on pipe %c but is still active\n", "sprite %c assertion failure, should be off on pipe %c but is still active\n",
plane_name(pipe), pipe_name(pipe)); plane_name(pipe), pipe_name(pipe));
} }
...@@ -1328,7 +1328,7 @@ static void assert_sprites_disabled(struct drm_i915_private *dev_priv, ...@@ -1328,7 +1328,7 @@ static void assert_sprites_disabled(struct drm_i915_private *dev_priv,
static void assert_vblank_disabled(struct drm_crtc *crtc) static void assert_vblank_disabled(struct drm_crtc *crtc)
{ {
if (WARN_ON(drm_crtc_vblank_get(crtc) == 0)) if (I915_STATE_WARN_ON(drm_crtc_vblank_get(crtc) == 0))
drm_crtc_vblank_put(crtc); drm_crtc_vblank_put(crtc);
} }
...@@ -1337,12 +1337,12 @@ static void ibx_assert_pch_refclk_enabled(struct drm_i915_private *dev_priv) ...@@ -1337,12 +1337,12 @@ static void ibx_assert_pch_refclk_enabled(struct drm_i915_private *dev_priv)
u32 val; u32 val;
bool enabled; bool enabled;
WARN_ON(!(HAS_PCH_IBX(dev_priv->dev) || HAS_PCH_CPT(dev_priv->dev))); I915_STATE_WARN_ON(!(HAS_PCH_IBX(dev_priv->dev) || HAS_PCH_CPT(dev_priv->dev)));
val = I915_READ(PCH_DREF_CONTROL); val = I915_READ(PCH_DREF_CONTROL);
enabled = !!(val & (DREF_SSC_SOURCE_MASK | DREF_NONSPREAD_SOURCE_MASK | enabled = !!(val & (DREF_SSC_SOURCE_MASK | DREF_NONSPREAD_SOURCE_MASK |
DREF_SUPERSPREAD_SOURCE_MASK)); DREF_SUPERSPREAD_SOURCE_MASK));
WARN(!enabled, "PCH refclk assertion failure, should be active but is disabled\n"); I915_STATE_WARN(!enabled, "PCH refclk assertion failure, should be active but is disabled\n");
} }
static void assert_pch_transcoder_disabled(struct drm_i915_private *dev_priv, static void assert_pch_transcoder_disabled(struct drm_i915_private *dev_priv,
...@@ -1355,7 +1355,7 @@ static void assert_pch_transcoder_disabled(struct drm_i915_private *dev_priv, ...@@ -1355,7 +1355,7 @@ static void assert_pch_transcoder_disabled(struct drm_i915_private *dev_priv,
reg = PCH_TRANSCONF(pipe); reg = PCH_TRANSCONF(pipe);
val = I915_READ(reg); val = I915_READ(reg);
enabled = !!(val & TRANS_ENABLE); enabled = !!(val & TRANS_ENABLE);
WARN(enabled, I915_STATE_WARN(enabled,
"transcoder assertion failed, should be off on pipe %c but is still active\n", "transcoder assertion failed, should be off on pipe %c but is still active\n",
pipe_name(pipe)); pipe_name(pipe));
} }
...@@ -1435,11 +1435,11 @@ static void assert_pch_dp_disabled(struct drm_i915_private *dev_priv, ...@@ -1435,11 +1435,11 @@ static void assert_pch_dp_disabled(struct drm_i915_private *dev_priv,
enum pipe pipe, int reg, u32 port_sel) enum pipe pipe, int reg, u32 port_sel)
{ {
u32 val = I915_READ(reg); u32 val = I915_READ(reg);
WARN(dp_pipe_enabled(dev_priv, pipe, port_sel, val), I915_STATE_WARN(dp_pipe_enabled(dev_priv, pipe, port_sel, val),
"PCH DP (0x%08x) enabled on transcoder %c, should be disabled\n", "PCH DP (0x%08x) enabled on transcoder %c, should be disabled\n",
reg, pipe_name(pipe)); reg, pipe_name(pipe));
WARN(HAS_PCH_IBX(dev_priv->dev) && (val & DP_PORT_EN) == 0 I915_STATE_WARN(HAS_PCH_IBX(dev_priv->dev) && (val & DP_PORT_EN) == 0
&& (val & DP_PIPEB_SELECT), && (val & DP_PIPEB_SELECT),
"IBX PCH dp port still using transcoder B\n"); "IBX PCH dp port still using transcoder B\n");
} }
...@@ -1448,11 +1448,11 @@ static void assert_pch_hdmi_disabled(struct drm_i915_private *dev_priv, ...@@ -1448,11 +1448,11 @@ static void assert_pch_hdmi_disabled(struct drm_i915_private *dev_priv,
enum pipe pipe, int reg) enum pipe pipe, int reg)
{ {
u32 val = I915_READ(reg); u32 val = I915_READ(reg);
WARN(hdmi_pipe_enabled(dev_priv, pipe, val), I915_STATE_WARN(hdmi_pipe_enabled(dev_priv, pipe, val),
"PCH HDMI (0x%08x) enabled on transcoder %c, should be disabled\n", "PCH HDMI (0x%08x) enabled on transcoder %c, should be disabled\n",
reg, pipe_name(pipe)); reg, pipe_name(pipe));
WARN(HAS_PCH_IBX(dev_priv->dev) && (val & SDVO_ENABLE) == 0 I915_STATE_WARN(HAS_PCH_IBX(dev_priv->dev) && (val & SDVO_ENABLE) == 0
&& (val & SDVO_PIPE_B_SELECT), && (val & SDVO_PIPE_B_SELECT),
"IBX PCH hdmi port still using transcoder B\n"); "IBX PCH hdmi port still using transcoder B\n");
} }
...@@ -1469,13 +1469,13 @@ static void assert_pch_ports_disabled(struct drm_i915_private *dev_priv, ...@@ -1469,13 +1469,13 @@ static void assert_pch_ports_disabled(struct drm_i915_private *dev_priv,
reg = PCH_ADPA; reg = PCH_ADPA;
val = I915_READ(reg); val = I915_READ(reg);
WARN(adpa_pipe_enabled(dev_priv, pipe, val), I915_STATE_WARN(adpa_pipe_enabled(dev_priv, pipe, val),
"PCH VGA enabled on transcoder %c, should be disabled\n", "PCH VGA enabled on transcoder %c, should be disabled\n",
pipe_name(pipe)); pipe_name(pipe));
reg = PCH_LVDS; reg = PCH_LVDS;
val = I915_READ(reg); val = I915_READ(reg);
WARN(lvds_pipe_enabled(dev_priv, pipe, val), I915_STATE_WARN(lvds_pipe_enabled(dev_priv, pipe, val),
"PCH LVDS enabled on transcoder %c, should be disabled\n", "PCH LVDS enabled on transcoder %c, should be disabled\n",
pipe_name(pipe)); pipe_name(pipe));
...@@ -5311,25 +5311,25 @@ static void intel_connector_check_state(struct intel_connector *connector) ...@@ -5311,25 +5311,25 @@ static void intel_connector_check_state(struct intel_connector *connector)
if (connector->mst_port) if (connector->mst_port)
return; return;
WARN(connector->base.dpms == DRM_MODE_DPMS_OFF, I915_STATE_WARN(connector->base.dpms == DRM_MODE_DPMS_OFF,
"wrong connector dpms state\n"); "wrong connector dpms state\n");
WARN(connector->base.encoder != &encoder->base, I915_STATE_WARN(connector->base.encoder != &encoder->base,
"active connector not linked to encoder\n"); "active connector not linked to encoder\n");
if (encoder) { if (encoder) {
WARN(!encoder->connectors_active, I915_STATE_WARN(!encoder->connectors_active,
"encoder->connectors_active not set\n"); "encoder->connectors_active not set\n");
encoder_enabled = encoder->get_hw_state(encoder, &pipe); encoder_enabled = encoder->get_hw_state(encoder, &pipe);
WARN(!encoder_enabled, "encoder not enabled\n"); I915_STATE_WARN(!encoder_enabled, "encoder not enabled\n");
if (WARN_ON(!encoder->base.crtc)) if (I915_STATE_WARN_ON(!encoder->base.crtc))
return; return;
crtc = encoder->base.crtc; crtc = encoder->base.crtc;
WARN(!crtc->enabled, "crtc not enabled\n"); I915_STATE_WARN(!crtc->enabled, "crtc not enabled\n");
WARN(!to_intel_crtc(crtc)->active, "crtc not active\n"); I915_STATE_WARN(!to_intel_crtc(crtc)->active, "crtc not active\n");
WARN(pipe != to_intel_crtc(crtc)->pipe, I915_STATE_WARN(pipe != to_intel_crtc(crtc)->pipe,
"encoder active on the wrong pipe\n"); "encoder active on the wrong pipe\n");
} }
} }
...@@ -7739,24 +7739,24 @@ static void assert_can_disable_lcpll(struct drm_i915_private *dev_priv) ...@@ -7739,24 +7739,24 @@ static void assert_can_disable_lcpll(struct drm_i915_private *dev_priv)
struct intel_crtc *crtc; struct intel_crtc *crtc;
for_each_intel_crtc(dev, crtc) for_each_intel_crtc(dev, crtc)
WARN(crtc->active, "CRTC for pipe %c enabled\n", I915_STATE_WARN(crtc->active, "CRTC for pipe %c enabled\n",
pipe_name(crtc->pipe)); pipe_name(crtc->pipe));
WARN(I915_READ(HSW_PWR_WELL_DRIVER), "Power well on\n"); I915_STATE_WARN(I915_READ(HSW_PWR_WELL_DRIVER), "Power well on\n");
WARN(I915_READ(SPLL_CTL) & SPLL_PLL_ENABLE, "SPLL enabled\n"); I915_STATE_WARN(I915_READ(SPLL_CTL) & SPLL_PLL_ENABLE, "SPLL enabled\n");
WARN(I915_READ(WRPLL_CTL1) & WRPLL_PLL_ENABLE, "WRPLL1 enabled\n"); I915_STATE_WARN(I915_READ(WRPLL_CTL1) & WRPLL_PLL_ENABLE, "WRPLL1 enabled\n");
WARN(I915_READ(WRPLL_CTL2) & WRPLL_PLL_ENABLE, "WRPLL2 enabled\n"); I915_STATE_WARN(I915_READ(WRPLL_CTL2) & WRPLL_PLL_ENABLE, "WRPLL2 enabled\n");
WARN(I915_READ(PCH_PP_STATUS) & PP_ON, "Panel power on\n"); I915_STATE_WARN(I915_READ(PCH_PP_STATUS) & PP_ON, "Panel power on\n");
WARN(I915_READ(BLC_PWM_CPU_CTL2) & BLM_PWM_ENABLE, I915_STATE_WARN(I915_READ(BLC_PWM_CPU_CTL2) & BLM_PWM_ENABLE,
"CPU PWM1 enabled\n"); "CPU PWM1 enabled\n");
if (IS_HASWELL(dev)) if (IS_HASWELL(dev))
WARN(I915_READ(HSW_BLC_PWM2_CTL) & BLM_PWM_ENABLE, I915_STATE_WARN(I915_READ(HSW_BLC_PWM2_CTL) & BLM_PWM_ENABLE,
"CPU PWM2 enabled\n"); "CPU PWM2 enabled\n");
WARN(I915_READ(BLC_PWM_PCH_CTL1) & BLM_PCH_PWM_ENABLE, I915_STATE_WARN(I915_READ(BLC_PWM_PCH_CTL1) & BLM_PCH_PWM_ENABLE,
"PCH PWM1 enabled\n"); "PCH PWM1 enabled\n");
WARN(I915_READ(UTIL_PIN_CTL) & UTIL_PIN_ENABLE, I915_STATE_WARN(I915_READ(UTIL_PIN_CTL) & UTIL_PIN_ENABLE,
"Utility pin enabled\n"); "Utility pin enabled\n");
WARN(I915_READ(PCH_GTC_CTL) & PCH_GTC_ENABLE, "PCH GTC enabled\n"); I915_STATE_WARN(I915_READ(PCH_GTC_CTL) & PCH_GTC_ENABLE, "PCH GTC enabled\n");
/* /*
* In theory we can still leave IRQs enabled, as long as only the HPD * In theory we can still leave IRQs enabled, as long as only the HPD
...@@ -7764,7 +7764,7 @@ static void assert_can_disable_lcpll(struct drm_i915_private *dev_priv) ...@@ -7764,7 +7764,7 @@ static void assert_can_disable_lcpll(struct drm_i915_private *dev_priv)
* gen-specific and since we only disable LCPLL after we fully disable * gen-specific and since we only disable LCPLL after we fully disable
* the interrupts, the check below should be enough. * the interrupts, the check below should be enough.
*/ */
WARN(intel_irqs_enabled(dev_priv), "IRQs enabled\n"); I915_STATE_WARN(intel_irqs_enabled(dev_priv), "IRQs enabled\n");
} }
static uint32_t hsw_read_dcomp(struct drm_i915_private *dev_priv) static uint32_t hsw_read_dcomp(struct drm_i915_private *dev_priv)
...@@ -10640,7 +10640,7 @@ check_connector_state(struct drm_device *dev) ...@@ -10640,7 +10640,7 @@ check_connector_state(struct drm_device *dev)
* ->get_hw_state callbacks. */ * ->get_hw_state callbacks. */
intel_connector_check_state(connector); intel_connector_check_state(connector);
WARN(&connector->new_encoder->base != connector->base.encoder, I915_STATE_WARN(&connector->new_encoder->base != connector->base.encoder,
"connector's staged encoder doesn't match current encoder\n"); "connector's staged encoder doesn't match current encoder\n");
} }
} }
...@@ -10660,9 +10660,9 @@ check_encoder_state(struct drm_device *dev) ...@@ -10660,9 +10660,9 @@ check_encoder_state(struct drm_device *dev)
encoder->base.base.id, encoder->base.base.id,
encoder->base.name); encoder->base.name);
WARN(&encoder->new_crtc->base != encoder->base.crtc, I915_STATE_WARN(&encoder->new_crtc->base != encoder->base.crtc,
"encoder's stage crtc doesn't match current crtc\n"); "encoder's stage crtc doesn't match current crtc\n");
WARN(encoder->connectors_active && !encoder->base.crtc, I915_STATE_WARN(encoder->connectors_active && !encoder->base.crtc,
"encoder's active_connectors set, but no crtc\n"); "encoder's active_connectors set, but no crtc\n");
list_for_each_entry(connector, &dev->mode_config.connector_list, list_for_each_entry(connector, &dev->mode_config.connector_list,
...@@ -10681,19 +10681,19 @@ check_encoder_state(struct drm_device *dev) ...@@ -10681,19 +10681,19 @@ check_encoder_state(struct drm_device *dev)
if (!enabled && encoder->base.encoder_type == DRM_MODE_ENCODER_DPMST) if (!enabled && encoder->base.encoder_type == DRM_MODE_ENCODER_DPMST)
continue; continue;
WARN(!!encoder->base.crtc != enabled, I915_STATE_WARN(!!encoder->base.crtc != enabled,
"encoder's enabled state mismatch " "encoder's enabled state mismatch "
"(expected %i, found %i)\n", "(expected %i, found %i)\n",
!!encoder->base.crtc, enabled); !!encoder->base.crtc, enabled);
WARN(active && !encoder->base.crtc, I915_STATE_WARN(active && !encoder->base.crtc,
"active encoder with no crtc\n"); "active encoder with no crtc\n");
WARN(encoder->connectors_active != active, I915_STATE_WARN(encoder->connectors_active != active,
"encoder's computed active state doesn't match tracked active state " "encoder's computed active state doesn't match tracked active state "
"(expected %i, found %i)\n", active, encoder->connectors_active); "(expected %i, found %i)\n", active, encoder->connectors_active);
active = encoder->get_hw_state(encoder, &pipe); active = encoder->get_hw_state(encoder, &pipe);
WARN(active != encoder->connectors_active, I915_STATE_WARN(active != encoder->connectors_active,
"encoder's hw state doesn't match sw tracking " "encoder's hw state doesn't match sw tracking "
"(expected %i, found %i)\n", "(expected %i, found %i)\n",
encoder->connectors_active, active); encoder->connectors_active, active);
...@@ -10702,7 +10702,7 @@ check_encoder_state(struct drm_device *dev) ...@@ -10702,7 +10702,7 @@ check_encoder_state(struct drm_device *dev)
continue; continue;
tracked_pipe = to_intel_crtc(encoder->base.crtc)->pipe; tracked_pipe = to_intel_crtc(encoder->base.crtc)->pipe;
WARN(active && pipe != tracked_pipe, I915_STATE_WARN(active && pipe != tracked_pipe,
"active encoder's pipe doesn't match" "active encoder's pipe doesn't match"
"(expected %i, found %i)\n", "(expected %i, found %i)\n",
tracked_pipe, pipe); tracked_pipe, pipe);
...@@ -10727,7 +10727,7 @@ check_crtc_state(struct drm_device *dev) ...@@ -10727,7 +10727,7 @@ check_crtc_state(struct drm_device *dev)
DRM_DEBUG_KMS("[CRTC:%d]\n", DRM_DEBUG_KMS("[CRTC:%d]\n",
crtc->base.base.id); crtc->base.base.id);
WARN(crtc->active && !crtc->base.enabled, I915_STATE_WARN(crtc->active && !crtc->base.enabled,
"active crtc, but not enabled in sw tracking\n"); "active crtc, but not enabled in sw tracking\n");
for_each_intel_encoder(dev, encoder) { for_each_intel_encoder(dev, encoder) {
...@@ -10738,10 +10738,10 @@ check_crtc_state(struct drm_device *dev) ...@@ -10738,10 +10738,10 @@ check_crtc_state(struct drm_device *dev)
active = true; active = true;
} }
WARN(active != crtc->active, I915_STATE_WARN(active != crtc->active,
"crtc's computed active state doesn't match tracked active state " "crtc's computed active state doesn't match tracked active state "
"(expected %i, found %i)\n", active, crtc->active); "(expected %i, found %i)\n", active, crtc->active);
WARN(enabled != crtc->base.enabled, I915_STATE_WARN(enabled != crtc->base.enabled,
"crtc's computed enabled state doesn't match tracked enabled state " "crtc's computed enabled state doesn't match tracked enabled state "
"(expected %i, found %i)\n", enabled, crtc->base.enabled); "(expected %i, found %i)\n", enabled, crtc->base.enabled);
...@@ -10761,13 +10761,13 @@ check_crtc_state(struct drm_device *dev) ...@@ -10761,13 +10761,13 @@ check_crtc_state(struct drm_device *dev)
encoder->get_config(encoder, &pipe_config); encoder->get_config(encoder, &pipe_config);
} }
WARN(crtc->active != active, I915_STATE_WARN(crtc->active != active,
"crtc active state doesn't match with hw state " "crtc active state doesn't match with hw state "
"(expected %i, found %i)\n", crtc->active, active); "(expected %i, found %i)\n", crtc->active, active);
if (active && if (active &&
!intel_pipe_config_compare(dev, &crtc->config, &pipe_config)) { !intel_pipe_config_compare(dev, &crtc->config, &pipe_config)) {
WARN(1, "pipe state doesn't match!\n"); I915_STATE_WARN(1, "pipe state doesn't match!\n");
intel_dump_pipe_config(crtc, &pipe_config, intel_dump_pipe_config(crtc, &pipe_config,
"[hw state]"); "[hw state]");
intel_dump_pipe_config(crtc, &crtc->config, intel_dump_pipe_config(crtc, &crtc->config,
...@@ -10795,14 +10795,14 @@ check_shared_dpll_state(struct drm_device *dev) ...@@ -10795,14 +10795,14 @@ check_shared_dpll_state(struct drm_device *dev)
active = pll->get_hw_state(dev_priv, pll, &dpll_hw_state); active = pll->get_hw_state(dev_priv, pll, &dpll_hw_state);
WARN(pll->active > hweight32(pll->config.crtc_mask), I915_STATE_WARN(pll->active > hweight32(pll->config.crtc_mask),
"more active pll users than references: %i vs %i\n", "more active pll users than references: %i vs %i\n",
pll->active, hweight32(pll->config.crtc_mask)); pll->active, hweight32(pll->config.crtc_mask));
WARN(pll->active && !pll->on, I915_STATE_WARN(pll->active && !pll->on,
"pll in active use but not on in sw tracking\n"); "pll in active use but not on in sw tracking\n");
WARN(pll->on && !pll->active, I915_STATE_WARN(pll->on && !pll->active,
"pll in on but not on in use in sw tracking\n"); "pll in on but not on in use in sw tracking\n");
WARN(pll->on != active, I915_STATE_WARN(pll->on != active,
"pll on state mismatch (expected %i, found %i)\n", "pll on state mismatch (expected %i, found %i)\n",
pll->on, active); pll->on, active);
...@@ -10812,14 +10812,14 @@ check_shared_dpll_state(struct drm_device *dev) ...@@ -10812,14 +10812,14 @@ check_shared_dpll_state(struct drm_device *dev)
if (crtc->active && intel_crtc_to_shared_dpll(crtc) == pll) if (crtc->active && intel_crtc_to_shared_dpll(crtc) == pll)
active_crtcs++; active_crtcs++;
} }
WARN(pll->active != active_crtcs, I915_STATE_WARN(pll->active != active_crtcs,
"pll active crtcs mismatch (expected %i, found %i)\n", "pll active crtcs mismatch (expected %i, found %i)\n",
pll->active, active_crtcs); pll->active, active_crtcs);
WARN(hweight32(pll->config.crtc_mask) != enabled_crtcs, I915_STATE_WARN(hweight32(pll->config.crtc_mask) != enabled_crtcs,
"pll enabled crtcs mismatch (expected %i, found %i)\n", "pll enabled crtcs mismatch (expected %i, found %i)\n",
hweight32(pll->config.crtc_mask), enabled_crtcs); hweight32(pll->config.crtc_mask), enabled_crtcs);
WARN(pll->on && memcmp(&pll->config.hw_state, &dpll_hw_state, I915_STATE_WARN(pll->on && memcmp(&pll->config.hw_state, &dpll_hw_state,
sizeof(dpll_hw_state)), sizeof(dpll_hw_state)),
"pll hw state mismatch\n"); "pll hw state mismatch\n");
} }
......
...@@ -1558,7 +1558,7 @@ void intel_edp_panel_vdd_on(struct intel_dp *intel_dp) ...@@ -1558,7 +1558,7 @@ void intel_edp_panel_vdd_on(struct intel_dp *intel_dp)
vdd = edp_panel_vdd_on(intel_dp); vdd = edp_panel_vdd_on(intel_dp);
pps_unlock(intel_dp); pps_unlock(intel_dp);
WARN(!vdd, "eDP port %c VDD already requested on\n", I915_STATE_WARN(!vdd, "eDP port %c VDD already requested on\n",
port_name(dp_to_dig_port(intel_dp)->port)); port_name(dp_to_dig_port(intel_dp)->port));
} }
...@@ -1642,7 +1642,7 @@ static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync) ...@@ -1642,7 +1642,7 @@ static void edp_panel_vdd_off(struct intel_dp *intel_dp, bool sync)
if (!is_edp(intel_dp)) if (!is_edp(intel_dp))
return; return;
WARN(!intel_dp->want_panel_vdd, "eDP port %c VDD not forced on", I915_STATE_WARN(!intel_dp->want_panel_vdd, "eDP port %c VDD not forced on",
port_name(dp_to_dig_port(intel_dp)->port)); port_name(dp_to_dig_port(intel_dp)->port));
intel_dp->want_panel_vdd = false; intel_dp->want_panel_vdd = false;
......
...@@ -633,7 +633,7 @@ static void check_power_well_state(struct drm_i915_private *dev_priv, ...@@ -633,7 +633,7 @@ static void check_power_well_state(struct drm_i915_private *dev_priv,
return; return;
mismatch: mismatch:
WARN(1, "state mismatch for '%s' (always_on %d hw state %d use-count %d disable_power_well %d\n", I915_STATE_WARN(1, "state mismatch for '%s' (always_on %d hw state %d use-count %d disable_power_well %d\n",
power_well->name, power_well->always_on, enabled, power_well->name, power_well->always_on, enabled,
power_well->count, i915.disable_power_well); power_well->count, i915.disable_power_well);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment