drivers/gpu/drm/drm_gem.c:1113:22: error: implicit declaration of function 'pgprot_writecombine'

From: kbuild test robot
Date: Tue Dec 10 2019 - 10:22:08 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 6794862a16ef41f753abd75c03a152836e4c8028
commit: 212836a9929f0c91214a8a1879e6e41be0e26a6f dma-mapping: remove dma_{alloc,free,mmap}_writecombine
date: 3 months ago
config: m68k-randconfig-a001-20191210 (attached as .config)
compiler: m68k-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
git checkout 212836a9929f0c91214a8a1879e6e41be0e26a6f
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=m68k

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/drm_gem.c: In function 'drm_gem_mmap_obj':
>> drivers/gpu/drm/drm_gem.c:1113:22: error: implicit declaration of function 'pgprot_writecombine' [-Werror=implicit-function-declaration]
vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
^~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/drm_gem.c:1113:20: error: incompatible types when assigning to type 'pgprot_t {aka struct <anonymous>}' from type 'int'
vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
^
cc1: some warnings being treated as errors
--
drivers/gpu/drm/udl/udl_gem.c: In function 'update_vm_cache_attr':
>> drivers/gpu/drm/udl/udl_gem.c:67:4: error: implicit declaration of function 'pgprot_writecombine' [-Werror=implicit-function-declaration]
pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
^~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/udl/udl_gem.c:66:21: error: incompatible types when assigning to type 'pgprot_t {aka struct <anonymous>}' from type 'int'
vma->vm_page_prot =
^
drivers/gpu/drm/udl/udl_gem.c:70:4: error: implicit declaration of function 'pgprot_noncached'; did you mean 'pgprot_encrypted'? [-Werror=implicit-function-declaration]
pgprot_noncached(vm_get_page_prot(vma->vm_flags));
^~~~~~~~~~~~~~~~
pgprot_encrypted
drivers/gpu/drm/udl/udl_gem.c:69:21: error: incompatible types when assigning to type 'pgprot_t {aka struct <anonymous>}' from type 'int'
vma->vm_page_prot =
^
cc1: some warnings being treated as errors
--
drivers/gpu/drm/vgem/vgem_drv.c: In function 'vgem_prime_vmap':
>> drivers/gpu/drm/vgem/vgem_drv.c:385:33: error: implicit declaration of function 'pgprot_writecombine' [-Werror=implicit-function-declaration]
return vmap(pages, n_pages, 0, pgprot_writecombine(PAGE_KERNEL));
^~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/vgem/vgem_drv.c:385:33: error: incompatible type for argument 4 of 'vmap'
In file included from include/asm-generic/io.h:887:0,
from arch/m68k/include/asm/io.h:11,
from include/linux/io.h:13,
from include/linux/irq.h:20,
from include/asm-generic/hardirq.h:13,
from arch/m68k/include/asm/hardirq.h:25,
from include/linux/hardirq.h:9,
from include/linux/interrupt.h:11,
from include/linux/kernel_stat.h:9,
from include/linux/cgroup.h:26,
from include/linux/memcontrol.h:13,
from include/linux/swap.h:9,
from include/linux/shmem_fs.h:6,
from drivers/gpu/drm/vgem/vgem_drv.c:35:
include/linux/vmalloc.h:111:14: note: expected 'pgprot_t {aka struct <anonymous>}' but argument is of type 'int'
extern void *vmap(struct page **pages, unsigned int count,
^~~~
drivers/gpu/drm/vgem/vgem_drv.c: In function 'vgem_prime_mmap':
drivers/gpu/drm/vgem/vgem_drv.c:414:20: error: incompatible types when assigning to type 'pgprot_t {aka struct <anonymous>}' from type 'int'
vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
^
drivers/gpu/drm/vgem/vgem_drv.c: In function 'vgem_prime_vmap':
drivers/gpu/drm/vgem/vgem_drv.c:386:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
cc1: some warnings being treated as errors

vim +/pgprot_writecombine +1113 drivers/gpu/drm/drm_gem.c

ab00b3e5210954 Jesse Barnes 2009-02-11 1070
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1071 /**
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1072 * drm_gem_mmap_obj - memory map a GEM object
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1073 * @obj: the GEM object to map
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1074 * @obj_size: the object size to be mapped, in bytes
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1075 * @vma: VMA for the area to be mapped
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1076 *
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1077 * Set up the VMA to prepare mapping of the GEM object using the gem_vm_ops
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1078 * provided by the driver. Depending on their requirements, drivers can either
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1079 * provide a fault handler in their gem_vm_ops (in which case any accesses to
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1080 * the object will be trapped, to perform migration, GTT binding, surface
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1081 * register allocation, or performance monitoring), or mmap the buffer memory
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1082 * synchronously after calling drm_gem_mmap_obj.
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1083 *
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1084 * This function is mainly intended to implement the DMABUF mmap operation, when
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1085 * the GEM object is not looked up based on its fake offset. To implement the
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1086 * DRM mmap operation, drivers should use the drm_gem_mmap() function.
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1087 *
ca481c9b2a3ae3 David Herrmann 2013-08-25 1088 * drm_gem_mmap_obj() assumes the user is granted access to the buffer while
ca481c9b2a3ae3 David Herrmann 2013-08-25 1089 * drm_gem_mmap() prevents unprivileged users from mapping random objects. So
ca481c9b2a3ae3 David Herrmann 2013-08-25 1090 * callers must verify access restrictions before calling this helper.
ca481c9b2a3ae3 David Herrmann 2013-08-25 1091 *
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1092 * Return 0 or success or -EINVAL if the object size is smaller than the VMA
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1093 * size, or if no gem_vm_ops are provided.
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1094 */
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1095 int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1096 struct vm_area_struct *vma)
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1097 {
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1098 struct drm_device *dev = obj->dev;
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1099
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1100 /* Check for valid size. */
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1101 if (obj_size < vma->vm_end - vma->vm_start)
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1102 return -EINVAL;
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1103
b39b5394fabc79 Noralf Trønnes 2018-11-10 1104 if (obj->funcs && obj->funcs->vm_ops)
b39b5394fabc79 Noralf Trønnes 2018-11-10 1105 vma->vm_ops = obj->funcs->vm_ops;
b39b5394fabc79 Noralf Trønnes 2018-11-10 1106 else if (dev->driver->gem_vm_ops)
b39b5394fabc79 Noralf Trønnes 2018-11-10 1107 vma->vm_ops = dev->driver->gem_vm_ops;
b39b5394fabc79 Noralf Trønnes 2018-11-10 1108 else
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1109 return -EINVAL;
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1110
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1111 vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP;
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1112 vma->vm_private_data = obj;
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 @1113 vma->vm_page_prot = pgprot_writecombine(vm_get_page_prot(vma->vm_flags));
95cf9264d5f36c Tom Lendacky 2017-07-17 1114 vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot);
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1115
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1116 /* Take a ref for this mapping of the object, so that the fault
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1117 * handler can dereference the mmap offset's pointer to the object.
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1118 * This reference is cleaned up by the corresponding vm_close
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1119 * (which should happen whether the vma was created by this call, or
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1120 * by a vm_open due to mremap or partial unmap or whatever).
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1121 */
e6b62714e87c88 Thierry Reding 2017-02-28 1122 drm_gem_object_get(obj);
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1123
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1124 return 0;
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1125 }
1c5aafa6eee2d5 Laurent Pinchart 2013-04-16 1126 EXPORT_SYMBOL(drm_gem_mmap_obj);
ab00b3e5210954 Jesse Barnes 2009-02-11 1127

:::::: The code at line 1113 was first introduced by commit
:::::: 1c5aafa6eee2d5712f774676d407e5ab6dae9a1b drm/gem: Split drm_gem_mmap() into object search and object mapping

:::::: TO: Laurent Pinchart <laurent.pinchart+renesas@xxxxxxxxxxxxxxxx>
:::::: CC: Laurent Pinchart <laurent.pinchart+renesas@xxxxxxxxxxxxxxxx>

---
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