[PATCH 0/3] 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(-)

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.
Signed-off-by: Michal Simek michal.simek@xilinx.com ---
drivers/firmware/firmware-zynqmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c index 2a2aa2f4f169..c37642569dda 100644 --- a/drivers/firmware/firmware-zynqmp.c +++ b/drivers/firmware/firmware-zynqmp.c @@ -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);

Parameter order is not correct based on zynqmp_mmio_write() declaration.
Fixes: be52372ff1bb ("arm64: zynqmp: Use zynqmp_mmio_read/write functions") Signed-off-by: Michal Simek michal.simek@xilinx.com ---
board/xilinx/zynqmp/zynqmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index eb1bc0861e2f..3c92b1a5825f 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -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;

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.
Signed-off-by: Michal Simek michal.simek@xilinx.com ---
arch/arm/mach-zynqmp/mkimage_fit_atf.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-zynqmp/mkimage_fit_atf.sh b/arch/arm/mach-zynqmp/mkimage_fit_atf.sh index 1e770ba111d3..e221e92828ad 100755 --- a/arch/arm/mach-zynqmp/mkimage_fit_atf.sh +++ b/arch/arm/mach-zynqmp/mkimage_fit_atf.sh @@ -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

po 23. 3. 2020 v 14:58 odesÃlatel Michal Simek michal.simek@xilinx.com napsal:
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(-)
-- 2.25.1
Applied all. M
participants (2)
-
Michal Simek
-
Michal Simek