summaryrefslogtreecommitdiff
path: root/drivers/dma/ioat/init.c
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2016-02-11 01:00:32 +0300
committerVinod Koul <vinod.koul@intel.com>2016-02-15 20:36:53 +0300
commitdd4645ebb7d100bb04ba38ec58b499cbe95322fa (patch)
tree3d1a8fff4a89b359952d77249dcccc5a9cc9276c /drivers/dma/ioat/init.c
parentcd60cd96137f6cb3ea82cace9225626619e7a52d (diff)
downloadlinux-dd4645ebb7d100bb04ba38ec58b499cbe95322fa.tar.xz
dmaengine: IOATDMA: Allocate DMA descriptor ring in contig DMA memory
Future IOATDMA hardware will take advantage of descriptors residing in contiguous memory. Setting the descriptor ring in max config DMA memory of 2MB. Each channel will need 2 of these chunks. This should provide 64k of 64B descriptors. Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma/ioat/init.c')
-rw-r--r--drivers/dma/ioat/init.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c
index 66369204896a..efdee1a69fc4 100644
--- a/drivers/dma/ioat/init.c
+++ b/drivers/dma/ioat/init.c
@@ -28,6 +28,7 @@
#include <linux/prefetch.h>
#include <linux/dca.h>
#include <linux/aer.h>
+#include <linux/sizes.h>
#include "dma.h"
#include "registers.h"
#include "hw.h"
@@ -496,15 +497,6 @@ static int ioat_probe(struct ioatdma_device *ioat_dma)
struct pci_dev *pdev = ioat_dma->pdev;
struct device *dev = &pdev->dev;
- /* DMA coherent memory pool for DMA descriptor allocations */
- ioat_dma->dma_pool = dma_pool_create("dma_desc_pool", dev,
- sizeof(struct ioat_dma_descriptor),
- 64, 0);
- if (!ioat_dma->dma_pool) {
- err = -ENOMEM;
- goto err_dma_pool;
- }
-
ioat_dma->completion_pool = dma_pool_create("completion_pool", dev,
sizeof(u64),
SMP_CACHE_BYTES,
@@ -512,7 +504,7 @@ static int ioat_probe(struct ioatdma_device *ioat_dma)
if (!ioat_dma->completion_pool) {
err = -ENOMEM;
- goto err_completion_pool;
+ goto err_out;
}
ioat_enumerate_channels(ioat_dma);
@@ -539,9 +531,7 @@ err_self_test:
ioat_disable_interrupts(ioat_dma);
err_setup_interrupts:
dma_pool_destroy(ioat_dma->completion_pool);
-err_completion_pool:
- dma_pool_destroy(ioat_dma->dma_pool);
-err_dma_pool:
+err_out:
return err;
}
@@ -552,7 +542,6 @@ static int ioat_register(struct ioatdma_device *ioat_dma)
if (err) {
ioat_disable_interrupts(ioat_dma);
dma_pool_destroy(ioat_dma->completion_pool);
- dma_pool_destroy(ioat_dma->dma_pool);
}
return err;
@@ -568,7 +557,6 @@ static void ioat_dma_remove(struct ioatdma_device *ioat_dma)
dma_async_device_unregister(dma);
- dma_pool_destroy(ioat_dma->dma_pool);
dma_pool_destroy(ioat_dma->completion_pool);
INIT_LIST_HEAD(&dma->channels);
@@ -658,6 +646,15 @@ static void ioat_free_chan_resources(struct dma_chan *c)
ioat_free_ring_ent(desc, c);
}
+ for (i = 0; i < ioat_chan->desc_chunks; i++) {
+ dma_free_coherent(to_dev(ioat_chan), SZ_2M,
+ ioat_chan->descs[i].virt,
+ ioat_chan->descs[i].hw);
+ ioat_chan->descs[i].virt = NULL;
+ ioat_chan->descs[i].hw = 0;
+ }
+ ioat_chan->desc_chunks = 0;
+
kfree(ioat_chan->ring);
ioat_chan->ring = NULL;
ioat_chan->alloc_order = 0;