[Skiboot] [PATCH] core/cpu: Fix invalid SMT indexes
Reza Arbab
arbab at linux.ibm.com
Wed Jan 15 02:24:06 AEDT 2025
On Mon, Nov 11, 2024 at 09:41:15AM +1000, Nicholas Piggin wrote:
>@@ -1205,8 +1207,27 @@ void init_cpu_max_pir(void)
> */
> pir = dt_prop_get_u32_def(cpu, "ibm,pir", server_no);
>
>- if (cpu_max_pir < pir + cpu_thread_count - 1)
>- cpu_max_pir = pir + cpu_thread_count - 1;
>+ p = dt_find_property(cpu, "ibm,ppc-interrupt-server#s");
>+ if (!p)
>+ continue;
>+ threads = p->len / 4;
>+ assert(threads > 0);
>+ if (threads > cpu_threads_max) {
>+ prlog(PR_WARNING, "CPU: Threads out of range for PIR 0x%04x"
>+ " threads=%d max=%d\n",
>+ pir, threads, cpu_threads_max);
>+ threads = cpu_threads_max;
>+ }
>+ if (!cpu_thread_count) {
>+ cpu_thread_count = threads;
>+ } else {
>+ /* Do not support asymmetric SMT topologies */
>+ assert(cpu_thread_count == threads);
>+ }
>+
I see, discover the number of threads at runtime, but cap to the
hardcoded hardware maximum, and disallow a mix of cpus with different
thread counts.
Exercised a bit with `qemu -smp threads=...`. LGTM!
Applied to master.
--
Reza Arbab
More information about the Skiboot
mailing list