Re: [PATCH v8 19/21] drm/bridge: synopsys: dw-dp: Use regmap_set_bits in dw_dp_send_sdp

[email protected]
Newsgroups org.freedesktop.lists.dri-devel,org.kernel.vger.linux-devicetree
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] A mutex is acquired in dw_dp_send_sdp(), which is called from the bridge's atomic enable path, violating atomic context rules.
--

--- Patch [19]: [PATCH v8 19/21] drm/bridge: synopsys: dw-dp: Use regmap_set_bits in dw_dp_send_sdp ---
commit fbf6588f46fe1b8bc7ef347644cccb5c7a752410
Author: Sebastian Reichel <[email protected]>

drm/bridge: synopsys: dw-dp: Use regmap_set_bits in dw_dp_send_sdp

This commit simplifies dw_dp_send_sdp() by making use of regmap_set_bits
instead of regmap_update_bits. No functional change is intended.

> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-dp.c b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
> --- a/drivers/gpu/drm/bridge/synopsys/dw-dp.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
> @@ -1070,14 +1070,12 @@ static int dw_dp_send_sdp(struct dw_dp *dp, struct dw_dp_sdp *sdp)

[Severity: High]
Does this function sleep in an atomic context?

Looking at dw_dp_send_sdp(), it acquires a sleeping lock via
scoped_guard(mutex, &dp->sdp_lock) earlier in the function. However, this
is called from the bridge's atomic enable path:

drm_atomic_helper_commit_tail()
  -> dw_dp_bridge_atomic_enable()
    -> dw_dp_video_enable()
      -> dw_dp_send_vsc_sdp()
        -> dw_dp_send_sdp()

Can this sequence cause a kernel splat ("BUG: sleeping function called from
invalid context") or potential deadlocks when modesetting, since it executes
within drm_atomic_helper_commit_tail() where sleeping is forbidden?

>  			     FIELD_PREP(SDP_REGS, get_unaligned_le32(payload)));
>  
>  	if (sdp->flags & DW_DP_SDP_VERTICAL_INTERVAL)
> -		regmap_update_bits(dp->regmap, DW_DP_SDP_VERTICAL_CTRL,
> -				   EN_VERTICAL_SDP << nr,
> -				   EN_VERTICAL_SDP << nr);
> +		regmap_set_bits(dp->regmap, DW_DP_SDP_VERTICAL_CTRL,
> +				EN_VERTICAL_SDP << nr);
>  
>  	if (sdp->flags & DW_DP_SDP_HORIZONTAL_INTERVAL)
> -		regmap_update_bits(dp->regmap, DW_DP_SDP_HORIZONTAL_CTRL,
> -				   EN_HORIZONTAL_SDP << nr,
> -				   EN_HORIZONTAL_SDP << nr);
> +		regmap_set_bits(dp->regmap, DW_DP_SDP_HORIZONTAL_CTRL,
> +				EN_HORIZONTAL_SDP << nr);
>  
>  	return nr;
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260731-synopsys-dw-dp-improvements-v8-0-ac1e6a75782f@collabora.com?part=19
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.