All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nirmoy Das <nirmoy.das@amd.com>
To: Christian.Koenig@amd.com
Cc: felix.kuehling@amd.com, Nirmoy Das <nirmoy.das@amd.com>,
	amd-gfx@lists.freedesktop.org
Subject: [PATCH 4/5] drm/amdgpu: use amdgpu_bo_create_user() for when possible
Date: Mon,  8 Mar 2021 16:37:04 +0100	[thread overview]
Message-ID: <20210308153705.37414-4-nirmoy.das@amd.com> (raw)
In-Reply-To: <20210308153705.37414-1-nirmoy.das@amd.com>

Use amdgpu_bo_create_user() for all the BO allocations for
ttm_bo_type_device type.

CC: felix.kuehling@amd.com
Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 4 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c    | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
index f44185f512de..00ac5c272f47 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
@@ -316,6 +316,7 @@ int amdgpu_amdkfd_alloc_gws(struct kgd_dev *kgd, size_t size,
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)kgd;
 	struct amdgpu_bo *bo = NULL;
+	struct amdgpu_bo_user *ubo;
 	struct amdgpu_bo_param bp;
 	int r;

@@ -327,13 +328,14 @@ int amdgpu_amdkfd_alloc_gws(struct kgd_dev *kgd, size_t size,
 	bp.type = ttm_bo_type_device;
 	bp.resv = NULL;

-	r = amdgpu_bo_create(adev, &bp, &bo);
+	r = amdgpu_bo_create_user(adev, &bp, &ubo);
 	if (r) {
 		dev_err(adev->dev,
 			"failed to allocate gws BO for amdkfd (%d)\n", r);
 		return r;
 	}

+	bo = &ubo->bo;
 	*mem_obj = bo;
 	return 0;
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index fb7171e5507c..beff96ddc0b4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -58,6 +58,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
 			     struct drm_gem_object **obj)
 {
 	struct amdgpu_bo *bo;
+	struct amdgpu_bo_user *ubo;
 	struct amdgpu_bo_param bp;
 	int r;

@@ -71,10 +72,11 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
 	bp.preferred_domain = initial_domain;
 	bp.flags = flags;
 	bp.domain = initial_domain;
-	r = amdgpu_bo_create(adev, &bp, &bo);
+	r = amdgpu_bo_create_user(adev, &bp, &ubo);
 	if (r)
 		return r;

+	bo = &ubo->bo;
 	*obj = &bo->tbo.base;
 	(*obj)->funcs = &amdgpu_gem_object_funcs;

--
2.30.1

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

  parent reply	other threads:[~2021-03-08 15:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 15:37 [PATCH 1/5] drm/amdgpu: allow variable BO struct creation Nirmoy Das
2021-03-08 15:37 ` [PATCH 2/5] drm/amdgpu: introduce struct amdgpu_bo_user Nirmoy Das
2021-03-08 20:24   ` Christian König
2021-03-08 15:37 ` [PATCH 3/5] drm/amdgpu: fb BO should be ttm_bo_type_device Nirmoy Das
2021-03-08 20:20   ` Christian König
2021-03-08 20:34     ` Alex Deucher
2021-03-08 20:36       ` Christian König
2021-03-08 15:37 ` Nirmoy Das [this message]
2021-03-08 15:37 ` [PATCH 5/5] drm/amdgpu: use amdgpu_bo_user bo for metadata and tiling flag Nirmoy Das
2021-03-08 20:23   ` Christian König
2021-03-08 18:12 ` [PATCH 1/5] drm/amdgpu: allow variable BO struct creation Christian König
2021-03-09  8:46 [PATCH v2 " Nirmoy Das
2021-03-09  8:46 ` [PATCH 4/5] drm/amdgpu: use amdgpu_bo_create_user() for when possible Nirmoy Das
2021-03-09 12:40   ` Christian König

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=20210308153705.37414-4-nirmoy.das@amd.com \
    --to=nirmoy.das@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=felix.kuehling@amd.com \
    /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 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.