summaryrefslogtreecommitdiffstats
path: root/drivers/ntb/test
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-01-26 04:31:45 -0500
committerJon Mason <jdmason@kudzu.us>2016-03-17 20:38:40 -0400
commit1985a88107b5330b2a911ad4d279e1bd7e4deb24 (patch)
tree35cf86e2078fbf6af0f8cb3429594a4506e7d373 /drivers/ntb/test
parentb562e44f507e863c6792946e4e1b1449fbbac85d (diff)
ntb: perf test: fix address space confusion
The ntb driver assigns between pointers an __iomem tokens, and also casts them to 64-bit integers, which results in compiler warnings on 32-bit systems: drivers/ntb/test/ntb_perf.c: In function 'perf_copy': drivers/ntb/test/ntb_perf.c:213:10: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] vbase = (u64)(u64 *)mw->vbase; ^ drivers/ntb/test/ntb_perf.c:214:14: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] dst_vaddr = (u64)(u64 *)dst; ^ This adds __iomem annotations where needed and changes the temporary variables to iomem pointers to avoid casting them to u64. I did not see the problem in linux-next earlier, but it show showed up in 4.5-rc1. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Dave Jiang <dave.jiang@intel.com> Fixes: 8a7b6a778a85 ("ntb: ntb perf tool") Signed-off-by: Jon Mason <jdmason@kudzu.us>
Diffstat (limited to 'drivers/ntb/test')
-rw-r--r--drivers/ntb/test/ntb_perf.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c
index c8a37ba4b4f9..6bdc1e7b7503 100644
--- a/drivers/ntb/test/ntb_perf.c
+++ b/drivers/ntb/test/ntb_perf.c
@@ -178,7 +178,7 @@ static void perf_copy_callback(void *data)
178 atomic_dec(&pctx->dma_sync); 178 atomic_dec(&pctx->dma_sync);
179} 179}
180 180
181static ssize_t perf_copy(struct pthr_ctx *pctx, char *dst, 181static ssize_t perf_copy(struct pthr_ctx *pctx, char __iomem *dst,
182 char *src, size_t size) 182 char *src, size_t size)
183{ 183{
184 struct perf_ctx *perf = pctx->perf; 184 struct perf_ctx *perf = pctx->perf;
@@ -189,7 +189,8 @@ static ssize_t perf_copy(struct pthr_ctx *pctx, char *dst,
189 dma_cookie_t cookie; 189 dma_cookie_t cookie;
190 size_t src_off, dst_off; 190 size_t src_off, dst_off;
191 struct perf_mw *mw = &perf->mw; 191 struct perf_mw *mw = &perf->mw;
192 u64 vbase, dst_vaddr; 192 void __iomem *vbase;
193 void __iomem *dst_vaddr;
193 dma_addr_t dst_phys; 194 dma_addr_t dst_phys;
194 int retries = 0; 195 int retries = 0;
195 196
@@ -204,14 +205,14 @@ static ssize_t perf_copy(struct pthr_ctx *pctx, char *dst,
204 } 205 }
205 206
206 device = chan->device; 207 device = chan->device;
207 src_off = (size_t)src & ~PAGE_MASK; 208 src_off = (uintptr_t)src & ~PAGE_MASK;
208 dst_off = (size_t)dst & ~PAGE_MASK; 209 dst_off = (uintptr_t __force)dst & ~PAGE_MASK;
209 210
210 if (!is_dma_copy_aligned(device, src_off, dst_off, size)) 211 if (!is_dma_copy_aligned(device, src_off, dst_off, size))
211 return -ENODEV; 212 return -ENODEV;
212 213
213 vbase = (u64)(u64 *)mw->vbase; 214 vbase = mw->vbase;
214 dst_vaddr = (u64)(u64 *)dst; 215 dst_vaddr = dst;
215 dst_phys = mw->phys_addr + (dst_vaddr - vbase); 216 dst_phys = mw->phys_addr + (dst_vaddr - vbase);
216 217
217 unmap = dmaengine_get_unmap_data(device->dev, 1, GFP_NOWAIT); 218 unmap = dmaengine_get_unmap_data(device->dev, 1, GFP_NOWAIT);
@@ -261,13 +262,13 @@ err_get_unmap:
261 return 0; 262 return 0;
262} 263}
263 264
264static int perf_move_data(struct pthr_ctx *pctx, char *dst, char *src, 265static int perf_move_data(struct pthr_ctx *pctx, char __iomem *dst, char *src,
265 u64 buf_size, u64 win_size, u64 total) 266 u64 buf_size, u64 win_size, u64 total)
266{ 267{
267 int chunks, total_chunks, i; 268 int chunks, total_chunks, i;
268 int copied_chunks = 0; 269 int copied_chunks = 0;
269 u64 copied = 0, result; 270 u64 copied = 0, result;
270 char *tmp = dst; 271 char __iomem *tmp = dst;
271 u64 perf, diff_us; 272 u64 perf, diff_us;
272 ktime_t kstart, kstop, kdiff; 273 ktime_t kstart, kstop, kdiff;
273 274
@@ -324,7 +325,7 @@ static int ntb_perf_thread(void *data)
324 struct perf_ctx *perf = pctx->perf; 325 struct perf_ctx *perf = pctx->perf;
325 struct pci_dev *pdev = perf->ntb->pdev; 326 struct pci_dev *pdev = perf->ntb->pdev;
326 struct perf_mw *mw = &perf->mw; 327 struct perf_mw *mw = &perf->mw;
327 char *dst; 328 char __iomem *dst;
328 u64 win_size, buf_size, total; 329 u64 win_size, buf_size, total;
329 void *src; 330 void *src;
330 int rc, node, i; 331 int rc, node, i;
@@ -364,7 +365,7 @@ static int ntb_perf_thread(void *data)
364 if (buf_size > MAX_TEST_SIZE) 365 if (buf_size > MAX_TEST_SIZE)
365 buf_size = MAX_TEST_SIZE; 366 buf_size = MAX_TEST_SIZE;
366 367
367 dst = (char *)mw->vbase; 368 dst = (char __iomem *)mw->vbase;
368 369
369 atomic_inc(&perf->tsync); 370 atomic_inc(&perf->tsync);
370 while (atomic_read(&perf->tsync) != perf->perf_threads) 371 while (atomic_read(&perf->tsync) != perf->perf_threads)