[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240322232638.GF1994522@ls.amr.corp.intel.com>
Date: Fri, 22 Mar 2024 16:26:38 -0700
From: Isaku Yamahata <isaku.yamahata@...el.com>
To: "Huang, Kai" <kai.huang@...el.com>
Cc: "Yamahata, Isaku" <isaku.yamahata@...el.com>,
"Zhang, Tina" <tina.zhang@...el.com>,
"isaku.yamahata@...ux.intel.com" <isaku.yamahata@...ux.intel.com>,
"seanjc@...gle.com" <seanjc@...gle.com>,
"Yuan, Hang" <hang.yuan@...el.com>,
"sean.j.christopherson@...el.com" <sean.j.christopherson@...el.com>,
"Chen, Bo2" <chen.bo@...el.com>,
"sagis@...gle.com" <sagis@...gle.com>,
"isaku.yamahata@...il.com" <isaku.yamahata@...il.com>,
"Aktas, Erdem" <erdemaktas@...gle.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"Yao, Yuan" <yuan.yao@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"binbin.wu@...ux.intel.com" <binbin.wu@...ux.intel.com>
Subject: Re: [PATCH v19 029/130] KVM: TDX: Add C wrapper functions for
SEAMCALLs to the TDX module
On Fri, Mar 22, 2024 at 04:33:21AM +0000,
"Huang, Kai" <kai.huang@...el.com> wrote:
> > >
> > > So how about we have some macros:
> > >
> > > static inline bool is_seamcall_err_kernel_defined(u64 err)
> > > {
> > > return err & TDX_SW_ERROR;
> > > }
> > >
> > > #define TDX_KVM_SEAMCALL(_kvm, _seamcall_func, _fn, _args) \
> > > ({ \
> > > u64 _ret = _seamcall_func(_fn, _args);
> > > KVM_BUG_ON(_kvm, is_seamcall_err_kernel_defined(_ret));
> > > _ret;
> > > })
> >
> > As we can move out KVM_BUG_ON() to the call site, we can simply have
> > seamcall() or seamcall_ret().
> > The call site has to check error. whether it is TDX_SW_ERROR or not.
> > And if it hit the unexpected error, it will mark the guest bugged.
>
> How many call sites are we talking about?
>
> I think handling KVM_BUG_ON() in macro should be able to eliminate bunch of
> individual KVM_BUG_ON()s in these call sites?
16: custom error check is needed
6: always error
So I'd like to consistently have error check in KVM code, not in macro or
wrapper.
--
Isaku Yamahata <isaku.yamahata@...el.com>
Powered by blists - more mailing lists