ARM: bootm: take into account gd->ram_top
PATCH 1/1 ARM: bootm: take into account gd->ram_top
From: Patrice Chotard <[email protected]>
If gd->ram_top has been tuned using board_get_usable_ram_top(), it must be taken into account when reserving arch lmb.
---
arch/arm/lib/bootm.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/lib/bootm.c +3 -0
@@ -75,6 +75,9 @@ void arch_lmb_reserve(struct lmb *lmb) gd->bd->bi_dram[bank].size -1 ;if (sp > bank_end)continue ; +if (bank_end > gd->ram_top) + bank_end = gd->ram_top -1 ; +lmb_reserve (lmb, sp, bank_end - sp +1 );break ; }
Signature · 1 line
2.17.1
PATCH 1/1 ARM: bootm: take into account gd->ram_top
Hi Patrick,
Quoted 6 lines · Patrick Delaunay
From: Patrice Chotard <[email protected]>
If
gd->ram_tophas been tuned usingboard_get_usable_ram_top(), it must be taken into account when reserving arch lmb.
Quoted 7 lines
Signed-off-by Patrice Chotard <[email protected]>Reviewed-by Patrick DELAUNAY <[email protected]>Signed-off-by Patrick Delaunay <[email protected]>---
arch/arm/lib/bootm.c | 3 +++ 1 file changed, 3 insertions(+)
Is this something we can test in test/lib/lmb.c ?
Regards,
Simon
PATCH 1/1 ARM: bootm: take into account gd->ram_top
Hi Simon,
Quoted 18 lines
From: Simon Glass <[email protected]>
Sent: vendredi 14 f?vrier 2020 20:17Hi Patrick,
Quoted 11 lines · Patrick Delaunay
From: Patrice Chotard <[email protected]>
If
gd->ram_tophas been tuned usingboard_get_usable_ram_top(), it must be taken into account when reserving arch lmb.Signed-off-by Patrice Chotard <[email protected]>Reviewed-by Patrick DELAUNAY <[email protected]>Signed-off-by Patrick Delaunay <[email protected]>---
Quoted 4 lines
Quoted 2 lines
arch/arm/lib/bootm.c | 3 +++ 1 file changed, 3 insertions(+)Is this something we can test in
test/lib/lmb.c?
I check these tests, and for me it is not possible, as I change the ARM part for bootm lib (limit the reserved size by u-boot to avoid conflict wxith other reserved memory) and not the lmb generic code...
I don't see how to test it in sandbox.
Quoted 2 lines
Regards,
Simon
Regards
Patrick
PATCH 1/1 ARM: bootm: take into account gd->ram_top
In reply to Patrick DelaunayQuoted 8 lines · Patrick Delaunay
From: Patrice Chotard <[email protected]>
If
gd->ram_tophas been tuned usingboard_get_usable_ram_top(), it must be taken into account when reserving arch lmb.Signed-off-by Patrice Chotard <[email protected]>Reviewed-by Patrick DELAUNAY <[email protected]>Signed-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200421/deb4f93c/attachment.sig>
PATCH 1/1 ARM: bootm: take into account gd->ram_top
In reply to Patrick DelaunayHi Patrick, all,
Quoted 8 lines · Patrick Delaunay
From: Patrice Chotard <[email protected]>
If
gd->ram_tophas been tuned usingboard_get_usable_ram_top(), it must be taken into account when reserving arch lmb.Signed-off-by Patrice Chotard <[email protected]>Reviewed-by Patrick DELAUNAY <[email protected]>Signed-off-by Patrick Delaunay <[email protected]>
[snip]
arch/arm/lib/bootm.c void arch_lmb_reserve(struct lmb *lmb) · line 80
Quoted 11 lines
arch/arm/lib/bootm.c +3
-0@@ -75,6 +75,9 @@ void arch_lmb_reserve(struct lmb *lmb) gd->bd->bi_dram[bank].size -1 ;if (sp > bank_end)continue ; +if (bank_end > gd->ram_top) + bank_end = gd->ram_top -1 ; +
This patch (now committed as 8ce1f10cf2b1) breaks kernel boot on Armada 8040 based Clearfog GT-8K with 16GB RAM. See below the console output of v2020.10-rc2 with a few added prints.
The first memory bank (bi_dram[0]) goes from 0 to 3GB. The rest (4GB-17GB) is on bi_dram[1] (see a8k_dram_init_banksize()). ram_top is set to 2GB on arch/arm/mach-mvebu/arm64-common.c:board_get_usable_ram_top().
Reverting commit 8ce1f10cf2b1 on top of v2020.10-rc2 fixes boot.
Any Idea?
Found /extlinux/extlinux.conf
Retrieving file: /extlinux/extlinux.conf
## Current stack ends at 0x7fb24300arch_lmb_reserve: bank_end: bfffffff ram_top: 80000000
62 bytes read in 21 ms (2 KiB/s)
1: linux
Retrieving file: /extlinux/Image
## Current stack ends at 0x7fb23960arch_lmb_reserve: bank_end: bfffffff ram_top: 80000000
13740544 bytes read in 1266 ms (10.4 MiB/s)
Retrieving file: /extlinux/armada-8040-clearfog-gt-8k.dtb
## Current stack ends at 0x7fb23960arch_lmb_reserve: bank_end: bfffffff ram_top: 80000000
33368 bytes read in 31 ms (1 MiB/s)
## Current stack ends at 0x7fb23cd0arch_lmb_reserve: bank_end: bfffffff ram_top: 80000000
## Flattened Device Tree blob at 04f00000
Booting using the fdt blob at 0x4f00000
Loading Device Tree to 00000000bfff4000, end 00000000bffff257 ... "Synchronous Abort" handler, esr 0x96000045
elr: 000000000006e1cc lr : 0000000000068fd8 (reloc)
elr: 000000007ffa91cc lr : 000000007ffa3fd8
x0 : ffffffffffffffff x1 : 00000000bfffc258
x2 : 0000000000000000 x3 : ffffffffffff7da7
x4 : 0000000004f08258 x5 : 00000000bfff4000
x6 : 00000000bfff4000 x7 : 000000000000000f
x8 : 000000007fb23bf8 x9 : 0000000000000008
x10: 00000000bffff257 x11: 00000000bffff257
x12: 0000000000000000 x13: fffffffffffff000
x14: 00000000bfff4000 x15: 0000000000000021
x16: 000000007ff7bc38 x17: 0000000000000000
x18: 000000007fb2add0 x19: 00000000bfff4000
x20: 0000000004f00000 x21: 000000000000b258
x22: 0000000058820000 x23: 0000000000000010
x24: 000000007ffe3c40 x25: 000000007fb23cb8
x26: 00000000c0000000 x27: 0000000000000000
x28: 000000007fc3fd50 x29: 000000007fb23bd0
Code: 54000061 aa0603e0 d65f03c0 38606882 (38206822)
Resetting CPU ...
Thanks,
baruch
Quoted 3 lines
arch/arm/lib/bootm.c +0
-0lmb_reserve (lmb, sp, bank_end - sp +1 );break ; }
Signature · 3 lines
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -PATCH 1/1 ARM: bootm: take into account gd->ram_top
Hi Baruch
Quoted 27 lines · Baruch Siach
Hi Patrick, all,
Quoted 8 lines · Patrick Delaunay
From: Patrice Chotard <[email protected]>
If
gd->ram_tophas been tuned usingboard_get_usable_ram_top(), it must be taken into account when reserving arch lmb.Signed-off-by Patrice Chotard <[email protected]>Reviewed-by Patrick DELAUNAY <[email protected]>Signed-off-by Patrick Delaunay <[email protected]>[snip]
arch/arm/lib/bootm.c void arch_lmb_reserve(struct lmb *lmb) · line 80
Quoted 11 lines
arch/arm/lib/bootm.c +3
-0@@ -75,6 +75,9 @@ void arch_lmb_reserve(struct lmb *lmb) gd->bd->bi_dram[bank].size -1 ;if (sp > bank_end)continue ; +if (bank_end > gd->ram_top) + bank_end = gd->ram_top -1 ; +This patch (now committed as
8ce1f10cf2b1) breaks kernel boot on Armada 8040 based Clearfog GT-8K with 16GB RAM. See below the console output of v2020.10-rc2 with a few added prints.
Quoted 4 lines
The first memory bank (bi_dram[0]) goes from 0 to 3GB. The rest (4GB-17GB) is on bi_dram[1] (see
a8k_dram_init_banksize()).ram_topis set to 2GB on arch/arm/mach-mvebu/arm64-common.c:board_get_usable_ram_top().
If i have correctly understood, before this patch, on your platform U-boot was using a memory area over
the ram_top limit set to 2Gb ? which is not correct.
You probably have to rework the platform memory mapping in order to either
_ make all needed memory area fit inside the ram_top limit (2Gb)
or
_ increase the ram_top limit over 2Gb.
It's only assumption as i don't know your platform.
Patrice
Quoted 51 lines
Reverting commit
8ce1f10cf2b1on top of v2020.10-rc2 fixes boot.Any Idea?
Found /extlinux/extlinux.conf
Retrieving file: /extlinux/extlinux.conf
## Current stack ends at0x7fb24300arch_lmb_reserve:bank_end: bfffffffram_top: 80000000
62 bytes read in 21 ms (2 KiB/s)
1: linux
Retrieving file: /extlinux/Image
## Current stack ends at0x7fb23960arch_lmb_reserve:bank_end: bfffffffram_top: 80000000
13740544 bytes read in 1266 ms (10.4 MiB/s)
Retrieving file: /extlinux/armada-8040-clearfog-gt-8k.dtb
## Current stack ends at0x7fb23960arch_lmb_reserve:bank_end: bfffffffram_top: 80000000
33368 bytes read in 31 ms (1 MiB/s)
## Current stack ends at0x7fb23cd0arch_lmb_reserve:bank_end: bfffffffram_top: 80000000
## Flattened Device Tree blob at04f00000
Booting using the fdt blob at0x4f00000
Loading Device Tree to00000000bfff4000, end00000000bffff257... "Synchronous Abort" handler, esr0x96000045
elr:000000000006e1cclr :0000000000068fd8(reloc)
elr:000000007ffa91cclr :000000007ffa3fd8
x0 : ffffffffffffffff x1 :00000000bfffc258
x2 : 0000000000000000 x3 :ffffffffffff7da7
x4 :0000000004f08258x5 :00000000bfff4000
x6 :00000000bfff4000x7 :000000000000000f
x8 :000000007fb23bf8x9 : 0000000000000008
x10:00000000bffff257x11:00000000bffff257
x12: 0000000000000000 x13:fffffffffffff000
x14:00000000bfff4000x15: 0000000000000021
x16:000000007ff7bc38x17: 0000000000000000
x18:000000007fb2add0x19:00000000bfff4000
x20:0000000004f00000x21:000000000000b258
x22: 0000000058820000 x23: 0000000000000010
x24:000000007ffe3c40x25:000000007fb23cb8
x26:00000000c0000000x27: 0000000000000000
x28:000000007fc3fd50x29:000000007fb23bd0Code: 54000061 aa0603e0 d65f03c0 38606882 (38206822)Resetting CPU ...
Thanks,
baruchQuoted 3 lines
arch/arm/lib/bootm.c +0
-0lmb_reserve (lmb, sp, bank_end - sp +1 );break ; }