[PATCH v5 1/4] mmc: Allow host driver to control the re-programming of Crypto keys
Neeraj Soni <[email protected]> Thu, 30 Jul 2026 19:38:19 +0530
| Newsgroups | org.kernel.vger.linux-mmc,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
The register context for the crypto profile belongs to the sdhci/cqhci host and not the mmc card, hence re-programming should be managed by the host driver itself. Add the flag MMC_CAP2_CRYPTO_NO_REPROG as part of host->caps2 to control reprogramming keys to crypto engine for SoCs which dont require this feature. 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/core/crypto.c | 2 +- include/linux/mmc/host.h | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/core/crypto.c b/drivers/mmc/core/crypto.c index fec4fbf16a5b..a5a90bfc634e 100644 --- a/drivers/mmc/core/crypto.c +++ b/drivers/mmc/core/crypto.c @@ -15,7 +15,7 @@ void mmc_crypto_set_initial_state(struct mmc_host *host) { /* Reset might clear all keys, so reprogram all the keys. */ - if (host->caps2 & MMC_CAP2_CRYPTO) + if ((host->caps2 & MMC_CAP2_CRYPTO) && !(host->caps2 & MMC_CAP2_CRYPTO_NO_REPROG)) blk_crypto_reprogram_all_keys(&host->crypto_profile); } diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index ba84f02c2a10..83d92fb64417 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -457,12 +457,9 @@ struct mmc_host { #define MMC_CAP2_CQE_DCMD (1 << 24) /* CQE can issue a direct command */ #define MMC_CAP2_AVOID_3_3V (1 << 25) /* Host must negotiate down from 3.3V */ #define MMC_CAP2_MERGE_CAPABLE (1 << 26) /* Host can merge a segment over the segment size */ -#ifdef CONFIG_MMC_CRYPTO #define MMC_CAP2_CRYPTO (1 << 27) /* Host supports inline encryption */ -#else -#define MMC_CAP2_CRYPTO 0 -#endif #define MMC_CAP2_ALT_GPT_TEGRA (1 << 28) /* Host with eMMC that has GPT entry at a non-standard location */ +#define MMC_CAP2_CRYPTO_NO_REPROG (1 << 29) /* Host handles inline crypto key reprogramming */ bool uhs2_sd_tran; /* UHS-II flag for SD_TRAN state */ bool uhs2_app_cmd; /* UHS-II flag for APP command */ -- 2.34.1