From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA346C433B4 for ; Tue, 4 May 2021 21:40:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99AF0613CD for ; Tue, 4 May 2021 21:40:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232803AbhEDVlT (ORCPT ); Tue, 4 May 2021 17:41:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230490AbhEDVlS (ORCPT ); Tue, 4 May 2021 17:41:18 -0400 Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [IPv6:2607:f8b0:4864:20::f29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4841C061574 for ; Tue, 4 May 2021 14:40:22 -0700 (PDT) Received: by mail-qv1-xf29.google.com with SMTP id w9so210364qvi.13 for ; Tue, 04 May 2021 14:40:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=a0cU5H7q1LCMAyhSWWKVmutP6bnvt+liyXXmz7rAPpE=; b=JFE6DgqigB5NCmWTf1FkzfeyY3KA4IfJyd5t8zP4wU1A/nFJqhhAs5Nv7cmwT4PmXD mNYOfikxGvlSUWXilYcuV/sihEX1SEPApJQzWdEhZSXXjwPQEzP+ayaLl/UXx/rxBj2G tPhVjP3AO9ycnlpaxSobZEKoViA09VupAPK94= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=a0cU5H7q1LCMAyhSWWKVmutP6bnvt+liyXXmz7rAPpE=; b=nXaMtwguBT3O9ETAIVCVdxkrw65sK6bppYwqeet8Z4amnTI3zw6whsNsRBBjR+tp2w CwqnRzTdjXuQ5hNKvn1iK2BV5Hc2+UEt3Ec9ynhIA8dRwOqjeDYmNTtQcLfBE143jW4w utzo+7tmiQ/lZ8droFd1pCEQOw8TaBpVRKQDrj6HBXbYuLLU2zoW2XujgjPzCxR/jC93 PC5Xc5I5RIp2/JiAXkhY6JEhp8Mk8qkANGjvzR4WXuxybPA7oASH30ff5DECUlPrQMYq CtzPA45Ed8AksNQGKyic2SKoiKEHHDdTs3v0Ie3Il5JGXMkjyqO12gJB7Xb6v1MJ36cn tttQ== X-Gm-Message-State: AOAM530bg5pbFzMPWWO3wz5DN5GaxO32rB+8vukbgEJDdNLWm5SWQGCC diKyyc6a8oOdcyJzv8jYvJiDtQ== X-Google-Smtp-Source: ABdhPJwVsPY7GTXTFUjIi9DMjfr/UOATTkv71eqUC5T8q0RVtjoZ7h4joPTk3j6tBIP+lNssjTvbWg== X-Received: by 2002:a0c:f044:: with SMTP id b4mr11886977qvl.3.1620164422145; Tue, 04 May 2021 14:40:22 -0700 (PDT) Received: from bill-the-cat (cpe-65-184-140-239.ec.res.rr.com. [65.184.140.239]) by smtp.gmail.com with ESMTPSA id c14sm3430708qtc.5.2021.05.04.14.40.17 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 May 2021 14:40:21 -0700 (PDT) Date: Tue, 4 May 2021 17:40:16 -0400 From: Tom Rini To: Simon Glass Cc: U-Boot Mailing List , Heinrich Schuchardt , Bin Meng , Robert Marko , Andre Przywara , Masahiro Yamada , AKASHI Takahiro , Adam Ford , Alexandru Gagniuc , Alexey Brodkin , Andrii Anisov , Asherah Connor , Bastian Krause , "Chan, Donald" , Chee Hong Ang , Chin-Liang See , Christian Gmeiner , Dinh Nguyen , Etienne Carriere , Eugeniy Paltsev , Fabien Parent , Fabio Estevam , Frieder Schrempf , =?iso-8859-1?Q?Fr=E9d=E9ric?= Danis , George McCollister , Giulio Benetti , Harald Seiler , Heiko Schocher , Heiko Stuebner , Hongwei Zhang , Jagan Teki , Jan Kiszka , Jan Luebbe , Jernej Skrabec , Joe Hershberger , Joel Peshkin , Joel Stanley , Jonathan Gray , Jorge Ramirez-Ortiz , Kever Yang , Klaus Heinrich Kiwi , Ley Foon Tan , Lukasz Majewski , Marcin Juszkiewicz , Marek Behun , Marek Szyprowski , Marek Vasut , Masahiro Yamada , Matthieu CASTET , Michal Simek , Michal Simek , "NXP i.MX U-Boot Team" , Naoki Hayama , Oleksandr Andrushchenko , Ovidiu Panait , Pali =?iso-8859-1?Q?Roh=E1r?= , Patrick Delaunay , Patrick Oppenlander , Peng Fan , Philippe Reynes , Pragnesh Patel , Qu Wenruo , Rasmus Villemoes , Reuben Dowle , Rick Chen , Samuel Holland , Sean Anderson , Sean Anderson , Sebastian Reichel , Siew Chin Lim , Stefan Roese , Stefano Babic , Suniel Mahesh , T Karthik Reddy , Tero Kristo , Thirupathaiah Annapureddy , Trevor Woerner , Wasim Khan , chenshuo , linux-btrfs@vger.kernel.org, uboot-snps-arc@synopsys.com Subject: Re: [PATCH 00/49] image: Reduce #ifdefs and ad-hoc defines in image code Message-ID: <20210504214016.GA17669@bill-the-cat> References: <20210503231136.744283-1-sjg@chromium.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="U7PH6YjyT5379uVx" Content-Disposition: inline In-Reply-To: <20210503231136.744283-1-sjg@chromium.org> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org --U7PH6YjyT5379uVx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 03, 2021 at 05:10:47PM -0600, Simon Glass wrote: > Much of the image-handling code predates the introduction of Kconfig and > has quite a few #ifdefs in it. It also uses its own IMAGE_... defines to > help reduce the #ifdefs, which is unnecessary now that we can use > IS_ENABLED() et al. >=20 > The image code is also where quite a bit of code is shared with the host > tools. At present this uses a lot of checks of USE_HOSTCC. >=20 > This series introduces 'host' Kconfig options and a way to use > CONFIG_IS_ENABLED() to check them. This works in a similar way to SPL, so >=20 > CONFIG_IS_ENABLED(FIT) >=20 > will evaluate to true on the host build (USE_HOSTCC) if CONFIG_HOST_FIT is > enabled. This allows quite a bit of clean-up of the image.h header file > and many of the image C files. >=20 > The 'host' Kconfig options should help to solve a more general problem in > that we mostly want the host tools to build with all features enabled, no > matter which features the 'target' build actually uses. This is a pain to > arrange at present, but with 'host' Kconfigs, we can just define them all > to y. >=20 > There are cases where the host tools do not have features which are > present on the target, for example environment and physical addressing. > To help with this, some of the core image code is split out into > image-board.c and image-host.c files. >=20 > Even with these changes, some #ifdefs remain (101 down to 42 in > common/image*). But the code is somewhat easier to follow and there are > fewer build paths. >=20 > In service of the above, this series includes a patch to add an API funct= ion > for zstd, so the code can be dropped from bootm.c >=20 > It also introduces a function to handle manual relocation. I like this idea overall. The good news is this reduces the size in a few places. The bad news, but I can live with if we can't restructure the changes more, is a few functions grow a bit. This shows the good and the bad (something like sama5d2_ptc_ek_mmc shows only growth, to be clear): px30-core-edimm2.2-px30: all -36 rodata -24 text -12 u-boot: add: 0/0, grow: 3/-4 bytes: 36/-48 (-12) function old new d= elta boot_get_fdt 896 924 = +28 image_decomp 372 376 = +4 boot_get_ramdisk 868 872 = +4 do_bootm_vxworks 552 540 = -12 do_bootm_rtems 124 112 = -12 do_bootm_plan9 228 216 = -12 do_bootm_netbsd 324 312 = -12 odroid-c2 : all -105 bss +128 rodata -65 text -168 u-boot: add: 0/0, grow: 2/-3 bytes: 108/-172 (-64) function old new d= elta images 504 608 = +104 image_decomp 372 376 = +4 image_setup_linux 108 96 = -12 boot_get_ramdisk 620 580 = -40 boot_get_fdt 660 540 = -120 origen : all +47 bss +96 rodata -57 text +8 u-boot: add: 0/0, grow: 15/-2 bytes: 180/-104 (76) function old new d= elta images 288 340 = +52 do_bootm_states 1304 1348 = +44 do_bootz 164 176 = +12 do_bootm_vxworks 332 344 = +12 image_setup_libfdt 168 176 = +8 image_decomp 156 164 = +8 bootm_find_images 212 220 = +8 boot_prep_linux 276 284 = +8 image_setup_linux 54 58 = +4 do_bootm_standalone 60 64 = +4 do_bootm_plan9 104 108 = +4 do_bootm_netbsd 168 172 = +4 boot_prep_vxworks 48 52 = +4 boot_jump_vxworks 6 10 = +4 boot_jump_linux 148 152 = +4 boot_get_ramdisk 420 392 = -28 boot_get_fdt 420 344 = -76 And looking at ls1088ardb_sdcard_qspi_SECURE_BOOT I think there might be something wrong as that looks to drop all crypto algos from SPL. Other layerscape SECURE_BOOT configs show this as well. It does however seem to clear up some other issues around unused code, so a deeper dive on which patch is dropping stuff is needed. I see a huge drop on am65x_evm_a53 / j721e_evm_a72 SPL as well but I can test those and at least the basic case is fine. socfpga_agilex_atf is one I don't know about being right or wrong. socfpga_agilex_vab dropping hashing code does look worrying however, but maybe it's a configuration issue in the end? --=20 Tom --U7PH6YjyT5379uVx Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmCRvzkACgkQFHw5/5Y0 tyxz1Av9Ewf+KwPJFFPgFlDV6jMvbYJTpf6d+I6Hvf77eAgnCTfKyMWdLwfN7M7e Vl7gQ0HIqDoqcIp2NtnyJUtPuQiLymvJYjqxARYEDTA5mDhLmO84Z+5zKGdrePSs sS7QCjDqVf4QvIF7kV5WGTKA9mfMJcEu9ityAIc7vwuHd/3pUgr8poWeNO6KEJxw H+wZsJMShitx4+lL47S2R1ORLMWY+Emav4ji5f29bRXGVacz6hdgziMvnNXwKIB7 cYr46Utnulo6xOwQ9EjLBwUjIAsmhIwnm7/sOr32dcPIsDnWlXKW8eJml8CCj9FD 1S0ohuUac7T8H6yEOvz3wmIKW6+zqvDx8bd9drRXxpw5lOlB9m8ibwRA8oLQRiNw H2JBKqyv0zMDVhFjmEIvtmb7w2AznKIj1nchCeNIOzwOEXgNl8T/YIMPsRS0BjoW XCRYGGm7EMzLL6F1bUq8mfp9mbP6ZowN6r9yVSFR1Jmlo1kyzP795UxU9OsJVyMr Zx16tkT7 =6qD1 -----END PGP SIGNATURE----- --U7PH6YjyT5379uVx-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Tue, 4 May 2021 17:40:16 -0400 Subject: [PATCH 00/49] image: Reduce #ifdefs and ad-hoc defines in image code In-Reply-To: <20210503231136.744283-1-sjg@chromium.org> References: <20210503231136.744283-1-sjg@chromium.org> Message-ID: <20210504214016.GA17669@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Mon, May 03, 2021 at 05:10:47PM -0600, Simon Glass wrote: > Much of the image-handling code predates the introduction of Kconfig and > has quite a few #ifdefs in it. It also uses its own IMAGE_... defines to > help reduce the #ifdefs, which is unnecessary now that we can use > IS_ENABLED() et al. > > The image code is also where quite a bit of code is shared with the host > tools. At present this uses a lot of checks of USE_HOSTCC. > > This series introduces 'host' Kconfig options and a way to use > CONFIG_IS_ENABLED() to check them. This works in a similar way to SPL, so > > CONFIG_IS_ENABLED(FIT) > > will evaluate to true on the host build (USE_HOSTCC) if CONFIG_HOST_FIT is > enabled. This allows quite a bit of clean-up of the image.h header file > and many of the image C files. > > The 'host' Kconfig options should help to solve a more general problem in > that we mostly want the host tools to build with all features enabled, no > matter which features the 'target' build actually uses. This is a pain to > arrange at present, but with 'host' Kconfigs, we can just define them all > to y. > > There are cases where the host tools do not have features which are > present on the target, for example environment and physical addressing. > To help with this, some of the core image code is split out into > image-board.c and image-host.c files. > > Even with these changes, some #ifdefs remain (101 down to 42 in > common/image*). But the code is somewhat easier to follow and there are > fewer build paths. > > In service of the above, this series includes a patch to add an API function > for zstd, so the code can be dropped from bootm.c > > It also introduces a function to handle manual relocation. I like this idea overall. The good news is this reduces the size in a few places. The bad news, but I can live with if we can't restructure the changes more, is a few functions grow a bit. This shows the good and the bad (something like sama5d2_ptc_ek_mmc shows only growth, to be clear): px30-core-edimm2.2-px30: all -36 rodata -24 text -12 u-boot: add: 0/0, grow: 3/-4 bytes: 36/-48 (-12) function old new delta boot_get_fdt 896 924 +28 image_decomp 372 376 +4 boot_get_ramdisk 868 872 +4 do_bootm_vxworks 552 540 -12 do_bootm_rtems 124 112 -12 do_bootm_plan9 228 216 -12 do_bootm_netbsd 324 312 -12 odroid-c2 : all -105 bss +128 rodata -65 text -168 u-boot: add: 0/0, grow: 2/-3 bytes: 108/-172 (-64) function old new delta images 504 608 +104 image_decomp 372 376 +4 image_setup_linux 108 96 -12 boot_get_ramdisk 620 580 -40 boot_get_fdt 660 540 -120 origen : all +47 bss +96 rodata -57 text +8 u-boot: add: 0/0, grow: 15/-2 bytes: 180/-104 (76) function old new delta images 288 340 +52 do_bootm_states 1304 1348 +44 do_bootz 164 176 +12 do_bootm_vxworks 332 344 +12 image_setup_libfdt 168 176 +8 image_decomp 156 164 +8 bootm_find_images 212 220 +8 boot_prep_linux 276 284 +8 image_setup_linux 54 58 +4 do_bootm_standalone 60 64 +4 do_bootm_plan9 104 108 +4 do_bootm_netbsd 168 172 +4 boot_prep_vxworks 48 52 +4 boot_jump_vxworks 6 10 +4 boot_jump_linux 148 152 +4 boot_get_ramdisk 420 392 -28 boot_get_fdt 420 344 -76 And looking at ls1088ardb_sdcard_qspi_SECURE_BOOT I think there might be something wrong as that looks to drop all crypto algos from SPL. Other layerscape SECURE_BOOT configs show this as well. It does however seem to clear up some other issues around unused code, so a deeper dive on which patch is dropping stuff is needed. I see a huge drop on am65x_evm_a53 / j721e_evm_a72 SPL as well but I can test those and at least the basic case is fine. socfpga_agilex_atf is one I don't know about being right or wrong. socfpga_agilex_vab dropping hashing code does look worrying however, but maybe it's a configuration issue in the end? -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: