Skip to contentSkip to conversation

Disable ASPM on various devices

PATCH New Matthew Garrett 5 participants 16 messages Nov 11, 2011 – Nov 14, 2011

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Disable ASPM on various devices

If the firmware has given us control of PCIe capabilities then it's valid for an operating system to configure ASPM more aggressively than the firmware did. A small number of devices object to this and exhibit various failure modes. Windows provides a mechanism to disable ASPM in the driver, indicated by the Needs=PciASPMOptOut statement in the .inf file. Trawling through Windows drivers has indicated the following set of hardware that disables ASPM in Windows but doesn't currently disable it in Linux. It makes sense for us to mimic Windows in this situation.

(V2: send the version that actually builds)

#1 lore raw

PATCH v2 1/6 net/ethernet/atl1c: Disable ASPM on various chipsets

The Windows driver disables ASPM support for various chipsets supported by atl1c. This adds the same set of logic to the Linux driver. ASPM is disabled on l1c, l2c, l2cb and l2cb2 devices except for those in Toshiba or Lenovo devices. Data taken from
http://www.atheros.cz/atheros-inf-file.php?inf=199&chipset=51&system=6

---
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
drivers/net/ethernet/atheros/atl1c/atl1c_main.c +15 -0
index 02c7ed8..d91dabd 100644
@@ -19,6 +19,7 @@
  * Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#include <linux/pci-aspm.h>
 #include "atl1c.h"
 
 #define ATL1C_DRV_VERSION "1.0.1.0-NAPI"
@@ -2652,6 +2653,20 @@ static int __devinit atl1c_probe(struct pci_dev *pdev,
 
 	int err = 0;
 
+	switch (pdev->device) {
+	case PCI_DEVICE_ID_ATTANSIC_L1C:
+	case PCI_DEVICE_ID_ATTANSIC_L2C:
+	case PCI_DEVICE_ID_ATHEROS_L2C_B:
+	case PCI_DEVICE_ID_ATHEROS_L2C_B2:
+		if (pdev->subsystem_vendor == PCI_VENDOR_ID_TOSHIBA ||
+		    pdev->subsystem_vendor == PCI_VENDOR_ID_LENOVO)
+			break;
+		pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S |
+				       PCIE_LINK_STATE_L1 |
+				       PCIE_LINK_STATE_CLKPM);
+		break;
+	}
+
 	/* enable device (incl. PCI PM wakeup and hotplug setup) */
 	err = pci_enable_device_mem(pdev);
 	if (err) {
Signature · 1 line
1.7.7.1
maintainer Applied
#2 lore raw

Re: [PATCH V2 1/6] net/ethernet/atl1c: Disable ASPM on various chipsets

From: Matthew Garrett <[email protected]>
Date: Fri, 11 Nov 2011 11:14:19 -0500

Quoted 7 lines

The Windows driver disables ASPM support for various chipsets supported by atl1c. This adds the same set of logic to the Linux driver. ASPM is disabled on l1c, l2c, l2cb and l2cb2 devices except for those in Toshiba or Lenovo devices. Data taken from
http://www.atheros.cz/atheros-inf-file.php?inf=199&chipset=51&system=6

Applied.

maintainer
#3 lore raw

Re: [PATCH V2 1/6] net/ethernet/atl1c: Disable ASPM on various chipsets

I'm reverting all of these.

You do all of that work to research the inf files and whatnot, then you don't even build test the patches you submit?

Forget it, for something as potentially fragile as this stuff might be, I simply cannot trust you if you can't even do due diligence wrt. the build validation.

#4 lore raw

PATCH v2 2/6 net/ethernet/atl1e: Disable ASPM

In reply to Matthew Garrett

http://www.atheros.cz/atheros-inf-file.php?inf=209&chipset=45&system=6
indicates that ASPM is disabled on all L1E hardware. Duplicate for sanity.

---
 drivers/net/ethernet/atheros/atl1e/atl1e_main.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/net/ethernet/atheros/atl1e/atl1e_main.c +3 -0
index 95483bc..fc74dd1 100644
@@ -2264,6 +2264,9 @@ static int __devinit atl1e_probe(struct pci_dev *pdev,
 
 	int err = 0;
 
+	pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |
+			       PCIE_LINK_STATE_CLKPM);
+
 	err = pci_enable_device(pdev);
 	if (err) {
 		dev_err(&pdev->dev, "cannot enable PCI device\n");
Signature · 1 line
1.7.7.1
maintainer
#6 lore raw

Re: [PATCH V2 2/6] net/ethernet/atl1e: Disable ASPM

From: David Miller <[email protected]>
Date: Mon, 14 Nov 2011 00:31:13 -0500 (EST)

Quoted 9 lines

From: Matthew Garrett <[email protected]>
Date: Fri, 11 Nov 2011 11:14:20 -0500

Quoted 4 lines

http://www.atheros.cz/atheros-inf-file.php?inf=209&chipset=45&system=6
indicates that ASPM is disabled on all L1E hardware. Duplicate for sanity.

Applied.

Ummm, -ENOBUILDTESTING?!??!

drivers/net/ethernet/atheros/atl1e/atl1e_main.c: In function ‘atl1e_probe’:
drivers/net/ethernet/atheros/atl1e/atl1e_main.c:2267:2: error: implicit declaration of function ‘pci_disable_link_state’ [-Werror=implicit-function-declaration] drivers/net/ethernet/atheros/atl1e/atl1e_main.c:2267:31: error: ‘PCIE_LINK_STATE_L0S’ undeclared (first use in this function) drivers/net/ethernet/atheros/atl1e/atl1e_main.c:2267:31: note: each undeclared identifier is reported only once for each function it appears in drivers/net/ethernet/atheros/atl1e/atl1e_main.c:2267:53: error: ‘PCIE_LINK_STATE_L1’ undeclared (first use in this function) drivers/net/ethernet/atheros/atl1e/atl1e_main.c:2268:11: error: ‘PCIE_LINK_STATE_CLKPM’ undeclared (first use in this function)

#7 lore raw

Re: [PATCH V2 2/6] net/ethernet/atl1e: Disable ASPM

Sorry, I screwed up there - it looks like I tested atl1c twice. Still inexcusable, and apologies for the wasted time.

Signature · 1 line
Matthew Garrett | [email protected]
#8 lore raw

PATCH v2 3/6 net/ethernet/jme: Disable ASPM

In reply to Matthew Garrett

http://driveragent.com/archive/30421/7-0-14 indicates that ASPM is disabled on the 250 and 260. Duplicate for sanity.

---
 drivers/net/ethernet/jme.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/net/ethernet/jme.c +4 -0
index 7becff1..88e7ce1 100644
@@ -27,6 +27,7 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/pci.h>
+#include <linux/pci-aspm.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
@@ -2860,6 +2861,9 @@ jme_init_one(struct pci_dev *pdev,
 	/*
 	 * set up PCI device basics
 	 */
+	pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 |
+			       PCIE_LINK_STATE_CLKPM);
+
 	rc = pci_enable_device(pdev);
 	if (rc) {
 		pr_err("Cannot enable PCI device\n");
Signature · 1 line
1.7.7.1
#10 lore raw

PATCH v2 4/6 block/cciss: Disable ASPM

In reply to Matthew Garrett

The Windows driver .inf disables ASPM on all cciss devices. Do the same.

---
 drivers/block/cciss.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/block/cciss.c +5 -0
index 486f94e..92d8a2f 100644
@@ -24,6 +24,7 @@
 #include <linux/interrupt.h>
 #include <linux/types.h>
 #include <linux/pci.h>
+#include <linux/pci-aspm.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
@@ -4319,6 +4320,10 @@ static int __devinit cciss_pci_init(ctlr_info_t *h)
 		dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
 		return -ENODEV;
 	}
+
+	pci_disable_link_state(h->pdev, PCIE_LINK_STATE_L0S |
+			       PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM);
+
 	err = pci_enable_device(h->pdev);
 	if (err) {
 		dev_warn(&h->pdev->dev, "Unable to Enable PCI device\n");
Signature · 1 line
1.7.7.1
Acked-by on v2 4/6
#11 lore raw

Re: [PATCH V2 4/6] block/cciss: Disable ASPM

Quoted 23 lines · Matthew Garrett

The Windows driver .inf disables ASPM on all cciss devices. Do the same.

---
  drivers/block/cciss.c |    5 +++++
  1 files changed, 5 insertions(+), 0 deletions(-)
drivers/block/cciss.c +1 -0
index 486f94e..92d8a2f 100644
@@ -24,6 +24,7 @@
  #include<linux/interrupt.h>
  #include<linux/types.h>
  #include<linux/pci.h>
+#include<linux/pci-aspm.h>
  #include<linux/kernel.h>
  #include<linux/slab.h>
  #include<linux/delay.h>

drivers/block/cciss.c static int __devinit cciss_pci_init(ctlr_info_t *h) · line 4329

Quoted 10 lines
drivers/block/cciss.c +4 -0
@@ -4319,6 +4320,10 @@ static int __devinit cciss_pci_init(ctlr_info_t *h)
  		dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
  		return -ENODEV;
  	}
+
+	pci_disable_link_state(h->pdev, PCIE_LINK_STATE_L0S |
+			       PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM);
+
  	err = pci_enable_device(h->pdev);
  	if (err) {
  		dev_warn(&h->pdev->dev, "Unable to Enable PCI device\n");
maintainer
#12 lore raw

Re: [PATCH V2 4/6] block/cciss: Disable ASPM

Quoted 28 lines · Mike Miller
Quoted 27 lines · Matthew Garrett

The Windows driver .inf disables ASPM on all cciss devices. Do the same.

---
  drivers/block/cciss.c |    5 +++++
  1 files changed, 5 insertions(+), 0 deletions(-)
drivers/block/cciss.c +2 -0
index 486f94e..92d8a2f 100644
@@ -24,6 +24,7 @@
  #include<linux/interrupt.h>
  #include<linux/types.h>
  #include<linux/pci.h>
+#include<linux/pci-aspm.h>
  #include<linux/kernel.h>
  #include<linux/slab.h>
  #include<linux/delay.h>
@@ -4319,6 +4320,10 @@ static int __devinit cciss_pci_init(ctlr_info_t *h)
          dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
          return -ENODEV;
      }
+
Quoted 8 lines

drivers/block/cciss.c static int __devinit cciss_pci_init(ctlr_info_t *h) · line 4329

Quoted 6 lines
drivers/block/cciss.c +3 -0
+    pci_disable_link_state(h->pdev, PCIE_LINK_STATE_L0S |
+                   PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM);
+
      err = pci_enable_device(h->pdev);
      if (err) {
          dev_warn(&h->pdev->dev, "Unable to Enable PCI device\n");

Applied for 3.2, thanks.

Signature · 1 line
Jens Axboe
#13 lore raw

PATCH v2 5/6 scsi/hpsa: Disable ASPM

In reply to Matthew Garrett

The Windows driver .inf disables ASPM on hpsa devices. Do the same.

---
 drivers/scsi/hpsa.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/scsi/hpsa.c +5 -0
index e76107b..865d452 100644
@@ -23,6 +23,7 @@
 #include <linux/interrupt.h>
 #include <linux/types.h>
 #include <linux/pci.h>
+#include <linux/pci-aspm.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
@@ -3922,6 +3923,10 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
 		dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
 		return -ENODEV;
 	}
+
+	pci_disable_link_state(h->pdev, PCIE_LINK_STATE_L0S |
+			       PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM);
+
 	err = pci_enable_device(h->pdev);
 	if (err) {
 		dev_warn(&h->pdev->dev, "unable to enable PCI device\n");
Signature · 1 line
1.7.7.1
Acked-by on v2 5/6
#14 lore raw

Re: [PATCH V2 5/6] scsi/hpsa: Disable ASPM

Quoted 23 lines · Matthew Garrett

The Windows driver .inf disables ASPM on hpsa devices. Do the same.

---
  drivers/scsi/hpsa.c |    5 +++++
  1 files changed, 5 insertions(+), 0 deletions(-)
drivers/scsi/hpsa.c +1 -0
index e76107b..865d452 100644
@@ -23,6 +23,7 @@
  #include<linux/interrupt.h>
  #include<linux/types.h>
  #include<linux/pci.h>
+#include<linux/pci-aspm.h>
  #include<linux/kernel.h>
  #include<linux/slab.h>
  #include<linux/delay.h>

drivers/scsi/hpsa.c static int __devinit hpsa_pci_init(struct ctlr_info *h) · line 3932

Quoted 10 lines
drivers/scsi/hpsa.c +4 -0
@@ -3922,6 +3923,10 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
  		dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
  		return -ENODEV;
  	}
+
+	pci_disable_link_state(h->pdev, PCIE_LINK_STATE_L0S |
+			       PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM);
+
  	err = pci_enable_device(h->pdev);
  	if (err) {
  		dev_warn(&h->pdev->dev, "unable to enable PCI device\n");
#15 lore raw

PATCH v2 6/6 infiniband/nes: Disable ASPM

In reply to Matthew Garrett

The Windows driver .inf disables ASPM on hpsa devices. Do the same.

---
 drivers/infiniband/hw/nes/nes.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/infiniband/hw/nes/nes.c +4 -0
index 5965b3d..ea320f5 100644
@@ -45,6 +45,7 @@
 #include <linux/if_arp.h>
 #include <linux/highmem.h>
 #include <linux/slab.h>
+#include <linux/pci-aspm.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/byteorder.h>
@@ -463,6 +464,9 @@ static int __devinit nes_probe(struct pci_dev *pcidev, const struct pci_device_i
 	printk(KERN_INFO PFX "NetEffect RNIC driver v%s loading. (%s)\n",
 			DRV_VERSION, pci_name(pcidev));
 
+	pci_disable_link_state(pcidev, PCIE_LINK_STATE_L0S |
+			       PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM);
+
 	ret = pci_enable_device(pcidev);
 	if (ret) {
 		printk(KERN_ERR PFX "Unable to enable PCI device. (%s)\n", pci_name(pcidev));
Signature · 6 lines
1.7.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html