linux/arch
Huacai Chen b204e05b75 LoongArch: Avoid using $r0/$r1 as "mask" for csrxchg
commit 52c22661c7 upstream.

When building kernel with LLVM there are occasionally such errors:

In file included from ./include/linux/spinlock.h:59:
In file included from ./include/linux/irqflags.h:17:
arch/loongarch/include/asm/irqflags.h:38:3: error: must not be $r0 or $r1
   38 |                 "csrxchg %[val], %[mask], %[reg]\n\t"
      |                 ^
<inline asm>:1:16: note: instantiated into assembly here
    1 |         csrxchg $a1, $ra, 0
      |                       ^

To prevent the compiler from allocating $r0 or $r1 for the "mask" of the
csrxchg instruction, the 'q' constraint must be used but Clang < 21 does
not support it. So force to use $t0 in the inline asm, in order to avoid
using $r0/$r1 while keeping the backward compatibility.

Cc: stable@vger.kernel.org
Link: https://github.com/llvm/llvm-project/pull/141037
Reviewed-by: Yanteng Si <si.yanteng@linux.dev>
Suggested-by: WANG Rui <wangrui@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-06-27 11:07:36 +01:00
..
alpha alpha/elf: Fix misc/setarch test of util-linux by removing 32bit support 2025-03-28 21:58:51 +01:00
arc ARC: build: Try to guess GCC variant of cross compiler 2025-01-09 13:30:05 +01:00
arm ARM: OMAP2+: Fix l4ls clk domain handling in STANDBY 2025-06-27 11:07:36 +01:00
arm64 xen/arm: call uaccess_ttbr0_enable for dm_op hypercall 2025-06-27 11:07:25 +01:00
csky mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
hexagon hexagon: Fix unbalanced spinlock in die() 2025-02-21 13:49:25 +01:00
ia64 mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
loongarch LoongArch: Avoid using $r0/$r1 as "mask" for csrxchg 2025-06-27 11:07:36 +01:00
m68k m68k: mac: Fix macintosh_config for Mac II 2025-06-27 11:07:08 +01:00
microblaze microblaze: Export xmb_manager functions 2024-12-14 19:53:20 +01:00
mips mips: Add -std= flag specified in KBUILD_CFLAGS to vdso CFLAGS 2025-06-27 11:07:30 +01:00
nios2 mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
openrisc mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
parisc parisc: fix building with gcc-15 2025-06-27 11:07:29 +01:00
powerpc powerpc/eeh: Fix missing PE bridge reconfiguration during VFIO EEH recovery 2025-06-27 11:07:36 +01:00
riscv riscv: mm: Fix the out of bound issue of vmemmap address 2025-05-22 14:10:09 +02:00
s390 KVM: s390: rename PROT_NONE to PROT_TYPE_DUMMY 2025-06-27 11:07:30 +01:00
sh sh: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK 2024-12-14 19:54:03 +01:00
sparc sparc/mm: disable preemption in lazy mmu mode 2025-04-25 10:43:42 +02:00
um um: let 'make clean' properly clean underlying SUBARCH as well 2025-06-04 14:40:26 +02:00
x86 Revert "x86/bugs: Make spectre user default depend on MITIGATION_SPECTRE_V2" on v6.6 and older 2025-06-27 11:07:36 +01:00
xtensa mm: remove kern_addr_valid() completely 2024-11-08 16:26:39 +01:00
.gitignore .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
Kconfig Revert "mm: mmap: allow for the maximum number of bits for randomizing mmap_base by default" 2024-06-27 13:46:24 +02:00