unsigned long pfn_first;
unsigned long callocated;
unsigned long bitmap[BITS_TO_LONGS(DMEM_CHUNK_NPAGES)];
- struct nvif_vma vma;
spinlock_t lock;
};
chunk = (void *)hmm_devmem_page_get_drvdata(spage);
src_addr = page_to_pfn(spage) - chunk->pfn_first;
- src_addr = (src_addr << PAGE_SHIFT) + chunk->vma.addr;
+ src_addr = (src_addr << PAGE_SHIFT) + chunk->bo->bo.offset;
ret = copy(drm, 1, NOUVEAU_APER_VIRT, dst_addr,
- NOUVEAU_APER_VIRT, src_addr);
+ NOUVEAU_APER_VRAM, src_addr);
if (ret) {
dst_pfns[i] = MIGRATE_PFN_ERROR;
__free_page(dpage);
static int
nouveau_dmem_chunk_alloc(struct nouveau_drm *drm)
{
- struct nvif_vmm *vmm = &drm->client.vmm.vmm;
struct nouveau_dmem_chunk *chunk;
int ret;
list_del(&chunk->list);
mutex_unlock(&drm->dmem->mutex);
- ret = nvif_vmm_get(vmm, LAZY, false, 12, 0,
- DMEM_CHUNK_SIZE, &chunk->vma);
- if (ret)
- goto out;
-
ret = nouveau_bo_new(&drm->client, DMEM_CHUNK_SIZE, 0,
TTM_PL_FLAG_VRAM, 0, 0, NULL, NULL,
&chunk->bo);
goto out;
}
- ret = nouveau_mem_map(nouveau_mem(&chunk->bo->bo.mem), vmm, &chunk->vma);
- if (ret) {
- nouveau_bo_unpin(chunk->bo);
- nouveau_bo_ref(NULL, &chunk->bo);
- goto out;
- }
-
bitmap_zero(chunk->bitmap, DMEM_CHUNK_NPAGES);
spin_lock_init(&chunk->lock);
void
nouveau_dmem_fini(struct nouveau_drm *drm)
{
- struct nvif_vmm *vmm = &drm->client.vmm.vmm;
struct nouveau_dmem_chunk *chunk, *tmp;
if (drm->dmem == NULL)
nouveau_bo_unpin(chunk->bo);
nouveau_bo_ref(NULL, &chunk->bo);
}
- nvif_vmm_put(vmm, &chunk->vma);
list_del(&chunk->list);
kfree(chunk);
}
chunk = (void *)hmm_devmem_page_get_drvdata(dpage);
dst_addr = page_to_pfn(dpage) - chunk->pfn_first;
- dst_addr = (dst_addr << PAGE_SHIFT) + chunk->vma.addr;
+ dst_addr = (dst_addr << PAGE_SHIFT) + chunk->bo->bo.offset;
spage = migrate_pfn_to_page(src_pfns[i]);
if (!spage || !(src_pfns[i] & MIGRATE_PFN_MIGRATE)) {
src_addr = migrate->hmem.vma.addr + (c << PAGE_SHIFT);
c++;
- ret = copy(drm, 1, NOUVEAU_APER_VIRT, dst_addr,
+ ret = copy(drm, 1, NOUVEAU_APER_VRAM, dst_addr,
NOUVEAU_APER_VIRT, src_addr);
if (ret) {
nouveau_dmem_page_free_locked(drm, dpage);