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 5/6] ice: Link storage consumers for runtime PM
Date: Thu, 03 Dec 2026 12:53:40 +0000	[thread overview]
Message-ID: <sashiko-outbox-247797@kernel.org> (raw)
In-Reply-To: <20261203-qcom_ice_pm_enable-v3-5-86f79ce468b5@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 7 potential
issues to consider:
- [High] soc: qcom: ice: removing resume/suspend breaks legacy DT
  bindings
- [High] soc: qcom: ice: clocks stay permanently disabled under
  CONFIG_PM=n
- [High] soc: qcom: ice: legacy DT bindings leave ICE clocks off and
  skip resume
- [High] ufs: qcom: UFS v5.0.0 ICE reset now runs after
  qcom_ice_runtime_resume()
- [High] soc: qcom: ice: PM link resumes ICE before consumer clocks on
  legacy DTBs
- [Medium] soc: qcom: ice: leak supplier RPM ref on ufs-qcom probe
  failure
- [Medium] soc: qcom: ice: missing clock disable in qcom_ice_remove()
  when RPM active
--

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

ice: Link storage consumers for runtime PM

This commit adds a runtime PM device link from storage consumers to the
ICE supplier in of_qcom_ice_get() and removes the explicit
qcom_ice_resume() and qcom_ice_suspend() calls from sdhci-msm and
ufs-qcom.

> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
> index 32b1bcba47d6b..73b2851c51c56 100644
> --- a/drivers/mmc/host/sdhci-msm.c
> +++ b/drivers/mmc/host/sdhci-msm.c

[ ... ]

> @@ -2983,15 +2955,11 @@ static int sdhci_msm_runtime_resume(struct device *dev)
>  
>  	dev_pm_opp_set_rate(dev, msm_host->clk_rate);
>  
> -	ret = sdhci_msm_ice_resume(msm_host);
> -	if (ret)
> -		return ret;
> -
>  	spin_lock_irqsave(&host->lock, flags);
>  	host->runtime_suspended = false;
>  	spin_unlock_irqrestore(&host->lock, flags);
>  
> -	return ret;
> +	return 0;
>  }

[Severity: High]
Does removing sdhci_msm_ice_resume() break platforms using the legacy
devicetree binding where the storage node provides an "ice" reg range
instead of a "qcom,ice" phandle?

In of_qcom_ice_get(), legacy DT consumers return qcom_ice_create() early
without a separate qcom-ice device or PM device link, and
qcom_ice_create() disables engine->core_clk and engine->iface_clk before
returning.  Because sdhci-msm does not manage the ice clock (for example
on sdm670), nothing re-enables it after probe, so later calls to
qcom_ice_enable() and qcom_ice_program_key() access ICE registers while
unclocked, causing bus hangs, SErrors, or BIST timeouts.

[ ... ]

> diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c
> index ea4a79c98b232..1fe1f1bb21c98 100644
> --- a/drivers/soc/qcom/ice.c
> +++ b/drivers/soc/qcom/ice.c
> @@ -725,7 +725,9 @@ static struct qcom_ice *of_qcom_ice_get(struct device *dev)
>  			return ice;
>  	}
>  
> -	link = device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_SUPPLIER);
> +	link = device_link_add(dev, &pdev->dev, DL_FLAG_PM_RUNTIME |
> +			       DL_FLAG_RPM_ACTIVE |
> +			       DL_FLAG_AUTOREMOVE_SUPPLIER);
>  	if (!link) {
>  		dev_err(&pdev->dev,
>  			"Failed to create device link to consumer %s\n",

[Severity: Medium]
Can combining DL_FLAG_RPM_ACTIVE with DL_FLAG_AUTOREMOVE_SUPPLIER leak
the ICE supplier's runtime PM reference if ufs-qcom probe fails?

In ufshcd_pltfrm_init(), ufshcd_init() calls ufs_qcom_ice_init() while
hba->dev is still RPM_SUSPENDED, before pm_runtime_set_active().  If
ufshcd_init() later returns an error, __device_links_no_driver() does
not drop DL_FLAG_AUTOREMOVE_SUPPLIER links and pm_runtime_reinit() skips
rpm_put_suppliers() because hba->dev is already RPM_SUSPENDED, leaving
ICE clocks and its power domain permanently active.  Using
DL_FLAG_AUTOREMOVE_CONSUMER would drop the link and release the supplier
reference on consumer probe failure.

[Severity: High]
Will ICE clocks stay permanently disabled when the kernel is built with
CONFIG_PM=n?

QCOM_INLINE_CRYPTO_ENGINE does not depend on or select PM.  When
CONFIG_PM=n, qcom_ice_create() still disables core_clk and iface_clk
before returning, while pm_ptr(&qcom_ice_pm_ops) evaluates to NULL and
DL_FLAG_RPM_ACTIVE is a no-op, leaving ICE unclocked during
qcom_ice_enable() and keyslot programming.

[Severity: High]
Can linking ICE as a PM supplier resume ICE before the storage
consumer's shared AHB clock and power domain are enabled on older
deployed DTBs?

The DT binding in qcom,inline-crypto-engine.yaml preserves compatibility
for older standalone ICE nodes (for example on sm8550) that declare only
core_clk without an iface clock or power-domains.  With
DL_FLAG_PM_RUNTIME, __rpm_callback() runs qcom_ice_runtime_resume()
before the storage consumer enables its AHB clock and UFS_PHY_GDSC, so
qcom_ice_hwkm_init() and qcom_ice_wait_bist_status() access ICE MMIO
registers while the block is still powered off or unclocked, causing an
SError or bus hang.

[Severity: Medium]
If qcom-ice is unbound while runtime-active, does qcom_ice_remove() leak
the prepare and enable counts on core_clk and iface_clk?

qcom_ice_remove() only clears the xarray entry and relies on
devm_pm_runtime_enable() and devm_clk_get() cleanup, neither of which
invokes qcom_ice_runtime_suspend() or disables clocks.  When usage_count
is still non-zero at unbind (for instance after a failed ufs-qcom probe
leaks the supplier link reference, or if userspace set power/control to
"on"), __device_release_driver() skips runtime suspend before
devres_release_all() puts the clocks.

> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
> index 6afb8498b8c26..2e65b55f14052 100644
> --- a/drivers/ufs/host/ufs-qcom.c
> +++ b/drivers/ufs/host/ufs-qcom.c

[ ... ]

> @@ -859,25 +833,22 @@ static int ufs_qcom_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
>  		ufshcd_readl(hba, UFS_MEM_ICE_CFG);
>  	}
>  
> -	return ufs_qcom_ice_resume(host);
> +	return 0;
>  }

[Severity: High]
Does dropping ufs_qcom_ice_resume() skip ICE resume on legacy UFS
devicetree bindings (such as sdm845 and sm8150)?

When the UFS node provides an "ice" reg range instead of a "qcom,ice"
phandle, of_qcom_ice_get() returns early without creating a PM device
link or binding qcom_ice_pm_ops.  Without ufs_qcom_ice_suspend() and
ufs_qcom_ice_resume(), ice->hwkm_init_complete is never cleared on
suspend and qcom_ice_hwkm_init() and qcom_ice_wait_bist_status() never
run on Hibern8 resume.

[Severity: High]
On UFS v5.0.0 controllers (such as SM8550), does the ICE synchronous
reset in ufs_qcom_resume() now run after qcom_ice_runtime_resume()?

With ICE linked as a PM supplier of hba->dev, PM core runs
qcom_ice_runtime_resume() before resuming hba->dev and calling
ufs_qcom_resume().  ufs_qcom_resume() then pulses UFS_ICE_SYNC_RST_SW in
UFS_MEM_ICE_CFG, wiping the HWKM configuration while leaving
ice->hwkm_init_complete set and skipping the post-reset BIST wait; on
Hibern8 resume, __ufshcd_wl_resume() does not call ufs_qcom_ice_enable(),
breaking wrapped-key programming and encrypted I/O.

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

  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 [this message]
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

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-247797@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.