Skip to contentSkip to conversation

imx8mq_evk: enlarge SYS_MALLOC_F_LEN

PATCH In review Peng Fan (OSS) 3 participants 6 messages Sep 14, 2022 – Sep 15, 2022 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 imx8mq_evk: enlarge SYS_MALLOC_F_LEN

From: Peng Fan <[email protected]>

There is "alloc space exhausted" with DEBUG_UART enabled with the options enabled.

CONFIG_DEBUG_UART_BASE=0x30860000 # for uart1
CONFIG_DEBUG_UART_CLOCK=24000000

It is because CONFIG_SYS_MALLOC_F_LEN is too small, enlarge it. And set CONFIG_SPL_STACK to 0x188000 to not waste the top 16bytes.

---
 configs/imx8mq_evk_defconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
configs/imx8mq_evk_defconfig +3 -1
index cf207295e54..d877a1290f9 100644
@@ -2,6 +2,8 @@ CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
 CONFIG_SYS_MALLOC_LEN=0x600000
+CONFIG_SYS_MALLOC_F_LEN=0x10000
+CONFIG_SPL_SYS_MALLOC_F_LEN=0x2000
 CONFIG_SPL_GPIO=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
@@ -36,7 +38,7 @@ CONFIG_SPL_BSS_START_ADDR=0x180000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SPL_STACK=0x187ff0
+CONFIG_SPL_STACK=0x188000
 CONFIG_SYS_SPL_MALLOC=y
 CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
 CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
Signature · 1 line
2.36.0
Tested-by on v1 1/1
#1 lore raw

Hi,

Am Mi., 14. Sept. 2022 um 03:38 Uhr schrieb Peng Fan (OSS) <[email protected]>:

Quoted 11 lines

From: Peng Fan <[email protected]>

There is "alloc space exhausted" with DEBUG_UART enabled with the options enabled.

CONFIG_DEBUG_UART_BASE=0x30860000 # for uart1
CONFIG_DEBUG_UART_CLOCK=24000000

It is because CONFIG_SYS_MALLOC_F_LEN is too small, enlarge it. And set CONFIG_SPL_STACK to 0x188000 to not waste the top 16bytes.

When changing these values on the kontron_pitx_imx8m_defconfig this board also works again.
Maybe it could be a good idea to change these values for all imx8mq boards.

Quoted 3 lines
Quoted 27 lines
---
 configs/imx8mq_evk_defconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
configs/imx8mq_evk_defconfig +3 -2
index cf207295e54..d877a1290f9 100644
@@ -2,6 +2,8 @@ CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
 CONFIG_SYS_MALLOC_LEN=0x600000
+CONFIG_SYS_MALLOC_F_LEN=0x10000
+CONFIG_SPL_SYS_MALLOC_F_LEN=0x2000
 CONFIG_SPL_GPIO=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
@@ -36,7 +38,7 @@ CONFIG_SPL_BSS_START_ADDR=0x180000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SPL_STACK=0x187ff0
+CONFIG_SPL_STACK=0x188000
 CONFIG_SYS_SPL_MALLOC=y
 CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
 CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
--
Quoted 2 lines

2.36.0

Thank you

Signature · 1 line
Heiko
#2 lore raw

Hi,

Am Mi., 14. Sept. 2022 um 06:12 Uhr schrieb Heiko Thiery <[email protected]>:

Quoted 10 lines

Hi,

Am Mi., 14. Sept. 2022 um 03:38 Uhr schrieb Peng Fan (OSS) <[email protected]>:

Quoted 5 lines

From: Peng Fan <[email protected]>

There is "alloc space exhausted" with DEBUG_UART enabled with the options enabled.

I don't think the explanation is right. The alloc problem is also there if you don't enable DEBUG_UART. But only with enabled DEBUG_UART you can see the output message(s).

Quoted 50 lines
Quoted 6 lines

CONFIG_DEBUG_UART_BASE=0x30860000 # for uart1
CONFIG_DEBUG_UART_CLOCK=24000000

It is because CONFIG_SYS_MALLOC_F_LEN is too small, enlarge it. And set CONFIG_SPL_STACK to 0x188000 to not waste the top 16bytes.

When changing these values on the kontron_pitx_imx8m_defconfig this board also works again.
Maybe it could be a good idea to change these values for all imx8mq boards.

Quoted 3 lines
Quoted 27 lines
---
 configs/imx8mq_evk_defconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
configs/imx8mq_evk_defconfig +3 -2
index cf207295e54..d877a1290f9 100644
@@ -2,6 +2,8 @@ CONFIG_ARM=y
 CONFIG_ARCH_IMX8M=y
 CONFIG_SYS_TEXT_BASE=0x40200000
 CONFIG_SYS_MALLOC_LEN=0x600000
+CONFIG_SYS_MALLOC_F_LEN=0x10000
+CONFIG_SPL_SYS_MALLOC_F_LEN=0x2000
 CONFIG_SPL_GPIO=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
@@ -36,7 +38,7 @@ CONFIG_SPL_BSS_START_ADDR=0x180000
 CONFIG_SPL_BSS_MAX_SIZE=0x2000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SPL_STACK=0x187ff0
+CONFIG_SPL_STACK=0x188000
 CONFIG_SYS_SPL_MALLOC=y
 CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
 CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x42200000
--
Quoted 2 lines

2.36.0

Thank you
--
Heiko

reviewer
#3 lore raw
In reply to Heiko Thiery
Quoted 3 lines · Heiko Thiery

When changing these values on the kontron_pitx_imx8m_defconfig this board also works again.
Maybe it could be a good idea to change these values for all imx8mq boards.

Yes, agreed. It would be great if someone could align these values for all imx8mq boards.

#4 lore raw

Hi,

Am Mi., 14. Sept. 2022 um 13:34 Uhr schrieb Fabio Estevam <[email protected]>:

Quoted 9 lines · Heiko Thiery
Quoted 4 lines

When changing these values on the kontron_pitx_imx8m_defconfig this board also works again.
Maybe it could be a good idea to change these values for all imx8mq boards.

Yes, agreed. It would be great if someone could align these values for all imx8mq boards.

Strange thing is, that we already had the value of 0x10000 (introduced by 545eceb52062cdc995c45b9581174b7ae66b0e6f and reverted by b598957206e541b3f8876ae34a15fac6da90dcef) and Peng said that the MALLOC BASE address of the IMX8MQ is set to OCRAM_S amd has 32kB [1].

[1] https://lore.kernel.org/u-boot/[email protected]/

--
Heiko

author
#5 lore raw
Quoted 10 lines · Heiko Thiery

Hi,

Am Mi., 14. Sept. 2022 um 13:34 Uhr schrieb Fabio Estevam <[email protected]>:

Quoted 7 lines · Heiko Thiery
Quoted 4 lines

When changing these values on the kontron_pitx_imx8m_defconfig this board also works again.
Maybe it could be a good idea to change these values for all imx8mq boards.

Quoted 7 lines
Quoted 2 lines

Yes, agreed. It would be great if someone could align these values for all imx8mq boards.

Strange thing is, that we already had the value of 0x10000 (introduced by 545eceb52062cdc995c45b9581174b7ae66b0e6f and reverted by b598957206e541b3f8876ae34a15fac6da90dcef) and Peng said that the MALLOC BASE address of the IMX8MQ is set to OCRAM_S amd has 32kB [1].

CONFIG_SPL_SYS_MALLOC_F_LEN should be set to 0x2000 CONFIG_SYS_MALLOC_F_LEN should be a bit larger after DM CLK enabled.

Regards,
Peng.

Quoted 5 lines

[1] https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Fu-boot%2F718b5b97-2b53-06f0-540b-70dd45f3915c%40oss.nxp.com%2F&amp;data=05%7C01%7Cpeng.fan%40nxp.com%7C7bec6a3ee3754efc681908da964777e0%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637987530938669481%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=uLMVrBhVtoXCKJRIUXdKxan%2FemHbKb%2B64ZF4RFWk7Hc%3D&amp;reserved=0

--
Heiko