summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ttm/ttm_bo.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2023-01-25 16:49:02 +0100
committerChristian König <christian.koenig@amd.com>2023-01-25 17:27:51 +0100
commit0c8fb2469438256a9cbb690d538437db6f845df8 (patch)
treee5f04964e58a0e177abb8f2333de9a73e708e9aa /drivers/gpu/drm/ttm/ttm_bo.c
parentdrm/ttm: revert "stop allocating a dummy resource for pipelined gutting" (diff)
downloadlinux-0c8fb2469438256a9cbb690d538437db6f845df8.tar.xz
linux-0c8fb2469438256a9cbb690d538437db6f845df8.zip
drm/ttm: revert "stop allocating dummy resources during BO creation"
This reverts commit 00984ad39599bb2a1e6ec5d4e9c75a749f7f45c9. It seems to still breka i915. Signed-off-by: Christian König <christian.koenig@amd.com> Acked-by: Matthew Auld <matthew.william.auld@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230125155023.105584-1-christian.koenig@amd.com
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_bo.c')
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index bb0c21c8caac..326a3d13a829 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -953,6 +953,7 @@ int ttm_bo_init_reserved(struct ttm_device *bdev, struct ttm_buffer_object *bo,
struct sg_table *sg, struct dma_resv *resv,
void (*destroy) (struct ttm_buffer_object *))
{
+ static const struct ttm_place sys_mem = { .mem_type = TTM_PL_SYSTEM };
int ret;
kref_init(&bo->kref);
@@ -969,6 +970,12 @@ int ttm_bo_init_reserved(struct ttm_device *bdev, struct ttm_buffer_object *bo,
bo->base.resv = &bo->base._resv;
atomic_inc(&ttm_glob.bo_count);
+ ret = ttm_resource_alloc(bo, &sys_mem, &bo->resource);
+ if (unlikely(ret)) {
+ ttm_bo_put(bo);
+ return ret;
+ }
+
/*
* For ttm_bo_type_device buffers, allocate
* address space from the device.