diff mbox series

[1/1,SRU,Kinetic] UBUNTU: SAUCE: platform/x86/amd: pmc: Read SMU version during suspend on Cezanne systems

Message ID 20221021063348.3340028-2-vicamo.yang@canonical.com
State New
Headers show
Series [1/1,SRU,Kinetic] UBUNTU: SAUCE: platform/x86/amd: pmc: Read SMU version during suspend on Cezanne systems | expand

Commit Message

You-Sheng Yang Oct. 21, 2022, 6:33 a.m. UTC
From: Mario Limonciello <mario.limonciello@amd.com>

BugLink: https://bugs.launchpad.net/bugs/1993715

commit b0c07116c8943 ("platform/x86: amd-pmc: Avoid reading SMU version at
probe time") adjusted the behavior for amd-pmc to avoid reading the SMU version
at startup but rather on first use to improve boot time.

However the SMU version is also used to decide whether to place a timer based
wakeup in the OS_HINT message.  If the idlemask hasn't been read before this
message was sent then the SMU version will not have been cached.

Ensure the SMU version has been read before deciding whether or not to run this
codepath.

Cc: stable@vger.kernel.org # 6.0
Reported-by: You-Sheng Yang <vicamo.yang@canonical.com>
Tested-by: Anson Tsao <anson.tsao@amd.com>
Fixes: b0c07116c8943 ("platform/x86: amd-pmc: Avoid reading SMU version at probe time")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
(cherry-picked from https://lore.kernel.org/all/20221020113749.6621-1-mario.limonciello@amd.com/)
Signed-off-by: You-Sheng Yang (vicamo) <vicamo.yang@canonical.com>
---
 drivers/platform/x86/amd-pmc.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Tim Gardner Oct. 21, 2022, 12:17 p.m. UTC | #1
On 10/21/22 12:33 AM, You-Sheng Yang wrote:
> From: Mario Limonciello <mario.limonciello@amd.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1993715
> 
> commit b0c07116c8943 ("platform/x86: amd-pmc: Avoid reading SMU version at
> probe time") adjusted the behavior for amd-pmc to avoid reading the SMU version
> at startup but rather on first use to improve boot time.
> 
> However the SMU version is also used to decide whether to place a timer based
> wakeup in the OS_HINT message.  If the idlemask hasn't been read before this
> message was sent then the SMU version will not have been cached.
> 
> Ensure the SMU version has been read before deciding whether or not to run this
> codepath.
> 
> Cc: stable@vger.kernel.org # 6.0
> Reported-by: You-Sheng Yang <vicamo.yang@canonical.com>
> Tested-by: Anson Tsao <anson.tsao@amd.com>
> Fixes: b0c07116c8943 ("platform/x86: amd-pmc: Avoid reading SMU version at probe time")
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> (cherry-picked from https://lore.kernel.org/all/20221020113749.6621-1-mario.limonciello@amd.com/)
> Signed-off-by: You-Sheng Yang (vicamo) <vicamo.yang@canonical.com>
> ---
>   drivers/platform/x86/amd-pmc.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c
> index 700eb19e8450..fc326fdf483f 100644
> --- a/drivers/platform/x86/amd-pmc.c
> +++ b/drivers/platform/x86/amd-pmc.c
> @@ -635,6 +635,13 @@ static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg)
>   	struct rtc_time tm;
>   	int rc;
>   
> +	/* we haven't yet read SMU version */
> +	if (!pdev->major) {
> +		rc = amd_pmc_get_smu_version(pdev);
> +		if (rc)
> +			return rc;
> +	}
> +
>   	if (pdev->major < 64 || (pdev->major == 64 && pdev->minor < 53))
>   		return 0;
>   
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Cory Todd Oct. 21, 2022, 4:17 p.m. UTC | #2
On Fri, Oct 21, 2022 at 02:33:47PM +0800, You-Sheng Yang wrote:
> From: Mario Limonciello <mario.limonciello@amd.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1993715
> 
> commit b0c07116c8943 ("platform/x86: amd-pmc: Avoid reading SMU version at
> probe time") adjusted the behavior for amd-pmc to avoid reading the SMU version
> at startup but rather on first use to improve boot time.
> 
> However the SMU version is also used to decide whether to place a timer based
> wakeup in the OS_HINT message.  If the idlemask hasn't been read before this
> message was sent then the SMU version will not have been cached.
> 
> Ensure the SMU version has been read before deciding whether or not to run this
> codepath.
> 
> Cc: stable@vger.kernel.org # 6.0
> Reported-by: You-Sheng Yang <vicamo.yang@canonical.com>
> Tested-by: Anson Tsao <anson.tsao@amd.com>
> Fixes: b0c07116c8943 ("platform/x86: amd-pmc: Avoid reading SMU version at probe time")
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> (cherry-picked from https://lore.kernel.org/all/20221020113749.6621-1-mario.limonciello@amd.com/)
> Signed-off-by: You-Sheng Yang (vicamo) <vicamo.yang@canonical.com>
> ---
>  drivers/platform/x86/amd-pmc.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c
> index 700eb19e8450..fc326fdf483f 100644
> --- a/drivers/platform/x86/amd-pmc.c
> +++ b/drivers/platform/x86/amd-pmc.c
> @@ -635,6 +635,13 @@ static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg)
>  	struct rtc_time tm;
>  	int rc;
>  
> +	/* we haven't yet read SMU version */
> +	if (!pdev->major) {
> +		rc = amd_pmc_get_smu_version(pdev);
> +		if (rc)
> +			return rc;
> +	}
> +
>  	if (pdev->major < 64 || (pdev->major == 64 && pdev->minor < 53))
>  		return 0;
>  

Acked-by: Cory Todd <cory.todd@canonical.com>
Stefan Bader Nov. 11, 2022, 11:40 a.m. UTC | #3
On 21.10.22 08:33, You-Sheng Yang wrote:
> Signed-off-by: You-Sheng Yang (vicamo)<vicamo.yang@canonical.com>

Upstream now as:

commit 0b6e6e149c136677f1cc859d4185b5a2db50ffbf
Author: Mario Limonciello mario.limonciello@amd.com
Date:   Thu Oct 20 06:37:49 2022 -0500
     platform/x86/amd: pmc: Read SMU version during suspend on Cezanne systems

Applied to kinetic:linux/master-next from upstream and adjusting path. Thanks.

-Stefan
diff mbox series

Patch

diff --git a/drivers/platform/x86/amd-pmc.c b/drivers/platform/x86/amd-pmc.c
index 700eb19e8450..fc326fdf483f 100644
--- a/drivers/platform/x86/amd-pmc.c
+++ b/drivers/platform/x86/amd-pmc.c
@@ -635,6 +635,13 @@  static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg)
 	struct rtc_time tm;
 	int rc;
 
+	/* we haven't yet read SMU version */
+	if (!pdev->major) {
+		rc = amd_pmc_get_smu_version(pdev);
+		if (rc)
+			return rc;
+	}
+
 	if (pdev->major < 64 || (pdev->major == 64 && pdev->minor < 53))
 		return 0;