[PATCH] pci_cap_init: add 82599 VF quirk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



v2: Updated to reflect changes requested by reviewers.
 
Add check when PCIe capability structure is version 0
and VID and DID is 82599 VF.  In this case, the size
of the PCIe cap structure should be the same as a version 2
cap structure.
Documented in 82599 Errata 35, and is still marked "No Fix".
According to Intel, it's in silicon not fw, and needs a sw workaround.

Signed-off-by: Donald Dutile <ddutile@xxxxxxxxxx>
---
 hw/device-assignment.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 288f80c..d3d8d36 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -1260,7 +1260,7 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev)
     }
 
     if ((pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_EXP, 0))) {
-        uint8_t version, size;
+        uint8_t version, size = 0;
         uint16_t type, devctl, lnkcap, lnksta;
         uint32_t devcap;
 
@@ -1287,7 +1287,20 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev)
                         "non-standard size 0x%x; std size should be 0x3c \n",
                          __func__, PCI_CAP_ID_EXP, size);
             }
-        } else {
+        } else if (version == 0) {
+            uint16_t vid, did;
+            vid = pci_get_word(pci_dev->config + PCI_VENDOR_ID);
+            did = pci_get_word(pci_dev->config + PCI_DEVICE_ID);
+            if (vid == PCI_VENDOR_ID_INTEL && did == 0x10ed) {
+                /*
+                 * quirk for Intel 82599 VF with invalid PCIe capability
+                 * version, should really be version 2 (same as PF)
+                 */
+                size = 0x3c;
+            }
+        }
+
+        if (size == 0) {
             fprintf(stderr,
                     "%s: Unsupported PCI express capability version %d\n",
                     __func__, version);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux