Skip to content

Commit b016296

Browse files
committed
platform/x86/amd/pmf: Call enact function sooner to process early pending requests
JIRA: https://issues.redhat.com/browse/RHEL-73301 commit 62214d9 Author: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> Date: Mon Sep 1 16:31:39 2025 +0530 platform/x86/amd/pmf: Call enact function sooner to process early pending requests Call the amd_pmf_invoke_cmd_enact() function to manage early pending requests and their associated custom BIOS inputs. 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. Also, add a new common routine amd_pmf_handle_early_preq() to handle early BIOS pending requests for both v1 and v2 variants. 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-9-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> Signed-off-by: Steve Best <sbest@redhat.com>
1 parent fc39660 commit b016296

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

drivers/platform/x86/amd/pmf/acpi.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,15 @@ int apmf_get_sbios_requests(struct amd_pmf_dev *pdev, struct apmf_sbios_req *req
331331
req, sizeof(*req));
332332
}
333333

334+
static void amd_pmf_handle_early_preq(struct amd_pmf_dev *pdev)
335+
{
336+
if (!pdev->cb_flag)
337+
return;
338+
339+
amd_pmf_invoke_cmd_enact(pdev);
340+
pdev->cb_flag = false;
341+
}
342+
334343
static void apmf_event_handler_v2(acpi_handle handle, u32 event, void *data)
335344
{
336345
struct amd_pmf_dev *pmf_dev = data;
@@ -339,8 +348,12 @@ static void apmf_event_handler_v2(acpi_handle handle, u32 event, void *data)
339348
guard(mutex)(&pmf_dev->cb_mutex);
340349

341350
ret = apmf_get_sbios_requests_v2(pmf_dev, &pmf_dev->req);
342-
if (ret)
351+
if (ret) {
343352
dev_err(pmf_dev->dev, "Failed to get v2 SBIOS requests: %d\n", ret);
353+
return;
354+
}
355+
356+
amd_pmf_handle_early_preq(pmf_dev);
344357
}
345358

346359
static void apmf_event_handler_v1(acpi_handle handle, u32 event, void *data)
@@ -351,8 +364,12 @@ static void apmf_event_handler_v1(acpi_handle handle, u32 event, void *data)
351364
guard(mutex)(&pmf_dev->cb_mutex);
352365

353366
ret = apmf_get_sbios_requests_v1(pmf_dev, &pmf_dev->req1);
354-
if (ret)
367+
if (ret) {
355368
dev_err(pmf_dev->dev, "Failed to get v1 SBIOS requests: %d\n", ret);
369+
return;
370+
}
371+
372+
amd_pmf_handle_early_preq(pmf_dev);
356373
}
357374

358375
static void apmf_event_handler(acpi_handle handle, u32 event, void *data)

drivers/platform/x86/amd/pmf/pmf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ struct amd_pmf_dev {
405405
u32 notifications;
406406
struct apmf_sbios_req_v1 req1;
407407
struct pmf_bios_inputs_prev cb_prev; /* To preserve custom BIOS inputs */
408+
bool cb_flag; /* To handle first custom BIOS input */
408409
};
409410

410411
struct apmf_sps_prop_granular_v2 {
@@ -885,5 +886,6 @@ int amd_pmf_smartpc_apply_bios_output(struct amd_pmf_dev *dev, u32 val, u32 preq
885886
/* Smart PC - TA interfaces */
886887
void amd_pmf_populate_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in);
887888
void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in);
889+
int amd_pmf_invoke_cmd_enact(struct amd_pmf_dev *dev);
888890

889891
#endif /* PMF_H */

drivers/platform/x86/amd/pmf/tee-if.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ static void amd_pmf_apply_policies(struct amd_pmf_dev *dev, struct ta_pmf_enact_
225225
}
226226
}
227227

228-
static int amd_pmf_invoke_cmd_enact(struct amd_pmf_dev *dev)
228+
int amd_pmf_invoke_cmd_enact(struct amd_pmf_dev *dev)
229229
{
230230
struct ta_pmf_shared_memory *ta_sm = NULL;
231231
struct ta_pmf_enact_result *out = NULL;
@@ -577,8 +577,10 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
577577
ret = amd_pmf_start_policy_engine(dev);
578578
dev_dbg(dev->dev, "start policy engine ret: %d\n", ret);
579579
status = ret == TA_PMF_TYPE_SUCCESS;
580-
if (status)
580+
if (status) {
581+
dev->cb_flag = true;
581582
break;
583+
}
582584
amd_pmf_tee_deinit(dev);
583585
}
584586

0 commit comments

Comments
 (0)