[PATCH v5 2/4] mmc: sdhci-msm: Reprogram crypto keys during host hardware initialization

Neeraj Soni <[email protected]> Thu, 30 Jul 2026 19:38:20 +0530
Newsgroups org.kernel.vger.linux-mmc,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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);
+
 	mmc->caps2 |= MMC_CAP2_CRYPTO;
+	mmc->caps2 |= MMC_CAP2_CRYPTO_NO_REPROG;
 	return 0;
 }
 
-- 
2.34.1