tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: b9ddbb0cde2adcedda26045cc58f31316a492215 commit: d9b719394a1147614351961ac454589111c76e76 nouveau/dmem: refactor nouveau_dmem_fault_copy_one() date: 12 months ago config: x86_64-randconfig-123-20231008 (https://download.01.org/0day-ci/archive/20231008/202310081010.okVQwwej-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/20231008/202310081010.okVQwwej-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/202310081010.okVQwwej-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 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