Skip to content
  • Viresh Kumar's avatar
    cpufreq: CPPC: Add support for frequency invariance · 7e9e1554
    Viresh Kumar authored and Ionela Voinescu's avatar Ionela Voinescu committed
    
    
    The Frequency Invariance Engine (FIE) is providing a frequency scaling
    correction factor that helps achieve more accurate load-tracking.
    
    Normally, this scaling factor can be obtained directly with the help of
    the cpufreq drivers as they know the exact frequency the hardware is
    running at. But that isn't the case for CPPC cpufreq driver.
    
    Another way of obtaining that is using the arch specific counter
    support, which is already present in kernel, but that hardware is
    optional for platforms.
    
    This patch updates the CPPC driver to register itself with the topology
    core to provide its own implementation (cppc_scale_freq_tick()) of
    topology_scale_freq_tick() which gets called by the scheduler on every
    tick. Note that the arch specific counters have higher priority than
    CPPC counters, if available, though the CPPC driver doesn't need to have
    any special handling for that.
    
    On an invocation of cppc_scale_freq_tick(), we schedule an irq work
    (since we reach here from hard-irq context), which then schedules a
    normal work item and cppc_scale_freq_workfn() updates the per_cpu
    freq_scale variable based on the counter updates since the last tick.
    
    To allow platforms to disable frequency invariance support if they want,
    this is all done under CONFIG_ACPI_CPPC_CPUFREQ_FIE, which is enabled by
    default.
    
    This also exports sched_setattr_nocheck() as the CPPC driver can be
    built as a module.
    
    Cc: Ionela Voinescu <ionela.voinescu@arm.com>
    Cc: linux-acpi@vger.kernel.org
    Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
    7e9e1554