Skip to contentSkip to conversation

ioat: PM Support

PATCH RESEND New Jon Mason 1 participant 1 message Sep 25, 2013 dmaengine

lore
Share & tools
lore

Jon Mason

author
#0 lore raw

PATCH RESEND 1/1 ioat: PM Support

Add power management support in the IOAT driver. Adding this feature resolves a known issue when attempting to suspend on systems with IOAT enabled. On those systems, IOAT would experience a DMA channel error when attempting to resume due to the channels not being suspended properly. Currently, all channels errors cause panics, thus bringing the system down.

Unfortunately, a hardware errata needs to be worked around on Xeon IOAT devices. The channel cannot be suspended or reset if there are active XOR transactions. To get around this, check to see if XOR is enabled on the channel and the channel has pending transactions. If so, then grab the lock and wait for the queue to drain. It might be more elegant to see if there are any XOR operations pending in the list, but by that time the queue will have drained anyway.

See BF509S in
http://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/xeon-c5500-c3500-spec-update.pdf
See BT92 in
http://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/xeon-e5-family-spec-update.pdf

---
 drivers/dma/ioat/dma.c    |    1 +
 drivers/dma/ioat/dma.h    |    1 +
 drivers/dma/ioat/dma_v2.c |    1 +
 drivers/dma/ioat/dma_v3.c |   60 ++++++++++++++++++++++++++++++++++++++++++---
 drivers/dma/ioat/pci.c    |   39 +++++++++++++++++++++++++++++
 5 files changed, 99 insertions(+), 3 deletions(-)
drivers/dma/ioat/dma.c +1 -0
index 5ff6fc1..eeccfaa 100644
@@ -1202,6 +1202,7 @@ int ioat1_dma_probe(struct ioatdma_device *device, int dca)
 	device->self_test = ioat_dma_self_test;
 	device->timer_fn = ioat1_timer_event;
 	device->cleanup_fn = ioat1_cleanup_event;
+	device->suspend = ioat_suspend;
 	dma = &device->common;
 	dma->device_prep_dma_memcpy = ioat1_dma_prep_memcpy;
 	dma->device_issue_pending = ioat1_dma_memcpy_issue_pending;
drivers/dma/ioat/dma.h +1 -0
index 54fb7b9..1372c8e 100644
@@ -97,6 +97,7 @@ struct ioatdma_device {
 	void (*cleanup_fn)(unsigned long data);
 	void (*timer_fn)(unsigned long data);
 	int (*self_test)(struct ioatdma_device *device);
+	void (*suspend)(struct ioat_chan_common *chan);
 };
 
 struct ioat_chan_common {
drivers/dma/ioat/dma_v2.c +1 -0
index b925e1b..bd21dcb 100644
@@ -890,6 +890,7 @@ int ioat2_dma_probe(struct ioatdma_device *device, int dca)
 	device->cleanup_fn = ioat2_cleanup_event;
 	device->timer_fn = ioat2_timer_event;
 	device->self_test = ioat_dma_self_test;
+	device->suspend = ioat_suspend;
 	dma = &device->common;
 	dma->device_prep_dma_memcpy = ioat2_dma_prep_memcpy_lock;
 	dma->device_issue_pending = ioat2_issue_pending;
drivers/dma/ioat/dma_v3.c +57 -3

90 lines not on this page · raw message

drivers/dma/ioat/pci.c +39 -0
index 2c8d560..136b10a 100644
@@ -126,11 +126,50 @@ struct kmem_cache *ioat2_cache;
 
 #define DRV_NAME "ioatdma"
 
+#ifdef CONFIG_PM
+static int ioat_pm_suspend(struct device *dev)
+{
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct ioatdma_device *device = pci_get_drvdata(pdev);
+	struct dma_device *dma = &device->common;
+	struct dma_chan *chan;
+
+	list_for_each_entry(chan, &dma->channels, device_node) {
+		struct ioat_dma_chan *ioat = to_ioat_chan(chan);
+
+		dev_info(dev, "Suspending Chan %d\n", chan->chan_id);
+		if (device->suspend)
+			device->suspend(&ioat->base);
+	}
+
+	return 0;
+}
+
+static int ioat_pm_resume(struct device *dev)
+{
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct ioatdma_device *device = pci_get_drvdata(pdev);
+	struct dma_device *dma = &device->common;
+	struct dma_chan *chan;
+
+	list_for_each_entry(chan, &dma->channels, device_node) {
+		struct ioat_dma_chan *ioat = to_ioat_chan(chan);
+		dev_info(dev, "Starting Chan %d\n", chan->chan_id);
+		ioat_start(&ioat->base);
+	}
+
+	return 0;
+}
+#endif
+
+SIMPLE_DEV_PM_OPS(ioat_pm_ops, ioat_pm_suspend, ioat_pm_resume);
+
 static struct pci_driver ioat_pci_driver = {
 	.name		= DRV_NAME,
 	.id_table	= ioat_pci_tbl,
 	.probe		= ioat_pci_probe,
 	.remove		= ioat_remove,
+	.driver.pm	= &ioat_pm_ops,
 };
 
 static struct ioatdma_device *
Signature · 1 line
1.7.9.5