Commit 8f18c59c01 for qemu.org

commit 8f18c59c018eff94b6465f73f5cd76a49ee3d6ec
Author: WANG Xuerui <git@xen0n.name>
Date:   Thu Nov 5 18:29:24 2026 +0800

    host/include/loongarch64: Fix build with 128-bit LL/SC enabled

    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
    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>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Message-ID: <20261105102924.1309687-1-i.qemu@xen0n.name>

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 919fd8d744..0000000000
--- 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 */