On Sun, Dec 13, 2020 at 08:46:38PM +0100, Mark Kettenis wrote: > > Date: Fri, 11 Dec 2020 17:24:51 +0100 > > From: "Peter J. Philipp" <p...@centroid.eu> > > > > Hi, > > > > Now that POWER9 systems are pretty well supported, I'm setting away > > some time next year to backport powerpc64 to the Mac G5. Is there > > anyone already doing that? I already tried this once (based on the > > macppc sources) but failed. I don't want to throw the little that I > > learned out the window. I'm giving myself more time next year than > > my last attempt. Right now I'm dreaming big, but I'll need to awake > > to do some work on this. I'll likely start in January or February > > with compiling on G5 macppc arch and testing on amd64 under qemu. > > Please don't give me any kudos until I share something that > > works. :-) > > Hi Peter, > > The core powerpc64 kernel code (pmap, traps, etc.) should work just > fine on the PowerPC 970. The powerpc64 <machine/endian.h> uses > instructions that the G5 doesn't have, but that is trivial to fix.
Awesome, that'll help a lot! Thank you! > Your biggest challenge will be the firmware differences. The POWER9 > machines use OPAL whereas the older systems use Open Firmware. The > way I envisioned supporting Open Firmware systems is to have the > bootloader translate the Open Firmware device tree into a "flattened" > device tree before entering the kernel. That way you don't need a > special kernel for the G5 systems. It's quite funny, I actually thought of that too, but had discarded it for porting the realtime ofw code from macppc over. I had taken a small peek at FreeBSD's code and had wondered why they had an FDT and an OFW register. I did spot some fdt routines in their bootloader. I guess I can do this though if you think it's the better way it's the better way, the bootloader that came with macppc I had converted to load 64-bit ELF binaries back in 2018 and I was thinking of re-using it. I guess I can tie in translation routines and that would be the core of the work. > One warning though: we may switch the POWER9 systems to little-endian > at some point in the future. Supporting both big-endian and > little-endian in the codebose shouldn't be a huge burden. But I'm not > sure we'll have the infrstructure to build both big-endian and > little-endian releases and packages. OK good to know. I have a stereotype in me that the 970 doesn't do little endian even though it has the MSR support for it. It would be worth it to stay on big endian for my port anyhow so that I can dual boot between macppc and macppc64 and share disk partitions perhaps. I'm thinking that would be helpful in many scenarios. So then POWER* cpu's can go little endian. In regards of packages, there will be a way, but first the macppc64 port has to complete. Perhaps we can set up a sort of DPD among the users to build packages for just that port. And there is no real word that this port will make it into OpenBSD at all. When it's ready I guess it's up to you guys to weigh options to put it in or not and then the question of making space for the release will likely be visited. > Cheers, > > Mark I'm looking forward to this. I'm interested how conversion from OFW to FDT would work in the bootloader. I'll likely take a peek at FreeBSD's bootloaders and see if I can use some of that. Best Regards, -peter