diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile index d882c57528..f42cf3dfa6 100644 --- a/xen/arch/riscv/Makefile +++ b/xen/arch/riscv/Makefile @@ -10,6 +10,7 @@ obj-y += sbi.o obj-y += setup.o obj-y += shutdown.o obj-y += smp.o +obj-y += smpboot.o obj-y += stubs.o obj-y += time.o obj-y += traps.o diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index 4e416f6e44..a9c0c61fb6 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -19,7 +20,6 @@ #include #include #include -#include #include /* Xen stack for bringing up the first CPU. */ @@ -72,7 +72,7 @@ void __init noreturn start_xen(unsigned long bootcpu_id, remove_identity_mapping(); - set_processor_id(0); + smp_prepare_boot_cpu(); set_cpuid_to_hartid(0, bootcpu_id); diff --git a/xen/arch/riscv/smpboot.c b/xen/arch/riscv/smpboot.c new file mode 100644 index 0000000000..0f9c2cc54a --- /dev/null +++ b/xen/arch/riscv/smpboot.c @@ -0,0 +1,16 @@ +#include +#include +#include + +#include + +cpumask_t __read_mostly cpu_online_map; +cpumask_t __ro_after_init cpu_possible_map; + +void __init smp_prepare_boot_cpu(void) +{ + set_processor_id(0); + + cpumask_set_cpu(0, &cpu_possible_map); + cpumask_set_cpu(0, &cpu_online_map); +} diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c index 83416d3350..fdcf91054e 100644 --- a/xen/arch/riscv/stubs.c +++ b/xen/arch/riscv/stubs.c @@ -11,12 +11,6 @@ /* smpboot.c */ -cpumask_t cpu_online_map; -cpumask_t cpu_present_map; -cpumask_t cpu_possible_map; - -/* ID of the PCPU we're running on */ -DEFINE_PER_CPU(unsigned int, cpu_id); /* XXX these seem awfully x86ish... */ /* representing HT siblings of each logical CPU */ DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_mask); diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S index 818aa43669..8c3c06de01 100644 --- a/xen/arch/riscv/xen.lds.S +++ b/xen/arch/riscv/xen.lds.S @@ -165,6 +165,8 @@ SECTIONS ELF_DETAILS_SECTIONS } +PROVIDE(cpu_present_map = cpu_possible_map); + ASSERT(IS_ALIGNED(__bss_start, POINTER_ALIGN), "__bss_start is misaligned") ASSERT(IS_ALIGNED(__bss_end, POINTER_ALIGN), "__bss_end is misaligned")