aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-02-04MIPS: of: Introduce helper function to get DTBThomas Bogendoerfer10-77/+39
Selection of the DTB to be used was burried in more or less readable code in head.S. Move this code into a inline helper function and use it. Signed-off-by: Thomas Bogendoerfer <[email protected]> Acked-by: Florian Fainelli <[email protected]>
2021-02-03arch: mips: kernel: Fix two spelling in smp.cBhaskar Chowdhury1-3/+3
s/logcal/logical/ s/intercpu/inter-CPU/ Signed-off-by: Bhaskar Chowdhury <[email protected]> Acked-by: Randy Dunlap <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-02-03MIPS: malta-time: remove unneeded semicolonYang Li1-1/+1
Eliminate the following coccicheck warning: ./arch/mips/mti-malta/malta-time.c:141:2-3: Unneeded semicolon Reported-by: Abaci Robot <[email protected]> Signed-off-by: Yang Li <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-02-03KVM: MIPS: remove unneeded semicolonYang Li1-1/+1
Eliminate the following coccicheck warning: ./arch/mips/kvm/mips.c:151:2-3: Unneeded semicolon Reported-by: Abaci Robot <[email protected]> Signed-off-by: Yang Li <[email protected]> Reviewed-by: Huacai Chen <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-02-03MIPS: fix kernel_stack_pointer()Huang Pei1-1/+1
MIPS always save kernel stack pointer in regs[29] Signed-off-by: Huang Pei <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-27MIPS: Fix inline asm input/output type mismatch in checksum.h used with ClangTiezhu Yang1-2/+4
Fix the following build error when make M=samples/bpf used with Clang: CLANG-bpf samples/bpf/sockex2_kern.o In file included from samples/bpf/sockex2_kern.c:7: In file included from ./include/uapi/linux/if_tunnel.h:7: In file included from ./include/linux/ip.h:16: In file included from ./include/linux/skbuff.h:28: In file included from ./include/net/checksum.h:22: ./arch/mips/include/asm/checksum.h:161:9: error: unsupported inline asm: input with type 'unsigned long' matching output with type '__wsum' (aka 'unsigned int') : "0" ((__force unsigned long)daddr), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. This is a known issue on MIPS [1], the changed code can be compiled successfully by both GCC and Clang. [1] https://lore.kernel.org/linux-mips/CAG_fn=W0JHf8QyUX==+rQMp8PoULHrsQCa9Htffws31ga8k-iw@mail.gmail.com/ Signed-off-by: Tiezhu Yang <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-27MIPS: mm:remove function __uncached_access()Yanteng Si2-15/+0
MIPS can now use the default uncached_access like other archs. Signed-off-by: Yanteng Si <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-27MIPS: loongson2ef: remove function __uncached_access()Yanteng Si1-11/+0
We no longer need the MESA workaround, so remove it. Signed-off-by: Yanteng Si <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-27MIPS: asm: spram: remove unneeded semicolonChengyang Fan1-1/+1
Remove a superfluous semicolon after function definition. Signed-off-by: Chengyang Fan <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-27MIPS: vpe: Remove vpe_getcwdThomas Bogendoerfer2-36/+0
I couldn't find any user of the dubious vpe_getcwd so far. So remove it and get rid of another set_fs(KERNEL_DS). Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-27mips: cacheinfo: Remove unnecessary increment of levelSouptick Joarder1-3/+1
kernel test robot throws below warning -> arch/mips/kernel/cacheinfo.c:112:3: warning: Variable 'level' is modified but its new value is never used. [unreadVariable] Remove unnecessary increment of level at the end. Reported-by: kernel test robot <[email protected]> Signed-off-by: Souptick Joarder <[email protected]> Reviewed-by: Jiaxun Yang <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-25MIPS: Add is_jr_ra_ins() to end the loop earlyJinyang He1-1/+33
For those leaf functions, they are likely to have no stack operations. Add is_jr_ra_ins() to determine whether jr ra has been touched before the frame_size is found. Without this patch, the get frame_size operation may be out of range and get the frame_size from the next nested function. There is no POOL32A format in uapi/asm/inst.h, so some bits here use the format of r_format instead. e.g. --------------------------------------------------------------------- | format | 31:26 | 25:21 | 20:16 | 15:6 | 5:0 | -----------------+---------+-------+-------+------------+------------ | pool32a_format | pool32a | rt | rs | jalrc | pool32axf | -----------------+---------+-------+-------+------------+------------ | r_format | opcode | rs | rt | rd:5, re:5 | func | --------------------------------------------------------------------- Signed-off-by: Jinyang He <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-25MIPS: Fix get_frame_info() handing of function sizeJinyang He1-4/+4
[1]: Commit b6c7a324df37b ("MIPS: Fix get_frame_info() handling of microMIPS function size") [2]: Commit 2b424cfc69728 ("MIPS: Remove function size check in get_frame_info()") First patch added a constant to check the number of iterations against. Second patch fixed the situation that info->func_size is zero. However, func_size member became useless after the second commit. Without ip_end, the get frame_size operation may be out of range although KALLSYMS enabled. Thus, check func_size first. Then make ip_end be the sum of ip and a constant (512) if func_size is equal to 0. Otherwise make ip_end be the sum of ip and func_size. Signed-off-by: Jinyang He <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-25MIPS: microMIPS: Fix the judgment of mm_jr16_op and mm_jalr_opJinyang He1-3/+3
mm16_r5_format.rt is 5 bits, so directly judge the value if equal or not. mm_jalr_op requires 7th to 16th bits. These 10 which bits generated by shifting u_format.uimmediate by 6 may be affected by sign extension. Thus, take out the 10 bits for comparison. Without this patch, errors may occur, such as these bits are all ones. Signed-off-by: Jinyang He <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-25MIPS: process: Remove unnecessary headers inclusionJinyang He1-29/+12
Some headers are not necessary, remove them and sort includes. Signed-off-by: Jinyang He <[email protected]> Reviewed-by: Huacai Chen <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-25MAINTAINERS: Update my e-mail address throughoutMaciej W. Rozycki2-6/+7
I find linux-mips.org too unreliable to rely on, so move to a place I have proper control over. Signed-off-by: Maciej W. Rozycki <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-25sound: Add n64 driverLauri Kasanen3-0/+380
This adds support for the Nintendo 64 console's sound. Signed-off-by: Lauri Kasanen <[email protected]> Reviewed-by: Takashi Iwai <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-22MIPS: make kgdb depend on FPU supportArnd Bergmann1-1/+1
kgdb fails to build when the FPU support is disabled: arch/mips/kernel/kgdb.c: In function 'dbg_set_reg': arch/mips/kernel/kgdb.c:147:35: error: 'struct thread_struct' has no member named 'fpu' 147 | memcpy((void *)&current->thread.fpu.fcr31, mem, | ^ arch/mips/kernel/kgdb.c:155:34: error: 'struct thread_struct' has no member named 'fpu' 155 | memcpy((void *)&current->thread.fpu.fpr[fp_reg], mem, This is only relevant for CONFIG_EXPERT=y, so disallowing it in Kconfig is an easier workaround than fixing it properly. Reported-by: kernel test robot <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-22MIPS: jazz: always allow little-endian buildsArnd Bergmann2-3/+1
The kernel test robot keeps reporting the same bug when it shows up in new files after random unrelated patches: In file included from arch/mips/include/uapi/asm/byteorder.h:13, from arch/mips/include/asm/bitops.h:20, from include/linux/bitops.h:26, from include/linux/kernel.h:12, from include/linux/clk.h:13, from drivers/base/regmap/regmap-mmio.c:7: include/linux/byteorder/big_endian.h:8:2: warning: #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN [-Wcpp] 8 | #warning inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN | ^~~~~~~ drivers/base/regmap/regmap-mmio.c: In function 'regmap_mmio_gen_context': >> drivers/base/regmap/regmap-mmio.c:274:2: error: duplicate case value 274 | case REGMAP_ENDIAN_NATIVE: | ^~~~ drivers/base/regmap/regmap-mmio.c:246:2: note: previously used here 246 | case REGMAP_ENDIAN_NATIVE: The problem is that some randconfig builds end up on the MIPS jazz platform with neither CONFIG_CPU_BIG_ENDIAN nor CONFIG_CPU_LITTLE_ENDIAN because no specific machine is selected. As it turns out, all jazz machines support little-endian kernels, so this can simply be allowed globally. Reported-by: kernel test robot <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-22MIPS: Make definitions of MIPSInst_FMA_{FUNC,FMTM} consistent with MIPS64 manualTiezhu Yang1-3/+3
The kernel definitions of MIPSInst_FMA_FUNC and MIPSInst_FMA_FFMT are not consistent with MADD.fmt, NMADD.fmt and NMSUB.fmt in the MIPS64 manual [1], the field func is bit 5..3 and fmt is bit 2..0, fix them. Otherwise there exists error when add new instruction simulation. [1] https://www.mips.com/?do-download=the-mips64-instruction-set-v6-06 Reported-by: Ming Wang <[email protected]> Signed-off-by: Tiezhu Yang <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-22mips: Add N64 machine typeLauri Kasanen8-0/+223
Add support for the Nintendo 64. Signed-off-by: Lauri Kasanen <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-22Revert "MIPS: Remove unused R4300 CPU support"Lauri Kasanen9-1/+33
This reverts commit f9065b54d437c4660e3d974ad9ce5188c068cd76. We're adding Nintendo 64 support, so the VR4300 is no longer unused. Signed-off-by: Lauri Kasanen <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-22MIPS: mm: Add prototype for function __update_cacheYanteng Si2-1/+2
This commit adds a prototype to fix error at W=1: arch/mips/mm/cache.c:129:6: error: no previous prototype for '__update_cache' [-Werror=missing-prototypes] Signed-off-by: Yanteng Si <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-22MIPS: mm: abort uaccess retries upon fatal signalThomas Bogendoerfer1-1/+4
When there's a fatal signal pending, MIPS's do_page_fault() implementation returns. The intent is that we'll return to the faulting userspace instruction, delivering the signal on the way. However, if we take a fatal signal during fixing up a uaccess, this results in a return to the faulting kernel instruction, which will be instantly retried, resulting in the same fault being taken forever. As the task never reaches userspace, the signal is not delivered, and the task is left unkillable. While the task is stuck in this state, it can inhibit the forward progress of the system. To avoid this, we must ensure that when a fatal signal is pending, we apply any necessary fixup for a faulting kernel instruction. Thus we will return to an error path, and it is up to that code to make forward progress towards delivering the fatal signal. [ Description taken from commit 746a272e4414 ("ARM: 8692/1: mm: abort uaccess retries upon fatal signal") ] Signed-off-by: Thomas Bogendoerfer <[email protected]> Acked-by: Mark Rutland <[email protected]>
2021-01-19MIPS: IRQ: Add prototype for function init_IRQYanteng Si1-0/+1
This commit adds a prototype to fix error at W=1: arch/mips/kernel/irq.c:52:13: error: no previous prototype for 'init_IRQ' [-Werror=missing-prototypes] Signed-off-by: Yanteng Si <[email protected]> Reviewed-by: Huacai Chen <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-19Revert "MIPS: Octeon: Remove special handling of CONFIG_MIPS_ELF_APPENDED_DTB=y"Kevin Hao1-3/+6
This reverts commit d9df9fb901d25b941ab2cfb5b570d91fb2abf7a3. For the OCTEON boards, it need to patch the built-in DTB before using it. Previously it judges if it is a built-in DTB by checking fw_passed_dtb. But after commit 37e5c69ffd41 ("MIPS: head.S: Init fw_passed_dtb to builtin DTB", the fw_passed_dtb is initialized even when using built-in DTB. This causes the OCTEON boards boot broken due to an unpatched built-in DTB is used. Revert the commit d9df9fb901d2 to restore the codes before the fw_passed_dtb is used and then fix this issue. Fixed: 37e5c69ffd41 ("MIPS: head.S: Init fw_passed_dtb to builtin DTB") Cc: [email protected] Suggested-by: Thomas Bogendoerfer <[email protected]> Signed-off-by: Kevin Hao <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-18MIPS: relocatable: optimize the relocation processAlexander Lobakin1-24/+30
For now, vmlinux relocation functions for relocatable kernel are implemented as an array of handlers of a particular type. Convert that array into a single switch-case function to: - remove unused arguments; - change the return type of simple handlers to void; - remove the array and don't use any data at all; - avoid using indirect calls; - allow the compiler to inline and greatly optimize the relocation function[s]; and also mark do_relocations() and show_kernel_relocation() static as they aren't used anywhere else. The result on MIPS32 R2 with GCC 10.2 -O2 is: scripts/bloat-o-meter -c arch/mips/kernel/__relocate.o arch/mips/kernel/relocate.o add/remove: 0/6 grow/shrink: 1/0 up/down: 356/-640 (-284) Function old new delta relocate_kernel 852 1208 +356 apply_r_mips_32_rel 20 - -20 apply_r_mips_hi16_rel 40 - -40 apply_r_mips_64_rel 44 - -44 apply_r_mips_26_rel 144 - -144 show_kernel_relocation 164 - -164 do_relocations 228 - -228 Total: Before=1780, After=1496, chg -15.96% add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-76 (-76) Data old new delta reloc_handlers_rel 76 - -76 Total: Before=92, After=16, chg -82.61% add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0) RO Data old new delta Total: Before=0, After=0, chg +0.00% All functions were collapsed into the main one, relocate_kernel(). Signed-off-by: Alexander Lobakin <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-18MIPS: module: optimize module relocations processingAlexander Lobakin1-57/+52
For now, module relocation functions are implemented as an array of handlers of type reloc_handler_t. Convert that array into a single switch-case function to: - remove unused arguments; - change the return type of simple handlers to void; - remove the array and don't use any data at all; - avoid using indirect calls; - allow the compiler to inline and greatly optimize the relocation function[s]. The result on MIPS32 R2 with GCC 10.2 -O2 is: scripts/bloat-o-meter -c arch/mips/kernel/__module.o arch/mips/kernel/module.o add/remove: 1/11 grow/shrink: 1/0 up/down: 876/-1436 (-560) Function old new delta apply_relocate 456 1148 +692 apply_r_mips_pc - 184 +184 apply_r_mips_none 8 - -8 apply_r_mips_32 16 - -16 apply_r_mips_64 76 - -76 apply_r_mips_highest 88 - -88 apply_r_mips_higher 108 - -108 apply_r_mips_26 132 - -132 apply_r_mips_pc26 160 - -160 apply_r_mips_pc21 160 - -160 apply_r_mips_pc16 160 - -160 apply_r_mips_hi16 172 - -172 apply_r_mips_lo16 356 - -356 Total: Before=2608, After=2048, chg -21.47% add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0) Data old new delta Total: Before=12, After=12, chg +0.00% add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-248 (-248) RO Data old new delta reloc_handlers 248 - -248 Total: Before=248, After=0, chg -100.00% All functions were collapsed into a single one that is called directly by $(srctree)/kernel/module.c. Signed-off-by: Alexander Lobakin <[email protected]> Reviewed-by: Jiaxun Yang <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-18MIPS: VDSO: Use CLANG_FLAGS instead of filtering out '--target='Nathan Chancellor1-4/+1
Commit ee67855ecd9d ("MIPS: vdso: Allow clang's --target flag in VDSO cflags") allowed the '--target=' flag from the main Makefile to filter through to the vDSO. However, it did not bring any of the other clang specific flags for controlling the integrated assembler and the GNU tools locations (--prefix=, --gcc-toolchain=, and -no-integrated-as). Without these, we will get a warning (visible with tinyconfig): arch/mips/vdso/elf.S:14:1: warning: DWARF2 only supports one section per compilation unit .pushsection .note.Linux, "a",@note ; .balign 4 ; .long 2f - 1f ; .long 4484f - 3f ; .long 0 ; 1:.asciz "Linux" ; 2:.balign 4 ; 3: ^ arch/mips/vdso/elf.S:34:2: warning: DWARF2 only supports one section per compilation unit .section .mips_abiflags, "a" ^ All of these flags are bundled up under CLANG_FLAGS in the main Makefile and exported so that they can be added to Makefiles that set their own CFLAGS. Use this value instead of filtering out '--target=' so there is no warning and all of the tools are properly used. Cc: [email protected] Fixes: ee67855ecd9d ("MIPS: vdso: Allow clang's --target flag in VDSO cflags") Link: https://github.com/ClangBuiltLinux/linux/issues/1256 Reported-by: Anders Roxell <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Tested-by: Anders Roxell <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-18MIPS: Ingenic: Disable HPTLB for D0 XBurst CPUs tooPaul Cercueil1-7/+8
The JZ4760 has the HPTLB as well, but has a XBurst CPU with a D0 CPUID. Disable the HPTLB for all XBurst CPUs with a D0 CPUID. In the case where there is no HPTLB (e.g. for older SoCs), this won't have any side effect. Fixes: b02efeb05699 ("MIPS: Ingenic: Disable abandoned HPTLB function.") Cc: <[email protected]> # 5.4 Signed-off-by: Paul Cercueil <[email protected]> Reviewed-by: 周琰杰 (Zhou Yanjie) <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-15MIPS: Support binutils configured with --enable-mips-fix-loongson3-llsc=yesAurelien Jarno2-22/+19
From version 2.35, binutils can be configured with --enable-mips-fix-loongson3-llsc=yes, which means it defaults to -mfix-loongson3-llsc. This breaks labels which might then point at the wrong instruction. The workaround to explicitly pass -mno-fix-loongson3-llsc has been added in Linux version 5.1, but is only enabled when building a Loongson 64 kernel. As vendors might use a common toolchain for building Loongson and non-Loongson kernels, just move that workaround to arch/mips/Makefile. At the same time update the comments to reflect the current status. Cc: [email protected] # 5.1+ Cc: YunQiang Su <[email protected]> Signed-off-by: Aurelien Jarno <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-15MIPS: Compare __SYNC_loongson3_war against 0Nathan Chancellor2-4/+4
When building with clang when CONFIG_CPU_LOONGSON3_WORKAROUNDS is enabled: In file included from lib/errseq.c:4: In file included from ./include/linux/atomic.h:7: ./arch/mips/include/asm/atomic.h:52:1: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare] ATOMIC_OPS(atomic64, s64) ^ ./arch/mips/include/asm/atomic.h:40:9: note: expanded from macro 'ATOMIC_OPS' return cmpxchg(&v->counter, o, n); ^ ./arch/mips/include/asm/cmpxchg.h:194:7: note: expanded from macro 'cmpxchg' if (!__SYNC_loongson3_war) ^ ./arch/mips/include/asm/sync.h:147:34: note: expanded from macro '__SYNC_loongson3_war' # define __SYNC_loongson3_war (1 << 31) ^ While it is not wrong that the result of this shift is always true in a boolean context, it is not a problem here. Regardless, the warning is really noisy so rather than making the shift a boolean implicitly, use it in an equality comparison so the shift is used as an integer value. Fixes: 4d1dbfe6cbec ("MIPS: atomic: Emit Loongson3 sync workarounds within asm") Fixes: a91f2a1dba44 ("MIPS: cmpxchg: Omit redundant barriers for Loongson3") Reported-by: kernel test robot <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Acked-by: Nick Desaulniers <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-15MIPS: pgtable: fix -Wshadow in asm/pgtable.hAlexander Lobakin1-6/+6
Solves the following repetitive warning when building with -Wshadow: In file included from ./include/linux/pgtable.h:6, from ./include/linux/mm.h:33, from ./include/linux/dax.h:6, from ./include/linux/mempolicy.h:11, from kernel/fork.c:34: ./arch/mips/include/asm/mmu_context.h: In function ‘switch_mm’: ./arch/mips/include/asm/pgtable.h:97:16: warning: declaration of ‘flags’ shadows a previous local [-Wshadow] 97 | unsigned long flags; \ | ^~~~~ ./arch/mips/include/asm/mmu_context.h:162:2: note: in expansion of macro ‘htw_stop’ 162 | htw_stop(); | ^~~~~~~~ In file included from kernel/fork.c:102: ./arch/mips/include/asm/mmu_context.h:159:16: note: shadowed declaration is here 159 | unsigned long flags; | ^~~~~ Signed-off-by: Alexander Lobakin <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-15MIPS: bitops: fix -Wshadow in asm/bitops.hAlexander Lobakin1-5/+5
Solves the following repetitive warning when building with -Wshadow: In file included from ./include/linux/bitops.h:32, from ./include/linux/kernel.h:11, from ./include/linux/skbuff.h:13, from ./include/linux/if_ether.h:19, from ./include/linux/etherdevice.h:20: ./arch/mips/include/asm/bitops.h: In function ‘test_and_set_bit_lock’: ./arch/mips/include/asm/bitops.h:46:16: warning: declaration of ‘orig’ shadows a previous local [-Wshadow] 46 | unsigned long orig, temp; \ | ^~~~ ./arch/mips/include/asm/bitops.h:190:10: note: in expansion of macro ‘__test_bit_op’ 190 | orig = __test_bit_op(*m, "%0", | ^~~~~~~~~~~~~ ./arch/mips/include/asm/bitops.h:185:21: note: shadowed declaration is here 185 | unsigned long res, orig; | ^~~~ ./arch/mips/include/asm/bitops.h: In function ‘test_and_clear_bit’: ./arch/mips/include/asm/bitops.h:46:16: warning: declaration of ‘orig’ shadows a previous local [-Wshadow] 46 | unsigned long orig, temp; \ | ^~~~ ./arch/mips/include/asm/bitops.h:236:9: note: in expansion of macro ‘__test_bit_op’ 236 | res = __test_bit_op(*m, "%1", | ^~~~~~~~~~~~~ ./arch/mips/include/asm/bitops.h:229:21: note: shadowed declaration is here 229 | unsigned long res, orig; | ^~~~ ./arch/mips/include/asm/bitops.h:46:16: warning: declaration of ‘orig’ shadows a previous local [-Wshadow] 46 | unsigned long orig, temp; \ | ^~~~ ./arch/mips/include/asm/bitops.h:241:10: note: in expansion of macro ‘__test_bit_op’ 241 | orig = __test_bit_op(*m, "%0", | ^~~~~~~~~~~~~ ./arch/mips/include/asm/bitops.h:229:21: note: shadowed declaration is here 229 | unsigned long res, orig; | ^~~~ ./arch/mips/include/asm/bitops.h: In function ‘test_and_change_bit’: ./arch/mips/include/asm/bitops.h:46:16: warning: declaration of ‘orig’ shadows a previous local [-Wshadow] 46 | unsigned long orig, temp; \ | ^~~~ ./arch/mips/include/asm/bitops.h:273:10: note: in expansion of macro ‘__test_bit_op’ 273 | orig = __test_bit_op(*m, "%0", | ^~~~~~~~~~~~~ ./arch/mips/include/asm/bitops.h:266:21: note: shadowed declaration is here 266 | unsigned long res, orig; | ^~~~ Signed-off-by: Alexander Lobakin <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-15MIPS: select ARCH_WANT_LD_ORPHAN_WARNAlexander Lobakin1-0/+1
Now, after that all the sections are explicitly described and declared in vmlinux.lds.S, we can enable ld orphan warnings to prevent from missing any new sections in future. Signed-off-by: Alexander Lobakin <[email protected]> Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-15vmlinux.lds.h: catch UBSAN's "unnamed data" into dataAlexander Lobakin1-1/+1
When building kernel with both LD_DEAD_CODE_DATA_ELIMINATION and UBSAN, LLVM stack generates lots of "unnamed data" sections: ld.lld: warning: net/built-in.a(netfilter/utils.o): (.data.$__unnamed_2) is being placed in '.data.$__unnamed_2' ld.lld: warning: net/built-in.a(netfilter/utils.o): (.data.$__unnamed_3) is being placed in '.data.$__unnamed_3' ld.lld: warning: net/built-in.a(netfilter/utils.o): (.data.$__unnamed_4) is being placed in '.data.$__unnamed_4' ld.lld: warning: net/built-in.a(netfilter/utils.o): (.data.$__unnamed_5) is being placed in '.data.$__unnamed_5' [...] Also handle this by adding the related sections to generic definitions. Signed-off-by: Alexander Lobakin <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-15vmlinux.lds.h: catch compound literals into data and BSSAlexander Lobakin1-3/+3
When building kernel with LD_DEAD_CODE_DATA_ELIMINATION, LLVM stack generates separate sections for compound literals, just like in case with enabled LTO [0]: ld.lld: warning: drivers/built-in.a(mtd/nand/spi/gigadevice.o): (.data..compoundliteral.14) is being placed in '.data..compoundliteral.14' ld.lld: warning: drivers/built-in.a(mtd/nand/spi/gigadevice.o): (.data..compoundliteral.15) is being placed in '.data..compoundliteral.15' ld.lld: warning: drivers/built-in.a(mtd/nand/spi/gigadevice.o): (.data..compoundliteral.16) is being placed in '.data..compoundliteral.16' ld.lld: warning: drivers/built-in.a(mtd/nand/spi/gigadevice.o): (.data..compoundliteral.17) is being placed in '.data..compoundliteral.17' [...] Handle this by adding the related sections to generic definitions as suggested by Sami [0]. [0] https://lore.kernel.org/lkml/[email protected] Suggested-by: Sami Tolvanen <[email protected]> Suggested-by: Kees Cook <[email protected]> Signed-off-by: Alexander Lobakin <[email protected]> Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-15MIPS: vmlinux.lds.S: explicitly declare .got tableAlexander Lobakin1-0/+2
LLVM stack generates GOT table when building the kernel: ld.lld: warning: <internal>:(.got) is being placed in '.got' According to the debug assertions, it's not zero-sized and thus can't be handled the way it's done for x86. Also use the ARM64 path here and place it at the end of .text section. Reported-by: Nathan Chancellor <[email protected]> Signed-off-by: Alexander Lobakin <[email protected]> Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-15MIPS: vmlinux.lds.S: explicitly catch .rel.dyn symbolsAlexander Lobakin1-0/+5
According to linker warnings, both GCC and LLVM generate '.rel.dyn' symbols: mips-alpine-linux-musl-ld: warning: orphan section `.rel.dyn' from `init/main.o' being placed in section `.rel.dyn' Link-time assertion shows that this section is sometimes empty, sometimes not, depending on machine bitness and the compiler [0]: LD .tmp_vmlinux.kallsyms1 mips64-linux-gnu-ld: Unexpected run-time relocations (.rel) detected! Just use the ARM64 approach and declare it in vmlinux.lds.S closer to __init_end. [0] https://lore.kernel.org/linux-mips/[email protected] Reported-by: Thomas Bogendoerfer <[email protected]> Signed-off-by: Alexander Lobakin <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-15MIPS: properly stop .eh_frame generationAlexander Lobakin2-1/+18
Commit 866b6a89c6d1 ("MIPS: Add DWARF unwinding to assembly") added -fno-asynchronous-unwind-tables to KBUILD_CFLAGS to prevent compiler from emitting .eh_frame symbols. However, as MIPS heavily uses CFI, that's not enough. Use the approach taken for x86 (as it also uses CFI) and explicitly put CFI symbols into the .debug_frame section (except for VDSO). This allows us to drop .eh_frame from DISCARDS as it's no longer being generated. Fixes: 866b6a89c6d1 ("MIPS: Add DWARF unwinding to assembly") Suggested-by: Kees Cook <[email protected]> Signed-off-by: Alexander Lobakin <[email protected]> Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-15MIPS: vmlinux.lds.S: add ".gnu.attributes" to DISCARDSAlexander Lobakin1-0/+1
Discard GNU attributes (MIPS FP type, GNU Hash etc.) at link time as kernel doesn't use it at all. Solves a dozen of the following ld warnings (one per every file): mips-alpine-linux-musl-ld: warning: orphan section `.gnu.attributes' from `arch/mips/kernel/head.o' being placed in section `.gnu.attributes' mips-alpine-linux-musl-ld: warning: orphan section `.gnu.attributes' from `init/main.o' being placed in section `.gnu.attributes' Signed-off-by: Alexander Lobakin <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-15MIPS: CPS: don't create redundant .text.cps-vec sectionAlexander Lobakin2-2/+0
A number of symbols from arch/mips/kernel/cps-vec.S is explicitly placed into '.text.cps-vec' section. There are no direct references to this section, so there's no need to form it. '.balign 0x1000' directive will work anyway. Moreover, this section was being placed in vmlinux differently depending on CONFIG_LD_DEAD_CODE_DATA_ELIMINATION: - with this option enabled, '.text.cps-vec' was being caught by '.text.[0-9a-zA-Z_]*' from include/asm-generic/vmlinux.lds.h; - without this option, '.text.cps-vec' was being caught by discouraging '.text.*' from arch/mips/kernel/vmlinux.lds.S. '.text.*' should not be used in vmlinux linker scripts at all as it silently catches any orphan text sections. So, remove both '.section .text.cps-vec' and '.text.*' from cps-vec.S and vmlinux.lds.S respectively. As said, this does not affect related functions alignment: 80116000 T mips_cps_core_entry 80116028 t not_nmi 80116200 T excep_tlbfill 80116280 T excep_xtlbfill 80116300 T excep_cache 80116380 T excep_genex 80116400 T excep_intex 80116480 T excep_ejtag 80116490 T mips_cps_core_init Signed-off-by: Alexander Lobakin <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-15MIPS: vmlinux.lds.S: add missing PAGE_ALIGNED_DATA() sectionAlexander Lobakin1-0/+1
MIPS uses its own declaration of rwdata, and thus it should be kept in sync with the asm-generic one. Currently PAGE_ALIGNED_DATA() is missing from the linker script, which emits the following ld warnings: mips-alpine-linux-musl-ld: warning: orphan section `.data..page_aligned' from `arch/mips/kernel/vdso.o' being placed in section `.data..page_aligned' mips-alpine-linux-musl-ld: warning: orphan section `.data..page_aligned' from `arch/mips/vdso/vdso-image.o' being placed in section `.data..page_aligned' Add the necessary declaration, so the mentioned structures will be placed in vmlinux as intended: ffffffff80630580 D __end_once ffffffff80630580 D __start___dyndbg ffffffff80630580 D __start_once ffffffff80630580 D __stop___dyndbg ffffffff80634000 d mips_vdso_data ffffffff80638000 d vdso_data ffffffff80638580 D _gp ffffffff8063c000 T __init_begin ffffffff8063c000 D _edata ffffffff8063c000 T _sinittext -> ffffffff805a4000 D __end_init_task ffffffff805a4000 D __nosave_begin ffffffff805a4000 D __nosave_end ffffffff805a4000 d mips_vdso_data ffffffff805a8000 d vdso_data ffffffff805ac000 D mmlist_lock ffffffff805ac080 D tasklist_lock Fixes: ebb5e78cc634 ("MIPS: Initial implementation of a VDSO") Signed-off-by: Alexander Lobakin <[email protected]> Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Cc: [email protected] # 4.4+ Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-13MIPS: lantiq: irq: register the interrupt controllers with irqchip_initMartin Blumenstingl1-5/+3
Add support for more interrupt controllers by switching from of_irq_init() to irqchip_init() in Lantiq's arch_init_irq(). This requires switching the ICU interrupt controller to use IRQCHIP_DECLARE(), like a real irqchip driver would do. This is needed for future changes when new irqchip drivers are implemented: - a dedicated driver for the EIU interrupt controller - a driver for the MSI PIC (Programmable Interrupt Controller) found on VRX200 and newer SoCs - ..or any other driver which uses IRQCHIP_DECLARE Signed-off-by: Martin Blumenstingl <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-13dt-bindings: mips: lantiq: Document Lantiq Xway DMA bindingsAleksander Jan Bajkowski1-0/+32
Document the Lantiq Xway SoC DMA Controller DT bindings. Signed-off-by: Aleksander Jan Bajkowski <[email protected]> Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-13dt-bindings: mips: lantiq: Document Lantiq Xway EBU bindingsAleksander Jan Bajkowski1-0/+32
Document the Lantiq Xway SoC series External Bus Unit (EBU) bindings. Signed-off-by: Aleksander Jan Bajkowski <[email protected]> Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-13dt-bindings: mips: lantiq: Document Lantiq Xway CGU bindingsAleksander Jan Bajkowski1-0/+32
Document the Lantiq Xway SoC series Clock Generation Unit (CGU) bindings. Signed-off-by: Aleksander Jan Bajkowski <[email protected]> Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-13dt-bindings: mips: lantiq: Document Lantiq Xway PMU bindingsAleksander Jan Bajkowski1-0/+32
Document the Lantiq Xway SoC series Power Management Unit (PMU) bindings. Signed-off-by: Aleksander Jan Bajkowski <[email protected]> Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-09MIPS: bitops: Fix reference to ffz locationGeert Uytterhoeven1-1/+1
Unlike most other architectures, MIPS defines ffz() below ffs(). Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
2021-01-07MIPS: UAPI: unexport unistd_nr_{n32,n64,o32}.hAlexander Lobakin3-11/+12
unistd_nr_{n32,n64,o32}.h are needed only by include/asm/unistd.h, which is a kernel-side header file, and their contents is generally not for userland use. Move their target destination from include/generated/uapi/asm/ to include/generated/asm/ to disable exporting them as UAPI headers. Signed-off-by: Alexander Lobakin <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>