Lines Matching refs:migrate
271 static unsigned long svm_migrate_successful_pages(struct migrate_vma *migrate) in svm_migrate_successful_pages() argument
276 for (i = 0; i < migrate->npages; i++) { in svm_migrate_successful_pages()
277 if (migrate->src[i] & MIGRATE_PFN_VALID && in svm_migrate_successful_pages()
278 migrate->src[i] & MIGRATE_PFN_MIGRATE) in svm_migrate_successful_pages()
284 static unsigned long svm_migrate_unsuccessful_pages(struct migrate_vma *migrate) in svm_migrate_unsuccessful_pages() argument
289 for (i = 0; i < migrate->npages; i++) { in svm_migrate_unsuccessful_pages()
290 if (migrate->src[i] & MIGRATE_PFN_VALID && in svm_migrate_unsuccessful_pages()
291 !(migrate->src[i] & MIGRATE_PFN_MIGRATE)) in svm_migrate_unsuccessful_pages()
299 struct migrate_vma *migrate, struct dma_fence **mfence, in svm_migrate_copy_to_vram() argument
302 uint64_t npages = migrate->cpages; in svm_migrate_copy_to_vram()
327 spage = migrate_pfn_to_page(migrate->src[i]); in svm_migrate_copy_to_vram()
330 migrate->dst[i] = svm_migrate_addr_to_pfn(adev, dst[i]); in svm_migrate_copy_to_vram()
331 svm_migrate_get_vram_page(prange, migrate->dst[i]); in svm_migrate_copy_to_vram()
332 migrate->dst[i] = migrate_pfn(migrate->dst[i]); in svm_migrate_copy_to_vram()
382 migrate->dst[i] = 0; in svm_migrate_copy_to_vram()
391 migrate->dst[i] = 0; in svm_migrate_copy_to_vram()
393 migrate->dst[i + 1] = 0; in svm_migrate_copy_to_vram()
395 migrate->dst[i + 2] = 0; in svm_migrate_copy_to_vram()
397 migrate->dst[i + 3] = 0; in svm_migrate_copy_to_vram()
412 struct migrate_vma migrate; in svm_migrate_vma_to_vram() local
419 memset(&migrate, 0, sizeof(migrate)); in svm_migrate_vma_to_vram()
420 migrate.vma = vma; in svm_migrate_vma_to_vram()
421 migrate.start = start; in svm_migrate_vma_to_vram()
422 migrate.end = end; in svm_migrate_vma_to_vram()
423 migrate.flags = MIGRATE_VMA_SELECT_SYSTEM; in svm_migrate_vma_to_vram()
424 migrate.pgmap_owner = SVM_ADEV_PGMAP_OWNER(adev); in svm_migrate_vma_to_vram()
426 size = 2 * sizeof(*migrate.src) + sizeof(uint64_t) + sizeof(dma_addr_t); in svm_migrate_vma_to_vram()
432 migrate.src = buf; in svm_migrate_vma_to_vram()
433 migrate.dst = migrate.src + npages; in svm_migrate_vma_to_vram()
434 scratch = (dma_addr_t *)(migrate.dst + npages); in svm_migrate_vma_to_vram()
436 r = migrate_vma_setup(&migrate); in svm_migrate_vma_to_vram()
443 cpages = migrate.cpages; in svm_migrate_vma_to_vram()
455 r = svm_migrate_copy_to_vram(adev, prange, &migrate, &mfence, scratch); in svm_migrate_vma_to_vram()
456 migrate_vma_pages(&migrate); in svm_migrate_vma_to_vram()
459 svm_migrate_successful_pages(&migrate), cpages, migrate.npages); in svm_migrate_vma_to_vram()
462 migrate_vma_finalize(&migrate); in svm_migrate_vma_to_vram()
558 struct migrate_vma *migrate, struct dma_fence **mfence, in svm_migrate_copy_to_ram() argument
580 spage = migrate_pfn_to_page(migrate->src[i]); in svm_migrate_copy_to_ram()
606 dpage = svm_migrate_get_sys_page(migrate->vma, addr); in svm_migrate_copy_to_ram()
624 migrate->dst[i] = migrate_pfn(page_to_pfn(dpage)); in svm_migrate_copy_to_ram()
636 migrate->dst[i] = 0; in svm_migrate_copy_to_ram()
652 struct migrate_vma migrate; in svm_migrate_vma_to_ram() local
658 memset(&migrate, 0, sizeof(migrate)); in svm_migrate_vma_to_ram()
659 migrate.vma = vma; in svm_migrate_vma_to_ram()
660 migrate.start = start; in svm_migrate_vma_to_ram()
661 migrate.end = end; in svm_migrate_vma_to_ram()
662 migrate.flags = MIGRATE_VMA_SELECT_DEVICE_PRIVATE; in svm_migrate_vma_to_ram()
663 migrate.pgmap_owner = SVM_ADEV_PGMAP_OWNER(adev); in svm_migrate_vma_to_ram()
665 size = 2 * sizeof(*migrate.src) + sizeof(uint64_t) + sizeof(dma_addr_t); in svm_migrate_vma_to_ram()
671 migrate.src = buf; in svm_migrate_vma_to_ram()
672 migrate.dst = migrate.src + npages; in svm_migrate_vma_to_ram()
673 scratch = (dma_addr_t *)(migrate.dst + npages); in svm_migrate_vma_to_ram()
675 r = migrate_vma_setup(&migrate); in svm_migrate_vma_to_ram()
682 cpages = migrate.cpages; in svm_migrate_vma_to_ram()
686 upages = svm_migrate_unsuccessful_pages(&migrate); in svm_migrate_vma_to_ram()
695 r = svm_migrate_copy_to_ram(adev, prange, &migrate, &mfence, in svm_migrate_vma_to_ram()
697 migrate_vma_pages(&migrate); in svm_migrate_vma_to_ram()
699 upages = svm_migrate_unsuccessful_pages(&migrate); in svm_migrate_vma_to_ram()
701 upages, cpages, migrate.npages); in svm_migrate_vma_to_ram()
704 migrate_vma_finalize(&migrate); in svm_migrate_vma_to_ram()