Commit 53d4d315 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge branch 'pm-cpufreq'

Merge cpufreq fixes and cleanups, mostly on top of those fixes, for
6.18-rc1:

 - Make cpufreq drivers setting the default CPU transition latency to
   CPUFREQ_ETERNAL specify a proper default transition latency value
   instead which addresses a regression introduced during the 6.6 cycle
   that broke CPUFREQ_ETERNAL handling (Rafael Wysocki)

 - Make the cpufreq CPPC driver use a proper transition delay value
   when CPUFREQ_ETERNAL is returned by cppc_get_transition_latency() to
   indicate an error condition (Rafael Wysocki)

 - Make cppc_get_transition_latency() return a negative error code to
   indicate error conditions instead of using CPUFREQ_ETERNAL for this
   purpose and drop CPUFREQ_ETERNAL that has no other users (Rafael
   Wysocki, Gopi Krishna Menon)

 - Fix device leak in the mediatek cpufreq driver (Johan Hovold)

 - Set target frequency on all CPUs sharing a policy during frequency
   updates in the tegra186 cpufreq driver and make it initialize all
   cores to max frequencies (Aaron Kling)

 - Rust cpufreq helper cleanup (Thorsten Blum)

* pm-cpufreq:
  docs/zh_CN: Fix malformed table
  docs/zh_TW: Fix malformed table
  cpufreq: Drop unused symbol CPUFREQ_ETERNAL
  ACPI: CPPC: Do not use CPUFREQ_ETERNAL as an error value
  cpufreq: CPPC: Avoid using CPUFREQ_ETERNAL as transition delay
  cpufreq: Make drivers using CPUFREQ_ETERNAL specify transition latency
  cpufreq: tegra186: Initialize all cores to max frequencies
  cpufreq: tegra186: Set target frequency for all cpus in policy
  rust: cpufreq: streamline find_supply_names
  cpufreq: mediatek: fix device leak on probe failure
parents 05f084d2 7e8f305a
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -274,10 +274,6 @@ are the following:
	The time it takes to switch the CPUs belonging to this policy from one
	P-state to another, in nanoseconds.

	If unknown or if known to be so high that the scaling driver does not
	work with the `ondemand`_ governor, -1 (:c:macro:`CPUFREQ_ETERNAL`)
	will be returned by reads from this attribute.

``related_cpus``
	List of all (online and offline) CPUs belonging to this policy.

+1 −2
Original line number Diff line number Diff line
@@ -109,8 +109,7 @@ Then, the driver must fill in the following values:
+-----------------------------------+--------------------------------------+
|policy->cpuinfo.transition_latency | the time it takes on this CPU to	   |
|				    | switch between two frequencies in	   |
|				    | nanoseconds (if appropriate, else	   |
|				    | specify CPUFREQ_ETERNAL)		   |
|				    | nanoseconds                          |
+-----------------------------------+--------------------------------------+
|policy->cur			    | The current operating frequency of   |
|				    | this CPU (if appropriate)		   |
+1 −2
Original line number Diff line number Diff line
@@ -112,8 +112,7 @@ CPUfreq核心层注册一个cpufreq_driver结构体。
|                                   |                                      |
+-----------------------------------+--------------------------------------+
|policy->cpuinfo.transition_latency | CPU在两个频率之间切换所需的时间,以  |
|                                   | 纳秒为单位(如不适用,设定为         |
|                                   | CPUFREQ_ETERNAL)                    |
|                                   | 纳秒为单位                           |
|                                   |                                      |
+-----------------------------------+--------------------------------------+
|policy->cur                        | 该CPU当前的工作频率(如适用)          |
+1 −2
Original line number Diff line number Diff line
@@ -112,8 +112,7 @@ CPUfreq核心層註冊一個cpufreq_driver結構體。
|                                   |                                      |
+-----------------------------------+--------------------------------------+
|policy->cpuinfo.transition_latency | CPU在兩個頻率之間切換所需的時間,以  |
|                                   | 納秒爲單位(如不適用,設定爲         |
|                                   | CPUFREQ_ETERNAL)                    |
|                                   | 納秒爲單位                           |
|                                   |                                      |
+-----------------------------------+--------------------------------------+
|policy->cur                        | 該CPU當前的工作頻率(如適用)          |
+7 −9
Original line number Diff line number Diff line
@@ -1876,7 +1876,7 @@ EXPORT_SYMBOL_GPL(cppc_set_perf);
 * If desired_reg is in the SystemMemory or SystemIo ACPI address space,
 * then assume there is no latency.
 */
unsigned int cppc_get_transition_latency(int cpu_num)
int cppc_get_transition_latency(int cpu_num)
{
	/*
	 * Expected transition latency is based on the PCCT timing values
@@ -1889,31 +1889,29 @@ unsigned int cppc_get_transition_latency(int cpu_num)
	 *              completion of a command before issuing the next command,
	 *              in microseconds.
	 */
	unsigned int latency_ns = 0;
	struct cpc_desc *cpc_desc;
	struct cpc_register_resource *desired_reg;
	int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpu_num);
	struct cppc_pcc_data *pcc_ss_data;
	int latency_ns = 0;

	cpc_desc = per_cpu(cpc_desc_ptr, cpu_num);
	if (!cpc_desc)
		return CPUFREQ_ETERNAL;
		return -ENODATA;

	desired_reg = &cpc_desc->cpc_regs[DESIRED_PERF];
	if (CPC_IN_SYSTEM_MEMORY(desired_reg) || CPC_IN_SYSTEM_IO(desired_reg))
		return 0;
	else if (!CPC_IN_PCC(desired_reg))
		return CPUFREQ_ETERNAL;

	if (pcc_ss_id < 0)
		return CPUFREQ_ETERNAL;
	if (!CPC_IN_PCC(desired_reg) || pcc_ss_id < 0)
		return -ENODATA;

	pcc_ss_data = pcc_data[pcc_ss_id];
	if (pcc_ss_data->pcc_mpar)
		latency_ns = 60 * (1000 * 1000 * 1000 / pcc_ss_data->pcc_mpar);

	latency_ns = max(latency_ns, pcc_ss_data->pcc_nominal * 1000);
	latency_ns = max(latency_ns, pcc_ss_data->pcc_mrtt * 1000);
	latency_ns = max_t(int, latency_ns, pcc_ss_data->pcc_nominal * 1000);
	latency_ns = max_t(int, latency_ns, pcc_ss_data->pcc_mrtt * 1000);

	return latency_ns;
}
Loading