{"id":2075146,"url":"http://patchwork.ozlabs.org/api/patches/2075146/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/73301cc216217d5c3e0d7acdd32482e36f4f045c.1745295397.git.ktokunaga.mail@gmail.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/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":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<73301cc216217d5c3e0d7acdd32482e36f4f045c.1745295397.git.ktokunaga.mail@gmail.com>","list_archive_url":null,"date":"2025-04-22T05:27:15","name":"[v2,11/20] util/cacheflush.c: Update cache flushing mechanism for Emscripten","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"bd8ff46333298c9e8c211e8126c8365010766730","submitter":{"id":90637,"url":"http://patchwork.ozlabs.org/api/people/90637/?format=json","name":"Kohei Tokunaga","email":"ktokunaga.mail@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/73301cc216217d5c3e0d7acdd32482e36f4f045c.1745295397.git.ktokunaga.mail@gmail.com/mbox/","series":[{"id":453631,"url":"http://patchwork.ozlabs.org/api/series/453631/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=453631","date":"2025-04-22T05:27:04","name":"Enable QEMU TCI to run 32bit guests on browsers","version":2,"mbox":"http://patchwork.ozlabs.org/series/453631/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2075146/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2075146/checks/","tags":{},"related":[],"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 unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20230601 header.b=JWdkG5Ho;\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 4ZhW6B5TtWz1yMZ\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 22 Apr 2025 15:30:26 +1000 (AEST)","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 1u76Cr-0002SI-0z; Tue, 22 Apr 2025 01:30:07 -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 <ktokunaga.mail@gmail.com>)\n id 1u76CM-00027G-5J; Tue, 22 Apr 2025 01:29:34 -0400","from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <ktokunaga.mail@gmail.com>)\n id 1u76CJ-0007tw-M6; Tue, 22 Apr 2025 01:29:33 -0400","by mail-pl1-x636.google.com with SMTP id\n d9443c01a7336-226185948ffso52631865ad.0;\n Mon, 21 Apr 2025 22:29:29 -0700 (PDT)","from localhost.localdomain ([240d:1a:3b6:8b00:e142:4a4f:1ebb:3ca4])\n by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-22c50eb4483sm75692085ad.118.2025.04.21.22.29.21\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 21 Apr 2025 22:29:27 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20230601; t=1745299768; x=1745904568; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=OcMrqg+AK4CG6FhWc+/PAoET2DJRr80sNz7sCzalahY=;\n b=JWdkG5HoSkZVu0HI6hsSwEfSulS/xJVFeaXmBo0yerDtpuKDJwgf2CMHZbPMZyG1dP\n 8+dz0dmSW2knSCv14bPDsDpbh3kRyXUHYTNxlZZIAao5lWaqjzdb5pQb23TkoTXAWBqP\n kE2q4P4dPyoMkNHN9s9km9IgeiHn3kruceXXLeAX1UMj7Hvr8USdNA6GoRCvhoUJA2WV\n 5E8cXPrduDtXwoeCjoOUYvqw7o46kRG3BMsBxZMdoQ4j+3sC31kGrommitki+lGyvG0D\n rijOtxaFzMdwR4DyDU1ngVQRj8q+G5hBlyakgljJDU03GswSiDvWeqRZ9nseU1Y6LdO+\n Ldkg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1745299768; x=1745904568;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=OcMrqg+AK4CG6FhWc+/PAoET2DJRr80sNz7sCzalahY=;\n b=WINKk/bLTf+aQQ/MO+G5mXD9kYLgfzXj70Z8ZHFOs98kD9+UkHDhlpGrx3uzzvKR6v\n fUVDzCr11/MXgJYYEVaBUkvrYHJ1Y+kAT8Tvr3VSntuQWRfP2Dc1rKeBnsJKhThL+Eoq\n ObQqmRBPTeMmcpQQoDDSVgd4v6Ptq+1reFtKO7tpT1XHX6+zpaXWQrStyoEC9xOhglD+\n ex0VxdNMw0mWxpQyVi/1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qa+fm/MRvQqrwC4kyd4L2y1DWQfWnFLGfwS9xzLmNLqSqcW3bp/SNxhoA9tvehg==","X-Received":"by 2002:a17:903:298c:b0:224:1d1c:8837 with SMTP id\n d9443c01a7336-22c535830d6mr189707265ad.19.1745299768184;\n Mon, 21 Apr 2025 22:29:28 -0700 (PDT)","From":"Kohei Tokunaga <ktokunaga.mail@gmail.com>","To":"qemu-devel@nongnu.org","Cc":"=?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org>, =?utf-8?q?Philipp?=\n\t=?utf-8?q?e_Mathieu-Daud=C3=A9?= <philmd@linaro.org>,\n Thomas Huth <thuth@redhat.com>, Kevin Wolf <kwolf@redhat.com>,\n Hanna Reitz <hreitz@redhat.com>, Kohei Tokunaga <ktokunaga.mail@gmail.com>,\n Paolo Bonzini <pbonzini@redhat.com>, Alexandre Iooss <erdnaxe@crans.org>,\n Mahmoud Mandour <ma.mandourr@gmail.com>,\n Pierrick Bouvier <pierrick.bouvier@linaro.org>,\n Pavel Pisa <pisa@cmp.felk.cvut.cz>,\n Francisco Iglesias <francisco.iglesias@amd.com>,\n Vikram Garhwal <vikram.garhwal@bytedance.com>,\n Jason Wang <jasowang@redhat.com>,\n =?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>,\n\t=?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= <berrange@redhat.com>,\n Eduardo Habkost <eduardo@habkost.net>, Peter Xu <peterx@redhat.com>,\n David Hildenbrand <david@redhat.com>,\n Peter Maydell <peter.maydell@linaro.org>, Zhao Liu <zhao1.liu@intel.com>,\n Nicholas Piggin <npiggin@gmail.com>,\n Daniel Henrique Barboza <danielhb413@gmail.com>,\n Richard Henderson <richard.henderson@linaro.org>,\n Ilya Leoshkevich <iii@linux.ibm.com>, Stefan Hajnoczi <stefanha@redhat.com>,\n qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org,\n qemu-s390x@nongnu.org","Subject":"[PATCH v2 11/20] util/cacheflush.c: Update cache flushing mechanism\n for Emscripten","Date":"Tue, 22 Apr 2025 14:27:15 +0900","Message-Id":"\n <73301cc216217d5c3e0d7acdd32482e36f4f045c.1745295397.git.ktokunaga.mail@gmail.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<cover.1745295397.git.ktokunaga.mail@gmail.com>","References":"<cover.1745295397.git.ktokunaga.mail@gmail.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=2607:f8b0:4864:20::636;\n envelope-from=ktokunaga.mail@gmail.com; helo=mail-pl1-x636.google.com","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, 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-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":"Although __builtin___clear_cache is used to flush the instruction cache for\na specified memory region[1], this operation doesn't apply to wasm, as its\nmemory isn't executable. Moreover, Emscripten does not support this builtin\nand fails to compile it with the following error.\n\n> fatal error: error in backend: llvm.clear_cache is not supported on wasm\n\nTo resolve this, this commit removes the call to __builtin___clear_cache for\nEmscripten build.\n\n[1] https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005f_005f_005fclear_005fcache\n\nSigned-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>\n---\n include/qemu/cacheflush.h | 7 +++++++\n util/cacheflush.c         | 4 ++++\n 2 files changed, 11 insertions(+)\n\nV2:\n- Added an explanation for the change to both the code comment and the\n  commit message.","diff":"diff --git a/include/qemu/cacheflush.h b/include/qemu/cacheflush.h\nindex ae20bcda73..76eb55d818 100644\n--- a/include/qemu/cacheflush.h\n+++ b/include/qemu/cacheflush.h\n@@ -26,6 +26,13 @@ static inline void flush_idcache_range(uintptr_t rx, uintptr_t rw, size_t len)\n     /* icache is coherent and does not require flushing. */\n }\n \n+#elif defined(EMSCRIPTEN)\n+\n+static inline void flush_idcache_range(uintptr_t rx, uintptr_t rw, size_t len)\n+{\n+    /* Wasm doesn't have executable region of memory. */\n+}\n+\n #else\n \n void flush_idcache_range(uintptr_t rx, uintptr_t rw, size_t len);\ndiff --git a/util/cacheflush.c b/util/cacheflush.c\nindex 1d12899a39..17c58918de 100644\n--- a/util/cacheflush.c\n+++ b/util/cacheflush.c\n@@ -229,6 +229,10 @@ static void __attribute__((constructor)) init_cache_info(void)\n \n /* Caches are coherent and do not require flushing; symbol inline. */\n \n+#elif defined(EMSCRIPTEN)\n+\n+/* Wasm doesn't have executable region of memory. */\n+\n #elif defined(__aarch64__) && !defined(CONFIG_WIN32)\n /*\n  * For Windows, we use generic implementation of flush_idcache_range, that\n","prefixes":["v2","11/20"]}