diff options
| author | Shyam Sundar S K <Shyam-sundar.S-k@amd.com> | 2025-09-01 16:31:37 +0530 |
|---|---|---|
| committer | Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> | 2025-09-11 11:03:42 +0300 |
| commit | 04199ef48ac2c5f0985a54171da47a218c37b00f (patch) | |
| tree | d5bf563114dc0097f5faf50580c6533528b9ebdd /drivers/platform/x86/amd/pmf/spc.c | |
| parent | platform/x86/amd/pmf: Add helper to verify BIOS input notifications are enabl... (diff) | |
| download | linux-04199ef48ac2c5f0985a54171da47a218c37b00f.tar.gz linux-04199ef48ac2c5f0985a54171da47a218c37b00f.zip | |
platform/x86/amd/pmf: Add custom BIOS input support for AMD_CPU_ID_PS
The PMF ACPI Specification (APMF) has been revised to version 1.3 to allow
for additional custom BIOS inputs, enabling OEMs to have more precise
thermal management of the system. This update includes adding support to
the driver using the new data structure received from the BIOS through the
existing APMF interfaces.
Co-developed-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Signed-off-by: Patil Rajesh Reddy <Patil.Reddy@amd.com>
Tested-by: Yijun Shen <Yijun.Shen@Dell.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Link: https://patch.msgid.link/20250901110140.2519072-7-Shyam-sundar.S-k@amd.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86/amd/pmf/spc.c')
| -rw-r--r-- | drivers/platform/x86/amd/pmf/spc.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/drivers/platform/x86/amd/pmf/spc.c b/drivers/platform/x86/amd/pmf/spc.c index 06b7760b2a8b..1b612e79a3d8 100644 --- a/drivers/platform/x86/amd/pmf/spc.c +++ b/drivers/platform/x86/amd/pmf/spc.c @@ -132,22 +132,46 @@ static void amd_pmf_set_ta_custom_bios_input(struct ta_pmf_enact_table *in, int } } +static void amd_pmf_update_bios_inputs(struct amd_pmf_dev *pdev, u32 pending_req, + const struct amd_pmf_pb_bitmap *inputs, + const u32 *custom_policy, struct ta_pmf_enact_table *in) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(custom_bios_inputs); i++) { + if (!(pending_req & inputs[i].bit_mask)) + continue; + amd_pmf_set_ta_custom_bios_input(in, i, custom_policy[i]); + } +} + static void amd_pmf_get_custom_bios_inputs(struct amd_pmf_dev *pdev, struct ta_pmf_enact_table *in) { - unsigned int i; + if (!(pdev->req.pending_req || pdev->req1.pending_req)) + return; - if (!pdev->req.pending_req) + if (!pdev->smart_pc_enabled) return; - for (i = 0; i < ARRAY_SIZE(custom_bios_inputs); i++) { - if (!(pdev->req.pending_req & custom_bios_inputs[i].bit_mask)) - continue; - amd_pmf_set_ta_custom_bios_input(in, i, pdev->req.custom_policy[i]); + switch (pdev->pmf_if_version) { + case PMF_IF_V1: + if (!is_apmf_bios_input_notifications_supported(pdev)) + return; + amd_pmf_update_bios_inputs(pdev, pdev->req1.pending_req, custom_bios_inputs_v1, + pdev->req1.custom_policy, in); + break; + case PMF_IF_V2: + amd_pmf_update_bios_inputs(pdev, pdev->req.pending_req, custom_bios_inputs, + pdev->req.custom_policy, in); + break; + default: + break; } /* Clear pending requests after handling */ memset(&pdev->req, 0, sizeof(pdev->req)); + memset(&pdev->req1, 0, sizeof(pdev->req1)); } static void amd_pmf_get_c0_residency(u16 *core_res, size_t size, struct ta_pmf_enact_table *in) |
