diff mbox series

[45/49] drm/amdgpu/ttm: remove man->bdev references.

Message ID 20200731040520.3701599-46-airlied@gmail.com (mailing list archive)
State New, archived
Headers show
Series ttm mem manager refactoring. | expand

Commit Message

Dave Airlie July 31, 2020, 4:05 a.m. UTC
From: Dave Airlie <airlied@redhat.com>

Just store the device in the private so the link
can be removed from the manager

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Christian König July 31, 2020, 2:55 p.m. UTC | #1
Am 31.07.20 um 06:05 schrieb Dave Airlie:
> From: Dave Airlie <airlied@redhat.com>
>
> Just store the device in the private so the link
> can be removed from the manager
>
> Signed-off-by: Dave Airlie <airlied@redhat.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> index 9d4a13926b8c..d451851c8689 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> @@ -34,6 +34,7 @@ struct amdgpu_vram_mgr {
>   	spinlock_t lock;
>   	atomic64_t usage;
>   	atomic64_t vis_usage;
> +	struct amdgpu_device *adev;
>   };
>   
>   static inline struct amdgpu_vram_mgr *to_vram_mgr(struct ttm_mem_type_manager *man)
> @@ -196,6 +197,8 @@ int amdgpu_vram_mgr_init(struct amdgpu_device *adev)
>   	drm_mm_init(&mgr->mm, 0, man->size);
>   	spin_lock_init(&mgr->lock);
>   
> +	mgr->adev = adev;
> +
>   	/* Add the two VRAM-related sysfs files */
>   	ret = sysfs_create_files(&adev->dev->kobj, amdgpu_vram_mgr_attributes);
>   	if (ret)
> @@ -323,8 +326,8 @@ static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man,
>   			       const struct ttm_place *place,
>   			       struct ttm_mem_reg *mem)
>   {
> -	struct amdgpu_device *adev = amdgpu_ttm_adev(man->bdev);
>   	struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
> +	struct amdgpu_device *adev = mgr->adev;
>   	struct drm_mm *mm = &mgr->mm;
>   	struct drm_mm_node *nodes;
>   	enum drm_mm_insert_mode mode;
> @@ -439,8 +442,8 @@ static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man,
>   static void amdgpu_vram_mgr_del(struct ttm_mem_type_manager *man,
>   				struct ttm_mem_reg *mem)
>   {
> -	struct amdgpu_device *adev = amdgpu_ttm_adev(man->bdev);
>   	struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
> +	struct amdgpu_device *adev = mgr->adev;
>   	struct drm_mm_node *nodes = mem->mm_node;
>   	uint64_t usage = 0, vis_usage = 0;
>   	unsigned pages = mem->num_pages;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
index 9d4a13926b8c..d451851c8689 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
@@ -34,6 +34,7 @@  struct amdgpu_vram_mgr {
 	spinlock_t lock;
 	atomic64_t usage;
 	atomic64_t vis_usage;
+	struct amdgpu_device *adev;
 };
 
 static inline struct amdgpu_vram_mgr *to_vram_mgr(struct ttm_mem_type_manager *man)
@@ -196,6 +197,8 @@  int amdgpu_vram_mgr_init(struct amdgpu_device *adev)
 	drm_mm_init(&mgr->mm, 0, man->size);
 	spin_lock_init(&mgr->lock);
 
+	mgr->adev = adev;
+
 	/* Add the two VRAM-related sysfs files */
 	ret = sysfs_create_files(&adev->dev->kobj, amdgpu_vram_mgr_attributes);
 	if (ret)
@@ -323,8 +326,8 @@  static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man,
 			       const struct ttm_place *place,
 			       struct ttm_mem_reg *mem)
 {
-	struct amdgpu_device *adev = amdgpu_ttm_adev(man->bdev);
 	struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
+	struct amdgpu_device *adev = mgr->adev;
 	struct drm_mm *mm = &mgr->mm;
 	struct drm_mm_node *nodes;
 	enum drm_mm_insert_mode mode;
@@ -439,8 +442,8 @@  static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man,
 static void amdgpu_vram_mgr_del(struct ttm_mem_type_manager *man,
 				struct ttm_mem_reg *mem)
 {
-	struct amdgpu_device *adev = amdgpu_ttm_adev(man->bdev);
 	struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
+	struct amdgpu_device *adev = mgr->adev;
 	struct drm_mm_node *nodes = mem->mm_node;
 	uint64_t usage = 0, vis_usage = 0;
 	unsigned pages = mem->num_pages;