hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/powerpc/kernel/head_64.S
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * PowerPC version
34 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
....@@ -15,11 +16,6 @@
1516 * This file contains the entry point for the 64-bit kernel along
1617 * with some early initialization code common to all 64-bit powerpc
1718 * variants.
18
- *
19
- * This program is free software; you can redistribute it and/or
20
- * modify it under the terms of the GNU General Public License
21
- * as published by the Free Software Foundation; either version
22
- * 2 of the License, or (at your option) any later version.
2319 */
2420
2521 #include <linux/threads.h>
....@@ -186,7 +182,8 @@
186182 isync
187183 bctr
188184 #else
189
- BUG_OPCODE
185
+0: trap
186
+ EMIT_BUG_ENTRY 0b, __FILE__, __LINE__, 0
190187 #endif
191188 CLOSE_FIXED_SECTION(first_256B)
192189
....@@ -303,9 +300,6 @@
303300 rlwimi r3, r3, 30, 2, 30
304301 mtspr SPRN_PIR, r3
305302 1:
306
-#endif
307
-
308
-_GLOBAL(generic_secondary_thread_init)
309303 mr r24,r3
310304
311305 /* turn on 64-bit mode */
....@@ -315,12 +309,12 @@
315309 bl relative_toc
316310 tovirt(r2,r2)
317311
318
-#ifdef CONFIG_PPC_BOOK3E
319312 /* Book3E initialization */
320313 mr r3,r24
321314 bl book3e_secondary_thread_init
322
-#endif
323315 b generic_secondary_common_init
316
+
317
+#endif /* CONFIG_PPC_BOOK3E */
324318
325319 /*
326320 * On pSeries and most other platforms, secondary processors spin
....@@ -540,6 +534,7 @@
540534 b __after_prom_start
541535 #endif /* CONFIG_PPC_BOOK3E */
542536
537
+__REF
543538 __boot_from_prom:
544539 #ifdef CONFIG_PPC_OF_BOOT_TRAMPOLINE
545540 /* Save parameters */
....@@ -577,6 +572,7 @@
577572 /* We never return. We also hit that trap if trying to boot
578573 * from OF while CONFIG_PPC_OF_BOOT_TRAMPOLINE isn't selected */
579574 trap
575
+ .previous
580576
581577 __after_prom_start:
582578 #ifdef CONFIG_RELOCATABLE
....@@ -639,7 +635,7 @@
639635 sub r5,r5,r11
640636 #else
641637 /* just copy interrupts */
642
- LOAD_REG_IMMEDIATE(r5, FIXED_SYMBOL_ABS_ADDR(__end_interrupts))
638
+ LOAD_REG_IMMEDIATE_SYM(r5, r11, FIXED_SYMBOL_ABS_ADDR(__end_interrupts))
643639 #endif
644640 b 5f
645641 3:
....@@ -801,21 +797,19 @@
801797 /* Set thread priority to MEDIUM */
802798 HMT_MEDIUM
803799
804
- /* Initialize the kernel stack */
805
- LOAD_REG_ADDR(r3, current_set)
806
- sldi r28,r24,3 /* get current_set[cpu#] */
807
- ldx r14,r3,r28
808
- addi r14,r14,THREAD_SIZE-STACK_FRAME_OVERHEAD
809
- std r14,PACAKSAVE(r13)
810
-
811
- /* Do early setup for that CPU (SLB and hash table pointer) */
800
+ /*
801
+ * Do early setup for this CPU, in particular initialising the MMU so we
802
+ * can turn it on below. This is a call to C, which is OK, we're still
803
+ * running on the emergency stack.
804
+ */
812805 bl early_setup_secondary
813806
814807 /*
815
- * setup the new stack pointer, but *don't* use this until
816
- * translation is on.
808
+ * The primary has initialized our kernel stack for us in the paca, grab
809
+ * it and put it in r1. We must *not* use it until we turn on the MMU
810
+ * below, because it may not be inside the RMO.
817811 */
818
- mr r1, r14
812
+ ld r1, PACAKSAVE(r13)
819813
820814 /* Clear backchain so we get nice backtraces */
821815 li r7,0
....@@ -975,7 +969,6 @@
975969 RFI
976970 b . /* prevent speculative execution */
977971
978
- .previous
979972 /* This is where all platforms converge execution */
980973
981974 start_here_common:
....@@ -997,7 +990,9 @@
997990 bl start_kernel
998991
999992 /* Not reached */
1000
- BUG_OPCODE
993
+0: trap
994
+ EMIT_BUG_ENTRY 0b, __FILE__, __LINE__, 0
995
+ .previous
1001996
1002997 /*
1003998 * We put a few things here that have to be page-aligned.