All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kuldeep Singh" <kuldeep.singh@oss.qualcomm.com>,
	"Abel Vesa" <abelvesa@kernel.org>,
	"Bjorn Andersson" <andersson@kernel.org>,
	"Konrad Dybcio" <konradybcio@kernel.org>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Harshal Dev" <harshal.dev@oss.qualcomm.com>,
	"Eric Biggers" <ebiggers@google.com>,
	"Ulf Hansson" <ulfh@kernel.org>,
	"Bartosz Golaszewski" <brgl@kernel.org>,
	"Martin K. Petersen" <mkp@kernel.org>,
	"Gaurav Kashyap" <quic_gaurkash@quicinc.com>,
	"Adrian Hunter" <adrian.hunter@intel.com>,
	"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: "Konrad Dybcio" <konrad.dybcio@oss.qualcomm.com>,
	linux-crypto@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH v3 6/6] soc: qcom: ice: Drop exported resume and suspend APIs
Date: Thu, 03 Dec 2026 12:53:51 +0000	[thread overview]
Message-ID: <sashiko-outbox-247798@kernel.org> (raw)
In-Reply-To: <20261203-qcom_ice_pm_enable-v3-6-86f79ce468b5@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 6 potential
issues to consider:
- [High] soc: qcom: ice: dropping resume/suspend breaks legacy DT
  bindings
- [High] soc: qcom: ice: unclocked MMIO access when CONFIG_PM is
  disabled
- [High] soc: qcom: ice: legacy DT bindings left unclocked after
  qcom_ice_create()
- [High] soc: qcom: ice: UFS v5.0.0 sync reset runs after
  qcom_ice_runtime_resume()
- [Medium] soc: qcom: ice: DL_FLAG_AUTOREMOVE_SUPPLIER leaks RPM ref on
  probe failure
- [Medium] soc: qcom: ice: qcom_ice_remove() leaks enabled clocks when
  runtime-active
--

commit 56528d5ac3c6c7e88600729e222e97f438e79ee1
Author: Kuldeep Singh <kuldeep.singh@oss.qualcomm.com>

soc: qcom: ice: Drop exported resume and suspend APIs

This commit folds qcom_ice_resume() and qcom_ice_suspend() into the
runtime PM callbacks in drivers/soc/qcom/ice.c and removes their
exported symbols and public declarations from include/soc/qcom/ice.h.

> diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c
> index 1fe1f1bb21c98..6246bbf8968d7 100644
> --- a/drivers/soc/qcom/ice.c
> +++ b/drivers/soc/qcom/ice.c
> @@ -344,8 +344,9 @@ static void qcom_ice_disable_clocks(struct qcom_ice *ice)
>  	clk_disable_unprepare(ice->core_clk);
>  }
>  
> -int qcom_ice_resume(struct qcom_ice *ice)
> +static int qcom_ice_runtime_resume(struct device *dev)
>  {
> +	struct qcom_ice *ice = dev_get_drvdata(dev);
>  	int err;
>  
>  	err = qcom_ice_enable_clocks(ice);

[Severity: High]
Will ICE clocks stay permanently disabled when CONFIG_PM is disabled?

QCOM_INLINE_CRYPTO_ENGINE and its storage consumers do not select or
depend on PM.  With CONFIG_PM=n, pm_ptr(&qcom_ice_pm_ops) evaluates to
NULL and __pm_runtime_resume() in device_link_add() is a no-op stub, so
qcom_ice_runtime_resume() never runs.

Because qcom_ice_create() unconditionally calls qcom_ice_disable_clocks()
before returning and qcom_ice_resume() is gone, subsequent calls to
qcom_ice_enable() access unclocked ICE MMIO registers and can hang the
bus or trigger an SError at boot.

[Severity: High]
Are legacy devicetree bindings left with ICE clocks disabled even when
CONFIG_PM is enabled?

When a storage node provides an "ice" reg range (such as sdhc_1 in
sdm670.dtsi), of_qcom_ice_get() returns directly from
qcom_ice_create(&pdev->dev, base) without probing qcom_ice_driver,
attaching qcom_ice_pm_ops, or creating a device link.

Because qcom_ice_create() disables core_clk and iface_clk before
returning and sdhci_msm_probe() never enables the "ice" clock, nothing
re-enables core_clk.  Subsequent calls to qcom_ice_enable() then perform
unclocked MMIO accesses during boot, causing a bus hang or SError.

[Severity: High]
Does folding qcom_ice_resume() into the supplier runtime PM callback
break UFS v5.0.0 resume ordering?

On UFS v5.0.0 (such as SM8550), ufs_qcom_resume() pulses
UFS_ICE_SYNC_RST_SEL | UFS_ICE_SYNC_RST_SW in UFS_MEM_ICE_CFG when the
link is not active (for example, on Hibern8 exit).  Previously,
ufs_qcom_resume() called qcom_ice_resume() after that reset.

With runtime PM device links, the PM core runs qcom_ice_runtime_resume()
before hba->dev resumes and before __ufshcd_wl_resume() calls
ufs_qcom_resume().  The later synchronous reset wipes HWKM setup and
starts BIST while ice->hwkm_init_complete stays true, and Hibern8 exit
does not call qcom_ice_enable() to re-initialize ICE.

> @@ -363,26 +364,16 @@ int qcom_ice_resume(struct qcom_ice *ice)
>  
>  	return 0;
>  }
> -EXPORT_SYMBOL_GPL(qcom_ice_resume);
>  
> -int qcom_ice_suspend(struct qcom_ice *ice)
> +static int qcom_ice_runtime_suspend(struct device *dev)
>  {
> +	struct qcom_ice *ice = dev_get_drvdata(dev);
> +
>  	ice->hwkm_init_complete = false;
>  	qcom_ice_disable_clocks(ice);
>  
>  	return 0;
>  }
> -EXPORT_SYMBOL_GPL(qcom_ice_suspend);

[Severity: Medium]
Can a consumer probe failure or deferral leak the ICE supplier's runtime
PM usage_count and prevent qcom_ice_runtime_suspend() from running?

of_qcom_ice_get() adds the device link with DL_FLAG_PM_RUNTIME |
DL_FLAG_RPM_ACTIVE | DL_FLAG_AUTOREMOVE_SUPPLIER.  In
ufshcd_pltfrm_init(), ufshcd_init() acquires ICE before
pm_runtime_set_active(dev) runs, so dev->power.runtime_status is still
RPM_SUSPENDED if ufshcd_init() fails or returns -EPROBE_DEFER.

On probe unwind, __device_links_no_driver() only drops links marked
DL_FLAG_AUTOREMOVE_CONSUMER, and pm_runtime_reinit() skips
pm_runtime_set_suspended() because runtime_status is not RPM_ACTIVE.
The supplier's usage_count stays elevated and ICE clocks remain on
indefinitely; using DL_FLAG_AUTOREMOVE_CONSUMER would drop the link on
consumer probe failure.

[Severity: Medium]
Does qcom_ice_remove() leak enabled ICE clocks if the driver is unbound
while runtime-active?

If ice->dev still has power.usage_count > 0 when __device_release_driver()
calls pm_runtime_put_sync() (for instance if userspace set power/control
to "on" or after a failed consumer probe leaked the device link),
qcom_ice_runtime_suspend() is not called.

qcom_ice_remove() only clears the ice_handles xarray entry, and
device_unbind_cleanup() then runs devm_pm_runtime_enable()'s cleanup
(which disables runtime PM without suspending) followed by
devm_clk_release(), calling clk_put() while core_clk and iface_clk are
still prepared and enabled.

> diff --git a/include/soc/qcom/ice.h b/include/soc/qcom/ice.h
> index 4bee553f0a59d..b17f2df0b75cf 100644
> --- a/include/soc/qcom/ice.h
> +++ b/include/soc/qcom/ice.h
> @@ -12,8 +12,6 @@
>  struct qcom_ice;
>  
>  int qcom_ice_enable(struct qcom_ice *ice);
> -int qcom_ice_resume(struct qcom_ice *ice);
> -int qcom_ice_suspend(struct qcom_ice *ice);
>  int qcom_ice_program_key(struct qcom_ice *ice, unsigned int slot,
>  			 const struct blk_crypto_key *blk_key);
>  int qcom_ice_evict_key(struct qcom_ice *ice, int slot);

[Severity: High]
Without qcom_ice_resume() and qcom_ice_suspend(), how do legacy
devicetree consumers re-initialize ICE across suspend and resume?

Legacy bindings (used by storage nodes in dtsi files such as sdm845.dtsi
and sdm670.dtsi) do not have a standalone qcom-ice supplier device or
runtime PM device link.  With these APIs gone, qcom_ice_runtime_suspend()
and qcom_ice_runtime_resume() never execute for them, so
ice->hwkm_init_complete is never cleared on suspend and
qcom_ice_hwkm_init() and qcom_ice_wait_bist_status() are never re-run
after power collapse or Hibern8, breaking inline encryption.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-qcom_ice_pm_enable-v3-0-86f79ce468b5@oss.qualcomm.com?part=6

      reply	other threads:[~2026-12-03 12:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 12:22 [PATCH v3 0/6] ICE: Enable runtime PM support and fixes Kuldeep Singh
2026-12-03 12:22 ` [PATCH v3 1/6] soc: qcom: ice: Fix clock unwind behaviour Kuldeep Singh
2026-12-03 12:22 ` [PATCH v3 2/6] soc: qcom: ice: Wait for HWKM BIST to complete Kuldeep Singh
2026-12-03 12:22 ` [PATCH v3 3/6] soc: qcom: ice: Fix error path on resume failures Kuldeep Singh
2026-12-03 12:41   ` sashiko-bot
2026-12-03 12:22 ` [PATCH v3 4/6] soc: qcom: ice: Add runtime PM support Kuldeep Singh
2026-12-03 12:49   ` sashiko-bot
2026-12-03 12:22 ` [PATCH v3 5/6] ice: Link storage consumers for runtime PM Kuldeep Singh
2026-12-03 12:53   ` sashiko-bot
2026-12-03 12:22 ` [PATCH v3 6/6] soc: qcom: ice: Drop exported resume and suspend APIs Kuldeep Singh
2026-12-03 12:53   ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-247798@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=abelvesa@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=andersson@kernel.org \
    --cc=brgl@kernel.org \
    --cc=ebiggers@google.com \
    --cc=harshal.dev@oss.qualcomm.com \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=kuldeep.singh@oss.qualcomm.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=mkp@kernel.org \
    --cc=quic_gaurkash@quicinc.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=ulfh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.