From: cov@codeaurora.org (Christopher Covington)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 3/4] ARM64: Big Endian fixes for kernel booting
Date: Tue, 15 Oct 2013 14:24:32 -0400 [thread overview]
Message-ID: <525D8860.7080204@codeaurora.org> (raw)
In-Reply-To: <1381494135-15085-4-git-send-email-ankit.jindal@linaro.org>
Hi Ankit,
On 10/11/2013 08:22 AM, Ankit Jindal wrote:
> - Enable appropriate bits for big endian kernel in SYSCTLR.EL2 and
> SYSCTLR.EL1 registers
> - Swap entry point for secondary core for big endian kernel
> - Set machine type to "aarch64b" for big endian and "aarch64l"
> for little endian.
[...]
> --- a/arch/arm64/kernel/head.S
> +++ b/arch/arm64/kernel/head.S
> @@ -122,6 +122,7 @@
> .word 0 // reserved
>
> ENTRY(stext)
> + ARM_BE(bl setend_be)
> mov x21, x0 // x21=FDT
> bl __calc_phys_offset // x24=PHYS_OFFSET, x28=PHYS_OFFSET-PAGE_OFFSET
> bl el2_setup // Drop to EL1
> @@ -148,6 +149,34 @@ ENTRY(stext)
> ENDPROC(stext)
>
> /*
> + * Set el0-el1-el2 to Big endian
> + */
It might be helpful to say why this has to be done (each level needs to be set
up before it's used?) and maybe list them in the order they're set up in.
> +#if defined(CONFIG_CPU_BIG_ENDIAN)
> +ENTRY(setend_be)
> + mrs x21, CurrentEL
> + cmp x21, #PSR_MODE_EL2t
> + b.ne setend_be_el1_el0
Make sure to use tabs rather than spaces and run checkpatch.pl.
> +
> +setend_be_el2:
> + mrs x21, sctlr_el2
> + mov x22, #(1<<25)
> + orr x21, x21, x22
> + msr sctlr_el2, x21
> + isb
> +
> +setend_be_el1_el0:
> + mrs x21, sctlr_el1
> + mov x22, #(3<<24)
> + orr x21, x21, x22
> + msr sctlr_el1, x21
> + isb
> +
> + ret
> +ENDPROC(setend_be)
> +#endif /* defined(CONFIG_CPU_BIG_ENDIAN) */
> +
> +/*
> * If we're fortunate enough to boot at EL2, ensure that the world is
> * sane before dropping to EL1.
> */
> @@ -181,7 +210,11 @@ ENTRY(el2_setup)
>
> /* sctlr_el1 */
> mov x0, #0x0800 // Set/clear RES{1,0} bits
> +#if defined(CONFIG_CPU_BIG_ENDIAN)
> + movk x0, #0x33d0, lsl #16
> +#else
> movk x0, #0x30d0, lsl #16
> +#endif
> msr sctlr_el1, x0
This may be easier to read if the magic number were ifdef'ed instead of the code.
[...]
Thanks,
Christopher
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by the Linux Foundation.
next prev parent reply other threads:[~2013-10-15 18:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-11 12:22 [RFC PATCH 0/4] Big Endian support for ARM64 kernel Ankit Jindal
2013-10-11 12:22 ` [RFC PATCH 1/4] ARM64: Add Kconfig option to enable Big Endian kernel Ankit Jindal
2013-10-15 18:09 ` Christopher Covington
2013-10-16 6:49 ` Tushar Jagad
2013-10-16 14:30 ` Christopher Covington
2013-10-11 12:22 ` [RFC PATCH 2/4] ARM64: Include appropriate byteorder for Big Endian Ankit Jindal
2013-10-11 12:22 ` [RFC PATCH 3/4] ARM64: Big Endian fixes for kernel booting Ankit Jindal
2013-10-11 12:52 ` Ankit Jindal
2013-10-15 18:24 ` Christopher Covington [this message]
2013-10-16 7:04 ` Tushar Jagad
2013-10-11 12:22 ` [RFC PATCH 4/4] ARM64: Support for 32-bit big endian userspace Ankit Jindal
2013-10-15 18:09 ` [RFC PATCH 0/4] Big Endian support for ARM64 kernel Christopher Covington
2013-10-16 8:05 ` Tushar Jagad
2013-10-16 14:40 ` Christopher Covington
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=525D8860.7080204@codeaurora.org \
--to=cov@codeaurora.org \
--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;
as well as URLs for NNTP newsgroup(s).