public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Linlin Zhang <linlin.zhang@oss.qualcomm.com>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	adrianvovk@gmail.com, dm-devel@lists.linux.dev,
	quic_mdalam@quicinc.com, gmazyland@gmail.com, israelr@nvidia.com,
	mpatocka@redhat.com
Subject: Re: [PATCH v1 3/3] dm-inlinecrypt: Expose inline crypto caps to the device
Date: Wed, 11 Mar 2026 23:35:34 -0700	[thread overview]
Message-ID: <20260312063534.GC2359@sol> (raw)
In-Reply-To: <20260304121729.1532469-4-linlin.zhang@oss.qualcomm.com>

On Wed, Mar 04, 2026 at 04:17:28AM -0800, Linlin Zhang wrote:
> Add a new DM flag, which means the inline crypto capabilities
> from underlying devices can be exposed to the DM device, and
> the DM device consumes these capabilities, rather pass through
> them to the upper layer.
> 
> Signed-off-by: Linlin Zhang <linlin.zhang@oss.qualcomm.com>
> ---
>  drivers/md/dm-inlinecrypt.c   | 2 +-
>  drivers/md/dm-table.c         | 3 ++-
>  include/linux/device-mapper.h | 7 +++++++
>  3 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/dm-inlinecrypt.c b/drivers/md/dm-inlinecrypt.c
> index 251760da9f7e..eda56893d430 100644
> --- a/drivers/md/dm-inlinecrypt.c
> +++ b/drivers/md/dm-inlinecrypt.c
> @@ -396,7 +396,7 @@ static struct target_type inlinecrypt_target = {
>  	 * Do not set DM_TARGET_PASSES_CRYPTO, since dm-inlinecrypt consumes the
>  	 * crypto capability itself.
>  	 */
> -	.features		= DM_TARGET_ZONED_HM,
> +	.features		= DM_TARGET_CONSUME_CRYPTO | DM_TARGET_ZONED_HM,
>  	.module			= THIS_MODULE,
>  	.ctr			= inlinecrypt_ctr,
>  	.dtr			= inlinecrypt_dtr,
> diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
> index 7be1d8dc8bdd..f0580935394a 100644
> --- a/drivers/md/dm-table.c
> +++ b/drivers/md/dm-table.c
> @@ -1407,7 +1407,8 @@ static int dm_table_construct_crypto_profile(struct dm_table *t)
>  	for (i = 0; i < t->num_targets; i++) {
>  		struct dm_target *ti = dm_table_get_target(t, i);
>  
> -		if (!dm_target_passes_crypto(ti->type)) {
> +		if (!dm_target_passes_crypto(ti->type)
> +				&& !dm_target_consume_crypto(ti->type)) {
>  			blk_crypto_intersect_capabilities(profile, NULL);
>  			break;
>  		}
> diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
> index 38f625af6ab4..6abd1b4fcb76 100644
> --- a/include/linux/device-mapper.h
> +++ b/include/linux/device-mapper.h
> @@ -306,6 +306,13 @@ struct target_type {
>  #define dm_target_supports_mixed_zoned_model(type) (false)
>  #endif
>  
> +/*
> + * A target consumes inline crypto capabilities itself and doesn't support
> + * passing through inline crypto support.
> + */
> +#define DM_TARGET_CONSUME_CRYPTO		0x00000300
> +#define dm_target_consume_crypto(type) ((type)->features & DM_TARGET_CONSUME_CRYPTO)

This patch doesn't make any sense.  First, no new flag is needed, as the
behavior is already correct if you just leave DM_TARGET_PASSES_CRYPTO
unset, as far as I can tell.  Second, the new flag is numerically equal
to DM_TARGET_PASSES_CRYPTO|CONFIG_BLK_DEV_ZONED.  Third, even if it had
a unique bit as seems to have been intended, the behavior is the same as
DM_TARGET_PASSES_CRYPTO, which should not be used on this target.

- Eric

  reply	other threads:[~2026-03-12  6:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04 12:17 [PATCH v1 0/3] dm-inlinecrypt: add target for inline block device encryption Linlin Zhang
2026-03-04 12:17 ` [PATCH v1 1/3] block: export blk-crypto symbols required by dm-inlinecrypt Linlin Zhang
2026-03-09 14:01   ` Mikulas Patocka
2026-03-09 15:05   ` Jens Axboe
2026-03-09 16:12     ` Mikulas Patocka
2026-03-04 12:17 ` [PATCH v1 2/3] dm-inlinecrypt: add target for inline block device encryption Linlin Zhang
2026-03-04 13:11   ` Milan Broz
2026-03-25 11:27     ` Linlin Zhang
2026-03-12  7:01   ` Eric Biggers
2026-03-13 13:25     ` Mikulas Patocka
2026-03-13 15:27       ` Milan Broz
2026-03-25 11:57         ` Linlin Zhang
2026-03-25 15:07           ` Milan Broz
2026-03-25  6:55     ` Linlin Zhang
2026-03-04 12:17 ` [PATCH v1 3/3] dm-inlinecrypt: Expose inline crypto caps to the device Linlin Zhang
2026-03-12  6:35   ` Eric Biggers [this message]
2026-03-13 13:19     ` Mikulas Patocka
2026-03-25  6:38     ` Linlin Zhang
2026-03-04 13:06 ` [PATCH v1 0/3] dm-inlinecrypt: add target for inline block device encryption Christoph Hellwig
2026-03-04 18:09   ` Adrian Vovk
     [not found]   ` <CAAdYy_mSB4U39Onwa=V2e2XB0sJXV6tCGkzwV2-z7ZtMcm+8zg@mail.gmail.com>
2026-03-05 14:38     ` Christoph Hellwig
2026-03-25  7:04       ` Linlin Zhang

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=20260312063534.GC2359@sol \
    --to=ebiggers@kernel.org \
    --cc=adrianvovk@gmail.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=gmazyland@gmail.com \
    --cc=israelr@nvidia.com \
    --cc=linlin.zhang@oss.qualcomm.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=quic_mdalam@quicinc.com \
    /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