From patchwork Fri Mar 14 17:31:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 14017220 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 29DB4C282EC for ; Fri, 14 Mar 2025 17:33:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tt8tY-0005of-I5; Fri, 14 Mar 2025 13:32:28 -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 1tt8t6-0005aZ-0Y for qemu-devel@nongnu.org; Fri, 14 Mar 2025 13:32:01 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tt8sx-0008DY-7F for qemu-devel@nongnu.org; Fri, 14 Mar 2025 13:31:57 -0400 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-22409077c06so62101995ad.1 for ; Fri, 14 Mar 2025 10:31:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741973509; x=1742578309; 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=XrSCanhi6//y8zzrdi4v8BnHzauYNOujovCqPIhMBF/Vuoymke2Esn2dyHzT6T34ha lb40lTuhQijssrYb9qyzpO5N9xjtAvwlWb0/G6UJCu/u2hZWIufHflTk5yraaSUY9RT4 hvbV5/X8mFjkKNxIw9x4YLYQTd1Lp3R2hIDN12kxMIyRDQPwoz/kETaTluhn8GpKcnrm A70rH7hIc5h8E3Y1yh9hOtoF7GYLuWRrei85xrUGRPDspcDMVBBjJAcmN0ilNk+QDm1W hd5KCHIDiMEdXBm91vykb8+9ZJD3XjKdDjCA71IepASxtJfFstt0eQJyhdwbOBRFJb02 /8ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741973509; x=1742578309; 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=iSImYdIAm1IFUwDqnVc18n8aUaCNiIGJL3PCHqtgMAhnfkot0LqojPyQiPwp9MciXQ yBDcSs9K98PK9gXbaJKr913BriYY4qWCGBQYqaWCkb76IetnpMOBmlUHMQ5NE4pMnf8n 3QHxyY5I+cH74YwTdetBZ2sgSgYxpX7fyV6trT3OujB8bBFY9WbmtnEYMuUo93545+qL vzfE//HAJQxEi16e033S5yHyG7Hrd0wA/j9l2j7UboMsAokxToANjSpCrho1IsoSqngK meWgkzE4/B/yJVMQNnfebYAk62Y+3pK34WZtww7dWlFvMAWRFZt+z5LORapX9CSGdJTG YSfA== X-Gm-Message-State: AOJu0YyyL/BXK9ErtV58EP5pbIf5jo0Bt9131CmAl0Deq5dJ+O2uDmIE 48f9xJe8UNP4o//Rbc/VBs4i/1AUusAWHp/sFbyqqlk9aTS0/9IlenGB7GU98oAkYL1J8S5Exix DmPA= X-Gm-Gg: ASbGncu2+1iL5x+C1W+MaptHwTLJOEEpQoVpEzhOOR24+t3HwmSsMngzBPXWH+RXjBn mn/Fi1+PmUeupEeoYfO2kiTauonBxu41niVmxeDXEMmg8ioIsPUzpesbmz93UJlh3tdDFa/eXGQ AOHmNktwgSFwpImkTMA+sO7O7DtkPhIlaRriLK/VeUdhwnicwgrgk3AMngMvmNVIEjwNcBqUOGF hNwwtinF/seCpuW0rSKO77LjLWkyTVOrgnDpq5tGcvYHKuR2rBuYlavVXACVV9m3SjqJi2EPZI5 f8smY8UVuEtwvV+RpC9tN/wEEmPEDw5Z2yyHSJ13+XZv X-Google-Smtp-Source: AGHT+IFQBeqqn3ezA5En8rRFWwDRdkhHWJ51dC4tNWFcY4zpXwmWJXk93HseKx7PQbRLNq1zxfYk9w== X-Received: by 2002:a05:6a21:1519:b0:1f5:8a1d:3905 with SMTP id adf61e73a8af0-1f5c10f7d60mr6252806637.7.1741973509576; Fri, 14 Mar 2025 10:31:49 -0700 (PDT) Received: from pc.. ([38.39.164.180]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-af56e9cd03bsm2990529a12.8.2025.03.14.10.31.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Mar 2025 10:31:49 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Yoshinori Sato , Paul Durrant , Peter Xu , alex.bennee@linaro.org, Harsh Prateek Bora , David Hildenbrand , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Richard Henderson , "Edgar E. Iglesias" , Liu Zhiwei , Nicholas Piggin , Daniel Henrique Barboza , qemu-riscv@nongnu.org, manos.pitsidianakis@linaro.org, Palmer Dabbelt , Anthony PERARD , kvm@vger.kernel.org, xen-devel@lists.xenproject.org, Stefano Stabellini , Paolo Bonzini , Weiwei Li , Pierrick Bouvier Subject: [PATCH v5 04/17] exec/memory_ldst_phys: extract memory_ldst_phys declarations from cpu-all.h Date: Fri, 14 Mar 2025 10:31:26 -0700 Message-Id: <20250314173139.2122904-5-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250314173139.2122904-1-pierrick.bouvier@linaro.org> References: <20250314173139.2122904-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x62b.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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