diff mbox series

[v2] xilinx: common: change bootm_size to not go beyond ram_top

Message ID 20220120191730.2009270-1-ricardo@foundries.io
State Accepted
Commit e6e3b9d7b55ce2563f9da0b5991605f15bd38163
Delegated to: Michal Simek
Headers show
Series [v2] xilinx: common: change bootm_size to not go beyond ram_top | expand

Commit Message

Ricardo Salveti Jan. 20, 2022, 7:17 p.m. UTC
The available ram can be limited by ram_top as that depends on the
reserved memory nodes provided by the device-tree (via
board_get_usable_ram_top), so make sure to respect ram_top when setting
up bootm_size to avoid overlapping reserved memory regions (e.g. memory
used by OP-TEE).

The same logic is available in env_get_bootm_size when bootm_size is
not defined by the default environment.

Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
---

Change in v2:
- Declare bootm_size based on ram top and base

 board/xilinx/common/board.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michal Simek Jan. 21, 2022, 7:59 a.m. UTC | #1
On 1/20/22 20:17, Ricardo Salveti wrote:
> The available ram can be limited by ram_top as that depends on the
> reserved memory nodes provided by the device-tree (via
> board_get_usable_ram_top), so make sure to respect ram_top when setting
> up bootm_size to avoid overlapping reserved memory regions (e.g. memory
> used by OP-TEE).
> 
> The same logic is available in env_get_bootm_size when bootm_size is
> not defined by the default environment.
> 
> Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
> ---
> 
> Change in v2:
> - Declare bootm_size based on ram top and base
> 
>   board/xilinx/common/board.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
> index 78a5d0efa86..6fce23197a4 100644
> --- a/board/xilinx/common/board.c
> +++ b/board/xilinx/common/board.c
> @@ -377,7 +377,7 @@ int board_late_init_xilinx(void)
>   	u32 ret = 0;
>   	int i, id, macid = 0;
>   	struct xilinx_board_description *desc;
> -	phys_size_t bootm_size = gd->ram_size;
> +	phys_size_t bootm_size = gd->ram_top - gd->ram_base;
>   
>   	if (!CONFIG_IS_ENABLED(MICROBLAZE)) {
>   		ulong scriptaddr;

Applied.
M
diff mbox series

Patch

diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 78a5d0efa86..6fce23197a4 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -377,7 +377,7 @@  int board_late_init_xilinx(void)
 	u32 ret = 0;
 	int i, id, macid = 0;
 	struct xilinx_board_description *desc;
-	phys_size_t bootm_size = gd->ram_size;
+	phys_size_t bootm_size = gd->ram_top - gd->ram_base;
 
 	if (!CONFIG_IS_ENABLED(MICROBLAZE)) {
 		ulong scriptaddr;