[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ydhp+kD71G2sQrfU@zn.tnic>
Date: Fri, 7 Jan 2022 17:27:38 +0100
From: Borislav Petkov <bp@...en8.de>
To: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc: tglx@...utronix.de, mingo@...hat.com, dave.hansen@...el.com,
luto@...nel.org, peterz@...radead.org,
sathyanarayanan.kuppuswamy@...ux.intel.com, aarcange@...hat.com,
ak@...ux.intel.com, dan.j.williams@...el.com, david@...hat.com,
hpa@...or.com, jgross@...e.com, jmattson@...gle.com,
joro@...tes.org, jpoimboe@...hat.com, knsathya@...nel.org,
pbonzini@...hat.com, sdeep@...are.com, seanjc@...gle.com,
tony.luck@...el.com, vkuznets@...hat.com, wanpengli@...cent.com,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 09/26] x86/tdx: Detect TDX at early kernel decompression
time
On Tue, Dec 14, 2021 at 06:02:47PM +0300, Kirill A. Shutemov wrote:
> @@ -370,6 +370,14 @@ asmlinkage __visible void *extract_kernel(void *rmode, memptr heap,
> lines = boot_params->screen_info.orig_video_lines;
> cols = boot_params->screen_info.orig_video_cols;
>
> + /*
> + * Detect if we are running in TDX guest environment.
Please use passive voice: no "we" or "I", etc,
> + *
> + * It has to be done before console_init() to use paravirtualized
^
in order
...
> +void early_tdx_detect(void)
> +{
> + u32 eax, sig[3];
> +
> + if (cpuid_max_leaf() < TDX_CPUID_LEAF_ID)
What's the use of that helper?
AFAICT, none because you call cpuid_count below anyway. And you use that
helper only here.
IOW, you can simply use cpuid_count() and not add it.
> + return;
> +
> + cpuid_count(TDX_CPUID_LEAF_ID, 0, &eax, &sig[0], &sig[2], &sig[1]);
> +
> + if (memcmp(TDX_IDENT, sig, 12))
> + return;
> +
> + /* Cache TDX guest feature status */
> + tdx_guest_detected = true;
> +}
...
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists