From: kernel test robot <lkp@intel.com>
To: Chunyan Zhang <zhang.lyra@gmail.com>,
Joerg Roedel <joro@8bytes.org>, Rob Herring <robh+dt@kernel.org>,
Robin Murphy <robin.murphy@arm.com>
Cc: devicetree@vger.kernel.org, kbuild-all@lists.01.org,
Chunyan Zhang <zhang.lyra@gmail.com>,
linux-kernel@vger.kernel.org, Sheng Xu <sheng.xu@unisoc.com>,
iommu@lists.linux-foundation.org,
Baolin Wang <baolin.wang7@gmail.com>,
Orson Zhai <orsonzhai@gmail.com>
Subject: Re: [PATCH v1 2/2] iommu: add Unisoc iommu basic driver
Date: Thu, 21 Jan 2021 23:47:38 +0800 [thread overview]
Message-ID: <202101212325.htjodGe2-lkp@intel.com> (raw)
In-Reply-To: <20210121112349.421464-3-zhang.lyra@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 7053 bytes --]
Hi Chunyan,
I love your patch! Perhaps something to improve:
[auto build test WARNING on robh/for-next]
[also build test WARNING on v5.11-rc4 next-20210121]
[cannot apply to iommu/next]
[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/Chunyan-Zhang/Add-Unisoc-iommu-basic-driver/20210121-194023
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
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
# https://github.com/0day-ci/linux/commit/891db11d7229149235a02e5bc31a61188243a5d7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chunyan-Zhang/Add-Unisoc-iommu-basic-driver/20210121-194023
git checkout 891db11d7229149235a02e5bc31a61188243a5d7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/iommu/sprd-iommu.c: In function 'sprd_iommu_attach_device':
drivers/iommu/sprd-iommu.c:248:16: error: implicit declaration of function 'dma_alloc_coherent' [-Werror=implicit-function-declaration]
248 | dom->pgt_va = dma_alloc_coherent(sdev->dev, pgt_size, &dom->pgt_pa, GFP_KERNEL);
| ^~~~~~~~~~~~~~~~~~
>> drivers/iommu/sprd-iommu.c:248:14: warning: assignment to 'u32 *' {aka 'unsigned int *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
248 | dom->pgt_va = dma_alloc_coherent(sdev->dev, pgt_size, &dom->pgt_pa, GFP_KERNEL);
| ^
drivers/iommu/sprd-iommu.c: In function 'sprd_iommu_detach_device':
drivers/iommu/sprd-iommu.c:270:2: error: implicit declaration of function 'dma_free_coherent' [-Werror=implicit-function-declaration]
270 | dma_free_coherent(sdev->dev, pgt_size, dom->pgt_va, dom->pgt_pa);
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/device.h:15,
from drivers/iommu/sprd-iommu.c:10:
drivers/iommu/sprd-iommu.c: In function 'sprd_iommu_map':
>> drivers/iommu/sprd-iommu.c:296:27: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
296 | dev_err(dom->sdev->dev, "(iova(0x%lx) + sixe(0x%lx)) are not in the range!\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/iommu/sprd-iommu.c:296:3: note: in expansion of macro 'dev_err'
296 | dev_err(dom->sdev->dev, "(iova(0x%lx) + sixe(0x%lx)) are not in the range!\n",
| ^~~~~~~
drivers/iommu/sprd-iommu.c:296:52: note: format string is defined here
296 | dev_err(dom->sdev->dev, "(iova(0x%lx) + sixe(0x%lx)) are not in the range!\n",
| ~~^
| |
| long unsigned int
| %x
>> drivers/iommu/sprd-iommu.c:279:38: warning: variable 'mdata' set but not used [-Wunused-but-set-variable]
279 | const struct sprd_iommu_match_data *mdata;
| ^~~~~
drivers/iommu/sprd-iommu.c: In function 'sprd_iommu_probe':
drivers/iommu/sprd-iommu.c:483:21: warning: assignment to 'u32 *' {aka 'unsigned int *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
483 | sdev->prot_page_va = dma_alloc_coherent(dev, SPRD_IOMMU_PAGE_SIZE,
| ^
cc1: some warnings being treated as errors
vim +248 drivers/iommu/sprd-iommu.c
240
241 static int sprd_iommu_attach_device(struct iommu_domain *domain,
242 struct device *dev)
243 {
244 struct sprd_iommu_device *sdev = dev_iommu_priv_get(dev);
245 struct sprd_iommu_domain *dom = to_sprd_domain(domain);
246 size_t pgt_size = sprd_iommu_pgt_size(domain);
247
> 248 dom->pgt_va = dma_alloc_coherent(sdev->dev, pgt_size, &dom->pgt_pa, GFP_KERNEL);
249 if (!dom->pgt_va)
250 return -ENOMEM;
251
252 dom->sdev = sdev;
253
254 sprd_iommu_first_ppn(dom);
255 sprd_iommu_first_vpn(dom);
256 sprd_iommu_vpn_range(dom);
257 sprd_iommu_default_ppn(sdev);
258 sprd_iommu_hw_en(sdev, true);
259
260 return 0;
261 }
262
263 static void sprd_iommu_detach_device(struct iommu_domain *domain,
264 struct device *dev)
265 {
266 struct sprd_iommu_domain *dom = to_sprd_domain(domain);
267 struct sprd_iommu_device *sdev = dom->sdev;
268 size_t pgt_size = sprd_iommu_pgt_size(domain);
269
270 dma_free_coherent(sdev->dev, pgt_size, dom->pgt_va, dom->pgt_pa);
271 sprd_iommu_hw_en(sdev, false);
272 dom->sdev = NULL;
273 }
274
275 static int sprd_iommu_map(struct iommu_domain *domain, unsigned long iova,
276 phys_addr_t paddr, size_t size, int prot, gfp_t gfp)
277 {
278 struct sprd_iommu_domain *dom = to_sprd_domain(domain);
> 279 const struct sprd_iommu_match_data *mdata;
280 unsigned int page_num = size >> SPRD_IOMMU_PAGE_SHIFT;
281 unsigned long flags;
282 unsigned int i;
283 u32 *pgt_base_iova;
284 u32 pabase = (u32)paddr;
285 int map_size = 0;
286 unsigned long start = domain->geometry.aperture_start;
287 unsigned long end = domain->geometry.aperture_end;
288
289 if (!dom->sdev) {
290 pr_err("No sprd_iommu_device attached to the domain\n");
291 return -EINVAL;
292 }
293
294 mdata = dom->sdev->mdata;
295 if (iova < start || (iova + size) > (end + 1)) {
> 296 dev_err(dom->sdev->dev, "(iova(0x%lx) + sixe(0x%lx)) are not in the range!\n",
297 iova, size);
298 return -EINVAL;
299 }
300
301 pgt_base_iova = dom->pgt_va + ((iova - start) >> SPRD_IOMMU_PAGE_SHIFT);
302
303 spin_lock_irqsave(&dom->pgtlock, flags);
304 for (i = 0; i < page_num; i++) {
305 pgt_base_iova[i] = pabase >> SPRD_IOMMU_PAGE_SHIFT;
306 pabase += SPRD_IOMMU_PAGE_SIZE;
307 map_size += SPRD_IOMMU_PAGE_SIZE;
308 }
309 spin_unlock_irqrestore(&dom->pgtlock, flags);
310
311 return map_size == size ? 0 : -EEXIST;
312 }
313
---
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: 67240 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 v1 2/2] iommu: add Unisoc iommu basic driver
Date: Thu, 21 Jan 2021 23:47:38 +0800 [thread overview]
Message-ID: <202101212325.htjodGe2-lkp@intel.com> (raw)
In-Reply-To: <20210121112349.421464-3-zhang.lyra@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 7204 bytes --]
Hi Chunyan,
I love your patch! Perhaps something to improve:
[auto build test WARNING on robh/for-next]
[also build test WARNING on v5.11-rc4 next-20210121]
[cannot apply to iommu/next]
[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/Chunyan-Zhang/Add-Unisoc-iommu-basic-driver/20210121-194023
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
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
# https://github.com/0day-ci/linux/commit/891db11d7229149235a02e5bc31a61188243a5d7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chunyan-Zhang/Add-Unisoc-iommu-basic-driver/20210121-194023
git checkout 891db11d7229149235a02e5bc31a61188243a5d7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/iommu/sprd-iommu.c: In function 'sprd_iommu_attach_device':
drivers/iommu/sprd-iommu.c:248:16: error: implicit declaration of function 'dma_alloc_coherent' [-Werror=implicit-function-declaration]
248 | dom->pgt_va = dma_alloc_coherent(sdev->dev, pgt_size, &dom->pgt_pa, GFP_KERNEL);
| ^~~~~~~~~~~~~~~~~~
>> drivers/iommu/sprd-iommu.c:248:14: warning: assignment to 'u32 *' {aka 'unsigned int *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
248 | dom->pgt_va = dma_alloc_coherent(sdev->dev, pgt_size, &dom->pgt_pa, GFP_KERNEL);
| ^
drivers/iommu/sprd-iommu.c: In function 'sprd_iommu_detach_device':
drivers/iommu/sprd-iommu.c:270:2: error: implicit declaration of function 'dma_free_coherent' [-Werror=implicit-function-declaration]
270 | dma_free_coherent(sdev->dev, pgt_size, dom->pgt_va, dom->pgt_pa);
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/device.h:15,
from drivers/iommu/sprd-iommu.c:10:
drivers/iommu/sprd-iommu.c: In function 'sprd_iommu_map':
>> drivers/iommu/sprd-iommu.c:296:27: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
296 | dev_err(dom->sdev->dev, "(iova(0x%lx) + sixe(0x%lx)) are not in the range!\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/iommu/sprd-iommu.c:296:3: note: in expansion of macro 'dev_err'
296 | dev_err(dom->sdev->dev, "(iova(0x%lx) + sixe(0x%lx)) are not in the range!\n",
| ^~~~~~~
drivers/iommu/sprd-iommu.c:296:52: note: format string is defined here
296 | dev_err(dom->sdev->dev, "(iova(0x%lx) + sixe(0x%lx)) are not in the range!\n",
| ~~^
| |
| long unsigned int
| %x
>> drivers/iommu/sprd-iommu.c:279:38: warning: variable 'mdata' set but not used [-Wunused-but-set-variable]
279 | const struct sprd_iommu_match_data *mdata;
| ^~~~~
drivers/iommu/sprd-iommu.c: In function 'sprd_iommu_probe':
drivers/iommu/sprd-iommu.c:483:21: warning: assignment to 'u32 *' {aka 'unsigned int *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
483 | sdev->prot_page_va = dma_alloc_coherent(dev, SPRD_IOMMU_PAGE_SIZE,
| ^
cc1: some warnings being treated as errors
vim +248 drivers/iommu/sprd-iommu.c
240
241 static int sprd_iommu_attach_device(struct iommu_domain *domain,
242 struct device *dev)
243 {
244 struct sprd_iommu_device *sdev = dev_iommu_priv_get(dev);
245 struct sprd_iommu_domain *dom = to_sprd_domain(domain);
246 size_t pgt_size = sprd_iommu_pgt_size(domain);
247
> 248 dom->pgt_va = dma_alloc_coherent(sdev->dev, pgt_size, &dom->pgt_pa, GFP_KERNEL);
249 if (!dom->pgt_va)
250 return -ENOMEM;
251
252 dom->sdev = sdev;
253
254 sprd_iommu_first_ppn(dom);
255 sprd_iommu_first_vpn(dom);
256 sprd_iommu_vpn_range(dom);
257 sprd_iommu_default_ppn(sdev);
258 sprd_iommu_hw_en(sdev, true);
259
260 return 0;
261 }
262
263 static void sprd_iommu_detach_device(struct iommu_domain *domain,
264 struct device *dev)
265 {
266 struct sprd_iommu_domain *dom = to_sprd_domain(domain);
267 struct sprd_iommu_device *sdev = dom->sdev;
268 size_t pgt_size = sprd_iommu_pgt_size(domain);
269
270 dma_free_coherent(sdev->dev, pgt_size, dom->pgt_va, dom->pgt_pa);
271 sprd_iommu_hw_en(sdev, false);
272 dom->sdev = NULL;
273 }
274
275 static int sprd_iommu_map(struct iommu_domain *domain, unsigned long iova,
276 phys_addr_t paddr, size_t size, int prot, gfp_t gfp)
277 {
278 struct sprd_iommu_domain *dom = to_sprd_domain(domain);
> 279 const struct sprd_iommu_match_data *mdata;
280 unsigned int page_num = size >> SPRD_IOMMU_PAGE_SHIFT;
281 unsigned long flags;
282 unsigned int i;
283 u32 *pgt_base_iova;
284 u32 pabase = (u32)paddr;
285 int map_size = 0;
286 unsigned long start = domain->geometry.aperture_start;
287 unsigned long end = domain->geometry.aperture_end;
288
289 if (!dom->sdev) {
290 pr_err("No sprd_iommu_device attached to the domain\n");
291 return -EINVAL;
292 }
293
294 mdata = dom->sdev->mdata;
295 if (iova < start || (iova + size) > (end + 1)) {
> 296 dev_err(dom->sdev->dev, "(iova(0x%lx) + sixe(0x%lx)) are not in the range!\n",
297 iova, size);
298 return -EINVAL;
299 }
300
301 pgt_base_iova = dom->pgt_va + ((iova - start) >> SPRD_IOMMU_PAGE_SHIFT);
302
303 spin_lock_irqsave(&dom->pgtlock, flags);
304 for (i = 0; i < page_num; i++) {
305 pgt_base_iova[i] = pabase >> SPRD_IOMMU_PAGE_SHIFT;
306 pabase += SPRD_IOMMU_PAGE_SIZE;
307 map_size += SPRD_IOMMU_PAGE_SIZE;
308 }
309 spin_unlock_irqrestore(&dom->pgtlock, flags);
310
311 return map_size == size ? 0 : -EEXIST;
312 }
313
---
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: 67240 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Chunyan Zhang <zhang.lyra@gmail.com>,
Joerg Roedel <joro@8bytes.org>, Rob Herring <robh+dt@kernel.org>,
Robin Murphy <robin.murphy@arm.com>
Cc: kbuild-all@lists.01.org, iommu@lists.linux-foundation.org,
devicetree@vger.kernel.org, Baolin Wang <baolin.wang7@gmail.com>,
linux-kernel@vger.kernel.org, Orson Zhai <orsonzhai@gmail.com>,
Chunyan Zhang <zhang.lyra@gmail.com>,
Sheng Xu <sheng.xu@unisoc.com>
Subject: Re: [PATCH v1 2/2] iommu: add Unisoc iommu basic driver
Date: Thu, 21 Jan 2021 23:47:38 +0800 [thread overview]
Message-ID: <202101212325.htjodGe2-lkp@intel.com> (raw)
In-Reply-To: <20210121112349.421464-3-zhang.lyra@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 7053 bytes --]
Hi Chunyan,
I love your patch! Perhaps something to improve:
[auto build test WARNING on robh/for-next]
[also build test WARNING on v5.11-rc4 next-20210121]
[cannot apply to iommu/next]
[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/Chunyan-Zhang/Add-Unisoc-iommu-basic-driver/20210121-194023
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
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
# https://github.com/0day-ci/linux/commit/891db11d7229149235a02e5bc31a61188243a5d7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chunyan-Zhang/Add-Unisoc-iommu-basic-driver/20210121-194023
git checkout 891db11d7229149235a02e5bc31a61188243a5d7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/iommu/sprd-iommu.c: In function 'sprd_iommu_attach_device':
drivers/iommu/sprd-iommu.c:248:16: error: implicit declaration of function 'dma_alloc_coherent' [-Werror=implicit-function-declaration]
248 | dom->pgt_va = dma_alloc_coherent(sdev->dev, pgt_size, &dom->pgt_pa, GFP_KERNEL);
| ^~~~~~~~~~~~~~~~~~
>> drivers/iommu/sprd-iommu.c:248:14: warning: assignment to 'u32 *' {aka 'unsigned int *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
248 | dom->pgt_va = dma_alloc_coherent(sdev->dev, pgt_size, &dom->pgt_pa, GFP_KERNEL);
| ^
drivers/iommu/sprd-iommu.c: In function 'sprd_iommu_detach_device':
drivers/iommu/sprd-iommu.c:270:2: error: implicit declaration of function 'dma_free_coherent' [-Werror=implicit-function-declaration]
270 | dma_free_coherent(sdev->dev, pgt_size, dom->pgt_va, dom->pgt_pa);
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/device.h:15,
from drivers/iommu/sprd-iommu.c:10:
drivers/iommu/sprd-iommu.c: In function 'sprd_iommu_map':
>> drivers/iommu/sprd-iommu.c:296:27: warning: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
296 | dev_err(dom->sdev->dev, "(iova(0x%lx) + sixe(0x%lx)) are not in the range!\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/iommu/sprd-iommu.c:296:3: note: in expansion of macro 'dev_err'
296 | dev_err(dom->sdev->dev, "(iova(0x%lx) + sixe(0x%lx)) are not in the range!\n",
| ^~~~~~~
drivers/iommu/sprd-iommu.c:296:52: note: format string is defined here
296 | dev_err(dom->sdev->dev, "(iova(0x%lx) + sixe(0x%lx)) are not in the range!\n",
| ~~^
| |
| long unsigned int
| %x
>> drivers/iommu/sprd-iommu.c:279:38: warning: variable 'mdata' set but not used [-Wunused-but-set-variable]
279 | const struct sprd_iommu_match_data *mdata;
| ^~~~~
drivers/iommu/sprd-iommu.c: In function 'sprd_iommu_probe':
drivers/iommu/sprd-iommu.c:483:21: warning: assignment to 'u32 *' {aka 'unsigned int *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
483 | sdev->prot_page_va = dma_alloc_coherent(dev, SPRD_IOMMU_PAGE_SIZE,
| ^
cc1: some warnings being treated as errors
vim +248 drivers/iommu/sprd-iommu.c
240
241 static int sprd_iommu_attach_device(struct iommu_domain *domain,
242 struct device *dev)
243 {
244 struct sprd_iommu_device *sdev = dev_iommu_priv_get(dev);
245 struct sprd_iommu_domain *dom = to_sprd_domain(domain);
246 size_t pgt_size = sprd_iommu_pgt_size(domain);
247
> 248 dom->pgt_va = dma_alloc_coherent(sdev->dev, pgt_size, &dom->pgt_pa, GFP_KERNEL);
249 if (!dom->pgt_va)
250 return -ENOMEM;
251
252 dom->sdev = sdev;
253
254 sprd_iommu_first_ppn(dom);
255 sprd_iommu_first_vpn(dom);
256 sprd_iommu_vpn_range(dom);
257 sprd_iommu_default_ppn(sdev);
258 sprd_iommu_hw_en(sdev, true);
259
260 return 0;
261 }
262
263 static void sprd_iommu_detach_device(struct iommu_domain *domain,
264 struct device *dev)
265 {
266 struct sprd_iommu_domain *dom = to_sprd_domain(domain);
267 struct sprd_iommu_device *sdev = dom->sdev;
268 size_t pgt_size = sprd_iommu_pgt_size(domain);
269
270 dma_free_coherent(sdev->dev, pgt_size, dom->pgt_va, dom->pgt_pa);
271 sprd_iommu_hw_en(sdev, false);
272 dom->sdev = NULL;
273 }
274
275 static int sprd_iommu_map(struct iommu_domain *domain, unsigned long iova,
276 phys_addr_t paddr, size_t size, int prot, gfp_t gfp)
277 {
278 struct sprd_iommu_domain *dom = to_sprd_domain(domain);
> 279 const struct sprd_iommu_match_data *mdata;
280 unsigned int page_num = size >> SPRD_IOMMU_PAGE_SHIFT;
281 unsigned long flags;
282 unsigned int i;
283 u32 *pgt_base_iova;
284 u32 pabase = (u32)paddr;
285 int map_size = 0;
286 unsigned long start = domain->geometry.aperture_start;
287 unsigned long end = domain->geometry.aperture_end;
288
289 if (!dom->sdev) {
290 pr_err("No sprd_iommu_device attached to the domain\n");
291 return -EINVAL;
292 }
293
294 mdata = dom->sdev->mdata;
295 if (iova < start || (iova + size) > (end + 1)) {
> 296 dev_err(dom->sdev->dev, "(iova(0x%lx) + sixe(0x%lx)) are not in the range!\n",
297 iova, size);
298 return -EINVAL;
299 }
300
301 pgt_base_iova = dom->pgt_va + ((iova - start) >> SPRD_IOMMU_PAGE_SHIFT);
302
303 spin_lock_irqsave(&dom->pgtlock, flags);
304 for (i = 0; i < page_num; i++) {
305 pgt_base_iova[i] = pabase >> SPRD_IOMMU_PAGE_SHIFT;
306 pabase += SPRD_IOMMU_PAGE_SIZE;
307 map_size += SPRD_IOMMU_PAGE_SIZE;
308 }
309 spin_unlock_irqrestore(&dom->pgtlock, flags);
310
311 return map_size == size ? 0 : -EEXIST;
312 }
313
---
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: 67240 bytes --]
next prev parent reply other threads:[~2021-01-21 15:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-21 11:23 [PATCH v1 0/2] Add Unisoc iommu basic driver Chunyan Zhang
2021-01-21 11:23 ` Chunyan Zhang
2021-01-21 11:23 ` [PATCH v1 1/2] dt-bindings: iommu: add bindings for sprd iommu Chunyan Zhang
2021-01-21 11:23 ` Chunyan Zhang
2021-01-21 11:23 ` [PATCH v1 2/2] iommu: add Unisoc iommu basic driver Chunyan Zhang
2021-01-21 11:23 ` Chunyan Zhang
2021-01-21 15:47 ` kernel test robot [this message]
2021-01-21 15:47 ` kernel test robot
2021-01-21 15:47 ` kernel test robot
2021-01-21 18:43 ` kernel test robot
2021-01-21 18:43 ` kernel test robot
2021-01-21 18:43 ` kernel test robot
2021-01-21 21:46 ` Robin Murphy
2021-01-21 21:46 ` Robin Murphy
2021-01-27 12:21 ` Chunyan Zhang
2021-01-27 12:21 ` Chunyan Zhang
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=202101212325.htjodGe2-lkp@intel.com \
--to=lkp@intel.com \
--cc=baolin.wang7@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=orsonzhai@gmail.com \
--cc=robh+dt@kernel.org \
--cc=robin.murphy@arm.com \
--cc=sheng.xu@unisoc.com \
--cc=zhang.lyra@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 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.