On Aug 18, 2019, at 4:49 PM, Mark Cave-Ayland mark.cave-ayland@ilande.co.uk wrote:
On 18/08/2019 19:41, 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?
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 s>> et_property: NULL phandle
============================================================= OpenBIOS 1.1 [Aug 6 2019 02:05] Configuration device id QEMU version 1 machine id 1 CPUs: 2 Memory: 256M UUID: 00000000-0000-0000-0000-000000000000 CPU type PowerPC,G4
milliseconds isn't unique.
switching to new context: call-method slw_update_keymap failed with error ffffffdf call-method slw_update_keymap failed with error ffffffdf
You can grab the current number of CPUs from the fwcfg interface at register FW_CFG_NB_CPUS. As a starting point I'd try writing a for loop somewhere around https://github.com/openbios/openbios/blob/master/arch/ppc/qemu/init.c#L996 to create the relevant number of CPU nodes in the DT.
Once that is done I suspect the next part of the puzzle will be figuring out how to wire up the machine and its IRQs correctly...
ATB,
Mark.
Thanks Mark,
Doing this gets me 2 /cpus but both are @0
/* This needs adjusting if #size-cells gets increased. Alternatively use multiple (address, size) tuples. */ PUSH(ram_size & 0xffffffff); fword("encode-int"); fword("encode+"); push_str("reg"); fword("property");
cpu = id_cpu(); cpu->initfn(cpu); printk("CPU type %s\n", cpu->name);
cpu = id_cpu(); cpu->initfn(cpu); printk("CPU type %s\n", cpu->name);
snprintf(buf, sizeof(buf), "/cpus/%s", cpu->name); ofmem_register(find_dev("/memory"), find_dev(buf)); node_methods_init(buf);
How would I go about making the second cpu be @1?
I can’t seem to figure where in the code the cpu is set to @0, is this a function of Openbios or Qemu?