aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-04-27 17:27:37 -0400
committerDavid S. Miller <davem@davemloft.net>2016-04-27 17:27:37 -0400
commit49fa5230462f9f2c4e97c81356473a6bdf06c422 (patch)
treebd144e692b2db745318d3fd11c0e53217787766d
parentc5b8b5beee1e2aadef0409dba555b7085d57910d (diff)
sparc64: Fix bootup regressions on some Kconfig combinations.
The system call tracing bug fix mentioned in the Fixes tag below increased the amount of assembler code in the sequence of assembler files included by head_64.S This caused to total set of code to exceed 0x4000 bytes in size, which overflows the expression in head_64.S that works to place swapper_tsb at address 0x408000. When this is violated, the TSB is not properly aligned, and also the trap table is not aligned properly either. All of this together results in failed boots. So, do two things: 1) Simplify some code by using ba,a instead of ba/nop to get those bytes back. 2) Add a linker script assertion to make sure that if this happens again the build will fail. Fixes: 1a40b95374f6 ("sparc: Fix system call tracing register handling.") Reported-by: Meelis Roos <mroos@linux.ee> Reported-by: Joerg Abraham <joerg.abraham@nokia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/sparc/kernel/cherrs.S14
-rw-r--r--arch/sparc/kernel/fpu_traps.S11
-rw-r--r--arch/sparc/kernel/head_64.S24
-rw-r--r--arch/sparc/kernel/misctrap.S12
-rw-r--r--arch/sparc/kernel/spiterrs.S18
-rw-r--r--arch/sparc/kernel/utrap.S3
-rw-r--r--arch/sparc/kernel/vmlinux.lds.S4
-rw-r--r--arch/sparc/kernel/winfixup.S3
8 files changed, 34 insertions, 55 deletions
diff --git a/arch/sparc/kernel/cherrs.S b/arch/sparc/kernel/cherrs.S
index 4ee1ad420862..655628def68e 100644
--- a/arch/sparc/kernel/cherrs.S
+++ b/arch/sparc/kernel/cherrs.S
@@ -214,8 +214,7 @@ do_dcpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */
214 subcc %g1, %g2, %g1 ! Next cacheline 214 subcc %g1, %g2, %g1 ! Next cacheline
215 bge,pt %icc, 1b 215 bge,pt %icc, 1b
216 nop 216 nop
217 ba,pt %xcc, dcpe_icpe_tl1_common 217 ba,a,pt %xcc, dcpe_icpe_tl1_common
218 nop
219 218
220do_dcpe_tl1_fatal: 219do_dcpe_tl1_fatal:
221 sethi %hi(1f), %g7 220 sethi %hi(1f), %g7
@@ -224,8 +223,7 @@ do_dcpe_tl1_fatal:
224 mov 0x2, %o0 223 mov 0x2, %o0
225 call cheetah_plus_parity_error 224 call cheetah_plus_parity_error
226 add %sp, PTREGS_OFF, %o1 225 add %sp, PTREGS_OFF, %o1
227 ba,pt %xcc, rtrap 226 ba,a,pt %xcc, rtrap
228 nop
229 .size do_dcpe_tl1,.-do_dcpe_tl1 227 .size do_dcpe_tl1,.-do_dcpe_tl1
230 228
231 .globl do_icpe_tl1 229 .globl do_icpe_tl1
@@ -259,8 +257,7 @@ do_icpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */
259 subcc %g1, %g2, %g1 257 subcc %g1, %g2, %g1
260 bge,pt %icc, 1b 258 bge,pt %icc, 1b
261 nop 259 nop
262 ba,pt %xcc, dcpe_icpe_tl1_common 260 ba,a,pt %xcc, dcpe_icpe_tl1_common
263 nop
264 261
265do_icpe_tl1_fatal: 262do_icpe_tl1_fatal:
266 sethi %hi(1f), %g7 263 sethi %hi(1f), %g7
@@ -269,8 +266,7 @@ do_icpe_tl1_fatal:
269 mov 0x3, %o0 266 mov 0x3, %o0
270 call cheetah_plus_parity_error 267 call cheetah_plus_parity_error
271 add %sp, PTREGS_OFF, %o1 268 add %sp, PTREGS_OFF, %o1
272 ba,pt %xcc, rtrap 269 ba,a,pt %xcc, rtrap
273 nop
274 .size do_icpe_tl1,.-do_icpe_tl1 270 .size do_icpe_tl1,.-do_icpe_tl1
275 271
276 .type dcpe_icpe_tl1_common,#function 272 .type dcpe_icpe_tl1_common,#function
@@ -456,7 +452,7 @@ __cheetah_log_error:
456 cmp %g2, 0x63 452 cmp %g2, 0x63
457 be c_cee 453 be c_cee
458 nop 454 nop
459 ba,pt %xcc, c_deferred 455 ba,a,pt %xcc, c_deferred
460 .size __cheetah_log_error,.-__cheetah_log_error 456 .size __cheetah_log_error,.-__cheetah_log_error
461 457
462 /* Cheetah FECC trap handling, we get here from tl{0,1}_fecc 458 /* Cheetah FECC trap handling, we get here from tl{0,1}_fecc
diff --git a/arch/sparc/kernel/fpu_traps.S b/arch/sparc/kernel/fpu_traps.S
index a6864826a4bd..336d2750fe78 100644
--- a/arch/sparc/kernel/fpu_traps.S
+++ b/arch/sparc/kernel/fpu_traps.S
@@ -100,8 +100,8 @@ do_fpdis:
100 fmuld %f0, %f2, %f26 100 fmuld %f0, %f2, %f26
101 faddd %f0, %f2, %f28 101 faddd %f0, %f2, %f28
102 fmuld %f0, %f2, %f30 102 fmuld %f0, %f2, %f30
103 b,pt %xcc, fpdis_exit 103 ba,a,pt %xcc, fpdis_exit
104 nop 104
1052: andcc %g5, FPRS_DU, %g0 1052: andcc %g5, FPRS_DU, %g0
106 bne,pt %icc, 3f 106 bne,pt %icc, 3f
107 fzero %f32 107 fzero %f32
@@ -144,8 +144,8 @@ do_fpdis:
144 fmuld %f32, %f34, %f58 144 fmuld %f32, %f34, %f58
145 faddd %f32, %f34, %f60 145 faddd %f32, %f34, %f60
146 fmuld %f32, %f34, %f62 146 fmuld %f32, %f34, %f62
147 ba,pt %xcc, fpdis_exit 147 ba,a,pt %xcc, fpdis_exit
148 nop 148
1493: mov SECONDARY_CONTEXT, %g3 1493: mov SECONDARY_CONTEXT, %g3
150 add %g6, TI_FPREGS, %g1 150 add %g6, TI_FPREGS, %g1
151 151
@@ -197,8 +197,7 @@ fpdis_exit2:
197fp_other_bounce: 197fp_other_bounce:
198 call do_fpother 198 call do_fpother
199 add %sp, PTREGS_OFF, %o0 199 add %sp, PTREGS_OFF, %o0
200 ba,pt %xcc, rtrap 200 ba,a,pt %xcc, rtrap
201 nop
202 .size fp_other_bounce,.-fp_other_bounce 201 .size fp_other_bounce,.-fp_other_bounce
203 202
204 .align 32 203 .align 32
diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
index 5b4f5c363674..a076b4249e62 100644
--- a/arch/sparc/kernel/head_64.S
+++ b/arch/sparc/kernel/head_64.S
@@ -466,9 +466,8 @@ sun4v_chip_type:
466 subcc %g3, 1, %g3 466 subcc %g3, 1, %g3
467 bne,pt %xcc, 41b 467 bne,pt %xcc, 41b
468 add %g1, 1, %g1 468 add %g1, 1, %g1
469 mov SUN4V_CHIP_SPARC64X, %g4
470 ba,pt %xcc, 5f 469 ba,pt %xcc, 5f
471 nop 470 mov SUN4V_CHIP_SPARC64X, %g4
472 471
47349: 47249:
474 mov SUN4V_CHIP_UNKNOWN, %g4 473 mov SUN4V_CHIP_UNKNOWN, %g4
@@ -553,8 +552,7 @@ sun4u_init:
553 stxa %g0, [%g7] ASI_DMMU 552 stxa %g0, [%g7] ASI_DMMU
554 membar #Sync 553 membar #Sync
555 554
556 ba,pt %xcc, sun4u_continue 555 ba,a,pt %xcc, sun4u_continue
557 nop
558 556
559sun4v_init: 557sun4v_init:
560 /* Set ctx 0 */ 558 /* Set ctx 0 */
@@ -565,14 +563,12 @@ sun4v_init:
565 mov SECONDARY_CONTEXT, %g7 563 mov SECONDARY_CONTEXT, %g7
566 stxa %g0, [%g7] ASI_MMU 564 stxa %g0, [%g7] ASI_MMU
567 membar #Sync 565 membar #Sync
568 ba,pt %xcc, niagara_tlb_fixup 566 ba,a,pt %xcc, niagara_tlb_fixup
569 nop
570 567
571sun4u_continue: 568sun4u_continue:
572 BRANCH_IF_ANY_CHEETAH(g1, g7, cheetah_tlb_fixup) 569 BRANCH_IF_ANY_CHEETAH(g1, g7, cheetah_tlb_fixup)
573 570
574 ba,pt %xcc, spitfire_tlb_fixup 571 ba,a,pt %xcc, spitfire_tlb_fixup
575 nop
576 572
577niagara_tlb_fixup: 573niagara_tlb_fixup:
578 mov 3, %g2 /* Set TLB type to hypervisor. */ 574 mov 3, %g2 /* Set TLB type to hypervisor. */
@@ -647,8 +643,7 @@ niagara_patch:
647 call hypervisor_patch_cachetlbops 643 call hypervisor_patch_cachetlbops
648 nop 644 nop
649 645
650 ba,pt %xcc, tlb_fixup_done 646 ba,a,pt %xcc, tlb_fixup_done
651 nop
652 647
653cheetah_tlb_fixup: 648cheetah_tlb_fixup:
654 mov 2, %g2 /* Set TLB type to cheetah+. */ 649 mov 2, %g2 /* Set TLB type to cheetah+. */
@@ -667,8 +662,7 @@ cheetah_tlb_fixup:
667 call cheetah_patch_cachetlbops 662 call cheetah_patch_cachetlbops
668 nop 663 nop
669 664
670 ba,pt %xcc, tlb_fixup_done 665 ba,a,pt %xcc, tlb_fixup_done
671 nop
672 666
673spitfire_tlb_fixup: 667spitfire_tlb_fixup:
674 /* Set TLB type to spitfire. */ 668 /* Set TLB type to spitfire. */
@@ -782,8 +776,7 @@ setup_trap_table:
782 call %o1 776 call %o1
783 add %sp, (2047 + 128), %o0 777 add %sp, (2047 + 128), %o0
784 778
785 ba,pt %xcc, 2f 779 ba,a,pt %xcc, 2f
786 nop
787 780
7881: sethi %hi(sparc64_ttable_tl0), %o0 7811: sethi %hi(sparc64_ttable_tl0), %o0
789 set prom_set_trap_table_name, %g2 782 set prom_set_trap_table_name, %g2
@@ -822,8 +815,7 @@ setup_trap_table:
822 815
823 BRANCH_IF_ANY_CHEETAH(o2, o3, 1f) 816 BRANCH_IF_ANY_CHEETAH(o2, o3, 1f)
824 817
825 ba,pt %xcc, 2f 818 ba,a,pt %xcc, 2f
826 nop
827 819
828 /* Disable STICK_INT interrupts. */ 820 /* Disable STICK_INT interrupts. */
8291: 8211:
diff --git a/arch/sparc/kernel/misctrap.S b/arch/sparc/kernel/misctrap.S
index 753b4f031bfb..34b4933900bf 100644
--- a/arch/sparc/kernel/misctrap.S
+++ b/arch/sparc/kernel/misctrap.S
@@ -18,8 +18,7 @@ __do_privact:
18109: or %g7, %lo(109b), %g7 18109: or %g7, %lo(109b), %g7
19 call do_privact 19 call do_privact
20 add %sp, PTREGS_OFF, %o0 20 add %sp, PTREGS_OFF, %o0
21 ba,pt %xcc, rtrap 21 ba,a,pt %xcc, rtrap
22 nop
23 .size __do_privact,.-__do_privact 22 .size __do_privact,.-__do_privact
24 23
25 .type do_mna,#function 24 .type do_mna,#function
@@ -46,8 +45,7 @@ do_mna:
46 mov %l5, %o2 45 mov %l5, %o2
47 call mem_address_unaligned 46 call mem_address_unaligned
48 add %sp, PTREGS_OFF, %o0 47 add %sp, PTREGS_OFF, %o0
49 ba,pt %xcc, rtrap 48 ba,a,pt %xcc, rtrap
50 nop
51 .size do_mna,.-do_mna 49 .size do_mna,.-do_mna
52 50
53 .type do_lddfmna,#function 51 .type do_lddfmna,#function
@@ -65,8 +63,7 @@ do_lddfmna:
65 mov %l5, %o2 63 mov %l5, %o2
66 call handle_lddfmna 64 call handle_lddfmna
67 add %sp, PTREGS_OFF, %o0 65 add %sp, PTREGS_OFF, %o0
68 ba,pt %xcc, rtrap 66 ba,a,pt %xcc, rtrap
69 nop
70 .size do_lddfmna,.-do_lddfmna 67 .size do_lddfmna,.-do_lddfmna
71 68
72 .type do_stdfmna,#function 69 .type do_stdfmna,#function
@@ -84,8 +81,7 @@ do_stdfmna:
84 mov %l5, %o2 81 mov %l5, %o2
85 call handle_stdfmna 82 call handle_stdfmna
86 add %sp, PTREGS_OFF, %o0 83 add %sp, PTREGS_OFF, %o0
87 ba,pt %xcc, rtrap 84 ba,a,pt %xcc, rtrap
88 nop
89 .size do_stdfmna,.-do_stdfmna 85 .size do_stdfmna,.-do_stdfmna
90 86
91 .type breakpoint_trap,#function 87 .type breakpoint_trap,#function
diff --git a/arch/sparc/kernel/spiterrs.S b/arch/sparc/kernel/spiterrs.S
index c357e40ffd01..4a73009f66a5 100644
--- a/arch/sparc/kernel/spiterrs.S
+++ b/arch/sparc/kernel/spiterrs.S
@@ -85,8 +85,7 @@ __spitfire_cee_trap_continue:
85 ba,pt %xcc, etraptl1 85 ba,pt %xcc, etraptl1
86 rd %pc, %g7 86 rd %pc, %g7
87 87
88 ba,pt %xcc, 2f 88 ba,a,pt %xcc, 2f
89 nop
90 89
911: ba,pt %xcc, etrap_irq 901: ba,pt %xcc, etrap_irq
92 rd %pc, %g7 91 rd %pc, %g7
@@ -100,8 +99,7 @@ __spitfire_cee_trap_continue:
100 mov %l5, %o2 99 mov %l5, %o2
101 call spitfire_access_error 100 call spitfire_access_error
102 add %sp, PTREGS_OFF, %o0 101 add %sp, PTREGS_OFF, %o0
103 ba,pt %xcc, rtrap 102 ba,a,pt %xcc, rtrap
104 nop
105 .size __spitfire_access_error,.-__spitfire_access_error 103 .size __spitfire_access_error,.-__spitfire_access_error
106 104
107 /* This is the trap handler entry point for ECC correctable 105 /* This is the trap handler entry point for ECC correctable
@@ -179,8 +177,7 @@ __spitfire_data_access_exception_tl1:
179 mov %l5, %o2 177 mov %l5, %o2
180 call spitfire_data_access_exception_tl1 178 call spitfire_data_access_exception_tl1
181 add %sp, PTREGS_OFF, %o0 179 add %sp, PTREGS_OFF, %o0
182 ba,pt %xcc, rtrap 180 ba,a,pt %xcc, rtrap
183 nop
184 .size __spitfire_data_access_exception_tl1,.-__spitfire_data_access_exception_tl1 181 .size __spitfire_data_access_exception_tl1,.-__spitfire_data_access_exception_tl1
185 182
186 .type __spitfire_data_access_exception,#function 183 .type __spitfire_data_access_exception,#function
@@ -200,8 +197,7 @@ __spitfire_data_access_exception:
200 mov %l5, %o2 197 mov %l5, %o2
201 call spitfire_data_access_exception 198 call spitfire_data_access_exception
202 add %sp, PTREGS_OFF, %o0 199 add %sp, PTREGS_OFF, %o0
203 ba,pt %xcc, rtrap 200 ba,a,pt %xcc, rtrap
204 nop
205 .size __spitfire_data_access_exception,.-__spitfire_data_access_exception 201 .size __spitfire_data_access_exception,.-__spitfire_data_access_exception
206 202
207 .type __spitfire_insn_access_exception_tl1,#function 203 .type __spitfire_insn_access_exception_tl1,#function
@@ -220,8 +216,7 @@ __spitfire_insn_access_exception_tl1:
220 mov %l5, %o2 216 mov %l5, %o2
221 call spitfire_insn_access_exception_tl1 217 call spitfire_insn_access_exception_tl1
222 add %sp, PTREGS_OFF, %o0 218 add %sp, PTREGS_OFF, %o0
223 ba,pt %xcc, rtrap 219 ba,a,pt %xcc, rtrap
224 nop
225 .size __spitfire_insn_access_exception_tl1,.-__spitfire_insn_access_exception_tl1 220 .size __spitfire_insn_access_exception_tl1,.-__spitfire_insn_access_exception_tl1
226 221
227 .type __spitfire_insn_access_exception,#function 222 .type __spitfire_insn_access_exception,#function
@@ -240,6 +235,5 @@ __spitfire_insn_access_exception:
240 mov %l5, %o2 235 mov %l5, %o2
241 call spitfire_insn_access_exception 236 call spitfire_insn_access_exception
242 add %sp, PTREGS_OFF, %o0 237 add %sp, PTREGS_OFF, %o0
243 ba,pt %xcc, rtrap 238 ba,a,pt %xcc, rtrap
244 nop
245 .size __spitfire_insn_access_exception,.-__spitfire_insn_access_exception 239 .size __spitfire_insn_access_exception,.-__spitfire_insn_access_exception
diff --git a/arch/sparc/kernel/utrap.S b/arch/sparc/kernel/utrap.S
index b7f0f3f3a909..c731e8023d3e 100644
--- a/arch/sparc/kernel/utrap.S
+++ b/arch/sparc/kernel/utrap.S
@@ -11,8 +11,7 @@ utrap_trap: /* %g3=handler,%g4=level */
11 mov %l4, %o1 11 mov %l4, %o1
12 call bad_trap 12 call bad_trap
13 add %sp, PTREGS_OFF, %o0 13 add %sp, PTREGS_OFF, %o0
14 ba,pt %xcc, rtrap 14 ba,a,pt %xcc, rtrap
15 nop
16 15
17invoke_utrap: 16invoke_utrap:
18 sllx %g3, 3, %g3 17 sllx %g3, 3, %g3
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index aadd321aa05d..7d02b1fef025 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -33,6 +33,10 @@ ENTRY(_start)
33jiffies = jiffies_64; 33jiffies = jiffies_64;
34#endif 34#endif
35 35
36#ifdef CONFIG_SPARC64
37ASSERT((swapper_tsb == 0x0000000000408000), "Error: sparc64 early assembler too large")
38#endif
39
36SECTIONS 40SECTIONS
37{ 41{
38#ifdef CONFIG_SPARC64 42#ifdef CONFIG_SPARC64
diff --git a/arch/sparc/kernel/winfixup.S b/arch/sparc/kernel/winfixup.S
index 1e67ce958369..855019a8590e 100644
--- a/arch/sparc/kernel/winfixup.S
+++ b/arch/sparc/kernel/winfixup.S
@@ -32,8 +32,7 @@ fill_fixup:
32 rd %pc, %g7 32 rd %pc, %g7
33 call do_sparc64_fault 33 call do_sparc64_fault
34 add %sp, PTREGS_OFF, %o0 34 add %sp, PTREGS_OFF, %o0
35 ba,pt %xcc, rtrap 35 ba,a,pt %xcc, rtrap
36 nop
37 36
38 /* Be very careful about usage of the trap globals here. 37 /* Be very careful about usage of the trap globals here.
39 * You cannot touch %g5 as that has the fault information. 38 * You cannot touch %g5 as that has the fault information.