Skip to contentSkip to conversation

Add Xilinx ZynqMP and ZCU106 board support

PATCH New Luca Ceresoli 3 participants 11 messages Jan 26, 2018 – Jan 28, 2018 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

cover Add Xilinx ZynqMP and ZCU106 board support

Hi,

this patchset adds basic support for the ZynqMP family of ARM64 SoC+FPGA by Xilinx and for the ZCU106 board based on it.

The ZynqMP sets a few challenges that needed some work besides the usual defconfig + readme that is enough for more classic and simple SoCs.

First, it requires ARM Trusted Firmware in the U-Boot mkimage format, not currently implemented. Nothing really hard here, this is addressed in patch 2 (with a trivial preliminary cleanup in patch 1).

The next issue is the PMU (Platform Management Unit). It is a Microblaze core that handles power and clock gating and the like, and reprogramming it at runtime is necessary to boot any modern U-Boot and Linux. Since we can't build Microblaze code out of the ARM64 toolchain, I've set up a repository with pre-built PMU firmwares and added a new package that just downloads from there. This is similar to the binaries-marvell and vexpress-firmware packages. This is added in patch 3.

Finally, U-Boot needs some tweaks in order for the PMU firmware to properly loaded and to initialize peripherals before starting Linux. This is done in patch 4.

With all these in place, patch 5 just adds the defconfig and board files.

Luca

Luca Ceresoli (5):
arm-trusted-firmware: simplify release dir path
arm-trusted-firmware: generate atf-uboot.ub for ZynqMP booting
zynqmp-pmufw-binaries: new package
u-boot: add customizations to boot on ZynqMP
configs: add Xilinx ZCU106 board (ZynqMP SoC)

 DEVELOPERS                                         |     3 +
 board/zynqmp/genimage.cfg                          |    28 +
 board/zynqmp/post-image.sh                         |    13 +
 board/zynqmp/readme.txt                            |    52 +
 board/zynqmp/zcu106/psu_init_gpl.c                 | 20955 +++++++++++
 board/zynqmp/zcu106/psu_init_gpl.h                 | 35810 +++++++++++++++++++
 boot/Config.in                                     |     1 +
 boot/arm-trusted-firmware/Config.in                |     9 +
 boot/arm-trusted-firmware/arm-trusted-firmware.mk  |    23 +-
 boot/uboot/Config.in                               |    32 +
 boot/uboot/uboot.mk                                |    25 +
 boot/zynqmp-pmufw-binaries/Config.in               |    19 +
 .../zynqmp-pmufw-binaries.hash                     |     3 +
 .../zynqmp-pmufw-binaries/zynqmp-pmufw-binaries.mk |    24 +
 configs/zynqmp_zcu106_defconfig                    |    31 +
 15 files changed, 57027 insertions(+), 1 deletion(-)
 create mode 100644 board/zynqmp/genimage.cfg
 create mode 100755 board/zynqmp/post-image.sh
 create mode 100644 board/zynqmp/readme.txt
 create mode 100644 board/zynqmp/zcu106/psu_init_gpl.c
 create mode 100644 board/zynqmp/zcu106/psu_init_gpl.h
 create mode 100644 boot/zynqmp-pmufw-binaries/Config.in
 create mode 100644 boot/zynqmp-pmufw-binaries/zynqmp-pmufw-binaries.hash
 create mode 100644 boot/zynqmp-pmufw-binaries/zynqmp-pmufw-binaries.mk
 create mode 100644 configs/zynqmp_zcu106_defconfig
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/5 arm-trusted-firmware: simplify release dir path

The path to the binary images is very long. Since we are about to make a larger use of it, let's use a variable to make it somewhat shorter.

---
 boot/arm-trusted-firmware/arm-trusted-firmware.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
boot/arm-trusted-firmware/arm-trusted-firmware.mk +2 -1
index 4bac916e3108..212bb5049f2b 100644
@@ -25,6 +25,7 @@ endif
 ARM_TRUSTED_FIRMWARE_INSTALL_IMAGES = YES
 
 ARM_TRUSTED_FIRMWARE_PLATFORM = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM))
+ARM_TRUSTED_FIRMWARE_IMG_DIR = $(@D)/build/$(ARM_TRUSTED_FIRMWARE_PLATFORM)/release
 
 ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
 	CROSS_COMPILE="$(TARGET_CROSS)" \
@@ -82,7 +83,7 @@ define ARM_TRUSTED_FIRMWARE_BUILD_CMDS
 endef
 
 define ARM_TRUSTED_FIRMWARE_INSTALL_IMAGES_CMDS
-	cp -dpf $(@D)/build/$(ARM_TRUSTED_FIRMWARE_PLATFORM)/release/*.bin $(BINARIES_DIR)/
+	cp -dpf $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/*.bin $(BINARIES_DIR)/
 endef
 
 # Configuration check
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/5 arm-trusted-firmware: generate atf-uboot.ub for ZynqMP booting

In reply to Luca Ceresoli

U-Boot SPL for the Xilinx ZynqMP SoCs needs ATF in this format to load it.

---
 boot/arm-trusted-firmware/Config.in               |  9 +++++++++
 boot/arm-trusted-firmware/arm-trusted-firmware.mk | 20 ++++++++++++++++++++
 2 files changed, 29 insertions(+)
boot/arm-trusted-firmware/Config.in +9 -0
index 7aef87cb746c..dca9958423b9 100644
@@ -71,6 +71,15 @@ config BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31
 	  typically used on platforms where another bootloader (e.g
 	  U-Boot) encapsulates ATF BL31.
 
+config BR2_TARGET_ARM_TRUSTED_FIRMWARE_ZYNQMP_UB_MKIMAGE
+	bool "Generate a U-Boot image (for Xilinx ZynqMP U-Boot)"
+	depends on BR2_cortex_a53
+	select BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31
+	help
+	  Uses mkimage from uboot-tools to encapsulate bl31.bin into
+	  a U-Boot image named atf-uboot.ub. This is needed by the
+	  Xilinx version of U-Boot SPL to load ATF on the ZynqMP SoC.
+
 config BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33
 	bool "Use U-Boot as BL33"
 	depends on BR2_TARGET_UBOOT
boot/arm-trusted-firmware/arm-trusted-firmware.mk +20 -0
index 212bb5049f2b..b2c2a67fb661 100644
@@ -86,6 +86,26 @@ define ARM_TRUSTED_FIRMWARE_INSTALL_IMAGES_CMDS
 	cp -dpf $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/*.bin $(BINARIES_DIR)/
 endef
 
+ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_ZYNQMP_UB_MKIMAGE),y)
+define ARM_TRUSTED_FIRMWARE_ZYNQMP_UB_MKIMAGE
+# Get the entry point address from the elf.
+	BASE_ADDR=$$($(TARGET_READELF) -h $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/bl31/bl31.elf | \
+	             grep -E -m 1 -i "entry point.*?0x" | \
+	             sed -r 's/.*?(0x.*?)/\1/g') && \
+	$(HOST_DIR)/bin/mkimage -A arm64 -O linux -T kernel -C none \
+		-a $${BASE_ADDR} -e $${BASE_ADDR} \
+		-d $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/bl31.bin \
+		$(ARM_TRUSTED_FIRMWARE_IMG_DIR)/atf-uboot.ub
+endef
+define ARM_TRUSTED_FIRMWARE_ZYNQMP_UB_INSTALL
+	install $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/atf-uboot.ub $(BINARIES_DIR)
+endef
+ARM_TRUSTED_FIRMWARE_MAKE_OPTS += RESET_TO_BL31=1
+ARM_TRUSTED_FIRMWARE_DEPENDENCIES += host-uboot-tools
+ARM_TRUSTED_FIRMWARE_POST_BUILD_HOOKS += ARM_TRUSTED_FIRMWARE_ZYNQMP_UB_MKIMAGE
+ARM_TRUSTED_FIRMWARE_POST_INSTALL_IMAGES_HOOKS += ARM_TRUSTED_FIRMWARE_ZYNQMP_UB_INSTALL
+endif
+
 # Configuration check
 ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE)$(BR_BUILDING),yy)
 
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/5 zynqmp-pmufw-binaries: new package

In reply to Luca Ceresoli

Downloads pre-built binary firmwares for the Xilinx ZynqMP SoCs PMU.

---
 DEVELOPERS                                         |  1 +
 boot/Config.in                                     |  1 +
 boot/zynqmp-pmufw-binaries/Config.in               | 19 +++++++++++++++++
 .../zynqmp-pmufw-binaries.hash                     |  3 +++
 .../zynqmp-pmufw-binaries/zynqmp-pmufw-binaries.mk | 24 ++++++++++++++++++++++
 5 files changed, 48 insertions(+)
 create mode 100644 boot/zynqmp-pmufw-binaries/Config.in
 create mode 100644 boot/zynqmp-pmufw-binaries/zynqmp-pmufw-binaries.hash
 create mode 100644 boot/zynqmp-pmufw-binaries/zynqmp-pmufw-binaries.mk
DEVELOPERS +1 -0
index 73c0231bc0dd..e4db352d3e10 100644
@@ -1013,6 +1013,7 @@ F:	package/ti-sgx-um/
 
 N:	Luca Ceresoli <[email protected]>
 F:	board/olimex/a20_olinuxino/
+F:	boot/zynqmp-pmufw-binaries/
 F:	configs/olimex_a20_olinuxino_*
 F:	package/agentpp/
 F:	package/exim/
boot/Config.in +1 -0
index 3687c41a2c00..a23886997c9f 100644
@@ -19,5 +19,6 @@ source "boot/ts4800-mbrboot/Config.in"
 source "boot/uboot/Config.in"
 source "boot/vexpress-firmware/Config.in"
 source "boot/xloader/Config.in"
+source "boot/zynqmp-pmufw-binaries/Config.in"
 
 endmenu
boot/zynqmp-pmufw-binaries/Config.in new file +19 -0
new file mode 100644
index 000000000000..e39561cbf91e
@@ -0,0 +1,19 @@
+config BR2_TARGET_ZYNQMP_PMUFW_BINARIES
+	bool "Zynqmp PMU firmware"
+	depends on BR2_aarch64
+	help
+	  This package provides precompiled firmwares for the Platform
+	  Management Unit (PMU) of the Xilinx ZynqMP family of SoCs.
+
+	  https://github.com/lucaceresoli/zynqmp-pmufw-binaries
+
+if BR2_TARGET_ZYNQMP_PMUFW_BINARIES
+
+config BR2_TARGET_ZYNQMP_PMUFW_BINARIES_IMAGE
+	string "PMU firmware image file"
+	help
+	  Enter the path to the PMU firmware file for your board and
+	  configuration, relative to the repository top directory.
+	  Example: "zcu106-default/pmufw.bin".
+
+endif
boot/zynqmp-pmufw-binaries/zynqmp-pmufw-binaries.hash new file +3 -0
new file mode 100644
index 000000000000..a60566445290
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  b74808c93522a39bedecd64bd5a75fd766f267e1d540f45dbfe868694f49b1d7  zynqmp-pmufw-binaries-ec64e06b836a0841f40bd52434f6919c5dafb133.tar.gz
+sha256  235b467980655706d5fded5baf3d8b52ddb102a9e0c26804a67c0ec719042d38  license.txt
boot/zynqmp-pmufw-binaries/zynqmp-pmufw-binaries.mk new file +24 -0
new file mode 100644
index 000000000000..2562818f2fb3
@@ -0,0 +1,24 @@
+################################################################################
+#
+# zynqmp-pmufw-binaries
+#
+################################################################################
+
+ZYNQMP_PMUFW_BINARIES_VERSION = ec64e06b836a0841f40bd52434f6919c5dafb133
+ZYNQMP_PMUFW_BINARIES_SITE = $(call github,lucaceresoli,zynqmp-pmufw-binaries,$(ZYNQMP_PMUFW_BINARIES_VERSION))
+
+ZYNQMP_PMUFW_BINARIES_LICENSE = X11 with Xilinx exception
+ZYNQMP_PMUFW_BINARIES_LICENSE_FILES = license.txt
+
+ZYNQMP_PMUFW_BINARIES_IMAGE = $(call qstrip,$(BR2_TARGET_ZYNQMP_PMUFW_BINARIES_IMAGE))
+ZYNQMP_PMUFW_BINARIES_INSTALL_IMAGES = YES
+
+define ZYNQMP_PMUFW_BINARIES_INSTALL_IMAGES_CMDS
+	$(INSTALL) -D -m 0644 $(@D)/$(ZYNQMP_PMUFW_BINARIES_IMAGE) $(BINARIES_DIR)/pmufw.bin
+endef
+
+ifeq ($(ZYNQMP_PMUFW_BINARIES_IMAGE),)
+$(error No PMU firmware image file name set. Check your BR2_TARGET_ZYNQMP_PMUFW_BINARIES_IMAGE setting)
+endif
+
+$(eval $(generic-package))
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/5 u-boot: add customizations to boot on ZynqMP

In reply to Luca Ceresoli

The Xilinx ZynqMP SoCs require some special handling to boot U-Boot with U-Boot SPL:

- In order to work, U-Boot requires a recent PMU firmware loaded, so let's instruct U-Boot to put it in the boot.bin file together with the SPL.

- U-Boot must then enable devices, configure pinumxes etc using a file generated by the Xilinx development tools. Add an option to pass these files from the outside (e.g. in the board files).

---
 boot/uboot/Config.in | 32 ++++++++++++++++++++++++++++++++
 boot/uboot/uboot.mk  | 25 +++++++++++++++++++++++++
 2 files changed, 57 insertions(+)
boot/uboot/Config.in +32 -0
index 264f34376749..dd805443726a 100644
@@ -367,6 +367,38 @@ config BR2_TARGET_UBOOT_ZYNQ_IMAGE
 	  for u-boot-dtb.img file so this U-Boot format is required
 	  to be set.
 
+config BR2_TARGET_UBOOT_ZYNQMP
+	bool "Boot on the Xilinx ZynqMP SoCs"
+	depends on BR2_aarch64
+	select BR2_TARGET_ZYNQMP_PMUFW_BINARIES
+	help
+	  Instruct the U-Boot build process to generate a file named
+	  boot.bin, which is the file loaded by the ZynqMP boot ROM.
+	  boot.bin contains both the U-Boot SPL and the PMU firmware
+	  (downloaded by the zynqmp-pmufw-binaries package) formatted
+	  with the Xilinx-specific format.
+
+if BR2_TARGET_UBOOT_ZYNQMP
+config BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_DIR
+	string "Custom psu_init_gpl files"
+	help
+	  On ZynqMP the booloader is responsible for some basic
+	  initializations, such as enabling peripherals and
+	  configuring pinmuxes. The psu_init_gpl.[ch], generated by
+	  the Xilinx development tools, contain the code for such
+	  initializations.
+
+	  Although U-Boot contains these files for some boards, these
+	  describe only one specific configuration. Users of a
+	  different board, or needing a different configuration, can
+	  provide different files here, and U-Boot will build and link
+	  these files instead of the built-in ones.
+
+	  Set to the path where the psu_init_gpl.[ch] files are
+	  located. Leave empty to use the files provided by U-Boot.
+
+endif
+
 config BR2_TARGET_UBOOT_ALTERA_SOCFPGA_IMAGE_CRC
 	bool "CRC image for Altera SoC FPGA (mkpimage)"
 	depends on BR2_arm
boot/uboot/uboot.mk +25 -0
index d2f241cd8bc5..62cab6a8ccdd 100644
@@ -273,6 +273,31 @@ define UBOOT_INSTALL_IMAGES_CMDS
 			$(BINARIES_DIR)/boot.scr)
 endef
 
+ifeq ($(BR2_TARGET_UBOOT_ZYNQMP),y)
+
+UBOOT_DEPENDENCIES += zynqmp-pmufw-binaries
+define UBOOT_KCONFIG_FIXUP_CMDS
+	$(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"board/xilinx/zynqmp/pmufw.bin",$(@D)/.config)
+endef
+define UBOOT_ZYNQMP_COPY_PMUFW
+	cp ${BINARIES_DIR}/pmufw.bin $(@D)/board/xilinx/zynqmp/
+endef
+UBOOT_PRE_CONFIGURE_HOOKS += UBOOT_ZYNQMP_COPY_PMUFW
+
+ifneq ($(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_DIR)),)
+define UBOOT_ZYNQMP_COPY_PSU_INIT
+# In U-Boot's board/xilinx/zynqmp/Makefile the bundled psu_init_gpl.c
+# has precedence over ours if placed in a subdir whose name matches
+# CONFIG_DEFAULT_DEVICE_TREE. Delete them all to be sure we use ours.
+	rm -f $(@D)/board/xilinx/zynqmp/*/psu_init*.[ch]
+	cp $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_DIR))/psu_init_gpl.[ch] \
+	   $(@D)/board/xilinx/zynqmp/
+endef
+UBOOT_PRE_CONFIGURE_HOOKS += UBOOT_ZYNQMP_COPY_PSU_INIT
+endif # BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_DIR
+
+endif # BR2_TARGET_UBOOT_ZYNQMP
+
 define UBOOT_INSTALL_OMAP_IFT_IMAGE
 	cp -dpf $(@D)/$(UBOOT_BIN_IFT) $(BINARIES_DIR)/
 endef
Signature · 1 line
2.7.4
#5 lore raw

cover Add Xilinx ZynqMP and ZCU106 board support

In reply to Luca Ceresoli
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Luca" == Luca Ceresoli <[email protected]> writes:

Hi,
this patchset adds basic support for the ZynqMP family of ARM64 SoC+FPGA by Xilinx and for the ZCU106 board based on it.

Thanks!

Quoted 8 lines

The ZynqMP sets a few challenges that needed some work besides the usual defconfig + readme that is enough for more classic and simple SoCs.

First, it requires ARM Trusted Firmware in the U-Boot mkimage format, not currently implemented. Nothing really hard here, this is addressed in patch 2 (with a trivial preliminary cleanup in patch 1).

Quoted 8 lines

The next issue is the PMU (Platform Management Unit). It is a Microblaze core that handles power and clock gating and the like, and reprogramming it at runtime is necessary to boot any modern U-Boot and Linux. Since we can't build Microblaze code out of the ARM64 toolchain, I've set up a repository with pre-built PMU firmwares and added a new package that just downloads from there. This is similar to the binaries-marvell and vexpress-firmware packages. This is added in patch 3.

It would be nice if Xilinx could host these officially. How do they do it for Yocto?

Quoted 3 lines

Finally, U-Boot needs some tweaks in order for the PMU firmware to properly loaded and to initialize peripherals before starting Linux. This is done in patch 4.

Is this now the offical supported boot flow from Xilinx? I haven't followed in details, but when I assisted with a Zynqmp based project last year they used Xilinx fsbl and bootgen instead of u-boot SPL.

As you probably know, fsbl is part of the embeddedsw repo:
https://github.com/Xilinx/embeddedsw/tree/master/lib/sw_apps/zynqmp_fsbl

Bootgen is afaik not distributed separately, but zynq-mkimage is an open source alternative:

https://github.com/antmicro/zynq-mkbootimage

Now, I would also prefer the more "normal" boot flow of U-Boot SPL, but as you are using the Xilinx BSP pmu/u-boot/linux, there is also some value in sticking to the official/tested boot flow.

Quoted 2 lines

With all these in place, patch 5 just adds the defconfig and board files.

Which unfortunately are huge! :/ (>50K lines). As this is an official Xilinx board, aren't these files available somewhere?

Signature · 1 line
Bye, Peter Korsgaard
#6 lore raw

cover Add Xilinx ZynqMP and ZCU106 board support

Quoted 25 lines · Peter Korsgaard
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Luca" == Luca Ceresoli <[email protected]> writes:

Hi,
this patchset adds basic support for the ZynqMP family of ARM64 SoC+FPGA by Xilinx and for the ZCU106 board based on it.

Thanks!

Quoted 8 lines

The ZynqMP sets a few challenges that needed some work besides the usual defconfig + readme that is enough for more classic and simple SoCs.

First, it requires ARM Trusted Firmware in the U-Boot mkimage format, not currently implemented. Nothing really hard here, this is addressed in patch 2 (with a trivial preliminary cleanup in patch 1).

Quoted 8 lines

The next issue is the PMU (Platform Management Unit). It is a Microblaze core that handles power and clock gating and the like, and reprogramming it at runtime is necessary to boot any modern U-Boot and Linux. Since we can't build Microblaze code out of the ARM64 toolchain, I've set up a repository with pre-built PMU firmwares and added a new package that just downloads from there. This is similar to the binaries-marvell and vexpress-firmware packages. This is added in patch 3.

Quoted 2 lines

It would be nice if Xilinx could host these officially. How do they do it for Yocto?

We don't have anything nice for Yocto either. The files are behind a click-through license so users have to manually download them.

There are instructions here:
https://git.yoctoproject.org/cgit/cgit.cgi/meta-xilinx/tree/meta-xilinx-bsp/README.qemu.md

I don't think hosting the files is a good idea. That puts you are risk for export compliance violations.

Quoted 9 lines
Quoted 5 lines

Finally, U-Boot needs some tweaks in order for the PMU firmware to properly loaded and to initialize peripherals before starting Linux. This is done in patch 4.

Is this now the offical supported boot flow from Xilinx? I haven't followed in details, but when I assisted with a Zynqmp based project last year they used Xilinx fsbl and bootgen instead of u-boot SPL.

It's not officially supported. It is what meta-xilinx uses for QEMU boot though.

Alistair

Quoted 26 lines

As you probably know, fsbl is part of the embeddedsw repo:
https://github.com/Xilinx/embeddedsw/tree/master/lib/sw_apps/zynqmp_fsb

Bootgen is afaik not distributed separately, but zynq-mkimage is an open source alternative:

https://github.com/antmicro/zynq-mkbootimage

Now, I would also prefer the more "normal" boot flow of U-Boot SPL, but as you are using the Xilinx BSP pmu/u-boot/linux, there is also some value in sticking to the official/tested boot flow.

Quoted 2 lines

With all these in place, patch 5 just adds the defconfig and board files.

Which unfortunately are huge! :/ (>50K lines). As this is an official Xilinx board, aren't these files available somewhere?

--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#7 lore raw

cover Add Xilinx ZynqMP and ZCU106 board support

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Alistair" == Alistair Francis <[email protected]> writes:

Hi,

Quoted 8 lines
Quoted 2 lines

It would be nice if Xilinx could host these officially. How do they do it for Yocto?

We don't have anything nice for Yocto either. The files are behind a click-through license so users have to manually download them.

There are instructions here:
https://git.yoctoproject.org/cgit/cgit.cgi/meta-xilinx/tree/meta-xilinx-bsp/README.qemu.md

But isn't this README about the 32KB pmu boot rom code, and not the runtime loadable pmu fw that you can build from the embeddedsw repo?

Quoted 2 lines

I don't think hosting the files is a good idea. That puts you are risk for export compliance violations.

I agree for the rom code, but that shouldn't be needed to run on a zcu106 board?

Quoted 9 lines
Quoted 7 lines
Quoted 3 lines

Finally, U-Boot needs some tweaks in order for the PMU firmware to properly loaded and to initialize peripherals before starting Linux. This is done in patch 4.

Is this now the offical supported boot flow from Xilinx? I haven't followed in details, but when I assisted with a Zynqmp based project last year they used Xilinx fsbl and bootgen instead of u-boot SPL.

It's not officially supported. It is what meta-xilinx uses for QEMU boot though.

Ok. Luca, any specific reason why you are using this for real hw?

Alistair, do you know if bootgen is downloadable somewhere separately?

Signature · 1 line
Bye, Peter Korsgaard
#8 lore raw

cover Add Xilinx ZynqMP and ZCU106 board support

Quoted 13 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Alistair" == Alistair Francis <[email protected]> writes:

Hi,

Quoted 8 lines
Quoted 2 lines

It would be nice if Xilinx could host these officially. How do they do it for Yocto?

We don't have anything nice for Yocto either. The files are behind a click-through license so users have to manually download them.

There are instructions here:
https://git.yoctoproject.org/cgit/cgit.cgi/meta-xilinx/tree/meta-xilinx-bsp/README.qemu.md

Quoted 8 lines

But isn't this README about the 32KB pmu boot rom code, and not the runtime loadable pmu fw that you can build from the embeddedsw repo?

Quoted 2 lines

I don't think hosting the files is a good idea. That puts you are risk for export compliance violations.

I agree for the rom code, but that shouldn't be needed to run on a zcu106 board?

Ah! Yes you are correct. I confused myself there.

Yocto just builds the PMU FW, but it does require a fair bit of interaction with Xilinx tools.

Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

Finally, U-Boot needs some tweaks in order for the PMU firmware to properly loaded and to initialize peripherals before starting Linux. This is done in patch 4.

Is this now the offical supported boot flow from Xilinx? I haven't followed in details, but when I assisted with a Zynqmp based project last year they used Xilinx fsbl and bootgen instead of u-boot SPL.

Quoted 5 lines
Quoted 1 line

It's not officially supported. It is what meta-xilinx uses for QEMU boot though.

Ok. Luca, any specific reason why you are using this for real hw?

Alistair, do you know if bootgen is downloadable somewhere separately?

AFAIK it's not. I think SPL should be fine. Maybe supporting both options is the best. If people want to follow the official path then they can install bootgen or prepare it manually.

Alistair

Quoted 3 lines

--
Bye, Peter Korsgaard

#9 lore raw

cover Add Xilinx ZynqMP and ZCU106 board support

Quoted 5 lines · Alistair Francis
Quoted 1 line

Alistair, do you know if bootgen is downloadable somewhere separately?

AFAIK it's not. I think SPL should be fine. Maybe supporting both options is the best. If people want to follow the official path then they can install bootgen or prepare it manually.

Either that, or use https://github.com/antmicro/zynq-mkbootimage

Signature · 1 line
Bye, Peter Korsgaard
#10 lore raw

cover Add Xilinx ZynqMP and ZCU106 board support

In reply to Peter Korsgaard

Hi Peter, Alistair,

Quoted 25 lines · Peter Korsgaard
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Luca" == Luca Ceresoli <[email protected]> writes:

Hi,
this patchset adds basic support for the ZynqMP family of ARM64 SoC+FPGA by Xilinx and for the ZCU106 board based on it.

Thanks!

Quoted 8 lines

The ZynqMP sets a few challenges that needed some work besides the usual defconfig + readme that is enough for more classic and simple SoCs.

First, it requires ARM Trusted Firmware in the U-Boot mkimage format, not currently implemented. Nothing really hard here, this is addressed in patch 2 (with a trivial preliminary cleanup in patch 1).

Quoted 8 lines

The next issue is the PMU (Platform Management Unit). It is a Microblaze core that handles power and clock gating and the like, and reprogramming it at runtime is necessary to boot any modern U-Boot and Linux. Since we can't build Microblaze code out of the ARM64 toolchain, I've set up a repository with pre-built PMU firmwares and added a new package that just downloads from there. This is similar to the binaries-marvell and vexpress-firmware packages. This is added in patch 3.

Quoted 1 line

It would be nice if Xilinx could host these officially.

The topic is quite tricky, and I should probably have explained it in my initial cover letter. Sorry, I'll try to amend now.

There are two main (development and boot) flows around which ZynqMP users focus on (by "ZynqMP users" I mean those who discuss on the meta-xilinx ML): the "Xilinx way" and the "open source way". The one I'm pushing to Buildroot is the latter.

The "Xilinx way" uses the Xilinx tools (Vivado, XSDK, bootgen) and the Petalinux buildsystem.
Boot components are PMUFW, FSBL, ATF, U-Boot.

The "Open source way" does not use the Xilinx tools during the build (1), only Yocto and the meta-xilinx-bsp (2) layer.
Boot components are PMUFW, U-Boot SPL, ATF, U-Boot.

(1) except for generating the psu_init_gpl.[hc] and pm_cfg_obj.c files, which does not need to be re-made at every build
(2) known as meta-xilinx until a few weeks ago [3]

To know how the chip resources are to be managed, the PMU firmware needs a ?configuration object? (pm_cfg_obj) to be passed from the outside even before U-Boot proper can start.

In the "Xilinx way" the FSBL is generated with a hard-coded pm_cfg_obj, and it is able to pass it to PMUFW. This means the PMUFW is quite generic and could technically be hosted somewhere and used by most users. It also means the FSBL changes based on how the chip is configured.

In the "open source way" U-Boot SPL is used. SPL is unable to pass the pm_cfg_obj to PMUFW (and there are also licensing issues to do that). So the "current best workaround" is to hard-code the pm_cfg_obj in PMUFW (not FSBL or SPL) and let it configure itself. This implies the SPL is now generic, while the PMUFW changes based on how the chip is configured. (more info on [0])

Thus the reply to your concern ("It would be nice if Xilinx could host these [PMU firmwares] officially"): since we are speaking about the "open source way", I don't expect Xilinx to host them. And it wouldn't make any sense since there can be hundreds of different PMUFWs based on the hard-coded pm_cfg_obj, at least until a better solution is devised and implemented.

Quoted 1 line

How do they do it for Yocto?

I don't know exactly how Yocto passes the config object to FSBL in the "Xilinx way", I never used that.

In the "Open source way" meta-xilinx-bsp is able to build a PMUFW without the pm_cfg_obj, and there is a tweak around [1] to hard-code and self-load it. BTW I suspect that tweak will land in meta-xilinx-bsp in the near future.

Quoted 8 lines
Quoted 3 lines

Finally, U-Boot needs some tweaks in order for the PMU firmware to properly loaded and to initialize peripherals before starting Linux. This is done in patch 4.

Is this now the offical supported boot flow from Xilinx? I haven't followed in details, but when I assisted with a Zynqmp based project last year they used Xilinx fsbl and bootgen instead of u-boot SPL.

Quoted 7 lines

As you probably know, fsbl is part of the embeddedsw repo:
https://github.com/Xilinx/embeddedsw/tree/master/lib/sw_apps/zynqmp_fsbl

Bootgen is afaik not distributed separately, but zynq-mkimage is an open source alternative:

https://github.com/antmicro/zynq-mkbootimage

Well, mixing the two ways (xilinx and open source) brings in complexity and leads to things that don't make much sense to me, although there might be use cases where it does. It's hard to find a good motivation for building FSBL with anything but the Xilinx tools (see [2] for some reasons).

Quoted 3 lines

Now, I would also prefer the more "normal" boot flow of U-Boot SPL, but as you are using the Xilinx BSP pmu/u-boot/linux, there is also some value in sticking to the official/tested boot flow.

I guess it's now clear that I'm not using the "Xilinx BSP" flow. :) Again sorry for not having explained that in the beginning.

Disclaimer: I'm not saying one flow is better that the other one.

Quoted 4 lines
Quoted 2 lines

With all these in place, patch 5 just adds the defconfig and board files.

Which unfortunately are huge! :/ (>50K lines).

Yup. :( Patch 5 never got to the ML (awaiting moderator approval) due to such a large size.

Quoted 2 lines

As this is an official
Xilinx board, aren't these files available somewhere?

Pretty stupid on my side, but I never tested with Buildroot the psu_init_gpl files bundled with U-Boot. I'm quite optimistic they will work, and in that case I will use them and have a reasonable patch.

OTOH I think there still is some value in keeping the BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_DIR option, so users who need a different configuration can apply it easily.

[0] http://lucaceresoli.net/en/zynqmp-pmufw-builder/
[1]
https://github.com/topic-embedded-products/meta-topic/blob/master/recipes-bsp/pmu-firmware/pmu-firmware_2017.1.bbappend
[2]
https://lists.yoctoproject.org/pipermail/meta-xilinx/2017-November/003365.html
[3]
https://git.yoctoproject.org/cgit/cgit.cgi/meta-xilinx/commit/?id=a18947c20dba2c0c38db8bde1ad4684995df4bbd

Signature · 1 line
Luca