AE350 support SMP boot from flash
v2 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 disabling this two features.
Changes in v2:
- Fix some typos
- Also surround the declaration of prior_stage_fdt_address in arch/riscv/cpu/cpu.c with OF_PRIOR_STAGE
- Use CONFIP_XIP to replace CONFIG_HART_LOTTERY and CONFIG_AVAILABLE_HARTS
Rick Chen (4):
riscv: hart_lottery and available harts features can be selectable
riscv: configs: Support AE350 SMP booting from flash flow
riscv: prior_stage_fdt_address should only be used when OF_PRIOR_STAGE
is enabled
riscv: configs: AE350 will use CONFIG_OF_PRIOR_STAGE when booting from
ram
arch/riscv/Kconfig | 10 ++++++++++ arch/riscv/cpu/cpu.c | 5 ++++- 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 ++ configs/ae350_rv32_defconfig | 2 +- configs/ae350_rv32_xip_defconfig | 36 +++++++++++++++++++++++++++++++++++ configs/ae350_rv64_defconfig | 2 +- configs/ae350_rv64_xip_defconfig | 37 ++++++++++++++++++++++++++++++++++++ 10 files changed, 103 insertions(+), 4 deletions(-) create mode 100644 configs/ae350_rv32_xip_defconfig create mode 100644 configs/ae350_rv64_xip_defconfig
Signature · 1 line
2.7.4
PATCH v2 1/4 riscv: hart_lottery and available harts features can be selectable
From: Rick Chen <[email protected]>
In smp flow these two features only can be enabled when U-Boot booting from ram. It shall be disabled when U-Boot booting from flash.
Add CONFIG_XIP to NOT select this two features. It's default value will say NO 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 write failure problem when AE350 booting from flash by disabling this two features.
--- arch/riscv/Kconfig | 10 ++++++++++ arch/riscv/cpu/cpu.c | 3 ++- arch/riscv/cpu/start.S | 7 ++++++- arch/riscv/include/asm/global_data.h | 2 ++ arch/riscv/lib/asm-offsets.c | 2 ++ arch/riscv/lib/smp.c | 2 ++ 6 files changed, 24 insertions(+), 2 deletions(-)
arch/riscv/Kconfig +10 -0
@@ -162,6 +162,16 @@ config SBI_IPI default y if RISCV_SMODE depends on SMP +config XIP + bool "XIP mode" + default n + help + XIP (eXecute In Place) is a method for executing code directly + from a serial NOR flash memory without copying the code to ram. + This must NOT support hart lottery and available harts features. + These two feature only can be enabled when U-Boot booting from + ram, but shall be disabled when booting from flash. + config STACK_SIZE_SHIFT int default 13
arch/riscv/cpu/cpu.c +2 -1
@@ -16,13 +16,14 @@* before the bss section is available. */ phys_addr_t prior_stage_fdt_address __attribute__((section(".data"))); +#ifndef CONFIG_XIP u32 hart_lottery __attribute__((section(".data"))) = 0; -/* * 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 +6 -1
@@ -98,6 +98,7 @@ call_board_init_f_0: mv sp, a0 #endif +#ifndef CONFIG_XIP /* * 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) +#ifndef CONFIG_XIP la t0, available_harts_lock fence rw, w amoswap.w zero, zero, 0(t0)
@@ -141,7 +146,7 @@ wait_for_gd_init: * 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 +#ifndef CONFIG_XIP 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)); +#ifndef CONFIG_XIP 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 ; } +#ifndef CONFIG_XIP /* 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 v2 1/4 riscv: hart_lottery and available harts features can be selectable
Hi Rick,
Quoted 3 lines · Andes
From: Rick Chen <[email protected]>
I would write the commit title and message as:
riscv: Introduce CONFIG_XIP to support booting from flash
When U-Boot boots from flash, during the boot process, hart_lottery and available_harts_lock variable addresses point to flash which is not writable. This causes boot failures on AE350. Introduce a config option CONFIG_XIP to support such configuration.
Quoted 28 lines
flash.
Add
CONFIG_XIPto NOT select this two features. It's default value will say NO for booting from ram.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 write failure problem when AE350 booting from flash by disabling this two features.
Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- arch/riscv/Kconfig | 10 ++++++++++ arch/riscv/cpu/cpu.c | 3 ++- arch/riscv/cpu/start.S | 7 ++++++- arch/riscv/include/asm/global_data.h | 2 ++ arch/riscv/lib/asm-offsets.c | 2 ++ arch/riscv/lib/smp.c | 2 ++ 6 files changed, 24 insertions(+), 2 deletions(-)arch/riscv/Kconfig +0
-0
arch/riscv/Kconfig config SBI_IPI · line 167
Quoted 6 lines
arch/riscv/Kconfig +3
-0@@ -162,6 +162,16 @@ config SBI_IPI default y if RISCV_SMODE depends on SMP +config XIP + bool "XIP mode" + default n
nits: this is not necessary as by default all config options are n
arch/riscv/Kconfig config SBI_IPI · line 170
Quoted 3 lines
arch/riscv/Kconfig +3
-0+ help + XIP (eXecute In Place) is a method for executing code directly + from a serial NOR flash memory without copying the code to ram.
It's not necessary to be a serial NOR flash. A parallel flash can be the same. I think you can just mention NOR flash memory.
arch/riscv/Kconfig config SBI_IPI · line 173
Quoted 3 lines
arch/riscv/Kconfig +3
-0+ This must NOT support hart lottery and available harts features. + These two feature only can be enabled when U-Boot booting from + ram, but shall be disabled when booting from flash.
remove the rest of the help message, and something like this:
Say yes here if U-Boot boots from flash directly.
Quoted 55 lines
arch/riscv/Kconfig +1
-0+ config STACK_SIZE_SHIFT int default 13arch/riscv/cpu/cpu.c +2
-1@@ -16,13 +16,14 @@* before the bss section is available. */ phys_addr_t prior_stage_fdt_address __attribute__((section(".data"))); +#ifndef CONFIG_XIP u32 hart_lottery __attribute__((section(".data"))) = 0; -/* * 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 +#ifndef CONFIG_XIP /* * 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) +#ifndef CONFIG_XIP la t0, available_harts_lock fence rw, w amoswap.w zero, zero, 0(t0)
arch/riscv/cpu/start.S wait_for_gd_init: · line 144
Quoted 4 lines
arch/riscv/cpu/start.S +0
-1@@ -141,7 +146,7 @@ wait_for_gd_init: * secondary_hart_loop. */ bnez s2, secondary_hart_loop -
Please keep the original blank line here.
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 +#ifndef CONFIG_XIP 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)); +#ifndef CONFIG_XIP 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+#ifndef CONFIG_XIP /* 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 v2 1/4 riscv: hart_lottery and available harts features can be selectable
Bin Meng <[email protected]> 於 2019年4月24日 週三 下午3:02寫道:
Quoted 8 lines
Hi Rick,
Quoted 3 lines · Andes
From: Rick Chen <[email protected]>
Quoted 9 lines
I would write the commit title and message as:
riscv: Introduce
CONFIG_XIPto support booting from flashWhen U-Boot boots from flash, during the boot process,
hart_lotteryandavailable_harts_lockvariable addresses point to flash which is not writable. This causes boot failures on AE350. Introduce a config optionCONFIG_XIPto support such configuration.
OK.
I will modify it as your description.
Quoted 31 lines
Quoted 31 lines
flash.
Add
CONFIG_XIPto NOT select this two features. It's default value will say NO for booting from ram.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 write failure problem when AE350 booting from flash by disabling this two features.
Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- arch/riscv/Kconfig | 10 ++++++++++ arch/riscv/cpu/cpu.c | 3 ++- arch/riscv/cpu/start.S | 7 ++++++- arch/riscv/include/asm/global_data.h | 2 ++ arch/riscv/lib/asm-offsets.c | 2 ++ arch/riscv/lib/smp.c | 2 ++ 6 files changed, 24 insertions(+), 2 deletions(-)arch/riscv/Kconfig +0
-0@@ -162,6 +162,16 @@ config SBI_IPI default y if RISCV_SMODE depends on SMP
Quoted 5 lines
arch/riscv/Kconfig config SBI_IPI · line 167
Quoted 3 lines
arch/riscv/Kconfig +3
-0+config XIP + bool "XIP mode" + default nnits: this is not necessary as by default all config options are n
OK
Quoted 8 lines
arch/riscv/Kconfig config SBI_IPI · line 170
Quoted 4 lines
arch/riscv/Kconfig +3
-0+ help + XIP (eXecute In Place) is a method for executing code directly + from a serial NOR flash memory without copying the code to ram.It's not necessary to be a serial NOR flash. A parallel flash can be the same. I think you can just mention NOR flash memory.
Quoted 7 lines
arch/riscv/Kconfig config SBI_IPI · line 173
Quoted 3 lines
arch/riscv/Kconfig +3
-0+ This must NOT support hart lottery and available harts features. + These two feature only can be enabled when U-Boot booting from + ram, but shall be disabled when booting from flash.remove the rest of the help message, and something like this:
Say yes here if U-Boot boots from flash directly.
OK
Quoted 51 lines
Quoted 51 lines
arch/riscv/Kconfig +1
-0+ config STACK_SIZE_SHIFT int default 13arch/riscv/cpu/cpu.c +2
-1@@ -16,13 +16,14 @@* before the bss section is available. */ phys_addr_t prior_stage_fdt_address __attribute__((section(".data"))); +#ifndef CONFIG_XIP u32 hart_lottery __attribute__((section(".data"))) = 0; -/* * 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 +4
-0@@ -98,6 +98,7 @@ call_board_init_f_0: mv sp, a0 #endif +#ifndef CONFIG_XIP /* * 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)
Quoted 11 lines
arch/riscv/cpu/start.S wait_for_gd_init: · line 144
Quoted 9 lines
arch/riscv/cpu/start.S +1
-1+#ifndef CONFIG_XIP la t0, available_harts_lock fence rw, w amoswap.w zero, zero, 0(t0)@@ -141,7 +146,7 @@ wait_for_gd_init: * secondary_hart_loop. */ bnez s2, secondary_hart_loop -Please keep the original blank line here.
OK
Quoted 53 lines
Quoted 40 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 +#ifndef CONFIG_XIP 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)); +#ifndef CONFIG_XIP 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+#ifndef CONFIG_XIP /* 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
Auer
PATCH v2 1/4 riscv: hart_lottery and available harts features can be selectable
In reply to AndesHi Rick,
Bin already included excellent feedback, I have just one more small nit below.
Quoted 53 lines · Andes
From: Rick Chen <[email protected]>
In smp flow these two features only can be enabled when U-Boot booting from ram. It shall be disabled when U-Boot booting from flash.
Add
CONFIG_XIPto NOT select this two features. It's default value will say NO for booting from ram.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 write failure problem when AE350 booting from flash by disabling this two features.
Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- arch/riscv/Kconfig | 10 ++++++++++ arch/riscv/cpu/cpu.c | 3 ++- arch/riscv/cpu/start.S | 7 ++++++- arch/riscv/include/asm/global_data.h | 2 ++ arch/riscv/lib/asm-offsets.c | 2 ++ arch/riscv/lib/smp.c | 2 ++ 6 files changed, 24 insertions(+), 2 deletions(-)arch/riscv/Kconfig +10
-0@@ -162,6 +162,16 @@ config SBI_IPI default y if RISCV_SMODE depends on SMP +config XIP + bool "XIP mode" + default n + help + XIP (eXecute In Place) is a method for executing code directly + from a serial NOR flash memory without copying the code to ram. + This must NOT support hart lottery and available harts features. + These two feature only can be enabled when U-Boot booting from + ram, but shall be disabled when booting from flash. + config STACK_SIZE_SHIFT int default 13arch/riscv/cpu/cpu.c +0
-0
arch/riscv/cpu/cpu.c line 20
Quoted 6 lines
arch/riscv/cpu/cpu.c +1
-1@@ -16,13 +16,14 @@* before the bss section is available. */ phys_addr_t prior_stage_fdt_address __attribute__((section(".data"))); +#ifndef CONFIG_XIP u32 hart_lottery __attribute__((section(".data"))) = 0; -
Please keep the blank line here.
Thanks,
Lukas
Quoted 92 lines
arch/riscv/cpu/cpu.c +1
-0/* * 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 +6
-1@@ -98,6 +98,7 @@ call_board_init_f_0: mv sp, a0 #endif +#ifndef CONFIG_XIP /* * 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) +#ifndef CONFIG_XIP la t0, available_harts_lock fence rw, w amoswap.w zero, zero, 0(t0)@@ -141,7 +146,7 @@ wait_for_gd_init: * secondary_hart_loop. */ bnez s2, secondary_hart_loop - +#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 +#ifndef CONFIG_XIP 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)); +#ifndef CONFIG_XIP 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 ; } +#ifndef CONFIG_XIP /* 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;
PATCH v2 1/4 riscv: hart_lottery and available harts features can be selectable
Hi Lukas
Auer, Lukas <[email protected]> 於 2019年4月26日 週五 上午4:55寫道:
Quoted 60 lines
Hi Rick,
Bin already included excellent feedback, I have just one more small nit below.
Quoted 53 lines · Andes
From: Rick Chen <[email protected]>
In smp flow these two features only can be enabled when U-Boot booting from ram. It shall be disabled when U-Boot booting from flash.
Add
CONFIG_XIPto NOT select this two features. It's default value will say NO for booting from ram.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 write failure problem when AE350 booting from flash by disabling this two features.
Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- arch/riscv/Kconfig | 10 ++++++++++ arch/riscv/cpu/cpu.c | 3 ++- arch/riscv/cpu/start.S | 7 ++++++- arch/riscv/include/asm/global_data.h | 2 ++ arch/riscv/lib/asm-offsets.c | 2 ++ arch/riscv/lib/smp.c | 2 ++ 6 files changed, 24 insertions(+), 2 deletions(-)arch/riscv/Kconfig +10
-0@@ -162,6 +162,16 @@ config SBI_IPI default y if RISCV_SMODE depends on SMP +config XIP + bool "XIP mode" + default n + help + XIP (eXecute In Place) is a method for executing code directly + from a serial NOR flash memory without copying the code to ram. + This must NOT support hart lottery and available harts features. + These two feature only can be enabled when U-Boot booting from + ram, but shall be disabled when booting from flash. + config STACK_SIZE_SHIFT int default 13arch/riscv/cpu/cpu.c +0
-0@@ -16,13 +16,14 @@
Quoted 8 lines
arch/riscv/cpu/cpu.c line 20
Quoted 6 lines
arch/riscv/cpu/cpu.c +1
-1* before the bss section is available. */ phys_addr_t prior_stage_fdt_address __attribute__((section(".data"))); +#ifndef CONFIG_XIP u32 hart_lottery __attribute__((section(".data"))) = 0; -Please keep the blank line here.
OK
Thnaks
Rick
Quoted 96 lines
Thanks,
LukasQuoted 92 lines
arch/riscv/cpu/cpu.c +1
-0/* * 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 +6
-1@@ -98,6 +98,7 @@ call_board_init_f_0: mv sp, a0 #endif +#ifndef CONFIG_XIP /* * 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) +#ifndef CONFIG_XIP la t0, available_harts_lock fence rw, w amoswap.w zero, zero, 0(t0)@@ -141,7 +146,7 @@ wait_for_gd_init: * secondary_hart_loop. */ bnez s2, secondary_hart_loop - +#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 +#ifndef CONFIG_XIP 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)); +#ifndef CONFIG_XIP 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 ; } +#ifndef CONFIG_XIP /* 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;
PATCH v2 2/4 riscv: configs: Support AE350 SMP booting from flash flow
In reply to AndesFrom: Rick Chen <[email protected]>
Add two defconfigs to support AE350 SMP booting from flash.
--- configs/ae350_rv32_xip_defconfig | 36 ++++++++++++++++++++++++++++++++++++ configs/ae350_rv64_xip_defconfig | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 configs/ae350_rv32_xip_defconfig create mode 100644 configs/ae350_rv64_xip_defconfig
configs/ae350_rv32_xip_defconfig new file +36 -0
@@ -0,0 +1,36 @@ +CONFIG_RISCV=y +CONFIG_SYS_TEXT_BASE=0x80000000 +CONFIG_XIP=y +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 +37 -0
@@ -0,0 +1,37 @@ +CONFIG_RISCV=y +CONFIG_SYS_TEXT_BASE=0x80000000 +CONFIG_XIP=y +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 v2 2/4 riscv: configs: Support AE350 SMP booting from flash flow
Quoted 5 lines · Andes
From: Rick Chen <[email protected]>
Add two defconfigs to support AE350 SMP booting from flash.
Quoted 9 lines
Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- configs/ae350_rv32_xip_defconfig | 36 ++++++++++++++++++++++++++++++++++++ configs/ae350_rv64_xip_defconfig | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 configs/ae350_rv32_xip_defconfig create mode 100644 configs/ae350_rv64_xip_defconfig
Auer
PATCH v2 2/4 riscv: configs: Support AE350 SMP booting from flash flow
In reply to AndesHi Rick,
Quoted 88 lines · Andes
From: Rick Chen <[email protected]>
Add two defconfigs to support AE350 SMP booting from flash.
Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- configs/ae350_rv32_xip_defconfig | 36 ++++++++++++++++++++++++++++++++++++ configs/ae350_rv64_xip_defconfig | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 configs/ae350_rv32_xip_defconfig create mode 100644 configs/ae350_rv64_xip_defconfigconfigs/ae350_rv32_xip_defconfig new file +36
-0@@ -0,0 +1,36 @@ +CONFIG_RISCV=y +CONFIG_SYS_TEXT_BASE=0x80000000 +CONFIG_XIP=y +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 +27
-0@@ -0,0 +1,37 @@ +CONFIG_RISCV=y +CONFIG_SYS_TEXT_BASE=0x80000000 +CONFIG_XIP=y +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 37
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
The non-xip defconfigs also define CONFIG_SF_DEFAULT_MODE as 0. Is this missing here or not needed in the xip configuration?
Looks good otherwise.
Thanks,
Lukas
PATCH v2 2/4 riscv: configs: Support AE350 SMP booting from flash flow
Hi Lukas
Auer, Lukas <[email protected]> 於 2019年4月26日 週五 上午4:56寫道:
Quoted 97 lines
Hi Rick,
Quoted 93 lines · Andes
From: Rick Chen <[email protected]>
Add two defconfigs to support AE350 SMP booting from flash.
Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- configs/ae350_rv32_xip_defconfig | 36 ++++++++++++++++++++++++++++++++++++ configs/ae350_rv64_xip_defconfig | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 configs/ae350_rv32_xip_defconfig create mode 100644 configs/ae350_rv64_xip_defconfigconfigs/ae350_rv32_xip_defconfig new file +36
-0@@ -0,0 +1,36 @@ +CONFIG_RISCV=y +CONFIG_SYS_TEXT_BASE=0x80000000 +CONFIG_XIP=y +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 +32
-0@@ -0,0 +1,37 @@ +CONFIG_RISCV=y +CONFIG_SYS_TEXT_BASE=0x80000000 +CONFIG_XIP=y +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
Quoted 9 lines
configs/ae350_rv64_xip_defconfig line 37
Quoted 5 lines
configs/ae350_rv64_xip_defconfig new file +5
-0+CONFIG_FTMAC100=y +CONFIG_BAUDRATE=38400 +CONFIG_SYS_NS16550=y +CONFIG_SPI=y +CONFIG_ATCSPI200_SPI=yThe non-xip defconfigs also define
CONFIG_SF_DEFAULT_MODEas 0. Is this missing here or not needed in the xip configuration?
Yes.
I shall keep this.
Thanks
Rick
Quoted 5 lines
Looks good otherwise.
Reviewed-by Lukas Auer <[email protected]>Thanks,
Lukas
PATCH v2 3/4 riscv: prior_stage_fdt_address should only be used when OF_PRIOR_STAGE is enabled
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/cpu.c | 2 ++ arch/riscv/cpu/start.S | 2 ++ 2 files changed, 4 insertions(+)
arch/riscv/cpu/cpu.c +2 -0
@@ -15,7 +15,9 @@* The variables here must be stored in the data section since they are used * before the bss section is available. */ +# if CONFIG_IS_ENABLED (OF_PRIOR_STAGE ) phys_addr_t prior_stage_fdt_address __attribute__((section(".data"))); +#endif #ifndef CONFIG_XIP u32 hart_lottery __attribute__((section(".data"))) = 0;/*
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 v2 3/4 riscv: prior_stage_fdt_address should only be used when OF_PRIOR_STAGE is enabled
Quoted 5 lines · Andes
From: Rick Chen <[email protected]>
This patch will fix
prior_stage_fdt_addresswrite failure problem, when AE350 was booting from flash.
was -> is
Quoted 2 lines
When AE350 was booting from falsh,
prior_stage_fdt_addresswill be in
was -> is
Quoted 14 lines
flash address, we shall avoid it to be written.
Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- arch/riscv/cpu/cpu.c | 2 ++ arch/riscv/cpu/start.S | 2 ++ 2 files changed, 4 insertions(+)arch/riscv/cpu/cpu.c +0
-0
arch/riscv/cpu/cpu.c line 18
Quoted 4 lines
arch/riscv/cpu/cpu.c +1
-0@@ -15,7 +15,9 @@* The variables here must be stored in the data section since they are used * before the bss section is available. */ +# if CONFIG_IS_ENABLED (OF_PRIOR_STAGE )
Should this be: ifdef CONFIG_OF_PRIOR_STAGE, because the next a few of lines you wrote: #ifndef CONFIG_XIP
Quoted 10 lines
arch/riscv/cpu/cpu.c +1
-0phys_addr_t prior_stage_fdt_address __attribute__((section(".data"))); +#endif #ifndef CONFIG_XIP u32 hart_lottery __attribute__((section(".data"))) = 0;/* arch/riscv/cpu/start.S +0
-0
arch/riscv/cpu/start.S call_board_init_f_0: · line 114
Quoted 4 lines
arch/riscv/cpu/start.S +1
-0@@ -111,7 +111,9 @@ call_board_init_f_0: bnez tp, secondary_hart_loop #endif +# if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
#ifdef CONFIG_OF_PRIOR_STAGE ?
arch/riscv/cpu/start.S call_board_init_f_0:
Quoted 6 lines
arch/riscv/cpu/start.S +1
-1la t0, prior_stage_fdt_address +#endif SREG s1, 0(t0) jal board_init_f_init_reserve --
Regards,
Bin
PATCH v2 3/4 riscv: prior_stage_fdt_address should only be used when OF_PRIOR_STAGE is enabled
Bin Meng <[email protected]> 於 2019年4月24日 週三 下午3:02寫道:
Quoted 9 lines · Andes
Quoted 5 lines
From: Rick Chen <[email protected]>
This patch will fix
prior_stage_fdt_addresswrite failure problem, when AE350 was booting from flash.was -> is
OK
Quoted 5 lines
Quoted 3 lines
When AE350 was booting from falsh,
prior_stage_fdt_addresswill be inwas -> is
OK
Quoted 10 lines
Quoted 10 lines
flash address, we shall avoid it to be written.
Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- arch/riscv/cpu/cpu.c | 2 ++ arch/riscv/cpu/start.S | 2 ++ 2 files changed, 4 insertions(+)
Quoted 12 lines
arch/riscv/cpu/cpu.c line 18
Quoted 9 lines
arch/riscv/cpu/cpu.c +1
-0@@ -15,7 +15,9 @@* The variables here must be stored in the data section since they are used * before the bss section is available. */ +# if CONFIG_IS_ENABLED (OF_PRIOR_STAGE )Should this be: ifdef
CONFIG_OF_PRIOR_STAGE, because the next a few of lines you wrote: #ifndefCONFIG_XIP
I just refer to fdtdesc.c and imitate it.
But it is no problem to modify it as ifdef CONFIG_OF_PRIOR_STAGE as you said.
Quoted 14 lines
Quoted 14 lines
arch/riscv/cpu/cpu.c +1
-0phys_addr_t prior_stage_fdt_address __attribute__((section(".data"))); +#endif #ifndef CONFIG_XIP u32 hart_lottery __attribute__((section(".data"))) = 0;/* arch/riscv/cpu/start.S +0
-0@@ -111,7 +111,9 @@ call_board_init_f_0: bnez tp, secondary_hart_loop #endif
Quoted 3 lines
arch/riscv/cpu/start.S call_board_init_f_0: · line 114
Quoted 1 line
arch/riscv/cpu/start.S +1
-0+# if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)#ifdef
CONFIG_OF_PRIOR_STAGE?
OK
Quoted 10 lines
arch/riscv/cpu/start.S call_board_init_f_0:
Quoted 7 lines
arch/riscv/cpu/start.S +1
-1la t0, prior_stage_fdt_address +#endif SREG s1, 0(t0) jal board_init_f_init_reserve --Regards,
Bin
Auer
PATCH v2 3/4 riscv: prior_stage_fdt_address should only be used when OF_PRIOR_STAGE is enabled
Quoted 39 lines · Rick Chen
Bin Meng <[email protected]> 於 2019年4月24日 週三 下午3:02寫道:
Quoted 7 lines · Andes
Quoted 4 lines
From: Rick Chen <[email protected]>
This patch will fix
prior_stage_fdt_addresswrite failure problem, when AE350 was booting from flash.was -> is
OK
Quoted 3 lines
Quoted 1 line
When AE350 was booting from falsh,
prior_stage_fdt_addresswill be inwas -> is
OK
Quoted 9 lines
Quoted 9 lines
flash address, we shall avoid it to be written.
Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- arch/riscv/cpu/cpu.c | 2 ++ arch/riscv/cpu/start.S | 2 ++ 2 files changed, 4 insertions(+)Quoted 12 lines
arch/riscv/cpu/cpu.c line 18
Quoted 9 lines
arch/riscv/cpu/cpu.c +1
-0@@ -15,7 +15,9 @@* The variables here must be stored in the data section since they are used * before the bss section is available. */ +# if CONFIG_IS_ENABLED (OF_PRIOR_STAGE )Should this be: ifdef
CONFIG_OF_PRIOR_STAGE, because the next a few of lines you wrote: #ifndefCONFIG_XIP
Quoted 3 lines
I just refer to
fdtdesc.cand imitate it.
But it is no problem to modify it as ifdefCONFIG_OF_PRIOR_STAGEas you said.
It might also makes sense to use #if CONFIG_IS_ENABLED() for both CONFIG_OF_PRIOR_STAGE and CONFIG_XIP. This way, once we support SPL for RISC-V, we won't have to make any additional changes.
With SPL support, SPL would likely enable XIP while U-Boot proper would not (SPL running from flash and U-Boot proper from RAM). To support this we would have to use CONFIG_IS_ENABLED.
If you choose to keep CONFIG_IS_ENABLED, please remove the spaces between # and if.
Thanks,
Lukas
Quoted 28 lines
Quoted 13 lines
Quoted 13 lines
arch/riscv/cpu/cpu.c +1
-0phys_addr_t prior_stage_fdt_address __attribute__((section(".data"))); +#endif #ifndef CONFIG_XIP u32 hart_lottery __attribute__((section(".data"))) = 0;/* arch/riscv/cpu/start.S +0
-0@@ -111,7 +111,9 @@ call_board_init_f_0: bnez tp, secondary_hart_loop #endifQuoted 3 lines
arch/riscv/cpu/start.S call_board_init_f_0: · line 114
Quoted 1 line
arch/riscv/cpu/start.S +1
-0+# if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)#ifdef
CONFIG_OF_PRIOR_STAGE?OK
Quoted 9 lines
arch/riscv/cpu/start.S call_board_init_f_0:
Quoted 6 lines
arch/riscv/cpu/start.S +1
-1la t0, prior_stage_fdt_address +#endif SREG s1, 0(t0) jal board_init_f_init_reserve --Regards,
Bin
PATCH v2 3/4 riscv: prior_stage_fdt_address should only be used when OF_PRIOR_STAGE is enabled
Auer, Lukas <[email protected]> 於 2019年4月26日 週五 上午4:58寫道:
Quoted 52 lines · Rick Chen
Quoted 39 lines
Bin Meng <[email protected]> 於 2019年4月24日 週三 下午3:02寫道:
Quoted 7 lines · Andes
Quoted 4 lines
From: Rick Chen <[email protected]>
This patch will fix
prior_stage_fdt_addresswrite failure problem, when AE350 was booting from flash.was -> is
OK
Quoted 3 lines
Quoted 1 line
When AE350 was booting from falsh,
prior_stage_fdt_addresswill be inwas -> is
OK
Quoted 9 lines
Quoted 9 lines
flash address, we shall avoid it to be written.
Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- arch/riscv/cpu/cpu.c | 2 ++ arch/riscv/cpu/start.S | 2 ++ 2 files changed, 4 insertions(+)Quoted 12 lines
arch/riscv/cpu/cpu.c line 18
Quoted 9 lines
arch/riscv/cpu/cpu.c +1
-0@@ -15,7 +15,9 @@* The variables here must be stored in the data section since they are used * before the bss section is available. */ +# if CONFIG_IS_ENABLED (OF_PRIOR_STAGE )Should this be: ifdef
CONFIG_OF_PRIOR_STAGE, because the next a few of lines you wrote: #ifndefCONFIG_XIPQuoted 3 lines
I just refer to
fdtdesc.cand imitate it.
But it is no problem to modify it as ifdefCONFIG_OF_PRIOR_STAGEas you said.It might also makes sense to use #if
CONFIG_IS_ENABLED()for bothCONFIG_OF_PRIOR_STAGEandCONFIG_XIP. This way, once we support SPL for RISC-V, we won't have to make any additional changes.
With SPL support, SPL would likely enable XIP while U-Boot proper would not (SPL running from flash and U-Boot proper from RAM). To support this we would have to useCONFIG_IS_ENABLED.
Quoted 3 lines
If you choose to keep
CONFIG_IS_ENABLED, please remove the spaces between # and if.
Thanks for explanation.
I will use #ifdef CONFIG_OF_PRIOR_STAGE
Thanks
Rick
Quoted 31 lines
Thanks,
LukasQuoted 28 lines
Quoted 13 lines
Quoted 13 lines
arch/riscv/cpu/cpu.c +1
-0phys_addr_t prior_stage_fdt_address __attribute__((section(".data"))); +#endif #ifndef CONFIG_XIP u32 hart_lottery __attribute__((section(".data"))) = 0;/* arch/riscv/cpu/start.S +0
-0@@ -111,7 +111,9 @@ call_board_init_f_0: bnez tp, secondary_hart_loop #endifQuoted 3 lines
arch/riscv/cpu/start.S call_board_init_f_0: · line 114
Quoted 1 line
arch/riscv/cpu/start.S +1
-0+# if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)#ifdef
CONFIG_OF_PRIOR_STAGE?OK
Quoted 9 lines
arch/riscv/cpu/start.S call_board_init_f_0:
Quoted 6 lines
arch/riscv/cpu/start.S +1
-1la t0, prior_stage_fdt_address +#endif SREG s1, 0(t0) jal board_init_f_init_reserve --Regards,
Bin
Auer
PATCH v2 3/4 riscv: prior_stage_fdt_address should only be used when OF_PRIOR_STAGE is enabled
In reply to AndesHi Rick,
Quoted 6 lines · Andes
From: Rick Chen <[email protected]>
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
nit: should be flash
Quoted 28 lines
flash address, we shall avoid it to be written.
Signed-off-by Rick Chen <[email protected]>Cc Greentime Hu <[email protected]>--- arch/riscv/cpu/cpu.c | 2 ++ arch/riscv/cpu/start.S | 2 ++ 2 files changed, 4 insertions(+)arch/riscv/cpu/cpu.c +2
-0@@ -15,7 +15,9 @@* The variables here must be stored in the data section since they are used * before the bss section is available. */ +# if CONFIG_IS_ENABLED (OF_PRIOR_STAGE ) phys_addr_t prior_stage_fdt_address __attribute__((section(".data"))); +#endif #ifndef CONFIG_XIP u32 hart_lottery __attribute__((section(".data"))) = 0;/* arch/riscv/cpu/start.S +0
-0
arch/riscv/cpu/start.S call_board_init_f_0: · line 117
Quoted 7 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 SREG s1, 0(t0)
The SREG instruction must also be inside the ifdef here.
Thanks,
Lukas
Quoted 2 lines
arch/riscv/cpu/start.S +0
-0jal board_init_f_init_reserve
PATCH v2 4/4 riscv: configs: AE350 will use CONFIG_OF_PRIOR_STAGE when booting from ram
In reply to AndesFrom: Rick Chen <[email protected]>
When AE350 was booting from ram, use CONFIG_OF_PRIOR_STAGE instead of CONFIG_OF_BOARD.
--- 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 v2 4/4 riscv: configs: AE350 will use CONFIG_OF_PRIOR_STAGE when booting from ram
Quoted 4 lines · Andes
From: Rick Chen <[email protected]>
When AE350 was booting from ram, use
CONFIG_OF_PRIOR_STAGEinstead
was -> is
Quoted 9 lines
of
CONFIG_OF_BOARD.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(-)
Other than that,
PATCH v2 4/4 riscv: configs: AE350 will use CONFIG_OF_PRIOR_STAGE when booting from ram
HI Bin
Bin Meng <[email protected]> 於 2019年4月24日 週三 下午3:02寫道:
Quoted 8 lines · Andes
Quoted 4 lines
From: Rick Chen <[email protected]>
When AE350 was booting from ram, use
CONFIG_OF_PRIOR_STAGEinsteadwas -> is
OK
Quoted 11 lines
Quoted 10 lines
of
CONFIG_OF_BOARD.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(-)
Quoted 2 lines
Other than that,
Reviewed-by Bin Meng <[email protected]>
Thanks
Rick
Auer
PATCH v2 4/4 riscv: configs: AE350 will use CONFIG_OF_PRIOR_STAGE when booting from ram
In reply to AndesQuoted 5 lines · Andes
From: Rick Chen <[email protected]>
When AE350 was booting from ram, use
CONFIG_OF_PRIOR_STAGEinstead ofCONFIG_OF_BOARD.
Quoted 7 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(-)