From nobody Sat Apr 11 20:10:31 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=1775213055; cv=none; d=zohomail.com; s=zohoarc; b=MjsGx2KlKIheUV3Jid2uQdsjNZ+HFXGMsCu2elnSyS8xv1rCYQVx84WjNKr5B2DthGI04IF+qYkdJL7p3GzgDYQxT12Ve86S2MzFh38UMeodrn1eruERGEecXxJgLtlu0G8eX+BK/4zXK+zZ71Kwyghwsey6okEzQf6XbPnAMOU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775213055; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BjZwUNB0BK9mtv3PJKfByxFlNm/0mrK+trwXk107I+U=; b=B71HJHPVK6D+XTPq3n+BQ5peaJJbj5kGLQxQxxxLCPzTjW2bMFOP55fc60KCtKdLRtZryuC1gWoRpf3SwcjtqNDd3UO/+vHXeGYJhjvpRfEI2gjUNjxESM7/Q1vATqww9Ug+FFxNCjW4bhN3qfLGftvBpdts21I/2uLL4zn9OxM= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1775213054555104.97363320110276; Fri, 3 Apr 2026 03:44:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w8c0C-000418-1v; Fri, 03 Apr 2026 06:43:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w8c09-00040X-S7 for qemu-devel@nongnu.org; Fri, 03 Apr 2026 06:43:45 -0400 Received: from isrv.corpit.ru ([212.248.84.144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w8c07-0005by-WD for qemu-devel@nongnu.org; Fri, 03 Apr 2026 06:43:45 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 3EA5119A640; Fri, 03 Apr 2026 13:42:51 +0300 (MSK) Received: from think4mjt.tls.msk.ru (mjtthink.wg.tls.msk.ru [192.168.177.146]) by tsrv.corpit.ru (Postfix) with ESMTP id F1AD338DB70; Fri, 03 Apr 2026 13:43:28 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tls.msk.ru; s=202602; t=1775212971; bh=PZxZax746ngAAU2XKXJByYV5R66SacE2lzw99jqs69c=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jQO3+9dBPiEJWCzr5ss3TRpMTXbOKxZ2AjAzr98242ofnrogLRLz9g60UiFEcm3Ni OEPPX4eJQSD+97FOGTYIZQGpurcye30kASbLyIQjFa2ObGT4AmUFjE+TWv/DMCz9kt Zx2NqIigEcmoiG3m8p857evcdtkgiCjNB6VxHbU/OAfVAv5a1xhq7evtD1nA0r65ri DqDC87Y5njxbM8a8yAhox90I2cxVls9sYr+1hLX5q7hbF4KljRIuZtib/DzCqdUBnX MvkZnsh8JsgKlweOcu2AXQIGQls20uLimMFuxin8B7eNUoztFEzCJu1/pzcS4QGB7h vr3/uYpdFojMQ== From: Michael Tokarev To: qemu-devel@nongnu.org Cc: Helge Deller , Michael Tokarev Subject: [PATCH for-11.0 6/6] RFC: Allow building qemu tools on 32-bit hosts Date: Fri, 3 Apr 2026 13:43:26 +0300 Message-ID: <20260403104327.1163942-7-mjt@tls.msk.ru> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260403104327.1163942-1-mjt@tls.msk.ru> References: <20260403104327.1163942-1-mjt@tls.msk.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=lists.gnu.org; Received-SPF: pass client-ip=212.248.84.144; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 @tls.msk.ru) X-ZM-MESSAGEID: 1775213060616154100 Content-Type: text/plain; charset="utf-8" From: Helge Deller Qemu's tools like qemu-img are often needed on 32-bit platforms, although the actual qemu emulators have been discontinued on 32-bit. To allow building the tools on 32-bit this patch implements two small changes: a) The check in meson.build is changed to still error out if the user tries to build qemu-system or qemu-user on a 32-bit platform, but allows building tools (e.g. by "--enable-tools") alone. b) Remove the compile time checks in atomic.h because: - for the qemu-system and qemu-user emulators this check is redundant since we only allow 64-bit platforms anyway (see a) - it breaks those 32-bit platforms, which do provide (slower) 64-bit atomics - 32-bit platforms without 64-bit atomics will fail instead with linker err= ors - the runtime speed of the qemu tools aren't actually that important. I've sucessfully tested building qemu tools on 32-bit hppa. Signed-off-by: Helge Deller Reviewed-by: Michael Tokarev --- include/qemu/atomic.h | 16 ---------------- meson.build | 4 ++-- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h index dc9290084b..f05dce36eb 100644 --- a/include/qemu/atomic.h +++ b/include/qemu/atomic.h @@ -56,14 +56,6 @@ */ #define signal_barrier() __atomic_signal_fence(__ATOMIC_SEQ_CST) =20 -/* - * Sanity check that the size of an atomic operation isn't "overly large". - * Despite the fact that e.g. i686 has 64-bit atomic operations, we do not - * want to use them because we ought not need them, and this lets us do a - * bit of sanity checking that other 32-bit hosts might build. - */ -#define ATOMIC_REG_SIZE sizeof(void *) - /* Weak atomic operations prevent the compiler moving other * loads/stores past the atomic operation load/store. However there is * no explicit memory barrier for the processor. @@ -79,7 +71,6 @@ =20 #define qatomic_read(ptr) \ ({ \ - qemu_build_assert(sizeof(*ptr) <=3D ATOMIC_REG_SIZE); \ qatomic_read__nocheck(ptr); \ }) =20 @@ -87,7 +78,6 @@ __atomic_store_n(ptr, i, __ATOMIC_RELAXED) =20 #define qatomic_set(ptr, i) do { \ - qemu_build_assert(sizeof(*ptr) <=3D ATOMIC_REG_SIZE); \ qatomic_set__nocheck(ptr, i); \ } while(0) =20 @@ -110,7 +100,6 @@ */ #define qatomic_rcu_read_internal(ptr, _val) \ ({ \ - qemu_build_assert(sizeof(*ptr) <=3D ATOMIC_REG_SIZE); \ typeof_strip_qual(*ptr) _val; \ qatomic_rcu_read__nocheck(ptr, &_val); \ _val; \ @@ -119,20 +108,17 @@ qatomic_rcu_read_internal((ptr), MAKE_IDENTIFIER(_val)) =20 #define qatomic_rcu_set(ptr, i) do { \ - qemu_build_assert(sizeof(*ptr) <=3D ATOMIC_REG_SIZE); \ __atomic_store_n(ptr, i, __ATOMIC_RELEASE); \ } while(0) =20 #define qatomic_load_acquire(ptr) \ ({ \ - qemu_build_assert(sizeof(*ptr) <=3D ATOMIC_REG_SIZE); \ typeof_strip_qual(*ptr) _val; \ __atomic_load(ptr, &_val, __ATOMIC_ACQUIRE); \ _val; \ }) =20 #define qatomic_store_release(ptr, i) do { \ - qemu_build_assert(sizeof(*ptr) <=3D ATOMIC_REG_SIZE); \ __atomic_store_n(ptr, i, __ATOMIC_RELEASE); \ } while(0) =20 @@ -144,7 +130,6 @@ }) =20 #define qatomic_xchg(ptr, i) ({ \ - qemu_build_assert(sizeof(*ptr) <=3D ATOMIC_REG_SIZE); \ qatomic_xchg__nocheck(ptr, i); \ }) =20 @@ -157,7 +142,6 @@ }) =20 #define qatomic_cmpxchg(ptr, old, new) ({ \ - qemu_build_assert(sizeof(*ptr) <=3D ATOMIC_REG_SIZE); \ qatomic_cmpxchg__nocheck(ptr, old, new); \ }) =20 diff --git a/meson.build b/meson.build index daa58e46a3..98a708372b 100644 --- a/meson.build +++ b/meson.build @@ -323,8 +323,8 @@ endif # Compiler flags # ################## =20 -if cc.sizeof('void *') < 8 - error('QEMU requires a 64-bit CPU host architecture') +if (cc.sizeof('void *') < 8) and (have_system or have_user) + error('QEMU emulator requires a 64-bit CPU host architecture. Only tools= may be built for 32-bit.') endif =20 foreach lang : all_languages --=20 2.47.3