Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/tidss: request_irq() called before hardware reset in
  tidss_probe()
--

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

drm/tidss: Implement hw_reset

This commit moves the DISPC hardware reset out of dispc_init() into a new
drm_mode_config_funcs.hw_reset callback so the hardware is only reset on
the reset path during initial state creation.

> diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c 
> b/drivers/gpu/drm/tidss/tidss_dispc.c
> index 8c4d7e148eb0e..e186c63ba5fb9 100644
> --- a/drivers/gpu/drm/tidss/tidss_dispc.c
> +++ b/drivers/gpu/drm/tidss/tidss_dispc.c
[ ... ]
> @@ -3003,10 +2994,6 @@ int dispc_init(struct tidss_device *tidss)
>       of_property_read_u32(dispc->dev->of_node, "max-memory-bandwidth",
>                            &dispc->memory_bandwidth_limit);
>  
> -     r = dispc_init_hw(dispc);
> -     if (r)
> -             return r;
> -
>       tidss->dispc = dispc;
>  
>       return 0;

[Severity: Medium]
Can moving the hardware reset from dispc_init() to
drm_mode_config_create_initial_state() allow tidss_irq_handler() to fire
while the device is still runtime-suspended?

Commit d4652187367b ("drm/tidss: IRQ code cleanup") dropped hardware IRQ
masking from tidss_irq_install() because dispc_init() had already reset
the hardware and masked all IRQs before request_irq().  With the reset
deferred to drm_mode_config_create_initial_state(), tidss_probe() now
calls tidss_irq_install() -> request_irq() before the hardware is reset:

drivers/gpu/drm/tidss/tidss_drv.c:tidss_probe() {
    ...
        ret = tidss_irq_install(ddev, irq);
        if (ret) {
                dev_err(dev, "tidss_irq_install failed: %d\n", ret);
                goto err_runtime_suspend;
        }

        drm_kms_helper_poll_init(ddev);

        ret = drm_mode_config_create_initial_state(ddev);
    ...
}

If the bootloader or a previous kexec kernel left DISPC interrupts
enabled, an interrupt arriving after request_irq() will run
tidss_irq_handler() -> dispc_read_and_clear_irqstatus() while the device
is runtime-suspended and dispc->fclk is disabled, causing unclocked MMIO
register accesses.

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

Reply via email to