All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/14] powerpc: Enable LTO on mpc85xx
@ 2026-11-19 13:32 Josef Schlehofer
  2026-11-19 13:32 ` [PATCH v3 01/14] board: nxp: p1_p2_rdb_pc, p1010rdb: Drop unused SPL gd copy Josef Schlehofer
                   ` (13 more replies)
  0 siblings, 14 replies; 24+ messages in thread
From: Josef Schlehofer @ 2026-11-19 13:32 UTC (permalink / raw)
  To: u-boot, Bradley Morgan
  Cc: Tom Rini, Marek Behún, Marek Mojík, Peng Fan,
	Priyanka Jain, Qiang Zhao, Shengzhou Liu,
	Christophe Leroy (CS GROUP), Mario Six, Dario Binacchi,
	Michael Trimarchi, Heiko Schocher, Holger Brunck, Simon Glass

This series allows LTO on mpc85xx and enables it for the CZ.NIC
Turris 1.x. The Turris NOR image is limited to 768 KiB. LTO, together
with dropping NVMe and SCSI from the NOR build, makes room for the ubi
command and the BCH ECC code required by the NAND.

v3 is based on next, which has "Makefile: Set LTO_ENABLE before
including config.mk" [1], needed by patch 7. On u-boot-ppc next,
patch 2 conflicts in board/nxp/t104xrdb/spl.c, which that branch
removes. Dropping that hunk resolves it.

The series consists of:

1-2. PowerPC global data:
- Drop an unused SPL copy of gd.
- Make the global data pointer LTO-safe.

3-5. PowerPC private libgcc:
- Add GCC's out-of-line register save and restore routines from Linux.
- Add 64-bit division routines.
- Select the private libgcc for mpc85xx LTO builds, as the LTO link
  puts it inside --whole-archive, where a toolchain libgcc does not
  link.

6-9. mpc85xx LTO support:
- Discard the LTO keep-syms section and its fixups.
- Drop -ffunction-sections and -fdata-sections with LTO, as 32-bit ARM
  does.
- Allow CONFIG_LTO=y on mpc85xx.
- Pass the make jobserver to xPL links, as GCC 12's lto-wrapper
  requires.

10-14. Turris 1.x:
- Enable LTO.
- Select the BCH ECC code required by the NAND.
- Make the NVMe and SCSI boot targets conditional.
- Add the ubi command to the NOR build.
- Put the OTP MAC addresses and serial number into the kernel device
  tree also after the environment has been reset.

On next, the turris_1x_sdcard u-boot.bin is 1052227 bytes, 3651 bytes
more than the 1 MiB that its SPL loads from the card. The build does
not catch this. Patch 10 brings the image back below the limit. Patch
11 fixes a separate problem: without it, NAND probing hits BUG().

With Debian's GCC 14.2, turris_1x_nor's u-boot-nodtb.bin shrinks from
759880 to 752752 bytes while gaining LTO, BCH ECC and the ubi command
and dropping NVMe and SCSI. The turris_1x_sdcard u-boot.bin shrinks
from 1052227 to 998051 bytes.

All 83 PowerPC defconfigs build, and all 71 mpc85xx defconfigs link
with CONFIG_LTO=y. No .discard* section or zero fixup entry remains.
test.py on qemu-ppce500 gives the same results as on next, with and
without LTO. With the kernel.org GCC 14.2 used by CI, both Turris LTO
builds fit. With Debian's GCC 12.2 and make 4.3 in a Debian bookworm
container, the Turris SD card SPL links at -j8 only with patch 9.

v2 was boot-tested on a Turris 1.1 from NOR and SD card. Its NOR build
also booted OpenWrt from a kernel in a UBI volume on NAND, and Linux
received the OTP MAC addresses and serial number even after
"env default -a". With the SD card build, ethaddr and serial# values
set in the environment were preserved. Against v2, the code of v3
changes only in two comments of patch 4. v3 was rebased onto next and
build-tested only, as were the other boards.

Changes in v3:
- Based on next, which has the generic LTO fixes v2 depended on.
- Patch 4: name lib/div64.c as the source more clearly and explain why
  the high word is only divided first when the divisor fits into
  32 bits, as Bradley Morgan asked.
- Patch 7: compare with 32-bit ARM, as ARM64 keeps both flags with LTO.
- Collect Bradley's Reviewed-by tags.
- Measure the sizes again on next.

Changes in v2:
- Based on main.
- Replace "Makefile: Link a toolchain libgcc outside --whole-archive
  with LTO" with patches 3-5, which make the private libgcc work for
  mpc85xx LTO builds.
- Add patch 7 to drop -ffunction-sections and -fdata-sections with LTO.
- Send "Makefile: Skip undefined symbols in keep-syms-lto.c" and
  "Makefile: Pass -static to the LTO link" separately.
- Explain in patch 10 that the SD card image already exceeds 1 MiB
  without BCH ECC.
- Shorten the commit messages of patches 6 and 9.
- Keep Marek Mojík's Reviewed-by from v1. His Tested-by is not carried
  over because the images have changed.

[1] commit 5f3bcac3f7f9 ("Makefile: Set LTO_ENABLE before including config.mk")
v2: https://lore.kernel.org/u-boot/20261018083516.49229-1-pepe.schlehofer@gmail.com/
v1: https://lore.kernel.org/u-boot/20260928110434.70686-1-pepe.schlehofer@gmail.com/

Josef Schlehofer (14):
  board: nxp: p1_p2_rdb_pc, p1010rdb: Drop unused SPL gd copy
  powerpc: Make the global data pointer LTO safe
  powerpc: lib: Add GPR save and restore routines to the private libgcc
  powerpc: lib: Add 64-bit division to the private libgcc
  powerpc: mpc85xx: Use the private libgcc with LTO
  powerpc: mpc85xx: Discard LTO keep-syms sections
  powerpc: Drop -ffunction-sections and -fdata-sections with LTO
  powerpc: mpc85xx: Allow LTO
  xpl: Pass the make jobserver to the xPL link
  configs: turris_1x: Enable LTO
  mtd: rawnand: fsl_elbc: Select NAND_ECC_BCH
  board: CZ.NIC: turris_1x: Make NVMe and SCSI boot targets conditional
  configs: turris_1x_nor: Enable CMD_UBI, drop NVMe and SCSI
  board: CZ.NIC: turris_1x: Fix up MACs and serial number from OTP

 arch/powerpc/Kconfig                      |   2 +
 arch/powerpc/config.mk                    |   8 +-
 arch/powerpc/cpu/mpc83xx/cpu_init.c       |   3 +-
 arch/powerpc/cpu/mpc83xx/spl_minimal.c    |   3 +-
 arch/powerpc/cpu/mpc85xx/cpu_init_early.c |   3 +-
 arch/powerpc/cpu/mpc85xx/u-boot-spl.lds   |  11 +-
 arch/powerpc/cpu/mpc85xx/u-boot.lds       |  11 +-
 arch/powerpc/include/asm/global_data.h    |  30 +++
 arch/powerpc/lib/Makefile                 |   5 +-
 arch/powerpc/lib/crtsavres.S              | 213 ++++++++++++++++++++++
 arch/powerpc/lib/gd.c                     |  14 ++
 arch/powerpc/lib/udivdi3.c                |  85 +++++++++
 board/CZ.NIC/turris_1x/turris_1x.c        |  20 ++
 board/nxp/p1010rdb/spl.c                  |   9 +-
 board/nxp/p1010rdb/spl_minimal.c          |   2 +-
 board/nxp/p1_p2_rdb_pc/p1_p2_rdb_pc.c     |   3 +
 board/nxp/p1_p2_rdb_pc/spl.c              |   9 +-
 board/nxp/p1_p2_rdb_pc/spl_minimal.c      |   2 +-
 board/nxp/t102xrdb/spl.c                  |   4 +-
 board/nxp/t104xrdb/spl.c                  |   4 +-
 board/nxp/t208xqds/spl.c                  |   4 +-
 board/nxp/t208xrdb/spl.c                  |   4 +-
 board/nxp/t4rdb/spl.c                     |   4 +-
 common/board_r.c                          |   2 +-
 common/init/board_init.c                  |   9 +-
 common/spl/spl.c                          |   4 +-
 configs/kmcoge5ne_defconfig               |   1 -
 configs/turris_1x_nor_defconfig           |  10 +-
 configs/turris_1x_sdcard_defconfig        |   2 +-
 doc/build/gcc.rst                         |   6 +-
 drivers/mtd/nand/raw/Kconfig              |   2 +
 include/configs/turris_1x.h               |  20 +-
 scripts/Makefile.xpl                      |   2 +-
 33 files changed, 449 insertions(+), 62 deletions(-)
 create mode 100644 arch/powerpc/lib/crtsavres.S
 create mode 100644 arch/powerpc/lib/gd.c
 create mode 100644 arch/powerpc/lib/udivdi3.c


base-commit: e6fa1282975af50acf44be7aa678b89e187f0860
-- 
2.54.0 (Apple Git-157)


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

end of thread, other threads:[~2026-11-20 16:18 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 13:32 [PATCH v3 00/14] powerpc: Enable LTO on mpc85xx Josef Schlehofer
2026-11-19 13:32 ` [PATCH v3 01/14] board: nxp: p1_p2_rdb_pc, p1010rdb: Drop unused SPL gd copy Josef Schlehofer
2026-11-19 13:32 ` [PATCH v3 02/14] powerpc: Make the global data pointer LTO safe Josef Schlehofer
2026-11-19 13:32 ` [PATCH v3 03/14] powerpc: lib: Add GPR save and restore routines to the private libgcc Josef Schlehofer
2026-11-19 13:33 ` [PATCH v3 04/14] powerpc: lib: Add 64-bit division " Josef Schlehofer
2026-11-19 14:21   ` Christophe Leroy (CS GROUP)
2026-11-19 16:01     ` Bradley Morgan
2026-11-19 18:42       ` Josef Schlehofer
2026-11-19 18:55         ` Bradley Morgan
2026-11-20  9:08           ` Josef Schlehofer
2026-11-20 16:04             ` Bradley Morgan
2026-11-20 16:16               ` Tom Rini
2026-11-20 16:18                 ` Bradley Morgan
2026-11-19 20:09         ` Tom Rini
2026-11-19 13:33 ` [PATCH v3 05/14] powerpc: mpc85xx: Use the private libgcc with LTO Josef Schlehofer
2026-11-19 13:33 ` [PATCH v3 06/14] powerpc: mpc85xx: Discard LTO keep-syms sections Josef Schlehofer
2026-11-19 13:33 ` [PATCH v3 07/14] powerpc: Drop -ffunction-sections and -fdata-sections with LTO Josef Schlehofer
2026-11-19 13:33 ` [PATCH v3 08/14] powerpc: mpc85xx: Allow LTO Josef Schlehofer
2026-11-19 13:33 ` [PATCH v3 09/14] xpl: Pass the make jobserver to the xPL link Josef Schlehofer
2026-11-19 13:33 ` [PATCH v3 10/14] configs: turris_1x: Enable LTO Josef Schlehofer
2026-11-19 13:33 ` [PATCH v3 11/14] mtd: rawnand: fsl_elbc: Select NAND_ECC_BCH Josef Schlehofer
2026-11-19 13:33 ` [PATCH v3 12/14] board: CZ.NIC: turris_1x: Make NVMe and SCSI boot targets conditional Josef Schlehofer
2026-11-19 13:33 ` [PATCH v3 13/14] configs: turris_1x_nor: Enable CMD_UBI, drop NVMe and SCSI Josef Schlehofer
2026-11-19 13:33 ` [PATCH v3 14/14] board: CZ.NIC: turris_1x: Fix up MACs and serial number from OTP Josef Schlehofer

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.