On Mon, 15 Nov 2021, BALATON Zoltan wrote:
On Sun, 14 Nov 2021, Mark Cave-Ayland wrote:
I also stand by my offer to provide help/advice on creating the real /pci node if you are willing to investigate the NetBSD issue.
So can you test on real hardware if the problem also exists on versions of NetBSD that aren't booting now on QEMU such as those between 8.1 and 9.1 other than 9.0? That would give a clue if the breakage is related to the PCI patch at all because if it isn't then we should look for the problem elsewhere. I've asked this several times but got no answer yet.
Then if it is a memory corruption problem I think we should compare how memory is allocated on real hardware vs. OpenBIOS but I have no idea how to do that nor any real hardware to test on. Some memory info is printed in the dmesg you've sent but that may not be enough info and more detailed knowledge about the NetBSD kernel may be needed to know what to look for.
If you're willing to help please do so and try to do the above tests to get closer to understanding what the problem actually is.
Also, I've done the following test before arriving at the dummy-pci version but now I've repeated it again to verify and you can reproduce it if you want:
1. Start from QEMU master, check that NetBSD-8.0-macppc.iso gets to the prompt as you've shown with upstream OpenBIOS.
2. Add -bios openbios-qemu.elf with OpenBIOS patched with the last v9 version of the patch that adds the full /pci node with all properties. This fails with the "bad dir ino 10" error as you said.
3. Then edit openbios/arch/ppc/qemu/init.c and change the name of the added pci node to something else than pci say dummy-pci or nonpci or whatever leaving all other properties there. This boots like in 1.
4. Now revert the add pci node patch and apply the dummy-pci patch instead which only adds a node named dummy-pci with type pci that's enough to fix MorphOS. NetBSD also boots with this like in 1. above.
5. Then edit openbios/arch/ppc/qemu/init.c and change it to add a node named pci but without any properties, such as:
case ARCH_MAC99: /* This adds a dummy node of pci device-type before the actual /pci * node which is needed for MorphOS to find devices on PCI bus. * (Real machine has 3 /pci nodes but we only have one.) */ fword("new-device"); push_str("pci"); fword("device-name"); fword("finish-device"); /* fall through */ case ARCH_MAC99_U3: /* The NewWorld NVRAM is not located in the MacIO device */ macio_nvram_init("/", 0); ob_pci_init();
or compared to the dummy-pci patch:
diff --git a/arch/ppc/qemu/init.c b/arch/ppc/qemu/init.c index ef8b27a..a33623d 100644 --- a/arch/ppc/qemu/init.c +++ b/arch/ppc/qemu/init.c @@ -869,10 +869,8 @@ arch_of_init(void) * node which is needed for MorphOS to find devices on PCI bus. * (Real machine has 3 /pci nodes but we only have one.) */ fword("new-device"); - push_str("dummy-pci"); - fword("device-name"); push_str("pci"); - fword("device-type"); + fword("device-name"); fword("finish-device"); /* fall through */ case ARCH_MAC99_U3:
which results in
0 > cd / ok 0 > ls fff55e44 aliases fff55ee8 openprom fff56090 options fff56108 chosen fff561b8 builtin fff5bdf0 packages fff5ecf8 cpus fff5edf8 memory@0 fff5eec0 rom@ff800000 fff61cf4 pci fff61d68 nvram@fff04000 fff62000 pci@f2000000 fff6ae74 uni-n@f8000000 ok 0 > cd pci ok 0 > .properties name "pci" ok
and this again gets the "bad dir ino 10" error with NetBSD 8.0.
After this I've concluded there's no way I can solve this by adding, removing or changing the properties in this patch that you've been asking for all along and submitted the dummy-pci patch instead as the minimal and only viable alternative I can see to solve this in the short term without breaking NetBSD versions that are booting now. This was three weeks ago and I'm trying to explain this to you but I'm not sure I've managed to get it across. Repeat the above experiment if you don't believe and say what to do next. We only have about a week to solve this.
Regards, BALATON Zoltan