aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
diff options
context:
space:
mode:
authorAndres Rodriguez <andresx7@gmail.com>2017-09-15 21:05:19 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-10-09 16:30:19 -0400
commitb82485fd384a56c27fae44e649552eca6334237a (patch)
treee76d630f2fe71fa5a435f7abb0e45f0ac005ba7e /drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
parent9fc8fc709b356c85034cbcb3b84c9d8b77865f52 (diff)
drm/amdgpu: add helper to convert a ttm bo to amdgpu_bo
Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Andres Rodriguez <andresx7@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 1f68a146e26c..10952c3e5eb6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -44,6 +44,7 @@
44#include <linux/debugfs.h> 44#include <linux/debugfs.h>
45#include <linux/iommu.h> 45#include <linux/iommu.h>
46#include "amdgpu.h" 46#include "amdgpu.h"
47#include "amdgpu_object.h"
47#include "amdgpu_trace.h" 48#include "amdgpu_trace.h"
48#include "bif/bif_4_1_d.h" 49#include "bif/bif_4_1_d.h"
49 50
@@ -209,7 +210,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
209 placement->num_busy_placement = 1; 210 placement->num_busy_placement = 1;
210 return; 211 return;
211 } 212 }
212 abo = container_of(bo, struct amdgpu_bo, tbo); 213 abo = ttm_to_amdgpu_bo(bo);
213 switch (bo->mem.mem_type) { 214 switch (bo->mem.mem_type) {
214 case TTM_PL_VRAM: 215 case TTM_PL_VRAM:
215 if (adev->mman.buffer_funcs && 216 if (adev->mman.buffer_funcs &&
@@ -257,7 +258,7 @@ gtt:
257 258
258static int amdgpu_verify_access(struct ttm_buffer_object *bo, struct file *filp) 259static int amdgpu_verify_access(struct ttm_buffer_object *bo, struct file *filp)
259{ 260{
260 struct amdgpu_bo *abo = container_of(bo, struct amdgpu_bo, tbo); 261 struct amdgpu_bo *abo = ttm_to_amdgpu_bo(bo);
261 262
262 if (amdgpu_ttm_tt_get_usermm(bo->ttm)) 263 if (amdgpu_ttm_tt_get_usermm(bo->ttm))
263 return -EPERM; 264 return -EPERM;
@@ -484,7 +485,7 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo,
484 int r; 485 int r;
485 486
486 /* Can't move a pinned BO */ 487 /* Can't move a pinned BO */
487 abo = container_of(bo, struct amdgpu_bo, tbo); 488 abo = ttm_to_amdgpu_bo(bo);
488 if (WARN_ON_ONCE(abo->pin_count > 0)) 489 if (WARN_ON_ONCE(abo->pin_count > 0))
489 return -EINVAL; 490 return -EINVAL;
490 491
@@ -1142,7 +1143,7 @@ static int amdgpu_ttm_access_memory(struct ttm_buffer_object *bo,
1142 unsigned long offset, 1143 unsigned long offset,
1143 void *buf, int len, int write) 1144 void *buf, int len, int write)
1144{ 1145{
1145 struct amdgpu_bo *abo = container_of(bo, struct amdgpu_bo, tbo); 1146 struct amdgpu_bo *abo = ttm_to_amdgpu_bo(bo);
1146 struct amdgpu_device *adev = amdgpu_ttm_adev(abo->tbo.bdev); 1147 struct amdgpu_device *adev = amdgpu_ttm_adev(abo->tbo.bdev);
1147 struct drm_mm_node *nodes = abo->tbo.mem.mm_node; 1148 struct drm_mm_node *nodes = abo->tbo.mem.mm_node;
1148 uint32_t value = 0; 1149 uint32_t value = 0;