Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Krzysztof Kozlowski" <krzysztof.kozlowski@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 2/7] drm/msm/hdmi: Handle msm_hdmi_power_on() errors during .atomic_pre_enable()
Date: Mon, 07 Sep 2026 13:14:19 +0000	[thread overview]
Message-ID: <20260907131419.D9BEF1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260907-drm-msm-hdmi-fixes-before-eliza-v2-2-b097cf1eac77@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Imprecise abort (kernel panic) in .atomic_post_disable() due to unclocked MMIO access after a failure in .atomic_pre_enable().
--

commit 4f4c185244ef7ea6a900e7c373d8e29c18ab92a6
Author: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

    drm/msm/hdmi: Handle msm_hdmi_power_on() errors during .atomic_pre_enable()
    
    Properly handle power up failures during .atomic_pre_enable() by
    aborting the .atomic_pre_enable() to avoid accessing registers why
    blocks did not bring up.  Otherwise this could lead to imprecise aborts
    when accessing MMIO while entire power domain is off.

> 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);
>  
> -	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;
> +			}
> +			hdmi->power_on = true;
> +		}
>  	}

[Severity: High]
Does this early return cause an imprecise abort during atomic_post_disable()?

Since atomic_pre_enable() returns void, the DRM core will consider the state
committed even if it returns early here. This leaves hdmi->power_on = false
and the PHY clocks and PM domain powered off.

When the pipeline is later disabled, msm_hdmi_bridge_atomic_post_disable()
will execute:

drivers/gpu/drm/msm/hdmi/hdmi_bridge.c:msm_hdmi_bridge_atomic_post_disable() {
    ...
    /* Keep the HDMI enabled if the HPD is enabled */
    mutex_lock(&hdmi->state_mutex);
    msm_hdmi_set_mode(hdmi, hdmi->hpd_enabled);

    msm_hdmi_phy_powerdown(phy);

    if (hdmi->power_on) {
    ...
}

Because msm_hdmi_set_mode() and msm_hdmi_phy_powerdown() are called
unconditionally outside the if (hdmi->power_on) block, won't they write to
MMIO registers while the power domain is off, causing an access fault?

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

  reply	other threads:[~2026-09-07 13:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07 13:00 [PATCH v2 0/7] drm/msm/hdmi: Fixes/Cleanups before Eliza Krzysztof Kozlowski
2026-09-07 13:00 ` [PATCH v2 1/7] drm/msm/hdmi_phy: Cleanup after msm_hdmi_phy_resource_enable() failure Krzysztof Kozlowski
2026-09-07 13:06   ` sashiko-bot
2026-09-07 13:17     ` Krzysztof Kozlowski
2026-09-07 13:00 ` [PATCH v2 2/7] drm/msm/hdmi: Handle msm_hdmi_power_on() errors during .atomic_pre_enable() Krzysztof Kozlowski
2026-09-07 13:14   ` sashiko-bot [this message]
2026-09-07 13:19     ` Krzysztof Kozlowski
2026-09-07 13:00 ` [PATCH v2 3/7] drm/msm/hdmi_bridge: Correct poweroff/audio cleanup order in post_disable Krzysztof Kozlowski
2026-09-07 13:11   ` sashiko-bot
2026-09-07 13:21     ` Krzysztof Kozlowski
2026-09-07 13:00 ` [PATCH v2 4/7] drm/msm/hdmi_bridge: Drop redundant initialization in msm_hdmi_bridge_init() Krzysztof Kozlowski
2026-09-07 13:00 ` [PATCH v2 5/7] drm/msm: Properly handle msm_ioremap() without name Krzysztof Kozlowski
2026-09-07 13:36   ` Abel Vesa
2026-09-07 13:00 ` [PATCH v2 6/7] drm/msm/dsi: Fix indentation of if block in dsi_mgr_bridge_mode_valid() Krzysztof Kozlowski
2026-09-07 13:00 ` [PATCH v2 7/7] dt-bindings: display/msm: hdmi: Correct name of disallowed supplies Krzysztof Kozlowski

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=20260907131419.D9BEF1F00A3A@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox