aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2017-04-12 08:41:43 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-12-06 12:48:02 -0500
commit6fead44a4c5897c1524005ed3228b86120ff3ada (patch)
treee49962694f6e0d4ae3101965e93fdaa913dd3879 /drivers/gpu/drm
parent19be5570107108fba772bc2e3a1eb22ec32fb021 (diff)
drm/ttm: use an operation ctx for ttm_bo_init_reserved
Instead of specifying if sleeping should be interruptible. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Chunming Zhou <david1.zhou@amd.com> Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de> Tested-by: Michel Dänzer <michel.daenzer@amd.com> Acked-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_object.c3
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c12
2 files changed, 7 insertions, 8 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index c2419bc6b3df..15027f751e07 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -327,6 +327,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
327 uint64_t init_value, 327 uint64_t init_value,
328 struct amdgpu_bo **bo_ptr) 328 struct amdgpu_bo **bo_ptr)
329{ 329{
330 struct ttm_operation_ctx ctx = { !kernel, false };
330 struct amdgpu_bo *bo; 331 struct amdgpu_bo *bo;
331 enum ttm_bo_type type; 332 enum ttm_bo_type type;
332 unsigned long page_align; 333 unsigned long page_align;
@@ -408,7 +409,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
408 initial_bytes_moved = atomic64_read(&adev->num_bytes_moved); 409 initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
409 /* Kernel allocation are uninterruptible */ 410 /* Kernel allocation are uninterruptible */
410 r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, type, 411 r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, type,
411 &bo->placement, page_align, !kernel, NULL, 412 &bo->placement, page_align, &ctx, NULL,
412 acc_size, sg, resv, &amdgpu_ttm_bo_destroy); 413 acc_size, sg, resv, &amdgpu_ttm_bo_destroy);
413 if (unlikely(r != 0)) 414 if (unlikely(r != 0))
414 return r; 415 return r;
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 5347c3f3e2f4..1f6957adc19e 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1132,7 +1132,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
1132 enum ttm_bo_type type, 1132 enum ttm_bo_type type,
1133 struct ttm_placement *placement, 1133 struct ttm_placement *placement,
1134 uint32_t page_alignment, 1134 uint32_t page_alignment,
1135 bool interruptible, 1135 struct ttm_operation_ctx *ctx,
1136 struct file *persistent_swap_storage, 1136 struct file *persistent_swap_storage,
1137 size_t acc_size, 1137 size_t acc_size,
1138 struct sg_table *sg, 1138 struct sg_table *sg,
@@ -1218,11 +1218,8 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
1218 WARN_ON(!locked); 1218 WARN_ON(!locked);
1219 } 1219 }
1220 1220
1221 if (likely(!ret)) { 1221 if (likely(!ret))
1222 struct ttm_operation_ctx ctx = { interruptible, false }; 1222 ret = ttm_bo_validate(bo, placement, ctx);
1223
1224 ret = ttm_bo_validate(bo, placement, &ctx);
1225 }
1226 1223
1227 if (unlikely(ret)) { 1224 if (unlikely(ret)) {
1228 if (!resv) 1225 if (!resv)
@@ -1255,10 +1252,11 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
1255 struct reservation_object *resv, 1252 struct reservation_object *resv,
1256 void (*destroy) (struct ttm_buffer_object *)) 1253 void (*destroy) (struct ttm_buffer_object *))
1257{ 1254{
1255 struct ttm_operation_ctx ctx = { interruptible, false };
1258 int ret; 1256 int ret;
1259 1257
1260 ret = ttm_bo_init_reserved(bdev, bo, size, type, placement, 1258 ret = ttm_bo_init_reserved(bdev, bo, size, type, placement,
1261 page_alignment, interruptible, 1259 page_alignment, &ctx,
1262 persistent_swap_storage, acc_size, 1260 persistent_swap_storage, acc_size,
1263 sg, resv, destroy); 1261 sg, resv, destroy);
1264 if (ret) 1262 if (ret)