All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vagrant Cascadian <vagrant@debian.org>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Tom Rini <trini@konsulko.com>,
	Liviu Dudau <liviu.dudau@foss.arm.com>,
	Simon Glass <sjg@chromium.org>, Stefan Roese <sr@denx.de>,
	Patrick Delaunay <patrick.delaunay@foss.st.com>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Michal Simek <michal.simek@amd.com>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>,
	u-boot@lists.denx.de,
	Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Subject: Re: [PATCH v2 3/3] lmb: consider EFI memory map
Date: Fri, 06 Jan 2023 15:22:49 -0800	[thread overview]
Message-ID: <87fscn5jue.fsf@contorta> (raw)
In-Reply-To: <20230105202536.190392-4-heinrich.schuchardt@canonical.com>

[-- Attachment #1: Type: text/plain, Size: 2346 bytes --]

On 2023-01-05, Heinrich Schuchardt wrote:
> Add reservations for all EFI memory areas that are not
> EFI_CONVENTIONAL_MEMORY.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

Tested on odroid-c2, fixes booting from extlinux.conf and boot.scr using
booti, and still works using EFI boot as well.

Thanks!

Tested-by: Vagrant Cascadian <vagrant@debian.org>

live well,
  vagrant

> ---
> v2:
> 	use efi_get_memory_map_alloc()
> ---
>  lib/lmb.c | 36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
>
> diff --git a/lib/lmb.c b/lib/lmb.c
> index c599608fa3..ec790760db 100644
> --- a/lib/lmb.c
> +++ b/lib/lmb.c
> @@ -7,7 +7,9 @@
>   */
>  
>  #include <common.h>
> +#include <efi_loader.h>
>  #include <image.h>
> +#include <mapmem.h>
>  #include <lmb.h>
>  #include <log.h>
>  #include <malloc.h>
> @@ -153,6 +155,37 @@ void arch_lmb_reserve_generic(struct lmb *lmb, ulong sp, ulong end, ulong align)
>  	}
>  }
>  
> +/**
> + * efi_lmb_reserve() - add reservations for EFI memory
> + *
> + * Add reservations for all EFI memory areas that are not
> + * EFI_CONVENTIONAL_MEMORY.
> + *
> + * @lmb:	lmb environment
> + * Return:	0 on success, 1 on failure
> + */
> +static __maybe_unused int efi_lmb_reserve(struct lmb *lmb)
> +{
> +	struct efi_mem_desc *memmap = NULL, *map;
> +	efi_uintn_t i, map_size = 0;
> +	efi_status_t ret;
> +
> +	ret = efi_get_memory_map_alloc(&map_size, &memmap);
> +	if (ret != EFI_SUCCESS)
> +		return 1;
> +
> +	for (i = 0, map = memmap; i < map_size / sizeof(*map); ++map, ++i) {
> +		if (map->type != EFI_CONVENTIONAL_MEMORY)
> +			lmb_reserve(lmb,
> +				    map_to_sysmem((void *)(uintptr_t)
> +						  map->physical_start),
> +				    map->num_pages * EFI_PAGE_SIZE);
> +	}
> +	efi_free_pool(memmap);
> +
> +	return 0;
> +}
> +
>  static void lmb_reserve_common(struct lmb *lmb, void *fdt_blob)
>  {
>  	arch_lmb_reserve(lmb);
> @@ -160,6 +193,9 @@ static void lmb_reserve_common(struct lmb *lmb, void *fdt_blob)
>  
>  	if (CONFIG_IS_ENABLED(OF_LIBFDT) && fdt_blob)
>  		boot_fdt_add_mem_rsv_regions(lmb, fdt_blob);
> +
> +	if (CONFIG_IS_ENABLED(EFI_LOADER))
> +		efi_lmb_reserve(lmb);
>  }
>  
>  /* Initialize the struct, add memory and call arch/board reserve functions */

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

  reply	other threads:[~2023-01-06 23:23 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-05 20:25 [PATCH v2 0/3] efi_loader: consider EFI memory map Heinrich Schuchardt
2023-01-05 20:25 ` [PATCH v2 1/3] vexpress: adjust loadaddr Heinrich Schuchardt
2023-01-05 20:25 ` [PATCH v2 2/3] efi_loader: carve out efi_get_memory_map_alloc() Heinrich Schuchardt
2023-01-06 23:22   ` Vagrant Cascadian
2023-01-09  7:18   ` Ilias Apalodimas
2023-01-09  8:06     ` Heinrich Schuchardt
2023-01-09 13:00       ` Ilias Apalodimas
2023-01-05 20:25 ` [PATCH v2 3/3] lmb: consider EFI memory map Heinrich Schuchardt
2023-01-06 23:22   ` Vagrant Cascadian [this message]
2023-01-09  7:19   ` Ilias Apalodimas
2023-01-09 20:11   ` Simon Glass
2023-01-09 20:20     ` Mark Kettenis
2023-01-09 20:31       ` Simon Glass
2023-01-09 20:53         ` Heinrich Schuchardt
2023-01-11  0:15           ` Simon Glass
2023-01-11  7:43             ` Heinrich Schuchardt
2023-01-11 13:59               ` Tom Rini
2023-01-11 16:48                 ` Simon Glass
2023-01-11 16:59                   ` Heinrich Schuchardt
2023-01-11 17:40                     ` Mark Kettenis
2023-01-11 17:50                       ` Heinrich Schuchardt
2023-01-11 17:55                     ` Simon Glass
2023-01-11 18:03                       ` Heinrich Schuchardt
2023-01-11 21:08                         ` Simon Glass
2023-01-11 22:59                           ` Mark Kettenis
2023-01-11 23:35                             ` Heinrich Schuchardt
2023-01-12  1:13                               ` Tom Rini
2023-01-11 23:36                             ` Simon Glass

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=87fscn5jue.fsf@contorta \
    --to=vagrant@debian.org \
    --cc=ashok.reddy.soma@xilinx.com \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jh80.chung@samsung.com \
    --cc=liviu.dudau@foss.arm.com \
    --cc=michal.simek@amd.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=sjg@chromium.org \
    --cc=sr@denx.de \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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.