Skip to content

Commit 4aa4ff9

Browse files
jannaumarcan
authored andcommitted
smp: Start CPU cores on the second t6002 die
Signed-off-by: Janne Grunau <[email protected]>
1 parent 8df40df commit 4aa4ff9

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/smp.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@
44
#include "adt.h"
55
#include "cpu_regs.h"
66
#include "malloc.h"
7+
#include "pmgr.h"
78
#include "string.h"
89
#include "types.h"
910
#include "utils.h"
1011

1112
#define CPU_START_OFF 0x54000
1213

14+
#define CPU_REG_CORE GENMASK(7, 0)
15+
#define CPU_REG_CLUSTER GENMASK(10, 8)
16+
#define CPU_REG_DIE GENMASK(14, 11)
17+
1318
struct spin_table {
1419
u64 mpidr;
1520
u64 flag;
@@ -69,7 +74,7 @@ void smp_secondary_entry(void)
6974
}
7075
}
7176

72-
static void smp_start_cpu(int index, int cluster, int core, u64 rvbar, u64 cpu_start_base)
77+
static void smp_start_cpu(int index, int die, int cluster, int core, u64 rvbar, u64 cpu_start_base)
7378
{
7479
int i;
7580

@@ -79,7 +84,7 @@ static void smp_start_cpu(int index, int cluster, int core, u64 rvbar, u64 cpu_s
7984
if (spin_table[index].flag)
8085
return;
8186

82-
printf("Starting CPU %d (%d:%d)... ", index, cluster, core);
87+
printf("Starting CPU %d (%d:%d:%d)... ", index, die, cluster, core);
8388

8489
memset(&spin_table[index], 0, sizeof(struct spin_table));
8590

@@ -91,6 +96,8 @@ static void smp_start_cpu(int index, int cluster, int core, u64 rvbar, u64 cpu_s
9196

9297
write64(rvbar, (u64)_vectors_start);
9398

99+
cpu_start_base += die * PMGR_DIE_OFFSET;
100+
94101
// Some kind of system level startup/status bit
95102
// Without this, IRQs don't work
96103
write32(cpu_start_base + 0x4, 1 << (4 * cluster + core));
@@ -166,7 +173,11 @@ void smp_start_secondaries(void)
166173
if (ADT_GETPROP_ARRAY(adt, node, "cpu-impl-reg", cpu_impl_reg) < 0)
167174
continue;
168175

169-
smp_start_cpu(i, reg >> 8, reg & 0xff, cpu_impl_reg[0], pmgr_reg + CPU_START_OFF);
176+
u8 core = FIELD_GET(CPU_REG_CORE, reg);
177+
u8 cluster = FIELD_GET(CPU_REG_CLUSTER, reg);
178+
u8 die = FIELD_GET(CPU_REG_DIE, reg);
179+
180+
smp_start_cpu(i, die, cluster, core, cpu_impl_reg[0], pmgr_reg + CPU_START_OFF);
170181
}
171182

172183
spin_table[0].mpidr = mrs(MPIDR_EL1) & 0xFFFFFF;

0 commit comments

Comments
 (0)