@@ -969,8 +969,7 @@ static struct ttm_backend_func amdgpu_backend_func = {
};
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;
@@ -983,7 +982,7 @@ static struct ttm_tt *amdgpu_ttm_tt_create(struct ttm_bo_device *bdev,
}
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;
}
@@ -200,8 +200,7 @@ static struct ttm_backend_func ast_tt_backend_func = {
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;
@@ -209,7 +208,7 @@ static struct ttm_tt *ast_ttm_tt_create(struct ttm_bo_device *bdev,
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;
}
@@ -178,8 +178,7 @@ static struct ttm_backend_func bochs_tt_backend_func = {
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;
@@ -187,7 +186,7 @@ static struct ttm_tt *bochs_ttm_tt_create(struct ttm_bo_device *bdev,
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;
}
@@ -200,8 +200,7 @@ static struct ttm_backend_func cirrus_tt_backend_func = {
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;
@@ -209,7 +208,7 @@ static struct ttm_tt *cirrus_ttm_tt_create(struct ttm_bo_device *bdev,
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;
}
@@ -202,8 +202,7 @@ static struct ttm_backend_func hibmc_tt_backend_func = {
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;
@@ -214,7 +213,7 @@ static struct ttm_tt *hibmc_ttm_tt_create(struct ttm_bo_device *bdev,
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);
@@ -200,8 +200,7 @@ static struct ttm_backend_func mgag200_tt_backend_func = {
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;
@@ -209,7 +208,7 @@ static struct ttm_tt *mgag200_ttm_tt_create(struct ttm_bo_device *bdev,
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;
}
@@ -604,18 +604,18 @@ nouveau_bo_wr32(struct nouveau_bo *nvbo, unsigned index, u32 val)
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
@@ -83,8 +83,7 @@ static struct ttm_backend_func nv50_sgdma_backend = {
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;
@@ -98,7 +97,7 @@ nouveau_sgdma_create_ttm(struct ttm_bo_device *bdev,
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
@@ -13,8 +13,7 @@ extern const struct ttm_mem_type_manager_func nouveau_gart_manager;
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);
@@ -292,8 +292,7 @@ static struct ttm_backend_func qxl_backend_func = {
};
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;
@@ -304,8 +303,7 @@ static struct ttm_tt *qxl_ttm_tt_create(struct ttm_bo_device *bdev,
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;
}
@@ -687,8 +687,7 @@ static struct ttm_backend_func radeon_backend_func = {
};
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;
@@ -697,7 +696,7 @@ static struct ttm_tt *radeon_ttm_tt_create(struct ttm_bo_device *bdev,
#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
@@ -707,7 +706,7 @@ static struct ttm_tt *radeon_ttm_tt_create(struct ttm_bo_device *bdev,
}
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;
}
@@ -50,6 +50,7 @@ struct ttm_agp_backend {
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);
@@ -64,7 +65,7 @@ static int ttm_agp_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem)
struct page *page = ttm->pages[i];
if (!page)
- page = ttm->dummy_read_page;
+ page = dummy_read_page;
mem->pages[mem->page_count++] = page;
}
@@ -111,8 +112,7 @@ static struct ttm_backend_func ttm_agp_func = {
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;
@@ -124,7 +124,7 @@ struct ttm_tt *ttm_agp_tt_create(struct ttm_bo_device *bdev,
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;
}
@@ -228,7 +228,6 @@ EXPORT_SYMBOL(ttm_bo_move_to_lru_tail);
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;
@@ -247,14 +246,13 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc)
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;
@@ -191,14 +191,12 @@ void ttm_tt_destroy(struct ttm_tt *ttm)
}
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;
@@ -219,8 +217,7 @@ void ttm_tt_fini(struct ttm_tt *ttm)
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;
@@ -228,7 +225,6 @@ int ttm_dma_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_bo_device *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;
@@ -326,8 +326,7 @@ static struct ttm_backend_func virtio_gpu_backend_func = {
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;
@@ -338,8 +337,7 @@ static struct ttm_tt *virtio_gpu_ttm_tt_create(struct ttm_bo_device *bdev,
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;
}
@@ -694,8 +694,7 @@ static struct ttm_backend_func vmw_ttm_func = {
};
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;
@@ -709,11 +708,9 @@ static struct ttm_tt *vmw_ttm_tt_create(struct ttm_bo_device *bdev,
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;
@@ -195,8 +195,7 @@ static struct ttm_backend_func vbox_tt_backend_func = {
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;
@@ -205,7 +204,7 @@ static struct ttm_tt *vbox_ttm_tt_create(struct ttm_bo_device *bdev,
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;
}
@@ -100,7 +100,6 @@ enum ttm_caching_state {
* @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.
@@ -118,7 +117,6 @@ enum ttm_caching_state {
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;
@@ -331,7 +329,6 @@ struct ttm_bo_driver {
* @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.
@@ -340,8 +337,7 @@ struct ttm_bo_driver {
*/
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
@@ -621,7 +617,6 @@ ttm_flag_masked(uint32_t *old, uint32_t new, uint32_t mask)
* @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.
@@ -629,11 +624,9 @@ ttm_flag_masked(uint32_t *old, uint32_t new, uint32_t mask)
* 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
@@ -1080,7 +1073,6 @@ extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
* @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
@@ -1089,8 +1081,7 @@ extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
*/
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
Only used by the AGP backend and there it can be easily accessed using ttm->bdev->glob. Signed-off-by: Christian König <christian.koenig@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 5 ++--- drivers/gpu/drm/ast/ast_ttm.c | 5 ++--- drivers/gpu/drm/bochs/bochs_mm.c | 5 ++--- drivers/gpu/drm/cirrus/cirrus_ttm.c | 5 ++--- drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 5 ++--- drivers/gpu/drm/mgag200/mgag200_ttm.c | 5 ++--- drivers/gpu/drm/nouveau/nouveau_bo.c | 6 +++--- drivers/gpu/drm/nouveau/nouveau_sgdma.c | 5 ++--- drivers/gpu/drm/nouveau/nouveau_ttm.h | 3 +-- drivers/gpu/drm/qxl/qxl_ttm.c | 6 ++---- drivers/gpu/drm/radeon/radeon_ttm.c | 7 +++---- drivers/gpu/drm/ttm/ttm_agp_backend.c | 8 ++++---- drivers/gpu/drm/ttm/ttm_bo.c | 6 ++---- drivers/gpu/drm/ttm/ttm_tt.c | 8 ++------ drivers/gpu/drm/virtio/virtgpu_ttm.c | 6 ++---- drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c | 9 +++------ drivers/staging/vboxvideo/vbox_ttm.c | 5 ++--- include/drm/ttm/ttm_bo_driver.h | 17 ++++------------- 18 files changed, 42 insertions(+), 74 deletions(-)