x86 provides a mem_hotplug variable to maintain the memory hotplug end address. We want to move some codes from x86 to common, so that it can be reused by other architectures. But not all architectures have supported memory hotplug. So in this patch, we introduce this helper to replace mem_hotplug direct access in these codes. This will give the ability of stubbing this helper to those architectures without memory hotplug support.
Signed-off-by: Wei Chen <wei.c...@arm.com> --- v1 -> v2: 1. Refine the commit message. 2. Merge v1 patch#9,10 into one patch. Introduce the new functions in the same patch that this patch will be used first time. 3. Fold if ( end > mem_hotplug ) to mem_hotplug_update_boundary, in this case, we can drop mem_hotplug_boundary. --- xen/arch/x86/include/asm/mm.h | 6 ++++++ xen/arch/x86/srat.c | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h index 07b59c982b..b3dfbdb52b 100644 --- a/xen/arch/x86/include/asm/mm.h +++ b/xen/arch/x86/include/asm/mm.h @@ -476,6 +476,12 @@ static inline int get_page_and_type(struct page_info *page, extern paddr_t mem_hotplug; +static inline void mem_hotplug_update_boundary(paddr_t end) +{ + if ( end > mem_hotplug ) + mem_hotplug = end; +} + /****************************************************************************** * With shadow pagetables, the different kinds of address start * to get get confusing. diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c index b62a152911..f53431f5e8 100644 --- a/xen/arch/x86/srat.c +++ b/xen/arch/x86/srat.c @@ -418,8 +418,7 @@ acpi_numa_memory_affinity_init(const struct acpi_srat_mem_affinity *ma) memblk_nodeid[num_node_memblks] = node; if (ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) { __set_bit(num_node_memblks, memblk_hotplug); - if (end > mem_hotplug) - mem_hotplug = end; + mem_hotplug_update_boundary(end); } num_node_memblks++; } -- 2.25.1