* [PATCH] accel/amdxdna: Resume power for creating and destroying hardware context
@ 2025-10-08 4:53 Lizhi Hou
2025-10-08 15:03 ` Mario Limonciello
0 siblings, 1 reply; 3+ messages in thread
From: Lizhi Hou @ 2025-10-08 4:53 UTC (permalink / raw)
To: ogabbay, quic_jhugo, maciej.falkowski, dri-devel
Cc: Lizhi Hou, linux-kernel, max.zhen, sonal.santan,
mario.limonciello
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.
Fixes: 063db451832b ("accel/amdxdna: Enhance runtime power management")
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
---
drivers/accel/amdxdna/aie2_ctx.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c
index 691fdb3b008f..ab4d66f1325d 100644
--- a/drivers/accel/amdxdna/aie2_ctx.c
+++ b/drivers/accel/amdxdna/aie2_ctx.c
@@ -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:
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] accel/amdxdna: Resume power for creating and destroying hardware context
2025-10-08 4:53 [PATCH] accel/amdxdna: Resume power for creating and destroying hardware context Lizhi Hou
@ 2025-10-08 15:03 ` Mario Limonciello
2025-10-08 15:39 ` Lizhi Hou
0 siblings, 1 reply; 3+ messages in thread
From: Mario Limonciello @ 2025-10-08 15:03 UTC (permalink / raw)
To: Lizhi Hou, ogabbay, quic_jhugo, maciej.falkowski, dri-devel
Cc: linux-kernel, max.zhen, sonal.santan
On 10/7/25 11:53 PM, Lizhi Hou wrote:
> 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.
>
> Fixes: 063db451832b ("accel/amdxdna: Enhance runtime power management")
> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
> ---
> drivers/accel/amdxdna/aie2_ctx.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/accel/amdxdna/aie2_ctx.c b/drivers/accel/amdxdna/aie2_ctx.c
> index 691fdb3b008f..ab4d66f1325d 100644
> --- a/drivers/accel/amdxdna/aie2_ctx.c
> +++ b/drivers/accel/amdxdna/aie2_ctx.c
> @@ -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:
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] accel/amdxdna: Resume power for creating and destroying hardware context
2025-10-08 15:03 ` Mario Limonciello
@ 2025-10-08 15:39 ` Lizhi Hou
0 siblings, 0 replies; 3+ messages in thread
From: Lizhi Hou @ 2025-10-08 15:39 UTC (permalink / raw)
To: Mario Limonciello, ogabbay, quic_jhugo, maciej.falkowski,
dri-devel
Cc: linux-kernel, max.zhen, sonal.santan
Applied to drm-misc-next
On 10/8/25 08:03, Mario Limonciello wrote:
> On 10/7/25 11:53 PM, Lizhi Hou wrote:
>> 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.
>>
>> Fixes: 063db451832b ("accel/amdxdna: Enhance runtime power management")
>> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
>
> Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
>
>> ---
>> drivers/accel/amdxdna/aie2_ctx.c | 9 ++++++++-
>> 1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/accel/amdxdna/aie2_ctx.c
>> b/drivers/accel/amdxdna/aie2_ctx.c
>> index 691fdb3b008f..ab4d66f1325d 100644
>> --- a/drivers/accel/amdxdna/aie2_ctx.c
>> +++ b/drivers/accel/amdxdna/aie2_ctx.c
>> @@ -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:
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-08 15:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-08 4:53 [PATCH] accel/amdxdna: Resume power for creating and destroying hardware context Lizhi Hou
2025-10-08 15:03 ` Mario Limonciello
2025-10-08 15:39 ` Lizhi Hou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).