On 05/08/16 21:44, BALATON Zoltan wrote:
Following up from this, I found out today that the reason OS 9 rtl8139 drivers don't work in QEMU is due to the same issue, i.e. by default Apple OF appears to enable bus mastering upon boot (OpenBIOS currently doesn't) and so many driver authors forget to explicitly enable this.
So taking this patch and making a few minor tweaks I was able to get the rtl8139 working in OS 9.2 and surf the web in Classilla :) I'm not sure whether it solves similar issues people were having in 10.4.11 but I'd invite people to test and report back.
I'm not sure if this is the correct fix but I've found it before this was needed to get RTL8139 working.
Recently I've seen changes in QEMU to calling realize functions for some devices that were not realized due to not being connected via a bridge and that mentioned that bus master is set on realize and this was needed to fix that (or something similar, not sure I got it completely and I've forgot it since; I think these were around commit 685f9a3 on QEMU). I've hoped this might also fix this issue but haven't tested that yet.
Also on real hardware there's a bridge chip which is currently disabled due to OpenBIOS not handling it correctly according to a comment in uninorth.c.
I'm not sure any of this is related to this issue, just mentioning it in case it rings a bell for someone.
AFAICT the bus mastering part is still needed since in QEMU the bus master memory region (which is aliased onto system memory) is disabled unless the bus master bit is set. It's fairly easy to spot this in the monitor with "info mtree".
My interpretation of this is that any PCI device in QEMU which wishes to read/write from system memory which isn't mapped via a BAR must also have the bus master bit set. I'm not a PCI expert so someone feel free to provide a more correct explanation :)