Hi,> >> enable TDX support for *this* memory configuration only. Use a memory
I've been auditing for_each_mem_pfn_range() users and it's usage in TDX is
dubious for me.
On Fri, Nov 10, 2023 at 12:55:45AM +1300, Kai Huang wrote:
As TDX-usable memory is a fixed configuration, take a snapshot of the
memory configuration from memblocks at the time of module initialization
(memblocks are modified on memory hotplug). This snapshot is used to
AFAUI this could happen long after free_initmem() which discards all
memblock data on x86.
hotplug notifier to ensure that no other RAM can be added outside of...
this configuration.
+/*
+ * Ensure that all memblock memory regions are convertible to TDX
+ * memory. Once this has been established, stash the memblock
+ * ranges off in a secondary structure because memblock is modified
+ * in memory hotplug while TDX memory regions are fixed.
+ */
+static int build_tdx_memlist(struct list_head *tmb_list)
+{
+ unsigned long start_pfn, end_pfn;
+ int i, ret;
+
+ for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, NULL) {
Unles ARCH_KEEP_MEMBLOCK is defined this won't work after free_initmem()