Skip to contentSkip to conversation

configs: at91: sama5d2_icp_mmc: Enable CONFIG_LTO

PATCH In review Stefan Roese 6 participants 11 messages Apr 27, 2023 – Jul 24, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configs: at91: sama5d2_icp_mmc: Enable CONFIG_LTO

Adding just a tiny bit more code for sama5d2_icp_mmc leads to a SRAM image overflow. Fix this by enabling LTO for this board, so that such changes still can be made to the common U-Boot code.

Cc Tudor Ambarus <[email protected]>
Cc Eugen Hristev <[email protected]>
Cc Sergiu Moga <[email protected]>
Cc Pali Rohár <[email protected]>
---
 configs/sama5d2_icp_mmc_defconfig | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
configs/sama5d2_icp_mmc_defconfig +3 -2
index e1b602d8e5ec..a3c57a3f1250 100644
@@ -9,9 +9,11 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20003ef0
+CONFIG_SF_DEFAULT_SPEED=66000000
 CONFIG_ENV_SIZE=0x4000
 CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d2_icp"
+CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL_DRIVERS_MISC=y
@@ -24,6 +26,7 @@ CONFIG_SPL_FS_FAT=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_SYS_LOAD_ADDR=0x22000000
 CONFIG_DEBUG_UART=y
+CONFIG_LTO=y
 CONFIG_ENV_VARS_UBOOT_CONFIG=y
 CONFIG_SYS_MONITOR_LEN=524288
 CONFIG_FIT=y
@@ -86,7 +89,6 @@ CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ATMEL=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SF_DEFAULT_BUS=2
-CONFIG_SF_DEFAULT_SPEED=66000000
 CONFIG_SPI_FLASH_SFDP_SUPPORT=y
 CONFIG_SPI_FLASH_ATMEL=y
 CONFIG_SPI_FLASH_MACRONIX=y
@@ -110,5 +112,4 @@ CONFIG_TIMER=y
 CONFIG_SPL_TIMER=y
 CONFIG_ATMEL_TCB_TIMER=y
 CONFIG_SPL_ATMEL_TCB_TIMER=y
-CONFIG_OF_LIBFDT_OVERLAY=y
 # CONFIG_EFI_LOADER_HII is not set
Signature · 1 line
2.40.1
#1 lore raw

Hi Stefan,

Thank you for the patch.

This I guess is a workaround such that you can add a bit more of code.
In the end, it's not scalable, and we have to find a better way, probably by removing some of the code to make the SPL smaller.

How does this impact the size? How much we are gaining ?
We can perhaps have a look to see which code is removed and guard it by #ifndef SPL_BUILD and that might lower the size. (if ofcourse, this code should really be removed)

Also, I don't have a board at hand to test this, so it has to be tested first to make sure the board doesn't break.

Eugen

Quoted 51 lines · Stefan Roese

Adding just a tiny bit more code for sama5d2_icp_mmc leads to a SRAM image overflow. Fix this by enabling LTO for this board, so that such changes still can be made to the common U-Boot code.

Cc Tudor Ambarus <[email protected]>
Cc Eugen Hristev <[email protected]>
Cc Sergiu Moga <[email protected]>
Cc Pali Rohár <[email protected]>
---
  configs/sama5d2_icp_mmc_defconfig | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
configs/sama5d2_icp_mmc_defconfig +3 -2
index e1b602d8e5ec..a3c57a3f1250 100644
@@ -9,9 +9,11 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y
  CONFIG_SPL_LIBGENERIC_SUPPORT=y
  CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20003ef0
+CONFIG_SF_DEFAULT_SPEED=66000000
  CONFIG_ENV_SIZE=0x4000
  CONFIG_DM_GPIO=y
  CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d2_icp"
+CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_SPL_MMC=y
  CONFIG_SPL_SERIAL=y
  CONFIG_SPL_DRIVERS_MISC=y
@@ -24,6 +26,7 @@ CONFIG_SPL_FS_FAT=y
  CONFIG_SPL_LIBDISK_SUPPORT=y
  CONFIG_SYS_LOAD_ADDR=0x22000000
  CONFIG_DEBUG_UART=y
+CONFIG_LTO=y
  CONFIG_ENV_VARS_UBOOT_CONFIG=y
  CONFIG_SYS_MONITOR_LEN=524288
  CONFIG_FIT=y
@@ -86,7 +89,6 @@ CONFIG_MMC_SDHCI=y
  CONFIG_MMC_SDHCI_ATMEL=y
  CONFIG_DM_SPI_FLASH=y
  CONFIG_SF_DEFAULT_BUS=2
-CONFIG_SF_DEFAULT_SPEED=66000000
  CONFIG_SPI_FLASH_SFDP_SUPPORT=y
  CONFIG_SPI_FLASH_ATMEL=y
  CONFIG_SPI_FLASH_MACRONIX=y
@@ -110,5 +112,4 @@ CONFIG_TIMER=y
  CONFIG_SPL_TIMER=y
  CONFIG_ATMEL_TCB_TIMER=y
  CONFIG_SPL_ATMEL_TCB_TIMER=y
-CONFIG_OF_LIBFDT_OVERLAY=y
  # CONFIG_EFI_LOADER_HII is not set
#2 lore raw

Hi Eugen,

Quoted 6 lines · Eugen Hristev

Hi Stefan,

Thank you for the patch.

This I guess is a workaround such that you can add a bit more of code.
In the end, it's not scalable, and we have to find a better way, probably by removing some of the code to make the SPL smaller.

U-Boot image size increase resulting in overflowing some limits is a common problem, especially in SPL. Enabling LTO gives quite some good improvements in image size decrease. So I don't think it's an workaround.

Quoted 1 line

How does this impact the size? How much we are gaining ?

I did not measure this. I just checked that this target compiles clean again with LTO enabled and the MMC related patches applied.

Could you (or some college?) please investigate here, how the results are in image size?

Quoted 1 line

We can perhaps have a look to see which code is removed and guard it by #ifndef SPL_BUILD and that might lower the size. (if ofcourse, this code should really be removed)

Sure, other improvements in image size decrease are of course always a good idea.

Quoted 1 line

Also, I don't have a board at hand to test this, so it has to be tested first to make sure the board doesn't break.

Agreed. I assume/hope that one of your colleges will be able to test this?

Thanks,
Stefan

Quoted 47 lines

Eugen

Quoted 43 lines · Stefan Roese

Adding just a tiny bit more code for sama5d2_icp_mmc leads to a SRAM image overflow. Fix this by enabling LTO for this board, so that such changes still can be made to the common U-Boot code.

Cc Tudor Ambarus <[email protected]>
Cc Eugen Hristev <[email protected]>
Cc Sergiu Moga <[email protected]>
Cc Pali Rohár <[email protected]>

---
  configs/sama5d2_icp_mmc_defconfig | 5 +++--

  1 file changed, 3 insertions(+), 2 deletions(-)
configs/sama5d2_icp_mmc_defconfig +0 -0
index e1b602d8e5ec..a3c57a3f1250 100644
@@ -9,9 +9,11 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y

  CONFIG_SPL_LIBGENERIC_SUPPORT=y
  CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20003ef0
+CONFIG_SF_DEFAULT_SPEED=66000000
  CONFIG_ENV_SIZE=0x4000
  CONFIG_DM_GPIO=y
  CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d2_icp"
+CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_SPL_MMC=y
  CONFIG_SPL_SERIAL=y
  CONFIG_SPL_DRIVERS_MISC=y

configs/sama5d2_icp_mmc_defconfig +0 -0
@@ -24,6 +26,7 @@ CONFIG_SPL_FS_FAT=y

  CONFIG_SPL_LIBDISK_SUPPORT=y
  CONFIG_SYS_LOAD_ADDR=0x22000000
  CONFIG_DEBUG_UART=y
+CONFIG_LTO=y
  CONFIG_ENV_VARS_UBOOT_CONFIG=y
  CONFIG_SYS_MONITOR_LEN=524288
  CONFIG_FIT=y

configs/sama5d2_icp_mmc_defconfig +0 -0
@@ -86,7 +89,6 @@ CONFIG_MMC_SDHCI=y

  CONFIG_MMC_SDHCI_ATMEL=y
  CONFIG_DM_SPI_FLASH=y
  CONFIG_SF_DEFAULT_BUS=2
-CONFIG_SF_DEFAULT_SPEED=66000000
  CONFIG_SPI_FLASH_SFDP_SUPPORT=y

Quoted 9 lines
Quoted 8 lines

  CONFIG_SPI_FLASH_ATMEL=y
  CONFIG_SPI_FLASH_MACRONIX=y

configs/sama5d2_icp_mmc_defconfig +0 -0
@@ -110,5 +112,4 @@ CONFIG_TIMER=y

  CONFIG_SPL_TIMER=y
  CONFIG_ATMEL_TCB_TIMER=y
  CONFIG_SPL_ATMEL_TCB_TIMER=y
-CONFIG_OF_LIBFDT_OVERLAY=y
  # CONFIG_EFI_LOADER_HII is not set

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#3 lore raw
Quoted 7 lines · Stefan Roese

Hi Eugen,

Quoted 4 lines · Eugen Hristev

Hi Stefan,

Thank you for the patch.

Quoted 7 lines
Quoted 2 lines

This I guess is a workaround such that you can add a bit more of code.
In the end, it's not scalable, and we have to find a better way, probably by removing some of the code to make the SPL smaller.

U-Boot image size increase resulting in overflowing some limits is a common problem, especially in SPL. Enabling LTO gives quite some good improvements in image size decrease. So I don't think it's an workaround.

If this was not needed until today, and not adding any new functionality, I would call this a workaround to avoid shrinking the size to fit in the SRAM. When we are adding more and more, and eventually hit this problem again, LTO already enabled, what we will do ?
That's why I call this a workaround because we are not solving the problem, just postponing so we can add more things today.

Quoted 8 lines
Quoted 2 lines

How does this impact the size? How much we are gaining ?

I did not measure this. I just checked that this target compiles clean again with LTO enabled and the MMC related patches applied.

Could you (or some college?) please investigate here, how the results are in image size?

No, you are submitting the patch, I assume you could give some numbers to support your patch.

Quoted 10 lines
Quoted 2 lines

We can perhaps have a look to see which code is removed and guard it by #ifndef SPL_BUILD and that might lower the size. (if ofcourse, this code should really be removed)

Sure, other improvements in image size decrease are of course always a good idea.

Quoted 1 line

Also, I don't have a board at hand to test this, so it has to be tested first to make sure the board doesn't break.

Agreed. I assume/hope that one of your colleges will be able to test this?

Someone from Microchip can, or other people using the board from the community

I no longer work for Microchip, but I am still maintaining the AT91 custodian tree

Eugen

Quoted 64 lines

Thanks,
Stefan

Quoted 47 lines

Eugen

Quoted 43 lines · Stefan Roese

Adding just a tiny bit more code for sama5d2_icp_mmc leads to a SRAM image overflow. Fix this by enabling LTO for this board, so that such changes still can be made to the common U-Boot code.

Cc Tudor Ambarus <[email protected]>
Cc Eugen Hristev <[email protected]>
Cc Sergiu Moga <[email protected]>
Cc Pali Rohár <[email protected]>

---
  configs/sama5d2_icp_mmc_defconfig | 5 +++--

  1 file changed, 3 insertions(+), 2 deletions(-)
configs/sama5d2_icp_mmc_defconfig +0 -0
index e1b602d8e5ec..a3c57a3f1250 100644
@@ -9,9 +9,11 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y

  CONFIG_SPL_LIBGENERIC_SUPPORT=y
  CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20003ef0
+CONFIG_SF_DEFAULT_SPEED=66000000
  CONFIG_ENV_SIZE=0x4000
  CONFIG_DM_GPIO=y
  CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d2_icp"
+CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_SPL_MMC=y
  CONFIG_SPL_SERIAL=y
  CONFIG_SPL_DRIVERS_MISC=y

configs/sama5d2_icp_mmc_defconfig +0 -0
@@ -24,6 +26,7 @@ CONFIG_SPL_FS_FAT=y

  CONFIG_SPL_LIBDISK_SUPPORT=y
  CONFIG_SYS_LOAD_ADDR=0x22000000
  CONFIG_DEBUG_UART=y
+CONFIG_LTO=y
  CONFIG_ENV_VARS_UBOOT_CONFIG=y
  CONFIG_SYS_MONITOR_LEN=524288
  CONFIG_FIT=y

configs/sama5d2_icp_mmc_defconfig +0 -0
@@ -86,7 +89,6 @@ CONFIG_MMC_SDHCI=y

  CONFIG_MMC_SDHCI_ATMEL=y
  CONFIG_DM_SPI_FLASH=y
  CONFIG_SF_DEFAULT_BUS=2
-CONFIG_SF_DEFAULT_SPEED=66000000
  CONFIG_SPI_FLASH_SFDP_SUPPORT=y

Quoted 9 lines
Quoted 8 lines

  CONFIG_SPI_FLASH_ATMEL=y
  CONFIG_SPI_FLASH_MACRONIX=y

configs/sama5d2_icp_mmc_defconfig +0 -0
@@ -110,5 +112,4 @@ CONFIG_TIMER=y

  CONFIG_SPL_TIMER=y
  CONFIG_ATMEL_TCB_TIMER=y
  CONFIG_SPL_ATMEL_TCB_TIMER=y
-CONFIG_OF_LIBFDT_OVERLAY=y
  # CONFIG_EFI_LOADER_HII is not set

Viele Grüße,
Stefan Roese

#4 lore raw
Quoted 11 lines · Eugen Hristev
Quoted 10 lines · Stefan Roese

Hi Eugen,

Quoted 6 lines · Eugen Hristev

Hi Stefan,

Thank you for the patch.

This I guess is a workaround such that you can add a bit more of code.
In the end, it's not scalable, and we have to find a better way, probably by removing some of the code to make the SPL smaller.

Quoted 8 lines
Quoted 4 lines

U-Boot image size increase resulting in overflowing some limits is a common problem, especially in SPL. Enabling LTO gives quite some good improvements in image size decrease. So I don't think it's an workaround.

If this was not needed until today, and not adding any new functionality, I would call this a workaround to avoid shrinking the size to fit in the SRAM. When we are adding more and more, and eventually hit this problem again, LTO already enabled, what we will do ?
That's why I call this a workaround because we are not solving the problem, just postponing so we can add more things today.

This is what's happening since many years. But okay, let's call it a workaround.

Quoted 10 lines
Quoted 8 lines
Quoted 2 lines

How does this impact the size? How much we are gaining ?

I did not measure this. I just checked that this target compiles clean again with LTO enabled and the MMC related patches applied.

Could you (or some college?) please investigate here, how the results are in image size?

No, you are submitting the patch, I assume you could give some numbers to support your patch.

Sorry, my time is limited and frankly, I don't feel very much motivated (any more) to do additional work here. Even if it's not that much of effort.

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

We can perhaps have a look to see which code is removed and guard it by #ifndef SPL_BUILD and that might lower the size. (if ofcourse, this code should really be removed)

Sure, other improvements in image size decrease are of course always a good idea.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Also, I don't have a board at hand to test this, so it has to be tested first to make sure the board doesn't break.

Agreed. I assume/hope that one of your colleges will be able to test this?

Someone from Microchip can, or other people using the board from the community

I no longer work for Microchip, but I am still maintaining the AT91 custodian tree

Okay. Let's see, where this goes.

Thanks,
Stefan

Quoted 66 lines

Eugen

Quoted 64 lines

Thanks,
Stefan

Quoted 47 lines

Eugen

Quoted 43 lines · Stefan Roese

Adding just a tiny bit more code for sama5d2_icp_mmc leads to a SRAM image overflow. Fix this by enabling LTO for this board, so that such changes still can be made to the common U-Boot code.

Cc Tudor Ambarus <[email protected]>
Cc Eugen Hristev <[email protected]>
Cc Sergiu Moga <[email protected]>
Cc Pali Rohár <[email protected]>

---
  configs/sama5d2_icp_mmc_defconfig | 5 +++--

  1 file changed, 3 insertions(+), 2 deletions(-)
configs/sama5d2_icp_mmc_defconfig +0 -0
index e1b602d8e5ec..a3c57a3f1250 100644
@@ -9,9 +9,11 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y

  CONFIG_SPL_LIBGENERIC_SUPPORT=y
  CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20003ef0
+CONFIG_SF_DEFAULT_SPEED=66000000
  CONFIG_ENV_SIZE=0x4000
  CONFIG_DM_GPIO=y
  CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d2_icp"
+CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_SPL_MMC=y
  CONFIG_SPL_SERIAL=y
  CONFIG_SPL_DRIVERS_MISC=y

configs/sama5d2_icp_mmc_defconfig +0 -0
@@ -24,6 +26,7 @@ CONFIG_SPL_FS_FAT=y

  CONFIG_SPL_LIBDISK_SUPPORT=y
  CONFIG_SYS_LOAD_ADDR=0x22000000
  CONFIG_DEBUG_UART=y
+CONFIG_LTO=y
  CONFIG_ENV_VARS_UBOOT_CONFIG=y
  CONFIG_SYS_MONITOR_LEN=524288
  CONFIG_FIT=y

configs/sama5d2_icp_mmc_defconfig +0 -0
@@ -86,7 +89,6 @@ CONFIG_MMC_SDHCI=y

  CONFIG_MMC_SDHCI_ATMEL=y
  CONFIG_DM_SPI_FLASH=y
  CONFIG_SF_DEFAULT_BUS=2
-CONFIG_SF_DEFAULT_SPEED=66000000
  CONFIG_SPI_FLASH_SFDP_SUPPORT=y

Quoted 9 lines
Quoted 8 lines

  CONFIG_SPI_FLASH_ATMEL=y
  CONFIG_SPI_FLASH_MACRONIX=y

configs/sama5d2_icp_mmc_defconfig +0 -0
@@ -110,5 +112,4 @@ CONFIG_TIMER=y

  CONFIG_SPL_TIMER=y
  CONFIG_ATMEL_TCB_TIMER=y
  CONFIG_SPL_ATMEL_TCB_TIMER=y
-CONFIG_OF_LIBFDT_OVERLAY=y
  # CONFIG_EFI_LOADER_HII is not set

Viele Grüße,
Stefan Roese

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#5 lore raw
Quoted 59 lines · On Thursday 27 April 2023 12:30:43 Stefan Roese wrote:
Quoted 17 lines · Eugen Hristev
Quoted 7 lines · Stefan Roese

Hi Eugen,

Quoted 4 lines · Eugen Hristev

Hi Stefan,

Thank you for the patch.

Quoted 8 lines
Quoted 3 lines

This I guess is a workaround such that you can add a bit more of code. In the end, it's not scalable, and we have to find a better way, probably by removing some of the code to make the SPL smaller.

U-Boot image size increase resulting in overflowing some limits is a common problem, especially in SPL. Enabling LTO gives quite some good improvements in image size decrease. So I don't think it's an workaround.

Quoted 7 lines

If this was not needed until today, and not adding any new functionality, I would call this a workaround to avoid shrinking the size to fit in the SRAM.
When we are adding more and more, and eventually hit this problem again, LTO already enabled, what we will do ?
That's why I call this a workaround because we are not solving the problem, just postponing so we can add more things today.

This is what's happening since many years. But okay, let's call it a workaround.

Quoted 11 lines
Quoted 8 lines
Quoted 2 lines

How does this impact the size? How much we are gaining ?

I did not measure this. I just checked that this target compiles clean again with LTO enabled and the MMC related patches applied.

Could you (or some college?) please investigate here, how the results are in image size?

No, you are submitting the patch, I assume you could give some numbers to support your patch.

Sorry, my time is limited and frankly, I don't feel very much motivated (any more) to do additional work here. Even if it's not that much of effort.

Quoted 14 lines
Quoted 13 lines
Quoted 4 lines

We can perhaps have a look to see which code is removed and guard it by #ifndef SPL_BUILD and that might lower the size. (if ofcourse, this code should really be removed)

Sure, other improvements in image size decrease are of course always a good idea.

Quoted 2 lines

Also, I don't have a board at hand to test this, so it has to be tested first to make sure the board doesn't break.

Agreed. I assume/hope that one of your colleges will be able to test this?

Quoted 7 lines
Quoted 5 lines

Someone from Microchip can, or other people using the board from the community

I no longer work for Microchip, but I am still maintaining the AT91 custodian tree

Okay. Let's see, where this goes.

Well, if nobody wants to care about this board, go ahead with this change and if it is not enough that drop support for this board.

Quoted 78 lines

Thanks,
Stefan

Quoted 67 lines

Eugen

Quoted 65 lines

Thanks,
Stefan

Quoted 48 lines

Eugen

Quoted 44 lines · Stefan Roese

Adding just a tiny bit more code for sama5d2_icp_mmc leads to a SRAM image overflow. Fix this by enabling LTO for this board, so that such changes still can be made to the common U-Boot code.

Cc Tudor Ambarus <[email protected]>
Cc Eugen Hristev <[email protected]>
Cc Sergiu Moga <[email protected]>
Cc Pali Rohár <[email protected]>

---
  configs/sama5d2_icp_mmc_defconfig | 5 +++--

  1 file changed, 3 insertions(+), 2 deletions(-)
configs/sama5d2_icp_mmc_defconfig +0 -0
index e1b602d8e5ec..a3c57a3f1250 100644
@@ -9,9 +9,11 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y

  CONFIG_SPL_LIBGENERIC_SUPPORT=y
  CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20003ef0
+CONFIG_SF_DEFAULT_SPEED=66000000
  CONFIG_ENV_SIZE=0x4000
  CONFIG_DM_GPIO=y
  CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d2_icp"
+CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_SPL_MMC=y
  CONFIG_SPL_SERIAL=y
  CONFIG_SPL_DRIVERS_MISC=y

configs/sama5d2_icp_mmc_defconfig +0 -0
@@ -24,6 +26,7 @@ CONFIG_SPL_FS_FAT=y

  CONFIG_SPL_LIBDISK_SUPPORT=y
  CONFIG_SYS_LOAD_ADDR=0x22000000
  CONFIG_DEBUG_UART=y
+CONFIG_LTO=y
  CONFIG_ENV_VARS_UBOOT_CONFIG=y
  CONFIG_SYS_MONITOR_LEN=524288
  CONFIG_FIT=y

configs/sama5d2_icp_mmc_defconfig +0 -0
@@ -86,7 +89,6 @@ CONFIG_MMC_SDHCI=y

  CONFIG_MMC_SDHCI_ATMEL=y
  CONFIG_DM_SPI_FLASH=y
  CONFIG_SF_DEFAULT_BUS=2
-CONFIG_SF_DEFAULT_SPEED=66000000
  CONFIG_SPI_FLASH_SFDP_SUPPORT=y

Quoted 9 lines
Quoted 8 lines

  CONFIG_SPI_FLASH_ATMEL=y
  CONFIG_SPI_FLASH_MACRONIX=y

configs/sama5d2_icp_mmc_defconfig +0 -0
@@ -110,5 +112,4 @@ CONFIG_TIMER=y

  CONFIG_SPL_TIMER=y
  CONFIG_ATMEL_TCB_TIMER=y
  CONFIG_SPL_ATMEL_TCB_TIMER=y
-CONFIG_OF_LIBFDT_OVERLAY=y
  # CONFIG_EFI_LOADER_HII is not set

Viele Grüße,
Stefan Roese

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#6 lore raw
Quoted 63 lines · Pali Rohár
Quoted 62 lines · On Thursday 27 April 2023 12:30:43 Stefan Roese wrote:
Quoted 17 lines · Eugen Hristev
Quoted 7 lines · Stefan Roese

Hi Eugen,

Quoted 4 lines · Eugen Hristev

Hi Stefan,

Thank you for the patch.

Quoted 8 lines
Quoted 3 lines

This I guess is a workaround such that you can add a bit more of code. In the end, it's not scalable, and we have to find a better way, probably by removing some of the code to make the SPL smaller.

U-Boot image size increase resulting in overflowing some limits is a common problem, especially in SPL. Enabling LTO gives quite some good improvements in image size decrease. So I don't think it's an workaround.

Quoted 7 lines

If this was not needed until today, and not adding any new functionality, I would call this a workaround to avoid shrinking the size to fit in the SRAM.
When we are adding more and more, and eventually hit this problem again, LTO already enabled, what we will do ?
That's why I call this a workaround because we are not solving the problem, just postponing so we can add more things today.

This is what's happening since many years. But okay, let's call it a workaround.

Quoted 11 lines
Quoted 8 lines
Quoted 2 lines

How does this impact the size? How much we are gaining ?

I did not measure this. I just checked that this target compiles clean again with LTO enabled and the MMC related patches applied.

Could you (or some college?) please investigate here, how the results are in image size?

No, you are submitting the patch, I assume you could give some numbers to support your patch.

Sorry, my time is limited and frankly, I don't feel very much motivated (any more) to do additional work here. Even if it's not that much of effort.

Quoted 17 lines
Quoted 5 lines
Quoted 4 lines

We can perhaps have a look to see which code is removed and guard it by #ifndef SPL_BUILD and that might lower the size. (if ofcourse, this code should really be removed)

Quoted 8 lines

Sure, other improvements in image size decrease are of course always a good idea.

Quoted 2 lines

Also, I don't have a board at hand to test this, so it has to be tested first to make sure the board doesn't break.

Agreed. I assume/hope that one of your colleges will be able to test this?

Someone from Microchip can, or other people using the board from the community

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I no longer work for Microchip, but I am still maintaining the AT91 custodian tree

Okay. Let's see, where this goes.

Well, if nobody wants to care about this board, go ahead with this change and if it is not enough that drop support for this board.

Hi Pali,

I kind of dislike this attitude. If a patchset breaks a board, a patchset should be changed. Or rejected. I don't agree with removing boards just because in a few days nobody tested one patch. And applying untested patches is again something which I disagree upon.

Quoted 79 lines
Quoted 79 lines

Thanks,
Stefan

Quoted 67 lines

Eugen

Quoted 65 lines

Thanks,
Stefan

Quoted 48 lines

Eugen

Quoted 44 lines · Stefan Roese

Adding just a tiny bit more code for sama5d2_icp_mmc leads to a SRAM image overflow. Fix this by enabling LTO for this board, so that such changes still can be made to the common U-Boot code.

Cc Tudor Ambarus <[email protected]>
Cc Eugen Hristev <[email protected]>
Cc Sergiu Moga <[email protected]>
Cc Pali Rohár <[email protected]>
---
   configs/sama5d2_icp_mmc_defconfig | 5 +++--
   1 file changed, 3 insertions(+), 2 deletions(-)
configs/sama5d2_icp_mmc_defconfig +3 -1
index e1b602d8e5ec..a3c57a3f1250 100644
@@ -9,9 +9,11 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y
   CONFIG_SPL_LIBGENERIC_SUPPORT=y
   CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
   CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20003ef0
+CONFIG_SF_DEFAULT_SPEED=66000000
   CONFIG_ENV_SIZE=0x4000
   CONFIG_DM_GPIO=y
   CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d2_icp"
+CONFIG_OF_LIBFDT_OVERLAY=y
   CONFIG_SPL_MMC=y
   CONFIG_SPL_SERIAL=y
   CONFIG_SPL_DRIVERS_MISC=y
@@ -24,6 +26,7 @@ CONFIG_SPL_FS_FAT=y
   CONFIG_SPL_LIBDISK_SUPPORT=y
   CONFIG_SYS_LOAD_ADDR=0x22000000
   CONFIG_DEBUG_UART=y
+CONFIG_LTO=y
   CONFIG_ENV_VARS_UBOOT_CONFIG=y
   CONFIG_SYS_MONITOR_LEN=524288
   CONFIG_FIT=y
@@ -86,7 +89,6 @@ CONFIG_MMC_SDHCI=y
   CONFIG_MMC_SDHCI_ATMEL=y
   CONFIG_DM_SPI_FLASH=y
   CONFIG_SF_DEFAULT_BUS=2
-CONFIG_SF_DEFAULT_SPEED=66000000
   CONFIG_SPI_FLASH_SFDP_SUPPORT=y
Quoted 9 lines

configs/sama5d2_icp_mmc_defconfig CONFIG_TIMER=y · line 115

Quoted 8 lines
configs/sama5d2_icp_mmc_defconfig +0 -1
   CONFIG_SPI_FLASH_ATMEL=y
   CONFIG_SPI_FLASH_MACRONIX=y
@@ -110,5 +112,4 @@ CONFIG_TIMER=y
   CONFIG_SPL_TIMER=y
   CONFIG_ATMEL_TCB_TIMER=y
   CONFIG_SPL_ATMEL_TCB_TIMER=y
-CONFIG_OF_LIBFDT_OVERLAY=y
   # CONFIG_EFI_LOADER_HII is not set

Viele Grüße,
Stefan Roese

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#7 lore raw
Quoted 72 lines · Eugen Hristev

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 67 lines · Pali Rohár
Quoted 66 lines · On Thursday 27 April 2023 12:30:43 Stefan Roese wrote:
Quoted 17 lines · Eugen Hristev
Quoted 7 lines · Stefan Roese

Hi Eugen,

Quoted 4 lines · Eugen Hristev

Hi Stefan,

Thank you for the patch.

Quoted 8 lines
Quoted 3 lines

This I guess is a workaround such that you can add a bit more of code. In the end, it's not scalable, and we have to find a better way, probably by removing some of the code to make the SPL smaller.

U-Boot image size increase resulting in overflowing some limits is a common problem, especially in SPL. Enabling LTO gives quite some good improvements in image size decrease. So I don't think it's an workaround.

Quoted 7 lines

If this was not needed until today, and not adding any new functionality, I would call this a workaround to avoid shrinking the size to fit in the SRAM.
When we are adding more and more, and eventually hit this problem again, LTO already enabled, what we will do ?
That's why I call this a workaround because we are not solving the problem, just postponing so we can add more things today.

This is what's happening since many years. But okay, let's call it a workaround.

Quoted 11 lines
Quoted 8 lines
Quoted 2 lines

How does this impact the size? How much we are gaining ?

I did not measure this. I just checked that this target compiles clean again with LTO enabled and the MMC related patches applied.

Could you (or some college?) please investigate here, how the results are in image size?

No, you are submitting the patch, I assume you could give some numbers to support your patch.

Sorry, my time is limited and frankly, I don't feel very much motivated (any more) to do additional work here. Even if it's not that much of effort.

Quoted 11 lines
Quoted 11 lines
Quoted 4 lines

We can perhaps have a look to see which code is removed and guard it by #ifndef SPL_BUILD and that might lower the size. (if ofcourse, this code should really be removed)

Sure, other improvements in image size decrease are of course always a good idea.

Quoted 2 lines

Also, I don't have a board at hand to test this, so it has to be tested first to make sure the board doesn't break.

Quoted 8 lines
Quoted 2 lines

Agreed. I assume/hope that one of your colleges will be able to test this?

Someone from Microchip can, or other people using the board from the community

I no longer work for Microchip, but I am still maintaining the AT91 custodian tree

Okay. Let's see, where this goes.

I'm monitoring that, with help from Eugen.

Quoted 3 lines
Quoted 3 lines

Well, if nobody wants to care about this board, go ahead with this change and if it is not enough that drop support for this board.

Well, give us some time, please!

Quoted 7 lines

Hi Pali,

I kind of dislike this attitude. If a patchset breaks a board, a patchset should be changed. Or rejected.
I don't agree with removing boards just because in a few days nobody tested one patch.
And applying untested patches is again something which I disagree upon.

Thanks Eugen for your support.

We didn't ask for this situation, so Pali, understand that we need to get organized before giving an answer / testing.

Best regards,
Nicolas

Quoted 68 lines
Quoted 67 lines
Quoted 67 lines
Quoted 55 lines
Quoted 55 lines
Quoted 54 lines · Stefan Roese
Quoted 52 lines

Adding just a tiny bit more code for sama5d2_icp_mmc leads to a SRAM image overflow. Fix this by enabling LTO for this board, so that such changes still can be made to the common U-Boot code.

Cc Tudor Ambarus <[email protected]>
Cc Eugen Hristev <[email protected]>
Cc Sergiu Moga <[email protected]>
Cc Pali Rohár <[email protected]>
---
    configs/sama5d2_icp_mmc_defconfig | 5 +++--
    1 file changed, 3 insertions(+), 2 deletions(-)
configs/sama5d2_icp_mmc_defconfig +3 -2
index e1b602d8e5ec..a3c57a3f1250 100644
@@ -9,9 +9,11 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y
    CONFIG_SPL_LIBGENERIC_SUPPORT=y
    CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
    CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20003ef0
+CONFIG_SF_DEFAULT_SPEED=66000000
    CONFIG_ENV_SIZE=0x4000
    CONFIG_DM_GPIO=y
    CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d2_icp"
+CONFIG_OF_LIBFDT_OVERLAY=y
    CONFIG_SPL_MMC=y
    CONFIG_SPL_SERIAL=y
    CONFIG_SPL_DRIVERS_MISC=y
@@ -24,6 +26,7 @@ CONFIG_SPL_FS_FAT=y
    CONFIG_SPL_LIBDISK_SUPPORT=y
    CONFIG_SYS_LOAD_ADDR=0x22000000
    CONFIG_DEBUG_UART=y
+CONFIG_LTO=y
    CONFIG_ENV_VARS_UBOOT_CONFIG=y
    CONFIG_SYS_MONITOR_LEN=524288
    CONFIG_FIT=y
@@ -86,7 +89,6 @@ CONFIG_MMC_SDHCI=y
    CONFIG_MMC_SDHCI_ATMEL=y
    CONFIG_DM_SPI_FLASH=y
    CONFIG_SF_DEFAULT_BUS=2
-CONFIG_SF_DEFAULT_SPEED=66000000
    CONFIG_SPI_FLASH_SFDP_SUPPORT=y
    CONFIG_SPI_FLASH_ATMEL=y
    CONFIG_SPI_FLASH_MACRONIX=y
@@ -110,5 +112,4 @@ CONFIG_TIMER=y
    CONFIG_SPL_TIMER=y
    CONFIG_ATMEL_TCB_TIMER=y
    CONFIG_SPL_ATMEL_TCB_TIMER=y
-CONFIG_OF_LIBFDT_OVERLAY=y
    # CONFIG_EFI_LOADER_HII is not set
Quoted 4 lines
Quoted 3 lines

Viele Grüße,
Stefan Roese

Viele Grüße,
Stefan Roese

--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]

Signature · 1 line
Nicolas Ferre
#8 lore raw
In reply to Stefan Roese
Quoted 16 lines · Stefan Roese

Hi Eugen,

Quoted 7 lines · Eugen Hristev

Hi Stefan,

Thank you for the patch.

This I guess is a workaround such that you can add a bit more of code. In the end, it's not scalable, and we have to find a better way, probably by removing some of the code to make the SPL smaller.

U-Boot image size increase resulting in overflowing some limits is a common problem, especially in SPL. Enabling LTO gives quite some good improvements in image size decrease. So I don't think it's an workaround.

Quoted 4 lines
Quoted 1 line

How does this impact the size? How much we are gaining ?

I did not measure this. I just checked that this target compiles clean again with LTO enabled and the MMC related patches applied.

Note that buildman already has flags to tell you how much the size changed and in what functions between commits.

Signature · 1 line
Tom
#9 lore raw
In reply to Stefan Roese
Quoted 46 lines · Stefan Roese

Adding just a tiny bit more code for sama5d2_icp_mmc leads to a SRAM image overflow. Fix this by enabling LTO for this board, so that such changes still can be made to the common U-Boot code.

Cc Tudor Ambarus <[email protected]>
Cc Eugen Hristev <[email protected]>
Cc Sergiu Moga <[email protected]>
Cc Pali Rohár <[email protected]>
---
  configs/sama5d2_icp_mmc_defconfig | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
configs/sama5d2_icp_mmc_defconfig +3 -1
index e1b602d8e5ec..a3c57a3f1250 100644
@@ -9,9 +9,11 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y
  CONFIG_SPL_LIBGENERIC_SUPPORT=y
  CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20003ef0
+CONFIG_SF_DEFAULT_SPEED=66000000
  CONFIG_ENV_SIZE=0x4000
  CONFIG_DM_GPIO=y
  CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d2_icp"
+CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_SPL_MMC=y
  CONFIG_SPL_SERIAL=y
  CONFIG_SPL_DRIVERS_MISC=y
@@ -24,6 +26,7 @@ CONFIG_SPL_FS_FAT=y
  CONFIG_SPL_LIBDISK_SUPPORT=y
  CONFIG_SYS_LOAD_ADDR=0x22000000
  CONFIG_DEBUG_UART=y
+CONFIG_LTO=y
  CONFIG_ENV_VARS_UBOOT_CONFIG=y
  CONFIG_SYS_MONITOR_LEN=524288
  CONFIG_FIT=y
@@ -86,7 +89,6 @@ CONFIG_MMC_SDHCI=y
  CONFIG_MMC_SDHCI_ATMEL=y
  CONFIG_DM_SPI_FLASH=y
  CONFIG_SF_DEFAULT_BUS=2
-CONFIG_SF_DEFAULT_SPEED=66000000
  CONFIG_SPI_FLASH_SFDP_SUPPORT=y
  CONFIG_SPI_FLASH_ATMEL=y
  CONFIG_SPI_FLASH_MACRONIX=y

configs/sama5d2_icp_mmc_defconfig CONFIG_TIMER=y · line 115

Quoted 5 lines
configs/sama5d2_icp_mmc_defconfig +0 -1
@@ -110,5 +112,4 @@ CONFIG_TIMER=y
  CONFIG_SPL_TIMER=y
  CONFIG_ATMEL_TCB_TIMER=y
  CONFIG_SPL_ATMEL_TCB_TIMER=y
-CONFIG_OF_LIBFDT_OVERLAY=y
  # CONFIG_EFI_LOADER_HII is not set

Mihai (added to the thread) tested this patch on sama5d2_icp.

Mihai, can you add your Tested-by tag then?
This is the original LTO patch for sama5d2_icp that we discussed about.

Thanks, Eugen

#10 lore raw

Hello Eugen,

I have successfully tested the binary on sama5d2_icp board. Board is booting OK the zImage from fat (SD-card).

Best regards,
Mihai Sain

-----Original Message-----
From: Eugen Hristev <[email protected]>
Sent: Monday, July 24, 2023 2:08 PM
To: [email protected]; Mihai Sain - M19926 <[email protected]>
Cc: Pali Rohár <[email protected]>; Stefan Roese <[email protected]>
Subject: Re: [PATCH] configs: at91: sama5d2_icp_mmc: Enable CONFIG_LTO

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 47 lines · Stefan Roese

Adding just a tiny bit more code for sama5d2_icp_mmc leads to a SRAM image overflow. Fix this by enabling LTO for this board, so that such changes still can be made to the common U-Boot code.

Cc Tudor Ambarus <[email protected]>
Cc Eugen Hristev <[email protected]>
Cc Sergiu Moga <[email protected]>
Cc Pali Rohár <[email protected]>
---
  configs/sama5d2_icp_mmc_defconfig | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
configs/sama5d2_icp_mmc_defconfig +3 -1
index e1b602d8e5ec..a3c57a3f1250 100644
@@ -9,9 +9,11 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y
  CONFIG_SPL_LIBGENERIC_SUPPORT=y
  CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
  CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20003ef0
+CONFIG_SF_DEFAULT_SPEED=66000000
  CONFIG_ENV_SIZE=0x4000
  CONFIG_DM_GPIO=y
  CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d2_icp"
+CONFIG_OF_LIBFDT_OVERLAY=y
  CONFIG_SPL_MMC=y
  CONFIG_SPL_SERIAL=y
  CONFIG_SPL_DRIVERS_MISC=y
@@ -24,6 +26,7 @@ CONFIG_SPL_FS_FAT=y
  CONFIG_SPL_LIBDISK_SUPPORT=y
  CONFIG_SYS_LOAD_ADDR=0x22000000
  CONFIG_DEBUG_UART=y
+CONFIG_LTO=y
  CONFIG_ENV_VARS_UBOOT_CONFIG=y
  CONFIG_SYS_MONITOR_LEN=524288
  CONFIG_FIT=y
@@ -86,7 +89,6 @@ CONFIG_MMC_SDHCI=y
  CONFIG_MMC_SDHCI_ATMEL=y
  CONFIG_DM_SPI_FLASH=y
  CONFIG_SF_DEFAULT_BUS=2
-CONFIG_SF_DEFAULT_SPEED=66000000
  CONFIG_SPI_FLASH_SFDP_SUPPORT=y
  CONFIG_SPI_FLASH_ATMEL=y
  CONFIG_SPI_FLASH_MACRONIX=y

configs/sama5d2_icp_mmc_defconfig CONFIG_TIMER=y · line 115

Quoted 5 lines
configs/sama5d2_icp_mmc_defconfig +0 -1
@@ -110,5 +112,4 @@ CONFIG_TIMER=y
  CONFIG_SPL_TIMER=y
  CONFIG_ATMEL_TCB_TIMER=y
  CONFIG_SPL_ATMEL_TCB_TIMER=y
-CONFIG_OF_LIBFDT_OVERLAY=y
  # CONFIG_EFI_LOADER_HII is not set

Mihai (added to the thread) tested this patch on sama5d2_icp.

Mihai, can you add your Tested-by tag then?
This is the original LTO patch for sama5d2_icp that we discussed about.

Thanks, Eugen