mbox series

[U-Boot,v5,0/2] arm64: zynqmp: pass a PMUFW config object

Message ID 20190521160644.8600-1-luca@lucaceresoli.net
Headers show
Series arm64: zynqmp: pass a PMUFW config object | expand

Message

Luca Ceresoli May 21, 2019, 4:06 p.m. UTC
Hi,

here's a minor improvement to 2/2 over v4. 1/1 is unchanged.

This patchset aims at solving a long-standing issue in the ZynqMP users
community: loading a PMU firmware configuration object when U-Boot SPL is
used.

The Platform Management Unit (PMU) needs a configuration object (cfg obj)
to know how to operate the SoC. When using the "Xilinx workflow", the
Xilinx FSBL (First Stage Bootloader) has the SPL role. FSBL has a built-in
cfg obj and passes it to the PMUFW at runtime before jumping to U-Boot
proper.

This is just not implemented in the U-Boot code. The best workaround for
U-Boot SPL users is to patch [0] the PMUFW itself to have the cfg obj
built-in and self-load it. This approach has some drawbacks: among others,
it forces to use a different PMUFW binary for each hardware and hardware
configuation. It also makes it impossible to change the configuration after
boot.

The first patch fills the gap by allowing U-Boot SPL to load the cfg
obj firmware at runtime. It adds a Kconfig string option to point to
the cfg obj in the form of a binary blob. If the option is non-empty,
code is enabled to link that file in U-Boot SPL and send the
configuration to PMUFW.

Patch 2 adds a tool to convert the cfg obj C file (as produced by the
Xilinx XSDK proprietary tool) in a binary blob suitable for
loading. As suggested by Mike Looijmans it has been implemented as a
Python script to make it easily usable.

These patches are tested on the UltraZed EV board, on u-boot/master and
microblaze/master, using the defconfig I submitted a few days ago [1].

Future work on this topic include moving the PMU IPC code to a mailbox
uclass driver and adding a command in U-Boot proper to load a config object
blob (e.g. from a file based on a script).

Many thanks to Michal Simek for his many suggestions on how to improve
this work.

[0] https://github.com/topic-embedded-products/meta-topic/blob/master/recipes-bsp/pmu-firmware/pmu-firmware/0001-Load-XPm_ConfigObject-at-boot.patch
[1] https://lists.denx.de/pipermail/u-boot/2019-May/368957.html
RFCv1: https://lists.denx.de/pipermail/u-boot/2019-February/360450.html
RFCv2: https://lists.denx.de/pipermail/u-boot/2019-March/362464.html
v3: https://lists.denx.de/pipermail/u-boot/2019-April/365410.html
v4: https://lists.denx.de/pipermail/u-boot/2019-May/369427.html

Luca

Luca Ceresoli (2):
  arm64: zynqmp: spl: install a PMU firmware config object at runtime
  arm64: zynqmp: add tool to convert PMU config object .c to binary

 arch/arm/mach-zynqmp/Kconfig                  |  18 ++
 arch/arm/mach-zynqmp/Makefile                 |   4 +
 arch/arm/mach-zynqmp/include/mach/sys_proto.h |   2 +
 arch/arm/mach-zynqmp/pmu_ipc.c                | 112 +++++++
 board/xilinx/zynqmp/Makefile                  |   5 +
 board/xilinx/zynqmp/pm_cfg_obj.S              |  17 +
 board/xilinx/zynqmp/pm_cfg_obj.h              |   9 +
 board/xilinx/zynqmp/zynqmp.c                  |   9 +
 tools/zynqmp_pm_cfg_obj_convert.py            | 301 ++++++++++++++++++
 9 files changed, 477 insertions(+)
 create mode 100644 arch/arm/mach-zynqmp/pmu_ipc.c
 create mode 100644 board/xilinx/zynqmp/pm_cfg_obj.S
 create mode 100644 board/xilinx/zynqmp/pm_cfg_obj.h
 create mode 100755 tools/zynqmp_pm_cfg_obj_convert.py

Comments

Michal Simek May 22, 2019, 11:28 a.m. UTC | #1
On 21. 05. 19 18:06, Luca Ceresoli wrote:
> Hi,
> 
> here's a minor improvement to 2/2 over v4. 1/1 is unchanged.
> 
> This patchset aims at solving a long-standing issue in the ZynqMP users
> community: loading a PMU firmware configuration object when U-Boot SPL is
> used.
> 
> The Platform Management Unit (PMU) needs a configuration object (cfg obj)
> to know how to operate the SoC. When using the "Xilinx workflow", the
> Xilinx FSBL (First Stage Bootloader) has the SPL role. FSBL has a built-in
> cfg obj and passes it to the PMUFW at runtime before jumping to U-Boot
> proper.
> 
> This is just not implemented in the U-Boot code. The best workaround for
> U-Boot SPL users is to patch [0] the PMUFW itself to have the cfg obj
> built-in and self-load it. This approach has some drawbacks: among others,
> it forces to use a different PMUFW binary for each hardware and hardware
> configuation. It also makes it impossible to change the configuration after
> boot.
> 
> The first patch fills the gap by allowing U-Boot SPL to load the cfg
> obj firmware at runtime. It adds a Kconfig string option to point to
> the cfg obj in the form of a binary blob. If the option is non-empty,
> code is enabled to link that file in U-Boot SPL and send the
> configuration to PMUFW.
> 
> Patch 2 adds a tool to convert the cfg obj C file (as produced by the
> Xilinx XSDK proprietary tool) in a binary blob suitable for
> loading. As suggested by Mike Looijmans it has been implemented as a
> Python script to make it easily usable.
> 
> These patches are tested on the UltraZed EV board, on u-boot/master and
> microblaze/master, using the defconfig I submitted a few days ago [1].
> 
> Future work on this topic include moving the PMU IPC code to a mailbox
> uclass driver and adding a command in U-Boot proper to load a config object
> blob (e.g. from a file based on a script).
> 
> Many thanks to Michal Simek for his many suggestions on how to improve
> this work.
> 
> [0] https://github.com/topic-embedded-products/meta-topic/blob/master/recipes-bsp/pmu-firmware/pmu-firmware/0001-Load-XPm_ConfigObject-at-boot.patch
> [1] https://lists.denx.de/pipermail/u-boot/2019-May/368957.html
> RFCv1: https://lists.denx.de/pipermail/u-boot/2019-February/360450.html
> RFCv2: https://lists.denx.de/pipermail/u-boot/2019-March/362464.html
> v3: https://lists.denx.de/pipermail/u-boot/2019-April/365410.html
> v4: https://lists.denx.de/pipermail/u-boot/2019-May/369427.html
> 
> Luca
> 
> Luca Ceresoli (2):
>   arm64: zynqmp: spl: install a PMU firmware config object at runtime
>   arm64: zynqmp: add tool to convert PMU config object .c to binary
> 
>  arch/arm/mach-zynqmp/Kconfig                  |  18 ++
>  arch/arm/mach-zynqmp/Makefile                 |   4 +
>  arch/arm/mach-zynqmp/include/mach/sys_proto.h |   2 +
>  arch/arm/mach-zynqmp/pmu_ipc.c                | 112 +++++++
>  board/xilinx/zynqmp/Makefile                  |   5 +
>  board/xilinx/zynqmp/pm_cfg_obj.S              |  17 +
>  board/xilinx/zynqmp/pm_cfg_obj.h              |   9 +
>  board/xilinx/zynqmp/zynqmp.c                  |   9 +
>  tools/zynqmp_pm_cfg_obj_convert.py            | 301 ++++++++++++++++++
>  9 files changed, 477 insertions(+)
>  create mode 100644 arch/arm/mach-zynqmp/pmu_ipc.c
>  create mode 100644 board/xilinx/zynqmp/pm_cfg_obj.S
>  create mode 100644 board/xilinx/zynqmp/pm_cfg_obj.h
>  create mode 100755 tools/zynqmp_pm_cfg_obj_convert.py
> 

Applied both.

Thanks,
Michal