All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Om Prakash Singh <quic_omprsing@quicinc.com>
Cc: andersson@kernel.org, linux-mmc@vger.kernel.org,
	satyaprateek2357@gmail.com, ulf.hansson@linaro.org,
	agross@kernel.org, adrian.hunter@intel.com,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH] mmc: core: crypto: Add MMC_CAP2_CRYPTO_RETAIN_KEY
Date: Mon, 21 Aug 2023 21:50:11 -0700	[thread overview]
Message-ID: <20230822045011.GA1661@sol.localdomain> (raw)
In-Reply-To: <20230821065037.1146977-1-quic_omprsing@quicinc.com>

On Mon, Aug 21, 2023 at 12:20:37PM +0530, Om Prakash Singh wrote:
> Add new capability MMC_CAP2_CRYPTO_RETAIN_KEY for mmc host that
> support inline crypto key retention and doesn't need reinitialization
> of all keys after mmc host has reinitialized.

MMC_CAP2_RETAINS_CRYPTO_KEYS would be a better name.

> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
> index 1c935b5bafe1..cfc2328f90ed 100644
> --- a/drivers/mmc/host/sdhci-msm.c
> +++ b/drivers/mmc/host/sdhci-msm.c
> @@ -1828,6 +1828,7 @@ static int sdhci_msm_ice_init(struct sdhci_msm_host *msm_host,
>  
>  	msm_host->ice = ice;
>  	mmc->caps2 |= MMC_CAP2_CRYPTO;
> +	mmc->caps2 |= MMC_CAP2_CRYPTO_RETAIN_KEY;
>  
>  	return 0;
>  }

Are you sure that *all* versions of Qualcomm's eMMC inline encryption hardware
have this behavior?

> diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
> index 461d1543893b..74c69415746d 100644
> --- a/include/linux/mmc/host.h
> +++ b/include/linux/mmc/host.h
> @@ -417,8 +417,10 @@ struct mmc_host {
>  #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 */
> +#define MMC_CAP2_CRYPTO_RETAIN_KEY (1 << 28)	/* Host doesn't need inline encryption key reinitialization */

How about:

/* Host retains inline encryption keys on reset */

>  #else
>  #define MMC_CAP2_CRYPTO		0
> +#define MMC_CAP2_CRYPTO_RETAIN_KEY 0
>  #endif
>  #define MMC_CAP2_ALT_GPT_TEGRA	(1 << 28)	/* Host with eMMC that has GPT entry at a non-standard location */

'1 << 28' is already used.

Also, the new flag doesn't need to be in the #ifdef section.

- Eric

  reply	other threads:[~2023-08-22  4:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-21  6:50 [PATCH] mmc: core: crypto: Add MMC_CAP2_CRYPTO_RETAIN_KEY Om Prakash Singh
2023-08-22  4:50 ` Eric Biggers [this message]
2023-08-23  3:56   ` Om Prakash Singh

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=20230822045011.GA1661@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=quic_omprsing@quicinc.com \
    --cc=satyaprateek2357@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.