smp: Handle boot CPU index != 0

Signed-off-by: Janne Grunau <j@jannau.net>
This commit is contained in:
Janne Grunau 2024-10-25 17:29:19 +02:00 committed by Hector Martin
parent 293e122845
commit a603b86e6b
2 changed files with 8 additions and 4 deletions

View file

@ -522,7 +522,7 @@ void hv_exc_fiq(struct exc_info *ctx)
int interruptible_cpu = hv_pinned_cpu;
if (interruptible_cpu == -1)
interruptible_cpu = 0;
interruptible_cpu = boot_cpu_idx;
if (smp_id() != interruptible_cpu && !(mrs(ISR_EL1) & 0x40) && hv_want_cpu == -1) {
// Non-interruptible CPU and it was just a timer tick (or spurious), so just update FIQs

View file

@ -319,6 +319,10 @@ void smp_start_secondaries(void)
if (strcmp(state, "running") == 0) {
boot_cpu_idx = i;
boot_cpu_mpidr = mrs(MPIDR_EL1);
if (in_el2())
msr(TPIDR_EL2, boot_cpu_idx);
else
msr(TPIDR_EL1, boot_cpu_idx);
break;
}
}
@ -330,6 +334,8 @@ void smp_start_secondaries(void)
return;
}
spin_table[boot_cpu_idx].mpidr = mrs(MPIDR_EL1) & 0xFFFFFF;
for (int i = 0; i < MAX_CPUS; i++) {
int cpu_node = cpu_nodes[i];
@ -369,8 +375,6 @@ void smp_start_secondaries(void)
smp_start_cpu(i, die, cluster, core, cpu_impl_reg[0], pmgr_reg + cpu_start_off);
}
spin_table[boot_cpu_idx].mpidr = mrs(MPIDR_EL1) & 0xFFFFFF;
}
void smp_stop_secondaries(bool deep_sleep)
@ -432,7 +436,7 @@ void smp_call4(int cpu, void *func, u64 arg0, u64 arg1, u64 arg2, u64 arg3)
struct spin_table *target = &spin_table[cpu];
if (cpu == 0)
if (cpu == boot_cpu_idx)
return;
u64 flag = target->flag;