Re: [PATCH v7 2/2] mmc: sdhci-msm: Use pm ops instead of macro to restore crypto keys

Ram Prakash Gupta <[email protected]>
Newsgroups org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel,org.kernel.vger.linux-mmc
Message-ID <[email protected]>

On 8/12/2026 12:38 AM, Eric Biggers wrote:
> On Tue, Aug 11, 2026 at 08:47:59PM +0530, Neeraj Soni wrote:
>> 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.
>>
>> Also set MMC_CAP2_CRYPTO_NO_REPROG to indicate that re-programming of ICE
>> keys is not needed during MMC runtime suspend/resume.
>>
>> Signed-off-by: Ram Prakash Gupta <[email protected]>
>> 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 | 32 +++++++++++++++++++++++++++++++-
>>  1 file changed, 31 insertions(+), 1 deletion(-)
> 
> So with this patch, resume from hibernation will be the *only* time that
> ICE keys are reprogrammed.  Are you absolutely sure that is enough on
> every SoC this driver supports?  What about resume from suspend-to-RAM?
> CQE error recovery?  What if the hibernation image fails to be created?
> 
> - Eric

Hi Eric,

There are two scenarios where key would be required to reprogram, first is when
rail powering the ICE goes off or SDCC does BCR reset.

now during suspend-to-RAM, rail powering the ice wont go off, so key would not
be required to reprogram. During CQE recovery, key would be only lost when BCR
reset is performed but that is not happening right now, to be taken up once its
fixed as part of recovery flow. And in case hibernation image fails to create
then device boots from normal flow where there is no need to reprogram the keys.

Thanks,
Ram
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.