mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 04:34:03 +02:00
ACPI: CPPC: Evaluate performance-control PCC use once
cppc_set_perf() evaluates the same immutable address-space predicates before and after each phase of a performance-control update. This repeats the three-control PCC test three times for every target request. Evaluate the predicate once after resolving the control descriptors and reuse the result throughout the transaction. Signed-off-by: Christian Loehle <christian.loehle@arm.com> Link: https://patch.msgid.link/20260803210527.1285229-4-christian.loehle@arm.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
9c5ab33a6d
commit
b0f51f98fb
|
|
@ -2012,6 +2012,7 @@ int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls)
|
|||
struct cpc_register_resource *desired_reg, *min_perf_reg, *max_perf_reg;
|
||||
int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpu);
|
||||
struct cppc_pcc_data *pcc_ss_data = NULL;
|
||||
bool regs_in_pcc;
|
||||
int ret = 0;
|
||||
|
||||
if (!cpc_desc) {
|
||||
|
|
@ -2022,6 +2023,8 @@ int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls)
|
|||
desired_reg = &cpc_desc->cpc_regs[DESIRED_PERF];
|
||||
min_perf_reg = &cpc_desc->cpc_regs[MIN_PERF];
|
||||
max_perf_reg = &cpc_desc->cpc_regs[MAX_PERF];
|
||||
regs_in_pcc = CPC_IN_PCC(desired_reg) || CPC_IN_PCC(min_perf_reg) ||
|
||||
CPC_IN_PCC(max_perf_reg);
|
||||
|
||||
/*
|
||||
* This is Phase-I where we want to write to CPC registers
|
||||
|
|
@ -2030,7 +2033,7 @@ int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls)
|
|||
* Since read_lock can be acquired by multiple CPUs simultaneously we
|
||||
* achieve that goal here
|
||||
*/
|
||||
if (CPC_IN_PCC(desired_reg) || CPC_IN_PCC(min_perf_reg) || CPC_IN_PCC(max_perf_reg)) {
|
||||
if (regs_in_pcc) {
|
||||
if (pcc_ss_id < 0) {
|
||||
pr_debug("Invalid pcc_ss_id\n");
|
||||
return -ENODEV;
|
||||
|
|
@ -2066,7 +2069,7 @@ int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls)
|
|||
if (perf_ctrls->max_perf && CPC_SUPPORTED(max_perf_reg))
|
||||
cpc_write(cpu, max_perf_reg, perf_ctrls->max_perf);
|
||||
|
||||
if (CPC_IN_PCC(desired_reg) || CPC_IN_PCC(min_perf_reg) || CPC_IN_PCC(max_perf_reg))
|
||||
if (regs_in_pcc)
|
||||
up_read(&pcc_ss_data->pcc_lock); /* END Phase-I */
|
||||
/*
|
||||
* This is Phase-II where we transfer the ownership of PCC to Platform
|
||||
|
|
@ -2114,7 +2117,7 @@ int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls)
|
|||
* case during a CMD_READ and if there are pending writes it delivers
|
||||
* the write command before servicing the read command
|
||||
*/
|
||||
if (CPC_IN_PCC(desired_reg) || CPC_IN_PCC(min_perf_reg) || CPC_IN_PCC(max_perf_reg)) {
|
||||
if (regs_in_pcc) {
|
||||
if (down_write_trylock(&pcc_ss_data->pcc_lock)) {/* BEGIN Phase-II */
|
||||
/* Update only if there are pending write commands */
|
||||
if (pcc_ss_data->pending_pcc_write_cmd)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user