Re: [PATCH v12 09/22] x86/virt/tdx: Use all system memory when initializing TDX module as TDX memory
From: Huang, Kai
Date: Wed Jun 28 2023 - 20:57:23 EST
On Wed, 2023-06-28 at 16:17 +0200, Peter Zijlstra wrote:
> On Tue, Jun 27, 2023 at 02:12:39AM +1200, Kai Huang wrote:
>
> > +static int tdx_memory_notifier(struct notifier_block *nb, unsigned long action,
> > + void *v)
> > +{
> > + struct memory_notify *mn = v;
> > +
> > + if (action != MEM_GOING_ONLINE)
> > + return NOTIFY_OK;
>
> So offlining TDX memory is ok?
Yes. We want to support normal software memory hotplug logic even TDX is
enabled. User can offline part of memory and then online again.
>
> > +
> > + /*
> > + * Empty list means TDX isn't enabled. Allow any memory
> > + * to go online.
> > + */
> > + if (list_empty(&tdx_memlist))
> > + return NOTIFY_OK;
> > +
> > + /*
> > + * The TDX memory configuration is static and can not be
> > + * changed. Reject onlining any memory which is outside of
> > + * the static configuration whether it supports TDX or not.
> > + */
> > + return is_tdx_memory(mn->start_pfn, mn->start_pfn + mn->nr_pages) ?
> > + NOTIFY_OK : NOTIFY_BAD;
>
> if (is_tdx_memory(...))
> return NOTIFY_OK;
>
> return NOTIFY_BAD;
>
Sure will do. Thanks!
>