x86, intel, power: Initialize MSR_IA32_ENERGY_PERF_BIAS
[linux-flexiantxendom0-natty.git] / arch / x86 / kernel / cpu / intel.c
index d16c2c5..7c1ca07 100644 (file)
@@ -448,6 +448,24 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
 
        if (cpu_has(c, X86_FEATURE_VMX))
                detect_vmx_virtcap(c);
+
+       /*
+        * Initialize MSR_IA32_ENERGY_PERF_BIAS if BIOS did not.
+        * x86_energy_perf_policy(8) is available to change it at run-time
+        */
+       if (cpu_has(c, X86_FEATURE_EPB)) {
+               u64 epb;
+
+               rdmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
+               if ((epb & 0xF) == 0) {
+                       printk_once(KERN_WARNING, "x86: updated energy_perf_bias"
+                               " to 'normal' from 'performance'\n"
+                               "You can view and update epb via utility,"
+                               " such as x86_energy_perf_policy(8)\n");
+                       epb = (epb & ~0xF) | ENERGY_PERF_BIAS_NORMAL;
+                       wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
+               }
+       }
 }
 
 #ifdef CONFIG_X86_32