From nobody Sun Nov 16 01:08:06 2025 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1745299843; cv=none; d=zohomail.com; s=zohoarc; b=HcNJRUDnakr3gdY8SLrP21rjXWdKrOoDlqQOnKDOzzJGiMh0q7fGxgcEvBGOQbVpM7qj/Lhv3HPyGsLwD3uvrrNjq9Rax0KtKmT/kYckUGFPuQ0h6FW3wKUzkSWCq4Da6CDh3ECiklS+tErwnuqdvw1Ajy2CK8KZRauheoj/8yM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745299843; 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=OcMrqg+AK4CG6FhWc+/PAoET2DJRr80sNz7sCzalahY=; b=JxC/Ko9ah/XcdG58DfmO1S94sg8HVxYz0KOERKNCqZS3GujuFiZBXgKnkc1ion9K3IuX5InIYVi9ow8uZfwNQe6+a+6zXNbOx+Vn86Yz0kVSlovYU7NLFXPwcMSGqOiGvspSaxQIaJdzTws1RUIT1JYnEP0ea74EFzv8T2OPsuc= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1745299843681700.5877954852333; Mon, 21 Apr 2025 22:30:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u76Cr-0002SI-0z; Tue, 22 Apr 2025 01:30:07 -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 1u76CM-00027G-5J; Tue, 22 Apr 2025 01:29:34 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u76CJ-0007tw-M6; Tue, 22 Apr 2025 01:29:33 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-226185948ffso52631865ad.0; Mon, 21 Apr 2025 22:29:29 -0700 (PDT) Received: from localhost.localdomain ([240d:1a:3b6:8b00:e142:4a4f:1ebb:3ca4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22c50eb4483sm75692085ad.118.2025.04.21.22.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Apr 2025 22:29:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745299768; x=1745904568; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OcMrqg+AK4CG6FhWc+/PAoET2DJRr80sNz7sCzalahY=; b=JWdkG5HoSkZVu0HI6hsSwEfSulS/xJVFeaXmBo0yerDtpuKDJwgf2CMHZbPMZyG1dP 8+dz0dmSW2knSCv14bPDsDpbh3kRyXUHYTNxlZZIAao5lWaqjzdb5pQb23TkoTXAWBqP kE2q4P4dPyoMkNHN9s9km9IgeiHn3kruceXXLeAX1UMj7Hvr8USdNA6GoRCvhoUJA2WV 5E8cXPrduDtXwoeCjoOUYvqw7o46kRG3BMsBxZMdoQ4j+3sC31kGrommitki+lGyvG0D rijOtxaFzMdwR4DyDU1ngVQRj8q+G5hBlyakgljJDU03GswSiDvWeqRZ9nseU1Y6LdO+ Ldkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745299768; x=1745904568; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OcMrqg+AK4CG6FhWc+/PAoET2DJRr80sNz7sCzalahY=; b=WINKk/bLTf+aQQ/MO+G5mXD9kYLgfzXj70Z8ZHFOs98kD9+UkHDhlpGrx3uzzvKR6v fUVDzCr11/MXgJYYEVaBUkvrYHJ1Y+kAT8Tvr3VSntuQWRfP2Dc1rKeBnsJKhThL+Eoq ObQqmRBPTeMmcpQQoDDSVgd4v6Ptq+1reFtKO7tpT1XHX6+zpaXWQrStyoEC9xOhglD+ ex0VxdNMw0mWxpQyVi/1opA8GqItqXjVzvHk4RqIjG6OHKP56cdEd0L+phAO+uq2AIsq 26CCNGdfoIdHXBJWCCczQjzZmBwm/w0ddFxRBva9UmSTGxZfjeLk2qipthsDKxHEkOB3 i+VA== X-Forwarded-Encrypted: i=1; AJvYcCUpK83syjOFQlgQcuRfk3P6vRwOTTvV/vBnFnhLnMbvMTmANzM6bc1+ftglF0BIN5q8qCAfR1PpojRssw==@nongnu.org, AJvYcCVs2qsE8AO/d6noQgPjNx/leDtNPZz4BTZdElK7KfyTAtUz2M+5nLCnawHd7d4ZLCN6JM7SheGbehw=@nongnu.org, AJvYcCW+Fh3Zurl6jgsqWPJAZzVlso/VP+Uqta1v2y9iKxYcG2E4x/rJ2XlwQhyIPeMRozj6zBRJ/w3ru5Cvog==@nongnu.org, AJvYcCXtqPvUDus8jsryyXvGHm82l4WKBbe3uOjeiD05ZCNf8mNEhmYmeVzuhAdi6WPreOnyPF8JrbsHvg==@nongnu.org X-Gm-Message-State: AOJu0Ywv37OjIzLBDe12a7RzgDUSgtlwZMVa22aL/pOVTd1CNh72A0dD Io7f/lAKmyDt7TeCWm7r+2l8z6wBvt7tlNjexlI/aqbQdspSHnM5un06IIlQ X-Gm-Gg: ASbGncuiVlHaoXtHaBGw/oZkpu2FkbpJy2JqSyZ3RVnUDrK1Hx1KsiPQ1sAGNAQGYPa WCxayFzB4XknHnvNqUDM2lqoJdRKLHG0n35DA4Ap4Kbw4OjeZysKY5i2+NX9Mchmbgp6yASmHYd o4JIfnUvG3Dwia0owhoWNm9ADipJ0rZEY9ZljGEUwIL97PKjXEPhy4GTIfoc0aSDo8YFLXeG9/3 6k7asBSwdp8igTwSKJ4x8Cr0vbeO5Q+hr9TA7B+nOVK0PCK9elLtB0hBCAcwTiTCdry7zLWOozL 1/dxCv2bQONgYKj1dCVDqg6M3638cT9vXhea55iUB1uoxKWbLQJv5e5BIZ0= X-Google-Smtp-Source: AGHT+IGRZvEetiyqa+fm/MRvQqrwC4kyd4L2y1DWQfWnFLGfwS9xzLmNLqSqcW3bp/SNxhoA9tvehg== X-Received: by 2002:a17:903:298c:b0:224:1d1c:8837 with SMTP id d9443c01a7336-22c535830d6mr189707265ad.19.1745299768184; Mon, 21 Apr 2025 22:29:28 -0700 (PDT) From: Kohei Tokunaga To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , Kevin Wolf , Hanna Reitz , Kohei Tokunaga , Paolo Bonzini , Alexandre Iooss , Mahmoud Mandour , Pierrick Bouvier , Pavel Pisa , Francisco Iglesias , Vikram Garhwal , Jason Wang , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Eduardo Habkost , Peter Xu , David Hildenbrand , Peter Maydell , Zhao Liu , Nicholas Piggin , Daniel Henrique Barboza , Richard Henderson , Ilya Leoshkevich , Stefan Hajnoczi , qemu-block@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org Subject: [PATCH v2 11/20] util/cacheflush.c: Update cache flushing mechanism for Emscripten Date: Tue, 22 Apr 2025 14:27:15 +0900 Message-Id: <73301cc216217d5c3e0d7acdd32482e36f4f045c.1745295397.git.ktokunaga.mail@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: 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=2607:f8b0:4864:20::636; 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, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: 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 @gmail.com) X-ZM-MESSAGEID: 1745299846961019000 Content-Type: text/plain; charset="utf-8" Although __builtin___clear_cache is used to flush the instruction cache for a specified memory region[1], this operation doesn't apply to wasm, as its memory isn't executable. Moreover, Emscripten does not support this builtin and fails to compile it with the following error. > fatal error: error in backend: llvm.clear_cache is not supported on wasm To resolve this, this commit removes the call to __builtin___clear_cache for Emscripten build. [1] https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Other-Builtins.html#index= -_005f_005fbuiltin_005f_005f_005fclear_005fcache Signed-off-by: Kohei Tokunaga Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/qemu/cacheflush.h | 7 +++++++ util/cacheflush.c | 4 ++++ 2 files changed, 11 insertions(+) V2: - Added an explanation for the change to both the code comment and the commit message. diff --git a/include/qemu/cacheflush.h b/include/qemu/cacheflush.h index ae20bcda73..76eb55d818 100644 --- a/include/qemu/cacheflush.h +++ b/include/qemu/cacheflush.h @@ -26,6 +26,13 @@ static inline void flush_idcache_range(uintptr_t rx, uin= tptr_t rw, size_t len) /* icache is coherent and does not require flushing. */ } =20 +#elif defined(EMSCRIPTEN) + +static inline void flush_idcache_range(uintptr_t rx, uintptr_t rw, size_t = len) +{ + /* Wasm doesn't have executable region of memory. */ +} + #else =20 void flush_idcache_range(uintptr_t rx, uintptr_t rw, size_t len); diff --git a/util/cacheflush.c b/util/cacheflush.c index 1d12899a39..17c58918de 100644 --- a/util/cacheflush.c +++ b/util/cacheflush.c @@ -229,6 +229,10 @@ static void __attribute__((constructor)) init_cache_in= fo(void) =20 /* Caches are coherent and do not require flushing; symbol inline. */ =20 +#elif defined(EMSCRIPTEN) + +/* Wasm doesn't have executable region of memory. */ + #elif defined(__aarch64__) && !defined(CONFIG_WIN32) /* * For Windows, we use generic implementation of flush_idcache_range, that --=20 2.25.1