On Sun, Jan 05, 2025 at 11:58:12AM +0100, Francesco Lavra wrote: > On 2024-10-30 at 19:00, Rick Edgecombe wrote: > > --- a/arch/x86/kvm/vmx/tdx.h > > +++ b/arch/x86/kvm/vmx/tdx.h > > @@ -4,9 +4,58 @@ > > #ifdef CONFIG_INTEL_TDX_HOST ... > > #else > > static inline void tdx_bringup(void) {} > > static inline void tdx_cleanup(void) {} > > + > > +#define enable_tdx 0 > > + > > +struct kvm_tdx { > > + struct kvm kvm; > > +}; > > + > > +struct vcpu_tdx { > > + struct kvm_vcpu vcpu; > > +}; > > + > > +static inline bool is_td(struct kvm *kvm) { return false; } > > +static inline bool is_td_vcpu(struct kvm_vcpu *vcpu) { return false; > > } > > +static inline struct kvm_tdx *to_kvm_tdx(struct kvm *kvm) { return > > NULL; } > > +static inline struct vcpu_tdx *to_tdx(struct kvm_vcpu *vcpu) { > > return NULL; } > > IMO the definitions of to_kvm_tdx() and to_tdx() shouldn't be there > when CONFIG_INTEL_TDX_HOST is not defined: they are (and should be) > only used in CONFIG_INTEL_TDX_HOST code. Good idea. How about let's just make to_kvm_tdx() and to_tdx() private to tdx.c? They are not currently used anywhere else. And we can add the #pragma poison GCC to_vmx at the top of tdx.c to avoid accidental use of to_vmx() in tdx.c like Paolo suggested earlier at [0] below. The dummy struct kvm_tdx and vcpu_tdx if CONFIG_INTEL_TDX_HOST is not defined we could get rid of with a few helpers to get the size. Regards, Tony [0] https://lore.kernel.org/kvm/89657f96-0ed1-4543-9074-f13f62cc4694@xxxxxxxxxx/