On 13/02/17 21:19, BALATON Zoltan wrote:
Not sure I understand this. QEMU already emulates the empty PCI bus, see in pci_pmac_init() in uninorth.c. What I think is happening that before this patch you get no warnings because the client thinks there's only one PCI bus and does not enumerate the second bus (where devices are) and finds nothing on the first bus, hence no warnings but devices on second bus are not initialised either (this is why bus master bit was not set for rtl8139). They may still appear to work because they are memory mapped and if the client writes the registers at the memory address then can talk to the device but PCI config may be wrong.
After this patch it actually finds both buses. There's one warning for overlapping bus-range but this is probably harmless as there are no devices on the first bus. Then enumerates the second bus and finds OHCI device which may have some other problem that cause the warnings but now at least it is found and the client could talk to it. At least this is what happened on MorphOS. If this is the case then fixing these warnings would need another patch independent of this one but I'd leave that to someone else as I have no time now to try to fix that. This patch alone fixes USB on MorphOS and if it does not break anything else then it's an improvement, even if not a complete fix for the old OpenSUSE image you get these warnings with.
Have you found a regression? If it works as good as before (i.e. did not work before on OpenSUSE and still not working but all other OSes are the same and MorphOS is better) then you might as well apply this patch and then look to fix OHCI with OpenSUSE later which now at least issues warnings instead of silently failing that may be a step forward.
I don't have time to experiment with this now but if you find some properties that help OpenSUSE I can test the patch.
Indeed, I've had a look and it does seem that the second bus does exist in QEMU but AFAICT it's wired up incorrectly (or at least the PCI data space is shared between both buses which is why I suspect these errors show up). It's almost as if the UniNorth AGP was supposed to be a subdevice on an existing PCI bus rather than a self-contained bus of its own.
Given the mix-up between the two buses I'm inclined to leave this patch for the moment until someone can also untangle the QEMU side to make sure that both distinct buses are addressed separately. Perhaps this is something that Ben managed to resolve in his branches from last year?
ATB,
Mark.