Re: [PATCH v5 2/4] mmc: sdhci-msm: Reprogram crypto keys during host hardware initialization
Neeraj Soni <[email protected]> Fri, 31 Jul 2026 11:37:25 +0530
| Newsgroups | org.kernel.vger.linux-mmc,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 7/31/2026 12:48 AM, Eric Biggers wrote: > On Thu, Jul 30, 2026 at 07:38:20PM +0530, Neeraj Soni wrote: >> Host looses the Inline Crypto Engine (ICE) keys during hardware reset. >> Re-program the keys while intializing ICE to ensure that ICE is available >> in the same state as before the hardware reset. >> >> Also set MMC_CAP2_CRYPTO_NO_REPROG to indicate that re-program of ICE keys >> is not needed during MMC runtime suspend/resume. >> >> Signed-off-by: Seshu Madhavi Puppala <[email protected]> >> Co-developed-by: Ram Prakash Gupta <[email protected]> >> Signed-off-by: Ram Prakash Gupta <[email protected]> >> Co-developed-by: Sarthak Garg <[email protected]> >> Signed-off-by: Sarthak Garg <[email protected]> >> Signed-off-by: Debraj Mukhopadhyay <[email protected]> >> Signed-off-by: Neeraj Soni <[email protected]> >> --- >> drivers/mmc/host/sdhci-msm.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c >> index 4aff965f0e2e..7d71dc6f388d 100644 >> --- a/drivers/mmc/host/sdhci-msm.c >> +++ b/drivers/mmc/host/sdhci-msm.c >> @@ -1958,7 +1958,10 @@ static int sdhci_msm_ice_init(struct sdhci_msm_host *msm_host, >> cap.sdus_mask * 512; >> } >> >> + blk_crypto_reprogram_all_keys(&mmc->crypto_profile); >> + > > This still does nothing. The crypto profile was just initialized, so no > keyslots are in-use and blk_crypto_reprogram_all_keys() does nothing. > This is needed to address those scenarios where device is running in a stable state and only the host hardware goes for a reset, for example, to recover from an error state or stall. >> mmc->caps2 |= MMC_CAP2_CRYPTO; >> + mmc->caps2 |= MMC_CAP2_CRYPTO_NO_REPROG; > > This seems to be the actual point of the patch, so let's simplify it to > just this. However, this is also broken because this is ordered before > patch 3 that introduces the actually functional key reprogramming. > Please drop the no-op call to blk_crypto_reprogram_all_keys(), then > merge patches 2 and 3 into a single one. > The call to blk_crypto_reprogram_all_keys() is not a no-op as clarified above. Hence the changes were split in two. > - Eric > Regards, Neeraj