stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform/x86: thinkpad_acpi: Fix profile modes on Intel platforms
@ 2023-01-24 15:36 Mark Pearson
  2023-01-24 15:42 ` Limonciello, Mario
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mark Pearson @ 2023-01-24 15:36 UTC (permalink / raw)
  To: mpearson-lenovo
  Cc: hdegoede, markgross, mario.limonciello, platform-driver-x86, stable

My last commit to fix profile mode displays on AMD platforms caused
an issue on Intel platforms - sorry!

In it I was reading the current functional mode (MMC, PSC, AMT) from
the BIOS but didn't account for the fact that on some of our Intel
platforms I use a different API which returns just the profile and not
the functional mode.

This commit fixes it so that on Intel platforms it knows the functional
mode is always MMC.

I also fixed a potential problem that a platform may try to set the mode
for both MMC and PSC - which was incorrect.

Tested on X1 Carbon 9 (Intel) and Z13 (AMD).

Link: https://bugzilla.kernel.org/show_bug.cgi?id=216963
Fixes: fde5f74ccfc7 ("platform/x86: thinkpad_acpi: Fix profile mode display in AMT mode")

Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
---
 drivers/platform/x86/thinkpad_acpi.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index a95946800ae9..6668d472df39 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -10496,8 +10496,7 @@ static int dytc_profile_set(struct platform_profile_handler *pprof,
 			if (err)
 				goto unlock;
 		}
-	}
-	if (dytc_capabilities & BIT(DYTC_FC_PSC)) {
+	} else if (dytc_capabilities & BIT(DYTC_FC_PSC)) {
 		err = dytc_command(DYTC_SET_COMMAND(DYTC_FUNCTION_PSC, perfmode, 1), &output);
 		if (err)
 			goto unlock;
@@ -10525,14 +10524,16 @@ static void dytc_profile_refresh(void)
 			err = dytc_command(DYTC_CMD_MMC_GET, &output);
 		else
 			err = dytc_cql_command(DYTC_CMD_GET, &output);
-	} else if (dytc_capabilities & BIT(DYTC_FC_PSC))
+		funcmode = DYTC_FUNCTION_MMC;
+	} else if (dytc_capabilities & BIT(DYTC_FC_PSC)) {
 		err = dytc_command(DYTC_CMD_GET, &output);
-
+		/*Check if we are PSC mode, or have AMT enabled */
+		funcmode = (output >> DYTC_GET_FUNCTION_BIT) & 0xF;
+	}
 	mutex_unlock(&dytc_mutex);
 	if (err)
 		return;
 
-	funcmode = (output >> DYTC_GET_FUNCTION_BIT) & 0xF;
 	perfmode = (output >> DYTC_GET_MODE_BIT) & 0xF;
 	convert_dytc_to_profile(funcmode, perfmode, &profile);
 	if (profile != dytc_current_profile) {
-- 
2.38.1


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

* RE: [PATCH] platform/x86: thinkpad_acpi: Fix profile modes on Intel platforms
  2023-01-24 15:36 [PATCH] platform/x86: thinkpad_acpi: Fix profile modes on Intel platforms Mark Pearson
@ 2023-01-24 15:42 ` Limonciello, Mario
  2023-01-24 16:18 ` Greg KH
  2023-01-25 11:49 ` Hans de Goede
  2 siblings, 0 replies; 4+ messages in thread
From: Limonciello, Mario @ 2023-01-24 15:42 UTC (permalink / raw)
  To: Mark Pearson; +Cc: hdegoede, markgross, platform-driver-x86, stable

[Public]



> -----Original Message-----
> From: Mark Pearson <mpearson-lenovo@squebb.ca>
> Sent: Tuesday, January 24, 2023 09:36
> To: mpearson-lenovo@squebb.ca
> Cc: hdegoede@redhat.com; markgross@kernel.org; Limonciello, Mario
> <Mario.Limonciello@amd.com>; platform-driver-x86@vger.kernel.org;
> stable@vger.kernel.org
> Subject: [PATCH] platform/x86: thinkpad_acpi: Fix profile modes on Intel
> platforms
> 
> My last commit to fix profile mode displays on AMD platforms caused
> an issue on Intel platforms - sorry!
> 
> In it I was reading the current functional mode (MMC, PSC, AMT) from
> the BIOS but didn't account for the fact that on some of our Intel
> platforms I use a different API which returns just the profile and not
> the functional mode.
> 
> This commit fixes it so that on Intel platforms it knows the functional
> mode is always MMC.
> 
> I also fixed a potential problem that a platform may try to set the mode
> for both MMC and PSC - which was incorrect.
> 
> Tested on X1 Carbon 9 (Intel) and Z13 (AMD).
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=216963
> Fixes: fde5f74ccfc7 ("platform/x86: thinkpad_acpi: Fix profile mode display in
> AMT mode")

In order for this to go to stable, it needs this tag in the commit message and not
just CC stable in the git send-email command.

(no need to respin for this reason, patchwork or b4 should pick it up when Hans grabs it)

Cc: stable@vger.kernel.org

> 
> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>

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

> ---
>  drivers/platform/x86/thinkpad_acpi.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/platform/x86/thinkpad_acpi.c
> b/drivers/platform/x86/thinkpad_acpi.c
> index a95946800ae9..6668d472df39 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -10496,8 +10496,7 @@ static int dytc_profile_set(struct
> platform_profile_handler *pprof,
>  			if (err)
>  				goto unlock;
>  		}
> -	}
> -	if (dytc_capabilities & BIT(DYTC_FC_PSC)) {
> +	} else if (dytc_capabilities & BIT(DYTC_FC_PSC)) {
>  		err =
> dytc_command(DYTC_SET_COMMAND(DYTC_FUNCTION_PSC, perfmode,
> 1), &output);
>  		if (err)
>  			goto unlock;
> @@ -10525,14 +10524,16 @@ static void dytc_profile_refresh(void)
>  			err = dytc_command(DYTC_CMD_MMC_GET,
> &output);
>  		else
>  			err = dytc_cql_command(DYTC_CMD_GET, &output);
> -	} else if (dytc_capabilities & BIT(DYTC_FC_PSC))
> +		funcmode = DYTC_FUNCTION_MMC;
> +	} else if (dytc_capabilities & BIT(DYTC_FC_PSC)) {
>  		err = dytc_command(DYTC_CMD_GET, &output);
> -
> +		/*Check if we are PSC mode, or have AMT enabled */
> +		funcmode = (output >> DYTC_GET_FUNCTION_BIT) & 0xF;
> +	}
>  	mutex_unlock(&dytc_mutex);
>  	if (err)
>  		return;
> 
> -	funcmode = (output >> DYTC_GET_FUNCTION_BIT) & 0xF;
>  	perfmode = (output >> DYTC_GET_MODE_BIT) & 0xF;
>  	convert_dytc_to_profile(funcmode, perfmode, &profile);
>  	if (profile != dytc_current_profile) {
> --
> 2.38.1

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

* Re: [PATCH] platform/x86: thinkpad_acpi: Fix profile modes on Intel platforms
  2023-01-24 15:36 [PATCH] platform/x86: thinkpad_acpi: Fix profile modes on Intel platforms Mark Pearson
  2023-01-24 15:42 ` Limonciello, Mario
@ 2023-01-24 16:18 ` Greg KH
  2023-01-25 11:49 ` Hans de Goede
  2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2023-01-24 16:18 UTC (permalink / raw)
  To: Mark Pearson
  Cc: hdegoede, markgross, mario.limonciello, platform-driver-x86, stable

On Tue, Jan 24, 2023 at 10:36:23AM -0500, Mark Pearson wrote:
> My last commit to fix profile mode displays on AMD platforms caused
> an issue on Intel platforms - sorry!
> 
> In it I was reading the current functional mode (MMC, PSC, AMT) from
> the BIOS but didn't account for the fact that on some of our Intel
> platforms I use a different API which returns just the profile and not
> the functional mode.
> 
> This commit fixes it so that on Intel platforms it knows the functional
> mode is always MMC.
> 
> I also fixed a potential problem that a platform may try to set the mode
> for both MMC and PSC - which was incorrect.
> 
> Tested on X1 Carbon 9 (Intel) and Z13 (AMD).
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=216963
> Fixes: fde5f74ccfc7 ("platform/x86: thinkpad_acpi: Fix profile mode display in AMT mode")
> 
> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
> ---
>  drivers/platform/x86/thinkpad_acpi.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

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

* Re: [PATCH] platform/x86: thinkpad_acpi: Fix profile modes on Intel platforms
  2023-01-24 15:36 [PATCH] platform/x86: thinkpad_acpi: Fix profile modes on Intel platforms Mark Pearson
  2023-01-24 15:42 ` Limonciello, Mario
  2023-01-24 16:18 ` Greg KH
@ 2023-01-25 11:49 ` Hans de Goede
  2 siblings, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2023-01-25 11:49 UTC (permalink / raw)
  To: Mark Pearson; +Cc: markgross, mario.limonciello, platform-driver-x86, stable

Hi,

On 1/24/23 16:36, Mark Pearson wrote:
> My last commit to fix profile mode displays on AMD platforms caused
> an issue on Intel platforms - sorry!
> 
> In it I was reading the current functional mode (MMC, PSC, AMT) from
> the BIOS but didn't account for the fact that on some of our Intel
> platforms I use a different API which returns just the profile and not
> the functional mode.
> 
> This commit fixes it so that on Intel platforms it knows the functional
> mode is always MMC.
> 
> I also fixed a potential problem that a platform may try to set the mode
> for both MMC and PSC - which was incorrect.
> 
> Tested on X1 Carbon 9 (Intel) and Z13 (AMD).
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=216963
> Fixes: fde5f74ccfc7 ("platform/x86: thinkpad_acpi: Fix profile mode display in AMT mode")
> 
> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>

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

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

I will include this patch in my next fixes pull-req to Linus
for the current kernel development cycle.

Regards,

Hans




> ---
>  drivers/platform/x86/thinkpad_acpi.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
> index a95946800ae9..6668d472df39 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -10496,8 +10496,7 @@ static int dytc_profile_set(struct platform_profile_handler *pprof,
>  			if (err)
>  				goto unlock;
>  		}
> -	}
> -	if (dytc_capabilities & BIT(DYTC_FC_PSC)) {
> +	} else if (dytc_capabilities & BIT(DYTC_FC_PSC)) {
>  		err = dytc_command(DYTC_SET_COMMAND(DYTC_FUNCTION_PSC, perfmode, 1), &output);
>  		if (err)
>  			goto unlock;
> @@ -10525,14 +10524,16 @@ static void dytc_profile_refresh(void)
>  			err = dytc_command(DYTC_CMD_MMC_GET, &output);
>  		else
>  			err = dytc_cql_command(DYTC_CMD_GET, &output);
> -	} else if (dytc_capabilities & BIT(DYTC_FC_PSC))
> +		funcmode = DYTC_FUNCTION_MMC;
> +	} else if (dytc_capabilities & BIT(DYTC_FC_PSC)) {
>  		err = dytc_command(DYTC_CMD_GET, &output);
> -
> +		/*Check if we are PSC mode, or have AMT enabled */
> +		funcmode = (output >> DYTC_GET_FUNCTION_BIT) & 0xF;
> +	}
>  	mutex_unlock(&dytc_mutex);
>  	if (err)
>  		return;
>  
> -	funcmode = (output >> DYTC_GET_FUNCTION_BIT) & 0xF;
>  	perfmode = (output >> DYTC_GET_MODE_BIT) & 0xF;
>  	convert_dytc_to_profile(funcmode, perfmode, &profile);
>  	if (profile != dytc_current_profile) {


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

end of thread, other threads:[~2023-01-25 11:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-24 15:36 [PATCH] platform/x86: thinkpad_acpi: Fix profile modes on Intel platforms Mark Pearson
2023-01-24 15:42 ` Limonciello, Mario
2023-01-24 16:18 ` Greg KH
2023-01-25 11:49 ` 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).