Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Debraj Mukhopadhyay <quic_dmukhopa@quicinc.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, kernel@quicinc.com,
	Neeraj Soni <quic_neersoni@quicinc.com>,
	Ram Prakash Gupta <quic_rampraka@quicinc.com>,
	Nitin Rawat <quic_nitirawa@quicinc.com>,
	Sachin Gupta <quic_sachgupt@quicinc.com>,
	Bhaskar Valaboju <quic_bhaskarv@quicinc.com>,
	Gaurav Kashyap <quic_gaurkash@quicinc.com>,
	Sarthak Garg <quic_sartgarg@quicinc.com>,
	Seshu Madhavi Puppala <quic_spuppala@quicinc.com>
Subject: Re: [PATCH v2] mmc: Avoid reprogram all keys to Inline Crypto Engine for MMC runtime suspend resume
Date: Fri, 6 Jun 2025 17:59:09 +0000	[thread overview]
Message-ID: <20250606175909.GB53397@google.com> (raw)
In-Reply-To: <20250606104714.1501297-1-quic_dmukhopa@quicinc.com>

On Fri, Jun 06, 2025 at 04:17:14PM +0530, Debraj Mukhopadhyay wrote:
> Crypto reprogram all keys is called for each MMC runtime
> suspend/resume in current upstream design.

It's called from mmc_set_initial_state(), which is documented as:

/*
 * Set initial state after a power cycle or a hw_reset.
 */

Please clarify how that corresponds to "MMC runtime suspend/resume".

> streaming applications have been observed due to this. Add the flag
> MMC_CAP2_DONT_REPROGRAM as part of host->caps2 to control reprogramming
> keys to crypto engine for socs which dont require this feature.

The flag has a different name in the code.

> diff --git a/drivers/mmc/core/crypto.c b/drivers/mmc/core/crypto.c
> index fec4fbf16a5b..d41672e2856e 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);

Add parentheses around 'host->caps2 & MMC_CAP2_CRYPTO'

> +#ifdef CONFIG_MMC_CRYPTO
> +#define MMC_CAP2_CRYPTO_NO_REPROG	(1 << 29)	/* Host does not support inline crypto key reprogramming */
> +#else
> +#define MMC_CAP2_CRYPTO_NO_REPROG	0
> +#endif

Well, it does support inline crypto key reprogramming.  It just doesn't want the
MMC core driver to handle it.  Please update the comment to something like:
/* Host driver handles crypto key reprogramming */

- Eric

  reply	other threads:[~2025-06-06 17:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-06 10:47 [PATCH v2] mmc: Avoid reprogram all keys to Inline Crypto Engine for MMC runtime suspend resume Debraj Mukhopadhyay
2025-06-06 17:59 ` Eric Biggers [this message]
2025-07-10  7:58   ` Debraj Mukhopadhyay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250606175909.GB53397@google.com \
    --to=ebiggers@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=kernel@quicinc.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=quic_bhaskarv@quicinc.com \
    --cc=quic_dmukhopa@quicinc.com \
    --cc=quic_gaurkash@quicinc.com \
    --cc=quic_neersoni@quicinc.com \
    --cc=quic_nitirawa@quicinc.com \
    --cc=quic_rampraka@quicinc.com \
    --cc=quic_sachgupt@quicinc.com \
    --cc=quic_sartgarg@quicinc.com \
    --cc=quic_spuppala@quicinc.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox