From: james.morse@arm.com (James Morse)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/8] arm64/kernel: reuse boot_args array to get to __fdt_pointer
Date: Mon, 04 Apr 2016 16:13:58 +0100 [thread overview]
Message-ID: <570284B6.9000006@arm.com> (raw)
In-Reply-To: <1459781544-14310-3-git-send-email-ard.biesheuvel@linaro.org>
Hi Ard,
On 04/04/16 15:52, Ard Biesheuvel wrote:
> Since we record the boot_args [x0 .. x3] early at boot anyway, there is
> no need to keep the FDT address in a callee saved register with file scope
> in head.S. So simply refer to boot_args[0] directly in the call to
> setup_machine(), and drop the handling of x21 from head.S entirely.
Won't this break Big Endian?
(or more accurately: bootloader-endian != kernel-endian)
The stores in preserve_boot_args happen before the EE/E0E bits have been
set/cleared by el2_setup(), so they happen with boot-loader:endianness. The
loads after el2_setup() happen with kernel:endianness.
Thanks,
James
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> arch/arm64/kernel/head.S | 14 ++++++--------
> arch/arm64/kernel/setup.c | 4 +---
> 2 files changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
> index 69b33535911e..9d8f928c355c 100644
> --- a/arch/arm64/kernel/head.S
> +++ b/arch/arm64/kernel/head.S
> @@ -234,16 +234,15 @@ ENDPROC(stext)
> * Preserve the arguments passed by the bootloader in x0 .. x3
> */
> preserve_boot_args:
> - mov x21, x0 // x21=FDT
> -
> - adr_l x0, boot_args // record the contents of
> - stp x21, x1, [x0] // x0 .. x3 at kernel entry
> - stp x2, x3, [x0, #16]
> + adr_l x4, boot_args // record the contents of
> + stp x0, x1, [x4] // x0 .. x3 at kernel entry
> + stp x2, x3, [x4, #16]
>
> dmb sy // needed before dc ivac with
> // MMU off
>
> - add x1, x0, #0x20 // 4 x 8 bytes
> + mov x0, x4
> + add x1, x4, #0x20 // 4 x 8 bytes
> b __inval_cache_range // tail call
> ENDPROC(preserve_boot_args)
>
> @@ -480,7 +479,6 @@ __mmap_switched:
> mov x4, sp
> and x4, x4, #~(THREAD_SIZE - 1)
> msr sp_el0, x4 // Save thread_info
> - str_l x21, __fdt_pointer, x5 // Save FDT pointer
>
> ldr_l x4, kimage_vaddr // Save the offset between
> sub x4, x4, x24 // the kernel virtual and
> @@ -492,7 +490,7 @@ __mmap_switched:
> #endif
> #ifdef CONFIG_RANDOMIZE_BASE
> cbnz x23, 0f // already running randomized?
> - mov x0, x21 // pass FDT address in x0
> + ldr_l x0, boot_args // pass FDT address in x0
> bl kaslr_early_init // parse FDT for KASLR options
> cbz x0, 0f // KASLR disabled? just proceed
> mov x23, x0 // record KASLR offset
> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> index 9dc67769b6a4..83a3e484a90a 100644
> --- a/arch/arm64/kernel/setup.c
> +++ b/arch/arm64/kernel/setup.c
> @@ -64,8 +64,6 @@
> #include <asm/xen/hypervisor.h>
> #include <asm/mmu_context.h>
>
> -phys_addr_t __fdt_pointer __initdata;
> -
> /*
> * Standard memory resources
> */
> @@ -304,7 +302,7 @@ void __init setup_arch(char **cmdline_p)
> early_fixmap_init();
> early_ioremap_init();
>
> - setup_machine_fdt(__fdt_pointer);
> + setup_machine_fdt(boot_args[0]);
>
> parse_early_param();
>
>
next prev parent reply other threads:[~2016-04-04 15:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-04 14:52 [PATCH 0/8] arm64: 2016 head.S spring cleaning Ard Biesheuvel
2016-04-04 14:52 ` [PATCH 1/8] arm64/kernel: use literal for relocated address of __secondary_switched Ard Biesheuvel
2016-04-07 9:38 ` Will Deacon
2016-04-07 9:43 ` Ard Biesheuvel
2016-04-04 14:52 ` [PATCH 2/8] arm64/kernel: reuse boot_args array to get to __fdt_pointer Ard Biesheuvel
2016-04-04 15:13 ` James Morse [this message]
2016-04-04 15:19 ` Ard Biesheuvel
2016-04-05 11:09 ` Ard Biesheuvel
2016-04-04 14:52 ` [PATCH 3/8] arm64/kernel: use a proper stack frame in __mmap_switched() Ard Biesheuvel
2016-04-04 15:33 ` James Morse
2016-04-04 15:40 ` Ard Biesheuvel
2016-04-04 14:52 ` [PATCH 4/8] arm64/kernel: use ordinary calling convention for EL2 setup Ard Biesheuvel
2016-04-04 14:52 ` [PATCH 5/8] arm64/kernel: refer to idmap_pg_dir and swapper_pg_dir directly Ard Biesheuvel
2016-04-04 14:52 ` [PATCH 6/8] arm64/kernel: pass virtual entry point as __enable_mmu() argument Ard Biesheuvel
2016-04-04 14:52 ` [PATCH 7/8] arm64/kernel: drop __PHYS_OFFSET register with file scope from head.S Ard Biesheuvel
2016-04-04 14:52 ` [PATCH 8/8] arm64/kernel: drop global kaslr_offset in x23 " Ard Biesheuvel
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=570284B6.9000006@arm.com \
--to=james.morse@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 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.