MIPS: reserve exception vector space ONLY ONCE
authorHuang Pei <huangpei@loongson.cn>
Tue, 23 Jan 2024 01:47:57 +0000 (09:47 +0800)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Fri, 26 Jan 2024 09:33:34 +0000 (10:33 +0100)
"cpu_probe" is called both by BP and APs, but reserving exception vector
(like 0x0-0x1000) called by "cpu_probe" need once and calling on APs is
too late since memblock is unavailable at that time.

So, reserve exception vector ONLY by BP.

Suggested-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Huang Pei <huangpei@loongson.cn>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/kernel/traps.c

index dec6878b35f627089226618ff4dc4628855c8eb4..a1c1cb5de91321468f338d41a01df2f40efaf293 100644 (file)
@@ -2007,7 +2007,13 @@ unsigned long vi_handlers[64];
 
 void reserve_exception_space(phys_addr_t addr, unsigned long size)
 {
-       memblock_reserve(addr, size);
+       /*
+        * reserve exception space on CPUs other than CPU0
+        * is too late, since memblock is unavailable when APs
+        * up
+        */
+       if (smp_processor_id() == 0)
+               memblock_reserve(addr, size);
 }
 
 void __init *set_except_vector(int n, void *addr)