riscv64/smp: Implement multi-processor support

* Working under qemu smp 1,2+
* Working on SiFive Unmatched
* x86_64 efi not broken by smp_boot_other_cpus change

Change-Id: I32ebc17913e46ed082be9ade8f56448bbf12f16e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4705
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Alex von Gluck IV <[email protected]>
This commit is contained in:
X512
2021-12-12 15:35:24 +00:00
committed by Alex von Gluck IV
parent 0cdb323800
commit 8ca0f03d0c
31 changed files with 1350 additions and 506 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2019 Haiku, Inc. All rights reserved.
* Copyright 2013-2021 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef KERNEL_BOOT_PLATFORM_EFI_ARCH_SMP_H
@@ -13,9 +13,17 @@
// These platforms take inventory of cpu cores from fdt
struct platform_cpu_info {
uint32 id;
uint32 id; // hart id on riscv
#if defined(__riscv)
uint32 phandle;
uint32 plicContext;
#endif
};
#if defined(__riscv)
extern uint32 gBootHart;
#endif
void arch_smp_register_cpu(platform_cpu_info** cpu);
#endif
@@ -23,6 +31,7 @@ void arch_smp_register_cpu(platform_cpu_info** cpu);
int arch_smp_get_current_cpu(void);
void arch_smp_init_other_cpus(void);
#ifdef __riscv
platform_cpu_info* arch_smp_find_cpu(uint32 phandle);
void arch_smp_boot_other_cpus(uint64 satp, uint64 kernel_entry);
#else
void arch_smp_boot_other_cpus(uint32 pml4, uint64 kernel_entry);