|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen/riscv: introduce smp_prepare_boot_cpu()
commit b54b825e6fa1dbcfa9ea9de5e285441dd6649989
Author: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
AuthorDate: Mon Jun 2 12:41:36 2025 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Jun 2 12:41:36 2025 +0200
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@xxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
xen/arch/riscv/Makefile | 1 +
xen/arch/riscv/setup.c | 4 ++--
xen/arch/riscv/smpboot.c | 16 ++++++++++++++++
xen/arch/riscv/stubs.c | 6 ------
xen/arch/riscv/xen.lds.S | 2 ++
5 files changed, 21 insertions(+), 8 deletions(-)
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 <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);
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 <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);
+}
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")
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |