On Tue, 2022-06-14 at 10:52 +0200, Gerd Hoffmann wrote: >> On 06/12/22 19:32, Kevin Locke wrote: >>> PCI Express devices which use legacy VGA compatibility should be placed >>> on the Root Complex. This simplifies ioport access to VGA registers, >>> which requires use of a special exception bit to work across PCI(e) >>> bridges. It is also necessary for ioport access to VESA BIOS Extension >>> (VBE) registers, which is not forwarded over PCI(e) bridges, even with >>> the special exception bit for VGA register access.[1] >>> >>> Update the PCI Express Guidelines to add these to the list of devices >>> which can be placed directly on the Root Complex. >>> >>> Note that the only PCI Express display devices currently supported >>> (bochs-display and virtio-gpu-pci) do not offer VGA compatibility. >>> Legacy PCI devices (e.g. vga, qxl-vga, virtio-vga) are already >>> documented as allowed on the Root Complex by the first item in the list. >>> However, this item documents an additional consideration for placing >>> devices which was not previously mentioned, and may be relevant for PCIe >>> devices offering VGA compatibility in the future. > > Well, the *key* problem is emulated VGA devices with VBE registers in > io address space, because those are not forwarded over bridges. > > For normal VGA registers this isn't much of a problem (in theory, not > fully sure whenever that holds in practice, Alex?). The linux kernel > knows how to use the bridge control register to manage access to VGA > registers. > > So, if the document already covers vga & qxl & virtio-vga (didn't check > that beforehand) I'm not sure we actually need an update ...
Section 2.1 Root Bus mentions attaching legacy PCI devices to the Root Complex. VGA/qxl-vga/virtio-vga are implicitly included (if the reader is aware they are PCI, not PCIe), but they are not specifically mentioned in the document. By my reading, the document does not recommend for or against attaching legacy PCI devices to the Root Complex, other than noting hot-unplugging from the Root Complex is not supported (in Section 2.3) and the general advice to prefer flat hierarchies. There is currently no mention of VGA or VBE in the document. I think documenting the issue with VBE registers would be helpful. Doing so with a recommendation for how to avoid the issue seems even better. Would a recommendation to attach a device which supports VBE to the Root Complex if VBE will be used by the guest make sense? As you noted, applying the recommendation to all VGA compatible devices may be too broad. I'm not sure whether it makes sense to recommend attaching VGA compatible devices to the Root Complex to avoid the complexity of the VGA exception bits, or if that is a non-issue. In fact, if I understand correctly, it may make sense to recommend attaching VGA compatible devices to separate PCI bridges if the VM will have multiple VGA compatible devices so that the guest can perform VGA arbitration. Unless I hear otherwise, I'll plan to create a v4 which documents the issue with VBE registers more specifically. Any suggestions for how best to do that would be appreciated. Cheers, Kevin