diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 16 |
2 files changed, 13 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 4dddeafabd09..758d8cf8fd17 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |||
@@ -927,8 +927,7 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo) | |||
927 | size = bo->mem.num_pages << PAGE_SHIFT; | 927 | size = bo->mem.num_pages << PAGE_SHIFT; |
928 | offset = bo->mem.start << PAGE_SHIFT; | 928 | offset = bo->mem.start << PAGE_SHIFT; |
929 | /* TODO: figure out how to map scattered VRAM to the CPU */ | 929 | /* TODO: figure out how to map scattered VRAM to the CPU */ |
930 | if ((offset + size) <= adev->mc.visible_vram_size && | 930 | if ((offset + size) <= adev->mc.visible_vram_size) |
931 | (abo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS)) | ||
932 | return 0; | 931 | return 0; |
933 | 932 | ||
934 | /* Can't move a pinned BO to visible VRAM */ | 933 | /* Can't move a pinned BO to visible VRAM */ |
@@ -936,7 +935,6 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo) | |||
936 | return -EINVAL; | 935 | return -EINVAL; |
937 | 936 | ||
938 | /* hurrah the memory is not visible ! */ | 937 | /* hurrah the memory is not visible ! */ |
939 | abo->flags |= AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS; | ||
940 | amdgpu_ttm_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_VRAM); | 938 | amdgpu_ttm_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_VRAM); |
941 | lpfn = adev->mc.visible_vram_size >> PAGE_SHIFT; | 939 | lpfn = adev->mc.visible_vram_size >> PAGE_SHIFT; |
942 | for (i = 0; i < abo->placement.num_placement; i++) { | 940 | for (i = 0; i < abo->placement.num_placement; i++) { |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index 83f4930f870c..e3008d55ec77 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | |||
@@ -529,9 +529,6 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_ | |||
529 | case TTM_PL_TT: | 529 | case TTM_PL_TT: |
530 | break; | 530 | break; |
531 | case TTM_PL_VRAM: | 531 | case TTM_PL_VRAM: |
532 | if (mem->start == AMDGPU_BO_INVALID_OFFSET) | ||
533 | return -EINVAL; | ||
534 | |||
535 | mem->bus.offset = mem->start << PAGE_SHIFT; | 532 | mem->bus.offset = mem->start << PAGE_SHIFT; |
536 | /* check if it's visible */ | 533 | /* check if it's visible */ |
537 | if ((mem->bus.offset + mem->bus.size) > adev->mc.visible_vram_size) | 534 | if ((mem->bus.offset + mem->bus.size) > adev->mc.visible_vram_size) |
@@ -549,6 +546,17 @@ static void amdgpu_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_re | |||
549 | { | 546 | { |
550 | } | 547 | } |
551 | 548 | ||
549 | static unsigned long amdgpu_ttm_io_mem_pfn(struct ttm_buffer_object *bo, | ||
550 | unsigned long page_offset) | ||
551 | { | ||
552 | struct drm_mm_node *mm = bo->mem.mm_node; | ||
553 | uint64_t size = mm->size; | ||
554 | unsigned long offset = page_offset; | ||
555 | |||
556 | page_offset = do_div(offset, size); | ||
557 | return (bo->mem.bus.base >> PAGE_SHIFT) + mm->start + page_offset; | ||
558 | } | ||
559 | |||
552 | /* | 560 | /* |
553 | * TTM backend functions. | 561 | * TTM backend functions. |
554 | */ | 562 | */ |
@@ -1064,7 +1072,7 @@ static struct ttm_bo_driver amdgpu_bo_driver = { | |||
1064 | .fault_reserve_notify = &amdgpu_bo_fault_reserve_notify, | 1072 | .fault_reserve_notify = &amdgpu_bo_fault_reserve_notify, |
1065 | .io_mem_reserve = &amdgpu_ttm_io_mem_reserve, | 1073 | .io_mem_reserve = &amdgpu_ttm_io_mem_reserve, |
1066 | .io_mem_free = &amdgpu_ttm_io_mem_free, | 1074 | .io_mem_free = &amdgpu_ttm_io_mem_free, |
1067 | .io_mem_pfn = ttm_bo_default_io_mem_pfn, | 1075 | .io_mem_pfn = amdgpu_ttm_io_mem_pfn, |
1068 | }; | 1076 | }; |
1069 | 1077 | ||
1070 | int amdgpu_ttm_init(struct amdgpu_device *adev) | 1078 | int amdgpu_ttm_init(struct amdgpu_device *adev) |