dm: core: Inline a few ofnode functions in SPL
PATCH 1/1 dm: core: Inline a few ofnode functions in SPL
A recent change to unify the flattree/livetree code introduced a small size increase in SPL on some boards. For example SPL code size for px30-core-ctouch2-px30 increased by 40 bytes.
To address this we can take advantage of the fact that some of the ofnode functions are only called a few times in SPL, so it is worth inlining them.
Add new Kconfig options to control this. These functions are not inlined for U-Boot proper, since this increases code size.
---
This series mostly improves code size:
04: dm: core: Inline a few ofnode functions in SPL
arm: brppt1_spi brsmarc1
aarch64: (for 267/267 boards) spl/u-boot-spl:all -8.9 spl/u-boot-spl:text -8.9
arm: (for 693/693 boards) all +65.1 bss +0.2 data +64.9 rodata +0.0 spl/u-boot-spl:all -6.6 spl/u-boot-spl:text -6.6 text -0.0
microblaze: (for 1/1 boards) spl/u-boot-spl:all -132.0 spl/u-boot-spl:text -132.0
mips: (for 44/44 boards) spl/u-boot-spl:all -9.0 spl/u-boot-spl:text -9.0
riscv: (for 18/18 boards) spl/u-boot-spl:all +17.3 spl/u-boot-spl:text +17.3
x86: (for 28/28 boards) spl/u-boot-spl:all -6.1 spl/u-boot-spl:text -6.1 tpl/u-boot-tpl:all -1.5 tpl/u-boot-tpl:text -1.5For the particular board mentioned with the problem (px30-core-ctouch2-px30) it erases the size 40-byte increase:
04: dm: core: Inline a few ofnode functions in SPL
aarch64: (for 1/1 boards) spl/u-boot-spl:all -84.0 spl/u-boot-spl:text -84.0
drivers/core/Kconfig | 16 +++++++++++++ drivers/core/ofnode.c | 2 ++ include/dm/ofnode.h | 56 ++++++++++++++++++++++++++++++++++--------- 3 files changed, 63 insertions(+), 11 deletions(-)
drivers/core/Kconfig +16 -0
@@ -113,6 +113,22 @@ config SPL_DM_SEQ_ALIAS numbered devices (e.g. serial0 = &serial0). This feature can be disabled if it is not required, to save code space in SPL. +config SPL_DM_INLINE_OFNODE + bool "Inline some ofnode functions which are seldom used in SPL" + depends on SPL_DM + default y + help + This applies to several ofnode functions (see ofnode.h) which are + seldom used. Inlining them can help reduce code size. + +config TPL_DM_INLINE_OFNODE + bool "Inline some ofnode functions which are seldom used in TPL" + depends on TPL_DM + default y + help + This applies to several ofnode functions (see ofnode.h) which are + seldom used. Inlining them can help reduce code size. + config REGMAP bool "Support register maps" depends on DM
drivers/core/ofnode.c +2 -0
@@ -226,6 +226,7 @@ int ofnode_read_u32_array(ofnode node, const char *propname, } } +#if !CONFIG_IS_ENABLED (DM_INLINE_OFNODE )bool ofnode_is_enabled (ofnode node) {if (ofnode_is_np (node)) {
@@ -255,6 +256,7 @@ ofnode ofnode_next_subnode(ofnode node)return offset_to_ofnode ( fdt_next_subnode(gd->fdt_blob, ofnode_to_offset(node))); } +#endif /* !DM_INLINE_OFNODE */ ofnode ofnode_get_parent (ofnode node) {
include/dm/ofnode.h +45 -11
80 lines not on this page · raw message
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 1/1 dm: core: Inline a few ofnode functions in SPL
A recent change to unify the flattree/livetree code introduced a small size increase in SPL on some boards. For example SPL code size for px30-core-ctouch2-px30 increased by 40 bytes.
To address this we can take advantage of the fact that some of the ofnode functions are only called a few times in SPL, so it is worth inlining them.
Add new Kconfig options to control this. These functions are not inlined for U-Boot proper, since this increases code size.
---
This series mostly improves code size:
04: dm: core: Inline a few ofnode functions in SPL
arm: brppt1_spi brsmarc1
aarch64: (for 267/267 boards) spl/u-boot-spl:all -8.9
spl/u-boot-spl:text -8.9
arm: (for 693/693 boards) all +65.1 bss +0.2 data +64.9 rodata
+0.0 spl/u-boot-spl:all -6.6 spl/u-boot-spl:text -6.6 text -0.0
microblaze: (for 1/1 boards) spl/u-boot-spl:all -132.0
spl/u-boot-spl:text -132.0
mips: (for 44/44 boards) spl/u-boot-spl:all -9.0 spl/u-boot-spl:text -9.0
riscv: (for 18/18 boards) spl/u-boot-spl:all +17.3
spl/u-boot-spl:text +17.3
x86: (for 28/28 boards) spl/u-boot-spl:all -6.1spl/u-boot-spl:text -6.1 tpl/u-boot-tpl:all -1.5 tpl/u-boot-tpl:text -1.5
For the particular board mentioned with the problem (px30-core-ctouch2-px30) it erases the size 40-byte increase:
04: dm: core: Inline a few ofnode functions in SPL
aarch64: (for 1/1 boards) spl/u-boot-spl:all -84.0 spl/u-boot-spl:text -84.0
drivers/core/Kconfig | 16 +++++++++++++ drivers/core/ofnode.c | 2 ++ include/dm/ofnode.h | 56 ++++++++++++++++++++++++++++++++++--------- 3 files changed, 63 insertions(+), 11 deletions(-)
Applied to u-boot-dm/next, thanks!