From patchwork Tue Mar 11 19:57:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 872496 Delivered-To: patch@linaro.org Received: by 2002:a5d:64ce:0:b0:38f:210b:807b with SMTP id f14csp1661084wri; Tue, 11 Mar 2025 12:59:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWtRy7XwRSN1ZGjVb32GEXbZqvlpIsS2nwVYUwE374Z1v83VZCyYyFHwcbl4z/8KfuptqecAg==@linaro.org X-Google-Smtp-Source: AGHT+IHpYH3swAYoUB0lsas2bmYxrWruMiKrXzHvLj0En9WOG9tq6UQgI5ZVEQGzwJKFfoN6iRQW X-Received: by 2002:a05:620a:2b86:b0:7c5:3ca5:58f2 with SMTP id af79cd13be357-7c53ca55ae0mr2332789485a.7.1741723167237; Tue, 11 Mar 2025 12:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1741723167; cv=none; d=google.com; s=arc-20240605; b=iSx+840hc0wUQFdrlqdMz7AnnNBERWuZeJ3yiyYqiIZS3Xds7Sd3jrnH0yDScv7yUd K96KWwbwWENlw6vz1gFm9NOhJt+zo4YAaPDiJIh3a1LI8RbSyaXrB/FEaFwGYMJSUzVP teTx6sAi23BwD5Ne3nV18rrpUEWgyvVshTtjFLz6sgsWQ40MmoLI13KNX2WwFrcmy2EN b4z++c3P3BGom3Jgac5sDwB/e3Dl00tWsx0iHVGsFwVofmHsjHOBq1HgEwtGhJoF96cJ Ny6Chb9ZapviGyEv3odp82WQBzb6L9XNgK8vUXU0zavA933/opZ6T8dcrIR7oGKIJAEs IFIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G6OuFeXnonCJBRRaCKlE2hD3nLeAbwsquVgoLJADjfc=; fh=kEoQpoDeYKqqTWMOc0Iq2e1LPI+fIsbUMg+I80Y/mck=; b=Y8oECtVPnCFfiMda1epF4ahn9woiTnl/mUckEV+y5+83bTQsv+a0ECge+TtmPEC22l han+27a1rRCkis2cT8KJF39xxWmPz6HQMC7LbYyn2mi23FtCg0kSn5sRJwuyiPvcdPGR 8z0hZGVkuJufFWUF+PkLrFxnEpMeUHvibQp+gWYFIwIV4e5js0kVLibnXSepw7yXcUMI kYxriqiO57xvoYGkoksuQL2dBP9Tb66ReARSp6kDFY6wqMsJLp97wzEyBpupvuhwFtr9 JzTdVPZoW7Dsq3oHghb0rOE03vr+pqBTAGFY+ZUPThbRwMBRWSvmmGd5WgvdZj7MHgLo ERIw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k2hoOdPB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7c5592be63dsi342471685a.407.2025.03.11.12.59.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Mar 2025 12:59:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k2hoOdPB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ts5kY-0001Tf-RH; Tue, 11 Mar 2025 15:58:50 -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 1ts5k5-0000x1-V7 for qemu-devel@nongnu.org; Tue, 11 Mar 2025 15:58:22 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ts5k1-0008Vn-Gi for qemu-devel@nongnu.org; Tue, 11 Mar 2025 15:58:21 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-2241053582dso20460545ad.1 for ; Tue, 11 Mar 2025 12:58:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741723095; x=1742327895; 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=G6OuFeXnonCJBRRaCKlE2hD3nLeAbwsquVgoLJADjfc=; b=k2hoOdPB+OKNBgM7+tTzlE0zETqfSmJ2wsl+6YMnwIQEa6yZ7MxH9PG4znReJOma38 qymgAUS4aLBEbIG6m8tlQYqVMs0gNO8WkmHhGNrLwLaCc6U6Tc+eGIlZ+69+rXrJl0ju VxA6mXziALiotvIIs5M7EcTvd0hUVCa6GN+zIFrsG2UodXkyko/a6ETNQ4ifRJlxQBJz 1/JwDO9k8jQ3DVuFp8ApzP0mqC3H/xpF8VgC6n4uFaAsQvuMy3wHowASw2+LHZRc4x/l /Pkg6+Sf3AGpLb9Yt4TAgojwbiZJXQ9irRlzpULmCXNe0BZ/fWMbZworHOHTdg40SZyA eJQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741723095; x=1742327895; 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=G6OuFeXnonCJBRRaCKlE2hD3nLeAbwsquVgoLJADjfc=; b=E5saFZcodqGS15t2VsKbco2fHWmL8/HH2Iak8rXe6CDgi45R3NQwVbT0k82sElHuOl I+OHp3skWEJuHV21JV6JV3gIooqqCHCvBTAr/f0sl4h0SqBneISrEtcXMvmefsHA2LUp sM0boKzOAvf2TnBW1FAIBAvSorJKvd4ynkJ7yNuXZNETN6Eb9g9JQbFVDu1Ep0E8Ljmd De5GUvdVJrWorjPwW+zwmtMKhby91pEz/RR2M7WFgKcQexP+7Gu5X6LMe/UAjik2DSSV Yw3HhzmBUDxThKhJziDqvlHimrWUPDUDkFHQgm8ywfr9L61JliPy2u4epfq2B4FjGviY g7VQ== X-Gm-Message-State: AOJu0YyByqzRfhwTcTk63dAZzpjZQ8YTPOBokel5NYcTIX62Jesp4GQk lE9yVg6ZXl+Vh2tfQZVEbcxB6BJAkuLqu8rGpKSsKHrB6VV4h9E6pHLTlpLlZhFICzZMdDbJUdY 23E0= X-Gm-Gg: ASbGncu2xtn6l5SxSL9daFGTq/3vjIILdABk5vMHEmHMkkw5QqPZCqTC1suBe/qeidG QpyA59G9aEfOBL6h32j4yDQwTvER18C7ApD40Ale7REgJiJ6CGSrPfl6e08nKuiqOezwuA4B9MV LaaTtZUwPKR9hJPir9c82UR2WT8cku52id+YO6Cd4iNwf5EmtHkkyze0Syb1D9Mx+Skeo5jr85w pfJBgq1CXFOXFfdvRGQztcE5BcCZYx4qQZKCYvHwt840dtz3iv/BG6bLQRSW9ffiBmB8TgaXZ+Z 3nnxoOLQWde1Z51btLbOo1HilV4xIhE2MDIG1TAAS66H X-Received: by 2002:a05:6a00:190a:b0:736:31cf:2590 with SMTP id d2e1a72fcca58-736aaaad27fmr26132051b3a.16.1741723095319; Tue, 11 Mar 2025 12:58:15 -0700 (PDT) Received: from pc.. ([38.39.164.180]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-736a6e5c13asm9646981b3a.157.2025.03.11.12.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 12:58:14 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: David Hildenbrand , Stefano Stabellini , "Edgar E. Iglesias" , Anthony PERARD , xen-devel@lists.xenproject.org, Nicholas Piggin , Richard Henderson , Weiwei Li , kvm@vger.kernel.org, Palmer Dabbelt , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paul Durrant , Liu Zhiwei , Daniel Henrique Barboza , manos.pitsidianakis@linaro.org, Peter Xu , Harsh Prateek Bora , Alistair Francis , alex.bennee@linaro.org, Yoshinori Sato , qemu-riscv@nongnu.org, qemu-ppc@nongnu.org, Pierrick Bouvier Subject: [PATCH v3 04/17] exec/memory_ldst_phys: extract memory_ldst_phys declarations from cpu-all.h Date: Tue, 11 Mar 2025 12:57:50 -0700 Message-Id: <20250311195803.4115788-5-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250311195803.4115788-1-pierrick.bouvier@linaro.org> References: <20250311195803.4115788-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x633.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org They are now accessible through exec/memory.h instead, and we make sure all variants are available for common or target dependent code. Move stl_phys_notdirty function as well. Cached endianness agnostic version rely on st/ld*_p, which is available through tswap.h. Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier --- include/exec/cpu-all.h | 29 ----------------------------- include/exec/memory.h | 10 ++++++++++ include/exec/memory_ldst_phys.h.inc | 5 +---- 3 files changed, 11 insertions(+), 33 deletions(-) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 0e8205818a4..902ca1f3c7b 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -38,35 +38,6 @@ #define BSWAP_NEEDED #endif -/* MMU memory access macros */ - -#if !defined(CONFIG_USER_ONLY) - -#include "exec/hwaddr.h" - -static inline void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val) -{ - address_space_stl_notdirty(as, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -#define SUFFIX -#define ARG1 as -#define ARG1_DECL AddressSpace *as -#define TARGET_ENDIANNESS -#include "exec/memory_ldst_phys.h.inc" - -/* Inline fast path for direct RAM access. */ -#define ENDIANNESS -#include "exec/memory_ldst_cached.h.inc" - -#define SUFFIX _cached -#define ARG1 cache -#define ARG1_DECL MemoryRegionCache *cache -#define TARGET_ENDIANNESS -#include "exec/memory_ldst_phys.h.inc" -#endif - /* page related stuff */ #include "exec/cpu-defs.h" #include "exec/target_page.h" diff --git a/include/exec/memory.h b/include/exec/memory.h index d09af58c971..da21e9150b5 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -21,6 +21,7 @@ #include "exec/memattrs.h" #include "exec/memop.h" #include "exec/ramlist.h" +#include "exec/tswap.h" #include "qemu/bswap.h" #include "qemu/queue.h" #include "qemu/int128.h" @@ -2732,6 +2733,12 @@ MemTxResult address_space_write_rom(AddressSpace *as, hwaddr addr, #define ARG1_DECL AddressSpace *as #include "exec/memory_ldst.h.inc" +static inline void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val) +{ + address_space_stl_notdirty(as, addr, val, + MEMTXATTRS_UNSPECIFIED, NULL); +} + #define SUFFIX #define ARG1 as #define ARG1_DECL AddressSpace *as @@ -2798,6 +2805,9 @@ static inline void address_space_stb_cached(MemoryRegionCache *cache, } } +#define ENDIANNESS +#include "exec/memory_ldst_cached.h.inc" + #define ENDIANNESS _le #include "exec/memory_ldst_cached.h.inc" diff --git a/include/exec/memory_ldst_phys.h.inc b/include/exec/memory_ldst_phys.h.inc index ecd678610d1..db67de75251 100644 --- a/include/exec/memory_ldst_phys.h.inc +++ b/include/exec/memory_ldst_phys.h.inc @@ -19,7 +19,6 @@ * License along with this library; if not, see . */ -#ifdef TARGET_ENDIANNESS static inline uint16_t glue(lduw_phys, SUFFIX)(ARG1_DECL, hwaddr addr) { return glue(address_space_lduw, SUFFIX)(ARG1, addr, @@ -55,7 +54,7 @@ static inline void glue(stq_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val) glue(address_space_stq, SUFFIX)(ARG1, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); } -#else + static inline uint8_t glue(ldub_phys, SUFFIX)(ARG1_DECL, hwaddr addr) { return glue(address_space_ldub, SUFFIX)(ARG1, addr, @@ -139,9 +138,7 @@ static inline void glue(stq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t va glue(address_space_stq_be, SUFFIX)(ARG1, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); } -#endif #undef ARG1_DECL #undef ARG1 #undef SUFFIX -#undef TARGET_ENDIANNESS