Skip to contentSkip to conversation

I/OAT update

PATCH In review Maciej Sosnowski 3 participants 10 messages Feb 26, 2009

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

cover I/OAT update

This patch series updates ioatdma driver
with a couple of fixes and workarounds,
including copybreak modification,
plus some cleanup like copyright dates update.

Maciej Sosnowski (6):
I/OAT: add verification for proper APICID_TAG_MAP setting by BIOS I/OAT: do not set DCACTRL_CMPL_WRITE_ENABLE for I/OAT ver.3 I/OAT: fail initialization on zero channels detection I/OAT: cancel watchdog before dma remove
I/OAT: set tcp_dma_copybreak to 256k for I/OAT ver.3 I/OAT: update driver version and copyright dates

Eric Sesterhenn (1):
I/OAT: list usage cleanup

 drivers/dca/dca-core.c          |    2 -
 drivers/dma/ioat.c              |    2 -
 drivers/dma/ioat_dca.c          |   26 ++++++++++++++++++++++++-
 drivers/dma/ioat_dma.c          |   31 ++++++++++++++++++------------
 drivers/dma/ioatdma.h           |    8 ++++---
 drivers/dma/ioatdma_hw.h        |    2 -
 drivers/dma/ioatdma_registers.h |    2 -
 7 files changed, 53 insertions(+), 20 deletions(-)

--
Maciej

#1 lore raw

PATCH 1/7 I/OAT: add verification for proper APICID_TAG_MAP setting by BIOS

BIOS versions for systems with I/OAT ver.2 have been found which fail to program APICID_TAG_MAP for DCA.
The ioatdma driver should recognize incorrectly set APICID_TAG_MAP and disable DCA in that case.

---

 drivers/dma/ioat_dca.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
drivers/dma/ioat_dca.c +24 -0
index 6cf622d..78705ca 100644
@@ -49,6 +49,23 @@ #define DCA3_TAG_MAP_LITERAL_VAL 0x1
 
 #define DCA_TAG_MAP_MASK 0xDF
 
+/* expected tag map bytes for I/OAT ver.2 */
+#define DCA2_TAG_MAP_BYTE0 0x80
+#define DCA2_TAG_MAP_BYTE1 0x0
+#define DCA2_TAG_MAP_BYTE2 0x81
+#define DCA2_TAG_MAP_BYTE3 0x82
+#define DCA2_TAG_MAP_BYTE4 0x82
+
+/* verify if tag map matches expected values */
+static inline int dca2_tag_map_valid(u8 *tag_map)
+{
+	return ((tag_map[0] == DCA2_TAG_MAP_BYTE0) &&
+		(tag_map[1] == DCA2_TAG_MAP_BYTE1) &&
+		(tag_map[2] == DCA2_TAG_MAP_BYTE2) &&
+		(tag_map[3] == DCA2_TAG_MAP_BYTE3) &&
+		(tag_map[4] == DCA2_TAG_MAP_BYTE4));
+}
+
 /*
  * "Legacy" DCA systems do not implement the DCA register set in the
  * I/OAT device.  Software needs direct support for their tag mappings.
@@ -452,6 +469,13 @@ struct dca_provider *ioat2_dca_init(stru
 			ioatdca->tag_map[i] = 0;
 	}
 
+	if (!dca2_tag_map_valid(ioatdca->tag_map)) {
+		dev_err(&pdev->dev, "APICID_TAG_MAP set incorrectly by BIOS, "
+			"disabling DCA\n");
+		free_dca_provider(dca);
+		return NULL;
+	}
+
 	err = register_dca_provider(dca, &pdev->dev);
 	if (err) {
 		free_dca_provider(dca);
#2 lore raw

PATCH 2/7 I/OAT: do not set DCACTRL_CMPL_WRITE_ENABLE for I/OAT ver.3

In reply to Maciej Sosnowski

Flag DCACTRL_CMPL_WRITE_ENABLE is valid only for I/OAT ver.2 so it should not be set for I/OAT ver.3.

---

 drivers/dma/ioat_dma.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
drivers/dma/ioat_dma.c +7 -5
index b3759c4..879f4a0 100644
@@ -189,11 +189,13 @@ #endif
 		ioat_chan->xfercap = xfercap;
 		ioat_chan->desccount = 0;
 		INIT_DELAYED_WORK(&ioat_chan->work, ioat_dma_chan_reset_part2);
-		if (ioat_chan->device->version != IOAT_VER_1_2) {
-			writel(IOAT_DCACTRL_CMPL_WRITE_ENABLE
-					| IOAT_DMA_DCA_ANY_CPU,
-				ioat_chan->reg_base + IOAT_DCACTRL_OFFSET);
-		}
+		if (ioat_chan->device->version == IOAT_VER_2_0)
+			writel(IOAT_DCACTRL_CMPL_WRITE_ENABLE |
+			       IOAT_DMA_DCA_ANY_CPU,
+			       ioat_chan->reg_base + IOAT_DCACTRL_OFFSET);
+		else if (ioat_chan->device->version == IOAT_VER_3_0)
+			writel(IOAT_DMA_DCA_ANY_CPU,
+			       ioat_chan->reg_base + IOAT_DCACTRL_OFFSET);
 		spin_lock_init(&ioat_chan->cleanup_lock);
 		spin_lock_init(&ioat_chan->desc_lock);
 		INIT_LIST_HEAD(&ioat_chan->free_desc);
#3 lore raw

PATCH 3/7 I/OAT: fail initialization on zero channels detection

In reply to Maciej Sosnowski

On some systems with I/OAT ver.2 when DCA is disabled in BIOS situations have been observed
that zero DMA channels are detected instead of four.
To avoid kernel panic driver should fail gracefully with appropriate message.

---

 drivers/dma/ioat_dma.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/dma/ioat_dma.c +7 -0
index 879f4a0..9012da7 100644
@@ -1659,6 +1659,13 @@ struct ioatdma_device *ioat_dma_probe(st
 		" %d channels, device version 0x%02x, driver version %s\n",
 		device->common.chancnt, device->version, IOAT_DMA_VERSION);
 
+	if (!device->common.chancnt) {
+		dev_err(&device->pdev->dev,
+			"Intel(R) I/OAT DMA Engine problem found: "
+			"zero channels detected\n");
+		goto err_setup_interrupts;
+	}
+
 	err = ioat_dma_setup_interrupts(device);
 	if (err)
 		goto err_setup_interrupts;
#4 lore raw

PATCH 4/7 I/OAT: cancel watchdog before dma remove

In reply to Maciej Sosnowski

Channel watchdog should be canceled before the rest of dma remove stuff.

---

 drivers/dma/ioat_dma.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/dma/ioat_dma.c +3 -4
index 9012da7..fc9b845 100644
@@ -1705,6 +1705,9 @@ void ioat_dma_remove(struct ioatdma_devi
 	struct dma_chan *chan, *_chan;
 	struct ioat_dma_chan *ioat_chan;
 
+	if (device->version != IOAT_VER_3_0)
+		cancel_delayed_work(&device->work);
+
 	ioat_dma_remove_interrupts(device);
 
 	dma_async_device_unregister(&device->common);
@@ -1716,10 +1719,6 @@ void ioat_dma_remove(struct ioatdma_devi
 	pci_release_regions(device->pdev);
 	pci_disable_device(device->pdev);
 
-	if (device->version != IOAT_VER_3_0) {
-		cancel_delayed_work(&device->work);
-	}
-
 	list_for_each_entry_safe(chan, _chan,
 				 &device->common.channels, device_node) {
 		ioat_chan = to_ioat_chan(chan);
#5 lore raw

PATCH 5/7 I/OAT: set tcp_dma_copybreak to 256k for I/OAT ver.3

In reply to Maciej Sosnowski

Upcoming server platforms from Intel based on the Nehalem performance have significantly improved CPU based copy performance. However, the DMA engine can still be effective at higher I/O sizes for TCP traffic and at this time copybreak
should be set to 256k for TCP traffic only.

---

 drivers/dma/ioatdma.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/dma/ioatdma.h +3 -1
index a3306d0..dcf8db5 100644
@@ -135,12 +135,14 @@ static inline void ioat_set_tcp_copy_bre
 	#ifdef CONFIG_NET_DMA
 	switch (dev->version) {
 	case IOAT_VER_1_2:
-	case IOAT_VER_3_0:
 		sysctl_tcp_dma_copybreak = 4096;
 		break;
 	case IOAT_VER_2_0:
 		sysctl_tcp_dma_copybreak = 2048;
 		break;
+	case IOAT_VER_3_0:
+		sysctl_tcp_dma_copybreak = 262144;
+		break;
 	}
 	#endif
 }
#6 lore raw

PATCH 6/7 I/OAT: list usage cleanup

In reply to Maciej Sosnowski

From: Eric Sesterhenn <[email protected]>

Trivial cleanup, list_del(); list_add_tail() is equivalent to list_move_tail(). Semantic patch for coccinelle can be found at www.cccmz.de/~snakebyte/list_move_tail.spatch

---

 drivers/dma/ioat_dma.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/dma/ioat_dma.c +2 -3
index fc9b845..ae8c0ce 100644
@@ -1171,9 +1171,8 @@ #endif
 				 * up if the client is done with the descriptor
 				 */
 				if (async_tx_test_ack(&desc->async_tx)) {
-					list_del(&desc->node);
-					list_add_tail(&desc->node,
-						      &ioat_chan->free_desc);
+					list_move_tail(&desc->node,
+						       &ioat_chan->free_desc);
 				} else
 					desc->async_tx.cookie = 0;
 			} else {
#7 lore raw

PATCH 7/7 I/OAT: update driver version and copyright dates

In reply to Maciej Sosnowski

Together with new fixes update driver version
and extend copyright dates ranges.

---

 drivers/dca/dca-core.c          |    2 +-
 drivers/dma/ioat.c              |    2 +-
 drivers/dma/ioat_dca.c          |    2 +-
 drivers/dma/ioat_dma.c          |    2 +-
 drivers/dma/ioatdma.h           |    4 ++--
 drivers/dma/ioatdma_hw.h        |    2 +-
 drivers/dma/ioatdma_registers.h |    2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)
drivers/dca/dca-core.c +1 -1
index 33bd753..25b743a 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2007 Intel Corporation. All rights reserved.
+ * Copyright(c) 2007 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
drivers/dma/ioat.c +1 -1
index 4105d65..ed83dd9 100644
@@ -1,6 +1,6 @@
 /*
  * Intel I/OAT DMA Linux driver
- * Copyright(c) 2007 Intel Corporation.
+ * Copyright(c) 2007 - 2009 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
drivers/dma/ioat_dca.c +1 -1
index 78705ca..c012a1e 100644
@@ -1,6 +1,6 @@
 /*
  * Intel I/OAT DMA Linux driver
- * Copyright(c) 2007 Intel Corporation.
+ * Copyright(c) 2007 - 2009 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
drivers/dma/ioat_dma.c +1 -1
index ae8c0ce..068b635 100644
@@ -1,6 +1,6 @@
 /*
  * Intel I/OAT DMA Linux driver
- * Copyright(c) 2004 - 2007 Intel Corporation.
+ * Copyright(c) 2004 - 2009 Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
drivers/dma/ioatdma.h +2 -2
index dcf8db5..a52ff4b 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2004 - 2007 Intel Corporation. All rights reserved.
+ * Copyright(c) 2004 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
@@ -29,7 +29,7 @@ #include <linux/cache.h>
 #include <linux/pci_ids.h>
 #include <net/tcp.h>
 
-#define IOAT_DMA_VERSION  "3.30"
+#define IOAT_DMA_VERSION  "3.64"
 
 enum ioat_interrupt {
 	none = 0,
drivers/dma/ioatdma_hw.h +1 -1
index f1ae2c7..afa57ee 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2004 - 2007 Intel Corporation. All rights reserved.
+ * Copyright(c) 2004 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
drivers/dma/ioatdma_registers.h +1 -1
index 827cb50..49bc277 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2004 - 2007 Intel Corporation. All rights reserved.
+ * Copyright(c) 2004 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
#8 lore raw
In reply to Maciej Sosnowski
Quoted 25 lines · Maciej Sosnowski

This patch series updates ioatdma driver
with a couple of fixes and workarounds,
including copybreak modification,
plus some cleanup like copyright dates update.

Maciej Sosnowski (6):
   I/OAT: add verification for proper APICID_TAG_MAP setting by BIOS I/OAT: do not set DCACTRL_CMPL_WRITE_ENABLE for I/OAT ver.3 I/OAT: fail initialization on zero channels detection I/OAT: cancel watchdog before dma remove
   I/OAT: set tcp_dma_copybreak to 256k for I/OAT ver.3 I/OAT: update driver version and copyright dates

Eric Sesterhenn (1):
   I/OAT: list usage cleanup

 drivers/dca/dca-core.c          |    2 -
 drivers/dma/ioat.c              |    2 -

 drivers/dma/ioat_dca.c          |   26 ++++++++++++++++++++++++-
 drivers/dma/ioat_dma.c          |   31 ++++++++++++++++++------------
 drivers/dma/ioatdma.h           |    8 ++++---
 drivers/dma/ioatdma_hw.h        |    2 -
 drivers/dma/ioatdma_registers.h |    2 -
 7 files changed, 53 insertions(+), 20 deletions(-)
Quoted 4 lines

--
Maciej
--

Dave - FYI, my Acked-by email on this patch series is incorrect. It should be [email protected] not "krisher".

Signature · 2 lines
Cheers,
Jeff
maintainer
#9 lore raw

From: Jeff Kirsher <[email protected]>
Date: Thu, 26 Feb 2009 02:31:24 -0800

Quoted 2 lines

Dave - FYI, my Acked-by email on this patch series is incorrect. It should be [email protected] not "krisher".

I'm actually not the one who will apply this stuff, so...