On Wed, 2013-02-27 at 20:11 -0500, Kevin O'Connor wrote:
On Wed, Feb 27, 2013 at 02:16:23PM -0700, Alex Williamson wrote:
When we start adding root ports and bridges to systems we need some concept of a primary VGA device.The differentiation of the primary device is that it's the default one that responds to the Legacy VGA address ranges. PCs often have a BIOS selection for this.
Seabios already seems to have some concept of this and looks for a VGA class device for which the parent devices all have VGA routing enabled. This seems to work today if QEMU initializes VGA routing for the path it considers the primary.
The first question is whether this bridge path pre-configuration is what we want to keep as the way QEMU communicates the primary VGA device to Seabios? Obviously we could switch to some kind of fwcfg interface, but I tend to think what we have is sufficient.
SeaBIOS uses the VGA PCI routing information to determine which option rom to run. However, it doesn't actually initialize the VGA PCI routing in it's PCI initialization code (pciinit.c). This isn't an issue for the default QEMU setup because QEMU does not place the VGA card behind a bus. However, should QEMU support multiple VGA cards and/or VGA cards behind a bus, then the PCI init code would likely need to handle VGA setup. (I suppose QEMU could setup the bus forwarding of the legacy VGA ranges, but it would seem ugly to have SeaBIOS do most of the PCI init while QEMU did this small part.)
Supporting VGA behind root ports is inevitable, modern topologies demand it and I've got rough working code to enable it for assigned devices. Once we have root ports, there's no reason bridges shouldn't also be supported and maybe we can even deprecate the QEMU -vga option in favor if a regular -device option.
It does make some sense that SeaBIOS initializes PCI, so should be responsible for this programming. Should we just start with a bus ordered search for the first PCI VGA class device we find and enable routing for that device? If we do that, perhaps we can defer the question of whether QEMU can specify an alternate primary device. Thanks,
Alex