Skip to content

Commit d8cd1b4

Browse files
committed
smp: Factor preparation for secondary CPU start out
It will be used to switch to CPU 0 on M3 and later to avoid confusion when Linux is not started with CPU 0. Signed-off-by: Janne Grunau <[email protected]>
1 parent 1ab3dee commit d8cd1b4

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

src/smp.c

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,21 +108,9 @@ void smp_secondary_prep_el3(void)
108108
return;
109109
}
110110

111-
static void smp_start_cpu(int index, int die, int cluster, int core, u64 impl, u64 cpu_start_base)
112-
{
113-
int i;
114-
115-
if (index >= MAX_CPUS)
116-
return;
117-
118-
if (has_el3() && index >= MAX_EL3_CPUS)
119-
return;
120-
121-
if (spin_table[index].flag)
122-
return;
123-
124-
printf("Starting CPU %d (%d:%d:%d)... ", index, die, cluster, core);
125111

112+
static void smp_prepare_cpu(int index)
113+
{
126114
memset(&spin_table[index], 0, sizeof(struct spin_table));
127115

128116
target_cpu = index;
@@ -139,6 +127,24 @@ static void smp_start_cpu(int index, int die, int cluster, int core, u64 impl, u
139127
dc_civac_range(&_reset_stack, sizeof(void *));
140128

141129
sysop("dsb sy");
130+
}
131+
132+
static void smp_start_cpu(int index, int die, int cluster, int core, u64 impl, u64 cpu_start_base)
133+
{
134+
int i;
135+
136+
if (index >= MAX_CPUS)
137+
return;
138+
139+
if (has_el3() && index >= MAX_EL3_CPUS)
140+
return;
141+
142+
if (spin_table[index].flag)
143+
return;
144+
145+
printf("Starting CPU %d (%d:%d:%d)... ", index, die, cluster, core);
146+
147+
smp_prepare_cpu(index);
142148

143149
write64(impl, (u64)_vectors_start);
144150

0 commit comments

Comments
 (0)