diff mbox series

[v2,3/3] spl: spl_legacy: Fix spl_end address

Message ID 20230701023053.747972-3-festevam@gmail.com
State Accepted
Commit 1b8a1be1a1f143ce6294e2dcd5244d995cdba8cf
Delegated to: Tom Rini
Headers show
Series [v2,1/3] sunxi: u-boot-spl.lds: Pass _image_binary_end | expand

Commit Message

Fabio Estevam July 1, 2023, 2:30 a.m. UTC
From: Fabio Estevam <festevam@denx.de>

Currently, spl_end points to the __bss_end address, which
is an external RAM address instead of the end of the SPL text
section in the internal RAM.

This causes boot failures on imx6-colibri, for example:

```
Trying to boot from MMC1
SPL: Image overlaps SPL
resetting ...
```
Fix this problem by assigning spl_end to _image_binary_end, as this
symbol properly represents the end of the SPL text section.

From u-boot-spl.map:

.end
 *(.__end)
                0x00000000009121a4                _image_binary_end = .

Fixes: 77aed22b48ab ("spl: spl_legacy: Add extra address checks")
Reported-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Fabio Estevam <festevam@denx.de>
Tested-by: Tom Rini <trini@konsulko.com>
---
Changes since v1:
- None.

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

Comments

Marek Vasut July 1, 2023, 1:11 p.m. UTC | #1
On 7/1/23 04:30, Fabio Estevam wrote:
> From: Fabio Estevam <festevam@denx.de>
> 
> Currently, spl_end points to the __bss_end address, which
> is an external RAM address instead of the end of the SPL text
> section in the internal RAM.
> 
> This causes boot failures on imx6-colibri, for example:
> 
> ```
> Trying to boot from MMC1
> SPL: Image overlaps SPL
> resetting ...
> ```
> Fix this problem by assigning spl_end to _image_binary_end, as this
> symbol properly represents the end of the SPL text section.
> 
>>From u-boot-spl.map:
> 
> .end
>   *(.__end)
>                  0x00000000009121a4                _image_binary_end = .
> 
> Fixes: 77aed22b48ab ("spl: spl_legacy: Add extra address checks")
> Reported-by: Francesco Dolcini <francesco.dolcini@toradex.com>
> Signed-off-by: Fabio Estevam <festevam@denx.de>
> Tested-by: Tom Rini <trini@konsulko.com>

Reviewed-by: Marek Vasut <marex@denx.de>
Tested-by: Marek Vasut <marex@denx.de> # DH i.MX6Q DHCOM PDK2
Tom Rini July 3, 2023, 6:28 p.m. UTC | #2
On Fri, Jun 30, 2023 at 11:30:53PM -0300, Fabio Estevam wrote:

> From: Fabio Estevam <festevam@denx.de>
> 
> Currently, spl_end points to the __bss_end address, which
> is an external RAM address instead of the end of the SPL text
> section in the internal RAM.
> 
> This causes boot failures on imx6-colibri, for example:
> 
> ```
> Trying to boot from MMC1
> SPL: Image overlaps SPL
> resetting ...
> ```
> Fix this problem by assigning spl_end to _image_binary_end, as this
> symbol properly represents the end of the SPL text section.
> 
> From u-boot-spl.map:
> 
> .end
>  *(.__end)
>                 0x00000000009121a4                _image_binary_end = .
> 
> Fixes: 77aed22b48ab ("spl: spl_legacy: Add extra address checks")
> Reported-by: Francesco Dolcini <francesco.dolcini@toradex.com>
> Signed-off-by: Fabio Estevam <festevam@denx.de>
> Tested-by: Tom Rini <trini@konsulko.com>
> Reviewed-by: Marek Vasut <marex@denx.de>
> Tested-by: Marek Vasut <marex@denx.de> # DH i.MX6Q DHCOM PDK2

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/common/spl/spl_legacy.c b/common/spl/spl_legacy.c
index d34bc5492e8d..095443c63d8d 100644
--- a/common/spl/spl_legacy.c
+++ b/common/spl/spl_legacy.c
@@ -19,7 +19,7 @@ 
 static void spl_parse_legacy_validate(uintptr_t start, uintptr_t size)
 {
 	uintptr_t spl_start = (uintptr_t)_start;
-	uintptr_t spl_end = (uintptr_t)__bss_end;
+	uintptr_t spl_end = (uintptr_t)_image_binary_end;
 	uintptr_t end = start + size;
 
 	if ((start >= spl_start && start < spl_end) ||