Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Shyam Sundar S K and committed by
Ilpo Järvinen
62214d94 b21ec883

+25 -4
+19 -2
drivers/platform/x86/amd/pmf/acpi.c
··· 331 331 req, sizeof(*req)); 332 332 } 333 333 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 + 334 343 static void apmf_event_handler_v2(acpi_handle handle, u32 event, void *data) 335 344 { 336 345 struct amd_pmf_dev *pmf_dev = data; ··· 348 339 guard(mutex)(&pmf_dev->cb_mutex); 349 340 350 341 ret = apmf_get_sbios_requests_v2(pmf_dev, &pmf_dev->req); 351 - if (ret) 342 + if (ret) { 352 343 dev_err(pmf_dev->dev, "Failed to get v2 SBIOS requests: %d\n", ret); 344 + return; 345 + } 346 + 347 + amd_pmf_handle_early_preq(pmf_dev); 353 348 } 354 349 355 350 static void apmf_event_handler_v1(acpi_handle handle, u32 event, void *data) ··· 364 351 guard(mutex)(&pmf_dev->cb_mutex); 365 352 366 353 ret = apmf_get_sbios_requests_v1(pmf_dev, &pmf_dev->req1); 367 - if (ret) 354 + if (ret) { 368 355 dev_err(pmf_dev->dev, "Failed to get v1 SBIOS requests: %d\n", ret); 356 + return; 357 + } 358 + 359 + amd_pmf_handle_early_preq(pmf_dev); 369 360 } 370 361 371 362 static void apmf_event_handler(acpi_handle handle, u32 event, void *data)
+2
drivers/platform/x86/amd/pmf/pmf.h
··· 405 405 u32 notifications; 406 406 struct apmf_sbios_req_v1 req1; 407 407 struct pmf_bios_inputs_prev cb_prev; /* To preserve custom BIOS inputs */ 408 + bool cb_flag; /* To handle first custom BIOS input */ 408 409 }; 409 410 410 411 struct apmf_sps_prop_granular_v2 { ··· 886 885 /* Smart PC - TA interfaces */ 887 886 void amd_pmf_populate_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in); 888 887 void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in); 888 + int amd_pmf_invoke_cmd_enact(struct amd_pmf_dev *dev); 889 889 890 890 #endif /* PMF_H */
+4 -2
drivers/platform/x86/amd/pmf/tee-if.c
··· 225 225 } 226 226 } 227 227 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) 229 229 { 230 230 struct ta_pmf_shared_memory *ta_sm = NULL; 231 231 struct ta_pmf_enact_result *out = NULL; ··· 577 577 ret = amd_pmf_start_policy_engine(dev); 578 578 dev_dbg(dev->dev, "start policy engine ret: %d\n", ret); 579 579 status = ret == TA_PMF_TYPE_SUCCESS; 580 - if (status) 580 + if (status) { 581 + dev->cb_flag = true; 581 582 break; 583 + } 582 584 amd_pmf_tee_deinit(dev); 583 585 } 584 586