Skip to content

Commit 49fa523

Browse files
committed
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: 1a40b95 ("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>
1 parent c5b8b5b commit 49fa523

File tree

8 files changed

+34
-55
lines changed

8 files changed

+34
-55
lines changed

arch/sparc/kernel/cherrs.S

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,7 @@ do_dcpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */
214214
subcc %g1, %g2, %g1 ! Next cacheline
215215
bge,pt %icc, 1b
216216
nop
217-
ba,pt %xcc, dcpe_icpe_tl1_common
218-
nop
217+
ba,a,pt %xcc, dcpe_icpe_tl1_common
219218

220219
do_dcpe_tl1_fatal:
221220
sethi %hi(1f), %g7
@@ -224,8 +223,7 @@ do_dcpe_tl1_fatal:
224223
mov 0x2, %o0
225224
call cheetah_plus_parity_error
226225
add %sp, PTREGS_OFF, %o1
227-
ba,pt %xcc, rtrap
228-
nop
226+
ba,a,pt %xcc, rtrap
229227
.size do_dcpe_tl1,.-do_dcpe_tl1
230228

231229
.globl do_icpe_tl1
@@ -259,8 +257,7 @@ do_icpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */
259257
subcc %g1, %g2, %g1
260258
bge,pt %icc, 1b
261259
nop
262-
ba,pt %xcc, dcpe_icpe_tl1_common
263-
nop
260+
ba,a,pt %xcc, dcpe_icpe_tl1_common
264261

265262
do_icpe_tl1_fatal:
266263
sethi %hi(1f), %g7
@@ -269,8 +266,7 @@ do_icpe_tl1_fatal:
269266
mov 0x3, %o0
270267
call cheetah_plus_parity_error
271268
add %sp, PTREGS_OFF, %o1
272-
ba,pt %xcc, rtrap
273-
nop
269+
ba,a,pt %xcc, rtrap
274270
.size do_icpe_tl1,.-do_icpe_tl1
275271

276272
.type dcpe_icpe_tl1_common,#function
@@ -456,7 +452,7 @@ __cheetah_log_error:
456452
cmp %g2, 0x63
457453
be c_cee
458454
nop
459-
ba,pt %xcc, c_deferred
455+
ba,a,pt %xcc, c_deferred
460456
.size __cheetah_log_error,.-__cheetah_log_error
461457

462458
/* Cheetah FECC trap handling, we get here from tl{0,1}_fecc

arch/sparc/kernel/fpu_traps.S

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ do_fpdis:
100100
fmuld %f0, %f2, %f26
101101
faddd %f0, %f2, %f28
102102
fmuld %f0, %f2, %f30
103-
b,pt %xcc, fpdis_exit
104-
nop
103+
ba,a,pt %xcc, fpdis_exit
104+
105105
2: andcc %g5, FPRS_DU, %g0
106106
bne,pt %icc, 3f
107107
fzero %f32
@@ -144,8 +144,8 @@ do_fpdis:
144144
fmuld %f32, %f34, %f58
145145
faddd %f32, %f34, %f60
146146
fmuld %f32, %f34, %f62
147-
ba,pt %xcc, fpdis_exit
148-
nop
147+
ba,a,pt %xcc, fpdis_exit
148+
149149
3: mov SECONDARY_CONTEXT, %g3
150150
add %g6, TI_FPREGS, %g1
151151

@@ -197,8 +197,7 @@ fpdis_exit2:
197197
fp_other_bounce:
198198
call do_fpother
199199
add %sp, PTREGS_OFF, %o0
200-
ba,pt %xcc, rtrap
201-
nop
200+
ba,a,pt %xcc, rtrap
202201
.size fp_other_bounce,.-fp_other_bounce
203202

204203
.align 32

arch/sparc/kernel/head_64.S

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,8 @@ sun4v_chip_type:
466466
subcc %g3, 1, %g3
467467
bne,pt %xcc, 41b
468468
add %g1, 1, %g1
469-
mov SUN4V_CHIP_SPARC64X, %g4
470469
ba,pt %xcc, 5f
471-
nop
470+
mov SUN4V_CHIP_SPARC64X, %g4
472471

473472
49:
474473
mov SUN4V_CHIP_UNKNOWN, %g4
@@ -553,8 +552,7 @@ sun4u_init:
553552
stxa %g0, [%g7] ASI_DMMU
554553
membar #Sync
555554

556-
ba,pt %xcc, sun4u_continue
557-
nop
555+
ba,a,pt %xcc, sun4u_continue
558556

559557
sun4v_init:
560558
/* Set ctx 0 */
@@ -565,14 +563,12 @@ sun4v_init:
565563
mov SECONDARY_CONTEXT, %g7
566564
stxa %g0, [%g7] ASI_MMU
567565
membar #Sync
568-
ba,pt %xcc, niagara_tlb_fixup
569-
nop
566+
ba,a,pt %xcc, niagara_tlb_fixup
570567

571568
sun4u_continue:
572569
BRANCH_IF_ANY_CHEETAH(g1, g7, cheetah_tlb_fixup)
573570

574-
ba,pt %xcc, spitfire_tlb_fixup
575-
nop
571+
ba,a,pt %xcc, spitfire_tlb_fixup
576572

577573
niagara_tlb_fixup:
578574
mov 3, %g2 /* Set TLB type to hypervisor. */
@@ -647,8 +643,7 @@ niagara_patch:
647643
call hypervisor_patch_cachetlbops
648644
nop
649645

650-
ba,pt %xcc, tlb_fixup_done
651-
nop
646+
ba,a,pt %xcc, tlb_fixup_done
652647

653648
cheetah_tlb_fixup:
654649
mov 2, %g2 /* Set TLB type to cheetah+. */
@@ -667,8 +662,7 @@ cheetah_tlb_fixup:
667662
call cheetah_patch_cachetlbops
668663
nop
669664

670-
ba,pt %xcc, tlb_fixup_done
671-
nop
665+
ba,a,pt %xcc, tlb_fixup_done
672666

673667
spitfire_tlb_fixup:
674668
/* Set TLB type to spitfire. */
@@ -782,8 +776,7 @@ setup_trap_table:
782776
call %o1
783777
add %sp, (2047 + 128), %o0
784778

785-
ba,pt %xcc, 2f
786-
nop
779+
ba,a,pt %xcc, 2f
787780

788781
1: sethi %hi(sparc64_ttable_tl0), %o0
789782
set prom_set_trap_table_name, %g2
@@ -822,8 +815,7 @@ setup_trap_table:
822815

823816
BRANCH_IF_ANY_CHEETAH(o2, o3, 1f)
824817

825-
ba,pt %xcc, 2f
826-
nop
818+
ba,a,pt %xcc, 2f
827819

828820
/* Disable STICK_INT interrupts. */
829821
1:

arch/sparc/kernel/misctrap.S

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ __do_privact:
1818
109: or %g7, %lo(109b), %g7
1919
call do_privact
2020
add %sp, PTREGS_OFF, %o0
21-
ba,pt %xcc, rtrap
22-
nop
21+
ba,a,pt %xcc, rtrap
2322
.size __do_privact,.-__do_privact
2423

2524
.type do_mna,#function
@@ -46,8 +45,7 @@ do_mna:
4645
mov %l5, %o2
4746
call mem_address_unaligned
4847
add %sp, PTREGS_OFF, %o0
49-
ba,pt %xcc, rtrap
50-
nop
48+
ba,a,pt %xcc, rtrap
5149
.size do_mna,.-do_mna
5250

5351
.type do_lddfmna,#function
@@ -65,8 +63,7 @@ do_lddfmna:
6563
mov %l5, %o2
6664
call handle_lddfmna
6765
add %sp, PTREGS_OFF, %o0
68-
ba,pt %xcc, rtrap
69-
nop
66+
ba,a,pt %xcc, rtrap
7067
.size do_lddfmna,.-do_lddfmna
7168

7269
.type do_stdfmna,#function
@@ -84,8 +81,7 @@ do_stdfmna:
8481
mov %l5, %o2
8582
call handle_stdfmna
8683
add %sp, PTREGS_OFF, %o0
87-
ba,pt %xcc, rtrap
88-
nop
84+
ba,a,pt %xcc, rtrap
8985
.size do_stdfmna,.-do_stdfmna
9086

9187
.type breakpoint_trap,#function

arch/sparc/kernel/spiterrs.S

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ __spitfire_cee_trap_continue:
8585
ba,pt %xcc, etraptl1
8686
rd %pc, %g7
8787

88-
ba,pt %xcc, 2f
89-
nop
88+
ba,a,pt %xcc, 2f
9089

9190
1: ba,pt %xcc, etrap_irq
9291
rd %pc, %g7
@@ -100,8 +99,7 @@ __spitfire_cee_trap_continue:
10099
mov %l5, %o2
101100
call spitfire_access_error
102101
add %sp, PTREGS_OFF, %o0
103-
ba,pt %xcc, rtrap
104-
nop
102+
ba,a,pt %xcc, rtrap
105103
.size __spitfire_access_error,.-__spitfire_access_error
106104

107105
/* This is the trap handler entry point for ECC correctable
@@ -179,8 +177,7 @@ __spitfire_data_access_exception_tl1:
179177
mov %l5, %o2
180178
call spitfire_data_access_exception_tl1
181179
add %sp, PTREGS_OFF, %o0
182-
ba,pt %xcc, rtrap
183-
nop
180+
ba,a,pt %xcc, rtrap
184181
.size __spitfire_data_access_exception_tl1,.-__spitfire_data_access_exception_tl1
185182

186183
.type __spitfire_data_access_exception,#function
@@ -200,8 +197,7 @@ __spitfire_data_access_exception:
200197
mov %l5, %o2
201198
call spitfire_data_access_exception
202199
add %sp, PTREGS_OFF, %o0
203-
ba,pt %xcc, rtrap
204-
nop
200+
ba,a,pt %xcc, rtrap
205201
.size __spitfire_data_access_exception,.-__spitfire_data_access_exception
206202

207203
.type __spitfire_insn_access_exception_tl1,#function
@@ -220,8 +216,7 @@ __spitfire_insn_access_exception_tl1:
220216
mov %l5, %o2
221217
call spitfire_insn_access_exception_tl1
222218
add %sp, PTREGS_OFF, %o0
223-
ba,pt %xcc, rtrap
224-
nop
219+
ba,a,pt %xcc, rtrap
225220
.size __spitfire_insn_access_exception_tl1,.-__spitfire_insn_access_exception_tl1
226221

227222
.type __spitfire_insn_access_exception,#function
@@ -240,6 +235,5 @@ __spitfire_insn_access_exception:
240235
mov %l5, %o2
241236
call spitfire_insn_access_exception
242237
add %sp, PTREGS_OFF, %o0
243-
ba,pt %xcc, rtrap
244-
nop
238+
ba,a,pt %xcc, rtrap
245239
.size __spitfire_insn_access_exception,.-__spitfire_insn_access_exception

arch/sparc/kernel/utrap.S

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ utrap_trap: /* %g3=handler,%g4=level */
1111
mov %l4, %o1
1212
call bad_trap
1313
add %sp, PTREGS_OFF, %o0
14-
ba,pt %xcc, rtrap
15-
nop
14+
ba,a,pt %xcc, rtrap
1615

1716
invoke_utrap:
1817
sllx %g3, 3, %g3

arch/sparc/kernel/vmlinux.lds.S

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ ENTRY(_start)
3333
jiffies = jiffies_64;
3434
#endif
3535

36+
#ifdef CONFIG_SPARC64
37+
ASSERT((swapper_tsb == 0x0000000000408000), "Error: sparc64 early assembler too large")
38+
#endif
39+
3640
SECTIONS
3741
{
3842
#ifdef CONFIG_SPARC64

arch/sparc/kernel/winfixup.S

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ fill_fixup:
3232
rd %pc, %g7
3333
call do_sparc64_fault
3434
add %sp, PTREGS_OFF, %o0
35-
ba,pt %xcc, rtrap
36-
nop
35+
ba,a,pt %xcc, rtrap
3736

3837
/* Be very careful about usage of the trap globals here.
3938
* You cannot touch %g5 as that has the fault information.

0 commit comments

Comments
 (0)