[RFC PATCH] buildsys: Stop checking for ESA/390 host

Philippe Mathieu-Daudé posted 1 patch 1 week, 4 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260519145859.91999-1-philmd@linaro.org
Maintainers: Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, Richard Henderson <richard.henderson@linaro.org>
There is a newer version of this series
configure                      | 12 ++----------
include/qemu/cacheflush.h      |  2 +-
include/qemu/timer.h           |  2 +-
tests/tcg/multiarch/nop_func.h |  2 +-
block/file-posix.c             |  2 +-
disas/disas-host.c             |  2 +-
util/cacheflush.c              |  2 +-
7 files changed, 8 insertions(+), 16 deletions(-)
[RFC PATCH] buildsys: Stop checking for ESA/390 host
Posted by Philippe Mathieu-Daudé 1 week, 4 days ago
We still build QEMU tools on 32-bit hosts (see commit
cf634dfcd8f), however no OS supported by QEMU still runs
on ESA/390 (Linux dropped support in release 4.1 in 2015).

Remove the configure check, directly checking for the 64-bit
z/Architecture.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 configure                      | 12 ++----------
 include/qemu/cacheflush.h      |  2 +-
 include/qemu/timer.h           |  2 +-
 tests/tcg/multiarch/nop_func.h |  2 +-
 block/file-posix.c             |  2 +-
 disas/disas-host.c             |  2 +-
 util/cacheflush.c              |  2 +-
 7 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/configure b/configure
index eea90306728..513ef7a153d 100755
--- a/configure
+++ b/configure
@@ -401,12 +401,8 @@ elif check_define _ARCH_PPC64 ; then
   fi
 elif check_define __mips64 ; then
   cpu="mips64"
-elif check_define __s390__ ; then
-  if check_define __s390x__ ; then
-    cpu="s390x"
-  else
-    cpu="s390"
-  fi
+elif check_define __s390x__ ; then
+  cpu="s390x"
 elif check_define __riscv && check_define _LP64 ; then
   cpu="riscv64"
 elif check_define __aarch64__ ; then
@@ -469,10 +465,6 @@ case "$cpu" in
     linux_arch=riscv
     ;;
 
-  s390)
-    linux_arch=s390
-    CPU_CFLAGS="-m31"
-    ;;
   s390x)
     host_arch=s390x
     linux_arch=s390
diff --git a/include/qemu/cacheflush.h b/include/qemu/cacheflush.h
index 8c64b878145..0618966ddde 100644
--- a/include/qemu/cacheflush.h
+++ b/include/qemu/cacheflush.h
@@ -19,7 +19,7 @@
  * mappings of the same physical page(s).
  */
 
-#if defined(__x86_64__) || defined(__s390__)
+#if defined(__x86_64__) || defined(__s390x__)
 
 static inline void flush_idcache_range(uintptr_t rx, uintptr_t rw, size_t len)
 {
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
index b931181f53d..fc021f8f966 100644
--- a/include/qemu/timer.h
+++ b/include/qemu/timer.h
@@ -889,7 +889,7 @@ static inline int64_t cpu_get_host_ticks(void)
     return val;
 }
 
-#elif defined(__s390__)
+#elif defined(__s390x__)
 
 static inline int64_t cpu_get_host_ticks(void)
 {
diff --git a/tests/tcg/multiarch/nop_func.h b/tests/tcg/multiarch/nop_func.h
index f714d210000..26d3a76eb62 100644
--- a/tests/tcg/multiarch/nop_func.h
+++ b/tests/tcg/multiarch/nop_func.h
@@ -15,7 +15,7 @@ static const char nop_func[] = {
     0x1e, 0xff, 0x2f, 0xe1,     /* bx lr */
 #elif defined(__riscv)
     0x67, 0x80, 0x00, 0x00,     /* ret */
-#elif defined(__s390__)
+#elif defined(__s390x__)
     0x07, 0xfe,                 /* br %r14 */
 #elif defined(__i386__) || defined(__x86_64__)
     0xc3,                       /* ret */
diff --git a/block/file-posix.c b/block/file-posix.c
index e49b13d6abb..5019ddade9b 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -79,7 +79,7 @@
 #include <linux/hdreg.h>
 #include <linux/magic.h>
 #include <scsi/sg.h>
-#ifdef __s390__
+#ifdef __s390x__
 #include <asm/dasd.h>
 #endif
 #ifndef FS_NOCOW_FL
diff --git a/disas/disas-host.c b/disas/disas-host.c
index 7cf432938e0..d41235250a0 100644
--- a/disas/disas-host.c
+++ b/disas/disas-host.c
@@ -74,7 +74,7 @@ static void initialize_debug_host(CPUDebug *s)
     s->info.print_insn = print_insn_little_mips;
 #elif defined(__m68k__)
     s->info.print_insn = print_insn_m68k;
-#elif defined(__s390__)
+#elif defined(__s390x__)
     s->info.cap_arch = CS_ARCH_SYSZ;
     s->info.cap_insn_unit = 2;
     s->info.cap_insn_split = 6;
diff --git a/util/cacheflush.c b/util/cacheflush.c
index c043c5f881a..77440ddb478 100644
--- a/util/cacheflush.c
+++ b/util/cacheflush.c
@@ -223,7 +223,7 @@ static void __attribute__((constructor)) init_cache_info(void)
  * Architecture (+ OS) specific cache flushing mechanisms.
  */
 
-#if defined(__x86_64__) || defined(__s390__)
+#if defined(__x86_64__) || defined(__s390x__)
 
 /* Caches are coherent and do not require flushing; symbol inline. */
 
-- 
2.53.0


Re: [RFC PATCH] buildsys: Stop checking for ESA/390 host
Posted by Paolo Bonzini 1 week, 4 days ago
Il mar 19 mag 2026, 16:59 Philippe Mathieu-Daudé <philmd@linaro.org> ha
scritto:

> We still build QEMU tools on 32-bit hosts (see commit
> cf634dfcd8f), however no OS supported by QEMU still runs
> on ESA/390 (Linux dropped support in release 4.1 in 2015).
>

If Linux still supports 31-bit *userspace binaries*, I would keep the
configure check, so that 32-bit s390 is properly detected as an unsupported
CPU:

elif check_define __s390__ ; then
>   if check_define __s390x__ ; then
>     cpu="s390x"
>   else
>     cpu="s390"
>   fi
>

and perhaps keep the CPU_CFLAGS only from the other hunk:

  s390)
>     linux_arch=s390
>     CPU_CFLAGS="-m31"
>     ;;
>

   s390x)
>      host_arch=s390x
>      linux_arch=s390
>

The rest is fine.

Paolo

diff --git a/include/qemu/cacheflush.h b/include/qemu/cacheflush.h
> index 8c64b878145..0618966ddde 100644
> --- a/include/qemu/cacheflush.h
> +++ b/include/qemu/cacheflush.h
> @@ -19,7 +19,7 @@
>   * mappings of the same physical page(s).
>   */
>
> -#if defined(__x86_64__) || defined(__s390__)
> +#if defined(__x86_64__) || defined(__s390x__)
>
>  static inline void flush_idcache_range(uintptr_t rx, uintptr_t rw, size_t
> len)
>  {
> diff --git a/include/qemu/timer.h b/include/qemu/timer.h
> index b931181f53d..fc021f8f966 100644
> --- a/include/qemu/timer.h
> +++ b/include/qemu/timer.h
> @@ -889,7 +889,7 @@ static inline int64_t cpu_get_host_ticks(void)
>      return val;
>  }
>
> -#elif defined(__s390__)
> +#elif defined(__s390x__)
>
>  static inline int64_t cpu_get_host_ticks(void)
>  {
> diff --git a/tests/tcg/multiarch/nop_func.h
> b/tests/tcg/multiarch/nop_func.h
> index f714d210000..26d3a76eb62 100644
> --- a/tests/tcg/multiarch/nop_func.h
> +++ b/tests/tcg/multiarch/nop_func.h
> @@ -15,7 +15,7 @@ static const char nop_func[] = {
>      0x1e, 0xff, 0x2f, 0xe1,     /* bx lr */
>  #elif defined(__riscv)
>      0x67, 0x80, 0x00, 0x00,     /* ret */
> -#elif defined(__s390__)
> +#elif defined(__s390x__)
>      0x07, 0xfe,                 /* br %r14 */
>  #elif defined(__i386__) || defined(__x86_64__)
>      0xc3,                       /* ret */
> diff --git a/block/file-posix.c b/block/file-posix.c
> index e49b13d6abb..5019ddade9b 100644
> --- a/block/file-posix.c
> +++ b/block/file-posix.c
> @@ -79,7 +79,7 @@
>  #include <linux/hdreg.h>
>  #include <linux/magic.h>
>  #include <scsi/sg.h>
> -#ifdef __s390__
> +#ifdef __s390x__
>  #include <asm/dasd.h>
>  #endif
>  #ifndef FS_NOCOW_FL
> diff --git a/disas/disas-host.c b/disas/disas-host.c
> index 7cf432938e0..d41235250a0 100644
> --- a/disas/disas-host.c
> +++ b/disas/disas-host.c
> @@ -74,7 +74,7 @@ static void initialize_debug_host(CPUDebug *s)
>      s->info.print_insn = print_insn_little_mips;
>  #elif defined(__m68k__)
>      s->info.print_insn = print_insn_m68k;
> -#elif defined(__s390__)
> +#elif defined(__s390x__)
>      s->info.cap_arch = CS_ARCH_SYSZ;
>      s->info.cap_insn_unit = 2;
>      s->info.cap_insn_split = 6;
> diff --git a/util/cacheflush.c b/util/cacheflush.c
> index c043c5f881a..77440ddb478 100644
> --- a/util/cacheflush.c
> +++ b/util/cacheflush.c
> @@ -223,7 +223,7 @@ static void __attribute__((constructor))
> init_cache_info(void)
>   * Architecture (+ OS) specific cache flushing mechanisms.
>   */
>
> -#if defined(__x86_64__) || defined(__s390__)
> +#if defined(__x86_64__) || defined(__s390x__)
>
>  /* Caches are coherent and do not require flushing; symbol inline. */
>
> --
> 2.53.0
>
>
Re: [RFC PATCH] buildsys: Stop checking for ESA/390 host
Posted by Cornelia Huck 1 week, 3 days ago
On Tue, May 19 2026, Paolo Bonzini <pbonzini@redhat.com> wrote:

> Il mar 19 mag 2026, 16:59 Philippe Mathieu-Daudé <philmd@linaro.org> ha
> scritto:
>
>> We still build QEMU tools on 32-bit hosts (see commit
>> cf634dfcd8f), however no OS supported by QEMU still runs
>> on ESA/390 (Linux dropped support in release 4.1 in 2015).
>>
>
> If Linux still supports 31-bit *userspace binaries*, I would keep the
> configure check, so that 32-bit s390 is properly detected as an unsupported
> CPU:

FWIW, Linux removed support for the 31 bit compat code in v6.19 (late
last year); it is unclear if anyone had been using it recently anyway.

>
> elif check_define __s390__ ; then
>>   if check_define __s390x__ ; then
>>     cpu="s390x"
>>   else
>>     cpu="s390"
>>   fi
>>
>
> and perhaps keep the CPU_CFLAGS only from the other hunk:
>
>   s390)
>>     linux_arch=s390
>>     CPU_CFLAGS="-m31"
>>     ;;
>>
>
>    s390x)
>>      host_arch=s390x
>>      linux_arch=s390
>>

I'm also wondering if anyone had actually tried to use QEMU on such a
setup recently; I don't have a setup to test that in any case.
Re: [RFC PATCH] buildsys: Stop checking for ESA/390 host
Posted by Peter Maydell 1 week, 4 days ago
On Tue, 19 May 2026 at 15:59, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> We still build QEMU tools on 32-bit hosts (see commit
> cf634dfcd8f), however no OS supported by QEMU still runs
> on ESA/390 (Linux dropped support in release 4.1 in 2015).
>
> Remove the configure check, directly checking for the 64-bit
> z/Architecture.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>


> diff --git a/tests/tcg/multiarch/nop_func.h b/tests/tcg/multiarch/nop_func.h
> index f714d210000..26d3a76eb62 100644
> --- a/tests/tcg/multiarch/nop_func.h
> +++ b/tests/tcg/multiarch/nop_func.h
> @@ -15,7 +15,7 @@ static const char nop_func[] = {
>      0x1e, 0xff, 0x2f, 0xe1,     /* bx lr */
>  #elif defined(__riscv)
>      0x67, 0x80, 0x00, 0x00,     /* ret */
> -#elif defined(__s390__)
> +#elif defined(__s390x__)
>      0x07, 0xfe,                 /* br %r14 */
>  #elif defined(__i386__) || defined(__x86_64__)
>      0xc3,                       /* ret */

This one is guest code, not host code. We might be able to change it too,
but that would be separate from "we don't support s390 as a host".

-- PMM