lkml.org 
[lkml]   [2021]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v10 03/11] x86/cpufeatures: Add TDX Guest CPU feature
On Wed, Oct 13, 2021 at 10:18:18AM +0200, Borislav Petkov wrote:
> On Fri, Oct 08, 2021 at 10:37:39PM -0700, Kuppuswamy Sathyanarayanan wrote:
> > @@ -500,6 +501,14 @@ asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data)
> >
> > copy_bootdata(__va(real_mode_data));
> >
> > + /*
> > + * A future dependency on cmdline parameters is expected (for
> > + * adding debug options). So the order of calling it should be
> > + * after copy_bootdata() (in which command line parameter is
> > + * initialized).
> > + */
>
> Plain and simple:
>
> /*
> * Keep this after copy_bootdata() so that TDX cmdline options can take
> * effect.
> */

But there are no actual TDX cmdline options in this patch set, which is
why I originally asked for clarification in the comment.

> > + tdx_early_init();
> > +
> > /*
> > * Load microcode early on BSP.
> > */
> > diff --git a/arch/x86/kernel/tdx.c b/arch/x86/kernel/tdx.c
> > new file mode 100644
> > index 000000000000..88bf12788684
> > --- /dev/null
> > +++ b/arch/x86/kernel/tdx.c
> > @@ -0,0 +1,38 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/* Copyright (C) 2020 Intel Corporation */
> > +
> > +#undef pr_fmt
> > +#define pr_fmt(fmt) "tdx: " fmt
> > +
> > +#include <asm/tdx.h>
> > +
> > +bool is_tdx_guest(void)
> > +{
> > + static int tdx_guest = -1;
>
> Put that one at the top of the file because such static variables do not
> belong among the automatic function vars.

I disagree, this prevents confusion and misuse by making it clear that
the scope of the static variable is limited to this function.

--
Josh

\
 
 \ /
  Last update: 2021-10-13 21:43    [W:0.604 / U:2.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site