From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [PATCH] pci_cap_init: add 82599 VF quirk Date: Tue, 4 Oct 2011 22:37:06 -0200 Message-ID: <20111005003706.GA21473@redhat.com> References: <1317754938-64699-1-git-send-email-ddutile@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org, chrisw@redhat.com To: Donald Dutile Return-path: Received: from mx1.redhat.com ([209.132.183.28]:17294 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933114Ab1JDUf7 (ORCPT ); Tue, 4 Oct 2011 16:35:59 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p94KZweY009364 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 4 Oct 2011 16:35:59 -0400 Content-Disposition: inline In-Reply-To: <1317754938-64699-1-git-send-email-ddutile@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Oct 04, 2011 at 03:02:18PM -0400, Donald Dutile wrote: > 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 Acked-by: Michael S. Tsirkin > --- > 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