On 01/01/17 22:22, BALATON Zoltan wrote:
On Sat, 31 Dec 2016, Mark Cave-Ayland wrote:
I've given this a spin around my PPC images and I don't see any regressions so I think this is going in the right direction - I think it
Good to hear. Have you also tested if it makes a difference with irq-s on mac99? I've found that USB irq-s did not work correctly without this patch so it may help with problems with that (e.g. sound and mouse problems) and likely makes the patch in OpenBIOS to set the bus master for RTL8139 unnecessary as well but I haven't tested these.
As USB hasn't previously been working that well on mac99, I must confess that it's not something I routinely test. If you think that adding a USB mouse/keyboard is enough then I can include that as part of my tests?
may need a couple of minor tweaks though.
Firstly, I now see the following PCI BAR warnings on boot for my old openSUSE 11 boot ISO (openSUSE-11.1-NET-ppc.iso):
[...]
I/O resource not set for host bridge 0 Memory resource not set for host bridge 0 pci 0001:10:0e.0: BAR 0: can't allocate mem resource [0x0-0xffffff] pci 0001:10:0c.0: BAR 0: can't allocate mem resource [0x0-0x7ffff] pci 0001:10:0f.0: BAR 6: can't allocate mem resource [0x82040000-0x8207ffff] pci 0001:10:0e.0: BAR 6: can't allocate mem resource [0x82010000-0x8201ffff] pci 0001:10:0e.0: BAR 2: can't allocate mem resource [0x0-0xfff] pci 0001:10:0d.0: BAR 0: can't allocate mem resource [0x0-0xff] ohci_hcd 0001:10:0d.0: init 0001:10:0d.0 fail, -16
Maybe these were silently failing before but I'm not sure what it is. It's hard to see these messages on normal boot as it seems to be printing dark gray text on black. Is there some way to get output on serial and enable more detailed logs? I'm not familiar with openSUSE on PPC or yaboot.
Sure, just fire up QEMU with -nographic and you can then grab the output from a standard text terminal (or at least that worked for me here).
I've also noticed this color problem with Finnix and wonder how this shows up on real Macs. I thought Macs have a light background by default but this happens after the boot loader has cleared the screen and set up its own colors so maybe it's not the default background but there's a problem somewhere later. (After all the OpenBIOS background is also light but it's cleared black before the text is printed.)
I did look at this a few years back when I did the big display rewrite. My last guess was that the writes to the VGA colour registers in vga.fs should be forced LE, however when I traced it through to QEMU the values seemed to come through correctly, and the defaults were being overridden from the bootloader.
If you are interested to take a further look at this, I can point you towards the relevant sections of code. I'm fairly sure that once the cause is found the fix should be reasonably trivial.
So perhaps you might need to fake up a few extra properties to get rid of the warnings on boot?
I'm not sure. Maybe only the first two warnings for bridge 0 could be eliminated by that but the other warnings refer to cards on the second bus and not the one my patch touches. Maybe the patch just uncovers problems with the other bus that was hidden so far because these requests were previously sent to the first bus and got empty replies earlier before it could get to the place where the warnings are issued. These warnings may show that the cards are actually tried to be initialised now but there are some problems. These may need to be fixed somewhere else on the other bus not in the empty PCI bus my patch adds as that does not have these cards at all.
Yes you could be right here. The one thing I did think was strange was that both the original and new /pci nodes have a bus range of 0 which could lead to some confusion?
Secondly while the address of the extra PCI node looks fine for -M mac99 in the device tree, I'm not sure it is correct for -M g3beige:
[...]
Perhaps the extra /pci node needs to be wrapped in an [IFDEF] block or similar so that it only appears for -M mac99?
It's likely wrong for g3beige but not sure an [IFDEF] would be enough to make it only appear on mac99. [IFDEF]s seem to test CONFIG_* options but mac99 is a runtime parameter so we would need a way to detect if we're running on mac99 or g3beige (the same openbios-elf.ppc compiled with the same CONFIG_* options can run on both so I can't use [IFDEF] for that). We would need to test the value of machine_id from arch/ppc/qemu/init.c for this but I'm not sure how to do that from Forth. Maybe moving the patch from Forth to C would be easier.
Probably the simplest option here is to hook is_newworld() into Forth using bind_func() as "is-newworld"?
But instead of that we could also aim for a more complete solution and consider doing it similar to spapr and SLOF and generate an fdt in QEMU and pass it to OpenBIOS and patch/amend it as needed after converting to a usual device tree (we could use the code from SLOF for this). I've checked how it's done with spapr and there a call to the hypervisor is used to get the fdt. We don't have that but we already use FWCFG so we could use FW_CFG_SETUP_* to pass the fdt. I think this is doable but I'm still missing some details and haven't tried to implement it. What do you think about such a solution? Basiacally we would need to add creating the fdt and making it available via FWCFG to the mac machines in QEMU, then implement getting it and using it in OpenBIOS. This way we could also solve the problem of keeping OpenBIOS and QEMU in sync because a change in the fdt could be made entirely in QEMU without needing a corresponding change in OpenBIOS. Also adding new machines could be easier. This is a bigger task but maybe worth doing if it could make the current code cleaner.
There was a recent thread about this with Thomas and my takeaway from this was that since the DT binds many functions (and not just properties) into the DT that it's not clear this would be much of a win. Feel free to pick up the thread at https://www.coreboot.org/pipermail/openbios/2016-November/009846.html if you have any further thoughts.
ATB,
Mark.