linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] Fix using rtcwake on Cezanne platforms
@ 2022-10-20 11:37 Mario Limonciello
  2022-10-20 11:37 ` [PATCH 1/1] platform/x86/amd: pmc: Read SMU version during suspend on Cezanne systems Mario Limonciello
  0 siblings, 1 reply; 3+ messages in thread
From: Mario Limonciello @ 2022-10-20 11:37 UTC (permalink / raw)
  To: mario.limonciello, Hans de Goede, platform-driver-x86
  Cc: Anson Tsao, You-Sheng Yang, Shyam Sundar S K, linux-kernel

Vicamo reports that rtcwake is not working properly on 6.0 kernel, but
worked properly on 5.17 kernel.  He bisected it down to:

commit b0c07116c8943 ("platform/x86: amd-pmc: Avoid reading SMU version at
probe time")

The issue is that commit made it possible to issue a suspend where SMU
version isn't known, meaning amd-pmc can't decide whether to activate
behavior to add a timer value to the OS_HINT message.

This wasn't reproduced on AMD's side initially because the testing
scripts were reading the idle mask from debugfs which would cache the
value in the driver.

This patch ensures that SMU version has been read even if debugfs hasn't
been accessed so that rtcwake can work again.

Mario Limonciello (1):
  platform/x86/amd: pmc: Read SMU version during suspend on Cezanne
    systems

 drivers/platform/x86/amd/pmc.c | 7 +++++++
 1 file changed, 7 insertions(+)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] platform/x86/amd: pmc: Read SMU version during suspend on Cezanne systems
  2022-10-20 11:37 [PATCH 0/1] Fix using rtcwake on Cezanne platforms Mario Limonciello
@ 2022-10-20 11:37 ` Mario Limonciello
  2022-10-24  9:29   ` Hans de Goede
  0 siblings, 1 reply; 3+ messages in thread
From: Mario Limonciello @ 2022-10-20 11:37 UTC (permalink / raw)
  To: mario.limonciello, Shyam Sundar S K, Hans de Goede
  Cc: Anson Tsao, You-Sheng Yang, stable, Mark Gross,
	platform-driver-x86, linux-kernel

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>
---
 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 ce859b300712b..96e790e639a21 100644
--- a/drivers/platform/x86/amd/pmc.c
+++ b/drivers/platform/x86/amd/pmc.c
@@ -663,6 +663,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;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] platform/x86/amd: pmc: Read SMU version during suspend on Cezanne systems
  2022-10-20 11:37 ` [PATCH 1/1] platform/x86/amd: pmc: Read SMU version during suspend on Cezanne systems Mario Limonciello
@ 2022-10-24  9:29   ` Hans de Goede
  0 siblings, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2022-10-24  9:29 UTC (permalink / raw)
  To: Mario Limonciello, Shyam Sundar S K
  Cc: Anson Tsao, You-Sheng Yang, stable, Mark Gross,
	platform-driver-x86, linux-kernel

Hi,

On 10/20/22 13:37, Mario Limonciello wrote:
> 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>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans


> ---
>  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 ce859b300712b..96e790e639a21 100644
> --- a/drivers/platform/x86/amd/pmc.c
> +++ b/drivers/platform/x86/amd/pmc.c
> @@ -663,6 +663,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;
>  


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-24  9:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-20 11:37 [PATCH 0/1] Fix using rtcwake on Cezanne platforms Mario Limonciello
2022-10-20 11:37 ` [PATCH 1/1] platform/x86/amd: pmc: Read SMU version during suspend on Cezanne systems Mario Limonciello
2022-10-24  9:29   ` Hans de Goede

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).