smp: Write _vectors_start into boot CPU rvbar where possible

On A7-A11 we have a ROM exploit and we can keep CPU0 RVBAR unlocked.

Signed-off-by: Nick Chan <towinchenmi@gmail.com>
This commit is contained in:
Nick Chan 2024-08-29 02:13:24 +08:00 committed by Hector Martin
parent 3b7fd2ce5e
commit dadc48ed10

View file

@ -319,9 +319,6 @@ void smp_start_secondaries(void)
}
for (int i = 0; i < MAX_CPUS; i++) {
if (i == boot_cpu_idx)
continue;
int cpu_node = cpu_nodes[i];
if (!cpu_node)
@ -342,6 +339,18 @@ void smp_start_secondaries(void)
memcpy(cpu_impl_reg, &regs[index], 16);
}
if (i == boot_cpu_idx) {
// Check if already locked
if (read64(cpu_impl_reg[0]) & 1)
continue;
// Unlocked, write _vectors_start into boot CPU's rvbar
write64(cpu_impl_reg[0], (u64)_vectors_start);
sysop("dmb sy");
continue;
}
u8 core = FIELD_GET(CPU_REG_CORE, reg);
u8 cluster = FIELD_GET(CPU_REG_CLUSTER, reg);
u8 die = FIELD_GET(CPU_REG_DIE, reg);