platform/x86/amd: pmc: Add a helper for checking minimum SMU version
PATCH 1/2 platform/x86/amd: pmc: Add a helper for checking minimum SMU version
In a few locations there is some boilerplate code for checking minimum SMU version. Switch this to a helper for this check.
No intended functional changes.
--- drivers/platform/x86/amd/pmc.c | 49 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 25 deletions(-)
drivers/platform/x86/amd/pmc.c +24 -25
@@ -418,6 +418,22 @@ static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)return 0 ; } +static bool amd_pmc_verify_min_version (struct amd_pmc_dev *pdev,int major,int minor) +{ +if (!pdev->major) { +int rc =amd_pmc_get_smu_version (pdev); + +if (rc) { +dev_warn (pdev->dev,"failed to read SMU version: %d\n" , rc); +return false; + } + } +if (pdev->major > major) +return true; + +return pdev->major == major && pdev->minor >= minor; +} +static ssize_t smu_fw_version_show (struct device *d,struct device_attribute *attr,char *buf) {
@@ -526,14 +542,7 @@ static int amd_pmc_idlemask_show(struct seq_file *s, void *unused)struct amd_pmc_dev *dev = s->private;int rc; -/* we haven't yet read SMU version */ -if (!dev->major) { - rc =amd_pmc_get_smu_version (dev); -if (rc) -return rc; - } - -if (dev->major >56 || (dev->major >=55 && dev->minor >=37 )) { +if (amd_pmc_verify_min_version (dev,55 ,37 )) { rc =amd_pmc_idlemask_read (dev,NULL , s);if (rc)return rc;
@@ -686,15 +695,8 @@ static int amd_pmc_get_os_hint(struct amd_pmc_dev *dev)static int amd_pmc_czn_wa_irq1 (struct amd_pmc_dev *pdev) {struct device *d; -int rc; -if (!pdev->major) { - rc =amd_pmc_get_smu_version (pdev); -if (rc) -return rc; - } - -if (pdev->major >64 || (pdev->major ==64 && pdev->minor >65 )) +if (amd_pmc_verify_min_version (pdev,64 ,66 ))return 0 ; d =bus_find_device_by_name (&serio_bus,NULL ,"serio0" );
@@ -718,14 +720,10 @@ 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 (disable_workarounds) +return 0 ; -if (pdev->major <64 || (pdev->major ==64 && pdev->minor <53 )) +if (!amd_pmc_verify_min_version (pdev,64 ,53 ))return 0 ; rtc_device =rtc_class_open ("rtc0" );
@@ -772,13 +770,14 @@ static void amd_pmc_s2idle_prepare(void)/* Reset and Start SMU logging - to monitor the s0i3 stats */ amd_pmc_setup_smu_logging (pdev); -/* Activate CZN specific platform bug workarounds */ -if (pdev->cpu_id ==AMD_CPU_ID_CZN && !disable_workarounds) { +switch (pdev->cpu_id) { +case AMD_CPU_ID_CZN : rc =amd_pmc_verify_czn_rtc (pdev, &arg);if (rc) {dev_err (pdev->dev,"failed to set RTC: %d\n" , rc);return ; } +break ; } msg =amd_pmc_get_os_hint (pdev);
Signature · 1 line
2.34.1
PATCH 2/2 platform/x86/amd: pmc: Add a check for PMFW version on PS platform
When running s2idle on PS if using PMFW older than 76.49.0 we will trip up some bugs that will lead to freezes outside of the control of Linux. Set a guard that we only can enter HW sleep on 76.49.0 or newer for PS.
--- drivers/platform/x86/amd/pmc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/platform/x86/amd/pmc.c +8 -0
@@ -778,6 +778,14 @@ static void amd_pmc_s2idle_prepare(void)return ; }break ; +case AMD_CPU_ID_PS : +if (!amd_pmc_verify_min_version (pdev,76 ,49 )) { +dev_warn (pdev->dev, +"hardware sleep unsupported with firmware %u.%u.%u\n" , + pdev->major, pdev->minor, pdev->rev); +return ; + } +break ; } msg =amd_pmc_get_os_hint (pdev);
Signature · 1 line
2.34.1
Hi,
Quoted 39 lines · Mario Limonciello
In a few locations there is some boilerplate code for checking minimum SMU version. Switch this to a helper for this check.
No intended functional changes.
Signed-off-by Mario Limonciello <[email protected]>--- drivers/platform/x86/amd/pmc.c | 49 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 25 deletions(-)drivers/platform/x86/amd/pmc.c +16
-0@@ -418,6 +418,22 @@ static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)return 0 ; } +static bool amd_pmc_verify_min_version (struct amd_pmc_dev *pdev,int major,int minor) +{ +if (!pdev->major) { +int rc =amd_pmc_get_smu_version (pdev); + +if (rc) { +dev_warn (pdev->dev,"failed to read SMU version: %d\n" , rc); +return false; + } + } +if (pdev->major > major) +return true; + +return pdev->major == major && pdev->minor >= minor; +} +static ssize_t smu_fw_version_show (struct device *d,struct device_attribute *attr,char *buf) {@@ -526,14 +542,7 @@ static int amd_pmc_idlemask_show(struct seq_file *s, void *unused)struct amd_pmc_dev *dev = s->private;
drivers/platform/x86/amd/pmc.c static int amd_pmc_idlemask_show(struct seq_file *s, void *unused) · line 536
Quoted 10 lines
drivers/platform/x86/amd/pmc.c +0
-8int rc; -/* we haven't yet read SMU version */ -if (!dev->major) { - rc =amd_pmc_get_smu_version (dev); -if (rc) -return rc; - } - -if (dev->major >56 || (dev->major >=55 && dev->minor >=37 )) {
The 2 major checks here originally were not in sync, so for major == 55 *and* major == 56 it would only succeed if minor >= 37.
Where as after this patch for major == 56 it will now always succeed.
This feels like a bug in the original code, but might have been intentional ? Please verify this.
After verifying please post a v2 updating the commit message to point out this functional change.
Quoted 46 lines
drivers/platform/x86/amd/pmc.c +6
-17+if (amd_pmc_verify_min_version (dev,55 ,37 )) { rc =amd_pmc_idlemask_read (dev,NULL , s);if (rc)return rc;@@ -686,15 +695,8 @@ static int amd_pmc_get_os_hint(struct amd_pmc_dev *dev)static int amd_pmc_czn_wa_irq1 (struct amd_pmc_dev *pdev) {struct device *d; -int rc; -if (!pdev->major) { - rc =amd_pmc_get_smu_version (pdev); -if (rc) -return rc; - } - -if (pdev->major >64 || (pdev->major ==64 && pdev->minor >65 )) +if (amd_pmc_verify_min_version (pdev,64 ,66 ))return 0 ; d =bus_find_device_by_name (&serio_bus,NULL ,"serio0" );@@ -718,14 +720,10 @@ 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 (disable_workarounds) +return 0 ; -if (pdev->major <64 || (pdev->major ==64 && pdev->minor <53 )) +if (!amd_pmc_verify_min_version (pdev,64 ,53 ))return 0 ; rtc_device =rtc_class_open ("rtc0" );@@ -772,13 +770,14 @@ static void amd_pmc_s2idle_prepare(void)/* Reset and Start SMU logging - to monitor the s0i3 stats */ amd_pmc_setup_smu_logging (pdev); -/* Activate CZN specific platform bug workarounds */ -if (pdev->cpu_id ==AMD_CPU_ID_CZN && !disable_workarounds) { +switch (pdev->cpu_id) {
drivers/platform/x86/amd/pmc.c static void amd_pmc_s2idle_prepare(void) · line 783
Quoted 10 lines
drivers/platform/x86/amd/pmc.c +2
-0+case AMD_CPU_ID_CZN : rc =amd_pmc_verify_czn_rtc (pdev, &arg);if (rc) {dev_err (pdev->dev,"failed to set RTC: %d\n" , rc);return ; } +break ; } msg =amd_pmc_get_os_hint (pdev);
Patch 2/2 looks good to me.
Should I queue v2 (once posted) up as a fix for 6.3-rc# ?
Regards,
Hans
[Public]
Quoted 72 lines
-----Original Message-----
From: Hans de Goede <[email protected]>
Sent: Wednesday, March 1, 2023 09:28
To: Limonciello, Mario <[email protected]>; S-k, Shyam-sundar <[email protected]>
Cc: Mark Gross <[email protected]>; platform-driver- [email protected]; [email protected]
Subject: Re: [PATCH 1/2] platform/x86/amd: pmc: Add a helper for checking minimum SMU versionHi,
Review
Quoted 11 lines · Mario Limonciello
In a few locations there is some boilerplate code for checking minimum SMU version. Switch this to a helper for this check.
No intended functional changes.
Signed-off-by Mario Limonciello <[email protected]>--- drivers/platform/x86/amd/pmc.c | 49 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 25 deletions(-)(quoted diff) +0
-0
b/drivers/platform/x86/amd/pmc.cdrivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct
Quoted 4 lines
index
2edaae04a691..c42fa47381c3100644drivers/platform/x86/amd/pmc.c +0
-0@@ -418,6 +418,22 @@ static int amd_pmc_get_smu_version(struct
amd_pmc_dev*dev)drivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
Quoted 4 lines
drivers/platform/x86/amd/pmc.c +1
-0return 0 ; } +static bool amd_pmc_verify_min_version(struct amd_pmc_dev *pdev,int major, int minor)
drivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
Quoted 6 lines
drivers/platform/x86/amd/pmc.c +6
-0+{ +if (!pdev->major) { +int rc =amd_pmc_get_smu_version (pdev); + +if (rc) { + dev_warn(pdev->dev, "failed to read SMU version:%d\n", rc);
drivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
Quoted 10 lines
drivers/platform/x86/amd/pmc.c +9
-0+return false; + } + } +if (pdev->major > major) +return true; + +return pdev->major == major && pdev->minor >= minor; +} + static ssize_t smu_fw_version_show(struct device *d, struct
device_attribute*attr,drivers/platform/x86/amd/pmc.c static int amd_pmc_idlemask_show(struct seq_file
Quoted 3 lines
drivers/platform/x86/amd/pmc.c +0
-0char *buf) {@@ -526,14 +542,7 @@ static int amd_pmc_idlemask_show(struct seq_file*s, void *unused)
drivers/platform/x86/amd/pmc.c static int amd_pmc_idlemask_show(struct seq_file *s, void *unused) · line 536
Quoted 11 lines
drivers/platform/x86/amd/pmc.c +0
-8struct amd_pmc_dev *dev = s->private;int rc; -/* we haven't yet read SMU version */ -if (!dev->major) { - rc =amd_pmc_get_smu_version (dev); -if (rc) -return rc; - } - -if (dev->major >56 || (dev->major >=55 && dev->minor >=37 )) {The 2 major checks here originally were not in sync, so for major == 55 *and* major == 56 it would only succeed if minor >= 37.
Quoted 4 lines
Where as after this patch for major == 56 it will now always succeed.
This feels like a bug in the original code, but might have been intentional ? Please verify this.
@S-k, Shyam-sundar as the original author of that, can you please confirm?
Quoted 4 lines
After verifying please post a v2 updating the commit message to point out this functional change.
Sure, thanks.
Quoted 57 lines
drivers/platform/x86/amd/pmc.c static int amd_pmc_get_os_hint(struct
Quoted 5 lines
drivers/platform/x86/amd/pmc.c +1
-0+if (amd_pmc_verify_min_version (dev,55 ,37 )) { rc =amd_pmc_idlemask_read (dev,NULL , s);if (rc)return rc;@@ -686,15 +695,8 @@ static int amd_pmc_get_os_hint(struct
amd_pmc_dev*dev)drivers/platform/x86/amd/pmc.c static int amd_pmc_verify_czn_rtc(struct
Quoted 17 lines
drivers/platform/x86/amd/pmc.c +1
-8static int amd_pmc_czn_wa_irq1 (struct amd_pmc_dev *pdev) {struct device *d; -int rc; -if (!pdev->major) { - rc =amd_pmc_get_smu_version (pdev); -if (rc) -return rc; - } - -if (pdev->major >64 || (pdev->major ==64 && pdev->minor >65 )) +if (amd_pmc_verify_min_version (pdev,64 ,66 ))return 0 ; d =bus_find_device_by_name (&serio_bus,NULL ,"serio0" );@@ -718,14 +720,10 @@ static int amd_pmc_verify_czn_rtc(struct
amd_pmc_dev*pdev, u32 *arg)Quoted 33 lines
drivers/platform/x86/amd/pmc.c +6
-9struct 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 (disable_workarounds) +return 0 ; -if (pdev->major <64 || (pdev->major ==64 && pdev->minor <53 )) +if (!amd_pmc_verify_min_version (pdev,64 ,53 ))return 0 ; rtc_device =rtc_class_open ("rtc0" );@@ -772,13 +770,14 @@ static void amd_pmc_s2idle_prepare(void)/* Reset and Start SMU logging - to monitor the s0i3 stats */ amd_pmc_setup_smu_logging (pdev); -/* Activate CZN specific platform bug workarounds */ -if (pdev->cpu_id ==AMD_CPU_ID_CZN && !disable_workarounds) { +switch (pdev->cpu_id) { +case AMD_CPU_ID_CZN : rc =amd_pmc_verify_czn_rtc (pdev, &arg);if (rc) {dev_err (pdev->dev,"failed to set RTC: %d\n" , rc);return ; } +break ; }
Quoted 6 lines
drivers/platform/x86/amd/pmc.c static void amd_pmc_s2idle_prepare(void) · line 783
Quoted 1 line
drivers/platform/x86/amd/pmc.c +0
-0msg =amd_pmc_get_os_hint (pdev);Patch 2/2 looks good to me.
Should I queue v2 (once posted) up as a fix for 6.3-rc# ?
Yes please. If it makes it easier I can re-order the series so that we add a check in 1/2 and switch to the helper as 2/2.
This might make it easier to take the LTS kernel too for stable, but I don't feel strongly.
Quoted 4 lines
Regards,
Hans
Hi,
Quoted 152 lines · Mario
[Public]
Quoted 72 lines
-----Original Message-----
From: Hans de Goede <[email protected]>
Sent: Wednesday, March 1, 2023 09:28
To: Limonciello, Mario <[email protected]>; S-k, Shyam-sundar <[email protected]>
Cc: Mark Gross <[email protected]>; platform-driver- [email protected]; [email protected]
Subject: Re: [PATCH 1/2] platform/x86/amd: pmc: Add a helper for checking minimum SMU versionHi,
Review
Quoted 11 lines · Mario Limonciello
In a few locations there is some boilerplate code for checking minimum SMU version. Switch this to a helper for this check.
No intended functional changes.
Signed-off-by Mario Limonciello <[email protected]>--- drivers/platform/x86/amd/pmc.c | 49 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 25 deletions(-)(quoted diff) +0
-0
b/drivers/platform/x86/amd/pmc.cdrivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct
Quoted 4 lines
index
2edaae04a691..c42fa47381c3100644drivers/platform/x86/amd/pmc.c +0
-0@@ -418,6 +418,22 @@ static int amd_pmc_get_smu_version(struct
amd_pmc_dev*dev)drivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
Quoted 4 lines
drivers/platform/x86/amd/pmc.c +1
-0return 0 ; } +static bool amd_pmc_verify_min_version(struct amd_pmc_dev *pdev,int major, int minor)
drivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
Quoted 6 lines
drivers/platform/x86/amd/pmc.c +6
-0+{ +if (!pdev->major) { +int rc =amd_pmc_get_smu_version (pdev); + +if (rc) { + dev_warn(pdev->dev, "failed to read SMU version:%d\n", rc);
drivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
Quoted 10 lines
drivers/platform/x86/amd/pmc.c +9
-0+return false; + } + } +if (pdev->major > major) +return true; + +return pdev->major == major && pdev->minor >= minor; +} + static ssize_t smu_fw_version_show(struct device *d, struct
device_attribute*attr,drivers/platform/x86/amd/pmc.c static int amd_pmc_idlemask_show(struct seq_file
Quoted 3 lines
drivers/platform/x86/amd/pmc.c +0
-0char *buf) {@@ -526,14 +542,7 @@ static int amd_pmc_idlemask_show(struct seq_file*s, void *unused)
drivers/platform/x86/amd/pmc.c static int amd_pmc_idlemask_show(struct seq_file *s, void *unused) · line 536
Quoted 11 lines
drivers/platform/x86/amd/pmc.c +0
-8struct amd_pmc_dev *dev = s->private;int rc; -/* we haven't yet read SMU version */ -if (!dev->major) { - rc =amd_pmc_get_smu_version (dev); -if (rc) -return rc; - } - -if (dev->major >56 || (dev->major >=55 && dev->minor >=37 )) {The 2 major checks here originally were not in sync, so for major == 55 *and* major == 56 it would only succeed if minor >= 37.
Quoted 4 lines
Where as after this patch for major == 56 it will now always succeed.
This feels like a bug in the original code, but might have been intentional ? Please verify this.
@S-k, Shyam-sundar as the original author of that, can you please confirm?
Quoted 4 lines
After verifying please post a v2 updating the commit message to point out this functional change.
Sure, thanks.
Quoted 62 lines
drivers/platform/x86/amd/pmc.c static int amd_pmc_get_os_hint(struct
Quoted 5 lines
drivers/platform/x86/amd/pmc.c +1
-0+if (amd_pmc_verify_min_version (dev,55 ,37 )) { rc =amd_pmc_idlemask_read (dev,NULL , s);if (rc)return rc;@@ -686,15 +695,8 @@ static int amd_pmc_get_os_hint(struct
amd_pmc_dev*dev)drivers/platform/x86/amd/pmc.c static int amd_pmc_verify_czn_rtc(struct
Quoted 17 lines
drivers/platform/x86/amd/pmc.c +1
-8static int amd_pmc_czn_wa_irq1 (struct amd_pmc_dev *pdev) {struct device *d; -int rc; -if (!pdev->major) { - rc =amd_pmc_get_smu_version (pdev); -if (rc) -return rc; - } - -if (pdev->major >64 || (pdev->major ==64 && pdev->minor >65 )) +if (amd_pmc_verify_min_version (pdev,64 ,66 ))return 0 ; d =bus_find_device_by_name (&serio_bus,NULL ,"serio0" );@@ -718,14 +720,10 @@ static int amd_pmc_verify_czn_rtc(struct
amd_pmc_dev*pdev, u32 *arg)Quoted 24 lines
drivers/platform/x86/amd/pmc.c +4
-9struct 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 (disable_workarounds) +return 0 ; -if (pdev->major <64 || (pdev->major ==64 && pdev->minor <53 )) +if (!amd_pmc_verify_min_version (pdev,64 ,53 ))return 0 ; rtc_device =rtc_class_open ("rtc0" );@@ -772,13 +770,14 @@ static void amd_pmc_s2idle_prepare(void)/* Reset and Start SMU logging - to monitor the s0i3 stats */ amd_pmc_setup_smu_logging (pdev); -/* Activate CZN specific platform bug workarounds */ -if (pdev->cpu_id ==AMD_CPU_ID_CZN && !disable_workarounds) { +switch (pdev->cpu_id) {drivers/platform/x86/amd/pmc.c static void amd_pmc_s2idle_prepare(void) · line 783
Quoted 10 lines
drivers/platform/x86/amd/pmc.c +2
-0+case AMD_CPU_ID_CZN : rc =amd_pmc_verify_czn_rtc (pdev, &arg);if (rc) {dev_err (pdev->dev,"failed to set RTC: %d\n" , rc);return ; } +break ; } msg =amd_pmc_get_os_hint (pdev);Patch 2/2 looks good to me.
Quoted 7 lines
Quoted 1 line
Should I queue v2 (once posted) up as a fix for 6.3-rc# ?
Yes please. If it makes it easier I can re-order the series so that we add a check in 1/2 and switch to the helper as 2/2.
This might make it easier to take the LTS kernel too for stable, but I don't feel strongly.
I'm fine with keeping the order as is, I'm also fine with swapping it :)
Regards,
Hans
Hi Mario,
Quoted 76 lines · Mario
[Public]
Quoted 72 lines
-----Original Message-----
From: Hans de Goede <[email protected]>
Sent: Wednesday, March 1, 2023 09:28
To: Limonciello, Mario <[email protected]>; S-k, Shyam-sundar <[email protected]>
Cc: Mark Gross <[email protected]>; platform-driver- [email protected]; [email protected]
Subject: Re: [PATCH 1/2] platform/x86/amd: pmc: Add a helper for checking minimum SMU versionHi,
Review
Quoted 11 lines · Mario Limonciello
In a few locations there is some boilerplate code for checking minimum SMU version. Switch this to a helper for this check.
No intended functional changes.
Signed-off-by Mario Limonciello <[email protected]>--- drivers/platform/x86/amd/pmc.c | 49 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 25 deletions(-)(quoted diff) +0
-0
b/drivers/platform/x86/amd/pmc.cdrivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct
Quoted 4 lines
index
2edaae04a691..c42fa47381c3100644drivers/platform/x86/amd/pmc.c +0
-0@@ -418,6 +418,22 @@ static int amd_pmc_get_smu_version(struct
amd_pmc_dev*dev)drivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
Quoted 4 lines
drivers/platform/x86/amd/pmc.c +1
-0return 0 ; } +static bool amd_pmc_verify_min_version(struct amd_pmc_dev *pdev,int major, int minor)
drivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
Quoted 6 lines
drivers/platform/x86/amd/pmc.c +6
-0+{ +if (!pdev->major) { +int rc =amd_pmc_get_smu_version (pdev); + +if (rc) { + dev_warn(pdev->dev, "failed to read SMU version:%d\n", rc);
drivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
Quoted 10 lines
drivers/platform/x86/amd/pmc.c +9
-0+return false; + } + } +if (pdev->major > major) +return true; + +return pdev->major == major && pdev->minor >= minor; +} + static ssize_t smu_fw_version_show(struct device *d, struct
device_attribute*attr,drivers/platform/x86/amd/pmc.c static int amd_pmc_idlemask_show(struct seq_file
Quoted 3 lines
drivers/platform/x86/amd/pmc.c +0
-0char *buf) {@@ -526,14 +542,7 @@ static int amd_pmc_idlemask_show(struct seq_file*s, void *unused)
drivers/platform/x86/amd/pmc.c static int amd_pmc_idlemask_show(struct seq_file *s, void *unused) · line 536
Quoted 11 lines
drivers/platform/x86/amd/pmc.c +0
-8struct amd_pmc_dev *dev = s->private;int rc; -/* we haven't yet read SMU version */ -if (!dev->major) { - rc =amd_pmc_get_smu_version (dev); -if (rc) -return rc; - } - -if (dev->major >56 || (dev->major >=55 && dev->minor >=37 )) {The 2 major checks here originally were not in sync, so for major == 55 *and* major == 56 it would only succeed if minor >= 37.
Quoted 6 lines
Quoted 4 lines
Where as after this patch for major == 56 it will now always succeed.
This feels like a bug in the original code, but might have been intentional ? Please verify this.
@S-k, Shyam-sundar as the original author of that, can you please confirm?
I cannot completely recall :-) It was something like if the major version is greater than 56, there is no need to check the other part of the "OR".
which is kind of similar to what you are now doing in amd_pmc_verify_min_version().
Like we discussed off-list, we should have this boilerplate in place, so that the future checks would not be duplicated.
Thanks,
Shyam
Quoted 82 lines
Quoted 5 lines
After verifying please post a v2 updating the commit message to point out this functional change.
Sure, thanks.
Quoted 57 lines
drivers/platform/x86/amd/pmc.c static int amd_pmc_get_os_hint(struct
Quoted 5 lines
drivers/platform/x86/amd/pmc.c +1
-0+if (amd_pmc_verify_min_version (dev,55 ,37 )) { rc =amd_pmc_idlemask_read (dev,NULL , s);if (rc)return rc;@@ -686,15 +695,8 @@ static int amd_pmc_get_os_hint(struct
amd_pmc_dev*dev)drivers/platform/x86/amd/pmc.c static int amd_pmc_verify_czn_rtc(struct
Quoted 17 lines
drivers/platform/x86/amd/pmc.c +1
-8static int amd_pmc_czn_wa_irq1 (struct amd_pmc_dev *pdev) {struct device *d; -int rc; -if (!pdev->major) { - rc =amd_pmc_get_smu_version (pdev); -if (rc) -return rc; - } - -if (pdev->major >64 || (pdev->major ==64 && pdev->minor >65 )) +if (amd_pmc_verify_min_version (pdev,64 ,66 ))return 0 ; d =bus_find_device_by_name (&serio_bus,NULL ,"serio0" );@@ -718,14 +720,10 @@ static int amd_pmc_verify_czn_rtc(struct
amd_pmc_dev*pdev, u32 *arg)Quoted 33 lines
drivers/platform/x86/amd/pmc.c +6
-9struct 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 (disable_workarounds) +return 0 ; -if (pdev->major <64 || (pdev->major ==64 && pdev->minor <53 )) +if (!amd_pmc_verify_min_version (pdev,64 ,53 ))return 0 ; rtc_device =rtc_class_open ("rtc0" );@@ -772,13 +770,14 @@ static void amd_pmc_s2idle_prepare(void)/* Reset and Start SMU logging - to monitor the s0i3 stats */ amd_pmc_setup_smu_logging (pdev); -/* Activate CZN specific platform bug workarounds */ -if (pdev->cpu_id ==AMD_CPU_ID_CZN && !disable_workarounds) { +switch (pdev->cpu_id) { +case AMD_CPU_ID_CZN : rc =amd_pmc_verify_czn_rtc (pdev, &arg);if (rc) {dev_err (pdev->dev,"failed to set RTC: %d\n" , rc);return ; } +break ; }Quoted 6 lines
drivers/platform/x86/amd/pmc.c static void amd_pmc_s2idle_prepare(void) · line 783
Quoted 1 line
drivers/platform/x86/amd/pmc.c +0
-0msg =amd_pmc_get_os_hint (pdev);Patch 2/2 looks good to me.
Should I queue v2 (once posted) up as a fix for 6.3-rc# ?
Yes please. If it makes it easier I can re-order the series so that we add a check in 1/2 and switch to the helper as 2/2.
This might make it easier to take the LTS kernel too for stable, but I don't feel strongly.
Quoted 4 lines
Regards,
Hans
Quoted 84 lines · Shyam Sundar S K
Hi Mario,
Quoted 81 lines · Mario
[Public]
Quoted 76 lines
-----Original Message-----
From: Hans de Goede <[email protected]>
Sent: Wednesday, March 1, 2023 09:28
To: Limonciello, Mario <[email protected]>; S-k, Shyam-sundar <[email protected]>
Cc: Mark Gross <[email protected]>; platform-driver- [email protected]; [email protected]
Subject: Re: [PATCH 1/2] platform/x86/amd: pmc: Add a helper for checking minimum SMU versionHi,
Review
Quoted 11 lines · Mario Limonciello
In a few locations there is some boilerplate code for checking minimum SMU version. Switch this to a helper for this check.
No intended functional changes.
Signed-off-by Mario Limonciello <[email protected]>--- drivers/platform/x86/amd/pmc.c | 49 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 25 deletions(-)(quoted diff) +0
-0
b/drivers/platform/x86/amd/pmc.cdrivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct
Quoted 4 lines
index
2edaae04a691..c42fa47381c3100644drivers/platform/x86/amd/pmc.c +0
-0@@ -418,6 +418,22 @@ static int amd_pmc_get_smu_version(struct
amd_pmc_dev*dev)drivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
Quoted 4 lines
drivers/platform/x86/amd/pmc.c +1
-0return 0 ; } +static bool amd_pmc_verify_min_version(struct amd_pmc_dev *pdev,int major, int minor)
drivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
Quoted 6 lines
drivers/platform/x86/amd/pmc.c +6
-0+{ +if (!pdev->major) { +int rc =amd_pmc_get_smu_version (pdev); + +if (rc) { + dev_warn(pdev->dev, "failed to read SMU version:%d\n", rc);
drivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
Quoted 10 lines
drivers/platform/x86/amd/pmc.c +9
-0+return false; + } + } +if (pdev->major > major) +return true; + +return pdev->major == major && pdev->minor >= minor; +} + static ssize_t smu_fw_version_show(struct device *d, struct
device_attribute*attr,drivers/platform/x86/amd/pmc.c static int amd_pmc_idlemask_show(struct seq_file
Quoted 3 lines
drivers/platform/x86/amd/pmc.c +0
-0char *buf) {@@ -526,14 +542,7 @@ static int amd_pmc_idlemask_show(struct seq_file*s, void *unused)
drivers/platform/x86/amd/pmc.c static int amd_pmc_idlemask_show(struct seq_file *s, void *unused) · line 536
Quoted 11 lines
drivers/platform/x86/amd/pmc.c +0
-8struct amd_pmc_dev *dev = s->private;int rc; -/* we haven't yet read SMU version */ -if (!dev->major) { - rc =amd_pmc_get_smu_version (dev); -if (rc) -return rc; - } - -if (dev->major >56 || (dev->major >=55 && dev->minor >=37 )) {The 2 major checks here originally were not in sync, so for major == 55 *and* major == 56 it would only succeed if minor >= 37.
Where as after this patch for major == 56 it will now always succeed.
This feels like a bug in the original code, but might have been intentional ? Please verify this.
Quoted 8 lines
Quoted 1 line
@S-k, Shyam-sundar as the original author of that, can you please confirm?
I cannot completely recall :-) It was something like if the major version is greater than 56, there is no need to check the other part of the "OR".
which is kind of similar to what you are now doing in
amd_pmc_verify_min_version().
OK yeah, then I'll split this correction of the logic off to that in a separate patch to make this one "really no intended functional changes".
Quoted 3 lines
Like we discussed off-list, we should have this boilerplate in place, so that the future checks would not be duplicated.
Something else I noticed that we probably need to consider is that there is no examination for the "program" version which may be important.
We don't have any version checks for YC, but if we did for example YC A0 and YC B0 use program "0" or program "4" respectively so version checks could fall over.
I'll add something like this in for v2 of the patch as well.
Quoted 86 lines
Thanks,
ShyamQuoted 82 lines
Quoted 5 lines
After verifying please post a v2 updating the commit message to point out this functional change.
Sure, thanks.
Quoted 57 lines
drivers/platform/x86/amd/pmc.c static int amd_pmc_get_os_hint(struct
Quoted 5 lines
drivers/platform/x86/amd/pmc.c +1
-0+if (amd_pmc_verify_min_version (dev,55 ,37 )) { rc =amd_pmc_idlemask_read (dev,NULL , s);if (rc)return rc;@@ -686,15 +695,8 @@ static int amd_pmc_get_os_hint(struct
amd_pmc_dev*dev)drivers/platform/x86/amd/pmc.c static int amd_pmc_verify_czn_rtc(struct
Quoted 17 lines
drivers/platform/x86/amd/pmc.c +1
-8static int amd_pmc_czn_wa_irq1 (struct amd_pmc_dev *pdev) {struct device *d; -int rc; -if (!pdev->major) { - rc =amd_pmc_get_smu_version (pdev); -if (rc) -return rc; - } - -if (pdev->major >64 || (pdev->major ==64 && pdev->minor >65 )) +if (amd_pmc_verify_min_version (pdev,64 ,66 ))return 0 ; d =bus_find_device_by_name (&serio_bus,NULL ,"serio0" );@@ -718,14 +720,10 @@ static int amd_pmc_verify_czn_rtc(struct
amd_pmc_dev*pdev, u32 *arg)Quoted 33 lines
drivers/platform/x86/amd/pmc.c +6
-9struct 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 (disable_workarounds) +return 0 ; -if (pdev->major <64 || (pdev->major ==64 && pdev->minor <53 )) +if (!amd_pmc_verify_min_version (pdev,64 ,53 ))return 0 ; rtc_device =rtc_class_open ("rtc0" );@@ -772,13 +770,14 @@ static void amd_pmc_s2idle_prepare(void)/* Reset and Start SMU logging - to monitor the s0i3 stats */ amd_pmc_setup_smu_logging (pdev); -/* Activate CZN specific platform bug workarounds */ -if (pdev->cpu_id ==AMD_CPU_ID_CZN && !disable_workarounds) { +switch (pdev->cpu_id) { +case AMD_CPU_ID_CZN : rc =amd_pmc_verify_czn_rtc (pdev, &arg);if (rc) {dev_err (pdev->dev,"failed to set RTC: %d\n" , rc);return ; } +break ; }Quoted 6 lines
drivers/platform/x86/amd/pmc.c static void amd_pmc_s2idle_prepare(void) · line 783
Quoted 1 line
drivers/platform/x86/amd/pmc.c +0
-0msg =amd_pmc_get_os_hint (pdev);Patch 2/2 looks good to me.
Should I queue v2 (once posted) up as a fix for 6.3-rc# ?
Yes please. If it makes it easier I can re-order the series so that we add a check in 1/2 and switch to the helper as 2/2.
This might make it easier to take the LTS kernel too for stable, but I don't feel strongly.
Quoted 4 lines
Regards,
Hans
Quoted 104 lines · Mario Limonciello
Quoted 89 lines · Shyam Sundar S K
Hi Mario,
Quoted 78 lines · Mario
[Public]
Quoted 74 lines
-----Original Message-----
From: Hans de Goede <[email protected]>
Sent: Wednesday, March 1, 2023 09:28
To: Limonciello, Mario <[email protected]>; S-k, Shyam-sundar <[email protected]>
Cc: Mark Gross <[email protected]>; platform-driver- [email protected]; [email protected]
Subject: Re: [PATCH 1/2] platform/x86/amd: pmc: Add a helper for checking
minimum SMU versionHi,
Quoted 5 lines · Mario Limonciello
In a few locations there is some boilerplate code for checking minimum SMU version. Switch this to a helper for this check.
No intended functional changes.
Review
Quoted 7 lines
Signed-off-by Mario Limonciello <[email protected]>---
drivers/platform/x86/amd/pmc.c| 49
+++++++++++++++++-----------------1 file changed, 24 insertions(+), 25 deletions(-)(quoted diff) +0
-0
b/drivers/platform/x86/amd/pmc.cdrivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct
Quoted 4 lines
index
2edaae04a691..c42fa47381c3100644drivers/platform/x86/amd/pmc.c +0
-0@@ -418,6 +418,22 @@ static int amd_pmc_get_smu_version(struct
amd_pmc_dev*dev)drivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
Quoted 4 lines
drivers/platform/x86/amd/pmc.c +1
-0return 0; } +static bool amd_pmc_verify_min_version(struct amd_pmc_dev *pdev,int major, int minor)
drivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
Quoted 6 lines
drivers/platform/x86/amd/pmc.c +6
-0+{ + if (!pdev->major) { + int rc = amd_pmc_get_smu_version(pdev); + + if (rc) { + dev_warn(pdev->dev, "failed to read SMU version:%d\n", rc);
Quoted 10 lines
drivers/platform/x86/amd/pmc.c +9
-0+ return false; + } + } + if (pdev->major > major) + return true; + + return pdev->major == major && pdev->minor >= minor; +} +static
ssize_tsmu_fw_version_show(struct device *d, struct
device_attribute*attr,drivers/platform/x86/amd/pmc.c static int amd_pmc_idlemask_show(struct seq_file
Quoted 3 lines
char *buf)
{drivers/platform/x86/amd/pmc.c +0
-0@@ -526,14 +542,7 @@ static int amd_pmc_idlemask_show(struct seq_file*s, void *unused)
drivers/platform/x86/amd/pmc.c static int amd_pmc_idlemask_show(struct seq_file *s, void *unused) · line 536
Quoted 11 lines
drivers/platform/x86/amd/pmc.c +0
-8struct amd_pmc_dev *dev = s->private; int rc; - /* we haven't yet read SMU version */ - if (!dev->major) { - rc = amd_pmc_get_smu_version(dev); - if (rc) - return rc; - } - - if (dev->major > 56 || (dev->major >= 55 && dev->minor >= 37)) {The 2 major checks here originally were not in sync, so for major == 55 *and* major == 56 it would only succeed if minor >= 37.
Quoted 7 lines
Quoted 4 lines
Where as after this patch for major == 56 it will now always succeed.
This feels like a bug in the original code, but might have been intentional ? Please verify this.
@S-k, Shyam-sundar as the original author of that, can you please confirm?
Quoted 6 lines
I cannot completely recall :-) It was something like if the major version is greater than 56, there is no need to check the other part of the "OR".
which is kind of similar to what you are now doing in
amd_pmc_verify_min_version().OK yeah, then I'll split this correction of the logic off to that in a separate patch to make this one "really no intended functional changes".
Quoted 3 lines
Like we discussed off-list, we should have this boilerplate in place, so that the future checks would not be duplicated.
Quoted 6 lines
Something else I noticed that we probably need to consider is that there is no examination for the "program" version which may be important.
We don't have any version checks for YC, but if we did for example YC A0 and YC B0 use program "0" or program "4" respectively so version checks could fall over.
Checking for "program" version may not be required as A0/B0 are never meant for production and IMO its a logical overhead.
Do you have a specific case, were you felt the real usage of "program" version?
Quoted 90 lines
I'll add something like this in for v2 of the patch as well.
Quoted 86 lines
Thanks,
ShyamQuoted 82 lines
Quoted 5 lines
After verifying please post a v2 updating the commit message to point out this functional change.
Sure, thanks.
Quoted 57 lines
drivers/platform/x86/amd/pmc.c static int amd_pmc_get_os_hint(struct
Quoted 5 lines
drivers/platform/x86/amd/pmc.c +1
-0+ if (amd_pmc_verify_min_version(dev, 55, 37)) { rc = amd_pmc_idlemask_read(dev, NULL, s); if (rc) return rc;@@ -686,15 +695,8 @@ static int amd_pmc_get_os_hint(struct
amd_pmc_dev*dev)drivers/platform/x86/amd/pmc.c static int amd_pmc_verify_czn_rtc(struct
Quoted 17 lines
drivers/platform/x86/amd/pmc.c +1
-8static int amd_pmc_czn_wa_irq1(struct amd_pmc_dev *pdev) { struct device *d; - int rc; - if (!pdev->major) { - rc = amd_pmc_get_smu_version(pdev); - if (rc) - return rc; - } - - if (pdev->major > 64 || (pdev->major == 64 && pdev->minor > 65)) + if (amd_pmc_verify_min_version(pdev, 64, 66)) return 0; d = bus_find_device_by_name(&serio_bus, NULL, "serio0");@@ -718,14 +720,10 @@ static int amd_pmc_verify_czn_rtc(struct
amd_pmc_dev*pdev, u32 *arg)Quoted 33 lines
drivers/platform/x86/amd/pmc.c +6
-9struct 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 (disable_workarounds) + return 0; - if (pdev->major < 64 || (pdev->major == 64 && pdev->minor < 53)) + if (!amd_pmc_verify_min_version(pdev, 64, 53)) return 0; rtc_device = rtc_class_open("rtc0");@@ -772,13 +770,14 @@ static void amd_pmc_s2idle_prepare(void) /* Reset and Start SMU logging - to monitor the s0i3 stats */ amd_pmc_setup_smu_logging(pdev); - /* Activate CZN specific platform bug workarounds */ - if (pdev->cpu_id == AMD_CPU_ID_CZN && !disable_workarounds) { + switch (pdev->cpu_id) { + case AMD_CPU_ID_CZN: rc = amd_pmc_verify_czn_rtc(pdev, &arg); if (rc) { dev_err(pdev->dev, "failed to set RTC: %d\n", rc); return; } + break; }Quoted 6 lines
drivers/platform/x86/amd/pmc.c static void amd_pmc_s2idle_prepare(void) · line 783
Quoted 1 line
drivers/platform/x86/amd/pmc.c +0
-0msg = amd_pmc_get_os_hint(pdev);Patch 2/2 looks good to me.
Should I queue v2 (once posted) up as a fix for 6.3-rc# ?
Yes please. If it makes it easier I can re-order the series so that we add a check in 1/2 and switch to the helper as 2/2.
This might make it easier to take the LTS kernel too for stable, but I don't feel strongly.
Quoted 4 lines
Regards,
Hans
Quoted 114 lines · Shyam Sundar S K
Quoted 104 lines · Mario Limonciello
Quoted 89 lines · Shyam Sundar S K
Hi Mario,
Quoted 78 lines · Mario
[Public]
Quoted 74 lines
-----Original Message-----
From: Hans de Goede <[email protected]>
Sent: Wednesday, March 1, 2023 09:28
To: Limonciello, Mario <[email protected]>; S-k, Shyam-sundar <[email protected]>
Cc: Mark Gross <[email protected]>; platform-driver- [email protected]; [email protected]
Subject: Re: [PATCH 1/2] platform/x86/amd: pmc: Add a helper for checking
minimum SMU versionHi,
Quoted 5 lines · Mario Limonciello
In a few locations there is some boilerplate code for checking minimum SMU version. Switch this to a helper for this check.
No intended functional changes.
Review
Quoted 7 lines
Signed-off-by Mario Limonciello <[email protected]>--- drivers/platform/x86/amd/pmc.c | 49 +++++++++++++++++----------------- 1 file changed, 24 insertions(+), 25 deletions(-)(quoted diff) +0
-0
b/drivers/platform/x86/amd/pmc.cdrivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct
Quoted 4 lines
index
2edaae04a691..c42fa47381c3100644drivers/platform/x86/amd/pmc.c +0
-0@@ -418,6 +418,22 @@ static int amd_pmc_get_smu_version(struct
amd_pmc_dev*dev)drivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
Quoted 4 lines
drivers/platform/x86/amd/pmc.c +1
-0return 0; } +static bool amd_pmc_verify_min_version(struct amd_pmc_dev *pdev,int major, int minor)
drivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
Quoted 6 lines
drivers/platform/x86/amd/pmc.c +6
-0+{ + if (!pdev->major) { + int rc = amd_pmc_get_smu_version(pdev); + + if (rc) { + dev_warn(pdev->dev, "failed to read SMU version:%d\n", rc);
drivers/platform/x86/amd/pmc.c static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
Quoted 10 lines
drivers/platform/x86/amd/pmc.c +9
-0+ return false; + } + } + if (pdev->major > major) + return true; + + return pdev->major == major && pdev->minor >= minor; +} + static ssize_t smu_fw_version_show(struct device *d, struct
device_attribute*attr,drivers/platform/x86/amd/pmc.c static int amd_pmc_idlemask_show(struct seq_file
Quoted 3 lines
drivers/platform/x86/amd/pmc.c +0
-0char *buf) {@@ -526,14 +542,7 @@ static int amd_pmc_idlemask_show(struct seq_file*s, void *unused)
drivers/platform/x86/amd/pmc.c static int amd_pmc_idlemask_show(struct seq_file *s, void *unused) · line 536
Quoted 11 lines
drivers/platform/x86/amd/pmc.c +0
-8struct amd_pmc_dev *dev = s->private; int rc; - /* we haven't yet read SMU version */ - if (!dev->major) { - rc = amd_pmc_get_smu_version(dev); - if (rc) - return rc; - } - - if (dev->major > 56 || (dev->major >= 55 && dev->minor >= 37)) {The 2 major checks here originally were not in sync, so for major == 55 *and* major == 56 it would only succeed if minor >= 37.
Quoted 7 lines
Quoted 4 lines
Where as after this patch for major == 56 it will now always succeed.
This feels like a bug in the original code, but might have been intentional ? Please verify this.
@S-k, Shyam-sundar as the original author of that, can you please confirm?
Quoted 6 lines
I cannot completely recall :-) It was something like if the major version is greater than 56, there is no need to check the other part of the "OR".
which is kind of similar to what you are now doing in
amd_pmc_verify_min_version().OK yeah, then I'll split this correction of the logic off to that in a separate patch to make this one "really no intended functional changes".
Quoted 3 lines
Like we discussed off-list, we should have this boilerplate in place, so that the future checks would not be duplicated.
Quoted 6 lines
Something else I noticed that we probably need to consider is that there is no examination for the "program" version which may be important.
We don't have any version checks for YC, but if we did for example YC A0 and YC B0 use program "0" or program "4" respectively so version checks could fall over.
Quoted 5 lines
Checking for "program" version may not be required as A0/B0 are never meant for production and IMO its a logical overhead.
Do you have a specific case, were you felt the real usage of "program" version?
A0/B0 of YC was just one example. The reason I mention it is I think technically it's possible that A0 is leveraged for an embedded product.
I know similar thing had occurred for Renoir leveraged products too.
Quoted 91 lines
Quoted 91 lines
I'll add something like this in for v2 of the patch as well.
Quoted 86 lines
Thanks,
ShyamQuoted 82 lines
Quoted 5 lines
After verifying please post a v2 updating the commit message to point out this functional change.
Sure, thanks.
Quoted 57 lines
drivers/platform/x86/amd/pmc.c static int amd_pmc_get_os_hint(struct
Quoted 5 lines
drivers/platform/x86/amd/pmc.c +1
-0+ if (amd_pmc_verify_min_version(dev, 55, 37)) { rc = amd_pmc_idlemask_read(dev, NULL, s); if (rc) return rc;@@ -686,15 +695,8 @@ static int amd_pmc_get_os_hint(struct
amd_pmc_dev*dev)drivers/platform/x86/amd/pmc.c static int amd_pmc_verify_czn_rtc(struct
Quoted 17 lines
drivers/platform/x86/amd/pmc.c +1
-8static int amd_pmc_czn_wa_irq1(struct amd_pmc_dev *pdev) { struct device *d; - int rc; - if (!pdev->major) { - rc = amd_pmc_get_smu_version(pdev); - if (rc) - return rc; - } - - if (pdev->major > 64 || (pdev->major == 64 && pdev->minor > 65)) + if (amd_pmc_verify_min_version(pdev, 64, 66)) return 0; d = bus_find_device_by_name(&serio_bus, NULL, "serio0");@@ -718,14 +720,10 @@ static int amd_pmc_verify_czn_rtc(struct
amd_pmc_dev*pdev, u32 *arg)Quoted 33 lines
drivers/platform/x86/amd/pmc.c +6
-9struct 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 (disable_workarounds) + return 0; - if (pdev->major < 64 || (pdev->major == 64 && pdev->minor < 53)) + if (!amd_pmc_verify_min_version(pdev, 64, 53)) return 0; rtc_device = rtc_class_open("rtc0");@@ -772,13 +770,14 @@ static void amd_pmc_s2idle_prepare(void) /* Reset and Start SMU logging - to monitor the s0i3 stats */ amd_pmc_setup_smu_logging(pdev); - /* Activate CZN specific platform bug workarounds */ - if (pdev->cpu_id == AMD_CPU_ID_CZN && !disable_workarounds) { + switch (pdev->cpu_id) { + case AMD_CPU_ID_CZN: rc = amd_pmc_verify_czn_rtc(pdev, &arg); if (rc) { dev_err(pdev->dev, "failed to set RTC: %d\n", rc); return; } + break; }Quoted 6 lines
drivers/platform/x86/amd/pmc.c static void amd_pmc_s2idle_prepare(void) · line 783
Quoted 1 line
drivers/platform/x86/amd/pmc.c +0
-0msg = amd_pmc_get_os_hint(pdev);Patch 2/2 looks good to me.
Should I queue v2 (once posted) up as a fix for 6.3-rc# ?
Yes please. If it makes it easier I can re-order the series so that we add a check in 1/2 and switch to the helper as 2/2.
This might make it easier to take the LTS kernel too for stable, but I don't feel strongly.
Quoted 4 lines
Regards,
Hans