public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] x86/cpuinfo: Clear X86_FEATURE_TME if TME/MKTME is disabled by BIOS
@ 2022-07-04 14:22 Martin Fernandez
  2022-07-05 10:15 ` Kai Huang
  0 siblings, 1 reply; 9+ messages in thread
From: Martin Fernandez @ 2022-07-04 14:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: bp, dave.hansen, x86, mingo, tglx, kirill.shutemov, daniel.gutson,
	hughsient, alex.bazhaniuk, Martin Fernandez

Right now the only way to check this is by greping the kernel logs,
which is inconvenient. This is currently checked for fwupd for
example.

I understand that cpuinfo is supposed to report every feature in the
cpu but since AMD is doing the same (and it also broke backwards
compatibility [1]) for sme/sev I think it's good to have this for
Intel too.

Another option to prevent greping the logs would be a file in
sysfs. I'm open to suggestions to where to place this infomartion. I
saw a proposal about a firmware security filesystem [2]; that would
fit perfectly.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/patch/?id=08f253ec3767bcfafc5d32617a92cee57c63968e

[2] https://lore.kernel.org/all/20220622215648.96723-3-nayna@linux.ibm.com/

Changelog since v1

Clear the flag not only for BSP but for every cpu in the system.

Signed-off-by: Martin Fernandez <martin.fernandez@eclypsium.com>
---
 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 fd5dead8371c..17f23e23f911 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -570,6 +570,7 @@ static void detect_tme(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");
+		clear_cpu_cap(c, X86_FEATURE_TME);
 		mktme_status = MKTME_DISABLED;
 		return;
 	}
--
2.30.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-07-12 19:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-04 14:22 [PATCH v2] x86/cpuinfo: Clear X86_FEATURE_TME if TME/MKTME is disabled by BIOS Martin Fernandez
2022-07-05 10:15 ` Kai Huang
2022-07-05 13:21   ` Martin Fernandez
2022-07-11 17:08     ` Sean Christopherson
2022-07-12  0:12       ` Kai Huang
2022-07-12  0:51         ` Sean Christopherson
2022-07-12  1:39           ` Kai Huang
2022-07-12 12:59             ` Martin Fernandez
2022-07-12 19:14               ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox