These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / arch / x86 / kernel / cpu / intel.c
index 50163fa..209ac1e 100644 (file)
@@ -97,6 +97,7 @@ static void early_init_intel(struct cpuinfo_x86 *c)
                switch (c->x86_model) {
                case 0x27:      /* Penwell */
                case 0x35:      /* Cloverview */
+               case 0x4a:      /* Merrifield */
                        set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC_S3);
                        break;
                default:
@@ -371,6 +372,36 @@ static void detect_vmx_virtcap(struct cpuinfo_x86 *c)
        }
 }
 
+static void init_intel_energy_perf(struct cpuinfo_x86 *c)
+{
+       u64 epb;
+
+       /*
+        * Initialize MSR_IA32_ENERGY_PERF_BIAS if not already initialized.
+        * (x86_energy_perf_policy(8) is available to change it at run-time.)
+        */
+       if (!cpu_has(c, X86_FEATURE_EPB))
+               return;
+
+       rdmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
+       if ((epb & 0xF) != ENERGY_PERF_BIAS_PERFORMANCE)
+               return;
+
+       pr_warn_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n");
+       pr_warn_once("ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)\n");
+       epb = (epb & ~0xF) | ENERGY_PERF_BIAS_NORMAL;
+       wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
+}
+
+static void intel_bsp_resume(struct cpuinfo_x86 *c)
+{
+       /*
+        * MSR_IA32_ENERGY_PERF_BIAS is lost across suspend/resume,
+        * so reinitialize it properly like during bootup:
+        */
+       init_intel_energy_perf(c);
+}
+
 static void init_intel(struct cpuinfo_x86 *c)
 {
        unsigned int l2 = 0;
@@ -478,21 +509,7 @@ static void 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) == ENERGY_PERF_BIAS_PERFORMANCE) {
-                       pr_warn_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n");
-                       pr_warn_once("ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)\n");
-                       epb = (epb & ~0xF) | ENERGY_PERF_BIAS_NORMAL;
-                       wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb);
-               }
-       }
+       init_intel_energy_perf(c);
 }
 
 #ifdef CONFIG_X86_32
@@ -747,6 +764,7 @@ static const struct cpu_dev intel_cpu_dev = {
        .c_detect_tlb   = intel_detect_tlb,
        .c_early_init   = early_init_intel,
        .c_init         = init_intel,
+       .c_bsp_resume   = intel_bsp_resume,
        .c_x86_vendor   = X86_VENDOR_INTEL,
 };