Re: [PATCH 3/3] iommu: Enable compile testing for some of drivers

From: kbuild test robot
Date: Mon Dec 30 2019 - 20:09:30 EST


Hi Krzysztof,

I love your patch! Yet something to improve:

[auto build test ERROR on iommu/next]
[also build test ERROR on v5.5-rc4 next-20191219]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Krzysztof-Kozlowski/iommu-omap-Fix-pointer-cast-Wpointer-to-int-cast-warnings-on-64-bit/20191231-022212
base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=sparc64

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

All errors (new ones prefixed by >>):

drivers/gpu/drm/rockchip/rockchip_drm_gem.c: In function 'rockchip_gem_alloc_iommu':
>> drivers/gpu/drm/rockchip/rockchip_drm_gem.c:134:20: error: implicit declaration of function 'vmap'; did you mean 'bmap'? [-Werror=implicit-function-declaration]
rk_obj->kvaddr = vmap(rk_obj->pages, rk_obj->num_pages, VM_MAP,
^~~~
bmap
>> drivers/gpu/drm/rockchip/rockchip_drm_gem.c:134:59: error: 'VM_MAP' undeclared (first use in this function); did you mean 'VM_MPX'?
rk_obj->kvaddr = vmap(rk_obj->pages, rk_obj->num_pages, VM_MAP,
^~~~~~
VM_MPX
drivers/gpu/drm/rockchip/rockchip_drm_gem.c:134:59: note: each undeclared identifier is reported only once for each function it appears in
drivers/gpu/drm/rockchip/rockchip_drm_gem.c: In function 'rockchip_gem_free_iommu':
>> drivers/gpu/drm/rockchip/rockchip_drm_gem.c:190:2: error: implicit declaration of function 'vunmap'; did you mean 'iounmap'? [-Werror=implicit-function-declaration]
vunmap(rk_obj->kvaddr);
^~~~~~
iounmap
drivers/gpu/drm/rockchip/rockchip_drm_gem.c: In function 'rockchip_gem_prime_vmap':
drivers/gpu/drm/rockchip/rockchip_drm_gem.c:547:49: error: 'VM_MAP' undeclared (first use in this function); did you mean 'VM_MPX'?
return vmap(rk_obj->pages, rk_obj->num_pages, VM_MAP,
^~~~~~
VM_MPX
cc1: some warnings being treated as errors

vim +134 drivers/gpu/drm/rockchip/rockchip_drm_gem.c

38f993b7c59e26 Tomasz Figa 2016-06-24 119
38f993b7c59e26 Tomasz Figa 2016-06-24 120 static int rockchip_gem_alloc_iommu(struct rockchip_gem_object *rk_obj,
38f993b7c59e26 Tomasz Figa 2016-06-24 121 bool alloc_kmap)
38f993b7c59e26 Tomasz Figa 2016-06-24 122 {
38f993b7c59e26 Tomasz Figa 2016-06-24 123 int ret;
38f993b7c59e26 Tomasz Figa 2016-06-24 124
38f993b7c59e26 Tomasz Figa 2016-06-24 125 ret = rockchip_gem_get_pages(rk_obj);
38f993b7c59e26 Tomasz Figa 2016-06-24 126 if (ret < 0)
38f993b7c59e26 Tomasz Figa 2016-06-24 127 return ret;
38f993b7c59e26 Tomasz Figa 2016-06-24 128
38f993b7c59e26 Tomasz Figa 2016-06-24 129 ret = rockchip_gem_iommu_map(rk_obj);
38f993b7c59e26 Tomasz Figa 2016-06-24 130 if (ret < 0)
38f993b7c59e26 Tomasz Figa 2016-06-24 131 goto err_free;
38f993b7c59e26 Tomasz Figa 2016-06-24 132
38f993b7c59e26 Tomasz Figa 2016-06-24 133 if (alloc_kmap) {
38f993b7c59e26 Tomasz Figa 2016-06-24 @134 rk_obj->kvaddr = vmap(rk_obj->pages, rk_obj->num_pages, VM_MAP,
38f993b7c59e26 Tomasz Figa 2016-06-24 135 pgprot_writecombine(PAGE_KERNEL));
38f993b7c59e26 Tomasz Figa 2016-06-24 136 if (!rk_obj->kvaddr) {
38f993b7c59e26 Tomasz Figa 2016-06-24 137 DRM_ERROR("failed to vmap() buffer\n");
38f993b7c59e26 Tomasz Figa 2016-06-24 138 ret = -ENOMEM;
38f993b7c59e26 Tomasz Figa 2016-06-24 139 goto err_unmap;
38f993b7c59e26 Tomasz Figa 2016-06-24 140 }
38f993b7c59e26 Tomasz Figa 2016-06-24 141 }
38f993b7c59e26 Tomasz Figa 2016-06-24 142
38f993b7c59e26 Tomasz Figa 2016-06-24 143 return 0;
38f993b7c59e26 Tomasz Figa 2016-06-24 144
38f993b7c59e26 Tomasz Figa 2016-06-24 145 err_unmap:
38f993b7c59e26 Tomasz Figa 2016-06-24 146 rockchip_gem_iommu_unmap(rk_obj);
38f993b7c59e26 Tomasz Figa 2016-06-24 147 err_free:
38f993b7c59e26 Tomasz Figa 2016-06-24 148 rockchip_gem_put_pages(rk_obj);
38f993b7c59e26 Tomasz Figa 2016-06-24 149
38f993b7c59e26 Tomasz Figa 2016-06-24 150 return ret;
38f993b7c59e26 Tomasz Figa 2016-06-24 151 }
38f993b7c59e26 Tomasz Figa 2016-06-24 152
38f993b7c59e26 Tomasz Figa 2016-06-24 153 static int rockchip_gem_alloc_dma(struct rockchip_gem_object *rk_obj,
f76c83b580043d Daniel Kurtz 2015-01-12 154 bool alloc_kmap)
2048e3286f347d Mark Yao 2014-08-22 155 {
2048e3286f347d Mark Yao 2014-08-22 156 struct drm_gem_object *obj = &rk_obj->base;
2048e3286f347d Mark Yao 2014-08-22 157 struct drm_device *drm = obj->dev;
2048e3286f347d Mark Yao 2014-08-22 158
00085f1efa387a Krzysztof Kozlowski 2016-08-03 159 rk_obj->dma_attrs = DMA_ATTR_WRITE_COMBINE;
2048e3286f347d Mark Yao 2014-08-22 160
f76c83b580043d Daniel Kurtz 2015-01-12 161 if (!alloc_kmap)
00085f1efa387a Krzysztof Kozlowski 2016-08-03 162 rk_obj->dma_attrs |= DMA_ATTR_NO_KERNEL_MAPPING;
f76c83b580043d Daniel Kurtz 2015-01-12 163
2048e3286f347d Mark Yao 2014-08-22 164 rk_obj->kvaddr = dma_alloc_attrs(drm->dev, obj->size,
2048e3286f347d Mark Yao 2014-08-22 165 &rk_obj->dma_addr, GFP_KERNEL,
00085f1efa387a Krzysztof Kozlowski 2016-08-03 166 rk_obj->dma_attrs);
4b9a90c0b374f8 Daniel Kurtz 2015-01-07 167 if (!rk_obj->kvaddr) {
913bb40a45f18f Brian Norris 2016-06-09 168 DRM_ERROR("failed to allocate %zu byte dma buffer", obj->size);
4b9a90c0b374f8 Daniel Kurtz 2015-01-07 169 return -ENOMEM;
2048e3286f347d Mark Yao 2014-08-22 170 }
2048e3286f347d Mark Yao 2014-08-22 171
2048e3286f347d Mark Yao 2014-08-22 172 return 0;
2048e3286f347d Mark Yao 2014-08-22 173 }
2048e3286f347d Mark Yao 2014-08-22 174
38f993b7c59e26 Tomasz Figa 2016-06-24 175 static int rockchip_gem_alloc_buf(struct rockchip_gem_object *rk_obj,
38f993b7c59e26 Tomasz Figa 2016-06-24 176 bool alloc_kmap)
38f993b7c59e26 Tomasz Figa 2016-06-24 177 {
38f993b7c59e26 Tomasz Figa 2016-06-24 178 struct drm_gem_object *obj = &rk_obj->base;
38f993b7c59e26 Tomasz Figa 2016-06-24 179 struct drm_device *drm = obj->dev;
38f993b7c59e26 Tomasz Figa 2016-06-24 180 struct rockchip_drm_private *private = drm->dev_private;
38f993b7c59e26 Tomasz Figa 2016-06-24 181
38f993b7c59e26 Tomasz Figa 2016-06-24 182 if (private->domain)
38f993b7c59e26 Tomasz Figa 2016-06-24 183 return rockchip_gem_alloc_iommu(rk_obj, alloc_kmap);
38f993b7c59e26 Tomasz Figa 2016-06-24 184 else
38f993b7c59e26 Tomasz Figa 2016-06-24 185 return rockchip_gem_alloc_dma(rk_obj, alloc_kmap);
38f993b7c59e26 Tomasz Figa 2016-06-24 186 }
38f993b7c59e26 Tomasz Figa 2016-06-24 187
38f993b7c59e26 Tomasz Figa 2016-06-24 188 static void rockchip_gem_free_iommu(struct rockchip_gem_object *rk_obj)
38f993b7c59e26 Tomasz Figa 2016-06-24 189 {
38f993b7c59e26 Tomasz Figa 2016-06-24 @190 vunmap(rk_obj->kvaddr);
38f993b7c59e26 Tomasz Figa 2016-06-24 191 rockchip_gem_iommu_unmap(rk_obj);
38f993b7c59e26 Tomasz Figa 2016-06-24 192 rockchip_gem_put_pages(rk_obj);
38f993b7c59e26 Tomasz Figa 2016-06-24 193 }
38f993b7c59e26 Tomasz Figa 2016-06-24 194

:::::: The code at line 134 was first introduced by commit
:::::: 38f993b7c59e261b8ff7deb66c96c7dff4017f7b drm/rockchip: Do not use DMA mapping API if attached to IOMMU domain

:::::: TO: Tomasz Figa <tfiga@xxxxxxxxxxxx>
:::::: CC: Mark Yao <mark.yao@xxxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation

Attachment: .config.gz
Description: application/gzip