Re: [PATCH v12 00/10] introduce Arm FF-A support

2023-06-06 Thread Tom Rini
On Tue, Jun 06, 2023 at 12:56:28PM +0100, Abdellatif El Khlifi wrote:
> On Mon, May 22, 2023 at 10:13:20AM +0100, Abdellatif El Khlifi wrote:
> 
> Hi Simon, Tom,
> 
> > Hi Simon,
> > 
> > > Adding support for Arm FF-A v1.0 (Arm Firmware Framework for Armv8-A) [A].
> > > 
> > > FF-A specifies interfaces that enable a pair of software execution 
> > > environments aka partitions to
> > > communicate with each other. A 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  DriverName
> > >---
> > >...
> > > 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_first_device).
> > > 
> > > 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
> > > - 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
> > > - 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 Uclass driver providing generic FF-A methods.
> > > - An Arm FF-A device driver providing Arm-specific methods and 
> > > reusing the Uclass methods.
> > > - A sandbox emulator for Arm FF-A, emulates the FF-A side of the 
> > > Secure World and provides
> > >   FF-A ABIs inspection methods.
> > > - An FF-A sandbox device driver for FF-A communication with the 
> > > emulated Secure World.
> > >   The driver leverages the FF-A Uclass to establish FF-A 
> > > communication.
> > > - Sandbox FF-A test cases.
> > > - A new command called armffa is provided as an example of how to 
> > > access the
> > >   FF-A bus
> > > 
> > > 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:
> > > ===
> > > 
> > > v12:
> > > 
> > > * remove the global variable (dscvry_info), use uc_priv instead
> > > * replace dscvry_info.invoke_ffa_fn() with a weak invoke_ffa_fn
> > >(user drivers can override it)
> > > * improve FFA_PARTITION_INFO_GET implementation
> > >(clients no longer need to calloc a buffer)
> > > * remove reparenting by making the sandbox emulator parent of the FF-A 
> > > device in the DT
> > > * improve argument checks for the armffa command
> > > * address nits
> > > 
> ...
> > > Cc: Tom Rini 
> > > Cc: Simon Glass 
> > 
> > A gentle reminder about the v12 patchset.
> > 
> > Your feedback is more than welcome :)
> 
> Could you please provide a feedback about the v12 patchset ?
> 
> Most of the patches are generic.
> 
> I'm gonna address Ilias comment for patch #9 with your future comments.
> 
> Your review is very much appreciated.

I've been waiting for Ilias to be happy with the series and then I'll
pick it up for -next.

-- 
Tom


signature.asc
Description: PGP signature


Re: [PATCH v12 00/10] introduce Arm FF-A support

2023-06-06 Thread Abdellatif El Khlifi
On Mon, May 22, 2023 at 10:13:20AM +0100, Abdellatif El Khlifi wrote:

Hi Simon, Tom,

> Hi Simon,
> 
> > Adding support for Arm FF-A v1.0 (Arm Firmware Framework for Armv8-A) [A].
> > 
> > FF-A specifies interfaces that enable a pair of software execution 
> > environments aka partitions to
> > communicate with each other. A 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  DriverName
> >---
> >...
> > 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_first_device).
> > 
> > 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
> > - 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
> > - 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 Uclass driver providing generic FF-A methods.
> > - An Arm FF-A device driver providing Arm-specific methods and reusing 
> > the Uclass methods.
> > - A sandbox emulator for Arm FF-A, emulates the FF-A side of the Secure 
> > World and provides
> >   FF-A ABIs inspection methods.
> > - An FF-A sandbox device driver for FF-A communication with the 
> > emulated Secure World.
> >   The driver leverages the FF-A Uclass to establish FF-A communication.
> > - Sandbox FF-A test cases.
> > - A new command called armffa is provided as an example of how to 
> > access the
> >   FF-A bus
> > 
> > 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:
> > ===
> > 
> > v12:
> > 
> > * remove the global variable (dscvry_info), use uc_priv instead
> > * replace dscvry_info.invoke_ffa_fn() with a weak invoke_ffa_fn
> >(user drivers can override it)
> > * improve FFA_PARTITION_INFO_GET implementation
> >(clients no longer need to calloc a buffer)
> > * remove reparenting by making the sandbox emulator parent of the FF-A 
> > device in the DT
> > * improve argument checks for the armffa command
> > * address nits
> > 
...
> > Cc: Tom Rini 
> > Cc: Simon Glass 
> 
> A gentle reminder about the v12 patchset.
> 
> Your feedback is more than welcome :)

Could you please provide a feedback about the v12 patchset ?

Most of the patches are generic.

I'm gonna address Ilias comment for patch #9 with your future comments.

Your review is very much appreciated.

Kind regards
Abdellatif


Re: [PATCH v12 00/10] introduce Arm FF-A support

2023-05-22 Thread Abdellatif El Khlifi
Hi Simon,

> Adding support for Arm FF-A v1.0 (Arm Firmware Framework for Armv8-A) [A].
> 
> FF-A specifies interfaces that enable a pair of software execution 
> environments aka partitions to
> communicate with each other. A 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  DriverName
>---
>...
> 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_first_device).
> 
> 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
> - 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
> - 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 Uclass driver providing generic FF-A methods.
> - An Arm FF-A device driver providing Arm-specific methods and reusing 
> the Uclass methods.
> - A sandbox emulator for Arm FF-A, emulates the FF-A side of the Secure 
> World and provides
>   FF-A ABIs inspection methods.
> - An FF-A sandbox device driver for FF-A communication with the emulated 
> Secure World.
>   The driver leverages the FF-A Uclass to establish FF-A communication.
> - Sandbox FF-A test cases.
> - A new command called armffa is provided as an example of how to access 
> the
>   FF-A bus
> 
> 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:
> ===
> 
> v12:
> 
> * remove the global variable (dscvry_info), use uc_priv instead
> * replace dscvry_info.invoke_ffa_fn() with a weak invoke_ffa_fn
>(user drivers can override it)
> * improve FFA_PARTITION_INFO_GET implementation
>(clients no longer need to calloc a buffer)
> * remove reparenting by making the sandbox emulator parent of the FF-A device 
> in the DT
> * improve argument checks for the armffa command
> * address nits
> 
> v11: [11]
> 
> * 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
> 
> 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]
> 
> * 

[PATCH v12 00/10] introduce Arm FF-A support

2023-05-12 Thread Abdellatif El Khlifi
Adding support for Arm FF-A v1.0 (Arm Firmware Framework for Armv8-A) [A].

FF-A specifies interfaces that enable a pair of software execution environments 
aka partitions to
communicate with each other. A 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  DriverName
   ---
   ...
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_first_device).

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
- 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
- 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 Uclass driver providing generic FF-A methods.
- An Arm FF-A device driver providing Arm-specific methods and reusing the 
Uclass methods.
- A sandbox emulator for Arm FF-A, emulates the FF-A side of the Secure 
World and provides
  FF-A ABIs inspection methods.
- An FF-A sandbox device driver for FF-A communication with the emulated 
Secure World.
  The driver leverages the FF-A Uclass to establish FF-A communication.
- Sandbox FF-A test cases.
- A new command called armffa is provided as an example of how to access the
  FF-A bus

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:
===

v12:

* remove the global variable (dscvry_info), use uc_priv instead
* replace dscvry_info.invoke_ffa_fn() with a weak invoke_ffa_fn
   (user drivers can override it)
* improve FFA_PARTITION_INFO_GET implementation
   (clients no longer need to calloc a buffer)
* remove reparenting by making the sandbox emulator parent of the FF-A device 
in the DT
* improve argument checks for the armffa command
* address nits

v11: [11]

* 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

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,