|
@@ -329,6 +329,28 @@ static __always_inline void setup_smap(struct cpuinfo_x86 *c)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+static __always_inline void setup_umip(struct cpuinfo_x86 *c)
|
|
|
+{
|
|
|
+ /* Check the boot processor, plus build option for UMIP. */
|
|
|
+ if (!cpu_feature_enabled(X86_FEATURE_UMIP))
|
|
|
+ goto out;
|
|
|
+
|
|
|
+ /* Check the current processor's cpuid bits. */
|
|
|
+ if (!cpu_has(c, X86_FEATURE_UMIP))
|
|
|
+ goto out;
|
|
|
+
|
|
|
+ cr4_set_bits(X86_CR4_UMIP);
|
|
|
+
|
|
|
+ return;
|
|
|
+
|
|
|
+out:
|
|
|
+ /*
|
|
|
+ * Make sure UMIP is disabled in case it was enabled in a
|
|
|
+ * previous boot (e.g., via kexec).
|
|
|
+ */
|
|
|
+ cr4_clear_bits(X86_CR4_UMIP);
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
* Protection Keys are not available in 32-bit mode.
|
|
|
*/
|
|
@@ -1147,9 +1169,10 @@ static void identify_cpu(struct cpuinfo_x86 *c)
|
|
|
/* Disable the PN if appropriate */
|
|
|
squash_the_stupid_serial_number(c);
|
|
|
|
|
|
- /* Set up SMEP/SMAP */
|
|
|
+ /* Set up SMEP/SMAP/UMIP */
|
|
|
setup_smep(c);
|
|
|
setup_smap(c);
|
|
|
+ setup_umip(c);
|
|
|
|
|
|
/*
|
|
|
* The vendor-specific functions might have changed features.
|