{"id":2219535,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2219535/?format=json","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.0/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260403104327.1163942-7-mjt@tls.msk.ru>","date":"2026-04-03T10:43:26","name":"[for-11.0,6/6] RFC: Allow building qemu tools on 32-bit hosts","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"948c331ba3374ae5824a5c1864b83b7ff20dd5b5","submitter":{"id":183,"url":"http://patchwork.ozlabs.org/api/1.0/people/183/?format=json","name":"Michael Tokarev","email":"mjt@tls.msk.ru"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260403104327.1163942-7-mjt@tls.msk.ru/mbox/","series":[{"id":498613,"url":"http://patchwork.ozlabs.org/api/1.0/series/498613/?format=json","date":"2026-04-03T10:43:24","name":"allow building tools and qemu-guest-agent on 32bit hosts","version":1,"mbox":"http://patchwork.ozlabs.org/series/498613/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2219535/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=tls.msk.ru header.i=@tls.msk.ru header.a=rsa-sha256\n header.s=202602 header.b=jQO3+9dB;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fnFhZ4sqJz1yDH\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 03 Apr 2026 21:44:14 +1100 (AEDT)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1w8c0C-000418-1v; Fri, 03 Apr 2026 06:43:48 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <mjt@tls.msk.ru>) id 1w8c09-00040X-S7\n for qemu-devel@nongnu.org; Fri, 03 Apr 2026 06:43:45 -0400","from isrv.corpit.ru ([212.248.84.144])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <mjt@tls.msk.ru>) id 1w8c07-0005by-WD\n for qemu-devel@nongnu.org; Fri, 03 Apr 2026 06:43:45 -0400","from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2])\n by isrv.corpit.ru (Postfix) with ESMTP id 3EA5119A640;\n Fri, 03 Apr 2026 13:42:51 +0300 (MSK)","from think4mjt.tls.msk.ru (mjtthink.wg.tls.msk.ru [192.168.177.146])\n by tsrv.corpit.ru (Postfix) with ESMTP id F1AD338DB70;\n 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;\n t=1775212971; bh=PZxZax746ngAAU2XKXJByYV5R66SacE2lzw99jqs69c=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References;\n b=jQO3+9dBPiEJWCzr5ss3TRpMTXbOKxZ2AjAzr98242ofnrogLRLz9g60UiFEcm3Ni\n OEPPX4eJQSD+97FOGTYIZQGpurcye30kASbLyIQjFa2ObGT4AmUFjE+TWv/DMCz9kt\n Zx2NqIigEcmoiG3m8p857evcdtkgiCjNB6VxHbU/OAfVAv5a1xhq7evtD1nA0r65ri\n DqDC87Y5njxbM8a8yAhox90I2cxVls9sYr+1hLX5q7hbF4KljRIuZtib/DzCqdUBnX\n MvkZnsh8JsgKlweOcu2AXQIGQls20uLimMFuxin8B7eNUoztFEzCJu1/pzcS4QGB7h\n vr3/uYpdFojMQ==","From":"Michael Tokarev <mjt@tls.msk.ru>","To":"qemu-devel@nongnu.org","Cc":"Helge Deller <deller@gmx.de>,\n\tMichael Tokarev <mjt@tls.msk.ru>","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":"8bit","Received-SPF":"pass client-ip=212.248.84.144; envelope-from=mjt@tls.msk.ru;\n 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,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\n RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001,\n 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 <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"From: Helge Deller <deller@gmx.de>\n\nQemu's tools like qemu-img are often needed on 32-bit platforms,\nalthough the actual qemu emulators have been discontinued on 32-bit.\n\nTo allow building the tools on 32-bit this patch implements two small\nchanges:\n\na) The check in meson.build is changed to still error out if the user\ntries to build qemu-system or qemu-user on a 32-bit platform, but allows\nbuilding tools (e.g. by \"--enable-tools\") alone.\n\nb) Remove the compile time checks in atomic.h because:\n- for the qemu-system and qemu-user emulators this check is redundant\n  since we only allow 64-bit platforms anyway (see a)\n- it breaks those 32-bit platforms, which do provide (slower) 64-bit atomics\n- 32-bit platforms without 64-bit atomics will fail instead with linker errors\n- the runtime speed of the qemu tools aren't actually that important.\n\nI've sucessfully tested building qemu tools on 32-bit hppa.\n\nSigned-off-by: Helge Deller <deller@gmx.de>\nReviewed-by: Michael Tokarev <mjt@tls.msk.ru>\n---\n include/qemu/atomic.h | 16 ----------------\n meson.build           |  4 ++--\n 2 files changed, 2 insertions(+), 18 deletions(-)","diff":"diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h\nindex dc9290084b..f05dce36eb 100644\n--- a/include/qemu/atomic.h\n+++ b/include/qemu/atomic.h\n@@ -56,14 +56,6 @@\n  */\n #define signal_barrier()    __atomic_signal_fence(__ATOMIC_SEQ_CST)\n \n-/*\n- * Sanity check that the size of an atomic operation isn't \"overly large\".\n- * Despite the fact that e.g. i686 has 64-bit atomic operations, we do not\n- * want to use them because we ought not need them, and this lets us do a\n- * bit of sanity checking that other 32-bit hosts might build.\n- */\n-#define ATOMIC_REG_SIZE  sizeof(void *)\n-\n /* Weak atomic operations prevent the compiler moving other\n  * loads/stores past the atomic operation load/store. However there is\n  * no explicit memory barrier for the processor.\n@@ -79,7 +71,6 @@\n \n #define qatomic_read(ptr)                              \\\n     ({                                                 \\\n-    qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \\\n     qatomic_read__nocheck(ptr);                        \\\n     })\n \n@@ -87,7 +78,6 @@\n     __atomic_store_n(ptr, i, __ATOMIC_RELAXED)\n \n #define qatomic_set(ptr, i)  do {                      \\\n-    qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \\\n     qatomic_set__nocheck(ptr, i);                      \\\n } while(0)\n \n@@ -110,7 +100,6 @@\n  */\n #define qatomic_rcu_read_internal(ptr, _val)            \\\n     ({                                                  \\\n-    qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \\\n     typeof_strip_qual(*ptr) _val;                       \\\n     qatomic_rcu_read__nocheck(ptr, &_val);              \\\n     _val;                                               \\\n@@ -119,20 +108,17 @@\n     qatomic_rcu_read_internal((ptr), MAKE_IDENTIFIER(_val))\n \n #define qatomic_rcu_set(ptr, i) do {                   \\\n-    qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \\\n     __atomic_store_n(ptr, i, __ATOMIC_RELEASE);        \\\n } while(0)\n \n #define qatomic_load_acquire(ptr)                       \\\n     ({                                                  \\\n-    qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \\\n     typeof_strip_qual(*ptr) _val;                       \\\n     __atomic_load(ptr, &_val, __ATOMIC_ACQUIRE);        \\\n     _val;                                               \\\n     })\n \n #define qatomic_store_release(ptr, i)  do {             \\\n-    qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE); \\\n     __atomic_store_n(ptr, i, __ATOMIC_RELEASE);         \\\n } while(0)\n \n@@ -144,7 +130,6 @@\n })\n \n #define qatomic_xchg(ptr, i)    ({                          \\\n-    qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE);     \\\n     qatomic_xchg__nocheck(ptr, i);                          \\\n })\n \n@@ -157,7 +142,6 @@\n })\n \n #define qatomic_cmpxchg(ptr, old, new)    ({                            \\\n-    qemu_build_assert(sizeof(*ptr) <= ATOMIC_REG_SIZE);                 \\\n     qatomic_cmpxchg__nocheck(ptr, old, new);                            \\\n })\n \ndiff --git a/meson.build b/meson.build\nindex daa58e46a3..98a708372b 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -323,8 +323,8 @@ endif\n # Compiler flags #\n ##################\n \n-if cc.sizeof('void *') < 8\n-  error('QEMU requires a 64-bit CPU host architecture')\n+if (cc.sizeof('void *') < 8) and (have_system or have_user)\n+  error('QEMU emulator requires a 64-bit CPU host architecture. Only tools may be built for 32-bit.')\n endif\n \n foreach lang : all_languages\n","prefixes":["for-11.0","6/6"]}