.../include/loongarch64/host/store-insert-al16.h.inc | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 host/include/loongarch64/host/store-insert-al16.h.inc
From: WANG Xuerui <git@xen0n.name>
LoongArch64 v1.1 has native 128-bit LL/SC capability through the
`sc.q` instruction, and [GCC uses it since 16.1.0][1]. So for
`-march=la64v1.1` (and equivalents such as `-march=la664` or just
`-mscq`) configurations the following happens:
- `CONFIG_ATOMIC128` is set,
- in `host/include/generic/host/atomic128-cas.h.inc`, `HAVE_CMPXCHG128`
is set to `1`,
- in `accel/tcg/ldst_atomicity.c.inc`, code paths invoking
`store_atom_insert_al16` are enabled,
- this errors out because of the explicit
`host/include/loongarch64/host/store-insert-al16.h.inc` override.
This doesn't affect `-march=la64v1.0` builds because the `atomic128`
probe, when code-generated without `sc.q` support, correctly fails to
link without libatomic.
Simply removing the override is enough to make QEMU build and run
correctly on `sc.q`-enabled hosts. The override was introduced in 2023,
in commit adc8467e697d ("host/include/loongarch64: Add atomic16 load
and store"), when it was true that no existing LoongArch implementation
could perform 128-bit LL/SC nor CAS at that time. It is no longer the
case since LA664 with LoongArch64 v1.1.
[1]: https://github.com/gcc-mirror/gcc/blob/releases/gcc-16.1.0/gcc/config/loongarch/sync.md#L784
Cc: qemu-stable@nongnu.org
Cc: Richard Henderson <richard.henderson@linaro.org>
Fixes: adc8467e697d ("host/include/loongarch64: Add atomic16 load and store")
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4767
Signed-off-by: WANG Xuerui <git@xen0n.name>
---
.../include/loongarch64/host/store-insert-al16.h.inc | 12 ------------
1 file changed, 12 deletions(-)
delete mode 100644 host/include/loongarch64/host/store-insert-al16.h.inc
diff --git a/host/include/loongarch64/host/store-insert-al16.h.inc b/host/include/loongarch64/host/store-insert-al16.h.inc
deleted file mode 100644
index 919fd8d74404..000000000000
--- a/host/include/loongarch64/host/store-insert-al16.h.inc
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * SPDX-License-Identifier: GPL-2.0-or-later
- * Atomic store insert into 128-bit, LoongArch version.
- */
-
-#ifndef LOONGARCH_STORE_INSERT_AL16_H
-#define LOONGARCH_STORE_INSERT_AL16_H
-
-void store_atom_insert_al16(Int128 *ps, Int128 val, Int128 msk)
- QEMU_ERROR("unsupported atomic");
-
-#endif /* LOONGARCH_STORE_INSERT_AL16_H */
--
2.55.0
On 11/5/26 02:29, WANG Xuerui wrote:
> From: WANG Xuerui <git@xen0n.name>
>
> LoongArch64 v1.1 has native 128-bit LL/SC capability through the
> `sc.q` instruction, and [GCC uses it since 16.1.0][1]. So for
> `-march=la64v1.1` (and equivalents such as `-march=la664` or just
> `-mscq`) configurations the following happens:
>
> - `CONFIG_ATOMIC128` is set,
> - in `host/include/generic/host/atomic128-cas.h.inc`, `HAVE_CMPXCHG128`
> is set to `1`,
> - in `accel/tcg/ldst_atomicity.c.inc`, code paths invoking
> `store_atom_insert_al16` are enabled,
> - this errors out because of the explicit
> `host/include/loongarch64/host/store-insert-al16.h.inc` override.
>
> This doesn't affect `-march=la64v1.0` builds because the `atomic128`
> probe, when code-generated without `sc.q` support, correctly fails to
> link without libatomic.
>
> Simply removing the override is enough to make QEMU build and run
> correctly on `sc.q`-enabled hosts. The override was introduced in 2023,
> in commit adc8467e697d ("host/include/loongarch64: Add atomic16 load
> and store"), when it was true that no existing LoongArch implementation
> could perform 128-bit LL/SC nor CAS at that time. It is no longer the
> case since LA664 with LoongArch64 v1.1.
>
> [1]: https://github.com/gcc-mirror/gcc/blob/releases/gcc-16.1.0/gcc/config/loongarch/sync.md#L784
>
> Cc: qemu-stable@nongnu.org
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Fixes: adc8467e697d ("host/include/loongarch64: Add atomic16 load and store")
> Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4767
> Signed-off-by: WANG Xuerui <git@xen0n.name>
> ---
> .../include/loongarch64/host/store-insert-al16.h.inc | 12 ------------
> 1 file changed, 12 deletions(-)
> delete mode 100644 host/include/loongarch64/host/store-insert-al16.h.inc
Thanks.
Depending on how quickly v1.1 becomes common, you might want to add
cpuinfo detection for this. But the most important thing in the short
term is fixing the build error, so queued.
r~
© 2016 - 2026 Red Hat, Inc.