mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 13:23:02 -04:00
cpufreq/amd-pstate: Cache the firmware programmed EPP value
At CPU EPP initialization, the private cpudata structure is allocated via kzalloc, which means cpudata->cppc_req_cached is initialized to 0. This makes the default cached EPP value 0 (AMD_CPPC_EPP_PERFORMANCE). When initializing a system that defaults to performance EPP, the driver attempts to configure the EPP via amd_pstate_set_epp(). Because the requested EPP (0) matches the uninitialized cached value (0), the cache guard check triggers, and the driver skips writing to the hardware. Cache the firmware-programmed default EPP value in cppc_req_cached during CPU EPP initialization. This saves on an unnecessary reprogramming later when the EPP is first set. Assisted-by: Antigravity:gemini-3.5-flash Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com> Tested-by: K Prateek Nayak <kprateek.nayak@amd.com> Signed-off-by: Marco Scardovi <scardracs@disroot.org> Link: https://lore.kernel.org/r/20260609073042.81275-4-scardracs@disroot.org Signed-off-by: Mario Limonciello <superm1@kernel.org>
This commit is contained in:
committed by
Mario Limonciello
parent
9dfd13f80c
commit
d0f4c1c8cb
@@ -1922,12 +1922,13 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)
|
||||
|
||||
policy->boost_supported = READ_ONCE(cpudata->boost_supported);
|
||||
|
||||
/* Fetch the firmware programmed default EPP value */
|
||||
/* Cache the firmware programmed EPP */
|
||||
default_epp = amd_pstate_get_epp(cpudata);
|
||||
if (default_epp < 0) {
|
||||
ret = default_epp;
|
||||
goto free_cpudata1;
|
||||
}
|
||||
FIELD_MODIFY(AMD_CPPC_EPP_PERF_MASK, &cpudata->cppc_req_cached, default_epp);
|
||||
|
||||
/*
|
||||
* Set the policy to provide a valid fallback value in case
|
||||
|
||||
Reference in New Issue
Block a user