diff mbox series

[v2,2/2] platform/x86/amd/pmf: Fix TEE enact command failure after suspend and resume

Message ID 20240213073651.404220-2-Shyam-sundar.S-k@amd.com (mailing list archive)
State Superseded, archived
Headers show
Series [v2,1/2] platform/x86/amd/pmf: remove smart_pc_status enum | expand

Commit Message

Shyam Sundar S K Feb. 13, 2024, 7:36 a.m. UTC
TEE enact command failures are seen after each suspend/resume cycle;
fix this by cancelling the policy builder workqueue before going into
suspend and reschedule the workqueue after resume.

[  629.516792] ccp 0000:c2:00.2: tee: command 0x5 timed out, disabling PSP
[  629.516835] amd-pmf AMDI0102:00: TEE enact cmd failed. err: ffff000e, ret:0
[  630.550464] amd-pmf AMDI0102:00: AMD_PMF_REGISTER_RESPONSE:1
[  630.550511] amd-pmf AMDI0102:00: AMD_PMF_REGISTER_ARGUMENT:7
[  630.550548] amd-pmf AMDI0102:00: AMD_PMF_REGISTER_MESSAGE:16

Fixes: ae82cef7d9c5 ("platform/x86/amd/pmf: Add support for PMF-TA interaction")
Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---

v1->v2:
- remove enum smart_pc_status and adjust the code handling

 drivers/platform/x86/amd/pmf/core.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Mario Limonciello Feb. 13, 2024, 2:59 p.m. UTC | #1
On 2/13/2024 01:36, Shyam Sundar S K wrote:
> TEE enact command failures are seen after each suspend/resume cycle;
> fix this by cancelling the policy builder workqueue before going into
> suspend and reschedule the workqueue after resume.
> 
> [  629.516792] ccp 0000:c2:00.2: tee: command 0x5 timed out, disabling PSP
> [  629.516835] amd-pmf AMDI0102:00: TEE enact cmd failed. err: ffff000e, ret:0
> [  630.550464] amd-pmf AMDI0102:00: AMD_PMF_REGISTER_RESPONSE:1
> [  630.550511] amd-pmf AMDI0102:00: AMD_PMF_REGISTER_ARGUMENT:7
> [  630.550548] amd-pmf AMDI0102:00: AMD_PMF_REGISTER_MESSAGE:16
> 
> Fixes: ae82cef7d9c5 ("platform/x86/amd/pmf: Add support for PMF-TA interaction")
> Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>

I think you're missing a Co-Develped-by tag here.

> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>

> ---
> 
> v1->v2:
> - remove enum smart_pc_status and adjust the code handling
> 
>   drivers/platform/x86/amd/pmf/core.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/platform/x86/amd/pmf/core.c b/drivers/platform/x86/amd/pmf/core.c
> index ff0d61a56484..0645164c25a0 100644
> --- a/drivers/platform/x86/amd/pmf/core.c
> +++ b/drivers/platform/x86/amd/pmf/core.c
> @@ -296,6 +296,9 @@ static int amd_pmf_suspend_handler(struct device *dev)
>   {
>   	struct amd_pmf_dev *pdev = dev_get_drvdata(dev);
>   
> +	if (pdev->smart_pc_enabled)
> +		cancel_delayed_work_sync(&pdev->pb_work);
> +
>   	kfree(pdev->buf);
>   
>   	return 0;
> @@ -312,6 +315,9 @@ static int amd_pmf_resume_handler(struct device *dev)
>   			return ret;
>   	}
>   
> +	if (pdev->smart_pc_enabled)
> +		schedule_delayed_work(&pdev->pb_work, msecs_to_jiffies(2000));
> +
>   	return 0;
>   }
>
diff mbox series

Patch

diff --git a/drivers/platform/x86/amd/pmf/core.c b/drivers/platform/x86/amd/pmf/core.c
index ff0d61a56484..0645164c25a0 100644
--- a/drivers/platform/x86/amd/pmf/core.c
+++ b/drivers/platform/x86/amd/pmf/core.c
@@ -296,6 +296,9 @@  static int amd_pmf_suspend_handler(struct device *dev)
 {
 	struct amd_pmf_dev *pdev = dev_get_drvdata(dev);
 
+	if (pdev->smart_pc_enabled)
+		cancel_delayed_work_sync(&pdev->pb_work);
+
 	kfree(pdev->buf);
 
 	return 0;
@@ -312,6 +315,9 @@  static int amd_pmf_resume_handler(struct device *dev)
 			return ret;
 	}
 
+	if (pdev->smart_pc_enabled)
+		schedule_delayed_work(&pdev->pb_work, msecs_to_jiffies(2000));
+
 	return 0;
 }