[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aGaSUTDYNQgtLNaM@lizhi-Precision-Tower-5810>
Date: Thu, 3 Jul 2025 10:23:32 -0400
From: Frank Li <Frank.li@....com>
To: Peng Fan <peng.fan@....com>
Cc: Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>, Abel Vesa <abelvesa@...nel.org>,
linux-clk@...r.kernel.org, devicetree@...r.kernel.org,
imx@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, Abel Vesa <abel.vesa@...aro.org>,
Laurentiu Palcu <laurentiu.palcu@....nxp.com>
Subject: Re: [PATCH v2 2/5] clk: imx95-blk-ctl: Fix synchronous abort
On Thu, Jul 03, 2025 at 11:40:21AM +0800, Peng Fan wrote:
> From: Laurentiu Palcu <laurentiu.palcu@....nxp.com>
>
> When enabling runtime PM for clock suppliers that also belong to a power
> domain, the following crash is thrown:
>
> ---
> Internal error: synchronous external abort: 0000000096000010 [#1] PREEMPT SMP
> Workqueue: events_unbound deferred_probe_work_func
> pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> pc : clk_mux_get_parent+0x60/0x90
> lr : clk_core_reparent_orphans_nolock+0x58/0xd8
> Call trace:
> clk_mux_get_parent+0x60/0x90
> clk_core_reparent_orphans_nolock+0x58/0xd8
> of_clk_add_hw_provider.part.0+0x90/0x100
> of_clk_add_hw_provider+0x1c/0x38
> imx95_bc_probe+0x2e0/0x3f0
> platform_probe+0x70/0xd8
>
> Enabling runtime PM without explicitly resuming the device caused
> the power domain cut off after clk_register() is called. As a result,
> a crash happens when the clock hardware provider is added and attempts
> to access the BLK_CTL register
>
> Fix this by using devm_pm_runtime_enable() instead of pm_runtime_enable()
> and getting rid of the pm_runtime_disable() in the cleanup path.
>
> Fixes: 5224b189462f ("clk: imx: add i.MX95 BLK CTL clk driver")
> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@....nxp.com>
> Signed-off-by: Peng Fan <peng.fan@....com>
> ---
Reviewed-by: Frank Li <Frank.Li@....com>
> drivers/clk/imx/clk-imx95-blk-ctl.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/clk/imx/clk-imx95-blk-ctl.c b/drivers/clk/imx/clk-imx95-blk-ctl.c
> index cc2ee2be18195f0e05e911bcb26e284b1a894244..86bdcd21753102b7d160288e7b69bf73da5a5706 100644
> --- a/drivers/clk/imx/clk-imx95-blk-ctl.c
> +++ b/drivers/clk/imx/clk-imx95-blk-ctl.c
> @@ -342,8 +342,10 @@ static int imx95_bc_probe(struct platform_device *pdev)
> if (!clk_hw_data)
> return -ENOMEM;
>
> - if (bc_data->rpm_enabled)
> - pm_runtime_enable(&pdev->dev);
> + if (bc_data->rpm_enabled) {
> + devm_pm_runtime_enable(&pdev->dev);
> + pm_runtime_resume_and_get(&pdev->dev);
> + }
>
> clk_hw_data->num = bc_data->num_clks;
> hws = clk_hw_data->hws;
> @@ -383,8 +385,10 @@ static int imx95_bc_probe(struct platform_device *pdev)
> goto cleanup;
> }
>
> - if (pm_runtime_enabled(bc->dev))
> + if (pm_runtime_enabled(bc->dev)) {
> + pm_runtime_put_sync(&pdev->dev);
> clk_disable_unprepare(bc->clk_apb);
> + }
>
> return 0;
>
> @@ -395,9 +399,6 @@ static int imx95_bc_probe(struct platform_device *pdev)
> clk_hw_unregister(hws[i]);
> }
>
> - if (bc_data->rpm_enabled)
> - pm_runtime_disable(&pdev->dev);
> -
> return ret;
> }
>
>
> --
> 2.37.1
>
Powered by blists - more mailing lists