Commit 35ed8fa0 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge back earlier cpufreq material for 7.1

parents 6dcf9d00 2e00c2dc
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1944,7 +1944,7 @@ static void cppc_find_dmi_mhz(const struct dmi_header *dm, void *private)
}

/* Look up the max frequency in DMI */
static u64 cppc_get_dmi_max_khz(void)
u64 cppc_get_dmi_max_khz(void)
{
	u16 mhz = 0;

@@ -1958,6 +1958,7 @@ static u64 cppc_get_dmi_max_khz(void)

	return KHZ_PER_MHZ * mhz;
}
EXPORT_SYMBOL_GPL(cppc_get_dmi_max_khz);

/*
 * If CPPC lowest_freq and nominal_freq registers are exposed then we can
+2 −3
Original line number Diff line number Diff line
@@ -163,7 +163,6 @@ config CPU_FREQ_GOV_ONDEMAND

config CPU_FREQ_GOV_CONSERVATIVE
	tristate "'conservative' cpufreq governor"
	depends on CPU_FREQ
	select CPU_FREQ_GOV_COMMON
	help
	  'conservative' - this driver is rather similar to the 'ondemand'
@@ -188,7 +187,7 @@ config CPU_FREQ_GOV_CONSERVATIVE

config CPU_FREQ_GOV_SCHEDUTIL
	bool "'schedutil' cpufreq policy governor"
	depends on CPU_FREQ && SMP
	depends on SMP
	select CPU_FREQ_GOV_ATTR_SET
	select IRQ_WORK
	help
@@ -365,6 +364,6 @@ config ACPI_CPPC_CPUFREQ_FIE

	  If in doubt, say N.

endif
endif # CPU_FREQ

endmenu
+24 −7
Original line number Diff line number Diff line
@@ -675,6 +675,29 @@ static inline u64 get_max_boost_ratio(unsigned int cpu, u64 *nominal_freq)
}
#endif

static void acpi_cpufreq_resolve_max_freq(struct cpufreq_policy *policy,
					  unsigned int pss_max_freq)
{
#ifdef CONFIG_ACPI_CPPC_LIB
	u64 max_speed = cppc_get_dmi_max_khz();
	/*
	 * Use DMI "Max Speed" if it looks plausible: must be
	 * above _PSS P0 frequency and within 2x of it.
	 */
	if (max_speed > pss_max_freq && max_speed < pss_max_freq * 2) {
		policy->cpuinfo.max_freq = max_speed;
		return;
	}
#endif
	/*
	 * If the maximum "boost" frequency is unknown, ask the arch
	 * scale-invariance code to use the "nominal" performance for
	 * CPU utilization scaling so as to prevent the schedutil
	 * governor from selecting inadequate CPU frequencies.
	 */
	arch_set_max_freq_ratio(true);
}

static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
{
	struct cpufreq_frequency_table *freq_table;
@@ -849,13 +872,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)

		policy->cpuinfo.max_freq = freq * max_boost_ratio >> SCHED_CAPACITY_SHIFT;
	} else {
		/*
		 * If the maximum "boost" frequency is unknown, ask the arch
		 * scale-invariance code to use the "nominal" performance for
		 * CPU utilization scaling so as to prevent the schedutil
		 * governor from selecting inadequate CPU frequencies.
		 */
		arch_set_max_freq_ratio(true);
		acpi_cpufreq_resolve_max_freq(policy, freq_table[0].frequency);
	}

	policy->freq_table = freq_table;
+0 −2
Original line number Diff line number Diff line
@@ -769,8 +769,6 @@ static int amd_pstate_cpu_boost_update(struct cpufreq_policy *policy, bool on)
	else if (policy->cpuinfo.max_freq > nominal_freq)
		policy->cpuinfo.max_freq = nominal_freq;

	policy->max = policy->cpuinfo.max_freq;

	if (cppc_state == AMD_PSTATE_PASSIVE) {
		ret = freq_qos_update_request(&cpudata->req[1], policy->cpuinfo.max_freq);
		if (ret < 0)
+2 −8
Original line number Diff line number Diff line
@@ -807,17 +807,11 @@ static int cppc_cpufreq_set_boost(struct cpufreq_policy *policy, int state)
{
	struct cppc_cpudata *cpu_data = policy->driver_data;
	struct cppc_perf_caps *caps = &cpu_data->perf_caps;
	int ret;

	if (state)
		policy->max = cppc_perf_to_khz(caps, caps->highest_perf);
		policy->cpuinfo.max_freq = cppc_perf_to_khz(caps, caps->highest_perf);
	else
		policy->max = cppc_perf_to_khz(caps, caps->nominal_perf);
	policy->cpuinfo.max_freq = policy->max;

	ret = freq_qos_update_request(policy->max_freq_req, policy->max);
	if (ret < 0)
		return ret;
		policy->cpuinfo.max_freq = cppc_perf_to_khz(caps, caps->nominal_perf);

	return 0;
}
Loading