On 28/10/2022 13:32, BALATON Zoltan wrote:
On Fri, 28 Oct 2022, Mark Cave-Ayland wrote:
On 25/10/2022 22:31, BALATON Zoltan wrote:
OpenBIOS cannot run FCode ROMs yet but it can detect NDRV in VGA card
ROM and add it to the device tree for MacOS. Pass the NDRV this way
instead of via fw_cfg. This solves the problem with OpenBIOS also
adding the NDRV to ati-vga which it does not work with. This does not
need any changes to OpenBIOS as this NDRV ROM handling is already
there but this patch also allows simplifying OpenBIOS later to remove
the fw_cfg ndrv handling from the vga FCode and also drop the
vga-ndrv? option which is not needed any more as users can disable the
ndrv with -device VGA,romfile="" (or override it with their own NDRV
or ROM). Once FCode support is implemented in OpenBIOS, the proper
FCode ROM can be set the same way so this paves the way to remove some
hacks.
This is not correct though: in a real option ROM the NDRV is included as part of
the ROM payload and is not a standalone file. The IEEE-1275 PCI specification gives
the correct format for an option ROM which at minimum contains a header, and likely
some additional FCode.
As the commit message says that does not work with OpenBIOS at the moment but passing
the NDRV does. That it's not how real hardware works is not an argument after all
real hardware does not have fw_cfg either and this way is much simpler than fw_cfg,
it fixes the problem with ati-vga and it can be changed later to pass the real FCode
ROM the same way so I think it's a better way to handle this now as what we have
currently.
Right, passing the NDRV directly only happens to work because Ben's original hack is
still in OpenBIOS. The longer term aim is to move towards the IEEE-1275 PCI
specification: I can't see how switching from one custom mechanism to a different
custom mechanism benefits anything here.
The problem you're actually trying to solve is that the ati-vga device should not be
picking up the NDRV, so that's where the focus should be.
Isn't the immediate problem here that the NDRV handling in OpenBIOS needs to be
improved so that it can be disabled for particular VGA devices such as ATI?
No change is needed to OpenBIOS (I've discussed it more in the reply to Howard on the
list yesterday). With this patch only VGA device will have qemu_vga.ndrv so OpenBIOS
won't add it for ati-vga. Also the fw_cfg and vga_ndrv? stuff can be removed from
OpenBIOS after this patch as it's not nedeed any more thus simplifying the vga.fs
FCode in OpenBIOS a lot.
The vga-ndrv? option was added for a reason though: the NDRV doesn't (yet?) work with
KVM-PR on real Mac hardware, so to run MacOS on KVM you need a separate mechanism to
disable the NDRV. This becomes more important when OpenBIOS gets to the stage where
the FCode can create the DT nodes itself.
Also if we do decide to change this, it would be a compatibility break for a lot of
existing documentation and examples: this is something we could manage going forward,
but it needs some planning and isn't something we should be doing a few days before
freeze.
ATB,
Mark.