1 From foo@baz Mon Jun 20 10:48:29 PDT 2016
2 From: "David S. Miller" <davem@davemloft.net>
3 Date: Wed, 27 Apr 2016 17:27:37 -0400
4 Subject: sparc64: Fix bootup regressions on some Kconfig combinations.
6 From: "David S. Miller" <davem@davemloft.net>
8 [ Upstream commit 49fa5230462f9f2c4e97c81356473a6bdf06c422 ]
10 The system call tracing bug fix mentioned in the Fixes tag
11 below increased the amount of assembler code in the sequence
12 of assembler files included by head_64.S
14 This caused to total set of code to exceed 0x4000 bytes in
15 size, which overflows the expression in head_64.S that works
16 to place swapper_tsb at address 0x408000.
18 When this is violated, the TSB is not properly aligned, and
19 also the trap table is not aligned properly either. All of
20 this together results in failed boots.
24 1) Simplify some code by using ba,a instead of ba/nop to get
27 2) Add a linker script assertion to make sure that if this
28 happens again the build will fail.
30 Fixes: 1a40b95374f6 ("sparc: Fix system call tracing register handling.")
31 Reported-by: Meelis Roos <mroos@linux.ee>
32 Reported-by: Joerg Abraham <joerg.abraham@nokia.com>
33 Signed-off-by: David S. Miller <davem@davemloft.net>
34 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
36 arch/sparc/kernel/cherrs.S | 14 +++++---------
37 arch/sparc/kernel/fpu_traps.S | 11 +++++------
38 arch/sparc/kernel/head_64.S | 24 ++++++++----------------
39 arch/sparc/kernel/misctrap.S | 12 ++++--------
40 arch/sparc/kernel/spiterrs.S | 18 ++++++------------
41 arch/sparc/kernel/utrap.S | 3 +--
42 arch/sparc/kernel/vmlinux.lds.S | 4 ++++
43 arch/sparc/kernel/winfixup.S | 3 +--
44 8 files changed, 34 insertions(+), 55 deletions(-)
46 --- a/arch/sparc/kernel/cherrs.S
47 +++ b/arch/sparc/kernel/cherrs.S
48 @@ -214,8 +214,7 @@ do_dcpe_tl1_nonfatal: /* Ok we may use i
49 subcc %g1, %g2, %g1 ! Next cacheline
52 - ba,pt %xcc, dcpe_icpe_tl1_common
54 + ba,a,pt %xcc, dcpe_icpe_tl1_common
58 @@ -224,8 +223,7 @@ do_dcpe_tl1_fatal:
60 call cheetah_plus_parity_error
61 add %sp, PTREGS_OFF, %o1
65 .size do_dcpe_tl1,.-do_dcpe_tl1
68 @@ -259,8 +257,7 @@ do_icpe_tl1_nonfatal: /* Ok we may use i
72 - ba,pt %xcc, dcpe_icpe_tl1_common
74 + ba,a,pt %xcc, dcpe_icpe_tl1_common
78 @@ -269,8 +266,7 @@ do_icpe_tl1_fatal:
80 call cheetah_plus_parity_error
81 add %sp, PTREGS_OFF, %o1
85 .size do_icpe_tl1,.-do_icpe_tl1
87 .type dcpe_icpe_tl1_common,#function
88 @@ -456,7 +452,7 @@ __cheetah_log_error:
92 - ba,pt %xcc, c_deferred
93 + ba,a,pt %xcc, c_deferred
94 .size __cheetah_log_error,.-__cheetah_log_error
96 /* Cheetah FECC trap handling, we get here from tl{0,1}_fecc
97 --- a/arch/sparc/kernel/fpu_traps.S
98 +++ b/arch/sparc/kernel/fpu_traps.S
99 @@ -100,8 +100,8 @@ do_fpdis:
103 - b,pt %xcc, fpdis_exit
105 + ba,a,pt %xcc, fpdis_exit
107 2: andcc %g5, FPRS_DU, %g0
110 @@ -144,8 +144,8 @@ do_fpdis:
111 fmuld %f32, %f34, %f58
112 faddd %f32, %f34, %f60
113 fmuld %f32, %f34, %f62
114 - ba,pt %xcc, fpdis_exit
116 + ba,a,pt %xcc, fpdis_exit
118 3: mov SECONDARY_CONTEXT, %g3
119 add %g6, TI_FPREGS, %g1
121 @@ -197,8 +197,7 @@ fpdis_exit2:
124 add %sp, PTREGS_OFF, %o0
127 + ba,a,pt %xcc, rtrap
128 .size fp_other_bounce,.-fp_other_bounce
131 --- a/arch/sparc/kernel/head_64.S
132 +++ b/arch/sparc/kernel/head_64.S
133 @@ -461,9 +461,8 @@ sun4v_chip_type:
137 - mov SUN4V_CHIP_SPARC64X, %g4
140 + mov SUN4V_CHIP_SPARC64X, %g4
143 mov SUN4V_CHIP_UNKNOWN, %g4
144 @@ -548,8 +547,7 @@ sun4u_init:
145 stxa %g0, [%g7] ASI_DMMU
148 - ba,pt %xcc, sun4u_continue
150 + ba,a,pt %xcc, sun4u_continue
154 @@ -560,14 +558,12 @@ sun4v_init:
155 mov SECONDARY_CONTEXT, %g7
156 stxa %g0, [%g7] ASI_MMU
158 - ba,pt %xcc, niagara_tlb_fixup
160 + ba,a,pt %xcc, niagara_tlb_fixup
163 BRANCH_IF_ANY_CHEETAH(g1, g7, cheetah_tlb_fixup)
165 - ba,pt %xcc, spitfire_tlb_fixup
167 + ba,a,pt %xcc, spitfire_tlb_fixup
170 mov 3, %g2 /* Set TLB type to hypervisor. */
171 @@ -639,8 +635,7 @@ niagara_patch:
172 call hypervisor_patch_cachetlbops
175 - ba,pt %xcc, tlb_fixup_done
177 + ba,a,pt %xcc, tlb_fixup_done
180 mov 2, %g2 /* Set TLB type to cheetah+. */
181 @@ -659,8 +654,7 @@ cheetah_tlb_fixup:
182 call cheetah_patch_cachetlbops
185 - ba,pt %xcc, tlb_fixup_done
187 + ba,a,pt %xcc, tlb_fixup_done
190 /* Set TLB type to spitfire. */
191 @@ -782,8 +776,7 @@ setup_trap_table:
193 add %sp, (2047 + 128), %o0
199 1: sethi %hi(sparc64_ttable_tl0), %o0
200 set prom_set_trap_table_name, %g2
201 @@ -822,8 +815,7 @@ setup_trap_table:
203 BRANCH_IF_ANY_CHEETAH(o2, o3, 1f)
209 /* Disable STICK_INT interrupts. */
211 --- a/arch/sparc/kernel/misctrap.S
212 +++ b/arch/sparc/kernel/misctrap.S
213 @@ -18,8 +18,7 @@ __do_privact:
214 109: or %g7, %lo(109b), %g7
216 add %sp, PTREGS_OFF, %o0
219 + ba,a,pt %xcc, rtrap
220 .size __do_privact,.-__do_privact
222 .type do_mna,#function
223 @@ -46,8 +45,7 @@ do_mna:
225 call mem_address_unaligned
226 add %sp, PTREGS_OFF, %o0
229 + ba,a,pt %xcc, rtrap
230 .size do_mna,.-do_mna
232 .type do_lddfmna,#function
233 @@ -65,8 +63,7 @@ do_lddfmna:
236 add %sp, PTREGS_OFF, %o0
239 + ba,a,pt %xcc, rtrap
240 .size do_lddfmna,.-do_lddfmna
242 .type do_stdfmna,#function
243 @@ -84,8 +81,7 @@ do_stdfmna:
246 add %sp, PTREGS_OFF, %o0
249 + ba,a,pt %xcc, rtrap
250 .size do_stdfmna,.-do_stdfmna
252 .type breakpoint_trap,#function
253 --- a/arch/sparc/kernel/spiterrs.S
254 +++ b/arch/sparc/kernel/spiterrs.S
255 @@ -85,8 +85,7 @@ __spitfire_cee_trap_continue:
263 1: ba,pt %xcc, etrap_irq
265 @@ -100,8 +99,7 @@ __spitfire_cee_trap_continue:
267 call spitfire_access_error
268 add %sp, PTREGS_OFF, %o0
271 + ba,a,pt %xcc, rtrap
272 .size __spitfire_access_error,.-__spitfire_access_error
274 /* This is the trap handler entry point for ECC correctable
275 @@ -179,8 +177,7 @@ __spitfire_data_access_exception_tl1:
277 call spitfire_data_access_exception_tl1
278 add %sp, PTREGS_OFF, %o0
281 + ba,a,pt %xcc, rtrap
282 .size __spitfire_data_access_exception_tl1,.-__spitfire_data_access_exception_tl1
284 .type __spitfire_data_access_exception,#function
285 @@ -200,8 +197,7 @@ __spitfire_data_access_exception:
287 call spitfire_data_access_exception
288 add %sp, PTREGS_OFF, %o0
291 + ba,a,pt %xcc, rtrap
292 .size __spitfire_data_access_exception,.-__spitfire_data_access_exception
294 .type __spitfire_insn_access_exception_tl1,#function
295 @@ -220,8 +216,7 @@ __spitfire_insn_access_exception_tl1:
297 call spitfire_insn_access_exception_tl1
298 add %sp, PTREGS_OFF, %o0
301 + ba,a,pt %xcc, rtrap
302 .size __spitfire_insn_access_exception_tl1,.-__spitfire_insn_access_exception_tl1
304 .type __spitfire_insn_access_exception,#function
305 @@ -240,6 +235,5 @@ __spitfire_insn_access_exception:
307 call spitfire_insn_access_exception
308 add %sp, PTREGS_OFF, %o0
311 + ba,a,pt %xcc, rtrap
312 .size __spitfire_insn_access_exception,.-__spitfire_insn_access_exception
313 --- a/arch/sparc/kernel/utrap.S
314 +++ b/arch/sparc/kernel/utrap.S
315 @@ -11,8 +11,7 @@ utrap_trap: /* %g3=handler,%g4=level */
318 add %sp, PTREGS_OFF, %o0
321 + ba,a,pt %xcc, rtrap
325 --- a/arch/sparc/kernel/vmlinux.lds.S
326 +++ b/arch/sparc/kernel/vmlinux.lds.S
327 @@ -33,6 +33,10 @@ ENTRY(_start)
328 jiffies = jiffies_64;
331 +#ifdef CONFIG_SPARC64
332 +ASSERT((swapper_tsb == 0x0000000000408000), "Error: sparc64 early assembler too large")
337 #ifdef CONFIG_SPARC64
338 --- a/arch/sparc/kernel/winfixup.S
339 +++ b/arch/sparc/kernel/winfixup.S
340 @@ -32,8 +32,7 @@ fill_fixup:
342 call do_sparc64_fault
343 add %sp, PTREGS_OFF, %o0
346 + ba,a,pt %xcc, rtrap
348 /* Be very careful about usage of the trap globals here.
349 * You cannot touch %g5 as that has the fault information.