diff mbox series

[2/2] zynqmp: Run board_get_usable_ram_top() only on main U-Boot

Message ID b6c6b876ca6ea81de27372b518892cae85d68cec.1642162459.git.michal.simek@xilinx.com
State Superseded
Delegated to: Michal Simek
Headers show
Series [1/2] lmb: Fix lmb property's defination under struct lmb | expand

Commit Message

Michal Simek Jan. 14, 2022, 12:14 p.m. UTC
From: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>

With commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location"), the function board_get_usable_ram_top() is allocating
MMU_SECTION_SIZE of about 2MB using lmb_alloc(). But we dont have this
much memory in case of mini U-Boot.

Keep these functions which use lmb under CONFIG_LMB so that they are
compiled and used only when LMB is enabled.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 board/xilinx/zynqmp/zynqmp.c | 3 +++
 boot/image-board.c           | 4 ++++
 2 files changed, 7 insertions(+)

Comments

Michal Simek Feb. 7, 2022, 9:41 a.m. UTC | #1
pá 14. 1. 2022 v 13:14 odesílatel Michal Simek <michal.simek@xilinx.com> napsal:
>
> From: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
>
> With commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
> location"), the function board_get_usable_ram_top() is allocating
> MMU_SECTION_SIZE of about 2MB using lmb_alloc(). But we dont have this
> much memory in case of mini U-Boot.
>
> Keep these functions which use lmb under CONFIG_LMB so that they are
> compiled and used only when LMB is enabled.
>
> Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  board/xilinx/zynqmp/zynqmp.c | 3 +++
>  boot/image-board.c           | 4 ++++
>  2 files changed, 7 insertions(+)
>
> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
> index 2b5239ccb475..c69fb939a83e 100644
> --- a/board/xilinx/zynqmp/zynqmp.c
> +++ b/board/xilinx/zynqmp/zynqmp.c
> @@ -483,6 +483,7 @@ int dram_init(void)
>         return 0;
>  }
>
> +#if defined(CONFIG_LMB)
>  ulong board_get_usable_ram_top(ulong total_size)
>  {
>         phys_size_t size;
> @@ -504,6 +505,8 @@ ulong board_get_usable_ram_top(ulong total_size)
>
>         return reg + size;
>  }
> +#endif
> +
>  #else
>  int dram_init_banksize(void)
>  {
> diff --git a/boot/image-board.c b/boot/image-board.c
> index bf8817165cab..9cdfbc44154c 100644
> --- a/boot/image-board.c
> +++ b/boot/image-board.c
> @@ -546,6 +546,7 @@ int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
>         return 0;
>  }
>
> +#if defined(CONFIG_LMB)
>  /**
>   * boot_ramdisk_high - relocate init ramdisk
>   * @lmb: pointer to lmb handle, will be used for memory mgmt
> @@ -639,6 +640,7 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
>  error:
>         return -1;
>  }
> +#endif
>
>  int boot_get_setup(bootm_headers_t *images, u8 arch,
>                    ulong *setup_start, ulong *setup_len)
> @@ -832,6 +834,7 @@ int boot_get_loadable(int argc, char *const argv[], bootm_headers_t *images,
>         return 0;
>  }
>
> +#if defined(CONFIG_LMB)
>  /**
>   * boot_get_cmdline - allocate and initialize kernel cmdline
>   * @lmb: pointer to lmb handle, will be used for memory mgmt
> @@ -939,6 +942,7 @@ int image_setup_linux(bootm_headers_t *images)
>
>         return 0;
>  }
> +#endif
>
>  void genimg_print_size(uint32_t size)
>  {
> --
> 2.34.1
>

Applied.
M
diff mbox series

Patch

diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 2b5239ccb475..c69fb939a83e 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -483,6 +483,7 @@  int dram_init(void)
 	return 0;
 }
 
+#if defined(CONFIG_LMB)
 ulong board_get_usable_ram_top(ulong total_size)
 {
 	phys_size_t size;
@@ -504,6 +505,8 @@  ulong board_get_usable_ram_top(ulong total_size)
 
 	return reg + size;
 }
+#endif
+
 #else
 int dram_init_banksize(void)
 {
diff --git a/boot/image-board.c b/boot/image-board.c
index bf8817165cab..9cdfbc44154c 100644
--- a/boot/image-board.c
+++ b/boot/image-board.c
@@ -546,6 +546,7 @@  int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
 	return 0;
 }
 
+#if defined(CONFIG_LMB)
 /**
  * boot_ramdisk_high - relocate init ramdisk
  * @lmb: pointer to lmb handle, will be used for memory mgmt
@@ -639,6 +640,7 @@  int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
 error:
 	return -1;
 }
+#endif
 
 int boot_get_setup(bootm_headers_t *images, u8 arch,
 		   ulong *setup_start, ulong *setup_len)
@@ -832,6 +834,7 @@  int boot_get_loadable(int argc, char *const argv[], bootm_headers_t *images,
 	return 0;
 }
 
+#if defined(CONFIG_LMB)
 /**
  * boot_get_cmdline - allocate and initialize kernel cmdline
  * @lmb: pointer to lmb handle, will be used for memory mgmt
@@ -939,6 +942,7 @@  int image_setup_linux(bootm_headers_t *images)
 
 	return 0;
 }
+#endif
 
 void genimg_print_size(uint32_t size)
 {