mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: i.MX8M: limit PBL size to 0x3f000
@ 2023-10-20 12:17 Ahmad Fatoum
  2023-10-20 13:03 ` Marco Felsch
  2023-10-23  9:47 ` Sascha Hauer
  0 siblings, 2 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2023-10-20 12:17 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

On i.MX8M(Q/M/N/P), barebox PBL is loaded 0x1000 bytes into ITCM
at address 0x7e00_1000. ITCM is 128K followed by 128K of DTCM.

Therefore, in total, barebox PBL may not exceed 0x3f000. Now that we
have a common macro for defining boards, let's add a
MAX_PBL_MEMORY_SIZE_$(entrypoint) into it, so check that we don't
exceed this size at runtime.

Boards that trip over this, should consider using get_builtin_firmware_ext
to offload binaries into barebox proper.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 images/Makefile.imx | 1 +
 1 file changed, 1 insertion(+)

diff --git a/images/Makefile.imx b/images/Makefile.imx
index 50f0a64b3091..ca09853c4b6e 100644
--- a/images/Makefile.imx
+++ b/images/Makefile.imx
@@ -26,6 +26,7 @@ $(eval
 ifeq ($($(strip $(1))), y)
 	pblb-y += $(strip $(2))
 	CFG_$(strip $(2)).pblb.imximg = $(board)/$(strip $(3)).imxcfg
+	MAX_PBL_MEMORY_SIZE_$(strip $(2)) = 0x3f000
 	FILE_barebox-$(strip $(4)).img    = $(strip $(2)).pblb.pimximg
 	FILE_barebox-$(strip $(4))-s.img  = $(strip $(2)).pblb.psimximg
 	image-y += barebox-$(strip $(4)).img
-- 
2.39.2




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

* Re: [PATCH] ARM: i.MX8M: limit PBL size to 0x3f000
  2023-10-20 12:17 [PATCH] ARM: i.MX8M: limit PBL size to 0x3f000 Ahmad Fatoum
@ 2023-10-20 13:03 ` Marco Felsch
  2023-10-20 13:08   ` Ahmad Fatoum
  2023-10-23  9:47 ` Sascha Hauer
  1 sibling, 1 reply; 5+ messages in thread
From: Marco Felsch @ 2023-10-20 13:03 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On 23-10-20, Ahmad Fatoum wrote:
> On i.MX8M(Q/M/N/P), barebox PBL is loaded 0x1000 bytes into ITCM

Nit: only the i.MX8MQ-EVK was converted. Don't know if the rest is
broken since they don't use the pblb (PBL only).

> at address 0x7e00_1000. ITCM is 128K followed by 128K of DTCM.
> 
> Therefore, in total, barebox PBL may not exceed 0x3f000. Now that we
> have a common macro for defining boards, let's add a
> MAX_PBL_MEMORY_SIZE_$(entrypoint) into it, so check that we don't
> exceed this size at runtime.
> 
> Boards that trip over this, should consider using get_builtin_firmware_ext
> to offload binaries into barebox proper.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>

> ---
>  images/Makefile.imx | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/images/Makefile.imx b/images/Makefile.imx
> index 50f0a64b3091..ca09853c4b6e 100644
> --- a/images/Makefile.imx
> +++ b/images/Makefile.imx
> @@ -26,6 +26,7 @@ $(eval
>  ifeq ($($(strip $(1))), y)
>  	pblb-y += $(strip $(2))
>  	CFG_$(strip $(2)).pblb.imximg = $(board)/$(strip $(3)).imxcfg
> +	MAX_PBL_MEMORY_SIZE_$(strip $(2)) = 0x3f000
>  	FILE_barebox-$(strip $(4)).img    = $(strip $(2)).pblb.pimximg
>  	FILE_barebox-$(strip $(4))-s.img  = $(strip $(2)).pblb.psimximg
>  	image-y += barebox-$(strip $(4)).img
> -- 
> 2.39.2
> 
> 
> 



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

* Re: [PATCH] ARM: i.MX8M: limit PBL size to 0x3f000
  2023-10-20 13:03 ` Marco Felsch
@ 2023-10-20 13:08   ` Ahmad Fatoum
  2023-10-20 13:19     ` Marco Felsch
  0 siblings, 1 reply; 5+ messages in thread
From: Ahmad Fatoum @ 2023-10-20 13:08 UTC (permalink / raw)
  To: Marco Felsch; +Cc: barebox

On 20.10.23 15:03, Marco Felsch wrote:
> On 23-10-20, Ahmad Fatoum wrote:
>> On i.MX8M(Q/M/N/P), barebox PBL is loaded 0x1000 bytes into ITCM
> 
> Nit: only the i.MX8MQ-EVK was converted. Don't know if the rest is
> broken since they don't use the pblb (PBL only).

I can't follow what you mean with "don't use the pblb (PBL only)",
but the other three 8MQ boards already have a MAX_PBL_MEMORY_SIZE,
so as far as this patch is concerned, there's nothing further to do.

> 
>> at address 0x7e00_1000. ITCM is 128K followed by 128K of DTCM.
>>
>> Therefore, in total, barebox PBL may not exceed 0x3f000. Now that we
>> have a common macro for defining boards, let's add a
>> MAX_PBL_MEMORY_SIZE_$(entrypoint) into it, so check that we don't
>> exceed this size at runtime.
>>
>> Boards that trip over this, should consider using get_builtin_firmware_ext
>> to offload binaries into barebox proper.
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> 
> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
> 
>> ---
>>  images/Makefile.imx | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/images/Makefile.imx b/images/Makefile.imx
>> index 50f0a64b3091..ca09853c4b6e 100644
>> --- a/images/Makefile.imx
>> +++ b/images/Makefile.imx
>> @@ -26,6 +26,7 @@ $(eval
>>  ifeq ($($(strip $(1))), y)
>>  	pblb-y += $(strip $(2))
>>  	CFG_$(strip $(2)).pblb.imximg = $(board)/$(strip $(3)).imxcfg
>> +	MAX_PBL_MEMORY_SIZE_$(strip $(2)) = 0x3f000
>>  	FILE_barebox-$(strip $(4)).img    = $(strip $(2)).pblb.pimximg
>>  	FILE_barebox-$(strip $(4))-s.img  = $(strip $(2)).pblb.psimximg
>>  	image-y += barebox-$(strip $(4)).img
>> -- 
>> 2.39.2
>>
>>
>>
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




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

* Re: [PATCH] ARM: i.MX8M: limit PBL size to 0x3f000
  2023-10-20 13:08   ` Ahmad Fatoum
@ 2023-10-20 13:19     ` Marco Felsch
  0 siblings, 0 replies; 5+ messages in thread
From: Marco Felsch @ 2023-10-20 13:19 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On 23-10-20, Ahmad Fatoum wrote:
> On 20.10.23 15:03, Marco Felsch wrote:
> > On 23-10-20, Ahmad Fatoum wrote:
> >> On i.MX8M(Q/M/N/P), barebox PBL is loaded 0x1000 bytes into ITCM
> > 
> > Nit: only the i.MX8MQ-EVK was converted. Don't know if the rest is
> > broken since they don't use the pblb (PBL only).
> 
> I can't follow what you mean with "don't use the pblb (PBL only)",
> but the other three 8MQ boards already have a MAX_PBL_MEMORY_SIZE,
> so as far as this patch is concerned, there's nothing further to do.

Sorry for the confusion, they use ".imximg" instead of ".pimximg". Not
sure if this is correct and you're right they already do have the
MAX_PBL_MEMORY_SIZE defined. I just wanted to point out that not all
i.MX8MQ images do use the new macro.

Regards,
  Marco

> >> at address 0x7e00_1000. ITCM is 128K followed by 128K of DTCM.
> >>
> >> Therefore, in total, barebox PBL may not exceed 0x3f000. Now that we
> >> have a common macro for defining boards, let's add a
> >> MAX_PBL_MEMORY_SIZE_$(entrypoint) into it, so check that we don't
> >> exceed this size at runtime.
> >>
> >> Boards that trip over this, should consider using get_builtin_firmware_ext
> >> to offload binaries into barebox proper.
> >>
> >> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> > 
> > Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
> > 
> >> ---
> >>  images/Makefile.imx | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/images/Makefile.imx b/images/Makefile.imx
> >> index 50f0a64b3091..ca09853c4b6e 100644
> >> --- a/images/Makefile.imx
> >> +++ b/images/Makefile.imx
> >> @@ -26,6 +26,7 @@ $(eval
> >>  ifeq ($($(strip $(1))), y)
> >>  	pblb-y += $(strip $(2))
> >>  	CFG_$(strip $(2)).pblb.imximg = $(board)/$(strip $(3)).imxcfg
> >> +	MAX_PBL_MEMORY_SIZE_$(strip $(2)) = 0x3f000
> >>  	FILE_barebox-$(strip $(4)).img    = $(strip $(2)).pblb.pimximg
> >>  	FILE_barebox-$(strip $(4))-s.img  = $(strip $(2)).pblb.psimximg
> >>  	image-y += barebox-$(strip $(4)).img
> >> -- 
> >> 2.39.2
> >>
> >>
> >>
> > 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 
> 



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

* Re: [PATCH] ARM: i.MX8M: limit PBL size to 0x3f000
  2023-10-20 12:17 [PATCH] ARM: i.MX8M: limit PBL size to 0x3f000 Ahmad Fatoum
  2023-10-20 13:03 ` Marco Felsch
@ 2023-10-23  9:47 ` Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2023-10-23  9:47 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Fri, Oct 20, 2023 at 02:17:10PM +0200, Ahmad Fatoum wrote:
> On i.MX8M(Q/M/N/P), barebox PBL is loaded 0x1000 bytes into ITCM
> at address 0x7e00_1000. ITCM is 128K followed by 128K of DTCM.
> 
> Therefore, in total, barebox PBL may not exceed 0x3f000. Now that we
> have a common macro for defining boards, let's add a
> MAX_PBL_MEMORY_SIZE_$(entrypoint) into it, so check that we don't
> exceed this size at runtime.
> 
> Boards that trip over this, should consider using get_builtin_firmware_ext
> to offload binaries into barebox proper.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  images/Makefile.imx | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks

Sascha

> 
> diff --git a/images/Makefile.imx b/images/Makefile.imx
> index 50f0a64b3091..ca09853c4b6e 100644
> --- a/images/Makefile.imx
> +++ b/images/Makefile.imx
> @@ -26,6 +26,7 @@ $(eval
>  ifeq ($($(strip $(1))), y)
>  	pblb-y += $(strip $(2))
>  	CFG_$(strip $(2)).pblb.imximg = $(board)/$(strip $(3)).imxcfg
> +	MAX_PBL_MEMORY_SIZE_$(strip $(2)) = 0x3f000
>  	FILE_barebox-$(strip $(4)).img    = $(strip $(2)).pblb.pimximg
>  	FILE_barebox-$(strip $(4))-s.img  = $(strip $(2)).pblb.psimximg
>  	image-y += barebox-$(strip $(4)).img
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

end of thread, other threads:[~2023-10-23  9:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-20 12:17 [PATCH] ARM: i.MX8M: limit PBL size to 0x3f000 Ahmad Fatoum
2023-10-20 13:03 ` Marco Felsch
2023-10-20 13:08   ` Ahmad Fatoum
2023-10-20 13:19     ` Marco Felsch
2023-10-23  9:47 ` Sascha Hauer

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