All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Krzysztof Kozlowski" <krzysztof.kozlowski@oss.qualcomm.com>
Cc: robh@kernel.org, conor+dt@kernel.org,
	dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v3 2/7] drm/msm/hdmi: Handle msm_hdmi_power_on() errors during .atomic_pre_enable()
Date: Tue, 08 Sep 2026 07:25:45 +0000	[thread overview]
Message-ID: <20260908072546.645FF1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260908-drm-msm-hdmi-fixes-before-eliza-v3-2-dcf8956878ca@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [High] Aborting `atomic_pre_enable()` on power-on failure guarantees an imprecise abort (system crash) in `atomic_post_disable()` due to unconditional accesses to unpowered PHY and HDMI controller registers.

Pre-existing issues:
- [High] Unclocked MMIO access in `msm_hdmi_set_timings()` before the HDMI PM runtime is resumed.
--

commit 9912da31672d32069f2e4d118d3714a533a0157a
Author: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
drm/msm/hdmi: Handle msm_hdmi_power_on() errors during .atomic_pre_enable()

This commit adds error handling for msm_hdmi_power_on() during the 
.atomic_pre_enable() phase to prevent register accesses if the power 
domain fails to come up.

Cc: <stable@vger.kernel.org>

> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
> index 157f19bd90b4e..db85400e574e4 100644
> --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
> +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c

[ ... ]

> @@ -287,13 +294,18 @@ static void msm_hdmi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
>  
>  	msm_hdmi_set_timings(hdmi, &crtc_state->adjusted_mode);

[Severity: High]
This is a pre-existing issue, but does calling msm_hdmi_set_timings() here
risk unclocked MMIO access?

This register access occurs before the power domain is reliably enabled by
msm_hdmi_power_on() later in this function. If the connector is forced on
while disconnected (so HPD is disabled and no background PM reference is
held), the AHB/APB clocks for the HDMI block are off.

Writing to these registers without an active clock can immediately stall the
bus and cause an imprecise external abort (kernel panic).

> -	mutex_lock(&hdmi->state_mutex);
> -	if (!hdmi->power_on) {
> -		msm_hdmi_phy_resource_enable(phy);
> -		msm_hdmi_power_on(bridge);
> -		hdmi->power_on = true;
> +	scoped_guard(mutex, &hdmi->state_mutex) {
> +		if (!hdmi->power_on) {
> +			if (msm_hdmi_phy_resource_enable(phy))
> +				return;
> +
> +			if (msm_hdmi_power_on(bridge)) {
> +				msm_hdmi_phy_resource_disable(phy);
> +				return;

[Severity: High]
Does aborting here guarantee a crash later during teardown?

When this error path disables PHY resources and returns early, it leaves
hdmi->power_on = false. However, because atomic_pre_enable() returns void,
the DRM core is unaware of the failure and continues the modeset sequence.

Eventually, the DRM core will call msm_hdmi_bridge_atomic_post_disable(),
which unconditionally writes to unpowered registers:

msm_hdmi_bridge_atomic_post_disable() {
    ...
    msm_hdmi_set_mode(hdmi, hdmi->hpd_enabled);
    msm_hdmi_phy_powerdown(phy);
}

Since the PHY clocks were explicitly disabled by this error path, accessing
these registers without an active clock will cause an imprecise external
abort on MSM hardware.

> +			}
> +			hdmi->power_on = true;
> +		}
>  	}
> -	mutex_unlock(&hdmi->state_mutex);
>  
>  	if (connector->display_info.is_hdmi)
>  		msm_hdmi_audio_update(hdmi);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260908-drm-msm-hdmi-fixes-before-eliza-v3-0-dcf8956878ca@oss.qualcomm.com?part=2

  reply	other threads:[~2026-09-08  7:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08  7:10 [PATCH v3 0/7] drm/msm/hdmi: Fixes/Cleanups before Eliza Krzysztof Kozlowski
2026-09-08  7:10 ` [PATCH v3 1/7] drm/msm/hdmi_phy: Cleanup after msm_hdmi_phy_resource_enable() failure Krzysztof Kozlowski
2026-09-08  8:02   ` Konrad Dybcio
2026-09-08  7:10 ` [PATCH v3 2/7] drm/msm/hdmi: Handle msm_hdmi_power_on() errors during .atomic_pre_enable() Krzysztof Kozlowski
2026-09-08  7:25   ` sashiko-bot [this message]
2026-09-08  8:37     ` Krzysztof Kozlowski
2026-09-08  7:10 ` [PATCH v3 3/7] drm/msm/hdmi_bridge: Correct poweroff/audio cleanup order in post_disable Krzysztof Kozlowski
2026-09-08  7:23   ` sashiko-bot
2026-09-08  8:36     ` Krzysztof Kozlowski
2026-09-08  8:00   ` Konrad Dybcio
2026-09-08  7:10 ` [PATCH v3 4/7] drm/msm/hdmi_bridge: Drop redundant initialization in msm_hdmi_bridge_init() Krzysztof Kozlowski
2026-09-08  7:10 ` [PATCH v3 5/7] drm/msm: Properly handle msm_ioremap() without name Krzysztof Kozlowski
2026-09-08  7:59   ` Konrad Dybcio
2026-09-08  8:39     ` Krzysztof Kozlowski
2026-09-08  7:10 ` [PATCH v3 6/7] drm/msm/dsi: Fix indentation of if block in dsi_mgr_bridge_mode_valid() Krzysztof Kozlowski
2026-09-08  7:10 ` [PATCH v3 7/7] dt-bindings: display/msm: hdmi: Correct name of disallowed supplies Krzysztof Kozlowski
2026-09-08  7:22   ` sashiko-bot
2026-09-08  8:36     ` Krzysztof Kozlowski
2026-09-08 18:00   ` Conor Dooley

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=20260908072546.645FF1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.