Skip to content

Switch Arm CCA to use an auxiliary device instead of a platform device

Aneesh Kumar K.V (Arm) linux-arm-kernel linux-coco lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest3 patches 18 repliesIn review
  2. v42 patches 10 repliesSuperseded
  3. v32 patches 1 replySuperseded

Changes in v5 from the cover letter

https://lore.kernel.org/all/[email protected]
* Add /sys/firmware/cca/realm_guest for detecting realm guest
* Convert smccc-trng to auxiliary device from platform device

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3firmware: smccc: coco: Manage arm-smccc platform device and CCA auxiliary driversarch/arm64/include/asm/rsi.h arch/arm64/kernel/rsi.c drivers/firmware/smccc/Kconfig +7 more+94 -3215 replies
2/3hwrng: arm_smccc_trng: Register as an auxiliary devicedrivers/char/hw_random/arm_smccc_trng.c drivers/firmware/smccc/smccc.c+27 -220 replies
3/3coco: guest: arm64: Replace dummy CCA device with sysfs ABIDocumentation/ABI/testing/sysfs-firmware-cca arch/arm64/kernel/rsi.c+39 -100 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [PATCH v5 0/3] Switch Arm CCA to use an auxiliary device instead of a platform device

As discussed here:
https://lore.kernel.org/all/[email protected]

The general feedback was that a platform device should not be used when there is no underlying platform resource to represent. The existing CCA support uses a platform device solely to anchor the TSM interface in the device hierarchy, which is not an appropriate use of a platform device. Use an auxiliary device instead to track CCA support.

The TSM framework uses the device abstraction to provide cross-architecture TSM and TEE I/O functionality, including enumerating available platform TEE I/O capabilities and provisioning connections between the platform TSM and device DSMs.

For the CCA platform, the resulting device hierarchy appears as follows. Note that the auxiliary device is still parented by the arm-smccc platform device, so the sysfs path remains under /devices/platform/arm-smccc/:

$ cd /sys/class/tsm/
$ ls -al
total 0
drwxr-xr-x    2 root     root             0 Jan  1 00:02 .
drwxr-xr-x   23 root     root             0 Jan  1 00:00 ..
lrwxrwxrwx    1 root     root             0 Jan  1 00:03 tsm0 -> ../../devices/platform/arm-smccc/arm_cca_guest.arm-rsi-dev.0/tsm/tsm0
$

Changes from v4:
https://lore.kernel.org/all/[email protected]
* Add /sys/firmware/cca/realm_guest for detecting realm guest
* Convert smccc-trng to auxiliary device from platform device

Changes from v3:
https://lore.kernel.org/all/[email protected]
* Rebased onto the latest kernel
* Drop pr_fmt() from drivers/firmware/smccc/rmm.c

Cc Catalin Marinas <[email protected]>
Cc Greg KH <[email protected]>
Cc Jeremy Linton <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Lorenzo Pieralisi <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Sudeep Holla <[email protected]>
Cc Will Deacon <[email protected]>
Cc Steven Price <[email protected]>
Cc Suzuki K Poulose <[email protected]>

Aneesh Kumar K.V (Arm) (3):
firmware: smccc: coco: Manage arm-smccc platform device and CCA
auxiliary drivers
hwrng: arm_smccc_trng: Register as an auxiliary device
coco: guest: arm64: Replace dummy CCA device with sysfs ABI

 Documentation/ABI/testing/sysfs-firmware-cca  | 10 ++++
 arch/arm64/include/asm/rsi.h                  |  2 +-
 arch/arm64/kernel/rsi.c                       | 39 ++++++++----
 drivers/char/hw_random/arm_smccc_trng.c       | 25 ++++----
 drivers/firmware/smccc/Kconfig                |  1 +
 drivers/firmware/smccc/Makefile               |  1 +
 drivers/firmware/smccc/rmm.c                  | 24 ++++++++
 drivers/firmware/smccc/rmm.h                  | 17 ++++++
 drivers/firmware/smccc/smccc.c                | 29 +++++++--
 drivers/virt/coco/arm-cca-guest/Kconfig       |  1 +
 drivers/virt/coco/arm-cca-guest/Makefile      |  2 +
 .../{arm-cca-guest.c => arm-cca.c}            | 59 +++++++++----------
 12 files changed, 153 insertions(+), 57 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-firmware-cca
 create mode 100644 drivers/firmware/smccc/rmm.c
 create mode 100644 drivers/firmware/smccc/rmm.h
 rename drivers/virt/coco/arm-cca-guest/{arm-cca-guest.c => arm-cca.c} (84%)
Signature · 1 line
2.43.0