Re: [PATCH v4 5/6] swiotlb: support aligned swiotlb buffers

From: kernel test robot
Date: Sat Aug 14 2021 - 04:40:19 EST


Hi David,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on iommu/next]
[also build test ERROR on hch-configfs/for-next linus/master v5.14-rc5]
[cannot apply to swiotlb/linux-next next-20210813]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/David-Stevens/Fixes-for-dma-iommu-swiotlb-bounce-buffers/20210813-154739
base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: x86_64-randconfig-a003-20210812 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/50aeec27cc4ccaa914c0bbefa59e349278646b6e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review David-Stevens/Fixes-for-dma-iommu-swiotlb-bounce-buffers/20210813-154739
git checkout 50aeec27cc4ccaa914c0bbefa59e349278646b6e
# save the attached .config to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

drivers/xen/swiotlb-xen.c: In function 'xen_swiotlb_map_page':
>> drivers/xen/swiotlb-xen.c:385:8: error: too few arguments to function 'swiotlb_tbl_map_single'
385 | map = swiotlb_tbl_map_single(dev, phys, size, size, dir, attrs);
| ^~~~~~~~~~~~~~~~~~~~~~
In file included from arch/x86/include/asm/swiotlb.h:5,
from arch/x86/include/asm/dma-mapping.h:12,
from include/linux/dma-map-ops.h:75,
from include/linux/dma-direct.h:10,
from drivers/xen/swiotlb-xen.c:30:
include/linux/swiotlb.h:45:13: note: declared here
45 | phys_addr_t swiotlb_tbl_map_single(struct device *hwdev, phys_addr_t phys,
| ^~~~~~~~~~~~~~~~~~~~~~


vim +/swiotlb_tbl_map_single +385 drivers/xen/swiotlb-xen.c

b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 352
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 353 /*
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 354 * Map a single buffer of the indicated size for DMA in streaming mode. The
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 355 * physical address to use is returned.
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 356 *
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 357 * Once the device is given the dma address, the device owns this memory until
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 358 * either xen_swiotlb_unmap_page or xen_swiotlb_dma_sync_single is performed.
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 359 */
dceb1a6819ab2c Christoph Hellwig 2017-05-21 360 static dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 361 unsigned long offset, size_t size,
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 362 enum dma_data_direction dir,
00085f1efa387a Krzysztof Kozlowski 2016-08-03 363 unsigned long attrs)
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 364 {
e05ed4d1fad9e7 Alexander Duyck 2012-10-15 365 phys_addr_t map, phys = page_to_phys(page) + offset;
91ffe4ad534ab2 Stefano Stabellini 2020-07-10 366 dma_addr_t dev_addr = xen_phys_to_dma(dev, phys);
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 367
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 368 BUG_ON(dir == DMA_NONE);
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 369 /*
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 370 * If the address happens to be in the device's DMA window,
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 371 * we can safely return the device addr and not worry about bounce
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 372 * buffering it.
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 373 */
68a33b1794665b Christoph Hellwig 2019-11-19 374 if (dma_capable(dev, dev_addr, size, true) &&
a4dba130891271 Stefano Stabellini 2014-11-21 375 !range_straddles_page_boundary(phys, size) &&
291be10fd75111 Julien Grall 2015-09-09 376 !xen_arch_need_swiotlb(dev, phys, dev_addr) &&
063b8271ec8f70 Christoph Hellwig 2019-04-11 377 swiotlb_force != SWIOTLB_FORCE)
063b8271ec8f70 Christoph Hellwig 2019-04-11 378 goto done;
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 379
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 380 /*
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 381 * Oh well, have to allocate and map a bounce buffer.
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 382 */
2b2b614dd24e4e Zoltan Kiss 2013-09-04 383 trace_swiotlb_bounced(dev, dev_addr, size, swiotlb_force);
2b2b614dd24e4e Zoltan Kiss 2013-09-04 384
fc0021aa340af6 Christoph Hellwig 2020-10-23 @385 map = swiotlb_tbl_map_single(dev, phys, size, size, dir, attrs);
9c106119f6538f Arnd Bergmann 2019-06-17 386 if (map == (phys_addr_t)DMA_MAPPING_ERROR)
a4abe0ad10654b Christoph Hellwig 2018-11-21 387 return DMA_MAPPING_ERROR;
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 388
b4dca1512941aa Christoph Hellwig 2019-09-05 389 phys = map;
91ffe4ad534ab2 Stefano Stabellini 2020-07-10 390 dev_addr = xen_phys_to_dma(dev, map);
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 391
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 392 /*
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 393 * Ensure that the address returned is DMA'ble
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 394 */
68a33b1794665b Christoph Hellwig 2019-11-19 395 if (unlikely(!dma_capable(dev, dev_addr, size, true))) {
2973073a80b46d Christoph Hellwig 2021-03-01 396 swiotlb_tbl_unmap_single(dev, map, size, dir,
063b8271ec8f70 Christoph Hellwig 2019-04-11 397 attrs | DMA_ATTR_SKIP_CPU_SYNC);
a4abe0ad10654b Christoph Hellwig 2018-11-21 398 return DMA_MAPPING_ERROR;
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 399 }
b097186fd29d5b Konrad Rzeszutek Wilk 2010-05-11 400
063b8271ec8f70 Christoph Hellwig 2019-04-11 401 done:
63f0620cc552c4 Stefano Stabellini 2020-07-10 402 if (!dev_is_dma_coherent(dev) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)) {
63f0620cc552c4 Stefano Stabellini 2020-07-10 403 if (pfn_valid(PFN_DOWN(dma_to_phys(dev, dev_addr))))
63f0620cc552c4 Stefano Stabellini 2020-07-10 404 arch_sync_dma_for_device(phys, size, dir);
63f0620cc552c4 Stefano Stabellini 2020-07-10 405 else
63f0620cc552c4 Stefano Stabellini 2020-07-10 406 xen_dma_sync_for_device(dev, dev_addr, size, dir);
63f0620cc552c4 Stefano Stabellini 2020-07-10 407 }
063b8271ec8f70 Christoph Hellwig 2019-04-11 408 return dev_addr;
063b8271ec8f70 Christoph Hellwig 2019-04-11 409 }
063b8271ec8f70 Christoph Hellwig 2019-04-11 410

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip