summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xe/xe_hw_engine.c
diff options
context:
space:
mode:
authorMatthew Auld <matthew.auld@intel.com>2022-12-22 13:53:59 +0300
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-20 02:29:43 +0300
commite103c45f501a32eaa9e0a12db1c1e167b06f78cf (patch)
tree65c68c02663941ca55d281b285311f27aaae6e0c /drivers/gpu/drm/xe/xe_hw_engine.c
parent90385dcfc040648e928a883298a19e2afbba41e5 (diff)
downloadlinux-e103c45f501a32eaa9e0a12db1c1e167b06f78cf.tar.xz
drm/xe: prefer xe_bo_create_pin_map()
With small-bar we likely want to annotate all the kernel users that require CPU access with vram. If xe_bo_create_pin_map() is the central place for that then we should have a central place to annotate. This also simplifies the code and fixes what appears to be a double xe_bo_put(hwe->hwsp) in the error handling. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/xe/xe_hw_engine.c')
-rw-r--r--drivers/gpu/drm/xe/xe_hw_engine.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c b/drivers/gpu/drm/xe/xe_hw_engine.c
index ae541b5e50f3..b035e2fa6744 100644
--- a/drivers/gpu/drm/xe/xe_hw_engine.c
+++ b/drivers/gpu/drm/xe/xe_hw_engine.c
@@ -310,24 +310,14 @@ static int hw_engine_init(struct xe_gt *gt, struct xe_hw_engine *hwe,
xe_reg_sr_apply_mmio(&hwe->reg_sr, gt);
xe_reg_sr_apply_whitelist(&hwe->reg_whitelist, hwe->mmio_base, gt);
- hwe->hwsp = xe_bo_create_locked(xe, gt, NULL, SZ_4K, ttm_bo_type_kernel,
- XE_BO_CREATE_VRAM_IF_DGFX(gt) |
- XE_BO_CREATE_GGTT_BIT);
+ hwe->hwsp = xe_bo_create_pin_map(xe, gt, NULL, SZ_4K, ttm_bo_type_kernel,
+ XE_BO_CREATE_VRAM_IF_DGFX(gt) |
+ XE_BO_CREATE_GGTT_BIT);
if (IS_ERR(hwe->hwsp)) {
err = PTR_ERR(hwe->hwsp);
goto err_name;
}
- err = xe_bo_pin(hwe->hwsp);
- if (err)
- goto err_unlock_put_hwsp;
-
- err = xe_bo_vmap(hwe->hwsp);
- if (err)
- goto err_unpin_hwsp;
-
- xe_bo_unlock_no_vm(hwe->hwsp);
-
err = xe_lrc_init(&hwe->kernel_lrc, hwe, NULL, NULL, SZ_16K);
if (err)
goto err_hwsp;
@@ -353,15 +343,10 @@ static int hw_engine_init(struct xe_gt *gt, struct xe_hw_engine *hwe,
return 0;
-err_unpin_hwsp:
- xe_bo_unpin(hwe->hwsp);
-err_unlock_put_hwsp:
- xe_bo_unlock_no_vm(hwe->hwsp);
- xe_bo_put(hwe->hwsp);
err_kernel_lrc:
xe_lrc_finish(&hwe->kernel_lrc);
err_hwsp:
- xe_bo_put(hwe->hwsp);
+ xe_bo_unpin_map_no_vm(hwe->hwsp);
err_name:
hwe->name = NULL;