diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-10-30 16:23:15 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-11-01 10:27:51 +0200 |
| commit | d5e5afae9249da312b417bc4f5f45ac164404846 (patch) | |
| tree | 91c486085c6e9618ae4acd1e18aae5d4fe627d04 /arch/riscv64 | |
| parent | dc71f4f38f49ed3a3b67098b7926a0731e9ce225 (diff) | |
| download | kmi-d5e5afae9249da312b417bc4f5f45ac164404846.tar.gz kmi-d5e5afae9249da312b417bc4f5f45ac164404846.zip | |
smp on visionfive2 'works'
Diffstat (limited to 'arch/riscv64')
| -rw-r--r-- | arch/riscv64/kernel/core_bringup.S | 4 | ||||
| -rw-r--r-- | arch/riscv64/kernel/smp.c | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/arch/riscv64/kernel/core_bringup.S b/arch/riscv64/kernel/core_bringup.S index 8a5a6f5..db68dce 100644 --- a/arch/riscv64/kernel/core_bringup.S +++ b/arch/riscv64/kernel/core_bringup.S @@ -1,3 +1,4 @@ +#include "../kernel/csr.h" #include "asm.h" /* pic forces core_bringup to be placed in .got that we can access both from @@ -11,6 +12,9 @@ riscv_bringup: csrw satp, a1 sfence.vma + /* set scratch to zero in case we crash */ + csrw CSR_SSCRATCH, x0 + /* fetch the stack allocated to us at our hart index in smp_init_stacks */ lui t0, %hi(smp_init_stacks) addi t0, t0, %lo(smp_init_stacks) diff --git a/arch/riscv64/kernel/smp.c b/arch/riscv64/kernel/smp.c index 5e30fee..f061694 100644 --- a/arch/riscv64/kernel/smp.c +++ b/arch/riscv64/kernel/smp.c @@ -99,8 +99,7 @@ void smp_bringup(struct vmem *b, void *fdt) BASE_PAGE_SIZE; /* fixup physical address of bringup */ - pm_t bringup = (pm_t)riscv_bringup; - bringup = bringup - VM_KERNEL + get_load_addr(); + pm_t bringup = (pm_t)riscv_bringup - VM_KERNEL + get_load_addr(); r = sbi_hart_start(hartid, bringup, satp); @@ -149,6 +148,9 @@ __noreturn void core_bringup(long hartid) tcb_assign(t); use_tcb(t); + /* now that we're in our own virtual address space, set stack etc. */ + set_thread(t); + info("core %ld releasing BKL\n", (long)cpuid); run_init(t, NULL, NULL); unreachable(); |
