2024-03-08 12:38:22

by Bingsong Si

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

Signed-off-by: Bingsong Si <[email protected]>
---
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 a927a8fc9624..22f0c829784d 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -526,6 +526,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;
}

--
2.34.1



2024-03-11 06:14:11

by Huang, Kai

[permalink] [raw]
Subject: Re: [PATCH] x86/cpu: Clear TME feature flag if TME is not enabled by BIOS

On Fri, 2024-03-08 at 20:27 +0800, Bingsong Si wrote:
> Signed-off-by: Bingsong Si <[email protected]>

Please add changelog to justify this patch. Thanks.

2024-03-11 07:27:48

by Bingsong Si

[permalink] [raw]
Subject: [PATCH v2] x86/cpu: Clear TME feature flag if TME is not enabled by BIOS

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

Signed-off-by: Bingsong Si <[email protected]>
---
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 a927a8fc9624..22f0c829784d 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -526,6 +526,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;
}

--
2.34.1


2024-03-12 10:44:40

by Bingsong Si

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

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 <[email protected]>
---
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


2024-03-26 08:56:15

by tip-bot2 for Tony Luck

[permalink] [raw]
Subject: [tip: x86/cpu] x86/cpu: Clear TME feature flag if TME is not enabled by BIOS

The following commit has been merged into the x86/cpu branch of tip:

Commit-ID: cd2236c2f49eb46443fd7573d0ddad5373577b11
Gitweb: https://git.kernel.org/tip/cd2236c2f49eb46443fd7573d0ddad5373577b11
Author: Bingsong Si <[email protected]>
AuthorDate: Mon, 11 Mar 2024 15:19:37 +08:00
Committer: Ingo Molnar <[email protected]>
CommitterDate: Tue, 26 Mar 2024 09:49:32 +01:00

x86/cpu: Clear TME feature flag if TME is not enabled by BIOS

When TME is disabled by BIOS, the dmesg output is:

x86/tme: not enabled by BIOS

.. and TME functionality is not enabled by the kernel, but the TME feature
is still shown in /proc/cpuinfo.

Clear it.

[ mingo: Clarified changelog ]

Signed-off-by: Bingsong Si <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Cc: "Huang, Kai" <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
---
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 be30d7f..3c3e7e5 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;
}