From: "Cédric Le Goater" <clg@fr.ibm.com>
To: benh@kernel.crashing.org
Cc: "Cédric Le Goater" <clg@fr.ibm.com>, linuxppc-dev@lists.ozlabs.org
Subject: [RFC PATCH 17/18] powerpc/boot: add support for 64bit little endian wrapper
Date: Fri, 7 Feb 2014 16:59:30 +0100 [thread overview]
Message-ID: <1391788771-16405-18-git-send-email-clg@fr.ibm.com> (raw)
In-Reply-To: <1391788771-16405-1-git-send-email-clg@fr.ibm.com>
Compilation is changed for little endian and entry points between the
wrapper and the kernel are modified to fix endian order with the famous
FIXUP_ENDIAN trampoline. This is PowerPC magic.
Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
---
arch/powerpc/boot/Makefile | 7 +++++--
arch/powerpc/boot/crt0.S | 1 +
arch/powerpc/boot/ppc_asm.h | 12 ++++++++++++
arch/powerpc/boot/pseries-head.S | 3 +++
arch/powerpc/boot/wrapper | 1 +
5 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index bedbd46273e4..de71d2a0af3b 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -22,11 +22,14 @@ all: $(obj)/zImage
BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -Os -msoft-float -pipe \
-fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
- -isystem $(shell $(CROSS32CC) -print-file-name=include) \
- -mbig-endian
+ -isystem $(shell $(CROSS32CC) -print-file-name=include)
ifdef CONFIG_PPC64
BOOTCFLAGS += -m64
endif
+ifdef CONFIG_CPU_BIG_ENDIAN
+BOOTCFLAGS += -mbig-endian
+endif
+
BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
ifdef CONFIG_DEBUG_INFO
diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S
index 689290561e69..14de4f8778a7 100644
--- a/arch/powerpc/boot/crt0.S
+++ b/arch/powerpc/boot/crt0.S
@@ -275,6 +275,7 @@ prom:
rfid
1: /* Return from OF */
+ FIXUP_ENDIAN
/* Restore registers and return. */
rldicl r1,r1,0,32
diff --git a/arch/powerpc/boot/ppc_asm.h b/arch/powerpc/boot/ppc_asm.h
index eb0e98be69e0..35ea60c1f070 100644
--- a/arch/powerpc/boot/ppc_asm.h
+++ b/arch/powerpc/boot/ppc_asm.h
@@ -62,4 +62,16 @@
#define SPRN_TBRL 268
#define SPRN_TBRU 269
+#define FIXUP_ENDIAN \
+ tdi 0, 0, 0x48; /* Reverse endian of b . + 8 */ \
+ b $+36; /* Skip trampoline if endian is good */ \
+ .long 0x05009f42; /* bcl 20,31,$+4 */ \
+ .long 0xa602487d; /* mflr r10 */ \
+ .long 0x1c004a39; /* addi r10,r10,28 */ \
+ .long 0xa600607d; /* mfmsr r11 */ \
+ .long 0x01006b69; /* xori r11,r11,1 */ \
+ .long 0xa6035a7d; /* mtsrr0 r10 */ \
+ .long 0xa6037b7d; /* mtsrr1 r11 */ \
+ .long 0x2400004c /* rfid */
+
#endif /* _PPC64_PPC_ASM_H */
diff --git a/arch/powerpc/boot/pseries-head.S b/arch/powerpc/boot/pseries-head.S
index 655c3d2c321b..6ef6e02e80f9 100644
--- a/arch/powerpc/boot/pseries-head.S
+++ b/arch/powerpc/boot/pseries-head.S
@@ -1,5 +1,8 @@
+#include "ppc_asm.h"
+
.text
.globl _zimage_start
_zimage_start:
+ FIXUP_ENDIAN
b _zimage_start_lib
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 6eca1b4ecfa4..a1654b510ff3 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -139,6 +139,7 @@ fi
elfformat="`${CROSS}objdump -p "$kernel" | grep 'file format' | awk '{print $4}'`"
case "$elfformat" in
+ elf64-powerpcle) format=elf64lppc ;;
elf64-powerpc) format=elf64ppc ;;
elf32-powerpc) format=elf32ppc ;;
esac
--
1.7.10.4
next prev parent reply other threads:[~2014-02-07 15:59 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-07 15:59 [RFC PATCH 00/18] powerpc/boot: 64bit little endian wrapper for pseries Cédric Le Goater
2014-02-07 15:59 ` [RFC PATCH 01/18] powerpc/boot: fix do_div for 64bit wrapper Cédric Le Goater
2014-02-07 15:59 ` [RFC PATCH 02/18] powerpc/boot: use a common prom_args struct in oflib Cédric Le Goater
2014-02-07 15:59 ` [RFC PATCH 03/18] powerpc/boot: use prom_arg_t " Cédric Le Goater
2014-02-07 15:59 ` [RFC PATCH 04/18] powerpc/boot: add byteswapping routines " Cédric Le Goater
2014-02-07 15:59 ` [RFC PATCH 05/18] powerpc/boot: add PROM_ERROR define " Cédric Le Goater
2014-02-07 15:59 ` [RFC PATCH 06/18] powerpc/boot: rework of_claim() to make it 64bit friendly Cédric Le Goater
2014-02-07 15:59 ` [RFC PATCH 07/18] powerpc/boot: define typedef ihandle as u32 Cédric Le Goater
2014-02-07 15:59 ` [RFC PATCH 08/18] powerpc/boot: fix compile warning in 64bit Cédric Le Goater
2014-02-07 15:59 ` [RFC PATCH 09/18] powerpc/boot: define byteswapping routines for little endian Cédric Le Goater
2014-02-07 15:59 ` [RFC PATCH 10/18] powerpc/boot: add 64bit and little endian support to addnote Cédric Le Goater
2014-02-07 15:59 ` [RFC PATCH 11/18] powerpc/boot: add little endian support to elf utils Cédric Le Goater
2014-02-07 15:59 ` [RFC PATCH 12/18] powerpc/boot: define a routine to enter prom Cédric Le Goater
2014-02-07 15:59 ` [RFC PATCH 13/18] powerpc/boot: modify entry point for 64bit Cédric Le Goater
2014-02-07 15:59 ` [RFC PATCH 14/18] powerpc/boot: modify how we enter kernel on 64bit Cédric Le Goater
2014-02-07 15:59 ` [RFC PATCH 15/18] powerpc/boot: add a global entry point for pseries Cédric Le Goater
2014-02-07 15:59 ` [RFC PATCH 16/18] powerpc/boot: add support for 64bit big endian wrapper Cédric Le Goater
2014-02-07 15:59 ` Cédric Le Goater [this message]
2014-02-07 15:59 ` [RFC PATCH 18/18] powerpc/boot: add PPC64_BOOT_WRAPPER config option Cédric Le Goater
2014-03-20 15:09 ` [PATCH 00/18] powerpc/boot: 64bit little endian wrapper Cédric Le Goater
2014-03-20 17:03 ` Geoff Levand
2014-03-21 8:37 ` Cedric Le Goater
2014-03-21 9:37 ` Cedric Le Goater
2014-03-21 17:28 ` Geoff Levand
2014-03-21 17:40 ` Cedric Le Goater
2014-03-20 15:09 ` [PATCH 01/18] powerpc/boot: fix do_div for 64bit wrapper Cédric Le Goater
2014-03-20 15:09 ` [PATCH 02/18] powerpc/boot: use a common prom_args struct in oflib Cédric Le Goater
2014-03-20 15:09 ` [PATCH 03/18] powerpc/boot: use prom_arg_t " Cédric Le Goater
2014-03-20 15:09 ` [PATCH 04/18] powerpc/boot: add byteswapping routines " Cédric Le Goater
2014-03-20 15:10 ` [PATCH 05/18] powerpc/boot: add PROM_ERROR define " Cédric Le Goater
2014-03-20 15:10 ` [PATCH 06/18] powerpc/boot: rework of_claim() to make it 64bit friendly Cédric Le Goater
2014-03-20 15:10 ` [PATCH 07/18] powerpc/boot: define typedef ihandle as u32 Cédric Le Goater
2014-03-20 15:10 ` [PATCH 08/18] powerpc/boot: fix compile warning in 64bit Cédric Le Goater
2014-03-20 15:10 ` [PATCH 09/18] powerpc/boot: define byteswapping routines for little endian Cédric Le Goater
2014-03-20 15:10 ` [PATCH 10/18] powerpc/boot: add 64bit and little endian support to addnote Cédric Le Goater
2014-03-20 15:10 ` [PATCH 11/18] powerpc/boot: add little endian support to elf utils Cédric Le Goater
2014-03-20 15:10 ` [PATCH 12/18] powerpc/boot: define a routine to enter prom Cédric Le Goater
2014-03-20 15:10 ` [PATCH 13/18] powerpc/boot: modify entry point for 64bit Cédric Le Goater
2014-03-20 15:10 ` [PATCH 14/18] powerpc/boot: modify how we enter kernel on 64bit Cédric Le Goater
2014-03-20 15:10 ` [PATCH 15/18] powerpc/boot: add a global entry point for pseries Cédric Le Goater
2014-03-20 15:10 ` [PATCH 16/18] powerpc/boot: add support for 64bit big endian wrapper Cédric Le Goater
2014-03-20 15:10 ` [PATCH 17/18] powerpc/boot: add support for 64bit little " Cédric Le Goater
2014-03-20 15:10 ` [PATCH 18/18] powerpc/boot: add PPC64_BOOT_WRAPPER config option Cédric Le Goater
2014-03-24 3:42 ` Benjamin Herrenschmidt
2014-03-24 8:38 ` Cedric Le Goater
2014-03-24 9:04 ` Benjamin Herrenschmidt
2014-03-24 10:22 ` [PATCH] powerpc/boot: fix global entry point for pseries Cédric Le Goater
2014-04-14 7:46 ` [PATCH v2 00/15] powerpc/boot: 64bit little endian wrapper Cédric Le Goater
2014-04-14 7:47 ` [PATCH v2 01/15] powerpc/boot: fix do_div for 64bit wrapper Cédric Le Goater
2014-04-14 7:47 ` [PATCH v2 02/15] powerpc/boot: use a common prom_args struct in oflib Cédric Le Goater
2014-04-14 7:47 ` [PATCH v2 03/15] powerpc/boot: use prom_arg_t " Cédric Le Goater
2014-04-14 7:47 ` [PATCH v2 04/15] powerpc/boot: add byteswapping routines " Cédric Le Goater
2014-04-14 7:47 ` [PATCH v2 05/15] powerpc/boot: add PROM_ERROR define " Cédric Le Goater
2014-04-14 7:47 ` [PATCH v2 06/15] powerpc/boot: rework of_claim() to make it 64bit friendly Cédric Le Goater
2014-04-14 7:47 ` [PATCH v2 07/15] powerpc/boot: define typedef ihandle as u32 Cédric Le Goater
2014-04-14 7:47 ` [PATCH v2 08/15] powerpc/boot: fix compile warning in 64bit Cédric Le Goater
2014-04-14 7:47 ` [PATCH v2 09/15] powerpc/boot: define byteswapping routines for little endian Cédric Le Goater
2014-04-14 7:47 ` [PATCH v2 10/15] powerpc/boot: add 64bit and little endian support to addnote Cédric Le Goater
2014-04-14 7:47 ` [PATCH v2 11/15] powerpc/boot: add little endian support to elf utils Cédric Le Goater
2014-04-14 7:47 ` [PATCH v2 12/15] powerpc/boot: define a routine to enter prom Cédric Le Goater
2014-04-14 7:47 ` [PATCH v2 13/15] powerpc/boot: modify entry point for 64bit Cédric Le Goater
2014-04-14 7:47 ` [PATCH v2 14/15] powerpc/boot: add a global entry point for pseries Cédric Le Goater
2014-04-14 7:47 ` [PATCH v2 15/15] powerpc/boot: add support for 64bit little endian wrapper Cédric Le Goater
2014-04-24 7:23 ` [PATCH v2 00/15] powerpc/boot: 64bit little endian wrapper (rebased on v3.15-rc2) Cédric Le Goater
2014-04-24 7:23 ` [PATCH v2 01/15] powerpc/boot: fix do_div for 64bit wrapper Cédric Le Goater
2014-04-24 7:23 ` [PATCH v2 02/15] powerpc/boot: use a common prom_args struct in oflib Cédric Le Goater
2014-04-24 7:23 ` [PATCH v2 03/15] powerpc/boot: use prom_arg_t " Cédric Le Goater
2014-04-24 7:23 ` [PATCH v2 04/15] powerpc/boot: add byteswapping routines " Cédric Le Goater
2014-04-24 7:23 ` [PATCH v2 05/15] powerpc/boot: add PROM_ERROR define " Cédric Le Goater
2014-04-24 7:23 ` [PATCH v2 06/15] powerpc/boot: rework of_claim() to make it 64bit friendly Cédric Le Goater
2014-04-24 7:23 ` [PATCH v2 07/15] powerpc/boot: define typedef ihandle as u32 Cédric Le Goater
2014-04-24 7:23 ` [PATCH v2 08/15] powerpc/boot: fix compile warning in 64bit Cédric Le Goater
2014-04-24 7:23 ` [PATCH v2 09/15] powerpc/boot: define byteswapping routines for little endian Cédric Le Goater
2014-04-24 7:23 ` [PATCH v2 10/15] powerpc/boot: add 64bit and little endian support to addnote Cédric Le Goater
2014-04-24 7:23 ` [PATCH v2 11/15] powerpc/boot: add little endian support to elf utils Cédric Le Goater
2014-04-24 7:23 ` [PATCH v2 12/15] powerpc/boot: define a routine to enter prom Cédric Le Goater
2014-04-24 7:23 ` [PATCH v2 13/15] powerpc/boot: modify entry point for 64bit Cédric Le Goater
2014-04-24 7:23 ` [PATCH v2 14/15] powerpc/boot: add a global entry point for pseries Cédric Le Goater
2014-04-24 7:23 ` [PATCH v2 15/15] powerpc/boot: add support for 64bit little endian wrapper Cédric Le Goater
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=1391788771-16405-18-git-send-email-clg@fr.ibm.com \
--to=clg@fr.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.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).