All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: David Stevens <stevensd@chromium.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Christoph Hellwig <hch@lst.de>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Tom Murphy <murphyt7@tcd.ie>,
	iommu@lists.linux-foundation.org,
	David Stevens <stevensd@chromium.org>,
	Will Deacon <will@kernel.org>
Subject: Re: [PATCH v4 5/6] swiotlb: support aligned swiotlb buffers
Date: Sat, 14 Aug 2021 16:39:40 +0800	[thread overview]
Message-ID: <202108141640.oblF7AGu-lkp@intel.com> (raw)
In-Reply-To: <20210813073839.1562438-6-stevensd@google.com>

[-- Attachment #1: Type: text/plain, Size: 7246 bytes --]

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@intel.com>

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@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 37812 bytes --]

[-- Attachment #3: Type: text/plain, Size: 156 bytes --]

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v4 5/6] swiotlb: support aligned swiotlb buffers
Date: Sat, 14 Aug 2021 16:39:40 +0800	[thread overview]
Message-ID: <202108141640.oblF7AGu-lkp@intel.com> (raw)
In-Reply-To: <20210813073839.1562438-6-stevensd@google.com>

[-- Attachment #1: Type: text/plain, Size: 7356 bytes --]

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@intel.com>

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(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 37812 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: David Stevens <stevensd@chromium.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Christoph Hellwig <hch@lst.de>
Cc: kbuild-all@lists.01.org, Joerg Roedel <joro@8bytes.org>,
	Will Deacon <will@kernel.org>,
	Lu Baolu <baolu.lu@linux.intel.com>, Tom Murphy <murphyt7@tcd.ie>,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
	David Stevens <stevensd@chromium.org>
Subject: Re: [PATCH v4 5/6] swiotlb: support aligned swiotlb buffers
Date: Sat, 14 Aug 2021 16:39:40 +0800	[thread overview]
Message-ID: <202108141640.oblF7AGu-lkp@intel.com> (raw)
In-Reply-To: <20210813073839.1562438-6-stevensd@google.com>

[-- Attachment #1: Type: text/plain, Size: 7246 bytes --]

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@intel.com>

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@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 37812 bytes --]

  parent reply	other threads:[~2021-08-14  8:40 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13  7:38 [PATCH v4 0/6] Fixes for dma-iommu swiotlb bounce buffers David Stevens
2021-08-13  7:38 ` David Stevens
2021-08-13  7:38 ` [PATCH v4 1/6] dma-iommu: fix sync_sg with swiotlb David Stevens
2021-08-13  7:38   ` David Stevens
2021-08-13  7:58   ` Christoph Hellwig
2021-08-13  7:58     ` Christoph Hellwig
2021-08-13  7:38 ` [PATCH v4 2/6] dma-iommu: fix arch_sync_dma for map David Stevens
2021-08-13  7:38   ` David Stevens
2021-08-13  8:02   ` Christoph Hellwig
2021-08-13  8:02     ` Christoph Hellwig
2021-08-13  7:38 ` [PATCH v4 3/6] dma-iommu: skip extra sync during unmap w/swiotlb David Stevens
2021-08-13  7:38   ` David Stevens
2021-08-13  8:03   ` Christoph Hellwig
2021-08-13  8:03     ` Christoph Hellwig
2021-08-13  7:38 ` [PATCH v4 4/6] dma-iommu: Check CONFIG_SWIOTLB more broadly David Stevens
2021-08-13  7:38   ` David Stevens
2021-08-13  8:03   ` Christoph Hellwig
2021-08-13  8:03     ` Christoph Hellwig
2021-08-13  7:38 ` [PATCH v4 5/6] swiotlb: support aligned swiotlb buffers David Stevens
2021-08-13  7:38   ` David Stevens
2021-08-13  8:04   ` Christoph Hellwig
2021-08-13  8:04     ` Christoph Hellwig
2021-08-14  8:39   ` kernel test robot [this message]
2021-08-14  8:39     ` kernel test robot
2021-08-14  8:39     ` kernel test robot
2021-08-13  7:38 ` [PATCH v4 6/6] dma-iommu: account for min_align_mask David Stevens
2021-08-13  7:38   ` David Stevens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202108141640.oblF7AGu-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=murphyt7@tcd.ie \
    --cc=robin.murphy@arm.com \
    --cc=stevensd@chromium.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.