Skip to content

Commit 6380b7b

Browse files
pierregondoisrafaeljw
authored andcommitted
ACPI: CPPC: Assume no transition latency if no PCCT
The transition_delay_us (struct cpufreq_policy) is currently defined as: Preferred average time interval between consecutive invocations of the driver to set the frequency for this policy. To be set by the scaling driver (0, which is the default, means no preference). The transition_latency represents the amount of time necessary for a CPU to change its frequency. A PCCT table advertises mutliple values: - pcc_nominal: Expected latency to process a command, in microseconds - pcc_mpar: The maximum number of periodic requests that the subspace channel can support, reported in commands per minute. 0 indicates no limitation. - pcc_mrtt: The minimum amount of time that OSPM must wait after the completion of a command before issuing the next command, in microseconds. cppc_get_transition_latency() allows to get the max of them. commit d4f3388 ("cpufreq / CPPC: Set platform specific transition_delay_us") allows to select transition_delay_us based on the platform, and fallbacks to cppc_get_transition_latency() otherwise. If _CPC objects are not using PCC channels (no PPCT table), the transition_delay_us is set to CPUFREQ_ETERNAL, leading to really long periods between frequency updates (~4s). If the desired_reg, where performance requests are written, is in SystemMemory or SystemIo ACPI address space, there is no delay in requests. So return 0 instead of CPUFREQ_ETERNAL, leading to transition_delay_us being set to LATENCY_MULTIPLIER us (1000 us). This patch also adds two macros to check the address spaces. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 72f2ecb commit 6380b7b

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

drivers/acpi/cppc_acpi.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr);
100100
(cpc)->cpc_entry.reg.space_id == \
101101
ACPI_ADR_SPACE_PLATFORM_COMM)
102102

103+
/* Check if a CPC register is in SystemMemory */
104+
#define CPC_IN_SYSTEM_MEMORY(cpc) ((cpc)->type == ACPI_TYPE_BUFFER && \
105+
(cpc)->cpc_entry.reg.space_id == \
106+
ACPI_ADR_SPACE_SYSTEM_MEMORY)
107+
108+
/* Check if a CPC register is in SystemIo */
109+
#define CPC_IN_SYSTEM_IO(cpc) ((cpc)->type == ACPI_TYPE_BUFFER && \
110+
(cpc)->cpc_entry.reg.space_id == \
111+
ACPI_ADR_SPACE_SYSTEM_IO)
112+
103113
/* Evaluates to True if reg is a NULL register descriptor */
104114
#define IS_NULL_REG(reg) ((reg)->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY && \
105115
(reg)->address == 0 && \
@@ -1456,6 +1466,9 @@ EXPORT_SYMBOL_GPL(cppc_set_perf);
14561466
* transition latency for performance change requests. The closest we have
14571467
* is the timing information from the PCCT tables which provides the info
14581468
* on the number and frequency of PCC commands the platform can handle.
1469+
*
1470+
* If desired_reg is in the SystemMemory or SystemIo ACPI address space,
1471+
* then assume there is no latency.
14591472
*/
14601473
unsigned int cppc_get_transition_latency(int cpu_num)
14611474
{
@@ -1481,7 +1494,9 @@ unsigned int cppc_get_transition_latency(int cpu_num)
14811494
return CPUFREQ_ETERNAL;
14821495

14831496
desired_reg = &cpc_desc->cpc_regs[DESIRED_PERF];
1484-
if (!CPC_IN_PCC(desired_reg))
1497+
if (CPC_IN_SYSTEM_MEMORY(desired_reg) || CPC_IN_SYSTEM_IO(desired_reg))
1498+
return 0;
1499+
else if (!CPC_IN_PCC(desired_reg))
14851500
return CPUFREQ_ETERNAL;
14861501

14871502
if (pcc_ss_id < 0)

0 commit comments

Comments
 (0)