aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-05-12 20:12:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-05-12 20:12:36 -0400
commitbd99f5e17b317a6d342ffaf500e2a9fd632d2a22 (patch)
tree83dfd8b181b9655b5d41dcce28f1034d42cf1d31
parent2ea3f868487dcee0bfd91055f1c42bb172efc507 (diff)
parentad567ffb32f067b30606071eb568cf637fe42185 (diff)
Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx
* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx: dma: fix ipu_idmac.c to not discard the last queued buffer ioatdma: fix "ioatdma frees DMA memory with wrong function" ipu_idmac: Use disable_irq_nosync() from within irq handlers. dmatest: fix max channels handling
-rw-r--r--drivers/dma/dmaengine.c17
-rw-r--r--drivers/dma/dmatest.c4
-rw-r--r--drivers/dma/ioat_dma.c45
-rw-r--r--drivers/dma/ipu/ipu_idmac.c7
-rw-r--r--include/linux/dmaengine.h6
5 files changed, 50 insertions, 29 deletions
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 92438e9dacc..5a87384ea4f 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -804,11 +804,14 @@ dma_async_memcpy_buf_to_buf(struct dma_chan *chan, void *dest,
804 dma_addr_t dma_dest, dma_src; 804 dma_addr_t dma_dest, dma_src;
805 dma_cookie_t cookie; 805 dma_cookie_t cookie;
806 int cpu; 806 int cpu;
807 unsigned long flags;
807 808
808 dma_src = dma_map_single(dev->dev, src, len, DMA_TO_DEVICE); 809 dma_src = dma_map_single(dev->dev, src, len, DMA_TO_DEVICE);
809 dma_dest = dma_map_single(dev->dev, dest, len, DMA_FROM_DEVICE); 810 dma_dest = dma_map_single(dev->dev, dest, len, DMA_FROM_DEVICE);
810 tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len, 811 flags = DMA_CTRL_ACK |
811 DMA_CTRL_ACK); 812 DMA_COMPL_SRC_UNMAP_SINGLE |
813 DMA_COMPL_DEST_UNMAP_SINGLE;
814 tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len, flags);
812 815
813 if (!tx) { 816 if (!tx) {
814 dma_unmap_single(dev->dev, dma_src, len, DMA_TO_DEVICE); 817 dma_unmap_single(dev->dev, dma_src, len, DMA_TO_DEVICE);
@@ -850,11 +853,12 @@ dma_async_memcpy_buf_to_pg(struct dma_chan *chan, struct page *page,
850 dma_addr_t dma_dest, dma_src; 853 dma_addr_t dma_dest, dma_src;
851 dma_cookie_t cookie; 854 dma_cookie_t cookie;
852 int cpu; 855 int cpu;
856 unsigned long flags;
853 857
854 dma_src = dma_map_single(dev->dev, kdata, len, DMA_TO_DEVICE); 858 dma_src = dma_map_single(dev->dev, kdata, len, DMA_TO_DEVICE);
855 dma_dest = dma_map_page(dev->dev, page, offset, len, DMA_FROM_DEVICE); 859 dma_dest = dma_map_page(dev->dev, page, offset, len, DMA_FROM_DEVICE);
856 tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len, 860 flags = DMA_CTRL_ACK | DMA_COMPL_SRC_UNMAP_SINGLE;
857 DMA_CTRL_ACK); 861 tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len, flags);
858 862
859 if (!tx) { 863 if (!tx) {
860 dma_unmap_single(dev->dev, dma_src, len, DMA_TO_DEVICE); 864 dma_unmap_single(dev->dev, dma_src, len, DMA_TO_DEVICE);
@@ -898,12 +902,13 @@ dma_async_memcpy_pg_to_pg(struct dma_chan *chan, struct page *dest_pg,
898 dma_addr_t dma_dest, dma_src; 902 dma_addr_t dma_dest, dma_src;
899 dma_cookie_t cookie; 903 dma_cookie_t cookie;
900 int cpu; 904 int cpu;
905 unsigned long flags;
901 906
902 dma_src = dma_map_page(dev->dev, src_pg, src_off, len, DMA_TO_DEVICE); 907 dma_src = dma_map_page(dev->dev, src_pg, src_off, len, DMA_TO_DEVICE);
903 dma_dest = dma_map_page(dev->dev, dest_pg, dest_off, len, 908 dma_dest = dma_map_page(dev->dev, dest_pg, dest_off, len,
904 DMA_FROM_DEVICE); 909 DMA_FROM_DEVICE);
905 tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len, 910 flags = DMA_CTRL_ACK;
906 DMA_CTRL_ACK); 911 tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len, flags);
907 912
908 if (!tx) { 913 if (!tx) {
909 dma_unmap_page(dev->dev, dma_src, len, DMA_TO_DEVICE); 914 dma_unmap_page(dev->dev, dma_src, len, DMA_TO_DEVICE);
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index a27c0fb1bc1..fb7da5141e9 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -531,9 +531,7 @@ static int __init dmatest_init(void)
531 chan = dma_request_channel(mask, filter, NULL); 531 chan = dma_request_channel(mask, filter, NULL);
532 if (chan) { 532 if (chan) {
533 err = dmatest_add_channel(chan); 533 err = dmatest_add_channel(chan);
534 if (err == 0) 534 if (err) {
535 continue;
536 else {
537 dma_release_channel(chan); 535 dma_release_channel(chan);
538 break; /* add_channel failed, punt */ 536 break; /* add_channel failed, punt */
539 } 537 }
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
index e4fc33c1c32..1955ee8d6d2 100644
--- a/drivers/dma/ioat_dma.c
+++ b/drivers/dma/ioat_dma.c
@@ -1063,22 +1063,31 @@ static void ioat_dma_cleanup_tasklet(unsigned long data)
1063static void 1063static void
1064ioat_dma_unmap(struct ioat_dma_chan *ioat_chan, struct ioat_desc_sw *desc) 1064ioat_dma_unmap(struct ioat_dma_chan *ioat_chan, struct ioat_desc_sw *desc)
1065{ 1065{
1066 /* 1066 if (!(desc->async_tx.flags & DMA_COMPL_SKIP_DEST_UNMAP)) {
1067 * yes we are unmapping both _page and _single 1067 if (desc->async_tx.flags & DMA_COMPL_DEST_UNMAP_SINGLE)
1068 * alloc'd regions with unmap_page. Is this 1068 pci_unmap_single(ioat_chan->device->pdev,
1069 * *really* that bad? 1069 pci_unmap_addr(desc, dst),
1070 */ 1070 pci_unmap_len(desc, len),
1071 if (!(desc->async_tx.flags & DMA_COMPL_SKIP_DEST_UNMAP)) 1071 PCI_DMA_FROMDEVICE);
1072 pci_unmap_page(ioat_chan->device->pdev, 1072 else
1073 pci_unmap_addr(desc, dst), 1073 pci_unmap_page(ioat_chan->device->pdev,
1074 pci_unmap_len(desc, len), 1074 pci_unmap_addr(desc, dst),
1075 PCI_DMA_FROMDEVICE); 1075 pci_unmap_len(desc, len),
1076 1076 PCI_DMA_FROMDEVICE);
1077 if (!(desc->async_tx.flags & DMA_COMPL_SKIP_SRC_UNMAP)) 1077 }
1078 pci_unmap_page(ioat_chan->device->pdev, 1078
1079 pci_unmap_addr(desc, src), 1079 if (!(desc->async_tx.flags & DMA_COMPL_SKIP_SRC_UNMAP)) {
1080 pci_unmap_len(desc, len), 1080 if (desc->async_tx.flags & DMA_COMPL_SRC_UNMAP_SINGLE)
1081 PCI_DMA_TODEVICE); 1081 pci_unmap_single(ioat_chan->device->pdev,
1082 pci_unmap_addr(desc, src),
1083 pci_unmap_len(desc, len),
1084 PCI_DMA_TODEVICE);
1085 else
1086 pci_unmap_page(ioat_chan->device->pdev,
1087 pci_unmap_addr(desc, src),
1088 pci_unmap_len(desc, len),
1089 PCI_DMA_TODEVICE);
1090 }
1082} 1091}
1083 1092
1084/** 1093/**
@@ -1363,6 +1372,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
1363 int err = 0; 1372 int err = 0;
1364 struct completion cmp; 1373 struct completion cmp;
1365 unsigned long tmo; 1374 unsigned long tmo;
1375 unsigned long flags;
1366 1376
1367 src = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL); 1377 src = kzalloc(sizeof(u8) * IOAT_TEST_SIZE, GFP_KERNEL);
1368 if (!src) 1378 if (!src)
@@ -1392,8 +1402,9 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
1392 DMA_TO_DEVICE); 1402 DMA_TO_DEVICE);
1393 dma_dest = dma_map_single(dma_chan->device->dev, dest, IOAT_TEST_SIZE, 1403 dma_dest = dma_map_single(dma_chan->device->dev, dest, IOAT_TEST_SIZE,
1394 DMA_FROM_DEVICE); 1404 DMA_FROM_DEVICE);
1405 flags = DMA_COMPL_SRC_UNMAP_SINGLE | DMA_COMPL_DEST_UNMAP_SINGLE;
1395 tx = device->common.device_prep_dma_memcpy(dma_chan, dma_dest, dma_src, 1406 tx = device->common.device_prep_dma_memcpy(dma_chan, dma_dest, dma_src,
1396 IOAT_TEST_SIZE, 0); 1407 IOAT_TEST_SIZE, flags);
1397 if (!tx) { 1408 if (!tx) {
1398 dev_err(&device->pdev->dev, 1409 dev_err(&device->pdev->dev,
1399 "Self-test prep failed, disabling\n"); 1410 "Self-test prep failed, disabling\n");
diff --git a/drivers/dma/ipu/ipu_idmac.c b/drivers/dma/ipu/ipu_idmac.c
index e202a6ce557..9a5bc1a7389 100644
--- a/drivers/dma/ipu/ipu_idmac.c
+++ b/drivers/dma/ipu/ipu_idmac.c
@@ -1272,7 +1272,8 @@ static irqreturn_t idmac_interrupt(int irq, void *dev_id)
1272 /* Other interrupts do not interfere with this channel */ 1272 /* Other interrupts do not interfere with this channel */
1273 spin_lock(&ichan->lock); 1273 spin_lock(&ichan->lock);
1274 if (unlikely(chan_id != IDMAC_SDC_0 && chan_id != IDMAC_SDC_1 && 1274 if (unlikely(chan_id != IDMAC_SDC_0 && chan_id != IDMAC_SDC_1 &&
1275 ((curbuf >> chan_id) & 1) == ichan->active_buffer)) { 1275 ((curbuf >> chan_id) & 1) == ichan->active_buffer &&
1276 !list_is_last(ichan->queue.next, &ichan->queue))) {
1276 int i = 100; 1277 int i = 100;
1277 1278
1278 /* This doesn't help. See comment in ipu_disable_channel() */ 1279 /* This doesn't help. See comment in ipu_disable_channel() */
@@ -1547,7 +1548,7 @@ static irqreturn_t ic_sof_irq(int irq, void *dev_id)
1547 struct idmac_channel *ichan = dev_id; 1548 struct idmac_channel *ichan = dev_id;
1548 printk(KERN_DEBUG "Got SOF IRQ %d on Channel %d\n", 1549 printk(KERN_DEBUG "Got SOF IRQ %d on Channel %d\n",
1549 irq, ichan->dma_chan.chan_id); 1550 irq, ichan->dma_chan.chan_id);
1550 disable_irq(irq); 1551 disable_irq_nosync(irq);
1551 return IRQ_HANDLED; 1552 return IRQ_HANDLED;
1552} 1553}
1553 1554
@@ -1556,7 +1557,7 @@ static irqreturn_t ic_eof_irq(int irq, void *dev_id)
1556 struct idmac_channel *ichan = dev_id; 1557 struct idmac_channel *ichan = dev_id;
1557 printk(KERN_DEBUG "Got EOF IRQ %d on Channel %d\n", 1558 printk(KERN_DEBUG "Got EOF IRQ %d on Channel %d\n",
1558 irq, ichan->dma_chan.chan_id); 1559 irq, ichan->dma_chan.chan_id);
1559 disable_irq(irq); 1560 disable_irq_nosync(irq);
1560 return IRQ_HANDLED; 1561 return IRQ_HANDLED;
1561} 1562}
1562 1563
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 2e2aa3df170..ffefba81c81 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -78,12 +78,18 @@ enum dma_transaction_type {
78 * dependency chains 78 * dependency chains
79 * @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s) 79 * @DMA_COMPL_SKIP_SRC_UNMAP - set to disable dma-unmapping the source buffer(s)
80 * @DMA_COMPL_SKIP_DEST_UNMAP - set to disable dma-unmapping the destination(s) 80 * @DMA_COMPL_SKIP_DEST_UNMAP - set to disable dma-unmapping the destination(s)
81 * @DMA_COMPL_SRC_UNMAP_SINGLE - set to do the source dma-unmapping as single
82 * (if not set, do the source dma-unmapping as page)
83 * @DMA_COMPL_DEST_UNMAP_SINGLE - set to do the destination dma-unmapping as single
84 * (if not set, do the destination dma-unmapping as page)
81 */ 85 */
82enum dma_ctrl_flags { 86enum dma_ctrl_flags {
83 DMA_PREP_INTERRUPT = (1 << 0), 87 DMA_PREP_INTERRUPT = (1 << 0),
84 DMA_CTRL_ACK = (1 << 1), 88 DMA_CTRL_ACK = (1 << 1),
85 DMA_COMPL_SKIP_SRC_UNMAP = (1 << 2), 89 DMA_COMPL_SKIP_SRC_UNMAP = (1 << 2),
86 DMA_COMPL_SKIP_DEST_UNMAP = (1 << 3), 90 DMA_COMPL_SKIP_DEST_UNMAP = (1 << 3),
91 DMA_COMPL_SRC_UNMAP_SINGLE = (1 << 4),
92 DMA_COMPL_DEST_UNMAP_SINGLE = (1 << 5),
87}; 93};
88 94
89/** 95/**