aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/ioat/dma_v2.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-09-08 15:01:04 -0400
committerDan Williams <dan.j.williams@intel.com>2009-09-08 20:30:24 -0400
commit4fb9b9e8d55880523db550043dfb204696dd0422 (patch)
tree733a672aeb819bb8133b16329a6b5088cf9ee693 /drivers/dma/ioat/dma_v2.c
parent6df9183a153291a2585a8dfe67597fc18c201147 (diff)
ioat: cleanup completion status reads
The cleanup path makes an effort to only perform an atomic read of the 64-bit completion address. However in the 32-bit case it does not matter if we read the upper-32 and lower-32 non-atomically because the upper-32 will always be zero. Signed-off-by: Maciej Sosnowski <maciej.sosnowski@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma/ioat/dma_v2.c')
-rw-r--r--drivers/dma/ioat/dma_v2.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
index 58881860f400..ca1134249341 100644
--- a/drivers/dma/ioat/dma_v2.c
+++ b/drivers/dma/ioat/dma_v2.c
@@ -200,8 +200,7 @@ static void ioat2_reset_channel(struct ioat2_dma_chan *ioat)
200 return; 200 return;
201 201
202 chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET); 202 chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET);
203 chansts = (chan->completion_virt->low 203 chansts = *chan->completion & IOAT_CHANSTS_DMA_TRANSFER_STATUS;
204 & IOAT_CHANSTS_DMA_TRANSFER_STATUS);
205 if (chanerr) { 204 if (chanerr) {
206 dev_err(to_dev(chan), 205 dev_err(to_dev(chan),
207 "chan%d, CHANSTS = 0x%08x CHANERR = 0x%04x, clearing\n", 206 "chan%d, CHANSTS = 0x%08x CHANERR = 0x%04x, clearing\n",
@@ -281,7 +280,7 @@ static void ioat2_cleanup(struct ioat2_dma_chan *ioat)
281 int i; 280 int i;
282 struct dma_async_tx_descriptor *tx; 281 struct dma_async_tx_descriptor *tx;
283 282
284 prefetch(chan->completion_virt); 283 prefetch(chan->completion);
285 284
286 spin_lock_bh(&chan->cleanup_lock); 285 spin_lock_bh(&chan->cleanup_lock);
287 phys_complete = ioat_get_current_completion(chan); 286 phys_complete = ioat_get_current_completion(chan);
@@ -470,17 +469,15 @@ static int ioat2_alloc_chan_resources(struct dma_chan *c)
470 469
471 /* allocate a completion writeback area */ 470 /* allocate a completion writeback area */
472 /* doing 2 32bit writes to mmio since 1 64b write doesn't work */ 471 /* doing 2 32bit writes to mmio since 1 64b write doesn't work */
473 chan->completion_virt = pci_pool_alloc(chan->device->completion_pool, 472 chan->completion = pci_pool_alloc(chan->device->completion_pool,
474 GFP_KERNEL, 473 GFP_KERNEL, &chan->completion_dma);
475 &chan->completion_addr); 474 if (!chan->completion)
476 if (!chan->completion_virt)
477 return -ENOMEM; 475 return -ENOMEM;
478 476
479 memset(chan->completion_virt, 0, 477 memset(chan->completion, 0, sizeof(*chan->completion));
480 sizeof(*chan->completion_virt)); 478 writel(((u64) chan->completion_dma) & 0x00000000FFFFFFFF,
481 writel(((u64) chan->completion_addr) & 0x00000000FFFFFFFF,
482 chan->reg_base + IOAT_CHANCMP_OFFSET_LOW); 479 chan->reg_base + IOAT_CHANCMP_OFFSET_LOW);
483 writel(((u64) chan->completion_addr) >> 32, 480 writel(((u64) chan->completion_dma) >> 32,
484 chan->reg_base + IOAT_CHANCMP_OFFSET_HIGH); 481 chan->reg_base + IOAT_CHANCMP_OFFSET_HIGH);
485 482
486 ioat->alloc_order = ioat_get_alloc_order(); 483 ioat->alloc_order = ioat_get_alloc_order();
@@ -655,12 +652,12 @@ static void ioat2_free_chan_resources(struct dma_chan *c)
655 ioat->ring = NULL; 652 ioat->ring = NULL;
656 ioat->alloc_order = 0; 653 ioat->alloc_order = 0;
657 pci_pool_free(ioatdma_device->completion_pool, 654 pci_pool_free(ioatdma_device->completion_pool,
658 chan->completion_virt, 655 chan->completion,
659 chan->completion_addr); 656 chan->completion_dma);
660 spin_unlock_bh(&ioat->ring_lock); 657 spin_unlock_bh(&ioat->ring_lock);
661 658
662 chan->last_completion = 0; 659 chan->last_completion = 0;
663 chan->completion_addr = 0; 660 chan->completion_dma = 0;
664 ioat->pending = 0; 661 ioat->pending = 0;
665 ioat->dmacount = 0; 662 ioat->dmacount = 0;
666 chan->watchdog_completion = 0; 663 chan->watchdog_completion = 0;