mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linlin Zhang <linlin.zhang@oss.qualcomm.com>
To: linux-block@vger.kernel.org, ebiggers@kernel.org
Cc: 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: [PATCH v1 3/3] dm-inlinecrypt: Expose inline crypto caps to the device
Date: Wed,  4 Mar 2026 04:17:28 -0800	[thread overview]
Message-ID: <20260304121729.1532469-4-linlin.zhang@oss.qualcomm.com> (raw)
In-Reply-To: <20260304121729.1532469-1-linlin.zhang@oss.qualcomm.com>

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)
+
 #define DM_TARGET_ATOMIC_WRITES		0x00000400
 #define dm_target_supports_atomic_writes(type) ((type)->features & DM_TARGET_ATOMIC_WRITES)
 
-- 
2.34.1


  parent reply	other threads:[~2026-03-04 12:17 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 ` Linlin Zhang [this message]
2026-03-12  6:35   ` [PATCH v1 3/3] dm-inlinecrypt: Expose inline crypto caps to the device Eric Biggers
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=20260304121729.1532469-4-linlin.zhang@oss.qualcomm.com \
    --to=linlin.zhang@oss.qualcomm.com \
    --cc=adrianvovk@gmail.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=ebiggers@kernel.org \
    --cc=gmazyland@gmail.com \
    --cc=israelr@nvidia.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

all inboxes | Powered by JetHome®