Re: [Patch v9] crypto: qce - Add runtime PM and interconnect bandwidth scaling support

Herbert Xu <[email protected]>
Newsgroups org.kernel.vger.linux-crypto,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Wed, Jul 29, 2026 at 04:34:55PM +0530, Kuldeep Singh wrote:
> From: Udit Tiwari <[email protected]>
> 
> The Qualcomm Crypto Engine (QCE) driver currently lacks support for
> runtime power management (PM) and interconnect bandwidth control.
> As a result, the hardware remains fully powered and clocks stay
> enabled even when the device is idle. Additionally, static
> interconnect bandwidth votes are held indefinitely, preventing the
> system from reclaiming unused bandwidth.
> 
> Address this by enabling runtime PM and dynamic interconnect
> bandwidth scaling to allow the system to suspend the device when idle
> and scale interconnect usage based on actual demand. Improve overall
> system efficiency by reducing power usage and optimizing interconnect
> resource allocation.
> 
> Signed-off-by: Udit Tiwari <[email protected]>
> Tested-by: Pankaj Patil <[email protected]>
> Signed-off-by: Kuldeep Singh <[email protected]>
> ---
> I am taking care of follow-up of this patch from the original author,
> with their consent, while preserving the original authorship.
> 
> Changes in v9:
> - Rebase to latest linux-next/master(tag: next-20260728).
> - Link to v8:
>   https://lore.kernel.org/linux-arm-msm/[email protected]/
> 
> Changes in v8:
> - Drop pm_clk framework (devm_pm_clk_create/pm_clk_add/pm_clk_suspend/
>   pm_clk_resume); use devm_clk_get_optional() and direct
>   clk_prepare_enable()/clk_disable_unprepare() in runtime PM callbacks.
>   This removes the CONFIG_PM_CLK dependency and the build error reported
>   by the kernel test robot.
> - Replace icc_disable() with icc_set_bw(path, 0, 0) in runtime suspend
>   to avoid corrupting the internal 'enabled' flag, which would cause
>   subsequent icc_set_bw() calls in resume to be silently skipped during
>   aggregation.
> - Fix ICC vote ordering: cast bandwidth vote before enabling clocks in
>   resume; disable clocks before dropping ICC vote in suspend.
> - Use PM_RUNTIME_ACQUIRE_AUTOSUSPEND()/PM_RUNTIME_ACQUIRE_ERR() wrapper
>   macros instead of raw ACQUIRE() in both qce_handle_queue() and probe.
> - Drop __maybe_unused from runtime PM callbacks; use RUNTIME_PM_OPS /
>   SYSTEM_SLEEP_PM_OPS (non-SET_ prefix) and pm_ptr(&qce_crypto_pm_ops).
> - Drop unnecessary ret = 0 initializations in qce_handle_queue() and
>   qce_runtime_resume().
> - Extend probe comment to explain ICC + clock ordering rationale.
> - Link to v7:
>   https://lore.kernel.org/lkml/[email protected]/
> 
> Changes in v7:
> - Use ACQUIRE guard in probe to simplify runtime PM management and error
>   paths.
> - Drop redundant icc_enable() call in runtime resume path.
> - Explicitly call pm_clk_suspend(dev) and pm_clk_resume(dev) within the
>   custom runtime PM callbacks. Since custom callbacks are provided to
>   handle interconnect scaling, the standard PM clock helpers must be
>   invoked manually to ensure clocks are gated/ungated.
> - Link to v6:
>  https://lore.kernel.org/lkml/[email protected]/
> 
> Changes in v6:
> - Adopt ACQUIRE(pm_runtime_active_try, ...) for scoped runtime PM
>   management in qce_handle_queue(). This removes the need for manual
>   put calls and goto labels in the error paths, as suggested by Konrad.
> - Link to v5:
>   https://lore.kernel.org/lkml/[email protected]/
> 
> Changes in v5:
> - Drop Reported-by and Closes tags for kernel test robot W=1 warnings,
>   as the issue was fixed within the same patch series.
> - Fix a minor comment indentation/style issue.
> - Link to v4:
>   https://lore.kernel.org/lkml/[email protected]/
> 
> Changes in v4:
> - Annotate runtime PM callbacks with __maybe_unused to silence W=1
>   warnings.
> - Add Reported-by and Closes tags for kernel test robot warning.
> - Link to v3:
>   https://lore.kernel.org/lkml/[email protected]/
> 
> Changes in v3:
> - Switch from manual clock management to PM clock helpers
>   (devm_pm_clk_create() + pm_clk_add()); no direct clk_* enable/disable
>   in runtime callbacks.
> - Replace pm_runtime_get_sync() with pm_runtime_resume_and_get(); remove
>   pm_runtime_put_noidle() on error.
> - Define PM ops using helper macros and reuse runtime callbacks for
>   system sleep via pm_runtime_force_suspend()/pm_runtime_force_resume().
> - Link to v2:
>   https://lore.kernel.org/lkml/[email protected]/
> 
> Changes in v2:
> - Extend suspend/resume support to include runtime PM and ICC scaling.
> - Register dev_pm_ops and implement runtime_suspend/resume callbacks.
> - Link to v1:
>   https://lore.kernel.org/lkml/[email protected]/
> ---
>  drivers/crypto/qce/core.c | 99 ++++++++++++++++++++++++++++++++++++---
>  1 file changed, 92 insertions(+), 7 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.