[PATCH v5 3/4] mmc: sdhci-msm: Use pm ops instead of macro to restore crypto keys
Neeraj Soni <[email protected]> Thu, 30 Jul 2026 19:38:21 +0530
| Newsgroups | org.kernel.vger.linux-mmc,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
From: Ram Prakash Gupta <[email protected]> Inline Crypto Engine (ICE) keys are lost after hibernation entry and this needs to be restored when hibernation exits. ICE keys are re-programmed during sdhci_msm_ice_init() but it may not cover cases where the hibernation image is already restored. Unwrap the pm ops and use directly in driver to add the call to restore Inline Crypto Engine (ICE) keys. This ensures that ICE is brought into same state as before hibernation. Signed-off-by: Ram Prakash Gupta <[email protected]> Signed-off-by: Neeraj Soni <[email protected]> --- drivers/mmc/host/sdhci-msm.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index 7d71dc6f388d..a4998e74a2bd 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -2986,9 +2986,26 @@ static int sdhci_msm_runtime_resume(struct device *dev) return ret; } +static int sdhci_msm_restore(struct device *dev) +{ + struct sdhci_host *host = dev_get_drvdata(dev); + +#ifdef CONFIG_MMC_CRYPTO + if (host->mmc->caps2 & MMC_CAP2_CRYPTO) + blk_crypto_reprogram_all_keys(&host->mmc->crypto_profile); +#endif + + return pm_runtime_force_resume(dev); +} + static const struct dev_pm_ops sdhci_msm_pm_ops = { - SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) RUNTIME_PM_OPS(sdhci_msm_runtime_suspend, sdhci_msm_runtime_resume, NULL) + .suspend = pm_runtime_force_suspend, + .resume = pm_runtime_force_resume, + .freeze = pm_runtime_force_suspend, + .restore = sdhci_msm_restore, + .thaw = pm_runtime_force_resume, + .poweroff = pm_runtime_force_suspend, }; static struct platform_driver sdhci_msm_driver = { -- 2.34.1