diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-01 15:01:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-01 15:01:10 -0400 |
commit | ef99f3aee9641d10a7c80d4803d2f0f004c797ca (patch) | |
tree | 83f14ccef66db48fc4178bd8b973462006de86b8 /drivers/cpufreq | |
parent | cb06ff102e2d79a82cf780aa5e6947b2e0529ac0 (diff) | |
parent | 07961ac7c0ee8b546658717034fe692fd12eefa9 (diff) |
Merge 3.9-rc5 into tty-next
We need the fixes here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/acpi-cpufreq.c | 2 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_stats.c | 12 | ||||
-rw-r--r-- | drivers/cpufreq/intel_pstate.c | 34 |
3 files changed, 38 insertions, 10 deletions
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index 937bc286591f..57a8774f0b4e 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c | |||
@@ -730,7 +730,6 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
730 | policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { | 730 | policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { |
731 | cpumask_copy(policy->cpus, perf->shared_cpu_map); | 731 | cpumask_copy(policy->cpus, perf->shared_cpu_map); |
732 | } | 732 | } |
733 | cpumask_copy(policy->related_cpus, perf->shared_cpu_map); | ||
734 | 733 | ||
735 | #ifdef CONFIG_SMP | 734 | #ifdef CONFIG_SMP |
736 | dmi_check_system(sw_any_bug_dmi_table); | 735 | dmi_check_system(sw_any_bug_dmi_table); |
@@ -742,7 +741,6 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
742 | if (check_amd_hwpstate_cpu(cpu) && !acpi_pstate_strict) { | 741 | if (check_amd_hwpstate_cpu(cpu) && !acpi_pstate_strict) { |
743 | cpumask_clear(policy->cpus); | 742 | cpumask_clear(policy->cpus); |
744 | cpumask_set_cpu(cpu, policy->cpus); | 743 | cpumask_set_cpu(cpu, policy->cpus); |
745 | cpumask_copy(policy->related_cpus, cpu_sibling_mask(cpu)); | ||
746 | policy->shared_type = CPUFREQ_SHARED_TYPE_HW; | 744 | policy->shared_type = CPUFREQ_SHARED_TYPE_HW; |
747 | pr_info_once(PFX "overriding BIOS provided _PSD data\n"); | 745 | pr_info_once(PFX "overriding BIOS provided _PSD data\n"); |
748 | } | 746 | } |
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 2fd779eb1ed1..bfd6273fd873 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
@@ -180,15 +180,19 @@ static void cpufreq_stats_free_sysfs(unsigned int cpu) | |||
180 | { | 180 | { |
181 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); | 181 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); |
182 | 182 | ||
183 | if (!cpufreq_frequency_get_table(cpu)) | 183 | if (!policy) |
184 | return; | 184 | return; |
185 | 185 | ||
186 | if (policy && !policy_is_shared(policy)) { | 186 | if (!cpufreq_frequency_get_table(cpu)) |
187 | goto put_ref; | ||
188 | |||
189 | if (!policy_is_shared(policy)) { | ||
187 | pr_debug("%s: Free sysfs stat\n", __func__); | 190 | pr_debug("%s: Free sysfs stat\n", __func__); |
188 | sysfs_remove_group(&policy->kobj, &stats_attr_group); | 191 | sysfs_remove_group(&policy->kobj, &stats_attr_group); |
189 | } | 192 | } |
190 | if (policy) | 193 | |
191 | cpufreq_cpu_put(policy); | 194 | put_ref: |
195 | cpufreq_cpu_put(policy); | ||
192 | } | 196 | } |
193 | 197 | ||
194 | static int cpufreq_stats_create_table(struct cpufreq_policy *policy, | 198 | static int cpufreq_stats_create_table(struct cpufreq_policy *policy, |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index f6dd1e761129..ad72922919ed 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -358,14 +358,14 @@ static void intel_pstate_sysfs_expose_params(void) | |||
358 | static int intel_pstate_min_pstate(void) | 358 | static int intel_pstate_min_pstate(void) |
359 | { | 359 | { |
360 | u64 value; | 360 | u64 value; |
361 | rdmsrl(0xCE, value); | 361 | rdmsrl(MSR_PLATFORM_INFO, value); |
362 | return (value >> 40) & 0xFF; | 362 | return (value >> 40) & 0xFF; |
363 | } | 363 | } |
364 | 364 | ||
365 | static int intel_pstate_max_pstate(void) | 365 | static int intel_pstate_max_pstate(void) |
366 | { | 366 | { |
367 | u64 value; | 367 | u64 value; |
368 | rdmsrl(0xCE, value); | 368 | rdmsrl(MSR_PLATFORM_INFO, value); |
369 | return (value >> 8) & 0xFF; | 369 | return (value >> 8) & 0xFF; |
370 | } | 370 | } |
371 | 371 | ||
@@ -373,7 +373,7 @@ static int intel_pstate_turbo_pstate(void) | |||
373 | { | 373 | { |
374 | u64 value; | 374 | u64 value; |
375 | int nont, ret; | 375 | int nont, ret; |
376 | rdmsrl(0x1AD, value); | 376 | rdmsrl(MSR_NHM_TURBO_RATIO_LIMIT, value); |
377 | nont = intel_pstate_max_pstate(); | 377 | nont = intel_pstate_max_pstate(); |
378 | ret = ((value) & 255); | 378 | ret = ((value) & 255); |
379 | if (ret <= nont) | 379 | if (ret <= nont) |
@@ -454,7 +454,7 @@ static inline void intel_pstate_calc_busy(struct cpudata *cpu, | |||
454 | sample->idletime_us * 100, | 454 | sample->idletime_us * 100, |
455 | sample->duration_us); | 455 | sample->duration_us); |
456 | core_pct = div64_u64(sample->aperf * 100, sample->mperf); | 456 | core_pct = div64_u64(sample->aperf * 100, sample->mperf); |
457 | sample->freq = cpu->pstate.turbo_pstate * core_pct * 1000; | 457 | sample->freq = cpu->pstate.max_pstate * core_pct * 1000; |
458 | 458 | ||
459 | sample->core_pct_busy = div_s64((sample->pstate_pct_busy * core_pct), | 459 | sample->core_pct_busy = div_s64((sample->pstate_pct_busy * core_pct), |
460 | 100); | 460 | 100); |
@@ -752,6 +752,29 @@ static struct cpufreq_driver intel_pstate_driver = { | |||
752 | 752 | ||
753 | static int __initdata no_load; | 753 | static int __initdata no_load; |
754 | 754 | ||
755 | static int intel_pstate_msrs_not_valid(void) | ||
756 | { | ||
757 | /* Check that all the msr's we are using are valid. */ | ||
758 | u64 aperf, mperf, tmp; | ||
759 | |||
760 | rdmsrl(MSR_IA32_APERF, aperf); | ||
761 | rdmsrl(MSR_IA32_MPERF, mperf); | ||
762 | |||
763 | if (!intel_pstate_min_pstate() || | ||
764 | !intel_pstate_max_pstate() || | ||
765 | !intel_pstate_turbo_pstate()) | ||
766 | return -ENODEV; | ||
767 | |||
768 | rdmsrl(MSR_IA32_APERF, tmp); | ||
769 | if (!(tmp - aperf)) | ||
770 | return -ENODEV; | ||
771 | |||
772 | rdmsrl(MSR_IA32_MPERF, tmp); | ||
773 | if (!(tmp - mperf)) | ||
774 | return -ENODEV; | ||
775 | |||
776 | return 0; | ||
777 | } | ||
755 | static int __init intel_pstate_init(void) | 778 | static int __init intel_pstate_init(void) |
756 | { | 779 | { |
757 | int cpu, rc = 0; | 780 | int cpu, rc = 0; |
@@ -764,6 +787,9 @@ static int __init intel_pstate_init(void) | |||
764 | if (!id) | 787 | if (!id) |
765 | return -ENODEV; | 788 | return -ENODEV; |
766 | 789 | ||
790 | if (intel_pstate_msrs_not_valid()) | ||
791 | return -ENODEV; | ||
792 | |||
767 | pr_info("Intel P-state driver initializing.\n"); | 793 | pr_info("Intel P-state driver initializing.\n"); |
768 | 794 | ||
769 | all_cpu_data = vmalloc(sizeof(void *) * num_possible_cpus()); | 795 | all_cpu_data = vmalloc(sizeof(void *) * num_possible_cpus()); |