Skip to contentSkip to conversation

PCI: Mark INTx masking support of Chelsio T310 10GbE NIC as broken

PATCH In review Jan Kiszka 5 participants 14 messages May 25, 2012 – Jun 18, 2012

Subsystems (2)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 PCI: Mark INTx masking support of Chelsio T310 10GbE NIC as broken

According to Alexey, the T310 does not properly support INTx masking as it fails to keep the PCI_STATUS_INTERRUPT bit updated once the interrupt is masked. Mark this adapter as broken so that pci_intx_mask_supported won't report it as compatible.

---

Alexey, please test if this catches your case correctly.

 drivers/pci/pci.c    |    3 +++
 drivers/pci/quirks.c |   12 ++++++++++++
 include/linux/pci.h  |    2 ++
 3 files changed, 17 insertions(+), 0 deletions(-)
drivers/pci/pci.c +3 -0
index 8f16900..3a1aeb5 100644
@@ -2876,6 +2876,9 @@ bool pci_intx_mask_supported(struct pci_dev *dev)
 	bool mask_supported = false;
 	u16 orig, new;
 
+	if (dev->broken_intx_masking)
+		return false;
+
 	pci_cfg_access_lock(dev);
 
 	pci_read_config_word(dev, PCI_COMMAND, &orig);
drivers/pci/quirks.c +12 -0
index 2a75216..151e174 100644
@@ -2929,6 +2929,18 @@ static void __devinit disable_igfx_irq(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq);
 
+/*
+ * Some devices may pass our check in pci_intx_mask_supported if
+ * PCI_COMMAND_INTX_DISABLE works though they actually do not properly
+ * support this feature.
+ */
+static void __devinit quirk_broken_intx_masking(struct pci_dev *dev)
+{
+	dev->broken_intx_masking = 1;
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x0010,
+			quirk_broken_intx_masking);
+
 static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
 			  struct pci_fixup *end)
 {
include/linux/pci.h +2 -0
index 17b7b5b..c7cfd73 100644
@@ -324,6 +324,8 @@ struct pci_dev {
 	unsigned int    is_hotplug_bridge:1;
 	unsigned int    __aer_firmware_first_valid:1;
 	unsigned int	__aer_firmware_first:1;
+	unsigned int	broken_intx_masking:1;	/* device's INTx masking
+						   support is not working */
 	pci_dev_flags_t dev_flags;
 	atomic_t	enable_cnt;	/* pci_enable_device has been called */
 
Signature · 1 line
1.7.3.4
maintainer
#1 lore raw
Quoted 4 lines · Jan Kiszka

According to Alexey, the T310 does not properly support INTx masking as it fails to keep the PCI_STATUS_INTERRUPT bit updated once the interrupt is masked. Mark this adapter as broken so that pci_intx_mask_supported won't report it as compatible.

Please include a reference to a bugzilla, mailing list discussion, or other details about how this was found and debugged. Thanks!

Quoted 63 lines

---

Alexey, please test if this catches your case correctly.

 drivers/pci/pci.c    |    3 +++
 drivers/pci/quirks.c |   12 ++++++++++++
 include/linux/pci.h  |    2 ++

 3 files changed, 17 insertions(+), 0 deletions(-)
drivers/pci/pci.c +3 -0
index 8f16900..3a1aeb5 100644
@@ -2876,6 +2876,9 @@ bool pci_intx_mask_supported(struct pci_dev *dev)
        bool mask_supported = false;
        u16 orig, new;
 
+       if (dev->broken_intx_masking)
+               return false;
+
        pci_cfg_access_lock(dev);
 
        pci_read_config_word(dev, PCI_COMMAND, &orig);
drivers/pci/quirks.c +12 -0
index 2a75216..151e174 100644
@@ -2929,6 +2929,18 @@ static void __devinit disable_igfx_irq(struct pci_dev *dev)
  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq);
  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq);
 
+/*
+ * Some devices may pass our check in pci_intx_mask_supported if
+ * PCI_COMMAND_INTX_DISABLE works though they actually do not properly
+ * support this feature.
+ */
+static void __devinit quirk_broken_intx_masking(struct pci_dev *dev)
+{
+       dev->broken_intx_masking = 1;
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x0010,
+                       quirk_broken_intx_masking);
+
  static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
                          struct pci_fixup *end)
  {
include/linux/pci.h +2 -0
index 17b7b5b..c7cfd73 100644
@@ -324,6 +324,8 @@ struct pci_dev {
        unsigned int    is_hotplug_bridge:1;
        unsigned int    __aer_firmware_first_valid:1;
        unsigned int    __aer_firmware_first:1;
+       unsigned int    broken_intx_masking:1;  /* device's INTx masking
+                                                  support is not working */
        pci_dev_flags_t dev_flags;

       atomic_t        enable_cnt;     /* pci_enable_device has been called */

--
1.7.3.4

author
#2 lore raw
Quoted 8 lines · Bjorn Helgaas
Quoted 4 lines · Jan Kiszka

According to Alexey, the T310 does not properly support INTx masking as it fails to keep the PCI_STATUS_INTERRUPT bit updated once the interrupt is masked. Mark this adapter as broken so that pci_intx_mask_supported won't report it as compatible.

Please include a reference to a bugzilla, mailing list discussion, or other details about how this was found and debugged. Thanks!

Sorry, it's documented here:
http://thread.gmane.org/gmane.comp.emulators.kvm.devel/91388. Will repost with this information included once Alexey provided his tested-by.

Jan

Quoted 64 lines
Quoted 64 lines

---

Alexey, please test if this catches your case correctly.

 drivers/pci/pci.c    |    3 +++
 drivers/pci/quirks.c |   12 ++++++++++++
 include/linux/pci.h  |    2 ++
 3 files changed, 17 insertions(+), 0 deletions(-)
drivers/pci/pci.c +3 -0
index 8f16900..3a1aeb5 100644
@@ -2876,6 +2876,9 @@ bool pci_intx_mask_supported(struct pci_dev *dev)
       bool mask_supported = false;
       u16 orig, new;
 
+       if (dev->broken_intx_masking)
+               return false;
+
       pci_cfg_access_lock(dev);
 
       pci_read_config_word(dev, PCI_COMMAND, &orig);
drivers/pci/quirks.c +12 -0
index 2a75216..151e174 100644
@@ -2929,6 +2929,18 @@ static void __devinit disable_igfx_irq(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq);
 
+/*
+ * Some devices may pass our check in pci_intx_mask_supported if
+ * PCI_COMMAND_INTX_DISABLE works though they actually do not properly
+ * support this feature.
+ */
+static void __devinit quirk_broken_intx_masking(struct pci_dev *dev)
+{
+       dev->broken_intx_masking = 1;
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x0010,
+                       quirk_broken_intx_masking);
+
 static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
                         struct pci_fixup *end)
 {
include/linux/pci.h +2 -1
index 17b7b5b..c7cfd73 100644
@@ -324,6 +324,8 @@ struct pci_dev {
       unsigned int    is_hotplug_bridge:1;
       unsigned int    __aer_firmware_first_valid:1;
       unsigned int    __aer_firmware_first:1;
+       unsigned int    broken_intx_masking:1;  /* device's INTx masking
+                                                  support is not working */
       pci_dev_flags_t dev_flags;
       atomic_t        enable_cnt;     /* pci_enable_device has been called */
 
--

1.7.3.4

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#3 lore raw
In reply to Jan Kiszka
Quoted 7 lines · Jan Kiszka

According to Alexey, the T310 does not properly support INTx masking as it fails to keep the PCI_STATUS_INTERRUPT bit updated once the interrupt is masked. Mark this adapter as broken so that pci_intx_mask_supported won't report it as compatible.

Just a thought: would be nice to have a way to discover the quirk was activated. Add an attribute so that userspace can detect and report this properly to users? Or just log a warning message ...

Quoted 66 lines

---

Alexey, please test if this catches your case correctly.

 drivers/pci/pci.c    |    3 +++
 drivers/pci/quirks.c |   12 ++++++++++++
 include/linux/pci.h  |    2 ++
 3 files changed, 17 insertions(+), 0 deletions(-)
drivers/pci/pci.c +3 -0
index 8f16900..3a1aeb5 100644
@@ -2876,6 +2876,9 @@ bool pci_intx_mask_supported(struct pci_dev *dev)
 	bool mask_supported = false;
 	u16 orig, new;
 
+	if (dev->broken_intx_masking)
+		return false;
+
 	pci_cfg_access_lock(dev);
 
 	pci_read_config_word(dev, PCI_COMMAND, &orig);
drivers/pci/quirks.c +12 -0
index 2a75216..151e174 100644
@@ -2929,6 +2929,18 @@ static void __devinit disable_igfx_irq(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq);
 
+/*
+ * Some devices may pass our check in pci_intx_mask_supported if
+ * PCI_COMMAND_INTX_DISABLE works though they actually do not properly
+ * support this feature.
+ */
+static void __devinit quirk_broken_intx_masking(struct pci_dev *dev)
+{
+	dev->broken_intx_masking = 1;
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x0010,
+			quirk_broken_intx_masking);
+
 static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
 			  struct pci_fixup *end)
 {
include/linux/pci.h +2 -0
index 17b7b5b..c7cfd73 100644
@@ -324,6 +324,8 @@ struct pci_dev {
 	unsigned int    is_hotplug_bridge:1;
 	unsigned int    __aer_firmware_first_valid:1;
 	unsigned int	__aer_firmware_first:1;
+	unsigned int	broken_intx_masking:1;	/* device's INTx masking
+						   support is not working */
 	pci_dev_flags_t dev_flags;
 	atomic_t	enable_cnt;	/* pci_enable_device has been called */
 
Signature · 6 lines
1.7.3.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
#4 lore raw
Quoted 6 lines · Michael S. Tsirkin
Quoted 5 lines · Jan Kiszka

According to Alexey, the T310 does not properly support INTx masking as it fails to keep the PCI_STATUS_INTERRUPT bit updated once the interrupt is masked. Mark this adapter as broken so that pci_intx_mask_supported won't report it as compatible.

Quoted 8 lines
Quoted 2 lines

Just a thought: would be nice to have a way to discover the quirk was activated. Add an attribute so that userspace can detect and report this properly to users? Or just log a warning message ...

pr_notice_once? A flag for userspace would be significantly more complicated (and not PCI layer hands).

Jan

#5 lore raw
Quoted 11 lines · Jan Kiszka
Quoted 10 lines · Michael S. Tsirkin
Quoted 7 lines · Jan Kiszka

According to Alexey, the T310 does not properly support INTx masking as it fails to keep the PCI_STATUS_INTERRUPT bit updated once the interrupt is masked. Mark this adapter as broken so that pci_intx_mask_supported won't report it as compatible.

Quoted 6 lines
Quoted 4 lines

Just a thought: would be nice to have a way to discover the quirk was activated. Add an attribute so that userspace can detect and report this properly to users? Or just log a warning message ...

pr_notice_once?

OK IMO.

Quoted 2 lines

A flag for userspace would be significantly more
complicated (and not PCI layer hands).

Why not? I meant e.g. an attribute in pci-sysfs.

Quoted 2 lines

Jan

#6 lore raw
Quoted 17 lines · Michael S. Tsirkin
Quoted 16 lines · Jan Kiszka
Quoted 14 lines · Michael S. Tsirkin
Quoted 7 lines · Jan Kiszka

According to Alexey, the T310 does not properly support INTx masking as it fails to keep the PCI_STATUS_INTERRUPT bit updated once the interrupt is masked. Mark this adapter as broken so that pci_intx_mask_supported won't report it as compatible.

Just a thought: would be nice to have a way to discover the quirk was activated. Add an attribute so that userspace can detect and report this properly to users? Or just log a warning message ...

Quoted 8 lines
Quoted 1 line

pr_notice_once?

OK IMO.

Quoted 2 lines

A flag for userspace would be significantly more
complicated (and not PCI layer hands).

Why not? I meant e.g. an attribute in pci-sysfs.

Possible. But what is the preferred way of doing this? Are there any precedences?

Jan

#7 lore raw
Quoted 25 lines · Jan Kiszka
Quoted 24 lines · Michael S. Tsirkin
Quoted 11 lines · Jan Kiszka
Quoted 10 lines · Michael S. Tsirkin
Quoted 7 lines · Jan Kiszka

According to Alexey, the T310 does not properly support INTx masking as it fails to keep the PCI_STATUS_INTERRUPT bit updated once the interrupt is masked. Mark this adapter as broken so that pci_intx_mask_supported won't report it as compatible.

Quoted 6 lines
Quoted 4 lines

Just a thought: would be nice to have a way to discover the quirk was activated. Add an attribute so that userspace can detect and report this properly to users? Or just log a warning message ...

pr_notice_once?

OK IMO.

Quoted 2 lines

A flag for userspace would be significantly more
complicated (and not PCI layer hands).

Quoted 7 lines
Quoted 1 line

Why not? I meant e.g. an attribute in pci-sysfs.

Possible. But what is the preferred way of doing this? Are there any precedences?

Jan

E.g. a reset attribute is there only if device reset is supported. I don't insist on this - merely asking how does userspace report an attempt to share IRQs and whether the reason is discoverable in some way.

Signature · 1 line
MST
author
#8 lore raw
Quoted 31 lines · Michael S. Tsirkin
Quoted 30 lines · Jan Kiszka
Quoted 17 lines · Michael S. Tsirkin
Quoted 16 lines · Jan Kiszka
Quoted 14 lines · Michael S. Tsirkin
Quoted 7 lines · Jan Kiszka

According to Alexey, the T310 does not properly support INTx masking as it fails to keep the PCI_STATUS_INTERRUPT bit updated once the interrupt is masked. Mark this adapter as broken so that pci_intx_mask_supported won't report it as compatible.

Just a thought: would be nice to have a way to discover the quirk was activated. Add an attribute so that userspace can detect and report this properly to users? Or just log a warning message ...

Quoted 8 lines
Quoted 1 line

pr_notice_once?

OK IMO.

Quoted 2 lines

A flag for userspace would be significantly more
complicated (and not PCI layer hands).

Why not? I meant e.g. an attribute in pci-sysfs.

Possible. But what is the preferred way of doing this? Are there any precedences?

Quoted 7 lines
Quoted 2 lines

Jan

E.g. a reset attribute is there only if device reset is supported. I don't insist on this - merely asking how does userspace report an attempt to share IRQs and whether the reason is discoverable in some way.

Well, so far there is no attribute associated with INTx masking that we could hide to express this.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#9 lore raw
Quoted 40 lines · Jan Kiszka
Quoted 31 lines · Michael S. Tsirkin
Quoted 30 lines · Jan Kiszka
Quoted 17 lines · Michael S. Tsirkin
Quoted 16 lines · Jan Kiszka
Quoted 14 lines · Michael S. Tsirkin
Quoted 7 lines · Jan Kiszka

According to Alexey, the T310 does not properly support INTx masking as it fails to keep the PCI_STATUS_INTERRUPT bit updated once the interrupt is masked. Mark this adapter as broken so that pci_intx_mask_supported won't report it as compatible.

Just a thought: would be nice to have a way to discover the quirk was activated. Add an attribute so that userspace can detect and report this properly to users? Or just log a warning message ...

Quoted 8 lines
Quoted 1 line

pr_notice_once?

OK IMO.

Quoted 2 lines

A flag for userspace would be significantly more
complicated (and not PCI layer hands).

Why not? I meant e.g. an attribute in pci-sysfs.

Possible. But what is the preferred way of doing this? Are there any precedences?

Quoted 7 lines
Quoted 2 lines

Jan

E.g. a reset attribute is there only if device reset is supported. I don't insist on this - merely asking how does userspace report an attempt to share IRQs and whether the reason is discoverable in some way.

Quoted 4 lines

Well, so far there is no attribute associated with INTx masking that we could hide to express this.

Jan

Thinking about it some more, userspace using this functionality is pretty recent. So if we just teach it to report 'intx mask or status bit unsupported' on failure, plus add pr_notice as you suggested, then that's probably enough.

Quoted 3 lines
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
author
#10 lore raw
In reply to Jan Kiszka
Quoted 10 lines · Jan Kiszka

According to Alexey, the T310 does not properly support INTx masking as it fails to keep the PCI_STATUS_INTERRUPT bit updated once the interrupt is masked. Mark this adapter as broken so that pci_intx_mask_supported won't report it as compatible.

---

Alexey, please test if this catches your case correctly.

Alexey? Ping for testing.

Jan

Quoted 56 lines
 drivers/pci/pci.c    |    3 +++
 drivers/pci/quirks.c |   12 ++++++++++++
 include/linux/pci.h  |    2 ++
 3 files changed, 17 insertions(+), 0 deletions(-)
drivers/pci/pci.c +3 -0
index 8f16900..3a1aeb5 100644
@@ -2876,6 +2876,9 @@ bool pci_intx_mask_supported(struct pci_dev *dev)
 	bool mask_supported = false;
 	u16 orig, new;
 
+	if (dev->broken_intx_masking)
+		return false;
+
 	pci_cfg_access_lock(dev);
 
 	pci_read_config_word(dev, PCI_COMMAND, &orig);
drivers/pci/quirks.c +12 -0
index 2a75216..151e174 100644
@@ -2929,6 +2929,18 @@ static void __devinit disable_igfx_irq(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq);
 
+/*
+ * Some devices may pass our check in pci_intx_mask_supported if
+ * PCI_COMMAND_INTX_DISABLE works though they actually do not properly
+ * support this feature.
+ */
+static void __devinit quirk_broken_intx_masking(struct pci_dev *dev)
+{
+	dev->broken_intx_masking = 1;
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x0010,
+			quirk_broken_intx_masking);
+
 static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
 			  struct pci_fixup *end)
 {
include/linux/pci.h +2 -0
index 17b7b5b..c7cfd73 100644
@@ -324,6 +324,8 @@ struct pci_dev {
 	unsigned int    is_hotplug_bridge:1;
 	unsigned int    __aer_firmware_first_valid:1;
 	unsigned int	__aer_firmware_first:1;
+	unsigned int	broken_intx_masking:1;	/* device's INTx masking
+						   support is not working */
 	pci_dev_flags_t dev_flags;
 	atomic_t	enable_cnt;	/* pci_enable_device has been called */
 
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#11 lore raw
Quoted 6 lines · Jan Kiszka
Quoted 5 lines · Jan Kiszka

According to Alexey, the T310 does not properly support INTx masking as it fails to keep the PCI_STATUS_INTERRUPT bit updated once the interrupt is masked. Mark this adapter as broken so that pci_intx_mask_supported won't report it as compatible.

Quoted 7 lines
Quoted 5 lines

---

Alexey, please test if this catches your case correctly.

Alexey? Ping for testing.

Sorry, was in vacation and then a bit busy.
Yes, that works, thanks. It just a device ID is wrong, should be 0x0030 rather than 0x0010 in your patch - may be 0x10 is broken too, I do not know, mine is 0x30 :)

Here:

Quoted 66 lines

drivers/pci/quirks.c static void __devinit disable_igfx_irq(struct pci_dev *dev) · line 2942

Quoted 2 lines
drivers/pci/quirks.c +2 -0
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x0010,
+			quirk_broken_intx_masking);

Jan

Quoted 56 lines
 drivers/pci/pci.c    |    3 +++
 drivers/pci/quirks.c |   12 ++++++++++++
 include/linux/pci.h  |    2 ++
 3 files changed, 17 insertions(+), 0 deletions(-)
drivers/pci/pci.c +3 -0
index 8f16900..3a1aeb5 100644
@@ -2876,6 +2876,9 @@ bool pci_intx_mask_supported(struct pci_dev *dev)
 	bool mask_supported = false;
 	u16 orig, new;
 
+	if (dev->broken_intx_masking)
+		return false;
+
 	pci_cfg_access_lock(dev);
 
 	pci_read_config_word(dev, PCI_COMMAND, &orig);
drivers/pci/quirks.c +12 -0
index 2a75216..151e174 100644
@@ -2929,6 +2929,18 @@ static void __devinit disable_igfx_irq(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq);
 
+/*
+ * Some devices may pass our check in pci_intx_mask_supported if
+ * PCI_COMMAND_INTX_DISABLE works though they actually do not properly
+ * support this feature.
+ */
+static void __devinit quirk_broken_intx_masking(struct pci_dev *dev)
+{
+	dev->broken_intx_masking = 1;
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x0010,
+			quirk_broken_intx_masking);
+
 static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
 			  struct pci_fixup *end)
 {
include/linux/pci.h +2 -0
index 17b7b5b..c7cfd73 100644
@@ -324,6 +324,8 @@ struct pci_dev {
 	unsigned int    is_hotplug_bridge:1;
 	unsigned int    __aer_firmware_first_valid:1;
 	unsigned int	__aer_firmware_first:1;
+	unsigned int	broken_intx_masking:1;	/* device's INTx masking
+						   support is not working */
 	pci_dev_flags_t dev_flags;
 	atomic_t	enable_cnt;	/* pci_enable_device has been called */
 
Signature · 1 line
Alexey
#12 lore raw

PATCH v2 1/1 PCI: Mark INTx masking support of Chelsio T310 10GbE NIC as broken

From: Jan Kiszka <[email protected]>

According to

http://thread.gmane.org/gmane.comp.emulators.kvm.devel/91388

the T310 does not properly support INTx masking as it fails to keep the PCI_STATUS_INTERRUPT bit updated once the interrupt is masked. Mark this adapter as broken so that pci_intx_mask_supported won't report it as compatible.

---

Changes in v2:
- Fixed device ID to Alexey's report
- Added reference to the original report

 drivers/pci/pci.c    |    3 +++
 drivers/pci/quirks.c |   12 ++++++++++++
 include/linux/pci.h  |    2 ++
 3 files changed, 17 insertions(+), 0 deletions(-)
drivers/pci/pci.c +3 -0
index 447e834..9ae517a 100644
@@ -2876,6 +2876,9 @@ bool pci_intx_mask_supported(struct pci_dev *dev)
 	bool mask_supported = false;
 	u16 orig, new;
 
+	if (dev->broken_intx_masking)
+		return false;
+
 	pci_cfg_access_lock(dev);
 
 	pci_read_config_word(dev, PCI_COMMAND, &orig);
drivers/pci/quirks.c +12 -0
index 2a75216..28804f4 100644
@@ -2929,6 +2929,18 @@ static void __devinit disable_igfx_irq(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq);
 
+/*
+ * Some devices may pass our check in pci_intx_mask_supported if
+ * PCI_COMMAND_INTX_DISABLE works though they actually do not properly
+ * support this feature.
+ */
+static void __devinit quirk_broken_intx_masking(struct pci_dev *dev)
+{
+	dev->broken_intx_masking = 1;
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x0030,
+			quirk_broken_intx_masking);
+
 static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
 			  struct pci_fixup *end)
 {
include/linux/pci.h +2 -0
index d8c379d..7ea6cf8 100644
@@ -324,6 +324,8 @@ struct pci_dev {
 	unsigned int    is_hotplug_bridge:1;
 	unsigned int    __aer_firmware_first_valid:1;
 	unsigned int	__aer_firmware_first:1;
+	unsigned int	broken_intx_masking:1;	/* device's INTx masking
+						   support is not working */
 	pci_dev_flags_t dev_flags;
 	atomic_t	enable_cnt;	/* pci_enable_device has been called */
 
Signature · 1 line
1.7.3.4
maintainer
#13 lore raw
Quoted 74 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

According to

http://thread.gmane.org/gmane.comp.emulators.kvm.devel/91388

the T310 does not properly support INTx masking as it fails to keep the PCI_STATUS_INTERRUPT bit updated once the interrupt is masked. Mark this adapter as broken so that pci_intx_mask_supported won't report it as compatible.

---

Changes in v2:
 - Fixed device ID to Alexey's report
 - Added reference to the original report

 drivers/pci/pci.c    |    3 +++
 drivers/pci/quirks.c |   12 ++++++++++++
 include/linux/pci.h  |    2 ++

 3 files changed, 17 insertions(+), 0 deletions(-)
drivers/pci/pci.c +3 -0
index 447e834..9ae517a 100644
@@ -2876,6 +2876,9 @@ bool pci_intx_mask_supported(struct pci_dev *dev)
        bool mask_supported = false;
        u16 orig, new;
 
+       if (dev->broken_intx_masking)
+               return false;
+
        pci_cfg_access_lock(dev);
 
        pci_read_config_word(dev, PCI_COMMAND, &orig);
drivers/pci/quirks.c +12 -0
index 2a75216..28804f4 100644
@@ -2929,6 +2929,18 @@ static void __devinit disable_igfx_irq(struct pci_dev *dev)
  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq);
  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq);
 
+/*
+ * Some devices may pass our check in pci_intx_mask_supported if
+ * PCI_COMMAND_INTX_DISABLE works though they actually do not properly
+ * support this feature.
+ */
+static void __devinit quirk_broken_intx_masking(struct pci_dev *dev)
+{
+       dev->broken_intx_masking = 1;
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CHELSIO, 0x0030,
+                       quirk_broken_intx_masking);
+
  static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
                          struct pci_fixup *end)
  {
include/linux/pci.h +2 -0
index d8c379d..7ea6cf8 100644
@@ -324,6 +324,8 @@ struct pci_dev {
        unsigned int    is_hotplug_bridge:1;
        unsigned int    __aer_firmware_first_valid:1;
        unsigned int    __aer_firmware_first:1;
+       unsigned int    broken_intx_masking:1;  /* device's INTx masking
+                                                  support is not working */
        pci_dev_flags_t dev_flags;

       atomic_t        enable_cnt;     /* pci_enable_device has been called */

Quoted 2 lines

--
1.7.3.4

I applied this to my "next" branch with minor tweaks (split the infrastructure part from the device-specific quirk, and changed from a FINAL quirk to a HEADER quirk because FINAL quirks currently aren't called for hot-added devices). Let me know if you see anything wrong.

Thanks!

Bjorn