Skip to content

Commit edef1ef

Browse files
spandruvadarafaeljw
authored andcommitted
ACPI / CPPC: Fix guaranteed performance handling
As per the ACPI specification, "Guaranteed Performance Register" is a "Buffer" field and it cannot be "Integer", so treat the "Integer" type for "Guaranteed Performance Register" field as invalid and ignore its value in that case. Also save one cpc_read() call when "Guaranteed Performance Register" is not present, which means a register defined as: "Register(SystemMemory, 0, 0, 0, 0)". Fixes: 29523f0 ("ACPI / CPPC: Add support for guaranteed performance") Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: 4.20+ <stable@vger.kernel.org> # 4.20+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 8c2ffd9 commit edef1ef

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/acpi/cppc_acpi.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,8 +1150,13 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_caps *perf_caps)
11501150
cpc_read(cpunum, nominal_reg, &nom);
11511151
perf_caps->nominal_perf = nom;
11521152

1153-
cpc_read(cpunum, guaranteed_reg, &guaranteed);
1154-
perf_caps->guaranteed_perf = guaranteed;
1153+
if (guaranteed_reg->type != ACPI_TYPE_BUFFER ||
1154+
IS_NULL_REG(&guaranteed_reg->cpc_entry.reg)) {
1155+
perf_caps->guaranteed_perf = 0;
1156+
} else {
1157+
cpc_read(cpunum, guaranteed_reg, &guaranteed);
1158+
perf_caps->guaranteed_perf = guaranteed;
1159+
}
11551160

11561161
cpc_read(cpunum, lowest_non_linear_reg, &min_nonlinear);
11571162
perf_caps->lowest_nonlinear_perf = min_nonlinear;

0 commit comments

Comments
 (0)