RPMB user space ABI

From: Alex Bennée
Date: Mon Feb 15 2021 - 07:48:21 EST


Hi,

Last year while I was implementing a virtio-rpmb backend for QEMU I
ended up using patches from the ACRN tree which was based on Thomas'
patches last posted in 2016:

https://lore.kernel.org/lkml/1478548394-8184-1-git-send-email-tomas.winkler@xxxxxxxxx/

which I bastardised into a testing tree on a more recent kernel:

https://git.linaro.org/people/alex.bennee/linux.git/log/?h=testing/virtio-rpmb

The main reason I hacked them around was because the VirtIO spec had
since been finalised and had a very different framing structure. The
original proposed ABI provided for an ioctl which sent JDEC frames to
the underlying device. This was later expanded to support NVME style
frames. Neither of these frame sequences matched the final VirtIO
specification.

It seems to me having the ioctl ABI at this level exposes too many
underlying HW details to user space. With the number of HW devices that
providing RPMB features likely to grow from the current 3 (eMMC/JDEC,
NVME, VirtIO) it seems this ABI should operate at a higher level, e.g.:

PROGRAM_KEY
GET_WRITE_COUNTER
WRITE_DATA
READ_DATA

and I guess some sort of asynchronous result check?

It would then be for the kernel to take the higher level concepts and
translate them to the final frames required to talk to the actual HW (if
indeed there is some).

Does this seem reasonable? Is this orthogonal to any access to RPMB
partitions that file-systems might want to do?

--
Alex Bennée