| From | "Huang, Kai" <> | Subject | Re: [PATCH v19 036/130] KVM: TDX: x86: Add ioctl to get TDX systemwide parameters | Date | Wed, 24 Apr 2024 10:30:45 +0000 |
| |
On Mon, 2024-02-26 at 00:25 -0800, isaku.yamahata@intel.com wrote: > --- a/arch/x86/kvm/vmx/tdx.h > +++ b/arch/x86/kvm/vmx/tdx.h > @@ -3,6 +3,9 @@ > #define __KVM_X86_TDX_H > > #ifdef CONFIG_INTEL_TDX_HOST > + > +#include "tdx_ops.h" > + > struct kvm_tdx { > struct kvm kvm; > /* TDX specific members follow. */
I am consistently hitting build error for the middle patches in our internal tree, mostly because of this madness of header file inclusion.
I found the above inclusion of "tdx_ops.h" in "tdx.h" just out of blue.
We have
- "tdx_arch.h" - "tdx_errno.h" - "tdx_ops.h" - "tdx.h"
The first two can be included by the "tdx.h", so that we can have a rule for C files to just include "tdx.h", i.e., the C files should never need to include the first two explicitly.
The "tdx_ops.h" is a little bit confusing. I _think_ the purpose of it is to only contain SEAMCALL wrappers. But I am not sure whether it can be included by any C file directly.
Based on above code change, I _think_ the intention is to also embed it to "tdx.h", so the C files should just include "tdx.h".
But based on Sean's comments, the SEAMCALL wrappers will be changed to take 'struct kvm_tdx *' and 'struct vcpu_tdx *', so they need the declaration of those structures which are in "tdx.h".
I think we can just make a rule that, "tdx_ops.h" should never be directly included by any C file, instead, we include "tdx_ops.h" into "tdx.h" somewhere after declaration of 'struct kvm_tdx' and 'struct vcpu_tdx'.
And such inclusion should happen when the "tdx_ops.h" is introduced.
Am I missing anything?
|