* [PATCH] qemu-kvm: device assignment: add 82599 PCIe Cap struct quirk
@ 2011-09-29 0:20 Donald Dutile
2011-09-29 0:23 ` Chris Wright
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Donald Dutile @ 2011-09-29 0:20 UTC (permalink / raw)
To: avi, mtosatti; +Cc: kvm, chrisw, mst
commit f9c29774d2174df6ffc20becec20928948198914
changed the PCIe Capability structure version check
from if > 2 fail, to if ==1, size=x, if ==2, size=y,
else fail.
Turns out the 82599's VF has an errata where it's
PCIe Cap struct version is 0, which now fails device assignment
due to the else fallout, where before, it would blissfully work.
Add a quirk if version=0, & intel-82599, set size to version 2 struct.
Signed-off-by: Donald_Dutile <ddutile@redhat.com>
---
hw/device-assignment.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 288f80c..ed2a883 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -1261,12 +1261,20 @@ 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;
- uint16_t type, devctl, lnkcap, lnksta;
+ uint16_t type, devctl, lnkcap, lnksta, vendor, device;
uint32_t devcap;
+ vendor = pci_get_word(pci_dev->config + PCI_VENDOR_ID);
+ device = pci_get_word(pci_dev->config + PCI_DEVICE_ID);
version = pci_get_byte(pci_dev->config + pos + PCI_EXP_FLAGS);
version &= PCI_EXP_FLAGS_VERS;
- if (version == 1) {
+ if (version == 0 && vendor == 0x8086 && device == 0x10ed) {
+ /*
+ * quirk for Intel 82599 VF with invalid PCIe capability version,
+ * should really be version 2 (same as PF)
+ */
+ size = 0x3c;
+ } else if (version == 1) {
size = 0x14;
} else if (version == 2) {
/*
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] qemu-kvm: device assignment: add 82599 PCIe Cap struct quirk
2011-09-29 0:20 [PATCH] qemu-kvm: device assignment: add 82599 PCIe Cap struct quirk Donald Dutile
@ 2011-09-29 0:23 ` Chris Wright
2011-09-29 4:12 ` Alex Williamson
2011-10-02 9:56 ` Michael S. Tsirkin
2 siblings, 0 replies; 5+ messages in thread
From: Chris Wright @ 2011-09-29 0:23 UTC (permalink / raw)
To: Donald Dutile; +Cc: avi, mtosatti, kvm, chrisw, mst
* Donald Dutile (ddutile@redhat.com) wrote:
> commit f9c29774d2174df6ffc20becec20928948198914
> changed the PCIe Capability structure version check
> from if > 2 fail, to if ==1, size=x, if ==2, size=y,
> else fail.
> Turns out the 82599's VF has an errata where it's
> PCIe Cap struct version is 0, which now fails device assignment
> due to the else fallout, where before, it would blissfully work.
>
> Add a quirk if version=0, & intel-82599, set size to version 2 struct.
>
> Signed-off-by: Donald_Dutile <ddutile@redhat.com>
(not pretty, but neither is the hw errata...)
Acked-by: Chris Wright <chrisw@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] qemu-kvm: device assignment: add 82599 PCIe Cap struct quirk
2011-09-29 0:20 [PATCH] qemu-kvm: device assignment: add 82599 PCIe Cap struct quirk Donald Dutile
2011-09-29 0:23 ` Chris Wright
@ 2011-09-29 4:12 ` Alex Williamson
2011-10-02 9:56 ` Michael S. Tsirkin
2 siblings, 0 replies; 5+ messages in thread
From: Alex Williamson @ 2011-09-29 4:12 UTC (permalink / raw)
To: Donald Dutile; +Cc: avi, mtosatti, kvm, chrisw, mst
On Wed, 2011-09-28 at 20:20 -0400, Donald Dutile wrote:
> commit f9c29774d2174df6ffc20becec20928948198914
> changed the PCIe Capability structure version check
> from if > 2 fail, to if ==1, size=x, if ==2, size=y,
> else fail.
> Turns out the 82599's VF has an errata where it's
> PCIe Cap struct version is 0, which now fails device assignment
> due to the else fallout, where before, it would blissfully work.
>
> Add a quirk if version=0, & intel-82599, set size to version 2 struct.
>
> Signed-off-by: Donald_Dutile <ddutile@redhat.com>
Ugh.
Acked-by: Alex Williamson <alex.williamson@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] qemu-kvm: device assignment: add 82599 PCIe Cap struct quirk
2011-09-29 0:20 [PATCH] qemu-kvm: device assignment: add 82599 PCIe Cap struct quirk Donald Dutile
2011-09-29 0:23 ` Chris Wright
2011-09-29 4:12 ` Alex Williamson
@ 2011-10-02 9:56 ` Michael S. Tsirkin
2011-10-03 17:02 ` Don Dutile
2 siblings, 1 reply; 5+ messages in thread
From: Michael S. Tsirkin @ 2011-10-02 9:56 UTC (permalink / raw)
To: Donald Dutile; +Cc: avi, mtosatti, kvm, chrisw
On Wed, Sep 28, 2011 at 08:20:33PM -0400, Donald Dutile wrote:
> commit f9c29774d2174df6ffc20becec20928948198914
> changed the PCIe Capability structure version check
> from if > 2 fail, to if ==1, size=x, if ==2, size=y,
> else fail.
> Turns out the 82599's VF has an errata where it's
> PCIe Cap struct version is 0, which now fails device assignment
> due to the else fallout, where before, it would blissfully work.
>
> Add a quirk if version=0, & intel-82599, set size to version 2 struct.
>
> Signed-off-by: Donald_Dutile <ddutile@redhat.com>
Makes sense.
Nit: please use PCI_VENDOR_ID_INTEL instead of 0x8086 below.
> ---
> hw/device-assignment.c | 12 ++++++++++--
> 1 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/hw/device-assignment.c b/hw/device-assignment.c
> index 288f80c..ed2a883 100644
> --- a/hw/device-assignment.c
> +++ b/hw/device-assignment.c
> @@ -1261,12 +1261,20 @@ 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;
> - uint16_t type, devctl, lnkcap, lnksta;
> + uint16_t type, devctl, lnkcap, lnksta, vendor, device;
> uint32_t devcap;
>
> + vendor = pci_get_word(pci_dev->config + PCI_VENDOR_ID);
> + device = pci_get_word(pci_dev->config + PCI_DEVICE_ID);
> version = pci_get_byte(pci_dev->config + pos + PCI_EXP_FLAGS);
> version &= PCI_EXP_FLAGS_VERS;
> - if (version == 1) {
> + if (version == 0 && vendor == 0x8086 && device == 0x10ed) {
I'd also make version == 0 last test in the list
to stress the fact this is a device specific quirk,
but that's a matter of taste ...
> + /*
> + * quirk for Intel 82599 VF with invalid PCIe capability version,
> + * should really be version 2 (same as PF)
> + */
> + size = 0x3c;
> + } else if (version == 1) {
> size = 0x14;
> } else if (version == 2) {
> /*
> --
> 1.7.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] qemu-kvm: device assignment: add 82599 PCIe Cap struct quirk
2011-10-02 9:56 ` Michael S. Tsirkin
@ 2011-10-03 17:02 ` Don Dutile
0 siblings, 0 replies; 5+ messages in thread
From: Don Dutile @ 2011-10-03 17:02 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: avi, mtosatti, kvm, chrisw
On 10/02/2011 05:56 AM, Michael S. Tsirkin wrote:
> On Wed, Sep 28, 2011 at 08:20:33PM -0400, Donald Dutile wrote:
>> commit f9c29774d2174df6ffc20becec20928948198914
>> changed the PCIe Capability structure version check
>> from if> 2 fail, to if ==1, size=x, if ==2, size=y,
>> else fail.
>> Turns out the 82599's VF has an errata where it's
>> PCIe Cap struct version is 0, which now fails device assignment
>> due to the else fallout, where before, it would blissfully work.
>>
>> Add a quirk if version=0,& intel-82599, set size to version 2 struct.
>>
>> Signed-off-by: Donald_Dutile<ddutile@redhat.com>
>
> Makes sense.
>
> Nit: please use PCI_VENDOR_ID_INTEL instead of 0x8086 below.
>
good idea.... read more below..
>> ---
>> hw/device-assignment.c | 12 ++++++++++--
>> 1 files changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/device-assignment.c b/hw/device-assignment.c
>> index 288f80c..ed2a883 100644
>> --- a/hw/device-assignment.c
>> +++ b/hw/device-assignment.c
>> @@ -1261,12 +1261,20 @@ 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;
>> - uint16_t type, devctl, lnkcap, lnksta;
>> + uint16_t type, devctl, lnkcap, lnksta, vendor, device;
>> uint32_t devcap;
>>
>> + vendor = pci_get_word(pci_dev->config + PCI_VENDOR_ID);
>> + device = pci_get_word(pci_dev->config + PCI_DEVICE_ID);
>> version = pci_get_byte(pci_dev->config + pos + PCI_EXP_FLAGS);
>> version&= PCI_EXP_FLAGS_VERS;
>> - if (version == 1) {
>> + if (version == 0&& vendor == 0x8086&& device == 0x10ed) {
>
> I'd also make version == 0 last test in the list
> to stress the fact this is a device specific quirk,
> but that's a matter of taste ...
>
given this is the odd case, yes, i agree.
will repost a new patch w/recommended changes.
pushed this up do to desire to fix sooner than later, but another day
won't matter given it's been this way for a couple months!
>> + /*
>> + * quirk for Intel 82599 VF with invalid PCIe capability version,
>> + * should really be version 2 (same as PF)
>> + */
>> + size = 0x3c;
>> + } else if (version == 1) {
>> size = 0x14;
>> } else if (version == 2) {
>> /*
>> --
>> 1.7.1
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-10-03 17:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-29 0:20 [PATCH] qemu-kvm: device assignment: add 82599 PCIe Cap struct quirk Donald Dutile
2011-09-29 0:23 ` Chris Wright
2011-09-29 4:12 ` Alex Williamson
2011-10-02 9:56 ` Michael S. Tsirkin
2011-10-03 17:02 ` Don Dutile
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).