mbox series

[0/2] target/arm: Deprecate iwMMXt emulation and associated CPUs

Message ID 20250127112715.2936555-1-peter.maydell@linaro.org
Headers show
Series target/arm: Deprecate iwMMXt emulation and associated CPUs | expand

Message

Peter Maydell Jan. 27, 2025, 11:27 a.m. UTC
This patchset marks all the CPUs that support iwMMXt as deprecated,
because I don't believe anybody is using them, and we have no way to
test the thousands of lines of code we have that's only there for
iwMMXt emulation.  (See for instance the recent thread where a patch
was submitted to fix an issue detected by a static analyzer: we
didn't take it, largely because we had no way to know if the
behaviour change the patch would produce was correct or not.)

The pxa2xx CPUs are now only useful with user-mode emulation, because
we dropped all the machine types that used them in 9.2.  (Technically
you could alse use "-cpu pxa270" with a board model like versatilepb
which doesn't sanity-check the CPU type, but that has never been a
supported config.)

To use them (or iwMMXt emulation) with QEMU user-mode you would need
to explicitly select them with the -cpu option or the QEMU_CPU
environment variable, because the '-cpu max' default CPU does not
include iwMMXt emulation.  A google search finds no examples of
anybody doing this in the last decade.

I asked some of the Linaro GCC folks if they were using QEMU to test
their iwMMXt codegen, or knew anybody doing that upstream, and the
answer was "no". In fact, GCC is in the process of dropping support
for iwMMXt entirely.
                    
We have one test case in check-tcg which purports to be checking
iwMMXt. In fact it is doing no such thing: it runs the test without
selecting an iwMMXt CPU, which means the iwMMXt insns are interpreted
as FPA11 insns by the linux-user emulate_arm_fpa11() code. So the test
prints garbage and then succeeds anyway. Modern distro toolchains
can't generate a binary that will run with -cpu pxa270 (because their
crt startup code uses Thumb insns); rather than putting in a lot of
effort trying to salvage the test case to really test a feature we've
deprecated, I opted to just remove the test.

-- PMM

Peter Maydell (2):
  target/arm: deprecate the pxa2xx CPUs and iwMMXt emulation
  tests/tcg/arm: Remove test-arm-iwmmxt test

 docs/about/deprecated.rst       | 21 ++++++++++++++
 target/arm/cpu.h                |  1 +
 target/arm/cpu.c                |  3 ++
 target/arm/tcg/cpu32.c          | 36 ++++++++++++++++--------
 tests/tcg/arm/Makefile.target   |  7 -----
 tests/tcg/arm/README            |  5 ----
 tests/tcg/arm/test-arm-iwmmxt.S | 49 ---------------------------------
 7 files changed, 49 insertions(+), 73 deletions(-)
 delete mode 100644 tests/tcg/arm/test-arm-iwmmxt.S

Comments

Richard Henderson Jan. 27, 2025, 4:13 p.m. UTC | #1
On 1/27/25 03:27, Peter Maydell wrote:
> This patchset marks all the CPUs that support iwMMXt as deprecated,
> because I don't believe anybody is using them, and we have no way to
> test the thousands of lines of code we have that's only there for
> iwMMXt emulation.  (See for instance the recent thread where a patch
> was submitted to fix an issue detected by a static analyzer: we
> didn't take it, largely because we had no way to know if the
> behaviour change the patch would produce was correct or not.)
> 
> The pxa2xx CPUs are now only useful with user-mode emulation, because
> we dropped all the machine types that used them in 9.2.  (Technically
> you could alse use "-cpu pxa270" with a board model like versatilepb
> which doesn't sanity-check the CPU type, but that has never been a
> supported config.)
> 
> To use them (or iwMMXt emulation) with QEMU user-mode you would need
> to explicitly select them with the -cpu option or the QEMU_CPU
> environment variable, because the '-cpu max' default CPU does not
> include iwMMXt emulation.  A google search finds no examples of
> anybody doing this in the last decade.
> 
> I asked some of the Linaro GCC folks if they were using QEMU to test
> their iwMMXt codegen, or knew anybody doing that upstream, and the
> answer was "no". In fact, GCC is in the process of dropping support
> for iwMMXt entirely.
>                      
> We have one test case in check-tcg which purports to be checking
> iwMMXt. In fact it is doing no such thing: it runs the test without
> selecting an iwMMXt CPU, which means the iwMMXt insns are interpreted
> as FPA11 insns by the linux-user emulate_arm_fpa11() code. So the test
> prints garbage and then succeeds anyway. Modern distro toolchains
> can't generate a binary that will run with -cpu pxa270 (because their
> crt startup code uses Thumb insns); rather than putting in a lot of
> effort trying to salvage the test case to really test a feature we've
> deprecated, I opted to just remove the test.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
Philippe Mathieu-Daudé Jan. 27, 2025, 5:27 p.m. UTC | #2
On 27/1/25 12:27, Peter Maydell wrote:
> This patchset marks all the CPUs that support iwMMXt as deprecated,
> because I don't believe anybody is using them, and we have no way to
> test the thousands of lines of code we have that's only there for
> iwMMXt emulation.  (See for instance the recent thread where a patch
> was submitted to fix an issue detected by a static analyzer: we
> didn't take it, largely because we had no way to know if the
> behaviour change the patch would produce was correct or not.)
> 
> The pxa2xx CPUs are now only useful with user-mode emulation, because
> we dropped all the machine types that used them in 9.2.  (Technically
> you could alse use "-cpu pxa270" with a board model like versatilepb
> which doesn't sanity-check the CPU type, but that has never been a
> supported config.)
> 
> To use them (or iwMMXt emulation) with QEMU user-mode you would need
> to explicitly select them with the -cpu option or the QEMU_CPU
> environment variable, because the '-cpu max' default CPU does not
> include iwMMXt emulation.  A google search finds no examples of
> anybody doing this in the last decade.
> 
> I asked some of the Linaro GCC folks if they were using QEMU to test
> their iwMMXt codegen, or knew anybody doing that upstream, and the
> answer was "no". In fact, GCC is in the process of dropping support
> for iwMMXt entirely.
>                      
> We have one test case in check-tcg which purports to be checking
> iwMMXt. In fact it is doing no such thing: it runs the test without
> selecting an iwMMXt CPU, which means the iwMMXt insns are interpreted
> as FPA11 insns by the linux-user emulate_arm_fpa11() code. So the test
> prints garbage and then succeeds anyway. Modern distro toolchains

Uh...

> can't generate a binary that will run with -cpu pxa270 (because their
> crt startup code uses Thumb insns); rather than putting in a lot of
> effort trying to salvage the test case to really test a feature we've
> deprecated, I opted to just remove the test.
> 
> -- PMM
> 
> Peter Maydell (2):
>    target/arm: deprecate the pxa2xx CPUs and iwMMXt emulation
>    tests/tcg/arm: Remove test-arm-iwmmxt test

Series:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Peter Maydell Jan. 27, 2025, 5:46 p.m. UTC | #3
On Mon, 27 Jan 2025 at 17:27, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> On 27/1/25 12:27, Peter Maydell wrote:
> > We have one test case in check-tcg which purports to be checking
> > iwMMXt. In fact it is doing no such thing: it runs the test without
> > selecting an iwMMXt CPU, which means the iwMMXt insns are interpreted
> > as FPA11 insns by the linux-user emulate_arm_fpa11() code. So the test
> > prints garbage and then succeeds anyway.
>
> Uh...

It had me confused for a while, because I'd convinced myself
by code inspection that we only enabled iwMMXt if you
manually asked for a pxa2xx CPU and not in the default 'max'
CPU, and then I found this test case that we were running
with the default CPU type and which was apparently passing :-)

-- PMM
Richard Henderson Jan. 27, 2025, 9:02 p.m. UTC | #4
On 1/27/25 09:46, Peter Maydell wrote:
> On Mon, 27 Jan 2025 at 17:27, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>> On 27/1/25 12:27, Peter Maydell wrote:
>>> We have one test case in check-tcg which purports to be checking
>>> iwMMXt. In fact it is doing no such thing: it runs the test without
>>> selecting an iwMMXt CPU, which means the iwMMXt insns are interpreted
>>> as FPA11 insns by the linux-user emulate_arm_fpa11() code. So the test
>>> prints garbage and then succeeds anyway.
>>
>> Uh...
> 
> It had me confused for a while, because I'd convinced myself
> by code inspection that we only enabled iwMMXt if you
> manually asked for a pxa2xx CPU and not in the default 'max'
> CPU, and then I found this test case that we were running
> with the default CPU type and which was apparently passing :-)

Any chance we can deprecate the fpa11 stuff too?

I see it's still enabled by the kernel for some boards,
but it depends on really old configury:

config FPE_NWFPE
         bool "NWFPE math emulation"
         depends on (!AEABI || OABI_COMPAT) && !THUMB2_KERNEL
         help
           Say Y to include the NWFPE floating point emulator in the kernel.
           This is necessary to run most binaries. Linux does not currently
           support floating point hardware so you need to say Y here even if
           your machine has an FPA or floating point co-processor podule.

No thumb2, no eabi, and oabi_compat enabled.
I suspect that's a very rare configuration these days.

I'll note the help message is somewhat dated.  :-)


r~