From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5F149C77B76 for ; Mon, 17 Apr 2023 16:03:06 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D603C85FE8; Mon, 17 Apr 2023 18:03:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 96DC985FD4; Mon, 17 Apr 2023 18:03:01 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id C4C1185F77 for ; Mon, 17 Apr 2023 18:02:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=abdellatif.elkhlifi@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A36BD1692; Mon, 17 Apr 2023 09:03:40 -0700 (PDT) Received: from e130802.arm.com (unknown [10.57.22.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 175CD3F5A1; Mon, 17 Apr 2023 09:02:55 -0700 (PDT) Date: Mon, 17 Apr 2023 17:02:47 +0100 From: Abdellatif El Khlifi To: sjg@chromium.org Cc: nd@arm.com, u-boot@lists.denx.de Subject: Re: [PATCH v11 00/10] introduce Arm FF-A support Message-ID: <20230417160247.GA244347@e130802.arm.com> References: <20230328161157.219375-1-abdellatif.elkhlifi@arm.com> <20230412094245.44674-1-abdellatif.elkhlifi@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230412094245.44674-1-abdellatif.elkhlifi@arm.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Hi Simon, > Adding support for Arm FF-A v1.0 (Arm Firmware Framework for Armv8-A) [A]. > > FF-A describes interfaces (ABIs) that standardize communication > between the Secure World and Normal World. These interfaces enable a pair of > software sandboxes to communicate with each other. A sandbox aka partition could > be a VM in the Normal or Secure world, an application in S-EL0, or a > Trusted OS in S-EL1. > > FF-A is a discoverable bus and similar to architecture features. > FF-A bus is discovered using ARM_SMCCC_FEATURES mechanism performed > by the PSCI driver. > > => dm tree > > Class Index Probed Driver Name > ----------------------------------------------------------- > ... > firmware 0 [ + ] psci |-- psci > ffa 0 [ ] arm_ffa | `-- arm_ffa > ... > > Clients are able to probe then use the FF-A bus by calling the DM class > searching APIs (e.g: uclass_get_device_by_name). > > This implementation of the specification provides support for Aarch64. > > The FF-A driver uses the SMC ABIs defined by the FF-A specification to: > > - Discover the presence of secure partitions (SPs) of interest > - Access an SP's service through communication protocols > e.g. EFI MM communication protocol > > The FF-A support provides the following features: > > - Being generic by design and can be used by any Arm 64-bit platform > - A Uclass driver providing generic FF-A methods and driver operations > - An Arm FF-A device driver > - FF-A support can be compiled and used without EFI > - Support for SMCCCv1.2 x0-x17 registers > - Support for SMC32 calling convention > - Support for 32-bit and 64-bit FF-A direct messaging > - A new command called armffa is provided as an example of how to access the > FF-A bus > - Support for FF-A MM communication (compatible with EFI boot time) > - Enabling FF-A and MM communication in Corstone1000 platform as a use case > - A sandbox emulator for Arm FF-A > - An FF-A sandbox device driver > - Sandbox FF-A test cases > > For more details about the FF-A support please refer to [B] and refer to [C] for > how to use the armffa command. > > Please find at [D] an example of the expected boot logs when enabling > FF-A support for a platform. In this example the platform is > Corstone1000. But it can be any Arm 64-bit platform. > > Changelog of the major changes: > =========================== > > v11: > > * move ffa_try_discovery() from the uclass to the Arm FF-A driver > * rename ffa_try_discovery() to arm_ffa_discover() > * add arm_ prefix to the Arm FF-A driver functions > * use U_BOOT_CMD_WITH_SUBCMDS for armffa command > * store the sandbox emulator pointer in the FF-A device uc_priv (struct ffa_priv) > * set the emulator as parent of the sandbox FF-A device > * rename select_ffa_mm_comms() to select_mm_comms() > * improve the logic of MM transport selection in mm_communicate() > * use ut_asserteq_mem() in uuid_str_to_le_bin test case > * address nits A gentle reminder for reviewing the v11 changes please. I already put you in CC :) Thank you in advance. Cheers, Abdellatif > > v10: [10] > > * provide the FF-A driver operations through the Uclass (arm-ffa-uclass.c) > * move the generic FF-A methods to the Uclass > * keep Arm specific methods in the Arm driver (arm-ffa.c renamed from core.c) > * split the FF-A sandbox support into an emulator (ffa-emul-uclass.c) and a driver (sandbox_ffa.c) > * use the FF-A driver Uclass operations by clients (armffa command, tests, MM comms) > * use uclass_first_device to search and probe the FF-A device (whether it is on Arm or on sandbox) > * address nits > > v9: [9] > > * integrate the FF-A bus discovery in the DM and use ARM_SMCCC_FEATURES for binding > * align FF-A sandbox driver with FF-A discovery through DM > * use DM class APIs to probe and interact with the FF-A bus (in FF-A MM comms, armffa command, sandbox tests) > * add documentation for the armffa command: doc/usage/cmd/armffa.rst > * introduce testcase for uuid_str_to_le_bin > > v8: [8] > > * pass the FF-A bus device to the bus operations > * isolate the compilation choices between FF-A and OP-TEE > * drop OP-TEE configs from Corstone-1000 defconfig > * make ffa_get_partitions_info() second argument to be an SP count in both > modes > > v7: [7] > > * add support for 32-bit direct messaging (now we have 32-bit and 64-bit support) > * set the MM door bell event to use 64-bit direct messaging > * issue a compile time error when one of these macros are not found : > FFA_SHARED_MM_BUFFER_SIZE, FFA_SHARED_MM_BUFFER_OFFSET, FFA_SHARED_MM_BUFFER_ADDR > * make uuid_str_to_le_bin() implementation similar to uuid_str_to_bin() > by using same APIs > > v6: [6] > > * remove clearing x0-x17 registers after SMC calls > * drop use of EFI runtime support for FF-A (We decided with Linaro to add this later) > * drop discovery from initcalls (discovery will be on demand by FF-A users) > * add FF-A runtime discovery at MM communication level > * update the documentation and move it to doc/arch/arm64.ffa.rst > > v5: [5] > > * move changelogs in each commit to the changes section > > v4: [4] > > * add FF-A support README (doc/README.ffa.drv) > * improving error handling by mapping the FF-A errors to standard errors > and logs > * replacing panics with an error log > * align sandbox driver and tests with the new FF-A driver interfaces > and new way of error handling > * use the new FF-A driver interfaces for MM communication > * discover MM partitions at runtime > * copy FF-A driver private data to EFI runtime section at > ExitBootServices() > * moving the FF-A driver work to drivers/firmware/arm-ffa > * improving features discovery in FFA_FEATURES > * add remove/unbind functions to the FF-A core device > * improve how the driver behaves when bus discovery is done more than > once > * move clearing x0-x17 registers code into a new macro like done in > the linux kernel > * enable EFI MM communication for the Corstone1000 platform > > v3: [3] > > * port x0-x17 registers support from linux kernel as defined by > SMCCCv1.2 > * align the interfaces of the u-boot FF-A driver with those in the linux > FF-A driver > * remove the FF-A helper layer > * make the u-boot FF-A driver independent from EFI > * provide an optional config that enables copying the driver data to > EFI runtime section at ExitBootServices service > * use 64-bit version of FFA_RXTX_MAP, FFA_MSG_SEND_DIRECT_{REQ, RESP} > * update armffa command with the new driver interfaces > > v2 [2]: > > * make FF-A bus discoverable using device_{bind, probe} APIs > * remove device tree support > > v1 [1]: > > * introduce FF-A bus driver with device tree support > * introduce armffa command > * introduce FF-A Sandbox driver > * add FF-A Sandbox test cases > * introduce FF-A MM communication > > Cheers, > Abdellatif > > List of previous patches: > > [1]: https://lore.kernel.org/all/20220329151659.16894-1-abdellatif.elkhlifi@arm.com/ > [2]: https://lore.kernel.org/all/20220415122803.16666-1-abdellatif.elkhlifi@arm.com/ > [3]: https://lore.kernel.org/all/20220801172053.20163-1-abdellatif.elkhlifi@arm.com/ > [4]: https://lore.kernel.org/all/20220926101723.9965-1-abdellatif.elkhlifi@arm.com/ > [5]: https://lore.kernel.org/all/20220926140827.15125-1-abdellatif.elkhlifi@arm.com/ > [6]: https://lore.kernel.org/all/20221013103857.614-1-abdellatif.elkhlifi@arm.com/ > [7]: https://lore.kernel.org/all/20221107192055.21669-1-abdellatif.elkhlifi@arm.com/ > [8]: https://lore.kernel.org/all/20221122131751.22747-1-abdellatif.elkhlifi@arm.com/ > [9]: https://lore.kernel.org/all/20230310141016.137986-1-abdellatif.elkhlifi@arm.com/ > [10]: https://lore.kernel.org/all/20230328161157.219375-1-abdellatif.elkhlifi@arm.com/ > > More details: > > [A]: https://developer.arm.com/documentation/den0077/latest/ > [B]: doc/arch/arm64.ffa.rst > [C]: doc/usage/cmd/armffa.rst > [D]: example of boot logs when enabling FF-A > > ``` > U-Boot 2023.01 (Mar 27 2023 - 13:48:33 +0000) corstone1000 aarch64 > > DRAM: 2 GiB > Arm FF-A framework discovery > Using Arm SMC for FF-A conduit > FF-A driver 1.0 > FF-A framework 1.0 > FF-A versions are compatible > ... > Hit any key to stop autoboot: 0 > Loading kernel from 0x083EE000 to memory ... > ... > FF-A endpoint ID is 0 > Using 1 4KB page(s) for FF-A RX/TX buffers size > FF-A RX buffer at virtual address 00000000fdf4f000 > FF-A TX buffer at virtual address 00000000fdf51000 > FF-A RX/TX buffers mapped > Reading FF-A partitions data from the RX buffer > FF-A partition ID 8001 : info cached > FF-A partition ID 8002 : info cached > FF-A partition ID 8003 : info cached > 3 FF-A partition(s) found and cached > Preparing for checking FF-A partitions count > Searching FF-A partitions using the provided UUID > No FF-A partition found. Querying framework ... > Reading FF-A partitions data from the RX buffer > Number of FF-A partition(s) matching the UUID: 1 > EFI: Pre-allocating 1 partition(s) info structures > Preparing for filling FF-A partitions info > Searching FF-A partitions using the provided UUID > FF-A partition ID 8003 matches the provided UUID > EFI: MM partition ID 0x8003 > EFI: Corstone1000: Capsule shared buffer at 0x80000000 , size 8192 pages > Booting /MemoryMapped(0x0,0x88200000,0xf00000) > EFI stub: Booting Linux Kernel... > EFI stub: Using DTB from configuration table > EFI stub: Exiting boot services... > unmapping FF-A RX/TX buffers > Freeing FF-A RX/TX buffers > Booting Linux on physical CPU 0x0000000000 [0x411fd040] > Linux version 6.1.9-yocto-standard (oe-user@oe-host) (aarch64-poky-linux-musl-gcc (GCC) 12.2.0, GNU ld (GNU Binutils) 2.40.202301193 > Machine model: ARM Corstone1000 FPGA MPS3 board > ``` > > Cc: Tom Rini > Cc: Simon Glass > Cc: Rob Herring > Cc: Ilias Apalodimas > Cc: Jens Wiklander > Cc: Achin Gupta > Cc: Drew Reed > Cc: Xueliang Zhong > > Abdellatif El Khlifi (10): > arm64: smccc: add support for SMCCCv1.2 x0-x17 registers > lib: uuid: introduce uuid_str_to_le_bin function > lib: uuid: introduce testcase for uuid_str_to_le_bin > arm_ffa: introduce Arm FF-A support > arm_ffa: introduce armffa command > arm_ffa: introduce sandbox FF-A support > arm_ffa: introduce sandbox test cases for UCLASS_FFA > arm_ffa: introduce armffa command Sandbox test > arm_ffa: efi: introduce FF-A MM communication > arm_ffa: efi: corstone1000: enable MM communication > > MAINTAINERS | 18 + > arch/arm/cpu/armv8/smccc-call.S | 57 +- > arch/arm/lib/asm-offsets.c | 16 + > arch/sandbox/dts/sandbox.dtsi | 8 + > arch/sandbox/dts/test.dts | 8 + > arch/sandbox/include/asm/sandbox_arm_ffa.h | 72 ++ > .../include/asm/sandbox_arm_ffa_priv.h | 133 ++ > cmd/Kconfig | 10 + > cmd/Makefile | 2 + > cmd/armffa.c | 212 +++ > configs/corstone1000_defconfig | 2 + > configs/sandbox64_defconfig | 1 + > configs/sandbox_defconfig | 1 + > doc/arch/arm64.ffa.rst | 294 +++++ > doc/arch/index.rst | 1 + > doc/arch/sandbox/sandbox.rst | 1 + > doc/usage/cmd/armffa.rst | 105 ++ > doc/usage/index.rst | 1 + > drivers/Makefile | 1 + > drivers/firmware/Kconfig | 1 + > drivers/firmware/arm-ffa/Kconfig | 42 + > drivers/firmware/arm-ffa/Makefile | 16 + > drivers/firmware/arm-ffa/arm-ffa-uclass.c | 1143 +++++++++++++++++ > drivers/firmware/arm-ffa/arm-ffa.c | 127 ++ > drivers/firmware/arm-ffa/ffa-emul-uclass.c | 738 +++++++++++ > drivers/firmware/arm-ffa/sandbox_ffa.c | 119 ++ > include/arm_ffa.h | 217 ++++ > include/arm_ffa_priv.h | 271 ++++ > include/configs/corstone1000.h | 15 +- > include/dm/uclass-id.h | 7 + > include/linux/arm-smccc.h | 45 + > include/mm_communication.h | 13 + > include/uuid.h | 15 + > lib/efi_loader/Kconfig | 14 +- > lib/efi_loader/efi_variable_tee.c | 312 ++++- > lib/uuid.c | 48 + > test/cmd/Makefile | 2 + > test/cmd/armffa.c | 39 + > test/dm/Makefile | 2 + > test/dm/ffa.c | 258 ++++ > test/lib/Makefile | 1 + > test/lib/uuid.c | 41 + > 42 files changed, 4420 insertions(+), 9 deletions(-) > create mode 100644 arch/sandbox/include/asm/sandbox_arm_ffa.h > create mode 100644 arch/sandbox/include/asm/sandbox_arm_ffa_priv.h > create mode 100644 cmd/armffa.c > create mode 100644 doc/arch/arm64.ffa.rst > create mode 100644 doc/usage/cmd/armffa.rst > create mode 100644 drivers/firmware/arm-ffa/Kconfig > create mode 100644 drivers/firmware/arm-ffa/Makefile > create mode 100644 drivers/firmware/arm-ffa/arm-ffa-uclass.c > create mode 100644 drivers/firmware/arm-ffa/arm-ffa.c > create mode 100644 drivers/firmware/arm-ffa/ffa-emul-uclass.c > create mode 100644 drivers/firmware/arm-ffa/sandbox_ffa.c > create mode 100644 include/arm_ffa.h > create mode 100644 include/arm_ffa_priv.h > create mode 100644 test/cmd/armffa.c > create mode 100644 test/dm/ffa.c > create mode 100644 test/lib/uuid.c > > -- > 2.25.1 >