public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/5] arm64/efi: adapt to relaxed FDT placement requirements
Date: Wed, 11 Mar 2015 12:09:50 +0000	[thread overview]
Message-ID: <20150311120950.GF4114@leverpostej> (raw)
In-Reply-To: <1425380630-3684-6-git-send-email-ard.biesheuvel@linaro.org>

On Tue, Mar 03, 2015 at 11:03:50AM +0000, Ard Biesheuvel wrote:
> With the relaxed FDT placement requirements in place, we can change
> the allocation strategy used by the stub to put the FDT image higher
> up in memory. At the same time, reduce the minimal alignment to a
> power of 2 upper bound of the size: this way, we are still guaranteed
> not to cross a 2 MB boundary, but will potentially waste less memory
> doing so.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  arch/arm64/include/asm/efi.h            | 9 ++++-----
>  drivers/firmware/efi/libstub/arm-stub.c | 2 +-
>  drivers/firmware/efi/libstub/fdt.c      | 7 ++-----
>  3 files changed, 7 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h
> index ef572206f1c3..68f7bb2ddad7 100644
> --- a/arch/arm64/include/asm/efi.h
> +++ b/arch/arm64/include/asm/efi.h
> @@ -39,12 +39,11 @@ extern void efi_init(void);
>  /* arch specific definitions used by the stub code */
>  
>  /*
> - * AArch64 requires the DTB to be 8-byte aligned in the first 512MiB from
> - * start of kernel and may not cross a 2MiB boundary. We set alignment to
> - * 2MiB so we know it won't cross a 2MiB boundary.
> + * AArch64 requires the DTB to be 8-byte aligned and not cross a 2MiB boundary.
> + * So align to a power of 2 upper bound of the FDT size.
>   */
> -#define EFI_FDT_ALIGN	SZ_2M   /* used by allocate_new_fdt_and_exit_boot() */
> -#define MAX_FDT_OFFSET	SZ_512M
> +#define EFI_FDT_ALIGN(x)	roundup_pow_of_two(x)
> +#define MAX_FDT_OFFSET		ULONG_MAX
>  
>  #define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)
>  
> diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c
> index dcae482a9a17..c58c21c22dbe 100644
> --- a/drivers/firmware/efi/libstub/arm-stub.c
> +++ b/drivers/firmware/efi/libstub/arm-stub.c
> @@ -269,7 +269,7 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table,
>  
>  	new_fdt_addr = fdt_addr;
>  	status = allocate_new_fdt_and_exit_boot(sys_table, handle,
> -				&new_fdt_addr, dram_base + MAX_FDT_OFFSET,
> +				&new_fdt_addr, MAX_FDT_OFFSET,

Do we still need the max_addr parameter and MAX_FDT_OFFSET, or can we
just have allocate_new_fdt_and_exit_boot assume it can allocate anywhere
in the physical address space (or ULONG_MAX if we want to allocate below
4GB whenever we get 32-bit EFI stub support).

Otherwise this looks fine.

Mark.

  reply	other threads:[~2015-03-11 12:09 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03 11:03 [PATCH 0/5] arm64: update/clarify/relax Image and FDT placement rules Ard Biesheuvel
2015-03-03 11:03 ` [PATCH 1/5] of/fdt: allow FDT virtual address outside of linear direct mapping Ard Biesheuvel
2015-03-10 21:47   ` Rob Herring
2015-03-11  8:34     ` Ard Biesheuvel
2015-03-11 11:48       ` Ard Biesheuvel
2015-03-03 11:03 ` [PATCH 2/5] arm64: use fixmap region for permanent FDT mapping Ard Biesheuvel
2015-03-10 21:37   ` Rob Herring
2015-03-11  7:05     ` Ard Biesheuvel
2015-03-11  9:50       ` Mark Rutland
2015-03-11 10:20         ` Ard Biesheuvel
2015-03-11 10:46           ` Mark Rutland
2015-03-11 12:22         ` Rob Herring
2015-03-11 10:43   ` Mark Rutland
2015-03-11 10:54     ` Ard Biesheuvel
2015-03-11 11:56       ` Mark Rutland
2015-03-03 11:03 ` [PATCH 3/5] arm64: Documentation: clarify Image placement in physical RAM Ard Biesheuvel
2015-03-11 10:04   ` Mark Rutland
2015-03-03 11:03 ` [PATCH 4/5] arm64/efi: ensure that Image does not cross a 512 MB boundary Ard Biesheuvel
2015-03-11 11:50   ` Mark Rutland
2015-03-11 15:00     ` Ard Biesheuvel
2015-03-03 11:03 ` [PATCH 5/5] arm64/efi: adapt to relaxed FDT placement requirements Ard Biesheuvel
2015-03-11 12:09   ` Mark Rutland [this message]
2015-03-11 14:42     ` Ard Biesheuvel
2015-03-10 10:51 ` [PATCH 0/5] arm64: update/clarify/relax Image and FDT placement rules Ard Biesheuvel
2015-03-10 11:21   ` Mark Rutland

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=20150311120950.GF4114@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox