public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v8 02/30] efi: sandbox: Adjust memory usage for sandbox
Date: Wed, 20 Jun 2018 08:10:55 +0200	[thread overview]
Message-ID: <fd82eff9-ece7-42c2-e034-fb2e9db38bb7@gmx.de> (raw)
In-Reply-To: <20180618140835.195901-3-sjg@chromium.org>

On 06/18/2018 04:08 PM, Simon Glass wrote:
> With sandbox the U-Boot code is not mapped into the sandbox memory range
> so does not need to be excluded when allocating EFI memory. Update the EFI
> memory init code to take account of that.
> 
> Also use mapmem instead of a cast to convert a memory address to a
> pointer.

This is not reflected in the patch.

> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
> Changes in v8: None
> Changes in v7:
> - Move some of the code from efi_memory_init() into a separate function
> 
> Changes in v6: None
> Changes in v5: None
> Changes in v4: None
> Changes in v3: None
> Changes in v2:
> - Update to use mapmem instead of a cast
> 
>  lib/efi_loader/efi_memory.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
> index ec66af98ea..c6410613c7 100644
> --- a/lib/efi_loader/efi_memory.c
> +++ b/lib/efi_loader/efi_memory.c
> @@ -9,6 +9,7 @@
>  #include <efi_loader.h>
>  #include <inttypes.h>
>  #include <malloc.h>
> +#include <mapmem.h>

I cannot see any use of this include in the patch.

>  #include <watchdog.h>
>  #include <linux/list_sort.h>
>  
> @@ -393,7 +394,7 @@ efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, void **buffer)
>  			       &t);
>  
>  	if (r == EFI_SUCCESS) {
> -		struct efi_pool_allocation *alloc = (void *)(uintptr_t)t;
> +		struct efi_pool_allocation *alloc = map_sysmem(t, size);
>  		alloc->num_pages = num_pages;
>  		*buffer = alloc->data;
>  	}
> @@ -496,14 +497,13 @@ __weak void efi_add_known_memory(void)
>  	}
>  }
>  
> -int efi_memory_init(void)
> +/* Add memory regions for U-Boot's memory and for the runtime services code */
> +static void add_u_boot_and_runtime(void)
>  {
>  	unsigned long runtime_start, runtime_end, runtime_pages;
>  	unsigned long uboot_start, uboot_pages;
>  	unsigned long uboot_stack_size = 16 * 1024 * 1024;
>  
> -	efi_add_known_memory();
> -
>  	/* Add U-Boot */
>  	uboot_start = (gd->start_addr_sp - uboot_stack_size) & ~EFI_PAGE_MASK;
>  	uboot_pages = (gd->ram_top - uboot_start) >> EFI_PAGE_SHIFT;
> @@ -516,6 +516,14 @@ int efi_memory_init(void)
>  	runtime_pages = (runtime_end - runtime_start) >> EFI_PAGE_SHIFT;
>  	efi_add_memory_map(runtime_start, runtime_pages,
>  			   EFI_RUNTIME_SERVICES_CODE, false);
> +}
> +
> +int efi_memory_init(void)
> +{
> +	efi_add_known_memory();
> +
> +	if (!IS_ENABLED(CONFIG_SANDBOX))
> +		add_u_boot_and_runtime();

Is the sandbox not using relocation? A comment is missing in the code
here to explain why add_u_boot_and_runtime() should not be called for
the sandbox.

Best regards

Heinrich

>  
>  #ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER
>  	/* Request a 32bit 64MB bounce buffer region */
> 

  reply	other threads:[~2018-06-20  6:10 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18 14:08 [U-Boot] [PATCH v8 00/30] efi: Enable sandbox support for EFI loader Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 01/30] efi: Don't allow CMD_BOOTEFI_SELFTEST on sandbox Simon Glass
2018-06-20  6:03   ` Heinrich Schuchardt
2018-06-20 17:51     ` Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 02/30] efi: sandbox: Adjust memory usage for sandbox Simon Glass
2018-06-20  6:10   ` Heinrich Schuchardt [this message]
2018-06-20  8:54     ` Alexander Graf
2018-06-21  2:02       ` Simon Glass
2018-06-21  9:52         ` Alexander Graf
2018-06-21 19:45           ` Simon Glass
2018-06-22 12:08             ` Alexander Graf
2018-06-22 19:28               ` Simon Glass
2018-06-23  7:31                 ` Alexander Graf
2018-06-25  3:02                   ` Simon Glass
2018-06-21  2:02     ` Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 03/30] sandbox: smbios: Update to support sandbox Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 04/30] efi: sandbox: Add distroboot support Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 05/30] efi: sandbox: Add relocation constants Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 06/30] efi: sandbox: Enable EFI loader build for sandbox Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 07/30] efi: Split out test init/uninit into functions Simon Glass
2018-06-20  6:26   ` Heinrich Schuchardt
2018-06-21  2:21     ` Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 08/30] efi: sandbox: Add a simple 'bootefi test' command Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 09/30] efi: Create a function to set up for running EFI code Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 10/30] efi: Rename bootefi_test_finish() to bootefi_run_finish() Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 11/30] sandbox: Align RAM buffer to the machine page size Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 12/30] sandbox: Try to start the RAM buffer at a particular address Simon Glass
2018-06-18 14:45   ` Alexander Graf
2018-06-19 22:02     ` Simon Glass
2018-06-20  8:51       ` Alexander Graf
2018-06-21  2:02         ` Simon Glass
2018-06-21  9:58           ` Alexander Graf
2018-06-21 19:45             ` Simon Glass
2018-06-22 12:10               ` Alexander Graf
2018-06-22 19:28                 ` Simon Glass
2018-06-22 21:29                   ` Alexander Graf
2018-06-25  2:59                     ` Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 13/30] sandbox: Add support for calling abort() Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 14/30] efi: Don't build sandbox with __attribute__((ms_abi)) Simon Glass
2018-06-18 14:46   ` Alexander Graf
2018-06-19 22:02     ` Simon Glass
2018-06-20  8:56       ` Alexander Graf
2018-06-21  2:02         ` Simon Glass
2018-06-21  9:59           ` Alexander Graf
2018-06-21 19:45             ` Simon Glass
2018-06-22 12:11               ` Alexander Graf
2018-06-22 19:28                 ` Simon Glass
2018-06-23  7:28                   ` Alexander Graf
2018-06-23 14:16                     ` Simon Glass
2018-06-25 11:23                       ` Alexander Graf
2018-06-26  3:58                         ` Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 15/30] vsprintf: Handle NULL with %pU Simon Glass
2018-06-18 14:47   ` Alexander Graf
2018-06-21 15:48   ` [U-Boot] [U-Boot,v8,15/30] " Alexander Graf
2018-06-27 19:00   ` Heinrich Schuchardt
2018-06-18 14:08 ` [U-Boot] [PATCH v8 16/30] efi_selftest: Clean up a few comments and messages Simon Glass
2018-06-21 17:31   ` [U-Boot] [U-Boot, v8, " Alexander Graf
2018-06-18 14:08 ` [U-Boot] [PATCH v8 17/30] sandbox: Enhance map_to_sysmem() to handle foreign pointers Simon Glass
2018-06-18 14:50   ` Alexander Graf
2018-06-21  2:01     ` Simon Glass
2018-06-21 10:00       ` Alexander Graf
2018-06-21 19:45         ` Simon Glass
2018-06-22 12:12           ` Alexander Graf
2018-06-22 19:31             ` Simon Glass
2018-06-21 10:10       ` Alexander Graf
2018-06-21 19:45         ` Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 18/30] efi: Add a call to exit() along with why we can't use it Simon Glass
2018-06-18 14:51   ` Alexander Graf
2018-06-21  2:01     ` Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 19/30] efi: Relocate FDT to 127MB instead of 128MB Simon Glass
2018-06-18 14:52   ` Alexander Graf
2018-06-21  2:01     ` Simon Glass
2018-06-21 10:01       ` Alexander Graf
2018-06-21 19:45         ` Simon Glass
2018-06-22 12:13           ` Alexander Graf
2018-06-18 14:08 ` [U-Boot] [PATCH v8 20/30] efi: Tidy up device-tree-size calculation in copy_fdt() Simon Glass
2018-06-21 17:31   ` [U-Boot] [U-Boot, v8, " Alexander Graf
2018-06-18 14:08 ` [U-Boot] [PATCH v8 21/30] efi_loader: Use map_sysmem() in bootefi command Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 22/30] efi: sandbox: Tidy up copy_fdt() to work with sandbox Simon Glass
2018-06-18 15:00   ` Alexander Graf
2018-06-21  2:01     ` Simon Glass
2018-06-21 10:13       ` Alexander Graf
2018-06-21 19:45         ` Simon Glass
2018-06-22 12:26           ` Alexander Graf
2018-06-22 19:31             ` Simon Glass
2018-06-23  7:24               ` Alexander Graf
2018-06-25  3:00                 ` Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 23/30] efi: Drop error return in efi_carve_out_dt_rsv() Simon Glass
2018-06-18 15:01   ` Alexander Graf
2018-06-21 17:31   ` [U-Boot] [U-Boot, v8, " Alexander Graf
2018-06-18 14:08 ` [U-Boot] [PATCH v8 24/30] efi: Adjust memory handling to support sandbox Simon Glass
2018-06-18 15:03   ` Alexander Graf
2018-06-21  2:01     ` Simon Glass
2018-06-21 10:14       ` Alexander Graf
2018-06-21 19:45         ` Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 25/30] efi: Add more debugging for memory allocations Simon Glass
2018-06-18 15:04   ` Alexander Graf
2018-06-21 16:45   ` Alexander Graf
2018-06-22 19:31     ` Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 26/30] efi_loader: Use compiler constants for image loader Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 27/30] efi_loader: efi_allocate_pages is too restrictive Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 28/30] efi_loader: Disable miniapps on sandbox Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 29/30] efi_loader: Pass address to fs_read() Simon Glass
2018-06-18 15:08   ` Alexander Graf
2018-06-21  2:01     ` Simon Glass
2018-06-18 14:08 ` [U-Boot] [PATCH v8 30/30] efi: sandbox: Enable selftest command 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=fd82eff9-ece7-42c2-e034-fb2e9db38bb7@gmx.de \
    --to=xypron.glpk@gmx.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox