diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2024-02-14 14:14:04 +0100 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2024-02-14 14:14:04 +0100 |
commit | dca79603fbc592ec7ea8bd7ba274052d3984e882 (patch) | |
tree | 3573fae16216f3a93079dee1919fd65409164784 /arch/powerpc/kernel/setup-common.c | |
parent | powerpc/smp: Increase nr_cpu_ids to include the boot CPU (diff) | |
download | linux-dca79603fbc592ec7ea8bd7ba274052d3984e882.tar.xz linux-dca79603fbc592ec7ea8bd7ba274052d3984e882.zip |
powerpc/smp: Lookup avail once per device tree node
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 <mpe@ellerman.id.au>
Link: https://msgid.link/20231229120107.2281153-3-mpe@ellerman.id.au
Diffstat (limited to 'arch/powerpc/kernel/setup-common.c')
-rw-r--r-- | arch/powerpc/kernel/setup-common.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 9b142b9d5187..375bade1cf09 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c @@ -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]); |