On Sun, 18 Aug 2019, Jd Lyons via OpenBIOS wrote:
I’ve been working a little to see if I can get multi-threaded TGC to work for the Mac OS/X in qemu, but Openbios doesn’t seem to support more than one CPU and doesn’t build any device for a second CPU.
I’ve looked at the openbios/arch/ppc/qemu/init.c, and that seems to be the place to apply a patch for multi cpu support, but I don’t really seem any graceful way of doing it.
Can anyone offer any help?
I think passing info about machine to OpenBIOS via a flattened device tree as was proposed before would solve this too becuase then QEMU (which knows how many and what kind of CPUs it emulates) could add the necessary info about CPUs in the FDT and OpenBIOS would not have to know or do anything about it just get it from QEMU. But I wasn't able to make this work in OpenBIOS yet. (I did manage to get FDT unflattening in OpenFirmware working but that's not complete yet so its experimental and OpenFirmware does not have Mac drivers so cannot replace OpenBIOS yet. I've also posted an attempted port of SLOF's fdt.fs before but that needs some work to be usable in OpenBIOS.) You can see a simple example of how to pass info about CPU and memory at the end of latest pegasos2 version here:
https://osdn.net/projects/qmiga/scm/git/qemu/blobs/pegasos2/hw/ppc/pegasos2....
(More complex examples can be found in spapr and pnv machines that likely handle multiple CPUs.) This creates an FDT with basic info that it puts in guest memory where the firmware parses it the same way as SLOF does to create the initial device tree which then it can amend as needed to add Forth words PCI buses and detected cards. But this also allows removing the hard coded CPU and board infos and to get rid of values passed over FW_CFG currently so I think would simplify OpenBIOS a lot.
TGC-Work/bin/qemu-system-ppc -M mac99,via=pmu -serial stdio -smp 2,cores=2,threads=1 -accel tcg,thread=multi -cpu g4 -boot c -prom-env auto-boot?=true -prom-env boot-args=-v -hda /Users/jam/os9.2.1.img -m 256 -bios /Users/jam/aty7/openbios/obj-ppc/openbios-qemu.elf heathrow_class_init: init 2 core99_machine_class_init: init 2 qemu-system-ppc: warning: Guest not yet converted to MTTCG - you may get unexpected results
This warning probably means that your main problem may not be missing info about CPUs in device tree yet but maybe you'd need to fix emulation first or it may not work at all with MTTCG yet. (I think MTTCG might be interesting but fixing hardfloat for PPC would provide a greater speedup for most programs currently so that could be more interesting to look at.)
Regards, BALATON Zoltan