Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:

Pre-existing issues:
- [High] Missing IRQ suspension in device probe error paths causes potential 
bus faults on shared IRQ lines.
--

commit 57c2c2f2f808cb53bd917f5b98f5700e0bc31b52
Author: Adrián Larumbe <[email protected]>

drm/panfrost: Split subsystem init/reset from interrupt enablement

This commit decouples GPU, MMU, and Job Manager initialization and reset
sequences from interrupt enablement. It ensures subsystems only enable their
interrupts explicitly and handles IRQ toggling manually during probe, reset,
and removal.

> diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c 
> b/drivers/gpu/drm/panfrost/panfrost_device.c
> index 9e02fb5f73c82..99f7da2180f92 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_device.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_device.c
[ ... ]
> @@ -315,6 +338,7 @@ int panfrost_device_init(struct panfrost_device *pfdev)
>  
>  out_devreg:
>       pm_runtime_disable(pfdev->base.dev);
> +     panfrost_device_disable_hw(pfdev);
>       panfrost_gem_fini(pfdev);
>  out_perfcnt:
>       panfrost_perfcnt_fini(pfdev);
>  out_job:
>       panfrost_jm_fini(pfdev);
>  out_mmu:
>       panfrost_mmu_fini(pfdev);
>  out_gpu:
>       panfrost_gpu_fini(pfdev);

[Severity: High]
This isn't a bug introduced by this patch, but is there a missing IRQ
suspension in the earlier error paths?

If probe fails early (for example, during panfrost_mmu_init() or later), the
error path jumps to out_mmu or out_gpu, calling panfrost_gpu_fini(),
panfrost_clk_fini(), etc. This powers off sub-blocks and disables clocks.

However, because panfrost_gpu_suspend_irq() (and its equivalents) are bypassed
on these early error paths, the is_suspended state remains 0. The IRQ was
already requested with devm_request_irq() in panfrost_gpu_init(), and is only
freed later during devres cleanup.

If the IRQ line is shared with another active device (IRQF_SHARED is used by
the driver), an interrupt in this window could cause panfrost_gpu_irq_handler()
to read GPU_FAULT_STATUS from disabled hardware:

drivers/gpu/drm/panfrost/panfrost_gpu.c:panfrost_gpu_irq_handler() {
    if (test_bit(PANFROST_COMP_BIT_GPU, pfdev->is_suspended))
        return IRQ_NONE;

    fault_status = gpu_read(pfdev, GPU_FAULT_STATUS);
    ...
}

Can this lead to a bus fault and kernel panic on systems where the GPU IRQ is
shared?

-- 
Sashiko AI review · 
https://sashiko.dev/#/patchset/[email protected]?part=8

Reply via email to