X86 platform drivers
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	platform-driver-x86@vger.kernel.org,  Patil.Reddy@amd.com,
	mario.limonciello@amd.com, Yijun.Shen@dell.com
Subject: Re: [PATCH 09/10] platform/x86/amd/pmf: Call enact function sooner to process early pending requests
Date: Tue, 10 Jun 2025 19:19:49 +0300 (EEST)	[thread overview]
Message-ID: <20e8a15a-0abe-6f14-37f9-d570dcec70b8@linux.intel.com> (raw)
In-Reply-To: <20250509072654.713629-10-Shyam-sundar.S-k@amd.com>

On Fri, 9 May 2025, Shyam Sundar S K wrote:

> Call the amd_pmf_invoke_cmd_enact() function to manage early pending
> requests and their associated custom BIOS inputs. Additionally, add a
> return statement for cases of failure.
> 
> The PMF driver will adjust power settings according to custom BIOS inputs
> after assessing the policy conditions.
> 
> Cc: Yijun Shen <Yijun.Shen@dell.com>
> Co-developed-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
> Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
> ---
>  drivers/platform/x86/amd/pmf/acpi.c   | 18 ++++++++++++++++--
>  drivers/platform/x86/amd/pmf/pmf.h    |  2 ++
>  drivers/platform/x86/amd/pmf/tee-if.c |  3 ++-
>  3 files changed, 20 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/platform/x86/amd/pmf/acpi.c b/drivers/platform/x86/amd/pmf/acpi.c
> index 1521988c1002..a3319ac89fd1 100644
> --- a/drivers/platform/x86/amd/pmf/acpi.c
> +++ b/drivers/platform/x86/amd/pmf/acpi.c
> @@ -339,8 +339,15 @@ static void apmf_event_handler_v2(acpi_handle handle, u32 event, void *data)
>  	guard(mutex)(&pmf_dev->cb_mutex);
>  
>  	ret = apmf_get_sbios_requests_v2(pmf_dev, &pmf_dev->req);
> -	if (ret)
> +	if (ret) {
>  		dev_err(pmf_dev->dev, "Failed to get v2 SBIOS requests: %d\n", ret);
> +		return;
> +	}
> +
> +	if (pmf_dev->cb_flag) {
> +		amd_pmf_invoke_cmd_enact(pmf_dev);
> +		pmf_dev->cb_flag = false;
> +	}
>  }
>  
>  static void apmf_event_handler_v1(acpi_handle handle, u32 event, void *data)
> @@ -351,8 +358,15 @@ static void apmf_event_handler_v1(acpi_handle handle, u32 event, void *data)
>  	guard(mutex)(&pmf_dev->cb_mutex);
>  
>  	ret = apmf_get_sbios_requests_v1(pmf_dev, &pmf_dev->req1);
> -	if (ret)
> +	if (ret) {
>  		dev_err(pmf_dev->dev, "Failed to get v1 SBIOS requests: %d\n", ret);
> +		return;
> +	}
> +
> +	if (pmf_dev->cb_flag) {
> +		amd_pmf_invoke_cmd_enact(pmf_dev);
> +		pmf_dev->cb_flag = false;
> +	}

Why isn't there another function which can be called by both???

>  }
>  
>  static void apmf_event_handler(acpi_handle handle, u32 event, void *data)
> diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h
> index d9e6467be852..71cc94bdbd32 100644
> --- a/drivers/platform/x86/amd/pmf/pmf.h
> +++ b/drivers/platform/x86/amd/pmf/pmf.h
> @@ -404,6 +404,7 @@ struct amd_pmf_dev {
>  	u32 notifications;
>  	struct apmf_sbios_req_v1 req1;
>  	struct pmf_bios_inputs_prev cb_prev; /* To preserve custom BIOS inputs */
> +	bool cb_flag; /* To handle first custom BIOS input */

Please more the comment more to right, preferrably align it with the 
previous line.

>  };
>  
>  struct apmf_sps_prop_granular_v2 {
> @@ -891,5 +892,6 @@ int amd_pmf_smartpc_apply_bios_output(struct amd_pmf_dev *dev, u32 val, u32 preq
>  /* Smart PC - TA interfaces */
>  void amd_pmf_populate_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in);
>  void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in);
> +int amd_pmf_invoke_cmd_enact(struct amd_pmf_dev *dev);
>  
>  #endif /* PMF_H */
> diff --git a/drivers/platform/x86/amd/pmf/tee-if.c b/drivers/platform/x86/amd/pmf/tee-if.c
> index 679c5bf5faca..249683509635 100644
> --- a/drivers/platform/x86/amd/pmf/tee-if.c
> +++ b/drivers/platform/x86/amd/pmf/tee-if.c
> @@ -223,7 +223,7 @@ static void amd_pmf_apply_policies(struct amd_pmf_dev *dev, struct ta_pmf_enact_
>  	}
>  }
>  
> -static int amd_pmf_invoke_cmd_enact(struct amd_pmf_dev *dev)
> +int amd_pmf_invoke_cmd_enact(struct amd_pmf_dev *dev)
>  {
>  	struct ta_pmf_shared_memory *ta_sm = NULL;
>  	struct ta_pmf_enact_result *out = NULL;
> @@ -559,6 +559,7 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
>  		switch (ret) {
>  		case TA_PMF_TYPE_SUCCESS:
>  			status = true;
> +			dev->cb_flag = true;
>  			break;
>  		case TA_ERROR_CRYPTO_INVALID_PARAM:
>  		case TA_ERROR_CRYPTO_BIN_TOO_LARGE:
> 

-- 
 i.


  reply	other threads:[~2025-06-10 16:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-09  7:26 [PATCH 00/10] Enhancements to PMF Driver for Improved Custom BIOS Input Handling Shyam Sundar S K
2025-05-09  7:26 ` [PATCH 01/10] platform/x86/amd/pmf: Add support for adjusting PMF PPT and PPT APU thresholds Shyam Sundar S K
2025-06-10 16:12   ` Ilpo Järvinen
2025-06-17  7:15     ` Shyam Sundar S K
2025-05-09  7:26 ` [PATCH 02/10] platform/x86/amd/pmf: Fix the custom bios input handling mechanism Shyam Sundar S K
2025-05-09  7:26 ` [PATCH 03/10] platform/x86/amd/pmf: Extend custom BIOS inputs for more policies Shyam Sundar S K
2025-06-10 15:58   ` Ilpo Järvinen
2025-05-09  7:26 ` [PATCH 04/10] platform/x86/amd/pmf: Update ta_pmf_action structure member Shyam Sundar S K
2025-05-09  7:26 ` [PATCH 05/10] platform/x86/amd/pmf: Add helper to verify BIOS input notifications are enable/disable Shyam Sundar S K
2025-06-10 16:01   ` Ilpo Järvinen
2025-05-09  7:26 ` [PATCH 06/10] platform/x86/amd/pmf: Add custom BIOS input support for AMD_CPU_ID_PS Shyam Sundar S K
2025-05-09  7:26 ` [PATCH 07/10] platform/x86/amd/pmf: Use amd_pmf_update_bios_inputs() helper Shyam Sundar S K
2025-06-10 15:56   ` Ilpo Järvinen
2025-05-09  7:26 ` [PATCH 08/10] platform/x86/amd/pmf: Preserve custom BIOS inputs for evaluating the policies Shyam Sundar S K
2025-05-09  7:26 ` [PATCH 09/10] platform/x86/amd/pmf: Call enact function sooner to process early pending requests Shyam Sundar S K
2025-06-10 16:19   ` Ilpo Järvinen [this message]
2025-05-09  7:26 ` [PATCH 10/10] platform/x86/amd/pmf: Add debug logs for pending requests and custom BIOS inputs Shyam Sundar S K
2025-05-12  8:13 ` [PATCH 00/10] Enhancements to PMF Driver for Improved Custom BIOS Input Handling Shen, Yijun
2025-05-12 17:26 ` Mario Limonciello

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=20e8a15a-0abe-6f14-37f9-d570dcec70b8@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=Patil.Reddy@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=Yijun.Shen@dell.com \
    --cc=hdegoede@redhat.com \
    --cc=mario.limonciello@amd.com \
    --cc=platform-driver-x86@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