From: kbuild test robot <lkp@intel.com>
To: kbuild@01.org, Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: stable@vger.kernel.org, intel-gfx@lists.freedesktop.org,
Daniel Kamil Kozar <dkk089@gmail.com>,
kbuild-all@01.org, Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH] drm/i915: Try to sanitize bogus DPLL state left over by broken SNB BIOSen
Date: Thu, 10 Jan 2019 22:41:09 +0300 [thread overview]
Message-ID: <20190110194109.GH1718@kadam> (raw)
In-Reply-To: <20190109120919.21668-1-ville.syrjala@linux.intel.com>
Hi Ville,
Thank you for the patch! Perhaps something to improve:
url: https://github.com/0day-ci/linux/commits/Ville-Syrjala/drm-i915-Try-to-sanitize-bogus-DPLL-state-left-over-by-broken-SNB-BIOSen/20190109-222838
base: git://anongit.freedesktop.org/drm-intel for-linux-next
New smatch warnings:
drivers/gpu/drm/i915/intel_display.c:15452 has_bogus_dpll_config() warn: variable dereferenced before check 'crtc_state' (see line 15439)
drivers/gpu/drm/i915/intel_display.c:15472 intel_sanitize_encoder() error: we previously assumed 'crtc_state' could be null (see line 15469)
drivers/gpu/drm/i915/intel_display.c:15487 intel_sanitize_encoder() warn: variable dereferenced before check 'crtc_state' (see line 15472)
# https://github.com/0day-ci/linux/commit/5a0056f774727561e522ccde5fe7fe78d343d25f
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 5a0056f774727561e522ccde5fe7fe78d343d25f
vim +/crtc_state +15452 drivers/gpu/drm/i915/intel_display.c
249293524 Daniel Vetter 2012-07-02 15436
5a0056f77 Ville Syrjälä 2019-01-09 15437 static bool has_bogus_dpll_config(struct intel_crtc_state *crtc_state)
5a0056f77 Ville Syrjälä 2019-01-09 15438 {
5a0056f77 Ville Syrjälä 2019-01-09 @15439 struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
5a0056f77 Ville Syrjälä 2019-01-09 15440
5a0056f77 Ville Syrjälä 2019-01-09 15441 /*
5a0056f77 Ville Syrjälä 2019-01-09 15442 * Some SNB BIOSen (eg. ASUS K53SV) are known to misprogram
5a0056f77 Ville Syrjälä 2019-01-09 15443 * the hardware when a high res displays plugged in. DPLL P
5a0056f77 Ville Syrjälä 2019-01-09 15444 * divider is zero, and the pipe timings are bonkers. We'll
5a0056f77 Ville Syrjälä 2019-01-09 15445 * try to disable everything in that case.
5a0056f77 Ville Syrjälä 2019-01-09 15446 *
5a0056f77 Ville Syrjälä 2019-01-09 15447 * FIXME would be nice to be able to sanitize this state
5a0056f77 Ville Syrjälä 2019-01-09 15448 * without several WARNs, but for now let's take the easy
5a0056f77 Ville Syrjälä 2019-01-09 15449 * road.
5a0056f77 Ville Syrjälä 2019-01-09 15450 */
5a0056f77 Ville Syrjälä 2019-01-09 15451 return IS_GEN(dev_priv, 6) &&
5a0056f77 Ville Syrjälä 2019-01-09 @15452 crtc_state &&
5a0056f77 Ville Syrjälä 2019-01-09 15453 crtc_state->base.active &&
5a0056f77 Ville Syrjälä 2019-01-09 15454 crtc_state->shared_dpll &&
5a0056f77 Ville Syrjälä 2019-01-09 15455 crtc_state->port_clock == 0;
5a0056f77 Ville Syrjälä 2019-01-09 15456 }
5a0056f77 Ville Syrjälä 2019-01-09 15457
249293524 Daniel Vetter 2012-07-02 15458 static void intel_sanitize_encoder(struct intel_encoder *encoder)
249293524 Daniel Vetter 2012-07-02 15459 {
70332ac53 Imre Deak 2018-11-01 15460 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
249293524 Daniel Vetter 2012-07-02 15461 struct intel_connector *connector;
5a0056f77 Ville Syrjälä 2019-01-09 15462 struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
5a0056f77 Ville Syrjälä 2019-01-09 15463 struct intel_crtc_state *crtc_state = crtc ?
5a0056f77 Ville Syrjälä 2019-01-09 15464 to_intel_crtc_state(crtc->base.state) : NULL;
249293524 Daniel Vetter 2012-07-02 15465
249293524 Daniel Vetter 2012-07-02 15466 /* We need to check both for a crtc link (meaning that the
249293524 Daniel Vetter 2012-07-02 15467 * encoder is active and trying to read from a pipe) and the
249293524 Daniel Vetter 2012-07-02 15468 * pipe itself being active. */
5a0056f77 Ville Syrjälä 2019-01-09 @15469 bool has_active_crtc = crtc_state &&
5a0056f77 Ville Syrjälä 2019-01-09 15470 crtc_state->base.active;
5a0056f77 Ville Syrjälä 2019-01-09 15471
5a0056f77 Ville Syrjälä 2019-01-09 @15472 if (has_bogus_dpll_config(crtc_state)) {
5a0056f77 Ville Syrjälä 2019-01-09 15473 DRM_DEBUG_KMS("BIOS has misprogrammed the hardware. Disabling pipe %c\n",
5a0056f77 Ville Syrjälä 2019-01-09 15474 pipe_name(crtc->pipe));
5a0056f77 Ville Syrjälä 2019-01-09 15475 has_active_crtc = false;
5a0056f77 Ville Syrjälä 2019-01-09 15476 }
249293524 Daniel Vetter 2012-07-02 15477
496b0fc37 Maarten Lankhorst 2016-08-23 15478 connector = intel_encoder_find_connector(encoder);
496b0fc37 Maarten Lankhorst 2016-08-23 15479 if (connector && !has_active_crtc) {
249293524 Daniel Vetter 2012-07-02 15480 DRM_DEBUG_KMS("[ENCODER:%d:%s] has active connectors but no active pipe!\n",
249293524 Daniel Vetter 2012-07-02 15481 encoder->base.base.id,
8e329a039 Jani Nikula 2014-06-03 15482 encoder->base.name);
249293524 Daniel Vetter 2012-07-02 15483
249293524 Daniel Vetter 2012-07-02 15484 /* Connector is active, but has no active pipe. This is
249293524 Daniel Vetter 2012-07-02 15485 * fallout from our resume register restoring. Disable
249293524 Daniel Vetter 2012-07-02 15486 * the encoder manually again. */
5a0056f77 Ville Syrjälä 2019-01-09 @15487 if (crtc_state) {
5a0056f77 Ville Syrjälä 2019-01-09 15488 struct drm_encoder *best_encoder;
fd6bbda9c Maarten Lankhorst 2016-08-09 15489
249293524 Daniel Vetter 2012-07-02 15490 DRM_DEBUG_KMS("[ENCODER:%d:%s] manually disabled\n",
249293524 Daniel Vetter 2012-07-02 15491 encoder->base.base.id,
8e329a039 Jani Nikula 2014-06-03 15492 encoder->base.name);
5a0056f77 Ville Syrjälä 2019-01-09 15493
5a0056f77 Ville Syrjälä 2019-01-09 15494 /* avoid oopsing in case the hooks consult best_encoder */
5a0056f77 Ville Syrjälä 2019-01-09 15495 best_encoder = connector->base.state->best_encoder;
5a0056f77 Ville Syrjälä 2019-01-09 15496 connector->base.state->best_encoder = &encoder->base;
5a0056f77 Ville Syrjälä 2019-01-09 15497
c84c6fe30 Jani Nikula 2018-10-16 15498 if (encoder->disable)
5a0056f77 Ville Syrjälä 2019-01-09 15499 encoder->disable(encoder, crtc_state,
5a0056f77 Ville Syrjälä 2019-01-09 15500 connector->base.state);
a62d14975 Ville Syrjälä 2014-06-28 15501 if (encoder->post_disable)
5a0056f77 Ville Syrjälä 2019-01-09 15502 encoder->post_disable(encoder, crtc_state,
5a0056f77 Ville Syrjälä 2019-01-09 15503 connector->base.state);
5a0056f77 Ville Syrjälä 2019-01-09 15504
5a0056f77 Ville Syrjälä 2019-01-09 15505 connector->base.state->best_encoder = best_encoder;
249293524 Daniel Vetter 2012-07-02 15506 }
7f1950fbb Egbert Eich 2014-04-25 15507 encoder->base.crtc = NULL;
249293524 Daniel Vetter 2012-07-02 15508
249293524 Daniel Vetter 2012-07-02 15509 /* Inconsistent output/port/pipe state happens presumably due to
249293524 Daniel Vetter 2012-07-02 15510 * a bug in one of the get_hw_state functions. Or someplace else
249293524 Daniel Vetter 2012-07-02 15511 * in our code, like the register restore mess on resume. Clamp
249293524 Daniel Vetter 2012-07-02 15512 * things to off as a safer default. */
fd6bbda9c Maarten Lankhorst 2016-08-09 15513
7f1950fbb Egbert Eich 2014-04-25 15514 connector->base.dpms = DRM_MODE_DPMS_OFF;
7f1950fbb Egbert Eich 2014-04-25 15515 connector->base.encoder = NULL;
249293524 Daniel Vetter 2012-07-02 15516 }
d6cae4aa3 Maarten Lankhorst 2018-05-16 15517
d6cae4aa3 Maarten Lankhorst 2018-05-16 15518 /* notify opregion of the sanitized encoder state */
d6cae4aa3 Maarten Lankhorst 2018-05-16 15519 intel_opregion_notify_encoder(encoder, connector && has_active_crtc);
70332ac53 Imre Deak 2018-11-01 15520
70332ac53 Imre Deak 2018-11-01 15521 if (INTEL_GEN(dev_priv) >= 11)
70332ac53 Imre Deak 2018-11-01 15522 icl_sanitize_encoder_pll_mapping(encoder);
249293524 Daniel Vetter 2012-07-02 15523 }
249293524 Daniel Vetter 2012-07-02 15524
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
WARNING: multiple messages have this Message-ID (diff)
From: kbuild test robot <lkp@intel.com>
To: kbuild@01.org, Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
kbuild-all@01.org, intel-gfx@lists.freedesktop.org,
Daniel Kamil Kozar <dkk089@gmail.com>,
stable@vger.kernel.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Try to sanitize bogus DPLL state left over by broken SNB BIOSen
Date: Thu, 10 Jan 2019 22:41:09 +0300 [thread overview]
Message-ID: <20190110194109.GH1718@kadam> (raw)
In-Reply-To: <20190109120919.21668-1-ville.syrjala@linux.intel.com>
Hi Ville,
Thank you for the patch! Perhaps something to improve:
url: https://github.com/0day-ci/linux/commits/Ville-Syrjala/drm-i915-Try-to-sanitize-bogus-DPLL-state-left-over-by-broken-SNB-BIOSen/20190109-222838
base: git://anongit.freedesktop.org/drm-intel for-linux-next
New smatch warnings:
drivers/gpu/drm/i915/intel_display.c:15452 has_bogus_dpll_config() warn: variable dereferenced before check 'crtc_state' (see line 15439)
drivers/gpu/drm/i915/intel_display.c:15472 intel_sanitize_encoder() error: we previously assumed 'crtc_state' could be null (see line 15469)
drivers/gpu/drm/i915/intel_display.c:15487 intel_sanitize_encoder() warn: variable dereferenced before check 'crtc_state' (see line 15472)
# https://github.com/0day-ci/linux/commit/5a0056f774727561e522ccde5fe7fe78d343d25f
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 5a0056f774727561e522ccde5fe7fe78d343d25f
vim +/crtc_state +15452 drivers/gpu/drm/i915/intel_display.c
249293524 Daniel Vetter 2012-07-02 15436
5a0056f77 Ville Syrjälä 2019-01-09 15437 static bool has_bogus_dpll_config(struct intel_crtc_state *crtc_state)
5a0056f77 Ville Syrjälä 2019-01-09 15438 {
5a0056f77 Ville Syrjälä 2019-01-09 @15439 struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
5a0056f77 Ville Syrjälä 2019-01-09 15440
5a0056f77 Ville Syrjälä 2019-01-09 15441 /*
5a0056f77 Ville Syrjälä 2019-01-09 15442 * Some SNB BIOSen (eg. ASUS K53SV) are known to misprogram
5a0056f77 Ville Syrjälä 2019-01-09 15443 * the hardware when a high res displays plugged in. DPLL P
5a0056f77 Ville Syrjälä 2019-01-09 15444 * divider is zero, and the pipe timings are bonkers. We'll
5a0056f77 Ville Syrjälä 2019-01-09 15445 * try to disable everything in that case.
5a0056f77 Ville Syrjälä 2019-01-09 15446 *
5a0056f77 Ville Syrjälä 2019-01-09 15447 * FIXME would be nice to be able to sanitize this state
5a0056f77 Ville Syrjälä 2019-01-09 15448 * without several WARNs, but for now let's take the easy
5a0056f77 Ville Syrjälä 2019-01-09 15449 * road.
5a0056f77 Ville Syrjälä 2019-01-09 15450 */
5a0056f77 Ville Syrjälä 2019-01-09 15451 return IS_GEN(dev_priv, 6) &&
5a0056f77 Ville Syrjälä 2019-01-09 @15452 crtc_state &&
5a0056f77 Ville Syrjälä 2019-01-09 15453 crtc_state->base.active &&
5a0056f77 Ville Syrjälä 2019-01-09 15454 crtc_state->shared_dpll &&
5a0056f77 Ville Syrjälä 2019-01-09 15455 crtc_state->port_clock == 0;
5a0056f77 Ville Syrjälä 2019-01-09 15456 }
5a0056f77 Ville Syrjälä 2019-01-09 15457
249293524 Daniel Vetter 2012-07-02 15458 static void intel_sanitize_encoder(struct intel_encoder *encoder)
249293524 Daniel Vetter 2012-07-02 15459 {
70332ac53 Imre Deak 2018-11-01 15460 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
249293524 Daniel Vetter 2012-07-02 15461 struct intel_connector *connector;
5a0056f77 Ville Syrjälä 2019-01-09 15462 struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
5a0056f77 Ville Syrjälä 2019-01-09 15463 struct intel_crtc_state *crtc_state = crtc ?
5a0056f77 Ville Syrjälä 2019-01-09 15464 to_intel_crtc_state(crtc->base.state) : NULL;
249293524 Daniel Vetter 2012-07-02 15465
249293524 Daniel Vetter 2012-07-02 15466 /* We need to check both for a crtc link (meaning that the
249293524 Daniel Vetter 2012-07-02 15467 * encoder is active and trying to read from a pipe) and the
249293524 Daniel Vetter 2012-07-02 15468 * pipe itself being active. */
5a0056f77 Ville Syrjälä 2019-01-09 @15469 bool has_active_crtc = crtc_state &&
5a0056f77 Ville Syrjälä 2019-01-09 15470 crtc_state->base.active;
5a0056f77 Ville Syrjälä 2019-01-09 15471
5a0056f77 Ville Syrjälä 2019-01-09 @15472 if (has_bogus_dpll_config(crtc_state)) {
5a0056f77 Ville Syrjälä 2019-01-09 15473 DRM_DEBUG_KMS("BIOS has misprogrammed the hardware. Disabling pipe %c\n",
5a0056f77 Ville Syrjälä 2019-01-09 15474 pipe_name(crtc->pipe));
5a0056f77 Ville Syrjälä 2019-01-09 15475 has_active_crtc = false;
5a0056f77 Ville Syrjälä 2019-01-09 15476 }
249293524 Daniel Vetter 2012-07-02 15477
496b0fc37 Maarten Lankhorst 2016-08-23 15478 connector = intel_encoder_find_connector(encoder);
496b0fc37 Maarten Lankhorst 2016-08-23 15479 if (connector && !has_active_crtc) {
249293524 Daniel Vetter 2012-07-02 15480 DRM_DEBUG_KMS("[ENCODER:%d:%s] has active connectors but no active pipe!\n",
249293524 Daniel Vetter 2012-07-02 15481 encoder->base.base.id,
8e329a039 Jani Nikula 2014-06-03 15482 encoder->base.name);
249293524 Daniel Vetter 2012-07-02 15483
249293524 Daniel Vetter 2012-07-02 15484 /* Connector is active, but has no active pipe. This is
249293524 Daniel Vetter 2012-07-02 15485 * fallout from our resume register restoring. Disable
249293524 Daniel Vetter 2012-07-02 15486 * the encoder manually again. */
5a0056f77 Ville Syrjälä 2019-01-09 @15487 if (crtc_state) {
5a0056f77 Ville Syrjälä 2019-01-09 15488 struct drm_encoder *best_encoder;
fd6bbda9c Maarten Lankhorst 2016-08-09 15489
249293524 Daniel Vetter 2012-07-02 15490 DRM_DEBUG_KMS("[ENCODER:%d:%s] manually disabled\n",
249293524 Daniel Vetter 2012-07-02 15491 encoder->base.base.id,
8e329a039 Jani Nikula 2014-06-03 15492 encoder->base.name);
5a0056f77 Ville Syrjälä 2019-01-09 15493
5a0056f77 Ville Syrjälä 2019-01-09 15494 /* avoid oopsing in case the hooks consult best_encoder */
5a0056f77 Ville Syrjälä 2019-01-09 15495 best_encoder = connector->base.state->best_encoder;
5a0056f77 Ville Syrjälä 2019-01-09 15496 connector->base.state->best_encoder = &encoder->base;
5a0056f77 Ville Syrjälä 2019-01-09 15497
c84c6fe30 Jani Nikula 2018-10-16 15498 if (encoder->disable)
5a0056f77 Ville Syrjälä 2019-01-09 15499 encoder->disable(encoder, crtc_state,
5a0056f77 Ville Syrjälä 2019-01-09 15500 connector->base.state);
a62d14975 Ville Syrjälä 2014-06-28 15501 if (encoder->post_disable)
5a0056f77 Ville Syrjälä 2019-01-09 15502 encoder->post_disable(encoder, crtc_state,
5a0056f77 Ville Syrjälä 2019-01-09 15503 connector->base.state);
5a0056f77 Ville Syrjälä 2019-01-09 15504
5a0056f77 Ville Syrjälä 2019-01-09 15505 connector->base.state->best_encoder = best_encoder;
249293524 Daniel Vetter 2012-07-02 15506 }
7f1950fbb Egbert Eich 2014-04-25 15507 encoder->base.crtc = NULL;
249293524 Daniel Vetter 2012-07-02 15508
249293524 Daniel Vetter 2012-07-02 15509 /* Inconsistent output/port/pipe state happens presumably due to
249293524 Daniel Vetter 2012-07-02 15510 * a bug in one of the get_hw_state functions. Or someplace else
249293524 Daniel Vetter 2012-07-02 15511 * in our code, like the register restore mess on resume. Clamp
249293524 Daniel Vetter 2012-07-02 15512 * things to off as a safer default. */
fd6bbda9c Maarten Lankhorst 2016-08-09 15513
7f1950fbb Egbert Eich 2014-04-25 15514 connector->base.dpms = DRM_MODE_DPMS_OFF;
7f1950fbb Egbert Eich 2014-04-25 15515 connector->base.encoder = NULL;
249293524 Daniel Vetter 2012-07-02 15516 }
d6cae4aa3 Maarten Lankhorst 2018-05-16 15517
d6cae4aa3 Maarten Lankhorst 2018-05-16 15518 /* notify opregion of the sanitized encoder state */
d6cae4aa3 Maarten Lankhorst 2018-05-16 15519 intel_opregion_notify_encoder(encoder, connector && has_active_crtc);
70332ac53 Imre Deak 2018-11-01 15520
70332ac53 Imre Deak 2018-11-01 15521 if (INTEL_GEN(dev_priv) >= 11)
70332ac53 Imre Deak 2018-11-01 15522 icl_sanitize_encoder_pll_mapping(encoder);
249293524 Daniel Vetter 2012-07-02 15523 }
249293524 Daniel Vetter 2012-07-02 15524
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
next prev parent reply other threads:[~2019-01-10 19:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-09 12:09 [PATCH] drm/i915: Try to sanitize bogus DPLL state left over by broken SNB BIOSen Ville Syrjala
2019-01-09 12:09 ` Ville Syrjala
2019-01-09 13:52 ` ✓ Fi.CI.BAT: success for " Patchwork
2019-01-09 16:08 ` ✓ Fi.CI.IGT: " Patchwork
2019-01-10 19:41 ` kbuild test robot [this message]
2019-01-10 19:41 ` [Intel-gfx] [PATCH] " kbuild test robot
2019-01-11 17:49 ` [PATCH v2] " Ville Syrjala
2019-01-11 17:49 ` Ville Syrjala
2019-01-16 13:35 ` Sasha Levin
2019-01-28 9:30 ` Kahola, Mika
2019-01-28 9:30 ` [Intel-gfx] " Kahola, Mika
2019-01-28 14:01 ` Ville Syrjälä
2019-01-11 18:25 ` ✓ Fi.CI.BAT: success for drm/i915: Try to sanitize bogus DPLL state left over by broken SNB BIOSen (rev2) Patchwork
2019-01-11 22:45 ` ✓ Fi.CI.IGT: " Patchwork
2019-01-16 13:35 ` [PATCH] drm/i915: Try to sanitize bogus DPLL state left over by broken SNB BIOSen Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190110194109.GH1718@kadam \
--to=lkp@intel.com \
--cc=dan.carpenter@oracle.com \
--cc=dkk089@gmail.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=kbuild-all@01.org \
--cc=kbuild@01.org \
--cc=stable@vger.kernel.org \
--cc=ville.syrjala@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.