aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-05-05 06:33:10 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-05-05 06:57:12 -0400
commitf6869e7fe657bd977e72954cd78c5871a6a4f71d (patch)
tree1e34a4bb36cde4b541d7344599e65b541bb4bee7
parent5a4e58bc693f04aa650219784e5e339e0db6b902 (diff)
parentcec4b7eaf09d330e94e8e94133d360e6f1855974 (diff)
Merge remote-tracking branch 'anton/abiv2' into next
This series adds support for building the powerpc 64-bit LE kernel using the new ABI v2. We already supported running ABI v2 userspace programs but this adds support for building the kernel itself using the new ABI.
-rw-r--r--arch/powerpc/Makefile11
-rw-r--r--arch/powerpc/boot/util.S4
-rw-r--r--arch/powerpc/include/asm/code-patching.h40
-rw-r--r--arch/powerpc/include/asm/context_tracking.h4
-rw-r--r--arch/powerpc/include/asm/exception-64e.h6
-rw-r--r--arch/powerpc/include/asm/exception-64s.h2
-rw-r--r--arch/powerpc/include/asm/ftrace.h2
-rw-r--r--arch/powerpc/include/asm/irqflags.h8
-rw-r--r--arch/powerpc/include/asm/kprobes.h5
-rw-r--r--arch/powerpc/include/asm/linkage.h2
-rw-r--r--arch/powerpc/include/asm/module.h4
-rw-r--r--arch/powerpc/include/asm/ppc_asm.h72
-rw-r--r--arch/powerpc/include/asm/sections.h2
-rw-r--r--arch/powerpc/include/asm/systbl.h6
-rw-r--r--arch/powerpc/include/uapi/asm/elf.h10
-rw-r--r--arch/powerpc/kernel/cpu_setup_fsl_booke.S28
-rw-r--r--arch/powerpc/kernel/entry_64.S117
-rw-r--r--arch/powerpc/kernel/exceptions-64e.S140
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S206
-rw-r--r--arch/powerpc/kernel/ftrace.c137
-rw-r--r--arch/powerpc/kernel/head_64.S117
-rw-r--r--arch/powerpc/kernel/idle_book3e.S2
-rw-r--r--arch/powerpc/kernel/idle_power4.S2
-rw-r--r--arch/powerpc/kernel/idle_power7.S4
-rw-r--r--arch/powerpc/kernel/misc_64.S46
-rw-r--r--arch/powerpc/kernel/module_64.c279
-rw-r--r--arch/powerpc/kernel/process.c17
-rw-r--r--arch/powerpc/kernel/prom_init_check.sh2
-rw-r--r--arch/powerpc/kernel/setup_64.c2
-rw-r--r--arch/powerpc/kernel/systbl.S18
-rw-r--r--arch/powerpc/kernel/tm.S13
-rw-r--r--arch/powerpc/kvm/book3s_hv_interrupts.S2
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S34
-rw-r--r--arch/powerpc/lib/copypage_64.S2
-rw-r--r--arch/powerpc/lib/copypage_power7.S12
-rw-r--r--arch/powerpc/lib/copyuser_64.S2
-rw-r--r--arch/powerpc/lib/copyuser_power7.S32
-rw-r--r--arch/powerpc/lib/hweight_64.S8
-rw-r--r--arch/powerpc/lib/mem_64.S4
-rw-r--r--arch/powerpc/lib/memcpy_64.S10
-rw-r--r--arch/powerpc/lib/memcpy_power7.S26
-rw-r--r--arch/powerpc/mm/hash_low_64.S44
-rw-r--r--arch/powerpc/mm/hash_utils_64.c36
-rw-r--r--arch/powerpc/mm/slb.c12
-rw-r--r--arch/powerpc/mm/slb_low.S12
-rw-r--r--arch/powerpc/platforms/85xx/smp.c3
-rw-r--r--arch/powerpc/platforms/cell/smp.c5
-rw-r--r--arch/powerpc/platforms/pasemi/powersave.S2
-rw-r--r--arch/powerpc/platforms/powernv/opal-takeover.S2
-rw-r--r--arch/powerpc/platforms/powernv/opal-wrappers.S4
-rw-r--r--arch/powerpc/platforms/powernv/smp.c5
-rw-r--r--arch/powerpc/platforms/pseries/hvCall.S4
-rw-r--r--arch/powerpc/platforms/pseries/smp.c5
-rw-r--r--arch/powerpc/platforms/wsp/scom_smp.c3
-rw-r--r--tools/testing/selftests/powerpc/copyloops/asm/ppc_asm.h5
55 files changed, 902 insertions, 680 deletions
<
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 31b96942c0a7..68cde2f8a12c 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -113,8 +113,13 @@ else
113endif 113endif
114endif 114endif
115 115
116CFLAGS-$(CONFIG_PPC64) := -mtraceback=no -mcall-aixdesc 116CFLAGS-$(CONFIG_PPC64) := -mtraceback=no
117CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1) 117ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
118CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2,-mcall-aixdesc)
119AFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2)
120else
121CFLAGS-$(CONFIG_PPC64) += -mcall-aixdesc
122endif
118CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,-mminimal-toc) 123CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,-mminimal-toc)
119CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions) 124CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions)
120CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 $(MULTIPLEWORD) 125CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 $(MULTIPLEWORD)
@@ -151,7 +156,7 @@ endif
151CFLAGS-$(CONFIG_TUNE_CELL) += $(call cc-option,-mtune=cell) 156CFLAGS-$(CONFIG_TUNE_CELL) += $(call cc-option,-mtune=cell)
152 157
153KBUILD_CPPFLAGS += -Iarch/$(ARCH) 158KBUILD_CPPFLAGS += -Iarch/$(ARCH)
154KBUILD_AFLAGS += -Iarch/$(ARCH) 159KBUILD_AFLAGS += -Iarch/$(ARCH) $(AFLAGS-y)
155KBUILD_CFLAGS += -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y) 160KBUILD_CFLAGS += -msoft-float -pipe -Iarch/$(ARCH) $(CFLAGS-y)
156CPP = $(CC) -E $(KBUILD_CFLAGS) 161CPP = $(CC) -E $(KBUILD_CFLAGS)
157 162
diff --git a/arch/powerpc/boot/util.S b/arch/powerpc/boot/util.S
index 6636b1d7821b..243b8497d58b 100644
--- a/arch/powerpc/boot/util.S
+++ b/arch/powerpc/boot/util.S
@@ -45,7 +45,7 @@ udelay:
45 mfspr r4,SPRN_PVR 45 mfspr r4,SPRN_PVR
46 srwi r4,r4,16 46 srwi r4,r4,16
47 cmpwi 0,r4,1 /* 601 ? */ 47 cmpwi 0,r4,1 /* 601 ? */
48 bne .udelay_not_601 48 bne .Ludelay_not_601
4900: li r0,86 /* Instructions / microsecond? */ 4900: li r0,86 /* Instructions / microsecond? */
50 mtctr r0 50 mtctr r0
5110: addi r0,r0,0 /* NOP */ 5110: addi r0,r0,0 /* NOP */
@@ -54,7 +54,7 @@ udelay:
54 bne 00b 54 bne 00b
55 blr 55 blr
56 56
57.udelay_not_601: 57.Ludelay_not_601:
58 mulli r4,r3,1000 /* nanoseconds */ 58 mulli r4,r3,1000 /* nanoseconds */
59 /* Change r4 to be the number of ticks using: 59 /* Change r4 to be the number of ticks using:
60 * (nanoseconds + (timebase_period_ns - 1 )) / timebase_period_ns 60 * (nanoseconds + (timebase_period_ns - 1 )) / timebase_period_ns
diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h
index 97e02f985df8..37991e154ef8 100644
--- a/arch/powerpc/include/asm/code-patching.h
+++ b/arch/powerpc/include/asm/code-patching.h
@@ -42,15 +42,47 @@ void __patch_exception(int exc, unsigned long addr);
42} while (0) 42} while (0)
43#endif 43#endif
44 44
45#define OP_RT_RA_MASK 0xffff0000UL
46#define LIS_R2 0x3c020000UL
47#define ADDIS_R2_R12 0x3c4c0000UL
48#define ADDI_R2_R2 0x38420000UL
49
45static inline unsigned long ppc_function_entry(void *func) 50static inline unsigned long ppc_function_entry(void *func)
46{ 51{
47#ifdef CONFIG_PPC64 52#if defined(CONFIG_PPC64)
53#if defined(_CALL_ELF) && _CALL_ELF == 2
54 u32 *insn = func;
55
56 /*
57 * A PPC64 ABIv2 function may have a local and a global entry
58 * point. We need to use the local entry point when patching
59 * functions, so identify and step over the global entry point
60 * sequence.
61 *
62 * The global entry point sequence is always of the form:
63 *
64 * addis r2,r12,XXXX
65 * addi r2,r2,XXXX
66 *
67 * A linker optimisation may convert the addis to lis:
68 *
69 * lis r2,XXXX
70 * addi r2,r2,XXXX
71 */
72 if ((((*insn & OP_RT_RA_MASK) == ADDIS_R2_R12) ||
73 ((*insn & OP_RT_RA_MASK) == LIS_R2)) &&
74 ((*(insn+1) & OP_RT_RA_MASK) == ADDI_R2_R2))
75 return (unsigned long)(insn + 2);
76 else
77 return (unsigned long)func;
78#else
48 /* 79 /*
49 * On PPC64 the function pointer actually points to the function's 80 * On PPC64 ABIv1 the function pointer actually points to the
50 * descriptor. The first entry in the descriptor is the address 81 * function's descriptor. The first entry in the descriptor is the