Skip to content

Commit 501d943

Browse files
committed
drm/xe: Update xe_sa to use xe_managed_bo_create_pin_map
Preferred way to create kernel BOs is xe_managed_bo_create_pin_map, use it. Signed-off-by: Matthew Brost <[email protected]> Reviewed-by: Lucas De Marchi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 6eb2aad commit 501d943

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

drivers/gpu/drm/xe/xe_sa.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ static void xe_sa_bo_manager_fini(struct drm_device *drm, void *arg)
2525

2626
drm_suballoc_manager_fini(&sa_manager->base);
2727

28-
if (bo->vmap.is_iomem)
28+
if (sa_manager->is_iomem)
2929
kvfree(sa_manager->cpu_ptr);
3030

31-
xe_bo_unpin_map_no_vm(bo);
3231
sa_manager->bo = NULL;
3332
}
3433

@@ -47,24 +46,24 @@ struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32
4746

4847
sa_manager->bo = NULL;
4948

50-
bo = xe_bo_create_pin_map(xe, tile, NULL, size, ttm_bo_type_kernel,
51-
XE_BO_FLAG_VRAM_IF_DGFX(tile) |
52-
XE_BO_FLAG_GGTT |
53-
XE_BO_FLAG_GGTT_INVALIDATE);
49+
bo = xe_managed_bo_create_pin_map(xe, tile, size,
50+
XE_BO_FLAG_VRAM_IF_DGFX(tile) |
51+
XE_BO_FLAG_GGTT |
52+
XE_BO_FLAG_GGTT_INVALIDATE);
5453
if (IS_ERR(bo)) {
5554
drm_err(&xe->drm, "failed to allocate bo for sa manager: %ld\n",
5655
PTR_ERR(bo));
5756
return (struct xe_sa_manager *)bo;
5857
}
5958
sa_manager->bo = bo;
59+
sa_manager->is_iomem = bo->vmap.is_iomem;
6060

6161
drm_suballoc_manager_init(&sa_manager->base, managed_size, align);
6262
sa_manager->gpu_addr = xe_bo_ggtt_addr(bo);
6363

6464
if (bo->vmap.is_iomem) {
6565
sa_manager->cpu_ptr = kvzalloc(managed_size, GFP_KERNEL);
6666
if (!sa_manager->cpu_ptr) {
67-
xe_bo_unpin_map_no_vm(sa_manager->bo);
6867
sa_manager->bo = NULL;
6968
return ERR_PTR(-ENOMEM);
7069
}

drivers/gpu/drm/xe/xe_sa_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ struct xe_sa_manager {
1414
struct xe_bo *bo;
1515
u64 gpu_addr;
1616
void *cpu_ptr;
17+
bool is_iomem;
1718
};
1819

1920
#endif

0 commit comments

Comments
 (0)