Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [High] drm/panfrost: bus fault due to unpowered MMIO access in fini
--

commit 1d33acca0e677034f1a99e084840bcc7a625c2cf
Author: Adrián Larumbe <[email protected]>

drm/panfrost: Warn of RPM get failure at device remove time

This commit adds a warning during device removal if taking a PM reference 
fails. The goal is to avoid silent failures and notify the user when the 
PM resume operation is unsuccessful.

> diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c 
> b/drivers/gpu/drm/panfrost/panfrost_device.c
> index a6deabb39fd2c..6872302257431 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_device.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_device.c
[ ... ]
> @@ -385,7 +386,7 @@ int panfrost_device_init(struct panfrost_device *pfdev)
>  
>  void panfrost_device_fini(struct panfrost_device *pfdev)
>  {
> -     pm_runtime_get_sync(pfdev->base.dev);
> +     drm_WARN_ON(&pfdev->base, pm_runtime_get_sync(pfdev->base.dev) < 0);

[Severity: High]
If pm_runtime_get_sync() fails, it indicates the device is still in a
powered-off or clock-gated state. While this adds a warning, execution
continues unconditionally to the hardware teardown.

The teardown process then performs MMIO writes to an unpowered device. For
example, later in panfrost_device_fini(), these writes are executed:

panfrost_mmu_fini()
  mmu_write(pfdev, MMU_INT_MASK, 0);

panfrost_gpu_fini()
  panfrost_gpu_power_off()
    gpu_write(pfdev, SHADER_PWROFF_LO, pfdev->features.shader_present);

On ARM platforms, accessing MMIO of a powered-off device triggers a
synchronous external abort (bus fault), leading to a kernel panic. Should
this function return early or otherwise skip the hardware teardown steps if
the PM reference cannot be acquired?

>  
>       pm_runtime_dont_use_autosuspend(pfdev->base.dev);
>       pm_runtime_disable(pfdev->base.dev);

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

Reply via email to