public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v2 1/3] sunxi: u-boot-spl.lds: Pass _image_binary_end
@ 2023-07-01  2:30 Fabio Estevam
  2023-07-01  2:30 ` [PATCH v2 2/3] microblaze: " Fabio Estevam
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Fabio Estevam @ 2023-07-01  2:30 UTC (permalink / raw)
  To: trini; +Cc: marex, u-boot, francesco.dolcini, Fabio Estevam

From: Fabio Estevam <festevam@denx.de>

Pass _image_binary_end to make a standard way to indicate the end
of the text section in SPL.

The motivation for this is to have a uniform way to handle
the SPL boundary checks.

Signed-off-by: Fabio Estevam <festevam@denx.de>
---
Changes since v1:
- Newly introduced to avoid build failure.

 arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds | 1 +
 arch/arm/cpu/armv7/sunxi/u-boot-spl.lds     | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds b/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds
index c10873681157..cf65e8c46281 100644
--- a/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds
+++ b/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds
@@ -36,6 +36,7 @@ SECTIONS
 	. = ALIGN(4);
 	__image_copy_end = .;
 	_end = .;
+	_image_binary_end = .;
 
 	.bss :
 	{
diff --git a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
index 306a4ddf3cd2..fb7a789b28b8 100644
--- a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
+++ b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
@@ -45,6 +45,7 @@ SECTIONS
 	. = ALIGN(4);
 	__image_copy_end = .;
 	_end = .;
+	_image_binary_end = .;
 
 	.bss :
 	{
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/3] microblaze: u-boot-spl.lds: Pass _image_binary_end
  2023-07-01  2:30 [PATCH v2 1/3] sunxi: u-boot-spl.lds: Pass _image_binary_end Fabio Estevam
@ 2023-07-01  2:30 ` Fabio Estevam
  2023-07-01 13:06   ` Marek Vasut
  2023-07-03 18:28   ` Tom Rini
  2023-07-01  2:30 ` [PATCH v2 3/3] spl: spl_legacy: Fix spl_end address Fabio Estevam
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Fabio Estevam @ 2023-07-01  2:30 UTC (permalink / raw)
  To: trini; +Cc: marex, u-boot, francesco.dolcini, Fabio Estevam

From: Fabio Estevam <festevam@denx.de>

Pass _image_binary_end to make a standard way to indicate the end
of the text section in SPL.

The motivation for this is to have a uniform way to handle
the SPL boundary checks.

Signed-off-by: Fabio Estevam <festevam@denx.de>
---
Changes since v1:
- Newly introduced to avoid build failure.

 arch/microblaze/cpu/u-boot-spl.lds | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/microblaze/cpu/u-boot-spl.lds b/arch/microblaze/cpu/u-boot-spl.lds
index 4ac5a21524c5..597095195cae 100644
--- a/arch/microblaze/cpu/u-boot-spl.lds
+++ b/arch/microblaze/cpu/u-boot-spl.lds
@@ -54,6 +54,7 @@ SECTIONS
 		__bss_end = .;
 	}
 	_end = . ;
+	_image_binary_end = .;
 }
 
 #if defined(CONFIG_SPL_MAX_FOOTPRINT)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/3] spl: spl_legacy: Fix spl_end address
  2023-07-01  2:30 [PATCH v2 1/3] sunxi: u-boot-spl.lds: Pass _image_binary_end Fabio Estevam
  2023-07-01  2:30 ` [PATCH v2 2/3] microblaze: " Fabio Estevam
@ 2023-07-01  2:30 ` Fabio Estevam
  2023-07-01 13:11   ` Marek Vasut
  2023-07-03 18:28   ` Tom Rini
  2023-07-01 13:06 ` [PATCH v2 1/3] sunxi: u-boot-spl.lds: Pass _image_binary_end Marek Vasut
  2023-07-03 18:27 ` Tom Rini
  3 siblings, 2 replies; 9+ messages in thread
From: Fabio Estevam @ 2023-07-01  2:30 UTC (permalink / raw)
  To: trini; +Cc: marex, u-boot, francesco.dolcini, Fabio Estevam

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(-)

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) ||
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/3] sunxi: u-boot-spl.lds: Pass _image_binary_end
  2023-07-01  2:30 [PATCH v2 1/3] sunxi: u-boot-spl.lds: Pass _image_binary_end Fabio Estevam
  2023-07-01  2:30 ` [PATCH v2 2/3] microblaze: " Fabio Estevam
  2023-07-01  2:30 ` [PATCH v2 3/3] spl: spl_legacy: Fix spl_end address Fabio Estevam
@ 2023-07-01 13:06 ` Marek Vasut
  2023-07-03 18:27 ` Tom Rini
  3 siblings, 0 replies; 9+ messages in thread
From: Marek Vasut @ 2023-07-01 13:06 UTC (permalink / raw)
  To: Fabio Estevam, trini; +Cc: u-boot, francesco.dolcini, Fabio Estevam

On 7/1/23 04:30, Fabio Estevam wrote:
> From: Fabio Estevam <festevam@denx.de>
> 
> Pass _image_binary_end to make a standard way to indicate the end
> of the text section in SPL.
> 
> The motivation for this is to have a uniform way to handle
> the SPL boundary checks.
> 
> Signed-off-by: Fabio Estevam <festevam@denx.de>

Reviewed-by: Marek Vasut <marex@denx.de>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/3] microblaze: u-boot-spl.lds: Pass _image_binary_end
  2023-07-01  2:30 ` [PATCH v2 2/3] microblaze: " Fabio Estevam
@ 2023-07-01 13:06   ` Marek Vasut
  2023-07-03 18:28   ` Tom Rini
  1 sibling, 0 replies; 9+ messages in thread
From: Marek Vasut @ 2023-07-01 13:06 UTC (permalink / raw)
  To: Fabio Estevam, trini; +Cc: u-boot, francesco.dolcini, Fabio Estevam

On 7/1/23 04:30, Fabio Estevam wrote:
> From: Fabio Estevam <festevam@denx.de>
> 
> Pass _image_binary_end to make a standard way to indicate the end
> of the text section in SPL.
> 
> The motivation for this is to have a uniform way to handle
> the SPL boundary checks.
> 
> Signed-off-by: Fabio Estevam <festevam@denx.de>

Reviewed-by: Marek Vasut <marex@denx.de>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/3] spl: spl_legacy: Fix spl_end address
  2023-07-01  2:30 ` [PATCH v2 3/3] spl: spl_legacy: Fix spl_end address Fabio Estevam
@ 2023-07-01 13:11   ` Marek Vasut
  2023-07-03 18:28   ` Tom Rini
  1 sibling, 0 replies; 9+ messages in thread
From: Marek Vasut @ 2023-07-01 13:11 UTC (permalink / raw)
  To: Fabio Estevam, trini; +Cc: u-boot, francesco.dolcini, Fabio Estevam

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/3] sunxi: u-boot-spl.lds: Pass _image_binary_end
  2023-07-01  2:30 [PATCH v2 1/3] sunxi: u-boot-spl.lds: Pass _image_binary_end Fabio Estevam
                   ` (2 preceding siblings ...)
  2023-07-01 13:06 ` [PATCH v2 1/3] sunxi: u-boot-spl.lds: Pass _image_binary_end Marek Vasut
@ 2023-07-03 18:27 ` Tom Rini
  3 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2023-07-03 18:27 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: marex, u-boot, francesco.dolcini, Fabio Estevam

[-- Attachment #1: Type: text/plain, Size: 454 bytes --]

On Fri, Jun 30, 2023 at 11:30:51PM -0300, Fabio Estevam wrote:

> From: Fabio Estevam <festevam@denx.de>
> 
> Pass _image_binary_end to make a standard way to indicate the end
> of the text section in SPL.
> 
> The motivation for this is to have a uniform way to handle
> the SPL boundary checks.
> 
> Signed-off-by: Fabio Estevam <festevam@denx.de>
> Reviewed-by: Marek Vasut <marex@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/3] microblaze: u-boot-spl.lds: Pass _image_binary_end
  2023-07-01  2:30 ` [PATCH v2 2/3] microblaze: " Fabio Estevam
  2023-07-01 13:06   ` Marek Vasut
@ 2023-07-03 18:28   ` Tom Rini
  1 sibling, 0 replies; 9+ messages in thread
From: Tom Rini @ 2023-07-03 18:28 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: marex, u-boot, francesco.dolcini, Fabio Estevam

[-- Attachment #1: Type: text/plain, Size: 454 bytes --]

On Fri, Jun 30, 2023 at 11:30:52PM -0300, Fabio Estevam wrote:

> From: Fabio Estevam <festevam@denx.de>
> 
> Pass _image_binary_end to make a standard way to indicate the end
> of the text section in SPL.
> 
> The motivation for this is to have a uniform way to handle
> the SPL boundary checks.
> 
> Signed-off-by: Fabio Estevam <festevam@denx.de>
> Reviewed-by: Marek Vasut <marex@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/3] spl: spl_legacy: Fix spl_end address
  2023-07-01  2:30 ` [PATCH v2 3/3] spl: spl_legacy: Fix spl_end address Fabio Estevam
  2023-07-01 13:11   ` Marek Vasut
@ 2023-07-03 18:28   ` Tom Rini
  1 sibling, 0 replies; 9+ messages in thread
From: Tom Rini @ 2023-07-03 18:28 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: marex, u-boot, francesco.dolcini, Fabio Estevam

[-- Attachment #1: Type: text/plain, Size: 1078 bytes --]

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!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-07-03 18:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-01  2:30 [PATCH v2 1/3] sunxi: u-boot-spl.lds: Pass _image_binary_end Fabio Estevam
2023-07-01  2:30 ` [PATCH v2 2/3] microblaze: " Fabio Estevam
2023-07-01 13:06   ` Marek Vasut
2023-07-03 18:28   ` Tom Rini
2023-07-01  2:30 ` [PATCH v2 3/3] spl: spl_legacy: Fix spl_end address Fabio Estevam
2023-07-01 13:11   ` Marek Vasut
2023-07-03 18:28   ` Tom Rini
2023-07-01 13:06 ` [PATCH v2 1/3] sunxi: u-boot-spl.lds: Pass _image_binary_end Marek Vasut
2023-07-03 18:27 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox