arm: rockchip: Guard call of board_early_init_f in SPL
Subsystems (3)
PATCH 1/1 arm: rockchip: Guard call of board_early_init_f in SPL
Today, no platforms call board_early_init_f, and rockchip provides a weak default function. Change this to not providing a weak function and only call board_early_init_f if CONFIG_BOARD_EARLY_INIT_F is enabled. This will allow any potential future needs to be taken care of, and make future consolidation easier.
---
Cc: Philipp Tomsich <[email protected]>
Cc: Kever Yang <[email protected]>
--- arch/arm/mach-rockchip/spl.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
arch/arm/mach-rockchip/spl.c +2 -6
@@ -97,11 +97,6 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)return MMCSD_MODE_RAW ; } -__weak int board_early_init_f (void ) -{ -return 0 ; -} -__weak int arch_cpu_init (void ) {return 0 ;
@@ -111,7 +106,8 @@ void board_init_f(ulong dummy) {int ret; -board_early_init_f (); +if (IS_ENABLED (CONFIG_BOARD_EARLY_INIT_F )) +board_early_init_f (); ret =spl_early_init ();if (ret) {
Signature · 1 line
2.43.0
Hi Tom,
Quoted 31 lines · Tom Rini
Today, no platforms call
board_early_init_f, and rockchip provides a weak default function. Change this to not providing a weak function and only callboard_early_init_fifCONFIG_BOARD_EARLY_INIT_Fis enabled. This will allow any potential future needs to be taken care of, and make future consolidation easier.Signed-off-by Tom Rini <[email protected]>---
Cc: Philipp Tomsich <[email protected]>
Cc: Kever Yang <[email protected]>--- arch/arm/mach-rockchip/spl.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)arch/arm/mach-rockchip/spl.c +0
-5@@ -97,11 +97,6 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)return MMCSD_MODE_RAW ; } -__weak int board_early_init_f (void ) -{ -return 0 ; -} -__weak int arch_cpu_init (void ) {return 0 ;
arch/arm/mach-rockchip/spl.c void board_init_f(ulong dummy) · line 109
Quoted 5 lines
arch/arm/mach-rockchip/spl.c +1
-1@@ -111,7 +106,8 @@ void board_init_f(ulong dummy) {int ret; -board_early_init_f (); +if (IS_ENABLED (CONFIG_BOARD_EARLY_INIT_F ))
This patch seem to introduce a change in behavior for chromebook bob and kevin, they do not seem to enable BOARD_EARLY_INIT_F, yet they have a board_early_init_f() in board/google/gru/gru.c no longer being called after this change.
I do not have a chromebook_bob/kevin so I cannot help verify if this change break anything, hopefully Simon can help test/verify.
Regards,
Jonas
Quoted 4 lines
arch/arm/mach-rockchip/spl.c +1
-0+board_early_init_f (); ret =spl_early_init ();if (ret) {
Hi Jonas,
Quoted 46 lines · Jonas Karlman
Hi Tom,
Quoted 31 lines · Tom Rini
Today, no platforms call
board_early_init_f, and rockchip provides a weak default function. Change this to not providing a weak function and only callboard_early_init_fifCONFIG_BOARD_EARLY_INIT_Fis enabled. This will allow any potential future needs to be taken care of, and make future consolidation easier.Signed-off-by Tom Rini <[email protected]>---
Cc: Philipp Tomsich <[email protected]>
Cc: Kever Yang <[email protected]>--- arch/arm/mach-rockchip/spl.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)arch/arm/mach-rockchip/spl.c +0
-5@@ -97,11 +97,6 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)return MMCSD_MODE_RAW ; } -__weak int board_early_init_f (void ) -{ -return 0 ; -} -__weak int arch_cpu_init (void ) {return 0 ;arch/arm/mach-rockchip/spl.c void board_init_f(ulong dummy) · line 109
Quoted 5 lines
arch/arm/mach-rockchip/spl.c +1
-1@@ -111,7 +106,8 @@ void board_init_f(ulong dummy) {int ret; -board_early_init_f (); +if (IS_ENABLED (CONFIG_BOARD_EARLY_INIT_F ))This patch seem to introduce a change in behavior for chromebook bob and kevin, they do not seem to enable
BOARD_EARLY_INIT_F, yet they have aboard_early_init_f()inboard/google/gru/gru.cno longer being called after this change.
Quoted 2 lines
I do not have a chromebook_bob/kevin so I cannot help verify if this change break anything, hopefully Simon can help test/verify.
Kevin spews some junk to the console with or without this patch.
No change observed on bob or kevin. BTW both are in the lab so you should be able to test if you push to your tree.
Quoted 6 lines
arch/arm/mach-rockchip/spl.c void board_init_f(ulong dummy) · line 113
Quoted 5 lines
arch/arm/mach-rockchip/spl.c +1
-0+board_early_init_f (); ret =spl_early_init ();if (ret) {
Regards,
Simon
Quoted 48 lines · Simon Glass
Hi Jonas,
Quoted 45 lines · Jonas Karlman
Hi Tom,
Quoted 31 lines · Tom Rini
Today, no platforms call
board_early_init_f, and rockchip provides a weak default function. Change this to not providing a weak function and only callboard_early_init_fifCONFIG_BOARD_EARLY_INIT_Fis enabled. This will allow any potential future needs to be taken care of, and make future consolidation easier.Signed-off-by Tom Rini <[email protected]>---
Cc: Philipp Tomsich <[email protected]>
Cc: Kever Yang <[email protected]>--- arch/arm/mach-rockchip/spl.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)arch/arm/mach-rockchip/spl.c +0
-5@@ -97,11 +97,6 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)return MMCSD_MODE_RAW ; } -__weak int board_early_init_f (void ) -{ -return 0 ; -} -__weak int arch_cpu_init (void ) {return 0 ;arch/arm/mach-rockchip/spl.c void board_init_f(ulong dummy) · line 109
Quoted 5 lines
arch/arm/mach-rockchip/spl.c +1
-1@@ -111,7 +106,8 @@ void board_init_f(ulong dummy) {int ret; -board_early_init_f (); +if (IS_ENABLED (CONFIG_BOARD_EARLY_INIT_F ))This patch seem to introduce a change in behavior for chromebook bob and kevin, they do not seem to enable
BOARD_EARLY_INIT_F, yet they have aboard_early_init_f()inboard/google/gru/gru.cno longer being called after this change.
I wouldn't call it a behavior change, since it's not called now, and this is the output from building before/after, checking for size differnces (and how I spotted odd cases as part of this overall work):
chromebook_bob : spl/u-boot-spl:all -8 spl/u-boot-spl:text -8
spl-u-boot-spl: add: 0/-1, grow: 0/-1 bytes: 0/-12 (-12)
function old new delta
board_init_f 148 144 -4
board_early_init_f 8 - -8
chromebook_kevin: spl/u-boot-spl:all -8 spl/u-boot-spl:text -8
spl-u-boot-spl: add: 0/-1, grow: 0/-1 bytes: 0/-12 (-12)
function old new delta
board_init_f 148 144 -4
board_early_init_f 8 - -8
Quoted 10 lines
Quoted 2 lines
I do not have a chromebook_bob/kevin so I cannot help verify if this change break anything, hopefully Simon can help test/verify.
Kevin spews some junk to the console with or without this patch.
No change observed on bob or kevin. BTW both are in the lab so you should be able to test if you push to your tree.
Perhaps the problem is those platforms should be enabling, but lost. I'll take a look, but would be unrelated to this (since if enabling BOARD_EARLY_INIT_F it would then call it).
Signature · 1 line
Tom
Quoted 50 lines · Tom Rini
Quoted 48 lines · Simon Glass
Hi Jonas,
Quoted 45 lines · Jonas Karlman
Hi Tom,
Quoted 31 lines · Tom Rini
Today, no platforms call
board_early_init_f, and rockchip provides a weak default function. Change this to not providing a weak function and only callboard_early_init_fifCONFIG_BOARD_EARLY_INIT_Fis enabled. This will allow any potential future needs to be taken care of, and make future consolidation easier.Signed-off-by Tom Rini <[email protected]>---
Cc: Philipp Tomsich <[email protected]>
Cc: Kever Yang <[email protected]>--- arch/arm/mach-rockchip/spl.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)arch/arm/mach-rockchip/spl.c +0
-5@@ -97,11 +97,6 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)return MMCSD_MODE_RAW ; } -__weak int board_early_init_f (void ) -{ -return 0 ; -} -__weak int arch_cpu_init (void ) {return 0 ;arch/arm/mach-rockchip/spl.c void board_init_f(ulong dummy) · line 109
Quoted 5 lines
arch/arm/mach-rockchip/spl.c +1
-1@@ -111,7 +106,8 @@ void board_init_f(ulong dummy) {int ret; -board_early_init_f (); +if (IS_ENABLED (CONFIG_BOARD_EARLY_INIT_F ))This patch seem to introduce a change in behavior for chromebook bob and kevin, they do not seem to enable
BOARD_EARLY_INIT_F, yet they have aboard_early_init_f()inboard/google/gru/gru.cno longer being called after this change.
Quoted 1 line
I wouldn't call it a behavior change, since it's not called now, and
You mean the function is currently being optimized out? Why would it not be called before the change introduced in this patch?
The code in board/google/gru/gru.c is silly and probably gets optimized out anyway, but the comment there suggest something was done to try and make so it was not.
Quoted 23 lines
this is the output from building before/after, checking for size differnces (and how I spotted odd cases as part of this overall work):
chromebook_bob: spl/u-boot-spl:all -8 spl/u-boot-spl:text -8
spl-u-boot-spl: add: 0/-1, grow: 0/-1 bytes: 0/-12 (-12)
function old new delta
board_init_f148 144 -4
board_early_init_f8 - -8
chromebook_kevin: spl/u-boot-spl:all -8 spl/u-boot-spl:text -8
spl-u-boot-spl: add: 0/-1, grow: 0/-1 bytes: 0/-12 (-12)
function old new delta
board_init_f148 144 -4
board_early_init_f8 - -8Quoted 8 lines
Quoted 2 lines
I do not have a chromebook_bob/kevin so I cannot help verify if this change break anything, hopefully Simon can help test/verify.
Kevin spews some junk to the console with or without this patch.
No change observed on bob or kevin. BTW both are in the lab so you should be able to test if you push to your tree.
Quoted 6 lines
Quoted 2 lines
Perhaps the problem is those platforms should be enabling, but lost. I'll take a look, but would be unrelated to this (since if enabling
BOARD_EARLY_INIT_Fit would then call it).
board_early_init_f() in gru.c is wrapped around CONFIG_XPL_BUILD so should only be included in SPL and was called from rockchip spl.c board_init_f() prior to this patch.
Based on Simons comment I guess the board_early_init_f() in gru.c probably could and should be fully removed, as it currently does not seem to provide the suggested delay.
Regards,
Jonas
Quoted 51 lines · Jonas Karlman
Quoted 50 lines · Tom Rini
Quoted 48 lines · Simon Glass
Hi Jonas,
Quoted 45 lines · Jonas Karlman
Hi Tom,
Quoted 31 lines · Tom Rini
Today, no platforms call
board_early_init_f, and rockchip provides a weak default function. Change this to not providing a weak function and only callboard_early_init_fifCONFIG_BOARD_EARLY_INIT_Fis enabled. This will allow any potential future needs to be taken care of, and make future consolidation easier.Signed-off-by Tom Rini <[email protected]>---
Cc: Philipp Tomsich <[email protected]>
Cc: Kever Yang <[email protected]>--- arch/arm/mach-rockchip/spl.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)arch/arm/mach-rockchip/spl.c +0
-5@@ -97,11 +97,6 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device)return MMCSD_MODE_RAW ; } -__weak int board_early_init_f (void ) -{ -return 0 ; -} -__weak int arch_cpu_init (void ) {return 0 ;arch/arm/mach-rockchip/spl.c void board_init_f(ulong dummy) · line 109
Quoted 5 lines
arch/arm/mach-rockchip/spl.c +1
-1@@ -111,7 +106,8 @@ void board_init_f(ulong dummy) {int ret; -board_early_init_f (); +if (IS_ENABLED (CONFIG_BOARD_EARLY_INIT_F ))This patch seem to introduce a change in behavior for chromebook bob and kevin, they do not seem to enable
BOARD_EARLY_INIT_F, yet they have aboard_early_init_f()inboard/google/gru/gru.cno longer being called after this change.
Quoted 8 lines
Quoted 1 line
I wouldn't call it a behavior change, since it's not called now, and
You mean the function is currently being optimized out? Why would it not be called before the change introduced in this patch?
The code in
board/google/gru/gru.cis silly and probably gets optimized out anyway, but the comment there suggest something was done to try and make so it was not.
You're right, sorry. Since the size change is the exact same as every platform that was calling the weak function, it seemed like it must have not been using that gru.c version at all. But building on top of this patch and enabling BOARD_EARLY_INIT_F for bob/kevin (and some quick rework so that full U-Boot links), and there's no size change to SPL.
Quoted 30 lines
Quoted 23 lines
this is the output from building before/after, checking for size differnces (and how I spotted odd cases as part of this overall work):
chromebook_bob: spl/u-boot-spl:all -8 spl/u-boot-spl:text -8
spl-u-boot-spl: add: 0/-1, grow: 0/-1 bytes: 0/-12 (-12)
function old new delta
board_init_f148 144 -4
board_early_init_f8 - -8
chromebook_kevin: spl/u-boot-spl:all -8 spl/u-boot-spl:text -8
spl-u-boot-spl: add: 0/-1, grow: 0/-1 bytes: 0/-12 (-12)
function old new delta
board_init_f148 144 -4
board_early_init_f8 - -8Quoted 8 lines
Quoted 2 lines
I do not have a chromebook_bob/kevin so I cannot help verify if this change break anything, hopefully Simon can help test/verify.
Kevin spews some junk to the console with or without this patch.
No change observed on bob or kevin. BTW both are in the lab so you should be able to test if you push to your tree.
Quoted 6 lines
Quoted 2 lines
Perhaps the problem is those platforms should be enabling, but lost. I'll take a look, but would be unrelated to this (since if enabling
BOARD_EARLY_INIT_Fit would then call it).
Quoted 7 lines
board_early_init_f()ingru.cis wrapped aroundCONFIG_XPL_BUILDso should only be included in SPL and was called from rockchipspl.cboard_init_f()prior to this patch.Based on Simons comment I guess the
board_early_init_f()ingru.cprobably could and should be fully removed, as it currently does not seem to provide the suggested delay.
Yes, both currently go green in GitLab when we run CI on them, with or without this patch, so there's no change in the end.
Signature · 1 line
Tom