Skip to content

Commit 03f11f0

Browse files
atishp04paul-walmsley-sifive
authored andcommitted
RISC-V: Parse cpu topology during boot.
Currently, there are no topology defined for RISC-V. Parse the cpu-map node from device tree and setup the cpu topology. CPU topology after applying the patch. $cat /sys/devices/system/cpu/cpu2/topology/core_siblings_list 0-3 $cat /sys/devices/system/cpu/cpu3/topology/core_siblings_list 0-3 $cat /sys/devices/system/cpu/cpu3/topology/physical_package_id 0 $cat /sys/devices/system/cpu/cpu3/topology/core_id 3 Signed-off-by: Atish Patra <atish.patra@wdc.com> Acked-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
1 parent ca74b31 commit 03f11f0

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

arch/riscv/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ config RISCV
4848
select PCI_MSI if PCI
4949
select RISCV_TIMER
5050
select GENERIC_IRQ_MULTI_HANDLER
51+
select GENERIC_ARCH_TOPOLOGY if SMP
5152
select ARCH_HAS_PTE_SPECIAL
5253
select ARCH_HAS_MMIOWB
5354
select HAVE_EBPF_JIT if 64BIT

arch/riscv/kernel/smpboot.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Copyright (C) 2017 SiFive
99
*/
1010

11+
#include <linux/arch_topology.h>
1112
#include <linux/module.h>
1213
#include <linux/init.h>
1314
#include <linux/kernel.h>
@@ -35,6 +36,7 @@ static DECLARE_COMPLETION(cpu_running);
3536

3637
void __init smp_prepare_boot_cpu(void)
3738
{
39+
init_cpu_topology();
3840
}
3941

4042
void __init smp_prepare_cpus(unsigned int max_cpus)
@@ -138,6 +140,7 @@ asmlinkage void __init smp_callin(void)
138140

139141
trap_init();
140142
notify_cpu_starting(smp_processor_id());
143+
update_siblings_masks(smp_processor_id());
141144
set_cpu_online(smp_processor_id(), 1);
142145
/*
143146
* Remote TLB flushes are ignored while the CPU is offline, so emit

0 commit comments

Comments
 (0)