stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Limonciello, Mario" <Mario.Limonciello@amd.com>
To: Sasha Levin <sashal@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Maxwell Beck <max@ryt.one>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>
Subject: RE: [PATCH AUTOSEL 5.14 10/25] ACPI: PM: s2idle: Run both AMD and Microsoft methods if both are supported
Date: Tue, 21 Sep 2021 14:57:26 +0000	[thread overview]
Message-ID: <SA0PR12MB451092FB36EAFACFCD928212E2A19@SA0PR12MB4510.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20210913223339.435347-10-sashal@kernel.org>

[Public]

> -----Original Message-----
> From: Sasha Levin <sashal@kernel.org>
> Sent: Monday, September 13, 2021 17:33
> To: linux-kernel@vger.kernel.org; stable@vger.kernel.org
> Cc: Limonciello, Mario <Mario.Limonciello@amd.com>; Maxwell Beck
> <max@ryt.one>; Rafael J . Wysocki <rafael.j.wysocki@intel.com>; Sasha Levin
> <sashal@kernel.org>; linux-acpi@vger.kernel.org
> Subject: [PATCH AUTOSEL 5.14 10/25] ACPI: PM: s2idle: Run both AMD and
> Microsoft methods if both are supported
> 
> From: Mario Limonciello <mario.limonciello@amd.com>
> 
> [ Upstream commit fa209644a7124b3f4cf811ced55daef49ae39ac6 ]
> 
> It was reported that on "HP ENVY x360" that power LED does not come
> back, certain keys like brightness controls do not work, and the fan
> never spins up, even under load on 5.14 final.
> 
> In analysis of the SSDT it's clear that the Microsoft UUID doesn't
> provide functional support, but rather the AMD UUID should be
> supporting this system.
> 
> Because this is a gap in the expected logic, we checked back with
> internal team.  The conclusion was that on Windows AMD uPEP *does*
> run even when Microsoft UUID present, but most OEM systems have
> adopted value of "0x3" for supported functions and hence nothing
> runs.
> 
> Henceforth add support for running both Microsoft and AMD methods.
> This approach will also allow the same logic on Intel systems if
> desired at a future time as well by pulling the evaluation of
> `lps0_dsm_func_mask_microsoft` out of the `if` block for
> `acpi_s2idle_vendor_amd`.
> 
> Link:
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.fr
> eedesktop.org%2Fdrm%2Famd%2Fuploads%2F9fbcd7ec3a385cc6949c9bacf45d
> c41b%2Facpi-
> f.20.bin&amp;data=04%7C01%7Cmario.limonciello%40amd.com%7Ce1f8dfc3d
> bfb45fc44ef08d97706917f%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C
> 0%7C637671692363481559%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA
> wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sda
> ta=wP0oz8OMnby9PA4MFrbY1ZAT%2FKv1jctTyXl%2BDteNHqY%3D&amp;reserv
> ed=0
> BugLink:
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.fr
> eedesktop.org%2Fdrm%2Famd%2F-
> %2Fissues%2F1691&amp;data=04%7C01%7Cmario.limonciello%40amd.com%7
> Ce1f8dfc3dbfb45fc44ef08d97706917f%7C3dd8961fe4884e608e11a82d994e183
> d%7C0%7C0%7C637671692363481559%7CUnknown%7CTWFpbGZsb3d8eyJWIj
> oiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C100
> 0&amp;sdata=MVhVz%2BYBTdwgvkkSRRFsL5QdfDLPgTzoMBjD4dsFfMA%3D&a
> mp;reserved=0
> Reported-by: Maxwell Beck <max@ryt.one>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> [ rjw: Edits of the new comments ]
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>  drivers/acpi/x86/s2idle.c | 67 +++++++++++++++++++++++----------------
>  1 file changed, 39 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
> index 3a308461246a..bd92b549fd5a 100644
> --- a/drivers/acpi/x86/s2idle.c
> +++ b/drivers/acpi/x86/s2idle.c
> @@ -449,25 +449,30 @@ int acpi_s2idle_prepare_late(void)
>  	if (pm_debug_messages_on)
>  		lpi_check_constraints();
> 
> -	if (lps0_dsm_func_mask_microsoft > 0) {
> +	/* Screen off */
> +	if (lps0_dsm_func_mask > 0)
> +		acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
> +					ACPI_LPS0_SCREEN_OFF_AMD :
> +					ACPI_LPS0_SCREEN_OFF,
> +					lps0_dsm_func_mask, lps0_dsm_guid);
> +
> +	if (lps0_dsm_func_mask_microsoft > 0)
>  		acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_OFF,
>  				lps0_dsm_func_mask_microsoft,
> lps0_dsm_guid_microsoft);
> -		acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_ENTRY,
> -				lps0_dsm_func_mask_microsoft,
> lps0_dsm_guid_microsoft);
> +
> +	/* LPS0 entry */
> +	if (lps0_dsm_func_mask > 0)
> +		acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
> +					ACPI_LPS0_ENTRY_AMD :
> +					ACPI_LPS0_ENTRY,
> +					lps0_dsm_func_mask, lps0_dsm_guid);
> +	if (lps0_dsm_func_mask_microsoft > 0) {
>  		acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY,
>  				lps0_dsm_func_mask_microsoft,
> lps0_dsm_guid_microsoft);
> -	} else if (acpi_s2idle_vendor_amd()) {
> -		acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_OFF_AMD,
> -				lps0_dsm_func_mask, lps0_dsm_guid);
> -		acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY_AMD,
> -				lps0_dsm_func_mask, lps0_dsm_guid);
> -	} else {
> -		acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_OFF,
> -				lps0_dsm_func_mask, lps0_dsm_guid);
> -		acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY,
> -				lps0_dsm_func_mask, lps0_dsm_guid);
> +		/* modern standby entry */
> +		acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_ENTRY,
> +				lps0_dsm_func_mask_microsoft,
> lps0_dsm_guid_microsoft);
>  	}
> -
>  	return 0;
>  }
> 
> @@ -476,24 +481,30 @@ void acpi_s2idle_restore_early(void)
>  	if (!lps0_device_handle || sleep_no_lps0)
>  		return;
> 
> -	if (lps0_dsm_func_mask_microsoft > 0) {
> -		acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT,
> -				lps0_dsm_func_mask_microsoft,
> lps0_dsm_guid_microsoft);
> +	/* Modern standby exit */
> +	if (lps0_dsm_func_mask_microsoft > 0)
>  		acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT,
>  				lps0_dsm_func_mask_microsoft,
> lps0_dsm_guid_microsoft);
> -		acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON,
> -				lps0_dsm_func_mask_microsoft,
> lps0_dsm_guid_microsoft);
> -	} else if (acpi_s2idle_vendor_amd()) {
> -		acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT_AMD,
> -				lps0_dsm_func_mask, lps0_dsm_guid);
> -		acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON_AMD,
> -				lps0_dsm_func_mask, lps0_dsm_guid);
> -	} else {
> +
> +	/* LPS0 exit */
> +	if (lps0_dsm_func_mask > 0)
> +		acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
> +					ACPI_LPS0_EXIT_AMD :
> +					ACPI_LPS0_EXIT,
> +					lps0_dsm_func_mask, lps0_dsm_guid);
> +	if (lps0_dsm_func_mask_microsoft > 0)
>  		acpi_sleep_run_lps0_dsm(ACPI_LPS0_EXIT,
> -				lps0_dsm_func_mask, lps0_dsm_guid);
> +				lps0_dsm_func_mask_microsoft,
> lps0_dsm_guid_microsoft);
> +
> +	/* Screen on */
> +	if (lps0_dsm_func_mask_microsoft > 0)
>  		acpi_sleep_run_lps0_dsm(ACPI_LPS0_SCREEN_ON,
> -				lps0_dsm_func_mask, lps0_dsm_guid);
> -	}
> +				lps0_dsm_func_mask_microsoft,
> lps0_dsm_guid_microsoft);
> +	if (lps0_dsm_func_mask > 0)
> +		acpi_sleep_run_lps0_dsm(acpi_s2idle_vendor_amd() ?
> +					ACPI_LPS0_SCREEN_ON_AMD :
> +					ACPI_LPS0_SCREEN_ON,
> +					lps0_dsm_func_mask, lps0_dsm_guid);
>  }
> 
>  static const struct platform_s2idle_ops acpi_s2idle_ops_lps0 = {
> --
> 2.30.2

I noticed this didn't get picked up automatically for 5.14.6, so as the submitter of the
original patch here is an explicit:

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

  reply	other threads:[~2021-09-21 14:57 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 22:33 [PATCH AUTOSEL 5.14 01/25] dmaengine: idxd: depends on !UML Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 02/25] dmaengine: sprd: Add missing MODULE_DEVICE_TABLE Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 03/25] cxl: Move cxl_core to new directory Sasha Levin
2021-09-14  8:56   ` Jonathan Cameron
2021-09-14  8:57     ` Jonathan Cameron
2021-09-14 15:05       ` Ben Widawsky
2021-09-14 15:40         ` Dan Williams
2021-09-14 17:00         ` Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 04/25] cxl/pci: Introduce cdevm_file_operations Sasha Levin
2021-09-14 15:42   ` Dan Williams
2021-09-14 17:01     ` Sasha Levin
2021-09-14 17:46       ` Dan Williams
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 05/25] gfs2: Switch to may_setattr in gfs2_setattr Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 06/25] dmaengine: ioat: depends on !UML Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 07/25] dmaengine: xilinx_dma: Set DMA mask for coherent APIs Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 08/25] s390: add kmemleak annotation in stack_alloc() Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 09/25] ASoC: audio-graph: respawn Platform Support Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 10/25] ACPI: PM: s2idle: Run both AMD and Microsoft methods if both are supported Sasha Levin
2021-09-21 14:57   ` Limonciello, Mario [this message]
2021-09-24 11:40     ` Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 11/25] ceph: fix memory leak on decode error in ceph_handle_caps Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 12/25] ceph: request Fw caps before updating the mtime in ceph_write_iter Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 13/25] ceph: remove the capsnaps when removing caps Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 14/25] ceph: lockdep annotations for try_nonblocking_invalidate Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 15/25] s390/unwind: use current_frame_address() to unwind current task Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 16/25] btrfs: update the bdev time directly when closing Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 17/25] btrfs: delay blkdev_put until after the device remove Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 18/25] btrfs: fix lockdep warning while mounting sprout fs Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 19/25] connector: send event on write to /proc/[pid]/comm Sasha Levin
2021-09-15 13:45   ` Eric W. Biederman
2021-09-16  0:36     ` Sasha Levin
2021-09-16 15:49       ` Eric W. Biederman
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 20/25] nilfs2: fix memory leak in nilfs_sysfs_create_device_group Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 21/25] nilfs2: fix NULL pointer in nilfs_##name##_attr_release Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 22/25] nilfs2: fix memory leak in nilfs_sysfs_create_##name##_group Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 23/25] nilfs2: fix memory leak in nilfs_sysfs_delete_##name##_group Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 24/25] nilfs2: fix memory leak in nilfs_sysfs_create_snapshot_group Sasha Levin
2021-09-13 22:33 ` [PATCH AUTOSEL 5.14 25/25] nilfs2: fix memory leak in nilfs_sysfs_delete_snapshot_group Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SA0PR12MB451092FB36EAFACFCD928212E2A19@SA0PR12MB4510.namprd12.prod.outlook.com \
    --to=mario.limonciello@amd.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=max@ryt.one \
    --cc=rafael.j.wysocki@intel.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).