Message ID | 1486655834-9708-6-git-send-email-vijay.kilari@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hello Vijay, On 09/02/17 15:56, vijay.kilari@gmail.com wrote: > From: Vijaya Kumar K <Vijaya.Kumar@cavium.com> > > When booting in UEFI mode, UEFI passes memory information > to Dom0 using EFI memory descriptor table and deletes the > memory nodes from the host DT. However to fetch the memory > numa node id, memory DT node should not be deleted by EFI stub. > > With this patch, do not delete memory node from FDT. > This memory nodes are later used by XEN to extract numa > node id information. > > Also, parse memory node only if bootmeminfo is NULL. > > Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@cavium.com> > --- > xen/arch/arm/bootfdt.c | 9 +++++++-- > xen/arch/arm/efi/efi-boot.h | 25 ------------------------- > 2 files changed, 7 insertions(+), 27 deletions(-) > > diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c > index cae6f83..979f675 100644 > --- a/xen/arch/arm/bootfdt.c > +++ b/xen/arch/arm/bootfdt.c > @@ -285,8 +285,13 @@ static int __init early_scan_node(const void *fdt, > u32 address_cells, u32 size_cells, > void *data) > { > - if ( device_tree_node_matches(fdt, node, "memory") ) > - process_memory_node(fdt, node, name, address_cells, size_cells); > + /* > + * Parse memory node only if bootinfo.mem is empty. > + */ > + if ( bootinfo.mem.nr_banks == 0 ) { I would prefer if we use efi_enabled(EFI_BOOT) instead. This will catch any potential bug when booted without EFI. > + if ( device_tree_node_matches(fdt, node, "memory") ) > + process_memory_node(fdt, node, name, address_cells, size_cells); > + } > else if ( device_tree_node_compatible(fdt, node, "xen,multiboot-module" ) || > device_tree_node_compatible(fdt, node, "multiboot,module" )) > process_multiboot_node(fdt, node, name, address_cells, size_cells); Regards,
diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c index cae6f83..979f675 100644 --- a/xen/arch/arm/bootfdt.c +++ b/xen/arch/arm/bootfdt.c @@ -285,8 +285,13 @@ static int __init early_scan_node(const void *fdt, u32 address_cells, u32 size_cells, void *data) { - if ( device_tree_node_matches(fdt, node, "memory") ) - process_memory_node(fdt, node, name, address_cells, size_cells); + /* + * Parse memory node only if bootinfo.mem is empty. + */ + if ( bootinfo.mem.nr_banks == 0 ) { + if ( device_tree_node_matches(fdt, node, "memory") ) + process_memory_node(fdt, node, name, address_cells, size_cells); + } else if ( device_tree_node_compatible(fdt, node, "xen,multiboot-module" ) || device_tree_node_compatible(fdt, node, "multiboot,module" )) process_multiboot_node(fdt, node, name, address_cells, size_cells); diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index 045d6ce..0b9c37f 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -192,33 +192,8 @@ EFI_STATUS __init fdt_add_uefi_nodes(EFI_SYSTEM_TABLE *sys_table, int status; u32 fdt_val32; u64 fdt_val64; - int prev; int num_rsv; - /* - * Delete any memory nodes present. The EFI memory map is the only - * memory description provided to Xen. - */ - prev = 0; - for (;;) - { - const char *type; - int len; - - node = fdt_next_node(fdt, prev, NULL); - if ( node < 0 ) - break; - - type = fdt_getprop(fdt, node, "device_type", &len); - if ( type && strncmp(type, "memory", len) == 0 ) - { - fdt_del_node(fdt, node); - continue; - } - - prev = node; - } - /* * Delete all memory reserve map entries. When booting via UEFI, * kernel will use the UEFI memory map to find reserved regions.