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

Neeraj Soni <[email protected]> Mon, 3 Aug 2026 19:30:13 +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 6:14 PM, Ram Prakash Gupta wrote:
> 
> 
> On 7/31/2026 11:42 AM, Eric Biggers wrote:
>> On Fri, Jul 31, 2026 at 11:37:44AM +0530, Neeraj Soni wrote:
>>>
>>>
>>> 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.
>>
>> Nope.  Please check the actual code.  This is called only at driver
>> probe time.  Again, the crypto profile was just initialized, and no
>> keyslots are in-use.  It is a no-op.  Maybe you intended it to do
>> something else, but that is not what it actually does.
>>
>> - Eric
> 
> Hi Neeraj,
> 
> earlier change for blk_crypto_reprogram_all_keys() in sdhci_msm_gcc_reset() was required
> when .hw_reset from sdhci_ops was overwritten with sdhi_msm_gcc_reset internally for robust
> error recovery but this changed after https://lore.kernel.org/all/[email protected]/
> 
> we plan to rework recovery soon and we will take care of key reprogramming as part of that.
> For time being you can drop this, as Eric pointed out, this is redundant.
>
Ack. Will fix this in v6.
 
> Thanks,
> Ram
>
Regards
Neeraj
 
> 
> 
>