[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20200619074053.GA32683@zn.tnic>
Date: Fri, 19 Jun 2020 09:40:53 +0200
From: Borislav Petkov <bp@...en8.de>
To: Daniel Gutson <daniel@...ypsium.com>
Cc: Dave Hansen <dave.hansen@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Peter Zijlstra <peterz@...radead.org>,
"David S. Miller" <davem@...emloft.net>,
Rob Herring <robh@...nel.org>, Tony Luck <tony.luck@...el.com>,
Rahul Tanwar <rahul.tanwar@...ux.intel.com>,
Xiaoyao Li <xiaoyao.li@...el.com>,
Sean Christopherson <sean.j.christopherson@...el.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
linux-kernel@...r.kernel.org, Richard Hughes <hughsient@...il.com>
Subject: Re: [PATCH] Ability to read the MKTME status from userspace
On Thu, Jun 18, 2020 at 07:34:21PM -0300, Daniel Gutson wrote:
> Besides being a CPU capability, it has to be enabled by the BIOS, which is
> what the flag represents.
... yes, and if it is disabled in the BIOS, you clear the CPU cap flag.
Something like this untested diff:
---
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index c25a67a34bd3..59d8342f6a64 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -525,6 +525,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");
mktme_status = MKTME_DISABLED;
+ clear_cpu_cap(c, X86_FEATURE_TME);
return;
}
@@ -553,10 +554,11 @@ static void detect_tme(struct cpuinfo_x86 *c)
pr_info_once("x86/mktme: disabled by BIOS\n");
}
- if (mktme_status == MKTME_UNINITIALIZED) {
- /* MKTME is usable */
+ /* MKTME is usable */
+ if (mktme_status == MKTME_UNINITIALIZED)
mktme_status = MKTME_ENABLED;
- }
+ else if (mktme_status == MKTME_DISABLED)
+ clear_cpu_cap(c, X86_FEATURE_TME);
/*
* KeyID bits effectively lower the number of physical address
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists