]> git.ipfire.org Git - thirdparty/linux.git/commit
scsi: ufs: core: Fix RPMB region size detection for UFS 2.2
authorAlexey Charkov <alchark@flipper.net>
Mon, 9 Feb 2026 15:17:34 +0000 (19:17 +0400)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 18 Feb 2026 02:16:04 +0000 (21:16 -0500)
commit2e6b5cd6a4b37a95b78cf8c39a979b58c915c8ed
treec5a44860de92f065b6f4f7a4ee93122b5b17fc12
parent57297736c08233987e5d29ce6584c6ca2a831b12
scsi: ufs: core: Fix RPMB region size detection for UFS 2.2

Older UFS spec devices (2.2 and earlier) do not expose per-region RPMB
sizes, as only one RPMB region is supported. In such cases, the size of the
single RPMB region can be deduced from the Logical Block Count and Logical
Block Size fields in the RPMB Unit Descriptor.

Add a fallback mechanism to calculate the RPMB region size from these
fields if the device implements an older spec, so that the RPMB driver can
work with such devices - otherwise it silently skips the whole RPMB.

        Section 14.1.4.6 (RPMB Unit Descriptor)

Link: https://www.jedec.org/system/files/docs/JESD220C-2_2.pdf
Cc: stable@vger.kernel.org
Fixes: b06b8c421485 ("scsi: ufs: core: Add OP-TEE based RPMB driver for UFS devices")
Reviewed-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Alexey Charkov <alchark@flipper.net>
Link: https://patch.msgid.link/20260209-ufs-rpmb-v3-1-b1804e71bd38@flipper.net
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ufs/core/ufshcd.c