Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use device tree instead of max_cpus to determine present cpus #8

Closed
Closed
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
18 changes: 15 additions & 3 deletions arch/openrisc/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/cpu.h>
#include <linux/sched.h>
#include <linux/irq.h>
#include <linux/of.h>
#include <asm/cpuinfo.h>
#include <asm/mmu_context.h>
#include <asm/tlbflush.h>
Expand Down Expand Up @@ -67,14 +68,25 @@ void __init smp_init_cpus(void)

void __init smp_prepare_cpus(unsigned int max_cpus)
{
int i;
u32 cpu_id;
struct device_node *cpu, *cpus;

/*
* Initialise the present map, which describes the set of CPUs
* actually populated at the present time.
*/
for (i = 0; i < max_cpus; i++)
set_cpu_present(i, true);
cpus = of_find_node_by_path("/cpus");
for_each_child_of_node(cpus, cpu) {
if (of_property_read_u32(cpu, "reg", &cpu_id)) {
pr_warn("%s missing reg property", cpu->full_name);
continue;
}

if (cpu_id >= max_cpus)
continue;

set_cpu_present(cpu_id, true);
}
}

void __init smp_cpus_done(unsigned int max_cpus)
Expand Down