On 05/07/2016 12:00, Gerd Hoffmann wrote:
One option would be to continue using sgabios.bin in fw_cfg. But instead of loading and executing it activate the build-in serial console if we find the file. That would make the switch completely transparent to upper layers. But it is quite hackish of course ...
OpenBIOS uses FW_CFG_NOGRAPHIC for this, which is the negation of qdev_get_machine()->enable_graphics and set by both "-nographic" and "-machine graphics=no" ("-nographic" is a shortcut for "-display none -machine graphics=no"). The default is "-machine graphics=yes".
As long as QEMU doesn't enable both FW_CFG_NOGRAPHIC and sgabios.bin, it should be fine. For example, if SeaBIOS's serial console is made accessible with "-machine graphics=no", then:
* QEMU's "-device sga" should do nothing if machine->enable_graphics is set.
* For old machine types, QEMU should hardcode FW_CFG_NOGRAPHIC to false(*) so that sgabios is never blocked.
For new machine types, SGABIOS will still be accessible with "-device sga". New machine types depend on SeaBIOS that has a serial console, otherwise "-nographic -device sga" breaks.
Paolo
(*) Hardcoding FW_CFG_NOGRAPHIC to false doesn't match what old QEMU does, but provides the best backwards-compatibility:
- old->new: Because old QEMU provides sgabios, you have to include sgabios.bin in the destination too or migration fails. After migration, the BIOS comes from old QEMU and itnever looks at FW_CFG_NOGRAPHIC, so the value doesn't matter---we just make it false.
- new->old: Because old QEMU expects sgabios to be there, you have to include sgabios.bin. The BIOS comes from new QEMU and looks at FW_CFG_NOGRAPHIC. To avoid double hooking FW_CFG_NOGRAPHIC has to be false.