Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions arch/risc-v/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,20 @@ config ARCH_RV_MMIO_BITS
default 32 if ARCH_RV32
default 64 if ARCH_RV64

config ARCH_RV_HARTID_BASE
int "Base hartid of this cluster"
default 0
---help---
Some RV chips have multiple cluster of harts with
globally numbered mhartids, like qemu-rv, mpfs and
jh7110 etc. Clusters with SMP ability can be managed
by NuttX. As NuttX expects cluster-local hart ids,
we can shift mhartid by this value to derive such
local ids. The SMP_NCPUS still defines number of
harts in the cluster. Note that we assume that global
ids for each cluster are continuous. Note that there
are chips like k230 which don't have global mhartid.

config ARCH_FAMILY
string
default "rv32" if ARCH_RV32
Expand Down
3 changes: 3 additions & 0 deletions arch/risc-v/src/common/riscv_macros.S
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@
REGLOAD \out, RISCV_PERCPU_HARTID(\out)
#else
csrr \out, CSR_MHARTID
# if CONFIG_ARCH_RV_HARTID_BASE > 0
add \out, \out, - CONFIG_ARCH_RV_HARTID_BASE
# endif
#endif
.endm

Expand Down