Skip to content

Commit a95eb1d

Browse files
committed
Merge tag 'loongarch-fixes-5.19-5' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
Pull LoongArch fixes from Huacai Chen: - Fix cache size calculation, stack protection attributes, ptrace's fpr_set and "ROM Size" in boardinfo - Some cleanups and improvements of assembly - Some cleanups of unused code and useless code * tag 'loongarch-fixes-5.19-5' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson: LoongArch: Fix wrong "ROM Size" of boardinfo LoongArch: Fix missing fcsr in ptrace's fpr_set LoongArch: Fix shared cache size calculation LoongArch: Disable executable stack by default LoongArch: Remove unused variables LoongArch: Remove clock setting during cpu hotplug stage LoongArch: Remove useless header compiler.h LoongArch: Remove several syntactic sugar macros for branches LoongArch: Re-tab the assembly files LoongArch: Simplify "BGT foo, zero" with BGTZ LoongArch: Simplify "BLT foo, zero" with BLTZ LoongArch: Simplify "BEQ/BNE foo, zero" with BEQZ/BNEZ LoongArch: Use the "move" pseudo-instruction where applicable LoongArch: Use the "jr" pseudo-instruction where applicable LoongArch: Use ABI names of registers where appropriate
2 parents 9d928d9 + 45b53c9 commit a95eb1d

31 files changed

+277
-428
lines changed

arch/loongarch/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ config LOONGARCH
6969
select GENERIC_TIME_VSYSCALL
7070
select GPIOLIB
7171
select HAVE_ARCH_AUDITSYSCALL
72-
select HAVE_ARCH_COMPILER_H
7372
select HAVE_ARCH_MMAP_RND_BITS if MMU
7473
select HAVE_ARCH_SECCOMP_FILTER
7574
select HAVE_ARCH_TRACEHOOK

arch/loongarch/include/asm/asmmacro.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -274,16 +274,4 @@
274274
nor \dst, \src, zero
275275
.endm
276276

277-
.macro bgt r0 r1 label
278-
blt \r1, \r0, \label
279-
.endm
280-
281-
.macro bltz r0 label
282-
blt \r0, zero, \label
283-
.endm
284-
285-
.macro bgez r0 label
286-
bge \r0, zero, \label
287-
.endm
288-
289277
#endif /* _ASM_ASMMACRO_H */

arch/loongarch/include/asm/atomic.h

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <linux/types.h>
1111
#include <asm/barrier.h>
1212
#include <asm/cmpxchg.h>
13-
#include <asm/compiler.h>
1413

1514
#if __SIZEOF_LONG__ == 4
1615
#define __LL "ll.w "
@@ -157,27 +156,25 @@ static inline int arch_atomic_sub_if_positive(int i, atomic_t *v)
157156
__asm__ __volatile__(
158157
"1: ll.w %1, %2 # atomic_sub_if_positive\n"
159158
" addi.w %0, %1, %3 \n"
160-
" or %1, %0, $zero \n"
161-
" blt %0, $zero, 2f \n"
159+
" move %1, %0 \n"
160+
" bltz %0, 2f \n"
162161
" sc.w %1, %2 \n"
163-
" beq $zero, %1, 1b \n"
162+
" beqz %1, 1b \n"
164163
"2: \n"
165164
__WEAK_LLSC_MB
166-
: "=&r" (result), "=&r" (temp),
167-
"+" GCC_OFF_SMALL_ASM() (v->counter)
165+
: "=&r" (result), "=&r" (temp), "+ZC" (v->counter)
168166
: "I" (-i));
169167
} else {
170168
__asm__ __volatile__(
171169
"1: ll.w %1, %2 # atomic_sub_if_positive\n"
172170
" sub.w %0, %1, %3 \n"
173-
" or %1, %0, $zero \n"
174-
" blt %0, $zero, 2f \n"
171+
" move %1, %0 \n"
172+
" bltz %0, 2f \n"
175173
" sc.w %1, %2 \n"
176-
" beq $zero, %1, 1b \n"
174+
" beqz %1, 1b \n"
177175
"2: \n"
178176
__WEAK_LLSC_MB
179-
: "=&r" (result), "=&r" (temp),
180-
"+" GCC_OFF_SMALL_ASM() (v->counter)
177+
: "=&r" (result), "=&r" (temp), "+ZC" (v->counter)
181178
: "r" (i));
182179
}
183180

@@ -320,27 +317,25 @@ static inline long arch_atomic64_sub_if_positive(long i, atomic64_t *v)
320317
__asm__ __volatile__(
321318
"1: ll.d %1, %2 # atomic64_sub_if_positive \n"
322319
" addi.d %0, %1, %3 \n"
323-
" or %1, %0, $zero \n"
324-
" blt %0, $zero, 2f \n"
320+
" move %1, %0 \n"
321+
" bltz %0, 2f \n"
325322
" sc.d %1, %2 \n"
326-
" beq %1, $zero, 1b \n"
323+
" beqz %1, 1b \n"
327324
"2: \n"
328325
__WEAK_LLSC_MB
329-
: "=&r" (result), "=&r" (temp),
330-
"+" GCC_OFF_SMALL_ASM() (v->counter)
326+
: "=&r" (result), "=&r" (temp), "+ZC" (v->counter)
331327
: "I" (-i));
332328
} else {
333329
__asm__ __volatile__(
334330
"1: ll.d %1, %2 # atomic64_sub_if_positive \n"
335331
" sub.d %0, %1, %3 \n"
336-
" or %1, %0, $zero \n"
337-
" blt %0, $zero, 2f \n"
332+
" move %1, %0 \n"
333+
" bltz %0, 2f \n"
338334
" sc.d %1, %2 \n"
339-
" beq %1, $zero, 1b \n"
335+
" beqz %1, 1b \n"
340336
"2: \n"
341337
__WEAK_LLSC_MB
342-
: "=&r" (result), "=&r" (temp),
343-
"+" GCC_OFF_SMALL_ASM() (v->counter)
338+
: "=&r" (result), "=&r" (temp), "+ZC" (v->counter)
344339
: "r" (i));
345340
}
346341

arch/loongarch/include/asm/barrier.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ static inline unsigned long array_index_mask_nospec(unsigned long index,
4848
__asm__ __volatile__(
4949
"sltu %0, %1, %2\n\t"
5050
#if (__SIZEOF_LONG__ == 4)
51-
"sub.w %0, $r0, %0\n\t"
51+
"sub.w %0, $zero, %0\n\t"
5252
#elif (__SIZEOF_LONG__ == 8)
53-
"sub.d %0, $r0, %0\n\t"
53+
"sub.d %0, $zero, %0\n\t"
5454
#endif
5555
: "=r" (mask)
5656
: "r" (index), "r" (size)

arch/loongarch/include/asm/cmpxchg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ static inline unsigned long __xchg(volatile void *ptr, unsigned long x,
5555
__asm__ __volatile__( \
5656
"1: " ld " %0, %2 # __cmpxchg_asm \n" \
5757
" bne %0, %z3, 2f \n" \
58-
" or $t0, %z4, $zero \n" \
58+
" move $t0, %z4 \n" \
5959
" " st " $t0, %1 \n" \
60-
" beq $zero, $t0, 1b \n" \
60+
" beqz $t0, 1b \n" \
6161
"2: \n" \
6262
__WEAK_LLSC_MB \
6363
: "=&r" (__ret), "=ZB"(*m) \

arch/loongarch/include/asm/compiler.h

Lines changed: 0 additions & 15 deletions
This file was deleted.

arch/loongarch/include/asm/elf.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,6 @@ struct arch_elf_state {
288288
.interp_fp_abi = LOONGARCH_ABI_FP_ANY, \
289289
}
290290

291-
#define elf_read_implies_exec(ex, exec_stk) (exec_stk == EXSTACK_DEFAULT)
292-
293291
extern int arch_elf_pt_proc(void *ehdr, void *phdr, struct file *elf,
294292
bool is_interp, struct arch_elf_state *state);
295293

arch/loongarch/include/asm/futex.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <linux/futex.h>
99
#include <linux/uaccess.h>
1010
#include <asm/barrier.h>
11-
#include <asm/compiler.h>
1211
#include <asm/errno.h>
1312

1413
#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
@@ -17,7 +16,7 @@
1716
"1: ll.w %1, %4 # __futex_atomic_op\n" \
1817
" " insn " \n" \
1918
"2: sc.w $t0, %2 \n" \
20-
" beq $t0, $zero, 1b \n" \
19+
" beqz $t0, 1b \n" \
2120
"3: \n" \
2221
" .section .fixup,\"ax\" \n" \
2322
"4: li.w %0, %6 \n" \
@@ -82,9 +81,9 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval, u32 newv
8281
"# futex_atomic_cmpxchg_inatomic \n"
8382
"1: ll.w %1, %3 \n"
8483
" bne %1, %z4, 3f \n"
85-
" or $t0, %z5, $zero \n"
84+
" move $t0, %z5 \n"
8685
"2: sc.w $t0, %2 \n"
87-
" beq $zero, $t0, 1b \n"
86+
" beqz $t0, 1b \n"
8887
"3: \n"
8988
__WEAK_LLSC_MB
9089
" .section .fixup,\"ax\" \n"
@@ -95,8 +94,8 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval, u32 newv
9594
" "__UA_ADDR "\t1b, 4b \n"
9695
" "__UA_ADDR "\t2b, 4b \n"
9796
" .previous \n"
98-
: "+r" (ret), "=&r" (val), "=" GCC_OFF_SMALL_ASM() (*uaddr)
99-
: GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oldval), "Jr" (newval),
97+
: "+r" (ret), "=&r" (val), "=ZC" (*uaddr)
98+
: "ZC" (*uaddr), "Jr" (oldval), "Jr" (newval),
10099
"i" (-EFAULT)
101100
: "memory", "t0");
102101

arch/loongarch/include/asm/irqflags.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
#include <linux/compiler.h>
1111
#include <linux/stringify.h>
12-
#include <asm/compiler.h>
1312
#include <asm/loongarch.h>
1413

1514
static inline void arch_local_irq_enable(void)

arch/loongarch/include/asm/local.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <linux/bitops.h>
1010
#include <linux/atomic.h>
1111
#include <asm/cmpxchg.h>
12-
#include <asm/compiler.h>
1312

1413
typedef struct {
1514
atomic_long_t a;

0 commit comments

Comments
 (0)