[PATCH v2 6/6] drm/xe: Update xe_sa to use xe_managed_bo_create_pin_map
Lucas De Marchi
lucas.demarchi at intel.com
Tue Aug 20 21:07:21 UTC 2024
On Tue, Aug 20, 2024 at 10:29:58AM GMT, Matthew Brost wrote:
>Preferred way to create kernel BOs is xe_managed_bo_create_pin_map, use
>it.
>
>Signed-off-by: Matthew Brost <matthew.brost at intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi at intel.com>
Lucas De Marchi
>---
> 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
>
More information about the Intel-xe
mailing list