[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260129031033.3428295-3-zheng.gong@samsung.com>
Date: Thu, 29 Jan 2026 11:10:32 +0800
From: "zheng.gong" <zheng.gong@...sung.com>
To: linux-scsi@...r.kernel.org
Cc: avri.altman@....com, bvanassche@....org, quic_cang@...cinc.com,
alim.akhtar@...sung.com, martin.petersen@...cle.com, ebiggers@...nel.org,
linux-kernel@...r.kernel.org, "zheng.gong" <zheng.gong@...sung.com>
Subject: [PATCH v4 2/3] scsi: ufs: exynos: Support crypto keyslot remapping
via DT
Add support for crypto keyslot remapping in the exynos UFS driver using
the device tree property 'ufs-keyslot-offset'.
This allows platforms to apply a fixed offset to the logical keyslot,
enabling secure inline encryption in virtualized or multi-domain
environments.
The implementation is generic and optional which only active if the DT
property is present.
Signed-off-by: zheng.gong <zheng.gong@...sung.com>
---
drivers/ufs/host/ufs-exynos.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c
index 70d195179eba..dc63900ebbee 100644
--- a/drivers/ufs/host/ufs-exynos.c
+++ b/drivers/ufs/host/ufs-exynos.c
@@ -1437,6 +1437,19 @@ static int exynos_ufs_fmp_fill_prdt(struct ufs_hba *hba,
return 0;
}
+static void exynos_ufs_fmp_crypto_keyslot_remap(struct ufs_hba *hba,
+ struct ufshcd_lrb *lrbp)
+{
+ struct device_node *np = hba->dev->of_node;
+ u32 offset;
+
+ /* If dt property is not present, use identity mapping still.*/
+ if (of_property_read_u32(np, "ufs-keyslot-offset", &offset) == 0) {
+ if (lrbp->crypto_key_slot >= 0)
+ lrbp->crypto_key_slot += offset;
+ }
+}
+
#else /* CONFIG_SCSI_UFS_CRYPTO */
static void exynos_ufs_fmp_init(struct ufs_hba *hba, struct exynos_ufs *ufs)
@@ -1449,6 +1462,8 @@ static void exynos_ufs_fmp_resume(struct ufs_hba *hba)
#define exynos_ufs_fmp_fill_prdt NULL
+#define exynos_ufs_fmp_crypto_keyslot_remap NULL
+
#endif /* !CONFIG_SCSI_UFS_CRYPTO */
static int exynos_ufs_init(struct ufs_hba *hba)
@@ -2013,6 +2028,7 @@ static const struct ufs_hba_variant_ops ufs_hba_exynos_ops = {
.suspend = exynos_ufs_suspend,
.resume = exynos_ufs_resume,
.fill_crypto_prdt = exynos_ufs_fmp_fill_prdt,
+ .crypto_keyslot_remap = exynos_ufs_fmp_crypto_keyslot_remap,
};
static struct ufs_hba_variant_ops ufs_hba_exynosauto_vh_ops = {
--
2.50.1
Powered by blists - more mailing lists