aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2018-04-12 03:42:34 -0400
committerIngo Molnar <mingo@kernel.org>2018-04-12 03:42:34 -0400
commitef389b734691cdc8beb009dd402135dcdcb86a56 (patch)
tree9523a37db93cb7c7874a5f18b4d9a7014898b814 /drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
parenta774635db5c430cbf21fa5d2f2df3d23aaa8e782 (diff)
parentc76fc98260751e71c884dc1a18a07e427ef033b5 (diff)
Merge branch 'WIP.x86/asm' into x86/urgent, because the topic is ready
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c35
1 files changed, 11 insertions, 24 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index e48b4ec88c8c..28c2706e48d7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -36,8 +36,6 @@ void amdgpu_gem_object_free(struct drm_gem_object *gobj)
36 struct amdgpu_bo *robj = gem_to_amdgpu_bo(gobj); 36 struct amdgpu_bo *robj = gem_to_amdgpu_bo(gobj);
37 37
38 if (robj) { 38 if (robj) {
39 if (robj->gem_base.import_attach)
40 drm_prime_gem_destroy(&robj->gem_base, robj->tbo.sg);
41 amdgpu_mn_unregister(robj); 39 amdgpu_mn_unregister(robj);
42 amdgpu_bo_unref(&robj); 40 amdgpu_bo_unref(&robj);
43 } 41 }
@@ -45,7 +43,7 @@ void amdgpu_gem_object_free(struct drm_gem_object *gobj)
45 43
46int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, 44int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
47 int alignment, u32 initial_domain, 45 int alignment, u32 initial_domain,
48 u64 flags, bool kernel, 46 u64 flags, enum ttm_bo_type type,
49 struct reservation_object *resv, 47 struct reservation_object *resv,
50 struct drm_gem_object **obj) 48 struct drm_gem_object **obj)
51{ 49{
@@ -58,23 +56,11 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
58 alignment = PAGE_SIZE; 56 alignment = PAGE_SIZE;
59 } 57 }
60 58
61retry: 59 r = amdgpu_bo_create(adev, size, alignment, initial_domain,
62 r = amdgpu_bo_create(adev, size, alignment, kernel, initial_domain, 60 flags, type, resv, &bo);
63 flags, NULL, resv, 0, &bo);
64 if (r) { 61 if (r) {
65 if (r != -ERESTARTSYS) { 62 DRM_DEBUG("Failed to allocate GEM object (%ld, %d, %u, %d)\n",
66 if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) { 63 size, initial_domain, alignment, r);
67 flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
68 goto retry;
69 }
70
71 if (initial_domain == AMDGPU_GEM_DOMAIN_VRAM) {
72 initial_domain |= AMDGPU_GEM_DOMAIN_GTT;
73 goto retry;
74 }
75 DRM_DEBUG("Failed to allocate GEM object (%ld, %d, %u, %d)\n",
76 size, initial_domain, alignment, r);
77 }
78 return r; 64 return r;
79 } 65 }
80 *obj = &bo->gem_base; 66 *obj = &bo->gem_base;
@@ -523,12 +509,13 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
523 goto error; 509 goto error;
524 510
525 if (operation == AMDGPU_VA_OP_MAP || 511 if (operation == AMDGPU_VA_OP_MAP ||
526 operation == AMDGPU_VA_OP_REPLACE) 512 operation == AMDGPU_VA_OP_REPLACE) {
527 r = amdgpu_vm_bo_update(adev, bo_va, false); 513 r = amdgpu_vm_bo_update(adev, bo_va, false);
514 if (r)
515 goto error;
516 }
528 517
529 r = amdgpu_vm_update_directories(adev, vm); 518 r = amdgpu_vm_update_directories(adev, vm);
530 if (r)
531 goto error;
532 519
533error: 520error:
534 if (r && r != -ERESTARTSYS) 521 if (r && r != -ERESTARTSYS)
@@ -634,7 +621,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
634 if (r) 621 if (r)
635 goto error_backoff; 622 goto error_backoff;
636 623
637 va_flags = amdgpu_vm_get_pte_flags(adev, args->flags); 624 va_flags = amdgpu_gmc_get_pte_flags(adev, args->flags);
638 r = amdgpu_vm_bo_map(adev, bo_va, args->va_address, 625 r = amdgpu_vm_bo_map(adev, bo_va, args->va_address,
639 args->offset_in_bo, args->map_size, 626 args->offset_in_bo, args->map_size,
640 va_flags); 627 va_flags);
@@ -654,7 +641,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
654 if (r) 641 if (r)
655 goto error_backoff; 642 goto error_backoff;
656 643
657 va_flags = amdgpu_vm_get_pte_flags(adev, args->flags); 644 va_flags = amdgpu_gmc_get_pte_flags(adev, args->flags);
658 r = amdgpu_vm_bo_replace_map(adev, bo_va, args->va_address, 645 r = amdgpu_vm_bo_replace_map(adev, bo_va, args->va_address,
659 args->offset_in_bo, args->map_size, 646 args->offset_in_bo, args->map_size,
660 va_flags); 647 va_flags);