diff mbox

[RFC,1/4] ARM64: Add Kconfig option to enable Big Endian kernel

Message ID 1381494135-15085-2-git-send-email-ankit.jindal@linaro.org
State New
Headers show

Commit Message

Ankit Jindal Oct. 11, 2013, 12:22 p.m. UTC
This patch adds Kconfig options and relevant Big Endian compiler flags.

Signed-off-by: Ankit Jindal <ankit.jindal@linaro.org>
Signed-off-by: Tushar Jagad <tushar.jagad@linaro.org>
---
 arch/arm64/Kconfig    |    2 ++
 arch/arm64/Makefile   |    7 +++++++
 arch/arm64/mm/Kconfig |    7 +++++++
 3 files changed, 16 insertions(+)
 create mode 100644 arch/arm64/mm/Kconfig

Comments

Christopher Covington Oct. 15, 2013, 6:09 p.m. UTC | #1
Hi Ankit,

On 10/11/2013 08:22 AM, Ankit Jindal wrote:
> This patch adds Kconfig options and relevant Big Endian compiler flags.
[...]
> diff --git a/arch/arm64/mm/Kconfig b/arch/arm64/mm/Kconfig
> new file mode 100644
> index 0000000..e4122ac
> --- /dev/null
> +++ b/arch/arm64/mm/Kconfig
> @@ -0,0 +1,7 @@
> +config CPU_BIG_ENDIAN
> +        bool "Build big-endian kernel"
> +        help
> +          Say Y if you plan on running a kernel in big-endian mode.
> +          Note that your board must be properly built [...]

What makes a board properly built and how can a user determine whether their
board is?

> +                                                [...] and your board
> +          port must properly enable any big-endian related features
> +          of your chipset/board/processor.

What is a board port for arm64?

Thanks,
Christopher
Tushar Jagad Oct. 16, 2013, 6:49 a.m. UTC | #2
Hi Christopher,

On 10/15/2013 11:39 PM, Christopher Covington wrote:

> What makes a board properly built and how can a user determine whether their
> board is?

As of now this flag assumes that the bootloader is in LE mode. It is 
left to the kernel to switch to BE mode. This flag makes the kernel set 
necessary flags in SCTLR registers on entry.
>
>> +                                                [...] and your board
>> +          port must properly enable any big-endian related features
>> +          of your chipset/board/processor.
>
> What is a board port for arm64?

This is a generic patch for the architecture. Each driver needs to make 
necessary changes keeping the kernel endianness in mind. We have tested 
these patches on our X-Gene platform.
Christopher Covington Oct. 16, 2013, 2:30 p.m. UTC | #3
Hi Tushar,

On 10/16/2013 02:49 AM, Tushar Jagad wrote:
> Hi Christopher,
> 
> On 10/15/2013 11:39 PM, Christopher Covington wrote:
> 
>> What makes a board properly built and how can a user determine whether their
>> board is?
> 
> As of now this flag assumes that the bootloader is in LE mode. It is left to
> the kernel to switch to BE mode. This flag makes the kernel set necessary
> flags in SCTLR registers on entry.

I would suggest that you say that instead. The existing wording makes it sound
strictly hardware related.

>>
>>> +                                                [...] and your board
>>> +          port must properly enable any big-endian related features
>>> +          of your chipset/board/processor.
>>
>> What is a board port for arm64?
> 
> This is a generic patch for the architecture. Each driver needs to make
> necessary changes keeping the kernel endianness in mind. We have tested these
> patches on our X-Gene platform.

Perhaps it would be clearer to say "drivers" instead of "board ports" then. I
thought the comment was referring to code inside mach-* or plat-* directories.

Regards,
Christopher
diff mbox

Patch

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index f558058..2214ab9 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -285,6 +285,8 @@  config SYSVIPC_COMPAT
 
 endmenu
 
+source "arch/arm64/mm/Kconfig"
+
 source "net/Kconfig"
 
 source "drivers/Kconfig"
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index d90cf79..c92b0f9 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -20,9 +20,16 @@  LIBGCC 		:= $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
 KBUILD_DEFCONFIG := defconfig
 
 KBUILD_CFLAGS	+= -mgeneral-regs-only
+
+ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
+KBUILD_CPPFLAGS += -mbig-endian
+AS              += -EB
+LD              += -EB
+else
 KBUILD_CPPFLAGS	+= -mlittle-endian
 AS		+= -EL
 LD		+= -EL
+endif
 
 comma = ,
 
diff --git a/arch/arm64/mm/Kconfig b/arch/arm64/mm/Kconfig
new file mode 100644
index 0000000..e4122ac
--- /dev/null
+++ b/arch/arm64/mm/Kconfig
@@ -0,0 +1,7 @@ 
+config CPU_BIG_ENDIAN
+        bool "Build big-endian kernel"
+        help
+          Say Y if you plan on running a kernel in big-endian mode.
+          Note that your board must be properly built and your board
+          port must properly enable any big-endian related features
+          of your chipset/board/processor.