aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2018-04-05 03:20:34 -0400
committerIngo Molnar <mingo@kernel.org>2018-04-05 03:20:34 -0400
commitea2a6af517714c52a1209795a03e863e96b460bb (patch)
tree3bd443bc9b23ceeaf3743eaf2d6d35ec63c620c9 /drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
parent1b5d43cfb69759d8ef8d30469cea31d0c037aed5 (diff)
parent642e7fd23353e22290e3d51719fcb658dc252342 (diff)
Merge branch 'linus' into sched/urgent, to pick up fixes and updates
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.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index ca6c931dabfa..28c2706e48d7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -43,7 +43,7 @@ void amdgpu_gem_object_free(struct drm_gem_object *gobj)
43 43
44int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, 44int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
45 int alignment, u32 initial_domain, 45 int alignment, u32 initial_domain,
46 u64 flags, bool kernel, 46 u64 flags, enum ttm_bo_type type,
47 struct reservation_object *resv, 47 struct reservation_object *resv,
48 struct drm_gem_object **obj) 48 struct drm_gem_object **obj)
49{ 49{
@@ -56,23 +56,11 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
56 alignment = PAGE_SIZE; 56 alignment = PAGE_SIZE;
57 } 57 }
58 58
59retry: 59 r = amdgpu_bo_create(adev, size, alignment, initial_domain,
60 r = amdgpu_bo_create(adev, size, alignment, kernel, initial_domain, 60 flags, type, resv, &bo);
61 flags, NULL, resv, 0, &bo);
62 if (r) { 61 if (r) {
63 if (r != -ERESTARTSYS) { 62 DRM_DEBUG("Failed to allocate GEM object (%ld, %d, %u, %d)\n",
64 if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) { 63 size, initial_domain, alignment, r);
65 flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
66 goto retry;
67 }
68
69 if (initial_domain == AMDGPU_GEM_DOMAIN_VRAM) {
70 initial_domain |= AMDGPU_GEM_DOMAIN_GTT;
71 goto retry;
72 }
73 DRM_DEBUG("Failed to allocate GEM object (%ld, %d, %u, %d)\n",
74 size, initial_domain, alignment, r);
75 }
76 return r; 64 return r;
77 } 65 }
78 *obj = &bo->gem_base; 66 *obj = &bo->gem_base;
@@ -521,12 +509,13 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
521 goto error; 509 goto error;
522 510
523 if (operation == AMDGPU_VA_OP_MAP || 511 if (operation == AMDGPU_VA_OP_MAP ||
524 operation == AMDGPU_VA_OP_REPLACE) 512 operation == AMDGPU_VA_OP_REPLACE) {
525 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 }
526 517
527 r = amdgpu_vm_update_directories(adev, vm); 518 r = amdgpu_vm_update_directories(adev, vm);
528 if (r)
529 goto error;
530 519
531error: 520error:
532 if (r && r != -ERESTARTSYS) 521 if (r && r != -ERESTARTSYS)
@@ -632,7 +621,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
632 if (r) 621 if (r)
633 goto error_backoff; 622 goto error_backoff;
634 623
635 va_flags = amdgpu_vm_get_pte_flags(adev, args->flags); 624 va_flags = amdgpu_gmc_get_pte_flags(adev, args->flags);
636 r = amdgpu_vm_bo_map(adev, bo_va, args->va_address, 625 r = amdgpu_vm_bo_map(adev, bo_va, args->va_address,
637 args->offset_in_bo, args->map_size, 626 args->offset_in_bo, args->map_size,
638 va_flags); 627 va_flags);
@@ -652,7 +641,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
652 if (r) 641 if (r)
653 goto error_backoff; 642 goto error_backoff;
654 643
655 va_flags = amdgpu_vm_get_pte_flags(adev, args->flags); 644 va_flags = amdgpu_gmc_get_pte_flags(adev, args->flags);
656 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,
657 args->offset_in_bo, args->map_size, 646 args->offset_in_bo, args->map_size,
658 va_flags); 647 va_flags);