From nobody Tue Feb 10 07:22:31 2026 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A04934CFC2 for ; Thu, 29 Jan 2026 03:20:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769656830; cv=none; b=nQCvCaDzc9KHZL8Yo+Q1SK8GVLxVYctZYoKYBrGXg7SL/HLj/faj/d3P8ma5DohS48AfXpsaCGY10PuckafVZ6+IsxAuY5TUjM8UNi80bMptvUZCbeW/iYaUezZ1RsG8yCXP+uzh43ACqTIx3CiAX2sTJzvHxEGhJ4GYfQ4I04U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769656830; c=relaxed/simple; bh=1Ii7V88DAH2WXmP8Gyx8c+QC52EAWiHFOqy2t8sbY8g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:MIME-Version: Content-Type:References; b=YYRSw9HLaOQkBMOb6djWfpUjwRQz7vPVt8zzrpVgyYJDTWvCh0I/wbuzbnF44mSA7ZdCVrtJinZPsgaKEryg3Bt1TyqCcVNMbCqEl15jO8T26sEIKXCcCqMKmpYJG45VpoOQFaPWVAWzVVtul4POYaojEFfMxtetDZt+6G6TjmY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=Y2Id7XJm; arc=none smtp.client-ip=203.254.224.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="Y2Id7XJm" Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20260129032026epoutp0474bd90094bb6509e027378955aa78998~PFYIOWeVs0352303523epoutp04d for ; Thu, 29 Jan 2026 03:20:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20260129032026epoutp0474bd90094bb6509e027378955aa78998~PFYIOWeVs0352303523epoutp04d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1769656826; bh=+zoEUws75av8unKfrjyl9GLv3I0yHKz+75I7bVXnS9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y2Id7XJmYlIgASjDRF7jF1ZHpSUcsMSv2KmLPdmFeUUnzuMkvQ3Rnjh9Osy4oxuZ1 KpxW3zGWU3oDXMH+IdavbaHWUQssB7g7Zy9bTPj8mN3S1RuvCD7kDEp6O4Mz5RE3qa OYxHU60P+8eU2NQG5aCKj7qzFfFYRaHjBNecCPu8= Received: from epsnrtp03.localdomain (unknown [182.195.42.155]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPS id 20260129032026epcas5p1f04820c0786365a8321feefcb12341cd~PFYH76uFg0140301403epcas5p1l; Thu, 29 Jan 2026 03:20:26 +0000 (GMT) Received: from epcas5p4.samsung.com (unknown [182.195.38.93]) by epsnrtp03.localdomain (Postfix) with ESMTP id 4f1kt14CYBz3hhTF; Thu, 29 Jan 2026 03:20:25 +0000 (GMT) Received: from epsmtip1.samsung.com (unknown [182.195.34.30]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20260129031043epcas5p36dc864415f55b44ededa232c17d33f39~PFPpQmO-_1803918039epcas5p3X; Thu, 29 Jan 2026 03:10:43 +0000 (GMT) Received: from testpc12933.samsungds.net (unknown [109.105.129.33]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20260129031042epsmtip1e2d533838c079fa2d219495b248bf3c4~PFPoHds3H0411304113epsmtip1v; Thu, 29 Jan 2026 03:10:42 +0000 (GMT) From: "zheng.gong" To: linux-scsi@vger.kernel.org Cc: avri.altman@wdc.com, bvanassche@acm.org, quic_cang@quicinc.com, alim.akhtar@samsung.com, martin.petersen@oracle.com, ebiggers@kernel.org, linux-kernel@vger.kernel.org, "zheng.gong" Subject: [PATCH v4 2/3] scsi: ufs: exynos: Support crypto keyslot remapping via DT Date: Thu, 29 Jan 2026 11:10:32 +0800 Message-ID: <20260129031033.3428295-3-zheng.gong@samsung.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260129031033.3428295-1-zheng.gong@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CMS-MailID: 20260129031043epcas5p36dc864415f55b44ededa232c17d33f39 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P cpgsPolicy: CPGSC10-505,Y X-CFilter-Loop: Reflected X-CMS-RootMailID: 20260129031043epcas5p36dc864415f55b44ededa232c17d33f39 References: <20251112031035.GA2832160@google.com> <20260129031033.3428295-1-zheng.gong@samsung.com> 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 --- 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; } =20 +static void exynos_ufs_fmp_crypto_keyslot_remap(struct ufs_hba *hba, + struct ufshcd_lrb *lrbp) +{ + struct device_node *np =3D 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) =3D=3D 0) { + if (lrbp->crypto_key_slot >=3D 0) + lrbp->crypto_key_slot +=3D offset; + } +} + #else /* CONFIG_SCSI_UFS_CRYPTO */ =20 static void exynos_ufs_fmp_init(struct ufs_hba *hba, struct exynos_ufs *uf= s) @@ -1449,6 +1462,8 @@ static void exynos_ufs_fmp_resume(struct ufs_hba *hba) =20 #define exynos_ufs_fmp_fill_prdt NULL =20 +#define exynos_ufs_fmp_crypto_keyslot_remap NULL + #endif /* !CONFIG_SCSI_UFS_CRYPTO */ =20 static int exynos_ufs_init(struct ufs_hba *hba) @@ -2013,6 +2028,7 @@ static const struct ufs_hba_variant_ops ufs_hba_exyno= s_ops =3D { .suspend =3D exynos_ufs_suspend, .resume =3D exynos_ufs_resume, .fill_crypto_prdt =3D exynos_ufs_fmp_fill_prdt, + .crypto_keyslot_remap =3D exynos_ufs_fmp_crypto_keyslot_remap, }; =20 static struct ufs_hba_variant_ops ufs_hba_exynosauto_vh_ops =3D { --=20 2.50.1