From nobody Mon Nov 23 04:32:25 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1793885056; cv=none; d=zohomail.com; s=zohoarc; b=BFoQwCiUU6uR/5DlIXGbAEsY2fbgs8S55Ugsu6liyWZOzyQYsilsiA650nvbO0rusYI815MhAKpQCqqq8rY5vZhFIOzzmh1yUPnLbdLO9zAs2yEJrXeElvFRsrcd/c/VuOo+nXCN3a40+pD4zcbJ3dFIQK0zo216qqqcqt9bg+Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793885056; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dIkerK1ddNMjiExkUdJ9CbLcyQyjdK1J1gkiCjdXAFw=; b=gOhsh87gHujUW4WtoMfhNAz0SSDYLnk1k5sMSQbZRJyMD5nBWHH9yIaJ2KruZlSTWP19BA7OCm+1CvgZzmYev474NCs6cctH36rlihgBDDiSrAnahhjmwAtBgceT2zAvjA6ytSQJS7j5DfBMJLfh29nRfoqaS+9p3I6jLEoLfZI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793885056358132.61448436552052; Thu, 5 Nov 2026 05:24:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xOxRa-0001wh-Dk; Thu, 05 Nov 2026 08:23:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xOusK-0007wa-AL; Thu, 05 Nov 2026 05:39:21 -0500 Received: from [115.28.160.31] (helo=mailbox.box.xen0n.name) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xOusH-0005I6-47; Thu, 05 Nov 2026 05:39:20 -0500 Received: from ld50.lan (unknown [IPv6:240e:b8f:9520:b00:4d15:c490:17a1:b378]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id B47E060075; Thu, 5 Nov 2026 18:29:26 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1793874567; bh=bRlGEqYHq49dJCph1FkFiiqLa3Il2BqZi7vY6wcMXfY=; h=From:To:Cc:Subject:Date:From; b=TTNOywXjrbi0wAIZ61WTqajIuj+Y6SiLELjmQpgsfZIYI7w6h2Yp10vXzFHcss0xB c6s9aq6YOqTbSrVdGYy/jnNCsbFog6ku4HwSZpaq7l3mLvhOoO0BIUH8KRY9xcsbxb 2eN65zDUWnhpsefWTRGIrdjTiZTImOtqcjY2P/e8= From: WANG Xuerui To: qemu-devel@nongnu.org Cc: WANG Xuerui , qemu-stable@nongnu.org, Richard Henderson Subject: [PATCH] host/include/loongarch64: Fix build with 128-bit LL/SC enabled Date: Thu, 5 Nov 2026 18:29:24 +0800 Message-ID: <20261105102924.1309687-1-i.qemu@xen0n.name> X-Mailer: git-send-email 2.55.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 115.28.160.31 (deferred) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=115.28.160.31; envelope-from=i.qemu@xen0n.name; helo=mailbox.box.xen0n.name X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 05 Nov 2026 08:23:50 -0500 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @xen0n.name) X-ZM-MESSAGEID: 1793885058797158500 Content-Type: text/plain; charset="utf-8" From: WANG Xuerui 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=3Dla64v1.1` (and equivalents such as `-march=3Dla664` 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=3Dla64v1.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 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 --- .../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/i= nclude/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 */ --=20 2.55.0