aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/ast/ast_ttm.c2
-rw-r--r--drivers/gpu/drm/bochs/bochs_mm.c2
-rw-r--r--drivers/gpu/drm/cirrus/cirrus_ttm.c2
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_ttm.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c2
-rw-r--r--drivers/gpu/drm/qxl/qxl_object.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c2
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c24
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_resource.c2
9 files changed, 26 insertions, 14 deletions
diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c
index c65d432f42c4..08f82eae6939 100644
--- a/drivers/gpu/drm/ast/ast_ttm.c
+++ b/drivers/gpu/drm/ast/ast_ttm.c
@@ -339,7 +339,7 @@ int ast_bo_create(struct drm_device *dev, int size, int align,
339 ret = ttm_bo_init(&ast->ttm.bdev, &astbo->bo, size, 339 ret = ttm_bo_init(&ast->ttm.bdev, &astbo->bo, size,
340 ttm_bo_type_device, &astbo->placement, 340 ttm_bo_type_device, &astbo->placement,
341 align >> PAGE_SHIFT, false, NULL, acc_size, 341 align >> PAGE_SHIFT, false, NULL, acc_size,
342 NULL, ast_bo_ttm_destroy); 342 NULL, NULL, ast_bo_ttm_destroy);
343 if (ret) 343 if (ret)
344 return ret; 344 return ret;
345 345
diff --git a/drivers/gpu/drm/bochs/bochs_mm.c b/drivers/gpu/drm/bochs/bochs_mm.c
index 324f5a09a0a1..66286ff518d4 100644
--- a/drivers/gpu/drm/bochs/bochs_mm.c
+++ b/drivers/gpu/drm/bochs/bochs_mm.c
@@ -377,7 +377,7 @@ static int bochs_bo_create(struct drm_device *dev, int size, int align,
377 ret = ttm_bo_init(&bochs->ttm.bdev, &bochsbo->bo, size, 377 ret = ttm_bo_init(&bochs->ttm.bdev, &bochsbo->bo, size,
378 ttm_bo_type_device, &bochsbo->placement, 378 ttm_bo_type_device, &bochsbo->placement,
379 align >> PAGE_SHIFT, false, NULL, acc_size, 379 align >> PAGE_SHIFT, false, NULL, acc_size,
380 NULL, bochs_bo_ttm_destroy); 380 NULL, NULL, bochs_bo_ttm_destroy);
381 if (ret) 381 if (ret)
382 return ret; 382 return ret;
383 383
diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c b/drivers/gpu/drm/cirrus/cirrus_ttm.c
index d3c615f9b183..dfffd528517a 100644
--- a/drivers/gpu/drm/cirrus/cirrus_ttm.c
+++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c
@@ -343,7 +343,7 @@ int cirrus_bo_create(struct drm_device *dev, int size, int align,
343 ret = ttm_bo_init(&cirrus->ttm.bdev, &cirrusbo->bo, size, 343 ret = ttm_bo_init(&cirrus->ttm.bdev, &cirrusbo->bo, size,
344 ttm_bo_type_device, &cirrusbo->placement, 344 ttm_bo_type_device, &cirrusbo->placement,
345 align >> PAGE_SHIFT, false, NULL, acc_size, 345 align >> PAGE_SHIFT, false, NULL, acc_size,
346 NULL, cirrus_bo_ttm_destroy); 346 NULL, NULL, cirrus_bo_ttm_destroy);
347 if (ret) 347 if (ret)
348 return ret; 348 return ret;
349 349
diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c b/drivers/gpu/drm/mgag200/mgag200_ttm.c
index 8ac70626df6c..d16964ea0ed4 100644
--- a/drivers/gpu/drm/mgag200/mgag200_ttm.c
+++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c
@@ -339,7 +339,7 @@ int mgag200_bo_create(struct drm_device *dev, int size, int align,
339 ret = ttm_bo_init(&mdev->ttm.bdev, &mgabo->bo, size, 339 ret = ttm_bo_init(&mdev->ttm.bdev, &mgabo->bo, size,
340 ttm_bo_type_device, &mgabo->placement, 340 ttm_bo_type_device, &mgabo->placement,
341 align >> PAGE_SHIFT, false, NULL, acc_size, 341 align >> PAGE_SHIFT, false, NULL, acc_size,
342 NULL, mgag200_bo_ttm_destroy); 342 NULL, NULL, mgag200_bo_ttm_destroy);
343 if (ret) 343 if (ret)
344 return ret; 344 return ret;
345 345
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 049f5de90928..7034cacaa4a1 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -230,7 +230,7 @@ nouveau_bo_new(struct drm_device *dev, int size, int align,
230 ret = ttm_bo_init(&drm->ttm.bdev, &nvbo->bo, size, 230 ret = ttm_bo_init(&drm->ttm.bdev, &nvbo->bo, size,
231 type, &nvbo->placement, 231 type, &nvbo->placement,
232 align >> PAGE_SHIFT, false, NULL, acc_size, sg, 232 align >> PAGE_SHIFT, false, NULL, acc_size, sg,
233 nouveau_bo_del_ttm); 233 NULL, nouveau_bo_del_ttm);
234 if (ret) { 234 if (ret) {
235 /* ttm will call nouveau_bo_del_ttm if it fails.. */ 235 /* ttm will call nouveau_bo_del_ttm if it fails.. */
236 return ret; 236 return ret;
diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm/qxl/qxl_object.c
index 69c104c3240f..cdeaf08fdc74 100644
--- a/drivers/gpu/drm/qxl/qxl_object.c
+++ b/drivers/gpu/drm/qxl/qxl_object.c
@@ -110,7 +110,7 @@ int qxl_bo_create(struct qxl_device *qdev,
110 110
111 r = ttm_bo_init(&qdev->mman.bdev, &bo->tbo, size, type, 111 r = ttm_bo_init(&qdev->mman.bdev, &bo->tbo, size, type,
112 &bo->placement, 0, !kernel, NULL, size, 112 &bo->placement, 0, !kernel, NULL, size,
113 NULL, &qxl_ttm_bo_destroy); 113 NULL, NULL, &qxl_ttm_bo_destroy);
114 if (unlikely(r != 0)) { 114 if (unlikely(r != 0)) {
115 if (r != -ERESTARTSYS) 115 if (r != -ERESTARTSYS)
116 dev_err(qdev->dev, 116 dev_err(qdev->dev,
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index 8abee5fa93bd..0e82f0223fd4 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -216,7 +216,7 @@ int radeon_bo_create(struct radeon_device *rdev,
216 down_read(&rdev->pm.mclk_lock); 216 down_read(&rdev->pm.mclk_lock);
217 r = ttm_bo_init(&rdev->mman.bdev, &bo->tbo, size, type, 217 r = ttm_bo_init(&rdev->mman.bdev, &bo->tbo, size, type,
218 &bo->placement, page_align, !kernel, NULL, 218 &bo->placement, page_align, !kernel, NULL,
219 acc_size, sg, &radeon_ttm_bo_destroy); 219 acc_size, sg, NULL, &radeon_ttm_bo_destroy);
220 up_read(&rdev->pm.mclk_lock); 220 up_read(&rdev->pm.mclk_lock);
221 if (unlikely(r != 0)) { 221 if (unlikely(r != 0)) {
222 return r; 222 return r;
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index a11969acfea5..8f5cec67c47d 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1068,6 +1068,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
1068 struct file *persistent_swap_storage, 1068 struct file *persistent_swap_storage,
1069 size_t acc_size, 1069 size_t acc_size,
1070 struct sg_table *sg, 1070 struct sg_table *sg,
1071 struct reservation_object *resv,
1071 void (*destroy) (struct ttm_buffer_object *)) 1072 void (*destroy) (struct ttm_buffer_object *))
1072{ 1073{
1073 int ret = 0; 1074 int ret = 0;
@@ -1121,8 +1122,13 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
1121 bo->persistent_swap_storage = persistent_swap_storage; 1122 bo->persistent_swap_storage = persistent_swap_storage;
1122 bo->acc_size = acc_size; 1123 bo->acc_size = acc_size;
1123 bo->sg = sg; 1124 bo->sg = sg;
1124 bo->resv = &bo->ttm_resv; 1125 if (resv) {
1125 reservation_object_init(bo->resv); 1126 bo->resv = resv;
1127 lockdep_assert_held(&bo->resv->lock.base);
1128 } else {
1129 bo->resv = &bo->ttm_resv;
1130 reservation_object_init(&bo->ttm_resv);
1131 }
1126 atomic_inc(&bo->glob->bo_count); 1132 atomic_inc(&bo->glob->bo_count);
1127 drm_vma_node_reset(&bo->vma_node); 1133 drm_vma_node_reset(&bo->vma_node);
1128 1134
@@ -1135,13 +1141,19 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
1135 ret = drm_vma_offset_add(&bdev->vma_manager, &bo->vma_node, 1141 ret = drm_vma_offset_add(&bdev->vma_manager, &bo->vma_node,
1136 bo->mem.num_pages); 1142 bo->mem.num_pages);
1137 1143
1138 locked = ww_mutex_trylock(&bo->resv->lock); 1144 /* passed reservation objects should already be locked,
1139 WARN_ON(!locked); 1145 * since otherwise lockdep will be angered in radeon.
1146 */
1147 if (!resv) {
1148 locked = ww_mutex_trylock(&bo->resv->lock);
1149 WARN_ON(!locked);
1150 }
1140 1151
1141 if (likely(!ret)) 1152 if (likely(!ret))
1142 ret = ttm_bo_validate(bo, placement, interruptible, false); 1153 ret = ttm_bo_validate(bo, placement, interruptible, false);
1143 1154
1144 ttm_bo_unreserve(bo); 1155 if (!resv)
1156 ttm_bo_unreserve(bo);
1145 1157
1146 if (unlikely(ret)) 1158 if (unlikely(ret))
1147 ttm_bo_unref(&bo); 1159 ttm_bo_unref(&bo);
@@ -1199,7 +1211,7 @@ int ttm_bo_create(struct ttm_bo_device *bdev,
1199 acc_size = ttm_bo_acc_size(bdev, size, sizeof(struct ttm_buffer_object)); 1211 acc_size = ttm_bo_acc_size(bdev, size, sizeof(struct ttm_buffer_object));
1200 ret = ttm_bo_init(bdev, bo, size, type, placement, page_alignment, 1212 ret = ttm_bo_init(bdev, bo, size, type, placement, page_alignment,
1201 interruptible, persistent_swap_storage, acc_size, 1213 interruptible, persistent_swap_storage, acc_size,
1202 NULL, NULL); 1214 NULL, NULL, NULL);
1203 if (likely(ret == 0)) 1215 if (likely(ret == 0))
1204 *p_bo = bo; 1216 *p_bo = bo;
1205 1217
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
index 26584316cb78..026de7cea0f6 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
@@ -430,7 +430,7 @@ int vmw_dmabuf_init(struct vmw_private *dev_priv,
430 ret = ttm_bo_init(bdev, &vmw_bo->base, size, 430 ret = ttm_bo_init(bdev, &vmw_bo->base, size,
431 ttm_bo_type_device, placement, 431 ttm_bo_type_device, placement,
432 0, interruptible, 432 0, interruptible,
433 NULL, acc_size, NULL, bo_free); 433 NULL, acc_size, NULL, NULL, bo_free);
434 return ret; 434 return ret;
435} 435}
436 436