On Fri, Aug 22, 2014 at 8:23 AM, Bruno Prémont bonbons@linux-vserver.org wrote:
On Thu, 21 Aug 2014 23:39:31 -0500 Bjorn Helgaas wrote:
On Thu, Aug 21, 2014 at 4:34 PM, Bruno Prémont wrote:
A second step would then be to tune vgaarb's initial selection. Bjorn, is it possible to verify which I/O ports are decoded by a PCI device at the time of adding it to vgaarb? If so, how? I would like to check for legacy VGA I/O range (0x03B0-0x03DF) and only let vgaarb set a device as default if that I/O range is decoded by the device.
I don't know of a way. I'm pretty sure VGA devices are allowed to respond to those legacy addresses even if there's no BAR for them, but I haven't found a spec reference for this. There is the VGA Enable bit in bridges, of course (PCI Bridge spec, sec 12.1.1. If the VGA device is behind a bridge that doesn't have the VGA Enable bit set, it probably isn't the default device.
Those VGA devices behind bridges are the easy ones that vgaarb selects properly. It's the ones not behind a bridge (integrated graphics) like the intel one that cause problems.
For Andreas's system the discrete nvidia GPU has no I/O enabled according to PCI_COMMAND flags while the integrated intel one does have them (that's why the Intel GPU is chosen).
Unfortunately I don't know what makes his system choke at boot time as he did not provide logs for the failing case.
Attached dmesg for the failing case (obtained via ssh).
Without blacklisting a small horizontal bar of vertical green bars appears (no x, no console). If nouveau is blacklisted then I get a console, but X will not start (No devices found). If i915 is blacklisted then I do not get a console. The screen just freezes after a few boot messages.
What is vga_default_device() used for? Is it supposed to hold the device that is controlling the (boot) screen? Why can't we just read the configuration from vga_switcheroo/gmux?
If there is no better way to detect the proper legacy VGA device the only remaining option would be to perform the screen_info testing in vga_arb_device_init() enclosed in arch #ifdef...
Bruno