Skip to contentSkip to conversation

drm/xe: Simplify xe_res_get_buddy()

PATCH In review Brian Welty 3 participants 3 messages Oct 19, 2023 – Oct 23, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/xe: Simplify xe_res_get_buddy()

We can remove the unnecessary indirection thru xe->tiles[] to get the TTM VRAM manager. This code can be common for VRAM and STOLEN.

---
 drivers/gpu/drm/xe/xe_res_cursor.h | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/xe/xe_res_cursor.h +1 -6
index 5cb4b66a5d74..006fc1361967 100644
@@ -50,14 +50,9 @@ struct xe_res_cursor {
 
 static struct drm_buddy *xe_res_get_buddy(struct ttm_resource *res)
 {
-	struct xe_device *xe = ttm_to_xe_device(res->bo->bdev);
 	struct ttm_resource_manager *mgr;
 
-	if (res->mem_type != XE_PL_STOLEN)
-		return &xe->tiles[res->mem_type - XE_PL_VRAM0].mem.vram_mgr->mm;
-
-	mgr = ttm_manager_type(&xe->ttm, XE_PL_STOLEN);
-
+	mgr = ttm_manager_type(res->bo->bdev, res->mem_type);
 	return &to_xe_ttm_vram_mgr(mgr)->mm;
 }
 
Signature · 1 line
2.38.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Brian Welty

We can remove the unnecessary indirection thru xe->tiles[] to get the TTM VRAM manager. This code can be common for VRAM and STOLEN.

Quoted 27 lines
---
 drivers/gpu/drm/xe/xe_res_cursor.h | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/xe/xe_res_cursor.h +1 -6
index 5cb4b66a5d74..006fc1361967 100644
@@ -50,14 +50,9 @@ struct xe_res_cursor {
 
 static struct drm_buddy *xe_res_get_buddy(struct ttm_resource *res)
 {
-	struct xe_device *xe = ttm_to_xe_device(res->bo->bdev);
 	struct ttm_resource_manager *mgr;
 
-	if (res->mem_type != XE_PL_STOLEN)
-		return &xe->tiles[res->mem_type - XE_PL_VRAM0].mem.vram_mgr->mm;
-
-	mgr = ttm_manager_type(&xe->ttm, XE_PL_STOLEN);
-
+	mgr = ttm_manager_type(res->bo->bdev, res->mem_type);
 	return &to_xe_ttm_vram_mgr(mgr)->mm;
 }
 
Signature · 1 line
2.38.0
#2 lore raw

[Intel-xe] ✗ CI.Patch_applied: failure for drm/xe: Simplify xe_res_get_buddy()

In reply to Brian Welty
== Series Details ==

== Series Details ==

Series: drm/xe: Simplify xe_res_get_buddy()
URL : https://patchwork.freedesktop.org/series/125358/
State : failure

== Summary ==

=== Applying kernel patches on branch 'drm-xe-next' with base: === Base commit: 4354e27ef drm/xe: Simplify xe_res_get_buddy() === git am output follows ===
error: patch failed: drivers/gpu/drm/xe/xe_res_cursor.h:50
error: drivers/gpu/drm/xe/xe_res_cursor.h: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Applying: drm/xe: Simplify xe_res_get_buddy()
Patch failed at 0001 drm/xe: Simplify xe_res_get_buddy() When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".