[PATCH v3 0/8] Add SM uclass and Meson SM driver

Alexey Romanov avromanov at salutedevices.com
Thu Sep 21 10:13:33 CEST 2023


Hello!

At the moment, there is no single general approach to using
secure monitor in U-Boot, there is only the smc_call() function,
over which everyone builds their own add-ons. This patchset
is designed to solve this problem by adding a new uclass -
SM_UCLASS. This UCLASS export following generic API:

1. sm_call() - generic SMC call to the secure-monitor
2. sm_call_read() - retrieve data from secure-monitor
3. sm_call_write() - send data to secure-monitor

In the future, it is necessary to completely get rid of raw
smc_call() calls, replacing them with the use of SM_UCLASS
based drivers.

V2:

- Add SM UCLASS
- Add SM sandbox driver
- Add test for sandbox driver
- Meson Secure Monitor driver now based on SM_UCLASS
- Fix include order in arch/arm/mach-meson/sm.c

Also, during the discussion in V1 of this patchset, it was
discussed to create MESON_SM_UCLASS, but I considered such
a uclass to be too arch-specific. That's why I suggest
SM_UCLASS, which is not so arch-specific: secure monitor can
used for whole ARM devices, not only for Amlogic SoC's.

V3:

- Fix typos in commit messages
- Use uclass_first_device_err() instead of uclass_get_device_by_name()
- Return -ENOSYS instead of -EPROTONOSUPPORT if SM_UCLASS option not
implemented

Alexey Romanov (8):
  drivers: introduce Secure Monitor uclass
  sandbox: add sandbox sm uclass driver
  sandbox: dts: add meson secure monitor node
  sandbox: add tests for UCLASS_SM
  sandbox: defconfig: enable CONFIG_SM option
  drivers: introduce Meson Secure Monitor driver
  arch: meson: sm: set correct order of the includes
  arch: meson: use secure monitor driver

 MAINTAINERS                 |   1 +
 arch/arm/mach-meson/Kconfig |   1 +
 arch/arm/mach-meson/sm.c    | 116 +++++++++++----------
 arch/sandbox/dts/test.dts   |   4 +
 configs/sandbox_defconfig   |   1 +
 drivers/Kconfig             |   2 +
 drivers/Makefile            |   1 +
 drivers/sm/Kconfig          |   9 ++
 drivers/sm/Makefile         |   5 +
 drivers/sm/meson-sm.c       | 198 ++++++++++++++++++++++++++++++++++++
 drivers/sm/sandbox-sm.c     |  76 ++++++++++++++
 drivers/sm/sm-uclass.c      |  55 ++++++++++
 include/dm/uclass-id.h      |   1 +
 include/meson/sm.h          |  19 ++++
 include/sandbox-sm.h        |  18 ++++
 include/sm-uclass.h         |  72 +++++++++++++
 include/sm.h                |  67 ++++++++++++
 test/dm/Makefile            |   1 +
 test/dm/sm.c                |  65 ++++++++++++
 19 files changed, 656 insertions(+), 56 deletions(-)
 create mode 100644 drivers/sm/Kconfig
 create mode 100644 drivers/sm/Makefile
 create mode 100644 drivers/sm/meson-sm.c
 create mode 100644 drivers/sm/sandbox-sm.c
 create mode 100644 drivers/sm/sm-uclass.c
 create mode 100644 include/meson/sm.h
 create mode 100644 include/sandbox-sm.h
 create mode 100644 include/sm-uclass.h
 create mode 100644 include/sm.h
 create mode 100644 test/dm/sm.c

-- 
2.25.1



More information about the U-Boot mailing list