drivers/gpu/drm/nouveau/dispnv50/disp.c:134:31: sparse: sparse: subtraction of different types can't work (different address spaces)

From: kernel test robot
Date: Mon Jan 22 2024 - 09:33:09 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 52b1853b080a082ec3749c3a9577f6c71b1d4a90
commit: 9cf06d6ef7fd08adf51568b704ab7ba6007b6fe8 drm/nouveau/disp: fix cast removes address space of expression warnings
date: 1 year, 3 months ago
:::::: branch date: 7 hours ago
:::::: commit date: 1 year, 3 months ago
config: i386-randconfig-062-20240106 (https://download.01.org/0day-ci/archive/20240107/202401071050.UrV4A3qz-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240107/202401071050.UrV4A3qz-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/r/202401071050.UrV4A3qz-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/nouveau/dispnv50/disp.c:134:31: sparse: sparse: subtraction of different types can't work (different address spaces)
drivers/gpu/drm/nouveau/dispnv50/disp.c:197:31: sparse: sparse: subtraction of different types can't work (different address spaces)
drivers/gpu/drm/nouveau/dispnv50/disp.c:257:19: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected unsigned int [usertype] *ptr @@ got void [noderef] __iomem *ptr @@
drivers/gpu/drm/nouveau/dispnv50/disp.c:261:25: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected unsigned int [usertype] *bgn @@ got void [noderef] __iomem *ptr @@

vim +134 drivers/gpu/drm/nouveau/dispnv50/disp.c

2853ccf09255aa Ben Skeggs 2020-06-20 128
2853ccf09255aa Ben Skeggs 2020-06-20 129 static void
2853ccf09255aa Ben Skeggs 2020-06-20 130 nv50_dmac_kick(struct nvif_push *push)
2853ccf09255aa Ben Skeggs 2020-06-20 131 {
2853ccf09255aa Ben Skeggs 2020-06-20 132 struct nv50_dmac *dmac = container_of(push, typeof(*dmac), _push);
0a96099691c8cd Ben Skeggs 2020-07-21 133
9cf06d6ef7fd08 ruanjinjie 2022-09-24 @134 dmac->cur = push->cur - (u32 __iomem *)dmac->_push.mem.object.map.ptr;
0a96099691c8cd Ben Skeggs 2020-07-21 135 if (dmac->put != dmac->cur) {
0a96099691c8cd Ben Skeggs 2020-07-21 136 /* Push buffer fetches are not coherent with BAR1, we need to ensure
0a96099691c8cd Ben Skeggs 2020-07-21 137 * writes have been flushed right through to VRAM before writing PUT.
0a96099691c8cd Ben Skeggs 2020-07-21 138 */
0a96099691c8cd Ben Skeggs 2020-07-21 139 if (dmac->push->mem.type & NVIF_MEM_VRAM) {
0a96099691c8cd Ben Skeggs 2020-07-21 140 struct nvif_device *device = dmac->base.device;
0a96099691c8cd Ben Skeggs 2020-07-21 141 nvif_wr32(&device->object, 0x070000, 0x00000001);
0a96099691c8cd Ben Skeggs 2020-07-21 142 nvif_msec(device, 2000,
0a96099691c8cd Ben Skeggs 2020-07-21 143 if (!(nvif_rd32(&device->object, 0x070000) & 0x00000002))
0a96099691c8cd Ben Skeggs 2020-07-21 144 break;
0a96099691c8cd Ben Skeggs 2020-07-21 145 );
0a96099691c8cd Ben Skeggs 2020-07-21 146 }
0a96099691c8cd Ben Skeggs 2020-07-21 147
0a96099691c8cd Ben Skeggs 2020-07-21 148 NVIF_WV32(&dmac->base.user, NV507C, PUT, PTR, dmac->cur);
0a96099691c8cd Ben Skeggs 2020-07-21 149 dmac->put = dmac->cur;
0a96099691c8cd Ben Skeggs 2020-07-21 150 }
0a96099691c8cd Ben Skeggs 2020-07-21 151
0a96099691c8cd Ben Skeggs 2020-07-21 152 push->bgn = push->cur;
0a96099691c8cd Ben Skeggs 2020-07-21 153 }
0a96099691c8cd Ben Skeggs 2020-07-21 154

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki