sparc: Avoid unsupported LLD branch relocations
PATCH 1/1 sparc: Avoid unsupported LLD branch relocations
LLD does not support several SPARC branch relocation types, including R_SPARC_WDISP16, R_SPARC_WDISP19, and R_SPARC_WDISP22. A sparc64 allmodconfig LLVM build can therefore fail when trap table code and low-level assembly leave branches to global symbols for the linker.
Use local labels for branches that stay within the same assembled object so the assembler can resolve them directly. Convert the remaining cross-object branches and tail calls to absolute set/jmpl sequences, which LLD handles through the usual HI22/LO10 relocations.
Disable the unused sparc32 syscall trace entry points when compat support is not built, and request sys_llseek for the native syscall table so the LLD allmodconfig build remains self-contained.
--- arch/sparc/include/asm/switch_to_64.h | 3 +- arch/sparc/include/asm/ttable.h | 76 +++++++------- arch/sparc/include/asm/unistd.h | 1 + arch/sparc/kernel/cherrs.S | 28 ++--- arch/sparc/kernel/dtlb_prot.S | 2 +- arch/sparc/kernel/etrap_64.S | 13 ++- arch/sparc/kernel/fpu_traps.S | 11 +- arch/sparc/kernel/itlb_miss.S | 2 +- arch/sparc/kernel/ktlb.S | 4 +- arch/sparc/kernel/misctrap.S | 18 ++-- arch/sparc/kernel/rtrap_64.S | 16 ++- arch/sparc/kernel/spiterrs.S | 24 ++--- arch/sparc/kernel/sun4v_ivec.S | 16 +-- arch/sparc/kernel/sun4v_mcd.S | 3 +- arch/sparc/kernel/sun4v_tlb_miss.S | 44 ++++---- arch/sparc/kernel/syscalls.S | 25 +++-- arch/sparc/kernel/tsb.S | 18 ++-- arch/sparc/kernel/ttable_64.S | 6 +- arch/sparc/kernel/urtt_fill.S | 18 +++- arch/sparc/kernel/utrap.S | 5 +- arch/sparc/kernel/winfixup.S | 21 ++-- arch/sparc/lib/GENbzero.S | 3 +- arch/sparc/lib/GENcopy_from_user.S | 8 +- arch/sparc/lib/GENcopy_to_user.S | 8 +- arch/sparc/lib/M7copy_from_user.S | 8 +- arch/sparc/lib/M7copy_to_user.S | 8 +- arch/sparc/lib/Memcpy_utils.S | 144 +++++++++++++------------- arch/sparc/lib/NG2copy_from_user.S | 8 +- arch/sparc/lib/NG2copy_to_user.S | 8 +- arch/sparc/lib/NG2memcpy.S | 21 ++-- arch/sparc/lib/NG4copy_from_user.S | 8 +- arch/sparc/lib/NG4copy_to_user.S | 8 +- arch/sparc/lib/NGbzero.S | 3 +- arch/sparc/lib/NGcopy_from_user.S | 8 +- arch/sparc/lib/NGcopy_to_user.S | 8 +- arch/sparc/lib/NGmemcpy.S | 37 +++---- arch/sparc/lib/U1copy_from_user.S | 8 +- arch/sparc/lib/U1copy_to_user.S | 8 +- arch/sparc/lib/U3copy_to_user.S | 8 +- arch/sparc/lib/memmove.S | 6 +- arch/sparc/mm/ultra.S | 16 ++- 41 files changed, 401 insertions(+), 287 deletions(-)
arch/sparc/include/asm/switch_to_64.h +2 -1
@@ -45,13 +45,14 @@ do { save_and_clear_fpu(); \"ldx [%%sp + 2047 + 0x78], %%i7\n\t" \"ldx [%%g6 + %9], %%g4\n\t" \"wrpr %%g0, 14, %%pil\n\t" \ -"brz,pt %%o7, switch_to_pc\n\t" \ +"brz,pt %%o7, 1f\n\t" \" mov %%g7, %0\n\t" \"sethi %%hi(ret_from_fork), %%g1\n\t" \"jmpl %%g1 + %%lo(ret_from_fork), %%g0\n\t" \" nop\n\t" \".globl switch_to_pc\n\t" \"switch_to_pc:\n\t" \ +"1:\n\t" \ : "=&r" (last), "=r" (current), "=r" (current_thread_info_reg), \ "=r" (__local_per_cpu_offset) \ : "0" (task_thread_info(next)), \
arch/sparc/include/asm/ttable.h +40 -36
255 lines not on this page · raw message
arch/sparc/include/asm/unistd.h +1 -0
@@ -40,6 +40,7 @@#define __ARCH_WANT_SYS_OLDUMOUNT#define __ARCH_WANT_SYS_SIGPENDING#define __ARCH_WANT_SYS_SIGPROCMASK +#define __ARCH_WANT_SYS_LLSEEK#ifdef __32bit_syscall_numbers__#define __ARCH_WANT_SYS_IPC#else
arch/sparc/kernel/cherrs.S +14 -14
@@ -104,7 +104,7 @@ cheetah_plus_dcpe_trap_vector: do_cheetah_plus_data_parity: rdpr %pil, %g2 wrpr %g0, PIL_NORMAL_MAX, %pil - ba,pt %xcc, etrap_irq + ba,pt %xcc, .Letrap_irq rd %pc, %g7 #ifdef CONFIG_TRACE_IRQFLAGS call trace_hardirqs_off
@@ -113,7 +113,7 @@ do_cheetah_plus_data_parity: mov 0x0, %o0 call cheetah_plus_parity_error add %sp, PTREGS_OFF, %o1 - ba,a,pt %xcc, rtrap_irq + ba,a,pt %xcc, .Lrtrap_irq .size do_cheetah_plus_data_parity,.-do_cheetah_plus_data_parity .globl cheetah_plus_dcpe_trap_vector_tl1
@@ -146,7 +146,7 @@ cheetah_plus_icpe_trap_vector: do_cheetah_plus_insn_parity: rdpr %pil, %g2 wrpr %g0, PIL_NORMAL_MAX, %pil - ba,pt %xcc, etrap_irq + ba,pt %xcc, .Letrap_irq rd %pc, %g7 #ifdef CONFIG_TRACE_IRQFLAGS call trace_hardirqs_off
@@ -155,7 +155,7 @@ do_cheetah_plus_insn_parity: mov 0x1, %o0 call cheetah_plus_parity_error add %sp, PTREGS_OFF, %o1 - ba,a,pt %xcc, rtrap_irq + ba,a,pt %xcc, .Lrtrap_irq .size do_cheetah_plus_insn_parity,.-do_cheetah_plus_insn_parity .globl cheetah_plus_icpe_trap_vector_tl1
@@ -219,12 +219,12 @@ do_dcpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */ do_dcpe_tl1_fatal: sethi %hi(1f), %g7 - ba,pt %xcc, etraptl1 + ba,pt %xcc, .Letraptl1 1: or %g7, %lo(1b), %g7 mov 0x2, %o0 call cheetah_plus_parity_error add %sp, PTREGS_OFF, %o1 - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap .size do_dcpe_tl1,.-do_dcpe_tl1 .globl do_icpe_tl1
@@ -262,12 +262,12 @@ do_icpe_tl1_nonfatal: /* Ok we may use interrupt globals safely. */ do_icpe_tl1_fatal: sethi %hi(1f), %g7 - ba,pt %xcc, etraptl1 + ba,pt %xcc, .Letraptl1 1: or %g7, %lo(1b), %g7 mov 0x3, %o0 call cheetah_plus_parity_error add %sp, PTREGS_OFF, %o1 - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap .size do_icpe_tl1,.-do_icpe_tl1 .type dcpe_icpe_tl1_common,#function
@@ -490,7 +490,7 @@ cheetah_fast_ecc: c_fast_ecc: rdpr %pil, %g2 wrpr %g0, PIL_NORMAL_MAX, %pil - ba,pt %xcc, etrap_irq + ba,pt %xcc, .Letrap_irq rd %pc, %g7 #ifdef CONFIG_TRACE_IRQFLAGS call trace_hardirqs_off
@@ -500,7 +500,7 @@ c_fast_ecc: mov %l5, %o2 call cheetah_fecc_handler add %sp, PTREGS_OFF, %o0 - ba,a,pt %xcc, rtrap_irq + ba,a,pt %xcc, .Lrtrap_irq .size c_fast_ecc,.-c_fast_ecc /* Our caller has disabled I-cache and performed membar Sync. */
@@ -526,7 +526,7 @@ cheetah_cee: c_cee: rdpr %pil, %g2 wrpr %g0, PIL_NORMAL_MAX, %pil - ba,pt %xcc, etrap_irq + ba,pt %xcc, .Letrap_irq rd %pc, %g7 #ifdef CONFIG_TRACE_IRQFLAGS call trace_hardirqs_off
@@ -536,7 +536,7 @@ c_cee: mov %l5, %o2 call cheetah_cee_handler add %sp, PTREGS_OFF, %o0 - ba,a,pt %xcc, rtrap_irq + ba,a,pt %xcc, .Lrtrap_irq .size c_cee,.-c_cee /* Our caller has disabled I-cache+D-cache and performed membar Sync. */
@@ -562,7 +562,7 @@ cheetah_deferred_trap: c_deferred: rdpr %pil, %g2 wrpr %g0, PIL_NORMAL_MAX, %pil - ba,pt %xcc, etrap_irq + ba,pt %xcc, .Letrap_irq rd %pc, %g7 #ifdef CONFIG_TRACE_IRQFLAGS call trace_hardirqs_off
@@ -572,5 +572,5 @@ c_deferred: mov %l5, %o2 call cheetah_deferred_handler add %sp, PTREGS_OFF, %o0 - ba,a,pt %xcc, rtrap_irq + ba,a,pt %xcc, .Lrtrap_irq .size c_deferred,.-c_deferred
arch/sparc/kernel/dtlb_prot.S +1 -1
@@ -30,7 +30,7 @@ sllx %g5, PAGE_SHIFT, %g5 ! Clear context ID bits bgu,pn %xcc, winfix_trampoline ! Yes, perform winfixup mov FAULT_CODE_DTLB | FAULT_CODE_WRITE, %g4 - ba,pt %xcc, sparc64_realfault_common ! Nope, normal fault + ba,pt %xcc, .Lsparc64_realfault_common ! Nope, normal fault nop nop
arch/sparc/kernel/etrap_64.S +9 -4
@@ -26,11 +26,14 @@ * %g4 and %g5 will be preserved %l4 and %l5 respectively. */ - .text - .align 64 - .globl etrap_syscall, etrap, etrap_irq, etraptl1 + .text + .align 64 + .globl etrap_syscall, etrap, etrap_irq, etraptl1 +.Letrap: etrap: rdpr %pil, %g2 +.Letrap_irq: etrap_irq: clr %g3 +.Letrap_syscall: etrap_syscall: TRAP_LOAD_THREAD_REG(%g6, %g1) rdpr %tstate, %g1 or %g1, %g3, %g1
@@ -66,7 +69,7 @@ etrap_syscall: TRAP_LOAD_THREAD_REG(%g6, %g1) st %g1, [%g2 + STACKFRAME_SZ + PT_V9_MAGIC] rdpr %cansave, %g1 - brnz,pt %g1, etrap_save + brnz,pt %g1, .Letrap_save nop rdpr %cwp, %g1
@@ -88,6 +91,7 @@ etrap_user_spill: nop ba,a,pt %xcc, etrap_user_spill_64bit +.Letrap_save: etrap_save: save %g2, -STACK_BIAS, %sp mov %g6, %l6
@@ -205,6 +209,7 @@ etrap_save: save %g2, -STACK_BIAS, %sp stb %g0, [%l4 + %l3] nop +.Letraptl1: etraptl1: /* Save tstate/tpc/tnpc of TL 1-->4 and the tl register itself. * We place this right after pt_regs on the trap stack. * The layout is:
arch/sparc/kernel/fpu_traps.S +7 -4
@@ -2,6 +2,7 @@ /* This is trivial with the new code... */ .globl do_fpdis .type do_fpdis,#function +.Ldo_fpdis: do_fpdis: sethi %hi(TSTATE_PEF), %g4 rdpr %tstate, %g5
@@ -15,10 +16,10 @@ do_fpdis: /* Legal state when DCR_IFPOE is set in Cheetah %dcr. */ sethi %hi(109f), %g7 - ba,pt %xcc, etrap + ba,pt %xcc, .Letrap 109: or %g7, %lo(109b), %g7 add %g0, %g0, %g0 - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap 1: TRAP_LOAD_THREAD_REG(%g6, %g1) ldub [%g6 + TI_FPSAVED], %g5
@@ -198,12 +199,13 @@ fpdis_exit2: fp_other_bounce: call do_fpother add %sp, PTREGS_OFF, %o0 - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap .size fp_other_bounce,.-fp_other_bounce .align 32 .globl do_fpother_check_fitos .type do_fpother_check_fitos,#function +.Ldo_fpother_check_fitos: do_fpother_check_fitos: TRAP_LOAD_THREAD_REG(%g6, %g1) sethi %hi(fp_other_bounce - 4), %g7
@@ -330,6 +332,7 @@ fitos_emul_fini: .align 32 .globl do_fptrap .type do_fptrap,#function +.Ldo_fptrap: do_fptrap: TRAP_LOAD_THREAD_REG(%g6, %g1) stx %fsr, [%g6 + TI_XFSR]
@@ -379,6 +382,6 @@ do_fptrap_after_fsr: .previous membar #Sync - ba,pt %xcc, etrap + ba,pt %xcc, .Letrap wr %g0, 0, %fprs .size do_fptrap,.-do_fptrap
arch/sparc/kernel/itlb_miss.S +1 -1
@@ -14,7 +14,7 @@ mov FAULT_CODE_ITLB, %g3 sethi %hi(_PAGE_EXEC_4U), %g4 andcc %g5, %g4, %g0 ! Executable? - be,pn %xcc, tsb_do_fault + be,pn %xcc, .Ltsb_do_fault nop ! Delay slot, fill me stxa %g5, [%g0] ASI_ITLB_DATA_IN ! Load TLB retry ! Trap done
arch/sparc/kernel/ktlb.S +2 -2
@@ -92,7 +92,7 @@ kvmap_itlb_longpath: .previous rdpr %tpc, %g5 - ba,pt %xcc, sparc64_realfault_common + ba,pt %xcc, .Lsparc64_realfault_common mov FAULT_CODE_ITLB, %g4 kvmap_itlb_obp:
@@ -264,7 +264,7 @@ kvmap_dtlb_longpath: * need to clear the context ID bits out of %g5 here. */ - be,pt %xcc, sparc64_realfault_common + be,pt %xcc, .Lsparc64_realfault_common mov FAULT_CODE_DTLB, %g4 ba,pt %xcc, winfix_trampoline nop
arch/sparc/kernel/misctrap.S +9 -9
@@ -15,11 +15,11 @@ __do_privact: stxa %g0, [%g3] ASI_DMMU ! Clear FaultValid bit membar #Sync sethi %hi(109f), %g7 - ba,pt %xcc, etrap + ba,pt %xcc, .Letrap 109: or %g7, %lo(109b), %g7 call do_privact add %sp, PTREGS_OFF, %o0 - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap .size __do_privact,.-__do_privact .type do_mna,#function
@@ -40,13 +40,13 @@ do_mna: rdpr %tpc, %g3 1: sethi %hi(109f), %g7 - ba,pt %xcc, etrap + ba,pt %xcc, .Letrap 109: or %g7, %lo(109b), %g7 mov %l4, %o1 mov %l5, %o2 call mem_address_unaligned add %sp, PTREGS_OFF, %o0 - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap .size do_mna,.-do_mna .type do_lddfmna,#function
@@ -58,13 +58,13 @@ do_lddfmna: membar #Sync mov DMMU_SFAR, %g4 ldxa [%g4] ASI_DMMU, %g4 - ba,pt %xcc, etrap + ba,pt %xcc, .Letrap 109: or %g7, %lo(109b), %g7 mov %l4, %o1 mov %l5, %o2 call handle_lddfmna add %sp, PTREGS_OFF, %o0 - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap .size do_lddfmna,.-do_lddfmna .type do_stdfmna,#function
@@ -76,13 +76,13 @@ do_stdfmna: membar #Sync mov DMMU_SFAR, %g4 ldxa [%g4] ASI_DMMU, %g4 - ba,pt %xcc, etrap + ba,pt %xcc, .Letrap 109: or %g7, %lo(109b), %g7 mov %l4, %o1 mov %l5, %o2 call handle_stdfmna add %sp, PTREGS_OFF, %o0 - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap nop .size do_stdfmna,.-do_stdfmna
@@ -90,6 +90,6 @@ do_stdfmna: breakpoint_trap: call sparc_breakpoint add %sp, PTREGS_OFF, %o0 - ba,pt %xcc, rtrap + ba,pt %xcc, .Lrtrap nop .size breakpoint_trap,.-breakpoint_trap
arch/sparc/kernel/rtrap_64.S +12 -4
@@ -93,6 +93,7 @@ __handle_signal: * avoid running softirqs, doing IRQ tracing, preempting, etc. */ .globl rtrap_nmi +.Lrtrap_nmi: rtrap_nmi: ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1 sethi %hi(0xf << 20), %l4 and %l1, %l4, %l4
@@ -109,7 +110,9 @@ rtrap_nmi: ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1 .align 64 .globl rtrap_irq, rtrap, irqsz_patchme, rtrap_xcall +.Lrtrap_irq: rtrap_irq: +.Lrtrap: rtrap: /* mm/ultra.S:xcall_report_regs KNOWS about this load. */ ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
@@ -279,17 +282,21 @@ rt_continue: ldx [%sp + PTREGS_OFF + PT_V9_G1], %g1 nop user_rtt_fill_fixup_dax: - ba,pt %xcc, user_rtt_fill_fixup_common + set user_rtt_fill_fixup_common, %g1 + jmpl %g1, %g0 mov 1, %g3 user_rtt_fill_fixup_mna: - ba,pt %xcc, user_rtt_fill_fixup_common + set user_rtt_fill_fixup_common, %g1 + jmpl %g1, %g0 mov 2, %g3 user_rtt_fill_fixup: - ba,pt %xcc, user_rtt_fill_fixup_common + set user_rtt_fill_fixup_common, %g1 + jmpl %g1, %g0 clr %g3 +.Luser_rtt_pre_restore: user_rtt_pre_restore: add %g1, 1, %g1 wrpr %g1, 0x0, %cwp
@@ -304,6 +311,7 @@ user_rtt_restore: kern_rtt: rdpr %canrestore, %g1 brz,pn %g1, kern_rtt_fill nop +.Lkern_rtt_restore: kern_rtt_restore: stw %g0, [%sp + PTREGS_OFF + PT_V9_MAGIC] restore
@@ -322,7 +330,7 @@ to_kernel: nop call preempt_schedule_irq nop - ba,pt %xcc, rtrap + ba,pt %xcc, .Lrtrap #endif kern_fpucheck: ldub [%g6 + TI_FPDEPTH], %l5 brz,pt %l5, rt_continue
arch/sparc/kernel/spiterrs.S +12 -12
@@ -83,13 +83,13 @@ __spitfire_cee_trap_continue: bleu,pt %xcc, 1f wrpr %g0, PIL_NORMAL_MAX, %pil - ba,pt %xcc, etraptl1 + ba,pt %xcc, .Letraptl1 rd %pc, %g7 ba,a,pt %xcc, 2f nop -1: ba,pt %xcc, etrap_irq +1: ba,pt %xcc, .Letrap_irq rd %pc, %g7 2:
@@ -101,7 +101,7 @@ __spitfire_cee_trap_continue: mov %l5, %o2 call spitfire_access_error add %sp, PTREGS_OFF, %o0 - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap .size __spitfire_access_error,.-__spitfire_access_error /* This is the trap handler entry point for ECC correctable
@@ -170,16 +170,16 @@ __spitfire_data_access_exception_tl1: cmp %g3, 0xff ! last win spill/fill trap bgu,pn %xcc, 1f nop - ba,pt %xcc, winfix_dax + ba,pt %xcc, .Lwinfix_dax rdpr %tpc, %g3 1: sethi %hi(109f), %g7 - ba,pt %xcc, etraptl1 + ba,pt %xcc, .Letraptl1 109: or %g7, %lo(109b), %g7 mov %l4, %o1 mov %l5, %o2 call spitfire_data_access_exception_tl1 add %sp, PTREGS_OFF, %o0 - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap .size __spitfire_data_access_exception_tl1,.-__spitfire_data_access_exception_tl1 .type __spitfire_data_access_exception,#function
@@ -193,13 +193,13 @@ __spitfire_data_access_exception: stxa %g0, [%g3] ASI_DMMU ! Clear SFSR.FaultValid bit membar #Sync sethi %hi(109f), %g7 - ba,pt %xcc, etrap + ba,pt %xcc, .Letrap 109: or %g7, %lo(109b), %g7 mov %l4, %o1 mov %l5, %o2 call spitfire_data_access_exception add %sp, PTREGS_OFF, %o0 - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap .size __spitfire_data_access_exception,.-__spitfire_data_access_exception .type __spitfire_insn_access_exception_tl1,#function
@@ -212,13 +212,13 @@ __spitfire_insn_access_exception_tl1: stxa %g0, [%g3] ASI_IMMU ! Clear FaultValid bit membar #Sync sethi %hi(109f), %g7 - ba,pt %xcc, etraptl1 + ba,pt %xcc, .Letraptl1 109: or %g7, %lo(109b), %g7 mov %l4, %o1 mov %l5, %o2 call spitfire_insn_access_exception_tl1 add %sp, PTREGS_OFF, %o0 - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap .size __spitfire_insn_access_exception_tl1,.-__spitfire_insn_access_exception_tl1 .type __spitfire_insn_access_exception,#function
@@ -231,11 +231,11 @@ __spitfire_insn_access_exception: stxa %g0, [%g3] ASI_IMMU ! Clear FaultValid bit membar #Sync sethi %hi(109f), %g7 - ba,pt %xcc, etrap + ba,pt %xcc, .Letrap 109: or %g7, %lo(109b), %g7 mov %l4, %o1 mov %l5, %o2 call spitfire_insn_access_exception add %sp, PTREGS_OFF, %o0 - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap .size __spitfire_insn_access_exception,.-__spitfire_insn_access_exception
arch/sparc/kernel/sun4v_ivec.S +8 -8
@@ -204,7 +204,7 @@ sun4v_res_mondo: rdpr %pil, %g2 wrpr %g0, PIL_NORMAL_MAX, %pil mov %g1, %g4 - ba,pt %xcc, etrap_irq + ba,pt %xcc, .Letrap_irq rd %pc, %g7 #ifdef CONFIG_TRACE_IRQFLAGS call trace_hardirqs_off
@@ -216,7 +216,7 @@ sun4v_res_mondo: mov %l4, %o1 /* Return from trap. */ - ba,pt %xcc, rtrap_irq + ba,pt %xcc, .Lrtrap_irq nop sun4v_res_mondo_queue_empty:
@@ -233,7 +233,7 @@ sun4v_res_mondo_queue_full: rdpr %pil, %g2 wrpr %g0, PIL_NORMAL_MAX, %pil - ba,pt %xcc, etrap_irq + ba,pt %xcc, .Letrap_irq rd %pc, %g7 #ifdef CONFIG_TRACE_IRQFLAGS call trace_hardirqs_off
@@ -242,7 +242,7 @@ sun4v_res_mondo_queue_full: call sun4v_resum_overflow add %sp, PTREGS_OFF, %o0 - ba,pt %xcc, rtrap_irq + ba,pt %xcc, .Lrtrap_irq nop sun4v_nonres_mondo:
@@ -315,7 +315,7 @@ sun4v_nonres_mondo: rdpr %pil, %g2 wrpr %g0, PIL_NORMAL_MAX, %pil mov %g1, %g4 - ba,pt %xcc, etrap_irq + ba,pt %xcc, .Letrap_irq rd %pc, %g7 #ifdef CONFIG_TRACE_IRQFLAGS call trace_hardirqs_off
@@ -327,7 +327,7 @@ sun4v_nonres_mondo: mov %l4, %o1 /* Return from trap. */ - ba,pt %xcc, rtrap_irq + ba,pt %xcc, .Lrtrap_irq nop sun4v_nonres_mondo_queue_empty:
@@ -344,7 +344,7 @@ sun4v_nonres_mondo_queue_full: rdpr %pil, %g2 wrpr %g0, PIL_NORMAL_MAX, %pil - ba,pt %xcc, etrap_irq + ba,pt %xcc, .Letrap_irq rd %pc, %g7 #ifdef CONFIG_TRACE_IRQFLAGS call trace_hardirqs_off
@@ -353,5 +353,5 @@ sun4v_nonres_mondo_queue_full: call sun4v_nonresum_overflow add %sp, PTREGS_OFF, %o0 - ba,pt %xcc, rtrap_irq + ba,pt %xcc, .Lrtrap_irq nop
arch/sparc/kernel/sun4v_mcd.S +2 -1
@@ -8,10 +8,11 @@ .text .align 32 +.Lsun4v_mcd_detect_precise: sun4v_mcd_detect_precise: mov %l4, %o1 mov %l5, %o2 call sun4v_mem_corrupt_detect_precise add %sp, PTREGS_OFF, %o0 - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap nop
arch/sparc/kernel/sun4v_tlb_miss.S +23 -21
170 lines not on this page · raw message
arch/sparc/kernel/syscalls.S +17 -8
@@ -55,11 +55,11 @@ sys32_rt_sigreturn: .align 32 1: ldx [%g6 + TI_FLAGS], %l5 andcc %l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT|_TIF_NOHZ), %g0 - be,pt %icc, rtrap + be,pt %icc, .Lrtrap nop call syscall_trace_leave add %sp, PTREGS_OFF, %o0 - ba,pt %xcc, rtrap + ba,pt %xcc, .Lrtrap nop /* This is how fork() was meant to be done, 8 instruction entry.
@@ -87,26 +87,30 @@ sys32_rt_sigreturn: */ .align 32 sys_vfork: + set sparc_vfork, %g1 flushw - ba,pt %xcc, sparc_vfork + jmpl %g1, %g0 add %sp, PTREGS_OFF, %o0 .align 32 sys_fork: + set sparc_fork, %g1 flushw - ba,pt %xcc, sparc_fork + jmpl %g1, %g0 add %sp, PTREGS_OFF, %o0 .align 32 sys_clone: + set sparc_clone, %g1 flushw - ba,pt %xcc, sparc_clone + jmpl %g1, %g0 add %sp, PTREGS_OFF, %o0 .align 32 __sys_clone3: + set sparc_clone3, %g1 flushw - ba,pt %xcc, sparc_clone3 + jmpl %g1, %g0 add %sp, PTREGS_OFF, %o0 .globl ret_from_fork
@@ -156,6 +160,7 @@ linux_sparc_ni_syscall: ba,pt %xcc, 4f or %l7, %lo(sys_ni_syscall), %l7 +#ifdef CONFIG_COMPAT linux_syscall_trace32: call syscall_trace_enter add %sp, PTREGS_OFF, %o0
@@ -185,6 +190,7 @@ linux_syscall_trace32: srl %i2, 0, %o2 ba,pt %xcc, 5f srl %i3, 0, %o3 +#endif linux_syscall_trace: call syscall_trace_enter
@@ -217,6 +223,7 @@ linux_syscall_trace: mov %i4, %o4 +#ifdef CONFIG_COMPAT /* Linux 32-bit system calls enter here... */ .align 32 .globl linux_sparc_syscall32
@@ -240,10 +247,12 @@ linux_sparc_syscall32: srl %i5, 0, %o5 ! IEU1 ba,pt %xcc, 3f sra %o0, 0, %o0 +#endif /* Linux native system calls enter here... */ .align 32 .globl linux_sparc_syscall +.Llinux_sparc_syscall: linux_sparc_syscall: /* Direct access to user regs, much faster. */ cmp %g1, NR_syscalls ! IEU1 Group
@@ -283,7 +292,7 @@ ret_sys_call: bne,pn %icc, linux_syscall_trace2 add %l1, 0x4, %l2 ! npc = npc+4 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC] - ba,pt %xcc, rtrap + ba,pt %xcc, .Lrtrap stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC] 1:
@@ -305,5 +314,5 @@ linux_syscall_trace2: call syscall_trace_leave add %sp, PTREGS_OFF, %o0 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC] - ba,pt %xcc, rtrap + ba,pt %xcc, .Lrtrap stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
arch/sparc/kernel/tsb.S +10 -8
@@ -113,7 +113,7 @@ tsb_miss_page_table_walk: * TSB both lack a matching entry. */ tsb_miss_page_table_walk_sun4v_fastpath: - USER_PGTABLE_WALK_TL1(%g4, %g7, %g5, %g2, tsb_do_fault) + USER_PGTABLE_WALK_TL1(%g4, %g7, %g5, %g2, .Ltsb_do_fault) /* Valid PTE is now in %g5. */
@@ -156,11 +156,11 @@ tsb_miss_page_table_walk_sun4v_fastpath: cmp %g7, 1 bne,pn %xcc, winfix_trampoline mov %g3, %g4 - ba,pt %xcc, etrap + ba,pt %xcc, .Letrap rd %pc, %g7 call hugetlb_setup add %sp, PTREGS_OFF, %o0 - ba,pt %xcc, rtrap + ba,pt %xcc, .Lrtrap nop 60:
@@ -217,7 +217,7 @@ tsb_itlb_load: nop .previous - be,pn %xcc, tsb_do_fault + be,pn %xcc, .Ltsb_do_fault nop 661: stxa %g5, [%g0] ASI_ITLB_DATA_IN
@@ -248,6 +248,7 @@ tsb_itlb_load: */ .globl tsb_do_fault +.Ltsb_do_fault: tsb_do_fault: cmp %g3, FAULT_CODE_DTLB
@@ -278,28 +279,29 @@ tsb_do_dtlb_fault: srlx %g5, PAGE_SHIFT, %g5 sllx %g5, PAGE_SHIFT, %g5 - be,pt %xcc, sparc64_realfault_common + be,pt %xcc, .Lsparc64_realfault_common mov FAULT_CODE_DTLB, %g4 ba,pt %xcc, winfix_trampoline nop tsb_do_itlb_fault: rdpr %tpc, %g5 - ba,pt %xcc, sparc64_realfault_common + ba,pt %xcc, .Lsparc64_realfault_common mov FAULT_CODE_ITLB, %g4 .globl sparc64_realfault_common +.Lsparc64_realfault_common: sparc64_realfault_common: /* fault code in %g4, fault address in %g5, etrap will * preserve these two values in %l4 and %l5 respectively */ - ba,pt %xcc, etrap ! Save trap state + ba,pt %xcc, .Letrap ! Save trap state 1: rd %pc, %g7 ! ... stb %l4, [%g6 + TI_FAULT_CODE] ! Save fault code stx %l5, [%g6 + TI_FAULT_ADDR] ! Save fault address call do_sparc64_fault ! Call fault handler add %sp, PTREGS_OFF, %o0 ! Compute pt_regs arg - ba,pt %xcc, rtrap ! Restore cpu state + ba,pt %xcc, .Lrtrap ! Restore cpu state nop ! Delay slot (fill me) winfix_trampoline:
arch/sparc/kernel/ttable_64.S +3 -3
@@ -30,9 +30,9 @@ tl0_resv018: BTRAP(0x18) BTRAP(0x19) tl0_mcd: SUN4V_MCD_PRECISE tl0_resv01b: BTRAP(0x1b) tl0_resv01c: BTRAP(0x1c) BTRAP(0x1d) BTRAP(0x1e) BTRAP(0x1f) -tl0_fpdis: TRAP_NOSAVE(do_fpdis) +tl0_fpdis: TRAP_NOSAVE(.Ldo_fpdis) tl0_fpieee: TRAP_SAVEFPU(do_fpieee) -tl0_fpother: TRAP_NOSAVE(do_fpother_check_fitos) +tl0_fpother: TRAP_NOSAVE(.Ldo_fpother_check_fitos) tl0_tof: TRAP(do_tof) tl0_cwin: CLEAN_WINDOW tl0_div0: TRAP(do_div0)
@@ -195,7 +195,7 @@ tl1_resv012: BTRAPTL1(0x12) BTRAPTL1(0x13) BTRAPTL1(0x14) BTRAPTL1(0x15) tl1_resv016: BTRAPTL1(0x16) BTRAPTL1(0x17) BTRAPTL1(0x18) BTRAPTL1(0x19) tl1_resv01a: BTRAPTL1(0x1a) BTRAPTL1(0x1b) BTRAPTL1(0x1c) BTRAPTL1(0x1d) tl1_resv01e: BTRAPTL1(0x1e) BTRAPTL1(0x1f) -tl1_fpdis: TRAP_NOSAVE(do_fpdis) +tl1_fpdis: TRAP_NOSAVE(.Ldo_fpdis) tl1_fpieee: TRAPTL1(do_fpieee_tl1) tl1_fpother: TRAPTL1(do_fpother_tl1) tl1_tof: TRAPTL1(do_tof_tl1)
arch/sparc/kernel/urtt_fill.S +13 -5
@@ -66,7 +66,8 @@ user_rtt_fill_fixup_common: call do_sparc64_fault add %sp, PTREGS_OFF, %o0 - ba,pt %xcc, rtrap + set rtrap, %g1 + jmpl %g1, %g0 nop 1: cmp %g3, 2
@@ -81,12 +82,16 @@ user_rtt_fill_fixup_common: mov %l4, %o2 call sun4v_do_mna mov %l5, %o1 - ba,a,pt %xcc, rtrap + set rtrap, %g1 + jmpl %g1, %g0 + nop 1: mov %l4, %o1 mov %l5, %o2 call mem_address_unaligned nop - ba,a,pt %xcc, rtrap + set rtrap, %g1 + jmpl %g1, %g0 + nop 2: sethi %hi(tlb_type), %g1 mov %l4, %o1
@@ -97,9 +102,12 @@ user_rtt_fill_fixup_common: add %sp, PTREGS_OFF, %o0 call sun4v_data_access_exception nop - ba,a,pt %xcc, rtrap + set rtrap, %g1 + jmpl %g1, %g0 nop 1: call spitfire_data_access_exception nop - ba,a,pt %xcc, rtrap + set rtrap, %g1 + jmpl %g1, %g0 + nop
arch/sparc/kernel/utrap.S +3 -2
@@ -1,18 +1,19 @@ /* SPDX-License-Identifier: GPL-2.0 */ .globl utrap_trap .type utrap_trap,#function +.Lutrap_trap: utrap_trap: /* %g3=handler,%g4=level */ TRAP_LOAD_THREAD_REG(%g6, %g1) ldx [%g6 + TI_UTRAPS], %g1 brnz,pt %g1, invoke_utrap nop - ba,pt %xcc, etrap + ba,pt %xcc, .Letrap rd %pc, %g7 mov %l4, %o1 call bad_trap add %sp, PTREGS_OFF, %o0 - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap invoke_utrap: sllx %g3, 3, %g3
arch/sparc/kernel/winfixup.S +11 -10
@@ -29,11 +29,11 @@ fill_fixup: stb %g4, [%g6 + TI_FAULT_CODE] stx %g5, [%g6 + TI_FAULT_ADDR] wrpr %g1, %cwp - ba,pt %xcc, etrap + ba,pt %xcc, .Letrap rd %pc, %g7 call do_sparc64_fault add %sp, PTREGS_OFF, %o0 - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap /* Be very careful about usage of the trap globals here. * You cannot touch %g5 as that has the fault information.
@@ -98,11 +98,11 @@ spill_fixup_dax: stb %g4, [%g6 + TI_FAULT_CODE] stx %g5, [%g6 + TI_FAULT_ADDR] wrpr %g1, %cwp - ba,pt %xcc, etrap + ba,pt %xcc, .Letrap rd %pc, %g7 call do_sparc64_fault add %sp, PTREGS_OFF, %o0 - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap winfix_mna: andn %g3, 0x7f, %g3
@@ -114,7 +114,7 @@ fill_fixup_mna: rdpr %tstate, %g1 and %g1, TSTATE_CWP, %g1 wrpr %g1, %cwp - ba,pt %xcc, etrap + ba,pt %xcc, .Letrap rd %pc, %g7 sethi %hi(tlb_type), %g1 lduw [%g1 + %lo(tlb_type)], %g1
@@ -124,13 +124,14 @@ fill_fixup_mna: mov %l4, %o2 call sun4v_do_mna mov %l5, %o1 - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap 1: mov %l4, %o1 mov %l5, %o2 call mem_address_unaligned nop - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap +.Lwinfix_dax: winfix_dax: andn %g3, 0x7f, %g3 add %g3, 0x74, %g3
@@ -141,7 +142,7 @@ fill_fixup_dax: rdpr %tstate, %g1 and %g1, TSTATE_CWP, %g1 wrpr %g1, %cwp - ba,pt %xcc, etrap + ba,pt %xcc, .Letrap rd %pc, %g7 sethi %hi(tlb_type), %g1 mov %l4, %o1
@@ -152,9 +153,9 @@ fill_fixup_dax: add %sp, PTREGS_OFF, %o0 call sun4v_data_access_exception nop - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap nop 1: call spitfire_data_access_exception nop - ba,a,pt %xcc, rtrap + ba,a,pt %xcc, .Lrtrap nop
arch/sparc/lib/GENbzero.S +2 -1
@@ -31,6 +31,7 @@ GENmemset: /* %o0=buf, %o1=pat, %o2=len */ .globl GENbzero .type GENbzero, #function +.LGENbzero: GENbzero: clr %o2 1: brz,pn %o1, GENbzero_return
@@ -121,7 +122,7 @@ GENclear_user: /* %o0=buf, %o1=len */ brz,pn %o1, GENbzero_done clr %o3 cmp %o5, ASI_AIUS - bne,pn %icc, GENbzero + bne,pn %icc, .LGENbzero clr %o2 ba,pt %xcc, GENbzero_from_clear_user mov ASI_AIUS, %o4
arch/sparc/lib/GENcopy_from_user.S +6 -2
@@ -24,8 +24,12 @@ #define PREAMBLE \ rd %asi, %g1; \ cmp %g1, ASI_AIUS; \ - bne,pn %icc, raw_copy_in_user; \ - nop + be,pt %icc, 1f; \ + nop; \ + set raw_copy_in_user, %g1; \ + jmpl %g1, %g0; \ + nop; \ +1: #endif #include "GENmemcpy.S"
arch/sparc/lib/GENcopy_to_user.S +6 -2
@@ -28,8 +28,12 @@ #define PREAMBLE \ rd %asi, %g1; \ cmp %g1, ASI_AIUS; \ - bne,pn %icc, raw_copy_in_user; \ - nop + be,pt %icc, 1f; \ + nop; \ + set raw_copy_in_user, %g1; \ + jmpl %g1, %g0; \ + nop; \ +1: #endif #include "GENmemcpy.S"
arch/sparc/lib/M7copy_from_user.S +6 -2
@@ -33,8 +33,12 @@ #define PREAMBLE \ rd %asi, %g1; \ cmp %g1, ASI_AIUS; \ - bne,pn %icc, raw_copy_in_user; \ - nop + be,pt %icc, 1f; \ + nop; \ + set raw_copy_in_user, %g1; \ + jmpl %g1, %g0; \ + nop; \ +1: #endif #include "M7memcpy.S"
arch/sparc/lib/M7copy_to_user.S +6 -2
@@ -44,8 +44,12 @@ #define PREAMBLE \ rd %asi, %g1; \ cmp %g1, ASI_AIUS; \ - bne,pn %icc, raw_copy_in_user; \ - nop + be,pt %icc, 1f; \ + nop; \ + set raw_copy_in_user, %g1; \ + jmpl %g1, %g0; \ + nop; \ +1: #endif #include "M7memcpy.S"
arch/sparc/lib/Memcpy_utils.S +73 -71
422 lines not on this page · raw message
arch/sparc/lib/NG2copy_from_user.S +6 -2
@@ -37,8 +37,12 @@ #define PREAMBLE \ rd %asi, %g1; \ cmp %g1, ASI_AIUS; \ - bne,pn %icc, raw_copy_in_user; \ - nop + be,pt %icc, 1f; \ + nop; \ + set raw_copy_in_user, %g1; \ + jmpl %g1, %g0; \ + nop; \ +1: #endif #include "NG2memcpy.S"
arch/sparc/lib/NG2copy_to_user.S +6 -2
@@ -46,8 +46,12 @@ #define PREAMBLE \ rd %asi, %g1; \ cmp %g1, ASI_AIUS; \ - bne,pn %icc, raw_copy_in_user; \ - nop + be,pt %icc, 1f; \ + nop; \ + set raw_copy_in_user, %g1; \ + jmpl %g1, %g0; \ + nop; \ +1: #endif #include "NG2memcpy.S"
arch/sparc/lib/NG2memcpy.S +11 -10
@@ -181,38 +181,39 @@ #define EX_RETVAL(x) x __restore_fp: VISExitHalf +.L__restore_asi: __restore_asi: retl wr %g0, ASI_AIUS, %asi ENTRY(NG2_retl_o2) - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi mov %o2, %o0 ENDPROC(NG2_retl_o2) ENTRY(NG2_retl_o2_plus_1) - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %o2, 1, %o0 ENDPROC(NG2_retl_o2_plus_1) ENTRY(NG2_retl_o2_plus_4) - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %o2, 4, %o0 ENDPROC(NG2_retl_o2_plus_4) ENTRY(NG2_retl_o2_plus_8) - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %o2, 8, %o0 ENDPROC(NG2_retl_o2_plus_8) ENTRY(NG2_retl_o2_plus_o4_plus_1) add %o4, 1, %o4 - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %o2, %o4, %o0 ENDPROC(NG2_retl_o2_plus_o4_plus_1) ENTRY(NG2_retl_o2_plus_o4_plus_8) add %o4, 8, %o4 - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %o2, %o4, %o0 ENDPROC(NG2_retl_o2_plus_o4_plus_8) ENTRY(NG2_retl_o2_plus_o4_plus_16) add %o4, 16, %o4 - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %o2, %o4, %o0 ENDPROC(NG2_retl_o2_plus_o4_plus_16) ENTRY(NG2_retl_o2_plus_g1_fp)
@@ -226,18 +227,18 @@ ENTRY(NG2_retl_o2_plus_g1_plus_64_fp) ENDPROC(NG2_retl_o2_plus_g1_plus_64_fp) ENTRY(NG2_retl_o2_plus_g1_plus_1) add %g1, 1, %g1 - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %o2, %g1, %o0 ENDPROC(NG2_retl_o2_plus_g1_plus_1) ENTRY(NG2_retl_o2_and_7_plus_o4) and %o2, 7, %o2 - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %o2, %o4, %o0 ENDPROC(NG2_retl_o2_and_7_plus_o4) ENTRY(NG2_retl_o2_and_7_plus_o4_plus_8) and %o2, 7, %o2 add %o4, 8, %o4 - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %o2, %o4, %o0 ENDPROC(NG2_retl_o2_and_7_plus_o4_plus_8) #endif
arch/sparc/lib/NG4copy_from_user.S +6 -2
@@ -32,8 +32,12 @@ #define PREAMBLE \ rd %asi, %g1; \ cmp %g1, ASI_AIUS; \ - bne,pn %icc, raw_copy_in_user; \ - nop + be,pt %icc, 1f; \ + nop; \ + set raw_copy_in_user, %g1; \ + jmpl %g1, %g0; \ + nop; \ +1: #endif #include "NG4memcpy.S"
arch/sparc/lib/NG4copy_to_user.S +6 -2
@@ -41,8 +41,12 @@ #define PREAMBLE \ rd %asi, %g1; \ cmp %g1, ASI_AIUS; \ - bne,pn %icc, raw_copy_in_user; \ - nop + be,pt %icc, 1f; \ + nop; \ + set raw_copy_in_user, %g1; \ + jmpl %g1, %g0; \ + nop; \ +1: #endif #include "NG4memcpy.S"
arch/sparc/lib/NGbzero.S +2 -1
@@ -30,6 +30,7 @@ NGmemset: /* %o0=buf, %o1=pat, %o2=len */ .globl NGbzero .type NGbzero, #function +.LNGbzero: NGbzero: clr %o2 1: brz,pn %o1, NGbzero_return
@@ -123,7 +124,7 @@ NGclear_user: /* %o0=buf, %o1=len */ brz,pn %o1, NGbzero_done clr %o3 cmp %o5, ASI_AIUS - bne,pn %icc, NGbzero + bne,pn %icc, .LNGbzero clr %o2 mov ASI_BLK_INIT_QUAD_LDD_AIUS, %g7 ba,pt %xcc, NGbzero_from_clear_user
arch/sparc/lib/NGcopy_from_user.S +6 -2
@@ -26,8 +26,12 @@ #define PREAMBLE \ rd %asi, %g1; \ cmp %g1, ASI_AIUS; \ - bne,pn %icc, raw_copy_in_user; \ - nop + be,pt %icc, 1f; \ + nop; \ + set raw_copy_in_user, %g1; \ + jmpl %g1, %g0; \ + nop; \ +1: #endif #include "NGmemcpy.S"
arch/sparc/lib/NGcopy_to_user.S +6 -2
@@ -29,8 +29,12 @@ #define PREAMBLE \ rd %asi, %g1; \ cmp %g1, ASI_AIUS; \ - bne,pn %icc, raw_copy_in_user; \ - nop + be,pt %icc, 1f; \ + nop; \ + set raw_copy_in_user, %g1; \ + jmpl %g1, %g0; \ + nop; \ +1: #endif #include "NGmemcpy.S"
arch/sparc/lib/NGmemcpy.S +19 -18
@@ -78,93 +78,94 @@ .text #ifndef EX_RETVAL #define EX_RETVAL(x) x +.L__restore_asi: __restore_asi: wr %g0, ASI_AIUS, %asi ret restore ENTRY(NG_ret_i2_plus_i4_plus_1) - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %i2, %i5, %i0 ENDPROC(NG_ret_i2_plus_i4_plus_1) ENTRY(NG_ret_i2_plus_g1) - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %i2, %g1, %i0 ENDPROC(NG_ret_i2_plus_g1) ENTRY(NG_ret_i2_plus_g1_minus_8) sub %g1, 8, %g1 - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %i2, %g1, %i0 ENDPROC(NG_ret_i2_plus_g1_minus_8) ENTRY(NG_ret_i2_plus_g1_minus_16) sub %g1, 16, %g1 - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %i2, %g1, %i0 ENDPROC(NG_ret_i2_plus_g1_minus_16) ENTRY(NG_ret_i2_plus_g1_minus_24) sub %g1, 24, %g1 - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %i2, %g1, %i0 ENDPROC(NG_ret_i2_plus_g1_minus_24) ENTRY(NG_ret_i2_plus_g1_minus_32) sub %g1, 32, %g1 - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %i2, %g1, %i0 ENDPROC(NG_ret_i2_plus_g1_minus_32) ENTRY(NG_ret_i2_plus_g1_minus_40) sub %g1, 40, %g1 - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %i2, %g1, %i0 ENDPROC(NG_ret_i2_plus_g1_minus_40) ENTRY(NG_ret_i2_plus_g1_minus_48) sub %g1, 48, %g1 - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %i2, %g1, %i0 ENDPROC(NG_ret_i2_plus_g1_minus_48) ENTRY(NG_ret_i2_plus_g1_minus_56) sub %g1, 56, %g1 - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %i2, %g1, %i0 ENDPROC(NG_ret_i2_plus_g1_minus_56) ENTRY(NG_ret_i2_plus_i4_plus_16) add %i4, 16, %i4 - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %i2, %i4, %i0 ENDPROC(NG_ret_i2_plus_i4_plus_16) ENTRY(NG_ret_i2_plus_i4_plus_8) add %i4, 8, %i4 - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %i2, %i4, %i0 ENDPROC(NG_ret_i2_plus_i4_plus_8) ENTRY(NG_ret_i2_plus_8) - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %i2, 8, %i0 ENDPROC(NG_ret_i2_plus_8) ENTRY(NG_ret_i2_plus_4) - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %i2, 4, %i0 ENDPROC(NG_ret_i2_plus_4) ENTRY(NG_ret_i2_plus_1) - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %i2, 1, %i0 ENDPROC(NG_ret_i2_plus_1) ENTRY(NG_ret_i2_plus_g1_plus_1) add %g1, 1, %g1 - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %i2, %g1, %i0 ENDPROC(NG_ret_i2_plus_g1_plus_1) ENTRY(NG_ret_i2) - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi mov %i2, %i0 ENDPROC(NG_ret_i2) ENTRY(NG_ret_i2_and_7_plus_i4) and %i2, 7, %i2 - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %i2, %i4, %i0 ENDPROC(NG_ret_i2_and_7_plus_i4) ENTRY(NG_ret_i2_and_7_plus_i4_plus_8) and %i2, 7, %i2 add %i4, 8, %i4 - ba,pt %xcc, __restore_asi + ba,pt %xcc, .L__restore_asi add %i2, %i4, %i0 ENDPROC(NG_ret_i2_and_7_plus_i4) #endif
arch/sparc/lib/U1copy_from_user.S +6 -2
@@ -32,7 +32,11 @@ #define PREAMBLE \ rd %asi, %g1; \ cmp %g1, ASI_AIUS; \ - bne,pn %icc, raw_copy_in_user; \ - nop; \ + be,pt %icc, 1f; \ + nop; \ + set raw_copy_in_user, %g1; \ + jmpl %g1, %g0; \ + nop; \ +1:; \ #include "U1memcpy.S"
arch/sparc/lib/U1copy_to_user.S +6 -2
@@ -32,7 +32,11 @@ #define PREAMBLE \ rd %asi, %g1; \ cmp %g1, ASI_AIUS; \ - bne,pn %icc, raw_copy_in_user; \ - nop; \ + be,pt %icc, 1f; \ + nop; \ + set raw_copy_in_user, %g1; \ + jmpl %g1, %g0; \ + nop; \ +1:; \ #include "U1memcpy.S"
arch/sparc/lib/U3copy_to_user.S +6 -2
@@ -32,7 +32,11 @@ #define PREAMBLE \ rd %asi, %g1; \ cmp %g1, ASI_AIUS; \ - bne,pn %icc, raw_copy_in_user; \ - nop; \ + be,pt %icc, 1f; \ + nop; \ + set raw_copy_in_user, %g1; \ + jmpl %g1, %g0; \ + nop; \ +1:; \ #include "U3memcpy.S"
arch/sparc/lib/memmove.S +5 -1
@@ -17,8 +17,12 @@ ENTRY(memmove) /* o0=dst o1=src o2=len */ bleu,pt %xcc, 2f add %o1, %o2, %g7 cmp %g7, %o0 - bleu,pt %xcc, memcpy + bgu,pn %xcc, 1f add %o0, %o2, %o5 + set memcpy, %g7 + jmpl %g7, %g0 + nop +1: sub %g7, 1, %o1 sub %o5, 1, %o0
arch/sparc/mm/ultra.S +11 -5
@@ -189,6 +189,7 @@ __spitfire_flush_tlb_mm_slow: .section .kprobes.text, "ax" .align 32 .globl __flush_icache_page +.L__flush_icache_page: __flush_icache_page: /* %o0 = phys_page */ srlx %o0, PAGE_SHIFT, %o0 sethi %hi(PAGE_OFFSET), %g1
@@ -237,7 +238,7 @@ __flush_dcache_page: /* %o0=kaddr, %o1=flush_icache */ /* The I-cache does not snoop local stores so we * better flush that too when necessary. */ - brnz,pt %o1, __flush_icache_page + brnz,pt %o1, .L__flush_icache_page sllx %o0, 11, %o0 retl nop
@@ -642,7 +643,8 @@ xcall_sync_tick: rdpr %pil, %g2 wrpr %g0, PIL_NORMAL_MAX, %pil sethi %hi(109f), %g7 - b,pt %xcc, etrap_irq + set etrap_irq, %g1 + jmpl %g1, %g0 109: or %g7, %lo(109b), %g7 #ifdef CONFIG_TRACE_IRQFLAGS call trace_hardirqs_off
@@ -650,7 +652,8 @@ xcall_sync_tick: #endif call smp_synchronize_tick_client nop - b rtrap_xcall + set rtrap_xcall, %g1 + jmpl %g1, %g0 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1 .globl xcall_fetch_glob_regs
@@ -844,12 +847,15 @@ xcall_flush_dcache_page_spitfire: /* %g1 == physical page address __hypervisor_tlb_xcall_error: mov %g5, %g4 mov %g6, %g5 - ba,pt %xcc, etrap + set etrap, %g1 + jmpl %g1, %g0 rd %pc, %g7 mov %l4, %o0 call hypervisor_tlbop_error_xcall mov %l5, %o1 - ba,a,pt %xcc, rtrap + set rtrap, %g1 + jmpl %g1, %g0 + nop .globl __hypervisor_xcall_flush_tlb_mm __hypervisor_xcall_flush_tlb_mm: /* 24 insns */
Signature · 1 line
2.54.0
Hi Rosen,
Quoted 5 lines · Rosen Penev
LLD does not support several SPARC branch relocation types, including
R_SPARC_WDISP16,R_SPARC_WDISP19, andR_SPARC_WDISP22. A sparc64 allmodconfig LLVM build can therefore fail when trap table code and low-level assembly leave branches to global symbols for the linker.
Quoted 8 lines
Use local labels for branches that stay within the same assembled object so the assembler can resolve them directly. Convert the remaining cross-object branches and tail calls to absolute set/jmpl sequences, which LLD handles through the usual HI22/LO10 relocations.
Disable the unused sparc32 syscall trace entry points when compat support is not built, and request
sys_llseekfor the native syscall table so the LLD allmodconfig build remains self-contained.
I would rather fix LLD than making such intrusive changes to the SPARC code in the kernel. In particular, since this touches the CPU-optimized memory routines which had been haunted by subtle bugs for years and were only fixed recently.
Is improving LLD in this case not possible?
Adrian
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Quoted 18 lines · John Paul Adrian Glaubitz
Hi Rosen,
Quoted 5 lines · Rosen Penev
LLD does not support several SPARC branch relocation types, including
R_SPARC_WDISP16,R_SPARC_WDISP19, andR_SPARC_WDISP22. A sparc64 allmodconfig LLVM build can therefore fail when trap table code and low-level assembly leave branches to global symbols for the linker.Quoted 8 lines
Use local labels for branches that stay within the same assembled object so the assembler can resolve them directly. Convert the remaining cross-object branches and tail calls to absolute set/jmpl sequences, which LLD handles through the usual HI22/LO10 relocations.
Disable the unused sparc32 syscall trace entry points when compat support is not built, and request
sys_llseekfor the native syscall table so the LLD allmodconfig build remains self-contained.
Quoted 6 lines
I would rather fix LLD than making such intrusive changes to the SPARC code in the kernel. In particular, since this touches the CPU-optimized memory routines which had been haunted by subtle bugs for years and were only fixed recently.
Is improving LLD in this case not possible?
Above my paygrade. I use this so that allmodconfig succeeds.
Quoted 8 lines
Adrian
--
.''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Quoted 8 lines · Rosen Penev
Quoted 6 lines
I would rather fix LLD than making such intrusive changes to the SPARC code in the kernel. In particular, since this touches the CPU-optimized memory routines which had been haunted by subtle bugs for years and were only fixed recently.
Is improving LLD in this case not possible?
Above my paygrade. I use this so that allmodconfig succeeds.
The kernel must also work in the end. Being able to build it isn't really enough.
Adrian
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
+ Koakuma
Quoted 20 lines · Rosen Penev
Quoted 18 lines · John Paul Adrian Glaubitz
Hi Rosen,
Quoted 13 lines · Rosen Penev
LLD does not support several SPARC branch relocation types, including
R_SPARC_WDISP16,R_SPARC_WDISP19, andR_SPARC_WDISP22. A sparc64 allmodconfig LLVM build can therefore fail when trap table code and low-level assembly leave branches to global symbols for the linker.Use local labels for branches that stay within the same assembled object so the assembler can resolve them directly. Convert the remaining cross-object branches and tail calls to absolute set/jmpl sequences, which LLD handles through the usual HI22/LO10 relocations.
Disable the unused sparc32 syscall trace entry points when compat support is not built, and request
sys_llseekfor the native syscall table so the LLD allmodconfig build remains self-contained.
Quoted 7 lines
Quoted 6 lines
I would rather fix LLD than making such intrusive changes to the SPARC code in the kernel. In particular, since this touches the CPU-optimized memory routines which had been haunted by subtle bugs for years and were only fixed recently.
Is improving LLD in this case not possible?
Above my paygrade. I use this so that allmodconfig succeeds.
We document sparc64 as only having support for clang as the compiler (not even supporting the integrated assembler yet, although maybe that needs to be updated [1]?) in Documentation/kbuild/llvm.rst, so I don't think we should take a patch like this. As far as I am aware, ld.lld work for sparc64 has not happened yet to make it work with the kernel. If you need to test with clang, use CC=clang LLVM_IAS=0 with GNU binutils (CROSS_COMPILE=sparc64-linux-gnu-).
[1]: https://github.com/llvm/llvm-project/issues/40792
Signature · 2 lines
Cheers, Nathan
Quoted 39 lines · Nathan Chancellor
+ Koakuma
Quoted 20 lines · Rosen Penev
Quoted 18 lines · John Paul Adrian Glaubitz
Hi Rosen,
Quoted 13 lines · Rosen Penev
LLD does not support several SPARC branch relocation types, including
R_SPARC_WDISP16,R_SPARC_WDISP19, andR_SPARC_WDISP22. A sparc64 allmodconfig LLVM build can therefore fail when trap table code and low-level assembly leave branches to global symbols for the linker.Use local labels for branches that stay within the same assembled object so the assembler can resolve them directly. Convert the remaining cross-object branches and tail calls to absolute set/jmpl sequences, which LLD handles through the usual HI22/LO10 relocations.
Disable the unused sparc32 syscall trace entry points when compat support is not built, and request
sys_llseekfor the native syscall table so the LLD allmodconfig build remains self-contained.Quoted 7 lines
Quoted 6 lines
I would rather fix LLD than making such intrusive changes to the SPARC code in the kernel. In particular, since this touches the CPU-optimized memory routines which had been haunted by subtle bugs for years and were only fixed recently.
Is improving LLD in this case not possible?
Above my paygrade. I use this so that allmodconfig succeeds.
We document sparc64 as only having support for clang as the compiler (not even supporting the integrated assembler yet, although maybe that needs to be updated [1]?) in
Documentation/kbuild/llvm.rst, so I don't think we should take a patch like this. As far as I am aware, ld.lld work for sparc64 has not happened yet to make it work with the kernel. If you need to test with clang, use CC=clang LLVM_IAS=0 with GNU binutils (CROSS_COMPILE=sparc64-linux-gnu-).
Quoted 1 line
Yes, at the moment LLD only has very basic capabilities and still can't link the kernel, at least not without some rather invasive changes. (And even if you manage to land all the changes to the kernel, still there are many complex programs out there that's currently unlinkable by LLD that I feel like improving LLD would be a better use of resources, in the long term)
As for the integrated assembler, now that PR 187534 [1] is merged it should be possible to build the kernel with IAS, but that commit hasn't made it into a release yet so I don't feel like it's the time to update the kernel's docs... maybe?
Quoted 5 lines · Koakuma
Yes, at the moment LLD only has very basic capabilities and still can't link the kernel, at least not without some rather invasive changes. (And even if you manage to land all the changes to the kernel, still there are many complex programs out there that's currently unlinkable by LLD that I feel like improving LLD would be a better use of resources, in the long term)
Agreed and that is generally what we tried to do for all other architectures, I don't think SPARC is special here.
Quoted 6 lines
As for the integrated assembler, now that PR 187534 [1] is merged it should be possible to build the kernel with IAS, but that commit hasn't made it into a release yet so I don't feel like it's the time to update the kernel's docs... maybe?
Yeah, we can update the documentation when 23.1.0 is out, but I should update our CI to test sparc64_defconfig with the integrated assembler for clang-23+ because we test from main.
Signature · 2 lines
Cheers, Nathan