From: Jens Wiklander <jens.wiklander@linaro.org>
To: xen-devel@lists.xenproject.org
Cc: Bertrand.Marquis@arm.com, Marc Bonnici <marc.bonnici@arm.com>,
Achin Gupta <achin.gupta@arm.com>,
Jens Wiklander <jens.wiklander@linaro.org>,
Stefano Stabellini <sstabellini@kernel.org>,
Julien Grall <julien@xen.org>,
Bertrand Marquis <bertrand.marquis@arm.com>,
Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
Wei Liu <wl@xen.org>, Anthony PERARD <anthony.perard@citrix.com>,
Juergen Gross <jgross@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
George Dunlap <george.dunlap@citrix.com>,
Jan Beulich <jbeulich@suse.com>
Subject: [XEN PATCH v7 00/20] Xen FF-A mediator
Date: Wed, 22 Feb 2023 16:32:57 +0100 [thread overview]
Message-ID: <cover.1677079671.git.jens.wiklander@linaro.org> (raw)
Hi,
This patch sets add an FF-A [1] mediator to the TEE mediator framework
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 are 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.
The patches are also available at https://github.com/jenswi-linaro/xen
branch "xen_ffa_v7".
With help from Bertrand I've intregrated this in a test setup with OP-TEE.
Please check prerequisites at
https://optee.readthedocs.io/en/latest/building/prerequisites.html
My setup is duplicated using:
repo init -u https://github.com/jenswi-linaro/manifest.git -m qemu_v8.xml \
-b qemu_xen_ffa
repo sync -j8
cd build
make -j8 toolchains
make -j8 all
make run-only
Test in dom0 with for instance:
xtest 1004
at the prompt.
To start up a domu and connect to it do:
cd /mnt/host/build/qemu_v8/xen
xl create guest_ffa.cfg
xl console domu
Then test as usual with "xtest 1004".
The setup uses the branch "ffa" from https://github.com/jenswi-linaro/xen.
That's currently the same as the "xen_ffa_v7" branch, but the "ffa" branch
may change later as I update for a new version of the patch set.
[1] https://developer.arm.com/documentation/den0077/latest
Thanks,
Jens
v6->v7:
* Split some of the larger patches into smaller patches for easier review.
For instance, the v6 patch "xen/arm: add a primitive FF-A mediator" has
been replaced with:
- "xen/arm: add a primitive FF-A mediator"
- "tools: add Arm FF-A mediator"
- "docs: add Arm FF-A mediator"
- "xen/arm: ffa: add remaining SMC function IDs"
* Some small fixes in the error path for handle_mem_share()
* Switched to SPDX for license in new files.
* Fixed comment style issues in
"xen/arm: smccc: add support for SMCCCv1.2 extended input/output registers"
* Made FFA support UNSUPPORTED in "xen/arm: add a primitive FF-A mediator"
* Replaced ffa_get_call_count() with FFA_NR_FUNCS
* Update the FFA_MAX_SHM_PAGE_COUNT with a formula instead of a value.
* Replaced XEN_ARM_FLAGS_FFA with XEN_DOMCTL_CONFIG_TEE_FFA to minimize impact
on struct xen_arch_domainconfig. This works because the FF-A mediator and
the OP-TEE mediator will not be used at the same time in by a guest.
* Replaced "ffa" boolean in the guest config with a new "ffa" value to the
enumeration "tee_type".
* Integrated the FF-A mediator in the TEE mediator framework instead of
being its own.
* Rebased on staging as of 2023-02-16
v5->v6:
* Updated "xen/arm: move regpair_to_uint64() and uint64_to_regpair() to regs.h"
commit message and moved the patch right before the patch which needs it.
Applied Michal Orzel's R-B tag.
* Renamed the guest configuration option "ffa_enabled" to "ffa" and
updated the description.
* More tools update in "xen/arm: add a primitive FF-A mediator" with the "ffa"
option, including golang and ocaml.
* Update ffa_domain_init() to return an error if communication with
the SPMC can't be established.
* Factored out a ffa_domain_destroy() from ffa_relinquish_resources().
* Added ffa_get_call_count() to give an accurate number of FF-A function,
updated in each patch as new FF-A functions are added.
* Added a flags field in struct xen_arch_domainconfig that replaces the
ffa_enabled field.
* Made check_mandatory_feature() __init
* Replaced a few printk() calls with gprintk() where needed.
* Rebased on staging as of 2022-09-14
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 (20):
xen/arm: smccc: add support for SMCCCv1.2 extended input/output
registers
xen/arm: tee: add a primitive FF-A mediator
tools: add Arm FF-A mediator
docs: add Arm FF-A mediator
xen/arm: ffa: add remaining SMC function IDs
xen/arm: ffa: add flags for FFA_PARTITION_INFO_GET
xen/arm: ffa: add defines for framework direct request/response
messages
xen/arm: ffa: note dependency on 4k pages
xen/arm: ffa: add support for FFA_ID_GET
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: move regpair_to_uint64() and uint64_to_regpair() to regs.h
xen/arm: ffa: add defines for sharing memory
xen/arm: ffa: add ABI structs for sharing memory
xen/arm: ffa: support sharing memory
xen/arm: ffa: add support to reclaim shared memory
xen/arm: ffa: support sharing large memory ranges
SUPPORT.md | 7 +
docs/man/xl.cfg.5.pod.in | 15 +
tools/libs/light/libxl_arm.c | 3 +
tools/libs/light/libxl_types.idl | 3 +-
xen/arch/arm/arm64/asm-offsets.c | 9 +
xen/arch/arm/arm64/smc.S | 42 +
xen/arch/arm/include/asm/domain.h | 2 +-
xen/arch/arm/include/asm/psci.h | 4 +
xen/arch/arm/include/asm/regs.h | 12 +
xen/arch/arm/include/asm/smccc.h | 40 +
xen/arch/arm/include/asm/tee/ffa.h | 35 +
xen/arch/arm/tee/Kconfig | 11 +
xen/arch/arm/tee/Makefile | 1 +
xen/arch/arm/tee/ffa.c | 1839 ++++++++++++++++++++++++++++
xen/arch/arm/tee/optee.c | 11 -
xen/arch/arm/vsmc.c | 19 +-
xen/include/public/arch-arm.h | 1 +
17 files changed, 2037 insertions(+), 17 deletions(-)
create mode 100644 xen/arch/arm/include/asm/tee/ffa.h
create mode 100644 xen/arch/arm/tee/ffa.c
--
2.34.1
next reply other threads:[~2023-02-22 15:34 UTC|newest]
Thread overview: 85+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-22 15:32 Jens Wiklander [this message]
2023-02-22 15:32 ` [XEN PATCH v7 01/20] xen/arm: smccc: add support for SMCCCv1.2 extended input/output registers Jens Wiklander
2023-02-23 14:28 ` Bertrand Marquis
2023-02-23 14:35 ` Julien Grall
2023-02-24 8:28 ` Jens Wiklander
2023-02-22 15:32 ` [XEN PATCH v7 02/20] xen/arm: tee: add a primitive FF-A mediator Jens Wiklander
2023-02-23 14:43 ` Julien Grall
2023-02-24 8:51 ` Jens Wiklander
2023-02-23 14:46 ` Bertrand Marquis
2023-02-23 15:07 ` Julien Grall
2023-02-24 9:09 ` Jens Wiklander
2023-02-22 15:33 ` [XEN PATCH v7 03/20] tools: add Arm " Jens Wiklander
2023-02-23 15:00 ` Bertrand Marquis
2023-02-23 16:49 ` Anthony PERARD
2023-02-24 8:33 ` Jens Wiklander
2023-02-22 15:33 ` [XEN PATCH v7 04/20] docs: " Jens Wiklander
2023-02-23 15:09 ` Bertrand Marquis
2023-02-24 8:31 ` Jens Wiklander
2023-02-22 15:33 ` [XEN PATCH v7 05/20] xen/arm: ffa: add remaining SMC function IDs Jens Wiklander
2023-02-23 15:28 ` Bertrand Marquis
2023-02-24 8:43 ` Jens Wiklander
2023-02-22 15:33 ` [XEN PATCH v7 06/20] xen/arm: ffa: add flags for FFA_PARTITION_INFO_GET Jens Wiklander
2023-02-24 9:30 ` Bertrand Marquis
2023-02-24 13:18 ` Jens Wiklander
2023-02-22 15:33 ` [XEN PATCH v7 07/20] xen/arm: ffa: add defines for framework direct request/response messages Jens Wiklander
2023-02-24 9:38 ` Bertrand Marquis
2023-03-03 7:01 ` Jens Wiklander
2023-03-03 8:14 ` Bertrand Marquis
2023-02-22 15:33 ` [XEN PATCH v7 08/20] xen/arm: ffa: note dependency on 4k pages Jens Wiklander
2023-02-24 15:27 ` Bertrand Marquis
2023-02-28 14:17 ` Jens Wiklander
2023-02-22 15:33 ` [XEN PATCH v7 09/20] xen/arm: ffa: add support for FFA_ID_GET Jens Wiklander
2023-02-27 14:48 ` Bertrand Marquis
2023-02-27 15:00 ` Julien Grall
2023-02-28 14:18 ` Jens Wiklander
2023-02-22 15:33 ` [XEN PATCH v7 10/20] xen/arm: ffa: add direct request support Jens Wiklander
2023-02-27 15:28 ` Bertrand Marquis
2023-03-01 10:55 ` Jens Wiklander
2023-03-01 13:06 ` Bertrand Marquis
2023-03-01 16:17 ` Jens Wiklander
2023-03-01 15:50 ` Bertrand Marquis
2023-03-01 15:56 ` Jens Wiklander
2023-02-22 15:33 ` [XEN PATCH v7 11/20] xen/arm: ffa: map SPMC rx/tx buffers Jens Wiklander
2023-02-28 12:57 ` Bertrand Marquis
2023-03-01 9:30 ` Jens Wiklander
2023-03-01 9:55 ` Bertrand Marquis
2023-03-01 11:10 ` Jens Wiklander
2023-02-22 15:33 ` [XEN PATCH v7 12/20] xen/arm: ffa: send guest events to Secure Partitions Jens Wiklander
2023-02-28 16:48 ` Bertrand Marquis
2023-03-01 10:16 ` Jens Wiklander
2023-03-01 12:58 ` Bertrand Marquis
2023-03-01 16:45 ` Jens Wiklander
2023-03-02 7:35 ` Bertrand Marquis
2023-03-01 15:55 ` Bertrand Marquis
2023-02-22 15:33 ` [XEN PATCH v7 13/20] xen/arm: ffa: support mapping guest RX/TX buffers Jens Wiklander
2023-03-02 15:05 ` Bertrand Marquis
2023-03-03 7:41 ` Jens Wiklander
2023-03-03 8:16 ` Bertrand Marquis
2023-03-03 10:22 ` Jens Wiklander
2023-02-22 15:33 ` [XEN PATCH v7 14/20] xen/arm: ffa: support guest FFA_PARTITION_INFO_GET Jens Wiklander
2023-03-03 9:50 ` Bertrand Marquis
2023-03-03 13:17 ` Jens Wiklander
2023-03-03 13:50 ` Bertrand Marquis
2023-03-03 15:53 ` Jens Wiklander
2023-02-22 15:33 ` [XEN PATCH v7 15/20] xen/arm: move regpair_to_uint64() and uint64_to_regpair() to regs.h Jens Wiklander
2023-03-03 10:51 ` Bertrand Marquis
2023-03-03 13:18 ` Jens Wiklander
2023-02-22 15:33 ` [XEN PATCH v7 16/20] xen/arm: ffa: add defines for sharing memory Jens Wiklander
2023-03-03 13:38 ` Bertrand Marquis
2023-03-03 16:51 ` Jens Wiklander
2023-02-22 15:33 ` [XEN PATCH v7 17/20] xen/arm: ffa: add ABI structs " Jens Wiklander
2023-03-03 14:19 ` Bertrand Marquis
2023-03-03 17:25 ` Jens Wiklander
2023-02-22 15:33 ` [XEN PATCH v7 18/20] xen/arm: ffa: support " Jens Wiklander
2023-03-13 8:49 ` Bertrand Marquis
2023-03-14 17:56 ` Jens Wiklander
2023-03-15 13:24 ` Bertrand Marquis
2023-03-15 14:33 ` Jens Wiklander
2023-02-22 15:33 ` [XEN PATCH v7 19/20] xen/arm: ffa: add support to reclaim shared memory Jens Wiklander
2023-03-13 11:16 ` Bertrand Marquis
2023-02-22 15:33 ` [XEN PATCH v7 20/20] xen/arm: ffa: support sharing large memory ranges Jens Wiklander
2023-03-15 10:13 ` Bertrand Marquis
2023-03-15 11:47 ` Jens Wiklander
2023-03-15 13:35 ` Bertrand Marquis
2023-03-15 14:37 ` Jens Wiklander
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1677079671.git.jens.wiklander@linaro.org \
--to=jens.wiklander@linaro.org \
--cc=Bertrand.Marquis@arm.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=achin.gupta@arm.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@citrix.com \
--cc=george.dunlap@citrix.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=julien@xen.org \
--cc=marc.bonnici@arm.com \
--cc=sstabellini@kernel.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.