Skip to contentSkip to conversation

arm64: zynqmp: Add support for running U-Boot in EL3 again

PATCH New Michal Simek 2 participants 5 messages Mar 23, 2020 – Apr 6, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover arm64: zynqmp: Add support for running U-Boot in EL3 again

Hi,

in past without PMU fw it was possible to run U-Boot in EL3. Firmware changes made ATF required that's why generation was done like this. But some recent changes (especially passing PMUFW object to PMU from SPL) introduce the whole infrastructure for talking to PMU via IPI interface. That's why this interface can be reused and run U-Boot in EL3 again.

Based on it I have fixed mkimage_fit_atf.sh script to generate u-boot.its/itb based on ATF availability but still producing working image without it.

Also found two issues which should be fixed to get U-Boot work in EL3.

Thanks,
Michal

Michal Simek (3):
firmware: zynqmp: Enable IPI code calling also in EL3
arm64: zynqmp: Reorder parameters for zynqmp_mmio_write()
arm64: zynqmp: Add support for u-boot.itb generation without ATF

 arch/arm/mach-zynqmp/mkimage_fit_atf.sh | 16 ++++++++++++----
 board/xilinx/zynqmp/zynqmp.c            |  2 +-
 drivers/firmware/firmware-zynqmp.c      |  2 +-
 3 files changed, 14 insertions(+), 6 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/3 firmware: zynqmp: Enable IPI code calling also in EL3

U-Boot proper can still run in EL3 without using firmware interface wired via ATF. For supporting this use case there is a need to check EL level where U-Boot runs and based on that choose the way how to talk to firmware.

---

 drivers/firmware/firmware-zynqmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/firmware-zynqmp.c +1 -1
index 2a2aa2f4f169..c37642569dda 100644
@@ -51,7 +51,7 @@ static int ipi_req(const u32 *req, size_t req_len, u32 *res, size_t res_maxlen)
 
 static int send_req(const u32 *req, size_t req_len, u32 *res, size_t res_maxlen)
 {
-	if (IS_ENABLED(CONFIG_SPL_BUILD))
+	if (IS_ENABLED(CONFIG_SPL_BUILD) || current_el() == 3)
 		return ipi_req(req, req_len, res, res_maxlen);
 
 	return xilinx_pm_request(req[0], 0, 0, 0, 0, res);
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/3 arm64: zynqmp: Reorder parameters for zynqmp_mmio_write()

In reply to Michal Simek

Parameter order is not correct based on zynqmp_mmio_write() declaration.

Fixes be52372ff1bb ("arm64: zynqmp: Use zynqmp_mmio_read/write functions")

---

 board/xilinx/zynqmp/zynqmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/xilinx/zynqmp/zynqmp.c +1 -1
index eb1bc0861e2f..3c92b1a5825f 100644
@@ -515,7 +515,7 @@ static int reset_reason(void)
 
 	env_set("reset_reason", reason);
 
-	ret = zynqmp_mmio_write(~0, ~0, (ulong)&crlapb_base->reset_reason);
+	ret = zynqmp_mmio_write((ulong)&crlapb_base->reset_reason, ~0, ~0);
 	if (ret)
 		return -EINVAL;
 
Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/3 arm64: zynqmp: Add support for u-boot.itb generation without ATF

In reply to Michal Simek

If ATF doesn't exist generate u-boot.itb without it and let U-Boot run in EL3. Still keep warning to let user know that ATF/BL31 is missing.

---

 arch/arm/mach-zynqmp/mkimage_fit_atf.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
arch/arm/mach-zynqmp/mkimage_fit_atf.sh +12 -4
index 1e770ba111d3..e221e92828ad 100755
@@ -29,11 +29,8 @@ else
 fi
 
 if [ ! -f $BL31 ]; then
-	echo "WARNING: BL31 file $BL31 NOT found, resulting binary is non-functional" >&2
+	echo "WARNING: BL31 file $BL31 NOT found, U-Boot will run in EL3" >&2
 	BL31=/dev/null
-	# But U-Boot proper could be loaded in EL3 by specifying
-	# firmware = "uboot";
-	# instead of "atf" in config node
 fi
 
 cat << __HEADER_EOF
@@ -106,6 +103,15 @@ __CONF_HEADER_EOF
 cnt=1
 for dtname in $DT
 do
+if [ ! -f $BL31 ]; then
+cat << __CONF_SECTION1_EOF
+		config_$cnt {
+			description = "$(basename $dtname .dtb)";
+			firmware = "uboot";
+			fdt = "fdt_$cnt";
+		};
+__CONF_SECTION1_EOF
+else
 cat << __CONF_SECTION1_EOF
 		config_$cnt {
 			description = "$(basename $dtname .dtb)";
@@ -114,6 +120,8 @@ cat << __CONF_SECTION1_EOF
 			fdt = "fdt_$cnt";
 		};
 __CONF_SECTION1_EOF
+fi
+
 cnt=$((cnt+1))
 done
 
Signature · 1 line
2.25.1
#4 lore raw

cover arm64: zynqmp: Add support for running U-Boot in EL3 again

In reply to Michal Simek

po 23. 3. 2020 v 14:58 odes?latel Michal Simek <[email protected]> napsal:

Quoted 24 lines

Hi,

in past without PMU fw it was possible to run U-Boot in EL3. Firmware changes made ATF required that's why generation was done like this. But some recent changes (especially passing PMUFW object to PMU from SPL) introduce the whole infrastructure for talking to PMU via IPI interface. That's why this interface can be reused and run U-Boot in EL3 again.

Based on it I have fixed mkimage_fit_atf.sh script to generate u-boot.its/itb based on ATF availability but still producing working image without it.

Also found two issues which should be fixed to get U-Boot work in EL3.

Thanks,
Michal

Michal Simek (3):
firmware: zynqmp: Enable IPI code calling also in EL3
arm64: zynqmp: Reorder parameters for zynqmp_mmio_write()
arm64: zynqmp: Add support for u-boot.itb generation without ATF

Quoted 8 lines
 arch/arm/mach-zynqmp/mkimage_fit_atf.sh | 16 ++++++++++++----
 board/xilinx/zynqmp/zynqmp.c            |  2 +-
 drivers/firmware/firmware-zynqmp.c      |  2 +-
 3 files changed, 14 insertions(+), 6 deletions(-)

--
2.25.1

Applied all.
M

Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs