Re: [PATCH v12 07/22] x86/virt/tdx: Add skeleton to enable TDX on demand
From: Isaku Yamahata
Date: Fri Jun 30 2023 - 14:42:41 EST
On Fri, Jun 30, 2023 at 10:09:08AM +0000,
"Huang, Kai" <kai.huang@xxxxxxxxx> wrote:
> On Fri, 2023-06-30 at 11:22 +0200, Peter Zijlstra wrote:
> > On Thu, Jun 29, 2023 at 12:15:13AM +0000, Huang, Kai wrote:
> >
> > > > Can be called locally or through an IPI function call.
> > > >
> > >
> > > Thanks. As in another reply, if using spinlock is OK, then I think we can say
> > > it will be called either locally or through an IPI function call. Otherwise, we
> > > do via a new separate function tdx_global_init() and no lock is needed in that
> > > function. The caller should call it properly.
> >
> > IPI must use raw_spinlock_t. I'm ok with using raw_spinlock_t if there's
> > actual need for that, but the code as presented didn't -- in comments or
> > otherwise -- make it clear why it was as it was.
>
> There's no hard requirement as I replied in another email.
>
> Presumably you prefer the option to have a dedicated tdx_global_init() so we can
> avoid the raw_spinlock_t?
TDX KVM calls tdx_cpu_enable() in IPI context as KVM hardware_setup() callback.
tdx_cpu_enable() calls tdx_global_init().
--
Isaku Yamahata <isaku.yamahata@xxxxxxxxx>