aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv/lib
diff options
context:
space:
mode:
authorRick Chen <rick@andestech.com>2022-09-21 14:34:54 +0800
committerLeo Yu-Chi Liang <ycliang@andestech.com>2022-09-26 14:29:13 +0800
commite0465f80bd33f239612ee9f0ee7b6cf13d2f5b4d (patch)
treeddd81b0d82d1c0e8abf0b80853fdde07407bd5e6 /arch/riscv/lib
parentc2bdf02c9d40da7154fea46b7d10343fe9f14209 (diff)
downloadu-boot-e0465f80bd33f239612ee9f0ee7b6cf13d2f5b4d.zip
u-boot-e0465f80bd33f239612ee9f0ee7b6cf13d2f5b4d.tar.gz
u-boot-e0465f80bd33f239612ee9f0ee7b6cf13d2f5b4d.tar.bz2
riscv: Introduce AVAILABLE_HARTS
In SMP all harts will register themself in available_hart during start up. Then main hart will send IPI to other harts according to this variables. But this mechanism may not guarantee that all other harts can jump to next stage. When main hart is sending IPI to other hart according to available_harts, but other harts maybe still not finish the registration. Then the SMP booting will miss some harts finally. So let it become an option and it will be enabled by default. Please refer to the discussion: https://www.mail-archive.com/u-boot@lists.denx.de/msg449997.html Signed-off-by: Rick Chen <rick@andestech.com> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Diffstat (limited to 'arch/riscv/lib')
-rw-r--r--arch/riscv/lib/asm-offsets.c2
-rw-r--r--arch/riscv/lib/smp.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/arch/riscv/lib/asm-offsets.c b/arch/riscv/lib/asm-offsets.c
index c4f48c8..452dfce 100644
--- a/arch/riscv/lib/asm-offsets.c
+++ b/arch/riscv/lib/asm-offsets.c
@@ -17,8 +17,10 @@ int main(void)
DEFINE(GD_BOOT_HART, offsetof(gd_t, arch.boot_hart));
DEFINE(GD_FIRMWARE_FDT_ADDR, offsetof(gd_t, arch.firmware_fdt_addr));
#if !CONFIG_IS_ENABLED(XIP)
+#ifdef CONFIG_AVAILABLE_HARTS
DEFINE(GD_AVAILABLE_HARTS, offsetof(gd_t, arch.available_harts));
#endif
+#endif
return 0;
}
diff --git a/arch/riscv/lib/smp.c b/arch/riscv/lib/smp.c
index f8b7562..c0f65af 100644
--- a/arch/riscv/lib/smp.c
+++ b/arch/riscv/lib/smp.c
@@ -46,10 +46,12 @@ static int send_ipi_many(struct ipi_data *ipi, int wait)
}
#if !CONFIG_IS_ENABLED(XIP)
+#ifdef CONFIG_AVAILABLE_HARTS
/* skip if hart is not available */
if (!(gd->arch.available_harts & (1 << reg)))
continue;
#endif
+#endif
gd->arch.ipi[reg].addr = ipi->addr;
gd->arch.ipi[reg].arg0 = ipi->arg0;