accel/amdxdna: Resume power for creating and destroying hardware context
Lizhi Hou
maintainerPATCH 1/1 accel/amdxdna: Resume power for creating and destroying hardware context
When the hardware is powered down by auto-suspend, creating or destroying a hardware context without resuming power will fail.
Call amdxdna_pm_resume_get() before requesting the hardware to create or destroy a hardware context.
--- drivers/accel/amdxdna/aie2_ctx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/accel/amdxdna/aie2_ctx.c +8 -1
@@ -610,10 +610,14 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx) goto free_entity; } + ret =amdxdna_pm_resume_get (xdna); +if (ret) + goto free_col_list; + ret =aie2_alloc_resource (hwctx);if (ret) {XDNA_ERR (xdna,"Alloc hw resource failed, ret %d" , ret); - goto free_col_list; + goto suspend_put; } ret = aie2_map_host_buf(xdna->dev_handle, hwctx->fw_ctx_id,
@@ -628,6 +632,7 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx)XDNA_ERR (xdna,"Create syncobj failed, ret %d" , ret); goto release_resource; } +amdxdna_pm_suspend_put (xdna); hwctx->status =HWCTX_STAT_INIT ; ndev = xdna->dev_handle;
@@ -640,6 +645,8 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx) release_resource:aie2_release_resource (hwctx); +suspend_put: +amdxdna_pm_suspend_put (xdna); free_col_list:kfree (hwctx->col_list); free_entity:
Signature · 1 line
2.34.1
Quoted 7 lines · Lizhi Hou
When the hardware is powered down by auto-suspend, creating or destroying a hardware context without resuming power will fail.
Callamdxdna_pm_resume_get()before requesting the hardware to create or destroy a hardware context.Fixes 063db451832b ("accel/amdxdna: Enhance runtime power management")Signed-off-by Lizhi Hou <[email protected]>
Quoted 41 lines
--- drivers/accel/amdxdna/aie2_ctx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)drivers/accel/amdxdna/aie2_ctx.c +8
-1@@ -610,10 +610,14 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx) goto free_entity; } + ret =amdxdna_pm_resume_get (xdna); +if (ret) + goto free_col_list; + ret =aie2_alloc_resource (hwctx);if (ret) {XDNA_ERR (xdna,"Alloc hw resource failed, ret %d" , ret); - goto free_col_list; + goto suspend_put; } ret = aie2_map_host_buf(xdna->dev_handle, hwctx->fw_ctx_id,@@ -628,6 +632,7 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx)XDNA_ERR (xdna,"Create syncobj failed, ret %d" , ret); goto release_resource; } +amdxdna_pm_suspend_put (xdna); hwctx->status =HWCTX_STAT_INIT ; ndev = xdna->dev_handle;@@ -640,6 +645,8 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx) release_resource:aie2_release_resource (hwctx); +suspend_put: +amdxdna_pm_suspend_put (xdna); free_col_list:kfree (hwctx->col_list); free_entity:
Applied to drm-misc-next
Quoted 49 lines · Mario Limonciello
Quoted 7 lines · Lizhi Hou
When the hardware is powered down by auto-suspend, creating or destroying a hardware context without resuming power will fail.
Callamdxdna_pm_resume_get()before requesting the hardware to create or destroy a hardware context.Fixes 063db451832b ("accel/amdxdna: Enhance runtime power management")Signed-off-by Lizhi Hou <[email protected]>Reviewed-by Mario Limonciello (AMD) <[email protected]>Quoted 37 lines
---
drivers/accel/amdxdna/aie2_ctx.c| 9 ++++++++-1 file changed, 8 insertions(+), 1 deletion(-)drivers/accel/amdxdna/aie2_ctx.c +5
-1@@ -610,10 +610,14 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx) goto free_entity; } + ret = amdxdna_pm_resume_get(xdna); + if (ret) + goto free_col_list; + ret = aie2_alloc_resource(hwctx); if (ret) { XDNA_ERR(xdna, "Alloc hw resource failed, ret %d", ret); - goto free_col_list; + goto suspend_put; } ret = aie2_map_host_buf(xdna->dev_handle, hwctx->fw_ctx_id,@@ -628,6 +632,7 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx) XDNA_ERR(xdna, "Create syncobj failed, ret %d", ret); goto release_resource; } + amdxdna_pm_suspend_put(xdna); hwctx->status = HWCTX_STAT_INIT; ndev = xdna->dev_handle;@@ -640,6 +645,8 @@ int aie2_hwctx_init(struct amdxdna_hwctx *hwctx)
release_resource:
aie2_release_resource(hwctx);
+suspend_put:
+amdxdna_pm_suspend_put(xdna);
free_col_list:
kfree(hwctx->col_list);
free_entity: