From nobody Sat Apr 11 18:34:10 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; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1775137488; cv=none; d=zohomail.com; s=zohoarc; b=arjL/3UjhaqglzHMZbMnxOfUm0J91w3zj5UmMKTlQ1tV+vfq9Hh2twNFiJD1CL8Dz2y3B3aVS9Tsbu+F6xhmlqHiJqeNLlRYkD0o+CTbqYISbLCl4ciG+Xbzmc13vI7Bivex/jW8UU49K1lzUnjBxiifg4oOTs01lSJWGaJ9KO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775137488; 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=pwGDwx2Uyrjn0Ci8NNnKFZ8skiWwN9Y+jrSG5tpf/Ss=; b=bvg2cB//cjsWGILRPNTMrE3Lgy4v+LI0WcMtd0VN0Dw+eFaqAKabQ6i74vF/SBd0IV1dnn2qVxQB1kqw6VxS0ah531exKzNUj18MTexc+IPFbkwRRKI52sfFqgtHP6wog+3SnIKBrKyUMqslfcidN2zwFDQtIS48sGaeIQiF3uM= 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; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1775137488052227.05395055037684; Thu, 2 Apr 2026 06:44:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w8IKm-00060V-Qo; Thu, 02 Apr 2026 09:43:44 -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 1w8IKl-0005fW-Ay for qemu-devel@nongnu.org; Thu, 02 Apr 2026 09:43:43 -0400 Received: from tor.source.kernel.org ([172.105.4.254]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w8I5s-0002RH-AM for qemu-devel@nongnu.org; Thu, 02 Apr 2026 09:28:21 -0400 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 5CFBC60008; Thu, 2 Apr 2026 13:28:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BB22C116C6; Thu, 2 Apr 2026 13:28:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775136491; bh=+Q6VYouA7YTugZZPEUHit4u4mCrzCUyb9xTNxtHHngk=; h=From:To:Cc:Subject:Date:From; b=Y3ZSW0E4qJkZ7e4vsJwy0wNksXKVXI800IIJ+/T5YFBAi7GhnSP83eHkutEf7hefh wZUI/WrGPzbf2zSyGjtfOwkrPiZNw3L2T+W4GWL5PA2/GyO4MW/DhkVN4cVnqQv3Dd Dow7dDMRp+E8RalaLk6UB96rc3KeikMTfrDDYDBcnrxwIRSWuoCiATduUxKkdyq9OZ A08bq36WrImM0rUAWlpUDv9xsSWXPHg3Ubi6J0vZqIiEiQndzUbpiJGa/GE3NJieY2 30dPzZBFA2jdhsK6WWLbtn8Bh9xVeFtUMp2FQbyX8lpmb3gyWnAdRmTqXhw826T/aS QJos7fSHYID4g== From: Helge Deller To: qemu-devel@nongnu.org Cc: deller@gmx.de, Michael Tokarev Subject: [PATCH] RFC: Allow building qemu tools on 32-bit hosts Date: Thu, 2 Apr 2026 15:28:01 +0200 Message-ID: <20260402132801.16053-1-deller@kernel.org> X-Mailer: git-send-email 2.53.0 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=172.105.4.254; envelope-from=deller@kernel.org; helo=tor.source.kernel.org X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.542, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-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 @kernel.org) X-ZM-MESSAGEID: 1775137490372158500 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.53.0