frno7 / gentoo-mipsr5900el

Gentoo tooling for the PlayStation 2, with a Docker, and scripts to install cross-compilers, QEMU, and essential tools.
24 stars 3 forks source link

Verify official Gentoo/MIPS stage3 archive compatibility #16

Closed frno7 closed 1 year ago

frno7 commented 2 years ago

I’m happy to say that Gentoo/MIPS lead member Matt Turner applied the -mfix-r5900 GCC option for the R5900 short loop erratum to the Gentoo Catalyst release building tool, which will make official Gentoo/MIPS stage3 downloads compatible with the R5900 and the PlayStation 2.

Verify official Gentoo/MIPS stage3 archives on PlayStation 2 hardware, and with QEMU/R5900, when they become available.

immolo commented 2 years ago

The fixes are now live in the stage3-mipsel3_n32 tarballs from asking in IRC.

Thanks for the work you put into this already and I can't wait to start trying this out on real hardware.

frno7 commented 2 years ago

@immolo, you’re welcome! At the moment only the o32 ABI is supported. The n32 ABI will hopefully come later.

immolo commented 2 years ago

I was under the impression the fix in Gentoo was only included in the tarball I highlighted but I'll be back home in a few weeks to test this out and see if I can add anything to the project.

frno7 commented 2 years ago

The Gentoo Catalyst patch has mipsel3, mipsel3_n32, and mipsel3_multilib. Presumably it covers both o32 and n32. At least I hope so. Gentoo supplies downloads for both o32 and n32 (and n64 which won’t work with the R5900).

immolo commented 2 years ago

Looking at the mirror list only mipsel2 is available in o32.

If I'm correct I can ask in #gentoo-mips to see what is happening with the build over the weekend.

immolo commented 2 years ago

@frno7 My workload freed up unexpectedly early this week :)

I just spoke to the dev team and they were unaware of the o32 requirement so we are just waiting on Matt to weight in and should see the builds in the next 24 hours which I'll update here and the wiki with a URL to it.

As an OT point, have you thought about creating an IRC room for this project to hopefully get more people involved? I know at least one other person that uses Linux on the PS2.

frno7 commented 2 years ago

Thanks, @immolo! :-) I mentioned o32 but it must have been lost. It’ll be interesting to learn how float-point calculations are dealt with in the Gentoo archives. Issue frno7/linux#3 has more about that topic.

I should use IRC more than I do. I think it’s quite good, it’s often popular for projects I like, and it’s independent of proprietary platforms, which is very good. I haven’t yet taken the time to configure a client properly. Some day, some day...

By the way, @AKuHAK told me about Discord for PS2 development, etc. Another thing to try out is Git Hub discussions.

immolo commented 2 years ago

Well at least I learnt something new about MIPS so it wasn't a waste of time :)

I prefer the sysadmin side more and would be interested to see if MUSL can run one day too, plus FP stuff is way above my skill level :P

Thanks for the discord, I'll check it out later. I'd be happy to sort the chat creation for you as well if you want but if you don't then I'll leave it for now.

frno7 commented 2 years ago

Musl can run indeed, with significant benefits, see https://github.com/frno7/linux/issues/33#issuecomment-750902872.

mirh commented 2 years ago

There's already a #ps2linux (or was it #sps2) channel on freenode..

immolo commented 2 years ago

@frno7 That's great news as any work we do there will benefit the Gentoo MIPS team which they will appreciate.

immolo commented 2 years ago

@mirh Just checked and it seems like it's dead unfortunately.

frno7 commented 2 years ago

@immolo, there’s been no response on the Musl patch mentioned in https://github.com/frno7/linux/issues/33#issuecomment-750902872, unfortunately. A reminder is possibly needed.

immolo commented 2 years ago

@frno7 Once I'm up to speed with it then I'll ask them about it.

In the meantime I can write an ebuild to add the patch for us and see if we can have that merged to portage.

frno7 commented 2 years ago

Hopefully the Musl people will merge the patch promptly when reminded. I haven’t tested it for a while though. Let us know if it still works with recent Musl, if you’d try it. :-)

immolo commented 2 years ago

I've heard they aren't the fastest at accepting changes on the grapevine ;) One of my friends works closely with them though so once I've confirmed the patch for myself I can nudge him to ask about it.

mirh commented 2 years ago

Sps2 used to average something like 10 users at least a year ago. I'm afraid the freenode suicide may have killed that too. Idk if somebody couldn't have take it elsewhere? @Ravenslofty @GeekLucanis @rhoenie @myrkraverk @neuschaefer

immolo commented 2 years ago

@mirh I thought the same and checked libre.chat where everyone moved to from freenode but it's not a registered room at the moment.

immolo commented 2 years ago

https://gentoo.osuosl.org/releases/mips/autobuilds/20220505T204659Z/

Stage3 is ready for testing

frno7 commented 2 years ago

Nice! I did a quick inspection of both mipsel2 and mipsel3 using the r5900check tool. It reported a few problems, but not significantly more than can be expected with having -mfix-r5900 at the moment. As noted in the article on the R5900 short loop erratum, it may be some stray noreorder directives that remain to be fixed in some libraries. Example:

mipsel3 % r5900check lib/libc.so.6
erratum shortloop path lib/libc.so.6
code 000241f8 -3 c222eb44
code 000241fc -2 24010000
code 00024200 -1 e221eb44
code 00024204  0 1020fffc
code 00024208  1 00200825

So it seems there’s a good chance they’ll work.

immolo commented 2 years ago

Sources are verified and after checking only the mipsel3 stage contains the fix we need.

This can be closed now.

frno7 commented 2 years ago

Sources are verified and after checking only the mipsel3 stage contains the fix we need.

Hasn’t mipsel2 been given the -mfix-r5900 treatment by Gentoo/MIPS? That’d be a pity since the R5900 to my knowledge is designed/supposed to be compatible with the whole range MIPS I, II and III. If someone for whatever reason likes to use mipsel2 with the R5900, why deny them that?

immolo commented 2 years ago

In my opinion it goes against the Gentoo way of optimising for your hardware however I can bring this up next time I'm talking to them.

frno7 commented 2 years ago

Thanks! Before the -mfix-r5900 option, the R5900 was mutually incompatible with every other MIPS processor in existence. Now that we have the option, it’d be nice if the R5900 could be part of the mipsel2 family too, and not excluded for being nonoptimal. Sometimes people seek the broadest possible hardware compatibility for various projects, and the R5900 has been on the sideline for so many years. :-)

immolo commented 2 years ago

I've discussed the mipsel2 stages and got the message that they didn't see a benefit to us or them from adding this.

My suggestion is we leave this now and I'll come back to it after we have working glibc and musl builds so we can lower the barrier of entry to get more people involved to help.

frno7 commented 2 years ago

Ah, well... Indeed, the Musl patch would be nice to have in.

immolo commented 2 years ago

Ah, well... Indeed, the Musl patch would be nice to have in.

Briefly spoke about that too in passing, we can have that added Gentoo side once I've tested it and that in turn will get it added upstream faster if it hasn't happened before hand.

On a side note has anyone here submitted a ps2 patch for gnuconfig recently? They were going to remove it until I offered to run some tests to see if we still needed it.

frno7 commented 2 years ago

On a side note has anyone here submitted a ps2 patch for gnuconfig recently? They were going to remove it until I offered to run some tests to see if we still needed it.

I have no idea what that thing does. :-) Do you have a link to it?

immolo commented 2 years ago

I'm stuck on Windows this week so I can't pull the patch up till I get home as I need more privileges than my work laptop allows me. I'll do some tests when I get back and we can see if it's needed or if it's a left over patch from the old Gentoo PS2 days like it sounds like it is.

They did add though that they would welcome any MIPS patches coming back and this was just a query.

immolo commented 2 years ago

0001-add-ps2-targets-to-config.sub.patch

Well it's something pre us as it was submitted in 2008 by one of the PS2 Gentoo devs.

frno7 commented 2 years ago

Well it's something pre us as it was submitted in 2008 by one of the PS2 Gentoo devs.

Maybe it was something for the PS2SDK? I don’t think it has any effect on the mipsr5900el target used for PlayStation 2 Linux, or the iopmod repo with its mipsr3000el target.

immolo commented 2 years ago

Possibly, Sam (One of the lead devs) seems to think it could be more important for us though and as he is rarely wrong I'll play it safe and test it on a live system with and without before it's removed.

I'll update with the Gentoo bugreport once this is complete.

immolo commented 2 years ago

gnuconfig is used for configure I've found.

I've done some tests though and this is no longer required for us :)

https://bugs.gentoo.org/851045

immolo commented 1 year ago

This can now be closed as we have had confirmed mipsel support in the Gentoo mipsel3 stage3 for a year now and also confirmed support for mipsel3 musl stage3s when those become an official stage3 in Gentoo.

https://github.com/gentoo/catalyst/blob/master/arch/mips.toml#L93

frno7 commented 1 year ago

Thanks!