iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>,
	dri-devel@lists.freedesktop.org,
	iommu@lists.linux-foundation.org, linaro-mm-sig@lists.linaro.org,
	linux-kernel@vger.kernel.org
Cc: kbuild-all@lists.01.org,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	David Airlie <airlied@linux.ie>,
	clang-built-linux@googlegroups.com,
	Thierry Reding <thierry.reding@gmail.com>,
	linux-tegra@vger.kernel.org, Robin Murphy <robin.murphy@arm.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v7 26/36] drm: host1x: fix common struct sg_table related issues
Date: Sun, 21 Jun 2020 22:47:38 +0800	[thread overview]
Message-ID: <202006212216.jLr6uCUi%lkp@intel.com> (raw)
In-Reply-To: <20200619103636.11974-27-m.szyprowski@samsung.com>

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

Hi Marek,

I love your patch! Yet something to improve:

[auto build test ERROR on next-20200618]
[also build test ERROR on v5.8-rc1]
[cannot apply to linuxtv-media/master staging/staging-testing drm-exynos/exynos-drm-next drm-intel/for-linux-next linus/master v5.8-rc1 v5.7 v5.7-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Marek-Szyprowski/DRM-fix-struct-sg_table-nents-vs-orig_nents-misuse/20200619-184302
base:    ce2cc8efd7a40cbd17841add878cb691d0ce0bba
config: arm64-randconfig-r036-20200621 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project ef455a55bcf2cfea04a99c361b182ad18b7f03f1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

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/gpu/host1x/job.c:230:10: error: implicit declaration of function 'iommu_map_sgtable' [-Werror,-Wimplicit-function-declaration]
                           err = iommu_map_sgtable(host->domain,
                                 ^
   drivers/gpu/host1x/job.c:230:10: note: did you mean 'dma_map_sgtable'?
   include/linux/dma-mapping.h:628:19: note: 'dma_map_sgtable' declared here
   static inline int dma_map_sgtable(struct device *dev, struct sg_table *sgt,
                     ^
   1 error generated.

vim +/iommu_map_sgtable +230 drivers/gpu/host1x/job.c

   100	
   101	static unsigned int pin_job(struct host1x *host, struct host1x_job *job)
   102	{
   103		struct host1x_client *client = job->client;
   104		struct device *dev = client->dev;
   105		struct iommu_domain *domain;
   106		unsigned int i;
   107		int err;
   108	
   109		domain = iommu_get_domain_for_dev(dev);
   110		job->num_unpins = 0;
   111	
   112		for (i = 0; i < job->num_relocs; i++) {
   113			struct host1x_reloc *reloc = &job->relocs[i];
   114			dma_addr_t phys_addr, *phys;
   115			struct sg_table *sgt;
   116	
   117			reloc->target.bo = host1x_bo_get(reloc->target.bo);
   118			if (!reloc->target.bo) {
   119				err = -EINVAL;
   120				goto unpin;
   121			}
   122	
   123			/*
   124			 * If the client device is not attached to an IOMMU, the
   125			 * physical address of the buffer object can be used.
   126			 *
   127			 * Similarly, when an IOMMU domain is shared between all
   128			 * host1x clients, the IOVA is already available, so no
   129			 * need to map the buffer object again.
   130			 *
   131			 * XXX Note that this isn't always safe to do because it
   132			 * relies on an assumption that no cache maintenance is
   133			 * needed on the buffer objects.
   134			 */
   135			if (!domain || client->group)
   136				phys = &phys_addr;
   137			else
   138				phys = NULL;
   139	
   140			sgt = host1x_bo_pin(dev, reloc->target.bo, phys);
   141			if (IS_ERR(sgt)) {
   142				err = PTR_ERR(sgt);
   143				goto unpin;
   144			}
   145	
   146			if (sgt) {
   147				unsigned long mask = HOST1X_RELOC_READ |
   148						     HOST1X_RELOC_WRITE;
   149				enum dma_data_direction dir;
   150	
   151				switch (reloc->flags & mask) {
   152				case HOST1X_RELOC_READ:
   153					dir = DMA_TO_DEVICE;
   154					break;
   155	
   156				case HOST1X_RELOC_WRITE:
   157					dir = DMA_FROM_DEVICE;
   158					break;
   159	
   160				case HOST1X_RELOC_READ | HOST1X_RELOC_WRITE:
   161					dir = DMA_BIDIRECTIONAL;
   162					break;
   163	
   164				default:
   165					err = -EINVAL;
   166					goto unpin;
   167				}
   168	
   169				err = dma_map_sgtable(dev, sgt, dir, 0);
   170				if (err)
   171					goto unpin;
   172	
   173				job->unpins[job->num_unpins].dev = dev;
   174				job->unpins[job->num_unpins].dir = dir;
   175				phys_addr = sg_dma_address(sgt->sgl);
   176			}
   177	
   178			job->addr_phys[job->num_unpins] = phys_addr;
   179			job->unpins[job->num_unpins].bo = reloc->target.bo;
   180			job->unpins[job->num_unpins].sgt = sgt;
   181			job->num_unpins++;
   182		}
   183	
   184		for (i = 0; i < job->num_gathers; i++) {
   185			struct host1x_job_gather *g = &job->gathers[i];
   186			size_t gather_size = 0;
   187			struct scatterlist *sg;
   188			struct sg_table *sgt;
   189			dma_addr_t phys_addr;
   190			unsigned long shift;
   191			struct iova *alloc;
   192			dma_addr_t *phys;
   193			unsigned int j;
   194	
   195			g->bo = host1x_bo_get(g->bo);
   196			if (!g->bo) {
   197				err = -EINVAL;
   198				goto unpin;
   199			}
   200	
   201			/**
   202			 * If the host1x is not attached to an IOMMU, there is no need
   203			 * to map the buffer object for the host1x, since the physical
   204			 * address can simply be used.
   205			 */
   206			if (!iommu_get_domain_for_dev(host->dev))
   207				phys = &phys_addr;
   208			else
   209				phys = NULL;
   210	
   211			sgt = host1x_bo_pin(host->dev, g->bo, phys);
   212			if (IS_ERR(sgt)) {
   213				err = PTR_ERR(sgt);
   214				goto unpin;
   215			}
   216	
   217			if (!IS_ENABLED(CONFIG_TEGRA_HOST1X_FIREWALL) && host->domain) {
   218				for_each_sgtable_sg(sgt, sg, j)
   219					gather_size += sg->length;
   220				gather_size = iova_align(&host->iova, gather_size);
   221	
   222				shift = iova_shift(&host->iova);
   223				alloc = alloc_iova(&host->iova, gather_size >> shift,
   224						   host->iova_end >> shift, true);
   225				if (!alloc) {
   226					err = -ENOMEM;
   227					goto unpin;
   228				}
   229	
 > 230				err = iommu_map_sgtable(host->domain,
   231						iova_dma_addr(&host->iova, alloc),
   232						sgt, IOMMU_READ);
   233				if (err == 0) {
   234					__free_iova(&host->iova, alloc);
   235					err = -EINVAL;
   236					goto unpin;
   237				}
   238	
   239				job->unpins[job->num_unpins].size = gather_size;
   240				phys_addr = iova_dma_addr(&host->iova, alloc);
   241			} else if (sgt) {
   242				err = dma_map_sgtable(host->dev, sgt, DMA_TO_DEVICE, 0);
   243				if (err)
   244					goto unpin;
   245	
   246				job->unpins[job->num_unpins].dir = DMA_TO_DEVICE;
   247				job->unpins[job->num_unpins].dev = host->dev;
   248				phys_addr = sg_dma_address(sgt->sgl);
   249			}
   250	
   251			job->addr_phys[job->num_unpins] = phys_addr;
   252			job->gather_addr_phys[i] = phys_addr;
   253	
   254			job->unpins[job->num_unpins].bo = g->bo;
   255			job->unpins[job->num_unpins].sgt = sgt;
   256			job->num_unpins++;
   257		}
   258	
   259		return 0;
   260	
   261	unpin:
   262		host1x_job_unpin(job);
   263		return err;
   264	}
   265	

---
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: 35472 bytes --]

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

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

  reply	other threads:[~2020-06-21 14:48 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200619103652eucas1p203d684adff0faa672ff5c8d383b52f23@eucas1p2.samsung.com>
2020-06-19 10:36 ` [PATCH v7 00/36] DRM: fix struct sg_table nents vs. orig_nents misuse Marek Szyprowski
     [not found]   ` <CGME20200619103653eucas1p2542a7f42db61b22a43919666368dbbfa@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 01/36] drm: prime: add common helper to check scatterlist contiguity Marek Szyprowski
2020-07-07 14:30       ` Andrzej Hajda
2020-07-07 15:03         ` Andrzej Hajda
     [not found]   ` <CGME20200619103654eucas1p227a1d6926d008ef21ba4e0b68a8de210@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 02/36] drm: prime: use sgtable iterators in drm_prime_sg_to_page_addr_arrays() Marek Szyprowski
2020-07-07 14:41       ` Andrzej Hajda
     [not found]   ` <CGME20200619103655eucas1p1b01cbe67526e2b2f8254eb20ccac1858@eucas1p1.samsung.com>
2020-06-19 10:36     ` [PATCH v7 03/36] drm: core: fix common struct sg_table related issues Marek Szyprowski
2020-07-07 15:02       ` Andrzej Hajda
     [not found]   ` <CGME20200619103655eucas1p28ea4bf59428550217c8962666d6f077b@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 04/36] drm: amdgpu: " Marek Szyprowski
2020-06-22 13:27       ` Christian König
2020-07-07 13:06         ` Marek Szyprowski
     [not found]   ` <CGME20200619103656eucas1p262a08b701244745a547a0c38f26f83af@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 05/36] drm: armada: " Marek Szyprowski
     [not found]   ` <CGME20200619103657eucas1p2b7cec8f7b477c9574e2594ad6644a780@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 06/36] drm: etnaviv: " Marek Szyprowski
     [not found]   ` <CGME20200619103657eucas1p24bff92408adbd4715130fb47595a6187@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 07/36] drm: exynos: use common helper for a scatterlist contiguity check Marek Szyprowski
2020-07-07  9:35       ` Andrzej Hajda
2020-07-07 15:04         ` Andrzej Hajda
2020-07-14  0:28       ` Inki Dae
     [not found]   ` <CGME20200619103658eucas1p1c3236e2de2798c2d8c02279a9263e9a9@eucas1p1.samsung.com>
2020-06-19 10:36     ` [PATCH v7 08/36] drm: exynos: fix common struct sg_table related issues Marek Szyprowski
2020-07-07  9:40       ` Andrzej Hajda
2020-07-07 15:05         ` Andrzej Hajda
2020-07-14  0:27       ` Inki Dae
     [not found]   ` <CGME20200619103659eucas1p27ece9865ea4cdd82d4ca4df06edef7e6@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 09/36] drm: i915: " Marek Szyprowski
     [not found]   ` <CGME20200619103659eucas1p15d57f701ea85df16e953bfd5098423f6@eucas1p1.samsung.com>
2020-06-19 10:36     ` [PATCH v7 10/36] drm: lima: " Marek Szyprowski
     [not found]   ` <CGME20200619103700eucas1p13747c6a4d1a89f3cfc94a585ada9be4b@eucas1p1.samsung.com>
2020-06-19 10:36     ` [PATCH v7 11/36] drm: mediatek: use common helper for a scatterlist contiguity check Marek Szyprowski
     [not found]   ` <CGME20200619103701eucas1p2323797b812f4d8c28e851aa80938a8dc@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 12/36] drm: mediatek: use common helper for extracting pages array Marek Szyprowski
     [not found]   ` <CGME20200619103702eucas1p1c57147013bbac3968f6ba073caec68b5@eucas1p1.samsung.com>
2020-06-19 10:36     ` [PATCH v7 13/36] drm: msm: fix common struct sg_table related issues Marek Szyprowski
2020-06-19 14:45       ` Rob Clark
     [not found]   ` <CGME20200619103702eucas1p207b9cacc7460a334a0eda58c2b60a965@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 14/36] drm: omapdrm: use common helper for extracting pages array Marek Szyprowski
     [not found]   ` <CGME20200619103703eucas1p14faa1cec371efb0bf98ae696d58da64d@eucas1p1.samsung.com>
2020-06-19 10:36     ` [PATCH v7 15/36] drm: omapdrm: fix common struct sg_table related issues Marek Szyprowski
     [not found]   ` <CGME20200619103703eucas1p2b8b0e90f9559c3fff12d61f76b861cc1@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 16/36] drm: panfrost: " Marek Szyprowski
     [not found]   ` <CGME20200619103704eucas1p1bf233e8914507323499186d9ab742c09@eucas1p1.samsung.com>
2020-06-19 10:36     ` [PATCH v7 17/36] drm: radeon: " Marek Szyprowski
     [not found]   ` <CGME20200619103705eucas1p2d81a91b989d5aed5c7da6897173905cd@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 18/36] drm: rockchip: use common helper for a scatterlist contiguity check Marek Szyprowski
     [not found]   ` <CGME20200619103706eucas1p24f226bc00559f0812bc44d7933acd1e4@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 19/36] drm: rockchip: fix common struct sg_table related issues Marek Szyprowski
     [not found]   ` <CGME20200619103706eucas1p2b9a9926941e812db1111ec46a97695cd@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 20/36] drm: tegra: " Marek Szyprowski
     [not found]   ` <CGME20200619103707eucas1p1cdb34a10d5657bdd62fdf51fb7bf0146@eucas1p1.samsung.com>
2020-06-19 10:36     ` [PATCH v7 21/36] drm: v3d: " Marek Szyprowski
     [not found]   ` <CGME20200619103708eucas1p2207ebc9373b820797675b91060a2a597@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 22/36] drm: virtio: " Marek Szyprowski
     [not found]   ` <CGME20200619103708eucas1p230ca99e915e759bc0e93cd844c91b311@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 23/36] drm: vmwgfx: " Marek Szyprowski
     [not found]   ` <CGME20200619103709eucas1p12c32fa6377caf78e5dc28ce0ff51e7a0@eucas1p1.samsung.com>
2020-06-19 10:36     ` [PATCH v7 24/36] drm: xen: " Marek Szyprowski
     [not found]   ` <CGME20200619103710eucas1p1873c8ebb37e6717a5864c31d10b50efd@eucas1p1.samsung.com>
2020-06-19 10:36     ` [PATCH v7 25/36] xen: gntdev: " Marek Szyprowski
     [not found]   ` <CGME20200619103710eucas1p1160d521b10c9afdb8e447e261072bfd4@eucas1p1.samsung.com>
2020-06-19 10:36     ` [PATCH v7 26/36] drm: host1x: " Marek Szyprowski
2020-06-21 14:47       ` kernel test robot [this message]
     [not found]   ` <CGME20200619103711eucas1p188e07cb9aaad13d39238aac4fe84b10c@eucas1p1.samsung.com>
2020-06-19 10:36     ` [PATCH v7 27/36] drm: rcar-du: " Marek Szyprowski
     [not found]   ` <CGME20200619103712eucas1p1a29d1fe41061ed5b138a9cdd5d811419@eucas1p1.samsung.com>
2020-06-19 10:36     ` [PATCH v7 28/36] dmabuf: " Marek Szyprowski
     [not found]   ` <CGME20200619103713eucas1p2f4b6b66a376a72d1bf62ea6d92572045@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 29/36] staging: ion: remove dead code Marek Szyprowski
     [not found]   ` <CGME20200619103714eucas1p2bfc6c1d97d7913ad5988e3aaef8cc5ff@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 30/36] staging: ion: fix common struct sg_table related issues Marek Szyprowski
     [not found]   ` <CGME20200619103714eucas1p18db6efd1a380fc0bdb16174ee85036fa@eucas1p1.samsung.com>
2020-06-19 10:36     ` [PATCH v7 31/36] staging: tegra-vde: " Marek Szyprowski
2020-06-20 21:10       ` kernel test robot
2020-06-21  4:00       ` Dmitry Osipenko
2020-06-30 10:07         ` Marek Szyprowski
2020-07-01  1:45           ` Dmitry Osipenko
     [not found]   ` <CGME20200619103715eucas1p12d01355499fbecb8632472b1b8230e6f@eucas1p1.samsung.com>
2020-06-19 10:36     ` [PATCH v7 32/36] misc: fastrpc: " Marek Szyprowski
     [not found]   ` <CGME20200619103716eucas1p1b7c50f7b421fb29829050b9355e3e644@eucas1p1.samsung.com>
2020-06-19 10:36     ` [PATCH v7 33/36] rapidio: " Marek Szyprowski
2020-06-21  1:23       ` kernel test robot
2020-06-23 15:46       ` [kbuild] " Dan Carpenter
     [not found]       ` <CGME20200630084445eucas1p1e85857b5d046648578f1447f8ba521a5@eucas1p1.samsung.com>
2020-06-30  8:44         ` [PATCH v8] " Marek Szyprowski
     [not found]   ` <CGME20200619103716eucas1p28d6da172346acf044d3c1f213d9543ef@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 34/36] samples: vfio-mdev/mbochs: " Marek Szyprowski
     [not found]   ` <CGME20200619103717eucas1p23b82366794c92cc70c0492e4ca29c4a1@eucas1p2.samsung.com>
2020-06-19 10:36     ` [PATCH v7 35/36] media: pci: fix common ALSA DMA-mapping related codes Marek Szyprowski
     [not found]   ` <CGME20200619103718eucas1p11cd577b435672197f48bfcba2d06bc18@eucas1p1.samsung.com>
2020-06-19 10:36     ` [PATCH v7 36/36] videobuf2: use sgtable-based scatterlist wrappers Marek Szyprowski
     [not found]       ` <CGME20200630104527eucas1p13f19c24ff053556fb1fa7dc72be14c77@eucas1p1.samsung.com>
2020-06-30 10:45         ` [PATCH v8] " Marek Szyprowski
2020-06-30  8:49   ` [PATCH v7 00/36] DRM: fix struct sg_table nents vs. orig_nents misuse Marek Szyprowski

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=202006212216.jLr6uCUi%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=airlied@linux.ie \
    --cc=b.zolnierkie@samsung.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=robin.murphy@arm.com \
    --cc=thierry.reding@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).