aboutsummaryrefslogtreecommitdiffstats
path: root/arch/riscv/kernel/setup.c
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@sifive.com>2018-10-22 17:39:29 -0700
committerPalmer Dabbelt <palmer@sifive.com>2018-10-22 17:41:43 -0700
commitd26c4bbf992463c043fdee4b3e5efa3f08990862 (patch)
tree6f7eb8b1da031352fc3e386dd4662fabf132b942 /arch/riscv/kernel/setup.c
parentRISC-V: Fix some RV32 bugs and build failures (diff)
parentRISC-V: Show IPI stats (diff)
downloadlinux-dev-d26c4bbf992463c043fdee4b3e5efa3f08990862.tar.xz
linux-dev-d26c4bbf992463c043fdee4b3e5efa3f08990862.zip
RISC-V: SMP cleanup and new features
This patch series now has evolved to contain several related changes. 1. Updated the assorted cleanup series by Palmer. The original cleanup patch series can be found here. http://lists.infradead.org/pipermail/linux-riscv/2018-August/001232.html 2. Implemented decoupling linux logical CPU ids from hart id. Some of the work has been inspired from ARM64. Tested on QEMU & HighFive Unleashed board with/without SMP enabled. 3. Included Anup's cleanup and IPI stat patch. All the patch series have been combined to avoid conflicts as a lot of common code is changed different patch sets. Atish has mostly addressed review comments and fixed checkpatch errors from Palmer's and Anup's series. Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
Diffstat (limited to 'arch/riscv/kernel/setup.c')
-rw-r--r--arch/riscv/kernel/setup.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index c9461985db7e..2c290e6aaa6e 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -81,6 +81,16 @@ EXPORT_SYMBOL(empty_zero_page);
/* The lucky hart to first increment this variable will boot the other cores */
atomic_t hart_lottery;
+unsigned long boot_cpu_hartid;
+
+unsigned long __cpuid_to_hartid_map[NR_CPUS] = {
+ [0 ... NR_CPUS-1] = INVALID_HARTID
+};
+
+void __init smp_setup_processor_id(void)
+{
+ cpuid_to_hartid_map(0) = boot_cpu_hartid;
+}
#ifdef CONFIG_BLK_DEV_INITRD
static void __init setup_initrd(void)