Re: [PATCH v1 1/3] rpmb: move rpmb_frame struct and constants to common header

From: Bean Huo
Date: Thu Sep 25 2025 - 10:57:51 EST


On Wed, 2025-09-24 at 06:12 +0000, Avri Altman wrote:
> > From: Bean Huo <beanhuo@xxxxxxxxxx>
> >
> > Move struct rpmb_frame and RPMB operation constants from MMC block
> > driver to include/linux/rpmb.h for reuse across different RPMB
> > implementations (UFS, NVMe, etc.).
> UFS RPMB differs from mmc RPMB in several levels:
>  - 9 vs. 5 operations
>  - frame structure: extended 4k
>  - rpmb unit descriptor
> etc.
> And as time goes on, this gap is likely to become larger,
> As mmc is not very likely to introduce major changes.
>
> Thus, you might want to consider having an internal ufs header - will simplify
> things in the future.
>
> Thanks,
> Avri


Avri,

thanks, I got your points.

In normal mode, UFS RPMB uses the same 512-byte frame format as eMMC RPMB,
with the same fields (MAC, nonce, counter, address, etc.). That’s why it makes
sense to keep a single definition of the frame struct in include/linux/rpmb.h,
so both eMMC and UFS RPMB drivers can reuse it without duplication.

The major differences only exist in UFS RPMB advanced mode, correct?

For advanced mode, our plan is to introduce a UFS-specific header for the
additional features (extended 4K frame, new opcodes, descriptors), so that
UFS can evolve independently without breaking the shared interface.

let's firstly enable UFS RPMB in normal mode, since its OP-TEE application is
avaiable in OP-TEE OS, the custoemr can use it simply. As discussed with Jens,
we can move next step for advanced RPMB for UFS, is this ok for you?


Kind regards,
Bean