Discussion:
Question about linux non-standard powerpc SPE FPU
Add Reply
Martina Hřebcová
2025-02-15 12:40:01 UTC
Reply
Permalink
Hi all,




I have one question about kernel / debian operation.

I have computer A1222+ with CPU P1022 ( two e500v2 cores ). It is NG Amiga
with AmigaOS4, but linux runs here nice too.

P1022 CPU is 32-bit powerpc processor, it has no powerpc FPU but have
embedded SPE FPU instead.  Also it has SPE SIMD unit. It has no FP or vector
registers, instead it has GPRs extended for 64bit for FPU and SIMD
operations. So it has different ABI than standard powerpc for floating-point
parameter calls.




There was in past powerpcspe port of Debian. It was dropped somewhere in
2016, due to excluding of SPE extension from gcc.

Debian 8+ powerpcspe snapshot from these times runs very well, with full 3D
desktop support. There is customized kernel for A1222+, which was maintained
by xeno74. Last version I found is 5.4. All this is normal and expected.

There are no other native powerpcspe distro ( or at least I am not hear
about it).




But now I tried standart powerpc Ubuntu 16.04 and also last version of
powerpc 32-bit Void linux.

If I used custom kernel from xeno74 and standart powerpc distro, it works on
my powerpcspe machine with different ABI.

( So now I have in plan to install more modern Debian from snapshots, or
Fienix distro, which is based on modern Debian )




Please, how does it works? How is possible that powerpc code with fpu not
crashes?

I can imagine, that in custom kernel there are soft-float calls. But there
shoud be some powerpc FPU emulator or what...

Please, do you have any idea?




thans




Martina
--
Martina Hřebcová
Lennart Sorensen
2025-02-16 17:20:01 UTC
Reply
Permalink
Post by Martina Hřebcová
Hi all,
I have one question about kernel / debian operation.
I have computer A1222+ with CPU P1022 ( two e500v2 cores ). It is NG Amiga
with AmigaOS4, but linux runs here nice too.
P1022 CPU is 32-bit powerpc processor, it has no powerpc FPU but have
embedded SPE FPU instead.  Also it has SPE SIMD unit. It has no FP or vector
registers, instead it has GPRs extended for 64bit for FPU and SIMD
operations. So it has different ABI than standard powerpc for floating-point
parameter calls.
There was in past powerpcspe port of Debian. It was dropped somewhere in
2016, due to excluding of SPE extension from gcc.
Debian 8+ powerpcspe snapshot from these times runs very well, with full 3D
desktop support. There is customized kernel for A1222+, which was maintained
by xeno74. Last version I found is 5.4. All this is normal and expected.
There are no other native powerpcspe distro ( or at least I am not hear
about it).
But now I tried standart powerpc Ubuntu 16.04 and also last version of
powerpc 32-bit Void linux.
If I used custom kernel from xeno74 and standart powerpc distro, it works on
my powerpcspe machine with different ABI.
( So now I have in plan to install more modern Debian from snapshots, or
Fienix distro, which is based on modern Debian )
Please, how does it works? How is possible that powerpc code with fpu not
crashes?
I can imagine, that in custom kernel there are soft-float calls. But there
shoud be some powerpc FPU emulator or what...
Please, do you have any idea?
Any software that doesn't use FPU at all should work I believe. Any that
uses FPU would not, unless the kernel happens to be configured to emulate
an FPU. I can't remember if powerpc ever had an option to do that.
I know some architectures in the past did at least.

Looking at the kernel config, it appears CONFIG_MATH_EMULATION exists
and may in fact do just that.

In fact I found some discussions from 8 years ago that said tha A1222 can
in fact run powerpc code with the MATH_EMULATION kernel option enabled.
It's not recommended, since the FPU performance is terrible.

I will continue to despise the A1222 even existing for the fact they
put that garbage CPU on it that is not a proper powerpc and broke all
existing compatibility of AmigaOS 4 FPU using code.
--
Len Sorensen
Martina Hřebcová
2025-02-17 14:40:02 UTC
Reply
Permalink
"
Any software that doesn't use FPU at all should work I believe. Any that
uses FPU would not, unless the kernel happens to be configured to emulate
an FPU. I can't remember if powerpc ever had an option to do that.
I know some architectures in the past did at least.

Looking at the kernel config, it appears CONFIG_MATH_EMULATION exists
and may in fact do just that.

In fact I found some discussions from 8 years ago that said tha A1222 can
in fact run powerpc code with the MATH_EMULATION kernel option enabled.
It's not recommended, since the FPU performance is terrible.

I will continue to despise the A1222 even existing for the fact they
put that garbage CPU on it that is not a proper powerpc and broke all
existing compatibility of AmigaOS 4 FPU using code.
"



thank you for answer - MATH_EMULATION is exactly what I searching for.





Yes I know, P1022 CPU is far from ideal for desktop.


On other hand, it is very interesting old embedded processor and has not
only incompatible SPE FPU, but also SPE SIMD APU. It uses 64-bit vectors, so
is far less powerful than VMX / AltiVec, but still nice.

And gcc vectorization feature works OOTB here, so it can be used relatively
easy.




And even if  modern versions of gcc droped support of SPE, Debian Sid
powerpc port still be used with custom kernel.




"Len Sorensen "



thank you very much for info

Martina
John Paul Adrian Glaubitz
2025-02-18 15:00:02 UTC
Reply
Permalink
Post by Lennart Sorensen
Any software that doesn't use FPU at all should work I believe. Any that
uses FPU would not, unless the kernel happens to be configured to emulate
an FPU. I can't remember if powerpc ever had an option to do that.
I know some architectures in the past did at least.
Looking at the kernel config, it appears CONFIG_MATH_EMULATION exists
and may in fact do just that.
Yes, math emulation should just work on 32-Bit PowerPC.
Post by Lennart Sorensen
In fact I found some discussions from 8 years ago that said tha A1222 can
in fact run powerpc code with the MATH_EMULATION kernel option enabled.
It's not recommended, since the FPU performance is terrible.
There is no other option at this point unless one wants to invest time and
effort to build Debian for powerpcspe with LLVM/Clang.

Also, as already mentioned in the other mail, the driver support for A1222
was never upstreamed.
Post by Lennart Sorensen
I will continue to despise the A1222 even existing for the fact they
put that garbage CPU on it that is not a proper powerpc and broke all
existing compatibility of AmigaOS 4 FPU using code.
Yeah, that CPU was an unfortunate choice given that Linux support for
it was lacking as well.

One option is to install FreeBSD which is currently supported on A1222:

See: https://www.freebsd.org/platforms/ppc/#hardware

Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Lennart Sorensen
2025-02-18 19:10:05 UTC
Reply
Permalink
Post by John Paul Adrian Glaubitz
Yes, math emulation should just work on 32-Bit PowerPC.
There is no other option at this point unless one wants to invest time and
effort to build Debian for powerpcspe with LLVM/Clang.
Also, as already mentioned in the other mail, the driver support for A1222
was never upstreamed.
Wow, that's even worse than I expected.
Post by John Paul Adrian Glaubitz
Yeah, that CPU was an unfortunate choice given that Linux support for
it was lacking as well.
See: https://www.freebsd.org/platforms/ppc/#hardware
I remember quite a few years ago where I worked at the time, freescale
suggested we move to that CPU from the 8360 we were using, and I told
them in no uncertain terms what I thought of their powerpc spe and that
we would never be using it. Software compatibility was too important.
We moved to ARM instead. If we had to move of powerpc it would be to
something with a future, not a dead end offshoot of powerpc. We ended
up as one of the first users of the TI AM5728 instead. We looked at
the layerscape powerpc chips, but the power consumption was too high
unfortunately for the design needed.
--
Len Sorensen
John Paul Adrian Glaubitz
2025-02-18 15:00:02 UTC
Reply
Permalink
Hello Martina,
Post by Martina Hřebcová
I have one question about kernel / debian operation.
I have computer A1222+ with CPU P1022 ( two e500v2 cores ).
It is NG Amiga with AmigaOS4, but linux runs here nice too.
I have the same hardware.
Post by Martina Hřebcová
P1022 CPU is 32-bit powerpc processor, it has no powerpc FPU but
have embedded SPE FPU instead.  Also it has SPE SIMD unit. It has
no FP or vector registers, instead it has GPRs extended for 64bit
for FPU and SIMD operations. So it has different ABI than standard
powerpc for floating-point parameter calls.
Yep, this is all known. I used to be the maintainer of the powerpcspe
port in Debian.
Post by Martina Hřebcová
There was in past powerpcspe port of Debian. It was dropped somewhere
in 2016, due to excluding of SPE extension from gcc.
Yes, this is correct. Support for the PowerPCSPE target was dropped from
GCC. It's currently still support by LLVM though.
Post by Martina Hřebcová
Debian 8+ powerpcspe snapshot from these times runs very well, with full
3D desktop support. There is customized kernel for A1222+, which was
maintained by xeno74. Last version I found is 5.4. All this is normal and expected.
There are no other native powerpcspe distro ( or at least I am not hear about it).
These kernels came from AEON and I used them as well. The problem is that
their patches never got upstreamed, from what I remember.
Post by Martina Hřebcová
But now I tried standart powerpc Ubuntu 16.04 and also last version of
powerpc 32-bit Void linux. If I used custom kernel from xeno74 and standart
powerpc distro, it works on my powerpcspe machine with different ABI.
It works since the kernel provides FPU emulation in software. It's slower
but it works.
Post by Martina Hřebcová
( So now I have in plan to install more modern Debian from snapshots,
or Fienix distro, which is based on modern Debian )
You can do that, but you need to stick to the AEON kernel as the support
for the A1222 was never upstreamed.
Post by Martina Hřebcová
Please, how does it works? How is possible that powerpc code with fpu
not crashes?
This is the first time that you are mentioning crashes. What kind of crashes
are you seeing? Again, if you use the proper kernel from AEON, you should
be able to run Debian's powerpc port just fine with software FPU emulation.
Post by Martina Hřebcová
I can imagine, that in custom kernel there are soft-float calls. But there
shoud be some powerpc FPU emulator or what...
That FPU emulator is part of the kernel.
Post by Martina Hřebcová
Please, do you have any idea?
Please be more specific with your error description and setup.

Thanks,
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Loading...