diff mbox series

[v2,1/4] RISC-V: Add RISC-V specific arch_match_cpu_phys_id

Message ID 20190410230443.15729-2-atish.patra@wdc.com (mailing list archive)
State New, archived
Headers show
Series Miscellaneous kernel command line fixes | expand

Commit Message

Atish Patra April 10, 2019, 11:04 p.m. UTC
OF/DT core has a hook for architecture specific logical cpuid to hartid
mapping. By implementing this, we can pass the logical cpu id to cpu
node parsing functions.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
---
 arch/riscv/kernel/smp.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Christoph Hellwig April 11, 2019, 6:58 a.m. UTC | #1
On Wed, Apr 10, 2019 at 04:04:40PM -0700, Atish Patra wrote:
> OF/DT core has a hook for architecture specific logical cpuid to hartid
> mapping. By implementing this, we can pass the logical cpu id to cpu
> node parsing functions.

But that also means we must pass it that way.  So as-is this would
break existing setups, wouldn't it?
diff mbox series

Patch

diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c
index 0c41d07ec281..94db72662f60 100644
--- a/arch/riscv/kernel/smp.c
+++ b/arch/riscv/kernel/smp.c
@@ -70,6 +70,11 @@  void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *out)
 	for_each_cpu(cpu, in)
 		cpumask_set_cpu(cpuid_to_hartid_map(cpu), out);
 }
+
+bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
+{
+	return phys_id == cpuid_to_hartid_map(cpu);
+}
 /* Unsupported */
 int setup_profiling_timer(unsigned int multiplier)
 {