powerpc: Enable LTO on mpc85xx
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest14 patches 9 repliesIn review
- v2 posting 2/214 patches 10 repliesSuperseded
- v2 posting 1/21 patch 1 replySuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 13 patches | 14 replies | Superseded |
Changes in v3 from the cover letter
- 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.
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/14 | board: nxp: p1_p2_rdb_pc, p1010rdb: Drop unused SPL gd copyboard/ board/ | +2 | 0 replies | |
| 2/14 | powerpc: Make the global data pointer LTO safearch/ arch/ arch/ +13 more | +69 | 0 replies | |
| 3/14 | powerpc: lib: Add GPR save and restore routines to the private libgccarch/ arch/ | +215 | 0 replies | |
| 4/14 | powerpc: lib: Add 64-bit division to the private libgccarch/ arch/ | +87 | 9 replies | |
| 5/14 | powerpc: mpc85xx: Use the private libgcc with LTOarch/ | +1 | 0 replies | |
| 6/14 | powerpc: mpc85xx: Discard LTO keep-syms sectionsarch/ arch/ | +20 | 0 replies | |
| 7/14 | powerpc: Drop -ffunction-sections and -fdata-sections with LTOarch/ | +6 | 0 replies | |
| 8/14 | powerpc: mpc85xx: Allow LTOarch/ doc/ | +4 | 0 replies | |
| 9/14 | xpl: Pass the make jobserver to the xPL linkscripts/ | +1 | 0 replies | |
| 10/14 | configs: turris_1x: Enable LTOconfigs/ configs/ | +2 | 0 replies | |
| 11/14 | mtd: rawnand: fsl_elbc: Select NAND_ECC_BCHconfigs/ configs/ configs/ +1 more | +2 | 0 replies | |
| 12/14 | board: CZ.NIC: turris_1x: Make NVMe and SCSI boot targets conditionalinclude/ | +16 | 0 replies | |
| 13/14 | configs: turris_1x_nor: Enable CMD_UBI, drop NVMe and SCSIconfigs/ | +2 | 0 replies | |
| 14/14 | board: CZ.NIC: turris_1x: Fix up MACs and serial number from OTPboard/ board/ | +23 | 0 replies |
Reviews trailers per patch
12 of 14 patches have a Reviewed-by or Acked-by.
| Patch | Marek Mojík | Bradley Morgan | Tom Rini |
|---|---|---|---|
| 1/14 | R-b | ||
| 2/14 | R-b | ||
| 3/14 | |||
| 4/14 | R-b | ||
| 5/14 | R-b | ||
| 6/14 | R-b | ||
| 7/14 | |||
| 8/14 | R-b | ||
| 9/14 | R-b | ||
| 10/14 | R-b | R-b | |
| 11/14 | R-b | ||
| 12/14 | R-b | R-b | |
| 13/14 | R-b | R-b | |
| 14/14 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH v3 00/14] powerpc: Enable LTO on mpc85xx
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/[email protected]/
v1: https://lore.kernel.org/u-boot/[email protected]/
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
Signature · 1 line
2.54.0 (Apple Git-157)