[PATCH 0/3] tee: optee: prepare the driver for RISC-V

marouene.boubakri@oss.nxp.com posted 3 patches 1 week, 3 days ago
drivers/tee/Kconfig               |  2 +-
drivers/tee/optee/Kconfig         | 10 +++++-
drivers/tee/optee/Makefile        |  5 +--
drivers/tee/optee/call.c          |  8 +++++
drivers/tee/optee/core.c          |  8 +++--
drivers/tee/optee/notif.c         |  1 -
drivers/tee/optee/optee_private.h | 52 ++++++++++++++++++++++++++++++-
drivers/tee/optee/rpmi_abi.c      | 23 ++++++++++++++
8 files changed, 101 insertions(+), 8 deletions(-)
create mode 100644 drivers/tee/optee/rpmi_abi.c
[PATCH 0/3] tee: optee: prepare the driver for RISC-V
Posted by marouene.boubakri@oss.nxp.com 1 week, 3 days ago
From: Marouene Boubakri <marouene.boubakri@oss.nxp.com>

The OP-TEE driver reaches OP-TEE through the SMC ABI or the FF-A ABI,
both specific to Arm, and the TEE subsystem and the OP-TEE driver
depend on HAVE_ARM_SMCCC. On RISC-V there is no SMC instruction: OP-TEE
runs in a domain isolated by the M-mode firmware and is reached through
the RISC-V Platform Management Interface (RPMI), carried on an SBI
Message Proxy (MPXY) channel, for which Linux already has a mailbox
driver.

This series only puts the build plumbing in place for a third ABI next
to the SMC and FF-A ones:

- patch 1 builds the Arm-specific code of the driver only on Arm:
  smc_abi.c when HAVE_ARM_SMCCC is set and ffa_abi.c when
  ARM_FFA_TRANSPORT is enabled, with stubs for their registration
  otherwise. The SMCCC header, the SMC and FF-A specific types and the
  SMC RPC register parameters in optee_private.h are kept under the
  same conditions, so that nothing Arm-specific is left in the common
  part of the driver;

- patch 2 adds an RPMI ABI placeholder: an OPTEE_RPMI_ABI option built
  when the MPXY mailbox driver is enabled, rpmi_abi.c and its
  registration from the driver core. The transport is not implemented,
  so the registration fails with -EOPNOTSUPP;

- patch 3 lets the TEE subsystem and the OP-TEE driver be enabled on
  RISC-V, and teaches the memory type check of the driver about the
  RISC-V page attributes, without which the driver does not build
  there. It is kept separate as it changes the dependencies of the
  subsystem-wide TEE menu.

There is no functional change. On Arm, OPTEE still depends on
HAVE_ARM_SMCCC and the SMC and FF-A ABIs are built whenever they can be
registered. On RISC-V the driver builds without any Arm-specific code
but no ABI registers, so it does not load. The RPMI transport will be
implemented on top of this in a separate series.

Testing: [TODO before posting: riscv64 defconfig plus TEE/OP-TEE,
built-in and as modules, and arm64 defconfig plus OP-TEE with FF-A
built-in, modular and disabled, with W=1 at every step of the series.]

Marouene Boubakri (3):
  tee: optee: build the Arm-specific code only on Arm
  tee: optee: add an RPMI ABI placeholder
  tee: optee: allow enabling the driver on RISC-V

 drivers/tee/Kconfig               |  2 +-
 drivers/tee/optee/Kconfig         | 10 +++++-
 drivers/tee/optee/Makefile        |  5 +--
 drivers/tee/optee/call.c          |  8 +++++
 drivers/tee/optee/core.c          |  8 +++--
 drivers/tee/optee/notif.c         |  1 -
 drivers/tee/optee/optee_private.h | 52 ++++++++++++++++++++++++++++++-
 drivers/tee/optee/rpmi_abi.c      | 23 ++++++++++++++
 8 files changed, 101 insertions(+), 8 deletions(-)
 create mode 100644 drivers/tee/optee/rpmi_abi.c


base-commit: 827751b699b79a6e569983359c02dce67f81b94c
-- 
2.43.0