[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <345753e50e4c113b1dfb71bba1ed841eee55aed3.camel@intel.com>
Date: Wed, 27 Apr 2022 12:06:32 +1200
From: Kai Huang <kai.huang@...el.com>
To: Dave Hansen <dave.hansen@...el.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Cc: seanjc@...gle.com, pbonzini@...hat.com, len.brown@...el.com,
tony.luck@...el.com, rafael.j.wysocki@...el.com,
reinette.chatre@...el.com, dan.j.williams@...el.com,
peterz@...radead.org, ak@...ux.intel.com,
kirill.shutemov@...ux.intel.com,
sathyanarayanan.kuppuswamy@...ux.intel.com,
isaku.yamahata@...el.com
Subject: Re: [PATCH v3 06/21] x86/virt/tdx: Shut down TDX module in case of
error
On Tue, 2022-04-26 at 13:59 -0700, Dave Hansen wrote:
> On 4/5/22 21:49, Kai Huang wrote:
> > TDX supports shutting down the TDX module at any time during its
> > lifetime. After TDX module is shut down, no further SEAMCALL can be
> > made on any logical cpu.
>
> Is this strictly true?
>
> I thought SEAMCALLs were used for the P-SEAMLDR too.
Sorry will change to no TDX module SEAMCALL can be made on any logical cpu.
[...]
> >
> > +/* Data structure to make SEAMCALL on multiple CPUs concurrently */
> > +struct seamcall_ctx {
> > + u64 fn;
> > + u64 rcx;
> > + u64 rdx;
> > + u64 r8;
> > + u64 r9;
> > + atomic_t err;
> > + u64 seamcall_ret;
> > + struct tdx_module_output out;
> > +};
> > +
> > +static void seamcall_smp_call_function(void *data)
> > +{
> > + struct seamcall_ctx *sc = data;
> > + int ret;
> > +
> > + ret = seamcall(sc->fn, sc->rcx, sc->rdx, sc->r8, sc->r9,
> > + &sc->seamcall_ret, &sc->out);
> > + if (ret)
> > + atomic_set(&sc->err, ret);
> > +}
> > +
> > +/*
> > + * Call the SEAMCALL on all online cpus concurrently.
> > + * Return error if SEAMCALL fails on any cpu.
> > + */
> > +static int seamcall_on_each_cpu(struct seamcall_ctx *sc)
> > +{
> > + on_each_cpu(seamcall_smp_call_function, sc, true);
> > + return atomic_read(&sc->err);
> > +}
>
> Why bother returning something that's not read?
It's not needed. I'll make it void.
Caller can check seamcall_ctx::err directly if they want to know whether any
error happened.
--
Thanks,
-Kai
Powered by blists - more mailing lists