OSDN Git Service

vfio-pci: Add PCIe capability mangling based on bus type
authorAlex Williamson <alex.williamson@redhat.com>
Mon, 1 Apr 2013 17:50:04 +0000 (11:50 -0600)
committerAlex Williamson <alex.williamson@redhat.com>
Mon, 1 Apr 2013 17:50:04 +0000 (11:50 -0600)
commit96adc5c7c2178d02f0db2db368ba3e4aacef931a
tree568b8a0827ae6fcbcec94b6e17f18df45c71b2bb
parent4b5d5e87c7ab2e979a2cad6c8e01bcae55b85f1c
vfio-pci: Add PCIe capability mangling based on bus type

Windows seems to pay particular interest to the PCIe header type of
devices and will fail to load drivers if we attach Endpoint devices or
Legacy Endpoint devices to the Root Complex.  We can use
pci_bus_is_express and pci_bus_is_root to determine the bus type and
mangle the type appropriately:

* Legacy PCI
  * No change, capability is unmodified for compatibility.
* PCI Express
  * Integrated Root Complex Endpoint -> Endpoint
* PCI Express Root Complex
  * Endpoint -> Integrated Root Complex Endpoint
  * Legacy Endpoint -> none, capability hidden

We also take this opportunity to explicitly limit supported devices
to Endpoints, Legacy Endpoints, and Root Complex Integrated Endpoints.
We don't currently have support for other types and users often cause
themselves problems by assigning them.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
hw/vfio_pci.c