Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] drm/mcde: TOCTOU race in mcde_clk_div_recalc_rate() [1]
--

commit b6626239eb4624a10d2245cb12fab62bbafe702d
Author: Linus Walleij <[email protected]>

drm/mcde: Use power domain for display power

This commit replaces explicit EPOD regulator handling in the MCDE DRM
driver with runtime PM calls while keeping the separate VANA analog supply
enabled during driver binding.

> diff --git a/drivers/gpu/drm/mcde/mcde_clk_div.c 
> b/drivers/gpu/drm/mcde/mcde_clk_div.c
> index 8c5af2677357f..1a22e6233946c 100644
> --- a/drivers/gpu/drm/mcde/mcde_clk_div.c
> +++ b/drivers/gpu/drm/mcde/mcde_clk_div.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0
>  #include <linux/clk-provider.h>
>  #include <linux/io.h>
> -#include <linux/regulator/consumer.h>
> +#include <linux/pm_runtime.h>
>  
>  #include "mcde_drm.h"
>  #include "mcde_display_regs.h"
> @@ -95,7 +95,7 @@ static unsigned long mcde_clk_div_recalc_rate(struct clk_hw 
> *hw,
>        * It will come up with 0 in the divider register bits, which
>        * means "divide by 2".
>        */
> -     if (!regulator_is_enabled(mcde->epod))
> +     if (!pm_runtime_active(mcde->dev))
>               return DIV_ROUND_UP_ULL(prate, 2);
>  
>       cr = readl(mcde->regs + cdiv->cr);

[Severity: High]
This problem wasn't introduced by this patch, but can mcde->dev runtime-suspend 
[1] between pm_runtime_active() and readl()?

pm_runtime_active() does not take a runtime PM reference, so a concurrent
suspend can power down the MCDE block before the register read completes:

CPU0                                  CPU1
mcde_clk_div_recalc_rate()
  pm_runtime_active(mcde->dev)
                                      pm_runtime_put_sync_suspend(mcde->dev)
  readl(mcde->regs + cdiv->cr)  <-- unpowered MMIO access

Reading MCDE registers while the power domain is off causes an unhandled
hardware fault.  Using pm_runtime_get_if_in_use() and dropping the
reference after readl() would keep the domain powered across the register
read.

[1] https://sashiko.dev/#/bug/linux-29030bde-9a9e-4287-978a-034b8c472d84

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

Reply via email to