Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2EB49C77B61 for ; Thu, 27 Apr 2023 09:51:45 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 95C7686128; Thu, 27 Apr 2023 11:51:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="aQOyFn6I"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7D8B086116; Thu, 27 Apr 2023 11:51:40 +0200 (CEST) Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 74A7886128 for ; Thu, 27 Apr 2023 11:51:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=eugen.hristev@collabora.com Received: from [192.168.0.125] (unknown [82.76.24.202]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: ehristev) by madras.collabora.co.uk (Postfix) with ESMTPSA id 90FCF6603280; Thu, 27 Apr 2023 10:51:36 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1682589097; bh=Denyjpsy76474z+0mI3SqdJuuH1+G5P9ZuuKaVWj8wM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=aQOyFn6IsPZLL46nGiaStv0qKyJNwdYyL3OapNuVxTBo1iYDj8TNWVJBm/k/YBkLk m/mAm2vRgI9TsBhP9C58Rt6DLNP+svuxDb/s/f6eDjHrRvcHZrhdQu1Msr7v7OiElf lsuXVYG9cMgCQDhBY+VJM5/LRIKBYVO7eXsjfY4c161XbYGk08EmVmr+fwDJpvtx29 0J1/1335bkL0bOwiAeq171cd7PLC1/akGFLkSRBFw4c7GxlaAR75uUtPVsNHMb5QrP OkSqh3ntjFUyhUvEd2mEg9c1mCRVK5SZlN5ETxoqJNGVUJN5IxEdw8azlYYVNPryDC udKv/LyGcmYgQ== Message-ID: Date: Thu, 27 Apr 2023 12:51:33 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH] configs: at91: sama5d2_icp_mmc: Enable CONFIG_LTO Content-Language: en-US To: Stefan Roese , u-boot@lists.denx.de Cc: =?UTF-8?Q?Pali_Roh=c3=a1r?= , Nicolas Ferre , cristian.birsan@microchip.com References: <20230427085945.475619-1-sr@denx.de> From: Eugen Hristev In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean On 4/27/23 12:26, Stefan Roese wrote: > Hi Eugen, > > On 4/27/23 11:19, Eugen Hristev wrote: >> 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. 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. > >> 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. > >> 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. > >> 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 > > Thanks, > Stefan > >> Eugen >> >> >> On 4/27/23 11:59, Stefan Roese wrote: >>> 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. >>> >>> Signed-off-by: Stefan Roese >>> Cc: Tudor Ambarus >>> Cc: Eugen Hristev >>> Cc: Sergiu Moga >>> Cc: Pali Rohár >>> --- >>>   configs/sama5d2_icp_mmc_defconfig | 5 +++-- >>>   1 file changed, 3 insertions(+), 2 deletions(-) >>> >>> diff --git a/configs/sama5d2_icp_mmc_defconfig >>> b/configs/sama5d2_icp_mmc_defconfig >>> index e1b602d8e5ec..a3c57a3f1250 100644 >>> --- a/configs/sama5d2_icp_mmc_defconfig >>> +++ b/configs/sama5d2_icp_mmc_defconfig >>> @@ -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 >> > > Viele Grüße, > Stefan Roese >