Merge branches 'pm-cpufreq-x86', 'pm-cpufreq-docs' and 'intel_pstate'
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 3 Aug 2017 18:29:24 +0000 (20:29 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 3 Aug 2017 18:29:24 +0000 (20:29 +0200)
* pm-cpufreq-x86:
  cpufreq: x86: Make scaling_cur_freq behave more as expected

* pm-cpufreq-docs:
  cpufreq: docs: Add missing cpuinfo_cur_freq description

* intel_pstate:
  cpufreq: intel_pstate: Drop ->get from intel_pstate structure

1  2  3  4 
drivers/cpufreq/intel_pstate.c

index 6cd50352563894bea24866d2d36d6b815d0abc20,6cd50352563894bea24866d2d36d6b815d0abc20,6cd50352563894bea24866d2d36d6b815d0abc20,bf6af77cd945f786c3c3a65f94346f66165ff325..0566455f233ed3cd663506321f08f7ae546862be
@@@@@ -656,12 -656,12 -656,12 -656,6 +656,12 @@@@@ static const char * const energy_perf_s
        "power",
        NULL
    };
   +static const unsigned int epp_values[] = {
   +    HWP_EPP_PERFORMANCE,
   +    HWP_EPP_BALANCE_PERFORMANCE,
   +    HWP_EPP_BALANCE_POWERSAVE,
   +    HWP_EPP_POWERSAVE
   +};
    
    static int intel_pstate_get_energy_pref_index(struct cpudata *cpu_data)
    {
                return epp;
    
        if (static_cpu_has(X86_FEATURE_HWP_EPP)) {
   -            /*
   -             * Range:
   -             *      0x00-0x3F       :       Performance
   -             *      0x40-0x7F       :       Balance performance
   -             *      0x80-0xBF       :       Balance power
   -             *      0xC0-0xFF       :       Power
   -             * The EPP is a 8 bit value, but our ranges restrict the
   -             * value which can be set. Here only using top two bits
   -             * effectively.
   -             */
   -            index = (epp >> 6) + 1;
   +            if (epp == HWP_EPP_PERFORMANCE)
   +                    return 1;
   +            if (epp <= HWP_EPP_BALANCE_PERFORMANCE)
   +                    return 2;
   +            if (epp <= HWP_EPP_BALANCE_POWERSAVE)
   +                    return 3;
   +            else
   +                    return 4;
        } else if (static_cpu_has(X86_FEATURE_EPB)) {
                /*
                 * Range:
@@@@@ -718,8 -718,8 -718,8 -715,15 +718,8 @@@@@ static int intel_pstate_set_energy_pref
    
                value &= ~GENMASK_ULL(31, 24);
    
   -            /*
   -             * If epp is not default, convert from index into
   -             * energy_perf_strings to epp value, by shifting 6
   -             * bits left to use only top two bits in epp.
   -             * The resultant epp need to shifted by 24 bits to
   -             * epp position in MSR_HWP_REQUEST.
   -             */
                if (epp == -EINVAL)
   -                    epp = (pref_index - 1) << 6;
   +                    epp = epp_values[pref_index - 1];
    
                value |= (u64)epp << 24;
                ret = wrmsrl_on_cpu(cpu_data->cpu, MSR_HWP_REQUEST, value);
@@@@@ -1219,7 -1219,7 -1219,7 -1223,7 +1219,7 @@@@@ static struct attribute *intel_pstate_a
        NULL
    };
    
   -static struct attribute_group intel_pstate_attr_group = {
   +static const struct attribute_group intel_pstate_attr_group = {
        .attrs = intel_pstate_attributes,
    };
    
@@@@@ -1922,13 -1922,13 -1922,13 -1926,6 +1922,6 @@@@@ static int intel_pstate_init_cpu(unsign
        return 0;
    }
    
--- static unsigned int intel_pstate_get(unsigned int cpu_num)
--- {
---     struct cpudata *cpu = all_cpu_data[cpu_num];
--- 
---     return cpu ? get_avg_frequency(cpu) : 0;
--- }
--- 
    static void intel_pstate_set_update_util_hook(unsigned int cpu_num)
    {
        struct cpudata *cpu = all_cpu_data[cpu_num];
@@@@@ -2169,7 -2169,7 -2169,7 -2166,6 +2162,6 @@@@@ static struct cpufreq_driver intel_psta
        .setpolicy      = intel_pstate_set_policy,
        .suspend        = intel_pstate_hwp_save_state,
        .resume         = intel_pstate_resume,
---     .get            = intel_pstate_get,
        .init           = intel_pstate_cpu_init,
        .exit           = intel_pstate_cpu_exit,
        .stop_cpu       = intel_pstate_stop_cpu,