diff options
author | Christian König <christian.koenig@amd.com> | 2018-03-14 15:48:17 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-03-14 16:08:24 -0400 |
commit | eab3de23a1639ec9419c1f9239ce651d3c82e7d6 (patch) | |
tree | 6d0ef8e3e8b892b47a2330d5803b4d35f4319c1d /drivers/gpu/drm/amd | |
parent | e3364dfc6a76e8d3432f3efd130f3dda6ddd698c (diff) |
drm/amdgpu: explicit give BO type to amdgpu_bo_create
Drop the "kernel" and sg parameter and give the BO type to create
explicit to amdgpu_bo_create instead of figuring it out from the
parameters.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Roger He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 46 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 8 |
12 files changed, 60 insertions, 66 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 98b05be03f0e..fea4ea286368 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -441,7 +441,7 @@ struct amdgpu_sa_bo { | |||
441 | void amdgpu_gem_force_release(struct amdgpu_device *adev); | 441 | void amdgpu_gem_force_release(struct amdgpu_device *adev); |
442 | int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, | 442 | int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, |
443 | int alignment, u32 initial_domain, | 443 | int alignment, u32 initial_domain, |
444 | u64 flags, bool kernel, | 444 | u64 flags, enum ttm_bo_type type, |
445 | struct reservation_object *resv, | 445 | struct reservation_object *resv, |
446 | struct drm_gem_object **obj); | 446 | struct drm_gem_object **obj); |
447 | 447 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c index 8a23aa8f9c73..4d36203ffb11 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | |||
@@ -221,8 +221,9 @@ int alloc_gtt_mem(struct kgd_dev *kgd, size_t size, | |||
221 | uint64_t gpu_addr_tmp = 0; | 221 | uint64_t gpu_addr_tmp = 0; |
222 | void *cpu_ptr_tmp = NULL; | 222 | void *cpu_ptr_tmp = NULL; |
223 | 223 | ||
224 | r = amdgpu_bo_create(adev, size, PAGE_SIZE, true, AMDGPU_GEM_DOMAIN_GTT, | 224 | r = amdgpu_bo_create(adev, size, PAGE_SIZE, AMDGPU_GEM_DOMAIN_GTT, |
225 | AMDGPU_GEM_CREATE_CPU_GTT_USWC, NULL, NULL, &bo); | 225 | AMDGPU_GEM_CREATE_CPU_GTT_USWC, ttm_bo_type_kernel, |
226 | NULL, &bo); | ||
226 | if (r) { | 227 | if (r) { |
227 | dev_err(adev->dev, | 228 | dev_err(adev->dev, |
228 | "failed to allocate BO for amdkfd (%d)\n", r); | 229 | "failed to allocate BO for amdkfd (%d)\n", r); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index e0371a9967b9..a12a1654e124 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | |||
@@ -997,8 +997,8 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu( | |||
997 | pr_debug("\tcreate BO VA 0x%llx size 0x%llx domain %s\n", | 997 | pr_debug("\tcreate BO VA 0x%llx size 0x%llx domain %s\n", |
998 | va, size, domain_string(alloc_domain)); | 998 | va, size, domain_string(alloc_domain)); |
999 | 999 | ||
1000 | ret = amdgpu_bo_create(adev, size, byte_align, false, | 1000 | ret = amdgpu_bo_create(adev, size, byte_align, |
1001 | alloc_domain, alloc_flags, NULL, NULL, &bo); | 1001 | alloc_domain, alloc_flags, ttm_bo_type_device, NULL, &bo); |
1002 | if (ret) { | 1002 | if (ret) { |
1003 | pr_debug("Failed to create BO on domain %s. ret %d\n", | 1003 | pr_debug("Failed to create BO on domain %s. ret %d\n", |
1004 | domain_string(alloc_domain), ret); | 1004 | domain_string(alloc_domain), ret); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c index 2fb299afc12b..02b849be083b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_benchmark.c | |||
@@ -80,8 +80,8 @@ static void amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size, | |||
80 | int time; | 80 | int time; |
81 | 81 | ||
82 | n = AMDGPU_BENCHMARK_ITERATIONS; | 82 | n = AMDGPU_BENCHMARK_ITERATIONS; |
83 | r = amdgpu_bo_create(adev, size, PAGE_SIZE, true, sdomain, 0, NULL, | 83 | r = amdgpu_bo_create(adev, size, PAGE_SIZE,sdomain, 0, |
84 | NULL, &sobj); | 84 | ttm_bo_type_kernel, NULL, &sobj); |
85 | if (r) { | 85 | if (r) { |
86 | goto out_cleanup; | 86 | goto out_cleanup; |
87 | } | 87 | } |
@@ -93,8 +93,8 @@ static void amdgpu_benchmark_move(struct amdgpu_device *adev, unsigned size, | |||
93 | if (r) { | 93 | if (r) { |
94 | goto out_cleanup; | 94 | goto out_cleanup; |
95 | } | 95 | } |
96 | r = amdgpu_bo_create(adev, size, PAGE_SIZE, true, ddomain, 0, NULL, | 96 | r = amdgpu_bo_create(adev, size, PAGE_SIZE, ddomain, 0, |
97 | NULL, &dobj); | 97 | ttm_bo_type_kernel, NULL, &dobj); |
98 | if (r) { | 98 | if (r) { |
99 | goto out_cleanup; | 99 | goto out_cleanup; |
100 | } | 100 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c index dc8d9f3216fa..cf0f186c6092 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c | |||
@@ -113,11 +113,12 @@ int amdgpu_gart_table_vram_alloc(struct amdgpu_device *adev) | |||
113 | int r; | 113 | int r; |
114 | 114 | ||
115 | if (adev->gart.robj == NULL) { | 115 | if (adev->gart.robj == NULL) { |
116 | r = amdgpu_bo_create(adev, adev->gart.table_size, | 116 | r = amdgpu_bo_create(adev, adev->gart.table_size, PAGE_SIZE, |
117 | PAGE_SIZE, true, AMDGPU_GEM_DOMAIN_VRAM, | 117 | AMDGPU_GEM_DOMAIN_VRAM, |
118 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | | 118 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | |
119 | AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS, | 119 | AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS, |
120 | NULL, NULL, &adev->gart.robj); | 120 | ttm_bo_type_kernel, NULL, |
121 | &adev->gart.robj); | ||
121 | if (r) { | 122 | if (r) { |
122 | return r; | 123 | return r; |
123 | } | 124 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index 55a840ae6d68..bb9b21266b67 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | |||
@@ -45,7 +45,7 @@ void amdgpu_gem_object_free(struct drm_gem_object *gobj) | |||
45 | 45 | ||
46 | int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, | 46 | int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, |
47 | int alignment, u32 initial_domain, | 47 | int alignment, u32 initial_domain, |
48 | u64 flags, bool kernel, | 48 | u64 flags, enum ttm_bo_type type, |
49 | struct reservation_object *resv, | 49 | struct reservation_object *resv, |
50 | struct drm_gem_object **obj) | 50 | struct drm_gem_object **obj) |
51 | { | 51 | { |
@@ -59,8 +59,8 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, | |||
59 | } | 59 | } |
60 | 60 | ||
61 | retry: | 61 | retry: |
62 | r = amdgpu_bo_create(adev, size, alignment, kernel, initial_domain, | 62 | r = amdgpu_bo_create(adev, size, alignment, initial_domain, |
63 | flags, NULL, resv, &bo); | 63 | flags, type, resv, &bo); |
64 | if (r) { | 64 | if (r) { |
65 | if (r != -ERESTARTSYS) { | 65 | if (r != -ERESTARTSYS) { |
66 | if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) { | 66 | if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) { |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 3ad2b6c65b85..ec6ec1f8a085 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |||
@@ -191,10 +191,10 @@ int amdgpu_bo_create_reserved(struct amdgpu_device *adev, | |||
191 | int r; | 191 | int r; |
192 | 192 | ||
193 | if (!*bo_ptr) { | 193 | if (!*bo_ptr) { |
194 | r = amdgpu_bo_create(adev, size, align, true, domain, | 194 | r = amdgpu_bo_create(adev, size, align, domain, |
195 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | | 195 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | |
196 | AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS, | 196 | AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS, |
197 | NULL, NULL, bo_ptr); | 197 | ttm_bo_type_kernel, NULL, bo_ptr); |
198 | if (r) { | 198 | if (r) { |
199 | dev_err(adev->dev, "(%d) failed to allocate kernel bo\n", | 199 | dev_err(adev->dev, "(%d) failed to allocate kernel bo\n", |
200 | r); | 200 | r); |
@@ -335,21 +335,19 @@ fail: | |||
335 | return false; | 335 | return false; |
336 | } | 336 | } |
337 | 337 | ||
338 | static int amdgpu_bo_do_create(struct amdgpu_device *adev, | 338 | static int amdgpu_bo_do_create(struct amdgpu_device *adev, unsigned long size, |
339 | unsigned long size, int byte_align, | 339 | int byte_align, u32 domain, |
340 | bool kernel, u32 domain, u64 flags, | 340 | u64 flags, enum ttm_bo_type type, |
341 | struct sg_table *sg, | ||
342 | struct reservation_object *resv, | 341 | struct reservation_object *resv, |
343 | struct amdgpu_bo **bo_ptr) | 342 | struct amdgpu_bo **bo_ptr) |
344 | { | 343 | { |
345 | struct ttm_operation_ctx ctx = { | 344 | struct ttm_operation_ctx ctx = { |
346 | .interruptible = !kernel, | 345 | .interruptible = (type != ttm_bo_type_kernel), |
347 | .no_wait_gpu = false, | 346 | .no_wait_gpu = false, |
348 | .resv = resv, | 347 | .resv = resv, |
349 | .flags = TTM_OPT_FLAG_ALLOW_RES_EVICT | 348 | .flags = TTM_OPT_FLAG_ALLOW_RES_EVICT |
350 | }; | 349 | }; |
351 | struct amdgpu_bo *bo; | 350 | struct amdgpu_bo *bo; |
352 | enum ttm_bo_type type; | ||
353 | unsigned long page_align; | 351 | unsigned long page_align; |
354 | size_t acc_size; | 352 | size_t acc_size; |
355 | int r; | 353 | int r; |
@@ -360,13 +358,6 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, | |||
360 | if (!amdgpu_bo_validate_size(adev, size, domain)) | 358 | if (!amdgpu_bo_validate_size(adev, size, domain)) |
361 | return -ENOMEM; | 359 | return -ENOMEM; |
362 | 360 | ||
363 | if (kernel) { | ||
364 | type = ttm_bo_type_kernel; | ||
365 | } else if (sg) { | ||
366 | type = ttm_bo_type_sg; | ||
367 | } else { | ||
368 | type = ttm_bo_type_device; | ||
369 | } | ||
370 | *bo_ptr = NULL; | 361 | *bo_ptr = NULL; |
371 | 362 | ||
372 | acc_size = ttm_bo_dma_acc_size(&adev->mman.bdev, size, | 363 | acc_size = ttm_bo_dma_acc_size(&adev->mman.bdev, size, |
@@ -385,7 +376,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, | |||
385 | AMDGPU_GEM_DOMAIN_GWS | | 376 | AMDGPU_GEM_DOMAIN_GWS | |
386 | AMDGPU_GEM_DOMAIN_OA); | 377 | AMDGPU_GEM_DOMAIN_OA); |
387 | bo->allowed_domains = bo->preferred_domains; | 378 | bo->allowed_domains = bo->preferred_domains; |
388 | if (!kernel && bo->allowed_domains == AMDGPU_GEM_DOMAIN_VRAM) | 379 | if (type != ttm_bo_type_kernel && |
380 | bo->allowed_domains == AMDGPU_GEM_DOMAIN_VRAM) | ||
389 | bo->allowed_domains |= AMDGPU_GEM_DOMAIN_GTT; | 381 | bo->allowed_domains |= AMDGPU_GEM_DOMAIN_GTT; |
390 | 382 | ||
391 | bo->flags = flags; | 383 | bo->flags = flags; |
@@ -423,7 +415,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, | |||
423 | 415 | ||
424 | r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, type, | 416 | r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, type, |
425 | &bo->placement, page_align, &ctx, acc_size, | 417 | &bo->placement, page_align, &ctx, acc_size, |
426 | sg, resv, &amdgpu_ttm_bo_destroy); | 418 | NULL, resv, &amdgpu_ttm_bo_destroy); |
427 | if (unlikely(r != 0)) | 419 | if (unlikely(r != 0)) |
428 | return r; | 420 | return r; |
429 | 421 | ||
@@ -435,7 +427,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, | |||
435 | else | 427 | else |
436 | amdgpu_cs_report_moved_bytes(adev, ctx.bytes_moved, 0); | 428 | amdgpu_cs_report_moved_bytes(adev, ctx.bytes_moved, 0); |
437 | 429 | ||
438 | if (kernel) | 430 | if (type == ttm_bo_type_kernel) |
439 | bo->tbo.priority = 1; | 431 | bo->tbo.priority = 1; |
440 | 432 | ||
441 | if (flags & AMDGPU_GEM_CREATE_VRAM_CLEARED && | 433 | if (flags & AMDGPU_GEM_CREATE_VRAM_CLEARED && |
@@ -479,12 +471,11 @@ static int amdgpu_bo_create_shadow(struct amdgpu_device *adev, | |||
479 | if (bo->shadow) | 471 | if (bo->shadow) |
480 | return 0; | 472 | return 0; |
481 | 473 | ||
482 | r = amdgpu_bo_do_create(adev, size, byte_align, true, | 474 | r = amdgpu_bo_do_create(adev, size, byte_align, AMDGPU_GEM_DOMAIN_GTT, |
483 | AMDGPU_GEM_DOMAIN_GTT, | ||
484 | AMDGPU_GEM_CREATE_CPU_GTT_USWC | | 475 | AMDGPU_GEM_CREATE_CPU_GTT_USWC | |
485 | AMDGPU_GEM_CREATE_SHADOW, | 476 | AMDGPU_GEM_CREATE_SHADOW, |
486 | NULL, bo->tbo.resv, | 477 | ttm_bo_type_kernel, |
487 | &bo->shadow); | 478 | bo->tbo.resv, &bo->shadow); |
488 | if (!r) { | 479 | if (!r) { |
489 | bo->shadow->parent = amdgpu_bo_ref(bo); | 480 | bo->shadow->parent = amdgpu_bo_ref(bo); |
490 | mutex_lock(&adev->shadow_list_lock); | 481 | mutex_lock(&adev->shadow_list_lock); |
@@ -495,18 +486,17 @@ static int amdgpu_bo_create_shadow(struct amdgpu_device *adev, | |||
495 | return r; | 486 | return r; |
496 | } | 487 | } |
497 | 488 | ||
498 | int amdgpu_bo_create(struct amdgpu_device *adev, | 489 | int amdgpu_bo_create(struct amdgpu_device *adev, unsigned long size, |
499 | unsigned long size, int byte_align, | 490 | int byte_align, u32 domain, |
500 | bool kernel, u32 domain, u64 flags, | 491 | u64 flags, enum ttm_bo_type type, |
501 | struct sg_table *sg, | ||
502 | struct reservation_object *resv, | 492 | struct reservation_object *resv, |
503 | struct amdgpu_bo **bo_ptr) | 493 | struct amdgpu_bo **bo_ptr) |
504 | { | 494 | { |
505 | uint64_t parent_flags = flags & ~AMDGPU_GEM_CREATE_SHADOW; | 495 | uint64_t parent_flags = flags & ~AMDGPU_GEM_CREATE_SHADOW; |
506 | int r; | 496 | int r; |
507 | 497 | ||
508 | r = amdgpu_bo_do_create(adev, size, byte_align, kernel, domain, | 498 | r = amdgpu_bo_do_create(adev, size, byte_align, domain, |
509 | parent_flags, sg, resv, bo_ptr); | 499 | parent_flags, type, resv, bo_ptr); |
510 | if (r) | 500 | if (r) |
511 | return r; | 501 | return r; |
512 | 502 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h index d4dbfe1f842e..546f77cb7882 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | |||
@@ -203,12 +203,11 @@ static inline bool amdgpu_bo_explicit_sync(struct amdgpu_bo *bo) | |||
203 | return bo->flags & AMDGPU_GEM_CREATE_EXPLICIT_SYNC; | 203 | return bo->flags & AMDGPU_GEM_CREATE_EXPLICIT_SYNC; |
204 | } | 204 | } |
205 | 205 | ||
206 | int amdgpu_bo_create(struct amdgpu_device *adev, | 206 | int amdgpu_bo_create(struct amdgpu_device *adev, unsigned long size, |
207 | unsigned long size, int byte_align, | 207 | int byte_align, u32 domain, |
208 | bool kernel, u32 domain, u64 flags, | 208 | u64 flags, enum ttm_bo_type type, |
209 | struct sg_table *sg, | 209 | struct reservation_object *resv, |
210 | struct reservation_object *resv, | 210 | struct amdgpu_bo **bo_ptr); |
211 | struct amdgpu_bo **bo_ptr); | ||
212 | int amdgpu_bo_create_reserved(struct amdgpu_device *adev, | 211 | int amdgpu_bo_create_reserved(struct amdgpu_device *adev, |
213 | unsigned long size, int align, | 212 | unsigned long size, int align, |
214 | u32 domain, struct amdgpu_bo **bo_ptr, | 213 | u32 domain, struct amdgpu_bo **bo_ptr, |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c index 44230165e181..1c9991738477 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | |||
@@ -105,11 +105,14 @@ amdgpu_gem_prime_import_sg_table(struct drm_device *dev, | |||
105 | int ret; | 105 | int ret; |
106 | 106 | ||
107 | ww_mutex_lock(&resv->lock, NULL); | 107 | ww_mutex_lock(&resv->lock, NULL); |
108 | ret = amdgpu_bo_create(adev, attach->dmabuf->size, PAGE_SIZE, false, | 108 | ret = amdgpu_bo_create(adev, attach->dmabuf->size, PAGE_SIZE, |
109 | AMDGPU_GEM_DOMAIN_CPU, 0, sg, resv, &bo); | 109 | AMDGPU_GEM_DOMAIN_CPU, 0, ttm_bo_type_sg, |
110 | resv, &bo); | ||
110 | if (ret) | 111 | if (ret) |
111 | goto error; | 112 | goto error; |
112 | 113 | ||
114 | bo->tbo.sg = sg; | ||
115 | bo->tbo.ttm->sg = sg; | ||
113 | bo->allowed_domains = AMDGPU_GEM_DOMAIN_GTT; | 116 | bo->allowed_domains = AMDGPU_GEM_DOMAIN_GTT; |
114 | bo->preferred_domains = AMDGPU_GEM_DOMAIN_GTT; | 117 | bo->preferred_domains = AMDGPU_GEM_DOMAIN_GTT; |
115 | if (attach->dmabuf->ops != &amdgpu_dmabuf_ops) | 118 | if (attach->dmabuf->ops != &amdgpu_dmabuf_ops) |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c index f3d81b6fb499..2dbe87591f81 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | |||
@@ -59,9 +59,8 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) | |||
59 | goto out_cleanup; | 59 | goto out_cleanup; |
60 | } | 60 | } |
61 | 61 | ||
62 | r = amdgpu_bo_create(adev, size, PAGE_SIZE, true, | 62 | r = amdgpu_bo_create(adev, size, PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM, 0, |
63 | AMDGPU_GEM_DOMAIN_VRAM, 0, | 63 | ttm_bo_type_kernel, NULL, &vram_obj); |
64 | NULL, NULL, &vram_obj); | ||
65 | if (r) { | 64 | if (r) { |
66 | DRM_ERROR("Failed to create VRAM object\n"); | 65 | DRM_ERROR("Failed to create VRAM object\n"); |
67 | goto out_cleanup; | 66 | goto out_cleanup; |
@@ -80,9 +79,9 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) | |||
80 | void **vram_start, **vram_end; | 79 | void **vram_start, **vram_end; |
81 | struct dma_fence *fence = NULL; | 80 | struct dma_fence *fence = NULL; |
82 | 81 | ||
83 | r = amdgpu_bo_create(adev, size, PAGE_SIZE, true, | 82 | r = amdgpu_bo_create(adev, size, PAGE_SIZE, |
84 | AMDGPU_GEM_DOMAIN_GTT, 0, NULL, | 83 | AMDGPU_GEM_DOMAIN_GTT, 0, |
85 | NULL, gtt_obj + i); | 84 | ttm_bo_type_kernel, NULL, gtt_obj + i); |
86 | if (r) { | 85 | if (r) { |
87 | DRM_ERROR("Failed to create GTT object %d\n", i); | 86 | DRM_ERROR("Failed to create GTT object %d\n", i); |
88 | goto out_lclean; | 87 | goto out_lclean; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index dbb993a2c151..e28b73609fbc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |||
@@ -1342,11 +1342,12 @@ static int amdgpu_ttm_fw_reserve_vram_init(struct amdgpu_device *adev) | |||
1342 | if (adev->fw_vram_usage.size > 0 && | 1342 | if (adev->fw_vram_usage.size > 0 && |
1343 | adev->fw_vram_usage.size <= vram_size) { | 1343 | adev->fw_vram_usage.size <= vram_size) { |
1344 | 1344 | ||
1345 | r = amdgpu_bo_create(adev, adev->fw_vram_usage.size, | 1345 | r = amdgpu_bo_create(adev, adev->fw_vram_usage.size, PAGE_SIZE, |
1346 | PAGE_SIZE, true, AMDGPU_GEM_DOMAIN_VRAM, | 1346 | AMDGPU_GEM_DOMAIN_VRAM, |
1347 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | | 1347 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | |
1348 | AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS, NULL, NULL, | 1348 | AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS, |
1349 | &adev->fw_vram_usage.reserved_bo); | 1349 | ttm_bo_type_kernel, NULL, |
1350 | &adev->fw_vram_usage.reserved_bo); | ||
1350 | if (r) | 1351 | if (r) |
1351 | goto error_create; | 1352 | goto error_create; |
1352 | 1353 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 0b237e027cab..24474294c92a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -413,9 +413,9 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev, | |||
413 | if (!entry->base.bo) { | 413 | if (!entry->base.bo) { |
414 | r = amdgpu_bo_create(adev, | 414 | r = amdgpu_bo_create(adev, |
415 | amdgpu_vm_bo_size(adev, level), | 415 | amdgpu_vm_bo_size(adev, level), |
416 | AMDGPU_GPU_PAGE_SIZE, true, | 416 | AMDGPU_GPU_PAGE_SIZE, |
417 | AMDGPU_GEM_DOMAIN_VRAM, flags, | 417 | AMDGPU_GEM_DOMAIN_VRAM, flags, |
418 | NULL, resv, &pt); | 418 | ttm_bo_type_kernel, resv, &pt); |
419 | if (r) | 419 | if (r) |
420 | return r; | 420 | return r; |
421 | 421 | ||
@@ -2409,8 +2409,8 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, | |||
2409 | AMDGPU_GEM_CREATE_SHADOW); | 2409 | AMDGPU_GEM_CREATE_SHADOW); |
2410 | 2410 | ||
2411 | size = amdgpu_vm_bo_size(adev, adev->vm_manager.root_level); | 2411 | size = amdgpu_vm_bo_size(adev, adev->vm_manager.root_level); |
2412 | r = amdgpu_bo_create(adev, size, align, true, AMDGPU_GEM_DOMAIN_VRAM, | 2412 | r = amdgpu_bo_create(adev, size, align, AMDGPU_GEM_DOMAIN_VRAM, flags, |
2413 | flags, NULL, NULL, &vm->root.base.bo); | 2413 | ttm_bo_type_kernel, NULL, &vm->root.base.bo); |
2414 | if (r) | 2414 | if (r) |
2415 | goto error_free_sched_entity; | 2415 | goto error_free_sched_entity; |
2416 | 2416 | ||