All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SPL: Do not enable SPL_SYS_MALLOC_SIMPLE without SPL_FRAMEWORK by default
@ 2022-04-05  9:28 Pali Rohár
  2022-04-08  8:28 ` [PATCH v2] " Pali Rohár
  0 siblings, 1 reply; 3+ messages in thread
From: Pali Rohár @ 2022-04-05  9:28 UTC (permalink / raw)
  To: Priyanka Jain, Simon Glass, Rick Chen, Andre Przywara,
	Michal Simek, Marek Behún, Sinan Akman
  Cc: u-boot

On P2020 board is SPL malloc simple always failing with error and loops:

  SD boot...
  alloc space exhausted
  Bad trap at PC: f8f8b5f0, SR: 21200, vector=d00
  NIP: 00000000 XER: 00000000 LR: 00000000 REGS: f8f8b5f0 TRAP: 20000000 DAR: 00000000
  MSR: 00021200 EE: 0 PR: 0 FP: 0 ME: 1 IR/DR: 00

  GPR00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  GPR08: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  GPR24: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  Call backtrace:
  Exception in kernel pc f8f8b5f0 signal 0

Inspection showed that gd->malloc_limit is zero. And it is because
generally SPL_FRAMEWORK initialize SPL's gd->malloc_limit. But when
SPL_FRAMEWORK is not enabled then in most cases nobody initialize
gd->malloc_limit and so SPL malloc simple does not work.

So disable SPL_SYS_MALLOC_SIMPLE by default when SPL_FRAMEWORK is not
enabled. SPL_SYS_MALLOC_SIMPLE can be disabled only by setting
SPL_SYS_MALLOC_F_LEN to zero. So do it.

This change fixes SPL error "alloc space exhausted" on P2020 board.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Kconfig b/Kconfig
index 9dd9ec7f6dfb..c36b375835f0 100644
--- a/Kconfig
+++ b/Kconfig
@@ -258,6 +258,7 @@ config SYS_MALLOC_LEN
 config SPL_SYS_MALLOC_F_LEN
 	hex "Size of malloc() pool in SPL"
 	depends on SYS_MALLOC_F && SPL
+	default 0 if !CONFIG_SPL_FRAMEWORK
 	default 0x2800 if RCAR_GEN3
 	default SYS_MALLOC_F_LEN
 	help
-- 
2.20.1


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

* [PATCH v2] SPL: Do not enable SPL_SYS_MALLOC_SIMPLE without SPL_FRAMEWORK by default
  2022-04-05  9:28 [PATCH] SPL: Do not enable SPL_SYS_MALLOC_SIMPLE without SPL_FRAMEWORK by default Pali Rohár
@ 2022-04-08  8:28 ` Pali Rohár
  2022-04-21 23:56   ` Tom Rini
  0 siblings, 1 reply; 3+ messages in thread
From: Pali Rohár @ 2022-04-08  8:28 UTC (permalink / raw)
  To: Priyanka Jain, Simon Glass, Rick Chen, Andre Przywara,
	Michal Simek, Marek Behún, Sinan Akman
  Cc: u-boot

On P2020 board is SPL malloc simple always failing with error and loops:

  SD boot...
  alloc space exhausted
  Bad trap at PC: f8f8b5f0, SR: 21200, vector=d00
  NIP: 00000000 XER: 00000000 LR: 00000000 REGS: f8f8b5f0 TRAP: 20000000 DAR: 00000000
  MSR: 00021200 EE: 0 PR: 0 FP: 0 ME: 1 IR/DR: 00

  GPR00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  GPR08: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  GPR24: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
  Call backtrace:
  Exception in kernel pc f8f8b5f0 signal 0

Inspection showed that gd->malloc_limit is zero. And it is because
generally SPL_FRAMEWORK initialize SPL's gd->malloc_limit. But when
SPL_FRAMEWORK is not enabled then in most cases nobody initialize
gd->malloc_limit and so SPL malloc simple does not work.

So disable SPL_SYS_MALLOC_SIMPLE by default when SPL_FRAMEWORK is not
enabled. SPL_SYS_MALLOC_SIMPLE can be disabled only by setting
SPL_SYS_MALLOC_F_LEN to zero. So do it.

This change fixes SPL error "alloc space exhausted" on P2020 board.

Signed-off-by: Pali Rohár <pali@kernel.org>

---
Changes in v2:
* Fixed name of the config option
---
 Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Kconfig b/Kconfig
index 9dd9ec7f6dfb..e8047eca3b52 100644
--- a/Kconfig
+++ b/Kconfig
@@ -258,6 +258,7 @@ config SYS_MALLOC_LEN
 config SPL_SYS_MALLOC_F_LEN
 	hex "Size of malloc() pool in SPL"
 	depends on SYS_MALLOC_F && SPL
+	default 0 if !SPL_FRAMEWORK
 	default 0x2800 if RCAR_GEN3
 	default SYS_MALLOC_F_LEN
 	help
-- 
2.20.1


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

* Re: [PATCH v2] SPL: Do not enable SPL_SYS_MALLOC_SIMPLE without SPL_FRAMEWORK by default
  2022-04-08  8:28 ` [PATCH v2] " Pali Rohár
@ 2022-04-21 23:56   ` Tom Rini
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Rini @ 2022-04-21 23:56 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Priyanka Jain, Simon Glass, Rick Chen, Andre Przywara,
	Michal Simek, Marek Behún, Sinan Akman, u-boot

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

On Fri, Apr 08, 2022 at 10:28:05AM +0200, Pali Rohár wrote:

> On P2020 board is SPL malloc simple always failing with error and loops:
> 
>   SD boot...
>   alloc space exhausted
>   Bad trap at PC: f8f8b5f0, SR: 21200, vector=d00
>   NIP: 00000000 XER: 00000000 LR: 00000000 REGS: f8f8b5f0 TRAP: 20000000 DAR: 00000000
>   MSR: 00021200 EE: 0 PR: 0 FP: 0 ME: 1 IR/DR: 00
> 
>   GPR00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
>   GPR08: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
>   GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
>   GPR24: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
>   Call backtrace:
>   Exception in kernel pc f8f8b5f0 signal 0
> 
> Inspection showed that gd->malloc_limit is zero. And it is because
> generally SPL_FRAMEWORK initialize SPL's gd->malloc_limit. But when
> SPL_FRAMEWORK is not enabled then in most cases nobody initialize
> gd->malloc_limit and so SPL malloc simple does not work.
> 
> So disable SPL_SYS_MALLOC_SIMPLE by default when SPL_FRAMEWORK is not
> enabled. SPL_SYS_MALLOC_SIMPLE can be disabled only by setting
> SPL_SYS_MALLOC_F_LEN to zero. So do it.
> 
> This change fixes SPL error "alloc space exhausted" on P2020 board.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>

Applied to u-boot/master, thanks!

-- 
Tom

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

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

end of thread, other threads:[~2022-04-21 23:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05  9:28 [PATCH] SPL: Do not enable SPL_SYS_MALLOC_SIMPLE without SPL_FRAMEWORK by default Pali Rohár
2022-04-08  8:28 ` [PATCH v2] " Pali Rohár
2022-04-21 23:56   ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.