Re: [PATCH v2 10/14] configure: Define TARGET_LONG_BITS in configs/targets/*.mak

2025-02-03 Thread Richard Henderson

On 2/3/25 10:30, Philippe Mathieu-Daudé wrote:

On 3/2/25 04:18, Richard Henderson wrote:

Define TARGET_LONG_BITS in each target's configure fragment.
Do this without removing the define in target/*/cpu-param.h
so that errors are caught like so:

In file included from .../src/include/exec/cpu-defs.h:26,
  from ../src/target/hppa/cpu.h:24,
  from ../src/linux-user/qemu.h:4,
  from ../src/linux-user/hppa/cpu_loop.c:21:
../src/target/hppa/cpu-param.h:11: error: "TARGET_LONG_BITS" redefined [-Werror]
    11 | #define TARGET_LONG_BITS  64
   |
In file included from .../src/include/qemu/osdep.h:36,
  from ../src/linux-user/hppa/cpu_loop.c:20:
./hppa-linux-user-config-target.h:32: note: this is the location of the 
previous definition
    32 | #define TARGET_LONG_BITS 32
   |
cc1: all warnings being treated as errors

Signed-off-by: Richard Henderson 
---


Orthogonal to this series, what about the other definitions,
like TARGET_PHYS_ADDR_SPACE_BITS / TARGET_VIRT_ADDR_SPACE_BITS
and possibly TARGET_PAGE_BITS?


We don't need those at configure time, so there's no need to move them.


r~



Re: [PATCH v2 10/14] configure: Define TARGET_LONG_BITS in configs/targets/*.mak

2025-02-03 Thread Philippe Mathieu-Daudé

On 3/2/25 04:18, Richard Henderson wrote:

Define TARGET_LONG_BITS in each target's configure fragment.
Do this without removing the define in target/*/cpu-param.h
so that errors are caught like so:

In file included from .../src/include/exec/cpu-defs.h:26,
  from ../src/target/hppa/cpu.h:24,
  from ../src/linux-user/qemu.h:4,
  from ../src/linux-user/hppa/cpu_loop.c:21:
../src/target/hppa/cpu-param.h:11: error: "TARGET_LONG_BITS" redefined [-Werror]
11 | #define TARGET_LONG_BITS  64
   |
In file included from .../src/include/qemu/osdep.h:36,
  from ../src/linux-user/hppa/cpu_loop.c:20:
./hppa-linux-user-config-target.h:32: note: this is the location of the 
previous definition
32 | #define TARGET_LONG_BITS 32
   |
cc1: all warnings being treated as errors

Signed-off-by: Richard Henderson 
---


Orthogonal to this series, what about the other definitions,
like TARGET_PHYS_ADDR_SPACE_BITS / TARGET_VIRT_ADDR_SPACE_BITS
and possibly TARGET_PAGE_BITS?



Re: [PATCH v2 10/14] configure: Define TARGET_LONG_BITS in configs/targets/*.mak

2025-02-03 Thread Philippe Mathieu-Daudé

On 3/2/25 04:18, Richard Henderson wrote:

Define TARGET_LONG_BITS in each target's configure fragment.
Do this without removing the define in target/*/cpu-param.h
so that errors are caught like so:

In file included from .../src/include/exec/cpu-defs.h:26,
  from ../src/target/hppa/cpu.h:24,
  from ../src/linux-user/qemu.h:4,
  from ../src/linux-user/hppa/cpu_loop.c:21:
../src/target/hppa/cpu-param.h:11: error: "TARGET_LONG_BITS" redefined [-Werror]
11 | #define TARGET_LONG_BITS  64
   |
In file included from .../src/include/qemu/osdep.h:36,
  from ../src/linux-user/hppa/cpu_loop.c:20:
./hppa-linux-user-config-target.h:32: note: this is the location of the 
previous definition
32 | #define TARGET_LONG_BITS 32
   |
cc1: all warnings being treated as errors

Signed-off-by: Richard Henderson 
---
  configs/targets/aarch64-bsd-user.mak| 1 +
  configs/targets/aarch64-linux-user.mak  | 1 +
  configs/targets/aarch64-softmmu.mak | 1 +
  configs/targets/aarch64_be-linux-user.mak   | 1 +
  configs/targets/alpha-linux-user.mak| 1 +
  configs/targets/alpha-softmmu.mak   | 1 +
  configs/targets/arm-bsd-user.mak| 1 +
  configs/targets/arm-linux-user.mak  | 1 +
  configs/targets/arm-softmmu.mak | 1 +
  configs/targets/armeb-linux-user.mak| 1 +
  configs/targets/avr-softmmu.mak | 1 +
  configs/targets/hexagon-linux-user.mak  | 1 +
  configs/targets/hppa-linux-user.mak | 2 ++
  configs/targets/hppa-softmmu.mak| 1 +
  configs/targets/i386-bsd-user.mak   | 1 +
  configs/targets/i386-linux-user.mak | 1 +
  configs/targets/i386-softmmu.mak| 1 +
  configs/targets/loongarch64-linux-user.mak  | 1 +
  configs/targets/loongarch64-softmmu.mak | 1 +
  configs/targets/m68k-linux-user.mak | 1 +
  configs/targets/m68k-softmmu.mak| 1 +
  configs/targets/microblaze-linux-user.mak   | 1 +
  configs/targets/microblaze-softmmu.mak  | 3 +++
  configs/targets/microblazeel-linux-user.mak | 1 +
  configs/targets/microblazeel-softmmu.mak| 3 +++
  configs/targets/mips-linux-user.mak | 1 +
  configs/targets/mips-softmmu.mak| 1 +
  configs/targets/mips64-linux-user.mak   | 1 +
  configs/targets/mips64-softmmu.mak  | 1 +
  configs/targets/mips64el-linux-user.mak | 1 +
  configs/targets/mips64el-softmmu.mak| 1 +
  configs/targets/mipsel-linux-user.mak   | 1 +
  configs/targets/mipsel-softmmu.mak  | 1 +
  configs/targets/mipsn32-linux-user.mak  | 1 +
  configs/targets/mipsn32el-linux-user.mak| 1 +
  configs/targets/or1k-linux-user.mak | 1 +
  configs/targets/or1k-softmmu.mak| 1 +
  configs/targets/ppc-linux-user.mak  | 1 +
  configs/targets/ppc-softmmu.mak | 1 +
  configs/targets/ppc64-linux-user.mak| 1 +
  configs/targets/ppc64-softmmu.mak   | 1 +
  configs/targets/ppc64le-linux-user.mak  | 1 +
  configs/targets/riscv32-linux-user.mak  | 1 +
  configs/targets/riscv32-softmmu.mak | 1 +
  configs/targets/riscv64-bsd-user.mak| 1 +
  configs/targets/riscv64-linux-user.mak  | 1 +
  configs/targets/riscv64-softmmu.mak | 1 +
  configs/targets/rx-softmmu.mak  | 1 +
  configs/targets/s390x-linux-user.mak| 1 +
  configs/targets/s390x-softmmu.mak   | 1 +
  configs/targets/sh4-linux-user.mak  | 1 +
  configs/targets/sh4-softmmu.mak | 1 +
  configs/targets/sh4eb-linux-user.mak| 1 +
  configs/targets/sh4eb-softmmu.mak   | 1 +
  configs/targets/sparc-linux-user.mak| 1 +
  configs/targets/sparc-softmmu.mak   | 1 +
  configs/targets/sparc32plus-linux-user.mak  | 1 +
  configs/targets/sparc64-linux-user.mak  | 1 +
  configs/targets/sparc64-softmmu.mak | 1 +
  configs/targets/tricore-softmmu.mak | 1 +
  configs/targets/x86_64-bsd-user.mak | 1 +
  configs/targets/x86_64-linux-user.mak   | 1 +
  configs/targets/x86_64-softmmu.mak  | 1 +
  configs/targets/xtensa-linux-user.mak   | 1 +
  configs/targets/xtensa-softmmu.mak  | 1 +
  configs/targets/xtensaeb-linux-user.mak | 1 +
  configs/targets/xtensaeb-softmmu.mak| 1 +
  67 files changed, 72 insertions(+)


Simpler to review split in 2 (32, 64).

$ git grep -l TARGET_LONG_BITS=32 configs/targets/
configs/targets/arm-bsd-user.mak
configs/targets/arm-linux-user.mak
configs/targets/arm-softmmu.mak
configs/targets/armeb-linux-user.mak
configs/targets/avr-softmmu.mak
configs/targets/hexagon-linux-user.mak
configs/targets/i386-bsd-user.mak
configs/targets/i386-linux-user.mak
configs/targets/i386-softmmu.mak
configs/targets/m68k-linux-user.mak
configs/targets/m68k-softmmu.mak
configs/targets/microblaze-linux-user.mak
configs/targets/microblazeel-linux-user.mak
configs/targets

Re: [PATCH v2 10/14] configure: Define TARGET_LONG_BITS in configs/targets/*.mak

2025-02-03 Thread Thomas Huth

On 03/02/2025 17.49, Richard Henderson wrote:

On 2/3/25 02:39, Thomas Huth wrote:
[...]> diff --git a/configs/targets/hppa-linux-user.mak b/configs/targets/ 
hppa-linux-user.mak

index 8e0a80492f..4295cf384e 100644
--- a/configs/targets/hppa-linux-user.mak
+++ b/configs/targets/hppa-linux-user.mak
@@ -3,3 +3,5 @@ TARGET_ABI32=y
  TARGET_SYSTBL_ABI=common,32
  TARGET_SYSTBL=syscall.tbl
  TARGET_BIG_ENDIAN=y
+# Compromise to ease maintainence vs system mode


s/maintainence/maintenance/


Oops.



diff --git a/configs/targets/mipsn32-linux-user.mak b/configs/targets/ 
mipsn32-linux- user.mak

index 206095da64..39ae214633 100644
--- a/configs/targets/mipsn32-linux-user.mak
+++ b/configs/targets/mipsn32-linux-user.mak
@@ -5,3 +5,4 @@ TARGET_BASE_ARCH=mips
  TARGET_SYSTBL_ABI=n32
  TARGET_SYSTBL=syscall_n32.tbl
  TARGET_BIG_ENDIAN=y
+TARGET_LONG_BITS=64


Why is this 64 ?

diff --git a/configs/targets/mipsn32el-linux-user.mak b/configs/targets/ 
mipsn32el-linux- user.mak

index ca2a3ed753..d9b61d6990 100644
--- a/configs/targets/mipsn32el-linux-user.mak
+++ b/configs/targets/mipsn32el-linux-user.mak
@@ -4,3 +4,4 @@ TARGET_ABI32=y
  TARGET_BASE_ARCH=mips
  TARGET_SYSTBL_ABI=n32
  TARGET_SYSTBL=syscall_n32.tbl
+TARGET_LONG_BITS=64


dito?

diff --git a/configs/targets/sparc32plus-linux-user.mak b/configs/ 
targets/sparc32plus- linux-user.mak

index 6cc8fa516b..7a16934fd1 100644
--- a/configs/targets/sparc32plus-linux-user.mak
+++ b/configs/targets/sparc32plus-linux-user.mak
@@ -5,3 +5,4 @@ TARGET_ABI_DIR=sparc
  TARGET_SYSTBL_ABI=common,32
  TARGET_SYSTBL=syscall.tbl
  TARGET_BIG_ENDIAN=y
+TARGET_LONG_BITS=64


Same question here: Why 64? If this isn't a mistake, could you maybe add a 
comment?


All three are 64-bit cpus using an ABI with 32-bit pointers.


Ok, thanks, makes sense now. So with the typo fixed:
Reviewed-by: Thomas Huth 




Re: [PATCH v2 10/14] configure: Define TARGET_LONG_BITS in configs/targets/*.mak

2025-02-03 Thread Richard Henderson

On 2/3/25 02:39, Thomas Huth wrote:

[...]> diff --git a/configs/targets/hppa-linux-user.mak 
b/configs/targets/hppa-linux-user.mak

index 8e0a80492f..4295cf384e 100644
--- a/configs/targets/hppa-linux-user.mak
+++ b/configs/targets/hppa-linux-user.mak
@@ -3,3 +3,5 @@ TARGET_ABI32=y
  TARGET_SYSTBL_ABI=common,32
  TARGET_SYSTBL=syscall.tbl
  TARGET_BIG_ENDIAN=y
+# Compromise to ease maintainence vs system mode


s/maintainence/maintenance/


Oops.



diff --git a/configs/targets/mipsn32-linux-user.mak b/configs/targets/mipsn32-linux- 
user.mak

index 206095da64..39ae214633 100644
--- a/configs/targets/mipsn32-linux-user.mak
+++ b/configs/targets/mipsn32-linux-user.mak
@@ -5,3 +5,4 @@ TARGET_BASE_ARCH=mips
  TARGET_SYSTBL_ABI=n32
  TARGET_SYSTBL=syscall_n32.tbl
  TARGET_BIG_ENDIAN=y
+TARGET_LONG_BITS=64


Why is this 64 ?

diff --git a/configs/targets/mipsn32el-linux-user.mak b/configs/targets/mipsn32el-linux- 
user.mak

index ca2a3ed753..d9b61d6990 100644
--- a/configs/targets/mipsn32el-linux-user.mak
+++ b/configs/targets/mipsn32el-linux-user.mak
@@ -4,3 +4,4 @@ TARGET_ABI32=y
  TARGET_BASE_ARCH=mips
  TARGET_SYSTBL_ABI=n32
  TARGET_SYSTBL=syscall_n32.tbl
+TARGET_LONG_BITS=64


dito?

diff --git a/configs/targets/sparc32plus-linux-user.mak b/configs/targets/sparc32plus- 
linux-user.mak

index 6cc8fa516b..7a16934fd1 100644
--- a/configs/targets/sparc32plus-linux-user.mak
+++ b/configs/targets/sparc32plus-linux-user.mak
@@ -5,3 +5,4 @@ TARGET_ABI_DIR=sparc
  TARGET_SYSTBL_ABI=common,32
  TARGET_SYSTBL=syscall.tbl
  TARGET_BIG_ENDIAN=y
+TARGET_LONG_BITS=64


Same question here: Why 64? If this isn't a mistake, could you maybe add a 
comment?


All three are 64-bit cpus using an ABI with 32-bit pointers.


r~



Re: [PATCH v2 10/14] configure: Define TARGET_LONG_BITS in configs/targets/*.mak

2025-02-03 Thread Alex Bennée
Thomas Huth  writes:

> On 03/02/2025 04.18, Richard Henderson wrote:
>> Define TARGET_LONG_BITS in each target's configure fragment.
>> Do this without removing the define in target/*/cpu-param.h
>> so that errors are caught like so:
>> In file included from .../src/include/exec/cpu-defs.h:26,
>>   from ../src/target/hppa/cpu.h:24,
>>   from ../src/linux-user/qemu.h:4,
>>   from ../src/linux-user/hppa/cpu_loop.c:21:
>> ../src/target/hppa/cpu-param.h:11: error: "TARGET_LONG_BITS" redefined 
>> [-Werror]
>> 11 | #define TARGET_LONG_BITS  64
>>|
>> In file included from .../src/include/qemu/osdep.h:36,
>>   from ../src/linux-user/hppa/cpu_loop.c:20:
>> ./hppa-linux-user-config-target.h:32: note: this is the location of the 
>> previous definition
>> 32 | #define TARGET_LONG_BITS 32
>>|
>> cc1: all warnings being treated as errors
>> Signed-off-by: Richard Henderson 
>> ---
> [...]> diff --git a/configs/targets/hppa-linux-user.mak
> b/configs/targets/hppa-linux-user.mak
>> index 8e0a80492f..4295cf384e 100644
>> --- a/configs/targets/hppa-linux-user.mak
>> +++ b/configs/targets/hppa-linux-user.mak
>> @@ -3,3 +3,5 @@ TARGET_ABI32=y
>>   TARGET_SYSTBL_ABI=common,32
>>   TARGET_SYSTBL=syscall.tbl
>>   TARGET_BIG_ENDIAN=y
>> +# Compromise to ease maintainence vs system mode
>
> s/maintainence/maintenance/
>
>> diff --git a/configs/targets/mipsn32-linux-user.mak 
>> b/configs/targets/mipsn32-linux-user.mak
>> index 206095da64..39ae214633 100644
>> --- a/configs/targets/mipsn32-linux-user.mak
>> +++ b/configs/targets/mipsn32-linux-user.mak
>> @@ -5,3 +5,4 @@ TARGET_BASE_ARCH=mips
>>   TARGET_SYSTBL_ABI=n32
>>   TARGET_SYSTBL=syscall_n32.tbl
>>   TARGET_BIG_ENDIAN=y
>> +TARGET_LONG_BITS=64
>
> Why is this 64 ?
>
>> diff --git a/configs/targets/mipsn32el-linux-user.mak 
>> b/configs/targets/mipsn32el-linux-user.mak
>> index ca2a3ed753..d9b61d6990 100644
>> --- a/configs/targets/mipsn32el-linux-user.mak
>> +++ b/configs/targets/mipsn32el-linux-user.mak
>> @@ -4,3 +4,4 @@ TARGET_ABI32=y
>>   TARGET_BASE_ARCH=mips
>>   TARGET_SYSTBL_ABI=n32
>>   TARGET_SYSTBL=syscall_n32.tbl
>> +TARGET_LONG_BITS=64
>
> dito?

Are these 64 bit linux-user with 32 bit ABIs like x32?

>
>> diff --git a/configs/targets/sparc32plus-linux-user.mak 
>> b/configs/targets/sparc32plus-linux-user.mak
>> index 6cc8fa516b..7a16934fd1 100644
>> --- a/configs/targets/sparc32plus-linux-user.mak
>> +++ b/configs/targets/sparc32plus-linux-user.mak
>> @@ -5,3 +5,4 @@ TARGET_ABI_DIR=sparc
>>   TARGET_SYSTBL_ABI=common,32
>>   TARGET_SYSTBL=syscall.tbl
>>   TARGET_BIG_ENDIAN=y
>> +TARGET_LONG_BITS=64
>
> Same question here: Why 64? If this isn't a mistake, could you maybe
> add a comment?

This is definitely one of those weird 32bit ABI on 64 host.

>
>  Thanks,
>   Thomas

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro



Re: [PATCH v2 10/14] configure: Define TARGET_LONG_BITS in configs/targets/*.mak

2025-02-03 Thread Thomas Huth

On 03/02/2025 04.18, Richard Henderson wrote:

Define TARGET_LONG_BITS in each target's configure fragment.
Do this without removing the define in target/*/cpu-param.h
so that errors are caught like so:

In file included from .../src/include/exec/cpu-defs.h:26,
  from ../src/target/hppa/cpu.h:24,
  from ../src/linux-user/qemu.h:4,
  from ../src/linux-user/hppa/cpu_loop.c:21:
../src/target/hppa/cpu-param.h:11: error: "TARGET_LONG_BITS" redefined [-Werror]
11 | #define TARGET_LONG_BITS  64
   |
In file included from .../src/include/qemu/osdep.h:36,
  from ../src/linux-user/hppa/cpu_loop.c:20:
./hppa-linux-user-config-target.h:32: note: this is the location of the 
previous definition
32 | #define TARGET_LONG_BITS 32
   |
cc1: all warnings being treated as errors

Signed-off-by: Richard Henderson 
---
[...]> diff --git a/configs/targets/hppa-linux-user.mak 
b/configs/targets/hppa-linux-user.mak

index 8e0a80492f..4295cf384e 100644
--- a/configs/targets/hppa-linux-user.mak
+++ b/configs/targets/hppa-linux-user.mak
@@ -3,3 +3,5 @@ TARGET_ABI32=y
  TARGET_SYSTBL_ABI=common,32
  TARGET_SYSTBL=syscall.tbl
  TARGET_BIG_ENDIAN=y
+# Compromise to ease maintainence vs system mode


s/maintainence/maintenance/


diff --git a/configs/targets/mipsn32-linux-user.mak 
b/configs/targets/mipsn32-linux-user.mak
index 206095da64..39ae214633 100644
--- a/configs/targets/mipsn32-linux-user.mak
+++ b/configs/targets/mipsn32-linux-user.mak
@@ -5,3 +5,4 @@ TARGET_BASE_ARCH=mips
  TARGET_SYSTBL_ABI=n32
  TARGET_SYSTBL=syscall_n32.tbl
  TARGET_BIG_ENDIAN=y
+TARGET_LONG_BITS=64


Why is this 64 ?


diff --git a/configs/targets/mipsn32el-linux-user.mak 
b/configs/targets/mipsn32el-linux-user.mak
index ca2a3ed753..d9b61d6990 100644
--- a/configs/targets/mipsn32el-linux-user.mak
+++ b/configs/targets/mipsn32el-linux-user.mak
@@ -4,3 +4,4 @@ TARGET_ABI32=y
  TARGET_BASE_ARCH=mips
  TARGET_SYSTBL_ABI=n32
  TARGET_SYSTBL=syscall_n32.tbl
+TARGET_LONG_BITS=64


dito?


diff --git a/configs/targets/sparc32plus-linux-user.mak 
b/configs/targets/sparc32plus-linux-user.mak
index 6cc8fa516b..7a16934fd1 100644
--- a/configs/targets/sparc32plus-linux-user.mak
+++ b/configs/targets/sparc32plus-linux-user.mak
@@ -5,3 +5,4 @@ TARGET_ABI_DIR=sparc
  TARGET_SYSTBL_ABI=common,32
  TARGET_SYSTBL=syscall.tbl
  TARGET_BIG_ENDIAN=y
+TARGET_LONG_BITS=64


Same question here: Why 64? If this isn't a mistake, could you maybe add a 
comment?


 Thanks,
  Thomas