Re: [PATCH 1/3] ACPI: CPPC: Add get the highest perf register value support

From: Tony W Wang-oc
Date: Wed Jan 31 2024 - 05:53:29 EST



On 2024/1/18 06:07, Ricardo Neri wrote:

[这封邮件来自外部发件人]

On Thu, Dec 28, 2023 at 03:57:03PM +0800, Tony W Wang-oc wrote:
Add function cppc_get_highest_perf in generic CPPC driver to get the
highest perf register value for specified core.

Signed-off-by: Tony W Wang-oc <TonyWWang-oc@xxxxxxxxxxx>
---
drivers/acpi/cppc_acpi.c | 13 +++++++++++++
include/acpi/cppc_acpi.h | 5 +++++
2 files changed, 18 insertions(+)

diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index 7ff269a78c20..1a77c514d007 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -1154,6 +1154,19 @@ int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf)
return cppc_get_perf(cpunum, NOMINAL_PERF, nominal_perf);
}

+/**
+ * cppc_get_highest_perf - Get the highest performance register value.
+ * @cpunum: CPU from which to get highest performance.
+ * @highest_perf: Return address.
+ *
+ * Return: 0 for success, -EIO otherwise.
+ */
+int cppc_get_highest_perf(int cpunum, u64 *highest_perf)
+{
+ return cppc_get_perf(cpunum, HIGHEST_PERF, highest_perf);
+}
+EXPORT_SYMBOL_GPL(cppc_get_highest_perf);
The Intel P-State driver uses cppc_get_perf_caps(). You would not need to
export this function.

Having said that, the Intel P-State driver could also use this new
function, IMO. AFAICS, it does not *have* to use cppc_get_perf_caps().

Yes, you are right.