Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: "Jouni Högander" <jouni.hogander@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: "Jouni Högander" <jouni.hogander@intel.com>,
	"Animesh Manna" <animesh.manna@intel.com>,
	stable@vger.kernel.org
Subject: [PATCH] drm/i915/alpm: Track the configured transcoder lifetime
Date: Fri, 20 Nov 2026 13:24:46 +0200	[thread overview]
Message-ID: <20261120112446.1562267-1-jouni.hogander@intel.com> (raw)

ALPM disable can access a stale transcoder when ALPM was not configured
for the current modeset, causing unclaimed register accesses during
pipe teardown.

Record the transcoder only when programming ALPM and invalidate it
after disable. Check it under the ALPM lock to avoid register accesses
on repeated or unconfigured disables.

Fixes: 504766382edb ("drm/i915/lobf: Disintegrate alpm_disable from psr_disable")
Cc: Animesh Manna <animesh.manna@intel.com>
Cc: <stable@vger.kernel.org> # v6.16+
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
---
 drivers/gpu/drm/i915/display/intel_alpm.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_alpm.c b/drivers/gpu/drm/i915/display/intel_alpm.c
index f54b29e193ee9..105006ca6be7f 100644
--- a/drivers/gpu/drm/i915/display/intel_alpm.c
+++ b/drivers/gpu/drm/i915/display/intel_alpm.c
@@ -46,6 +46,7 @@ bool intel_alpm_is_alpm_aux_less(struct intel_dp *intel_dp,
 void intel_alpm_init(struct intel_dp *intel_dp)
 {
 	mutex_init(&intel_dp->alpm.lock);
+	intel_dp->alpm.transcoder = INVALID_TRANSCODER;
 }
 
 static int get_silence_period_symbols(const struct intel_crtc_state *crtc_state)
@@ -549,6 +550,7 @@ static void lnl_alpm_configure(struct intel_dp *intel_dp,
 	alpm_ctl |= ALPM_CTL_ALPM_ENTRY_CHECK(crtc_state->alpm_state.check_entry_lines);
 
 	intel_de_write(display, ALPM_CTL(display, cpu_transcoder), alpm_ctl);
+	intel_dp->alpm.transcoder = cpu_transcoder;
 	mutex_unlock(&intel_dp->alpm.lock);
 }
 
@@ -556,7 +558,6 @@ void intel_alpm_configure(struct intel_dp *intel_dp,
 			  const struct intel_crtc_state *crtc_state)
 {
 	lnl_alpm_configure(intel_dp, crtc_state);
-	intel_dp->alpm.transcoder = crtc_state->cpu_transcoder;
 }
 
 void intel_alpm_port_configure(struct intel_dp *intel_dp,
@@ -733,17 +734,23 @@ void intel_alpm_lobf_debugfs_add(struct intel_connector *connector)
 void intel_alpm_disable(struct intel_dp *intel_dp)
 {
 	struct intel_display *display = to_intel_display(intel_dp);
-	enum transcoder cpu_transcoder = intel_dp->alpm.transcoder;
+	enum transcoder cpu_transcoder;
 
 	if (DISPLAY_VER(display) < 20 || !intel_dp->alpm_dpcd)
 		return;
 
 	mutex_lock(&intel_dp->alpm.lock);
 
+	cpu_transcoder = intel_dp->alpm.transcoder;
+	if (cpu_transcoder == INVALID_TRANSCODER)
+		goto unlock;
+
 	intel_de_rmw(display, ALPM_CTL(display, cpu_transcoder),
 		     ALPM_CTL_ALPM_ENABLE | ALPM_CTL_LOBF_ENABLE, 0);
+	intel_dp->alpm.transcoder = INVALID_TRANSCODER;
 
 	drm_dbg_kms(display->drm, "Disabling ALPM\n");
+unlock:
 	mutex_unlock(&intel_dp->alpm.lock);
 }
 
-- 
2.53.0


             reply	other threads:[~2026-11-20 11:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 11:24 Jouni Högander [this message]
2026-11-20 14:59 ` [PATCH] drm/i915/alpm: Track the configured transcoder lifetime Jani Nikula

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=20261120112446.1562267-1-jouni.hogander@intel.com \
    --to=jouni.hogander@intel.com \
    --cc=animesh.manna@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox