Commit bb31fef0 authored by Gautham R. Shenoy's avatar Gautham R. Shenoy Committed by Mario Limonciello (AMD)
Browse files

cpufreq/amd-pstate: Call cppc_set_auto_sel() only for online CPUs



amd_pstate_change_mode_without_dvr_change() calls cppc_set_auto_sel()
for all the present CPUs.

However, this callpath eventually calls cppc_set_reg_val() which
accesses the per-cpu cpc_desc_ptr object. This object is initialized
only for online CPUs via acpi_soft_cpu_online() -->
__acpi_processor_start() --> acpi_cppc_processor_probe().

Hence, restrict calling cppc_set_auto_sel() to only the online CPUs.

Fixes: 3ca7bc81 ("cpufreq: amd-pstate: Add guided mode control support via sysfs")
Suggested-by: default avatarMario Limonciello (AMD) (kernel.org) <superm1@kernel.org>
Signed-off-by: default avatarGautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: default avatarMario Limonciello (AMD) <superm1@kernel.org>
parent 077f2357
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1278,7 +1278,7 @@ static int amd_pstate_change_mode_without_dvr_change(int mode)
	if (cpu_feature_enabled(X86_FEATURE_CPPC) || cppc_state == AMD_PSTATE_ACTIVE)
		return 0;

	for_each_present_cpu(cpu) {
	for_each_online_cpu(cpu) {
		cppc_set_auto_sel(cpu, (cppc_state == AMD_PSTATE_PASSIVE) ? 0 : 1);
	}