[PATCH v3 1/8] firmware: add SCMI agent uclass

Simon Glass sjg at chromium.org
Tue Sep 8 17:20:53 CEST 2020


On Mon, 7 Sep 2020 at 08:50, Etienne Carriere
<etienne.carriere at linaro.org> wrote:
>
> This change introduces SCMI agent uclass to interact with a firmware
> using the SCMI protocols [1].
>
> SCMI agent uclass currently supports a single method to request
> processing of the SCMI message by an identified server. A SCMI message
> is made of a byte payload associated to a protocol ID and a message ID,
> all defined by the SCMI specification [1]. On return from process_msg()
> method, the caller gets the service response.
>
> SCMI agent uclass defines a post bind generic sequence for all devices.
> The sequence binds all the SCMI protocols listed in the FDT for that
> SCMI agent device. Currently none, but later change will introduce
> protocols.
>
> This change implements a simple sandbox device for the SCMI agent uclass.
> The sandbox nicely answers SCMI_NOT_SUPPORTED to SCMI messages.
> To prepare for further test support, the sandbox exposes a architecture
> function for test application to read the sandbox emulated devices state.
> Currently supports 2 SCMI agents, identified by an ID in the FDT device
> name. The simplistic DM test does nothing yet.
>
> SCMI agent uclass is designed for platforms that embed a SCMI server in
> a firmware hosted somewhere, for example in a companion co-processor or
> in the secure world of the executing processor. SCMI protocols allow an
> SCMI agent to discover and access external resources as clock, reset
> controllers and more. SCMI agent and server communicate following the
> SCMI specification [1]. This SCMI agent implementation complies with
> the DT bindings defined in the Linux kernel source tree regarding
> SCMI agent description since v5.8.
>
> Links: [1] https://developer.arm.com/architectures/system-architectures/software-standards/scmi
> Signed-off-by: Etienne Carriere <etienne.carriere at linaro.org>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Peng Fan <peng.fan at nxp.com>
> Cc: Sudeep Holla <sudeep.holla at arm.com>
> ---
>
> Changes in v3:
> - Address comments about adding a new uclass and some sandbox test from
>   v2 in https://patchwork.ozlabs.org/project/uboot/list/?series=196253
> - New directory drivers/firmware/scmi/. The path mimics Linux kernel
>   source tree for the equivalent driver.
> - Split scmi.h (patch v2) into scmi_protocols.h, scmi_agent.h and
>   scmi_agent-uclass.h.
> - Create new uclass UCLASS_SCMI_AGENT.
> - Introduce a simple sandbox on that agent. Mailbox and smccc agents are
>   moved to specific commits in the series.
>
> Changes in v2:
> - Fix CONFIG_SCMI_FIRMWARE description with explicit SCMI reference.
> - Move struct, enum and macro definitions at source file top and
>   add inline comment description for the structures and local functions.
> - Replace rc with ret as return value local variable label.
> - Use explicit return 0 on successful return paths.
> - Replace EINVAL with more accurate error numbers.
> - Use dev_read_u32() instead of ofnode_read_u32(dev_ofnode(), ...).
> - Use memcpy_toio()/memcpy_fromio() when copying message payload
>   to/from IO memory.
> - Embed mailbox transport resources upon CONFIG_DM_MAILBOX and
>   SMCCC transport resources upon CONFIG_ARM_SMCCC.
>
> Note: review comments on defining a uclass and sandbox for SCMI
> transport drivers are NOT addressed in this v2. Main issue is that
> there is no driver/device defined for SCMI transport layer as well as
> and no defined compatible ID in the SCMI DT bindings documentation.
> ---
>  arch/sandbox/dts/test.dts                  |  16 +++
>  arch/sandbox/include/asm/scmi_test.h       |  43 ++++++
>  configs/sandbox_defconfig                  |   2 +
>  drivers/firmware/Kconfig                   |   2 +
>  drivers/firmware/Makefile                  |   1 +
>  drivers/firmware/scmi/Kconfig              |  17 +++
>  drivers/firmware/scmi/Makefile             |   2 +
>  drivers/firmware/scmi/sandbox-scmi_agent.c | 147 +++++++++++++++++++++
>  drivers/firmware/scmi/scmi_agent-uclass.c  | 107 +++++++++++++++
>  include/dm/uclass-id.h                     |   1 +
>  include/scmi_agent-uclass.h                |  24 ++++
>  include/scmi_agent.h                       |  68 ++++++++++
>  include/scmi_protocols.h                   |  41 ++++++
>  test/dm/Makefile                           |   1 +
>  test/dm/scmi.c                             |  38 ++++++
>  15 files changed, 510 insertions(+)
>  create mode 100644 arch/sandbox/include/asm/scmi_test.h
>  create mode 100644 drivers/firmware/scmi/Kconfig
>  create mode 100644 drivers/firmware/scmi/Makefile
>  create mode 100644 drivers/firmware/scmi/sandbox-scmi_agent.c
>  create mode 100644 drivers/firmware/scmi/scmi_agent-uclass.c
>  create mode 100644 include/scmi_agent-uclass.h
>  create mode 100644 include/scmi_agent.h
>  create mode 100644 include/scmi_protocols.h
>  create mode 100644 test/dm/scmi.c
>

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list