All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] xilinx: common: Fix fdt/initrd_high and bootm_* variables
@ 2020-08-12 10:42 Michal Simek
  2020-08-12 10:42 ` [PATCH 1/4] xilinx: common: Get rid of fdt_high variable Michal Simek
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Michal Simek @ 2020-08-12 10:42 UTC (permalink / raw)
  To: u-boot

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(-)

-- 
2.28.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] xilinx: common: Get rid of fdt_high variable
  2020-08-12 10:42 [PATCH 0/4] xilinx: common: Fix fdt/initrd_high and bootm_* variables Michal Simek
@ 2020-08-12 10:42 ` Michal Simek
  2020-08-12 10:42 ` [PATCH 2/4] xilinx: common: Get rid of initrd_high variable setup Michal Simek
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Michal Simek @ 2020-08-12 10:42 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 include/configs/xilinx_versal.h | 1 -
 include/configs/xilinx_zynqmp.h | 1 -
 include/configs/zynq-common.h   | 1 -
 3 files changed, 3 deletions(-)

diff --git a/include/configs/xilinx_versal.h b/include/configs/xilinx_versal.h
index 32cd5b21f7b7..d7255a05dff1 100644
--- a/include/configs/xilinx_versal.h
+++ b/include/configs/xilinx_versal.h
@@ -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" \
diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h
index 7c24bf632e3f..15ad4198a6be 100644
--- a/include/configs/xilinx_zynqmp.h
+++ b/include/configs/xilinx_zynqmp.h
@@ -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" \
diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
index 79c75784f2bf..1607a8d06518 100644
--- a/include/configs/zynq-common.h
+++ b/include/configs/zynq-common.h
@@ -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"        \
-- 
2.28.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] xilinx: common: Get rid of initrd_high variable setup
  2020-08-12 10:42 [PATCH 0/4] xilinx: common: Fix fdt/initrd_high and bootm_* variables Michal Simek
  2020-08-12 10:42 ` [PATCH 1/4] xilinx: common: Get rid of fdt_high variable Michal Simek
@ 2020-08-12 10:42 ` Michal Simek
  2020-08-12 10:42 ` [PATCH 3/4] xilinx: common: Check return value from " Michal Simek
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Michal Simek @ 2020-08-12 10:42 UTC (permalink / raw)
  To: u-boot

When bootm_low/bootm_size are setup properly there is no need to setup any
initrd_high address. Location for initrd is determined through LMB.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 board/xilinx/common/board.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 0782d08ee3fe..901591ba2a85 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -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);
 
-- 
2.28.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] xilinx: common: Check return value from variable setup
  2020-08-12 10:42 [PATCH 0/4] xilinx: common: Fix fdt/initrd_high and bootm_* variables Michal Simek
  2020-08-12 10:42 ` [PATCH 1/4] xilinx: common: Get rid of fdt_high variable Michal Simek
  2020-08-12 10:42 ` [PATCH 2/4] xilinx: common: Get rid of initrd_high variable setup Michal Simek
@ 2020-08-12 10:42 ` Michal Simek
  2020-08-12 10:42 ` [PATCH 4/4] xilinx: common: Change bootm_size variable setting Michal Simek
  2020-08-20  7:58 ` [PATCH 0/4] xilinx: common: Fix fdt/initrd_high and bootm_* variables Michal Simek
  4 siblings, 0 replies; 6+ messages in thread
From: Michal Simek @ 2020-08-12 10:42 UTC (permalink / raw)
  To: u-boot

env_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.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

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(-)

diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 901591ba2a85..581c88ad49a4 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -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;
 }
-- 
2.28.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] xilinx: common: Change bootm_size variable setting
  2020-08-12 10:42 [PATCH 0/4] xilinx: common: Fix fdt/initrd_high and bootm_* variables Michal Simek
                   ` (2 preceding siblings ...)
  2020-08-12 10:42 ` [PATCH 3/4] xilinx: common: Check return value from " Michal Simek
@ 2020-08-12 10:42 ` Michal Simek
  2020-08-20  7:58 ` [PATCH 0/4] xilinx: common: Fix fdt/initrd_high and bootm_* variables Michal Simek
  4 siblings, 0 replies; 6+ messages in thread
From: Michal Simek @ 2020-08-12 10:42 UTC (permalink / raw)
  To: u-boot

Linux 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.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 board/xilinx/common/board.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 581c88ad49a4..eab389d049f2 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -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__);
-- 
2.28.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 0/4] xilinx: common: Fix fdt/initrd_high and bootm_* variables
  2020-08-12 10:42 [PATCH 0/4] xilinx: common: Fix fdt/initrd_high and bootm_* variables Michal Simek
                   ` (3 preceding siblings ...)
  2020-08-12 10:42 ` [PATCH 4/4] xilinx: common: Change bootm_size variable setting Michal Simek
@ 2020-08-20  7:58 ` Michal Simek
  4 siblings, 0 replies; 6+ messages in thread
From: Michal Simek @ 2020-08-20  7:58 UTC (permalink / raw)
  To: u-boot

st 12. 8. 2020 v 12:42 odes?latel Michal Simek <michal.simek@xilinx.com> napsal:
>
> 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(-)
>
> --
> 2.28.0
>

Applied all.
M

-- 
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-08-20  7:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-12 10:42 [PATCH 0/4] xilinx: common: Fix fdt/initrd_high and bootm_* variables Michal Simek
2020-08-12 10:42 ` [PATCH 1/4] xilinx: common: Get rid of fdt_high variable Michal Simek
2020-08-12 10:42 ` [PATCH 2/4] xilinx: common: Get rid of initrd_high variable setup Michal Simek
2020-08-12 10:42 ` [PATCH 3/4] xilinx: common: Check return value from " Michal Simek
2020-08-12 10:42 ` [PATCH 4/4] xilinx: common: Change bootm_size variable setting Michal Simek
2020-08-20  7:58 ` [PATCH 0/4] xilinx: common: Fix fdt/initrd_high and bootm_* variables Michal Simek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.