Hi,
This patch sets add a FF-A [1] mediator modeled after the TEE mediator
already present in Xen. The FF-A mediator implements the subset of the FF-A
1.1 specification needed to communicate with OP-TEE using FF-A as transport
mechanism instead of SMC/HVC as with the TEE mediator. It allows a similar
design in OP-TEE as with the TEE mediator where OP-TEE presents one virtual
partition of itself to each guest in Xen.
The FF-A mediator is generic in the sense it has nothing OP-TEE specific
except that only the subset needed for OP-TEE is implemented so far. The
hooks needed to inform OP-TEE that a guest is created or destroyed is part
of the FF-A specification.
It should be possible to extend the FF-A mediator to implement a larger
portion of the FF-A 1.1 specification without breaking with the way OP-TEE
is communicated with here. So it should be possible to support any TEE or
Secure Partition using FF-A as transport with this mediator.
[1] https://developer.arm.com/documentation/den0077/latest
Thanks,
Jens
V4->v5:
* Added "xen/arm: move regpair_to_uint64() and uint64_to_regpair() to regs.h"
* Added documentation for the "ffa_enabled" guest config flag
* Changed to GPL license for xen/arch/arm/ffa.c
* Added __read_mostly and const where applicable
* Added more describing comments in the code
* Moved list of shared memory object ("ffa_mem_list") into the guest context
as they are guest specific
* Simplified a few of the simple wrapper functions for SMC to SPMC
* Added a BUILD_BUG_ON(PAGE_SIZE != FFA_PAGE_SIZE) since the mediator
currently depends on the page size to be same as FFA_PAGE_SIZE (4k).
* Added max number of shared memory object per guest and max number of
size of each shared memory object
* Added helper macros to calculate offsets of different FF-A data structures
in the communication buffer instead of relying on pointer arithmetic
* Addressed style issues and other comments
* Broke the commit "xen/arm: add FF-A mediator" into multiple parts, trying
to add a few features at a time as requested
* Added a missing call to rxtx_unmap() in ffa_relinquish_resources()
* Assignment of "ffa_enabled" is kept as is until I have something definitive
on the type etc.
* Tested with CONFIG_DEBUG=y
v3->v4:
* Missed v3 and sent a v4 instead by mistake.
v2->v3:
* Generates offsets into struct arm_smccc_1_2_regs with asm-offsets.c in
order to avoid hard coded offsets in the assembly function
arm_smccc_1_2_smc()
* Adds an entry in SUPPORT.md on the FF-A status
* Adds a configuration variable "ffa_enabled" to tell if FF-A should be
enabled for a particular domu guest
* Moves the ffa_frag_list for fragmented memory share requests into
struct ffa_ctx instead to keep it per guest in order to avoid mixups
and simplify locking
* Adds a spinlock to struct ffa_ctx for per guest locking
* Addressing style issues and suggestions
* Uses FFA_FEATURES to check that all the needed features are available
before initializing the mediator
* Rebased on staging as of 2022-06-20
v1->v2:
* Rebased on staging to resolve some merge conflicts as requested
Jens Wiklander (9):
xen/arm: smccc: add support for SMCCCv1.2 extended input/output
registers
xen/arm: move regpair_to_uint64() and uint64_to_regpair() to regs.h
xen/arm: add a primitive FF-A mediator
xen/arm: ffa: add direct request support
xen/arm: ffa: map SPMC rx/tx buffers
xen/arm: ffa: send guest events to Secure Partitions
xen/arm: ffa: support mapping guest RX/TX buffers
xen/arm: ffa: support guest FFA_PARTITION_INFO_GET
xen/arm: ffa: support sharing memory
SUPPORT.md | 7 +
docs/man/xl.cfg.5.pod.in | 15 +
tools/include/libxl.h | 6 +
tools/libs/light/libxl_arm.c | 3 +
tools/libs/light/libxl_types.idl | 1 +
tools/xl/xl_parse.c | 3 +
xen/arch/arm/Kconfig | 11 +
xen/arch/arm/Makefile | 1 +
xen/arch/arm/arm64/asm-offsets.c | 9 +
xen/arch/arm/arm64/smc.S | 43 +
xen/arch/arm/domain.c | 10 +
xen/arch/arm/domain_build.c | 1 +
xen/arch/arm/ffa.c | 1805 +++++++++++++++++++++++++++++
xen/arch/arm/include/asm/domain.h | 4 +
xen/arch/arm/include/asm/ffa.h | 71 ++
xen/arch/arm/include/asm/regs.h | 12 +
xen/arch/arm/include/asm/smccc.h | 40 +
xen/arch/arm/tee/optee.c | 11 -
xen/arch/arm/vsmc.c | 19 +-
xen/include/public/arch-arm.h | 2 +
20 files changed, 2059 insertions(+), 15 deletions(-)
create mode 100644 xen/arch/arm/ffa.c
create mode 100644 xen/arch/arm/include/asm/ffa.h
--
2.31.1