public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Donald Dutile <ddutile@redhat.com>
To: avi@redhat.com, mtosatti@redhat.com
Cc: kvm@vger.kernel.org, chrisw@redhat.com, mst@redhat.com
Subject: [PATCH] pci_cap_init: add 82599 VF quirk
Date: Tue,  4 Oct 2011 15:02:18 -0400	[thread overview]
Message-ID: <1317754938-64699-1-git-send-email-ddutile@redhat.com> (raw)

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


             reply	other threads:[~2011-10-04 19:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-04 19:02 Donald Dutile [this message]
2011-10-05  0:37 ` [PATCH] pci_cap_init: add 82599 VF quirk Michael S. Tsirkin
2011-10-05 19:59 ` Marcelo Tosatti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1317754938-64699-1-git-send-email-ddutile@redhat.com \
    --to=ddutile@redhat.com \
    --cc=avi@redhat.com \
    --cc=chrisw@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox