FAILED: patch "[PATCH] drm/i915/cdclk: Fix voltage_level programming edge case" failed to apply to 5.15-stable tree
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x 6154cc9177ccea00c89ce0bf93352e474b819ff2
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024041519-zoning-angling-730e@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 6154cc9177ccea00c89ce0bf93352e474b819ff2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <[email protected]>
Date: Tue, 2 Apr 2024 18:50:04 +0300
Subject: [PATCH] drm/i915/cdclk: Fix voltage_level programming edge case
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Currently we only consider the relationship of the old and new CDCLK frequencies when determining whether to do the repgramming from intel_set_cdclk_pre_plane_update() or intel_set_cdclk_post_plane_update().
It is technically possible to have a situation where the CDCLK frequency is decreasing, but the voltage_level is increasing due a DDI port. In this case we should bump the voltage level already in intel_set_cdclk_pre_plane_update() (so that the voltage_level will have been increased by the time the port gets enabled), while leaving the CDCLK frequency unchanged (as active planes/etc. may still depend on it). We can then reduce the CDCLK frequency to its final value from intel_set_cdclk_post_plane_update().
In order to handle that correctly we shall construct a suitable amalgam of the old and new cdclk states in intel_set_cdclk_pre_plane_update().
And we can simply call intel_set_cdclk() unconditionally in both places as it will not do anything if nothing actually changes vs. the current hw state.
v2: Handle cdclk_state->disable_pipes
v3: Only synchronize the cd2x update against the pipe's vblank
when the cdclk frequency is changing during the current commit phase (Gustavo)
drivers/gpu/drm/i915/display/intel_cdclk.c +27 -10
@@ -2534,7 +2534,8 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)intel_atomic_get_old_cdclk_state (state);const struct intel_cdclk_state *new_cdclk_state =intel_atomic_get_new_cdclk_state (state); -enum pipe pipe = new_cdclk_state->pipe; +struct intel_cdclk_config cdclk_config; +enum pipe pipe;if (!intel_cdclk_changed (&old_cdclk_state->actual, &new_cdclk_state->actual))
@@ -2543,12 +2544,25 @@ intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)if (IS_DG2 (i915))intel_cdclk_pcode_pre_notify (state); -if (new_cdclk_state->disable_pipes || - old_cdclk_state->actual.cdclk <= new_cdclk_state->actual.cdclk) { -drm_WARN_ON (&i915->drm, !new_cdclk_state->base.changed); +if (new_cdclk_state->disable_pipes) { + cdclk_config = new_cdclk_state->actual; + pipe =INVALID_PIPE ; + }else { +if (new_cdclk_state->actual.cdclk >= old_cdclk_state->actual.cdclk) { + cdclk_config = new_cdclk_state->actual; + pipe = new_cdclk_state->pipe; + }else { + cdclk_config = old_cdclk_state->actual; + pipe =INVALID_PIPE ; + } -intel_set_cdclk (i915, &new_cdclk_state->actual, pipe); + cdclk_config.voltage_level =max (new_cdclk_state->actual.voltage_level, + old_cdclk_state->actual.voltage_level); } + +drm_WARN_ON (&i915->drm, !new_cdclk_state->base.changed); + +intel_set_cdclk (i915, &cdclk_config, pipe); }/**
@@ -2566,7 +2580,7 @@ intel_set_cdclk_post_plane_update(struct intel_atomic_state *state)intel_atomic_get_old_cdclk_state (state);const struct intel_cdclk_state *new_cdclk_state =intel_atomic_get_new_cdclk_state (state); -enum pipe pipe = new_cdclk_state->pipe; +enum pipe pipe;if (!intel_cdclk_changed (&old_cdclk_state->actual, &new_cdclk_state->actual))
@@ -2576,11 +2590,14 @@ intel_set_cdclk_post_plane_update(struct intel_atomic_state *state)intel_cdclk_pcode_post_notify (state);if (!new_cdclk_state->disable_pipes && - old_cdclk_state->actual.cdclk > new_cdclk_state->actual.cdclk) { -drm_WARN_ON (&i915->drm, !new_cdclk_state->base.changed); + new_cdclk_state->actual.cdclk < old_cdclk_state->actual.cdclk) + pipe = new_cdclk_state->pipe; +else + pipe =INVALID_PIPE ; -intel_set_cdclk (i915, &new_cdclk_state->actual, pipe); - } +drm_WARN_ON (&i915->drm, !new_cdclk_state->base.changed); + +intel_set_cdclk (i915, &new_cdclk_state->actual, pipe); }static int intel_pixel_rate_to_cdclk (const struct intel_crtc_state *crtc_state)