Andrew, Here's a new rev of the IOAT DCA patches that are currently in -mm. These patches include updates based on feedback on the first set, as well as a couple of other fixes we found internally. These were originally posted on 20-Jul-2007 - see http://marc.info/?l=linux-kernel&m=118489237427303&w=2 The following series implements support for providers and clients of Direct Cache Access (DCA), a method for warming the cache in the correct CPU before needing data. ioat-new-device-ids.patch - add devices id's for newer Intel chipsets which support DMA and DCA ioat-rename-source-file.patch - prepare for adding new functionality ioat-dma-cleanups.patch - cleanup some code ugliness ioat-split-startup-code.patch - split the DMA support code from the PCI startup ioat-add-msi-msix-support.patch - add support for various interrupt handling schemes ioat-add-dca-support.patch - add the dca driver ioat-add-ioat-dca.patch - add DCA services to the ioatdma driver b/drivers/Kconfig | 2 b/drivers/Makefile | 1 b/drivers/dca/Kconfig | 8 b/drivers/dca/Makefile | 2 b/drivers/dca/dca-core.c | 168 ++++++ b/drivers/dca/dca-sysfs.c | 88 +++ b/drivers/dma/Kconfig | 60 +- b/drivers/dma/Makefile | 1 b/drivers/dma/ioat.c | 196 +++++++ b/drivers/dma/ioat_dca.c | 267 ++++++++++ b/drivers/dma/ioat_dma.c | 967 ++++++++++++++++++++++++++++++++++++++ b/drivers/dma/ioatdma.h | 30 + b/drivers/dma/ioatdma_hw.h | 2 b/drivers/dma/ioatdma_registers.h | 6 b/include/linux/dca.h | 47 + b/include/linux/pci_ids.h | 2 drivers/dma/ioatdma.c | 827 -------------------------------- 17 files changed, 1816 insertions(+), 858 deletions(-) Thanks, sln -- ====================================================================== Mr. Shannon Nelson ...
Add device ids for new revs of the Intel I/OAT DMA engine
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Acked-by: David S. Miller <davem@davemloft.net>
---
drivers/dma/ioatdma.c | 5 +++--
include/linux/pci_ids.h | 2 ++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/ioatdma.c b/drivers/dma/ioatdma.c
index 2d1f178..55227d4 100644
--- a/drivers/dma/ioatdma.c
+++ b/drivers/dma/ioatdma.c
@@ -516,8 +516,9 @@ static enum dma_status ioat_dma_is_complete(struct dma_chan *chan,
static struct pci_device_id ioat_pci_tbl[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT) },
- { PCI_DEVICE(PCI_VENDOR_ID_UNISYS,
- PCI_DEVICE_ID_UNISYS_DMA_DIRECTOR) },
+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB) },
+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_SCNB) },
+ { PCI_DEVICE(PCI_VENDOR_ID_UNISYS, PCI_DEVICE_ID_UNISYS_DMA_DIRECTOR) },
{ 0, }
};
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 07fc574..d4883bd 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2287,6 +2287,8 @@
#define PCI_DEVICE_ID_INTEL_MCH_PC 0x3599
#define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a
#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e
+#define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b
+#define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff
#define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000
#define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010
#define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020
-
Rename the ioatdma.c file in preparation for splitting into multiple files, which will allow for easier adding new functionality. Signed-off-by: Shannon Nelson <shannon.nelson@intel.com> Acked-by: David S. Miller <davem@davemloft.net> --- drivers/dma/Makefile | 1 drivers/dma/ioat_dma.c | 828 ++++++++++++++++++++++++++++++++++++++++++++++++ drivers/dma/ioatdma.c | 828 ------------------------------------------------ 3 files changed, 829 insertions(+), 828 deletions(-) diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile index b3839b6..77bee99 100644 --- a/drivers/dma/Makefile +++ b/drivers/dma/Makefile @@ -1,4 +1,5 @@ obj-$(CONFIG_DMA_ENGINE) += dmaengine.o obj-$(CONFIG_NET_DMA) += iovlock.o obj-$(CONFIG_INTEL_IOATDMA) += ioatdma.o +ioatdma-objs := ioat_dma.o obj-$(CONFIG_INTEL_IOP_ADMA) += iop-adma.o diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c new file mode 100644 index 0000000..55227d4 --- /dev/null +++ b/drivers/dma/ioat_dma.c @@ -0,0 +1,828 @@ +/* + * Copyright(c) 2004 - 2006 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 + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The full GNU General Public License is included in this distribution in the + * file called COPYING. + */ + +/* + * This driver supports an Intel I/OAT DMA engine, which does ...
Take care of a bunch of little code nits in ioatdma files Signed-off-by: Shannon Nelson <shannon.nelson@intel.com> Acked-by: David S. Miller <davem@davemloft.net> --- drivers/dma/ioat_dma.c | 200 +++++++++++++++++++++++++++--------------------- 1 files changed, 111 insertions(+), 89 deletions(-) diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c index 55227d4..9a4d154 100644 --- a/drivers/dma/ioat_dma.c +++ b/drivers/dma/ioat_dma.c @@ -1,10 +1,10 @@ /* - * Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved. + * Intel I/OAT DMA Linux driver + * Copyright(c) 2004 - 2007 Intel Corporation. * * 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 - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or @@ -12,11 +12,12 @@ * more details. * * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + * The full GNU General Public License is included in this distribution in + * the file called "COPYING". * - * The full GNU General Public License is included in this distribution in the - * file called COPYING. */ /* @@ -35,17 +36,22 @@ #include "ioatdma_registers.h" #include "ioatdma_hw.h" +#define INITIAL_IOAT_DESC_COUNT 128 + #define to_ioat_chan(chan) container_of(chan, struct ioat_dma_chan, common) ...
What's with these (KERN_INFO " " "...more strings"); ?? --- ~Randy *** Remember to use Documentation/SubmitChecklist when testing your code *** -
These are admittedly not the smartest move, but they are replaced later in the patch-set. sln -- ====================================================================== Mr. Shannon Nelson LAN Access Division, Intel Corp. Shannon.Nelson@intel.com I don't speak for Intel (503) 712-7659 Parents can't afford to be squeamish. -
Split the general PCI startup from the DMA handling code in order to prepare for adding support for DCA services and future versions of the ioatdma device. Signed-off-by: Shannon Nelson <shannon.nelson@intel.com> Acked-by: David S. Miller <davem@davemloft.net> --- drivers/dma/Makefile | 2 drivers/dma/ioat.c | 186 ++++++++++++++++++++++++++++++++++++++++++++ drivers/dma/ioat_dma.c | 196 +++++++++++----------------------------------- drivers/dma/ioatdma.h | 16 +++- drivers/dma/ioatdma_hw.h | 2 5 files changed, 245 insertions(+), 157 deletions(-) diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile index 77bee99..cec0c9c 100644 --- a/drivers/dma/Makefile +++ b/drivers/dma/Makefile @@ -1,5 +1,5 @@ obj-$(CONFIG_DMA_ENGINE) += dmaengine.o obj-$(CONFIG_NET_DMA) += iovlock.o obj-$(CONFIG_INTEL_IOATDMA) += ioatdma.o -ioatdma-objs := ioat_dma.o +ioatdma-objs := ioat.o ioat_dma.o obj-$(CONFIG_INTEL_IOP_ADMA) += iop-adma.o diff --git a/drivers/dma/ioat.c b/drivers/dma/ioat.c new file mode 100644 index 0000000..9d9f672 --- /dev/null +++ b/drivers/dma/ioat.c @@ -0,0 +1,186 @@ +/* + * Intel I/OAT DMA Linux driver + * Copyright(c) 2004 - 2007 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, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + * + * The full GNU General Public License is included in this distribution in + * the file called ...
This field name change needs a corresponding change in the Please use parameter variable names in function prototypes (above; --- ~Randy *** Remember to use Documentation/SubmitChecklist when testing your code *** -
Yep, I'll get it. Again, thanks for your comments, sln -- ====================================================================== Mr. Shannon Nelson LAN Access Division, Intel Corp. Shannon.Nelson@intel.com I don't speak for Intel (503) 712-7659 Parents can't afford to be squeamish. -
Add support for MSI and MSI-X interrupt handling, including the ability
to choose the desired interrupt method.
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Acked-by: David S. Miller <davem@davemloft.net>
---
drivers/dma/ioat_dma.c | 353 ++++++++++++++++++++++++++++++++-------
drivers/dma/ioatdma.h | 12 +
drivers/dma/ioatdma_registers.h | 6 +
3 files changed, 305 insertions(+), 66 deletions(-)
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
index 9012176..0909fee 100644
--- a/drivers/dma/ioat_dma.c
+++ b/drivers/dma/ioat_dma.c
@@ -47,6 +47,71 @@
static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan);
static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan);
+#define for_each_bit(bit, addr, size) \
+ for ((bit) = find_first_bit((addr), (size)); \
+ (bit) < (size); \
+ (bit) = find_next_bit((addr), (size), (bit) + 1))
+
+
+struct ioat_dma_chan *ioat_lookup_chan_by_index(struct ioatdma_device *device,
+ int index)
+{
+ return device->idx[index];
+}
+
+/**
+ * ioat_dma_do_interrupt - handler used for single vector interrupt mode
+ * @irq: interrupt id
+ * @data: interrupt data
+ */
+static irqreturn_t ioat_dma_do_interrupt(int irq, void *data)
+{
+ struct ioatdma_device *instance = data;
+ struct ioat_dma_chan *ioat_chan;
+ unsigned long attnstatus;
+ int bit;
+ u8 intrctrl;
+
+ intrctrl = readb(instance->reg_base + IOAT_INTRCTRL_OFFSET);
+
+ if (!(intrctrl & IOAT_INTRCTRL_MASTER_INT_EN))
+ return IRQ_NONE;
+
+ if (!(intrctrl & IOAT_INTRCTRL_INT_STATUS)) {
+ writeb(intrctrl, instance->reg_base + IOAT_INTRCTRL_OFFSET);
+ return IRQ_NONE;
+ }
+
+ attnstatus = readl(instance->reg_base + IOAT_ATTNSTATUS_OFFSET);
+ for_each_bit (bit, &attnstatus, BITS_PER_LONG) {
+ ioat_chan = ioat_lookup_chan_by_index(instance, bit);
+ tasklet_schedule(&ioat_chan->cleanup_task);
+ }
+
+ writeb(intrctrl, instance->reg_base + IOAT_INTRCTRL_OFFSET);
+ return ...Any reason that this macro shouldn't be added to include/linux/bitops.h instead of here? I'd prefer/expect such Unfortunately, function name + short description in kernel-doc must be on one line (only). If you want to add more text/description, put it We normally use one * ... --- ~Randy *** Remember to use Documentation/SubmitChecklist when testing your code *** -
Thanks, sln -- ====================================================================== Mr. Shannon Nelson LAN Access Division, Intel Corp. Shannon.Nelson@intel.com I don't speak for Intel (503) 712-7659 Parents can't afford to be squeamish. -
Direct Cache Access (DCA) is a method for warming the CPU cache before data
is used, with the intent of lessening the impact of cache misses. This
patch adds a manager and interface for matching up client requests for DCA
services with devices that offer DCA services.
In order to use DCA, a module must do bus writes with the appropriate tag
bits set to trigger a cache read for a specific CPU. However, different
CPUs and chipsets can require different sets of tag bits, and the methods
for determining the correct bits may be simple hardcoding or may be a
hardware specific magic incantation. This interface is a way for DCA
clients to find the correct tag bits for the targeted CPU without needing
to know the specifics.
[Dave Miller] use DEFINE_SPINLOCK()
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Acked-by: David S. Miller <davem@davemloft.net>
---
drivers/Kconfig | 2 +
drivers/Makefile | 1
drivers/dca/Kconfig | 11 +++
drivers/dca/Makefile | 2 +
drivers/dca/dca-core.c | 168 +++++++++++++++++++++++++++++++++++++++++++++++
drivers/dca/dca-sysfs.c | 88 +++++++++++++++++++++++++
include/linux/dca.h | 47 +++++++++++++
7 files changed, 319 insertions(+), 0 deletions(-)
diff --git a/drivers/Kconfig b/drivers/Kconfig
index 3e1c442..b447e60 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -82,6 +82,8 @@ source "drivers/rtc/Kconfig"
source "drivers/dma/Kconfig"
+source "drivers/dca/Kconfig"
+
source "drivers/auxdisplay/Kconfig"
source "drivers/kvm/Kconfig"
diff --git a/drivers/Makefile b/drivers/Makefile
index f0878b2..dbd9fa5 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -85,6 +85,7 @@ obj-$(CONFIG_CRYPTO) += crypto/
obj-$(CONFIG_SUPERH) += sh/
obj-$(CONFIG_GENERIC_TIME) += clocksource/
obj-$(CONFIG_DMA_ENGINE) += dma/
+obj-$(CONFIG_DCA) += dca/
obj-$(CONFIG_HID) += hid/
obj-$(CONFIG_PPC_PS3) += ps3/
obj-$(CONFIG_OF) += of/
diff --git a/drivers/dca/Kconfig ...We conventionally put help text last in each config entry. Can global_dca be static, or is it used in other source files? It would be good to have all of these global/exported interfaces documented somewhere. Did I miss it in another file? If not, you could use kernel-doc to add inline function docs. or just (in all cases): --- ~Randy *** Remember to use Documentation/SubmitChecklist when testing your code *** -
Yep, will do. Thanks for the comments, sln -- ====================================================================== Mr. Shannon Nelson LAN Access Division, Intel Corp. Shannon.Nelson@intel.com I don't speak for Intel (503) 712-7659 Parents can't afford to be squeamish. -
Add code to connect to the DCA driver and provide cpu tags for use by
drivers that would like to use Direct Cache Access hints.
[Adrian Bunk] Several Kconfig cleanup items
[Andrew Morten, Chris Leech] fix for using cpu_physical_id() even when
built for uni-processor
Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Acked-by: David S. Miller <davem@davemloft.net>
---
drivers/dca/Kconfig | 7 -
drivers/dma/Kconfig | 60 ++++++-----
drivers/dma/Makefile | 2
drivers/dma/ioat.c | 12 ++
drivers/dma/ioat_dca.c | 267 ++++++++++++++++++++++++++++++++++++++++++++++++
drivers/dma/ioatdma.h | 2
6 files changed, 318 insertions(+), 32 deletions(-)
diff --git a/drivers/dca/Kconfig b/drivers/dca/Kconfig
index d901615..c2ed77c 100644
--- a/drivers/dca/Kconfig
+++ b/drivers/dca/Kconfig
@@ -3,9 +3,6 @@
#
config DCA
- tristate "DCA support for clients and providers"
- ---help---
- This is a server to help modules that want to use Direct Cache
- Access to find DCA providers that will supply correct CPU tags.
- default m
+ tristate
+
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 8f670da..955a99b 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -2,42 +2,52 @@
# DMA engine configuration
#
-menu "DMA Engine support"
- depends on HAS_DMA
+menuconfig DMADEVICES
+ bool "DMA Offload Engine support"
+ depends on (PCI && X86) || ARCH_IOP32X || ARCH_IOP33X || ARCH_IOP13XX
+ help
+ Intel(R) offload engines enable offloading memory copies in the
+ network stack and RAID operations in the MD driver.
+
+if DMADEVICES
+
+comment "DMA Devices"
+
+config INTEL_IOATDMA
+ tristate "Intel I/OAT DMA support"
+ depends on PCI && X86
+ select DMA_ENGINE
+ select DCA
+ help
+ Enable support for the Intel(R) I/OAT DMA engine present
+ in recent chipsets.
+
+ Say Y here if you have such a chipset.
+
+ If unsure, say N.
+
+config ...Yes, feature bits need to be integrated with the other CPU-specific --- ~Randy *** Remember to use Documentation/SubmitChecklist when testing your code *** -
Added to include/asm-i386/cpufeature.h, which is also used by the x86_64 Possibly, but I don't know pci well enough to know for sure, so I'll let Done. Thanks again, sln -- ====================================================================== Mr. Shannon Nelson LAN Access Division, Intel Corp. Shannon.Nelson@intel.com I don't speak for Intel (503) 712-7659 Parents can't afford to be squeamish. -
