Re: [PATCH v12 07/22] x86/virt/tdx: Add skeleton to enable TDX on demand

From: Huang, Kai
Date: Thu Jun 29 2023 - 18:58:26 EST



> > +static enum tdx_module_status_t tdx_module_status;
>
> Why can't you switch to a simple bool here as well?
>
> It's either initialized or uninitialized. If uninitialized and you get
> an error, leave it uninitialized. The next caller will try again and
> fail again.
>

We can, but in this case there might be message printed in each module
initialization call. Let's say TDH.SYS.INFO is successful but the later
TDH.SYS.CONFIG fails. In this case, each initialization call will print out TDX
module info and CMR info.

I think only allow initialization to be done once would be better in this case.
Apart from the message printing, it's OK to just use a simple bool.