mirror of https://github.com/OpenIPC/firmware.git
69 lines
2.0 KiB
Diff
69 lines
2.0 KiB
Diff
diff -drupN a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
|
|
--- a/arch/arm64/kernel/smp.c 2018-08-06 17:23:04.000000000 +0300
|
|
+++ b/arch/arm64/kernel/smp.c 2022-06-12 05:28:14.000000000 +0300
|
|
@@ -58,6 +58,9 @@
|
|
#define CREATE_TRACE_POINTS
|
|
#include <trace/events/ipi.h>
|
|
|
|
+DEFINE_PER_CPU_READ_MOSTLY(int, cpu_number);
|
|
+EXPORT_PER_CPU_SYMBOL(cpu_number);
|
|
+
|
|
/*
|
|
* as from 2.5, kernels no longer have an init_tasks structure
|
|
* so we need some other way of telling a new secondary core
|
|
@@ -146,6 +149,7 @@ int __cpu_up(unsigned int cpu, struct ta
|
|
* We need to tell the secondary core where to find its stack and the
|
|
* page tables.
|
|
*/
|
|
+ secondary_data.task = idle;
|
|
secondary_data.stack = task_stack_page(idle) + THREAD_START_SP;
|
|
update_cpu_boot_status(CPU_MMU_OFF);
|
|
__flush_dcache_area(&secondary_data, sizeof(secondary_data));
|
|
@@ -170,6 +174,7 @@ int __cpu_up(unsigned int cpu, struct ta
|
|
pr_err("CPU%u: failed to boot: %d\n", cpu, ret);
|
|
}
|
|
|
|
+ secondary_data.task = NULL;
|
|
secondary_data.stack = NULL;
|
|
status = READ_ONCE(secondary_data.status);
|
|
if (ret && status) {
|
|
@@ -208,7 +213,10 @@ int __cpu_up(unsigned int cpu, struct ta
|
|
asmlinkage void secondary_start_kernel(void)
|
|
{
|
|
struct mm_struct *mm = &init_mm;
|
|
- unsigned int cpu = smp_processor_id();
|
|
+ unsigned int cpu;
|
|
+
|
|
+ cpu = task_cpu(current);
|
|
+ set_my_cpu_offset(per_cpu_offset(cpu));
|
|
|
|
/*
|
|
* All kernel threads share the same mm context; grab a
|
|
@@ -217,8 +225,6 @@ asmlinkage void secondary_start_kernel(v
|
|
atomic_inc(&mm->mm_count);
|
|
current->active_mm = mm;
|
|
|
|
- set_my_cpu_offset(per_cpu_offset(smp_processor_id()));
|
|
-
|
|
/*
|
|
* TTBR0 is only used for the identity mapping at this stage. Make it
|
|
* point to zero page to avoid speculatively fetching new entries.
|
|
@@ -718,6 +724,8 @@ void __init smp_prepare_cpus(unsigned in
|
|
*/
|
|
for_each_possible_cpu(cpu) {
|
|
|
|
+ per_cpu(cpu_number, cpu) = cpu;
|
|
+
|
|
if (cpu == smp_processor_id())
|
|
continue;
|
|
|
|
@@ -815,6 +823,8 @@ static void ipi_cpu_stop(unsigned int cp
|
|
|
|
local_irq_disable();
|
|
|
|
+ flush_cache_all();
|
|
+
|
|
while (1)
|
|
cpu_relax();
|
|
}
|