Skip to content

Commit

Permalink
powerpc/smp: Lookup avail once per device tree node
Browse files Browse the repository at this point in the history
The of_device_is_available() check only needs to be done once per device
node, there's no need to repeat it for each thread. Move it out of the
loop.

Signed-off-by: Michael Ellerman <[email protected]>
Link: https://msgid.link/[email protected]
  • Loading branch information
mpe committed Feb 14, 2024
1 parent 777f81f commit dca7960
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions arch/powerpc/kernel/setup-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,17 +468,16 @@ void __init smp_setup_cpu_maps(void)

nthreads = len / sizeof(int);

bool avail = of_device_is_available(dn);
if (!avail)
avail = !of_property_match_string(dn,
"enable-method", "spin-table");

for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) {
bool avail;

DBG(" thread %d -> cpu %d (hard id %d)\n",
j, cpu, be32_to_cpu(intserv[j]));

avail = of_device_is_available(dn);
if (!avail)
avail = !of_property_match_string(dn,
"enable-method", "spin-table");

set_cpu_present(cpu, avail);
set_cpu_possible(cpu, true);
cpu_to_phys_id[cpu] = be32_to_cpu(intserv[j]);
Expand Down

0 comments on commit dca7960

Please sign in to comment.