AE350 support SMP boot from flash
cover AE350 support SMP boot from flash
From: Rick Chen <[email protected]>
In current RISC-V SMP flow, AE350 will encounter the the write failure problem since hart_lottery and available_harts_lock was not in ram address but in flash address when booing from flash.
This patch can help to fix the failure problem when AE350 was booting from flash by disable this two features.
Rick Chen (4):
riscv: hart_lottery and available harts feature can be seletable
riscv: configs: Support AE350 SMP boot from flash flow
riscv: prior_stage_fdt_address only be used when OF_PRIOR_STAGE is
enable
riscv: configs: AE350 will use OF_PRIOR_STAGE when boot from ram
arch/riscv/Kconfig | 21 ++++++++++++++++++++ arch/riscv/cpu/cpu.c | 4 ++++ arch/riscv/cpu/start.S | 11 ++++++++++- arch/riscv/include/asm/global_data.h | 2 ++ arch/riscv/lib/asm-offsets.c | 2 ++ arch/riscv/lib/smp.c | 2 ++ configs/ae350_rv32_defconfig | 2 +- configs/ae350_rv32_xip_defconfig | 37 +++++++++++++++++++++++++++++++++++ configs/ae350_rv64_defconfig | 2 +- configs/ae350_rv64_xip_defconfig | 38 ++++++++++++++++++++++++++++++++++++ 10 files changed, 118 insertions(+), 3 deletions(-) create mode 100644 configs/ae350_rv32_xip_defconfig create mode 100644 configs/ae350_rv64_xip_defconfig
Signature · 1 line
2.7.4
PATCH 1/4 riscv: hart_lottery and available harts feature can be seletable
From: Rick Chen <[email protected]>
In smp flow this two features only can be enabled when U-Boot boot from ram. It shall be disabled when U-Boot boot from flash.
Add CONFIG_HART_LOTTERY and CONFIG_AVAILABLE_HARTS to select this two features. Their default value will say YES for booting from ram.
AE350 will encounter the the write failure problem since hart_lottery and available_harts_lock was not in ram address but in flash address when booing from flash.
This patch can help to fix the failure problem when AE350 was booting from flash by disable this two features.
--- arch/riscv/Kconfig | 21 +++++++++++++++++++++ arch/riscv/cpu/cpu.c | 4 ++++ arch/riscv/cpu/start.S | 9 ++++++++- arch/riscv/include/asm/global_data.h | 2 ++ arch/riscv/lib/asm-offsets.c | 2 ++ arch/riscv/lib/smp.c | 2 ++ 6 files changed, 39 insertions(+), 1 deletion(-)
arch/riscv/Kconfig +21 -0
@@ -162,6 +162,27 @@ config SBI_IPI default y if RISCV_SMODE depends on SMP +config HART_LOTTERY + bool "Hart lottery support" + default y + depends on SMP + help + This will upport hart lottery, all harts have changce to become + main hart. But if you say N here, hart 0 will be the main hart. + It only can be enabled when U-Boot boot from ram, but shall be + disabled when boot from flash. + +config AVAILABLE_HARTS + bool "available harts support" + default y + depends on SMP + depends on HART_LOTTERY + help + This will help to record active harts and compare with dts' cpus. + So it will not send ipi to in-active harts. + It only can be enabled when U-Boot boot from ram, but shall be + disabled when boot from flash. + config STACK_SIZE_SHIFT int default 13
arch/riscv/cpu/cpu.c +4 -0
@@ -16,13 +16,17 @@* before the bss section is available. */ phys_addr_t prior_stage_fdt_address __attribute__((section(".data"))); +#ifdef CONFIG_HART_LOTTERY u32 hart_lottery __attribute__((section(".data"))) = 0; +#endif +#ifdef CONFIG_AVAILABLE_HARTS /* * The main hart running U-Boot has acquired available_harts_lock until it has * finished initialization of global data. */ u32 available_harts_lock =1 ; +#endif static inline bool supports_extension (char ext) {
arch/riscv/cpu/start.S +8 -1
@@ -98,6 +98,7 @@ call_board_init_f_0: mv sp, a0 #endif +#ifdef CONFIG_HART_LOTTERY /* * Pick hart to initialize global data and run U-Boot. The other harts * wait for initialization to complete.
@@ -106,6 +107,9 @@ call_board_init_f_0: li s2, 1 amoswap.w s2, t1, 0(t0) bnez s2, wait_for_gd_init +#else + bnez tp, secondary_hart_loop +#endif la t0, prior_stage_fdt_address SREG s1, 0(t0)
@@ -115,6 +119,7 @@ call_board_init_f_0: /* save the boot hart id to global_data */ SREG tp, GD_BOOT_HART(gp) +#ifdef CONFIG_AVAILABLE_HARTS la t0, available_harts_lock fence rw, w amoswap.w zero, zero, 0(t0)
@@ -135,13 +140,15 @@ wait_for_gd_init: fence rw, w amoswap.w zero, zero, 0(t0) +#endif +#ifdef CONFIG_HART_LOTTERY /* * Continue on hart lottery winner, others branch to * secondary_hart_loop. */ bnez s2, secondary_hart_loop - +#endif /* Enable cache */ jal icache_enable jal dcache_enable
arch/riscv/include/asm/global_data.h +2 -0
@@ -27,7 +27,9 @@ struct arch_global_data {#ifdef CONFIG_SMP struct ipi_data ipi[CONFIG_NR_CPUS ];#endif +#ifdef CONFIG_AVAILABLE_HARTS ulong available_harts; +#endif };#include <asm-generic/global_data.h>
arch/riscv/lib/asm-offsets.c +2 -0
@@ -14,7 +14,9 @@int main (void ) { DEFINE(GD_BOOT_HART, offsetof(gd_t, arch.boot_hart)); +#ifdef CONFIG_AVAILABLE_HARTS DEFINE(GD_AVAILABLE_HARTS, offsetof(gd_t, arch.available_harts)); +#endif return 0 ; }
arch/riscv/lib/smp.c +2 -0
@@ -63,9 +63,11 @@ static int send_ipi_many(struct ipi_data *ipi)continue ; } +#ifdef CONFIG_AVAILABLE_HARTS /* skip if hart is not available */ if (!(gd->arch.available_harts & (1 << reg)))continue ; +#endif gd->arch.ipi[reg].addr = ipi->addr; gd->arch.ipi[reg].arg0 = ipi->arg0;
Signature · 1 line
2.7.4
PATCH 1/4 riscv: hart_lottery and available harts feature can be seletable
Hi Rick,
Quoted 3 lines · Andes
From: Rick Chen <[email protected]>
typo in the commit title: seletable -> selectable
Quoted 1 line
In smp flow this two features only can be enabled when U-Boot
this->these
Quoted 1 line
boot from ram. It shall be disabled when U-Boot boot from flash.
boot->boots
Quoted 3 lines
Add
CONFIG_HART_LOTTERYandCONFIG_AVAILABLE_HARTSto select this two features. Their default value will say YES for booting
this->these
Quoted 4 lines
from ram.
AE350 will encounter the the write failure problem since
hart_lotteryandavailable_harts_lockwas not in ram address
was->is
Quoted 1 line
but in flash address when booing from flash.
booing->booting
Quoted 2 lines
This patch can help to fix the failure problem when AE350 was
was->is
Quoted 1 line
booting from flash by disable this two features.
disable->disabling
Quoted 17 lines
Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- arch/riscv/Kconfig | 21 +++++++++++++++++++++ arch/riscv/cpu/cpu.c | 4 ++++ arch/riscv/cpu/start.S | 9 ++++++++- arch/riscv/include/asm/global_data.h | 2 ++ arch/riscv/lib/asm-offsets.c | 2 ++ arch/riscv/lib/smp.c | 2 ++ 6 files changed, 39 insertions(+), 1 deletion(-)arch/riscv/Kconfig +0
-0
arch/riscv/Kconfig config SBI_IPI · line 166
Quoted 5 lines
arch/riscv/Kconfig +2
-0@@ -162,6 +162,27 @@ config SBI_IPI default y if RISCV_SMODE depends on SMP +config HART_LOTTERY + bool "Hart lottery support"
nits: I would use "hart"
arch/riscv/Kconfig config SBI_IPI · line 170
Quoted 4 lines
arch/riscv/Kconfig +4
-0+ default y + depends on SMP + help + This will upport hart lottery, all harts have changce to become
upport->support, changce->chance
arch/riscv/Kconfig config SBI_IPI · line 172
Quoted 2 lines
arch/riscv/Kconfig +2
-0+ main hart. But if you say N here, hart 0 will be the main hart. + It only can be enabled when U-Boot boot from ram, but shall be
boot->boots
arch/riscv/Kconfig config SBI_IPI · line 173
Quoted 1 line
arch/riscv/Kconfig +1
-0+ disabled when boot from flash.
boot->booting
arch/riscv/Kconfig config SBI_IPI · line 182
Quoted 9 lines
arch/riscv/Kconfig +9
-0+ +config AVAILABLE_HARTS + bool "available harts support" + default y + depends on SMP + depends on HART_LOTTERY + help + This will help to record active harts and compare with dts' cpus. + So it will not send ipi to in-active harts.
in-active->inactive
arch/riscv/Kconfig config SBI_IPI · line 183
Quoted 1 line
arch/riscv/Kconfig +1
-0+ It only can be enabled when U-Boot boot from ram, but shall be
boot->boots
arch/riscv/Kconfig config SBI_IPI · line 184
Quoted 1 line
arch/riscv/Kconfig +1
-0+ disabled when boot from flash.
boot->booting
Quoted 59 lines
arch/riscv/Kconfig +1
-0+ config STACK_SIZE_SHIFT int default 13arch/riscv/cpu/cpu.c +4
-0@@ -16,13 +16,17 @@* before the bss section is available. */ phys_addr_t prior_stage_fdt_address __attribute__((section(".data"))); +#ifdef CONFIG_HART_LOTTERY u32 hart_lottery __attribute__((section(".data"))) = 0; +#endif +#ifdef CONFIG_AVAILABLE_HARTS /* * The main hart running U-Boot has acquired available_harts_lock until it has * finished initialization of global data. */ u32 available_harts_lock =1 ; +#endif static inline bool supports_extension (char ext) {arch/riscv/cpu/start.S +5
-0@@ -98,6 +98,7 @@ call_board_init_f_0: mv sp, a0 #endif +#ifdef CONFIG_HART_LOTTERY /* * Pick hart to initialize global data and run U-Boot. The other harts * wait for initialization to complete.@@ -106,6 +107,9 @@ call_board_init_f_0: li s2, 1 amoswap.w s2, t1, 0(t0) bnez s2, wait_for_gd_init +#else + bnez tp, secondary_hart_loop +#endif la t0, prior_stage_fdt_address SREG s1, 0(t0)@@ -115,6 +119,7 @@ call_board_init_f_0: /* save the boot hart id to global_data */ SREG tp, GD_BOOT_HART(gp) +#ifdef CONFIG_AVAILABLE_HARTS la t0, available_harts_lock fence rw, w amoswap.w zero, zero, 0(t0)@@ -135,13 +140,15 @@ wait_for_gd_init: fence rw, w
arch/riscv/cpu/start.S wait_for_gd_init: · line 144
Quoted 10 lines
arch/riscv/cpu/start.S +2
-1amoswap.w zero, zero, 0(t0) +#endif +#ifdef CONFIG_HART_LOTTERY /* * Continue on hart lottery winner, others branch to * secondary_hart_loop. */ bnez s2, secondary_hart_loop -
This blank line should not be deleted.
Quoted 39 lines
arch/riscv/cpu/start.S +1
-0+#endif /* Enable cache */ jal icache_enable jal dcache_enablearch/riscv/include/asm/global_data.h +2
-0@@ -27,7 +27,9 @@ struct arch_global_data {#ifdef CONFIG_SMP struct ipi_data ipi[CONFIG_NR_CPUS ];#endif +#ifdef CONFIG_AVAILABLE_HARTS ulong available_harts; +#endif };#include <asm-generic/global_data.h> arch/riscv/lib/asm-offsets.c +2
-0@@ -14,7 +14,9 @@int main (void ) { DEFINE(GD_BOOT_HART, offsetof(gd_t, arch.boot_hart)); +#ifdef CONFIG_AVAILABLE_HARTS DEFINE(GD_AVAILABLE_HARTS, offsetof(gd_t, arch.available_harts)); +#endif return 0 ; }arch/riscv/lib/smp.c +0
-0@@ -63,9 +63,11 @@ static int send_ipi_many(struct ipi_data *ipi)continue ; }
arch/riscv/lib/smp.c static int send_ipi_many(struct ipi_data *ipi)
Quoted 10 lines
arch/riscv/lib/smp.c +2
-1+#ifdef CONFIG_AVAILABLE_HARTS /* skip if hart is not available */ if (!(gd->arch.available_harts & (1 << reg)))continue ; +#endif gd->arch.ipi[reg].addr = ipi->addr; gd->arch.ipi[reg].arg0 = ipi->arg0; --
Regards,
Bin
PATCH 1/4 riscv: hart_lottery and available harts feature can be seletable
Quoted 10 lines · Bin Meng
Hi Rick,
Quoted 3 lines · Andes
From: Rick Chen <[email protected]>
typo in the commit title: seletable -> selectable
Quoted 10 lines
Quoted 1 line
In smp flow this two features only can be enabled when U-Boot
this->theseQuoted 1 line
boot from ram. It shall be disabled when U-Boot boot from flash.
boot->bootsQuoted 2 lines
Add
CONFIG_HART_LOTTERYandCONFIG_AVAILABLE_HARTSto select
BTW: is it possible to use a single option for such feature, like CONFIG_XIP? Basically these two options are used for the same reason.
Quoted 5 lines
Quoted 1 line
this two features. Their default value will say YES for booting
this->theseQuoted 1 line
from ram.
Regards,
Bin
PATCH 1/4 riscv: hart_lottery and available harts feature can be seletable
Hi Bin
Bin Meng <[email protected]> 於 2019年4月23日 週二 下午8:19寫道:
Quoted 11 lines · Bin Meng
Quoted 9 lines
Hi Rick,
Quoted 3 lines · Andes
From: Rick Chen <[email protected]>
typo in the commit title: seletable -> selectable
OK
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
In smp flow this two features only can be enabled when U-Boot
this->these
OK
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
boot from ram. It shall be disabled when U-Boot boot from flash.
boot->boots
OK
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Add
CONFIG_HART_LOTTERYandCONFIG_AVAILABLE_HARTSto selectBTW: is it possible to use a single option for such feature, like
CONFIG_XIP? Basically these two options are used for the same reason.
Yes. This is my initial idea. But I worry the connection seem a little weak. But if you say so, I will do it as you say.
Thanks
Rick
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
this two features. Their default value will say YES for booting
this->theseQuoted 1 line
from ram.
Regards,
Bin
PATCH 2/4 riscv: configs: Support AE350 SMP boot from flash flow
In reply to AndesFrom: Rick Chen <[email protected]>
Add two defconfig to support AE350 SMP boot from flash by disable CONFIG_HART_LOTTERY and CONFIG_AVAILABLE_HARTS.
--- configs/ae350_rv32_xip_defconfig | 37 +++++++++++++++++++++++++++++++++++++ configs/ae350_rv64_xip_defconfig | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 configs/ae350_rv32_xip_defconfig create mode 100644 configs/ae350_rv64_xip_defconfig
configs/ae350_rv32_xip_defconfig new file +37 -0
@@ -0,0 +1,37 @@ +CONFIG_RISCV=y +CONFIG_HART_LOTTERY=n +CONFIG_AVAILABLE_HARTS=n +CONFIG_SYS_TEXT_BASE=0x80000000 +CONFIG_TARGET_AX25_AE350=y +CONFIG_DISTRO_DEFAULTS=y +CONFIG_NR_DRAM_BANKS=2 +CONFIG_FIT=y +CONFIG_BOOTDELAY=3 +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_SYS_PROMPT="RISC-V # " +CONFIG_CMD_IMLS=y +CONFIG_CMD_MMC=y +CONFIG_CMD_SF=y +CONFIG_CMD_SF_TEST=y +# CONFIG_CMD_SETEXPR is not set +CONFIG_BOOTP_PREFER_SERVERIP=y +CONFIG_CMD_CACHE=y +CONFIG_OF_BOARD=y +CONFIG_DEFAULT_DEVICE_TREE="ae350_32" +CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_MMC=y +CONFIG_FTSDC010=y +CONFIG_FTSDC010_SDIO=y +CONFIG_MTD_NOR_FLASH=y +CONFIG_FLASH_CFI_DRIVER=y +CONFIG_CFI_FLASH=y +CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y +CONFIG_SYS_FLASH_CFI=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_FTMAC100=y +CONFIG_BAUDRATE=38400 +CONFIG_SYS_NS16550=y +CONFIG_SPI=y +CONFIG_ATCSPI200_SPI=y
configs/ae350_rv64_xip_defconfig new file +38 -0
@@ -0,0 +1,38 @@ +CONFIG_RISCV=y +CONFIG_HART_LOTTERY=n +CONFIG_AVAILABLE_HARTS=n +CONFIG_SYS_TEXT_BASE=0x80000000 +CONFIG_TARGET_AX25_AE350=y +CONFIG_ARCH_RV64I=y +CONFIG_DISTRO_DEFAULTS=y +CONFIG_NR_DRAM_BANKS=2 +CONFIG_FIT=y +CONFIG_BOOTDELAY=3 +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_SYS_PROMPT="RISC-V # " +CONFIG_CMD_IMLS=y +CONFIG_CMD_MMC=y +CONFIG_CMD_SF=y +CONFIG_CMD_SF_TEST=y +# CONFIG_CMD_SETEXPR is not set +CONFIG_BOOTP_PREFER_SERVERIP=y +CONFIG_CMD_CACHE=y +CONFIG_OF_BOARD=y +CONFIG_DEFAULT_DEVICE_TREE="ae350_64" +CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_MMC=y +CONFIG_FTSDC010=y +CONFIG_FTSDC010_SDIO=y +CONFIG_MTD_NOR_FLASH=y +CONFIG_FLASH_CFI_DRIVER=y +CONFIG_CFI_FLASH=y +CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y +CONFIG_SYS_FLASH_CFI=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_FTMAC100=y +CONFIG_BAUDRATE=38400 +CONFIG_SYS_NS16550=y +CONFIG_SPI=y +CONFIG_ATCSPI200_SPI=y
Signature · 1 line
2.7.4
PATCH 2/4 riscv: configs: Support AE350 SMP boot from flash flow
Hi Rick,
Quoted 2 lines · Andes
From: Rick Chen <[email protected]>
nits in the commit title: boot->booting
Quoted 2 lines
Add two defconfig to support AE350 SMP boot from flash
boot->bootings
Quoted 1 line
by disable
CONFIG_HART_LOTTERYandCONFIG_AVAILABLE_HARTS.
disable->disabling
Quoted 16 lines
Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- configs/ae350_rv32_xip_defconfig | 37 +++++++++++++++++++++++++++++++++++++ configs/ae350_rv64_xip_defconfig | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 configs/ae350_rv32_xip_defconfig create mode 100644 configs/ae350_rv64_xip_defconfigconfigs/ae350_rv32_xip_defconfig new file +0
-0
configs/ae350_rv32_xip_defconfig line 3
Quoted 3 lines
configs/ae350_rv32_xip_defconfig new file +3
-0@@ -0,0 +1,37 @@ +CONFIG_RISCV=y +CONFIG_HART_LOTTERY=n +CONFIG_AVAILABLE_HARTS=n
I think this should be:
# CONFIG_HART_LOTTERY is not set
# CONFIG_AVAILABLE_HARTS is not set
Quoted 40 lines
configs/ae350_rv32_xip_defconfig new file +34
-0+CONFIG_SYS_TEXT_BASE=0x80000000 +CONFIG_TARGET_AX25_AE350=y +CONFIG_DISTRO_DEFAULTS=y +CONFIG_NR_DRAM_BANKS=2 +CONFIG_FIT=y +CONFIG_BOOTDELAY=3 +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_SYS_PROMPT="RISC-V # " +CONFIG_CMD_IMLS=y +CONFIG_CMD_MMC=y +CONFIG_CMD_SF=y +CONFIG_CMD_SF_TEST=y +# CONFIG_CMD_SETEXPR is not set +CONFIG_BOOTP_PREFER_SERVERIP=y +CONFIG_CMD_CACHE=y +CONFIG_OF_BOARD=y +CONFIG_DEFAULT_DEVICE_TREE="ae350_32" +CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_MMC=y +CONFIG_FTSDC010=y +CONFIG_FTSDC010_SDIO=y +CONFIG_MTD_NOR_FLASH=y +CONFIG_FLASH_CFI_DRIVER=y +CONFIG_CFI_FLASH=y +CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y +CONFIG_SYS_FLASH_CFI=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_FTMAC100=y +CONFIG_BAUDRATE=38400 +CONFIG_SYS_NS16550=y +CONFIG_SPI=y +CONFIG_ATCSPI200_SPI=yconfigs/ae350_rv64_xip_defconfig new file +0
-0
configs/ae350_rv64_xip_defconfig line 3
Quoted 3 lines
configs/ae350_rv64_xip_defconfig new file +3
-0@@ -0,0 +1,38 @@ +CONFIG_RISCV=y +CONFIG_HART_LOTTERY=n +CONFIG_AVAILABLE_HARTS=n
ditto
Quoted 25 lines
configs/ae350_rv64_xip_defconfig new file +25
-0+CONFIG_SYS_TEXT_BASE=0x80000000 +CONFIG_TARGET_AX25_AE350=y +CONFIG_ARCH_RV64I=y +CONFIG_DISTRO_DEFAULTS=y +CONFIG_NR_DRAM_BANKS=2 +CONFIG_FIT=y +CONFIG_BOOTDELAY=3 +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_SYS_PROMPT="RISC-V # " +CONFIG_CMD_IMLS=y +CONFIG_CMD_MMC=y +CONFIG_CMD_SF=y +CONFIG_CMD_SF_TEST=y +# CONFIG_CMD_SETEXPR is not set +CONFIG_BOOTP_PREFER_SERVERIP=y +CONFIG_CMD_CACHE=y +CONFIG_OF_BOARD=y +CONFIG_DEFAULT_DEVICE_TREE="ae350_64" +CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_MMC=y +CONFIG_FTSDC010=y +CONFIG_FTSDC010_SDIO=y +CONFIG_MTD_NOR_FLASH=y +CONFIG_FLASH_CFI_DRIVER=y
configs/ae350_rv64_xip_defconfig line 38
Quoted 10 lines
configs/ae350_rv64_xip_defconfig new file +10
-0+CONFIG_CFI_FLASH=y +CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y +CONFIG_SYS_FLASH_CFI=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_FTMAC100=y +CONFIG_BAUDRATE=38400 +CONFIG_SYS_NS16550=y +CONFIG_SPI=y +CONFIG_ATCSPI200_SPI=y
Regards,
Bin
PATCH 2/4 riscv: configs: Support AE350 SMP boot from flash flow
Hi Bin
Bin Meng <[email protected]> 於 2019年4月23日 週二 下午8:14寫道:
Quoted 8 lines
Hi Rick,
Quoted 2 lines · Andes
From: Rick Chen <[email protected]>
nits in the commit title:
boot->booting
OK
Quoted 5 lines
Quoted 3 lines
Add two defconfig to support AE350 SMP boot from flash
boot->bootings
OK
Quoted 4 lines
Quoted 2 lines
by disable
CONFIG_HART_LOTTERYandCONFIG_AVAILABLE_HARTS.
disable->disabling
OK
Quoted 23 lines
Quoted 17 lines
Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- configs/ae350_rv32_xip_defconfig | 37 +++++++++++++++++++++++++++++++++++++ configs/ae350_rv64_xip_defconfig | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 configs/ae350_rv32_xip_defconfig create mode 100644 configs/ae350_rv64_xip_defconfigconfigs/ae350_rv32_xip_defconfig new file +0
-0configs/ae350_rv32_xip_defconfig line 3
Quoted 3 lines
configs/ae350_rv32_xip_defconfig new file +3
-0@@ -0,0 +1,37 @@ +CONFIG_RISCV=y +CONFIG_HART_LOTTERY=n +CONFIG_AVAILABLE_HARTS=nI think this should be:
Quoted 2 lines
#
CONFIG_HART_LOTTERYis not set
#CONFIG_AVAILABLE_HARTSis not set
OK
Quoted 38 lines
Quoted 38 lines
configs/ae350_rv32_xip_defconfig new file +34
-0+CONFIG_SYS_TEXT_BASE=0x80000000 +CONFIG_TARGET_AX25_AE350=y +CONFIG_DISTRO_DEFAULTS=y +CONFIG_NR_DRAM_BANKS=2 +CONFIG_FIT=y +CONFIG_BOOTDELAY=3 +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_SYS_PROMPT="RISC-V # " +CONFIG_CMD_IMLS=y +CONFIG_CMD_MMC=y +CONFIG_CMD_SF=y +CONFIG_CMD_SF_TEST=y +# CONFIG_CMD_SETEXPR is not set +CONFIG_BOOTP_PREFER_SERVERIP=y +CONFIG_CMD_CACHE=y +CONFIG_OF_BOARD=y +CONFIG_DEFAULT_DEVICE_TREE="ae350_32" +CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_MMC=y +CONFIG_FTSDC010=y +CONFIG_FTSDC010_SDIO=y +CONFIG_MTD_NOR_FLASH=y +CONFIG_FLASH_CFI_DRIVER=y +CONFIG_CFI_FLASH=y +CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y +CONFIG_SYS_FLASH_CFI=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_FTMAC100=y +CONFIG_BAUDRATE=38400 +CONFIG_SYS_NS16550=y +CONFIG_SPI=y +CONFIG_ATCSPI200_SPI=yconfigs/ae350_rv64_xip_defconfig new file +0
-0
Quoted 8 lines
configs/ae350_rv64_xip_defconfig line 3
Quoted 6 lines
configs/ae350_rv64_xip_defconfig new file +3
-0@@ -0,0 +1,38 @@ +CONFIG_RISCV=y +CONFIG_HART_LOTTERY=n +CONFIG_AVAILABLE_HARTS=nditto
OK
Quoted 28 lines
Quoted 28 lines
configs/ae350_rv64_xip_defconfig new file +27
-0+CONFIG_SYS_TEXT_BASE=0x80000000 +CONFIG_TARGET_AX25_AE350=y +CONFIG_ARCH_RV64I=y +CONFIG_DISTRO_DEFAULTS=y +CONFIG_NR_DRAM_BANKS=2 +CONFIG_FIT=y +CONFIG_BOOTDELAY=3 +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_SYS_PROMPT="RISC-V # " +CONFIG_CMD_IMLS=y +CONFIG_CMD_MMC=y +CONFIG_CMD_SF=y +CONFIG_CMD_SF_TEST=y +# CONFIG_CMD_SETEXPR is not set +CONFIG_BOOTP_PREFER_SERVERIP=y +CONFIG_CMD_CACHE=y +CONFIG_OF_BOARD=y +CONFIG_DEFAULT_DEVICE_TREE="ae350_64" +CONFIG_ENV_IS_IN_SPI_FLASH=y +CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_MMC=y +CONFIG_FTSDC010=y +CONFIG_FTSDC010_SDIO=y +CONFIG_MTD_NOR_FLASH=y +CONFIG_FLASH_CFI_DRIVER=y +CONFIG_CFI_FLASH=y +CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
Quoted 9 lines
configs/ae350_rv64_xip_defconfig line 38
Quoted 8 lines
configs/ae350_rv64_xip_defconfig new file +8
-0+CONFIG_SYS_FLASH_CFI=y +CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_FTMAC100=y +CONFIG_BAUDRATE=38400 +CONFIG_SYS_NS16550=y +CONFIG_SPI=y +CONFIG_ATCSPI200_SPI=y
Thanks for your review.
Rick
Quoted 2 lines
Regards,
Bin
PATCH 3/4 riscv: prior_stage_fdt_address only be used when OF_PRIOR_STAGE is enable
In reply to AndesFrom: Rick Chen <[email protected]>
This patch will fix prior_stage_fdt_address write failure problem, when AE350 was booting from flash.
When AE350 was booting from falsh, prior_stage_fdt_address will be in flash address, we shall avoid it to be written.
--- arch/riscv/cpu/start.S | 2 ++ 1 file changed, 2 insertions(+)
arch/riscv/cpu/start.S +2 -0
@@ -111,7 +111,9 @@ call_board_init_f_0: bnez tp, secondary_hart_loop #endif +# if CONFIG_IS_ENABLED(OF_PRIOR_STAGE) la t0, prior_stage_fdt_address +#endif SREG s1, 0(t0) jal board_init_f_init_reserve
Signature · 1 line
2.7.4
PATCH 3/4 riscv: prior_stage_fdt_address only be used when OF_PRIOR_STAGE is enable
Hi Rick,
Quoted 3 lines · Andes
From: Rick Chen <[email protected]>
commit title should read: prior_stage_fdt_address should only be used when OF_PRIOR_STAGE is enabled
Quoted 17 lines
This patch will fix
prior_stage_fdt_addresswrite failure problem, when AE350 was booting from flash.When AE350 was booting from falsh,
prior_stage_fdt_addresswill be in flash address, we shall avoid it to be written.Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- arch/riscv/cpu/start.S | 2 ++ 1 file changed, 2 insertions(+)arch/riscv/cpu/start.S +0
-0
arch/riscv/cpu/start.S call_board_init_f_0: · line 116
Quoted 6 lines
arch/riscv/cpu/start.S +2
-0@@ -111,7 +111,9 @@ call_board_init_f_0: bnez tp, secondary_hart_loop #endif +# if CONFIG_IS_ENABLED(OF_PRIOR_STAGE) la t0, prior_stage_fdt_address +#endif
I think you should also surround the declaration of prior_stage_fdt_address in arch/riscv/cpu/cpu.c with OF_PRIOR_STAGE
arch/riscv/cpu/start.S call_board_init_f_0:
Quoted 4 lines
arch/riscv/cpu/start.S +0
-1SREG s1, 0(t0) jal board_init_f_init_reserve --
Regards,
Bin
PATCH 3/4 riscv: prior_stage_fdt_address only be used when OF_PRIOR_STAGE is enable
Hi Bin
Bin Meng <[email protected]> 於 2019年4月23日 週二 下午8:14寫道:
Quoted 10 lines
Hi Rick,
Quoted 3 lines · Andes
From: Rick Chen <[email protected]>
commit title should read:
prior_stage_fdt_addressshould only be used whenOF_PRIOR_STAGEis enabled
OK
Quoted 21 lines
Quoted 21 lines
This patch will fix
prior_stage_fdt_addresswrite failure problem, when AE350 was booting from flash.When AE350 was booting from falsh,
prior_stage_fdt_addresswill be in flash address, we shall avoid it to be written.Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- arch/riscv/cpu/start.S | 2 ++ 1 file changed, 2 insertions(+)arch/riscv/cpu/start.S +0
-0@@ -111,7 +111,9 @@ call_board_init_f_0: bnez tp, secondary_hart_loop #endif
Quoted 6 lines
arch/riscv/cpu/start.S call_board_init_f_0: · line 116
Quoted 3 lines
arch/riscv/cpu/start.S +2
-0+# if CONFIG_IS_ENABLED(OF_PRIOR_STAGE) la t0, prior_stage_fdt_address +#endifI think you should also surround the declaration of
prior_stage_fdt_addressinarch/riscv/cpu/cpu.cwithOF_PRIOR_STAGE
OK
I will surround it.
Thanks for review
Rick
Quoted 8 lines
arch/riscv/cpu/start.S call_board_init_f_0:
Quoted 5 lines
arch/riscv/cpu/start.S +0
-1SREG s1, 0(t0) jal board_init_f_init_reserve --Regards,
Bin
PATCH 4/4 riscv: configs: AE350 will use OF_PRIOR_STAGE when boot from ram
In reply to AndesFrom: Rick Chen <[email protected]>
When AE350 was booting from ram, use OF_PRIOR_STAGE instead of OF_PRIOR_STAGE.
--- configs/ae350_rv32_defconfig | 2 +- configs/ae350_rv64_defconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
configs/ae350_rv32_defconfig +1 -1
@@ -14,7 +14,7 @@ CONFIG_CMD_SF_TEST=y # CONFIG_CMD_SETEXPR is not set CONFIG_BOOTP_PREFER_SERVERIP=y CONFIG_CMD_CACHE=y -CONFIG_OF_BOARD=y +CONFIG_OF_PRIOR_STAGE=y CONFIG_DEFAULT_DEVICE_TREE="ae350_32" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_NET_RANDOM_ETHADDR=y
configs/ae350_rv64_defconfig +1 -1
@@ -15,7 +15,7 @@ CONFIG_CMD_SF_TEST=y # CONFIG_CMD_SETEXPR is not set CONFIG_BOOTP_PREFER_SERVERIP=y CONFIG_CMD_CACHE=y -CONFIG_OF_BOARD=y +CONFIG_OF_PRIOR_STAGE=y CONFIG_DEFAULT_DEVICE_TREE="ae350_64" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_NET_RANDOM_ETHADDR=y
Signature · 1 line
2.7.4
PATCH 4/4 riscv: configs: AE350 will use OF_PRIOR_STAGE when boot from ram
Hi Rick,
Quoted 3 lines · Andes
From: Rick Chen <[email protected]>
nits in the commit title: boot->booting
Quoted 2 lines
When AE350 was booting from ram, use
OF_PRIOR_STAGEinstead ofOF_PRIOR_STAGE.
This should be CONFIG_OF_BOARD
Quoted 26 lines
Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- configs/ae350_rv32_defconfig | 2 +- configs/ae350_rv64_defconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)configs/ae350_rv32_defconfig +1
-1@@ -14,7 +14,7 @@ CONFIG_CMD_SF_TEST=y # CONFIG_CMD_SETEXPR is not set CONFIG_BOOTP_PREFER_SERVERIP=y CONFIG_CMD_CACHE=y -CONFIG_OF_BOARD=y +CONFIG_OF_PRIOR_STAGE=y CONFIG_DEFAULT_DEVICE_TREE="ae350_32" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_NET_RANDOM_ETHADDR=yconfigs/ae350_rv64_defconfig +0
-0
configs/ae350_rv64_defconfig CONFIG_CMD_SF_TEST=y · line 21
Quoted 8 lines
configs/ae350_rv64_defconfig +1
-1@@ -15,7 +15,7 @@ CONFIG_CMD_SF_TEST=y # CONFIG_CMD_SETEXPR is not set CONFIG_BOOTP_PREFER_SERVERIP=y CONFIG_CMD_CACHE=y -CONFIG_OF_BOARD=y +CONFIG_OF_PRIOR_STAGE=y CONFIG_DEFAULT_DEVICE_TREE="ae350_64" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_NET_RANDOM_ETHADDR=y
Regards,
Bin
PATCH 4/4 riscv: configs: AE350 will use OF_PRIOR_STAGE when boot from ram
Hi Bin
Bin Meng <[email protected]> 於 2019年4月23日 週二 下午8:14寫道:
Quoted 9 lines
Hi Rick,
Quoted 3 lines · Andes
From: Rick Chen <[email protected]>
nits in the commit title:
boot->booting
OK
Quoted 5 lines
Quoted 3 lines
When AE350 was booting from ram, use
OF_PRIOR_STAGEinstead ofOF_PRIOR_STAGE.This should be
CONFIG_OF_BOARD
OK
Thanks
Rick
Quoted 38 lines
Quoted 27 lines
Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- configs/ae350_rv32_defconfig | 2 +- configs/ae350_rv64_defconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)configs/ae350_rv32_defconfig +1
-1@@ -14,7 +14,7 @@ CONFIG_CMD_SF_TEST=y # CONFIG_CMD_SETEXPR is not set CONFIG_BOOTP_PREFER_SERVERIP=y CONFIG_CMD_CACHE=y -CONFIG_OF_BOARD=y +CONFIG_OF_PRIOR_STAGE=y CONFIG_DEFAULT_DEVICE_TREE="ae350_32" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_NET_RANDOM_ETHADDR=yconfigs/ae350_rv64_defconfig +0
-0configs/ae350_rv64_defconfig CONFIG_CMD_SF_TEST=y · line 21
Quoted 8 lines
configs/ae350_rv64_defconfig +1
-1@@ -15,7 +15,7 @@ CONFIG_CMD_SF_TEST=y # CONFIG_CMD_SETEXPR is not set CONFIG_BOOTP_PREFER_SERVERIP=y CONFIG_CMD_CACHE=y -CONFIG_OF_BOARD=y +CONFIG_OF_PRIOR_STAGE=y CONFIG_DEFAULT_DEVICE_TREE="ae350_64" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_NET_RANDOM_ETHADDR=yRegards,
Bin
Auer
cover AE350 support SMP boot from flash
In reply to AndesHi Rick,
Quoted 9 lines · Andes
From: Rick Chen <[email protected]>
In current RISC-V SMP flow, AE350 will encounter the the write failure problem since
hart_lotteryandavailable_harts_lockwas not in ram address but in flash address when booing from flash.This patch can help to fix the failure problem when AE350 was booting from flash by disable this two features.
Can you describe the issue you are seeing a bit more. The write failures are both to variables in the .data section, which should be writable. Perhaps the write failures can be avoided by moving the .data section or just the variable to RAM?
Thanks,
Lukas
cover AE350 support SMP boot from flash
Hi Lukas
Auer, Lukas <[email protected]> 於 2019年4月24日 週三 上午3:58寫道:
Quoted 10 lines
Hi Rick,
Quoted 6 lines · Andes
From: Rick Chen <[email protected]>
In current RISC-V SMP flow, AE350 will encounter the the write failure problem since
hart_lotteryandavailable_harts_lockwas not in ram address but in flash address when booing from flash.
Quoted 9 lines
Quoted 3 lines
This patch can help to fix the failure problem when AE350 was booting from flash by disable this two features.
Can you describe the issue you are seeing a bit more. The write failures are both to variables in the .data section, which should be writable. Perhaps the write failures can be avoided by moving the .data section or just the variable to RAM?
When I compile AE350's CONFIG_SYS_TEXT_BASE=0x80000000 which is spi flash base. And burn u-boot.bin into AE350 spi flash. Power off / on, U-Boot will run in XIP mode.
At this time prior_stage_fdt_address will be in flash address(0x8004e9e8) So it is not writable.
80000042: 16021563 bnez tp,800001ac
<secondary_hart_loop>
80000046: 0004f297 auipc t0,0x4f 8000004a: 9a22a283 lw t0,-1630(t0) #
8004e9e8 <prior_stage_fdt_address+0x3f74>8000004e: 0092a023 sw s1,0(t0)
Rick
Quoted 2 lines
Thanks,
Lukas
Auer
cover AE350 support SMP boot from flash
Hi Rick,
Quoted 28 lines · Rick Chen
Hi Lukas
Auer, Lukas <[email protected]> 於 2019年4月24日 週三 上午3:58寫道:
Quoted 9 lines
Hi Rick,
Quoted 6 lines · Andes
From: Rick Chen <[email protected]>
In current RISC-V SMP flow, AE350 will encounter the the write failure problem since
hart_lotteryandavailable_harts_lockwas not in ram address but in flash address when booing from flash.Quoted 9 lines
Quoted 3 lines
This patch can help to fix the failure problem when AE350 was booting from flash by disable this two features.
Can you describe the issue you are seeing a bit more. The write failures are both to variables in the .data section, which should be writable. Perhaps the write failures can be avoided by moving the .data section or just the variable to RAM?
When I compile AE350's
CONFIG_SYS_TEXT_BASE=0x80000000which is spi flash base. And burn u-boot.bin into AE350 spi flash. Power off / on, U-Boot will run in XIP mode.
At this timeprior_stage_fdt_addresswill be in flash address(0x8004e9e8) So it is not writable.
Quoted 7 lines
80000042: 16021563 bnez tp,800001ac
<secondary_hart_loop>80000046: 0004f297 auipc t0,0x4f 8000004a: 9a22a283 lw t0,-1630(t0) #
8004e9e8<prior_stage_fdt_address+0x3f74>8000004e:0092a023sw s1,0(t0)
Ok, that makes sense.
Another option would be to move the variable to RAM or some other location, which is write-accessible when U-Boot starts. Would this work?
I think it would be good to support the hart lottery and the available harts mask in all configurations.
Thanks,
Lukas
cover AE350 support SMP boot from flash
Hi Lukas
Auer, Lukas <[email protected]> 於 2019年4月25日 週四 上午5:18寫道:
Quoted 40 lines
Hi Rick,
Quoted 28 lines · Rick Chen
Hi Lukas
Auer, Lukas <[email protected]> 於 2019年4月24日 週三 上午3:58寫道:
Quoted 9 lines
Hi Rick,
Quoted 6 lines · Andes
From: Rick Chen <[email protected]>
In current RISC-V SMP flow, AE350 will encounter the the write failure problem since
hart_lotteryandavailable_harts_lockwas not in ram address but in flash address when booing from flash.Quoted 9 lines
Quoted 3 lines
This patch can help to fix the failure problem when AE350 was booting from flash by disable this two features.
Can you describe the issue you are seeing a bit more. The write failures are both to variables in the .data section, which should be writable. Perhaps the write failures can be avoided by moving the .data section or just the variable to RAM?
When I compile AE350's
CONFIG_SYS_TEXT_BASE=0x80000000which is spi flash base. And burn u-boot.bin into AE350 spi flash. Power off / on, U-Boot will run in XIP mode.
At this timeprior_stage_fdt_addresswill be in flash address(0x8004e9e8) So it is not writable.Quoted 7 lines
80000042: 16021563 bnez tp,800001ac
<secondary_hart_loop>80000046: 0004f297 auipc t0,0x4f 8000004a: 9a22a283 lw t0,-1630(t0) #
8004e9e8<prior_stage_fdt_address+0x3f74>8000004e:0092a023sw s1,0(t0)
Quoted 7 lines
Ok, that makes sense.
Another option would be to move the variable to RAM or some other location, which is write-accessible when U-Boot starts. Would this work?
I think it would be good to support the hart lottery and the available harts mask in all configurations.
Actually I have tried to move them to gd, but it fail. Because it need some requirements :hart_lottery need equal to 0 and available_harts_lock equal to 1 at compile time.
It is hard to achieve this at run time.
That is why I add a CONFIG_XXX to remove this two features simply.
Thanks
Rick
Quoted 2 lines
Thanks,
Lukas
Auer
cover AE350 support SMP boot from flash
Hi Rick,
Quoted 50 lines · Rick Chen
Hi Lukas
Auer, Lukas <[email protected]> 於 2019年4月25日 週四 上午5:18寫道:
Quoted 39 lines
Hi Rick,
Quoted 28 lines · Rick Chen
Hi Lukas
Auer, Lukas <[email protected]> 於 2019年4月24日 週三 上午3:58寫道:
Quoted 9 lines
Hi Rick,
Quoted 6 lines · Andes
From: Rick Chen <[email protected]>
In current RISC-V SMP flow, AE350 will encounter the the write failure problem since
hart_lotteryandavailable_harts_lockwas not in ram address but in flash address when booing from flash.Quoted 9 lines
Quoted 3 lines
This patch can help to fix the failure problem when AE350 was booting from flash by disable this two features.
Can you describe the issue you are seeing a bit more. The write failures are both to variables in the .data section, which should be writable. Perhaps the write failures can be avoided by moving the .data section or just the variable to RAM?
When I compile AE350's
CONFIG_SYS_TEXT_BASE=0x80000000which is spi flash base. And burn u-boot.bin into AE350 spi flash. Power off / on, U-Boot will run in XIP mode.
At this timeprior_stage_fdt_addresswill be in flash address(0x8004e9e8) So it is not writable.Quoted 7 lines
80000042: 16021563 bnez tp,800001ac
<secondary_hart_loop>80000046: 0004f297 auipc t0,0x4f 8000004a: 9a22a283 lw t0,-1630(t0) #
8004e9e8<prior_stage_fdt_address+0x3f74>8000004e:0092a023sw s1,0(t0)Quoted 7 lines
Ok, that makes sense.
Another option would be to move the variable to RAM or some other location, which is write-accessible when U-Boot starts. Would this work?
I think it would be good to support the hart lottery and the available harts mask in all configurations.
Quoted 7 lines
Actually I have tried to move them to gd, but it fail. Because it need some requirements :
hart_lotteryneed equal to 0 andavailable_harts_lockequal to 1 at compile time.
It is hard to achieve this at run time.
That is why I add aCONFIG_XXXto remove this two features simply.
Ah, you are right. I did not consider that.
Thanks,
Lukas