Skip to contentSkip to conversation

riscv: export boot_cpu_hartid

PATCH Applied Klara Modin 4 participants 4 messages Jun 17, 2025 – Jun 24, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: export boot_cpu_hartid

The mailbox controller driver for the Microchip Inter-processor Communication can be built as a module. It uses cpuid_to_hartid_map and commit 4783ce32b080 ("riscv: export __cpuid_to_hartid_map") enables that to work for SMP. However, cpuid_to_hartid_map uses boot_cpu_hartid on non-SMP kernels and this driver can be useful in such configurations[1].

Export boot_cpu_hartid so the driver can be built as a module on non-SMP kernels as well.

---
 arch/riscv/kernel/setup.c | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/kernel/setup.c +1 -0
index f7c9a1caa83e..14888e5ea19a 100644
@@ -50,6 +50,7 @@ atomic_t hart_lottery __section(".sdata")
 #endif
 ;
 unsigned long boot_cpu_hartid;
+EXPORT_SYMBOL_GPL(boot_cpu_hartid);
 
 /*
  * Place kernel memory regions on the resource tree so that
Signature · 1 line
2.49.0
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Klara Modin

The mailbox controller driver for the Microchip Inter-processor Communication can be built as a module. It uses cpuid_to_hartid_map and commit 4783ce32b080 ("riscv: export __cpuid_to_hartid_map") enables that to work for SMP. However, cpuid_to_hartid_map uses boot_cpu_hartid on non-SMP kernels and this driver can be useful in such configurations[1].

Quoted 6 lines

Export boot_cpu_hartid so the driver can be built as a module on non-SMP kernels as well.

Fixes e4b1d67e7141 ("mailbox: add Microchip IPC support")

I'm not sure that this fixes tag is really right, but I have no better suggestions

Quoted 20 lines
---
 arch/riscv/kernel/setup.c | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/kernel/setup.c +1 -0
index f7c9a1caa83e..14888e5ea19a 100644
@@ -50,6 +50,7 @@ atomic_t hart_lottery __section(".sdata")
 #endif
 ;
 unsigned long boot_cpu_hartid;
+EXPORT_SYMBOL_GPL(boot_cpu_hartid);
 
 /*
  * Place kernel memory regions on the resource tree so that
Signature · 1 line
2.49.0
maintainer
#2 lore raw
Quoted 10 lines · Conor Dooley
Quoted 9 lines · Klara Modin

The mailbox controller driver for the Microchip Inter-processor Communication can be built as a module. It uses cpuid_to_hartid_map and commit 4783ce32b080 ("riscv: export __cpuid_to_hartid_map") enables that to work for SMP. However, cpuid_to_hartid_map uses boot_cpu_hartid on non-SMP kernels and this driver can be useful in such configurations[1].

Export boot_cpu_hartid so the driver can be built as a module on non-SMP kernels as well.

Quoted 6 lines
Quoted 3 lines
Fixes e4b1d67e7141 ("mailbox: add Microchip IPC support")

I'm not sure that this fixes tag is really right, but I have no better suggestions

Seems OK to me, the driver is what causes the symbol to need the definition, so that patch is the first place we'd need this (unless some other drivers want it, which wouldn't be surprising).

I'm throwing it at the tester, it should show up on fixes soon.

Thanks!

Quoted 22 lines
Quoted 20 lines
---
 arch/riscv/kernel/setup.c | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/kernel/setup.c +1 -0
index f7c9a1caa83e..14888e5ea19a 100644
@@ -50,6 +50,7 @@ atomic_t hart_lottery __section(".sdata")
 #endif
 ;
 unsigned long boot_cpu_hartid;
+EXPORT_SYMBOL_GPL(boot_cpu_hartid);
 
 /*
  * Place kernel memory regions on the resource tree so that
Signature · 1 line
2.49.0
#3 lore raw
In reply to Klara Modin
This patch was applied to riscv/linux.git (fixes) by Palmer Dabbelt <[email protected]>:

Hello:

This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <[email protected]>:

Quoted 10 lines · On Tue, 17 Jun 2025 14:58:47 +0200 you wrote:

The mailbox controller driver for the Microchip Inter-processor Communication can be built as a module. It uses cpuid_to_hartid_map and commit 4783ce32b080 ("riscv: export __cpuid_to_hartid_map") enables that to work for SMP. However, cpuid_to_hartid_map uses boot_cpu_hartid on non-SMP kernels and this driver can be useful in such configurations[1].

Export boot_cpu_hartid so the driver can be built as a module on non-SMP kernels as well.

[...]

Here is the summary with links:
- riscv: export boot_cpu_hartid

    https://git.kernel.org/riscv/c/c5136add3f9b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html