common: bootm: reserve memory bank
PATCH 1/1 common: bootm: reserve memory bank
Actually the DRAM is not only seperated in one
bank. The DRAM bank information is stored ingd->bd->bi_dram, so reserve lmb according togd->bd->bi_dram.
--- common/bootm.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
common/bootm.c +10 -3
@@ -53,16 +53,23 @@ __weak void board_quiesce_devices(void)#ifdef CONFIG_LMB static void boot_start_lmb (bootm_headers_t *images) { +lmb_init (&images->lmb); +#ifdef CONFIG_NR_DRAM_BANKS +int i; + +for (i =0 ; i <CONFIG_NR_DRAM_BANKS ; i++) { +lmb_add (&images->lmb, gd->bd->bi_dram[i].start, + gd->bd->bi_dram[i].size); + } +#else ulong mem_start;phys_size_t mem_size; -lmb_init (&images->lmb); - mem_start =env_get_bootm_low (); mem_size =env_get_bootm_size ();lmb_add (&images->lmb, (phys_addr_t )mem_start, mem_size); - +#endif arch_lmb_reserve (&images->lmb);board_lmb_reserve (&images->lmb); }
Signature · 1 line
2.7.4
PATCH 1/1 common: bootm: reserve memory bank
Quoted 31 lines · Jason Zhu
Actually the DRAM is not only seperated in one
bank. The DRAM bank information is stored ingd->bd->bi_dram, so reserve lmb according togd->bd->bi_dram.Signed-off-by Jason Zhu <[email protected]>--- common/bootm.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)common/bootm.c +9
-1@@ -53,16 +53,23 @@ __weak void board_quiesce_devices(void)#ifdef CONFIG_LMB static void boot_start_lmb (bootm_headers_t *images) { +lmb_init (&images->lmb); +#ifdef CONFIG_NR_DRAM_BANKS +int i; + +for (i =0 ; i <CONFIG_NR_DRAM_BANKS ; i++) { +lmb_add (&images->lmb, gd->bd->bi_dram[i].start, + gd->bd->bi_dram[i].size); + } +#else ulong mem_start;phys_size_t mem_size; -lmb_init (&images->lmb);
common/bootm.c __weak void board_quiesce_devices(void) · line 75
Quoted 10 lines
common/bootm.c +1
-2- mem_start =env_get_bootm_low (); mem_size =env_get_bootm_size ();lmb_add (&images->lmb, (phys_addr_t )mem_start, mem_size); - +#endif arch_lmb_reserve (&images->lmb);board_lmb_reserve (&images->lmb); }
Can you describe a bit how you ran into this problem? Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180618/ae0c2d01/attachment.sig>
PATCH 1/1 common: bootm: reserve memory bank
Quoted 31 lines
Actually the DRAM is not only seperated in one
bank. The DRAM bank information is stored ingd->bd->bi_dram, so reserve lmb according togd->bd->bi_dram.Signed-off-by Jason Zhu <[email protected]>--- common/bootm.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)common/bootm.c +9
-1@@ -53,16 +53,23 @@ __weak void board_quiesce_devices(void)#ifdef CONFIG_LMB static void boot_start_lmb (bootm_headers_t *images) { +lmb_init (&images->lmb); +#ifdef CONFIG_NR_DRAM_BANKS +int i; + +for (i =0 ; i <CONFIG_NR_DRAM_BANKS ; i++) { +lmb_add (&images->lmb, gd->bd->bi_dram[i].start, + gd->bd->bi_dram[i].size); + } +#else ulong mem_start;phys_size_t mem_size; -lmb_init (&images->lmb);
common/bootm.c __weak void board_quiesce_devices(void) · line 75
Quoted 10 lines
common/bootm.c +1
-2- mem_start =env_get_bootm_low (); mem_size =env_get_bootm_size ();lmb_add (&images->lmb, (phys_addr_t )mem_start, mem_size); - +#endif arch_lmb_reserve (&images->lmb);board_lmb_reserve (&images->lmb); }
Can you describe a bit how you ran into this problem? Thanks!
Quoted 7 lines
Run the function
dram_init_banksize, then the dram is seperated in several
banks. Sometimes the bank0's size maybe zero. If we callboot_start_lmbto reserve lmb which just only reserve bank0, the lmb's memory size is zero. This can cause allocate memory error when we want to reserve lmb for fdt. So reserve lmb depend onCONFIG_NR_DRAM_BANKS(function dram_init_banksize seperates the dram by CONFIG_NR_DRAM_BANKS)but not just bank0. Thanks!
jason.zhu at rock-chips.com
From: Tom Rini
Date: 2018-06-19 03:02
To: Jason Zhu
CC: Simon Glass; u-boot; Alexander Graf
Subject: Re: [U-Boot] [PATCH] common: bootm: reserve memory bank
Quoted 31 lines · Jason Zhu
Actually the DRAM is not only seperated in one
bank. The DRAM bank information is stored ingd->bd->bi_dram, so reserve lmb according togd->bd->bi_dram.Signed-off-by Jason Zhu <[email protected]>--- common/bootm.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)common/bootm.c +9
-1@@ -53,16 +53,23 @@ __weak void board_quiesce_devices(void)#ifdef CONFIG_LMB static void boot_start_lmb (bootm_headers_t *images) { +lmb_init (&images->lmb); +#ifdef CONFIG_NR_DRAM_BANKS +int i; + +for (i =0 ; i <CONFIG_NR_DRAM_BANKS ; i++) { +lmb_add (&images->lmb, gd->bd->bi_dram[i].start, + gd->bd->bi_dram[i].size); + } +#else ulong mem_start;phys_size_t mem_size; -lmb_init (&images->lmb);
common/bootm.c __weak void board_quiesce_devices(void) · line 75
Quoted 10 lines
common/bootm.c +1
-2- mem_start =env_get_bootm_low (); mem_size =env_get_bootm_size ();lmb_add (&images->lmb, (phys_addr_t )mem_start, mem_size); - +#endif arch_lmb_reserve (&images->lmb);board_lmb_reserve (&images->lmb); }
Can you describe a bit how you ran into this problem? Thanks!
Signature · 1 line
Tom
PATCH 1/1 common: bootm: reserve memory bank
In reply to Jason ZhuHi Jason,
Quoted 4 lines · Jason Zhu
Actually the DRAM is not only seperated in one
bank. The DRAM bank information is stored ingd->bd->bi_dram, so reserve lmb according togd->bd->bi_dram.
This commit message is not clear enough for what you have done in this patch,
you should mention the LMB is not correctly mapped when DRAM has more than 1 bank.
Quoted 15 lines
Signed-off-by Jason Zhu <[email protected]>--- common/bootm.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)common/bootm.c +1
-0@@ -53,16 +53,23 @@ __weak void board_quiesce_devices(void)#ifdef CONFIG_LMB static void boot_start_lmb (bootm_headers_t *images) { +lmb_init (&images->lmb);
common/bootm.c __weak void board_quiesce_devices(void) · line 66
Quoted 10 lines
common/bootm.c +8
-0+#ifdef CONFIG_NR_DRAM_BANKS +int i; + +for (i =0 ; i <CONFIG_NR_DRAM_BANKS ; i++) { +lmb_add (&images->lmb, gd->bd->bi_dram[i].start, + gd->bd->bi_dram[i].size); + } +#else ulong mem_start;phys_size_t mem_size;
For the config without CONFIG_NR_DRAM_BANKS enable, there will be a warning.
Thanks,
- Kever
Quoted 12 lines
common/bootm.c +1
-3-lmb_init (&images->lmb); - mem_start =env_get_bootm_low (); mem_size =env_get_bootm_size ();lmb_add (&images->lmb, (phys_addr_t )mem_start, mem_size); - +#endif arch_lmb_reserve (&images->lmb);board_lmb_reserve (&images->lmb); }