[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z5Cjukf9K_1bTxVN@tlindgre-MOBL1>
Date: Wed, 22 Jan 2025 09:52:26 +0200
From: Tony Lindgren <tony.lindgren@...ux.intel.com>
To: Francesco Lavra <francescolavra.fl@...il.com>
Cc: rick.p.edgecombe@...el.com, isaku.yamahata@...il.com,
isaku.yamahata@...el.com, kai.huang@...el.com, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, pbonzini@...hat.com,
reinette.chatre@...el.com, seanjc@...gle.com, xiaoyao.li@...el.com,
yan.y.zhao@...el.com
Subject: Re: [PATCH v2 11/25] KVM: TDX: Add placeholders for TDX VM/vCPU
structures
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@redhat.com/
Powered by blists - more mailing lists