Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xtensa: don't use l32r opcode directly

xtensa assembler is capable of representing register loads with either
movi + addmi, l32r or const16, depending on the core configuration.
Don't use '.literal' and 'l32r' directly in the code, use 'movi' and let
the assembler relax them.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

+24 -31
+14 -15
arch/xtensa/boot/boot-elf/bootstrap.S
··· 29 29 .begin no-absolute-literals 30 30 .literal_position 31 31 32 - #if defined(CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX) && \ 33 - XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY 34 - .literal RomInitAddr, CONFIG_KERNEL_LOAD_ADDRESS 35 - #else 36 - .literal RomInitAddr, KERNELOFFSET 37 - #endif 38 - #ifndef CONFIG_PARSE_BOOTPARAM 39 - .literal RomBootParam, 0 40 - #else 41 - .literal RomBootParam, _bootparam 42 - 32 + #ifdef CONFIG_PARSE_BOOTPARAM 43 33 .align 4 44 34 _bootparam: 45 35 .short BP_TAG_FIRST ··· 56 66 initialize_mmu 57 67 #endif 58 68 59 - .end no-absolute-literals 60 - 61 69 rsil a0, XCHAL_DEBUGLEVEL-1 62 70 rsync 63 71 reset: 64 - l32r a0, RomInitAddr 65 - l32r a2, RomBootParam 72 + #if defined(CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX) && \ 73 + XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY 74 + movi a0, CONFIG_KERNEL_LOAD_ADDRESS 75 + #else 76 + movi a0, KERNELOFFSET 77 + #endif 78 + #ifdef CONFIG_PARSE_BOOTPARAM 79 + movi a2, _bootparam 80 + #else 81 + movi a2, 0 82 + #endif 66 83 movi a3, 0 67 84 movi a4, 0 68 85 jx a0 86 + 87 + .end no-absolute-literals
+4 -4
arch/xtensa/include/asm/futex.h
··· 32 32 "3:\n" \ 33 33 " .section .fixup,\"ax\"\n" \ 34 34 " .align 4\n" \ 35 - "4: .long 3b\n" \ 36 - "5: l32r %0, 4b\n" \ 35 + " .literal_position\n" \ 36 + "5: movi %0, 3b\n" \ 37 37 " movi %1, %3\n" \ 38 38 " jx %0\n" \ 39 39 " .previous\n" \ ··· 108 108 "2:\n" 109 109 " .section .fixup,\"ax\"\n" 110 110 " .align 4\n" 111 - "3: .long 2b\n" 112 - "4: l32r %1, 3b\n" 111 + " .literal_position\n" 112 + "4: movi %1, 2b\n" 113 113 " movi %0, %7\n" 114 114 " jx %1\n" 115 115 " .previous\n"
+4 -6
arch/xtensa/include/asm/uaccess.h
··· 159 159 "2: \n" \ 160 160 " .section .fixup,\"ax\" \n" \ 161 161 " .align 4 \n" \ 162 - "4: \n" \ 163 - " .long 2b \n" \ 162 + " .literal_position \n" \ 164 163 "5: \n" \ 165 - " l32r %1, 4b \n" \ 164 + " movi %1, 2b \n" \ 166 165 " movi %0, %4 \n" \ 167 166 " jx %1 \n" \ 168 167 " .previous \n" \ ··· 216 217 "2: \n" \ 217 218 " .section .fixup,\"ax\" \n" \ 218 219 " .align 4 \n" \ 219 - "4: \n" \ 220 - " .long 2b \n" \ 220 + " .literal_position \n" \ 221 221 "5: \n" \ 222 - " l32r %1, 4b \n" \ 222 + " movi %1, 2b \n" \ 223 223 " movi %2, 0 \n" \ 224 224 " movi %0, %4 \n" \ 225 225 " jx %1 \n" \
+2 -6
arch/xtensa/kernel/head.S
··· 59 59 60 60 .align 4 61 61 .literal_position 62 - .Lstartup: 63 - .word _startup 64 - 65 - .align 4 66 62 _SetupOCD: 67 63 /* 68 64 * Initialize WB, WS, and clear PS.EXCM (to allow loop instructions). ··· 95 99 1: 96 100 #endif 97 101 #endif 98 - .end no-absolute-literals 99 102 100 - l32r a0, .Lstartup 103 + movi a0, _startup 101 104 jx a0 102 105 103 106 ENDPROC(_start) 107 + .end no-absolute-literals 104 108 105 109 __REF 106 110 .literal_position