|
@@ -611,6 +611,25 @@ static void early_init_amd(struct cpuinfo_x86 *c)
|
|
|
*/
|
|
|
if (cpu_has_amd_erratum(c, amd_erratum_400))
|
|
|
set_cpu_bug(c, X86_BUG_AMD_E400);
|
|
|
+
|
|
|
+ /*
|
|
|
+ * BIOS support is required for SME. If BIOS has not enabled SME
|
|
|
+ * then don't advertise the feature (set in scattered.c). Also,
|
|
|
+ * since the SME support requires long mode, don't advertise the
|
|
|
+ * feature under CONFIG_X86_32.
|
|
|
+ */
|
|
|
+ if (cpu_has(c, X86_FEATURE_SME)) {
|
|
|
+ if (IS_ENABLED(CONFIG_X86_32)) {
|
|
|
+ clear_cpu_cap(c, X86_FEATURE_SME);
|
|
|
+ } else {
|
|
|
+ u64 msr;
|
|
|
+
|
|
|
+ /* Check if SME is enabled */
|
|
|
+ rdmsrl(MSR_K8_SYSCFG, msr);
|
|
|
+ if (!(msr & MSR_K8_SYSCFG_MEM_ENCRYPT))
|
|
|
+ clear_cpu_cap(c, X86_FEATURE_SME);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
static void init_amd_k8(struct cpuinfo_x86 *c)
|