linux-yocto/arch/loongarch
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>
2025-06-27 11:07:36 +01:00
..
boot loongarch: efi: enable generic EFI compressed boot 2022-09-20 09:50:31 +02:00
configs mm: z3fold: deprecate CONFIG_Z3FOLD 2024-10-17 15:22:05 +02:00
include LoongArch: Avoid using $r0/$r1 as "mask" for csrxchg 2025-06-27 11:07:36 +01:00
kernel LoongArch: Eliminate superfluous get_numa_distances_cnt() 2025-04-25 10:44:01 +02:00
lib LoongArch: Improve dump_tlb() output messages 2022-09-03 18:01:27 +08:00
mm LoongArch: Fix build error due to backport 2025-05-05 10:59:01 +02:00
net Revert "LoongArch: BPF: Fix off-by-one error in build_prologue()" 2025-04-25 10:44:02 +02:00
pci LoongArch: Fix memleak in pci_acpi_scan_root() 2024-10-17 15:22:16 +02:00
vdso LoongArch: Fix build failure with GCC 15 (-std=gnu23) 2024-12-14 19:53:49 +01:00
Kbuild LoongArch: Add BPF JIT support 2022-10-12 16:36:20 +08:00
Kconfig LoongArch: Select ARCH_USE_MEMTEST 2025-05-02 07:46:55 +02:00
Kconfig.debug LoongArch: Add prologue unwinder support 2022-08-12 13:10:11 +08:00
Makefile LoongArch: Explicitly specify code model in Makefile 2025-05-22 14:10:09 +02:00