public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pci_cap_init: add 82599 VF quirk
@ 2011-10-04 19:02 Donald Dutile
  2011-10-05  0:37 ` Michael S. Tsirkin
  2011-10-05 19:59 ` Marcelo Tosatti
  0 siblings, 2 replies; 3+ messages in thread
From: Donald Dutile @ 2011-10-04 19:02 UTC (permalink / raw)
  To: avi, mtosatti; +Cc: kvm, chrisw, mst

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@redhat.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-10-05 20:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-04 19:02 [PATCH] pci_cap_init: add 82599 VF quirk Donald Dutile
2011-10-05  0:37 ` Michael S. Tsirkin
2011-10-05 19:59 ` Marcelo Tosatti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox