[PATCH 4/4] configs/targets: Forbid OpenRISC to use legacy native endianness APIs

Philippe Mathieu-Daudé posted 4 patches 1 month, 2 weeks ago
Maintainers: Laurent Vivier <laurent@vivier.eu>, Jia Liu <proljc@gmail.com>, Stafford Horne <shorne@gmail.com>
[PATCH 4/4] configs/targets: Forbid OpenRISC to use legacy native endianness APIs
Posted by Philippe Mathieu-Daudé 1 month, 2 weeks ago
All OpenRISC-related binaries are buildable without a single
use of the legacy "native endian" API. Unset the transitional
TARGET_USE_LEGACY_NATIVE_ENDIAN_API definition to forbid
further uses of the legacy API.

Preliminary commits allowing this final change:

 . 5b67dbf1dc3 target/openrisc: Replace target_ulong -> uint32_t
 . 500708331e3 target/openrisc: Inline tcg_gen_trunc_i64_tl()
 . 4f6c60683f2 target/openrisc: Replace MO_TE -> MO_BE
 . 73cd283e58d target/openrisc: Introduce mo_endian() helper
 . 2f737e19a4d target/openrisc: Conceal MO_TE within do_store()
 . 22c36c0a20c target/openrisc: Conceal MO_TE within do_load()
 . ef797ac0025 target/openrisc: Explode MO_TExx -> MO_TE | MO_xx
 . 81e2fb236b7 target/openrisc: Remove 'TARGET_LONG_BITS != 32' dead code
 . 9dc4862dc4a target/openrisc: Use vaddr type for $pc jumps
 . 2367c94cbb1 target/openrisc: Remove target_ulong use in raise_mmu_exception()
 . 1843e89bec5 target/openrisc: Remove unused cpu_openrisc_map_address_*() handlers
 . a3c4facd395 target/openrisc: Do not use target_ulong for @mr in MTSPR helper
 . 2795bc52af4 target/openrisc: Replace VMSTATE_UINTTL() -> VMSTATE_UINT32()

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 configs/targets/or1k-linux-user.mak | 1 +
 configs/targets/or1k-softmmu.mak    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/targets/or1k-linux-user.mak b/configs/targets/or1k-linux-user.mak
index 810567a98f9..97d7cb10465 100644
--- a/configs/targets/or1k-linux-user.mak
+++ b/configs/targets/or1k-linux-user.mak
@@ -3,3 +3,4 @@ TARGET_BIG_ENDIAN=y
 TARGET_SYSTBL_ABI=common,32,or1k,time32,stat64,rlimit,renameat
 TARGET_SYSTBL=syscall.tbl
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=y
diff --git a/configs/targets/or1k-softmmu.mak b/configs/targets/or1k-softmmu.mak
index 89f81b75bf7..c53408a2bf5 100644
--- a/configs/targets/or1k-softmmu.mak
+++ b/configs/targets/or1k-softmmu.mak
@@ -4,3 +4,4 @@ TARGET_BIG_ENDIAN=y
 TARGET_NEED_FDT=y
 TARGET_LONG_BITS=32
 TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
+TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=y
-- 
2.52.0


Re: [PATCH 4/4] configs/targets: Forbid OpenRISC to use legacy native endianness APIs
Posted by Richard Henderson 1 month ago
On 12/25/25 03:18, Philippe Mathieu-Daudé wrote:
> All OpenRISC-related binaries are buildable without a single
> use of the legacy "native endian" API. Unset the transitional
> TARGET_USE_LEGACY_NATIVE_ENDIAN_API definition to forbid
> further uses of the legacy API.
> 
> Preliminary commits allowing this final change:
> 
>   . 5b67dbf1dc3 target/openrisc: Replace target_ulong -> uint32_t
>   . 500708331e3 target/openrisc: Inline tcg_gen_trunc_i64_tl()
>   . 4f6c60683f2 target/openrisc: Replace MO_TE -> MO_BE
>   . 73cd283e58d target/openrisc: Introduce mo_endian() helper
>   . 2f737e19a4d target/openrisc: Conceal MO_TE within do_store()
>   . 22c36c0a20c target/openrisc: Conceal MO_TE within do_load()
>   . ef797ac0025 target/openrisc: Explode MO_TExx -> MO_TE | MO_xx
>   . 81e2fb236b7 target/openrisc: Remove 'TARGET_LONG_BITS != 32' dead code
>   . 9dc4862dc4a target/openrisc: Use vaddr type for $pc jumps
>   . 2367c94cbb1 target/openrisc: Remove target_ulong use in raise_mmu_exception()
>   . 1843e89bec5 target/openrisc: Remove unused cpu_openrisc_map_address_*() handlers
>   . a3c4facd395 target/openrisc: Do not use target_ulong for @mr in MTSPR helper
>   . 2795bc52af4 target/openrisc: Replace VMSTATE_UINTTL() -> VMSTATE_UINT32()
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   configs/targets/or1k-linux-user.mak | 1 +
>   configs/targets/or1k-softmmu.mak    | 1 +
>   2 files changed, 2 insertions(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~

Re: [PATCH 4/4] configs/targets: Forbid OpenRISC to use legacy native endianness APIs
Posted by Manos Pitsidianakis 1 month, 1 week ago
On Wed, Dec 24, 2025 at 6:18 PM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> All OpenRISC-related binaries are buildable without a single
> use of the legacy "native endian" API. Unset the transitional
> TARGET_USE_LEGACY_NATIVE_ENDIAN_API definition to forbid
> further uses of the legacy API.
>
> Preliminary commits allowing this final change:
>
>  . 5b67dbf1dc3 target/openrisc: Replace target_ulong -> uint32_t
>  . 500708331e3 target/openrisc: Inline tcg_gen_trunc_i64_tl()
>  . 4f6c60683f2 target/openrisc: Replace MO_TE -> MO_BE
>  . 73cd283e58d target/openrisc: Introduce mo_endian() helper
>  . 2f737e19a4d target/openrisc: Conceal MO_TE within do_store()
>  . 22c36c0a20c target/openrisc: Conceal MO_TE within do_load()
>  . ef797ac0025 target/openrisc: Explode MO_TExx -> MO_TE | MO_xx
>  . 81e2fb236b7 target/openrisc: Remove 'TARGET_LONG_BITS != 32' dead code
>  . 9dc4862dc4a target/openrisc: Use vaddr type for $pc jumps
>  . 2367c94cbb1 target/openrisc: Remove target_ulong use in raise_mmu_exception()
>  . 1843e89bec5 target/openrisc: Remove unused cpu_openrisc_map_address_*() handlers
>  . a3c4facd395 target/openrisc: Do not use target_ulong for @mr in MTSPR helper
>  . 2795bc52af4 target/openrisc: Replace VMSTATE_UINTTL() -> VMSTATE_UINT32()
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>

>  configs/targets/or1k-linux-user.mak | 1 +
>  configs/targets/or1k-softmmu.mak    | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/configs/targets/or1k-linux-user.mak b/configs/targets/or1k-linux-user.mak
> index 810567a98f9..97d7cb10465 100644
> --- a/configs/targets/or1k-linux-user.mak
> +++ b/configs/targets/or1k-linux-user.mak
> @@ -3,3 +3,4 @@ TARGET_BIG_ENDIAN=y
>  TARGET_SYSTBL_ABI=common,32,or1k,time32,stat64,rlimit,renameat
>  TARGET_SYSTBL=syscall.tbl
>  TARGET_LONG_BITS=32
> +TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=y
> diff --git a/configs/targets/or1k-softmmu.mak b/configs/targets/or1k-softmmu.mak
> index 89f81b75bf7..c53408a2bf5 100644
> --- a/configs/targets/or1k-softmmu.mak
> +++ b/configs/targets/or1k-softmmu.mak
> @@ -4,3 +4,4 @@ TARGET_BIG_ENDIAN=y
>  TARGET_NEED_FDT=y
>  TARGET_LONG_BITS=32
>  TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
> +TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=y
> --
> 2.52.0
>