From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ian Rogers <irogers@google.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Tvrtko Ursulin <tursulin@ursulin.net>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev, Elkin Cruz <elkin@google.com>,
Ian Rogers <irogers@google.com>,
Mika Kahola <mika.kahola@intel.com>
Subject: Re: [PATCH] drm/i915/display: Pass crtc->pipe to intel_pmdemand_update_port_clock()
Date: Fri, 20 Nov 2026 11:13:51 +0200 [thread overview]
Message-ID: <bc01cd57f349fa647fb0e38bfbbcba108ff8289e@intel.com> (raw)
In-Reply-To: <20261119170642.1521198-1-irogers@google.com>
On Thu, 19 Nov 2026, Ian Rogers <irogers@google.com> wrote:
> In intel_modeset_readout_hw_state(), 'pipe' is only populated inside the
> earlier for_each_intel_encoder() loop. Later, inside
> for_each_intel_crtc(), intel_pmdemand_update_port_clock() is called with
> 'pipe' instead of 'crtc->pipe'.
>
> When the encoder list is empty (for example on headless SKUs or VBT
> configurations with all display outputs disabled), 'pipe' is completely
> uninitialized and indexes out-of-bounds into pmdemand_state->ddi_clocks[].
> Even when encoders are present, every CRTC iteration overwrites the slot
> for the last encoder's pipe rather than updating crtc->pipe.
>
> Scope 'pipe' locally to for_each_intel_encoder() and pass crtc->pipe to
> intel_pmdemand_update_port_clock().
>
> Found via an x86_64 LLVM=1 (Clang 21.1.8) allyesconfig audit with
> -Wconditional-uninitialized enabled; fix and changelog drafted with an AI
> coding assistant. Build-tested for both i915 and xe under LLVM=1 W=1
> (-Werror) and -Wconditional-uninitialized; not runtime-tested on Intel
> Xe_LPD+ hardware.
>
> Fixes: 4c4cc7ac207f ("drm/i915/mtl: Add support for PM DEMAND")
> Signed-off-by: Ian Rogers <irogers@google.com>
Cc: <stable@vger.kernel.org> # v6.5+
Cc: Mika Kahola <mika.kahola@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_modeset_setup.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_modeset_setup.c b/drivers/gpu/drm/i915/display/intel_modeset_setup.c
> index 6aed88173770..e5d7c05e006a 100644
> --- a/drivers/gpu/drm/i915/display/intel_modeset_setup.c
> +++ b/drivers/gpu/drm/i915/display/intel_modeset_setup.c
> @@ -695,7 +695,6 @@ static void intel_modeset_readout_hw_state(struct intel_display *display)
> {
> struct intel_pmdemand_state *pmdemand_state =
> to_intel_pmdemand_state(display->pmdemand.obj.state);
> - enum pipe pipe;
> struct intel_crtc *crtc;
> struct intel_encoder *encoder;
> struct intel_connector *connector;
> @@ -726,8 +725,7 @@ static void intel_modeset_readout_hw_state(struct intel_display *display)
>
> for_each_intel_encoder(display->drm, encoder) {
> struct intel_crtc_state *crtc_state = NULL;
> -
> - pipe = 0;
> + enum pipe pipe = PIPE_A;
>
> if (encoder->get_hw_state(encoder, &pipe)) {
> crtc = intel_crtc_for_pipe(display, pipe);
> @@ -869,7 +867,8 @@ static void intel_modeset_readout_hw_state(struct intel_display *display)
> drm_dbg_kms(display->drm, "[CRTC:%d:%s] min_cdclk %d kHz\n",
> crtc->base.base.id, crtc->base.name, crtc_state->min_cdclk);
>
> - intel_pmdemand_update_port_clock(display, pmdemand_state, pipe,
> + intel_pmdemand_update_port_clock(display, pmdemand_state,
> + crtc->pipe,
> crtc_state->port_clock);
> }
--
Jani Nikula, Intel
prev parent reply other threads:[~2026-11-20 9:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 17:06 [PATCH] drm/i915/display: Pass crtc->pipe to intel_pmdemand_update_port_clock() Ian Rogers
2026-11-19 21:40 ` ✓ CI.KUnit: success for " Patchwork
2026-11-19 22:18 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-19 23:33 ` ✓ i915.CI.BAT: " Patchwork
2026-11-20 9:13 ` Jani Nikula [this message]
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=bc01cd57f349fa647fb0e38bfbbcba108ff8289e@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=elkin@google.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=irogers@google.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mika.kahola@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=tursulin@ursulin.net \
/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.