All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] drm/amdgpu: remove unused member from struct amdgpu_bo
@ 2016-09-15 13:10 Christian König
       [not found] ` <1473945024-8275-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Christian König @ 2016-09-15 13:10 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Christian König <christian.koenig@amd.com>

Not used in a while.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 2 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 1 -
 2 files changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index ee55763..3b3981d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -446,8 +446,6 @@ struct amdgpu_bo_va {
 #define AMDGPU_GEM_DOMAIN_MAX		0x3
 
 struct amdgpu_bo {
-	/* Protected by gem.mutex */
-	struct list_head		list;
 	/* Protected by tbo.reserved */
 	u32				prefered_domains;
 	u32				allowed_domains;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index d6e6c93..4289c31 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -360,7 +360,6 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
 		return r;
 	}
 	bo->adev = adev;
-	INIT_LIST_HEAD(&bo->list);
 	INIT_LIST_HEAD(&bo->shadow_list);
 	INIT_LIST_HEAD(&bo->va);
 	bo->prefered_domains = domain & (AMDGPU_GEM_DOMAIN_VRAM |
-- 
2.5.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/5] drm/amdgpu: fix a bunch of coding style issues in amdgpu_ttm.c
       [not found] ` <1473945024-8275-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
@ 2016-09-15 13:10   ` Christian König
       [not found]     ` <1473945024-8275-2-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
  2016-09-15 13:10   ` [PATCH 3/5] drm/amdgpu: fix a bunch of coding style issues in amdgpu_gem.c Christian König
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Christian König @ 2016-09-15 13:10 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Christian König <christian.koenig@amd.com>

No intented functional change.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 65 +++++++++++++++++++++------------
 1 file changed, 42 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 428ffb6..1965209 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -214,9 +214,11 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
 	switch (bo->mem.mem_type) {
 	case TTM_PL_VRAM:
 		if (rbo->adev->mman.buffer_funcs_ring->ready == false) {
-			amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_CPU);
+			amdgpu_ttm_placement_from_domain(rbo,
+							 AMDGPU_GEM_DOMAIN_CPU);
 		} else {
-			amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_GTT);
+			amdgpu_ttm_placement_from_domain(rbo,
+							 AMDGPU_GEM_DOMAIN_GTT);
 			for (i = 0; i < rbo->placement.num_placement; ++i) {
 				if (!(rbo->placements[i].flags &
 				      TTM_PL_FLAG_TT))
@@ -524,7 +526,8 @@ memcpy:
 	return 0;
 }
 
-static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
+static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
+				     struct ttm_mem_reg *mem)
 {
 	struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type];
 	struct amdgpu_device *adev = amdgpu_get_adev(bdev);
@@ -545,7 +548,8 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
 	case TTM_PL_VRAM:
 		mem->bus.offset = mem->start << PAGE_SHIFT;
 		/* check if it's visible */
-		if ((mem->bus.offset + mem->bus.size) > adev->mc.visible_vram_size)
+		if ((mem->bus.offset + mem->bus.size) >
+		    adev->mc.visible_vram_size)
 			return -EINVAL;
 		mem->bus.base = adev->mc.aper_base;
 		mem->bus.is_iomem = true;
@@ -579,7 +583,8 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
 	return 0;
 }
 
-static void amdgpu_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
+static void amdgpu_ttm_io_mem_free(struct ttm_bo_device *bdev,
+				   struct ttm_mem_reg *mem)
 {
 }
 
@@ -791,7 +796,8 @@ int amdgpu_ttm_recover_gart(struct amdgpu_device *adev)
 	bo_mem.mem_type = TTM_PL_TT;
 	spin_lock(&adev->gtt_list_lock);
 	list_for_each_entry_safe(gtt, tmp, &adev->gtt_list, list) {
-		flags = amdgpu_ttm_tt_pte_flags(gtt->adev, &gtt->ttm.ttm, &bo_mem);
+		flags = amdgpu_ttm_tt_pte_flags(gtt->adev, &gtt->ttm.ttm,
+						&bo_mem);
 		r = amdgpu_gart_bind(adev, gtt->offset, gtt->ttm.ttm.num_pages,
 				     gtt->ttm.ttm.pages, gtt->ttm.dma_address,
 				     flags);
@@ -856,7 +862,8 @@ static struct ttm_tt *amdgpu_ttm_tt_create(struct ttm_bo_device *bdev,
 	}
 	gtt->ttm.ttm.func = &amdgpu_backend_func;
 	gtt->adev = adev;
-	if (ttm_dma_tt_init(&gtt->ttm, bdev, size, page_flags, dummy_read_page)) {
+	if (ttm_dma_tt_init(&gtt->ttm, bdev, size, page_flags,
+			    dummy_read_page)) {
 		kfree(gtt);
 		return NULL;
 	}
@@ -887,7 +894,8 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
 
 	if (slave && ttm->sg) {
 		drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
-						 gtt->ttm.dma_address, ttm->num_pages);
+						 gtt->ttm.dma_address,
+						 ttm->num_pages);
 		ttm->state = tt_unbound;
 		return 0;
 	}
@@ -906,13 +914,17 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
 	}
 
 	for (i = 0; i < ttm->num_pages; i++) {
-		gtt->ttm.dma_address[i] = pci_map_page(adev->pdev, ttm->pages[i],
+		gtt->ttm.dma_address[i] = pci_map_page(adev->pdev,
+						       ttm->pages[i],
 						       0, PAGE_SIZE,
 						       PCI_DMA_BIDIRECTIONAL);
-		if (pci_dma_mapping_error(adev->pdev, gtt->ttm.dma_address[i])) {
+		if (pci_dma_mapping_error(adev->pdev,
+					  gtt->ttm.dma_address[i])) {
 			while (i--) {
-				pci_unmap_page(adev->pdev, gtt->ttm.dma_address[i],
-					       PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
+				pci_unmap_page(adev->pdev,
+					       gtt->ttm.dma_address[i],
+					       PAGE_SIZE,
+					       PCI_DMA_BIDIRECTIONAL);
 				gtt->ttm.dma_address[i] = 0;
 			}
 			ttm_pool_unpopulate(ttm);
@@ -1195,14 +1207,20 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
 		 (unsigned)(adev->mc.gtt_size / (1024 * 1024)));
 
 	adev->gds.mem.total_size = adev->gds.mem.total_size << AMDGPU_GDS_SHIFT;
-	adev->gds.mem.gfx_partition_size = adev->gds.mem.gfx_partition_size << AMDGPU_GDS_SHIFT;
-	adev->gds.mem.cs_partition_size = adev->gds.mem.cs_partition_size << AMDGPU_GDS_SHIFT;
+	adev->gds.mem.gfx_partition_size =
+		adev->gds.mem.gfx_partition_size << AMDGPU_GDS_SHIFT;
+	adev->gds.mem.cs_partition_size =
+		adev->gds.mem.cs_partition_size << AMDGPU_GDS_SHIFT;
 	adev->gds.gws.total_size = adev->gds.gws.total_size << AMDGPU_GWS_SHIFT;
-	adev->gds.gws.gfx_partition_size = adev->gds.gws.gfx_partition_size << AMDGPU_GWS_SHIFT;
-	adev->gds.gws.cs_partition_size = adev->gds.gws.cs_partition_size << AMDGPU_GWS_SHIFT;
+	adev->gds.gws.gfx_partition_size =
+		adev->gds.gws.gfx_partition_size << AMDGPU_GWS_SHIFT;
+	adev->gds.gws.cs_partition_size =
+		adev->gds.gws.cs_partition_size << AMDGPU_GWS_SHIFT;
 	adev->gds.oa.total_size = adev->gds.oa.total_size << AMDGPU_OA_SHIFT;
-	adev->gds.oa.gfx_partition_size = adev->gds.oa.gfx_partition_size << AMDGPU_OA_SHIFT;
-	adev->gds.oa.cs_partition_size = adev->gds.oa.cs_partition_size << AMDGPU_OA_SHIFT;
+	adev->gds.oa.gfx_partition_size =
+		adev->gds.oa.gfx_partition_size << AMDGPU_OA_SHIFT;
+	adev->gds.oa.cs_partition_size =
+		adev->gds.oa.cs_partition_size << AMDGPU_OA_SHIFT;
 	/* GDS Memory */
 	r = ttm_bo_init_mm(&adev->mman.bdev, AMDGPU_PL_GDS,
 				adev->gds.mem.total_size >> PAGE_SHIFT);
@@ -1362,10 +1380,9 @@ error_free:
 	return r;
 }
 
-int amdgpu_fill_buffer(struct amdgpu_bo *bo,
-		uint32_t src_data,
-		struct reservation_object *resv,
-		struct fence **fence)
+int amdgpu_fill_buffer(struct amdgpu_bo *bo, uint32_t src_data,
+		       struct reservation_object *resv,
+		       struct fence **fence)
 {
 	struct amdgpu_device *adev = bo->adev;
 	struct amdgpu_job *job;
@@ -1607,5 +1624,7 @@ static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev)
 
 u64 amdgpu_ttm_get_gtt_mem_size(struct amdgpu_device *adev)
 {
-	return ttm_get_kernel_zone_memory_size(adev->mman.mem_global_ref.object);
+	struct ttm_mem_global *glob = adev->mman.mem_global_ref.object;
+
+	return ttm_get_kernel_zone_memory_size(glob);
 }
-- 
2.5.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/5] drm/amdgpu: fix a bunch of coding style issues in amdgpu_gem.c
       [not found] ` <1473945024-8275-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
  2016-09-15 13:10   ` [PATCH 2/5] drm/amdgpu: fix a bunch of coding style issues in amdgpu_ttm.c Christian König
@ 2016-09-15 13:10   ` Christian König
       [not found]     ` <1473945024-8275-3-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
  2016-09-15 13:10   ` [PATCH 4/5] drm/amdgpu: remove adev pointer from struct amdgpu_bo Christian König
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Christian König @ 2016-09-15 13:10 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Christian König <christian.koenig@amd.com>

No intented functional change.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 88fbed2..70e294b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -58,7 +58,8 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
 		alignment = PAGE_SIZE;
 	}
 
-	if (!(initial_domain & (AMDGPU_GEM_DOMAIN_GDS | AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA))) {
+	if (!(initial_domain & (AMDGPU_GEM_DOMAIN_GDS | AMDGPU_GEM_DOMAIN_GWS |
+				AMDGPU_GEM_DOMAIN_OA))) {
 		/* Maximum bo size is the unpinned gtt size since we use the gtt to
 		 * handle vram to system pool migrations.
 		 */
@@ -116,7 +117,8 @@ void amdgpu_gem_force_release(struct amdgpu_device *adev)
  * Call from drm_gem_handle_create which appear in both new and open ioctl
  * case.
  */
-int amdgpu_gem_object_open(struct drm_gem_object *obj, struct drm_file *file_priv)
+int amdgpu_gem_object_open(struct drm_gem_object *obj,
+			   struct drm_file *file_priv)
 {
 	struct amdgpu_bo *rbo = gem_to_amdgpu_bo(obj);
 	struct amdgpu_device *adev = rbo->adev;
@@ -408,9 +410,11 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
 	}
 	robj = gem_to_amdgpu_bo(gobj);
 	if (timeout == 0)
-		ret = reservation_object_test_signaled_rcu(robj->tbo.resv, true);
+		ret = reservation_object_test_signaled_rcu(robj->tbo.resv,
+							   true);
 	else
-		ret = reservation_object_wait_timeout_rcu(robj->tbo.resv, true, true, timeout);
+		ret = reservation_object_wait_timeout_rcu(robj->tbo.resv, true,
+							  true, timeout);
 
 	/* ret == 0 means not signaled,
 	 * ret > 0 means signaled
@@ -480,7 +484,8 @@ out:
  * vital here, so they are not reported back to userspace.
  */
 static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
-				    struct amdgpu_bo_va *bo_va, uint32_t operation)
+				    struct amdgpu_bo_va *bo_va,
+				    uint32_t operation)
 {
 	struct ttm_validate_buffer tv, *entry;
 	struct amdgpu_bo_list_entry vm_pd;
@@ -704,7 +709,8 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
 	uint32_t handle;
 	int r;
 
-	args->pitch = amdgpu_align_pitch(adev, args->width, args->bpp, 0) * ((args->bpp + 1) / 8);
+	args->pitch = amdgpu_align_pitch(adev, args->width, args->bpp, 0) *
+		((args->bpp + 1) / 8);
 	args->size = (u64)args->pitch * args->height;
 	args->size = ALIGN(args->size, PAGE_SIZE);
 
-- 
2.5.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/5] drm/amdgpu: remove adev pointer from struct amdgpu_bo
       [not found] ` <1473945024-8275-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
  2016-09-15 13:10   ` [PATCH 2/5] drm/amdgpu: fix a bunch of coding style issues in amdgpu_ttm.c Christian König
  2016-09-15 13:10   ` [PATCH 3/5] drm/amdgpu: fix a bunch of coding style issues in amdgpu_gem.c Christian König
@ 2016-09-15 13:10   ` Christian König
       [not found]     ` <1473945024-8275-4-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
  2016-09-15 13:10   ` [PATCH 5/5] drm/amdgpu: rename all rbo variable to abo Christian König
  2016-09-15 18:18   ` [PATCH 1/5] drm/amdgpu: remove unused member from struct amdgpu_bo Alex Deucher
  4 siblings, 1 reply; 14+ messages in thread
From: Christian König @ 2016-09-15 13:10 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Christian König <christian.koenig@amd.com>

It's completely pointsless to have two pointers to the
device in the same structur.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  6 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c     | 10 +++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c    |  4 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c     |  4 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 50 ++++++++++++++++--------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.h |  3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 17 +++-------
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c    |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c     |  2 +-
 9 files changed, 50 insertions(+), 48 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 3b3981d..ed91f08 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -465,7 +465,6 @@ struct amdgpu_bo {
 	 */
 	struct list_head		va;
 	/* Constant after initialization */
-	struct amdgpu_device		*adev;
 	struct drm_gem_object		gem_base;
 	struct amdgpu_bo		*parent;
 	struct amdgpu_bo		*shadow;
@@ -2144,6 +2143,11 @@ struct amdgpu_device {
 
 };
 
+static inline struct amdgpu_device *amdgpu_get_adev(struct ttm_bo_device *bdev)
+{
+	return container_of(bdev, struct amdgpu_device, mman.bdev);
+}
+
 bool amdgpu_device_is_px(struct drm_device *dev);
 int amdgpu_device_init(struct amdgpu_device *adev,
 		       struct drm_device *ddev,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 187c366..5beab71 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -355,6 +355,7 @@ static void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev,
 static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
 				 struct amdgpu_bo *bo)
 {
+	struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
 	u64 initial_bytes_moved;
 	uint32_t domain;
 	int r;
@@ -372,9 +373,9 @@ static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
 
 retry:
 	amdgpu_ttm_placement_from_domain(bo, domain);
-	initial_bytes_moved = atomic64_read(&bo->adev->num_bytes_moved);
+	initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
 	r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);
-	p->bytes_moved += atomic64_read(&bo->adev->num_bytes_moved) -
+	p->bytes_moved += atomic64_read(&adev->num_bytes_moved) -
 		initial_bytes_moved;
 
 	if (unlikely(r == -ENOMEM) && domain != bo->allowed_domains) {
@@ -400,6 +401,7 @@ static bool amdgpu_cs_try_evict(struct amdgpu_cs_parser *p,
 
 		struct amdgpu_bo_list_entry *candidate = p->evictable;
 		struct amdgpu_bo *bo = candidate->robj;
+		struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
 		u64 initial_bytes_moved;
 		uint32_t other;
 
@@ -420,9 +422,9 @@ static bool amdgpu_cs_try_evict(struct amdgpu_cs_parser *p,
 
 		/* Good we can try to move this BO somewhere else */
 		amdgpu_ttm_placement_from_domain(bo, other);
-		initial_bytes_moved = atomic64_read(&bo->adev->num_bytes_moved);
+		initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
 		r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);
-		p->bytes_moved += atomic64_read(&bo->adev->num_bytes_moved) -
+		p->bytes_moved += atomic64_read(&adev->num_bytes_moved) -
 			initial_bytes_moved;
 
 		if (unlikely(r))
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 70e294b..480ae7e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -121,7 +121,7 @@ int amdgpu_gem_object_open(struct drm_gem_object *obj,
 			   struct drm_file *file_priv)
 {
 	struct amdgpu_bo *rbo = gem_to_amdgpu_bo(obj);
-	struct amdgpu_device *adev = rbo->adev;
+	struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
 	struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
 	struct amdgpu_vm *vm = &fpriv->vm;
 	struct amdgpu_bo_va *bo_va;
@@ -144,7 +144,7 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj,
 			     struct drm_file *file_priv)
 {
 	struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
-	struct amdgpu_device *adev = bo->adev;
+	struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
 	struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
 	struct amdgpu_vm *vm = &fpriv->vm;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
index 32fa7b7..4731231 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
@@ -285,7 +285,7 @@ free_rmn:
 int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
 {
 	unsigned long end = addr + amdgpu_bo_size(bo) - 1;
-	struct amdgpu_device *adev = bo->adev;
+	struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
 	struct amdgpu_mn *rmn;
 	struct amdgpu_mn_node *node = NULL;
 	struct list_head bos;
@@ -340,7 +340,7 @@ int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
  */
 void amdgpu_mn_unregister(struct amdgpu_bo *bo)
 {
-	struct amdgpu_device *adev = bo->adev;
+	struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
 	struct amdgpu_mn *rmn;
 	struct list_head *head;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 4289c31..5cbe803 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -90,18 +90,19 @@ static void amdgpu_update_memory_usage(struct amdgpu_device *adev,
 
 static void amdgpu_ttm_bo_destroy(struct ttm_buffer_object *tbo)
 {
+	struct amdgpu_device *adev = amdgpu_get_adev(tbo->bdev);
 	struct amdgpu_bo *bo;
 
 	bo = container_of(tbo, struct amdgpu_bo, tbo);
 
-	amdgpu_update_memory_usage(bo->adev, &bo->tbo.mem, NULL);
+	amdgpu_update_memory_usage(adev, &bo->tbo.mem, NULL);
 
 	drm_gem_object_release(&bo->gem_base);
 	amdgpu_bo_unref(&bo->parent);
 	if (!list_empty(&bo->shadow_list)) {
-		mutex_lock(&bo->adev->shadow_list_lock);
+		mutex_lock(&adev->shadow_list_lock);
 		list_del_init(&bo->shadow_list);
-		mutex_unlock(&bo->adev->shadow_list_lock);
+		mutex_unlock(&adev->shadow_list_lock);
 	}
 	kfree(bo->metadata);
 	kfree(bo);
@@ -212,8 +213,10 @@ static void amdgpu_ttm_placement_init(struct amdgpu_device *adev,
 
 void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *rbo, u32 domain)
 {
-	amdgpu_ttm_placement_init(rbo->adev, &rbo->placement,
-				  rbo->placements, domain, rbo->flags);
+	struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
+
+	amdgpu_ttm_placement_init(adev, &rbo->placement, rbo->placements,
+				  domain, rbo->flags);
 }
 
 static void amdgpu_fill_placement_to_bo(struct amdgpu_bo *bo,
@@ -359,7 +362,6 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
 		kfree(bo);
 		return r;
 	}
-	bo->adev = adev;
 	INIT_LIST_HEAD(&bo->shadow_list);
 	INIT_LIST_HEAD(&bo->va);
 	bo->prefered_domains = domain & (AMDGPU_GEM_DOMAIN_VRAM |
@@ -624,6 +626,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 			     u64 min_offset, u64 max_offset,
 			     u64 *gpu_addr)
 {
+	struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
 	int r, i;
 	unsigned fpfn, lpfn;
 
@@ -659,12 +662,12 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 		if ((bo->placements[i].flags & TTM_PL_FLAG_VRAM) &&
 		    !(bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) &&
 		    (!max_offset || max_offset >
-		     bo->adev->mc.visible_vram_size)) {
+		     adev->mc.visible_vram_size)) {
 			if (WARN_ON_ONCE(min_offset >
-					 bo->adev->mc.visible_vram_size))
+					 adev->mc.visible_vram_size))
 				return -EINVAL;
 			fpfn = min_offset >> PAGE_SHIFT;
-			lpfn = bo->adev->mc.visible_vram_size >> PAGE_SHIFT;
+			lpfn = adev->mc.visible_vram_size >> PAGE_SHIFT;
 		} else {
 			fpfn = min_offset >> PAGE_SHIFT;
 			lpfn = max_offset >> PAGE_SHIFT;
@@ -679,12 +682,12 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 
 	r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
 	if (unlikely(r)) {
-		dev_err(bo->adev->dev, "%p pin failed\n", bo);
+		dev_err(adev->dev, "%p pin failed\n", bo);
 		goto error;
 	}
 	r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
 	if (unlikely(r)) {
-		dev_err(bo->adev->dev, "%p bind failed\n", bo);
+		dev_err(adev->dev, "%p bind failed\n", bo);
 		goto error;
 	}
 
@@ -692,11 +695,11 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 	if (gpu_addr != NULL)
 		*gpu_addr = amdgpu_bo_gpu_offset(bo);
 	if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
-		bo->adev->vram_pin_size += amdgpu_bo_size(bo);
+		adev->vram_pin_size += amdgpu_bo_size(bo);
 		if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
-			bo->adev->invisible_pin_size += amdgpu_bo_size(bo);
+			adev->invisible_pin_size += amdgpu_bo_size(bo);
 	} else if (domain == AMDGPU_GEM_DOMAIN_GTT) {
-		bo->adev->gart_pin_size += amdgpu_bo_size(bo);
+		adev->gart_pin_size += amdgpu_bo_size(bo);
 	}
 
 error:
@@ -710,10 +713,11 @@ int amdgpu_bo_pin(struct amdgpu_bo *bo, u32 domain, u64 *gpu_addr)
 
 int amdgpu_bo_unpin(struct amdgpu_bo *bo)
 {
+	struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
 	int r, i;
 
 	if (!bo->pin_count) {
-		dev_warn(bo->adev->dev, "%p unpin not necessary\n", bo);
+		dev_warn(adev->dev, "%p unpin not necessary\n", bo);
 		return 0;
 	}
 	bo->pin_count--;
@@ -725,16 +729,16 @@ int amdgpu_bo_unpin(struct amdgpu_bo *bo)
 	}
 	r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
 	if (unlikely(r)) {
-		dev_err(bo->adev->dev, "%p validate failed for unpin\n", bo);
+		dev_err(adev->dev, "%p validate failed for unpin\n", bo);
 		goto error;
 	}
 
 	if (bo->tbo.mem.mem_type == TTM_PL_VRAM) {
-		bo->adev->vram_pin_size -= amdgpu_bo_size(bo);
+		adev->vram_pin_size -= amdgpu_bo_size(bo);
 		if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
-			bo->adev->invisible_pin_size -= amdgpu_bo_size(bo);
+			adev->invisible_pin_size -= amdgpu_bo_size(bo);
 	} else if (bo->tbo.mem.mem_type == TTM_PL_TT) {
-		bo->adev->gart_pin_size -= amdgpu_bo_size(bo);
+		adev->gart_pin_size -= amdgpu_bo_size(bo);
 	}
 
 error:
@@ -859,6 +863,7 @@ int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer,
 void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
 			   struct ttm_mem_reg *new_mem)
 {
+	struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
 	struct amdgpu_bo *rbo;
 	struct ttm_mem_reg *old_mem = &bo->mem;
 
@@ -866,21 +871,21 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
 		return;
 
 	rbo = container_of(bo, struct amdgpu_bo, tbo);
-	amdgpu_vm_bo_invalidate(rbo->adev, rbo);
+	amdgpu_vm_bo_invalidate(adev, rbo);
 
 	/* update statistics */
 	if (!new_mem)
 		return;
 
 	/* move_notify is called before move happens */
-	amdgpu_update_memory_usage(rbo->adev, &bo->mem, new_mem);
+	amdgpu_update_memory_usage(adev, &bo->mem, new_mem);
 
 	trace_amdgpu_ttm_bo_move(rbo, new_mem->mem_type, old_mem->mem_type);
 }
 
 int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
 {
-	struct amdgpu_device *adev;
+	struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
 	struct amdgpu_bo *abo;
 	unsigned long offset, size, lpfn;
 	int i, r;
@@ -889,7 +894,6 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
 		return 0;
 
 	abo = container_of(bo, struct amdgpu_bo, tbo);
-	adev = abo->adev;
 	if (bo->mem.mem_type != TTM_PL_VRAM)
 		return 0;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
index 8255034..c9b2c01 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
@@ -71,12 +71,13 @@ static inline unsigned amdgpu_mem_type_to_domain(u32 mem_type)
  */
 static inline int amdgpu_bo_reserve(struct amdgpu_bo *bo, bool no_intr)
 {
+	struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
 	int r;
 
 	r = ttm_bo_reserve(&bo->tbo, !no_intr, false, NULL);
 	if (unlikely(r != 0)) {
 		if (r != -ERESTARTSYS)
-			dev_err(bo->adev->dev, "%p reserve failed\n", bo);
+			dev_err(adev->dev, "%p reserve failed\n", bo);
 		return r;
 	}
 	return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 1965209..d246a1f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -51,16 +51,6 @@
 static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev);
 static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev);
 
-static struct amdgpu_device *amdgpu_get_adev(struct ttm_bo_device *bdev)
-{
-	struct amdgpu_mman *mman;
-	struct amdgpu_device *adev;
-
-	mman = container_of(bdev, struct amdgpu_mman, bdev);
-	adev = container_of(mman, struct amdgpu_device, mman);
-	return adev;
-}
-
 
 /*
  * Global memory.
@@ -195,6 +185,7 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
 static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
 				struct ttm_placement *placement)
 {
+	struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
 	struct amdgpu_bo *rbo;
 	static struct ttm_place placements = {
 		.fpfn = 0,
@@ -213,7 +204,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
 	rbo = container_of(bo, struct amdgpu_bo, tbo);
 	switch (bo->mem.mem_type) {
 	case TTM_PL_VRAM:
-		if (rbo->adev->mman.buffer_funcs_ring->ready == false) {
+		if (adev->mman.buffer_funcs_ring->ready == false) {
 			amdgpu_ttm_placement_from_domain(rbo,
 							 AMDGPU_GEM_DOMAIN_CPU);
 		} else {
@@ -231,7 +222,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
 				 * allocating address space for the BO.
 				 */
 				rbo->placements[i].lpfn =
-					rbo->adev->mc.gtt_size >> PAGE_SHIFT;
+					adev->mc.gtt_size >> PAGE_SHIFT;
 			}
 		}
 		break;
@@ -1384,7 +1375,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, uint32_t src_data,
 		       struct reservation_object *resv,
 		       struct fence **fence)
 {
-	struct amdgpu_device *adev = bo->adev;
+	struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
 	struct amdgpu_job *job;
 	struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
index e6842b0..87bcac3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -931,7 +931,7 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo,
 	if (r)
 		return r;
 
-	if (!bo->adev->uvd.address_64_bit) {
+	if (!ring->adev->uvd.address_64_bit) {
 		amdgpu_ttm_placement_from_domain(bo, AMDGPU_GEM_DOMAIN_VRAM);
 		amdgpu_uvd_force_into_uvd_segment(bo);
 	}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index d3a2d1f..5dba9f7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1175,7 +1175,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 
 	flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
 	gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
-		adev == bo_va->bo->adev) ? flags : 0;
+		adev == amdgpu_get_adev(bo_va->bo->tbo.bdev)) ? flags : 0;
 
 	spin_lock(&vm->status_lock);
 	if (!list_empty(&bo_va->vm_status))
-- 
2.5.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/5] drm/amdgpu: rename all rbo variable to abo
       [not found] ` <1473945024-8275-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
                     ` (2 preceding siblings ...)
  2016-09-15 13:10   ` [PATCH 4/5] drm/amdgpu: remove adev pointer from struct amdgpu_bo Christian König
@ 2016-09-15 13:10   ` Christian König
       [not found]     ` <1473945024-8275-5-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
  2016-09-15 18:18   ` [PATCH 1/5] drm/amdgpu: remove unused member from struct amdgpu_bo Alex Deucher
  4 siblings, 1 reply; 14+ messages in thread
From: Christian König @ 2016-09-15 13:10 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

From: Christian König <christian.koenig@amd.com>

Just to cleanup some radeon leftovers.

sed -i "s/rbo/abo/g" drivers/gpu/drm/amd/amdgpu/*.c
sed -i "s/rbo/abo/g" drivers/gpu/drm/amd/amdgpu/*.h

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h         |  4 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 42 +++++++++++++--------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c      | 44 ++++++++++++++---------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c     | 20 ++++++-------
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c  | 16 +++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 24 ++++++++--------
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c     |  8 +++---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c      | 36 +++++++++++------------
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c      | 36 +++++++++++------------
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c       | 36 +++++++++++------------
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c       | 36 +++++++++++------------
 drivers/gpu/drm/amd/amdgpu/dce_virtual.c    | 12 ++++----
 12 files changed, 157 insertions(+), 157 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index ed91f08..c30635a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -701,7 +701,7 @@ struct amdgpu_flip_work {
 	int				crtc_id;
 	uint64_t			base;
 	struct drm_pending_vblank_event *event;
-	struct amdgpu_bo		*old_rbo;
+	struct amdgpu_bo		*old_abo;
 	struct fence			*excl;
 	unsigned			shared_count;
 	struct fence			**shared;
@@ -2436,7 +2436,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data);
 int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type,
 		       u32 ip_instance, u32 ring,
 		       struct amdgpu_ring **out_ring);
-void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *rbo, u32 domain);
+void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *abo, u32 domain);
 bool amdgpu_ttm_bo_is_amdgpu_bo(struct ttm_buffer_object *bo);
 int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages);
 int amdgpu_ttm_tt_set_userptr(struct ttm_tt *ttm, uint64_t addr,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 93fd761..783e1d8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -154,17 +154,17 @@ static void amdgpu_unpin_work_func(struct work_struct *__work)
 	int r;
 
 	/* unpin of the old buffer */
-	r = amdgpu_bo_reserve(work->old_rbo, false);
+	r = amdgpu_bo_reserve(work->old_abo, false);
 	if (likely(r == 0)) {
-		r = amdgpu_bo_unpin(work->old_rbo);
+		r = amdgpu_bo_unpin(work->old_abo);
 		if (unlikely(r != 0)) {
 			DRM_ERROR("failed to unpin buffer after flip\n");
 		}
-		amdgpu_bo_unreserve(work->old_rbo);
+		amdgpu_bo_unreserve(work->old_abo);
 	} else
 		DRM_ERROR("failed to reserve buffer after flip\n");
 
-	amdgpu_bo_unref(&work->old_rbo);
+	amdgpu_bo_unref(&work->old_abo);
 	kfree(work->shared);
 	kfree(work);
 }
@@ -181,7 +181,7 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
 	struct amdgpu_framebuffer *new_amdgpu_fb;
 	struct drm_gem_object *obj;
 	struct amdgpu_flip_work *work;
-	struct amdgpu_bo *new_rbo;
+	struct amdgpu_bo *new_abo;
 	unsigned long flags;
 	u64 tiling_flags;
 	u64 base;
@@ -204,28 +204,28 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
 	obj = old_amdgpu_fb->obj;
 
 	/* take a reference to the old object */
-	work->old_rbo = gem_to_amdgpu_bo(obj);
-	amdgpu_bo_ref(work->old_rbo);
+	work->old_abo = gem_to_amdgpu_bo(obj);
+	amdgpu_bo_ref(work->old_abo);
 
 	new_amdgpu_fb = to_amdgpu_framebuffer(fb);
 	obj = new_amdgpu_fb->obj;
-	new_rbo = gem_to_amdgpu_bo(obj);
+	new_abo = gem_to_amdgpu_bo(obj);
 
 	/* pin the new buffer */
-	r = amdgpu_bo_reserve(new_rbo, false);
+	r = amdgpu_bo_reserve(new_abo, false);
 	if (unlikely(r != 0)) {
-		DRM_ERROR("failed to reserve new rbo buffer before flip\n");
+		DRM_ERROR("failed to reserve new abo buffer before flip\n");
 		goto cleanup;
 	}
 
-	r = amdgpu_bo_pin_restricted(new_rbo, AMDGPU_GEM_DOMAIN_VRAM, 0, 0, &base);
+	r = amdgpu_bo_pin_restricted(new_abo, AMDGPU_GEM_DOMAIN_VRAM, 0, 0, &base);
 	if (unlikely(r != 0)) {
 		r = -EINVAL;
-		DRM_ERROR("failed to pin new rbo buffer before flip\n");
+		DRM_ERROR("failed to pin new abo buffer before flip\n");
 		goto unreserve;
 	}
 
-	r = reservation_object_get_fences_rcu(new_rbo->tbo.resv, &work->excl,
+	r = reservation_object_get_fences_rcu(new_abo->tbo.resv, &work->excl,
 					      &work->shared_count,
 					      &work->shared);
 	if (unlikely(r != 0)) {
@@ -233,8 +233,8 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
 		goto unpin;
 	}
 
-	amdgpu_bo_get_tiling_flags(new_rbo, &tiling_flags);
-	amdgpu_bo_unreserve(new_rbo);
+	amdgpu_bo_get_tiling_flags(new_abo, &tiling_flags);
+	amdgpu_bo_unreserve(new_abo);
 
 	work->base = base;
 
@@ -269,19 +269,19 @@ vblank_cleanup:
 	drm_vblank_put(crtc->dev, amdgpu_crtc->crtc_id);
 
 pflip_cleanup:
-	if (unlikely(amdgpu_bo_reserve(new_rbo, false) != 0)) {
-		DRM_ERROR("failed to reserve new rbo in error path\n");
+	if (unlikely(amdgpu_bo_reserve(new_abo, false) != 0)) {
+		DRM_ERROR("failed to reserve new abo in error path\n");
 		goto cleanup;
 	}
 unpin:
-	if (unlikely(amdgpu_bo_unpin(new_rbo) != 0)) {
-		DRM_ERROR("failed to unpin new rbo in error path\n");
+	if (unlikely(amdgpu_bo_unpin(new_abo) != 0)) {
+		DRM_ERROR("failed to unpin new abo in error path\n");
 	}
 unreserve:
-	amdgpu_bo_unreserve(new_rbo);
+	amdgpu_bo_unreserve(new_abo);
 
 cleanup:
-	amdgpu_bo_unref(&work->old_rbo);
+	amdgpu_bo_unref(&work->old_abo);
 	fence_put(work->excl);
 	for (i = 0; i < work->shared_count; ++i)
 		fence_put(work->shared[i]);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
index 95a4cdd..f491092 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
@@ -111,14 +111,14 @@ int amdgpu_align_pitch(struct amdgpu_device *adev, int width, int bpp, bool tile
 
 static void amdgpufb_destroy_pinned_object(struct drm_gem_object *gobj)
 {
-	struct amdgpu_bo *rbo = gem_to_amdgpu_bo(gobj);
+	struct amdgpu_bo *abo = gem_to_amdgpu_bo(gobj);
 	int ret;
 
-	ret = amdgpu_bo_reserve(rbo, false);
+	ret = amdgpu_bo_reserve(abo, false);
 	if (likely(ret == 0)) {
-		amdgpu_bo_kunmap(rbo);
-		amdgpu_bo_unpin(rbo);
-		amdgpu_bo_unreserve(rbo);
+		amdgpu_bo_kunmap(abo);
+		amdgpu_bo_unpin(abo);
+		amdgpu_bo_unreserve(abo);
 	}
 	drm_gem_object_unreference_unlocked(gobj);
 }
@@ -129,7 +129,7 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
 {
 	struct amdgpu_device *adev = rfbdev->adev;
 	struct drm_gem_object *gobj = NULL;
-	struct amdgpu_bo *rbo = NULL;
+	struct amdgpu_bo *abo = NULL;
 	bool fb_tiled = false; /* useful for testing */
 	u32 tiling_flags = 0;
 	int ret;
@@ -156,30 +156,30 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
 		       aligned_size);
 		return -ENOMEM;
 	}
-	rbo = gem_to_amdgpu_bo(gobj);
+	abo = gem_to_amdgpu_bo(gobj);
 
 	if (fb_tiled)
 		tiling_flags = AMDGPU_TILING_SET(ARRAY_MODE, GRPH_ARRAY_2D_TILED_THIN1);
 
-	ret = amdgpu_bo_reserve(rbo, false);
+	ret = amdgpu_bo_reserve(abo, false);
 	if (unlikely(ret != 0))
 		goto out_unref;
 
 	if (tiling_flags) {
-		ret = amdgpu_bo_set_tiling_flags(rbo,
+		ret = amdgpu_bo_set_tiling_flags(abo,
 						 tiling_flags);
 		if (ret)
 			dev_err(adev->dev, "FB failed to set tiling flags\n");
 	}
 
 
-	ret = amdgpu_bo_pin_restricted(rbo, AMDGPU_GEM_DOMAIN_VRAM, 0, 0, NULL);
+	ret = amdgpu_bo_pin_restricted(abo, AMDGPU_GEM_DOMAIN_VRAM, 0, 0, NULL);
 	if (ret) {
-		amdgpu_bo_unreserve(rbo);
+		amdgpu_bo_unreserve(abo);
 		goto out_unref;
 	}
-	ret = amdgpu_bo_kmap(rbo, NULL);
-	amdgpu_bo_unreserve(rbo);
+	ret = amdgpu_bo_kmap(abo, NULL);
+	amdgpu_bo_unreserve(abo);
 	if (ret) {
 		goto out_unref;
 	}
@@ -201,7 +201,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 	struct drm_framebuffer *fb = NULL;
 	struct drm_mode_fb_cmd2 mode_cmd;
 	struct drm_gem_object *gobj = NULL;
-	struct amdgpu_bo *rbo = NULL;
+	struct amdgpu_bo *abo = NULL;
 	int ret;
 	unsigned long tmp;
 
@@ -220,7 +220,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 		return ret;
 	}
 
-	rbo = gem_to_amdgpu_bo(gobj);
+	abo = gem_to_amdgpu_bo(gobj);
 
 	/* okay we have an object now allocate the framebuffer */
 	info = drm_fb_helper_alloc_fbi(helper);
@@ -243,7 +243,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 	/* setup helper */
 	rfbdev->helper.fb = fb;
 
-	memset_io(rbo->kptr, 0x0, amdgpu_bo_size(rbo));
+	memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
 
 	strcpy(info->fix.id, "amdgpudrmfb");
 
@@ -252,11 +252,11 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 	info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
 	info->fbops = &amdgpufb_ops;
 
-	tmp = amdgpu_bo_gpu_offset(rbo) - adev->mc.vram_start;
+	tmp = amdgpu_bo_gpu_offset(abo) - adev->mc.vram_start;
 	info->fix.smem_start = adev->mc.aper_base + tmp;
-	info->fix.smem_len = amdgpu_bo_size(rbo);
-	info->screen_base = rbo->kptr;
-	info->screen_size = amdgpu_bo_size(rbo);
+	info->fix.smem_len = amdgpu_bo_size(abo);
+	info->screen_base = abo->kptr;
+	info->screen_size = amdgpu_bo_size(abo);
 
 	drm_fb_helper_fill_var(info, &rfbdev->helper, sizes->fb_width, sizes->fb_height);
 
@@ -273,7 +273,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 
 	DRM_INFO("fb mappable at 0x%lX\n",  info->fix.smem_start);
 	DRM_INFO("vram apper at 0x%lX\n",  (unsigned long)adev->mc.aper_base);
-	DRM_INFO("size %lu\n", (unsigned long)amdgpu_bo_size(rbo));
+	DRM_INFO("size %lu\n", (unsigned long)amdgpu_bo_size(abo));
 	DRM_INFO("fb depth is %d\n", fb->depth);
 	DRM_INFO("   pitch is %d\n", fb->pitches[0]);
 
@@ -283,7 +283,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 out_destroy_fbi:
 	drm_fb_helper_release_fbi(helper);
 out_unref:
-	if (rbo) {
+	if (abo) {
 
 	}
 	if (fb && ret) {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 480ae7e..6ae87e8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -120,23 +120,23 @@ void amdgpu_gem_force_release(struct amdgpu_device *adev)
 int amdgpu_gem_object_open(struct drm_gem_object *obj,
 			   struct drm_file *file_priv)
 {
-	struct amdgpu_bo *rbo = gem_to_amdgpu_bo(obj);
-	struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
+	struct amdgpu_bo *abo = gem_to_amdgpu_bo(obj);
+	struct amdgpu_device *adev = amdgpu_get_adev(abo->tbo.bdev);
 	struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
 	struct amdgpu_vm *vm = &fpriv->vm;
 	struct amdgpu_bo_va *bo_va;
 	int r;
-	r = amdgpu_bo_reserve(rbo, false);
+	r = amdgpu_bo_reserve(abo, false);
 	if (r)
 		return r;
 
-	bo_va = amdgpu_vm_bo_find(vm, rbo);
+	bo_va = amdgpu_vm_bo_find(vm, abo);
 	if (!bo_va) {
-		bo_va = amdgpu_vm_bo_add(adev, vm, rbo);
+		bo_va = amdgpu_vm_bo_add(adev, vm, abo);
 	} else {
 		++bo_va->ref_count;
 	}
-	amdgpu_bo_unreserve(rbo);
+	amdgpu_bo_unreserve(abo);
 	return 0;
 }
 
@@ -552,7 +552,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
 	struct drm_gem_object *gobj;
 	struct amdgpu_device *adev = dev->dev_private;
 	struct amdgpu_fpriv *fpriv = filp->driver_priv;
-	struct amdgpu_bo *rbo;
+	struct amdgpu_bo *abo;
 	struct amdgpu_bo_va *bo_va;
 	struct ttm_validate_buffer tv, tv_pd;
 	struct ww_acquire_ctx ticket;
@@ -592,10 +592,10 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
 	gobj = drm_gem_object_lookup(filp, args->handle);
 	if (gobj == NULL)
 		return -ENOENT;
-	rbo = gem_to_amdgpu_bo(gobj);
+	abo = gem_to_amdgpu_bo(gobj);
 	INIT_LIST_HEAD(&list);
 	INIT_LIST_HEAD(&duplicates);
-	tv.bo = &rbo->tbo;
+	tv.bo = &abo->tbo;
 	tv.shared = true;
 	list_add(&tv.head, &list);
 
@@ -609,7 +609,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
 		return r;
 	}
 
-	bo_va = amdgpu_vm_bo_find(&fpriv->vm, rbo);
+	bo_va = amdgpu_vm_bo_find(&fpriv->vm, abo);
 	if (!bo_va) {
 		ttm_eu_backoff_reservation(&ticket, &list);
 		drm_gem_object_unreference_unlocked(gobj);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 5cbe803..c57d55d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -211,12 +211,12 @@ static void amdgpu_ttm_placement_init(struct amdgpu_device *adev,
 	placement->busy_placement = places;
 }
 
-void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *rbo, u32 domain)
+void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *abo, u32 domain)
 {
-	struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
+	struct amdgpu_device *adev = amdgpu_get_adev(abo->tbo.bdev);
 
-	amdgpu_ttm_placement_init(adev, &rbo->placement, rbo->placements,
-				  domain, rbo->flags);
+	amdgpu_ttm_placement_init(adev, &abo->placement, abo->placements,
+				  domain, abo->flags);
 }
 
 static void amdgpu_fill_placement_to_bo(struct amdgpu_bo *bo,
@@ -864,14 +864,14 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
 			   struct ttm_mem_reg *new_mem)
 {
 	struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
-	struct amdgpu_bo *rbo;
+	struct amdgpu_bo *abo;
 	struct ttm_mem_reg *old_mem = &bo->mem;
 
 	if (!amdgpu_ttm_bo_is_amdgpu_bo(bo))
 		return;
 
-	rbo = container_of(bo, struct amdgpu_bo, tbo);
-	amdgpu_vm_bo_invalidate(adev, rbo);
+	abo = container_of(bo, struct amdgpu_bo, tbo);
+	amdgpu_vm_bo_invalidate(adev, abo);
 
 	/* update statistics */
 	if (!new_mem)
@@ -880,7 +880,7 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
 	/* move_notify is called before move happens */
 	amdgpu_update_memory_usage(adev, &bo->mem, new_mem);
 
-	trace_amdgpu_ttm_bo_move(rbo, new_mem->mem_type, old_mem->mem_type);
+	trace_amdgpu_ttm_bo_move(abo, new_mem->mem_type, old_mem->mem_type);
 }
 
 int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index d246a1f..6d0ed39f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -186,7 +186,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
 				struct ttm_placement *placement)
 {
 	struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
-	struct amdgpu_bo *rbo;
+	struct amdgpu_bo *abo;
 	static struct ttm_place placements = {
 		.fpfn = 0,
 		.lpfn = 0,
@@ -201,45 +201,45 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
 		placement->num_busy_placement = 1;
 		return;
 	}
-	rbo = container_of(bo, struct amdgpu_bo, tbo);
+	abo = container_of(bo, struct amdgpu_bo, tbo);
 	switch (bo->mem.mem_type) {
 	case TTM_PL_VRAM:
 		if (adev->mman.buffer_funcs_ring->ready == false) {
-			amdgpu_ttm_placement_from_domain(rbo,
+			amdgpu_ttm_placement_from_domain(abo,
 							 AMDGPU_GEM_DOMAIN_CPU);
 		} else {
-			amdgpu_ttm_placement_from_domain(rbo,
+			amdgpu_ttm_placement_from_domain(abo,
 							 AMDGPU_GEM_DOMAIN_GTT);
-			for (i = 0; i < rbo->placement.num_placement; ++i) {
-				if (!(rbo->placements[i].flags &
+			for (i = 0; i < abo->placement.num_placement; ++i) {
+				if (!(abo->placements[i].flags &
 				      TTM_PL_FLAG_TT))
 					continue;
 
-				if (rbo->placements[i].lpfn)
+				if (abo->placements[i].lpfn)
 					continue;
 
 				/* set an upper limit to force directly
 				 * allocating address space for the BO.
 				 */
-				rbo->placements[i].lpfn =
+				abo->placements[i].lpfn =
 					adev->mc.gtt_size >> PAGE_SHIFT;
 			}
 		}
 		break;
 	case TTM_PL_TT:
 	default:
-		amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_CPU);
+		amdgpu_ttm_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_CPU);
 	}
-	*placement = rbo->placement;
+	*placement = abo->placement;
 }
 
 static int amdgpu_verify_access(struct ttm_buffer_object *bo, struct file *filp)
 {
-	struct amdgpu_bo *rbo = container_of(bo, struct amdgpu_bo, tbo);
+	struct amdgpu_bo *abo = container_of(bo, struct amdgpu_bo, tbo);
 
 	if (amdgpu_ttm_tt_get_usermm(bo->ttm))
 		return -EPERM;
-	return drm_vma_node_verify_access(&rbo->gem_base.vma_node, filp);
+	return drm_vma_node_verify_access(&abo->gem_base.vma_node, filp);
 }
 
 static void amdgpu_move_null(struct ttm_buffer_object *bo,
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
index 87bcac3..d67eada 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -351,12 +351,12 @@ void amdgpu_uvd_free_handles(struct amdgpu_device *adev, struct drm_file *filp)
 	}
 }
 
-static void amdgpu_uvd_force_into_uvd_segment(struct amdgpu_bo *rbo)
+static void amdgpu_uvd_force_into_uvd_segment(struct amdgpu_bo *abo)
 {
 	int i;
-	for (i = 0; i < rbo->placement.num_placement; ++i) {
-		rbo->placements[i].fpfn = 0 >> PAGE_SHIFT;
-		rbo->placements[i].lpfn = (256 * 1024 * 1024) >> PAGE_SHIFT;
+	for (i = 0; i < abo->placement.num_placement; ++i) {
+		abo->placements[i].fpfn = 0 >> PAGE_SHIFT;
+		abo->placements[i].lpfn = (256 * 1024 * 1024) >> PAGE_SHIFT;
 	}
 }
 
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 2af166e..5af418f 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -2102,7 +2102,7 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
 	struct amdgpu_framebuffer *amdgpu_fb;
 	struct drm_framebuffer *target_fb;
 	struct drm_gem_object *obj;
-	struct amdgpu_bo *rbo;
+	struct amdgpu_bo *abo;
 	uint64_t fb_location, tiling_flags;
 	uint32_t fb_format, fb_pitch_pixels;
 	u32 fb_swap = REG_SET_FIELD(0, GRPH_SWAP_CNTL, GRPH_ENDIAN_SWAP, ENDIAN_NONE);
@@ -2129,23 +2129,23 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
 	 * just update base pointers
 	 */
 	obj = amdgpu_fb->obj;
-	rbo = gem_to_amdgpu_bo(obj);
-	r = amdgpu_bo_reserve(rbo, false);
+	abo = gem_to_amdgpu_bo(obj);
+	r = amdgpu_bo_reserve(abo, false);
 	if (unlikely(r != 0))
 		return r;
 
 	if (atomic) {
-		fb_location = amdgpu_bo_gpu_offset(rbo);
+		fb_location = amdgpu_bo_gpu_offset(abo);
 	} else {
-		r = amdgpu_bo_pin(rbo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
+		r = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
 		if (unlikely(r != 0)) {
-			amdgpu_bo_unreserve(rbo);
+			amdgpu_bo_unreserve(abo);
 			return -EINVAL;
 		}
 	}
 
-	amdgpu_bo_get_tiling_flags(rbo, &tiling_flags);
-	amdgpu_bo_unreserve(rbo);
+	amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
+	amdgpu_bo_unreserve(abo);
 
 	pipe_config = AMDGPU_TILING_GET(tiling_flags, PIPE_CONFIG);
 
@@ -2319,12 +2319,12 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
 
 	if (!atomic && fb && fb != crtc->primary->fb) {
 		amdgpu_fb = to_amdgpu_framebuffer(fb);
-		rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-		r = amdgpu_bo_reserve(rbo, false);
+		abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+		r = amdgpu_bo_reserve(abo, false);
 		if (unlikely(r != 0))
 			return r;
-		amdgpu_bo_unpin(rbo);
-		amdgpu_bo_unreserve(rbo);
+		amdgpu_bo_unpin(abo);
+		amdgpu_bo_unreserve(abo);
 	}
 
 	/* Bytes per pixel may have changed */
@@ -2802,16 +2802,16 @@ static void dce_v10_0_crtc_disable(struct drm_crtc *crtc)
 	if (crtc->primary->fb) {
 		int r;
 		struct amdgpu_framebuffer *amdgpu_fb;
-		struct amdgpu_bo *rbo;
+		struct amdgpu_bo *abo;
 
 		amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
-		rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-		r = amdgpu_bo_reserve(rbo, false);
+		abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+		r = amdgpu_bo_reserve(abo, false);
 		if (unlikely(r))
-			DRM_ERROR("failed to reserve rbo before unpin\n");
+			DRM_ERROR("failed to reserve abo before unpin\n");
 		else {
-			amdgpu_bo_unpin(rbo);
-			amdgpu_bo_unreserve(rbo);
+			amdgpu_bo_unpin(abo);
+			amdgpu_bo_unreserve(abo);
 		}
 	}
 	/* disable the GRPH */
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 6747f8f..256de46 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -2085,7 +2085,7 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
 	struct amdgpu_framebuffer *amdgpu_fb;
 	struct drm_framebuffer *target_fb;
 	struct drm_gem_object *obj;
-	struct amdgpu_bo *rbo;
+	struct amdgpu_bo *abo;
 	uint64_t fb_location, tiling_flags;
 	uint32_t fb_format, fb_pitch_pixels;
 	u32 fb_swap = REG_SET_FIELD(0, GRPH_SWAP_CNTL, GRPH_ENDIAN_SWAP, ENDIAN_NONE);
@@ -2112,23 +2112,23 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
 	 * just update base pointers
 	 */
 	obj = amdgpu_fb->obj;
-	rbo = gem_to_amdgpu_bo(obj);
-	r = amdgpu_bo_reserve(rbo, false);
+	abo = gem_to_amdgpu_bo(obj);
+	r = amdgpu_bo_reserve(abo, false);
 	if (unlikely(r != 0))
 		return r;
 
 	if (atomic) {
-		fb_location = amdgpu_bo_gpu_offset(rbo);
+		fb_location = amdgpu_bo_gpu_offset(abo);
 	} else {
-		r = amdgpu_bo_pin(rbo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
+		r = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
 		if (unlikely(r != 0)) {
-			amdgpu_bo_unreserve(rbo);
+			amdgpu_bo_unreserve(abo);
 			return -EINVAL;
 		}
 	}
 
-	amdgpu_bo_get_tiling_flags(rbo, &tiling_flags);
-	amdgpu_bo_unreserve(rbo);
+	amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
+	amdgpu_bo_unreserve(abo);
 
 	pipe_config = AMDGPU_TILING_GET(tiling_flags, PIPE_CONFIG);
 
@@ -2302,12 +2302,12 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
 
 	if (!atomic && fb && fb != crtc->primary->fb) {
 		amdgpu_fb = to_amdgpu_framebuffer(fb);
-		rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-		r = amdgpu_bo_reserve(rbo, false);
+		abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+		r = amdgpu_bo_reserve(abo, false);
 		if (unlikely(r != 0))
 			return r;
-		amdgpu_bo_unpin(rbo);
-		amdgpu_bo_unreserve(rbo);
+		amdgpu_bo_unpin(abo);
+		amdgpu_bo_unreserve(abo);
 	}
 
 	/* Bytes per pixel may have changed */
@@ -2820,16 +2820,16 @@ static void dce_v11_0_crtc_disable(struct drm_crtc *crtc)
 	if (crtc->primary->fb) {
 		int r;
 		struct amdgpu_framebuffer *amdgpu_fb;
-		struct amdgpu_bo *rbo;
+		struct amdgpu_bo *abo;
 
 		amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
-		rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-		r = amdgpu_bo_reserve(rbo, false);
+		abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+		r = amdgpu_bo_reserve(abo, false);
 		if (unlikely(r))
-			DRM_ERROR("failed to reserve rbo before unpin\n");
+			DRM_ERROR("failed to reserve abo before unpin\n");
 		else {
-			amdgpu_bo_unpin(rbo);
-			amdgpu_bo_unreserve(rbo);
+			amdgpu_bo_unpin(abo);
+			amdgpu_bo_unreserve(abo);
 		}
 	}
 	/* disable the GRPH */
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index 0a807d2..0a1db00 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -1493,7 +1493,7 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,
 	struct amdgpu_framebuffer *amdgpu_fb;
 	struct drm_framebuffer *target_fb;
 	struct drm_gem_object *obj;
-	struct amdgpu_bo *rbo;
+	struct amdgpu_bo *abo;
 	uint64_t fb_location, tiling_flags;
 	uint32_t fb_format, fb_pitch_pixels, pipe_config;
 	u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE);
@@ -1520,23 +1520,23 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,
 	 * just update base pointers
 	 */
 	obj = amdgpu_fb->obj;
-	rbo = gem_to_amdgpu_bo(obj);
-	r = amdgpu_bo_reserve(rbo, false);
+	abo = gem_to_amdgpu_bo(obj);
+	r = amdgpu_bo_reserve(abo, false);
 	if (unlikely(r != 0))
 		return r;
 
 	if (atomic)
-		fb_location = amdgpu_bo_gpu_offset(rbo);
+		fb_location = amdgpu_bo_gpu_offset(abo);
 	else {
-		r = amdgpu_bo_pin(rbo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
+		r = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
 		if (unlikely(r != 0)) {
-			amdgpu_bo_unreserve(rbo);
+			amdgpu_bo_unreserve(abo);
 			return -EINVAL;
 		}
 	}
 
-	amdgpu_bo_get_tiling_flags(rbo, &tiling_flags);
-	amdgpu_bo_unreserve(rbo);
+	amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
+	amdgpu_bo_unreserve(abo);
 
 	switch (target_fb->pixel_format) {
 	case DRM_FORMAT_C8:
@@ -1688,12 +1688,12 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,
 
 	if (!atomic && fb && fb != crtc->primary->fb) {
 		amdgpu_fb = to_amdgpu_framebuffer(fb);
-		rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-		r = amdgpu_bo_reserve(rbo, false);
+		abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+		r = amdgpu_bo_reserve(abo, false);
 		if (unlikely(r != 0))
 			return r;
-		amdgpu_bo_unpin(rbo);
-		amdgpu_bo_unreserve(rbo);
+		amdgpu_bo_unpin(abo);
+		amdgpu_bo_unreserve(abo);
 	}
 
 	/* Bytes per pixel may have changed */
@@ -2139,16 +2139,16 @@ static void dce_v6_0_crtc_disable(struct drm_crtc *crtc)
 	if (crtc->primary->fb) {
 		int r;
 		struct amdgpu_framebuffer *amdgpu_fb;
-		struct amdgpu_bo *rbo;
+		struct amdgpu_bo *abo;
 
 		amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
-		rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-		r = amdgpu_bo_reserve(rbo, false);
+		abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+		r = amdgpu_bo_reserve(abo, false);
 		if (unlikely(r))
-			DRM_ERROR("failed to reserve rbo before unpin\n");
+			DRM_ERROR("failed to reserve abo before unpin\n");
 		else {
-			amdgpu_bo_unpin(rbo);
-			amdgpu_bo_unreserve(rbo);
+			amdgpu_bo_unpin(abo);
+			amdgpu_bo_unreserve(abo);
 		}
 	}
 	/* disable the GRPH */
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 06d836f..4d313aa 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -1990,7 +1990,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
 	struct amdgpu_framebuffer *amdgpu_fb;
 	struct drm_framebuffer *target_fb;
 	struct drm_gem_object *obj;
-	struct amdgpu_bo *rbo;
+	struct amdgpu_bo *abo;
 	uint64_t fb_location, tiling_flags;
 	uint32_t fb_format, fb_pitch_pixels;
 	u32 fb_swap = (GRPH_ENDIAN_NONE << GRPH_SWAP_CNTL__GRPH_ENDIAN_SWAP__SHIFT);
@@ -2017,23 +2017,23 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
 	 * just update base pointers
 	 */
 	obj = amdgpu_fb->obj;
-	rbo = gem_to_amdgpu_bo(obj);
-	r = amdgpu_bo_reserve(rbo, false);
+	abo = gem_to_amdgpu_bo(obj);
+	r = amdgpu_bo_reserve(abo, false);
 	if (unlikely(r != 0))
 		return r;
 
 	if (atomic) {
-		fb_location = amdgpu_bo_gpu_offset(rbo);
+		fb_location = amdgpu_bo_gpu_offset(abo);
 	} else {
-		r = amdgpu_bo_pin(rbo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
+		r = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
 		if (unlikely(r != 0)) {
-			amdgpu_bo_unreserve(rbo);
+			amdgpu_bo_unreserve(abo);
 			return -EINVAL;
 		}
 	}
 
-	amdgpu_bo_get_tiling_flags(rbo, &tiling_flags);
-	amdgpu_bo_unreserve(rbo);
+	amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
+	amdgpu_bo_unreserve(abo);
 
 	pipe_config = AMDGPU_TILING_GET(tiling_flags, PIPE_CONFIG);
 
@@ -2188,12 +2188,12 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
 
 	if (!atomic && fb && fb != crtc->primary->fb) {
 		amdgpu_fb = to_amdgpu_framebuffer(fb);
-		rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-		r = amdgpu_bo_reserve(rbo, false);
+		abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+		r = amdgpu_bo_reserve(abo, false);
 		if (unlikely(r != 0))
 			return r;
-		amdgpu_bo_unpin(rbo);
-		amdgpu_bo_unreserve(rbo);
+		amdgpu_bo_unpin(abo);
+		amdgpu_bo_unreserve(abo);
 	}
 
 	/* Bytes per pixel may have changed */
@@ -2663,16 +2663,16 @@ static void dce_v8_0_crtc_disable(struct drm_crtc *crtc)
 	if (crtc->primary->fb) {
 		int r;
 		struct amdgpu_framebuffer *amdgpu_fb;
-		struct amdgpu_bo *rbo;
+		struct amdgpu_bo *abo;
 
 		amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
-		rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-		r = amdgpu_bo_reserve(rbo, false);
+		abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+		r = amdgpu_bo_reserve(abo, false);
 		if (unlikely(r))
-			DRM_ERROR("failed to reserve rbo before unpin\n");
+			DRM_ERROR("failed to reserve abo before unpin\n");
 		else {
-			amdgpu_bo_unpin(rbo);
-			amdgpu_bo_unreserve(rbo);
+			amdgpu_bo_unpin(abo);
+			amdgpu_bo_unreserve(abo);
 		}
 	}
 	/* disable the GRPH */
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index 85f14a6..c93e18e 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -227,16 +227,16 @@ static void dce_virtual_crtc_disable(struct drm_crtc *crtc)
 	if (crtc->primary->fb) {
 		int r;
 		struct amdgpu_framebuffer *amdgpu_fb;
-		struct amdgpu_bo *rbo;
+		struct amdgpu_bo *abo;
 
 		amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
-		rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
-		r = amdgpu_bo_reserve(rbo, false);
+		abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
+		r = amdgpu_bo_reserve(abo, false);
 		if (unlikely(r))
-			DRM_ERROR("failed to reserve rbo before unpin\n");
+			DRM_ERROR("failed to reserve abo before unpin\n");
 		else {
-			amdgpu_bo_unpin(rbo);
-			amdgpu_bo_unreserve(rbo);
+			amdgpu_bo_unpin(abo);
+			amdgpu_bo_unreserve(abo);
 		}
 	}
 
-- 
2.5.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/5] drm/amdgpu: remove unused member from struct amdgpu_bo
       [not found] ` <1473945024-8275-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
                     ` (3 preceding siblings ...)
  2016-09-15 13:10   ` [PATCH 5/5] drm/amdgpu: rename all rbo variable to abo Christian König
@ 2016-09-15 18:18   ` Alex Deucher
  4 siblings, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2016-09-15 18:18 UTC (permalink / raw)
  To: Christian König; +Cc: amd-gfx list

On Thu, Sep 15, 2016 at 9:10 AM, Christian König
<deathsimple@vodafone.de> wrote:
> From: Christian König <christian.koenig@amd.com>
>
> Not used in a while.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 2 --
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 1 -
>  2 files changed, 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index ee55763..3b3981d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -446,8 +446,6 @@ struct amdgpu_bo_va {
>  #define AMDGPU_GEM_DOMAIN_MAX          0x3
>
>  struct amdgpu_bo {
> -       /* Protected by gem.mutex */
> -       struct list_head                list;
>         /* Protected by tbo.reserved */
>         u32                             prefered_domains;
>         u32                             allowed_domains;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index d6e6c93..4289c31 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -360,7 +360,6 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
>                 return r;
>         }
>         bo->adev = adev;
> -       INIT_LIST_HEAD(&bo->list);
>         INIT_LIST_HEAD(&bo->shadow_list);
>         INIT_LIST_HEAD(&bo->va);
>         bo->prefered_domains = domain & (AMDGPU_GEM_DOMAIN_VRAM |
> --
> 2.5.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/5] drm/amdgpu: rename all rbo variable to abo
       [not found]     ` <1473945024-8275-5-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
@ 2016-09-15 18:19       ` Alex Deucher
  0 siblings, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2016-09-15 18:19 UTC (permalink / raw)
  To: Christian König; +Cc: amd-gfx list

On Thu, Sep 15, 2016 at 9:10 AM, Christian König
<deathsimple@vodafone.de> wrote:
> From: Christian König <christian.koenig@amd.com>
>
> Just to cleanup some radeon leftovers.
>
> sed -i "s/rbo/abo/g" drivers/gpu/drm/amd/amdgpu/*.c
> sed -i "s/rbo/abo/g" drivers/gpu/drm/amd/amdgpu/*.h
>
> Signed-off-by: Christian König <christian.koenig@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h         |  4 +--
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 42 +++++++++++++--------------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c      | 44 ++++++++++++++---------------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c     | 20 ++++++-------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c  | 16 +++++------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 24 ++++++++--------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c     |  8 +++---
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c      | 36 +++++++++++------------
>  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c      | 36 +++++++++++------------
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c       | 36 +++++++++++------------
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c       | 36 +++++++++++------------
>  drivers/gpu/drm/amd/amdgpu/dce_virtual.c    | 12 ++++----
>  12 files changed, 157 insertions(+), 157 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index ed91f08..c30635a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -701,7 +701,7 @@ struct amdgpu_flip_work {
>         int                             crtc_id;
>         uint64_t                        base;
>         struct drm_pending_vblank_event *event;
> -       struct amdgpu_bo                *old_rbo;
> +       struct amdgpu_bo                *old_abo;
>         struct fence                    *excl;
>         unsigned                        shared_count;
>         struct fence                    **shared;
> @@ -2436,7 +2436,7 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data);
>  int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type,
>                        u32 ip_instance, u32 ring,
>                        struct amdgpu_ring **out_ring);
> -void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *rbo, u32 domain);
> +void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *abo, u32 domain);
>  bool amdgpu_ttm_bo_is_amdgpu_bo(struct ttm_buffer_object *bo);
>  int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages);
>  int amdgpu_ttm_tt_set_userptr(struct ttm_tt *ttm, uint64_t addr,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 93fd761..783e1d8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -154,17 +154,17 @@ static void amdgpu_unpin_work_func(struct work_struct *__work)
>         int r;
>
>         /* unpin of the old buffer */
> -       r = amdgpu_bo_reserve(work->old_rbo, false);
> +       r = amdgpu_bo_reserve(work->old_abo, false);
>         if (likely(r == 0)) {
> -               r = amdgpu_bo_unpin(work->old_rbo);
> +               r = amdgpu_bo_unpin(work->old_abo);
>                 if (unlikely(r != 0)) {
>                         DRM_ERROR("failed to unpin buffer after flip\n");
>                 }
> -               amdgpu_bo_unreserve(work->old_rbo);
> +               amdgpu_bo_unreserve(work->old_abo);
>         } else
>                 DRM_ERROR("failed to reserve buffer after flip\n");
>
> -       amdgpu_bo_unref(&work->old_rbo);
> +       amdgpu_bo_unref(&work->old_abo);
>         kfree(work->shared);
>         kfree(work);
>  }
> @@ -181,7 +181,7 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
>         struct amdgpu_framebuffer *new_amdgpu_fb;
>         struct drm_gem_object *obj;
>         struct amdgpu_flip_work *work;
> -       struct amdgpu_bo *new_rbo;
> +       struct amdgpu_bo *new_abo;
>         unsigned long flags;
>         u64 tiling_flags;
>         u64 base;
> @@ -204,28 +204,28 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
>         obj = old_amdgpu_fb->obj;
>
>         /* take a reference to the old object */
> -       work->old_rbo = gem_to_amdgpu_bo(obj);
> -       amdgpu_bo_ref(work->old_rbo);
> +       work->old_abo = gem_to_amdgpu_bo(obj);
> +       amdgpu_bo_ref(work->old_abo);
>
>         new_amdgpu_fb = to_amdgpu_framebuffer(fb);
>         obj = new_amdgpu_fb->obj;
> -       new_rbo = gem_to_amdgpu_bo(obj);
> +       new_abo = gem_to_amdgpu_bo(obj);
>
>         /* pin the new buffer */
> -       r = amdgpu_bo_reserve(new_rbo, false);
> +       r = amdgpu_bo_reserve(new_abo, false);
>         if (unlikely(r != 0)) {
> -               DRM_ERROR("failed to reserve new rbo buffer before flip\n");
> +               DRM_ERROR("failed to reserve new abo buffer before flip\n");
>                 goto cleanup;
>         }
>
> -       r = amdgpu_bo_pin_restricted(new_rbo, AMDGPU_GEM_DOMAIN_VRAM, 0, 0, &base);
> +       r = amdgpu_bo_pin_restricted(new_abo, AMDGPU_GEM_DOMAIN_VRAM, 0, 0, &base);
>         if (unlikely(r != 0)) {
>                 r = -EINVAL;
> -               DRM_ERROR("failed to pin new rbo buffer before flip\n");
> +               DRM_ERROR("failed to pin new abo buffer before flip\n");
>                 goto unreserve;
>         }
>
> -       r = reservation_object_get_fences_rcu(new_rbo->tbo.resv, &work->excl,
> +       r = reservation_object_get_fences_rcu(new_abo->tbo.resv, &work->excl,
>                                               &work->shared_count,
>                                               &work->shared);
>         if (unlikely(r != 0)) {
> @@ -233,8 +233,8 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc,
>                 goto unpin;
>         }
>
> -       amdgpu_bo_get_tiling_flags(new_rbo, &tiling_flags);
> -       amdgpu_bo_unreserve(new_rbo);
> +       amdgpu_bo_get_tiling_flags(new_abo, &tiling_flags);
> +       amdgpu_bo_unreserve(new_abo);
>
>         work->base = base;
>
> @@ -269,19 +269,19 @@ vblank_cleanup:
>         drm_vblank_put(crtc->dev, amdgpu_crtc->crtc_id);
>
>  pflip_cleanup:
> -       if (unlikely(amdgpu_bo_reserve(new_rbo, false) != 0)) {
> -               DRM_ERROR("failed to reserve new rbo in error path\n");
> +       if (unlikely(amdgpu_bo_reserve(new_abo, false) != 0)) {
> +               DRM_ERROR("failed to reserve new abo in error path\n");
>                 goto cleanup;
>         }
>  unpin:
> -       if (unlikely(amdgpu_bo_unpin(new_rbo) != 0)) {
> -               DRM_ERROR("failed to unpin new rbo in error path\n");
> +       if (unlikely(amdgpu_bo_unpin(new_abo) != 0)) {
> +               DRM_ERROR("failed to unpin new abo in error path\n");
>         }
>  unreserve:
> -       amdgpu_bo_unreserve(new_rbo);
> +       amdgpu_bo_unreserve(new_abo);
>
>  cleanup:
> -       amdgpu_bo_unref(&work->old_rbo);
> +       amdgpu_bo_unref(&work->old_abo);
>         fence_put(work->excl);
>         for (i = 0; i < work->shared_count; ++i)
>                 fence_put(work->shared[i]);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> index 95a4cdd..f491092 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> @@ -111,14 +111,14 @@ int amdgpu_align_pitch(struct amdgpu_device *adev, int width, int bpp, bool tile
>
>  static void amdgpufb_destroy_pinned_object(struct drm_gem_object *gobj)
>  {
> -       struct amdgpu_bo *rbo = gem_to_amdgpu_bo(gobj);
> +       struct amdgpu_bo *abo = gem_to_amdgpu_bo(gobj);
>         int ret;
>
> -       ret = amdgpu_bo_reserve(rbo, false);
> +       ret = amdgpu_bo_reserve(abo, false);
>         if (likely(ret == 0)) {
> -               amdgpu_bo_kunmap(rbo);
> -               amdgpu_bo_unpin(rbo);
> -               amdgpu_bo_unreserve(rbo);
> +               amdgpu_bo_kunmap(abo);
> +               amdgpu_bo_unpin(abo);
> +               amdgpu_bo_unreserve(abo);
>         }
>         drm_gem_object_unreference_unlocked(gobj);
>  }
> @@ -129,7 +129,7 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
>  {
>         struct amdgpu_device *adev = rfbdev->adev;
>         struct drm_gem_object *gobj = NULL;
> -       struct amdgpu_bo *rbo = NULL;
> +       struct amdgpu_bo *abo = NULL;
>         bool fb_tiled = false; /* useful for testing */
>         u32 tiling_flags = 0;
>         int ret;
> @@ -156,30 +156,30 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
>                        aligned_size);
>                 return -ENOMEM;
>         }
> -       rbo = gem_to_amdgpu_bo(gobj);
> +       abo = gem_to_amdgpu_bo(gobj);
>
>         if (fb_tiled)
>                 tiling_flags = AMDGPU_TILING_SET(ARRAY_MODE, GRPH_ARRAY_2D_TILED_THIN1);
>
> -       ret = amdgpu_bo_reserve(rbo, false);
> +       ret = amdgpu_bo_reserve(abo, false);
>         if (unlikely(ret != 0))
>                 goto out_unref;
>
>         if (tiling_flags) {
> -               ret = amdgpu_bo_set_tiling_flags(rbo,
> +               ret = amdgpu_bo_set_tiling_flags(abo,
>                                                  tiling_flags);
>                 if (ret)
>                         dev_err(adev->dev, "FB failed to set tiling flags\n");
>         }
>
>
> -       ret = amdgpu_bo_pin_restricted(rbo, AMDGPU_GEM_DOMAIN_VRAM, 0, 0, NULL);
> +       ret = amdgpu_bo_pin_restricted(abo, AMDGPU_GEM_DOMAIN_VRAM, 0, 0, NULL);
>         if (ret) {
> -               amdgpu_bo_unreserve(rbo);
> +               amdgpu_bo_unreserve(abo);
>                 goto out_unref;
>         }
> -       ret = amdgpu_bo_kmap(rbo, NULL);
> -       amdgpu_bo_unreserve(rbo);
> +       ret = amdgpu_bo_kmap(abo, NULL);
> +       amdgpu_bo_unreserve(abo);
>         if (ret) {
>                 goto out_unref;
>         }
> @@ -201,7 +201,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
>         struct drm_framebuffer *fb = NULL;
>         struct drm_mode_fb_cmd2 mode_cmd;
>         struct drm_gem_object *gobj = NULL;
> -       struct amdgpu_bo *rbo = NULL;
> +       struct amdgpu_bo *abo = NULL;
>         int ret;
>         unsigned long tmp;
>
> @@ -220,7 +220,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
>                 return ret;
>         }
>
> -       rbo = gem_to_amdgpu_bo(gobj);
> +       abo = gem_to_amdgpu_bo(gobj);
>
>         /* okay we have an object now allocate the framebuffer */
>         info = drm_fb_helper_alloc_fbi(helper);
> @@ -243,7 +243,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
>         /* setup helper */
>         rfbdev->helper.fb = fb;
>
> -       memset_io(rbo->kptr, 0x0, amdgpu_bo_size(rbo));
> +       memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
>
>         strcpy(info->fix.id, "amdgpudrmfb");
>
> @@ -252,11 +252,11 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
>         info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
>         info->fbops = &amdgpufb_ops;
>
> -       tmp = amdgpu_bo_gpu_offset(rbo) - adev->mc.vram_start;
> +       tmp = amdgpu_bo_gpu_offset(abo) - adev->mc.vram_start;
>         info->fix.smem_start = adev->mc.aper_base + tmp;
> -       info->fix.smem_len = amdgpu_bo_size(rbo);
> -       info->screen_base = rbo->kptr;
> -       info->screen_size = amdgpu_bo_size(rbo);
> +       info->fix.smem_len = amdgpu_bo_size(abo);
> +       info->screen_base = abo->kptr;
> +       info->screen_size = amdgpu_bo_size(abo);
>
>         drm_fb_helper_fill_var(info, &rfbdev->helper, sizes->fb_width, sizes->fb_height);
>
> @@ -273,7 +273,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
>
>         DRM_INFO("fb mappable at 0x%lX\n",  info->fix.smem_start);
>         DRM_INFO("vram apper at 0x%lX\n",  (unsigned long)adev->mc.aper_base);
> -       DRM_INFO("size %lu\n", (unsigned long)amdgpu_bo_size(rbo));
> +       DRM_INFO("size %lu\n", (unsigned long)amdgpu_bo_size(abo));
>         DRM_INFO("fb depth is %d\n", fb->depth);
>         DRM_INFO("   pitch is %d\n", fb->pitches[0]);
>
> @@ -283,7 +283,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
>  out_destroy_fbi:
>         drm_fb_helper_release_fbi(helper);
>  out_unref:
> -       if (rbo) {
> +       if (abo) {
>
>         }
>         if (fb && ret) {
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index 480ae7e..6ae87e8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -120,23 +120,23 @@ void amdgpu_gem_force_release(struct amdgpu_device *adev)
>  int amdgpu_gem_object_open(struct drm_gem_object *obj,
>                            struct drm_file *file_priv)
>  {
> -       struct amdgpu_bo *rbo = gem_to_amdgpu_bo(obj);
> -       struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
> +       struct amdgpu_bo *abo = gem_to_amdgpu_bo(obj);
> +       struct amdgpu_device *adev = amdgpu_get_adev(abo->tbo.bdev);
>         struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
>         struct amdgpu_vm *vm = &fpriv->vm;
>         struct amdgpu_bo_va *bo_va;
>         int r;
> -       r = amdgpu_bo_reserve(rbo, false);
> +       r = amdgpu_bo_reserve(abo, false);
>         if (r)
>                 return r;
>
> -       bo_va = amdgpu_vm_bo_find(vm, rbo);
> +       bo_va = amdgpu_vm_bo_find(vm, abo);
>         if (!bo_va) {
> -               bo_va = amdgpu_vm_bo_add(adev, vm, rbo);
> +               bo_va = amdgpu_vm_bo_add(adev, vm, abo);
>         } else {
>                 ++bo_va->ref_count;
>         }
> -       amdgpu_bo_unreserve(rbo);
> +       amdgpu_bo_unreserve(abo);
>         return 0;
>  }
>
> @@ -552,7 +552,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
>         struct drm_gem_object *gobj;
>         struct amdgpu_device *adev = dev->dev_private;
>         struct amdgpu_fpriv *fpriv = filp->driver_priv;
> -       struct amdgpu_bo *rbo;
> +       struct amdgpu_bo *abo;
>         struct amdgpu_bo_va *bo_va;
>         struct ttm_validate_buffer tv, tv_pd;
>         struct ww_acquire_ctx ticket;
> @@ -592,10 +592,10 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
>         gobj = drm_gem_object_lookup(filp, args->handle);
>         if (gobj == NULL)
>                 return -ENOENT;
> -       rbo = gem_to_amdgpu_bo(gobj);
> +       abo = gem_to_amdgpu_bo(gobj);
>         INIT_LIST_HEAD(&list);
>         INIT_LIST_HEAD(&duplicates);
> -       tv.bo = &rbo->tbo;
> +       tv.bo = &abo->tbo;
>         tv.shared = true;
>         list_add(&tv.head, &list);
>
> @@ -609,7 +609,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
>                 return r;
>         }
>
> -       bo_va = amdgpu_vm_bo_find(&fpriv->vm, rbo);
> +       bo_va = amdgpu_vm_bo_find(&fpriv->vm, abo);
>         if (!bo_va) {
>                 ttm_eu_backoff_reservation(&ticket, &list);
>                 drm_gem_object_unreference_unlocked(gobj);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 5cbe803..c57d55d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -211,12 +211,12 @@ static void amdgpu_ttm_placement_init(struct amdgpu_device *adev,
>         placement->busy_placement = places;
>  }
>
> -void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *rbo, u32 domain)
> +void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *abo, u32 domain)
>  {
> -       struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
> +       struct amdgpu_device *adev = amdgpu_get_adev(abo->tbo.bdev);
>
> -       amdgpu_ttm_placement_init(adev, &rbo->placement, rbo->placements,
> -                                 domain, rbo->flags);
> +       amdgpu_ttm_placement_init(adev, &abo->placement, abo->placements,
> +                                 domain, abo->flags);
>  }
>
>  static void amdgpu_fill_placement_to_bo(struct amdgpu_bo *bo,
> @@ -864,14 +864,14 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
>                            struct ttm_mem_reg *new_mem)
>  {
>         struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
> -       struct amdgpu_bo *rbo;
> +       struct amdgpu_bo *abo;
>         struct ttm_mem_reg *old_mem = &bo->mem;
>
>         if (!amdgpu_ttm_bo_is_amdgpu_bo(bo))
>                 return;
>
> -       rbo = container_of(bo, struct amdgpu_bo, tbo);
> -       amdgpu_vm_bo_invalidate(adev, rbo);
> +       abo = container_of(bo, struct amdgpu_bo, tbo);
> +       amdgpu_vm_bo_invalidate(adev, abo);
>
>         /* update statistics */
>         if (!new_mem)
> @@ -880,7 +880,7 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
>         /* move_notify is called before move happens */
>         amdgpu_update_memory_usage(adev, &bo->mem, new_mem);
>
> -       trace_amdgpu_ttm_bo_move(rbo, new_mem->mem_type, old_mem->mem_type);
> +       trace_amdgpu_ttm_bo_move(abo, new_mem->mem_type, old_mem->mem_type);
>  }
>
>  int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index d246a1f..6d0ed39f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -186,7 +186,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
>                                 struct ttm_placement *placement)
>  {
>         struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
> -       struct amdgpu_bo *rbo;
> +       struct amdgpu_bo *abo;
>         static struct ttm_place placements = {
>                 .fpfn = 0,
>                 .lpfn = 0,
> @@ -201,45 +201,45 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
>                 placement->num_busy_placement = 1;
>                 return;
>         }
> -       rbo = container_of(bo, struct amdgpu_bo, tbo);
> +       abo = container_of(bo, struct amdgpu_bo, tbo);
>         switch (bo->mem.mem_type) {
>         case TTM_PL_VRAM:
>                 if (adev->mman.buffer_funcs_ring->ready == false) {
> -                       amdgpu_ttm_placement_from_domain(rbo,
> +                       amdgpu_ttm_placement_from_domain(abo,
>                                                          AMDGPU_GEM_DOMAIN_CPU);
>                 } else {
> -                       amdgpu_ttm_placement_from_domain(rbo,
> +                       amdgpu_ttm_placement_from_domain(abo,
>                                                          AMDGPU_GEM_DOMAIN_GTT);
> -                       for (i = 0; i < rbo->placement.num_placement; ++i) {
> -                               if (!(rbo->placements[i].flags &
> +                       for (i = 0; i < abo->placement.num_placement; ++i) {
> +                               if (!(abo->placements[i].flags &
>                                       TTM_PL_FLAG_TT))
>                                         continue;
>
> -                               if (rbo->placements[i].lpfn)
> +                               if (abo->placements[i].lpfn)
>                                         continue;
>
>                                 /* set an upper limit to force directly
>                                  * allocating address space for the BO.
>                                  */
> -                               rbo->placements[i].lpfn =
> +                               abo->placements[i].lpfn =
>                                         adev->mc.gtt_size >> PAGE_SHIFT;
>                         }
>                 }
>                 break;
>         case TTM_PL_TT:
>         default:
> -               amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_CPU);
> +               amdgpu_ttm_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_CPU);
>         }
> -       *placement = rbo->placement;
> +       *placement = abo->placement;
>  }
>
>  static int amdgpu_verify_access(struct ttm_buffer_object *bo, struct file *filp)
>  {
> -       struct amdgpu_bo *rbo = container_of(bo, struct amdgpu_bo, tbo);
> +       struct amdgpu_bo *abo = container_of(bo, struct amdgpu_bo, tbo);
>
>         if (amdgpu_ttm_tt_get_usermm(bo->ttm))
>                 return -EPERM;
> -       return drm_vma_node_verify_access(&rbo->gem_base.vma_node, filp);
> +       return drm_vma_node_verify_access(&abo->gem_base.vma_node, filp);
>  }
>
>  static void amdgpu_move_null(struct ttm_buffer_object *bo,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> index 87bcac3..d67eada 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> @@ -351,12 +351,12 @@ void amdgpu_uvd_free_handles(struct amdgpu_device *adev, struct drm_file *filp)
>         }
>  }
>
> -static void amdgpu_uvd_force_into_uvd_segment(struct amdgpu_bo *rbo)
> +static void amdgpu_uvd_force_into_uvd_segment(struct amdgpu_bo *abo)
>  {
>         int i;
> -       for (i = 0; i < rbo->placement.num_placement; ++i) {
> -               rbo->placements[i].fpfn = 0 >> PAGE_SHIFT;
> -               rbo->placements[i].lpfn = (256 * 1024 * 1024) >> PAGE_SHIFT;
> +       for (i = 0; i < abo->placement.num_placement; ++i) {
> +               abo->placements[i].fpfn = 0 >> PAGE_SHIFT;
> +               abo->placements[i].lpfn = (256 * 1024 * 1024) >> PAGE_SHIFT;
>         }
>  }
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index 2af166e..5af418f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -2102,7 +2102,7 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
>         struct amdgpu_framebuffer *amdgpu_fb;
>         struct drm_framebuffer *target_fb;
>         struct drm_gem_object *obj;
> -       struct amdgpu_bo *rbo;
> +       struct amdgpu_bo *abo;
>         uint64_t fb_location, tiling_flags;
>         uint32_t fb_format, fb_pitch_pixels;
>         u32 fb_swap = REG_SET_FIELD(0, GRPH_SWAP_CNTL, GRPH_ENDIAN_SWAP, ENDIAN_NONE);
> @@ -2129,23 +2129,23 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
>          * just update base pointers
>          */
>         obj = amdgpu_fb->obj;
> -       rbo = gem_to_amdgpu_bo(obj);
> -       r = amdgpu_bo_reserve(rbo, false);
> +       abo = gem_to_amdgpu_bo(obj);
> +       r = amdgpu_bo_reserve(abo, false);
>         if (unlikely(r != 0))
>                 return r;
>
>         if (atomic) {
> -               fb_location = amdgpu_bo_gpu_offset(rbo);
> +               fb_location = amdgpu_bo_gpu_offset(abo);
>         } else {
> -               r = amdgpu_bo_pin(rbo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
> +               r = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
>                 if (unlikely(r != 0)) {
> -                       amdgpu_bo_unreserve(rbo);
> +                       amdgpu_bo_unreserve(abo);
>                         return -EINVAL;
>                 }
>         }
>
> -       amdgpu_bo_get_tiling_flags(rbo, &tiling_flags);
> -       amdgpu_bo_unreserve(rbo);
> +       amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
> +       amdgpu_bo_unreserve(abo);
>
>         pipe_config = AMDGPU_TILING_GET(tiling_flags, PIPE_CONFIG);
>
> @@ -2319,12 +2319,12 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc,
>
>         if (!atomic && fb && fb != crtc->primary->fb) {
>                 amdgpu_fb = to_amdgpu_framebuffer(fb);
> -               rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
> -               r = amdgpu_bo_reserve(rbo, false);
> +               abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
> +               r = amdgpu_bo_reserve(abo, false);
>                 if (unlikely(r != 0))
>                         return r;
> -               amdgpu_bo_unpin(rbo);
> -               amdgpu_bo_unreserve(rbo);
> +               amdgpu_bo_unpin(abo);
> +               amdgpu_bo_unreserve(abo);
>         }
>
>         /* Bytes per pixel may have changed */
> @@ -2802,16 +2802,16 @@ static void dce_v10_0_crtc_disable(struct drm_crtc *crtc)
>         if (crtc->primary->fb) {
>                 int r;
>                 struct amdgpu_framebuffer *amdgpu_fb;
> -               struct amdgpu_bo *rbo;
> +               struct amdgpu_bo *abo;
>
>                 amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
> -               rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
> -               r = amdgpu_bo_reserve(rbo, false);
> +               abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
> +               r = amdgpu_bo_reserve(abo, false);
>                 if (unlikely(r))
> -                       DRM_ERROR("failed to reserve rbo before unpin\n");
> +                       DRM_ERROR("failed to reserve abo before unpin\n");
>                 else {
> -                       amdgpu_bo_unpin(rbo);
> -                       amdgpu_bo_unreserve(rbo);
> +                       amdgpu_bo_unpin(abo);
> +                       amdgpu_bo_unreserve(abo);
>                 }
>         }
>         /* disable the GRPH */
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> index 6747f8f..256de46 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
> @@ -2085,7 +2085,7 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
>         struct amdgpu_framebuffer *amdgpu_fb;
>         struct drm_framebuffer *target_fb;
>         struct drm_gem_object *obj;
> -       struct amdgpu_bo *rbo;
> +       struct amdgpu_bo *abo;
>         uint64_t fb_location, tiling_flags;
>         uint32_t fb_format, fb_pitch_pixels;
>         u32 fb_swap = REG_SET_FIELD(0, GRPH_SWAP_CNTL, GRPH_ENDIAN_SWAP, ENDIAN_NONE);
> @@ -2112,23 +2112,23 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
>          * just update base pointers
>          */
>         obj = amdgpu_fb->obj;
> -       rbo = gem_to_amdgpu_bo(obj);
> -       r = amdgpu_bo_reserve(rbo, false);
> +       abo = gem_to_amdgpu_bo(obj);
> +       r = amdgpu_bo_reserve(abo, false);
>         if (unlikely(r != 0))
>                 return r;
>
>         if (atomic) {
> -               fb_location = amdgpu_bo_gpu_offset(rbo);
> +               fb_location = amdgpu_bo_gpu_offset(abo);
>         } else {
> -               r = amdgpu_bo_pin(rbo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
> +               r = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
>                 if (unlikely(r != 0)) {
> -                       amdgpu_bo_unreserve(rbo);
> +                       amdgpu_bo_unreserve(abo);
>                         return -EINVAL;
>                 }
>         }
>
> -       amdgpu_bo_get_tiling_flags(rbo, &tiling_flags);
> -       amdgpu_bo_unreserve(rbo);
> +       amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
> +       amdgpu_bo_unreserve(abo);
>
>         pipe_config = AMDGPU_TILING_GET(tiling_flags, PIPE_CONFIG);
>
> @@ -2302,12 +2302,12 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc,
>
>         if (!atomic && fb && fb != crtc->primary->fb) {
>                 amdgpu_fb = to_amdgpu_framebuffer(fb);
> -               rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
> -               r = amdgpu_bo_reserve(rbo, false);
> +               abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
> +               r = amdgpu_bo_reserve(abo, false);
>                 if (unlikely(r != 0))
>                         return r;
> -               amdgpu_bo_unpin(rbo);
> -               amdgpu_bo_unreserve(rbo);
> +               amdgpu_bo_unpin(abo);
> +               amdgpu_bo_unreserve(abo);
>         }
>
>         /* Bytes per pixel may have changed */
> @@ -2820,16 +2820,16 @@ static void dce_v11_0_crtc_disable(struct drm_crtc *crtc)
>         if (crtc->primary->fb) {
>                 int r;
>                 struct amdgpu_framebuffer *amdgpu_fb;
> -               struct amdgpu_bo *rbo;
> +               struct amdgpu_bo *abo;
>
>                 amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
> -               rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
> -               r = amdgpu_bo_reserve(rbo, false);
> +               abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
> +               r = amdgpu_bo_reserve(abo, false);
>                 if (unlikely(r))
> -                       DRM_ERROR("failed to reserve rbo before unpin\n");
> +                       DRM_ERROR("failed to reserve abo before unpin\n");
>                 else {
> -                       amdgpu_bo_unpin(rbo);
> -                       amdgpu_bo_unreserve(rbo);
> +                       amdgpu_bo_unpin(abo);
> +                       amdgpu_bo_unreserve(abo);
>                 }
>         }
>         /* disable the GRPH */
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index 0a807d2..0a1db00 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -1493,7 +1493,7 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,
>         struct amdgpu_framebuffer *amdgpu_fb;
>         struct drm_framebuffer *target_fb;
>         struct drm_gem_object *obj;
> -       struct amdgpu_bo *rbo;
> +       struct amdgpu_bo *abo;
>         uint64_t fb_location, tiling_flags;
>         uint32_t fb_format, fb_pitch_pixels, pipe_config;
>         u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE);
> @@ -1520,23 +1520,23 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,
>          * just update base pointers
>          */
>         obj = amdgpu_fb->obj;
> -       rbo = gem_to_amdgpu_bo(obj);
> -       r = amdgpu_bo_reserve(rbo, false);
> +       abo = gem_to_amdgpu_bo(obj);
> +       r = amdgpu_bo_reserve(abo, false);
>         if (unlikely(r != 0))
>                 return r;
>
>         if (atomic)
> -               fb_location = amdgpu_bo_gpu_offset(rbo);
> +               fb_location = amdgpu_bo_gpu_offset(abo);
>         else {
> -               r = amdgpu_bo_pin(rbo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
> +               r = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
>                 if (unlikely(r != 0)) {
> -                       amdgpu_bo_unreserve(rbo);
> +                       amdgpu_bo_unreserve(abo);
>                         return -EINVAL;
>                 }
>         }
>
> -       amdgpu_bo_get_tiling_flags(rbo, &tiling_flags);
> -       amdgpu_bo_unreserve(rbo);
> +       amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
> +       amdgpu_bo_unreserve(abo);
>
>         switch (target_fb->pixel_format) {
>         case DRM_FORMAT_C8:
> @@ -1688,12 +1688,12 @@ static int dce_v6_0_crtc_do_set_base(struct drm_crtc *crtc,
>
>         if (!atomic && fb && fb != crtc->primary->fb) {
>                 amdgpu_fb = to_amdgpu_framebuffer(fb);
> -               rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
> -               r = amdgpu_bo_reserve(rbo, false);
> +               abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
> +               r = amdgpu_bo_reserve(abo, false);
>                 if (unlikely(r != 0))
>                         return r;
> -               amdgpu_bo_unpin(rbo);
> -               amdgpu_bo_unreserve(rbo);
> +               amdgpu_bo_unpin(abo);
> +               amdgpu_bo_unreserve(abo);
>         }
>
>         /* Bytes per pixel may have changed */
> @@ -2139,16 +2139,16 @@ static void dce_v6_0_crtc_disable(struct drm_crtc *crtc)
>         if (crtc->primary->fb) {
>                 int r;
>                 struct amdgpu_framebuffer *amdgpu_fb;
> -               struct amdgpu_bo *rbo;
> +               struct amdgpu_bo *abo;
>
>                 amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
> -               rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
> -               r = amdgpu_bo_reserve(rbo, false);
> +               abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
> +               r = amdgpu_bo_reserve(abo, false);
>                 if (unlikely(r))
> -                       DRM_ERROR("failed to reserve rbo before unpin\n");
> +                       DRM_ERROR("failed to reserve abo before unpin\n");
>                 else {
> -                       amdgpu_bo_unpin(rbo);
> -                       amdgpu_bo_unreserve(rbo);
> +                       amdgpu_bo_unpin(abo);
> +                       amdgpu_bo_unreserve(abo);
>                 }
>         }
>         /* disable the GRPH */
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index 06d836f..4d313aa 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -1990,7 +1990,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
>         struct amdgpu_framebuffer *amdgpu_fb;
>         struct drm_framebuffer *target_fb;
>         struct drm_gem_object *obj;
> -       struct amdgpu_bo *rbo;
> +       struct amdgpu_bo *abo;
>         uint64_t fb_location, tiling_flags;
>         uint32_t fb_format, fb_pitch_pixels;
>         u32 fb_swap = (GRPH_ENDIAN_NONE << GRPH_SWAP_CNTL__GRPH_ENDIAN_SWAP__SHIFT);
> @@ -2017,23 +2017,23 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
>          * just update base pointers
>          */
>         obj = amdgpu_fb->obj;
> -       rbo = gem_to_amdgpu_bo(obj);
> -       r = amdgpu_bo_reserve(rbo, false);
> +       abo = gem_to_amdgpu_bo(obj);
> +       r = amdgpu_bo_reserve(abo, false);
>         if (unlikely(r != 0))
>                 return r;
>
>         if (atomic) {
> -               fb_location = amdgpu_bo_gpu_offset(rbo);
> +               fb_location = amdgpu_bo_gpu_offset(abo);
>         } else {
> -               r = amdgpu_bo_pin(rbo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
> +               r = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM, &fb_location);
>                 if (unlikely(r != 0)) {
> -                       amdgpu_bo_unreserve(rbo);
> +                       amdgpu_bo_unreserve(abo);
>                         return -EINVAL;
>                 }
>         }
>
> -       amdgpu_bo_get_tiling_flags(rbo, &tiling_flags);
> -       amdgpu_bo_unreserve(rbo);
> +       amdgpu_bo_get_tiling_flags(abo, &tiling_flags);
> +       amdgpu_bo_unreserve(abo);
>
>         pipe_config = AMDGPU_TILING_GET(tiling_flags, PIPE_CONFIG);
>
> @@ -2188,12 +2188,12 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc,
>
>         if (!atomic && fb && fb != crtc->primary->fb) {
>                 amdgpu_fb = to_amdgpu_framebuffer(fb);
> -               rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
> -               r = amdgpu_bo_reserve(rbo, false);
> +               abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
> +               r = amdgpu_bo_reserve(abo, false);
>                 if (unlikely(r != 0))
>                         return r;
> -               amdgpu_bo_unpin(rbo);
> -               amdgpu_bo_unreserve(rbo);
> +               amdgpu_bo_unpin(abo);
> +               amdgpu_bo_unreserve(abo);
>         }
>
>         /* Bytes per pixel may have changed */
> @@ -2663,16 +2663,16 @@ static void dce_v8_0_crtc_disable(struct drm_crtc *crtc)
>         if (crtc->primary->fb) {
>                 int r;
>                 struct amdgpu_framebuffer *amdgpu_fb;
> -               struct amdgpu_bo *rbo;
> +               struct amdgpu_bo *abo;
>
>                 amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
> -               rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
> -               r = amdgpu_bo_reserve(rbo, false);
> +               abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
> +               r = amdgpu_bo_reserve(abo, false);
>                 if (unlikely(r))
> -                       DRM_ERROR("failed to reserve rbo before unpin\n");
> +                       DRM_ERROR("failed to reserve abo before unpin\n");
>                 else {
> -                       amdgpu_bo_unpin(rbo);
> -                       amdgpu_bo_unreserve(rbo);
> +                       amdgpu_bo_unpin(abo);
> +                       amdgpu_bo_unreserve(abo);
>                 }
>         }
>         /* disable the GRPH */
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> index 85f14a6..c93e18e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
> @@ -227,16 +227,16 @@ static void dce_virtual_crtc_disable(struct drm_crtc *crtc)
>         if (crtc->primary->fb) {
>                 int r;
>                 struct amdgpu_framebuffer *amdgpu_fb;
> -               struct amdgpu_bo *rbo;
> +               struct amdgpu_bo *abo;
>
>                 amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb);
> -               rbo = gem_to_amdgpu_bo(amdgpu_fb->obj);
> -               r = amdgpu_bo_reserve(rbo, false);
> +               abo = gem_to_amdgpu_bo(amdgpu_fb->obj);
> +               r = amdgpu_bo_reserve(abo, false);
>                 if (unlikely(r))
> -                       DRM_ERROR("failed to reserve rbo before unpin\n");
> +                       DRM_ERROR("failed to reserve abo before unpin\n");
>                 else {
> -                       amdgpu_bo_unpin(rbo);
> -                       amdgpu_bo_unreserve(rbo);
> +                       amdgpu_bo_unpin(abo);
> +                       amdgpu_bo_unreserve(abo);
>                 }
>         }
>
> --
> 2.5.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/5] drm/amdgpu: fix a bunch of coding style issues in amdgpu_ttm.c
       [not found]     ` <1473945024-8275-2-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
@ 2016-09-15 18:25       ` Alex Deucher
  2016-09-16  2:17       ` Michel Dänzer
  1 sibling, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2016-09-15 18:25 UTC (permalink / raw)
  To: Christian König; +Cc: amd-gfx list

On Thu, Sep 15, 2016 at 9:10 AM, Christian König
<deathsimple@vodafone.de> wrote:
> From: Christian König <christian.koenig@amd.com>
>
> No intented functional change.

"intended"

In general, with respect to the white space changes, I think the code
is more readable as is, but I don't have a strong opinion either way,
if you prefer this.  One additional comment below.

>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 65 +++++++++++++++++++++------------
>  1 file changed, 42 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 428ffb6..1965209 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -214,9 +214,11 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
>         switch (bo->mem.mem_type) {
>         case TTM_PL_VRAM:
>                 if (rbo->adev->mman.buffer_funcs_ring->ready == false) {
> -                       amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_CPU);
> +                       amdgpu_ttm_placement_from_domain(rbo,
> +                                                        AMDGPU_GEM_DOMAIN_CPU);
>                 } else {
> -                       amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_GTT);
> +                       amdgpu_ttm_placement_from_domain(rbo,
> +                                                        AMDGPU_GEM_DOMAIN_GTT);
>                         for (i = 0; i < rbo->placement.num_placement; ++i) {
>                                 if (!(rbo->placements[i].flags &
>                                       TTM_PL_FLAG_TT))
> @@ -524,7 +526,8 @@ memcpy:
>         return 0;
>  }
>
> -static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
> +static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
> +                                    struct ttm_mem_reg *mem)
>  {
>         struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type];
>         struct amdgpu_device *adev = amdgpu_get_adev(bdev);
> @@ -545,7 +548,8 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
>         case TTM_PL_VRAM:
>                 mem->bus.offset = mem->start << PAGE_SHIFT;
>                 /* check if it's visible */
> -               if ((mem->bus.offset + mem->bus.size) > adev->mc.visible_vram_size)
> +               if ((mem->bus.offset + mem->bus.size) >
> +                   adev->mc.visible_vram_size)
>                         return -EINVAL;
>                 mem->bus.base = adev->mc.aper_base;
>                 mem->bus.is_iomem = true;
> @@ -579,7 +583,8 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
>         return 0;
>  }
>
> -static void amdgpu_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
> +static void amdgpu_ttm_io_mem_free(struct ttm_bo_device *bdev,
> +                                  struct ttm_mem_reg *mem)
>  {
>  }
>
> @@ -791,7 +796,8 @@ int amdgpu_ttm_recover_gart(struct amdgpu_device *adev)
>         bo_mem.mem_type = TTM_PL_TT;
>         spin_lock(&adev->gtt_list_lock);
>         list_for_each_entry_safe(gtt, tmp, &adev->gtt_list, list) {
> -               flags = amdgpu_ttm_tt_pte_flags(gtt->adev, &gtt->ttm.ttm, &bo_mem);
> +               flags = amdgpu_ttm_tt_pte_flags(gtt->adev, &gtt->ttm.ttm,
> +                                               &bo_mem);
>                 r = amdgpu_gart_bind(adev, gtt->offset, gtt->ttm.ttm.num_pages,
>                                      gtt->ttm.ttm.pages, gtt->ttm.dma_address,
>                                      flags);
> @@ -856,7 +862,8 @@ static struct ttm_tt *amdgpu_ttm_tt_create(struct ttm_bo_device *bdev,
>         }
>         gtt->ttm.ttm.func = &amdgpu_backend_func;
>         gtt->adev = adev;
> -       if (ttm_dma_tt_init(&gtt->ttm, bdev, size, page_flags, dummy_read_page)) {
> +       if (ttm_dma_tt_init(&gtt->ttm, bdev, size, page_flags,
> +                           dummy_read_page)) {
>                 kfree(gtt);
>                 return NULL;
>         }
> @@ -887,7 +894,8 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
>
>         if (slave && ttm->sg) {
>                 drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
> -                                                gtt->ttm.dma_address, ttm->num_pages);
> +                                                gtt->ttm.dma_address,
> +                                                ttm->num_pages);
>                 ttm->state = tt_unbound;
>                 return 0;
>         }
> @@ -906,13 +914,17 @@ static int amdgpu_ttm_tt_populate(struct ttm_tt *ttm)
>         }
>
>         for (i = 0; i < ttm->num_pages; i++) {
> -               gtt->ttm.dma_address[i] = pci_map_page(adev->pdev, ttm->pages[i],
> +               gtt->ttm.dma_address[i] = pci_map_page(adev->pdev,
> +                                                      ttm->pages[i],
>                                                        0, PAGE_SIZE,
>                                                        PCI_DMA_BIDIRECTIONAL);
> -               if (pci_dma_mapping_error(adev->pdev, gtt->ttm.dma_address[i])) {
> +               if (pci_dma_mapping_error(adev->pdev,
> +                                         gtt->ttm.dma_address[i])) {
>                         while (i--) {
> -                               pci_unmap_page(adev->pdev, gtt->ttm.dma_address[i],
> -                                              PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
> +                               pci_unmap_page(adev->pdev,
> +                                              gtt->ttm.dma_address[i],
> +                                              PAGE_SIZE,
> +                                              PCI_DMA_BIDIRECTIONAL);
>                                 gtt->ttm.dma_address[i] = 0;
>                         }
>                         ttm_pool_unpopulate(ttm);
> @@ -1195,14 +1207,20 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
>                  (unsigned)(adev->mc.gtt_size / (1024 * 1024)));
>
>         adev->gds.mem.total_size = adev->gds.mem.total_size << AMDGPU_GDS_SHIFT;
> -       adev->gds.mem.gfx_partition_size = adev->gds.mem.gfx_partition_size << AMDGPU_GDS_SHIFT;
> -       adev->gds.mem.cs_partition_size = adev->gds.mem.cs_partition_size << AMDGPU_GDS_SHIFT;
> +       adev->gds.mem.gfx_partition_size =
> +               adev->gds.mem.gfx_partition_size << AMDGPU_GDS_SHIFT;
> +       adev->gds.mem.cs_partition_size =
> +               adev->gds.mem.cs_partition_size << AMDGPU_GDS_SHIFT;
>         adev->gds.gws.total_size = adev->gds.gws.total_size << AMDGPU_GWS_SHIFT;
> -       adev->gds.gws.gfx_partition_size = adev->gds.gws.gfx_partition_size << AMDGPU_GWS_SHIFT;
> -       adev->gds.gws.cs_partition_size = adev->gds.gws.cs_partition_size << AMDGPU_GWS_SHIFT;
> +       adev->gds.gws.gfx_partition_size =
> +               adev->gds.gws.gfx_partition_size << AMDGPU_GWS_SHIFT;
> +       adev->gds.gws.cs_partition_size =
> +               adev->gds.gws.cs_partition_size << AMDGPU_GWS_SHIFT;
>         adev->gds.oa.total_size = adev->gds.oa.total_size << AMDGPU_OA_SHIFT;
> -       adev->gds.oa.gfx_partition_size = adev->gds.oa.gfx_partition_size << AMDGPU_OA_SHIFT;
> -       adev->gds.oa.cs_partition_size = adev->gds.oa.cs_partition_size << AMDGPU_OA_SHIFT;
> +       adev->gds.oa.gfx_partition_size =
> +               adev->gds.oa.gfx_partition_size << AMDGPU_OA_SHIFT;
> +       adev->gds.oa.cs_partition_size =
> +               adev->gds.oa.cs_partition_size << AMDGPU_OA_SHIFT;
>         /* GDS Memory */
>         r = ttm_bo_init_mm(&adev->mman.bdev, AMDGPU_PL_GDS,
>                                 adev->gds.mem.total_size >> PAGE_SHIFT);
> @@ -1362,10 +1380,9 @@ error_free:
>         return r;
>  }
>
> -int amdgpu_fill_buffer(struct amdgpu_bo *bo,
> -               uint32_t src_data,
> -               struct reservation_object *resv,
> -               struct fence **fence)
> +int amdgpu_fill_buffer(struct amdgpu_bo *bo, uint32_t src_data,
> +                      struct reservation_object *resv,
> +                      struct fence **fence)
>  {
>         struct amdgpu_device *adev = bo->adev;
>         struct amdgpu_job *job;
> @@ -1607,5 +1624,7 @@ static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev)
>
>  u64 amdgpu_ttm_get_gtt_mem_size(struct amdgpu_device *adev)
>  {
> -       return ttm_get_kernel_zone_memory_size(adev->mman.mem_global_ref.object);
> +       struct ttm_mem_global *glob = adev->mman.mem_global_ref.object;
> +
> +       return ttm_get_kernel_zone_memory_size(glob);


Was this change intended?  There were just a bunch of patches applied
that did the opposite.

Alex

>  }
> --
> 2.5.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/5] drm/amdgpu: fix a bunch of coding style issues in amdgpu_gem.c
       [not found]     ` <1473945024-8275-3-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
@ 2016-09-15 18:27       ` Alex Deucher
  0 siblings, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2016-09-15 18:27 UTC (permalink / raw)
  To: Christian König; +Cc: amd-gfx list

On Thu, Sep 15, 2016 at 9:10 AM, Christian König
<deathsimple@vodafone.de> wrote:
> From: Christian König <christian.koenig@amd.com>
>
> No intented functional change.
>

"intended"

In general, with respect to the white space changes, I think the code
is more readable as is, but I don't have a strong opinion either way,
if you prefer this.

> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index 88fbed2..70e294b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -58,7 +58,8 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
>                 alignment = PAGE_SIZE;
>         }
>
> -       if (!(initial_domain & (AMDGPU_GEM_DOMAIN_GDS | AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA))) {
> +       if (!(initial_domain & (AMDGPU_GEM_DOMAIN_GDS | AMDGPU_GEM_DOMAIN_GWS |
> +                               AMDGPU_GEM_DOMAIN_OA))) {
>                 /* Maximum bo size is the unpinned gtt size since we use the gtt to
>                  * handle vram to system pool migrations.
>                  */
> @@ -116,7 +117,8 @@ void amdgpu_gem_force_release(struct amdgpu_device *adev)
>   * Call from drm_gem_handle_create which appear in both new and open ioctl
>   * case.
>   */
> -int amdgpu_gem_object_open(struct drm_gem_object *obj, struct drm_file *file_priv)
> +int amdgpu_gem_object_open(struct drm_gem_object *obj,
> +                          struct drm_file *file_priv)
>  {
>         struct amdgpu_bo *rbo = gem_to_amdgpu_bo(obj);
>         struct amdgpu_device *adev = rbo->adev;
> @@ -408,9 +410,11 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
>         }
>         robj = gem_to_amdgpu_bo(gobj);
>         if (timeout == 0)
> -               ret = reservation_object_test_signaled_rcu(robj->tbo.resv, true);
> +               ret = reservation_object_test_signaled_rcu(robj->tbo.resv,
> +                                                          true);
>         else
> -               ret = reservation_object_wait_timeout_rcu(robj->tbo.resv, true, true, timeout);
> +               ret = reservation_object_wait_timeout_rcu(robj->tbo.resv, true,
> +                                                         true, timeout);
>
>         /* ret == 0 means not signaled,
>          * ret > 0 means signaled
> @@ -480,7 +484,8 @@ out:
>   * vital here, so they are not reported back to userspace.
>   */
>  static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
> -                                   struct amdgpu_bo_va *bo_va, uint32_t operation)
> +                                   struct amdgpu_bo_va *bo_va,
> +                                   uint32_t operation)
>  {
>         struct ttm_validate_buffer tv, *entry;
>         struct amdgpu_bo_list_entry vm_pd;
> @@ -704,7 +709,8 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
>         uint32_t handle;
>         int r;
>
> -       args->pitch = amdgpu_align_pitch(adev, args->width, args->bpp, 0) * ((args->bpp + 1) / 8);
> +       args->pitch = amdgpu_align_pitch(adev, args->width, args->bpp, 0) *
> +               ((args->bpp + 1) / 8);
>         args->size = (u64)args->pitch * args->height;
>         args->size = ALIGN(args->size, PAGE_SIZE);
>
> --
> 2.5.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] drm/amdgpu: remove adev pointer from struct amdgpu_bo
       [not found]     ` <1473945024-8275-4-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
@ 2016-09-15 18:30       ` Alex Deucher
       [not found]         ` <CADnq5_M4VrN-N=Fh2kvZpedqTRVkxePjDBCySk9icaD77R87ag-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Alex Deucher @ 2016-09-15 18:30 UTC (permalink / raw)
  To: Christian König; +Cc: amd-gfx list

On Thu, Sep 15, 2016 at 9:10 AM, Christian König
<deathsimple@vodafone.de> wrote:
> From: Christian König <christian.koenig@amd.com>
>
> It's completely pointsless to have two pointers to the
> device in the same structur.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  6 +++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c     | 10 +++---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c    |  4 +--
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c     |  4 +--
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 50 ++++++++++++++++--------------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.h |  3 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 17 +++-------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c    |  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c     |  2 +-
>  9 files changed, 50 insertions(+), 48 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 3b3981d..ed91f08 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -465,7 +465,6 @@ struct amdgpu_bo {
>          */
>         struct list_head                va;
>         /* Constant after initialization */
> -       struct amdgpu_device            *adev;
>         struct drm_gem_object           gem_base;
>         struct amdgpu_bo                *parent;
>         struct amdgpu_bo                *shadow;
> @@ -2144,6 +2143,11 @@ struct amdgpu_device {
>
>  };
>
> +static inline struct amdgpu_device *amdgpu_get_adev(struct ttm_bo_device *bdev)
> +{
> +       return container_of(bdev, struct amdgpu_device, mman.bdev);
> +}

Maybe call this amdgpu_ttm_get_adev() to make it clear to to get the
adev from a ttm bo device?

Alex

> +
>  bool amdgpu_device_is_px(struct drm_device *dev);
>  int amdgpu_device_init(struct amdgpu_device *adev,
>                        struct drm_device *ddev,
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 187c366..5beab71 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -355,6 +355,7 @@ static void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev,
>  static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
>                                  struct amdgpu_bo *bo)
>  {
> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>         u64 initial_bytes_moved;
>         uint32_t domain;
>         int r;
> @@ -372,9 +373,9 @@ static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
>
>  retry:
>         amdgpu_ttm_placement_from_domain(bo, domain);
> -       initial_bytes_moved = atomic64_read(&bo->adev->num_bytes_moved);
> +       initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
>         r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);
> -       p->bytes_moved += atomic64_read(&bo->adev->num_bytes_moved) -
> +       p->bytes_moved += atomic64_read(&adev->num_bytes_moved) -
>                 initial_bytes_moved;
>
>         if (unlikely(r == -ENOMEM) && domain != bo->allowed_domains) {
> @@ -400,6 +401,7 @@ static bool amdgpu_cs_try_evict(struct amdgpu_cs_parser *p,
>
>                 struct amdgpu_bo_list_entry *candidate = p->evictable;
>                 struct amdgpu_bo *bo = candidate->robj;
> +               struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>                 u64 initial_bytes_moved;
>                 uint32_t other;
>
> @@ -420,9 +422,9 @@ static bool amdgpu_cs_try_evict(struct amdgpu_cs_parser *p,
>
>                 /* Good we can try to move this BO somewhere else */
>                 amdgpu_ttm_placement_from_domain(bo, other);
> -               initial_bytes_moved = atomic64_read(&bo->adev->num_bytes_moved);
> +               initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
>                 r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);
> -               p->bytes_moved += atomic64_read(&bo->adev->num_bytes_moved) -
> +               p->bytes_moved += atomic64_read(&adev->num_bytes_moved) -
>                         initial_bytes_moved;
>
>                 if (unlikely(r))
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index 70e294b..480ae7e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -121,7 +121,7 @@ int amdgpu_gem_object_open(struct drm_gem_object *obj,
>                            struct drm_file *file_priv)
>  {
>         struct amdgpu_bo *rbo = gem_to_amdgpu_bo(obj);
> -       struct amdgpu_device *adev = rbo->adev;
> +       struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
>         struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
>         struct amdgpu_vm *vm = &fpriv->vm;
>         struct amdgpu_bo_va *bo_va;
> @@ -144,7 +144,7 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj,
>                              struct drm_file *file_priv)
>  {
>         struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
> -       struct amdgpu_device *adev = bo->adev;
> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>         struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
>         struct amdgpu_vm *vm = &fpriv->vm;
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
> index 32fa7b7..4731231 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
> @@ -285,7 +285,7 @@ free_rmn:
>  int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
>  {
>         unsigned long end = addr + amdgpu_bo_size(bo) - 1;
> -       struct amdgpu_device *adev = bo->adev;
> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>         struct amdgpu_mn *rmn;
>         struct amdgpu_mn_node *node = NULL;
>         struct list_head bos;
> @@ -340,7 +340,7 @@ int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
>   */
>  void amdgpu_mn_unregister(struct amdgpu_bo *bo)
>  {
> -       struct amdgpu_device *adev = bo->adev;
> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>         struct amdgpu_mn *rmn;
>         struct list_head *head;
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 4289c31..5cbe803 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -90,18 +90,19 @@ static void amdgpu_update_memory_usage(struct amdgpu_device *adev,
>
>  static void amdgpu_ttm_bo_destroy(struct ttm_buffer_object *tbo)
>  {
> +       struct amdgpu_device *adev = amdgpu_get_adev(tbo->bdev);
>         struct amdgpu_bo *bo;
>
>         bo = container_of(tbo, struct amdgpu_bo, tbo);
>
> -       amdgpu_update_memory_usage(bo->adev, &bo->tbo.mem, NULL);
> +       amdgpu_update_memory_usage(adev, &bo->tbo.mem, NULL);
>
>         drm_gem_object_release(&bo->gem_base);
>         amdgpu_bo_unref(&bo->parent);
>         if (!list_empty(&bo->shadow_list)) {
> -               mutex_lock(&bo->adev->shadow_list_lock);
> +               mutex_lock(&adev->shadow_list_lock);
>                 list_del_init(&bo->shadow_list);
> -               mutex_unlock(&bo->adev->shadow_list_lock);
> +               mutex_unlock(&adev->shadow_list_lock);
>         }
>         kfree(bo->metadata);
>         kfree(bo);
> @@ -212,8 +213,10 @@ static void amdgpu_ttm_placement_init(struct amdgpu_device *adev,
>
>  void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *rbo, u32 domain)
>  {
> -       amdgpu_ttm_placement_init(rbo->adev, &rbo->placement,
> -                                 rbo->placements, domain, rbo->flags);
> +       struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
> +
> +       amdgpu_ttm_placement_init(adev, &rbo->placement, rbo->placements,
> +                                 domain, rbo->flags);
>  }
>
>  static void amdgpu_fill_placement_to_bo(struct amdgpu_bo *bo,
> @@ -359,7 +362,6 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
>                 kfree(bo);
>                 return r;
>         }
> -       bo->adev = adev;
>         INIT_LIST_HEAD(&bo->shadow_list);
>         INIT_LIST_HEAD(&bo->va);
>         bo->prefered_domains = domain & (AMDGPU_GEM_DOMAIN_VRAM |
> @@ -624,6 +626,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>                              u64 min_offset, u64 max_offset,
>                              u64 *gpu_addr)
>  {
> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>         int r, i;
>         unsigned fpfn, lpfn;
>
> @@ -659,12 +662,12 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>                 if ((bo->placements[i].flags & TTM_PL_FLAG_VRAM) &&
>                     !(bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) &&
>                     (!max_offset || max_offset >
> -                    bo->adev->mc.visible_vram_size)) {
> +                    adev->mc.visible_vram_size)) {
>                         if (WARN_ON_ONCE(min_offset >
> -                                        bo->adev->mc.visible_vram_size))
> +                                        adev->mc.visible_vram_size))
>                                 return -EINVAL;
>                         fpfn = min_offset >> PAGE_SHIFT;
> -                       lpfn = bo->adev->mc.visible_vram_size >> PAGE_SHIFT;
> +                       lpfn = adev->mc.visible_vram_size >> PAGE_SHIFT;
>                 } else {
>                         fpfn = min_offset >> PAGE_SHIFT;
>                         lpfn = max_offset >> PAGE_SHIFT;
> @@ -679,12 +682,12 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>
>         r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
>         if (unlikely(r)) {
> -               dev_err(bo->adev->dev, "%p pin failed\n", bo);
> +               dev_err(adev->dev, "%p pin failed\n", bo);
>                 goto error;
>         }
>         r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
>         if (unlikely(r)) {
> -               dev_err(bo->adev->dev, "%p bind failed\n", bo);
> +               dev_err(adev->dev, "%p bind failed\n", bo);
>                 goto error;
>         }
>
> @@ -692,11 +695,11 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>         if (gpu_addr != NULL)
>                 *gpu_addr = amdgpu_bo_gpu_offset(bo);
>         if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
> -               bo->adev->vram_pin_size += amdgpu_bo_size(bo);
> +               adev->vram_pin_size += amdgpu_bo_size(bo);
>                 if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
> -                       bo->adev->invisible_pin_size += amdgpu_bo_size(bo);
> +                       adev->invisible_pin_size += amdgpu_bo_size(bo);
>         } else if (domain == AMDGPU_GEM_DOMAIN_GTT) {
> -               bo->adev->gart_pin_size += amdgpu_bo_size(bo);
> +               adev->gart_pin_size += amdgpu_bo_size(bo);
>         }
>
>  error:
> @@ -710,10 +713,11 @@ int amdgpu_bo_pin(struct amdgpu_bo *bo, u32 domain, u64 *gpu_addr)
>
>  int amdgpu_bo_unpin(struct amdgpu_bo *bo)
>  {
> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>         int r, i;
>
>         if (!bo->pin_count) {
> -               dev_warn(bo->adev->dev, "%p unpin not necessary\n", bo);
> +               dev_warn(adev->dev, "%p unpin not necessary\n", bo);
>                 return 0;
>         }
>         bo->pin_count--;
> @@ -725,16 +729,16 @@ int amdgpu_bo_unpin(struct amdgpu_bo *bo)
>         }
>         r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
>         if (unlikely(r)) {
> -               dev_err(bo->adev->dev, "%p validate failed for unpin\n", bo);
> +               dev_err(adev->dev, "%p validate failed for unpin\n", bo);
>                 goto error;
>         }
>
>         if (bo->tbo.mem.mem_type == TTM_PL_VRAM) {
> -               bo->adev->vram_pin_size -= amdgpu_bo_size(bo);
> +               adev->vram_pin_size -= amdgpu_bo_size(bo);
>                 if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
> -                       bo->adev->invisible_pin_size -= amdgpu_bo_size(bo);
> +                       adev->invisible_pin_size -= amdgpu_bo_size(bo);
>         } else if (bo->tbo.mem.mem_type == TTM_PL_TT) {
> -               bo->adev->gart_pin_size -= amdgpu_bo_size(bo);
> +               adev->gart_pin_size -= amdgpu_bo_size(bo);
>         }
>
>  error:
> @@ -859,6 +863,7 @@ int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer,
>  void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
>                            struct ttm_mem_reg *new_mem)
>  {
> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
>         struct amdgpu_bo *rbo;
>         struct ttm_mem_reg *old_mem = &bo->mem;
>
> @@ -866,21 +871,21 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
>                 return;
>
>         rbo = container_of(bo, struct amdgpu_bo, tbo);
> -       amdgpu_vm_bo_invalidate(rbo->adev, rbo);
> +       amdgpu_vm_bo_invalidate(adev, rbo);
>
>         /* update statistics */
>         if (!new_mem)
>                 return;
>
>         /* move_notify is called before move happens */
> -       amdgpu_update_memory_usage(rbo->adev, &bo->mem, new_mem);
> +       amdgpu_update_memory_usage(adev, &bo->mem, new_mem);
>
>         trace_amdgpu_ttm_bo_move(rbo, new_mem->mem_type, old_mem->mem_type);
>  }
>
>  int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
>  {
> -       struct amdgpu_device *adev;
> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
>         struct amdgpu_bo *abo;
>         unsigned long offset, size, lpfn;
>         int i, r;
> @@ -889,7 +894,6 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
>                 return 0;
>
>         abo = container_of(bo, struct amdgpu_bo, tbo);
> -       adev = abo->adev;
>         if (bo->mem.mem_type != TTM_PL_VRAM)
>                 return 0;
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> index 8255034..c9b2c01 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
> @@ -71,12 +71,13 @@ static inline unsigned amdgpu_mem_type_to_domain(u32 mem_type)
>   */
>  static inline int amdgpu_bo_reserve(struct amdgpu_bo *bo, bool no_intr)
>  {
> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>         int r;
>
>         r = ttm_bo_reserve(&bo->tbo, !no_intr, false, NULL);
>         if (unlikely(r != 0)) {
>                 if (r != -ERESTARTSYS)
> -                       dev_err(bo->adev->dev, "%p reserve failed\n", bo);
> +                       dev_err(adev->dev, "%p reserve failed\n", bo);
>                 return r;
>         }
>         return 0;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 1965209..d246a1f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -51,16 +51,6 @@
>  static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev);
>  static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev);
>
> -static struct amdgpu_device *amdgpu_get_adev(struct ttm_bo_device *bdev)
> -{
> -       struct amdgpu_mman *mman;
> -       struct amdgpu_device *adev;
> -
> -       mman = container_of(bdev, struct amdgpu_mman, bdev);
> -       adev = container_of(mman, struct amdgpu_device, mman);
> -       return adev;
> -}
> -
>
>  /*
>   * Global memory.
> @@ -195,6 +185,7 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
>  static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
>                                 struct ttm_placement *placement)
>  {
> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
>         struct amdgpu_bo *rbo;
>         static struct ttm_place placements = {
>                 .fpfn = 0,
> @@ -213,7 +204,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
>         rbo = container_of(bo, struct amdgpu_bo, tbo);
>         switch (bo->mem.mem_type) {
>         case TTM_PL_VRAM:
> -               if (rbo->adev->mman.buffer_funcs_ring->ready == false) {
> +               if (adev->mman.buffer_funcs_ring->ready == false) {
>                         amdgpu_ttm_placement_from_domain(rbo,
>                                                          AMDGPU_GEM_DOMAIN_CPU);
>                 } else {
> @@ -231,7 +222,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
>                                  * allocating address space for the BO.
>                                  */
>                                 rbo->placements[i].lpfn =
> -                                       rbo->adev->mc.gtt_size >> PAGE_SHIFT;
> +                                       adev->mc.gtt_size >> PAGE_SHIFT;
>                         }
>                 }
>                 break;
> @@ -1384,7 +1375,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, uint32_t src_data,
>                        struct reservation_object *resv,
>                        struct fence **fence)
>  {
> -       struct amdgpu_device *adev = bo->adev;
> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>         struct amdgpu_job *job;
>         struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> index e6842b0..87bcac3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> @@ -931,7 +931,7 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo,
>         if (r)
>                 return r;
>
> -       if (!bo->adev->uvd.address_64_bit) {
> +       if (!ring->adev->uvd.address_64_bit) {
>                 amdgpu_ttm_placement_from_domain(bo, AMDGPU_GEM_DOMAIN_VRAM);
>                 amdgpu_uvd_force_into_uvd_segment(bo);
>         }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index d3a2d1f..5dba9f7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1175,7 +1175,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
>
>         flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
>         gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
> -               adev == bo_va->bo->adev) ? flags : 0;
> +               adev == amdgpu_get_adev(bo_va->bo->tbo.bdev)) ? flags : 0;
>
>         spin_lock(&vm->status_lock);
>         if (!list_empty(&bo_va->vm_status))
> --
> 2.5.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/5] drm/amdgpu: fix a bunch of coding style issues in amdgpu_ttm.c
       [not found]     ` <1473945024-8275-2-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
  2016-09-15 18:25       ` Alex Deucher
@ 2016-09-16  2:17       ` Michel Dänzer
       [not found]         ` <0a85f244-9e39-f5cf-41c7-41f5954094e7-otUistvHUpPR7s880joybQ@public.gmane.org>
  1 sibling, 1 reply; 14+ messages in thread
From: Michel Dänzer @ 2016-09-16  2:17 UTC (permalink / raw)
  To: Christian König; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On 15/09/16 10:10 PM, Christian König wrote:
> From: Christian König <christian.koenig@amd.com>
> 
> No intented functional change.
> 
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 65 +++++++++++++++++++++------------
>  1 file changed, 42 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 428ffb6..1965209 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -214,9 +214,11 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
>  	switch (bo->mem.mem_type) {
>  	case TTM_PL_VRAM:
>  		if (rbo->adev->mman.buffer_funcs_ring->ready == false) {
> -			amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_CPU);
> +			amdgpu_ttm_placement_from_domain(rbo,
> +							 AMDGPU_GEM_DOMAIN_CPU);
>  		} else {
> -			amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_GTT);
> +			amdgpu_ttm_placement_from_domain(rbo,
> +							 AMDGPU_GEM_DOMAIN_GTT);

I don't see the point of this kind of change. We save all of 5 columns
of horizontal space, but for that we reduce readability by breaking up a
single line statement to multiple lines.

It makes more sense when saving a more significant amount of horizontal
space or when the statement already spans multiple lines though.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/5] drm/amdgpu: fix a bunch of coding style issues in amdgpu_ttm.c
       [not found]         ` <0a85f244-9e39-f5cf-41c7-41f5954094e7-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2016-09-16  8:41           ` Christian König
  0 siblings, 0 replies; 14+ messages in thread
From: Christian König @ 2016-09-16  8:41 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Am 16.09.2016 um 04:17 schrieb Michel Dänzer:
> On 15/09/16 10:10 PM, Christian König wrote:
>> From: Christian König <christian.koenig@amd.com>
>>
>> No intented functional change.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 65 +++++++++++++++++++++------------
>>   1 file changed, 42 insertions(+), 23 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> index 428ffb6..1965209 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> @@ -214,9 +214,11 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
>>   	switch (bo->mem.mem_type) {
>>   	case TTM_PL_VRAM:
>>   		if (rbo->adev->mman.buffer_funcs_ring->ready == false) {
>> -			amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_CPU);
>> +			amdgpu_ttm_placement_from_domain(rbo,
>> +							 AMDGPU_GEM_DOMAIN_CPU);
>>   		} else {
>> -			amdgpu_ttm_placement_from_domain(rbo, AMDGPU_GEM_DOMAIN_GTT);
>> +			amdgpu_ttm_placement_from_domain(rbo,
>> +							 AMDGPU_GEM_DOMAIN_GTT);
> I don't see the point of this kind of change. We save all of 5 columns
> of horizontal space, but for that we reduce readability by breaking up a
> single line statement to multiple lines.
>
> It makes more sense when saving a more significant amount of horizontal
> space or when the statement already spans multiple lines though.
>

I was mostly just following what the auto formatter suggested, but now 
that you say it it's probably not such a good idea in some cases.

Should I just drop those two patches or just fix what Alex and you have 
noted and send them again? Some of the changes still seem to make sense 
to me.

Regards,
Christain.
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] drm/amdgpu: remove adev pointer from struct amdgpu_bo
       [not found]         ` <CADnq5_M4VrN-N=Fh2kvZpedqTRVkxePjDBCySk9icaD77R87ag-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-09-29  8:05           ` Christian König
       [not found]             ` <9a954630-b832-f596-ff48-90b24fc3600c-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
  0 siblings, 1 reply; 14+ messages in thread
From: Christian König @ 2016-09-29  8:05 UTC (permalink / raw)
  To: Alex Deucher; +Cc: amd-gfx list

Am 15.09.2016 um 20:30 schrieb Alex Deucher:
> On Thu, Sep 15, 2016 at 9:10 AM, Christian König
> <deathsimple@vodafone.de> wrote:
>> From: Christian König <christian.koenig@amd.com>
>>
>> It's completely pointsless to have two pointers to the
>> device in the same structur.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  6 +++-
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c     | 10 +++---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c    |  4 +--
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c     |  4 +--
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 50 ++++++++++++++++--------------
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.h |  3 +-
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 17 +++-------
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c    |  2 +-
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c     |  2 +-
>>   9 files changed, 50 insertions(+), 48 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> index 3b3981d..ed91f08 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> @@ -465,7 +465,6 @@ struct amdgpu_bo {
>>           */
>>          struct list_head                va;
>>          /* Constant after initialization */
>> -       struct amdgpu_device            *adev;
>>          struct drm_gem_object           gem_base;
>>          struct amdgpu_bo                *parent;
>>          struct amdgpu_bo                *shadow;
>> @@ -2144,6 +2143,11 @@ struct amdgpu_device {
>>
>>   };
>>
>> +static inline struct amdgpu_device *amdgpu_get_adev(struct ttm_bo_device *bdev)
>> +{
>> +       return container_of(bdev, struct amdgpu_device, mman.bdev);
>> +}
> Maybe call this amdgpu_ttm_get_adev() to make it clear to to get the
> adev from a ttm bo device?

Do you have a strong opinion on this? I thought about that as well, but 
I find it a bit long then. Especially a few lines would then become 
longer than 80 characters again.

I just send the patch out with a bunch of other cleanups as well, please 
take another look.

Christian.

>
> Alex
>
>> +
>>   bool amdgpu_device_is_px(struct drm_device *dev);
>>   int amdgpu_device_init(struct amdgpu_device *adev,
>>                         struct drm_device *ddev,
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> index 187c366..5beab71 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> @@ -355,6 +355,7 @@ static void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev,
>>   static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
>>                                   struct amdgpu_bo *bo)
>>   {
>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>>          u64 initial_bytes_moved;
>>          uint32_t domain;
>>          int r;
>> @@ -372,9 +373,9 @@ static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
>>
>>   retry:
>>          amdgpu_ttm_placement_from_domain(bo, domain);
>> -       initial_bytes_moved = atomic64_read(&bo->adev->num_bytes_moved);
>> +       initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
>>          r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);
>> -       p->bytes_moved += atomic64_read(&bo->adev->num_bytes_moved) -
>> +       p->bytes_moved += atomic64_read(&adev->num_bytes_moved) -
>>                  initial_bytes_moved;
>>
>>          if (unlikely(r == -ENOMEM) && domain != bo->allowed_domains) {
>> @@ -400,6 +401,7 @@ static bool amdgpu_cs_try_evict(struct amdgpu_cs_parser *p,
>>
>>                  struct amdgpu_bo_list_entry *candidate = p->evictable;
>>                  struct amdgpu_bo *bo = candidate->robj;
>> +               struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>>                  u64 initial_bytes_moved;
>>                  uint32_t other;
>>
>> @@ -420,9 +422,9 @@ static bool amdgpu_cs_try_evict(struct amdgpu_cs_parser *p,
>>
>>                  /* Good we can try to move this BO somewhere else */
>>                  amdgpu_ttm_placement_from_domain(bo, other);
>> -               initial_bytes_moved = atomic64_read(&bo->adev->num_bytes_moved);
>> +               initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
>>                  r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);
>> -               p->bytes_moved += atomic64_read(&bo->adev->num_bytes_moved) -
>> +               p->bytes_moved += atomic64_read(&adev->num_bytes_moved) -
>>                          initial_bytes_moved;
>>
>>                  if (unlikely(r))
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> index 70e294b..480ae7e 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> @@ -121,7 +121,7 @@ int amdgpu_gem_object_open(struct drm_gem_object *obj,
>>                             struct drm_file *file_priv)
>>   {
>>          struct amdgpu_bo *rbo = gem_to_amdgpu_bo(obj);
>> -       struct amdgpu_device *adev = rbo->adev;
>> +       struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
>>          struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
>>          struct amdgpu_vm *vm = &fpriv->vm;
>>          struct amdgpu_bo_va *bo_va;
>> @@ -144,7 +144,7 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj,
>>                               struct drm_file *file_priv)
>>   {
>>          struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
>> -       struct amdgpu_device *adev = bo->adev;
>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>>          struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
>>          struct amdgpu_vm *vm = &fpriv->vm;
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
>> index 32fa7b7..4731231 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
>> @@ -285,7 +285,7 @@ free_rmn:
>>   int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
>>   {
>>          unsigned long end = addr + amdgpu_bo_size(bo) - 1;
>> -       struct amdgpu_device *adev = bo->adev;
>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>>          struct amdgpu_mn *rmn;
>>          struct amdgpu_mn_node *node = NULL;
>>          struct list_head bos;
>> @@ -340,7 +340,7 @@ int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
>>    */
>>   void amdgpu_mn_unregister(struct amdgpu_bo *bo)
>>   {
>> -       struct amdgpu_device *adev = bo->adev;
>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>>          struct amdgpu_mn *rmn;
>>          struct list_head *head;
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> index 4289c31..5cbe803 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> @@ -90,18 +90,19 @@ static void amdgpu_update_memory_usage(struct amdgpu_device *adev,
>>
>>   static void amdgpu_ttm_bo_destroy(struct ttm_buffer_object *tbo)
>>   {
>> +       struct amdgpu_device *adev = amdgpu_get_adev(tbo->bdev);
>>          struct amdgpu_bo *bo;
>>
>>          bo = container_of(tbo, struct amdgpu_bo, tbo);
>>
>> -       amdgpu_update_memory_usage(bo->adev, &bo->tbo.mem, NULL);
>> +       amdgpu_update_memory_usage(adev, &bo->tbo.mem, NULL);
>>
>>          drm_gem_object_release(&bo->gem_base);
>>          amdgpu_bo_unref(&bo->parent);
>>          if (!list_empty(&bo->shadow_list)) {
>> -               mutex_lock(&bo->adev->shadow_list_lock);
>> +               mutex_lock(&adev->shadow_list_lock);
>>                  list_del_init(&bo->shadow_list);
>> -               mutex_unlock(&bo->adev->shadow_list_lock);
>> +               mutex_unlock(&adev->shadow_list_lock);
>>          }
>>          kfree(bo->metadata);
>>          kfree(bo);
>> @@ -212,8 +213,10 @@ static void amdgpu_ttm_placement_init(struct amdgpu_device *adev,
>>
>>   void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *rbo, u32 domain)
>>   {
>> -       amdgpu_ttm_placement_init(rbo->adev, &rbo->placement,
>> -                                 rbo->placements, domain, rbo->flags);
>> +       struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
>> +
>> +       amdgpu_ttm_placement_init(adev, &rbo->placement, rbo->placements,
>> +                                 domain, rbo->flags);
>>   }
>>
>>   static void amdgpu_fill_placement_to_bo(struct amdgpu_bo *bo,
>> @@ -359,7 +362,6 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
>>                  kfree(bo);
>>                  return r;
>>          }
>> -       bo->adev = adev;
>>          INIT_LIST_HEAD(&bo->shadow_list);
>>          INIT_LIST_HEAD(&bo->va);
>>          bo->prefered_domains = domain & (AMDGPU_GEM_DOMAIN_VRAM |
>> @@ -624,6 +626,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>>                               u64 min_offset, u64 max_offset,
>>                               u64 *gpu_addr)
>>   {
>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>>          int r, i;
>>          unsigned fpfn, lpfn;
>>
>> @@ -659,12 +662,12 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>>                  if ((bo->placements[i].flags & TTM_PL_FLAG_VRAM) &&
>>                      !(bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) &&
>>                      (!max_offset || max_offset >
>> -                    bo->adev->mc.visible_vram_size)) {
>> +                    adev->mc.visible_vram_size)) {
>>                          if (WARN_ON_ONCE(min_offset >
>> -                                        bo->adev->mc.visible_vram_size))
>> +                                        adev->mc.visible_vram_size))
>>                                  return -EINVAL;
>>                          fpfn = min_offset >> PAGE_SHIFT;
>> -                       lpfn = bo->adev->mc.visible_vram_size >> PAGE_SHIFT;
>> +                       lpfn = adev->mc.visible_vram_size >> PAGE_SHIFT;
>>                  } else {
>>                          fpfn = min_offset >> PAGE_SHIFT;
>>                          lpfn = max_offset >> PAGE_SHIFT;
>> @@ -679,12 +682,12 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>>
>>          r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
>>          if (unlikely(r)) {
>> -               dev_err(bo->adev->dev, "%p pin failed\n", bo);
>> +               dev_err(adev->dev, "%p pin failed\n", bo);
>>                  goto error;
>>          }
>>          r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
>>          if (unlikely(r)) {
>> -               dev_err(bo->adev->dev, "%p bind failed\n", bo);
>> +               dev_err(adev->dev, "%p bind failed\n", bo);
>>                  goto error;
>>          }
>>
>> @@ -692,11 +695,11 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>>          if (gpu_addr != NULL)
>>                  *gpu_addr = amdgpu_bo_gpu_offset(bo);
>>          if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
>> -               bo->adev->vram_pin_size += amdgpu_bo_size(bo);
>> +               adev->vram_pin_size += amdgpu_bo_size(bo);
>>                  if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
>> -                       bo->adev->invisible_pin_size += amdgpu_bo_size(bo);
>> +                       adev->invisible_pin_size += amdgpu_bo_size(bo);
>>          } else if (domain == AMDGPU_GEM_DOMAIN_GTT) {
>> -               bo->adev->gart_pin_size += amdgpu_bo_size(bo);
>> +               adev->gart_pin_size += amdgpu_bo_size(bo);
>>          }
>>
>>   error:
>> @@ -710,10 +713,11 @@ int amdgpu_bo_pin(struct amdgpu_bo *bo, u32 domain, u64 *gpu_addr)
>>
>>   int amdgpu_bo_unpin(struct amdgpu_bo *bo)
>>   {
>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>>          int r, i;
>>
>>          if (!bo->pin_count) {
>> -               dev_warn(bo->adev->dev, "%p unpin not necessary\n", bo);
>> +               dev_warn(adev->dev, "%p unpin not necessary\n", bo);
>>                  return 0;
>>          }
>>          bo->pin_count--;
>> @@ -725,16 +729,16 @@ int amdgpu_bo_unpin(struct amdgpu_bo *bo)
>>          }
>>          r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
>>          if (unlikely(r)) {
>> -               dev_err(bo->adev->dev, "%p validate failed for unpin\n", bo);
>> +               dev_err(adev->dev, "%p validate failed for unpin\n", bo);
>>                  goto error;
>>          }
>>
>>          if (bo->tbo.mem.mem_type == TTM_PL_VRAM) {
>> -               bo->adev->vram_pin_size -= amdgpu_bo_size(bo);
>> +               adev->vram_pin_size -= amdgpu_bo_size(bo);
>>                  if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
>> -                       bo->adev->invisible_pin_size -= amdgpu_bo_size(bo);
>> +                       adev->invisible_pin_size -= amdgpu_bo_size(bo);
>>          } else if (bo->tbo.mem.mem_type == TTM_PL_TT) {
>> -               bo->adev->gart_pin_size -= amdgpu_bo_size(bo);
>> +               adev->gart_pin_size -= amdgpu_bo_size(bo);
>>          }
>>
>>   error:
>> @@ -859,6 +863,7 @@ int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void *buffer,
>>   void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
>>                             struct ttm_mem_reg *new_mem)
>>   {
>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
>>          struct amdgpu_bo *rbo;
>>          struct ttm_mem_reg *old_mem = &bo->mem;
>>
>> @@ -866,21 +871,21 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
>>                  return;
>>
>>          rbo = container_of(bo, struct amdgpu_bo, tbo);
>> -       amdgpu_vm_bo_invalidate(rbo->adev, rbo);
>> +       amdgpu_vm_bo_invalidate(adev, rbo);
>>
>>          /* update statistics */
>>          if (!new_mem)
>>                  return;
>>
>>          /* move_notify is called before move happens */
>> -       amdgpu_update_memory_usage(rbo->adev, &bo->mem, new_mem);
>> +       amdgpu_update_memory_usage(adev, &bo->mem, new_mem);
>>
>>          trace_amdgpu_ttm_bo_move(rbo, new_mem->mem_type, old_mem->mem_type);
>>   }
>>
>>   int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
>>   {
>> -       struct amdgpu_device *adev;
>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
>>          struct amdgpu_bo *abo;
>>          unsigned long offset, size, lpfn;
>>          int i, r;
>> @@ -889,7 +894,6 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
>>                  return 0;
>>
>>          abo = container_of(bo, struct amdgpu_bo, tbo);
>> -       adev = abo->adev;
>>          if (bo->mem.mem_type != TTM_PL_VRAM)
>>                  return 0;
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
>> index 8255034..c9b2c01 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
>> @@ -71,12 +71,13 @@ static inline unsigned amdgpu_mem_type_to_domain(u32 mem_type)
>>    */
>>   static inline int amdgpu_bo_reserve(struct amdgpu_bo *bo, bool no_intr)
>>   {
>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>>          int r;
>>
>>          r = ttm_bo_reserve(&bo->tbo, !no_intr, false, NULL);
>>          if (unlikely(r != 0)) {
>>                  if (r != -ERESTARTSYS)
>> -                       dev_err(bo->adev->dev, "%p reserve failed\n", bo);
>> +                       dev_err(adev->dev, "%p reserve failed\n", bo);
>>                  return r;
>>          }
>>          return 0;
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> index 1965209..d246a1f 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> @@ -51,16 +51,6 @@
>>   static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev);
>>   static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev);
>>
>> -static struct amdgpu_device *amdgpu_get_adev(struct ttm_bo_device *bdev)
>> -{
>> -       struct amdgpu_mman *mman;
>> -       struct amdgpu_device *adev;
>> -
>> -       mman = container_of(bdev, struct amdgpu_mman, bdev);
>> -       adev = container_of(mman, struct amdgpu_device, mman);
>> -       return adev;
>> -}
>> -
>>
>>   /*
>>    * Global memory.
>> @@ -195,6 +185,7 @@ static int amdgpu_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
>>   static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
>>                                  struct ttm_placement *placement)
>>   {
>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
>>          struct amdgpu_bo *rbo;
>>          static struct ttm_place placements = {
>>                  .fpfn = 0,
>> @@ -213,7 +204,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
>>          rbo = container_of(bo, struct amdgpu_bo, tbo);
>>          switch (bo->mem.mem_type) {
>>          case TTM_PL_VRAM:
>> -               if (rbo->adev->mman.buffer_funcs_ring->ready == false) {
>> +               if (adev->mman.buffer_funcs_ring->ready == false) {
>>                          amdgpu_ttm_placement_from_domain(rbo,
>>                                                           AMDGPU_GEM_DOMAIN_CPU);
>>                  } else {
>> @@ -231,7 +222,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
>>                                   * allocating address space for the BO.
>>                                   */
>>                                  rbo->placements[i].lpfn =
>> -                                       rbo->adev->mc.gtt_size >> PAGE_SHIFT;
>> +                                       adev->mc.gtt_size >> PAGE_SHIFT;
>>                          }
>>                  }
>>                  break;
>> @@ -1384,7 +1375,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo, uint32_t src_data,
>>                         struct reservation_object *resv,
>>                         struct fence **fence)
>>   {
>> -       struct amdgpu_device *adev = bo->adev;
>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>>          struct amdgpu_job *job;
>>          struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>> index e6842b0..87bcac3 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>> @@ -931,7 +931,7 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo,
>>          if (r)
>>                  return r;
>>
>> -       if (!bo->adev->uvd.address_64_bit) {
>> +       if (!ring->adev->uvd.address_64_bit) {
>>                  amdgpu_ttm_placement_from_domain(bo, AMDGPU_GEM_DOMAIN_VRAM);
>>                  amdgpu_uvd_force_into_uvd_segment(bo);
>>          }
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> index d3a2d1f..5dba9f7 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>> @@ -1175,7 +1175,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
>>
>>          flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
>>          gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
>> -               adev == bo_va->bo->adev) ? flags : 0;
>> +               adev == amdgpu_get_adev(bo_va->bo->tbo.bdev)) ? flags : 0;
>>
>>          spin_lock(&vm->status_lock);
>>          if (!list_empty(&bo_va->vm_status))
>> --
>> 2.5.0
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] drm/amdgpu: remove adev pointer from struct amdgpu_bo
       [not found]             ` <9a954630-b832-f596-ff48-90b24fc3600c-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
@ 2016-09-29 16:39               ` Alex Deucher
  0 siblings, 0 replies; 14+ messages in thread
From: Alex Deucher @ 2016-09-29 16:39 UTC (permalink / raw)
  To: Christian König; +Cc: amd-gfx list

On Thu, Sep 29, 2016 at 4:05 AM, Christian König
<deathsimple@vodafone.de> wrote:
> Am 15.09.2016 um 20:30 schrieb Alex Deucher:
>>
>> On Thu, Sep 15, 2016 at 9:10 AM, Christian König
>> <deathsimple@vodafone.de> wrote:
>>>
>>> From: Christian König <christian.koenig@amd.com>
>>>
>>> It's completely pointsless to have two pointers to the
>>> device in the same structur.
>>>
>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>> ---
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  6 +++-
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c     | 10 +++---
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c    |  4 +--
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c     |  4 +--
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 50
>>> ++++++++++++++++--------------
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.h |  3 +-
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 17 +++-------
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c    |  2 +-
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c     |  2 +-
>>>   9 files changed, 50 insertions(+), 48 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>>> index 3b3981d..ed91f08 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>>> @@ -465,7 +465,6 @@ struct amdgpu_bo {
>>>           */
>>>          struct list_head                va;
>>>          /* Constant after initialization */
>>> -       struct amdgpu_device            *adev;
>>>          struct drm_gem_object           gem_base;
>>>          struct amdgpu_bo                *parent;
>>>          struct amdgpu_bo                *shadow;
>>> @@ -2144,6 +2143,11 @@ struct amdgpu_device {
>>>
>>>   };
>>>
>>> +static inline struct amdgpu_device *amdgpu_get_adev(struct ttm_bo_device
>>> *bdev)
>>> +{
>>> +       return container_of(bdev, struct amdgpu_device, mman.bdev);
>>> +}
>>
>> Maybe call this amdgpu_ttm_get_adev() to make it clear to to get the
>> adev from a ttm bo device?
>
>
> Do you have a strong opinion on this? I thought about that as well, but I
> find it a bit long then. Especially a few lines would then become longer
> than 80 characters again.

My main concern is if we ever add another accessor for an adev
embedded in something else.  How about amdgpu_ttm_to_adev() or
amdgpu_ttm_adev()?

Alex

>
> I just send the patch out with a bunch of other cleanups as well, please
> take another look.
>
> Christian.
>
>
>>
>> Alex
>>
>>> +
>>>   bool amdgpu_device_is_px(struct drm_device *dev);
>>>   int amdgpu_device_init(struct amdgpu_device *adev,
>>>                         struct drm_device *ddev,
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>>> index 187c366..5beab71 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>>> @@ -355,6 +355,7 @@ static void amdgpu_cs_report_moved_bytes(struct
>>> amdgpu_device *adev,
>>>   static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
>>>                                   struct amdgpu_bo *bo)
>>>   {
>>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>>>          u64 initial_bytes_moved;
>>>          uint32_t domain;
>>>          int r;
>>> @@ -372,9 +373,9 @@ static int amdgpu_cs_bo_validate(struct
>>> amdgpu_cs_parser *p,
>>>
>>>   retry:
>>>          amdgpu_ttm_placement_from_domain(bo, domain);
>>> -       initial_bytes_moved = atomic64_read(&bo->adev->num_bytes_moved);
>>> +       initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
>>>          r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);
>>> -       p->bytes_moved += atomic64_read(&bo->adev->num_bytes_moved) -
>>> +       p->bytes_moved += atomic64_read(&adev->num_bytes_moved) -
>>>                  initial_bytes_moved;
>>>
>>>          if (unlikely(r == -ENOMEM) && domain != bo->allowed_domains) {
>>> @@ -400,6 +401,7 @@ static bool amdgpu_cs_try_evict(struct
>>> amdgpu_cs_parser *p,
>>>
>>>                  struct amdgpu_bo_list_entry *candidate = p->evictable;
>>>                  struct amdgpu_bo *bo = candidate->robj;
>>> +               struct amdgpu_device *adev =
>>> amdgpu_get_adev(bo->tbo.bdev);
>>>                  u64 initial_bytes_moved;
>>>                  uint32_t other;
>>>
>>> @@ -420,9 +422,9 @@ static bool amdgpu_cs_try_evict(struct
>>> amdgpu_cs_parser *p,
>>>
>>>                  /* Good we can try to move this BO somewhere else */
>>>                  amdgpu_ttm_placement_from_domain(bo, other);
>>> -               initial_bytes_moved =
>>> atomic64_read(&bo->adev->num_bytes_moved);
>>> +               initial_bytes_moved =
>>> atomic64_read(&adev->num_bytes_moved);
>>>                  r = ttm_bo_validate(&bo->tbo, &bo->placement, true,
>>> false);
>>> -               p->bytes_moved +=
>>> atomic64_read(&bo->adev->num_bytes_moved) -
>>> +               p->bytes_moved += atomic64_read(&adev->num_bytes_moved) -
>>>                          initial_bytes_moved;
>>>
>>>                  if (unlikely(r))
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> index 70e294b..480ae7e 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> @@ -121,7 +121,7 @@ int amdgpu_gem_object_open(struct drm_gem_object
>>> *obj,
>>>                             struct drm_file *file_priv)
>>>   {
>>>          struct amdgpu_bo *rbo = gem_to_amdgpu_bo(obj);
>>> -       struct amdgpu_device *adev = rbo->adev;
>>> +       struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
>>>          struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
>>>          struct amdgpu_vm *vm = &fpriv->vm;
>>>          struct amdgpu_bo_va *bo_va;
>>> @@ -144,7 +144,7 @@ void amdgpu_gem_object_close(struct drm_gem_object
>>> *obj,
>>>                               struct drm_file *file_priv)
>>>   {
>>>          struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj);
>>> -       struct amdgpu_device *adev = bo->adev;
>>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>>>          struct amdgpu_fpriv *fpriv = file_priv->driver_priv;
>>>          struct amdgpu_vm *vm = &fpriv->vm;
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
>>> index 32fa7b7..4731231 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
>>> @@ -285,7 +285,7 @@ free_rmn:
>>>   int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
>>>   {
>>>          unsigned long end = addr + amdgpu_bo_size(bo) - 1;
>>> -       struct amdgpu_device *adev = bo->adev;
>>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>>>          struct amdgpu_mn *rmn;
>>>          struct amdgpu_mn_node *node = NULL;
>>>          struct list_head bos;
>>> @@ -340,7 +340,7 @@ int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned
>>> long addr)
>>>    */
>>>   void amdgpu_mn_unregister(struct amdgpu_bo *bo)
>>>   {
>>> -       struct amdgpu_device *adev = bo->adev;
>>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>>>          struct amdgpu_mn *rmn;
>>>          struct list_head *head;
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>> index 4289c31..5cbe803 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>> @@ -90,18 +90,19 @@ static void amdgpu_update_memory_usage(struct
>>> amdgpu_device *adev,
>>>
>>>   static void amdgpu_ttm_bo_destroy(struct ttm_buffer_object *tbo)
>>>   {
>>> +       struct amdgpu_device *adev = amdgpu_get_adev(tbo->bdev);
>>>          struct amdgpu_bo *bo;
>>>
>>>          bo = container_of(tbo, struct amdgpu_bo, tbo);
>>>
>>> -       amdgpu_update_memory_usage(bo->adev, &bo->tbo.mem, NULL);
>>> +       amdgpu_update_memory_usage(adev, &bo->tbo.mem, NULL);
>>>
>>>          drm_gem_object_release(&bo->gem_base);
>>>          amdgpu_bo_unref(&bo->parent);
>>>          if (!list_empty(&bo->shadow_list)) {
>>> -               mutex_lock(&bo->adev->shadow_list_lock);
>>> +               mutex_lock(&adev->shadow_list_lock);
>>>                  list_del_init(&bo->shadow_list);
>>> -               mutex_unlock(&bo->adev->shadow_list_lock);
>>> +               mutex_unlock(&adev->shadow_list_lock);
>>>          }
>>>          kfree(bo->metadata);
>>>          kfree(bo);
>>> @@ -212,8 +213,10 @@ static void amdgpu_ttm_placement_init(struct
>>> amdgpu_device *adev,
>>>
>>>   void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *rbo, u32
>>> domain)
>>>   {
>>> -       amdgpu_ttm_placement_init(rbo->adev, &rbo->placement,
>>> -                                 rbo->placements, domain, rbo->flags);
>>> +       struct amdgpu_device *adev = amdgpu_get_adev(rbo->tbo.bdev);
>>> +
>>> +       amdgpu_ttm_placement_init(adev, &rbo->placement, rbo->placements,
>>> +                                 domain, rbo->flags);
>>>   }
>>>
>>>   static void amdgpu_fill_placement_to_bo(struct amdgpu_bo *bo,
>>> @@ -359,7 +362,6 @@ int amdgpu_bo_create_restricted(struct amdgpu_device
>>> *adev,
>>>                  kfree(bo);
>>>                  return r;
>>>          }
>>> -       bo->adev = adev;
>>>          INIT_LIST_HEAD(&bo->shadow_list);
>>>          INIT_LIST_HEAD(&bo->va);
>>>          bo->prefered_domains = domain & (AMDGPU_GEM_DOMAIN_VRAM |
>>> @@ -624,6 +626,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo,
>>> u32 domain,
>>>                               u64 min_offset, u64 max_offset,
>>>                               u64 *gpu_addr)
>>>   {
>>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>>>          int r, i;
>>>          unsigned fpfn, lpfn;
>>>
>>> @@ -659,12 +662,12 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo,
>>> u32 domain,
>>>                  if ((bo->placements[i].flags & TTM_PL_FLAG_VRAM) &&
>>>                      !(bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) &&
>>>                      (!max_offset || max_offset >
>>> -                    bo->adev->mc.visible_vram_size)) {
>>> +                    adev->mc.visible_vram_size)) {
>>>                          if (WARN_ON_ONCE(min_offset >
>>> -                                        bo->adev->mc.visible_vram_size))
>>> +                                        adev->mc.visible_vram_size))
>>>                                  return -EINVAL;
>>>                          fpfn = min_offset >> PAGE_SHIFT;
>>> -                       lpfn = bo->adev->mc.visible_vram_size >>
>>> PAGE_SHIFT;
>>> +                       lpfn = adev->mc.visible_vram_size >> PAGE_SHIFT;
>>>                  } else {
>>>                          fpfn = min_offset >> PAGE_SHIFT;
>>>                          lpfn = max_offset >> PAGE_SHIFT;
>>> @@ -679,12 +682,12 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo,
>>> u32 domain,
>>>
>>>          r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
>>>          if (unlikely(r)) {
>>> -               dev_err(bo->adev->dev, "%p pin failed\n", bo);
>>> +               dev_err(adev->dev, "%p pin failed\n", bo);
>>>                  goto error;
>>>          }
>>>          r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
>>>          if (unlikely(r)) {
>>> -               dev_err(bo->adev->dev, "%p bind failed\n", bo);
>>> +               dev_err(adev->dev, "%p bind failed\n", bo);
>>>                  goto error;
>>>          }
>>>
>>> @@ -692,11 +695,11 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo,
>>> u32 domain,
>>>          if (gpu_addr != NULL)
>>>                  *gpu_addr = amdgpu_bo_gpu_offset(bo);
>>>          if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
>>> -               bo->adev->vram_pin_size += amdgpu_bo_size(bo);
>>> +               adev->vram_pin_size += amdgpu_bo_size(bo);
>>>                  if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
>>> -                       bo->adev->invisible_pin_size +=
>>> amdgpu_bo_size(bo);
>>> +                       adev->invisible_pin_size += amdgpu_bo_size(bo);
>>>          } else if (domain == AMDGPU_GEM_DOMAIN_GTT) {
>>> -               bo->adev->gart_pin_size += amdgpu_bo_size(bo);
>>> +               adev->gart_pin_size += amdgpu_bo_size(bo);
>>>          }
>>>
>>>   error:
>>> @@ -710,10 +713,11 @@ int amdgpu_bo_pin(struct amdgpu_bo *bo, u32 domain,
>>> u64 *gpu_addr)
>>>
>>>   int amdgpu_bo_unpin(struct amdgpu_bo *bo)
>>>   {
>>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>>>          int r, i;
>>>
>>>          if (!bo->pin_count) {
>>> -               dev_warn(bo->adev->dev, "%p unpin not necessary\n", bo);
>>> +               dev_warn(adev->dev, "%p unpin not necessary\n", bo);
>>>                  return 0;
>>>          }
>>>          bo->pin_count--;
>>> @@ -725,16 +729,16 @@ int amdgpu_bo_unpin(struct amdgpu_bo *bo)
>>>          }
>>>          r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
>>>          if (unlikely(r)) {
>>> -               dev_err(bo->adev->dev, "%p validate failed for unpin\n",
>>> bo);
>>> +               dev_err(adev->dev, "%p validate failed for unpin\n", bo);
>>>                  goto error;
>>>          }
>>>
>>>          if (bo->tbo.mem.mem_type == TTM_PL_VRAM) {
>>> -               bo->adev->vram_pin_size -= amdgpu_bo_size(bo);
>>> +               adev->vram_pin_size -= amdgpu_bo_size(bo);
>>>                  if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
>>> -                       bo->adev->invisible_pin_size -=
>>> amdgpu_bo_size(bo);
>>> +                       adev->invisible_pin_size -= amdgpu_bo_size(bo);
>>>          } else if (bo->tbo.mem.mem_type == TTM_PL_TT) {
>>> -               bo->adev->gart_pin_size -= amdgpu_bo_size(bo);
>>> +               adev->gart_pin_size -= amdgpu_bo_size(bo);
>>>          }
>>>
>>>   error:
>>> @@ -859,6 +863,7 @@ int amdgpu_bo_get_metadata(struct amdgpu_bo *bo, void
>>> *buffer,
>>>   void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
>>>                             struct ttm_mem_reg *new_mem)
>>>   {
>>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
>>>          struct amdgpu_bo *rbo;
>>>          struct ttm_mem_reg *old_mem = &bo->mem;
>>>
>>> @@ -866,21 +871,21 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object
>>> *bo,
>>>                  return;
>>>
>>>          rbo = container_of(bo, struct amdgpu_bo, tbo);
>>> -       amdgpu_vm_bo_invalidate(rbo->adev, rbo);
>>> +       amdgpu_vm_bo_invalidate(adev, rbo);
>>>
>>>          /* update statistics */
>>>          if (!new_mem)
>>>                  return;
>>>
>>>          /* move_notify is called before move happens */
>>> -       amdgpu_update_memory_usage(rbo->adev, &bo->mem, new_mem);
>>> +       amdgpu_update_memory_usage(adev, &bo->mem, new_mem);
>>>
>>>          trace_amdgpu_ttm_bo_move(rbo, new_mem->mem_type,
>>> old_mem->mem_type);
>>>   }
>>>
>>>   int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
>>>   {
>>> -       struct amdgpu_device *adev;
>>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
>>>          struct amdgpu_bo *abo;
>>>          unsigned long offset, size, lpfn;
>>>          int i, r;
>>> @@ -889,7 +894,6 @@ int amdgpu_bo_fault_reserve_notify(struct
>>> ttm_buffer_object *bo)
>>>                  return 0;
>>>
>>>          abo = container_of(bo, struct amdgpu_bo, tbo);
>>> -       adev = abo->adev;
>>>          if (bo->mem.mem_type != TTM_PL_VRAM)
>>>                  return 0;
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
>>> index 8255034..c9b2c01 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
>>> @@ -71,12 +71,13 @@ static inline unsigned amdgpu_mem_type_to_domain(u32
>>> mem_type)
>>>    */
>>>   static inline int amdgpu_bo_reserve(struct amdgpu_bo *bo, bool no_intr)
>>>   {
>>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>>>          int r;
>>>
>>>          r = ttm_bo_reserve(&bo->tbo, !no_intr, false, NULL);
>>>          if (unlikely(r != 0)) {
>>>                  if (r != -ERESTARTSYS)
>>> -                       dev_err(bo->adev->dev, "%p reserve failed\n",
>>> bo);
>>> +                       dev_err(adev->dev, "%p reserve failed\n", bo);
>>>                  return r;
>>>          }
>>>          return 0;
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> index 1965209..d246a1f 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> @@ -51,16 +51,6 @@
>>>   static int amdgpu_ttm_debugfs_init(struct amdgpu_device *adev);
>>>   static void amdgpu_ttm_debugfs_fini(struct amdgpu_device *adev);
>>>
>>> -static struct amdgpu_device *amdgpu_get_adev(struct ttm_bo_device *bdev)
>>> -{
>>> -       struct amdgpu_mman *mman;
>>> -       struct amdgpu_device *adev;
>>> -
>>> -       mman = container_of(bdev, struct amdgpu_mman, bdev);
>>> -       adev = container_of(mman, struct amdgpu_device, mman);
>>> -       return adev;
>>> -}
>>> -
>>>
>>>   /*
>>>    * Global memory.
>>> @@ -195,6 +185,7 @@ static int amdgpu_init_mem_type(struct ttm_bo_device
>>> *bdev, uint32_t type,
>>>   static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
>>>                                  struct ttm_placement *placement)
>>>   {
>>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->bdev);
>>>          struct amdgpu_bo *rbo;
>>>          static struct ttm_place placements = {
>>>                  .fpfn = 0,
>>> @@ -213,7 +204,7 @@ static void amdgpu_evict_flags(struct
>>> ttm_buffer_object *bo,
>>>          rbo = container_of(bo, struct amdgpu_bo, tbo);
>>>          switch (bo->mem.mem_type) {
>>>          case TTM_PL_VRAM:
>>> -               if (rbo->adev->mman.buffer_funcs_ring->ready == false) {
>>> +               if (adev->mman.buffer_funcs_ring->ready == false) {
>>>                          amdgpu_ttm_placement_from_domain(rbo,
>>>
>>> AMDGPU_GEM_DOMAIN_CPU);
>>>                  } else {
>>> @@ -231,7 +222,7 @@ static void amdgpu_evict_flags(struct
>>> ttm_buffer_object *bo,
>>>                                   * allocating address space for the BO.
>>>                                   */
>>>                                  rbo->placements[i].lpfn =
>>> -                                       rbo->adev->mc.gtt_size >>
>>> PAGE_SHIFT;
>>> +                                       adev->mc.gtt_size >> PAGE_SHIFT;
>>>                          }
>>>                  }
>>>                  break;
>>> @@ -1384,7 +1375,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo,
>>> uint32_t src_data,
>>>                         struct reservation_object *resv,
>>>                         struct fence **fence)
>>>   {
>>> -       struct amdgpu_device *adev = bo->adev;
>>> +       struct amdgpu_device *adev = amdgpu_get_adev(bo->tbo.bdev);
>>>          struct amdgpu_job *job;
>>>          struct amdgpu_ring *ring = adev->mman.buffer_funcs_ring;
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>>> index e6842b0..87bcac3 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
>>> @@ -931,7 +931,7 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring
>>> *ring, struct amdgpu_bo *bo,
>>>          if (r)
>>>                  return r;
>>>
>>> -       if (!bo->adev->uvd.address_64_bit) {
>>> +       if (!ring->adev->uvd.address_64_bit) {
>>>                  amdgpu_ttm_placement_from_domain(bo,
>>> AMDGPU_GEM_DOMAIN_VRAM);
>>>                  amdgpu_uvd_force_into_uvd_segment(bo);
>>>          }
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>> index d3a2d1f..5dba9f7 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
>>> @@ -1175,7 +1175,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
>>>
>>>          flags = amdgpu_ttm_tt_pte_flags(adev, bo_va->bo->tbo.ttm, mem);
>>>          gtt_flags = (amdgpu_ttm_is_bound(bo_va->bo->tbo.ttm) &&
>>> -               adev == bo_va->bo->adev) ? flags : 0;
>>> +               adev == amdgpu_get_adev(bo_va->bo->tbo.bdev)) ? flags :
>>> 0;
>>>
>>>          spin_lock(&vm->status_lock);
>>>          if (!list_empty(&bo_va->vm_status))
>>> --
>>> 2.5.0
>>>
>>> _______________________________________________
>>> amd-gfx mailing list
>>> amd-gfx@lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
>
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-09-29 16:39 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-15 13:10 [PATCH 1/5] drm/amdgpu: remove unused member from struct amdgpu_bo Christian König
     [not found] ` <1473945024-8275-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-09-15 13:10   ` [PATCH 2/5] drm/amdgpu: fix a bunch of coding style issues in amdgpu_ttm.c Christian König
     [not found]     ` <1473945024-8275-2-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-09-15 18:25       ` Alex Deucher
2016-09-16  2:17       ` Michel Dänzer
     [not found]         ` <0a85f244-9e39-f5cf-41c7-41f5954094e7-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-09-16  8:41           ` Christian König
2016-09-15 13:10   ` [PATCH 3/5] drm/amdgpu: fix a bunch of coding style issues in amdgpu_gem.c Christian König
     [not found]     ` <1473945024-8275-3-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-09-15 18:27       ` Alex Deucher
2016-09-15 13:10   ` [PATCH 4/5] drm/amdgpu: remove adev pointer from struct amdgpu_bo Christian König
     [not found]     ` <1473945024-8275-4-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-09-15 18:30       ` Alex Deucher
     [not found]         ` <CADnq5_M4VrN-N=Fh2kvZpedqTRVkxePjDBCySk9icaD77R87ag-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-09-29  8:05           ` Christian König
     [not found]             ` <9a954630-b832-f596-ff48-90b24fc3600c-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-09-29 16:39               ` Alex Deucher
2016-09-15 13:10   ` [PATCH 5/5] drm/amdgpu: rename all rbo variable to abo Christian König
     [not found]     ` <1473945024-8275-5-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-09-15 18:19       ` Alex Deucher
2016-09-15 18:18   ` [PATCH 1/5] drm/amdgpu: remove unused member from struct amdgpu_bo Alex Deucher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.