RISC-V: Add RISC-V specific arch_match_cpu_phys_id

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>
This commit is contained in:
Atish Patra 2019-04-24 14:47:58 -07:00 коммит произвёл Palmer Dabbelt
Родитель fd7f744cae
Коммит 70114560b2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: EF4CA1502CCBAB41
2 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -136,8 +136,7 @@ static void c_stop(struct seq_file *m, void *v)
static int c_show(struct seq_file *m, void *v) static int c_show(struct seq_file *m, void *v)
{ {
unsigned long cpu_id = (unsigned long)v - 1; unsigned long cpu_id = (unsigned long)v - 1;
struct device_node *node = of_get_cpu_node(cpuid_to_hartid_map(cpu_id), struct device_node *node = of_get_cpu_node(cpu_id, NULL);
NULL);
const char *compat, *isa, *mmu; const char *compat, *isa, *mmu;
seq_printf(m, "processor\t: %lu\n", cpu_id); seq_printf(m, "processor\t: %lu\n", cpu_id);

Просмотреть файл

@ -70,6 +70,12 @@ void riscv_cpuid_to_hartid_mask(const struct cpumask *in, struct cpumask *out)
for_each_cpu(cpu, in) for_each_cpu(cpu, in)
cpumask_set_cpu(cpuid_to_hartid_map(cpu), out); 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 */ /* Unsupported */
int setup_profiling_timer(unsigned int multiplier) int setup_profiling_timer(unsigned int multiplier)
{ {