drivers/gpu/drm/nouveau/nouveau_dmem.c:205:13: sparse: sparse: incorrect type in assignment (different base types)

From: kernel test robot
Date: Fri Aug 11 2023 - 15:02:36 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9106536c1aa37bcf60202ad93bb8b94bcd29f3f0
commit: d9b719394a1147614351961ac454589111c76e76 nouveau/dmem: refactor nouveau_dmem_fault_copy_one()
date: 10 months ago
config: x86_64-randconfig-r072-20230811 (https://download.01.org/0day-ci/archive/20230812/202308120234.ile8pRGe-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230812/202308120234.ile8pRGe-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/oe-kbuild-all/202308120234.ile8pRGe-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/nouveau/nouveau_dmem.c:205:13: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted vm_fault_t [usertype] ret @@ got int @@
drivers/gpu/drm/nouveau/nouveau_dmem.c:205:13: sparse: expected restricted vm_fault_t [usertype] ret
drivers/gpu/drm/nouveau/nouveau_dmem.c:205:13: sparse: got int
drivers/gpu/drm/nouveau/nouveau_dmem.c:409:25: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:409:25: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:413:25: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:413:25: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:426:25: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:426:25: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:430:25: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:430:25: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:440:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:440:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:440:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:440:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:440:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:440:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:440:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:440:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:440:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:454:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:454:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:481:17: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:481:17: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:485:17: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:485:17: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:494:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:494:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:494:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:494:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:503:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:503:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:503:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:508:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:508:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:510:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/gpu/drm/nouveau/nouveau_dmem.c:510:9: sparse: sparse: cast removes address space '__iomem' of expression

vim +205 drivers/gpu/drm/nouveau/nouveau_dmem.c

161
162 static vm_fault_t nouveau_dmem_migrate_to_ram(struct vm_fault *vmf)
163 {
164 struct nouveau_drm *drm = page_to_drm(vmf->page);
165 struct nouveau_dmem *dmem = drm->dmem;
166 struct nouveau_fence *fence;
167 struct nouveau_svmm *svmm;
168 struct page *spage, *dpage;
169 unsigned long src = 0, dst = 0;
170 dma_addr_t dma_addr = 0;
171 vm_fault_t ret = 0;
172 struct migrate_vma args = {
173 .vma = vmf->vma,
174 .start = vmf->address,
175 .end = vmf->address + PAGE_SIZE,
176 .src = &src,
177 .dst = &dst,
178 .pgmap_owner = drm->dev,
179 .flags = MIGRATE_VMA_SELECT_DEVICE_PRIVATE,
180 };
181
182 /*
183 * FIXME what we really want is to find some heuristic to migrate more
184 * than just one page on CPU fault. When such fault happens it is very
185 * likely that more surrounding page will CPU fault too.
186 */
187 if (migrate_vma_setup(&args) < 0)
188 return VM_FAULT_SIGBUS;
189 if (!args.cpages)
190 return 0;
191
192 spage = migrate_pfn_to_page(src);
193 if (!spage || !(src & MIGRATE_PFN_MIGRATE))
194 goto done;
195
196 dpage = alloc_page_vma(GFP_HIGHUSER, vmf->vma, vmf->address);
197 if (!dpage)
198 goto done;
199
200 dst = migrate_pfn(page_to_pfn(dpage));
201
202 svmm = spage->zone_device_data;
203 mutex_lock(&svmm->mutex);
204 nouveau_svmm_invalidate(svmm, args.start, args.end);
> 205 ret = nouveau_dmem_copy_one(drm, spage, dpage, &dma_addr);
206 mutex_unlock(&svmm->mutex);
207 if (ret) {
208 ret = VM_FAULT_SIGBUS;
209 goto done;
210 }
211
212 nouveau_fence_new(dmem->migrate.chan, false, &fence);
213 migrate_vma_pages(&args);
214 nouveau_dmem_fence_done(&fence);
215 dma_unmap_page(drm->dev->dev, dma_addr, PAGE_SIZE, DMA_BIDIRECTIONAL);
216 done:
217 migrate_vma_finalize(&args);
218 return ret;
219 }
220

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