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

Ulf Hansson <[email protected]> Tue, 4 Aug 2026 13:14:53 +0200
Newsgroups org.kernel.vger.linux-mmc,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel
Message-ID <CAPx+jO9ikCQBLxzc8814C3LnFHQoejjpL3kUvCXE5T3OkQYz6g@mail.gmail.com>
On Mon, Aug 3, 2026 at 8:10=E2=80=AFPM Dmitry Baryshkov
<[email protected]> wrote:
>
> On Mon, Aug 03, 2026 at 10:01:23PM +0530, Neeraj Soni wrote:
> > From: Ram Prakash Gupta <[email protected]>
> >
> > Inline Crypto Engine (ICE) keys are lost after hibernation entry and th=
is
> > 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 I=
CE
> > keys is not needed during MMC runtime suspend/resume.
>
> Hmm, if there is a flag which controls reprogramming of the keys, why
> can't we use a default and make the core reprogram those?

The core is responsible for managing the card, but the crypto context
belongs to the host. Similar to other host registers, it's better to
let host specific drivers deal with those.

In regards to the host capabilities flags, we decided to add
MMC_CAP2_CRYPTO_NO_REPROG to avoid breaking the mtk-sd. But long term
wise, there should be nothing in the core that deals with
re-programming of ICE keys, hence MMC_CAP2_CRYPTO_NO_REPROG should be
removed at some point when we have verified the behaviour for mtk-sd
too.

>
> >
> > 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 | 23 ++++++++++++++++++++++-
> >  1 file changed, 22 insertions(+), 1 deletion(-)
> >
>
> --
> With best wishes
> Dmitry

Kind regards
Uffe