From: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
To: jorge.ramirez@oss.qualcomm.com, trini@konsulko.com,
jens.wiklander@linaro.org, ilias.apalodimas@linaro.org,
neil.armstrong@linaro.org, bhupesh.linux@gmail.com,
n-francis@ti.com, marek.vasut+renesas@mailbox.org,
igor.belwon@mentallysanemainliners.org, shawn.lin@rock-chips.com,
yoshihiro.shimoda.uh@renesas.com, alchark@gmail.com,
tuyen.dang.xa@renesas.com, macpaul.lin@mediatek.com,
padmarao.begari@amd.com, jstephan@baylibre.com, bb@ti.com,
j-mcarthur@ti.com, venkyada@qti.qualcomm.com,
hayashi.kunihiko@socionext.com
Cc: u-boot@lists.denx.de, sumit.garg@kernel.org
Subject: [PATCH v1 0/7] ufs: rpmb: route OP-TEE RPMB secure storage over UFS
Date: Mon, 20 Jul 2026 10:51:40 +0200 [thread overview]
Message-ID: <20260720085202.537019-1-jorge.ramirez@oss.qualcomm.com> (raw)
OP-TEE secure storage (CFG_RPMB_FS) relies on an RPMB partition, but
U-Boot's OP-TEE RPMB supplicant only speaks the legacy single-command
interface, which is bound to eMMC. SoCs that are UFS-only and have no
eMMC (for example the Qualcomm SA8775P) therefore cannot back OP-TEE
secure storage from U-Boot today. This series adds that support.
It introduces the transport-agnostic OP-TEE RPMB "subsystem" interface
(PROBE_RESET / PROBE_NEXT / FRAMES), where the normal world enumerates
the RPMB device and reports its kind, size and CID, then carries the
signed frames. The legacy eMMC supplicant is preserved unchanged, only
renamed to rpmb_legacy.c; the two are mutually exclusive via Kconfig
(SUPPORT_UFS_RPMB depends on !SUPPORT_EMMC_RPMB) because the OP-TEE
supplicant handles a single RPMB transport. The subsystem interface is
UFS-only for now; eMMC can be migrated onto it later as the legacy path
is retired.
On top of that it adds a UFS RPMB transport that moves JEDEC RPMB frames
to and from the RPMB Well-Known LUN using SCSI SECURITY PROTOCOL IN/OUT.
The per-region 16-byte CID is derived by BLAKE2b-hashing the exact
device-id string the Linux kernel builds (ufshcd_create_device_id()
plus a "-R<region>" suffix), so OP-TEE derives an RPMB key that matches
the one Linux would use.
The first patch is a standalone UFS descriptor fix the RPMB path depends
on (UTF-16BE string decoding); the transport patches also include a
power-on UNIT ATTENTION retry and a DMA-alignment bounce for the RPMB
WLUN.
Note: reading UFS descriptors reliably also requires the descriptor
data-segment cache-invalidation fix, which has already been posted and
merged separately, so this series is based on top of it.
Tested on the Qualcomm IQ-9075-EVK (SA8775P): OP-TEE with CFG_RPMB_FS
programs the RPMB key through U-Boot and reads/writes secure-storage
objects, with the derived CID matching the Linux UFS device_id ABI.
Dependencies:
Linux kernel:
https://lore.kernel.org/linux-scsi/20260716083728.2226422-1-jorge.ramirez@oss.qualcomm.com/
Op-tee
https://github.com/OP-TEE/optee_os/pull/7881
Jorge Ramirez-Ortiz (7):
ufs: decode string descriptors as UTF-16 big-endian
ufs: add RPMB transport over SCSI SECURITY PROTOCOL
ufs: rpmb: derive the per-region RPMB CID and size for OP-TEE
ufs: rpmb: retry SECURITY PROTOCOL on power-on UNIT ATTENTION
ufs: rpmb: bounce unaligned frames through a DMA-aligned buffer
optee: rename rpmb.c to rpmb_legacy.c
optee: implement the RPMB subsystem interface for UFS
drivers/tee/optee/Makefile | 3 +-
drivers/tee/optee/optee_msg_supplicant.h | 8 +
drivers/tee/optee/optee_private.h | 41 +++
drivers/tee/optee/rpmb.c | 217 ++++++----------
drivers/tee/optee/rpmb_legacy.c | 193 ++++++++++++++
drivers/tee/optee/supplicant.c | 9 +
drivers/ufs/Kconfig | 13 +
drivers/ufs/Makefile | 1 +
drivers/ufs/ufs-rpmb.c | 307 +++++++++++++++++++++++
drivers/ufs/ufs-uclass.c | 18 +-
drivers/ufs/ufs.h | 24 ++
include/ufs.h | 12 +
12 files changed, 701 insertions(+), 145 deletions(-)
create mode 100644 drivers/tee/optee/rpmb_legacy.c
create mode 100644 drivers/ufs/ufs-rpmb.c
base-commit: ece349ade2973e220f524ce59e59711cc919263f
--
2.54.0
next reply other threads:[~2026-07-20 8:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 8:51 Jorge Ramirez-Ortiz [this message]
2026-07-20 8:51 ` [PATCH v1 1/7] ufs: decode string descriptors as UTF-16 big-endian Jorge Ramirez-Ortiz
2026-07-20 8:51 ` [PATCH v1 2/7] ufs: add RPMB transport over SCSI SECURITY PROTOCOL Jorge Ramirez-Ortiz
2026-07-20 8:51 ` [PATCH v1 3/7] ufs: rpmb: derive the per-region RPMB CID and size for OP-TEE Jorge Ramirez-Ortiz
2026-07-20 8:51 ` [PATCH v1 4/7] ufs: rpmb: retry SECURITY PROTOCOL on power-on UNIT ATTENTION Jorge Ramirez-Ortiz
2026-07-20 8:51 ` [PATCH v1 5/7] ufs: rpmb: bounce unaligned frames through a DMA-aligned buffer Jorge Ramirez-Ortiz
2026-07-20 8:51 ` [PATCH v1 6/7] optee: rename rpmb.c to rpmb_legacy.c Jorge Ramirez-Ortiz
2026-07-20 8:51 ` [PATCH v1 7/7] optee: implement the RPMB subsystem interface for UFS Jorge Ramirez-Ortiz
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=20260720085202.537019-1-jorge.ramirez@oss.qualcomm.com \
--to=jorge.ramirez@oss.qualcomm.com \
--cc=alchark@gmail.com \
--cc=bb@ti.com \
--cc=bhupesh.linux@gmail.com \
--cc=hayashi.kunihiko@socionext.com \
--cc=igor.belwon@mentallysanemainliners.org \
--cc=ilias.apalodimas@linaro.org \
--cc=j-mcarthur@ti.com \
--cc=jens.wiklander@linaro.org \
--cc=jstephan@baylibre.com \
--cc=macpaul.lin@mediatek.com \
--cc=marek.vasut+renesas@mailbox.org \
--cc=n-francis@ti.com \
--cc=neil.armstrong@linaro.org \
--cc=padmarao.begari@amd.com \
--cc=shawn.lin@rock-chips.com \
--cc=sumit.garg@kernel.org \
--cc=trini@konsulko.com \
--cc=tuyen.dang.xa@renesas.com \
--cc=u-boot@lists.denx.de \
--cc=venkyada@qti.qualcomm.com \
--cc=yoshihiro.shimoda.uh@renesas.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.