[linux-next:master 4676/13542] drivers/gpu/drm/drm_bufs.c:346:36: sparse: sparse: incorrect type in argument 1 (different address spaces)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   7c5e07b73ff3011c9b82d4a3286a3362b951ad2b
commit: d803336abdbc1bfacdb32b2cf9f4fdbee072b8ee [4676/13542] ARM: mm: kill unused runtime hook arch_iounmap()
config: arm-randconfig-s041-20220728 (https://download.01.org/0day-ci/archive/20220729/202207290016.kJUuouRz-lkp@xxxxxxxxx/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=d803336abdbc1bfacdb32b2cf9f4fdbee072b8ee
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout d803336abdbc1bfacdb32b2cf9f4fdbee072b8ee
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm SHELL=/bin/bash drivers/gpu/drm/

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

sparse warnings: (new ones prefixed by >>)
   drivers/gpu/drm/drm_bufs.c:227:45: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *handle @@     got void [noderef] __iomem * @@
   drivers/gpu/drm/drm_bufs.c:227:45: sparse:     expected void *handle
   drivers/gpu/drm/drm_bufs.c:227:45: sparse:     got void [noderef] __iomem *
   drivers/gpu/drm/drm_bufs.c:230:45: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *handle @@     got void [noderef] __iomem * @@
   drivers/gpu/drm/drm_bufs.c:230:45: sparse:     expected void *handle
   drivers/gpu/drm/drm_bufs.c:230:45: sparse:     got void [noderef] __iomem *
>> drivers/gpu/drm/drm_bufs.c:346:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *io_addr @@     got void *handle @@
   drivers/gpu/drm/drm_bufs.c:346:36: sparse:     expected void volatile [noderef] __iomem *io_addr
   drivers/gpu/drm/drm_bufs.c:346:36: sparse:     got void *handle
   drivers/gpu/drm/drm_bufs.c:363:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *io_addr @@     got void *handle @@
   drivers/gpu/drm/drm_bufs.c:363:36: sparse:     expected void volatile [noderef] __iomem *io_addr
   drivers/gpu/drm/drm_bufs.c:363:36: sparse:     got void *handle
   drivers/gpu/drm/drm_bufs.c:540:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *io_addr @@     got void *handle @@
   drivers/gpu/drm/drm_bufs.c:540:28: sparse:     expected void volatile [noderef] __iomem *io_addr
   drivers/gpu/drm/drm_bufs.c:540:28: sparse:     got void *handle
--
   drivers/gpu/drm/drm_memory.c:115:29: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *handle @@     got void [noderef] __iomem * @@
   drivers/gpu/drm/drm_memory.c:115:29: sparse:     expected void *handle
   drivers/gpu/drm/drm_memory.c:115:29: sparse:     got void [noderef] __iomem *
   drivers/gpu/drm/drm_memory.c:124:29: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *handle @@     got void [noderef] __iomem * @@
   drivers/gpu/drm/drm_memory.c:124:29: sparse:     expected void *handle
   drivers/gpu/drm/drm_memory.c:124:29: sparse:     got void [noderef] __iomem *
>> drivers/gpu/drm/drm_memory.c:136:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *io_addr @@     got void *handle @@
   drivers/gpu/drm/drm_memory.c:136:28: sparse:     expected void volatile [noderef] __iomem *io_addr
   drivers/gpu/drm/drm_memory.c:136:28: sparse:     got void *handle
--
>> drivers/gpu/drm/drm_vm.c:270:44: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *io_addr @@     got void *handle @@
   drivers/gpu/drm/drm_vm.c:270:44: sparse:     expected void volatile [noderef] __iomem *io_addr
   drivers/gpu/drm/drm_vm.c:270:44: sparse:     got void *handle
--
>> drivers/gpu/drm/armada/armada_gem.c:63:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *io_addr @@     got void *addr @@
   drivers/gpu/drm/armada/armada_gem.c:63:37: sparse:     expected void volatile [noderef] __iomem *io_addr
   drivers/gpu/drm/armada/armada_gem.c:63:37: sparse:     got void *addr
   drivers/gpu/drm/armada/armada_gem.c:185:28: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void *addr @@     got void [noderef] __iomem * @@
   drivers/gpu/drm/armada/armada_gem.c:185:28: sparse:     expected void *addr
   drivers/gpu/drm/armada/armada_gem.c:185:28: sparse:     got void [noderef] __iomem *

vim +346 drivers/gpu/drm/drm_bufs.c

9a18664506dbce drivers/char/drm/drm_bufs.c Dave Airlie                 2005-06-23  138  
abee5491db9f33 drivers/gpu/drm/drm_bufs.c  Benjamin Gaignard           2020-03-06  139  /*
f77d390c9779c4 drivers/gpu/drm/drm_bufs.c  Benjamin Herrenschmidt      2009-02-02  140   * Core function to create a range of memory available for mapping by a
f77d390c9779c4 drivers/gpu/drm/drm_bufs.c  Benjamin Herrenschmidt      2009-02-02  141   * non-root process.
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  142   *
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  143   * Adjusts the memory offset to its absolute value according to the mapping
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  144   * type.  Adds the map to the map list drm_device::maplist. Adds MTRR's where
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  145   * applicable and if supported by the kernel.
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  146   */
41c2e75e60200a drivers/gpu/drm/drm_bufs.c  Benjamin Herrenschmidt      2009-02-02  147  static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
c60ce623bd1613 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-07-11  148  			   unsigned int size, enum drm_map_type type,
55910517af381e drivers/char/drm/drm_bufs.c Dave Airlie                 2007-07-11  149  			   enum drm_map_flags flags,
55910517af381e drivers/char/drm/drm_bufs.c Dave Airlie                 2007-07-11  150  			   struct drm_map_list **maplist)
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  151  {
f77d390c9779c4 drivers/gpu/drm/drm_bufs.c  Benjamin Herrenschmidt      2009-02-02  152  	struct drm_local_map *map;
55910517af381e drivers/char/drm/drm_bufs.c Dave Airlie                 2007-07-11  153  	struct drm_map_list *list;
8d153f7107ff2c drivers/char/drm/drm_bufs.c Thomas Hellstrom            2006-08-07  154  	unsigned long user_token;
8d153f7107ff2c drivers/char/drm/drm_bufs.c Thomas Hellstrom            2006-08-07  155  	int ret;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  156  
9a298b2acd771d drivers/gpu/drm/drm_bufs.c  Eric Anholt                 2009-03-24  157  	map = kmalloc(sizeof(*map), GFP_KERNEL);
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  158  	if (!map)
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  159  		return -ENOMEM;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  160  
7ab984012a879a drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  161  	map->offset = offset;
7ab984012a879a drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  162  	map->size = size;
7ab984012a879a drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  163  	map->flags = flags;
7ab984012a879a drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  164  	map->type = type;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  165  
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  166  	/* Only allow shared memory to be removable since we only keep enough
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  167  	 * book keeping information about shared memory to allow for removal
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  168  	 * when processes fork.
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  169  	 */
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  170  	if ((map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM) {
9a298b2acd771d drivers/gpu/drm/drm_bufs.c  Eric Anholt                 2009-03-24  171  		kfree(map);
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  172  		return -EINVAL;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  173  	}
41c2e75e60200a drivers/gpu/drm/drm_bufs.c  Benjamin Herrenschmidt      2009-02-02  174  	DRM_DEBUG("offset = 0x%08llx, size = 0x%08lx, type = %d\n",
41c2e75e60200a drivers/gpu/drm/drm_bufs.c  Benjamin Herrenschmidt      2009-02-02  175  		  (unsigned long long)map->offset, map->size, map->type);
b674137755bbe2 drivers/gpu/drm/drm_bufs.c  Benjamin Herrenschmidt      2009-05-18  176  
b674137755bbe2 drivers/gpu/drm/drm_bufs.c  Benjamin Herrenschmidt      2009-05-18  177  	/* page-align _DRM_SHM maps. They are allocated here so there is no security
b674137755bbe2 drivers/gpu/drm/drm_bufs.c  Benjamin Herrenschmidt      2009-05-18  178  	 * hole created by that and it works around various broken drivers that use
b674137755bbe2 drivers/gpu/drm/drm_bufs.c  Benjamin Herrenschmidt      2009-05-18  179  	 * a non-aligned quantity to map the SAREA. --BenH
b674137755bbe2 drivers/gpu/drm/drm_bufs.c  Benjamin Herrenschmidt      2009-05-18  180  	 */
b674137755bbe2 drivers/gpu/drm/drm_bufs.c  Benjamin Herrenschmidt      2009-05-18  181  	if (map->type == _DRM_SHM)
b674137755bbe2 drivers/gpu/drm/drm_bufs.c  Benjamin Herrenschmidt      2009-05-18  182  		map->size = PAGE_ALIGN(map->size);
b674137755bbe2 drivers/gpu/drm/drm_bufs.c  Benjamin Herrenschmidt      2009-05-18  183  
41c2e75e60200a drivers/gpu/drm/drm_bufs.c  Benjamin Herrenschmidt      2009-02-02  184  	if ((map->offset & (~(resource_size_t)PAGE_MASK)) || (map->size & (~PAGE_MASK))) {
9a298b2acd771d drivers/gpu/drm/drm_bufs.c  Eric Anholt                 2009-03-24  185  		kfree(map);
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  186  		return -EINVAL;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  187  	}
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  188  	map->mtrr = -1;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  189  	map->handle = NULL;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  190  
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  191  	switch (map->type) {
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  192  	case _DRM_REGISTERS:
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  193  	case _DRM_FRAME_BUFFER:
4b7fb9b5746554 drivers/gpu/drm/drm_bufs.c  Jordan Crouse               2010-05-27  194  #if !defined(__sparc__) && !defined(__alpha__) && !defined(__ia64__) && !defined(__powerpc64__) && !defined(__x86_64__) && !defined(__arm__)
8d2ea6258123d7 drivers/char/drm/drm_bufs.c Dave Airlie                 2006-01-11  195  		if (map->offset + (map->size-1) < map->offset ||
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  196  		    map->offset < virt_to_phys(high_memory)) {
9a298b2acd771d drivers/gpu/drm/drm_bufs.c  Eric Anholt                 2009-03-24  197  			kfree(map);
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  198  			return -EINVAL;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  199  		}
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  200  #endif
836cf0465c422e drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  201  		/* Some drivers preinitialize some maps, without the X Server
836cf0465c422e drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  202  		 * needing to be aware of it.  Therefore, we just return success
836cf0465c422e drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  203  		 * when the server tries to create a duplicate map.
836cf0465c422e drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  204  		 */
89625eb186b9b0 drivers/char/drm/drm_bufs.c Dave Airlie                 2005-09-05  205  		list = drm_find_matching_map(dev, map);
89625eb186b9b0 drivers/char/drm/drm_bufs.c Dave Airlie                 2005-09-05  206  		if (list != NULL) {
89625eb186b9b0 drivers/char/drm/drm_bufs.c Dave Airlie                 2005-09-05  207  			if (list->map->size != map->size) {
836cf0465c422e drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  208  				DRM_DEBUG("Matching maps of type %d with "
836cf0465c422e drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  209  					  "mismatched sizes, (%ld vs %ld)\n",
b5e89ed53ed8d2 drivers/char/drm/drm_bufs.c Dave Airlie                 2005-09-25  210  					  map->type, map->size,
b5e89ed53ed8d2 drivers/char/drm/drm_bufs.c Dave Airlie                 2005-09-25  211  					  list->map->size);
89625eb186b9b0 drivers/char/drm/drm_bufs.c Dave Airlie                 2005-09-05  212  				list->map->size = map->size;
836cf0465c422e drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  213  			}
836cf0465c422e drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  214  
9a298b2acd771d drivers/gpu/drm/drm_bufs.c  Eric Anholt                 2009-03-24  215  			kfree(map);
89625eb186b9b0 drivers/char/drm/drm_bufs.c Dave Airlie                 2005-09-05  216  			*maplist = list;
836cf0465c422e drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  217  			return 0;
836cf0465c422e drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  218  		}
836cf0465c422e drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  219  
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  220  		if (map->type == _DRM_FRAME_BUFFER ||
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  221  		    (map->flags & _DRM_WRITE_COMBINING)) {
ff47eaf24d01b5 drivers/gpu/drm/drm_bufs.c  Andy Lutomirski             2013-05-13  222  			map->mtrr =
ff47eaf24d01b5 drivers/gpu/drm/drm_bufs.c  Andy Lutomirski             2013-05-13  223  				arch_phys_wc_add(map->offset, map->size);
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  224  		}
0769d39c993145 drivers/char/drm/drm_bufs.c Scott Thompson              2007-08-25  225  		if (map->type == _DRM_REGISTERS) {
ff47eaf24d01b5 drivers/gpu/drm/drm_bufs.c  Andy Lutomirski             2013-05-13  226  			if (map->flags & _DRM_WRITE_COMBINING)
ff47eaf24d01b5 drivers/gpu/drm/drm_bufs.c  Andy Lutomirski             2013-05-13  227  				map->handle = ioremap_wc(map->offset,
ff47eaf24d01b5 drivers/gpu/drm/drm_bufs.c  Andy Lutomirski             2013-05-13  228  							 map->size);
ff47eaf24d01b5 drivers/gpu/drm/drm_bufs.c  Andy Lutomirski             2013-05-13  229  			else
004a7727421fd2 drivers/char/drm/drm_bufs.c Christoph Hellwig           2007-01-08  230  				map->handle = ioremap(map->offset, map->size);
0769d39c993145 drivers/char/drm/drm_bufs.c Scott Thompson              2007-08-25  231  			if (!map->handle) {
9a298b2acd771d drivers/gpu/drm/drm_bufs.c  Eric Anholt                 2009-03-24  232  				kfree(map);
0769d39c993145 drivers/char/drm/drm_bufs.c Scott Thompson              2007-08-25  233  				return -ENOMEM;
0769d39c993145 drivers/char/drm/drm_bufs.c Scott Thompson              2007-08-25  234  			}
0769d39c993145 drivers/char/drm/drm_bufs.c Scott Thompson              2007-08-25  235  		}
0769d39c993145 drivers/char/drm/drm_bufs.c Scott Thompson              2007-08-25  236  
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  237  		break;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  238  	case _DRM_SHM:
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  239  		list = drm_find_matching_map(dev, map);
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  240  		if (list != NULL) {
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  241  			if (list->map->size != map->size) {
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  242  				DRM_DEBUG("Matching maps of type %d with "
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  243  					  "mismatched sizes, (%ld vs %ld)\n",
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  244  					  map->type, map->size, list->map->size);
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  245  				list->map->size = map->size;
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  246  			}
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  247  
9a298b2acd771d drivers/gpu/drm/drm_bufs.c  Eric Anholt                 2009-03-24  248  			kfree(map);
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  249  			*maplist = list;
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  250  			return 0;
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  251  		}
f239b7b0cac068 drivers/char/drm/drm_bufs.c Thomas Hellstrom            2007-01-08  252  		map->handle = vmalloc_user(map->size);
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  253  		DRM_DEBUG("%lu %d %p\n",
04420c9c6a6d02 drivers/gpu/drm/drm_bufs.c  Daniel Vetter               2013-07-10  254  			  map->size, order_base_2(map->size), map->handle);
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  255  		if (!map->handle) {
9a298b2acd771d drivers/gpu/drm/drm_bufs.c  Eric Anholt                 2009-03-24  256  			kfree(map);
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  257  			return -ENOMEM;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  258  		}
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  259  		map->offset = (unsigned long)map->handle;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  260  		if (map->flags & _DRM_CONTAINS_LOCK) {
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  261  			/* Prevent a 2nd X Server from creating a 2nd lock */
95c081c17f284d drivers/gpu/drm/drm_bufs.c  Daniel Vetter               2016-06-21  262  			if (dev->master->lock.hw_lock != NULL) {
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  263  				vfree(map->handle);
9a298b2acd771d drivers/gpu/drm/drm_bufs.c  Eric Anholt                 2009-03-24  264  				kfree(map);
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  265  				return -EBUSY;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  266  			}
95c081c17f284d drivers/gpu/drm/drm_bufs.c  Daniel Vetter               2016-06-21  267  			dev->sigdata.lock = dev->master->lock.hw_lock = map->handle;	/* Pointer to lock */
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  268  		}
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  269  		break;
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  270  	case _DRM_AGP: {
55910517af381e drivers/char/drm/drm_bufs.c Dave Airlie                 2007-07-11  271  		struct drm_agp_mem *entry;
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  272  		int valid = 0;
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  273  
d9906753bb997d drivers/gpu/drm/drm_bufs.c  Daniel Vetter               2013-12-11  274  		if (!dev->agp) {
9a298b2acd771d drivers/gpu/drm/drm_bufs.c  Eric Anholt                 2009-03-24  275  			kfree(map);
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  276  			return -EINVAL;
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  277  		}
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  278  #ifdef __alpha__
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  279  		map->offset += dev->hose->mem_space->start;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  280  #endif
47a184a80800dd drivers/char/drm/drm_bufs.c Eric Anholt                 2007-11-22  281  		/* In some cases (i810 driver), user space may have already
47a184a80800dd drivers/char/drm/drm_bufs.c Eric Anholt                 2007-11-22  282  		 * added the AGP base itself, because dev->agp->base previously
47a184a80800dd drivers/char/drm/drm_bufs.c Eric Anholt                 2007-11-22  283  		 * only got set during AGP enable.  So, only add the base
47a184a80800dd drivers/char/drm/drm_bufs.c Eric Anholt                 2007-11-22  284  		 * address if the map's offset isn't already within the
47a184a80800dd drivers/char/drm/drm_bufs.c Eric Anholt                 2007-11-22  285  		 * aperture.
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  286  		 */
47a184a80800dd drivers/char/drm/drm_bufs.c Eric Anholt                 2007-11-22  287  		if (map->offset < dev->agp->base ||
47a184a80800dd drivers/char/drm/drm_bufs.c Eric Anholt                 2007-11-22  288  		    map->offset > dev->agp->base +
47a184a80800dd drivers/char/drm/drm_bufs.c Eric Anholt                 2007-11-22  289  		    dev->agp->agp_info.aper_size * 1024 * 1024 - 1) {
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  290  			map->offset += dev->agp->base;
47a184a80800dd drivers/char/drm/drm_bufs.c Eric Anholt                 2007-11-22  291  		}
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  292  		map->mtrr = dev->agp->agp_mtrr;	/* for getmap */
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  293  
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  294  		/* This assumes the DRM is in total control of AGP space.
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  295  		 * It's not always the case as AGP can be in the control
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  296  		 * of user space (i.e. i810 driver). So this loop will get
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  297  		 * skipped and we double check that dev->agp->memory is
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  298  		 * actually set as well as being invalid before EPERM'ing
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  299  		 */
bd1b331fae2813 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-05-26  300  		list_for_each_entry(entry, &dev->agp->memory, head) {
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  301  			if ((map->offset >= entry->bound) &&
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  302  			    (map->offset + map->size <= entry->bound + entry->pages * PAGE_SIZE)) {
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  303  				valid = 1;
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  304  				break;
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  305  			}
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  306  		}
bd1b331fae2813 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-05-26  307  		if (!list_empty(&dev->agp->memory) && !valid) {
9a298b2acd771d drivers/gpu/drm/drm_bufs.c  Eric Anholt                 2009-03-24  308  			kfree(map);
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  309  			return -EPERM;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  310  		}
41c2e75e60200a drivers/gpu/drm/drm_bufs.c  Benjamin Herrenschmidt      2009-02-02  311  		DRM_DEBUG("AGP offset = 0x%08llx, size = 0x%08lx\n",
41c2e75e60200a drivers/gpu/drm/drm_bufs.c  Benjamin Herrenschmidt      2009-02-02  312  			  (unsigned long long)map->offset, map->size);
54ba2f76e28128 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-02-10  313  
a2c0a97b784f83 drivers/gpu/drm/drm_bufs.c  Jesse Barnes                2008-11-05  314  		break;
812c369dbf3b5a drivers/gpu/drm/drm_bufs.c  Pekka Paalanen              2009-09-17  315  	}
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  316  	case _DRM_SCATTER_GATHER:
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  317  		if (!dev->sg) {
9a298b2acd771d drivers/gpu/drm/drm_bufs.c  Eric Anholt                 2009-03-24  318  			kfree(map);
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  319  			return -EINVAL;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  320  		}
d1f2b55ad2c11f drivers/char/drm/drm_bufs.c Dave Airlie                 2005-08-05  321  		map->offset += (unsigned long)dev->sg->virtual;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  322  		break;
2d0f9eaff8e1d0 drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  323  	case _DRM_CONSISTENT:
2d0f9eaff8e1d0 drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  324  		/* dma_addr_t is 64bit on i386 with CONFIG_HIGHMEM64G,
9c8da5ebbf6f87 drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  325  		 * As we're limiting the address to 2^32-1 (or less),
2d0f9eaff8e1d0 drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  326  		 * casting it down to 32 bits is no problem, but we
ad6ce32a81e438 drivers/gpu/drm/drm_bufs.c  Beatriz Martins de Carvalho 2021-04-18  327  		 * need to point to a 64bit variable first.
ad6ce32a81e438 drivers/gpu/drm/drm_bufs.c  Beatriz Martins de Carvalho 2021-04-18  328  		 */
36b73b051c41c1 drivers/gpu/drm/drm_bufs.c  Thomas Zimmermann           2021-01-18  329  		map->handle = dma_alloc_coherent(dev->dev,
8e4ff9b5695728 drivers/gpu/drm/drm_bufs.c  Chris Wilson                2020-02-02  330  						 map->size,
8e4ff9b5695728 drivers/gpu/drm/drm_bufs.c  Chris Wilson                2020-02-02  331  						 &map->offset,
8e4ff9b5695728 drivers/gpu/drm/drm_bufs.c  Chris Wilson                2020-02-02  332  						 GFP_KERNEL);
8e4ff9b5695728 drivers/gpu/drm/drm_bufs.c  Chris Wilson                2020-02-02  333  		if (!map->handle) {
9a298b2acd771d drivers/gpu/drm/drm_bufs.c  Eric Anholt                 2009-03-24  334  			kfree(map);
2d0f9eaff8e1d0 drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  335  			return -ENOMEM;
2d0f9eaff8e1d0 drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  336  		}
2d0f9eaff8e1d0 drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  337  		break;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  338  	default:
9a298b2acd771d drivers/gpu/drm/drm_bufs.c  Eric Anholt                 2009-03-24  339  		kfree(map);
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  340  		return -EINVAL;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  341  	}
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  342  
94e3370eb9fc00 drivers/gpu/drm/drm_bufs.c  Davidlohr Bueso             2010-08-11  343  	list = kzalloc(sizeof(*list), GFP_KERNEL);
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  344  	if (!list) {
85abb3f95010b2 drivers/char/drm/drm_bufs.c Amol Lad                    2006-10-25  345  		if (map->type == _DRM_REGISTERS)
004a7727421fd2 drivers/char/drm/drm_bufs.c Christoph Hellwig           2007-01-08 @346  			iounmap(map->handle);
9a298b2acd771d drivers/gpu/drm/drm_bufs.c  Eric Anholt                 2009-03-24  347  		kfree(map);
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  348  		return -EINVAL;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  349  	}
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  350  	list->map = map;
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  351  
30e2fb18819490 drivers/char/drm/drm_bufs.c Dave Airlie                 2006-02-02  352  	mutex_lock(&dev->struct_mutex);
bd1b331fae2813 drivers/char/drm/drm_bufs.c Dave Airlie                 2007-05-26  353  	list_add(&list->head, &dev->maplist);
8d153f7107ff2c drivers/char/drm/drm_bufs.c Thomas Hellstrom            2006-08-07  354  
d1f2b55ad2c11f drivers/char/drm/drm_bufs.c Dave Airlie                 2005-08-05  355  	/* Assign a 32-bit handle */
30e2fb18819490 drivers/char/drm/drm_bufs.c Dave Airlie                 2006-02-02  356  	/* We do it here so that dev->struct_mutex protects the increment */
8d153f7107ff2c drivers/char/drm/drm_bufs.c Thomas Hellstrom            2006-08-07  357  	user_token = (map->type == _DRM_SHM) ? (unsigned long)map->handle :
8d153f7107ff2c drivers/char/drm/drm_bufs.c Thomas Hellstrom            2006-08-07  358  		map->offset;
f1a2a9b6189f9f drivers/gpu/drm/drm_bufs.c  David Miller                2009-02-18  359  	ret = drm_map_handle(dev, &list->hash, user_token, 0,
f1a2a9b6189f9f drivers/gpu/drm/drm_bufs.c  David Miller                2009-02-18  360  			     (map->type == _DRM_SHM));
8d153f7107ff2c drivers/char/drm/drm_bufs.c Thomas Hellstrom            2006-08-07  361  	if (ret) {
85abb3f95010b2 drivers/char/drm/drm_bufs.c Amol Lad                    2006-10-25  362  		if (map->type == _DRM_REGISTERS)
004a7727421fd2 drivers/char/drm/drm_bufs.c Christoph Hellwig           2007-01-08  363  			iounmap(map->handle);
9a298b2acd771d drivers/gpu/drm/drm_bufs.c  Eric Anholt                 2009-03-24  364  		kfree(map);
9a298b2acd771d drivers/gpu/drm/drm_bufs.c  Eric Anholt                 2009-03-24  365  		kfree(list);
8d153f7107ff2c drivers/char/drm/drm_bufs.c Thomas Hellstrom            2006-08-07  366  		mutex_unlock(&dev->struct_mutex);
8d153f7107ff2c drivers/char/drm/drm_bufs.c Thomas Hellstrom            2006-08-07  367  		return ret;
8d153f7107ff2c drivers/char/drm/drm_bufs.c Thomas Hellstrom            2006-08-07  368  	}
8d153f7107ff2c drivers/char/drm/drm_bufs.c Thomas Hellstrom            2006-08-07  369  
1545085a28f226 drivers/char/drm/drm_bufs.c Thomas Hellstrom            2007-02-08  370  	list->user_token = list->hash.key << PAGE_SHIFT;
30e2fb18819490 drivers/char/drm/drm_bufs.c Dave Airlie                 2006-02-02  371  	mutex_unlock(&dev->struct_mutex);
^1da177e4c3f41 drivers/char/drm/drm_bufs.c Linus Torvalds              2005-04-16  372  
2ff2e8a3e1898e drivers/gpu/drm/drm_bufs.c  Ben Skeggs                  2009-05-26  373  	if (!(map->flags & _DRM_DRIVER))
95c081c17f284d drivers/gpu/drm/drm_bufs.c  Daniel Vetter               2016-06-21  374  		list->master = dev->master;
89625eb186b9b0 drivers/char/drm/drm_bufs.c Dave Airlie                 2005-09-05  375  	*maplist = list;
7ab984012a879a drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  376  	return 0;
7ab984012a879a drivers/char/drm/drm_bufs.c Dave Airlie                 2005-07-10  377  }
89625eb186b9b0 drivers/char/drm/drm_bufs.c Dave Airlie                 2005-09-05  378  

:::::: The code at line 346 was first introduced by commit
:::::: 004a7727421fd202bbdfcc0231a3359085199a52 drm: remove drm_ioremap and drm_ioremapfree

:::::: TO: Christoph Hellwig <hch@xxxxxx>
:::::: CC: Dave Airlie <airlied@xxxxxxxx>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux