xen/riscv: introduce smp_prepare_boot_cpu()

Initialize cpu_{possible, online}_map by using smp_prepare_boot_cpu().

Drop DEFINE_PER_CPU(unsigned int, cpu_id) from stubs.c as this variable isn't
expected to be used in RISC-V at all.

Move declaration of cpu_{possible,online}_map from stubs.c to smpboot.c
as now smpboot.c is now introduced.
Other defintions keep in stubs.c as they are not initialized and not needed, at
the moment.

Drop cpu_present_map as it is enough to have cpu_possible_map. Also, ask
linker to provide symbol for cpu_present_map as common code references it.

Move call of set_processor_id(0) to smp_prepare_boot_cpu().

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Oleksii Kurochko authored and Jan Beulich committed 2025-06-02 12:41:36 +02:00
1 parent 6b1da8110b
commit b54b825e6f
5 files changed
+21 -8

No files matched your search

+1
View File
@@ -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
+2 -2
View File
@@ -8,6 +8,7 @@
#include <xen/init.h>
#include <xen/mm.h>
#include <xen/shutdown.h>
#include <xen/smp.h>
#include <xen/vmap.h>
#include <xen/xvmalloc.h>
@@ -19,7 +20,6 @@
#include <asm/intc.h>
#include <asm/sbi.h>
#include <asm/setup.h>
#include <asm/smp.h>
#include <asm/traps.h>
/* 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);
+16
View File
@@ -0,0 +1,16 @@
#include <xen/cpumask.h>
#include <xen/init.h>
#include <xen/sections.h>
#include <asm/current.h>
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);
}
-6
View File
@@ -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);
+2
View File
@@ -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")
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.