xilinx: common: Fix fdt/initrd_high and bootm_* variables
cover xilinx: common: Fix fdt/initrd_high and bootm_* variables
Hi,
this series is removing fdt/initrd_high variables and tune bootm_size run time setup to match needs from Linux kernel.
Thanks,
Michal
Michal Simek (4):
xilinx: common: Get rid of fdt_high variable
xilinx: common: Get rid of initrd_high variable setup
xilinx: common: Check return value from variable setup
xilinx: common: Change bootm_size variable setting
board/xilinx/common/board.c | 17 ++++++++++------- include/configs/xilinx_versal.h | 1 - include/configs/xilinx_zynqmp.h | 1 - include/configs/zynq-common.h | 1 - 4 files changed, 10 insertions(+), 10 deletions(-)
Signature · 1 line
2.28.0
PATCH 1/4 xilinx: common: Get rid of fdt_high variable
There is no need to setup this variable if bootm_low and bootm_size variable are properly setup. If fdt_high variable is missing U-Boot is asking LMB to return free memory which is not used.
---
include/configs/xilinx_versal.h | 1 - include/configs/xilinx_zynqmp.h | 1 - include/configs/zynq-common.h | 1 - 3 files changed, 3 deletions(-)
include/configs/xilinx_versal.h +0 -1
@@ -79,7 +79,6 @@#define CONFIG_CLOCKS #define ENV_MEM_LAYOUT_SETTINGS \ - "fdt_high=10000000\0" \ "fdt_addr_r=0x40000000\0" \ "fdt_size_r=0x400000\0" \ "pxefile_addr_r=0x10000000\0" \
include/configs/xilinx_zynqmp.h +0 -1
@@ -101,7 +101,6 @@#define CONFIG_CLOCKS #define ENV_MEM_LAYOUT_SETTINGS \ - "fdt_high=10000000\0" \ "fdt_addr_r=0x40000000\0" \ "fdt_size_r=0x400000\0" \ "pxefile_addr_r=0x10000000\0" \
include/configs/zynq-common.h +0 -1
@@ -196,7 +196,6 @@/* Default environment */ #ifndef CONFIG_EXTRA_ENV_SETTINGS #define CONFIG_EXTRA_ENV_SETTINGS \ - "fdt_high=0x20000000\0" \ "scriptaddr=0x20000\0" \ "script_size_f=0x40000\0" \ "fdt_addr_r=0x1f00000\0" \
Signature · 1 line
2.28.0
PATCH 2/4 xilinx: common: Get rid of initrd_high variable setup
In reply to Michal SimekWhen bootm_low/bootm_size are setup properly there is no need to setup any initrd_high address. Location for initrd is determined through LMB.
---
board/xilinx/common/board.c | 6 ------ 1 file changed, 6 deletions(-)
board/xilinx/common/board.c +0 -6
@@ -77,14 +77,8 @@ void *board_fdt_blob_setup(void)int board_late_init_xilinx (void ) { -ulong initrd_hi; -env_set_hex ("script_offset_f" ,CONFIG_BOOT_SCRIPT_OFFSET ); - initrd_hi = gd->start_addr_sp -CONFIG_STACK_SIZE ; - initrd_hi =round_down (initrd_hi,SZ_16M ); -env_set_addr ("initrd_high" , (void *)initrd_hi); -env_set_addr ("bootm_low" , (void *)gd->ram_base);env_set_addr ("bootm_size" , (void *)gd->ram_size);
Signature · 1 line
2.28.0
PATCH 3/4 xilinx: common: Check return value from variable setup
In reply to Michal Simekenv_set..() can failed that's why check return status and report it back to make sure that user is aware that's something went wrong.
---
Change type to u32 to have defined bit operations (mentioned by Marek) Origin patch sent as https://lists.denx.de/pipermail/u-boot/2020-August/422508.html
--- board/xilinx/common/board.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
board/xilinx/common/board.c +8 -3
@@ -77,10 +77,15 @@ void *board_fdt_blob_setup(void)int board_late_init_xilinx (void ) { -env_set_hex ("script_offset_f" ,CONFIG_BOOT_SCRIPT_OFFSET ); +u32 ret =0 ; -env_set_addr ("bootm_low" , (void *)gd->ram_base); -env_set_addr ("bootm_size" , (void *)gd->ram_size); + ret |=env_set_hex ("script_offset_f" ,CONFIG_BOOT_SCRIPT_OFFSET ); + + ret |=env_set_addr ("bootm_low" , (void *)gd->ram_base); + ret |=env_set_addr ("bootm_size" , (void *)gd->ram_size); + +if (ret) +printf ("%s: Saving run time variables FAILED\n" , __func__);return 0 ; }
Signature · 1 line
2.28.0
PATCH 4/4 xilinx: common: Change bootm_size variable setting
In reply to Michal SimekLinux kernel for arm32 requires dtb and initrd to be placed in low memory to work properly. This requirement is described in chapter 4b) and 5) in Linux documentation (Documentation/arm/booting.rst).
There is an issue on arm32 with 2GB of memory that bootm_size is bigger than Linux lowmem (for example with VMSPLIT_3G). That's why limit bootm size on these systems not to be above 768MB.
---
board/xilinx/common/board.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
board/xilinx/common/board.c +5 -1
@@ -78,11 +78,15 @@ void *board_fdt_blob_setup(void)int board_late_init_xilinx (void ) {u32 ret =0 ; +phys_size_t bootm_size = gd->ram_size; + +if (CONFIG_IS_ENABLED (ARCH_ZYNQ )) + bootm_size =min (bootm_size, (phys_size_t)(SZ_512M +SZ_256M )); ret |=env_set_hex ("script_offset_f" ,CONFIG_BOOT_SCRIPT_OFFSET ); ret |=env_set_addr ("bootm_low" , (void *)gd->ram_base); - ret |=env_set_addr ("bootm_size" , (void *)gd->ram_size); + ret |=env_set_addr ("bootm_size" , (void *)bootm_size);if (ret)printf ("%s: Saving run time variables FAILED\n" , __func__);
Signature · 1 line
2.28.0
cover xilinx: common: Fix fdt/initrd_high and bootm_* variables
In reply to Michal Simekst 12. 8. 2020 v 12:42 odes?latel Michal Simek <[email protected]> napsal:
Quoted 16 lines
Hi,
this series is removing fdt/initrd_high variables and tune
bootm_sizerun time setup to match needs from Linux kernel.Thanks,
MichalMichal Simek (4):
xilinx: common: Get rid offdt_highvariable
xilinx: common: Get rid ofinitrd_highvariable setup
xilinx: common: Check return value from variable setup
xilinx: common: Changebootm_sizevariable setting
Quoted 9 lines
board/xilinx/common/board.c | 17 ++++++++++------- include/configs/xilinx_versal.h | 1 - include/configs/xilinx_zynqmp.h | 1 - include/configs/zynq-common.h | 1 - 4 files changed, 10 insertions(+), 10 deletions(-)--
2.28.0
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