Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [High] drm/tilcdc: skipped tilcdc_crtc_hw_reset() in tilcdc_pdev_probe()
--

commit a7aa194e686d4c29674928aee2622cefc3bf4547
Author: Maxime Ripard <[email protected]>

drm/tilcdc: Switch to drm_mode_config_create_initial_state

This commit replaces drm_mode_config_reset() with
drm_mode_config_create_initial_state() in tilcdc_pdev_probe() to separate
initial KMS state creation at probe time from suspend/resume resets.

> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c 
> b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> index 1d6c9a423a410..da718d9cb1d69 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> @@ -422,7 +422,9 @@ static int tilcdc_pdev_probe(struct platform_device *pdev)
>               goto unregister_cpufreq_notif;
>       }
>  
> -     drm_mode_config_reset(ddev);
> +     ret = drm_mode_config_create_initial_state(ddev);
> +     if (ret)
> +             goto stop_poll;

[Severity: High]
Does replacing drm_mode_config_reset() with
drm_mode_config_create_initial_state() in tilcdc_pdev_probe() skip calling
tilcdc_crtc_hw_reset() at probe time?

In drivers/gpu/drm/tilcdc/tilcdc_crtc.c, tilcdc_crtc_hw_reset() is
registered as the drm_crtc_helper_funcs.hw_reset callback to turn off the
LCDC raster if the bootloader left it enabled, synchronizing the hardware
with the initial disabled software CRTC state:

drivers/gpu/drm/tilcdc/tilcdc_crtc.c:tilcdc_crtc_hw_reset() {
        /* Turn the raster off if it for some reason is on. */
        pm_runtime_get_sync(dev->dev);
        if (tilcdc_read(dev, LCDC_RASTER_CTRL_REG) & LCDC_RASTER_ENABLE) {
                /* Enable DMA Frame Done Interrupt */
                tilcdc_write(dev, LCDC_INT_ENABLE_SET_REG, LCDC_FRAME_DONE);
                tilcdc_clear_irqstatus(dev, 0xffffffff);

                tilcdc_crtc->frame_done = false;
                tilcdc_clear(dev, LCDC_RASTER_CTRL_REG, LCDC_RASTER_ENABLE);
                ...
        }
        pm_runtime_put_sync(dev->dev);
}

This logic was added in commit 46a956ab3c5b ("drm/tilcdc: Turn raster off
in crtc reset, if it was on in the HW") and moved to the hw_reset hook in
commit 6e531fda1d6b ("drm/tilcdc: Move hardware reset to hw_reset hook").

Previously, tilcdc_pdev_probe() called drm_mode_config_reset() right after
tilcdc_irq_install(), which ran
drm_mode_config_crtc_reset_with_create_state() ->
helper_funcs->hw_reset(crtc).

However, drm_mode_config_create_initial_state() calls
drm_mode_config_crtc_create_state() directly without invoking
helper_funcs->hw_reset(crtc).

If the bootloader leaves LCDC_RASTER_ENABLE active at boot, won't the
hardware raster remain running while crtc->state->active and
tilcdc_crtc->enabled are initialized to false, causing the first modeset in
tilcdc_crtc_atomic_enable() -> tilcdc_crtc_enable() ->
tilcdc_crtc_set_mode() -> tilcdc_crtc_load_palette() to reprogram timings
and palette DMA while the raster is still active?

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=59

Reply via email to