aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2009-06-23 02:04:13 -0400
committerRoland Dreier <rolandd@cisco.com>2009-06-23 02:04:13 -0400
commit99987bea474ceca8ec6fb05f81d7d188634cdffd (patch)
tree623e0222b4a85dfa66078db880a0e2828d42670a /drivers/infiniband
parent65795efbd380a832ae508b04dba8f8e53f0b84d9 (diff)
IB/mthca: Replace dma_sync_single() use with proper functions
dma_sync_single() is deprecated now, and the use in mthca is wrong: there should be a dma_sync_single_for_cpu() before touching the memory from the CPU, and a dma_sync_single_for_device() afterwards. Fix this, prompted by a kick in the pants from a patch from FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>. Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_mr.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c
index d606edf10858..065b20899876 100644
--- a/drivers/infiniband/hw/mthca/mthca_mr.c
+++ b/drivers/infiniband/hw/mthca/mthca_mr.c
@@ -352,10 +352,14 @@ static void mthca_arbel_write_mtt_seg(struct mthca_dev *dev,
352 352
353 BUG_ON(!mtts); 353 BUG_ON(!mtts);
354 354
355 dma_sync_single_for_cpu(&dev->pdev->dev, dma_handle,
356 list_len * sizeof (u64), DMA_TO_DEVICE);
357
355 for (i = 0; i < list_len; ++i) 358 for (i = 0; i < list_len; ++i)
356 mtts[i] = cpu_to_be64(buffer_list[i] | MTHCA_MTT_FLAG_PRESENT); 359 mtts[i] = cpu_to_be64(buffer_list[i] | MTHCA_MTT_FLAG_PRESENT);
357 360
358 dma_sync_single(&dev->pdev->dev, dma_handle, list_len * sizeof (u64), DMA_TO_DEVICE); 361 dma_sync_single_for_device(&dev->pdev->dev, dma_handle,
362 list_len * sizeof (u64), DMA_TO_DEVICE);
359} 363}
360 364
361int mthca_write_mtt(struct mthca_dev *dev, struct mthca_mtt *mtt, 365int mthca_write_mtt(struct mthca_dev *dev, struct mthca_mtt *mtt,
@@ -803,12 +807,15 @@ int mthca_arbel_map_phys_fmr(struct ib_fmr *ibfmr, u64 *page_list,
803 807
804 wmb(); 808 wmb();
805 809
810 dma_sync_single_for_cpu(&dev->pdev->dev, fmr->mem.arbel.dma_handle,
811 list_len * sizeof(u64), DMA_TO_DEVICE);
812
806 for (i = 0; i < list_len; ++i) 813 for (i = 0; i < list_len; ++i)
807 fmr->mem.arbel.mtts[i] = cpu_to_be64(page_list[i] | 814 fmr->mem.arbel.mtts[i] = cpu_to_be64(page_list[i] |
808 MTHCA_MTT_FLAG_PRESENT); 815 MTHCA_MTT_FLAG_PRESENT);
809 816
810 dma_sync_single(&dev->pdev->dev, fmr->mem.arbel.dma_handle, 817 dma_sync_single_for_device(&dev->pdev->dev, fmr->mem.arbel.dma_handle,
811 list_len * sizeof(u64), DMA_TO_DEVICE); 818 list_len * sizeof(u64), DMA_TO_DEVICE);
812 819
813 fmr->mem.arbel.mpt->key = cpu_to_be32(key); 820 fmr->mem.arbel.mpt->key = cpu_to_be32(key);
814 fmr->mem.arbel.mpt->lkey = cpu_to_be32(key); 821 fmr->mem.arbel.mpt->lkey = cpu_to_be32(key);