drm/ttm: nuke ttm_tt_set_(un)populated again
Neither page allocation backend nor the driver should mess with that. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Madhav Chauhan <madhav.chauhan@amd.com> Link: https://patchwork.freedesktop.org/patch/396948/
This commit is contained in:
parent
ef52d5853b
commit
d1cb1f254a
|
@ -1363,7 +1363,6 @@ static int amdgpu_ttm_tt_populate(struct ttm_bo_device *bdev,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
ttm->page_flags |= TTM_PAGE_FLAG_SG;
|
ttm->page_flags |= TTM_PAGE_FLAG_SG;
|
||||||
ttm_tt_set_populated(ttm);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1383,7 +1382,6 @@ static int amdgpu_ttm_tt_populate(struct ttm_bo_device *bdev,
|
||||||
drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
|
drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
|
||||||
gtt->ttm.dma_address,
|
gtt->ttm.dma_address,
|
||||||
ttm->num_pages);
|
ttm->num_pages);
|
||||||
ttm_tt_set_populated(ttm);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1321,7 +1321,6 @@ nouveau_ttm_tt_populate(struct ttm_bo_device *bdev,
|
||||||
/* make userspace faulting work */
|
/* make userspace faulting work */
|
||||||
drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
|
drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
|
||||||
ttm_dma->dma_address, ttm->num_pages);
|
ttm_dma->dma_address, ttm->num_pages);
|
||||||
ttm_tt_set_populated(ttm);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -670,14 +670,12 @@ static int radeon_ttm_tt_populate(struct ttm_bo_device *bdev,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
ttm->page_flags |= TTM_PAGE_FLAG_SG;
|
ttm->page_flags |= TTM_PAGE_FLAG_SG;
|
||||||
ttm_tt_set_populated(ttm);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slave && ttm->sg) {
|
if (slave && ttm->sg) {
|
||||||
drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
|
drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
|
||||||
gtt->ttm.dma_address, ttm->num_pages);
|
gtt->ttm.dma_address, ttm->num_pages);
|
||||||
ttm_tt_set_populated(ttm);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1041,7 +1041,6 @@ ttm_pool_unpopulate_helper(struct ttm_tt *ttm, unsigned mem_count_update)
|
||||||
put_pages:
|
put_pages:
|
||||||
ttm_put_pages(ttm->pages, ttm->num_pages, ttm->page_flags,
|
ttm_put_pages(ttm->pages, ttm->num_pages, ttm->page_flags,
|
||||||
ttm->caching);
|
ttm->caching);
|
||||||
ttm_tt_set_unpopulated(ttm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
|
int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
|
||||||
|
@ -1080,7 +1079,6 @@ int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ttm_tt_set_populated(ttm);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ttm_pool_populate);
|
EXPORT_SYMBOL(ttm_pool_populate);
|
||||||
|
|
|
@ -983,7 +983,6 @@ skip_huge:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ttm_tt_set_populated(ttm);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(ttm_dma_populate);
|
EXPORT_SYMBOL_GPL(ttm_dma_populate);
|
||||||
|
@ -1077,7 +1076,6 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)
|
||||||
/* shrink pool if necessary (only on !is_cached pools)*/
|
/* shrink pool if necessary (only on !is_cached pools)*/
|
||||||
if (npages)
|
if (npages)
|
||||||
ttm_dma_page_pool_free(pool, npages, false);
|
ttm_dma_page_pool_free(pool, npages, false);
|
||||||
ttm_tt_set_unpopulated(ttm);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(ttm_dma_unpopulate);
|
EXPORT_SYMBOL_GPL(ttm_dma_unpopulate);
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,6 @@ static void ttm_tt_init_fields(struct ttm_tt *ttm,
|
||||||
ttm->num_pages = bo->num_pages;
|
ttm->num_pages = bo->num_pages;
|
||||||
ttm->caching = ttm_cached;
|
ttm->caching = ttm_cached;
|
||||||
ttm->page_flags = page_flags;
|
ttm->page_flags = page_flags;
|
||||||
ttm_tt_set_unpopulated(ttm);
|
|
||||||
ttm->swap_storage = NULL;
|
ttm->swap_storage = NULL;
|
||||||
ttm->sg = bo->sg;
|
ttm->sg = bo->sg;
|
||||||
ttm->caching = caching;
|
ttm->caching = caching;
|
||||||
|
@ -334,9 +333,12 @@ int ttm_tt_populate(struct ttm_bo_device *bdev,
|
||||||
ret = bdev->driver->ttm_tt_populate(bdev, ttm, ctx);
|
ret = bdev->driver->ttm_tt_populate(bdev, ttm, ctx);
|
||||||
else
|
else
|
||||||
ret = ttm_pool_populate(ttm, ctx);
|
ret = ttm_pool_populate(ttm, ctx);
|
||||||
if (!ret)
|
if (ret)
|
||||||
ttm_tt_add_mapping(bdev, ttm);
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
ttm_tt_add_mapping(bdev, ttm);
|
||||||
|
ttm->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ttm_tt_populate);
|
EXPORT_SYMBOL(ttm_tt_populate);
|
||||||
|
|
||||||
|
@ -365,4 +367,5 @@ void ttm_tt_unpopulate(struct ttm_bo_device *bdev,
|
||||||
bdev->driver->ttm_tt_unpopulate(bdev, ttm);
|
bdev->driver->ttm_tt_unpopulate(bdev, ttm);
|
||||||
else
|
else
|
||||||
ttm_pool_unpopulate(ttm);
|
ttm_pool_unpopulate(ttm);
|
||||||
|
ttm->page_flags &= ~TTM_PAGE_FLAG_PRIV_POPULATED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,16 +72,6 @@ static inline bool ttm_tt_is_populated(struct ttm_tt *tt)
|
||||||
return tt->page_flags & TTM_PAGE_FLAG_PRIV_POPULATED;
|
return tt->page_flags & TTM_PAGE_FLAG_PRIV_POPULATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void ttm_tt_set_unpopulated(struct ttm_tt *tt)
|
|
||||||
{
|
|
||||||
tt->page_flags &= ~TTM_PAGE_FLAG_PRIV_POPULATED;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void ttm_tt_set_populated(struct ttm_tt *tt)
|
|
||||||
{
|
|
||||||
tt->page_flags |= TTM_PAGE_FLAG_PRIV_POPULATED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct ttm_dma_tt
|
* struct ttm_dma_tt
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue