diff mbox series

[1/2] MIPS: reserve exception vector space ONLY ONCE

Message ID 20240118123929.369939-2-huangpei@loongson.cn (mailing list archive)
State Superseded
Headers show
Series [1/2] MIPS: reserve exception vector space ONLY ONCE | expand

Commit Message

Huang Pei Jan. 18, 2024, 12:39 p.m. UTC
cpu_probe is called by BP an APs, but reserving exception vector
0x0-0x1000 need once. Call it on cpu 0.

Signed-off-by: Huang Pei <huangpei@loongson.cn>
---
 arch/mips/kernel/cpu-probe.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index b406d8bfb15a..6939d0de2a03 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -1581,7 +1581,9 @@  static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
 			__cpu_name[cpu] = "Broadcom BMIPS4380";
 			set_elf_platform(cpu, "bmips4380");
 			c->options |= MIPS_CPU_RIXI;
-			reserve_exception_space(0x400, VECTORSPACING * 64);
+			if (cpu == 0) {
+				reserve_exception_space(0x400, VECTORSPACING * 64);
+			}
 		} else {
 			c->cputype = CPU_BMIPS4350;
 			__cpu_name[cpu] = "Broadcom BMIPS4350";
@@ -1598,7 +1600,9 @@  static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
 			__cpu_name[cpu] = "Broadcom BMIPS5000";
 		set_elf_platform(cpu, "bmips5000");
 		c->options |= MIPS_CPU_ULRI | MIPS_CPU_RIXI;
-		reserve_exception_space(0x1000, VECTORSPACING * 64);
+		if (cpu == 0) {
+			reserve_exception_space(0x1000, VECTORSPACING * 64);
+		}
 		break;
 	}
 }
@@ -1992,12 +1996,13 @@  void cpu_probe(void)
 	 */
 	loongson3_cpucfg_synthesize_data(c);
 
+	if (cpu == 0) {
 #ifdef CONFIG_64BIT
-	if (cpu == 0)
 		__ua_limit = ~((1ull << cpu_vmbits) - 1);
 #endif
+		reserve_exception_space(0, 0x1000);
+	}
 
-	reserve_exception_space(0, 0x1000);
 }
 
 void cpu_report(void)