Commit 152c37bf authored by Rodrigo Vivi's avatar Rodrigo Vivi

drm/xe: Remove useless mem_access during probe

xe_pm_init is the very last thing during the xe_pci_probe(),
hence these protections are useless from the point of view
of ensuring that the device is awake.

Let's remove it so we continue towards the goal of killing
xe_device_mem_access.

v2: Adding more cases
v3: Provide a separate fix for xe_tile_init_noalloc return (Matt)
    Adding a new case where display HDCP init calls which
    are also called at display probe time.

Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240417203952.25503-5-rodrigo.vivi@intel.comSigned-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 8ae84a27
...@@ -70,7 +70,6 @@ static int intel_hdcp_gsc_initialize_message(struct xe_device *xe, ...@@ -70,7 +70,6 @@ static int intel_hdcp_gsc_initialize_message(struct xe_device *xe,
int ret = 0; int ret = 0;
/* allocate object of two page for HDCP command memory and store it */ /* allocate object of two page for HDCP command memory and store it */
xe_device_mem_access_get(xe);
bo = xe_bo_create_pin_map(xe, xe_device_get_root_tile(xe), NULL, PAGE_SIZE * 2, bo = xe_bo_create_pin_map(xe, xe_device_get_root_tile(xe), NULL, PAGE_SIZE * 2,
ttm_bo_type_kernel, ttm_bo_type_kernel,
XE_BO_FLAG_SYSTEM | XE_BO_FLAG_SYSTEM |
...@@ -90,7 +89,6 @@ static int intel_hdcp_gsc_initialize_message(struct xe_device *xe, ...@@ -90,7 +89,6 @@ static int intel_hdcp_gsc_initialize_message(struct xe_device *xe,
hdcp_message->hdcp_cmd_in = cmd_in; hdcp_message->hdcp_cmd_in = cmd_in;
hdcp_message->hdcp_cmd_out = cmd_out; hdcp_message->hdcp_cmd_out = cmd_out;
out: out:
xe_device_mem_access_put(xe);
return ret; return ret;
} }
......
...@@ -203,14 +203,12 @@ static void xe_ggtt_initial_clear(struct xe_ggtt *ggtt) ...@@ -203,14 +203,12 @@ static void xe_ggtt_initial_clear(struct xe_ggtt *ggtt)
u64 start, end; u64 start, end;
/* Display may have allocated inside ggtt, so be careful with clearing here */ /* Display may have allocated inside ggtt, so be careful with clearing here */
xe_device_mem_access_get(tile_to_xe(ggtt->tile));
mutex_lock(&ggtt->lock); mutex_lock(&ggtt->lock);
drm_mm_for_each_hole(hole, &ggtt->mm, start, end) drm_mm_for_each_hole(hole, &ggtt->mm, start, end)
xe_ggtt_clear(ggtt, start, end - start); xe_ggtt_clear(ggtt, start, end - start);
xe_ggtt_invalidate(ggtt); xe_ggtt_invalidate(ggtt);
mutex_unlock(&ggtt->lock); mutex_unlock(&ggtt->lock);
xe_device_mem_access_put(tile_to_xe(ggtt->tile));
} }
int xe_ggtt_init(struct xe_ggtt *ggtt) int xe_ggtt_init(struct xe_ggtt *ggtt)
......
...@@ -354,7 +354,6 @@ static int gt_fw_domain_init(struct xe_gt *gt) ...@@ -354,7 +354,6 @@ static int gt_fw_domain_init(struct xe_gt *gt)
{ {
int err, i; int err, i;
xe_device_mem_access_get(gt_to_xe(gt));
err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT); err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
if (err) if (err)
goto err_hw_fence_irq; goto err_hw_fence_irq;
...@@ -396,7 +395,6 @@ static int gt_fw_domain_init(struct xe_gt *gt) ...@@ -396,7 +395,6 @@ static int gt_fw_domain_init(struct xe_gt *gt)
err = xe_force_wake_put(gt_to_fw(gt), XE_FW_GT); err = xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
XE_WARN_ON(err); XE_WARN_ON(err);
xe_device_mem_access_put(gt_to_xe(gt));
return 0; return 0;
...@@ -406,7 +404,6 @@ static int gt_fw_domain_init(struct xe_gt *gt) ...@@ -406,7 +404,6 @@ static int gt_fw_domain_init(struct xe_gt *gt)
err_hw_fence_irq: err_hw_fence_irq:
for (i = 0; i < XE_ENGINE_CLASS_MAX; ++i) for (i = 0; i < XE_ENGINE_CLASS_MAX; ++i)
xe_hw_fence_irq_finish(&gt->fence_irq[i]); xe_hw_fence_irq_finish(&gt->fence_irq[i]);
xe_device_mem_access_put(gt_to_xe(gt));
return err; return err;
} }
...@@ -415,7 +412,6 @@ static int all_fw_domain_init(struct xe_gt *gt) ...@@ -415,7 +412,6 @@ static int all_fw_domain_init(struct xe_gt *gt)
{ {
int err, i; int err, i;
xe_device_mem_access_get(gt_to_xe(gt));
err = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL); err = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
if (err) if (err)
goto err_hw_fence_irq; goto err_hw_fence_irq;
...@@ -481,7 +477,6 @@ static int all_fw_domain_init(struct xe_gt *gt) ...@@ -481,7 +477,6 @@ static int all_fw_domain_init(struct xe_gt *gt)
err = xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL); err = xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
XE_WARN_ON(err); XE_WARN_ON(err);
xe_device_mem_access_put(gt_to_xe(gt));
return 0; return 0;
...@@ -490,7 +485,6 @@ static int all_fw_domain_init(struct xe_gt *gt) ...@@ -490,7 +485,6 @@ static int all_fw_domain_init(struct xe_gt *gt)
err_hw_fence_irq: err_hw_fence_irq:
for (i = 0; i < XE_ENGINE_CLASS_MAX; ++i) for (i = 0; i < XE_ENGINE_CLASS_MAX; ++i)
xe_hw_fence_irq_finish(&gt->fence_irq[i]); xe_hw_fence_irq_finish(&gt->fence_irq[i]);
xe_device_mem_access_put(gt_to_xe(gt));
return err; return err;
} }
...@@ -503,7 +497,6 @@ int xe_gt_init_hwconfig(struct xe_gt *gt) ...@@ -503,7 +497,6 @@ int xe_gt_init_hwconfig(struct xe_gt *gt)
{ {
int err; int err;
xe_device_mem_access_get(gt_to_xe(gt));
err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT); err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
if (err) if (err)
goto out; goto out;
...@@ -526,8 +519,6 @@ int xe_gt_init_hwconfig(struct xe_gt *gt) ...@@ -526,8 +519,6 @@ int xe_gt_init_hwconfig(struct xe_gt *gt)
out_fw: out_fw:
xe_force_wake_put(gt_to_fw(gt), XE_FW_GT); xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
out: out:
xe_device_mem_access_put(gt_to_xe(gt));
return err; return err;
} }
......
...@@ -160,24 +160,19 @@ int xe_tile_init_noalloc(struct xe_tile *tile) ...@@ -160,24 +160,19 @@ int xe_tile_init_noalloc(struct xe_tile *tile)
{ {
int err; int err;
xe_device_mem_access_get(tile_to_xe(tile));
err = tile_ttm_mgr_init(tile); err = tile_ttm_mgr_init(tile);
if (err) if (err)
goto err_mem_access; return err;
tile->mem.kernel_bb_pool = xe_sa_bo_manager_init(tile, SZ_1M, 16); tile->mem.kernel_bb_pool = xe_sa_bo_manager_init(tile, SZ_1M, 16);
if (IS_ERR(tile->mem.kernel_bb_pool)) { if (IS_ERR(tile->mem.kernel_bb_pool))
err = PTR_ERR(tile->mem.kernel_bb_pool); return PTR_ERR(tile->mem.kernel_bb_pool);
goto err_mem_access;
}
xe_wa_apply_tile_workarounds(tile); xe_wa_apply_tile_workarounds(tile);
xe_tile_sysfs_init(tile); xe_tile_sysfs_init(tile);
err_mem_access: return 0;
xe_device_mem_access_put(tile_to_xe(tile));
return err;
} }
void xe_tile_migrate_wait(struct xe_tile *tile) void xe_tile_migrate_wait(struct xe_tile *tile)
......
...@@ -32,11 +32,8 @@ uc_to_xe(struct xe_uc *uc) ...@@ -32,11 +32,8 @@ uc_to_xe(struct xe_uc *uc)
/* Should be called once at driver load only */ /* Should be called once at driver load only */
int xe_uc_init(struct xe_uc *uc) int xe_uc_init(struct xe_uc *uc)
{ {
struct xe_device *xe = uc_to_xe(uc);
int ret; int ret;
xe_device_mem_access_get(xe);
/* /*
* We call the GuC/HuC/GSC init functions even if GuC submission is off * We call the GuC/HuC/GSC init functions even if GuC submission is off
* to correctly move our tracking of the FW state to "disabled". * to correctly move our tracking of the FW state to "disabled".
...@@ -65,16 +62,8 @@ int xe_uc_init(struct xe_uc *uc) ...@@ -65,16 +62,8 @@ int xe_uc_init(struct xe_uc *uc)
goto err; goto err;
ret = xe_guc_db_mgr_init(&uc->guc.dbm, ~0); ret = xe_guc_db_mgr_init(&uc->guc.dbm, ~0);
if (ret)
goto err;
xe_device_mem_access_put(xe);
return 0;
err: err:
xe_device_mem_access_put(xe);
return ret; return ret;
} }
......
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