Skip to contentSkip to conversation

AE350 support SMP boot from flash

PATCH Superseded Andes 4 participants 19 messages Apr 23, 2019 – Apr 25, 2019 RISC-V

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Andes

author
#0 lore raw

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
author
#1 lore raw

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.

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 +21 -0
index ae8ff7b..4354396 100644
@@ -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
index c32de8a..0add783 100644
@@ -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
index a4433fb..d030d4a 100644
@@ -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
index dffcd45..e2e8b65 100644
@@ -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
index f998402..3ebda97 100644
@@ -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
index caa292c..4de7ea2 100644
@@ -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
#2 lore raw

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_LOTTERY and CONFIG_AVAILABLE_HARTS to 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_lottery and available_harts_lock was 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
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
index ae8ff7b..4354396 100644

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 13
arch/riscv/cpu/cpu.c +4 -0
index c32de8a..0add783 100644
@@ -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
index a4433fb..d030d4a 100644
@@ -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 -1
        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
-

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_enable
arch/riscv/include/asm/global_data.h +2 -0
index dffcd45..e2e8b65 100644
@@ -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
index f998402..3ebda97 100644
@@ -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
index caa292c..4de7ea2 100644
@@ -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

#3 lore raw

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->these

Quoted 1 line

boot from ram. It shall be disabled when U-Boot boot from flash.

boot->boots

Quoted 2 lines

Add CONFIG_HART_LOTTERY and CONFIG_AVAILABLE_HARTS to 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->these

Quoted 1 line

from ram.

Regards,
Bin

#4 lore raw

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_LOTTERY and CONFIG_AVAILABLE_HARTS to 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.

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->these

Quoted 1 line

from ram.

Regards,
Bin

author
#5 lore raw

PATCH 2/4 riscv: configs: Support AE350 SMP boot from flash flow

In reply to Andes

From: Rick Chen <[email protected]>

Add two defconfig to support AE350 SMP boot from flash by disable CONFIG_HART_LOTTERY and CONFIG_AVAILABLE_HARTS.

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_defconfig
configs/ae350_rv32_xip_defconfig new file +37 -0
new file mode 100644
index 0000000..1639367
@@ -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
new file mode 100644
index 0000000..d6a502c
@@ -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
#6 lore raw

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_LOTTERY and CONFIG_AVAILABLE_HARTS.

disable->disabling

Quoted 16 lines
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_defconfig
configs/ae350_rv32_xip_defconfig new file +0 -0
new file mode 100644
index 0000000..1639367

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=y
configs/ae350_rv64_xip_defconfig new file +0 -0
new file mode 100644
index 0000000..d6a502c

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

#7 lore raw

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_LOTTERY and CONFIG_AVAILABLE_HARTS.

disable->disabling

OK

Quoted 23 lines
Quoted 17 lines
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_defconfig
configs/ae350_rv32_xip_defconfig new file +0 -0
new file mode 100644
index 0000000..1639367

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:

Quoted 2 lines

# CONFIG_HART_LOTTERY is not set
# CONFIG_AVAILABLE_HARTS is 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=y
configs/ae350_rv64_xip_defconfig new file +0 -0
new file mode 100644
index 0000000..d6a502c
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=n

ditto

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

author
#8 lore raw

PATCH 3/4 riscv: prior_stage_fdt_address only be used when OF_PRIOR_STAGE is enable

In reply to Andes

From: 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.

Cc Greentime Hu <[email protected]>
---
 arch/riscv/cpu/start.S | 2 ++
 1 file changed, 2 insertions(+)
arch/riscv/cpu/start.S +2 -0
index d030d4a..0e672e0 100644
@@ -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
#9 lore raw

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_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.

Cc Greentime Hu <[email protected]>
---
 arch/riscv/cpu/start.S | 2 ++
 1 file changed, 2 insertions(+)
arch/riscv/cpu/start.S +0 -0
index d030d4a..0e672e0 100644

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 -1
        SREG    s1, 0(t0)
 
        jal     board_init_f_init_reserve
--

Regards,
Bin

#10 lore raw

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_address should only be used when OF_PRIOR_STAGE is enabled

OK

Quoted 21 lines
Quoted 21 lines

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.

Cc Greentime Hu <[email protected]>
---
 arch/riscv/cpu/start.S | 2 ++
 1 file changed, 2 insertions(+)
arch/riscv/cpu/start.S +0 -0
index d030d4a..0e672e0 100644
@@ -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
+#endif

I think you should also surround the declaration of prior_stage_fdt_address in arch/riscv/cpu/cpu.c with OF_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 -1
        SREG    s1, 0(t0)
 
        jal     board_init_f_init_reserve
--

Regards,
Bin

author
#11 lore raw

PATCH 4/4 riscv: configs: AE350 will use OF_PRIOR_STAGE when boot from ram

In reply to Andes

From: Rick Chen <[email protected]>

When AE350 was booting from ram, use OF_PRIOR_STAGE instead of OF_PRIOR_STAGE.

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
index e13c7de..54b65f1 100644
@@ -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
index a41f918..0ff4de8 100644
@@ -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
#12 lore raw

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_STAGE instead of OF_PRIOR_STAGE.

This should be CONFIG_OF_BOARD

Quoted 26 lines
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
index e13c7de..54b65f1 100644
@@ -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 +0 -0
index a41f918..0ff4de8 100644

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

#13 lore raw

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_STAGE instead of OF_PRIOR_STAGE.

This should be CONFIG_OF_BOARD

OK

Thanks
Rick

Quoted 38 lines
Quoted 27 lines
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
index e13c7de..54b65f1 100644
@@ -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 +0 -0
index a41f918..0ff4de8 100644

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

#14 lore raw

cover AE350 support SMP boot from flash

In reply to Andes

Hi 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_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.

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

#15 lore raw

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_lottery and available_harts_lock was 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

#16 lore raw

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_lottery and available_harts_lock was 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.

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: 0092a023 sw 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

#17 lore raw

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_lottery and available_harts_lock was 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.

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: 0092a023 sw 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

#18 lore raw

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_lottery and available_harts_lock was 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.

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: 0092a023 sw 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_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.

Ah, you are right. I did not consider that.

Thanks,
Lukas