[PATCH 8/8] configs/targets: Forbid S390x to use legacy native endianness APIs

Philippe Mathieu-Daudé posted 8 patches 1 month, 2 weeks ago
Maintainers: Laurent Vivier <laurent@vivier.eu>, Halil Pasic <pasic@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, Farhan Ali <alifm@linux.ibm.com>, Thomas Huth <thuth@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Ilya Leoshkevich <iii@linux.ibm.com>, David Hildenbrand <david@kernel.org>, Matthew Rosato <mjrosato@linux.ibm.com>, "Michael S. Tsirkin" <mst@redhat.com>, Cornelia Huck <cohuck@redhat.com>
[PATCH 8/8] configs/targets: Forbid S390x to use legacy native endianness APIs
Posted by Philippe Mathieu-Daudé 1 month, 2 weeks ago
All S390x-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.

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

diff --git a/configs/targets/s390x-linux-user.mak b/configs/targets/s390x-linux-user.mak
index 68c2f288724..e3723f5dc54 100644
--- a/configs/targets/s390x-linux-user.mak
+++ b/configs/targets/s390x-linux-user.mak
@@ -4,3 +4,4 @@ TARGET_SYSTBL=syscall.tbl
 TARGET_BIG_ENDIAN=y
 TARGET_XML_FILES= gdb-xml/s390x-core64.xml gdb-xml/s390-acr.xml gdb-xml/s390-fpr.xml gdb-xml/s390-vx.xml gdb-xml/s390-cr.xml gdb-xml/s390-virt.xml gdb-xml/s390-virt-kvm.xml gdb-xml/s390-gs.xml
 TARGET_LONG_BITS=64
+TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=y
diff --git a/configs/targets/s390x-softmmu.mak b/configs/targets/s390x-softmmu.mak
index 76dd5de6584..544657cfe2d 100644
--- a/configs/targets/s390x-softmmu.mak
+++ b/configs/targets/s390x-softmmu.mak
@@ -3,3 +3,4 @@ TARGET_BIG_ENDIAN=y
 TARGET_KVM_HAVE_GUEST_DEBUG=y
 TARGET_XML_FILES= gdb-xml/s390x-core64.xml gdb-xml/s390-acr.xml gdb-xml/s390-fpr.xml gdb-xml/s390-vx.xml gdb-xml/s390-cr.xml gdb-xml/s390-virt.xml gdb-xml/s390-virt-kvm.xml gdb-xml/s390-gs.xml
 TARGET_LONG_BITS=64
+TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=y
-- 
2.52.0


Re: [PATCH 8/8] configs/targets: Forbid S390x to use legacy native endianness APIs
Posted by Eric Farman 1 month ago
On Wed, 2025-12-24 at 17:20 +0100, Philippe Mathieu-Daudé wrote:
> All S390x-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.

One nit is that this text confuses me, because the code below sets
TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API rather than unsetting TARGET_USE_LEGACY_NATIVE_ENDIAN_API.

End goal seems the same though.

Thanks,
Eric

> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  configs/targets/s390x-linux-user.mak | 1 +
>  configs/targets/s390x-softmmu.mak    | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/configs/targets/s390x-linux-user.mak b/configs/targets/s390x-linux-user.mak
> index 68c2f288724..e3723f5dc54 100644
> --- a/configs/targets/s390x-linux-user.mak
> +++ b/configs/targets/s390x-linux-user.mak
> @@ -4,3 +4,4 @@ TARGET_SYSTBL=syscall.tbl
>  TARGET_BIG_ENDIAN=y
>  TARGET_XML_FILES= gdb-xml/s390x-core64.xml gdb-xml/s390-acr.xml gdb-xml/s390-fpr.xml gdb-xml/s390-vx.xml gdb-xml/s390-cr.xml gdb-xml/s390-virt.xml gdb-xml/s390-virt-kvm.xml gdb-xml/s390-gs.xml
>  TARGET_LONG_BITS=64
> +TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=y
> diff --git a/configs/targets/s390x-softmmu.mak b/configs/targets/s390x-softmmu.mak
> index 76dd5de6584..544657cfe2d 100644
> --- a/configs/targets/s390x-softmmu.mak
> +++ b/configs/targets/s390x-softmmu.mak
> @@ -3,3 +3,4 @@ TARGET_BIG_ENDIAN=y
>  TARGET_KVM_HAVE_GUEST_DEBUG=y
>  TARGET_XML_FILES= gdb-xml/s390x-core64.xml gdb-xml/s390-acr.xml gdb-xml/s390-fpr.xml gdb-xml/s390-vx.xml gdb-xml/s390-cr.xml gdb-xml/s390-virt.xml gdb-xml/s390-virt-kvm.xml gdb-xml/s390-gs.xml
>  TARGET_LONG_BITS=64
> +TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=y
Re: [PATCH 8/8] configs/targets: Forbid S390x to use legacy native endianness APIs
Posted by Thomas Huth 1 month ago
On 06/01/2026 21.29, Eric Farman wrote:
> On Wed, 2025-12-24 at 17:20 +0100, Philippe Mathieu-Daudé wrote:
>> All S390x-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.
> 
> One nit is that this text confuses me, because the code below sets
> TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API rather than unsetting TARGET_USE_LEGACY_NATIVE_ENDIAN_API.
> 
> End goal seems the same though.
By the way, both definitions seem to be completely unused in QEMU currently, 
so this patch is currently for no real use yet? Unless some more 
infrastructure gets merged that consumes this setting, I think we should 
rather not merge this patch yet. I'll queue patches 1-7 for my next pull 
request.

  Thomas


Re: [PATCH 8/8] configs/targets: Forbid S390x to use legacy native endianness APIs
Posted by Philippe Mathieu-Daudé 1 month ago
On 7/1/26 06:11, Thomas Huth wrote:
> On 06/01/2026 21.29, Eric Farman wrote:
>> On Wed, 2025-12-24 at 17:20 +0100, Philippe Mathieu-Daudé wrote:
>>> All S390x-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.
>>
>> One nit is that this text confuses me, because the code below sets
>> TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API rather than unsetting 
>> TARGET_USE_LEGACY_NATIVE_ENDIAN_API.

Oops, I'll reword.

>> End goal seems the same though.
> By the way, both definitions seem to be completely unused in QEMU 
> currently, so this patch is currently for no real use yet? Unless some 
> more infrastructure gets merged that consumes this setting, I think we 
> should rather not merge this patch yet.

Oh. I usually add 'Based-on' in my cover letters when there are
dependencies between series. I did that in the previous version
(which was not covering s390x) but Pierrick told me this was not
practical to apply and test, and suggested to share a branch/tag
with all series; which is what I did (sharing a tag,
https://gitlab.com/philmd/qemu/-/tags/endian_s390x-v1), however
I failed to precise the other series. In particular, this is
based on:
https://lore.kernel.org/qemu-devel/20251224152210.87880-1-philmd@linaro.org/
See these patches:

system: Allow restricting the legacy ld/st_phys() 'native-endian' API
system: Allow restricting the legacy ld/st_he() 'native-endian' API
system: Allow restricting legacy address_space_ldst() native-endian API
system: Allow restricting the legacy cpu_ld/st() 'native-endian' API
system: Allow restricting the legacy translator_ld() 'native-endian' API
system: Allow restricting the legacy tswap() 'native-endian' API
system: Allow restricting the legacy MO_TE* 'native-endian' definitions
system: Allow restricting the legacy DEVICE_NATIVE_ENDIAN definition

> I'll queue patches 1-7 for my 
> next pull request.

Thanks!

Re: [PATCH 8/8] configs/targets: Forbid S390x to use legacy native endianness APIs
Posted by Manos Pitsidianakis 1 month, 1 week ago
On Wed, Dec 24, 2025 at 6:21 PM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> All S390x-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.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---

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



>  configs/targets/s390x-linux-user.mak | 1 +
>  configs/targets/s390x-softmmu.mak    | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/configs/targets/s390x-linux-user.mak b/configs/targets/s390x-linux-user.mak
> index 68c2f288724..e3723f5dc54 100644
> --- a/configs/targets/s390x-linux-user.mak
> +++ b/configs/targets/s390x-linux-user.mak
> @@ -4,3 +4,4 @@ TARGET_SYSTBL=syscall.tbl
>  TARGET_BIG_ENDIAN=y
>  TARGET_XML_FILES= gdb-xml/s390x-core64.xml gdb-xml/s390-acr.xml gdb-xml/s390-fpr.xml gdb-xml/s390-vx.xml gdb-xml/s390-cr.xml gdb-xml/s390-virt.xml gdb-xml/s390-virt-kvm.xml gdb-xml/s390-gs.xml
>  TARGET_LONG_BITS=64
> +TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=y
> diff --git a/configs/targets/s390x-softmmu.mak b/configs/targets/s390x-softmmu.mak
> index 76dd5de6584..544657cfe2d 100644
> --- a/configs/targets/s390x-softmmu.mak
> +++ b/configs/targets/s390x-softmmu.mak
> @@ -3,3 +3,4 @@ TARGET_BIG_ENDIAN=y
>  TARGET_KVM_HAVE_GUEST_DEBUG=y
>  TARGET_XML_FILES= gdb-xml/s390x-core64.xml gdb-xml/s390-acr.xml gdb-xml/s390-fpr.xml gdb-xml/s390-vx.xml gdb-xml/s390-cr.xml gdb-xml/s390-virt.xml gdb-xml/s390-virt-kvm.xml gdb-xml/s390-gs.xml
>  TARGET_LONG_BITS=64
> +TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API=y
> --
> 2.52.0
>