From 23b34de6dfbd42f1c2d9df0f0aee12b5cab3d2e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 9 Dec 2025 19:24:05 +0100 Subject: [PATCH] system: Allow restricting the legacy ld/st_phys() 'native-endian' API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guard the native endian APIs we want to remove by surrounding them with TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API #ifdef'ry. Since all targets can check the definition, do not poison it. Once a target gets cleaned we'll set the definition in the target config, then the target won't be able to use the legacy API anymore. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Reviewed-by: Richard Henderson Message-ID: <20260109165058.59144-15-philmd@linaro.org> --- include/system/memory_ldst_phys.h.inc | 2 ++ scripts/make-config-poison.sh | 1 + 2 files changed, 3 insertions(+) diff --git a/include/system/memory_ldst_phys.h.inc b/include/system/memory_ldst_phys.h.inc index f4c91dc7a9..66bbd3061c 100644 --- a/include/system/memory_ldst_phys.h.inc +++ b/include/system/memory_ldst_phys.h.inc @@ -31,8 +31,10 @@ static inline void glue(stb_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint8_t val) MEMTXATTRS_UNSPECIFIED, NULL); } +#ifndef TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API #define ENDIANNESS #include "system/memory_ldst_phys_endian.h.inc" +#endif /* TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API */ #define ENDIANNESS _le #include "system/memory_ldst_phys_endian.h.inc" diff --git a/scripts/make-config-poison.sh b/scripts/make-config-poison.sh index 937357b353..b4d61e8bc9 100755 --- a/scripts/make-config-poison.sh +++ b/scripts/make-config-poison.sh @@ -11,6 +11,7 @@ exec sed -n \ -e '/CONFIG_USER_ONLY/d' \ -e '/CONFIG_SOFTMMU/d' \ -e '/TARGET_NOT_USING_LEGACY_LDST_PHYS_API/d' \ + -e '/TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API/d' \ -e '/^#define / {' \ -e 's///' \ -e 's/ .*//' \