• Srinivas Pandruvada's avatar
    cpufreq: intel_pstate: Allow enable/disable energy efficiency · ed7bde7a
    Srinivas Pandruvada authored
    By default intel_pstate the driver disables energy efficiency by setting
    MSR_IA32_POWER_CTL bit 19 for Kaby Lake desktop CPU model in HWP mode.
    This CPU model is also shared by Coffee Lake desktop CPUs. This allows
    these systems to reach maximum possible frequency. But this adds power
    penalty, which some customers don't want. They want some way to enable/
    disable dynamically.
    
    So, add an additional attribute "energy_efficiency" under
    /sys/devices/system/cpu/intel_pstate/ for these CPU models. This allows
    to read and write bit 19 ("Disable Energy Efficiency Optimization") in
    the MSR IA32_POWER_CTL.
    
    This attribute is present in both HWP and non-HWP mode as this has an
    effect in both modes. Refer to Intel Software Developer's manual for
    details.
    
    The scope of this bit is package wide. Also these systems are single
    package systems. So read/write MSR on the current CPU is enough.
    
    The energy efficiency (EE) bit setting needs to be preserved during
    suspend/resume and CPU offline/online operation. To do this:
    - Restoring the EE setting from the cpufreq resume() callback, if there
    is change from the system default.
    - By default, don't disable EE from cpufreq init() callback for matching
    CPU models. Since the scope is package wide and is a single package
    system, move the disable EE calls from init() callback to
    intel_pstate_init() function, which is called only once.
    Suggested-by: default avatarLen Brown <lenb@kernel.org>
    Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    ed7bde7a
intel_pstate.c 71.2 KB