};
static struct ttm_tt *amdgpu_ttm_tt_create(struct ttm_bo_device *bdev,
- unsigned long size, uint32_t page_flags,
- struct page *dummy_read_page)
+ unsigned long size, uint32_t page_flags)
{
struct amdgpu_device *adev;
struct amdgpu_ttm_tt *gtt;
}
gtt->ttm.ttm.func = &amdgpu_backend_func;
gtt->adev = adev;
- if (ttm_dma_tt_init(>t->ttm, bdev, size, page_flags, dummy_read_page)) {
+ if (ttm_dma_tt_init(>t->ttm, bdev, size, page_flags)) {
kfree(gtt);
return NULL;
}
static struct ttm_tt *ast_ttm_tt_create(struct ttm_bo_device *bdev,
- unsigned long size, uint32_t page_flags,
- struct page *dummy_read_page)
+ unsigned long size, uint32_t page_flags)
{
struct ttm_tt *tt;
if (tt == NULL)
return NULL;
tt->func = &ast_tt_backend_func;
- if (ttm_tt_init(tt, bdev, size, page_flags, dummy_read_page)) {
+ if (ttm_tt_init(tt, bdev, size, page_flags)) {
kfree(tt);
return NULL;
}
static struct ttm_tt *bochs_ttm_tt_create(struct ttm_bo_device *bdev,
unsigned long size,
- uint32_t page_flags,
- struct page *dummy_read_page)
+ uint32_t page_flags)
{
struct ttm_tt *tt;
if (tt == NULL)
return NULL;
tt->func = &bochs_tt_backend_func;
- if (ttm_tt_init(tt, bdev, size, page_flags, dummy_read_page)) {
+ if (ttm_tt_init(tt, bdev, size, page_flags)) {
kfree(tt);
return NULL;
}
static struct ttm_tt *cirrus_ttm_tt_create(struct ttm_bo_device *bdev,
- unsigned long size, uint32_t page_flags,
- struct page *dummy_read_page)
+ unsigned long size, uint32_t page_flags)
{
struct ttm_tt *tt;
if (tt == NULL)
return NULL;
tt->func = &cirrus_tt_backend_func;
- if (ttm_tt_init(tt, bdev, size, page_flags, dummy_read_page)) {
+ if (ttm_tt_init(tt, bdev, size, page_flags)) {
kfree(tt);
return NULL;
}
static struct ttm_tt *hibmc_ttm_tt_create(struct ttm_bo_device *bdev,
unsigned long size,
- u32 page_flags,
- struct page *dummy_read_page)
+ u32 page_flags)
{
struct ttm_tt *tt;
int ret;
return NULL;
}
tt->func = &hibmc_tt_backend_func;
- ret = ttm_tt_init(tt, bdev, size, page_flags, dummy_read_page);
+ ret = ttm_tt_init(tt, bdev, size, page_flags);
if (ret) {
DRM_ERROR("failed to initialize ttm_tt: %d\n", ret);
kfree(tt);
static struct ttm_tt *mgag200_ttm_tt_create(struct ttm_bo_device *bdev,
- unsigned long size, uint32_t page_flags,
- struct page *dummy_read_page)
+ unsigned long size, uint32_t page_flags)
{
struct ttm_tt *tt;
if (tt == NULL)
return NULL;
tt->func = &mgag200_tt_backend_func;
- if (ttm_tt_init(tt, bdev, size, page_flags, dummy_read_page)) {
+ if (ttm_tt_init(tt, bdev, size, page_flags)) {
kfree(tt);
return NULL;
}
static struct ttm_tt *
nouveau_ttm_tt_create(struct ttm_bo_device *bdev, unsigned long size,
- uint32_t page_flags, struct page *dummy_read)
+ uint32_t page_flags)
{
#if IS_ENABLED(CONFIG_AGP)
struct nouveau_drm *drm = nouveau_bdev(bdev);
if (drm->agp.bridge) {
return ttm_agp_tt_create(bdev, drm->agp.bridge, size,
- page_flags, dummy_read);
+ page_flags);
}
#endif
- return nouveau_sgdma_create_ttm(bdev, size, page_flags, dummy_read);
+ return nouveau_sgdma_create_ttm(bdev, size, page_flags);
}
static int
struct ttm_tt *
nouveau_sgdma_create_ttm(struct ttm_bo_device *bdev,
- unsigned long size, uint32_t page_flags,
- struct page *dummy_read_page)
+ unsigned long size, uint32_t page_flags)
{
struct nouveau_drm *drm = nouveau_bdev(bdev);
struct nouveau_sgdma_be *nvbe;
else
nvbe->ttm.ttm.func = &nv50_sgdma_backend;
- if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags, dummy_read_page))
+ if (ttm_dma_tt_init(&nvbe->ttm, bdev, size, page_flags))
/*
* A failing ttm_dma_tt_init() will call ttm_tt_destroy()
* and thus our nouveau_sgdma_destroy() hook, so we don't need
extern const struct ttm_mem_type_manager_func nv04_gart_manager;
struct ttm_tt *nouveau_sgdma_create_ttm(struct ttm_bo_device *,
- unsigned long size, u32 page_flags,
- struct page *dummy_read_page);
+ unsigned long size, u32 page_flags);
int nouveau_ttm_init(struct nouveau_drm *drm);
void nouveau_ttm_fini(struct nouveau_drm *drm);
};
static struct ttm_tt *qxl_ttm_tt_create(struct ttm_bo_device *bdev,
- unsigned long size, uint32_t page_flags,
- struct page *dummy_read_page)
+ unsigned long size, uint32_t page_flags)
{
struct qxl_device *qdev;
struct qxl_ttm_tt *gtt;
return NULL;
gtt->ttm.ttm.func = &qxl_backend_func;
gtt->qdev = qdev;
- if (ttm_dma_tt_init(>t->ttm, bdev, size, page_flags,
- dummy_read_page)) {
+ if (ttm_dma_tt_init(>t->ttm, bdev, size, page_flags)) {
kfree(gtt);
return NULL;
}
};
static struct ttm_tt *radeon_ttm_tt_create(struct ttm_bo_device *bdev,
- unsigned long size, uint32_t page_flags,
- struct page *dummy_read_page)
+ unsigned long size, uint32_t page_flags)
{
struct radeon_device *rdev;
struct radeon_ttm_tt *gtt;
#if IS_ENABLED(CONFIG_AGP)
if (rdev->flags & RADEON_IS_AGP) {
return ttm_agp_tt_create(bdev, rdev->ddev->agp->bridge,
- size, page_flags, dummy_read_page);
+ size, page_flags);
}
#endif
}
gtt->ttm.ttm.func = &radeon_backend_func;
gtt->rdev = rdev;
- if (ttm_dma_tt_init(>t->ttm, bdev, size, page_flags, dummy_read_page)) {
+ if (ttm_dma_tt_init(>t->ttm, bdev, size, page_flags)) {
kfree(gtt);
return NULL;
}
static int ttm_agp_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem)
{
struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm);
+ struct page *dummy_read_page = ttm->bdev->glob->dummy_read_page;
struct drm_mm_node *node = bo_mem->mm_node;
struct agp_memory *mem;
int ret, cached = (bo_mem->placement & TTM_PL_FLAG_CACHED);
struct page *page = ttm->pages[i];
if (!page)
- page = ttm->dummy_read_page;
+ page = dummy_read_page;
mem->pages[mem->page_count++] = page;
}
struct ttm_tt *ttm_agp_tt_create(struct ttm_bo_device *bdev,
struct agp_bridge_data *bridge,
- unsigned long size, uint32_t page_flags,
- struct page *dummy_read_page)
+ unsigned long size, uint32_t page_flags)
{
struct ttm_agp_backend *agp_be;
agp_be->bridge = bridge;
agp_be->ttm.func = &ttm_agp_func;
- if (ttm_tt_init(&agp_be->ttm, bdev, size, page_flags, dummy_read_page)) {
+ if (ttm_tt_init(&agp_be->ttm, bdev, size, page_flags)) {
kfree(agp_be);
return NULL;
}
static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc)
{
struct ttm_bo_device *bdev = bo->bdev;
- struct ttm_bo_global *glob = bdev->glob;
int ret = 0;
uint32_t page_flags = 0;
page_flags |= TTM_PAGE_FLAG_ZERO_ALLOC;
case ttm_bo_type_kernel:
bo->ttm = bdev->driver->ttm_tt_create(bdev, bo->num_pages << PAGE_SHIFT,
- page_flags, glob->dummy_read_page);
+ page_flags);
if (unlikely(bo->ttm == NULL))
ret = -ENOMEM;
break;
case ttm_bo_type_sg:
bo->ttm = bdev->driver->ttm_tt_create(bdev, bo->num_pages << PAGE_SHIFT,
- page_flags | TTM_PAGE_FLAG_SG,
- glob->dummy_read_page);
+ page_flags | TTM_PAGE_FLAG_SG);
if (unlikely(bo->ttm == NULL)) {
ret = -ENOMEM;
break;
}
int ttm_tt_init(struct ttm_tt *ttm, struct ttm_bo_device *bdev,
- unsigned long size, uint32_t page_flags,
- struct page *dummy_read_page)
+ unsigned long size, uint32_t page_flags)
{
ttm->bdev = bdev;
ttm->num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
ttm->caching_state = tt_cached;
ttm->page_flags = page_flags;
- ttm->dummy_read_page = dummy_read_page;
ttm->state = tt_unpopulated;
ttm->swap_storage = NULL;
EXPORT_SYMBOL(ttm_tt_fini);
int ttm_dma_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_bo_device *bdev,
- unsigned long size, uint32_t page_flags,
- struct page *dummy_read_page)
+ unsigned long size, uint32_t page_flags)
{
struct ttm_tt *ttm = &ttm_dma->ttm;
ttm->num_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
ttm->caching_state = tt_cached;
ttm->page_flags = page_flags;
- ttm->dummy_read_page = dummy_read_page;
ttm->state = tt_unpopulated;
ttm->swap_storage = NULL;
static struct ttm_tt *virtio_gpu_ttm_tt_create(struct ttm_bo_device *bdev,
unsigned long size,
- uint32_t page_flags,
- struct page *dummy_read_page)
+ uint32_t page_flags)
{
struct virtio_gpu_device *vgdev;
struct virtio_gpu_ttm_tt *gtt;
return NULL;
gtt->ttm.ttm.func = &virtio_gpu_backend_func;
gtt->vgdev = vgdev;
- if (ttm_dma_tt_init(>t->ttm, bdev, size, page_flags,
- dummy_read_page)) {
+ if (ttm_dma_tt_init(>t->ttm, bdev, size, page_flags)) {
kfree(gtt);
return NULL;
}
};
static struct ttm_tt *vmw_ttm_tt_create(struct ttm_bo_device *bdev,
- unsigned long size, uint32_t page_flags,
- struct page *dummy_read_page)
+ unsigned long size, uint32_t page_flags)
{
struct vmw_ttm_tt *vmw_be;
int ret;
vmw_be->mob = NULL;
if (vmw_be->dev_priv->map_mode == vmw_dma_alloc_coherent)
- ret = ttm_dma_tt_init(&vmw_be->dma_ttm, bdev, size, page_flags,
- dummy_read_page);
+ ret = ttm_dma_tt_init(&vmw_be->dma_ttm, bdev, size, page_flags);
else
- ret = ttm_tt_init(&vmw_be->dma_ttm.ttm, bdev, size, page_flags,
- dummy_read_page);
+ ret = ttm_tt_init(&vmw_be->dma_ttm.ttm, bdev, size, page_flags);
if (unlikely(ret != 0))
goto out_no_init;
static struct ttm_tt *vbox_ttm_tt_create(struct ttm_bo_device *bdev,
unsigned long size,
- u32 page_flags,
- struct page *dummy_read_page)
+ u32 page_flags)
{
struct ttm_tt *tt;
return NULL;
tt->func = &vbox_tt_backend_func;
- if (ttm_tt_init(tt, bdev, size, page_flags, dummy_read_page)) {
+ if (ttm_tt_init(tt, bdev, size, page_flags)) {
kfree(tt);
return NULL;
}
* @bdev: Pointer to a struct ttm_bo_device.
* @func: Pointer to a struct ttm_backend_func that describes
* the backend methods.
- * @dummy_read_page: Page to map where the ttm_tt page array contains a NULL
* pointer.
* @pages: Array of pages backing the data.
* @num_pages: Number of pages in the page array.
struct ttm_tt {
struct ttm_bo_device *bdev;
struct ttm_backend_func *func;
- struct page *dummy_read_page;
struct page **pages;
uint32_t page_flags;
unsigned long num_pages;
* @bdev: pointer to a struct ttm_bo_device:
* @size: Size of the data needed backing.
* @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags.
- * @dummy_read_page: See struct ttm_bo_device.
*
* Create a struct ttm_tt to back data with system memory pages.
* No pages are actually allocated.
*/
struct ttm_tt *(*ttm_tt_create)(struct ttm_bo_device *bdev,
unsigned long size,
- uint32_t page_flags,
- struct page *dummy_read_page);
+ uint32_t page_flags);
/**
* ttm_tt_populate
* @bdev: pointer to a struct ttm_bo_device:
* @size: Size of the data needed backing.
* @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags.
- * @dummy_read_page: See struct ttm_bo_device.
*
* Create a struct ttm_tt to back data with system memory pages.
* No pages are actually allocated.
* NULL: Out of memory.
*/
int ttm_tt_init(struct ttm_tt *ttm, struct ttm_bo_device *bdev,
- unsigned long size, uint32_t page_flags,
- struct page *dummy_read_page);
+ unsigned long size, uint32_t page_flags);
int ttm_dma_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_bo_device *bdev,
- unsigned long size, uint32_t page_flags,
- struct page *dummy_read_page);
+ unsigned long size, uint32_t page_flags);
/**
* ttm_tt_fini
* @bridge: The agp bridge this device is sitting on.
* @size: Size of the data needed backing.
* @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags.
- * @dummy_read_page: See struct ttm_bo_device.
*
*
* Create a TTM backend that uses the indicated AGP bridge as an aperture
*/
struct ttm_tt *ttm_agp_tt_create(struct ttm_bo_device *bdev,
struct agp_bridge_data *bridge,
- unsigned long size, uint32_t page_flags,
- struct page *dummy_read_page);
+ unsigned long size, uint32_t page_flags);
int ttm_agp_tt_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx);
void ttm_agp_tt_unpopulate(struct ttm_tt *ttm);
#endif