[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <537ad4d3ed653f722c811de86f12d0248136b1dc.camel@intel.com>
Date: Wed, 18 Oct 2023 06:27:14 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "sathyanarayanan.kuppuswamy@...ux.intel.com"
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: "Hansen, Dave" <dave.hansen@...el.com>,
"david@...hat.com" <david@...hat.com>,
"bagasdotme@...il.com" <bagasdotme@...il.com>,
"ak@...ux.intel.com" <ak@...ux.intel.com>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
"Christopherson,, Sean" <seanjc@...gle.com>,
"mingo@...hat.com" <mingo@...hat.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"Yamahata, Isaku" <isaku.yamahata@...el.com>,
"nik.borisov@...e.com" <nik.borisov@...e.com>,
"Luck, Tony" <tony.luck@...el.com>,
"hpa@...or.com" <hpa@...or.com>,
"peterz@...radead.org" <peterz@...radead.org>,
"Shahar, Sagi" <sagis@...gle.com>,
"imammedo@...hat.com" <imammedo@...hat.com>,
"bp@...en8.de" <bp@...en8.de>, "Gao, Chao" <chao.gao@...el.com>,
"rafael@...nel.org" <rafael@...nel.org>,
"Brown, Len" <len.brown@...el.com>,
"Huang, Ying" <ying.huang@...el.com>,
"Williams, Dan J" <dan.j.williams@...el.com>,
"x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH v14 06/23] x86/virt/tdx: Add SEAMCALL error printing for
module initialization
> >
> > +typedef void (*sc_err_func_t)(u64 fn, u64 err, struct tdx_module_args *args);
> > +
> > +static inline void seamcall_err(u64 fn, u64 err, struct tdx_module_args *args)
> > +{
> > + pr_err("SEAMCALL (0x%llx) failed: 0x%llx\n", fn, err);
> > +}
> > +
>
> Why pass args here?
It needs to be sc_err_func_t so that it can be used by the common code
sc_retry_prerr() below.
>
> > +static inline void seamcall_err_ret(u64 fn, u64 err,
> > + struct tdx_module_args *args)
> > +{
> > + seamcall_err(fn, err, args);
> > + pr_err("RCX 0x%llx RDX 0x%llx R8 0x%llx R9 0x%llx R10 0x%llx R11 0x%llx\n",
> > + args->rcx, args->rdx, args->r8, args->r9,
> > + args->r10, args->r11);
> > +}
> > +
> > +static inline void seamcall_err_saved_ret(u64 fn, u64 err,
> > + struct tdx_module_args *args)
> > +{
> > + seamcall_err_ret(fn, err, args);
> > + pr_err("RBX 0x%llx RDI 0x%llx RSI 0x%llx R12 0x%llx R13 0x%llx R14 0x%llx R15 0x%llx\n",
> > + args->rbx, args->rdi, args->rsi, args->r12,
> > + args->r13, args->r14, args->r15);
> > +}
> > +
> > +static inline int sc_retry_prerr(sc_func_t func, sc_err_func_t err_func,
> > + u64 fn, struct tdx_module_args *args)
> > +{
> > + u64 sret = sc_retry(func, fn, args);
> > +
> > + if (sret == TDX_SUCCESS)
> > + return 0;
> > +
> > + if (sret == TDX_SEAMCALL_VMFAILINVALID)
> > + return -ENODEV;
> > +
> > + if (sret == TDX_SEAMCALL_GP)
> > + return -EOPNOTSUPP;
> > +
> > + if (sret == TDX_SEAMCALL_UD)
> > + return -EACCES;
> > +
> > + err_func(fn, sret, args);
> > + return -EIO;
> > +}
> > +
> > +#define seamcall_prerr(__fn, __args) \
> > + sc_retry_prerr(__seamcall, seamcall_err, (__fn), (__args))
> > +
> > +#define seamcall_prerr_ret(__fn, __args) \
> > + sc_retry_prerr(__seamcall_ret, seamcall_err_ret, (__fn), (__args))
> > +
> > static int __init record_keyid_partitioning(u32 *tdx_keyid_start,
> > u32 *nr_tdx_keyids)
> > {
>
Powered by blists - more mailing lists