All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/iommu/dma-iommu.c:666:25: warning: Opposite expression on both sides of '&'. [oppositeExpression]
@ 2022-01-27  9:43 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-01-27  9:43 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: "Jean-Philippe Brucker" <jean-philippe@linaro.org>
CC: Joerg Roedel <jroedel@suse.de>
CC: Eric Auger <eric.auger@redhat.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   0280e3c58f92b2fe0e8fbbdf8d386449168de4a8
commit: 8ce4904bfd22de04ac3cd35d469c0a3337bdeb7b iommu/virtio: Enable x86 support
date:   7 months ago
:::::: branch date: 2 days ago
:::::: commit date: 7 months ago
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> drivers/iommu/dma-iommu.c:666:25: warning: Opposite expression on both sides of '&'. [oppositeExpression]
    min_size = alloc_sizes & -alloc_sizes;
                           ^

vim +666 drivers/iommu/dma-iommu.c

0db2e5d18f76a6 Robin Murphy        2015-10-01  644  
8230ce9a4e206f Christoph Hellwig   2021-01-28  645  /*
8230ce9a4e206f Christoph Hellwig   2021-01-28  646   * If size is less than PAGE_SIZE, then a full CPU page will be allocated,
0db2e5d18f76a6 Robin Murphy        2015-10-01  647   * but an IOMMU which supports smaller pages might not map the whole thing.
0db2e5d18f76a6 Robin Murphy        2015-10-01  648   */
8230ce9a4e206f Christoph Hellwig   2021-01-28  649  static struct page **__iommu_dma_alloc_noncontiguous(struct device *dev,
8230ce9a4e206f Christoph Hellwig   2021-01-28  650  		size_t size, struct sg_table *sgt, gfp_t gfp, pgprot_t prot,
e8d39a903cc680 Christoph Hellwig   2020-09-01  651  		unsigned long attrs)
0db2e5d18f76a6 Robin Murphy        2015-10-01  652  {
43c5bf11a610ce Robin Murphy        2018-09-12  653  	struct iommu_domain *domain = iommu_get_dma_domain(dev);
842fe519f68b4d Robin Murphy        2017-03-31  654  	struct iommu_dma_cookie *cookie = domain->iova_cookie;
842fe519f68b4d Robin Murphy        2017-03-31  655  	struct iova_domain *iovad = &cookie->iovad;
21b95aaf5f2212 Christoph Hellwig   2019-05-20  656  	bool coherent = dev_is_dma_coherent(dev);
21b95aaf5f2212 Christoph Hellwig   2019-05-20  657  	int ioprot = dma_info_to_prot(DMA_BIDIRECTIONAL, coherent, attrs);
21b95aaf5f2212 Christoph Hellwig   2019-05-20  658  	unsigned int count, min_size, alloc_sizes = domain->pgsize_bitmap;
0db2e5d18f76a6 Robin Murphy        2015-10-01  659  	struct page **pages;
842fe519f68b4d Robin Murphy        2017-03-31  660  	dma_addr_t iova;
0db2e5d18f76a6 Robin Murphy        2015-10-01  661  
a8e8af35c9f4f7 Lianbo Jiang        2021-01-26  662  	if (static_branch_unlikely(&iommu_deferred_attach_enabled) &&
3ab657291638ea Lianbo Jiang        2021-01-26  663  	    iommu_deferred_attach(dev, domain))
795bbbb9b6f803 Tom Murphy          2019-09-08  664  		return NULL;
795bbbb9b6f803 Tom Murphy          2019-09-08  665  
3b6b7e19e31a81 Robin Murphy        2016-04-13 @666  	min_size = alloc_sizes & -alloc_sizes;
3b6b7e19e31a81 Robin Murphy        2016-04-13  667  	if (min_size < PAGE_SIZE) {
3b6b7e19e31a81 Robin Murphy        2016-04-13  668  		min_size = PAGE_SIZE;
3b6b7e19e31a81 Robin Murphy        2016-04-13  669  		alloc_sizes |= PAGE_SIZE;
3b6b7e19e31a81 Robin Murphy        2016-04-13  670  	} else {
3b6b7e19e31a81 Robin Murphy        2016-04-13  671  		size = ALIGN(size, min_size);
3b6b7e19e31a81 Robin Murphy        2016-04-13  672  	}
00085f1efa387a Krzysztof Kozlowski 2016-08-03  673  	if (attrs & DMA_ATTR_ALLOC_SINGLE_PAGES)
3b6b7e19e31a81 Robin Murphy        2016-04-13  674  		alloc_sizes = min_size;
3b6b7e19e31a81 Robin Murphy        2016-04-13  675  
3b6b7e19e31a81 Robin Murphy        2016-04-13  676  	count = PAGE_ALIGN(size) >> PAGE_SHIFT;
c4b17afb0a4e8d Ganapatrao Kulkarni 2018-11-30  677  	pages = __iommu_dma_alloc_pages(dev, count, alloc_sizes >> PAGE_SHIFT,
c4b17afb0a4e8d Ganapatrao Kulkarni 2018-11-30  678  					gfp);
0db2e5d18f76a6 Robin Murphy        2015-10-01  679  	if (!pages)
0db2e5d18f76a6 Robin Murphy        2015-10-01  680  		return NULL;
0db2e5d18f76a6 Robin Murphy        2015-10-01  681  
842fe519f68b4d Robin Murphy        2017-03-31  682  	size = iova_align(iovad, size);
842fe519f68b4d Robin Murphy        2017-03-31  683  	iova = iommu_dma_alloc_iova(domain, size, dev->coherent_dma_mask, dev);
0db2e5d18f76a6 Robin Murphy        2015-10-01  684  	if (!iova)
0db2e5d18f76a6 Robin Murphy        2015-10-01  685  		goto out_free_pages;
0db2e5d18f76a6 Robin Murphy        2015-10-01  686  
8230ce9a4e206f Christoph Hellwig   2021-01-28  687  	if (sg_alloc_table_from_pages(sgt, pages, count, 0, size, GFP_KERNEL))
0db2e5d18f76a6 Robin Murphy        2015-10-01  688  		goto out_free_iova;
0db2e5d18f76a6 Robin Murphy        2015-10-01  689  
21b95aaf5f2212 Christoph Hellwig   2019-05-20  690  	if (!(ioprot & IOMMU_CACHE)) {
23f88e0a7e9f08 Christoph Hellwig   2019-05-20  691  		struct scatterlist *sg;
23f88e0a7e9f08 Christoph Hellwig   2019-05-20  692  		int i;
23f88e0a7e9f08 Christoph Hellwig   2019-05-20  693  
8230ce9a4e206f Christoph Hellwig   2021-01-28  694  		for_each_sg(sgt->sgl, sg, sgt->orig_nents, i)
23f88e0a7e9f08 Christoph Hellwig   2019-05-20  695  			arch_dma_prep_coherent(sg_page(sg), sg->length);
0db2e5d18f76a6 Robin Murphy        2015-10-01  696  	}
0db2e5d18f76a6 Robin Murphy        2015-10-01  697  
8230ce9a4e206f Christoph Hellwig   2021-01-28  698  	if (iommu_map_sg_atomic(domain, iova, sgt->sgl, sgt->orig_nents, ioprot)
0db2e5d18f76a6 Robin Murphy        2015-10-01  699  			< size)
0db2e5d18f76a6 Robin Murphy        2015-10-01  700  		goto out_free_sg;
0db2e5d18f76a6 Robin Murphy        2015-10-01  701  
8230ce9a4e206f Christoph Hellwig   2021-01-28  702  	sgt->sgl->dma_address = iova;
e817ee5f2f95ca Christoph Hellwig   2021-01-28  703  	sgt->sgl->dma_length = size;
8230ce9a4e206f Christoph Hellwig   2021-01-28  704  	return pages;
8230ce9a4e206f Christoph Hellwig   2021-01-28  705  
8230ce9a4e206f Christoph Hellwig   2021-01-28  706  out_free_sg:
8230ce9a4e206f Christoph Hellwig   2021-01-28  707  	sg_free_table(sgt);
8230ce9a4e206f Christoph Hellwig   2021-01-28  708  out_free_iova:
8230ce9a4e206f Christoph Hellwig   2021-01-28  709  	iommu_dma_free_iova(cookie, iova, size, NULL);
8230ce9a4e206f Christoph Hellwig   2021-01-28  710  out_free_pages:
8230ce9a4e206f Christoph Hellwig   2021-01-28  711  	__iommu_dma_free_pages(pages, count);
8230ce9a4e206f Christoph Hellwig   2021-01-28  712  	return NULL;
8230ce9a4e206f Christoph Hellwig   2021-01-28  713  }
8230ce9a4e206f Christoph Hellwig   2021-01-28  714  

:::::: The code at line 666 was first introduced by commit
:::::: 3b6b7e19e31a816ee02a8d4372cbea9ad7db3784 iommu/dma: Finish optimising higher-order allocations

:::::: TO: Robin Murphy <robin.murphy@arm.com>
:::::: CC: Joerg Roedel <jroedel@suse.de>

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-27  9:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-27  9:43 drivers/iommu/dma-iommu.c:666:25: warning: Opposite expression on both sides of '&'. [oppositeExpression] kernel test robot

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.