mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kai Huang <kai.huang@intel.com>
To: Martin Fernandez <martin.fernandez@eclypsium.com>,
	linux-kernel@vger.kernel.org
Cc: bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org,
	mingo@redhat.com, tglx@linutronix.de,
	daniel.gutson@eclypsium.com, hughsient@gmail.com,
	alex.bazhaniuk@eclypsium.com
Subject: Re: [PATCH] x86/cpuinfo: Clear X86_FEATURE_TME if TME/MKTME is disabled by BIOS
Date: Thu, 16 Jun 2022 14:10:53 +1200	[thread overview]
Message-ID: <3b274c9a58ddfba8bd37827519aec541d1838697.camel@intel.com> (raw)
In-Reply-To: <20220614210217.1940563-1-martin.fernandez@eclypsium.com>

On Tue, 2022-06-14 at 18:02 -0300, Martin Fernandez wrote:
> Right now the only way to check this is by greping the kernel logs,
> which is inconvinient. 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 for sme/sev I think is good to
> have this for Intel too.
> 
> Signed-off-by: Martin Fernandez <martin.fernandez@eclypsium.com>
> ---
>  arch/x86/kernel/cpu/intel.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
> index fd5dead8371c..7311172aceaf 100644
> --- a/arch/x86/kernel/cpu/intel.c
> +++ b/arch/x86/kernel/cpu/intel.c
> @@ -570,6 +570,8 @@ 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");
> +		if (mktme_status == MKTME_UNINITIALIZED)
> +			clear_cpu_cap(c, X86_FEATURE_TME);

The above code seems only clear TME on BSP, if I read correctly.  Why not
unconditionally clear this flag?  If TME is detected as not enabled by BIOS on
*this* cpu, then the flag for *this* cpu should be cleared.

Also could you CC Kirill A. Shutemov <kirill.shutemov@linux.intel.com>, who is
the original author of this code?


>  		mktme_status = MKTME_DISABLED;
>  		return;
>  	}
> --
> 2.30.2
> 

-- 
Thanks,
-Kai



  parent reply	other threads:[~2022-06-16  2:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14 21:02 Martin Fernandez
2022-06-14 21:05 ` Richard Hughes
2022-06-15 19:05 ` Alison Schofield
2022-06-15 19:34   ` Richard Hughes
2022-06-15 19:54     ` Alison Schofield
2022-06-15 20:26       ` Daniel Gutson
2022-06-15 20:48         ` Martin Fernandez
2022-06-15 20:59           ` Alison Schofield
2022-06-16  2:10 ` Kai Huang [this message]
2022-06-16 14:23   ` Martin Fernandez
2022-07-04 14:20 Martin Fernandez
2022-07-04 14:22 ` Martin Fernandez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3b274c9a58ddfba8bd37827519aec541d1838697.camel@intel.com \
    --to=kai.huang@intel.com \
    --cc=alex.bazhaniuk@eclypsium.com \
    --cc=bp@alien8.de \
    --cc=daniel.gutson@eclypsium.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hughsient@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.fernandez@eclypsium.com \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®