Commit 501d9438 authored by Matthew Brost's avatar Matthew Brost

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: default avatarMatthew Brost <matthew.brost@intel.com>
Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240820172958.1095143-7-matthew.brost@intel.com
parent 6eb2aad4
...@@ -25,10 +25,9 @@ static void xe_sa_bo_manager_fini(struct drm_device *drm, void *arg) ...@@ -25,10 +25,9 @@ static void xe_sa_bo_manager_fini(struct drm_device *drm, void *arg)
drm_suballoc_manager_fini(&sa_manager->base); drm_suballoc_manager_fini(&sa_manager->base);
if (bo->vmap.is_iomem) if (sa_manager->is_iomem)
kvfree(sa_manager->cpu_ptr); kvfree(sa_manager->cpu_ptr);
xe_bo_unpin_map_no_vm(bo);
sa_manager->bo = NULL; sa_manager->bo = NULL;
} }
...@@ -47,16 +46,17 @@ struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32 ...@@ -47,16 +46,17 @@ struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32
sa_manager->bo = NULL; sa_manager->bo = NULL;
bo = xe_bo_create_pin_map(xe, tile, NULL, size, ttm_bo_type_kernel, bo = xe_managed_bo_create_pin_map(xe, tile, size,
XE_BO_FLAG_VRAM_IF_DGFX(tile) | XE_BO_FLAG_VRAM_IF_DGFX(tile) |
XE_BO_FLAG_GGTT | XE_BO_FLAG_GGTT |
XE_BO_FLAG_GGTT_INVALIDATE); XE_BO_FLAG_GGTT_INVALIDATE);
if (IS_ERR(bo)) { if (IS_ERR(bo)) {
drm_err(&xe->drm, "failed to allocate bo for sa manager: %ld\n", drm_err(&xe->drm, "failed to allocate bo for sa manager: %ld\n",
PTR_ERR(bo)); PTR_ERR(bo));
return (struct xe_sa_manager *)bo; return (struct xe_sa_manager *)bo;
} }
sa_manager->bo = bo; sa_manager->bo = bo;
sa_manager->is_iomem = bo->vmap.is_iomem;
drm_suballoc_manager_init(&sa_manager->base, managed_size, align); drm_suballoc_manager_init(&sa_manager->base, managed_size, align);
sa_manager->gpu_addr = xe_bo_ggtt_addr(bo); 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 ...@@ -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) { if (bo->vmap.is_iomem) {
sa_manager->cpu_ptr = kvzalloc(managed_size, GFP_KERNEL); sa_manager->cpu_ptr = kvzalloc(managed_size, GFP_KERNEL);
if (!sa_manager->cpu_ptr) { if (!sa_manager->cpu_ptr) {
xe_bo_unpin_map_no_vm(sa_manager->bo);
sa_manager->bo = NULL; sa_manager->bo = NULL;
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
......
...@@ -14,6 +14,7 @@ struct xe_sa_manager { ...@@ -14,6 +14,7 @@ struct xe_sa_manager {
struct xe_bo *bo; struct xe_bo *bo;
u64 gpu_addr; u64 gpu_addr;
void *cpu_ptr; void *cpu_ptr;
bool is_iomem;
}; };
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment