On Thu, 20 Feb 2025, Jd Lyons wrote:
Thanks Balaton, I’m working on the PIR code in the Openpic.c to see if I can resolve some of the issues with resets of the additional cpus. The
You don't have to change the PIR code in openpic. That's correct for e500. I just said you can verify if this register is written at all on the Mac by enabling the DPRINTFs and see if you see any logs. Likely you won't see any for the PIR reset bits because on the Mac the CPU resets are connected to GPIO instead so Linux pokes there not the openpic PIR which is how e500 does it. So having the CPU resets connected to PIR in mac_newworld.c is probably code copied from e500 but it's not correct for Mac. You have to change that in mac_newworld.c to connect the CPU reset to the macio GPIO instead and openpic.c likely does not need patching at this point. I don't know how more detailed to explain this to get this through. There must be somebody on the list by now who could come up with a patch.
limit for qemu ppc seems to be 32 cores but Openbios only seems to read 20 of them. At any rate, if I can get 2 or 4 cores working things will be that much faster, I just like to see all those cores in the device tree. I’m just toying around with more than 2 cores because that is all a PowerMac G4 ever had anyway.
Forget about these for a minute. Just stick to -smp 2 at first to make it simpler to do and debug. You won't be able to get more than 4 CPUs anyway according to the Linux source which says only that many GPIO lines exist so it won't even try more and that's also what Mac OS X would also support. Was there any PPC Mac with more than 4 CPU cores? If not then you would likely need to also patch the kernel for that so it's not something to try to do at first if you don't want to make your own job harder than it needs to be and not get distracted by trying to debug problems you would not get with -smp 2. Once you can get 2 CPUs working you can try 4 and after that's working you can think about if there could be more but maybe you'll find that adding more CPUs won't make things faster beyond 4 CPUs. But that's something to try later when it works with 2 CPUs already.
Regards, BALATON Zoltan
On a side note, not unrelated I looked at my Dual CPU MDD PowerMac and found the GPIO has several nodes in the device tree, like 8 or 9 of them, I did not count. Anyways, it looks like only the top device pci/Mac-io/@50 is the GPIO for the CPUs and maybe some other stuff, and it has an extended gpio that looks like it may handle the other CPU or just some other system stuff, all the other GPIO entries in the deice tree below it on the Mac-io/ node say they are for audio.
A rather complex setup for builtin audio if you ask me, but if I have too I’ll probe the main gpio@50 and see if I can find how the cpus are brought out of reset.
Likely the code you pointed to is all we need to property reset the second cpu in qemu so that linux, OS 9, and OS X can bring it up and use it.