All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: Wei Chen <wei.chen@arm.com>
Cc: xen-devel@lists.xenproject.org, nd@arm.com,
	 Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>,
	 Bertrand Marquis <bertrand.marquis@arm.com>,
	 Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: Re: [PATCH v2 04/10] xen/arm: Keep memory nodes in device tree when Xen boots from EFI
Date: Wed, 20 Apr 2022 17:30:17 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2204201728560.915916@ubuntu-linux-20-04-desktop> (raw)
In-Reply-To: <20220418090735.3940393-5-wei.chen@arm.com>

On Mon, 18 Apr 2022, Wei Chen wrote:
> In current code, when Xen is booting from EFI, it will delete
> all memory nodes in device tree. This would work well in current
> stage, because Xen can get memory map from EFI system table.
> However, EFI system table cannot completely replace memory nodes
> of device tree. EFI system table doesn't contain memory NUMA
> information. Xen depends on ACPI SRAT or device tree memory nodes
> to parse memory blocks' NUMA mapping. So in EFI + DTB boot, Xen
> doesn't have any method to get numa-node-id for memory blocks any
> more. This makes device tree based NUMA support become impossible
> for Xen in EFI + DTB boot.
> 
> So in this patch, we will keep memory nodes in device tree for
> NUMA code to parse memory numa-node-id later.
> 
> As a side effect, if we still parse boot memory information in
> early_scan_node, bootmem.info will calculate memory ranges in
> memory nodes twice. So we have to prevent early_scan_node to
> parse memory nodes in EFI boot.
> 
> Signed-off-by: Wei Chen <wei.chen@arm.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> v1 -> v2:
> 1. Move this patch from later to early of this series.
> 2. Refine commit message.
> ---
>  xen/arch/arm/bootfdt.c      |  8 +++++++-
>  xen/arch/arm/efi/efi-boot.h | 25 -------------------------
>  2 files changed, 7 insertions(+), 26 deletions(-)
> 
> diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
> index e318ef9603..78e10c6ebc 100644
> --- a/xen/arch/arm/bootfdt.c
> +++ b/xen/arch/arm/bootfdt.c
> @@ -11,6 +11,7 @@
>  #include <xen/lib.h>
>  #include <xen/kernel.h>
>  #include <xen/init.h>
> +#include <xen/efi.h>
>  #include <xen/device_tree.h>
>  #include <xen/libfdt/libfdt.h>
>  #include <xen/sort.h>
> @@ -370,7 +371,12 @@ static int __init early_scan_node(const void *fdt,
>  {
>      int rc = 0;
>  
> -    if ( device_tree_node_matches(fdt, node, "memory") )
> +    /*
> +     * If Xen has been booted via UEFI, the memory banks are
> +     * populated. So we should skip the parsing.
> +     */
> +    if ( !efi_enabled(EFI_BOOT) &&
> +         device_tree_node_matches(fdt, node, "memory") )
>          rc = process_memory_node(fdt, node, name, depth,
>                                   address_cells, size_cells, &bootinfo.mem);
>      else if ( depth == 1 && !dt_node_cmp(name, "reserved-memory") )
> diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h
> index e452b687d8..59d93c24a1 100644
> --- a/xen/arch/arm/efi/efi-boot.h
> +++ b/xen/arch/arm/efi/efi-boot.h
> @@ -231,33 +231,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.
> -- 
> 2.25.1
> 


  reply	other threads:[~2022-04-21  0:30 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-18  9:07 [PATCH v2 00/10] Device tree based NUMA support for Arm - Part#1 Wei Chen
2022-04-18  9:07 ` [PATCH v2 01/10] xen/arm: Print a 64-bit number in hex from early uart Wei Chen
2022-04-19  9:13   ` Jiamei Xie
2022-04-21  7:05     ` Wei Chen
2022-04-18  9:07 ` [PATCH v2 02/10] xen/x86: move reusable EFI stub functions from x86 to common Wei Chen
2022-04-21  0:17   ` Stefano Stabellini
2022-04-26  8:53   ` Jan Beulich
2022-04-26 10:37     ` Wei Chen
2022-04-26 14:31       ` Jan Beulich
2022-04-27  2:56         ` Wei Chen
2022-04-27  5:54           ` Jan Beulich
2022-04-27  6:26             ` Wei Chen
2022-04-18  9:07 ` [PATCH v2 03/10] xen/arm: add CONFIG_ARM_EFI to stub EFI API Wei Chen
2022-04-21  0:25   ` Stefano Stabellini
2022-04-21  7:01     ` Wei Chen
2022-04-21 21:35       ` Stefano Stabellini
2022-04-18  9:07 ` [PATCH v2 04/10] xen/arm: Keep memory nodes in device tree when Xen boots from EFI Wei Chen
2022-04-21  0:30   ` Stefano Stabellini [this message]
2022-04-18  9:07 ` [PATCH v2 05/10] xen/x86: Use ASSERT instead of VIRTUAL_BUG_ON for phys_to_nid Wei Chen
2022-04-21  0:37   ` Stefano Stabellini
2022-04-26  9:02   ` Jan Beulich
2022-04-26 10:59     ` Wei Chen
2022-04-26 14:42       ` Jan Beulich
2022-04-27  3:52         ` Wei Chen
2022-04-27  5:56           ` Jan Beulich
2022-04-27  6:27             ` Wei Chen
2022-04-18  9:07 ` [PATCH v2 06/10] xen: introduce an arch helper for default dma zone status Wei Chen
2022-04-19  9:18   ` Jan Beulich
2022-04-21  7:03     ` Wei Chen
2022-04-18  9:07 ` [PATCH v2 07/10] xen: decouple NUMA from ACPI in Kconfig Wei Chen
2022-04-18  9:07 ` [PATCH v2 08/10] xen/arm: use !CONFIG_NUMA to keep fake NUMA API Wei Chen
2022-04-18  9:07 ` [PATCH v2 09/10] xen/x86: use paddr_t for addresses in NUMA node structure Wei Chen
2022-04-26  9:11   ` Jan Beulich
2022-04-26 10:42     ` Wei Chen
2022-04-18  9:07 ` [PATCH v2 10/10] xen/x86: add detection of memory interleaves for different nodes Wei Chen
2022-04-26  9:20   ` Jan Beulich
2022-04-26 11:07     ` Wei Chen
2022-04-19  9:29 ` [PATCH v2 00/10] Device tree based NUMA support for Arm - Part#1 Wei Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.22.394.2204201728560.915916@ubuntu-linux-20-04-desktop \
    --to=sstabellini@kernel.org \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=bertrand.marquis@arm.com \
    --cc=julien@xen.org \
    --cc=nd@arm.com \
    --cc=wei.chen@arm.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.