[PATCH v3] x86/cpu: Clear TME feature flag if TME is not enabled by BIOS

From: Bingsong Si
Date: Tue Mar 12 2024 - 06:44:41 EST


When TME is disabled by BIOS, dmesg output is "x86/tme: not enabled by
BIOS" but the TME feature is still shown in the output of/proc/cpuinfo.

Signed-off-by: Bingsong Si <sibs@xxxxxxxxxxxxxxx>
---
arch/x86/kernel/cpu/intel.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 40dec9b56f87..119ae291573b 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -228,6 +228,7 @@ static void detect_tme_early(struct cpuinfo_x86 *c)
if (!TME_ACTIVATE_LOCKED(tme_activate) || !TME_ACTIVATE_ENABLED(tme_activate)) {
pr_info_once("x86/tme: not enabled by BIOS\n");
mktme_status = MKTME_DISABLED;
+ clear_cpu_cap(c, X86_FEATURE_TME);
return;
}

--
2.34.1