public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linux ACPI <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>,
	David Box <david.e.box@linux.intel.com>
Subject: Re: [PATCH v1] ACPI: PM: s2idle: Enable Low-Power S0 Idle MSFT UUID for non-AMD systems
Date: Tue, 6 Feb 2024 13:58:00 -0600	[thread overview]
Message-ID: <26c73a47-c672-4c99-9c41-aa0bdc162a4c@amd.com> (raw)
In-Reply-To: <12388452.O9o76ZdvQC@kreacher>

On 2/6/2024 13:33, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Systems based on Intel platforms that use the MSFT UUID for Low-Power S0
> Idle (LPS0) have started to ship, so allow the kernel to use the MSFT
> UUID in the non-AMD case too, but in that case make it avoid evaluating
> the same _DSM function for two different UUIDs and prioritize the MSFT
> one.
> 
> While at it, combine two MSFT _DSM function mask checks in
> acpi_s2idle_restore_early() so as to make it reflect the
> acpi_s2idle_prepare_late() flow more closely and adjust the
> Modern Standby entry and exit comments slightly.
> 
> Non-AMD systems that do not support MSFT UUID for Low-power S0 Idle are
> not expected to be affected by this change in any way.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>   drivers/acpi/x86/s2idle.c |   37 +++++++++++++++++++++++++++----------
>   1 file changed, 27 insertions(+), 10 deletions(-)
> 
> Index: linux-pm/drivers/acpi/x86/s2idle.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/x86/s2idle.c
> +++ linux-pm/drivers/acpi/x86/s2idle.c
> @@ -488,7 +488,21 @@ static int lps0_device_attach(struct acp
>   		rev_id = 1;
>   		lps0_dsm_func_mask = validate_dsm(adev->handle,
>   					ACPI_LPS0_DSM_UUID, rev_id, &lps0_dsm_guid);
> -		lps0_dsm_func_mask_microsoft = -EINVAL;
> +		if (lps0_dsm_func_mask > 0 && lps0_dsm_func_mask_microsoft > 0) {
> +			unsigned int func_mask;
> +
> +			/*
> +			 * Avoid evaluating the same _DSM function for two
> +			 * different UUIDs and prioritize the MSFT one.
> +			 */
> +			func_mask = lps0_dsm_func_mask & lps0_dsm_func_mask_microsoft;
> +			if (func_mask) {
> +				acpi_handle_info(adev->handle,
> +						 "Duplicate LPS0 _DSM functions (mask: 0x%x)\n",
> +						 func_mask);
> +				lps0_dsm_func_mask &= ~func_mask;
> +			}
> +		}
>   	}
>   
>   	if (lps0_dsm_func_mask < 0 && lps0_dsm_func_mask_microsoft < 0)
> @@ -549,19 +563,22 @@ int acpi_s2idle_prepare_late(void)
>   				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,
> +	if (lps0_dsm_func_mask > 0 && acpi_s2idle_vendor_amd())
> +		acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY_AMD,
>   					lps0_dsm_func_mask, lps0_dsm_guid);
> +
>   	if (lps0_dsm_func_mask_microsoft > 0) {
> -		/* modern standby entry */
> +		/* Modern Standby entry */
>   		acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_ENTRY,
>   				lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
>   		acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY,
>   				lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
>   	}
>   
> +	if (lps0_dsm_func_mask > 0 && !acpi_s2idle_vendor_amd())
> +		acpi_sleep_run_lps0_dsm(ACPI_LPS0_ENTRY,
> +					lps0_dsm_func_mask, lps0_dsm_guid);
> +
>   	list_for_each_entry(handler, &lps0_s2idle_devops_head, list_node) {
>   		if (handler->prepare)
>   			handler->prepare();
> @@ -600,14 +617,14 @@ void acpi_s2idle_restore_early(void)
>   					ACPI_LPS0_EXIT_AMD :
>   					ACPI_LPS0_EXIT,
>   					lps0_dsm_func_mask, lps0_dsm_guid);
> -	if (lps0_dsm_func_mask_microsoft > 0)
> +
> +	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)
> +		/* Modern Standby exit */
>   		acpi_sleep_run_lps0_dsm(ACPI_LPS0_MS_EXIT,
>   				lps0_dsm_func_mask_microsoft, lps0_dsm_guid_microsoft);
> +	}
>   
>   	/* Screen on */
>   	if (lps0_dsm_func_mask_microsoft > 0)
> 
> 
> 


      reply	other threads:[~2024-02-06 19:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06 19:33 [PATCH v1] ACPI: PM: s2idle: Enable Low-Power S0 Idle MSFT UUID for non-AMD systems Rafael J. Wysocki
2024-02-06 19:58 ` Mario Limonciello [this message]

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=26c73a47-c672-4c99-9c41-aa0bdc162a4c@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=david.e.box@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=stanislaw.gruszka@linux.intel.com \
    /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