Skip to contentSkip to conversation

PCI: Disable parity checking if broken_parity is set

PATCH In review Heiner Kallweit 3 participants 9 messages Jan 6, 2021 – Jan 14, 2021

Subsystems (6)
lore
Share & tools
lore

Heiner Kallweit

author maintainer
#0 lore raw

v3 cover PCI: Disable parity checking if broken_parity is set

If we know that a device has broken parity checking, then disable it. This avoids quirks like in r8169 where on the first parity error interrupt parity checking will be disabled if broken_parity_status is set. Make pci_quirk_broken_parity() public so that it can be used by platform code, e.g. for Thecus N2100.

v2:
- reduce scope of N2100 change to using the new PCI core quirk v3:
- improve commit message of patch 2

Heiner Kallweit (3):
PCI: Disable parity checking if broken_parity_status is set
ARM: iop32x: improve N2100 PCI broken parity quirk
r8169: simplify broken parity handling now that PCI core takes care

 arch/arm/mach-iop32x/n2100.c              |  2 +-
 drivers/net/ethernet/realtek/r8169_main.c | 14 --------------
 drivers/pci/quirks.c                      | 17 +++++++++++------
 include/linux/pci.h                       |  2 ++
 4 files changed, 14 insertions(+), 21 deletions(-)
Signature · 1 line
2.30.0
author maintainer
#1 lore raw

PATCH v3 1/3 PCI: Disable parity checking if broken_parity is set

If we know that a device has broken parity checking, then disable it. This avoids quirks like in r8169 where on the first parity error interrupt parity checking will be disabled if broken_parity_status is set. Make pci_quirk_broken_parity() public so that it can be used by platform code, e.g. for Thecus N2100.

---
 drivers/pci/quirks.c | 17 +++++++++++------
 include/linux/pci.h  |  2 ++
 2 files changed, 13 insertions(+), 6 deletions(-)
drivers/pci/quirks.c +11 -6
index 653660e3b..ab54e26b8 100644
@@ -205,17 +205,22 @@ static void quirk_mmio_always_on(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_ANY_ID, PCI_ANY_ID,
 				PCI_CLASS_BRIDGE_HOST, 8, quirk_mmio_always_on);
 
+void pci_quirk_broken_parity(struct pci_dev *dev)
+{
+	u16 cmd;
+
+	dev->broken_parity_status = 1;	/* This device gives false positives */
+	pci_read_config_word(dev, PCI_COMMAND, &cmd);
+	pci_write_config_word(dev, PCI_COMMAND, cmd & ~PCI_COMMAND_PARITY);
+}
+
 /*
  * The Mellanox Tavor device gives false positive parity errors.  Mark this
  * device with a broken_parity_status to allow PCI scanning code to "skip"
  * this now blacklisted device.
  */
-static void quirk_mellanox_tavor(struct pci_dev *dev)
-{
-	dev->broken_parity_status = 1;	/* This device gives false positives */
-}
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR, quirk_mellanox_tavor);
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE, quirk_mellanox_tavor);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR, pci_quirk_broken_parity);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE, pci_quirk_broken_parity);
 
 /*
  * Deal with broken BIOSes that neglect to enable passive release,
include/linux/pci.h +2 -0
index b32126d26..161dcc474 100644
@@ -1916,6 +1916,8 @@ enum pci_fixup_pass {
 	pci_fixup_suspend_late,	/* pci_device_suspend_late() */
 };
 
+void pci_quirk_broken_parity(struct pci_dev *dev);
+
 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
 #define __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class,	\
 				    class_shift, hook)			\
Signature · 1 line
2.30.0
Acked-by on v3 1/3
#2 lore raw
Quoted 8 lines · Heiner Kallweit

If we know that a device has broken parity checking, then disable it. This avoids quirks like in r8169 where on the first parity error interrupt parity checking will be disabled if broken_parity_status is set. Make pci_quirk_broken_parity() public so that it can be used by platform code, e.g. for Thecus N2100.

This series should all go together. Let me know if you want me to do anything more (would require acks for arm and r8169, of course).

Quoted 56 lines
---
 drivers/pci/quirks.c | 17 +++++++++++------
 include/linux/pci.h  |  2 ++
 2 files changed, 13 insertions(+), 6 deletions(-)
drivers/pci/quirks.c +11 -6
index 653660e3b..ab54e26b8 100644
@@ -205,17 +205,22 @@ static void quirk_mmio_always_on(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_ANY_ID, PCI_ANY_ID,
 				PCI_CLASS_BRIDGE_HOST, 8, quirk_mmio_always_on);
 
+void pci_quirk_broken_parity(struct pci_dev *dev)
+{
+	u16 cmd;
+
+	dev->broken_parity_status = 1;	/* This device gives false positives */
+	pci_read_config_word(dev, PCI_COMMAND, &cmd);
+	pci_write_config_word(dev, PCI_COMMAND, cmd & ~PCI_COMMAND_PARITY);
+}
+
 /*
  * The Mellanox Tavor device gives false positive parity errors.  Mark this
  * device with a broken_parity_status to allow PCI scanning code to "skip"
  * this now blacklisted device.
  */
-static void quirk_mellanox_tavor(struct pci_dev *dev)
-{
-	dev->broken_parity_status = 1;	/* This device gives false positives */
-}
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR, quirk_mellanox_tavor);
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE, quirk_mellanox_tavor);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR, pci_quirk_broken_parity);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE, pci_quirk_broken_parity);
 
 /*
  * Deal with broken BIOSes that neglect to enable passive release,
include/linux/pci.h +2 -0
index b32126d26..161dcc474 100644
@@ -1916,6 +1916,8 @@ enum pci_fixup_pass {
 	pci_fixup_suspend_late,	/* pci_device_suspend_late() */
 };
 
+void pci_quirk_broken_parity(struct pci_dev *dev);
+
 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
 #define __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class,	\
 				    class_shift, hook)			\
Signature · 1 line
2.30.0
author maintainer
#3 lore raw
Quoted 7 lines · Bjorn Helgaas
Quoted 6 lines · Heiner Kallweit

If we know that a device has broken parity checking, then disable it. This avoids quirks like in r8169 where on the first parity error interrupt parity checking will be disabled if broken_parity_status is set. Make pci_quirk_broken_parity() public so that it can be used by platform code, e.g. for Thecus N2100.

Quoted 8 lines
Quoted 2 lines

This series should all go together. Let me know if you want me to do anything more (would require acks for arm and r8169, of course).

Right. For r8169 I'm the maintainer myself and agreed with Jakub that the r8169 patch will go through the PCI tree.

Regarding the arm/iop32x part:
MAINTAINERS file lists Lennert as maintainer, let me add him. Strange thing is that the MAINTAINERS entry for arm/iop32x has no F entry, therefore the get_maintainers scripts will never list him as addressee. The script lists Russell as "odd fixer". @Lennert: Please provide a patch to add the missing F entry.

ARM/INTEL IOP32X ARM ARCHITECTURE
M: Lennert Buytenhek <[email protected]>
L: [email protected] (moderated for non-subscribers)
S: Maintained

Quoted 56 lines
Quoted 56 lines
---
 drivers/pci/quirks.c | 17 +++++++++++------
 include/linux/pci.h  |  2 ++
 2 files changed, 13 insertions(+), 6 deletions(-)
drivers/pci/quirks.c +11 -6
index 653660e3b..ab54e26b8 100644
@@ -205,17 +205,22 @@ static void quirk_mmio_always_on(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_ANY_ID, PCI_ANY_ID,
 				PCI_CLASS_BRIDGE_HOST, 8, quirk_mmio_always_on);
 
+void pci_quirk_broken_parity(struct pci_dev *dev)
+{
+	u16 cmd;
+
+	dev->broken_parity_status = 1;	/* This device gives false positives */
+	pci_read_config_word(dev, PCI_COMMAND, &cmd);
+	pci_write_config_word(dev, PCI_COMMAND, cmd & ~PCI_COMMAND_PARITY);
+}
+
 /*
  * The Mellanox Tavor device gives false positive parity errors.  Mark this
  * device with a broken_parity_status to allow PCI scanning code to "skip"
  * this now blacklisted device.
  */
-static void quirk_mellanox_tavor(struct pci_dev *dev)
-{
-	dev->broken_parity_status = 1;	/* This device gives false positives */
-}
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR, quirk_mellanox_tavor);
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE, quirk_mellanox_tavor);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR, pci_quirk_broken_parity);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE, pci_quirk_broken_parity);
 
 /*
  * Deal with broken BIOSes that neglect to enable passive release,
include/linux/pci.h +2 -0
index b32126d26..161dcc474 100644
@@ -1916,6 +1916,8 @@ enum pci_fixup_pass {
 	pci_fixup_suspend_late,	/* pci_device_suspend_late() */
 };
 
+void pci_quirk_broken_parity(struct pci_dev *dev);
+
 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
 #define __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class,	\
 				    class_shift, hook)			\
Signature · 1 line
2.30.0
author maintainer
#4 lore raw
Quoted 26 lines · Heiner Kallweit
Quoted 7 lines · Bjorn Helgaas
Quoted 6 lines · Heiner Kallweit

If we know that a device has broken parity checking, then disable it. This avoids quirks like in r8169 where on the first parity error interrupt parity checking will be disabled if broken_parity_status is set. Make pci_quirk_broken_parity() public so that it can be used by platform code, e.g. for Thecus N2100.

Quoted 8 lines
Quoted 2 lines

This series should all go together. Let me know if you want me to do anything more (would require acks for arm and r8169, of course).

Right. For r8169 I'm the maintainer myself and agreed with Jakub that the r8169 patch will go through the PCI tree.

Regarding the arm/iop32x part:
MAINTAINERS file lists Lennert as maintainer, let me add him. Strange thing is that the MAINTAINERS entry for arm/iop32x has no F entry, therefore the get_maintainers scripts will never list him as addressee. The script lists Russell as "odd fixer". @Lennert: Please provide a patch to add the missing F entry.

Quoted 5 lines

ARM/INTEL IOP32X ARM ARCHITECTURE
M: Lennert Buytenhek <[email protected]>
L: [email protected] (moderated for non-subscribers)
S: Maintained

Bjorn, I saw that you set the series to "not applicable". Is this because of the missing ack for the arm part?
I checked and Lennert's last kernel contribution is from 2015. Having said that the maintainer's entry may be outdated. Not sure who else would be entitled to ack this patch. The change is simple enough, could you take it w/o an ack?
Alternatively, IIRC Russell has got such a device. Russell, would it be possible that you test that there's still no false-positive parity errors with this series?

Quoted 47 lines
Quoted 47 lines
Quoted 47 lines
---
 drivers/pci/quirks.c | 17 +++++++++++------
 include/linux/pci.h  |  2 ++
 2 files changed, 13 insertions(+), 6 deletions(-)
drivers/pci/quirks.c +11 -6
index 653660e3b..ab54e26b8 100644
@@ -205,17 +205,22 @@ static void quirk_mmio_always_on(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_ANY_ID, PCI_ANY_ID,
 				PCI_CLASS_BRIDGE_HOST, 8, quirk_mmio_always_on);
 
+void pci_quirk_broken_parity(struct pci_dev *dev)
+{
+	u16 cmd;
+
+	dev->broken_parity_status = 1;	/* This device gives false positives */
+	pci_read_config_word(dev, PCI_COMMAND, &cmd);
+	pci_write_config_word(dev, PCI_COMMAND, cmd & ~PCI_COMMAND_PARITY);
+}
+
 /*
  * The Mellanox Tavor device gives false positive parity errors.  Mark this
  * device with a broken_parity_status to allow PCI scanning code to "skip"
  * this now blacklisted device.
  */
-static void quirk_mellanox_tavor(struct pci_dev *dev)
-{
-	dev->broken_parity_status = 1;	/* This device gives false positives */
-}
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR, quirk_mellanox_tavor);
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE, quirk_mellanox_tavor);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR, pci_quirk_broken_parity);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE, pci_quirk_broken_parity);
 
 /*
  * Deal with broken BIOSes that neglect to enable passive release,
include/linux/pci.h +0 -0
index b32126d26..161dcc474 100644
@@ -1916,6 +1916,8 @@ enum pci_fixup_pass {
 	pci_fixup_suspend_late,	/* pci_device_suspend_late() */
 };
 
Quoted 11 lines
Quoted 10 lines
Quoted 10 lines
include/linux/pci.h +2 -0
+void pci_quirk_broken_parity(struct pci_dev *dev);
+
 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
 #define __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class,	\
 				    class_shift, hook)			\
Signature · 1 line
2.30.0

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#5 lore raw
Quoted 27 lines · Heiner Kallweit
Quoted 26 lines · Heiner Kallweit
Quoted 7 lines · Bjorn Helgaas
Quoted 6 lines · Heiner Kallweit

If we know that a device has broken parity checking, then disable it. This avoids quirks like in r8169 where on the first parity error interrupt parity checking will be disabled if broken_parity_status is set. Make pci_quirk_broken_parity() public so that it can be used by platform code, e.g. for Thecus N2100.

Quoted 8 lines
Quoted 2 lines

This series should all go together. Let me know if you want me to do anything more (would require acks for arm and r8169, of course).

Right. For r8169 I'm the maintainer myself and agreed with Jakub that the r8169 patch will go through the PCI tree.

Regarding the arm/iop32x part:
MAINTAINERS file lists Lennert as maintainer, let me add him. Strange thing is that the MAINTAINERS entry for arm/iop32x has no F entry, therefore the get_maintainers scripts will never list him as addressee. The script lists Russell as "odd fixer". @Lennert: Please provide a patch to add the missing F entry.

Quoted 7 lines
Quoted 4 lines

ARM/INTEL IOP32X ARM ARCHITECTURE
M: Lennert Buytenhek <[email protected]>
L: [email protected] (moderated for non-subscribers)
S: Maintained

Bjorn, I saw that you set the series to "not applicable". Is this because of the missing ack for the arm part?

No, it's because I screwed up. I use "not applicable" when I expect patches to go via another tree. I just missed your note about merging via the PCI tree. I'll take a look soon.

Quoted 68 lines

I checked and Lennert's last kernel contribution is from 2015. Having said that the maintainer's entry may be outdated. Not sure who else would be entitled to ack this patch. The change is simple enough, could you take it w/o an ack?
Alternatively, IIRC Russell has got such a device. Russell, would it be possible that you test that there's still no false-positive parity errors with this series?

Quoted 58 lines
Quoted 57 lines
Quoted 57 lines
---
 drivers/pci/quirks.c | 17 +++++++++++------
 include/linux/pci.h  |  2 ++
 2 files changed, 13 insertions(+), 6 deletions(-)
drivers/pci/quirks.c +11 -6
index 653660e3b..ab54e26b8 100644
@@ -205,17 +205,22 @@ static void quirk_mmio_always_on(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_ANY_ID, PCI_ANY_ID,
 				PCI_CLASS_BRIDGE_HOST, 8, quirk_mmio_always_on);
 
+void pci_quirk_broken_parity(struct pci_dev *dev)
+{
+	u16 cmd;
+
+	dev->broken_parity_status = 1;	/* This device gives false positives */
+	pci_read_config_word(dev, PCI_COMMAND, &cmd);
+	pci_write_config_word(dev, PCI_COMMAND, cmd & ~PCI_COMMAND_PARITY);
+}
+
 /*
  * The Mellanox Tavor device gives false positive parity errors.  Mark this
  * device with a broken_parity_status to allow PCI scanning code to "skip"
  * this now blacklisted device.
  */
-static void quirk_mellanox_tavor(struct pci_dev *dev)
-{
-	dev->broken_parity_status = 1;	/* This device gives false positives */
-}
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR, quirk_mellanox_tavor);
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE, quirk_mellanox_tavor);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR, pci_quirk_broken_parity);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE, pci_quirk_broken_parity);
 
 /*
  * Deal with broken BIOSes that neglect to enable passive release,
include/linux/pci.h +2 -0
index b32126d26..161dcc474 100644
@@ -1916,6 +1916,8 @@ enum pci_fixup_pass {
 	pci_fixup_suspend_late,	/* pci_device_suspend_late() */
 };
 
+void pci_quirk_broken_parity(struct pci_dev *dev);
+
 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
 #define __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class,	\
 				    class_shift, hook)			\
Signature · 1 line
2.30.0

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#6 lore raw
In reply to Heiner Kallweit
Quoted 32 lines · Heiner Kallweit
Quoted 26 lines · Heiner Kallweit
Quoted 7 lines · Bjorn Helgaas
Quoted 6 lines · Heiner Kallweit

If we know that a device has broken parity checking, then disable it. This avoids quirks like in r8169 where on the first parity error interrupt parity checking will be disabled if broken_parity_status is set. Make pci_quirk_broken_parity() public so that it can be used by platform code, e.g. for Thecus N2100.

Quoted 8 lines
Quoted 2 lines

This series should all go together. Let me know if you want me to do anything more (would require acks for arm and r8169, of course).

Right. For r8169 I'm the maintainer myself and agreed with Jakub that the r8169 patch will go through the PCI tree.

Regarding the arm/iop32x part:
MAINTAINERS file lists Lennert as maintainer, let me add him. Strange thing is that the MAINTAINERS entry for arm/iop32x has no F entry, therefore the get_maintainers scripts will never list him as addressee. The script lists Russell as "odd fixer". @Lennert: Please provide a patch to add the missing F entry.

Quoted 4 lines

ARM/INTEL IOP32X ARM ARCHITECTURE
M: Lennert Buytenhek <[email protected]>
L: [email protected] (moderated for non-subscribers)
S: Maintained

Quoted 6 lines

Bjorn, I saw that you set the series to "not applicable". Is this because of the missing ack for the arm part?
I checked and Lennert's last kernel contribution is from 2015. Having said that the maintainer's entry may be outdated. Not sure who else would be entitled to ack this patch. The change is simple enough, could you take it w/o an ack?

This entry is indeed outdated, I don't have access to this hardware anymore.

Quoted 63 lines

Alternatively, IIRC Russell has got such a device. Russell, would it be possible that you test that there's still no false-positive parity errors with this series?

Quoted 58 lines
Quoted 57 lines
Quoted 57 lines
---
 drivers/pci/quirks.c | 17 +++++++++++------
 include/linux/pci.h  |  2 ++
 2 files changed, 13 insertions(+), 6 deletions(-)
drivers/pci/quirks.c +11 -6
index 653660e3b..ab54e26b8 100644
@@ -205,17 +205,22 @@ static void quirk_mmio_always_on(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_ANY_ID, PCI_ANY_ID,
 				PCI_CLASS_BRIDGE_HOST, 8, quirk_mmio_always_on);
 
+void pci_quirk_broken_parity(struct pci_dev *dev)
+{
+	u16 cmd;
+
+	dev->broken_parity_status = 1;	/* This device gives false positives */
+	pci_read_config_word(dev, PCI_COMMAND, &cmd);
+	pci_write_config_word(dev, PCI_COMMAND, cmd & ~PCI_COMMAND_PARITY);
+}
+
 /*
  * The Mellanox Tavor device gives false positive parity errors.  Mark this
  * device with a broken_parity_status to allow PCI scanning code to "skip"
  * this now blacklisted device.
  */
-static void quirk_mellanox_tavor(struct pci_dev *dev)
-{
-	dev->broken_parity_status = 1;	/* This device gives false positives */
-}
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR, quirk_mellanox_tavor);
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE, quirk_mellanox_tavor);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR, pci_quirk_broken_parity);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_MELLANOX, PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE, pci_quirk_broken_parity);
 
 /*
  * Deal with broken BIOSes that neglect to enable passive release,
include/linux/pci.h +2 -0
index b32126d26..161dcc474 100644
@@ -1916,6 +1916,8 @@ enum pci_fixup_pass {
 	pci_fixup_suspend_late,	/* pci_device_suspend_late() */
 };
 
+void pci_quirk_broken_parity(struct pci_dev *dev);
+
 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
 #define __DECLARE_PCI_FIXUP_SECTION(sec, name, vendor, device, class,	\
 				    class_shift, hook)			\
Signature · 1 line
2.30.0

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author maintainer
#7 lore raw

PATCH v3 2/3 ARM: iop32x: improve N2100 PCI broken parity quirk

In reply to Heiner Kallweit

Use new PCI core function pci_quirk_broken_parity() to disable parity checking.

---
v2:
- remove additional changes from this patch
v3:
- improve commit message

---
 arch/arm/mach-iop32x/n2100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-iop32x/n2100.c +1 -1
index 78b9a5ee4..9f2aae3cd 100644
@@ -125,7 +125,7 @@ static void n2100_fixup_r8169(struct pci_dev *dev)
 	if (dev->bus->number == 0 &&
 	    (dev->devfn == PCI_DEVFN(1, 0) ||
 	     dev->devfn == PCI_DEVFN(2, 0)))
-		dev->broken_parity_status = 1;
+		pci_quirk_broken_parity(dev);
 }
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_REALTEK, PCI_ANY_ID, n2100_fixup_r8169);
 
Signature · 1 line
2.30.0
author maintainer
#8 lore raw

PATCH v3 3/3 r8169: simplify broken parity handling now that PCI core takes care

In reply to Heiner Kallweit

Meanwhile the PCI core disables parity checking for a device that has broken_parity_status set. Therefore we don't need the quirk any longer to disable parity checking on the first parity error interrupt.

---
 drivers/net/ethernet/realtek/r8169_main.c | 14 --------------
 1 file changed, 14 deletions(-)
drivers/net/ethernet/realtek/r8169_main.c +0 -14
index c9abc7ccb..024042f37 100644
@@ -4329,20 +4329,6 @@ static void rtl8169_pcierr_interrupt(struct net_device *dev)
 	if (net_ratelimit())
 		netdev_err(dev, "PCI error (cmd = 0x%04x, status_errs = 0x%04x)\n",
 			   pci_cmd, pci_status_errs);
-	/*
-	 * The recovery sequence below admits a very elaborated explanation:
-	 * - it seems to work;
-	 * - I did not see what else could be done;
-	 * - it makes iop3xx happy.
-	 *
-	 * Feel free to adjust to your needs.
-	 */
-	if (pdev->broken_parity_status)
-		pci_cmd &= ~PCI_COMMAND_PARITY;
-	else
-		pci_cmd |= PCI_COMMAND_SERR | PCI_COMMAND_PARITY;
-
-	pci_write_config_word(pdev, PCI_COMMAND, pci_cmd);
 
 	rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_PENDING);
 }
Signature · 1 line
2.30.0