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? > + > + /* > + * 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; > +}