]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix PCIe FLR detection
authorMark McLoughlin <markmc@redhat.com>
Fri, 31 Jul 2009 14:35:53 +0000 (15:35 +0100)
committerMark McLoughlin <markmc@redhat.com>
Fri, 31 Jul 2009 14:41:36 +0000 (15:41 +0100)
PCIe DevCap register is actually 32 bits, not 16 bits. Since FLR is
bit 28, we clearly are failing to detect FLR support.

Known to fix device reset with some SR-IOV devices.

* src/pci.c: fix pciDetectFunctionLevelReset()

src/pci.c

index 4030a14c89efdd294ccc3b7f444f61117f7b2f5b..2dc2e1c550751bbd368db1b4494bb8b418a0efa5 100644 (file)
--- a/src/pci.c
+++ b/src/pci.c
@@ -321,7 +321,7 @@ pciFindCapabilityOffset(pciDevice *dev, unsigned capability)
 static unsigned
 pciDetectFunctionLevelReset(pciDevice *dev)
 {
-    uint16_t caps;
+    uint32_t caps;
     uint8_t pos;
 
     /* The PCIe Function Level Reset capability allows
@@ -331,7 +331,7 @@ pciDetectFunctionLevelReset(pciDevice *dev)
      * on SR-IOV NICs at the moment.
      */
     if (dev->pcie_cap_pos) {
-        caps = pciRead16(dev, dev->pcie_cap_pos + PCI_EXP_DEVCAP);
+        caps = pciRead32(dev, dev->pcie_cap_pos + PCI_EXP_DEVCAP);
         if (caps & PCI_EXP_DEVCAP_FLR) {
             VIR_DEBUG("%s %s: detected PCIe FLR capability", dev->id, dev->name);
             return 1;