aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-20 18:13:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-20 18:13:47 -0500
commit527d1511310a89650000081869260394e20c7013 (patch)
treef23f76433f3b67de5eb64ec0963f18737f677b06 /arch
parentd5bdaf4f68f0590fc481bca54bcaffeb27b75fca (diff)
parent280270828f108be56f0c486def58acabb070244f (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Pull powerpc LE updates from Ben Herrenschmidt: "With my previous pull request I mentioned some remaining Little Endian patches, notably support for our new ABI, which I was sitting on making sure it was all finalized. The toolchain folks confirmed it now, the new ABI is stable and merged with gcc, so we are all good. Oh and we actually missed the actual Kconfig switch for LE so here it is, along with a couple more bug fixes. I have more fixes but not related to LE so I'll send them as a separate pull request tomorrow, let's get this one out of the way. Note that this supports running user space binaries using the new ABI, but the kernel itself still needs to be built with the old one. We'll bring fixes for that after -rc1. Here's Anton log that goes with this series: This patch series adds support for the new ABI, LPAR support for H_SET_MODE and finally adds a kconfig option and defconfig. ABIv2 support was recently committed to binutils and gcc, and should be merged into glibc soon. There are a number of very nice improvements including the removal of function descriptors. Rusty's kernel patches allow binaries of either ABI to work, easing the transition" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: powerpc: Wrong DWARF CFI in the kernel vdso for little-endian / ELFv2 powerpc: Add pseries_le_defconfig powerpc: Add CONFIG_CPU_LITTLE_ENDIAN kernel config option. powerpc: Don't use ELFv2 ABI to build the kernel powerpc: ELF2 binaries signal handling powerpc: ELF2 binaries launched directly. powerpc: Set eflags correctly for ELF ABIv2 core dumps. powerpc: Add TIF_ELF2ABI flag. pseries: Add H_SET_MODE to change exception endianness powerpc/pseries: Fix endian issues in pseries EEH code
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/Makefile1
-rw-r--r--arch/powerpc/configs/pseries_le_defconfig352
-rw-r--r--arch/powerpc/include/asm/elf.h4
-rw-r--r--arch/powerpc/include/asm/hvcall.h2
-rw-r--r--arch/powerpc/include/asm/plpar_wrappers.h26
-rw-r--r--arch/powerpc/include/asm/thread_info.h9
-rw-r--r--arch/powerpc/kernel/process.c50
-rw-r--r--arch/powerpc/kernel/signal_64.c25
-rw-r--r--arch/powerpc/kernel/vdso64/sigtramp.S16
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype11
-rw-r--r--arch/powerpc/platforms/pseries/eeh_pseries.c21
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c17
-rw-r--r--arch/powerpc/platforms/pseries/setup.c42
13 files changed, 542 insertions, 34 deletions
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 607acf54a425..8a2463670a5b 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -111,6 +111,7 @@ endif
111endif 111endif
112 112
113CFLAGS-$(CONFIG_PPC64) := -mtraceback=no -mcall-aixdesc 113CFLAGS-$(CONFIG_PPC64) := -mtraceback=no -mcall-aixdesc
114CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1)
114CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,-mminimal-toc) 115CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,-mminimal-toc)
115CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions) 116CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions)
116CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 $(MULTIPLEWORD) 117CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 $(MULTIPLEWORD)
diff --git a/arch/powerpc/configs/pseries_le_defconfig b/arch/powerpc/configs/pseries_le_defconfig
new file mode 100644
index 000000000000..62771e0adb7c
--- /dev/null
+++ b/arch/powerpc/configs/pseries_le_defconfig
@@ -0,0 +1,352 @@
1CONFIG_PPC64=y
2CONFIG_ALTIVEC=y
3CONFIG_VSX=y
4CONFIG_SMP=y
5CONFIG_NR_CPUS=2048
6CONFIG_CPU_LITTLE_ENDIAN=y
7CONFIG_SYSVIPC=y
8CONFIG_POSIX_MQUEUE=y
9CONFIG_AUDIT=y
10CONFIG_AUDITSYSCALL=y
11CONFIG_IRQ_DOMAIN_DEBUG=y
12CONFIG_NO_HZ=y
13CONFIG_HIGH_RES_TIMERS=y
14CONFIG_TASKSTATS=y
15CONFIG_TASK_DELAY_ACCT=y
16CONFIG_TASK_XACCT=y
17CONFIG_TASK_IO_ACCOUNTING=y
18CONFIG_IKCONFIG=y
19CONFIG_IKCONFIG_PROC=y
20CONFIG_CGROUPS=y
21CONFIG_CGROUP_FREEZER=y
22CONFIG_CGROUP_DEVICE=y
23CONFIG_CPUSETS=y
24CONFIG_CGROUP_CPUACCT=y
25CONFIG_BLK_DEV_INITRD=y
26# CONFIG_COMPAT_BRK is not set
27CONFIG_PROFILING=y
28CONFIG_OPROFILE=y
29CONFIG_KPROBES=y
30CONFIG_JUMP_LABEL=y
31CONFIG_MODULES=y
32CONFIG_MODULE_UNLOAD=y
33CONFIG_MODVERSIONS=y
34CONFIG_MODULE_SRCVERSION_ALL=y
35CONFIG_PARTITION_ADVANCED=y
36CONFIG_PPC_SPLPAR=y
37CONFIG_SCANLOG=m
38CONFIG_PPC_SMLPAR=y
39CONFIG_DTL=y
40# CONFIG_PPC_PMAC is not set
41CONFIG_RTAS_FLASH=m
42CONFIG_IBMEBUS=y
43CONFIG_HZ_100=y
44CONFIG_BINFMT_MISC=m
45CONFIG_PPC_TRANSACTIONAL_MEM=y
46CONFIG_KEXEC=y
47CONFIG_IRQ_ALL_CPUS=y
48CONFIG_MEMORY_HOTPLUG=y
49CONFIG_MEMORY_HOTREMOVE=y
50CONFIG_CMA=y
51CONFIG_PPC_64K_PAGES=y
52CONFIG_PPC_SUBPAGE_PROT=y
53CONFIG_SCHED_SMT=y
54CONFIG_HOTPLUG_PCI=y
55CONFIG_HOTPLUG_PCI_RPA=m
56CONFIG_HOTPLUG_PCI_RPA_DLPAR=m
57CONFIG_PACKET=y
58CONFIG_UNIX=y
59CONFIG_XFRM_USER=m
60CONFIG_NET_KEY=m
61CONFIG_INET=y
62CONFIG_IP_MULTICAST=y
63CONFIG_NET_IPIP=y
64CONFIG_SYN_COOKIES=y
65CONFIG_INET_AH=m
66CONFIG_INET_ESP=m
67CONFIG_INET_IPCOMP=m
68# CONFIG_IPV6 is not set
69CONFIG_NETFILTER=y
70CONFIG_NF_CONNTRACK=m
71CONFIG_NF_CONNTRACK_EVENTS=y
72CONFIG_NF_CT_PROTO_UDPLITE=m
73CONFIG_NF_CONNTRACK_FTP=m
74CONFIG_NF_CONNTRACK_IRC=m
75CONFIG_NF_CONNTRACK_TFTP=m
76CONFIG_NF_CT_NETLINK=m
77CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
78CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
79CONFIG_NETFILTER_XT_TARGET_MARK=m
80CONFIG_NETFILTER_XT_TARGET_NFLOG=m
81CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
82CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
83CONFIG_NETFILTER_XT_MATCH_COMMENT=m
84CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
85CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m
86CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
87CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
88CONFIG_NETFILTER_XT_MATCH_DCCP=m
89CONFIG_NETFILTER_XT_MATCH_DSCP=m
90CONFIG_NETFILTER_XT_MATCH_ESP=m
91CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
92CONFIG_NETFILTER_XT_MATCH_HELPER=m
93CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
94CONFIG_NETFILTER_XT_MATCH_LENGTH=m
95CONFIG_NETFILTER_XT_MATCH_LIMIT=m
96CONFIG_NETFILTER_XT_MATCH_MAC=m
97CONFIG_NETFILTER_XT_MATCH_MARK=m
98CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
99CONFIG_NETFILTER_XT_MATCH_OWNER=m
100CONFIG_NETFILTER_XT_MATCH_POLICY=m
101CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
102CONFIG_NETFILTER_XT_MATCH_QUOTA=m
103CONFIG_NETFILTER_XT_MATCH_RATEEST=m
104CONFIG_NETFILTER_XT_MATCH_REALM=m
105CONFIG_NETFILTER_XT_MATCH_RECENT=m
106CONFIG_NETFILTER_XT_MATCH_SCTP=m
107CONFIG_NETFILTER_XT_MATCH_STATE=m
108CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
109CONFIG_NETFILTER_XT_MATCH_STRING=m
110CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
111CONFIG_NETFILTER_XT_MATCH_TIME=m
112CONFIG_NETFILTER_XT_MATCH_U32=m
113CONFIG_NF_CONNTRACK_IPV4=m
114CONFIG_IP_NF_IPTABLES=m
115CONFIG_IP_NF_MATCH_AH=m
116CONFIG_IP_NF_MATCH_ECN=m
117CONFIG_IP_NF_MATCH_TTL=m
118CONFIG_IP_NF_FILTER=m
119CONFIG_IP_NF_TARGET_REJECT=m
120CONFIG_IP_NF_TARGET_ULOG=m
121CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
122CONFIG_DEVTMPFS=y
123CONFIG_DEVTMPFS_MOUNT=y
124CONFIG_PROC_DEVICETREE=y
125CONFIG_PARPORT=m
126CONFIG_PARPORT_PC=m
127CONFIG_BLK_DEV_FD=m
128CONFIG_BLK_DEV_LOOP=y
129CONFIG_BLK_DEV_NBD=m
130CONFIG_BLK_DEV_RAM=y
131CONFIG_BLK_DEV_RAM_SIZE=65536
132CONFIG_VIRTIO_BLK=m
133CONFIG_IDE=y
134CONFIG_BLK_DEV_IDECD=y
135CONFIG_BLK_DEV_GENERIC=y
136CONFIG_BLK_DEV_AMD74XX=y
137CONFIG_BLK_DEV_SD=y
138CONFIG_CHR_DEV_ST=y
139CONFIG_BLK_DEV_SR=y
140CONFIG_BLK_DEV_SR_VENDOR=y
141CONFIG_CHR_DEV_SG=y
142CONFIG_SCSI_MULTI_LUN=y
143CONFIG_SCSI_CONSTANTS=y
144CONFIG_SCSI_FC_ATTRS=y
145CONFIG_SCSI_CXGB3_ISCSI=m
146CONFIG_SCSI_CXGB4_ISCSI=m
147CONFIG_SCSI_BNX2_ISCSI=m
148CONFIG_BE2ISCSI=m
149CONFIG_SCSI_MPT2SAS=m
150CONFIG_SCSI_IBMVSCSI=y
151CONFIG_SCSI_IBMVFC=m
152CONFIG_SCSI_SYM53C8XX_2=y
153CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
154CONFIG_SCSI_IPR=y
155CONFIG_SCSI_QLA_FC=m
156CONFIG_SCSI_QLA_ISCSI=m
157CONFIG_SCSI_LPFC=m
158CONFIG_SCSI_VIRTIO=m
159CONFIG_SCSI_DH=m
160CONFIG_SCSI_DH_RDAC=m
161CONFIG_SCSI_DH_ALUA=m
162CONFIG_ATA=y
163# CONFIG_ATA_SFF is not set
164CONFIG_MD=y
165CONFIG_BLK_DEV_MD=y
166CONFIG_MD_LINEAR=y
167CONFIG_MD_RAID0=y
168CONFIG_MD_RAID1=y
169CONFIG_MD_RAID10=m
170CONFIG_MD_RAID456=m
171CONFIG_MD_MULTIPATH=m
172CONFIG_MD_FAULTY=m
173CONFIG_BLK_DEV_DM=y
174CONFIG_DM_CRYPT=m
175CONFIG_DM_SNAPSHOT=m
176CONFIG_DM_MIRROR=m
177CONFIG_DM_ZERO=m
178CONFIG_DM_MULTIPATH=m
179CONFIG_DM_MULTIPATH_QL=m
180CONFIG_DM_MULTIPATH_ST=m
181CONFIG_DM_UEVENT=y
182CONFIG_BONDING=m
183CONFIG_DUMMY=m
184CONFIG_NETCONSOLE=y
185CONFIG_NETPOLL_TRAP=y
186CONFIG_TUN=m
187CONFIG_VIRTIO_NET=m
188CONFIG_VORTEX=y
189CONFIG_ACENIC=m
190CONFIG_ACENIC_OMIT_TIGON_I=y
191CONFIG_PCNET32=y
192CONFIG_TIGON3=y
193CONFIG_CHELSIO_T1=m
194CONFIG_BE2NET=m
195CONFIG_S2IO=m
196CONFIG_IBMVETH=y
197CONFIG_EHEA=y
198CONFIG_E100=y
199CONFIG_E1000=y
200CONFIG_E1000E=y
201CONFIG_IXGB=m
202CONFIG_IXGBE=m
203CONFIG_MLX4_EN=m
204CONFIG_MYRI10GE=m
205CONFIG_QLGE=m
206CONFIG_NETXEN_NIC=m
207CONFIG_PPP=m
208CONFIG_PPP_BSDCOMP=m
209CONFIG_PPP_DEFLATE=m
210CONFIG_PPPOE=m
211CONFIG_PPP_ASYNC=m
212CONFIG_PPP_SYNC_TTY=m
213# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
214CONFIG_INPUT_EVDEV=m
215CONFIG_INPUT_MISC=y
216CONFIG_INPUT_PCSPKR=m
217# CONFIG_SERIO_SERPORT is not set
218CONFIG_SERIAL_8250=y
219CONFIG_SERIAL_8250_CONSOLE=y
220CONFIG_SERIAL_ICOM=m
221CONFIG_SERIAL_JSM=m
222CONFIG_HVC_CONSOLE=y
223CONFIG_HVC_RTAS=y
224CONFIG_HVCS=m
225CONFIG_VIRTIO_CONSOLE=m
226CONFIG_IBM_BSR=m
227CONFIG_GEN_RTC=y
228CONFIG_RAW_DRIVER=y
229CONFIG_MAX_RAW_DEVS=1024
230CONFIG_FB=y
231CONFIG_FIRMWARE_EDID=y
232CONFIG_FB_OF=y
233CONFIG_FB_MATROX=y
234CONFIG_FB_MATROX_MILLENIUM=y
235CONFIG_FB_MATROX_MYSTIQUE=y
236CONFIG_FB_MATROX_G=y
237CONFIG_FB_RADEON=y
238CONFIG_FB_IBM_GXT4500=y
239CONFIG_LCD_PLATFORM=m
240# CONFIG_VGA_CONSOLE is not set
241CONFIG_FRAMEBUFFER_CONSOLE=y
242CONFIG_LOGO=y
243CONFIG_HID_GYRATION=y
244CONFIG_HID_PANTHERLORD=y
245CONFIG_HID_PETALYNX=y
246CONFIG_HID_SAMSUNG=y
247CONFIG_HID_SUNPLUS=y
248CONFIG_USB_HIDDEV=y
249CONFIG_USB=y
250CONFIG_USB_MON=m
251CONFIG_USB_EHCI_HCD=y
252# CONFIG_USB_EHCI_HCD_PPC_OF is not set
253CONFIG_USB_OHCI_HCD=y
254CONFIG_USB_STORAGE=m
255CONFIG_INFINIBAND=m
256CONFIG_INFINIBAND_USER_MAD=m
257CONFIG_INFINIBAND_USER_ACCESS=m
258CONFIG_INFINIBAND_MTHCA=m
259CONFIG_INFINIBAND_EHCA=m
260CONFIG_INFINIBAND_CXGB3=m
261CONFIG_INFINIBAND_CXGB4=m
262CONFIG_MLX4_INFINIBAND=m
263CONFIG_INFINIBAND_IPOIB=m
264CONFIG_INFINIBAND_IPOIB_CM=y
265CONFIG_INFINIBAND_SRP=m
266CONFIG_INFINIBAND_ISER=m
267CONFIG_VIRTIO_PCI=m
268CONFIG_VIRTIO_BALLOON=m
269CONFIG_EXT2_FS=y
270CONFIG_EXT2_FS_XATTR=y
271CONFIG_EXT2_FS_POSIX_ACL=y
272CONFIG_EXT2_FS_SECURITY=y
273CONFIG_EXT2_FS_XIP=y
274CONFIG_EXT3_FS=y
275CONFIG_EXT3_FS_POSIX_ACL=y
276CONFIG_EXT3_FS_SECURITY=y
277CONFIG_EXT4_FS=y
278CONFIG_EXT4_FS_POSIX_ACL=y
279CONFIG_EXT4_FS_SECURITY=y
280CONFIG_REISERFS_FS=y
281CONFIG_REISERFS_FS_XATTR=y
282CONFIG_REISERFS_FS_POSIX_ACL=y
283CONFIG_REISERFS_FS_SECURITY=y
284CONFIG_JFS_FS=m
285CONFIG_JFS_POSIX_ACL=y
286CONFIG_JFS_SECURITY=y
287CONFIG_XFS_FS=m
288CONFIG_XFS_POSIX_ACL=y
289CONFIG_BTRFS_FS=m
290CONFIG_BTRFS_FS_POSIX_ACL=y
291CONFIG_NILFS2_FS=m
292CONFIG_AUTOFS4_FS=m
293CONFIG_FUSE_FS=m
294CONFIG_ISO9660_FS=y
295CONFIG_UDF_FS=m
296CONFIG_MSDOS_FS=y
297CONFIG_VFAT_FS=y
298CONFIG_PROC_KCORE=y
299CONFIG_TMPFS=y
300CONFIG_TMPFS_POSIX_ACL=y
301CONFIG_HUGETLBFS=y
302CONFIG_CRAMFS=m
303CONFIG_SQUASHFS=m
304CONFIG_SQUASHFS_XATTR=y
305CONFIG_SQUASHFS_LZO=y
306CONFIG_SQUASHFS_XZ=y
307CONFIG_PSTORE=y
308CONFIG_NFS_FS=y
309CONFIG_NFS_V3_ACL=y
310CONFIG_NFS_V4=y
311CONFIG_NFSD=m
312CONFIG_NFSD_V3_ACL=y
313CONFIG_NFSD_V4=y
314CONFIG_CIFS=m
315CONFIG_CIFS_XATTR=y
316CONFIG_CIFS_POSIX=y
317CONFIG_NLS_DEFAULT="utf8"
318CONFIG_NLS_CODEPAGE_437=y
319CONFIG_NLS_ASCII=y
320CONFIG_NLS_ISO8859_1=y
321CONFIG_NLS_UTF8=y
322CONFIG_CRC_T10DIF=y
323CONFIG_MAGIC_SYSRQ=y
324CONFIG_DEBUG_KERNEL=y
325CONFIG_DEBUG_STACK_USAGE=y
326CONFIG_DEBUG_STACKOVERFLOW=y
327CONFIG_LOCKUP_DETECTOR=y
328CONFIG_LATENCYTOP=y
329CONFIG_SCHED_TRACER=y
330CONFIG_BLK_DEV_IO_TRACE=y
331CONFIG_CODE_PATCHING_SELFTEST=y
332CONFIG_FTR_FIXUP_SELFTEST=y
333CONFIG_MSI_BITMAP_SELFTEST=y
334CONFIG_XMON=y
335CONFIG_CRYPTO_TEST=m
336CONFIG_CRYPTO_PCBC=m
337CONFIG_CRYPTO_HMAC=y
338CONFIG_CRYPTO_MICHAEL_MIC=m
339CONFIG_CRYPTO_TGR192=m
340CONFIG_CRYPTO_WP512=m
341CONFIG_CRYPTO_ANUBIS=m
342CONFIG_CRYPTO_BLOWFISH=m
343CONFIG_CRYPTO_CAST6=m
344CONFIG_CRYPTO_KHAZAD=m
345CONFIG_CRYPTO_SALSA20=m
346CONFIG_CRYPTO_SERPENT=m
347CONFIG_CRYPTO_TEA=m
348CONFIG_CRYPTO_TWOFISH=m
349CONFIG_CRYPTO_LZO=m
350# CONFIG_CRYPTO_ANSI_CPRNG is not set
351CONFIG_CRYPTO_DEV_NX=y
352CONFIG_CRYPTO_DEV_NX_ENCRYPT=m
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index cc0655a702a7..935b5e7a1436 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -31,6 +31,8 @@
31extern unsigned long randomize_et_dyn(unsigned long base); 31extern unsigned long randomize_et_dyn(unsigned long base);
32#define ELF_ET_DYN_BASE (randomize_et_dyn(0x20000000)) 32#define ELF_ET_DYN_BASE (randomize_et_dyn(0x20000000))
33 33
34#define ELF_CORE_EFLAGS (is_elf2_task() ? 2 : 0)
35
34/* 36/*
35 * Our registers are always unsigned longs, whether we're a 32 bit 37 * Our registers are always unsigned longs, whether we're a 32 bit
36 * process or 64 bit, on either a 64 bit or 32 bit kernel. 38 * process or 64 bit, on either a 64 bit or 32 bit kernel.
@@ -86,6 +88,8 @@ typedef elf_vrregset_t elf_fpxregset_t;
86#ifdef __powerpc64__ 88#ifdef __powerpc64__
87# define SET_PERSONALITY(ex) \ 89# define SET_PERSONALITY(ex) \
88do { \ 90do { \
91 if (((ex).e_flags & 0x3) == 2) \
92 set_thread_flag(TIF_ELF2ABI); \
89 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \ 93 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
90 set_thread_flag(TIF_32BIT); \ 94 set_thread_flag(TIF_32BIT); \
91 else \ 95 else \
diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
index 0c7f2bfcf134..d8b600b3f058 100644
--- a/arch/powerpc/include/asm/hvcall.h
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -403,6 +403,8 @@ static inline unsigned long cmo_get_page_size(void)
403extern long pSeries_enable_reloc_on_exc(void); 403extern long pSeries_enable_reloc_on_exc(void);
404extern long pSeries_disable_reloc_on_exc(void); 404extern long pSeries_disable_reloc_on_exc(void);
405 405
406extern long pseries_big_endian_exceptions(void);
407
406#else 408#else
407 409
408#define pSeries_enable_reloc_on_exc() do {} while (0) 410#define pSeries_enable_reloc_on_exc() do {} while (0)
diff --git a/arch/powerpc/include/asm/plpar_wrappers.h b/arch/powerpc/include/asm/plpar_wrappers.h
index a63b045e707c..12c32c5f533d 100644
--- a/arch/powerpc/include/asm/plpar_wrappers.h
+++ b/arch/powerpc/include/asm/plpar_wrappers.h
@@ -287,6 +287,32 @@ static inline long disable_reloc_on_exceptions(void) {
287 return plpar_set_mode(0, 3, 0, 0); 287 return plpar_set_mode(0, 3, 0, 0);
288} 288}
289 289
290/*
291 * Take exceptions in big endian mode on this partition
292 *
293 * Note: this call has a partition wide scope and can take a while to complete.
294 * If it returns H_LONG_BUSY_* it should be retried periodically until it
295 * returns H_SUCCESS.
296 */
297static inline long enable_big_endian_exceptions(void)
298{
299 /* mflags = 0: big endian exceptions */
300 return plpar_set_mode(0, 4, 0, 0);
301}
302
303/*
304 * Take exceptions in little endian mode on this partition
305 *
306 * Note: this call has a partition wide scope and can take a while to complete.
307 * If it returns H_LONG_BUSY_* it should be retried periodically until it
308 * returns H_SUCCESS.
309 */
310static inline long enable_little_endian_exceptions(void)
311{
312 /* mflags = 1: little endian exceptions */
313 return plpar_set_mode(1, 4, 0, 0);
314}
315
290static inline long plapr_set_ciabr(unsigned long ciabr) 316static inline long plapr_set_ciabr(unsigned long ciabr)
291{ 317{
292 return plpar_set_mode(0, 1, ciabr, 0); 318 return plpar_set_mode(0, 1, ciabr, 0);
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index 8fd6cf6dcee8..9854c564ac52 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -105,6 +105,9 @@ static inline struct thread_info *current_thread_info(void)
105#define TIF_EMULATE_STACK_STORE 16 /* Is an instruction emulation 105#define TIF_EMULATE_STACK_STORE 16 /* Is an instruction emulation
106 for stack store? */ 106 for stack store? */
107#define TIF_MEMDIE 17 /* is terminating due to OOM killer */ 107#define TIF_MEMDIE 17 /* is terminating due to OOM killer */
108#if defined(CONFIG_PPC64)
109#define TIF_ELF2ABI 18 /* function descriptors must die! */
110#endif
108 111
109/* as above, but as bit values */ 112/* as above, but as bit values */
110#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 113#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -183,6 +186,12 @@ static inline bool test_thread_local_flags(unsigned int flags)
183#define is_32bit_task() (1) 186#define is_32bit_task() (1)
184#endif 187#endif
185 188
189#if defined(CONFIG_PPC64)
190#define is_elf2_task() (test_thread_flag(TIF_ELF2ABI))
191#else
192#define is_elf2_task() (0)
193#endif
194
186#endif /* !__ASSEMBLY__ */ 195#endif /* !__ASSEMBLY__ */
187 196
188#endif /* __KERNEL__ */ 197#endif /* __KERNEL__ */
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 75c2d1009985..0650e18169f8 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1086,25 +1086,45 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp)
1086 regs->msr = MSR_USER; 1086 regs->msr = MSR_USER;
1087#else 1087#else
1088 if (!is_32bit_task()) { 1088 if (!is_32bit_task()) {
1089 unsigned long entry, toc; 1089 unsigned long entry;
1090 1090
1091 /* start is a relocated pointer to the function descriptor for 1091 if (is_elf2_task()) {
1092 * the elf _start routine. The first entry in the function 1092 /* Look ma, no function descriptors! */
1093 * descriptor is the entry address of _start and the second 1093 entry = start;
1094 * entry is the TOC value we need to use.
1095 */
1096 __get_user(entry, (unsigned long __user *)start);
1097 __get_user(toc, (unsigned long __user *)start+1);
1098 1094
1099 /* Check whether the e_entry function descriptor entries 1095 /*
1100 * need to be relocated before we can use them. 1096 * Ulrich says:
1101 */ 1097 * The latest iteration of the ABI requires that when
1102 if (load_addr != 0) { 1098 * calling a function (at its global entry point),
1103 entry += load_addr; 1099 * the caller must ensure r12 holds the entry point
1104 toc += load_addr; 1100 * address (so that the function can quickly
1101 * establish addressability).
1102 */
1103 regs->gpr[12] = start;
1104 /* Make sure that's restored on entry to userspace. */
1105 set_thread_flag(TIF_RESTOREALL);
1106 } else {
1107 unsigned long toc;
1108
1109 /* start is a relocated pointer to the function
1110 * descriptor for the elf _start routine. The first
1111 * entry in the function descriptor is the entry
1112 * address of _start and the second entry is the TOC
1113 * value we need to use.
1114 */
1115 __get_user(entry, (unsigned long __user *)start);
1116 __get_user(toc, (unsigned long __user *)start+1);
1117
1118 /* Check whether the e_entry function descriptor entries
1119 * need to be relocated before we can use them.
1120 */
1121 if (load_addr != 0) {
1122 entry += load_addr;
1123 toc += load_addr;
1124 }
1125 regs->gpr[2] = toc;
1105 } 1126 }
1106 regs->nip = entry; 1127 regs->nip = entry;
1107 regs->gpr[2] = toc;
1108 regs->msr = MSR_USER64; 1128 regs->msr = MSR_USER64;
1109 } else { 1129 } else {
1110 regs->nip = start; 1130 regs->nip = start;
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index b3c615764c9b..e66f67b8b9e6 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -701,12 +701,6 @@ badframe:
701int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info, 701int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
702 sigset_t *set, struct pt_regs *regs) 702 sigset_t *set, struct pt_regs *regs)
703{ 703{
704 /* Handler is *really* a pointer to the function descriptor for
705 * the signal routine. The first entry in the function
706 * descriptor is the entry address of signal and the second
707 * entry is the TOC value we need to use.
708 */
709 func_descr_t __user *funct_desc_ptr;
710 struct rt_sigframe __user *frame; 704 struct rt_sigframe __user *frame;
711 unsigned long newsp = 0; 705 unsigned long newsp = 0;
712 long err = 0; 706 long err = 0;
@@ -766,19 +760,32 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
766 goto badframe; 760 goto badframe;
767 regs->link = (unsigned long) &frame->tramp[0]; 761 regs->link = (unsigned long) &frame->tramp[0];
768 } 762 }
769 funct_desc_ptr = (func_descr_t __user *) ka->sa.sa_handler;
770 763
771 /* Allocate a dummy caller frame for the signal handler. */ 764 /* Allocate a dummy caller frame for the signal handler. */
772 newsp = ((unsigned long)frame) - __SIGNAL_FRAMESIZE; 765 newsp = ((unsigned long)frame) - __SIGNAL_FRAMESIZE;
773 err |= put_user(regs->gpr[1], (unsigned long __user *)newsp); 766 err |= put_user(regs->gpr[1], (unsigned long __user *)newsp);
774 767
775 /* Set up "regs" so we "return" to the signal handler. */ 768 /* Set up "regs" so we "return" to the signal handler. */
776 err |= get_user(regs->nip, &funct_desc_ptr->entry); 769 if (is_elf2_task()) {
770 regs->nip = (unsigned long) ka->sa.sa_handler;
771 regs->gpr[12] = regs->nip;
772 } else {
773 /* Handler is *really* a pointer to the function descriptor for
774 * the signal routine. The first entry in the function
775 * descriptor is the entry address of signal and the second
776 * entry is the TOC value we need to use.
777 */
778 func_descr_t __user *funct_desc_ptr =
779 (func_descr_t __user *) ka->sa.sa_handler;
780
781 err |= get_user(regs->nip, &funct_desc_ptr->entry);
782 err |= get_user(regs->gpr[2], &funct_desc_ptr->toc);
783 }
784
777 /* enter the signal handler in native-endian mode */ 785 /* enter the signal handler in native-endian mode */
778 regs->msr &= ~MSR_LE; 786 regs->msr &= ~MSR_LE;
779 regs->msr |= (MSR_KERNEL & MSR_LE); 787 regs->msr |= (MSR_KERNEL & MSR_LE);
780 regs->gpr[1] = newsp; 788 regs->gpr[1] = newsp;
781 err |= get_user(regs->gpr[2], &funct_desc_ptr->toc);
782 regs->gpr[3] = signr; 789 regs->gpr[3] = signr;
783 regs->result = 0; 790 regs->result = 0;
784 if (ka->sa.sa_flags & SA_SIGINFO) { 791 if (ka->sa.sa_flags & SA_SIGINFO) {
diff --git a/arch/powerpc/kernel/vdso64/sigtramp.S b/arch/powerpc/kernel/vdso64/sigtramp.S
index 45ea281e9a21..542c6f422e4d 100644
--- a/arch/powerpc/kernel/vdso64/sigtramp.S
+++ b/arch/powerpc/kernel/vdso64/sigtramp.S
@@ -142,6 +142,13 @@ V_FUNCTION_END(__kernel_sigtramp_rt64)
142/* Size of CR reg in DWARF unwind info. */ 142/* Size of CR reg in DWARF unwind info. */
143#define CRSIZE 4 143#define CRSIZE 4
144 144
145/* Offset of CR reg within a full word. */
146#ifdef __LITTLE_ENDIAN__
147#define CROFF 0
148#else
149#define CROFF (RSIZE - CRSIZE)
150#endif
151
145/* This is the offset of the VMX reg pointer. */ 152/* This is the offset of the VMX reg pointer. */
146#define VREGS 48*RSIZE+33*8 153#define VREGS 48*RSIZE+33*8
147 154
@@ -181,7 +188,14 @@ V_FUNCTION_END(__kernel_sigtramp_rt64)
181 rsave (31, 31*RSIZE); \ 188 rsave (31, 31*RSIZE); \
182 rsave (67, 32*RSIZE); /* ap, used as temp for nip */ \ 189 rsave (67, 32*RSIZE); /* ap, used as temp for nip */ \
183 rsave (65, 36*RSIZE); /* lr */ \ 190 rsave (65, 36*RSIZE); /* lr */ \
184 rsave (70, 38*RSIZE + (RSIZE - CRSIZE)) /* cr */ 191 rsave (68, 38*RSIZE + CROFF); /* cr fields */ \
192 rsave (69, 38*RSIZE + CROFF); \
193 rsave (70, 38*RSIZE + CROFF); \
194 rsave (71, 38*RSIZE + CROFF); \
195 rsave (72, 38*RSIZE + CROFF); \
196 rsave (73, 38*RSIZE + CROFF); \
197 rsave (74, 38*RSIZE + CROFF); \
198 rsave (75, 38*RSIZE + CROFF)
185 199
186/* Describe where the FP regs are saved. */ 200/* Describe where the FP regs are saved. */
187#define EH_FRAME_FP \ 201#define EH_FRAME_FP \
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index c2a566fb8bb8..132f8726a257 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -403,3 +403,14 @@ config PPC_DOORBELL
403 default n 403 default n
404 404
405endmenu 405endmenu
406
407config CPU_LITTLE_ENDIAN
408 bool "Build little endian kernel"
409 default n
410 help
411 This option selects whether a big endian or little endian kernel will
412 be built.
413
414 Note that if cross compiling a little endian kernel,
415 CROSS_COMPILE must point to a toolchain capable of targeting
416 little endian powerpc.
diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
index 7fbc25b1813f..ccb633e077b1 100644
--- a/arch/powerpc/platforms/pseries/eeh_pseries.c
+++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
@@ -189,8 +189,9 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag)
189 struct eeh_dev *edev; 189 struct eeh_dev *edev;
190 struct eeh_pe pe; 190 struct eeh_pe pe;
191 struct pci_dn *pdn = PCI_DN(dn); 191 struct pci_dn *pdn = PCI_DN(dn);
192 const u32 *class_code, *vendor_id, *device_id; 192 const __be32 *classp, *vendorp, *devicep;
193 const u32 *regs; 193 u32 class_code;
194 const __be32 *regs;
194 u32 pcie_flags; 195 u32 pcie_flags;
195 int enable = 0; 196 int enable = 0;
196 int ret; 197 int ret;
@@ -201,22 +202,24 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag)
201 return NULL; 202 return NULL;
202 203
203 /* Retrieve class/vendor/device IDs */ 204 /* Retrieve class/vendor/device IDs */
204 class_code = of_get_property(dn, "class-code", NULL); 205 classp = of_get_property(dn, "class-code", NULL);
205 vendor_id = of_get_property(dn, "vendor-id", NULL); 206 vendorp = of_get_property(dn, "vendor-id", NULL);
206 device_id = of_get_property(dn, "device-id", NULL); 207 devicep = of_get_property(dn, "device-id", NULL);
207 208
208 /* Skip for bad OF node or PCI-ISA bridge */ 209 /* Skip for bad OF node or PCI-ISA bridge */
209 if (!class_code || !vendor_id || !device_id) 210 if (!classp || !vendorp || !devicep)
210 return NULL; 211 return NULL;
211 if (dn->type && !strcmp(dn->type, "isa")) 212 if (dn->type && !strcmp(dn->type, "isa"))
212 return NULL; 213 return NULL;
213 214
215 class_code = of_read_number(classp, 1);
216
214 /* 217 /*
215 * Update class code and mode of eeh device. We need 218 * Update class code and mode of eeh device. We need
216 * correctly reflects that current device is root port 219 * correctly reflects that current device is root port
217 * or PCIe switch downstream port. 220 * or PCIe switch downstream port.
218 */ 221 */
219 edev->class_code = *class_code; 222 edev->class_code = class_code;
220 edev->pcie_cap = pseries_eeh_find_cap(dn, PCI_CAP_ID_EXP); 223 edev->pcie_cap = pseries_eeh_find_cap(dn, PCI_CAP_ID_EXP);
221 edev->mode &= 0xFFFFFF00; 224 edev->mode &= 0xFFFFFF00;
222 if ((edev->class_code >> 8) == PCI_CLASS_BRIDGE_PCI) { 225 if ((edev->class_code >> 8) == PCI_CLASS_BRIDGE_PCI) {
@@ -243,12 +246,12 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag)
243 /* Initialize the fake PE */ 246 /* Initialize the fake PE */
244 memset(&pe, 0, sizeof(struct eeh_pe)); 247 memset(&pe, 0, sizeof(struct eeh_pe));
245 pe.phb = edev->phb; 248 pe.phb = edev->phb;
246 pe.config_addr = regs[0]; 249 pe.config_addr = of_read_number(regs, 1);
247 250
248 /* Enable EEH on the device */ 251 /* Enable EEH on the device */
249 ret = eeh_ops->set_option(&pe, EEH_OPT_ENABLE); 252 ret = eeh_ops->set_option(&pe, EEH_OPT_ENABLE);
250 if (!ret) { 253 if (!ret) {
251 edev->config_addr = regs[0]; 254 edev->config_addr = of_read_number(regs, 1);
252 /* Retrieve PE address */ 255 /* Retrieve PE address */
253 edev->pe_config_addr = eeh_ops->get_pe_addr(&pe); 256 edev->pe_config_addr = eeh_ops->get_pe_addr(&pe);
254 pe.addr = edev->pe_config_addr; 257 pe.addr = edev->pe_config_addr;
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 356bc75ca74f..4fca3def9db9 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -245,6 +245,23 @@ static void pSeries_lpar_hptab_clear(void)
245 &(ptes[j].pteh), &(ptes[j].ptel)); 245 &(ptes[j].pteh), &(ptes[j].ptel));
246 } 246 }
247 } 247 }
248
249#ifdef __LITTLE_ENDIAN__
250 /* Reset exceptions to big endian */
251 if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
252 long rc;
253
254 rc = pseries_big_endian_exceptions();
255 /*
256 * At this point it is unlikely panic() will get anything
257 * out to the user, but at least this will stop us from
258 * continuing on further and creating an even more
259 * difficult to debug situation.
260 */
261 if (rc)
262 panic("Could not enable big endian exceptions");
263 }
264#endif
248} 265}
249 266
250/* 267/*
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 1f97e2b87a62..c1f190858701 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -442,6 +442,32 @@ static void pSeries_machine_kexec(struct kimage *image)
442} 442}
443#endif 443#endif
444 444
445#ifdef __LITTLE_ENDIAN__
446long pseries_big_endian_exceptions(void)
447{
448 long rc;
449
450 while (1) {
451 rc = enable_big_endian_exceptions();
452 if (!H_IS_LONG_BUSY(rc))
453 return rc;
454 mdelay(get_longbusy_msecs(rc));
455 }
456}
457
458static long pseries_little_endian_exceptions(void)
459{
460 long rc;
461
462 while (1) {
463 rc = enable_little_endian_exceptions();
464 if (!H_IS_LONG_BUSY(rc))
465 return rc;
466 mdelay(get_longbusy_msecs(rc));
467 }
468}
469#endif
470
445static void __init pSeries_setup_arch(void) 471static void __init pSeries_setup_arch(void)
446{ 472{
447 panic_timeout = 10; 473 panic_timeout = 10;
@@ -698,6 +724,22 @@ static int __init pSeries_probe(void)
698 /* Now try to figure out if we are running on LPAR */ 724 /* Now try to figure out if we are running on LPAR */
699 of_scan_flat_dt(pseries_probe_fw_features, NULL); 725 of_scan_flat_dt(pseries_probe_fw_features, NULL);
700 726
727#ifdef __LITTLE_ENDIAN__
728 if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
729 long rc;
730 /*
731 * Tell the hypervisor that we want our exceptions to
732 * be taken in little endian mode. If this fails we don't
733 * want to use BUG() because it will trigger an exception.
734 */
735 rc = pseries_little_endian_exceptions();
736 if (rc) {
737 ppc_md.progress("H_SET_MODE LE exception fail", 0);
738 panic("Could not enable little endian exceptions");
739 }
740 }
741#endif
742
701 if (firmware_has_feature(FW_FEATURE_LPAR)) 743 if (firmware_has_feature(FW_FEATURE_LPAR))
702 hpte_init_lpar(); 744 hpte_init_lpar();
703 else 745 else