diff options
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3725-drm-ttm-use-an-operation-ctx-for-ttm_bo_init_reserve.patch')
-rw-r--r-- | meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3725-drm-ttm-use-an-operation-ctx-for-ttm_bo_init_reserve.patch | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3725-drm-ttm-use-an-operation-ctx-for-ttm_bo_init_reserve.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3725-drm-ttm-use-an-operation-ctx-for-ttm_bo_init_reserve.patch new file mode 100644 index 00000000..9e37158c --- /dev/null +++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3725-drm-ttm-use-an-operation-ctx-for-ttm_bo_init_reserve.patch @@ -0,0 +1,143 @@ +From 8b05f4e444d44939135dfff06469e20671da2ac1 Mon Sep 17 00:00:00 2001 +From: Christian Koenig <christian.koenig@amd.com> +Date: Wed, 12 Apr 2017 14:41:43 +0200 +Subject: [PATCH 3725/4131] drm/ttm: use an operation ctx for + ttm_bo_init_reserved +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +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> +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 2 +- + drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++-- + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +- + drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 ++- + drivers/gpu/drm/ttm/ttm_bo.c | 2 +- + include/drm/ttm/ttm_bo_api.h | 13 ++++++++++--- + 6 files changed, 22 insertions(+), 9 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +index ea2162f..05c558d 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +@@ -57,7 +57,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, + struct drm_gem_object **obj) + { + struct amdgpu_bo *robj; +- struct amdgpu_gem_object *gobj; ++ struct amdgpu_bo *bo; + unsigned long max_size; + int r; + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +index d39dada..4104eb6 100755 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +@@ -363,7 +363,12 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, unsigned long size, + struct reservation_object *resv, + struct amdgpu_bo **bo_ptr) + { +- struct ttm_operation_ctx ctx = { !kernel, false }; ++ struct ttm_operation_ctx ctx = { ++ .interruptible = (type != ttm_bo_type_kernel), ++ .no_wait_gpu = false, ++ .resv = resv, ++ .flags = TTM_OPT_FLAG_ALLOW_RES_EVICT ++ }; + struct amdgpu_bo *bo; + unsigned long page_align; + size_t acc_size; +@@ -435,7 +440,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, unsigned long size, + amdgpu_ttm_placement_from_domain(bo, domain); + + r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, type, +- &bo->placement, page_align, &ctx, NULL, ++ &bo->placement, page_align, &ctx, acc_size, + NULL, resv, &amdgpu_ttm_bo_destroy); + if (unlikely(r != 0)) + return r; +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +index d6ca275..990491e 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +@@ -1568,7 +1568,7 @@ static int amdgpu_ttm_fw_reserve_vram_init(struct amdgpu_device *adev) + + ttm_bo_mem_put(&bo->tbo, &bo->tbo.mem); + r = ttm_bo_mem_space(&bo->tbo, &bo->placement, +- &bo->tbo.mem, false, false); ++ &bo->tbo.mem, &ctx); + if (r) + goto error_pin; + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +index 1132678..6c071ae 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +@@ -271,6 +271,7 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev, + struct amdgpu_vm *vm, struct amdgpu_bo *bo, + unsigned level, bool pte_support_ats) + { ++ struct ttm_operation_ctx ctx = { true, false }; + struct dma_fence *fence = NULL; + unsigned entries, ats_entries; + struct amdgpu_ring *ring; +@@ -302,7 +303,7 @@ static int amdgpu_vm_clear_bo(struct amdgpu_device *adev, + if (r) + return r; + +- r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false); ++ r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx); + if (r) + goto error; + +diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c +index 66a2183..124081e 100644 +--- a/drivers/gpu/drm/ttm/ttm_bo.c ++++ b/drivers/gpu/drm/ttm/ttm_bo.c +@@ -1263,7 +1263,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev, + int ret; + + ret = ttm_bo_init_reserved(bdev, bo, size, type, placement, +- page_alignment, interruptible, ++ page_alignment, &ctx, + persistent_swap_storage, acc_size, + sg, resv, destroy); + if (ret) +diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h +index ab5810d..c18238f 100644 +--- a/include/drm/ttm/ttm_bo_api.h ++++ b/include/drm/ttm/ttm_bo_api.h +@@ -270,11 +270,18 @@ struct ttm_bo_kmap_obj { + * allocation. + */ + struct ttm_operation_ctx { +- bool interruptible; +- bool no_wait_gpu; +- uint64_t bytes_moved; ++ bool interruptible; ++ bool no_wait_gpu; ++ struct reservation_object *resv; ++ uint64_t bytes_moved; ++ uint32_t flags; + }; + ++/* Allow eviction of reserved BOs */ ++#define TTM_OPT_FLAG_ALLOW_RES_EVICT 0x1 ++/* when serving page fault or suspend, allow alloc anyway */ ++#define TTM_OPT_FLAG_FORCE_ALLOC 0x2 ++ + /** + * ttm_bo_reference - reference a struct ttm_buffer_object + * +-- +2.7.4 + |