dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Airlie <airlied@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: bskeggs@redhat.com, christian.koenig@amd.com
Subject: [PATCH 2/4] drm/amdgpu/ttm: drop the adev link from vram mgr
Date: Fri,  7 Aug 2020 09:34:57 +1000	[thread overview]
Message-ID: <20200806233459.4057784-3-airlied@gmail.com> (raw)
In-Reply-To: <20200806233459.4057784-1-airlied@gmail.com>

From: Dave Airlie <airlied@redhat.com>

There is no need for that now since it's embedded.

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

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
index 168294be276d..4a6d92f27b6e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
@@ -47,7 +47,6 @@ struct amdgpu_vram_mgr {
 	spinlock_t lock;
 	atomic64_t usage;
 	atomic64_t vis_usage;
-	struct amdgpu_device *adev;
 };
 
 struct amdgpu_gtt_mgr {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
index a41a8abc9927..7882efd275d1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
@@ -33,6 +33,11 @@ static inline struct amdgpu_vram_mgr *to_vram_mgr(struct ttm_resource_manager *m
 	return container_of(man, struct amdgpu_vram_mgr, manager);
 }
 
+static inline struct amdgpu_device *to_amdgpu_device(struct amdgpu_vram_mgr *mgr)
+{
+	return container_of(mgr, struct amdgpu_device, mman.vram_mgr);
+}
+
 /**
  * DOC: mem_info_vram_total
  *
@@ -182,8 +187,6 @@ 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)
@@ -311,7 +314,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
 			       struct ttm_resource *mem)
 {
 	struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
-	struct amdgpu_device *adev = mgr->adev;
+	struct amdgpu_device *adev = to_amdgpu_device(mgr);
 	struct drm_mm *mm = &mgr->mm;
 	struct drm_mm_node *nodes;
 	enum drm_mm_insert_mode mode;
@@ -429,7 +432,7 @@ static void amdgpu_vram_mgr_del(struct ttm_resource_manager *man,
 				struct ttm_resource *mem)
 {
 	struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
-	struct amdgpu_device *adev = mgr->adev;
+	struct amdgpu_device *adev = to_amdgpu_device(mgr);
 	struct drm_mm_node *nodes = mem->mm_node;
 	uint64_t usage = 0, vis_usage = 0;
 	unsigned pages = mem->num_pages;
-- 
2.27.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2020-08-06 23:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-06 23:34 further small ttm cleanups Dave Airlie
2020-08-06 23:34 ` [PATCH 1/4] drm/amdgpu/ttm: move vram/gtt mgr allocations to mman Dave Airlie
2020-08-07  9:17   ` Christian König
2020-08-06 23:34 ` Dave Airlie [this message]
2020-08-07  9:18   ` [PATCH 2/4] drm/amdgpu/ttm: drop the adev link from vram mgr Christian König
2020-08-06 23:34 ` [PATCH 3/4] drm/ttm: drop size from resource manager base class Dave Airlie
2020-08-07  3:50   ` kernel test robot
2020-08-07  4:46   ` kernel test robot
2020-08-07  7:17   ` kernel test robot
2020-08-07  9:22   ` Christian König
2020-08-06 23:34 ` [PATCH 4/4] drm/ttm/nouveau: move io_lru storage into driver Dave Airlie
2020-08-07 12:22   ` Christian König
2020-08-09  4:34   ` [drm/ttm/nouveau] c36a1cfe1b: BUG:kernel_NULL_pointer_dereference,address kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200806233459.4057784-3-airlied@gmail.com \
    --to=airlied@gmail.com \
    --cc=bskeggs@redhat.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox