From: Kuldeep Singh <kuldeep.singh@oss.qualcomm.com>
To: Eric Biggers <ebiggers@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>,
Ulf Hansson <ulfh@kernel.org>, Abel Vesa <abelvesa@kernel.org>,
Manivannan Sadhasivam <mani@kernel.org>,
"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
"Martin K. Petersen" <mkp@kernel.org>,
linux-mmc@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2 2/2] ufs: ufs-qcom: Enable ICE before enabling crypto support
Date: Tue, 17 Nov 2026 11:55:17 +0530 [thread overview]
Message-ID: <2a4f99e9-4b51-42c5-9852-8747bf8f1a14@oss.qualcomm.com> (raw)
In-Reply-To: <20261113040820.GE1742@sol>
On 13-11-2026 09:38, Eric Biggers wrote:
> On Thu, Nov 12, 2026 at 06:48:18PM +0530, Kuldeep Singh wrote:
>> ufs-qcom currently exposes UFS crypto profile and sets UFSHCD_CAP_CRYPTO
>> before enabling ICE. This leaves a window where blk-crypto can issue
>> keyslot programming calls before ufs-qcom has explicitly enabled ICE.
>
> Please be more specific about what actually goes wrong, and why. During
> probe, the crypto profile hasn't actually been registered with the block
> layer yet. So the above seems inaccurate. Likewise in the MMC patch.
Seems i explained problem in cover letter and didn't mention here.
Please refer here:
https://lore.kernel.org/linux-arm-msm/20261022-qcom_ice_pm_enable-v1-0-f7a84086c651@oss.qualcomm.com/
Actual bug got reported in storage drivers after introducing runtime PM
in ice.
In UFS probe, setting UFSHCD_CAP_CRYPTO enables the crypto profile and
let blk-crypto layer send key programming calls(i.e
qcom_ice_program_key() in ice.c) even before UFS get ice handle (i.e
qcom_ice_enable).
OTOH, with no runtime PM in ice, clocks are remain voted after probe
too. When key program call comes from blk-crypto(qcom_ice_program_key),
it calls qcom_ice_writel(ice, 0x0, QCOM_ICE_REG_CRYPTOCFG(slot)); and
works fine as it's clocked register access.
With runtime PM in ice, clocks are voted off after probe and now same
sequence(ufs-probe -> key program call -> qcom_ice_enable) introduces
kernel panic as it's *unclocked* register access in ICE. That's why it's
important to enable ice instance in UFS before blk-crypto trigger any
key program call and hence moved qcom_ice_enable in probe.
Same sequence applies to MMC.
Though the issue reported once runtime PM in ICE got enabled, it's
actually persistent always and ideally UFS should not assume ice clock
cycle and get the instance early.
>
>> static int ufs_qcom_ice_init(struct ufs_qcom_host *host)
>> {
>> @@ -188,6 +190,12 @@ static int ufs_qcom_ice_init(struct ufs_qcom_host *host)
>>
>> host->ice = ice;
>>
>> + err = qcom_ice_enable(host->ice);
>
> Use the 'ice' local variable.
Ack.
>
>> @@ -636,12 +645,15 @@ static int ufs_qcom_hce_enable_notify(struct ufs_hba *hba,
>> * is initialized.
>> */
>> err = ufs_qcom_enable_lane_clks(host);
>> + if (err)
>> + return err;
>> +
>> + err = ufs_qcom_ice_enable(host);
>> break;
>> case POST_CHANGE:
>> /* check if UFS PHY moved from DISABLED to HIBERN8 */
>> err = ufs_qcom_check_hibern8(hba);
>> ufs_qcom_enable_hw_clk_gating(hba);
>> - ufs_qcom_ice_enable(host);
>> ufs_qcom_config_ice_allocator(host);
>> break;
>
> Needs an explanation for why ufs_qcom_config_ice_allocator() and
> ufs_qcom_ice_enable() need to be called at different times.
I didn't get any issue if we enable ice in POST_CHANGE, I added as good
to have change so as to make ice available at earliest.
As no issue observed, I am planning to drop the change.
--
Regards
Kuldeep
prev parent reply other threads:[~2026-11-17 6:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 13:18 [PATCH v2 0/2] Fix MMC/UFS sequence for ICE calls Kuldeep Singh
2026-11-12 13:18 ` [PATCH v2 1/2] mmc: sdhci-msm: Enable ICE before enabling crypto support Kuldeep Singh
2026-11-12 13:18 ` [PATCH v2 2/2] ufs: ufs-qcom: " Kuldeep Singh
2026-11-13 4:08 ` Eric Biggers
2026-11-17 6:25 ` Kuldeep Singh [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=2a4f99e9-4b51-42c5-9852-8747bf8f1a14@oss.qualcomm.com \
--to=kuldeep.singh@oss.qualcomm.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=abelvesa@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ebiggers@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mani@kernel.org \
--cc=mkp@kernel.org \
--cc=stable@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®