arm: Correct cpu_reset function prototype on some platforms
Subsystems (4)
PATCH 1/6 arm: Correct cpu_reset function prototype on some platforms
Some platforms were not including <cpu_func.h> which sets the prototype for reset_cpu, and in turn had it set wrong. Correct these cases.
--- arch/arm/mach-hpe/gxp/reset.c | 3 ++- arch/arm/mach-mediatek/mt7981/init.c | 3 ++- arch/arm/mach-mediatek/mt7986/init.c | 3 ++- board/armltd/corstone1000/corstone1000.c | 3 ++- board/bosch/acc/acc.c | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-)
arch/arm/mach-hpe/gxp/reset.c +2 -1
@@ -7,6 +7,7 @@* Author: Jean-Marie Verdun <[email protected]> */ +#include <cpu_func.h> #include <asm/io.h> #define GXP_CCR 0xc0000000
@@ -16,7 +17,7 @@ void lowlevel_init(void) { } -void reset_cpu (ulong ignored) +void reset_cpu (void ) {writel (1 ,GXP_CCR );
arch/arm/mach-mediatek/mt7981/init.c +2 -1
@@ -4,6 +4,7 @@* Author: Sam Shih <[email protected]> */ +#include <cpu_func.h> #include <init.h> #include <asm/armv8/mmu.h> #include <asm/system.h>
@@ -19,7 +20,7 @@ int dram_init(void)return 0 ; } -void reset_cpu (ulong addr) +void reset_cpu (void ) {psci_system_reset (); }
arch/arm/mach-mediatek/mt7986/init.c +2 -1
@@ -4,6 +4,7 @@* Author: Sam Shih <[email protected]> */ +#include <cpu_func.h> #include <init.h> #include <asm/armv8/mmu.h> #include <asm/system.h>
@@ -19,7 +20,7 @@ int dram_init(void)return 0 ; } -void reset_cpu (ulong addr) +void reset_cpu (void ) {psci_system_reset (); }
board/armltd/corstone1000/corstone1000.c +2 -1
@@ -6,6 +6,7 @@*/ #include <common.h> +#include <cpu_func.h> #include <dm.h> #include <netdev.h> #include <dm/platform_data/serial_pl01x.h>
@@ -86,6 +87,6 @@ int dram_init_banksize(void)return 0 ; } -void reset_cpu (ulong addr) +void reset_cpu (void ) { }
board/bosch/acc/acc.c +2 -1
@@ -6,6 +6,7 @@*/ #include <common.h> +#include <cpu_func.h> #include <bootstage.h> #include <dm.h> #include <dm/platform_data/serial_mxc.h>
@@ -720,7 +721,7 @@ int board_fit_config_name_match(const char *name)return -1 ; } -void reset_cpu (ulong addr) +void reset_cpu (void ) {puts ("Hanging CPU for watchdog reset!\n" );hang ();
Signature · 1 line
2.34.1
PATCH 2/6 spl: Add function prototype for spl_mmc_get_uboot_raw_sector
We did not add a prototype for spl_mmc_get_uboot_raw_sector to include/spl.h before, so add and document one now. Correct the incorrect prototype in board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c and ensure that we have spl.h where we define a non-weak spl_mmc_get_uboot_raw_sector as well.
--- arch/arm/mach-imx/image-container.c | 1 + board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c | 3 ++- include/spl.h | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-)
arch/arm/mach-imx/image-container.c +1 -0
@@ -10,6 +10,7 @@#include <asm/io.h> #include <mmc.h> #include <spi_flash.h> +#include <spl.h> #include <nand.h> #include <asm/mach-imx/image.h> #include <asm/arch/sys_proto.h>
board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c +2 -1
@@ -208,7 +208,8 @@ int board_late_init(void)#ifdef CONFIG_SPL_MMC #define UBOOT_RAW_SECTOR_OFFSET 0x40 -unsigned long spl_mmc_get_uboot_raw_sector (struct mmc *mmc) +unsigned long spl_mmc_get_uboot_raw_sector (struct mmc *mmc, +unsigned long raw_sector) {u32 boot_dev =spl_boot_device ();
include/spl.h +13 -0
@@ -466,6 +466,19 @@ int spl_mmc_emmc_boot_partition(struct mmc *mmc);void spl_set_bd (void ); +/** +* spl_mmc_get_uboot_raw_sector() - Provide raw sector of the start of U-Boot +* +* This is a weak function which by default will provide the raw sector that is +* where the start of the U-Boot image has been written to. +* +* @mmc: struct mmc that describes the devie where U-Boot resides +* @raw_sect: The raw sector number where U-Boot is by default. +* Return: The raw sector location that U-Boot resides at +*/ +unsigned long spl_mmc_get_uboot_raw_sector (struct mmc *mmc, +unsigned long raw_sect); +/** * spl_set_header_raw_uboot() - Set up a standard SPL image structure *
Signature · 1 line
2.34.1
Re: [PATCH 2/6] spl: Add function prototype for spl_mmc_get_uboot_raw_sector
Quoted 7 lines · Tom Rini
We did not add a prototype for
spl_mmc_get_uboot_raw_sectortoinclude/spl.hbefore, so add and document one now. Correct the incorrect prototype inboard/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.cand ensure that we havespl.hwhere we define a non-weakspl_mmc_get_uboot_raw_sectoras well.Signed-off-by Tom Rini <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH 3/6 examples: Don't use LTO for hello_world
In reply to Tom RiniIf we're building U-Boot with LTO, we don't want to use that for examples as it's more work than required.
--- examples/standalone/Makefile | 4 ++++ 1 file changed, 4 insertions(+)
examples/standalone/Makefile +4 -0
@@ -29,6 +29,10 @@ targets += $(patsubst $(obj)/%,%,$(LIB)) $(COBJS) $(LIBOBJS-y) LIBOBJS := $(addprefix $(obj)/,$(LIBOBJS-y)) ELF := $(addprefix $(obj)/,$(ELF)) +# Disable LTO for these builds +CFLAGS_REMOVE_hello_world.o := $(LTO_CFLAGS) +CFLAGS_REMOVE_stubs.o := $(LTO_CFLAGS) + # For PowerPC there's no need to compile standalone applications as a # relocatable executable. The relocation data is not needed, and # also causes the entry point of the standalone application to be
Signature · 1 line
2.34.1
Re: [PATCH 3/6] examples: Don't use LTO for hello_world
Quoted 8 lines · Tom Rini
If we're building U-Boot with LTO, we don't want to use that for examples as it's more work than required.
Signed-off-by Tom Rini <[email protected]>--- examples/standalone/Makefile | 4 ++++ 1 file changed, 4 insertions(+)
BTW linux has a reduced LTO which doesn't take so long to build, but still gets a lot of the benefits.
Re: [PATCH 3/6] examples: Don't use LTO for hello_world
In reply to Tom RiniQuoted 5 lines · Tom Rini
If we're building U-Boot with LTO, we don't want to use that for examples as it's more work than required.
Signed-off-by Tom Rini <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH 4/6 compulab: imx8mm-cl-iot-gate: Fix some function declarations in eeprom_spl.c
In reply to Tom RiniWe have a few places here we the function declarations do not match their prototypes in another header, correct them.
---
Cc: "Ying-Chun Liu (PaulLiu)" <[email protected]>
--- board/compulab/imx8mm-cl-iot-gate/eeprom_spl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
board/compulab/imx8mm-cl-iot-gate/eeprom_spl.c +2 -2
@@ -101,7 +101,7 @@ u32 cl_eeprom_set_ddrinfo(u32 ddrinfo)return board_ddrinfo; }; -u8 cl_eeprom_get_subind (void ) +u32 cl_eeprom_get_subind (void ) {if (cl_eeprom_read (BOARD_DDRSUBIND_OFFSET , (uchar *)&board_ddrsubind,BOARD_DDRSUBIND_SIZE ))return 0xff ;
@@ -109,7 +109,7 @@ u8 cl_eeprom_get_subind(void)return board_ddrsubind; }; -u8 cl_eeprom_set_subind (u8 ddrsubind) +u32 cl_eeprom_set_subind (u32 ddrsubind) {if (cl_eeprom_write (BOARD_DDRSUBIND_OFFSET , (uchar *)&ddrsubind,BOARD_DDRSUBIND_SIZE ))return 0xff ;
Signature · 1 line
2.34.1
Re: [PATCH 4/6] compulab: imx8mm-cl-iot-gate: Fix some function declarations in eeprom_spl.c
Hi Tom,
Maybe we should fix the header by changing it to u8? Because the eeprom only returns one byte for the DDRSUBIND value.
Yours,
Paul
Quoted 39 lines · Tom Rini
We have a few places here we the function declarations do not match their prototypes in another header, correct them.
Signed-off-by Tom Rini <[email protected]>---
Cc: "Ying-Chun Liu (PaulLiu)" <[email protected]>--- board/compulab/imx8mm-cl-iot-gate/eeprom_spl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)board/compulab/imx8mm-cl-iot-gate/eeprom_spl.c +1
-1@@ -101,7 +101,7 @@ u32 cl_eeprom_set_ddrinfo(u32 ddrinfo)return board_ddrinfo; }; -u8 cl_eeprom_get_subind (void ) +u32 cl_eeprom_get_subind (void ) {if (cl_eeprom_read (BOARD_DDRSUBIND_OFFSET , (uchar *)&board_ddrsubind,BOARD_DDRSUBIND_SIZE ))return 0xff;board/compulab/imx8mm-cl-iot-gate/eeprom_spl.c +1
-1@@ -109,7 +109,7 @@ u8 cl_eeprom_get_subind(void)return board_ddrsubind; }; -u8 cl_eeprom_set_subind (u8 ddrsubind) +u32 cl_eeprom_set_subind (u32 ddrsubind) {if (cl_eeprom_write (BOARD_DDRSUBIND_OFFSET , (uchar *)&ddrsubind,BOARD_DDRSUBIND_SIZE ))return 0xff;--
2.34.1
Re: [PATCH 4/6] compulab: imx8mm-cl-iot-gate: Fix some function declarations in eeprom_spl.c
Quoted 4 lines · Paul Liu
Hi Tom,
Maybe we should fix the header by changing it to u8? Because the eeprom only returns one byte for the DDRSUBIND value.
As the board maintainer, yes, please feel free to submit a new patch to better correct the issue. I hit this as part of enabling LTO for all of ARM, and it errored out here.
Signature · 1 line
Tom
PATCH 5/6 purism: librem5: Fix a function declaration in spl.c
In reply to Tom RiniHere we implement usb_gadget_handle_interrupts() but did not include <linux/usb/gadget.h> so did not have the declaration correct. Fix this and add the missing include.
---
Cc: Angus Ainslie <[email protected]>
Cc: [email protected]
--- board/purism/librem5/spl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
board/purism/librem5/spl.c +2 -1
@@ -26,6 +26,7 @@#include <usb.h> #include <dwc3-uboot.h> #include <linux/delay.h> +#include <linux/usb/gadget.h> #include "librem5.h" DECLARE_GLOBAL_DATA_PTR ;
@@ -417,7 +418,7 @@ out:return rv; } -int usb_gadget_handle_interrupts (void ) +int usb_gadget_handle_interrupts (int index) {dwc3_uboot_handle_interrupt (0 );return 0 ;
Signature · 1 line
2.34.1
Re: [PATCH 5/6] purism: librem5: Fix a function declaration in spl.c
Quoted 5 lines · Tom Rini
Here we implement
usb_gadget_handle_interrupts()but did not include <linux/usb/gadget.h> so did not have the declaration correct. Fix this and add the missing include.Signed-off-by Tom Rini <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom
PATCH 6/6 RFC: arm: Enable LTO by default
In reply to Tom RiniAt this point, we have had wide enough testing of LTO on ARM platforms that we hope to have covered all of the issues that linking in manner exposes in terms of run-time failures. Note that on 32bit ARM we must use our private libgcc in order to ensure that we do not have a size mismatch over wchar_t, and we're missing some thumb1 assembly functions for LTO to be usable in that case. Enable this by default, on ARM.
---
This is not yet ready to go. As noted in this[0] thread there's some issues with weak functions. In addition, platforms such as socfpga_n5x_vab (and _atf) have their SPL grow and meesc_dataflash grows itself. This seems to be in part due to how the sha1_process_one/sha256_process_one abstractions interact with LTO. There might be more issues like this, but it's harder to spot just due to how LTO will essentially inline a large number of functions.
Further, my pine64_plus fails to boot with LTO and loops on:
U-Boot SPL 2023.04-rc3-00196-gbe79da84c30b-dirty (Mar 08 2023 - 16:10:56 -0500)
DRAM: 1024 MiB
Trying to boot from MMC1
Trying to boot from MMC1 (repeats)
So this very much isn't ready for everyone, just yet.
[0]: https://lore.kernel.org/u-boot/[email protected]/
--- Kconfig | 2 ++ configs/qemu_arm_defconfig | 1 + 2 files changed, 3 insertions(+)
Kconfig +2 -0
@@ -121,6 +121,8 @@ config ARCH_SUPPORTS_LTO config LTO bool "Enable Link Time Optimizations" depends on ARCH_SUPPORTS_LTO + select USE_PRIVATE_LIBGCC if ARM && !ARM64 + default y if ARM && !(SYS_THUMB_BUILD || SPL_SYS_THUMB_BUILD) help This option enables Link Time Optimization (LTO), a mechanism which allows the compiler to optimize between different compilation units.
configs/qemu_arm_defconfig +1 -0
@@ -16,6 +16,7 @@ CONFIG_SYS_LOAD_ADDR=0x40200000 CONFIG_ENV_ADDR=0x4000000 CONFIG_DEBUG_UART=y CONFIG_AHCI=y +# CONFIG_LTO is not set CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y CONFIG_FIT_VERBOSE=y
Signature · 1 line
2.34.1
Quoted 4 lines · Tom Rini
Some platforms were not including <
cpu_func.h> which sets the prototype forreset_cpu, and in turn had it set wrong. Correct these cases.Signed-off-by Tom Rini <[email protected]>
Applied to u-boot/next, thanks!
Signature · 1 line
Tom