Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: intel-xe@lists.freedesktop.org
Subject: [PATCH 11/11] drm/xe: Update xe_sa to use xe_managed_bo_create_pin_map
Date: Fri,  9 Aug 2024 18:55:44 -0700	[thread overview]
Message-ID: <20240810015544.3443258-12-matthew.brost@intel.com> (raw)
In-Reply-To: <20240810015544.3443258-1-matthew.brost@intel.com>

Preferred way to create kernel BOs is xe_managed_bo_create_pin_map, use
it.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_sa.c       | 13 ++++++-------
 drivers/gpu/drm/xe/xe_sa_types.h |  1 +
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_sa.c b/drivers/gpu/drm/xe/xe_sa.c
index f3060979e63f..fe2cb2a96f78 100644
--- a/drivers/gpu/drm/xe/xe_sa.c
+++ b/drivers/gpu/drm/xe/xe_sa.c
@@ -25,10 +25,9 @@ static void xe_sa_bo_manager_fini(struct drm_device *drm, void *arg)
 
 	drm_suballoc_manager_fini(&sa_manager->base);
 
-	if (bo->vmap.is_iomem)
+	if (sa_manager->is_iomem)
 		kvfree(sa_manager->cpu_ptr);
 
-	xe_bo_unpin_map_no_vm(bo);
 	sa_manager->bo = NULL;
 }
 
@@ -47,16 +46,17 @@ struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32
 
 	sa_manager->bo = NULL;
 
-	bo = xe_bo_create_pin_map(xe, tile, NULL, size, ttm_bo_type_kernel,
-				  XE_BO_FLAG_VRAM_IF_DGFX(tile) |
-				  XE_BO_FLAG_GGTT |
-				  XE_BO_FLAG_GGTT_INVALIDATE);
+	bo = xe_managed_bo_create_pin_map(xe, tile, size,
+					  XE_BO_FLAG_VRAM_IF_DGFX(tile) |
+					  XE_BO_FLAG_GGTT |
+					  XE_BO_FLAG_GGTT_INVALIDATE);
 	if (IS_ERR(bo)) {
 		drm_err(&xe->drm, "failed to allocate bo for sa manager: %ld\n",
 			PTR_ERR(bo));
 		return (struct xe_sa_manager *)bo;
 	}
 	sa_manager->bo = bo;
+	sa_manager->is_iomem = bo->vmap.is_iomem;
 
 	drm_suballoc_manager_init(&sa_manager->base, managed_size, align);
 	sa_manager->gpu_addr = xe_bo_ggtt_addr(bo);
@@ -64,7 +64,6 @@ struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32
 	if (bo->vmap.is_iomem) {
 		sa_manager->cpu_ptr = kvzalloc(managed_size, GFP_KERNEL);
 		if (!sa_manager->cpu_ptr) {
-			xe_bo_unpin_map_no_vm(sa_manager->bo);
 			sa_manager->bo = NULL;
 			return ERR_PTR(-ENOMEM);
 		}
diff --git a/drivers/gpu/drm/xe/xe_sa_types.h b/drivers/gpu/drm/xe/xe_sa_types.h
index 2ef896aeca1d..2b070ff1292e 100644
--- a/drivers/gpu/drm/xe/xe_sa_types.h
+++ b/drivers/gpu/drm/xe/xe_sa_types.h
@@ -14,6 +14,7 @@ struct xe_sa_manager {
 	struct xe_bo *bo;
 	u64 gpu_addr;
 	void *cpu_ptr;
+	bool is_iomem;
 };
 
 #endif
-- 
2.34.1


  parent reply	other threads:[~2024-08-10  1:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-10  1:55 [PATCH 00/11] Fix error paths in driver load Matthew Brost
2024-08-10  1:55 ` [PATCH 01/11] drm/xe: use devm instead of drmm for managed bo Matthew Brost
2024-08-10  1:55 ` [PATCH 02/11] drm/xe/uc: Use managed bo for HuC and GSC objects Matthew Brost
2024-08-10  1:55 ` [PATCH 03/11] drm/xe/uc: Use devm to register cleanup that includes exec_queues Matthew Brost
2024-08-10  1:55 ` [PATCH 04/11] drm/xe: Fix tile fini sequence Matthew Brost
2024-08-10  1:55 ` [PATCH 05/11] drm/xe: Add driver load error injection Matthew Brost
2024-08-10  1:55 ` [PATCH 06/11] drm/xe: Move ggtt_fini to devm managed Matthew Brost
2024-08-10  1:55 ` [PATCH 07/11] drm/xe: Set firmware state to loadable before registering guc_fini_hw Matthew Brost
2024-08-10  1:55 ` [PATCH 08/11] drm/xe: Drop warn on xe_guc_pc_gucrc_disable in guc pc fini Matthew Brost
2024-08-10  1:55 ` [PATCH 09/11] drm/xe: Move hw_engine_fini to devm managed Matthew Brost
2024-08-10  1:55 ` [PATCH 10/11] drm/xe: Move HuC init before GuC init Matthew Brost
2024-08-10  1:55 ` Matthew Brost [this message]
2024-08-10  2:01 ` ✓ CI.Patch_applied: success for Fix error paths in driver load Patchwork
2024-08-10  2:01 ` ✗ CI.checkpatch: warning " Patchwork
2024-08-10  2:01 ` ✗ CI.KUnit: failure " Patchwork

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=20240810015544.3443258-12-matthew.brost@intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@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