| Date | Fri, 7 Jan 2022 17:27:38 +0100 | From | Borislav Petkov <> | 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
|