Re: [PATCH v3 1/2] drm/imx/lcdc: avoid duplicate clk_per enable

[email protected]
Newsgroups dev.linux.lists.imx
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Calls to sleeping functions (`clk_prepare_enable` and `clk_disable_unprepare`) from the plane atomic update and CRTC enable/disable callbacks, violating DRM atomic context requirements.
--

--- Patch [1]: [PATCH v3 1/2] drm/imx/lcdc: avoid duplicate clk_per enable ---
commit 48c4f154b28e9de1d485ea56766c8a24df823739
Author: Ze Huang <[email protected]>

drm/imx/lcdc: avoid duplicate clk_per enable

The simple-KMS helper calls the pipe update after enabling the CRTC,
which causes imx_lcdc_update_hw_registers() to be called again. This
patch avoids the duplicate clock enable by skipping the register update
when the CRTC already needs a modeset.

> diff --git a/drivers/gpu/drm/imx/lcdc/imx-lcdc.c b/drivers/gpu/drm/imx/lcdc/imx-lcdc.c
> index c67fe80b8115e..e00e52c1c46ec 100644
> --- a/drivers/gpu/drm/imx/lcdc/imx-lcdc.c
> +++ b/drivers/gpu/drm/imx/lcdc/imx-lcdc.c
> @@ -310,7 +310,8 @@ static void imx_lcdc_pipe_update(struct drm_simple_display_pipe *pipe,
>  	else if (old_crtc != crtc)
>  		mode_changed = true;
>  
> -	imx_lcdc_update_hw_registers(pipe, old_state, mode_changed);
> +	if (!drm_atomic_crtc_needs_modeset(crtc->state))
> +		imx_lcdc_update_hw_registers(pipe, old_state, mode_changed);

[Severity: High]
This is a pre-existing issue, but does calling imx_lcdc_update_hw_registers()
from imx_lcdc_pipe_update() risk sleeping in an atomic context?

imx_lcdc_pipe_update() acts as a plane atomic update callback, which executes
in an atomic context where sleeping is forbidden. However, it calls
imx_lcdc_update_hw_registers(), which in turn calls sleeping functions:

imx_lcdc_update_hw_registers() {
    ...
    clk_disable_unprepare(lcdc->clk_per);
    ...
    clk_prepare_enable(lcdc->clk_per);
    ...
}

Will this cause 'scheduling while atomic' panics when a plane format changes
without a full modeset?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260727-drm-simple-kms-removal-v3-0-de36e534f7a1@oss.qualcomm.com?part=1
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.