RISC-V: Add RISC-V specific arch_match_cpu_phys_id
authorAtish Patra <atish.patra@wdc.com>
Wed, 24 Apr 2019 21:47:58 +0000 (14:47 -0700)
committerPalmer Dabbelt <palmer@sifive.com>
Tue, 30 Apr 2019 16:47:44 +0000 (09:47 -0700)
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.

Fix the instances where logical cpuid is expected as an argument in
of_get_cpu_node.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
arch/riscv/kernel/cpu.c
arch/riscv/kernel/smp.c

index cf2fca12414a4501a35037ffa020fc6a46e47277..c8d2a322309949d2079662a955b24725ef95344d 100644 (file)
@@ -136,8 +136,7 @@ static void c_stop(struct seq_file *m, void *v)
 static int c_show(struct seq_file *m, void *v)
 {
        unsigned long cpu_id = (unsigned long)v - 1;
-       struct device_node *node = of_get_cpu_node(cpuid_to_hartid_map(cpu_id),
-                                                  NULL);
+       struct device_node *node = of_get_cpu_node(cpu_id, NULL);
        const char *compat, *isa, *mmu;
 
        seq_printf(m, "processor\t: %lu\n", cpu_id);
index 0c41d07ec281e4a6c94e7a53b975c66ac2c44e49..89251f8ab7545d564c507a5925654adc1448dcff 100644 (file)
@@ -70,6 +70,12 @@ 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)
 {