aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/Kconfig5
-rw-r--r--arch/powerpc/Makefile8
-rw-r--r--arch/powerpc/boot/dts/fsl/b4si-post.dtsi4
-rw-r--r--arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi82
-rw-r--r--arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi82
-rw-r--r--arch/powerpc/boot/dts/fsl/t4240si-post.dtsi4
-rw-r--r--arch/powerpc/boot/dts/mpc5121.dtsi1
-rw-r--r--arch/powerpc/boot/dts/mpc5125twr.dts6
-rw-r--r--arch/powerpc/boot/dts/xcalibur1501.dts4
-rw-r--r--arch/powerpc/boot/dts/xpedite5301.dts4
-rw-r--r--arch/powerpc/boot/dts/xpedite5330.dts4
-rw-r--r--arch/powerpc/boot/dts/xpedite5370.dts4
-rw-r--r--arch/powerpc/boot/util.S14
-rw-r--r--arch/powerpc/configs/52xx/cm5200_defconfig3
-rw-r--r--arch/powerpc/configs/52xx/lite5200b_defconfig3
-rw-r--r--arch/powerpc/configs/52xx/motionpro_defconfig3
-rw-r--r--arch/powerpc/configs/52xx/pcm030_defconfig3
-rw-r--r--arch/powerpc/configs/52xx/tqm5200_defconfig3
-rw-r--r--arch/powerpc/configs/mpc5200_defconfig3
-rw-r--r--arch/powerpc/configs/pasemi_defconfig7
-rw-r--r--arch/powerpc/configs/pseries_le_defconfig352
-rw-r--r--arch/powerpc/include/asm/barrier.h21
-rw-r--r--arch/powerpc/include/asm/elf.h4
-rw-r--r--arch/powerpc/include/asm/exception-64s.h2
-rw-r--r--arch/powerpc/include/asm/hvcall.h2
-rw-r--r--arch/powerpc/include/asm/kvm_book3s.h4
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_asm.h2
-rw-r--r--arch/powerpc/include/asm/opal.h4
-rw-r--r--arch/powerpc/include/asm/pgalloc-32.h6
-rw-r--r--arch/powerpc/include/asm/pgalloc-64.h7
-rw-r--r--arch/powerpc/include/asm/plpar_wrappers.h26
-rw-r--r--arch/powerpc/include/asm/ppc_asm.h2
-rw-r--r--arch/powerpc/include/asm/reg.h7
-rw-r--r--arch/powerpc/include/asm/setup.h1
-rw-r--r--arch/powerpc/include/asm/smp.h2
-rw-r--r--arch/powerpc/include/asm/spinlock.h2
-rw-r--r--arch/powerpc/include/asm/switch_to.h2
-rw-r--r--arch/powerpc/include/asm/thread_info.h11
-rw-r--r--arch/powerpc/include/asm/timex.h8
-rw-r--r--arch/powerpc/include/asm/unaligned.h7
-rw-r--r--arch/powerpc/include/asm/uprobes.h5
-rw-r--r--arch/powerpc/kernel/asm-offsets.c1
-rw-r--r--arch/powerpc/kernel/crash_dump.c6
-rw-r--r--arch/powerpc/kernel/eeh.c9
-rw-r--r--arch/powerpc/kernel/eeh_driver.c19
-rw-r--r--arch/powerpc/kernel/eeh_event.c9
-rw-r--r--arch/powerpc/kernel/head_64.S2
-rw-r--r--arch/powerpc/kernel/kprobes.c2
-rw-r--r--arch/powerpc/kernel/machine_kexec.c14
-rw-r--r--arch/powerpc/kernel/misc_64.S5
-rw-r--r--arch/powerpc/kernel/nvram_64.c2
-rw-r--r--arch/powerpc/kernel/pci-common.c4
-rw-r--r--arch/powerpc/kernel/pci_of_scan.c4
-rw-r--r--arch/powerpc/kernel/process.c103
-rw-r--r--arch/powerpc/kernel/prom.c20
-rw-r--r--arch/powerpc/kernel/prom_init.c22
-rw-r--r--arch/powerpc/kernel/ptrace.c4
-rw-r--r--arch/powerpc/kernel/setup-common.c4
-rw-r--r--arch/powerpc/kernel/setup_32.c3
-rw-r--r--arch/powerpc/kernel/setup_64.c3
-rw-r--r--arch/powerpc/kernel/signal_32.c6
-rw-r--r--arch/powerpc/kernel/signal_64.c31
-rw-r--r--arch/powerpc/kernel/smp.c20
-rw-r--r--arch/powerpc/kernel/time.c4
-rw-r--r--arch/powerpc/kernel/uprobes.c2
-rw-r--r--arch/powerpc/kernel/vdso32/gettimeofday.S6
-rw-r--r--arch/powerpc/kernel/vdso64/sigtramp.S16
-rw-r--r--arch/powerpc/kernel/vio.c2
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_hv.c18
-rw-r--r--arch/powerpc/kvm/book3s_hv.c26
-rw-r--r--arch/powerpc/kvm/book3s_hv_rm_mmu.c9
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S23
-rw-r--r--arch/powerpc/kvm/book3s_interrupts.S19
-rw-r--r--arch/powerpc/kvm/book3s_pr.c22
-rw-r--r--arch/powerpc/kvm/book3s_rmhandlers.S6
-rw-r--r--arch/powerpc/kvm/booke.c12
-rw-r--r--arch/powerpc/lib/copyuser_64.S53
-rw-r--r--arch/powerpc/mm/gup.c5
-rw-r--r--arch/powerpc/mm/hugetlbpage-book3e.c3
-rw-r--r--arch/powerpc/mm/mem.c2
-rw-r--r--arch/powerpc/mm/numa.c8
-rw-r--r--arch/powerpc/mm/slice.c2
-rw-r--r--arch/powerpc/mm/tlb_nohash.c2
-rw-r--r--arch/powerpc/net/bpf_jit_comp.c7
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c2
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype25
-rw-r--r--arch/powerpc/platforms/powernv/eeh-ioda.c20
-rw-r--r--arch/powerpc/platforms/powernv/opal-flash.c4
-rw-r--r--arch/powerpc/platforms/powernv/opal-lpc.c12
-rw-r--r--arch/powerpc/platforms/powernv/opal-xscom.c4
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c1
-rw-r--r--arch/powerpc/platforms/powernv/pci.h4
-rw-r--r--arch/powerpc/platforms/powernv/rng.c1
-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/lparcfg.c12
-rw-r--r--arch/powerpc/platforms/pseries/msi.c28
-rw-r--r--arch/powerpc/platforms/pseries/nvram.c48
-rw-r--r--arch/powerpc/platforms/pseries/pci.c8
-rw-r--r--arch/powerpc/platforms/pseries/rng.c1
-rw-r--r--arch/powerpc/platforms/pseries/setup.c44
-rw-r--r--arch/powerpc/platforms/wsp/chroma.c1
-rw-r--r--arch/powerpc/platforms/wsp/h8.c1
-rw-r--r--arch/powerpc/platforms/wsp/ics.c2
-rw-r--r--arch/powerpc/platforms/wsp/opb_pic.c2
-rw-r--r--arch/powerpc/platforms/wsp/psr2.c1
-rw-r--r--arch/powerpc/platforms/wsp/scom_wsp.c1
-rw-r--r--arch/powerpc/platforms/wsp/wsp.c1
-rw-r--r--arch/powerpc/sysdev/ppc4xx_ocm.c2
109 files changed, 1217 insertions, 310 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 799d758f42c4..805420853ac1 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -85,6 +85,7 @@ config GENERIC_HWEIGHT
85config PPC 85config PPC
86 bool 86 bool
87 default y 87 default y
88 select ARCH_MIGHT_HAVE_PC_PARPORT
88 select BINFMT_ELF 89 select BINFMT_ELF
89 select OF 90 select OF
90 select OF_EARLY_FLATTREE 91 select OF_EARLY_FLATTREE
@@ -146,6 +147,10 @@ config EARLY_PRINTK
146 bool 147 bool
147 default y 148 default y
148 149
150config PANIC_TIMEOUT
151 int
152 default 180
153
149config COMPAT 154config COMPAT
150 bool 155 bool
151 default y if PPC64 156 default y if PPC64
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 607acf54a425..0f4344e6fbca 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -75,8 +75,10 @@ LDEMULATION := lppc
75GNUTARGET := powerpcle 75GNUTARGET := powerpcle
76MULTIPLEWORD := -mno-multiple 76MULTIPLEWORD := -mno-multiple
77else 77else
78ifeq ($(call cc-option-yn,-mbig-endian),y)
78override CC += -mbig-endian 79override CC += -mbig-endian
79override AS += -mbig-endian 80override AS += -mbig-endian
81endif
80override LD += -EB 82override LD += -EB
81LDEMULATION := ppc 83LDEMULATION := ppc
82GNUTARGET := powerpc 84GNUTARGET := powerpc
@@ -111,6 +113,7 @@ endif
111endif 113endif
112 114
113CFLAGS-$(CONFIG_PPC64) := -mtraceback=no -mcall-aixdesc 115CFLAGS-$(CONFIG_PPC64) := -mtraceback=no -mcall-aixdesc
116CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1)
114CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,-mminimal-toc) 117CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,-mminimal-toc)
115CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions) 118CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions)
116CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 $(MULTIPLEWORD) 119CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 $(MULTIPLEWORD)
@@ -127,7 +130,12 @@ CFLAGS-$(CONFIG_POWER5_CPU) += $(call cc-option,-mcpu=power5)
127CFLAGS-$(CONFIG_POWER6_CPU) += $(call cc-option,-mcpu=power6) 130CFLAGS-$(CONFIG_POWER6_CPU) += $(call cc-option,-mcpu=power6)
128CFLAGS-$(CONFIG_POWER7_CPU) += $(call cc-option,-mcpu=power7) 131CFLAGS-$(CONFIG_POWER7_CPU) += $(call cc-option,-mcpu=power7)
129 132
133# Altivec option not allowed with e500mc64 in GCC.
134ifeq ($(CONFIG_ALTIVEC),y)
135E5500_CPU := -mcpu=powerpc64
136else
130E5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64) 137E5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
138endif
131CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU) 139CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
132CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU)) 140CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
133 141
diff --git a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi
index 4c617bf8cdb2..4f6e48277c46 100644
--- a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi
@@ -223,13 +223,13 @@
223 reg = <0xe2000 0x1000>; 223 reg = <0xe2000 0x1000>;
224 }; 224 };
225 225
226/include/ "qoriq-dma-0.dtsi" 226/include/ "elo3-dma-0.dtsi"
227 dma@100300 { 227 dma@100300 {
228 fsl,iommu-parent = <&pamu0>; 228 fsl,iommu-parent = <&pamu0>;
229 fsl,liodn-reg = <&guts 0x580>; /* DMA1LIODNR */ 229 fsl,liodn-reg = <&guts 0x580>; /* DMA1LIODNR */
230 }; 230 };
231 231
232/include/ "qoriq-dma-1.dtsi" 232/include/ "elo3-dma-1.dtsi"
233 dma@101300 { 233 dma@101300 {
234 fsl,iommu-parent = <&pamu0>; 234 fsl,iommu-parent = <&pamu0>;
235 fsl,liodn-reg = <&guts 0x584>; /* DMA2LIODNR */ 235 fsl,liodn-reg = <&guts 0x584>; /* DMA2LIODNR */
diff --git a/arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi b/arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi
new file mode 100644
index 000000000000..3c210e0d5201
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi
@@ -0,0 +1,82 @@
1/*
2 * QorIQ Elo3 DMA device tree stub [ controller @ offset 0x100000 ]
3 *
4 * Copyright 2013 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35dma0: dma@100300 {
36 #address-cells = <1>;
37 #size-cells = <1>;
38 compatible = "fsl,elo3-dma";
39 reg = <0x100300 0x4>,
40 <0x100600 0x4>;
41 ranges = <0x0 0x100100 0x500>;
42 dma-channel@0 {
43 compatible = "fsl,eloplus-dma-channel";
44 reg = <0x0 0x80>;
45 interrupts = <28 2 0 0>;
46 };
47 dma-channel@80 {
48 compatible = "fsl,eloplus-dma-channel";
49 reg = <0x80 0x80>;
50 interrupts = <29 2 0 0>;
51 };
52 dma-channel@100 {
53 compatible = "fsl,eloplus-dma-channel";
54 reg = <0x100 0x80>;
55 interrupts = <30 2 0 0>;
56 };
57 dma-channel@180 {
58 compatible = "fsl,eloplus-dma-channel";
59 reg = <0x180 0x80>;
60 interrupts = <31 2 0 0>;
61 };
62 dma-channel@300 {
63 compatible = "fsl,eloplus-dma-channel";
64 reg = <0x300 0x80>;
65 interrupts = <76 2 0 0>;
66 };
67 dma-channel@380 {
68 compatible = "fsl,eloplus-dma-channel";
69 reg = <0x380 0x80>;
70 interrupts = <77 2 0 0>;
71 };
72 dma-channel@400 {
73 compatible = "fsl,eloplus-dma-channel";
74 reg = <0x400 0x80>;
75 interrupts = <78 2 0 0>;
76 };
77 dma-channel@480 {
78 compatible = "fsl,eloplus-dma-channel";
79 reg = <0x480 0x80>;
80 interrupts = <79 2 0 0>;
81 };
82};
diff --git a/arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi b/arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi
new file mode 100644
index 000000000000..cccf3bb38224
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi
@@ -0,0 +1,82 @@
1/*
2 * QorIQ Elo3 DMA device tree stub [ controller @ offset 0x101000 ]
3 *
4 * Copyright 2013 Freescale Semiconductor Inc.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Freescale Semiconductor nor the
14 * names of its contributors may be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 *
18 * ALTERNATIVELY, this software may be distributed under the terms of the
19 * GNU General Public License ("GPL") as published by the Free Software
20 * Foundation, either version 2 of that License or (at your option) any
21 * later version.
22 *
23 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
24 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35dma1: dma@101300 {
36 #address-cells = <1>;
37 #size-cells = <1>;
38 compatible = "fsl,elo3-dma";
39 reg = <0x101300 0x4>,
40 <0x101600 0x4>;
41 ranges = <0x0 0x101100 0x500>;
42 dma-channel@0 {
43 compatible = "fsl,eloplus-dma-channel";
44 reg = <0x0 0x80>;
45 interrupts = <32 2 0 0>;
46 };
47 dma-channel@80 {
48 compatible = "fsl,eloplus-dma-channel";
49 reg = <0x80 0x80>;
50 interrupts = <33 2 0 0>;
51 };
52 dma-channel@100 {
53 compatible = "fsl,eloplus-dma-channel";
54 reg = <0x100 0x80>;
55 interrupts = <34 2 0 0>;
56 };
57 dma-channel@180 {
58 compatible = "fsl,eloplus-dma-channel";
59 reg = <0x180 0x80>;
60 interrupts = <35 2 0 0>;
61 };
62 dma-channel@300 {
63 compatible = "fsl,eloplus-dma-channel";
64 reg = <0x300 0x80>;
65 interrupts = <80 2 0 0>;
66 };
67 dma-channel@380 {
68 compatible = "fsl,eloplus-dma-channel";
69 reg = <0x380 0x80>;
70 interrupts = <81 2 0 0>;
71 };
72 dma-channel@400 {
73 compatible = "fsl,eloplus-dma-channel";
74 reg = <0x400 0x80>;
75 interrupts = <82 2 0 0>;
76 };
77 dma-channel@480 {
78 compatible = "fsl,eloplus-dma-channel";
79 reg = <0x480 0x80>;
80 interrupts = <83 2 0 0>;
81 };
82};
diff --git a/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi b/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi
index 510afa362de1..4143a9733cd0 100644
--- a/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/t4240si-post.dtsi
@@ -387,8 +387,8 @@
387 reg = <0xea000 0x4000>; 387 reg = <0xea000 0x4000>;
388 }; 388 };
389 389
390/include/ "qoriq-dma-0.dtsi" 390/include/ "elo3-dma-0.dtsi"
391/include/ "qoriq-dma-1.dtsi" 391/include/ "elo3-dma-1.dtsi"
392 392
393/include/ "qoriq-espi-0.dtsi" 393/include/ "qoriq-espi-0.dtsi"
394 spi@110000 { 394 spi@110000 {
diff --git a/arch/powerpc/boot/dts/mpc5121.dtsi b/arch/powerpc/boot/dts/mpc5121.dtsi
index bd14c00e5146..2d7cb04ac962 100644
--- a/arch/powerpc/boot/dts/mpc5121.dtsi
+++ b/arch/powerpc/boot/dts/mpc5121.dtsi
@@ -77,7 +77,6 @@
77 compatible = "fsl,mpc5121-immr"; 77 compatible = "fsl,mpc5121-immr";
78 #address-cells = <1>; 78 #address-cells = <1>;
79 #size-cells = <1>; 79 #size-cells = <1>;
80 #interrupt-cells = <2>;
81 ranges = <0x0 0x80000000 0x400000>; 80 ranges = <0x0 0x80000000 0x400000>;
82 reg = <0x80000000 0x400000>; 81 reg = <0x80000000 0x400000>;
83 bus-frequency = <66000000>; /* 66 MHz ips bus */ 82 bus-frequency = <66000000>; /* 66 MHz ips bus */
diff --git a/arch/powerpc/boot/dts/mpc5125twr.dts b/arch/powerpc/boot/dts/mpc5125twr.dts
index 4177b62240c2..a618dfc13e4c 100644
--- a/arch/powerpc/boot/dts/mpc5125twr.dts
+++ b/arch/powerpc/boot/dts/mpc5125twr.dts
@@ -58,7 +58,6 @@
58 compatible = "fsl,mpc5121-immr"; 58 compatible = "fsl,mpc5121-immr";
59 #address-cells = <1>; 59 #address-cells = <1>;
60 #size-cells = <1>; 60 #size-cells = <1>;
61 #interrupt-cells = <2>;
62 ranges = <0x0 0x80000000 0x400000>; 61 ranges = <0x0 0x80000000 0x400000>;
63 reg = <0x80000000 0x400000>; 62 reg = <0x80000000 0x400000>;
64 bus-frequency = <66000000>; // 66 MHz ips bus 63 bus-frequency = <66000000>; // 66 MHz ips bus
@@ -189,6 +188,10 @@
189 reg = <0xA000 0x1000>; 188 reg = <0xA000 0x1000>;
190 }; 189 };
191 190
191 // disable USB1 port
192 // TODO:
193 // correct pinmux config and fix USB3320 ulpi dependency
194 // before re-enabling it
192 usb@3000 { 195 usb@3000 {
193 compatible = "fsl,mpc5121-usb2-dr"; 196 compatible = "fsl,mpc5121-usb2-dr";
194 reg = <0x3000 0x400>; 197 reg = <0x3000 0x400>;
@@ -197,6 +200,7 @@
197 interrupts = <43 0x8>; 200 interrupts = <43 0x8>;
198 dr_mode = "host"; 201 dr_mode = "host";
199 phy_type = "ulpi"; 202 phy_type = "ulpi";
203 status = "disabled";
200 }; 204 };
201 205
202 // 5125 PSCs are not 52xx or 5121 PSC compatible 206 // 5125 PSCs are not 52xx or 5121 PSC compatible
diff --git a/arch/powerpc/boot/dts/xcalibur1501.dts b/arch/powerpc/boot/dts/xcalibur1501.dts
index cc00f4ddd9a7..c409cbafb126 100644
--- a/arch/powerpc/boot/dts/xcalibur1501.dts
+++ b/arch/powerpc/boot/dts/xcalibur1501.dts
@@ -637,14 +637,14 @@
637 tlu@2f000 { 637 tlu@2f000 {
638 compatible = "fsl,mpc8572-tlu", "fsl_tlu"; 638 compatible = "fsl,mpc8572-tlu", "fsl_tlu";
639 reg = <0x2f000 0x1000>; 639 reg = <0x2f000 0x1000>;
640 interupts = <61 2 >; 640 interrupts = <61 2>;
641 interrupt-parent = <&mpic>; 641 interrupt-parent = <&mpic>;
642 }; 642 };
643 643
644 tlu@15000 { 644 tlu@15000 {
645 compatible = "fsl,mpc8572-tlu", "fsl_tlu"; 645 compatible = "fsl,mpc8572-tlu", "fsl_tlu";
646 reg = <0x15000 0x1000>; 646 reg = <0x15000 0x1000>;
647 interupts = <75 2>; 647 interrupts = <75 2>;
648 interrupt-parent = <&mpic>; 648 interrupt-parent = <&mpic>;
649 }; 649 };
650 }; 650 };
diff --git a/arch/powerpc/boot/dts/xpedite5301.dts b/arch/powerpc/boot/dts/xpedite5301.dts
index 53c1c6a9752f..04cb410da48b 100644
--- a/arch/powerpc/boot/dts/xpedite5301.dts
+++ b/arch/powerpc/boot/dts/xpedite5301.dts
@@ -547,14 +547,14 @@
547 tlu@2f000 { 547 tlu@2f000 {
548 compatible = "fsl,mpc8572-tlu", "fsl_tlu"; 548 compatible = "fsl,mpc8572-tlu", "fsl_tlu";
549 reg = <0x2f000 0x1000>; 549 reg = <0x2f000 0x1000>;
550 interupts = <61 2 >; 550 interrupts = <61 2>;
551 interrupt-parent = <&mpic>; 551 interrupt-parent = <&mpic>;
552 }; 552 };
553 553
554 tlu@15000 { 554 tlu@15000 {
555 compatible = "fsl,mpc8572-tlu", "fsl_tlu"; 555 compatible = "fsl,mpc8572-tlu", "fsl_tlu";
556 reg = <0x15000 0x1000>; 556 reg = <0x15000 0x1000>;
557 interupts = <75 2>; 557 interrupts = <75 2>;
558 interrupt-parent = <&mpic>; 558 interrupt-parent = <&mpic>;
559 }; 559 };
560 }; 560 };
diff --git a/arch/powerpc/boot/dts/xpedite5330.dts b/arch/powerpc/boot/dts/xpedite5330.dts
index 215225983150..73f8620f1ce7 100644
--- a/arch/powerpc/boot/dts/xpedite5330.dts
+++ b/arch/powerpc/boot/dts/xpedite5330.dts
@@ -583,14 +583,14 @@
583 tlu@2f000 { 583 tlu@2f000 {
584 compatible = "fsl,mpc8572-tlu", "fsl_tlu"; 584 compatible = "fsl,mpc8572-tlu", "fsl_tlu";
585 reg = <0x2f000 0x1000>; 585 reg = <0x2f000 0x1000>;
586 interupts = <61 2 >; 586 interrupts = <61 2>;
587 interrupt-parent = <&mpic>; 587 interrupt-parent = <&mpic>;
588 }; 588 };
589 589
590 tlu@15000 { 590 tlu@15000 {
591 compatible = "fsl,mpc8572-tlu", "fsl_tlu"; 591 compatible = "fsl,mpc8572-tlu", "fsl_tlu";
592 reg = <0x15000 0x1000>; 592 reg = <0x15000 0x1000>;
593 interupts = <75 2>; 593 interrupts = <75 2>;
594 interrupt-parent = <&mpic>; 594 interrupt-parent = <&mpic>;
595 }; 595 };
596 }; 596 };
diff --git a/arch/powerpc/boot/dts/xpedite5370.dts b/arch/powerpc/boot/dts/xpedite5370.dts
index 11dbda10d756..cd0ea2b99362 100644
--- a/arch/powerpc/boot/dts/xpedite5370.dts
+++ b/arch/powerpc/boot/dts/xpedite5370.dts
@@ -545,14 +545,14 @@
545 tlu@2f000 { 545 tlu@2f000 {
546 compatible = "fsl,mpc8572-tlu", "fsl_tlu"; 546 compatible = "fsl,mpc8572-tlu", "fsl_tlu";
547 reg = <0x2f000 0x1000>; 547 reg = <0x2f000 0x1000>;
548 interupts = <61 2 >; 548 interrupts = <61 2>;
549 interrupt-parent = <&mpic>; 549 interrupt-parent = <&mpic>;
550 }; 550 };
551 551
552 tlu@15000 { 552 tlu@15000 {
553 compatible = "fsl,mpc8572-tlu", "fsl_tlu"; 553 compatible = "fsl,mpc8572-tlu", "fsl_tlu";
554 reg = <0x15000 0x1000>; 554 reg = <0x15000 0x1000>;
555 interupts = <75 2>; 555 interrupts = <75 2>;
556 interrupt-parent = <&mpic>; 556 interrupt-parent = <&mpic>;
557 }; 557 };
558 }; 558 };
diff --git a/arch/powerpc/boot/util.S b/arch/powerpc/boot/util.S
index 5143228e3e5f..6636b1d7821b 100644
--- a/arch/powerpc/boot/util.S
+++ b/arch/powerpc/boot/util.S
@@ -71,18 +71,32 @@ udelay:
71 add r4,r4,r5 71 add r4,r4,r5
72 addi r4,r4,-1 72 addi r4,r4,-1
73 divw r4,r4,r5 /* BUS ticks */ 73 divw r4,r4,r5 /* BUS ticks */
74#ifdef CONFIG_8xx
751: mftbu r5
76 mftb r6
77 mftbu r7
78#else
741: mfspr r5, SPRN_TBRU 791: mfspr r5, SPRN_TBRU
75 mfspr r6, SPRN_TBRL 80 mfspr r6, SPRN_TBRL
76 mfspr r7, SPRN_TBRU 81 mfspr r7, SPRN_TBRU
82#endif
77 cmpw 0,r5,r7 83 cmpw 0,r5,r7
78 bne 1b /* Get [synced] base time */ 84 bne 1b /* Get [synced] base time */
79 addc r9,r6,r4 /* Compute end time */ 85 addc r9,r6,r4 /* Compute end time */
80 addze r8,r5 86 addze r8,r5
87#ifdef CONFIG_8xx
882: mftbu r5
89#else
812: mfspr r5, SPRN_TBRU 902: mfspr r5, SPRN_TBRU
91#endif
82 cmpw 0,r5,r8 92 cmpw 0,r5,r8
83 blt 2b 93 blt 2b
84 bgt 3f 94 bgt 3f
95#ifdef CONFIG_8xx
96 mftb r6
97#else
85 mfspr r6, SPRN_TBRL 98 mfspr r6, SPRN_TBRL
99#endif
86 cmpw 0,r6,r9 100 cmpw 0,r6,r9
87 blt 2b 101 blt 2b
883: blr 1023: blr
diff --git a/arch/powerpc/configs/52xx/cm5200_defconfig b/arch/powerpc/configs/52xx/cm5200_defconfig
index 69b57daf402e..0b88c7b30bb9 100644
--- a/arch/powerpc/configs/52xx/cm5200_defconfig
+++ b/arch/powerpc/configs/52xx/cm5200_defconfig
@@ -12,7 +12,6 @@ CONFIG_EXPERT=y
12CONFIG_PPC_MPC52xx=y 12CONFIG_PPC_MPC52xx=y
13CONFIG_PPC_MPC5200_SIMPLE=y 13CONFIG_PPC_MPC5200_SIMPLE=y
14# CONFIG_PPC_PMAC is not set 14# CONFIG_PPC_PMAC is not set
15CONFIG_PPC_BESTCOMM=y
16CONFIG_SPARSE_IRQ=y 15CONFIG_SPARSE_IRQ=y
17CONFIG_PM=y 16CONFIG_PM=y
18# CONFIG_PCI is not set 17# CONFIG_PCI is not set
@@ -71,6 +70,8 @@ CONFIG_USB_DEVICEFS=y
71CONFIG_USB_OHCI_HCD=y 70CONFIG_USB_OHCI_HCD=y
72CONFIG_USB_OHCI_HCD_PPC_OF_BE=y 71CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
73CONFIG_USB_STORAGE=y 72CONFIG_USB_STORAGE=y
73CONFIG_DMADEVICES=y
74CONFIG_PPC_BESTCOMM=y
74CONFIG_EXT2_FS=y 75CONFIG_EXT2_FS=y
75CONFIG_EXT3_FS=y 76CONFIG_EXT3_FS=y
76# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 77# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
diff --git a/arch/powerpc/configs/52xx/lite5200b_defconfig b/arch/powerpc/configs/52xx/lite5200b_defconfig
index f3638ae0a627..104a332e79ab 100644
--- a/arch/powerpc/configs/52xx/lite5200b_defconfig
+++ b/arch/powerpc/configs/52xx/lite5200b_defconfig
@@ -15,7 +15,6 @@ CONFIG_PPC_MPC52xx=y
15CONFIG_PPC_MPC5200_SIMPLE=y 15CONFIG_PPC_MPC5200_SIMPLE=y
16CONFIG_PPC_LITE5200=y 16CONFIG_PPC_LITE5200=y
17# CONFIG_PPC_PMAC is not set 17# CONFIG_PPC_PMAC is not set
18CONFIG_PPC_BESTCOMM=y
19CONFIG_NO_HZ=y 18CONFIG_NO_HZ=y
20CONFIG_HIGH_RES_TIMERS=y 19CONFIG_HIGH_RES_TIMERS=y
21CONFIG_SPARSE_IRQ=y 20CONFIG_SPARSE_IRQ=y
@@ -59,6 +58,8 @@ CONFIG_I2C_CHARDEV=y
59CONFIG_I2C_MPC=y 58CONFIG_I2C_MPC=y
60# CONFIG_HWMON is not set 59# CONFIG_HWMON is not set
61CONFIG_VIDEO_OUTPUT_CONTROL=m 60CONFIG_VIDEO_OUTPUT_CONTROL=m
61CONFIG_DMADEVICES=y
62CONFIG_PPC_BESTCOMM=y
62CONFIG_EXT2_FS=y 63CONFIG_EXT2_FS=y
63CONFIG_EXT3_FS=y 64CONFIG_EXT3_FS=y
64# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 65# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
diff --git a/arch/powerpc/configs/52xx/motionpro_defconfig b/arch/powerpc/configs/52xx/motionpro_defconfig
index 0c7de9620ea6..0d13ad7e4478 100644
--- a/arch/powerpc/configs/52xx/motionpro_defconfig
+++ b/arch/powerpc/configs/52xx/motionpro_defconfig
@@ -12,7 +12,6 @@ CONFIG_EXPERT=y
12CONFIG_PPC_MPC52xx=y 12CONFIG_PPC_MPC52xx=y
13CONFIG_PPC_MPC5200_SIMPLE=y 13CONFIG_PPC_MPC5200_SIMPLE=y
14# CONFIG_PPC_PMAC is not set 14# CONFIG_PPC_PMAC is not set
15CONFIG_PPC_BESTCOMM=y
16CONFIG_SPARSE_IRQ=y 15CONFIG_SPARSE_IRQ=y
17CONFIG_PM=y 16CONFIG_PM=y
18# CONFIG_PCI is not set 17# CONFIG_PCI is not set
@@ -84,6 +83,8 @@ CONFIG_LEDS_TRIGGERS=y
84CONFIG_LEDS_TRIGGER_TIMER=y 83CONFIG_LEDS_TRIGGER_TIMER=y
85CONFIG_RTC_CLASS=y 84CONFIG_RTC_CLASS=y
86CONFIG_RTC_DRV_DS1307=y 85CONFIG_RTC_DRV_DS1307=y
86CONFIG_DMADEVICES=y
87CONFIG_PPC_BESTCOMM=y
87CONFIG_EXT2_FS=y 88CONFIG_EXT2_FS=y
88CONFIG_EXT3_FS=y 89CONFIG_EXT3_FS=y
89# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 90# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
diff --git a/arch/powerpc/configs/52xx/pcm030_defconfig b/arch/powerpc/configs/52xx/pcm030_defconfig
index 22e719575c60..430aa182fa1c 100644
--- a/arch/powerpc/configs/52xx/pcm030_defconfig
+++ b/arch/powerpc/configs/52xx/pcm030_defconfig
@@ -21,7 +21,6 @@ CONFIG_MODULE_UNLOAD=y
21CONFIG_PPC_MPC52xx=y 21CONFIG_PPC_MPC52xx=y
22CONFIG_PPC_MPC5200_SIMPLE=y 22CONFIG_PPC_MPC5200_SIMPLE=y
23# CONFIG_PPC_PMAC is not set 23# CONFIG_PPC_PMAC is not set
24CONFIG_PPC_BESTCOMM=y
25CONFIG_NO_HZ=y 24CONFIG_NO_HZ=y
26CONFIG_HIGH_RES_TIMERS=y 25CONFIG_HIGH_RES_TIMERS=y
27CONFIG_HZ_100=y 26CONFIG_HZ_100=y
@@ -87,6 +86,8 @@ CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
87CONFIG_USB_STORAGE=m 86CONFIG_USB_STORAGE=m
88CONFIG_RTC_CLASS=y 87CONFIG_RTC_CLASS=y
89CONFIG_RTC_DRV_PCF8563=m 88CONFIG_RTC_DRV_PCF8563=m
89CONFIG_DMADEVICES=y
90CONFIG_PPC_BESTCOMM=y
90CONFIG_EXT2_FS=m 91CONFIG_EXT2_FS=m
91CONFIG_EXT3_FS=m 92CONFIG_EXT3_FS=m
92# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 93# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
diff --git a/arch/powerpc/configs/52xx/tqm5200_defconfig b/arch/powerpc/configs/52xx/tqm5200_defconfig
index 716a37be16e3..7af4c5bb7c63 100644
--- a/arch/powerpc/configs/52xx/tqm5200_defconfig
+++ b/arch/powerpc/configs/52xx/tqm5200_defconfig
@@ -17,7 +17,6 @@ CONFIG_PPC_MPC52xx=y
17CONFIG_PPC_MPC5200_SIMPLE=y 17CONFIG_PPC_MPC5200_SIMPLE=y
18CONFIG_PPC_MPC5200_BUGFIX=y 18CONFIG_PPC_MPC5200_BUGFIX=y
19# CONFIG_PPC_PMAC is not set 19# CONFIG_PPC_PMAC is not set
20CONFIG_PPC_BESTCOMM=y
21CONFIG_PM=y 20CONFIG_PM=y
22# CONFIG_PCI is not set 21# CONFIG_PCI is not set
23CONFIG_NET=y 22CONFIG_NET=y
@@ -86,6 +85,8 @@ CONFIG_USB_STORAGE=y
86CONFIG_RTC_CLASS=y 85CONFIG_RTC_CLASS=y
87CONFIG_RTC_DRV_DS1307=y 86CONFIG_RTC_DRV_DS1307=y
88CONFIG_RTC_DRV_DS1374=y 87CONFIG_RTC_DRV_DS1374=y
88CONFIG_DMADEVICES=y
89CONFIG_PPC_BESTCOMM=y
89CONFIG_EXT2_FS=y 90CONFIG_EXT2_FS=y
90CONFIG_EXT3_FS=y 91CONFIG_EXT3_FS=y
91# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 92# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
diff --git a/arch/powerpc/configs/mpc5200_defconfig b/arch/powerpc/configs/mpc5200_defconfig
index 6640a35bebb7..8b682d1cf4d6 100644
--- a/arch/powerpc/configs/mpc5200_defconfig
+++ b/arch/powerpc/configs/mpc5200_defconfig
@@ -15,7 +15,6 @@ CONFIG_PPC_MEDIA5200=y
15CONFIG_PPC_MPC5200_BUGFIX=y 15CONFIG_PPC_MPC5200_BUGFIX=y
16CONFIG_PPC_MPC5200_LPBFIFO=m 16CONFIG_PPC_MPC5200_LPBFIFO=m
17# CONFIG_PPC_PMAC is not set 17# CONFIG_PPC_PMAC is not set
18CONFIG_PPC_BESTCOMM=y
19CONFIG_SIMPLE_GPIO=y 18CONFIG_SIMPLE_GPIO=y
20CONFIG_NO_HZ=y 19CONFIG_NO_HZ=y
21CONFIG_HIGH_RES_TIMERS=y 20CONFIG_HIGH_RES_TIMERS=y
@@ -125,6 +124,8 @@ CONFIG_RTC_CLASS=y
125CONFIG_RTC_DRV_DS1307=y 124CONFIG_RTC_DRV_DS1307=y
126CONFIG_RTC_DRV_DS1374=y 125CONFIG_RTC_DRV_DS1374=y
127CONFIG_RTC_DRV_PCF8563=m 126CONFIG_RTC_DRV_PCF8563=m
127CONFIG_DMADEVICES=y
128CONFIG_PPC_BESTCOMM=y
128CONFIG_EXT2_FS=y 129CONFIG_EXT2_FS=y
129CONFIG_EXT3_FS=y 130CONFIG_EXT3_FS=y
130# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 131# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
diff --git a/arch/powerpc/configs/pasemi_defconfig b/arch/powerpc/configs/pasemi_defconfig
index bd8a6f71944f..cec044a3ff69 100644
--- a/arch/powerpc/configs/pasemi_defconfig
+++ b/arch/powerpc/configs/pasemi_defconfig
@@ -2,7 +2,6 @@ CONFIG_PPC64=y
2CONFIG_ALTIVEC=y 2CONFIG_ALTIVEC=y
3CONFIG_SMP=y 3CONFIG_SMP=y
4CONFIG_NR_CPUS=2 4CONFIG_NR_CPUS=2
5CONFIG_EXPERIMENTAL=y
6CONFIG_SYSVIPC=y 5CONFIG_SYSVIPC=y
7CONFIG_NO_HZ=y 6CONFIG_NO_HZ=y
8CONFIG_HIGH_RES_TIMERS=y 7CONFIG_HIGH_RES_TIMERS=y
@@ -45,8 +44,9 @@ CONFIG_INET_AH=y
45CONFIG_INET_ESP=y 44CONFIG_INET_ESP=y
46# CONFIG_IPV6 is not set 45# CONFIG_IPV6 is not set
47CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 46CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
47CONFIG_DEVTMPFS=y
48CONFIG_DEVTMPFS_MOUNT=y
48CONFIG_MTD=y 49CONFIG_MTD=y
49CONFIG_MTD_CHAR=y
50CONFIG_MTD_BLOCK=y 50CONFIG_MTD_BLOCK=y
51CONFIG_MTD_SLRAM=y 51CONFIG_MTD_SLRAM=y
52CONFIG_MTD_PHRAM=y 52CONFIG_MTD_PHRAM=y
@@ -88,7 +88,6 @@ CONFIG_BLK_DEV_DM=y
88CONFIG_DM_CRYPT=y 88CONFIG_DM_CRYPT=y
89CONFIG_NETDEVICES=y 89CONFIG_NETDEVICES=y
90CONFIG_DUMMY=y 90CONFIG_DUMMY=y
91CONFIG_MII=y
92CONFIG_TIGON3=y 91CONFIG_TIGON3=y
93CONFIG_E1000=y 92CONFIG_E1000=y
94CONFIG_PASEMI_MAC=y 93CONFIG_PASEMI_MAC=y
@@ -174,8 +173,8 @@ CONFIG_NLS_CODEPAGE_437=y
174CONFIG_NLS_ISO8859_1=y 173CONFIG_NLS_ISO8859_1=y
175CONFIG_CRC_CCITT=y 174CONFIG_CRC_CCITT=y
176CONFIG_PRINTK_TIME=y 175CONFIG_PRINTK_TIME=y
177CONFIG_MAGIC_SYSRQ=y
178CONFIG_DEBUG_FS=y 176CONFIG_DEBUG_FS=y
177CONFIG_MAGIC_SYSRQ=y
179CONFIG_DEBUG_KERNEL=y 178CONFIG_DEBUG_KERNEL=y
180CONFIG_DETECT_HUNG_TASK=y 179CONFIG_DETECT_HUNG_TASK=y
181# CONFIG_SCHED_DEBUG is not set 180# CONFIG_SCHED_DEBUG is not set
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/barrier.h b/arch/powerpc/include/asm/barrier.h
index ae782254e731..f89da808ce31 100644
--- a/arch/powerpc/include/asm/barrier.h
+++ b/arch/powerpc/include/asm/barrier.h
@@ -45,11 +45,15 @@
45# define SMPWMB eieio 45# define SMPWMB eieio
46#endif 46#endif
47 47
48#define __lwsync() __asm__ __volatile__ (stringify_in_c(LWSYNC) : : :"memory")
49
48#define smp_mb() mb() 50#define smp_mb() mb()
49#define smp_rmb() __asm__ __volatile__ (stringify_in_c(LWSYNC) : : :"memory") 51#define smp_rmb() __lwsync()
50#define smp_wmb() __asm__ __volatile__ (stringify_in_c(SMPWMB) : : :"memory") 52#define smp_wmb() __asm__ __volatile__ (stringify_in_c(SMPWMB) : : :"memory")
51#define smp_read_barrier_depends() read_barrier_depends() 53#define smp_read_barrier_depends() read_barrier_depends()
52#else 54#else
55#define __lwsync() barrier()
56
53#define smp_mb() barrier() 57#define smp_mb() barrier()
54#define smp_rmb() barrier() 58#define smp_rmb() barrier()
55#define smp_wmb() barrier() 59#define smp_wmb() barrier()
@@ -65,4 +69,19 @@
65#define data_barrier(x) \ 69#define data_barrier(x) \
66 asm volatile("twi 0,%0,0; isync" : : "r" (x) : "memory"); 70 asm volatile("twi 0,%0,0; isync" : : "r" (x) : "memory");
67 71
72#define smp_store_release(p, v) \
73do { \
74 compiletime_assert_atomic_type(*p); \
75 __lwsync(); \
76 ACCESS_ONCE(*p) = (v); \
77} while (0)
78
79#define smp_load_acquire(p) \
80({ \
81 typeof(*p) ___p1 = ACCESS_ONCE(*p); \
82 compiletime_assert_atomic_type(*p); \
83 __lwsync(); \
84 ___p1; \
85})
86
68#endif /* _ASM_POWERPC_BARRIER_H */ 87#endif /* _ASM_POWERPC_BARRIER_H */
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/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 894662a5d4d5..243ce69ad685 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -284,7 +284,7 @@ do_kvm_##n: \
284 subi r1,r1,INT_FRAME_SIZE; /* alloc frame on kernel stack */ \ 284 subi r1,r1,INT_FRAME_SIZE; /* alloc frame on kernel stack */ \
285 beq- 1f; \ 285 beq- 1f; \
286 ld r1,PACAKSAVE(r13); /* kernel stack to use */ \ 286 ld r1,PACAKSAVE(r13); /* kernel stack to use */ \
2871: cmpdi cr1,r1,0; /* check if r1 is in userspace */ \ 2871: cmpdi cr1,r1,-INT_FRAME_SIZE; /* check if r1 is in userspace */ \
288 blt+ cr1,3f; /* abort if it is */ \ 288 blt+ cr1,3f; /* abort if it is */ \
289 li r1,(n); /* will be reloaded later */ \ 289 li r1,(n); /* will be reloaded later */ \
290 sth r1,PACA_TRAP_SAVE(r13); \ 290 sth r1,PACA_TRAP_SAVE(r13); \
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/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
index 1e9c26f45d18..83851aabfdc8 100644
--- a/arch/powerpc/include/asm/kvm_book3s.h
+++ b/arch/powerpc/include/asm/kvm_book3s.h
@@ -189,6 +189,10 @@ extern void kvmppc_hv_entry_trampoline(void);
189extern u32 kvmppc_alignment_dsisr(struct kvm_vcpu *vcpu, unsigned int inst); 189extern u32 kvmppc_alignment_dsisr(struct kvm_vcpu *vcpu, unsigned int inst);
190extern ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst); 190extern ulong kvmppc_alignment_dar(struct kvm_vcpu *vcpu, unsigned int inst);
191extern int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd); 191extern int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd);
192extern void kvmppc_copy_to_svcpu(struct kvmppc_book3s_shadow_vcpu *svcpu,
193 struct kvm_vcpu *vcpu);
194extern void kvmppc_copy_from_svcpu(struct kvm_vcpu *vcpu,
195 struct kvmppc_book3s_shadow_vcpu *svcpu);
192 196
193static inline struct kvmppc_vcpu_book3s *to_book3s(struct kvm_vcpu *vcpu) 197static inline struct kvmppc_vcpu_book3s *to_book3s(struct kvm_vcpu *vcpu)
194{ 198{
diff --git a/arch/powerpc/include/asm/kvm_book3s_asm.h b/arch/powerpc/include/asm/kvm_book3s_asm.h
index 490b34f5d6bf..f3a91dc02c98 100644
--- a/arch/powerpc/include/asm/kvm_book3s_asm.h
+++ b/arch/powerpc/include/asm/kvm_book3s_asm.h
@@ -79,6 +79,7 @@ struct kvmppc_host_state {
79 ulong vmhandler; 79 ulong vmhandler;
80 ulong scratch0; 80 ulong scratch0;
81 ulong scratch1; 81 ulong scratch1;
82 ulong scratch2;
82 u8 in_guest; 83 u8 in_guest;
83 u8 restore_hid5; 84 u8 restore_hid5;
84 u8 napping; 85 u8 napping;
@@ -107,6 +108,7 @@ struct kvmppc_host_state {
107}; 108};
108 109
109struct kvmppc_book3s_shadow_vcpu { 110struct kvmppc_book3s_shadow_vcpu {
111 bool in_use;
110 ulong gpr[14]; 112 ulong gpr[14];
111 u32 cr; 113 u32 cr;
112 u32 xer; 114 u32 xer;
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 033c06be1d84..7bdcf340016c 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -720,13 +720,13 @@ int64_t opal_pci_next_error(uint64_t phb_id, uint64_t *first_frozen_pe,
720int64_t opal_pci_poll(uint64_t phb_id); 720int64_t opal_pci_poll(uint64_t phb_id);
721int64_t opal_return_cpu(void); 721int64_t opal_return_cpu(void);
722 722
723int64_t opal_xscom_read(uint32_t gcid, uint32_t pcb_addr, uint64_t *val); 723int64_t opal_xscom_read(uint32_t gcid, uint32_t pcb_addr, __be64 *val);
724int64_t opal_xscom_write(uint32_t gcid, uint32_t pcb_addr, uint64_t val); 724int64_t opal_xscom_write(uint32_t gcid, uint32_t pcb_addr, uint64_t val);
725 725
726int64_t opal_lpc_write(uint32_t chip_id, enum OpalLPCAddressType addr_type, 726int64_t opal_lpc_write(uint32_t chip_id, enum OpalLPCAddressType addr_type,
727 uint32_t addr, uint32_t data, uint32_t sz); 727 uint32_t addr, uint32_t data, uint32_t sz);
728int64_t opal_lpc_read(uint32_t chip_id, enum OpalLPCAddressType addr_type, 728int64_t opal_lpc_read(uint32_t chip_id, enum OpalLPCAddressType addr_type,
729 uint32_t addr, uint32_t *data, uint32_t sz); 729 uint32_t addr, __be32 *data, uint32_t sz);
730int64_t opal_validate_flash(uint64_t buffer, uint32_t *size, uint32_t *result); 730int64_t opal_validate_flash(uint64_t buffer, uint32_t *size, uint32_t *result);
731int64_t opal_manage_flash(uint8_t op); 731int64_t opal_manage_flash(uint8_t op);
732int64_t opal_update_flash(uint64_t blk_list); 732int64_t opal_update_flash(uint64_t blk_list);
diff --git a/arch/powerpc/include/asm/pgalloc-32.h b/arch/powerpc/include/asm/pgalloc-32.h
index 27b2386f738a..842846c1b711 100644
--- a/arch/powerpc/include/asm/pgalloc-32.h
+++ b/arch/powerpc/include/asm/pgalloc-32.h
@@ -84,10 +84,8 @@ static inline void pgtable_free_tlb(struct mmu_gather *tlb,
84static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table, 84static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
85 unsigned long address) 85 unsigned long address)
86{ 86{
87 struct page *page = page_address(table);
88
89 tlb_flush_pgtable(tlb, address); 87 tlb_flush_pgtable(tlb, address);
90 pgtable_page_dtor(page); 88 pgtable_page_dtor(table);
91 pgtable_free_tlb(tlb, page, 0); 89 pgtable_free_tlb(tlb, page_address(table), 0);
92} 90}
93#endif /* _ASM_POWERPC_PGALLOC_32_H */ 91#endif /* _ASM_POWERPC_PGALLOC_32_H */
diff --git a/arch/powerpc/include/asm/pgalloc-64.h b/arch/powerpc/include/asm/pgalloc-64.h
index 16cb92d215d2..4b0be20fcbfd 100644
--- a/arch/powerpc/include/asm/pgalloc-64.h
+++ b/arch/powerpc/include/asm/pgalloc-64.h
@@ -16,6 +16,7 @@ struct vmemmap_backing {
16 unsigned long phys; 16 unsigned long phys;
17 unsigned long virt_addr; 17 unsigned long virt_addr;
18}; 18};
19extern struct vmemmap_backing *vmemmap_list;
19 20
20/* 21/*
21 * Functions that deal with pagetables that could be at any level of 22 * Functions that deal with pagetables that could be at any level of
@@ -147,11 +148,9 @@ static inline void pgtable_free_tlb(struct mmu_gather *tlb,
147static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table, 148static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table,
148 unsigned long address) 149 unsigned long address)
149{ 150{
150 struct page *page = page_address(table);
151
152 tlb_flush_pgtable(tlb, address); 151 tlb_flush_pgtable(tlb, address);
153 pgtable_page_dtor(page); 152 pgtable_page_dtor(table);
154 pgtable_free_tlb(tlb, page, 0); 153 pgtable_free_tlb(tlb, page_address(table), 0);
155} 154}
156 155
157#else /* if CONFIG_PPC_64K_PAGES */ 156#else /* if CONFIG_PPC_64K_PAGES */
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/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index 3c1acc31a092..f595b98079ee 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -366,6 +366,8 @@ BEGIN_FTR_SECTION_NESTED(96); \
366 cmpwi dest,0; \ 366 cmpwi dest,0; \
367 beq- 90b; \ 367 beq- 90b; \
368END_FTR_SECTION_NESTED(CPU_FTR_CELL_TB_BUG, CPU_FTR_CELL_TB_BUG, 96) 368END_FTR_SECTION_NESTED(CPU_FTR_CELL_TB_BUG, CPU_FTR_CELL_TB_BUG, 96)
369#elif defined(CONFIG_8xx)
370#define MFTB(dest) mftb dest
369#else 371#else
370#define MFTB(dest) mfspr dest, SPRN_TBRL 372#define MFTB(dest) mfspr dest, SPRN_TBRL
371#endif 373#endif
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index adf644a80a3e..6ba8d4af3999 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -1201,12 +1201,19 @@
1201 1201
1202#else /* __powerpc64__ */ 1202#else /* __powerpc64__ */
1203 1203
1204#if defined(CONFIG_8xx)
1205#define mftbl() ({unsigned long rval; \
1206 asm volatile("mftbl %0" : "=r" (rval)); rval;})
1207#define mftbu() ({unsigned long rval; \
1208 asm volatile("mftbu %0" : "=r" (rval)); rval;})
1209#else
1204#define mftbl() ({unsigned long rval; \ 1210#define mftbl() ({unsigned long rval; \
1205 asm volatile("mfspr %0, %1" : "=r" (rval) : \ 1211 asm volatile("mfspr %0, %1" : "=r" (rval) : \
1206 "i" (SPRN_TBRL)); rval;}) 1212 "i" (SPRN_TBRL)); rval;})
1207#define mftbu() ({unsigned long rval; \ 1213#define mftbu() ({unsigned long rval; \
1208 asm volatile("mfspr %0, %1" : "=r" (rval) : \ 1214 asm volatile("mfspr %0, %1" : "=r" (rval) : \
1209 "i" (SPRN_TBRU)); rval;}) 1215 "i" (SPRN_TBRU)); rval;})
1216#endif
1210#endif /* !__powerpc64__ */ 1217#endif /* !__powerpc64__ */
1211 1218
1212#define mttbl(v) asm volatile("mttbl %0":: "r"(v)) 1219#define mttbl(v) asm volatile("mttbl %0":: "r"(v))
diff --git a/arch/powerpc/include/asm/setup.h b/arch/powerpc/include/asm/setup.h
index 703a8412dac2..11ba86e17631 100644
--- a/arch/powerpc/include/asm/setup.h
+++ b/arch/powerpc/include/asm/setup.h
@@ -26,6 +26,7 @@ extern void reloc_got2(unsigned long);
26void check_for_initrd(void); 26void check_for_initrd(void);
27void do_init_bootmem(void); 27void do_init_bootmem(void);
28void setup_panic(void); 28void setup_panic(void);
29#define ARCH_PANIC_TIMEOUT 180
29 30
30#endif /* !__ASSEMBLY__ */ 31#endif /* !__ASSEMBLY__ */
31 32
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index 98da78e0c2c0..084e0807db98 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -33,6 +33,7 @@ extern int boot_cpuid;
33extern int spinning_secondaries; 33extern int spinning_secondaries;
34 34
35extern void cpu_die(void); 35extern void cpu_die(void);
36extern int cpu_to_chip_id(int cpu);
36 37
37#ifdef CONFIG_SMP 38#ifdef CONFIG_SMP
38 39
@@ -112,7 +113,6 @@ static inline struct cpumask *cpu_core_mask(int cpu)
112} 113}
113 114
114extern int cpu_to_core_id(int cpu); 115extern int cpu_to_core_id(int cpu);
115extern int cpu_to_chip_id(int cpu);
116 116
117/* Since OpenPIC has only 4 IPIs, we use slightly different message numbers. 117/* Since OpenPIC has only 4 IPIs, we use slightly different message numbers.
118 * 118 *
diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h
index 5f54a744dcc5..f6e78d63fb6a 100644
--- a/arch/powerpc/include/asm/spinlock.h
+++ b/arch/powerpc/include/asm/spinlock.h
@@ -28,6 +28,8 @@
28#include <asm/synch.h> 28#include <asm/synch.h>
29#include <asm/ppc-opcode.h> 29#include <asm/ppc-opcode.h>
30 30
31#define smp_mb__after_unlock_lock() smp_mb() /* Full ordering for lock. */
32
31#define arch_spin_is_locked(x) ((x)->slock != 0) 33#define arch_spin_is_locked(x) ((x)->slock != 0)
32 34
33#ifdef CONFIG_PPC64 35#ifdef CONFIG_PPC64
diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h
index 971ca336f451..0e83e7d8c73f 100644
--- a/arch/powerpc/include/asm/switch_to.h
+++ b/arch/powerpc/include/asm/switch_to.h
@@ -33,7 +33,7 @@ extern void giveup_vsx(struct task_struct *);
33extern void enable_kernel_spe(void); 33extern void enable_kernel_spe(void);
34extern void giveup_spe(struct task_struct *); 34extern void giveup_spe(struct task_struct *);
35extern void load_up_spe(struct task_struct *); 35extern void load_up_spe(struct task_struct *);
36extern void switch_booke_debug_regs(struct thread_struct *new_thread); 36extern void switch_booke_debug_regs(struct debug_reg *new_debug);
37 37
38#ifndef CONFIG_SMP 38#ifndef CONFIG_SMP
39extern void discard_lazy_cpu_state(void); 39extern void discard_lazy_cpu_state(void);
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index ba7b1973866e..9854c564ac52 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -82,8 +82,6 @@ static inline struct thread_info *current_thread_info(void)
82 82
83#endif /* __ASSEMBLY__ */ 83#endif /* __ASSEMBLY__ */
84 84
85#define PREEMPT_ACTIVE 0x10000000
86
87/* 85/*
88 * thread information flag bit numbers 86 * thread information flag bit numbers
89 */ 87 */
@@ -107,6 +105,9 @@ static inline struct thread_info *current_thread_info(void)
107#define TIF_EMULATE_STACK_STORE 16 /* Is an instruction emulation 105#define TIF_EMULATE_STACK_STORE 16 /* Is an instruction emulation
108 for stack store? */ 106 for stack store? */
109#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
110 111
111/* as above, but as bit values */ 112/* as above, but as bit values */
112#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 113#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -185,6 +186,12 @@ static inline bool test_thread_local_flags(unsigned int flags)
185#define is_32bit_task() (1) 186#define is_32bit_task() (1)
186#endif 187#endif
187 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
188#endif /* !__ASSEMBLY__ */ 195#endif /* !__ASSEMBLY__ */
189 196
190#endif /* __KERNEL__ */ 197#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/timex.h b/arch/powerpc/include/asm/timex.h
index 18908caa1f3b..2cf846edb3fc 100644
--- a/arch/powerpc/include/asm/timex.h
+++ b/arch/powerpc/include/asm/timex.h
@@ -29,7 +29,11 @@ static inline cycles_t get_cycles(void)
29 ret = 0; 29 ret = 0;
30 30
31 __asm__ __volatile__( 31 __asm__ __volatile__(
32#ifdef CONFIG_8xx
33 "97: mftb %0\n"
34#else
32 "97: mfspr %0, %2\n" 35 "97: mfspr %0, %2\n"
36#endif
33 "99:\n" 37 "99:\n"
34 ".section __ftr_fixup,\"a\"\n" 38 ".section __ftr_fixup,\"a\"\n"
35 ".align 2\n" 39 ".align 2\n"
@@ -41,7 +45,11 @@ static inline cycles_t get_cycles(void)
41 " .long 0\n" 45 " .long 0\n"
42 " .long 0\n" 46 " .long 0\n"
43 ".previous" 47 ".previous"
48#ifdef CONFIG_8xx
49 : "=r" (ret) : "i" (CPU_FTR_601));
50#else
44 : "=r" (ret) : "i" (CPU_FTR_601), "i" (SPRN_TBRL)); 51 : "=r" (ret) : "i" (CPU_FTR_601), "i" (SPRN_TBRL));
52#endif
45 return ret; 53 return ret;
46#endif 54#endif
47} 55}
diff --git a/arch/powerpc/include/asm/unaligned.h b/arch/powerpc/include/asm/unaligned.h
index 5f1b1e3c2137..8296381ae432 100644
--- a/arch/powerpc/include/asm/unaligned.h
+++ b/arch/powerpc/include/asm/unaligned.h
@@ -4,13 +4,18 @@
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6/* 6/*
7 * The PowerPC can do unaligned accesses itself in big endian mode. 7 * The PowerPC can do unaligned accesses itself based on its endian mode.
8 */ 8 */
9#include <linux/unaligned/access_ok.h> 9#include <linux/unaligned/access_ok.h>
10#include <linux/unaligned/generic.h> 10#include <linux/unaligned/generic.h>
11 11
12#ifdef __LITTLE_ENDIAN__
13#define get_unaligned __get_unaligned_le
14#define put_unaligned __put_unaligned_le
15#else
12#define get_unaligned __get_unaligned_be 16#define get_unaligned __get_unaligned_be
13#define put_unaligned __put_unaligned_be 17#define put_unaligned __put_unaligned_be
18#endif
14 19
15#endif /* __KERNEL__ */ 20#endif /* __KERNEL__ */
16#endif /* _ASM_POWERPC_UNALIGNED_H */ 21#endif /* _ASM_POWERPC_UNALIGNED_H */
diff --git a/arch/powerpc/include/asm/uprobes.h b/arch/powerpc/include/asm/uprobes.h
index 75c6ecdb8f37..7422a999a39a 100644
--- a/arch/powerpc/include/asm/uprobes.h
+++ b/arch/powerpc/include/asm/uprobes.h
@@ -36,9 +36,8 @@ typedef ppc_opcode_t uprobe_opcode_t;
36 36
37struct arch_uprobe { 37struct arch_uprobe {
38 union { 38 union {
39 u8 insn[MAX_UINSN_BYTES]; 39 u32 insn;
40 u8 ixol[MAX_UINSN_BYTES]; 40 u32 ixol;
41 u32 ainsn;
42 }; 41 };
43}; 42};
44 43
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 687f2ebf0cce..29eb7c19ee38 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -609,6 +609,7 @@ int main(void)
609 HSTATE_FIELD(HSTATE_VMHANDLER, vmhandler); 609 HSTATE_FIELD(HSTATE_VMHANDLER, vmhandler);
610 HSTATE_FIELD(HSTATE_SCRATCH0, scratch0); 610 HSTATE_FIELD(HSTATE_SCRATCH0, scratch0);
611 HSTATE_FIELD(HSTATE_SCRATCH1, scratch1); 611 HSTATE_FIELD(HSTATE_SCRATCH1, scratch1);
612 HSTATE_FIELD(HSTATE_SCRATCH2, scratch2);
612 HSTATE_FIELD(HSTATE_IN_GUEST, in_guest); 613 HSTATE_FIELD(HSTATE_IN_GUEST, in_guest);
613 HSTATE_FIELD(HSTATE_RESTORE_HID5, restore_hid5); 614 HSTATE_FIELD(HSTATE_RESTORE_HID5, restore_hid5);
614 HSTATE_FIELD(HSTATE_NAPPING, napping); 615 HSTATE_FIELD(HSTATE_NAPPING, napping);
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index 779a78c26435..11c1d069d920 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -124,15 +124,15 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
124void crash_free_reserved_phys_range(unsigned long begin, unsigned long end) 124void crash_free_reserved_phys_range(unsigned long begin, unsigned long end)
125{ 125{
126 unsigned long addr; 126 unsigned long addr;
127 const u32 *basep, *sizep; 127 const __be32 *basep, *sizep;
128 unsigned int rtas_start = 0, rtas_end = 0; 128 unsigned int rtas_start = 0, rtas_end = 0;
129 129
130 basep = of_get_property(rtas.dev, "linux,rtas-base", NULL); 130 basep = of_get_property(rtas.dev, "linux,rtas-base", NULL);
131 sizep = of_get_property(rtas.dev, "rtas-size", NULL); 131 sizep = of_get_property(rtas.dev, "rtas-size", NULL);
132 132
133 if (basep && sizep) { 133 if (basep && sizep) {
134 rtas_start = *basep; 134 rtas_start = be32_to_cpup(basep);
135 rtas_end = *basep + *sizep; 135 rtas_end = rtas_start + be32_to_cpup(sizep);
136 } 136 }
137 137
138 for (addr = begin; addr < end; addr += PAGE_SIZE) { 138 for (addr = begin; addr < end; addr += PAGE_SIZE) {
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index 671302065347..4bd687d5e7aa 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -686,6 +686,15 @@ void eeh_save_bars(struct eeh_dev *edev)
686 686
687 for (i = 0; i < 16; i++) 687 for (i = 0; i < 16; i++)
688 eeh_ops->read_config(dn, i * 4, 4, &edev->config_space[i]); 688 eeh_ops->read_config(dn, i * 4, 4, &edev->config_space[i]);
689
690 /*
691 * For PCI bridges including root port, we need enable bus
692 * master explicitly. Otherwise, it can't fetch IODA table
693 * entries correctly. So we cache the bit in advance so that
694 * we can restore it after reset, either PHB range or PE range.
695 */
696 if (edev->mode & EEH_DEV_BRIDGE)
697 edev->config_space[1] |= PCI_COMMAND_MASTER;
689} 698}
690 699
691/** 700/**
diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c
index 36bed5a12750..c17f90d0f73c 100644
--- a/arch/powerpc/kernel/eeh_driver.c
+++ b/arch/powerpc/kernel/eeh_driver.c
@@ -369,7 +369,9 @@ static void *eeh_rmv_device(void *data, void *userdata)
369 edev->mode |= EEH_DEV_DISCONNECTED; 369 edev->mode |= EEH_DEV_DISCONNECTED;
370 (*removed)++; 370 (*removed)++;
371 371
372 pci_lock_rescan_remove();
372 pci_stop_and_remove_bus_device(dev); 373 pci_stop_and_remove_bus_device(dev);
374 pci_unlock_rescan_remove();
373 375
374 return NULL; 376 return NULL;
375} 377}
@@ -416,10 +418,13 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus)
416 * into pcibios_add_pci_devices(). 418 * into pcibios_add_pci_devices().
417 */ 419 */
418 eeh_pe_state_mark(pe, EEH_PE_KEEP); 420 eeh_pe_state_mark(pe, EEH_PE_KEEP);
419 if (bus) 421 if (bus) {
422 pci_lock_rescan_remove();
420 pcibios_remove_pci_devices(bus); 423 pcibios_remove_pci_devices(bus);
421 else if (frozen_bus) 424 pci_unlock_rescan_remove();
425 } else if (frozen_bus) {
422 eeh_pe_dev_traverse(pe, eeh_rmv_device, &removed); 426 eeh_pe_dev_traverse(pe, eeh_rmv_device, &removed);
427 }
423 428
424 /* Reset the pci controller. (Asserts RST#; resets config space). 429 /* Reset the pci controller. (Asserts RST#; resets config space).
425 * Reconfigure bridges and devices. Don't try to bring the system 430 * Reconfigure bridges and devices. Don't try to bring the system
@@ -429,6 +434,8 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus)
429 if (rc) 434 if (rc)
430 return rc; 435 return rc;
431 436
437 pci_lock_rescan_remove();
438
432 /* Restore PE */ 439 /* Restore PE */
433 eeh_ops->configure_bridge(pe); 440 eeh_ops->configure_bridge(pe);
434 eeh_pe_restore_bars(pe); 441 eeh_pe_restore_bars(pe);
@@ -462,6 +469,7 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus)
462 pe->tstamp = tstamp; 469 pe->tstamp = tstamp;
463 pe->freeze_count = cnt; 470 pe->freeze_count = cnt;
464 471
472 pci_unlock_rescan_remove();
465 return 0; 473 return 0;
466} 474}
467 475
@@ -618,8 +626,11 @@ perm_error:
618 eeh_pe_dev_traverse(pe, eeh_report_failure, NULL); 626 eeh_pe_dev_traverse(pe, eeh_report_failure, NULL);
619 627
620 /* Shut down the device drivers for good. */ 628 /* Shut down the device drivers for good. */
621 if (frozen_bus) 629 if (frozen_bus) {
630 pci_lock_rescan_remove();
622 pcibios_remove_pci_devices(frozen_bus); 631 pcibios_remove_pci_devices(frozen_bus);
632 pci_unlock_rescan_remove();
633 }
623} 634}
624 635
625static void eeh_handle_special_event(void) 636static void eeh_handle_special_event(void)
@@ -692,6 +703,7 @@ static void eeh_handle_special_event(void)
692 if (rc == 2 || rc == 1) 703 if (rc == 2 || rc == 1)
693 eeh_handle_normal_event(pe); 704 eeh_handle_normal_event(pe);
694 else { 705 else {
706 pci_lock_rescan_remove();
695 list_for_each_entry_safe(hose, tmp, 707 list_for_each_entry_safe(hose, tmp,
696 &hose_list, list_node) { 708 &hose_list, list_node) {
697 phb_pe = eeh_phb_pe_get(hose); 709 phb_pe = eeh_phb_pe_get(hose);
@@ -703,6 +715,7 @@ static void eeh_handle_special_event(void)
703 eeh_pe_dev_traverse(pe, eeh_report_failure, NULL); 715 eeh_pe_dev_traverse(pe, eeh_report_failure, NULL);
704 pcibios_remove_pci_devices(bus); 716 pcibios_remove_pci_devices(bus);
705 } 717 }
718 pci_unlock_rescan_remove();
706 } 719 }
707} 720}
708 721
diff --git a/arch/powerpc/kernel/eeh_event.c b/arch/powerpc/kernel/eeh_event.c
index d27c5afc90ae..72d748b56c86 100644
--- a/arch/powerpc/kernel/eeh_event.c
+++ b/arch/powerpc/kernel/eeh_event.c
@@ -74,8 +74,13 @@ static int eeh_event_handler(void * dummy)
74 pe = event->pe; 74 pe = event->pe;
75 if (pe) { 75 if (pe) {
76 eeh_pe_state_mark(pe, EEH_PE_RECOVERING); 76 eeh_pe_state_mark(pe, EEH_PE_RECOVERING);
77 pr_info("EEH: Detected PCI bus error on PHB#%d-PE#%x\n", 77 if (pe->type & EEH_PE_PHB)
78 pe->phb->global_number, pe->addr); 78 pr_info("EEH: Detected error on PHB#%d\n",
79 pe->phb->global_number);
80 else
81 pr_info("EEH: Detected PCI bus error on "
82 "PHB#%d-PE#%x\n",
83 pe->phb->global_number, pe->addr);
79 eeh_handle_event(pe); 84 eeh_handle_event(pe);
80 eeh_pe_state_clear(pe, EEH_PE_RECOVERING); 85 eeh_pe_state_clear(pe, EEH_PE_RECOVERING);
81 } else { 86 } else {
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 2ae41aba4053..4f0946de2d5c 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -80,6 +80,7 @@ END_FTR_SECTION(0, 1)
80 * of the function that the cpu should jump to to continue 80 * of the function that the cpu should jump to to continue
81 * initialization. 81 * initialization.
82 */ 82 */
83 .balign 8
83 .globl __secondary_hold_spinloop 84 .globl __secondary_hold_spinloop
84__secondary_hold_spinloop: 85__secondary_hold_spinloop:
85 .llong 0x0 86 .llong 0x0
@@ -470,6 +471,7 @@ _STATIC(__after_prom_start)
470 mtctr r8 471 mtctr r8
471 bctr 472 bctr
472 473
474.balign 8
473p_end: .llong _end - _stext 475p_end: .llong _end - _stext
474 476
4754: /* Now copy the rest of the kernel up to _end */ 4774: /* Now copy the rest of the kernel up to _end */
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 2156ea90eb54..90fab64d911d 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -429,7 +429,7 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr)
429 case KPROBE_HIT_SSDONE: 429 case KPROBE_HIT_SSDONE:
430 /* 430 /*
431 * We increment the nmissed count for accounting, 431 * We increment the nmissed count for accounting,
432 * we can also use npre/npostfault count for accouting 432 * we can also use npre/npostfault count for accounting
433 * these specific fault cases. 433 * these specific fault cases.
434 */ 434 */
435 kprobes_inc_nmissed_count(cur); 435 kprobes_inc_nmissed_count(cur);
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index e1ec57e87b3b..75d4f7340da8 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -18,6 +18,7 @@
18#include <linux/ftrace.h> 18#include <linux/ftrace.h>
19 19
20#include <asm/machdep.h> 20#include <asm/machdep.h>
21#include <asm/pgalloc.h>
21#include <asm/prom.h> 22#include <asm/prom.h>
22#include <asm/sections.h> 23#include <asm/sections.h>
23 24
@@ -75,6 +76,17 @@ void arch_crash_save_vmcoreinfo(void)
75#ifndef CONFIG_NEED_MULTIPLE_NODES 76#ifndef CONFIG_NEED_MULTIPLE_NODES
76 VMCOREINFO_SYMBOL(contig_page_data); 77 VMCOREINFO_SYMBOL(contig_page_data);
77#endif 78#endif
79#if defined(CONFIG_PPC64) && defined(CONFIG_SPARSEMEM_VMEMMAP)
80 VMCOREINFO_SYMBOL(vmemmap_list);
81 VMCOREINFO_SYMBOL(mmu_vmemmap_psize);
82 VMCOREINFO_SYMBOL(mmu_psize_defs);
83 VMCOREINFO_STRUCT_SIZE(vmemmap_backing);
84 VMCOREINFO_OFFSET(vmemmap_backing, list);
85 VMCOREINFO_OFFSET(vmemmap_backing, phys);
86 VMCOREINFO_OFFSET(vmemmap_backing, virt_addr);
87 VMCOREINFO_STRUCT_SIZE(mmu_psize_def);
88 VMCOREINFO_OFFSET(mmu_psize_def, shift);
89#endif
78} 90}
79 91
80/* 92/*
@@ -136,7 +148,7 @@ void __init reserve_crashkernel(void)
136 * a small SLB (128MB) since the crash kernel needs to place 148 * a small SLB (128MB) since the crash kernel needs to place
137 * itself and some stacks to be in the first segment. 149 * itself and some stacks to be in the first segment.
138 */ 150 */
139 crashk_res.start = min(0x80000000ULL, (ppc64_rma_size / 2)); 151 crashk_res.start = min(0x8000000ULL, (ppc64_rma_size / 2));
140#else 152#else
141 crashk_res.start = KDUMP_KERNELBASE; 153 crashk_res.start = KDUMP_KERNELBASE;
142#endif 154#endif
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index e59caf874d05..64bf8db12b15 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -246,8 +246,8 @@ _GLOBAL(__bswapdi2)
246 or r3,r7,r9 246 or r3,r7,r9
247 blr 247 blr
248 248
249#if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE)
250 249
250#ifdef CONFIG_PPC_EARLY_DEBUG_BOOTX
251_GLOBAL(rmci_on) 251_GLOBAL(rmci_on)
252 sync 252 sync
253 isync 253 isync
@@ -277,6 +277,9 @@ _GLOBAL(rmci_off)
277 isync 277 isync
278 sync 278 sync
279 blr 279 blr
280#endif /* CONFIG_PPC_EARLY_DEBUG_BOOTX */
281
282#if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE)
280 283
281/* 284/*
282 * Do an IO access in real mode 285 * Do an IO access in real mode
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index fd82c289ab1c..28b898e68185 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -210,7 +210,7 @@ static void __init nvram_print_partitions(char * label)
210 printk(KERN_WARNING "--------%s---------\n", label); 210 printk(KERN_WARNING "--------%s---------\n", label);
211 printk(KERN_WARNING "indx\t\tsig\tchks\tlen\tname\n"); 211 printk(KERN_WARNING "indx\t\tsig\tchks\tlen\tname\n");
212 list_for_each_entry(tmp_part, &nvram_partitions, partition) { 212 list_for_each_entry(tmp_part, &nvram_partitions, partition) {
213 printk(KERN_WARNING "%4d \t%02x\t%02x\t%d\t%12s\n", 213 printk(KERN_WARNING "%4d \t%02x\t%02x\t%d\t%12.12s\n",
214 tmp_part->index, tmp_part->header.signature, 214 tmp_part->index, tmp_part->header.signature,
215 tmp_part->header.checksum, tmp_part->header.length, 215 tmp_part->header.checksum, tmp_part->header.length,
216 tmp_part->header.name); 216 tmp_part->header.name);
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index a1e3e40ca3fd..d9476c1fc959 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -835,7 +835,7 @@ static void pcibios_fixup_resources(struct pci_dev *dev)
835 * at 0 as unset as well, except if PCI_PROBE_ONLY is also set 835 * at 0 as unset as well, except if PCI_PROBE_ONLY is also set
836 * since in that case, we don't want to re-assign anything 836 * since in that case, we don't want to re-assign anything
837 */ 837 */
838 pcibios_resource_to_bus(dev, &reg, res); 838 pcibios_resource_to_bus(dev->bus, &reg, res);
839 if (pci_has_flag(PCI_REASSIGN_ALL_RSRC) || 839 if (pci_has_flag(PCI_REASSIGN_ALL_RSRC) ||
840 (reg.start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) { 840 (reg.start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) {
841 /* Only print message if not re-assigning */ 841 /* Only print message if not re-assigning */
@@ -886,7 +886,7 @@ static int pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
886 886
887 /* Job is a bit different between memory and IO */ 887 /* Job is a bit different between memory and IO */
888 if (res->flags & IORESOURCE_MEM) { 888 if (res->flags & IORESOURCE_MEM) {
889 pcibios_resource_to_bus(dev, &region, res); 889 pcibios_resource_to_bus(dev->bus, &region, res);
890 890
891 /* If the BAR is non-0 then it's probably been initialized */ 891 /* If the BAR is non-0 then it's probably been initialized */
892 if (region.start != 0) 892 if (region.start != 0)
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index ac0b034f9ae0..83c26d829991 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -111,7 +111,7 @@ static void of_pci_parse_addrs(struct device_node *node, struct pci_dev *dev)
111 res->name = pci_name(dev); 111 res->name = pci_name(dev);
112 region.start = base; 112 region.start = base;
113 region.end = base + size - 1; 113 region.end = base + size - 1;
114 pcibios_bus_to_resource(dev, res, &region); 114 pcibios_bus_to_resource(dev->bus, res, &region);
115 } 115 }
116} 116}
117 117
@@ -280,7 +280,7 @@ void of_scan_pci_bridge(struct pci_dev *dev)
280 res->flags = flags; 280 res->flags = flags;
281 region.start = of_read_number(&ranges[1], 2); 281 region.start = of_read_number(&ranges[1], 2);
282 region.end = region.start + size - 1; 282 region.end = region.start + size - 1;
283 pcibios_bus_to_resource(dev, res, &region); 283 pcibios_bus_to_resource(dev->bus, res, &region);
284 } 284 }
285 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), 285 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
286 bus->number); 286 bus->number);
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 75c2d1009985..4a96556fd2d4 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -339,7 +339,7 @@ static void set_debug_reg_defaults(struct thread_struct *thread)
339#endif 339#endif
340} 340}
341 341
342static void prime_debug_regs(struct thread_struct *thread) 342static void prime_debug_regs(struct debug_reg *debug)
343{ 343{
344 /* 344 /*
345 * We could have inherited MSR_DE from userspace, since 345 * We could have inherited MSR_DE from userspace, since
@@ -348,22 +348,22 @@ static void prime_debug_regs(struct thread_struct *thread)
348 */ 348 */
349 mtmsr(mfmsr() & ~MSR_DE); 349 mtmsr(mfmsr() & ~MSR_DE);
350 350
351 mtspr(SPRN_IAC1, thread->debug.iac1); 351 mtspr(SPRN_IAC1, debug->iac1);
352 mtspr(SPRN_IAC2, thread->debug.iac2); 352 mtspr(SPRN_IAC2, debug->iac2);
353#if CONFIG_PPC_ADV_DEBUG_IACS > 2 353#if CONFIG_PPC_ADV_DEBUG_IACS > 2
354 mtspr(SPRN_IAC3, thread->debug.iac3); 354 mtspr(SPRN_IAC3, debug->iac3);
355 mtspr(SPRN_IAC4, thread->debug.iac4); 355 mtspr(SPRN_IAC4, debug->iac4);
356#endif 356#endif
357 mtspr(SPRN_DAC1, thread->debug.dac1); 357 mtspr(SPRN_DAC1, debug->dac1);
358 mtspr(SPRN_DAC2, thread->debug.dac2); 358 mtspr(SPRN_DAC2, debug->dac2);
359#if CONFIG_PPC_ADV_DEBUG_DVCS > 0 359#if CONFIG_PPC_ADV_DEBUG_DVCS > 0
360 mtspr(SPRN_DVC1, thread->debug.dvc1); 360 mtspr(SPRN_DVC1, debug->dvc1);
361 mtspr(SPRN_DVC2, thread->debug.dvc2); 361 mtspr(SPRN_DVC2, debug->dvc2);
362#endif 362#endif
363 mtspr(SPRN_DBCR0, thread->debug.dbcr0); 363 mtspr(SPRN_DBCR0, debug->dbcr0);
364 mtspr(SPRN_DBCR1, thread->debug.dbcr1); 364 mtspr(SPRN_DBCR1, debug->dbcr1);
365#ifdef CONFIG_BOOKE 365#ifdef CONFIG_BOOKE
366 mtspr(SPRN_DBCR2, thread->debug.dbcr2); 366 mtspr(SPRN_DBCR2, debug->dbcr2);
367#endif 367#endif
368} 368}
369/* 369/*
@@ -371,11 +371,11 @@ static void prime_debug_regs(struct thread_struct *thread)
371 * debug registers, set the debug registers from the values 371 * debug registers, set the debug registers from the values
372 * stored in the new thread. 372 * stored in the new thread.
373 */ 373 */
374void switch_booke_debug_regs(struct thread_struct *new_thread) 374void switch_booke_debug_regs(struct debug_reg *new_debug)
375{ 375{
376 if ((current->thread.debug.dbcr0 & DBCR0_IDM) 376 if ((current->thread.debug.dbcr0 & DBCR0_IDM)
377 || (new_thread->debug.dbcr0 & DBCR0_IDM)) 377 || (new_debug->dbcr0 & DBCR0_IDM))
378 prime_debug_regs(new_thread); 378 prime_debug_regs(new_debug);
379} 379}
380EXPORT_SYMBOL_GPL(switch_booke_debug_regs); 380EXPORT_SYMBOL_GPL(switch_booke_debug_regs);
381#else /* !CONFIG_PPC_ADV_DEBUG_REGS */ 381#else /* !CONFIG_PPC_ADV_DEBUG_REGS */
@@ -683,7 +683,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
683#endif /* CONFIG_SMP */ 683#endif /* CONFIG_SMP */
684 684
685#ifdef CONFIG_PPC_ADV_DEBUG_REGS 685#ifdef CONFIG_PPC_ADV_DEBUG_REGS
686 switch_booke_debug_regs(&new->thread); 686 switch_booke_debug_regs(&new->thread.debug);
687#else 687#else
688/* 688/*
689 * For PPC_BOOK3S_64, we use the hw-breakpoint interfaces that would 689 * For PPC_BOOK3S_64, we use the hw-breakpoint interfaces that would
@@ -858,17 +858,21 @@ void show_regs(struct pt_regs * regs)
858 printk("MSR: "REG" ", regs->msr); 858 printk("MSR: "REG" ", regs->msr);
859 printbits(regs->msr, msr_bits); 859 printbits(regs->msr, msr_bits);
860 printk(" CR: %08lx XER: %08lx\n", regs->ccr, regs->xer); 860 printk(" CR: %08lx XER: %08lx\n", regs->ccr, regs->xer);
861#ifdef CONFIG_PPC64
862 printk("SOFTE: %ld\n", regs->softe);
863#endif
864 trap = TRAP(regs); 861 trap = TRAP(regs);
865 if ((regs->trap != 0xc00) && cpu_has_feature(CPU_FTR_CFAR)) 862 if ((regs->trap != 0xc00) && cpu_has_feature(CPU_FTR_CFAR))
866 printk("CFAR: "REG"\n", regs->orig_gpr3); 863 printk("CFAR: "REG" ", regs->orig_gpr3);
867 if (trap == 0x300 || trap == 0x600) 864 if (trap == 0x200 || trap == 0x300 || trap == 0x600)
868#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) 865#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
869 printk("DEAR: "REG", ESR: "REG"\n", regs->dar, regs->dsisr); 866 printk("DEAR: "REG" ESR: "REG" ", regs->dar, regs->dsisr);
870#else 867#else
871 printk("DAR: "REG", DSISR: %08lx\n", regs->dar, regs->dsisr); 868 printk("DAR: "REG" DSISR: %08lx ", regs->dar, regs->dsisr);
869#endif
870#ifdef CONFIG_PPC64
871 printk("SOFTE: %ld ", regs->softe);
872#endif
873#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
874 if (MSR_TM_ACTIVE(regs->msr))
875 printk("\nPACATMSCRATCH: %016llx ", get_paca()->tm_scratch);
872#endif 876#endif
873 877
874 for (i = 0; i < 32; i++) { 878 for (i = 0; i < 32; i++) {
@@ -887,9 +891,6 @@ void show_regs(struct pt_regs * regs)
887 printk("NIP ["REG"] %pS\n", regs->nip, (void *)regs->nip); 891 printk("NIP ["REG"] %pS\n", regs->nip, (void *)regs->nip);
888 printk("LR ["REG"] %pS\n", regs->link, (void *)regs->link); 892 printk("LR ["REG"] %pS\n", regs->link, (void *)regs->link);
889#endif 893#endif
890#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
891 printk("PACATMSCRATCH [%llx]\n", get_paca()->tm_scratch);
892#endif
893 show_stack(current, (unsigned long *) regs->gpr[1]); 894 show_stack(current, (unsigned long *) regs->gpr[1]);
894 if (!user_mode(regs)) 895 if (!user_mode(regs))
895 show_instructions(regs); 896 show_instructions(regs);
@@ -1086,25 +1087,45 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp)
1086 regs->msr = MSR_USER; 1087 regs->msr = MSR_USER;
1087#else 1088#else
1088 if (!is_32bit_task()) { 1089 if (!is_32bit_task()) {
1089 unsigned long entry, toc; 1090 unsigned long entry;
1090 1091
1091 /* start is a relocated pointer to the function descriptor for 1092 if (is_elf2_task()) {
1092 * the elf _start routine. The first entry in the function 1093 /* Look ma, no function descriptors! */
1093 * descriptor is the entry address of _start and the second 1094 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 1095
1099 /* Check whether the e_entry function descriptor entries 1096 /*
1100 * need to be relocated before we can use them. 1097 * Ulrich says:
1101 */ 1098 * The latest iteration of the ABI requires that when
1102 if (load_addr != 0) { 1099 * calling a function (at its global entry point),
1103 entry += load_addr; 1100 * the caller must ensure r12 holds the entry point
1104 toc += load_addr; 1101 * address (so that the function can quickly
1102 * establish addressability).
1103 */
1104 regs->gpr[12] = start;
1105 /* Make sure that's restored on entry to userspace. */
1106 set_thread_flag(TIF_RESTOREALL);
1107 } else {
1108 unsigned long toc;
1109
1110 /* start is a relocated pointer to the function
1111 * descriptor for the elf _start routine. The first
1112 * entry in the function descriptor is the entry
1113 * address of _start and the second entry is the TOC
1114 * value we need to use.
1115 */
1116 __get_user(entry, (unsigned long __user *)start);
1117 __get_user(toc, (unsigned long __user *)start+1);
1118
1119 /* Check whether the e_entry function descriptor entries
1120 * need to be relocated before we can use them.
1121 */
1122 if (load_addr != 0) {
1123 entry += load_addr;
1124 toc += load_addr;
1125 }
1126 regs->gpr[2] = toc;
1105 } 1127 }
1106 regs->nip = entry; 1128 regs->nip = entry;
1107 regs->gpr[2] = toc;
1108 regs->msr = MSR_USER64; 1129 regs->msr = MSR_USER64;
1109 } else { 1130 } else {
1110 regs->nip = start; 1131 regs->nip = start;
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index f3a47098fb8e..fa0ad8aafbcc 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -777,6 +777,26 @@ int of_get_ibm_chip_id(struct device_node *np)
777 return -1; 777 return -1;
778} 778}
779 779
780/**
781 * cpu_to_chip_id - Return the cpus chip-id
782 * @cpu: The logical cpu number.
783 *
784 * Return the value of the ibm,chip-id property corresponding to the given
785 * logical cpu number. If the chip-id can not be found, returns -1.
786 */
787int cpu_to_chip_id(int cpu)
788{
789 struct device_node *np;
790
791 np = of_get_cpu_node(cpu, NULL);
792 if (!np)
793 return -1;
794
795 of_node_put(np);
796 return of_get_ibm_chip_id(np);
797}
798EXPORT_SYMBOL(cpu_to_chip_id);
799
780#ifdef CONFIG_PPC_PSERIES 800#ifdef CONFIG_PPC_PSERIES
781/* 801/*
782 * Fix up the uninitialized fields in a new device node: 802 * Fix up the uninitialized fields in a new device node:
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index cb64a6e1dc51..078145acf7fb 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -1986,19 +1986,23 @@ static void __init prom_init_stdout(void)
1986 /* Get the full OF pathname of the stdout device */ 1986 /* Get the full OF pathname of the stdout device */
1987 memset(path, 0, 256); 1987 memset(path, 0, 256);
1988 call_prom("instance-to-path", 3, 1, prom.stdout, path, 255); 1988 call_prom("instance-to-path", 3, 1, prom.stdout, path, 255);
1989 stdout_node = call_prom("instance-to-package", 1, 1, prom.stdout);
1990 val = cpu_to_be32(stdout_node);
1991 prom_setprop(prom.chosen, "/chosen", "linux,stdout-package",
1992 &val, sizeof(val));
1993 prom_printf("OF stdout device is: %s\n", of_stdout_device); 1989 prom_printf("OF stdout device is: %s\n", of_stdout_device);
1994 prom_setprop(prom.chosen, "/chosen", "linux,stdout-path", 1990 prom_setprop(prom.chosen, "/chosen", "linux,stdout-path",
1995 path, strlen(path) + 1); 1991 path, strlen(path) + 1);
1996 1992
1997 /* If it's a display, note it */ 1993 /* instance-to-package fails on PA-Semi */
1998 memset(type, 0, sizeof(type)); 1994 stdout_node = call_prom("instance-to-package", 1, 1, prom.stdout);
1999 prom_getprop(stdout_node, "device_type", type, sizeof(type)); 1995 if (stdout_node != PROM_ERROR) {
2000 if (strcmp(type, "display") == 0) 1996 val = cpu_to_be32(stdout_node);
2001 prom_setprop(stdout_node, path, "linux,boot-display", NULL, 0); 1997 prom_setprop(prom.chosen, "/chosen", "linux,stdout-package",
1998 &val, sizeof(val));
1999
2000 /* If it's a display, note it */
2001 memset(type, 0, sizeof(type));
2002 prom_getprop(stdout_node, "device_type", type, sizeof(type));
2003 if (strcmp(type, "display") == 0)
2004 prom_setprop(stdout_node, path, "linux,boot-display", NULL, 0);
2005 }
2002} 2006}
2003 2007
2004static int __init prom_find_machine_type(void) 2008static int __init prom_find_machine_type(void)
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 75fb40498b41..2e3d2bf536c5 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1555,7 +1555,7 @@ long arch_ptrace(struct task_struct *child, long request,
1555 1555
1556 flush_fp_to_thread(child); 1556 flush_fp_to_thread(child);
1557 if (fpidx < (PT_FPSCR - PT_FPR0)) 1557 if (fpidx < (PT_FPSCR - PT_FPR0))
1558 memcpy(&tmp, &child->thread.fp_state.fpr, 1558 memcpy(&tmp, &child->thread.TS_FPR(fpidx),
1559 sizeof(long)); 1559 sizeof(long));
1560 else 1560 else
1561 tmp = child->thread.fp_state.fpscr; 1561 tmp = child->thread.fp_state.fpscr;
@@ -1588,7 +1588,7 @@ long arch_ptrace(struct task_struct *child, long request,
1588 1588
1589 flush_fp_to_thread(child); 1589 flush_fp_to_thread(child);
1590 if (fpidx < (PT_FPSCR - PT_FPR0)) 1590 if (fpidx < (PT_FPSCR - PT_FPR0))
1591 memcpy(&child->thread.fp_state.fpr, &data, 1591 memcpy(&child->thread.TS_FPR(fpidx), &data,
1592 sizeof(long)); 1592 sizeof(long));
1593 else 1593 else
1594 child->thread.fp_state.fpscr = data; 1594 child->thread.fp_state.fpscr = data;
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index febc80445d25..bc76cc6b419c 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -479,7 +479,7 @@ void __init smp_setup_cpu_maps(void)
479 if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) && 479 if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) &&
480 (dn = of_find_node_by_path("/rtas"))) { 480 (dn = of_find_node_by_path("/rtas"))) {
481 int num_addr_cell, num_size_cell, maxcpus; 481 int num_addr_cell, num_size_cell, maxcpus;
482 const unsigned int *ireg; 482 const __be32 *ireg;
483 483
484 num_addr_cell = of_n_addr_cells(dn); 484 num_addr_cell = of_n_addr_cells(dn);
485 num_size_cell = of_n_size_cells(dn); 485 num_size_cell = of_n_size_cells(dn);
@@ -489,7 +489,7 @@ void __init smp_setup_cpu_maps(void)
489 if (!ireg) 489 if (!ireg)
490 goto out; 490 goto out;
491 491
492 maxcpus = ireg[num_addr_cell + num_size_cell]; 492 maxcpus = be32_to_cpup(ireg + num_addr_cell + num_size_cell);
493 493
494 /* Double maxcpus for processors which have SMT capability */ 494 /* Double maxcpus for processors which have SMT capability */
495 if (cpu_has_feature(CPU_FTR_SMT)) 495 if (cpu_has_feature(CPU_FTR_SMT))
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index b903dc5cf944..2b0da27eaee4 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -296,9 +296,6 @@ void __init setup_arch(char **cmdline_p)
296 if (cpu_has_feature(CPU_FTR_UNIFIED_ID_CACHE)) 296 if (cpu_has_feature(CPU_FTR_UNIFIED_ID_CACHE))
297 ucache_bsize = icache_bsize = dcache_bsize; 297 ucache_bsize = icache_bsize = dcache_bsize;
298 298
299 /* reboot on panic */
300 panic_timeout = 180;
301
302 if (ppc_md.panic) 299 if (ppc_md.panic)
303 setup_panic(); 300 setup_panic();
304 301
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 4085aaa9478f..856dd4e99bfe 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -588,9 +588,6 @@ void __init setup_arch(char **cmdline_p)
588 dcache_bsize = ppc64_caches.dline_size; 588 dcache_bsize = ppc64_caches.dline_size;
589 icache_bsize = ppc64_caches.iline_size; 589 icache_bsize = ppc64_caches.iline_size;
590 590
591 /* reboot on panic */
592 panic_timeout = 180;
593
594 if (ppc_md.panic) 591 if (ppc_md.panic)
595 setup_panic(); 592 setup_panic();
596 593
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 749778e0a69d..68027bfa5f8e 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -445,6 +445,12 @@ static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame,
445#endif /* CONFIG_ALTIVEC */ 445#endif /* CONFIG_ALTIVEC */
446 if (copy_fpr_to_user(&frame->mc_fregs, current)) 446 if (copy_fpr_to_user(&frame->mc_fregs, current))
447 return 1; 447 return 1;
448
449 /*
450 * Clear the MSR VSX bit to indicate there is no valid state attached
451 * to this context, except in the specific case below where we set it.
452 */
453 msr &= ~MSR_VSX;
448#ifdef CONFIG_VSX 454#ifdef CONFIG_VSX
449 /* 455 /*
450 * Copy VSR 0-31 upper half from thread_struct to local 456 * Copy VSR 0-31 upper half from thread_struct to local
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index b3c615764c9b..42991045349f 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -122,6 +122,12 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
122 flush_fp_to_thread(current); 122 flush_fp_to_thread(current);
123 /* copy fpr regs and fpscr */ 123 /* copy fpr regs and fpscr */
124 err |= copy_fpr_to_user(&sc->fp_regs, current); 124 err |= copy_fpr_to_user(&sc->fp_regs, current);
125
126 /*
127 * Clear the MSR VSX bit to indicate there is no valid state attached
128 * to this context, except in the specific case below where we set it.
129 */
130 msr &= ~MSR_VSX;
125#ifdef CONFIG_VSX 131#ifdef CONFIG_VSX
126 /* 132 /*
127 * Copy VSX low doubleword to local buffer for formatting, 133 * Copy VSX low doubleword to local buffer for formatting,
@@ -701,12 +707,6 @@ badframe:
701int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info, 707int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
702 sigset_t *set, struct pt_regs *regs) 708 sigset_t *set, struct pt_regs *regs)
703{ 709{
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; 710 struct rt_sigframe __user *frame;
711 unsigned long newsp = 0; 711 unsigned long newsp = 0;
712 long err = 0; 712 long err = 0;
@@ -766,19 +766,32 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
766 goto badframe; 766 goto badframe;
767 regs->link = (unsigned long) &frame->tramp[0]; 767 regs->link = (unsigned long) &frame->tramp[0];
768 } 768 }
769 funct_desc_ptr = (func_descr_t __user *) ka->sa.sa_handler;
770 769
771 /* Allocate a dummy caller frame for the signal handler. */ 770 /* Allocate a dummy caller frame for the signal handler. */
772 newsp = ((unsigned long)frame) - __SIGNAL_FRAMESIZE; 771 newsp = ((unsigned long)frame) - __SIGNAL_FRAMESIZE;
773 err |= put_user(regs->gpr[1], (unsigned long __user *)newsp); 772 err |= put_user(regs->gpr[1], (unsigned long __user *)newsp);
774 773
775 /* Set up "regs" so we "return" to the signal handler. */ 774 /* Set up "regs" so we "return" to the signal handler. */
776 err |= get_user(regs->nip, &funct_desc_ptr->entry); 775 if (is_elf2_task()) {
776 regs->nip = (unsigned long) ka->sa.sa_handler;
777 regs->gpr[12] = regs->nip;
778 } else {
779 /* Handler is *really* a pointer to the function descriptor for
780 * the signal routine. The first entry in the function
781 * descriptor is the entry address of signal and the second
782 * entry is the TOC value we need to use.
783 */
784 func_descr_t __user *funct_desc_ptr =
785 (func_descr_t __user *) ka->sa.sa_handler;
786
787 err |= get_user(regs->nip, &funct_desc_ptr->entry);
788 err |= get_user(regs->gpr[2], &funct_desc_ptr->toc);
789 }
790
777 /* enter the signal handler in native-endian mode */ 791 /* enter the signal handler in native-endian mode */
778 regs->msr &= ~MSR_LE; 792 regs->msr &= ~MSR_LE;
779 regs->msr |= (MSR_KERNEL & MSR_LE); 793 regs->msr |= (MSR_KERNEL & MSR_LE);
780 regs->gpr[1] = newsp; 794 regs->gpr[1] = newsp;
781 err |= get_user(regs->gpr[2], &funct_desc_ptr->toc);
782 regs->gpr[3] = signr; 795 regs->gpr[3] = signr;
783 regs->result = 0; 796 regs->result = 0;
784 if (ka->sa.sa_flags & SA_SIGINFO) { 797 if (ka->sa.sa_flags & SA_SIGINFO) {
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 930cd8af3503..c1cf4a1522d9 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -580,7 +580,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
580int cpu_to_core_id(int cpu) 580int cpu_to_core_id(int cpu)
581{ 581{
582 struct device_node *np; 582 struct device_node *np;
583 const int *reg; 583 const __be32 *reg;
584 int id = -1; 584 int id = -1;
585 585
586 np = of_get_cpu_node(cpu, NULL); 586 np = of_get_cpu_node(cpu, NULL);
@@ -591,28 +591,12 @@ int cpu_to_core_id(int cpu)
591 if (!reg) 591 if (!reg)
592 goto out; 592 goto out;
593 593
594 id = *reg; 594 id = be32_to_cpup(reg);
595out: 595out:
596 of_node_put(np); 596 of_node_put(np);
597 return id; 597 return id;
598} 598}
599 599
600/* Return the value of the chip-id property corresponding
601 * to the given logical cpu.
602 */
603int cpu_to_chip_id(int cpu)
604{
605 struct device_node *np;
606
607 np = of_get_cpu_node(cpu, NULL);
608 if (!np)
609 return -1;
610
611 of_node_put(np);
612 return of_get_ibm_chip_id(np);
613}
614EXPORT_SYMBOL(cpu_to_chip_id);
615
616/* Helper routines for cpu to core mapping */ 600/* Helper routines for cpu to core mapping */
617int cpu_core_index_of_thread(int cpu) 601int cpu_core_index_of_thread(int cpu)
618{ 602{
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 192b051df97e..b3b144121cc9 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -213,8 +213,6 @@ static u64 scan_dispatch_log(u64 stop_tb)
213 if (i == be64_to_cpu(vpa->dtl_idx)) 213 if (i == be64_to_cpu(vpa->dtl_idx))
214 return 0; 214 return 0;
215 while (i < be64_to_cpu(vpa->dtl_idx)) { 215 while (i < be64_to_cpu(vpa->dtl_idx)) {
216 if (dtl_consumer)
217 dtl_consumer(dtl, i);
218 dtb = be64_to_cpu(dtl->timebase); 216 dtb = be64_to_cpu(dtl->timebase);
219 tb_delta = be32_to_cpu(dtl->enqueue_to_dispatch_time) + 217 tb_delta = be32_to_cpu(dtl->enqueue_to_dispatch_time) +
220 be32_to_cpu(dtl->ready_to_enqueue_time); 218 be32_to_cpu(dtl->ready_to_enqueue_time);
@@ -227,6 +225,8 @@ static u64 scan_dispatch_log(u64 stop_tb)
227 } 225 }
228 if (dtb > stop_tb) 226 if (dtb > stop_tb)
229 break; 227 break;
228 if (dtl_consumer)
229 dtl_consumer(dtl, i);
230 stolen += tb_delta; 230 stolen += tb_delta;
231 ++i; 231 ++i;
232 ++dtl; 232 ++dtl;
diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c
index 59f419b935f2..003b20964ea0 100644
--- a/arch/powerpc/kernel/uprobes.c
+++ b/arch/powerpc/kernel/uprobes.c
@@ -186,7 +186,7 @@ bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)
186 * emulate_step() returns 1 if the insn was successfully emulated. 186 * emulate_step() returns 1 if the insn was successfully emulated.
187 * For all other cases, we need to single-step in hardware. 187 * For all other cases, we need to single-step in hardware.
188 */ 188 */
189 ret = emulate_step(regs, auprobe->ainsn); 189 ret = emulate_step(regs, auprobe->insn);
190 if (ret > 0) 190 if (ret > 0)
191 return true; 191 return true;
192 192
diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S
index 6b1f2a6d5517..6b2b69616e77 100644
--- a/arch/powerpc/kernel/vdso32/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso32/gettimeofday.S
@@ -232,9 +232,15 @@ __do_get_tspec:
232 lwz r6,(CFG_TB_ORIG_STAMP+4)(r9) 232 lwz r6,(CFG_TB_ORIG_STAMP+4)(r9)
233 233
234 /* Get a stable TB value */ 234 /* Get a stable TB value */
235#ifdef CONFIG_8xx
2362: mftbu r3
237 mftbl r4
238 mftbu r0
239#else
2352: mfspr r3, SPRN_TBRU 2402: mfspr r3, SPRN_TBRU
236 mfspr r4, SPRN_TBRL 241 mfspr r4, SPRN_TBRL
237 mfspr r0, SPRN_TBRU 242 mfspr r0, SPRN_TBRU
243#endif
238 cmplw cr0,r3,r0 244 cmplw cr0,r3,r0
239 bne- 2b 245 bne- 2b
240 246
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/kernel/vio.c b/arch/powerpc/kernel/vio.c
index e7d0c88f621a..76a64821f4a2 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -1419,7 +1419,7 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
1419 1419
1420 /* needed to ensure proper operation of coherent allocations 1420 /* needed to ensure proper operation of coherent allocations
1421 * later, in case driver doesn't set it explicitly */ 1421 * later, in case driver doesn't set it explicitly */
1422 dma_set_mask_and_coherent(&viodev->dev, DMA_BIT_MASK(64)); 1422 dma_coerce_mask_and_coherent(&viodev->dev, DMA_BIT_MASK(64));
1423 } 1423 }
1424 1424
1425 /* register with generic device framework */ 1425 /* register with generic device framework */
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index 22cc895333e6..303ece75b8e4 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -469,11 +469,14 @@ static int kvmppc_mmu_book3s_64_hv_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
469 slb_v = vcpu->kvm->arch.vrma_slb_v; 469 slb_v = vcpu->kvm->arch.vrma_slb_v;
470 } 470 }
471 471
472 preempt_disable();
472 /* Find the HPTE in the hash table */ 473 /* Find the HPTE in the hash table */
473 index = kvmppc_hv_find_lock_hpte(kvm, eaddr, slb_v, 474 index = kvmppc_hv_find_lock_hpte(kvm, eaddr, slb_v,
474 HPTE_V_VALID | HPTE_V_ABSENT); 475 HPTE_V_VALID | HPTE_V_ABSENT);
475 if (index < 0) 476 if (index < 0) {
477 preempt_enable();
476 return -ENOENT; 478 return -ENOENT;
479 }
477 hptep = (unsigned long *)(kvm->arch.hpt_virt + (index << 4)); 480 hptep = (unsigned long *)(kvm->arch.hpt_virt + (index << 4));
478 v = hptep[0] & ~HPTE_V_HVLOCK; 481 v = hptep[0] & ~HPTE_V_HVLOCK;
479 gr = kvm->arch.revmap[index].guest_rpte; 482 gr = kvm->arch.revmap[index].guest_rpte;
@@ -481,6 +484,7 @@ static int kvmppc_mmu_book3s_64_hv_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
481 /* Unlock the HPTE */ 484 /* Unlock the HPTE */
482 asm volatile("lwsync" : : : "memory"); 485 asm volatile("lwsync" : : : "memory");
483 hptep[0] = v; 486 hptep[0] = v;
487 preempt_enable();
484 488
485 gpte->eaddr = eaddr; 489 gpte->eaddr = eaddr;
486 gpte->vpage = ((v & HPTE_V_AVPN) << 4) | ((eaddr >> 12) & 0xfff); 490 gpte->vpage = ((v & HPTE_V_AVPN) << 4) | ((eaddr >> 12) & 0xfff);
@@ -665,6 +669,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
665 return -EFAULT; 669 return -EFAULT;
666 } else { 670 } else {
667 page = pages[0]; 671 page = pages[0];
672 pfn = page_to_pfn(page);
668 if (PageHuge(page)) { 673 if (PageHuge(page)) {
669 page = compound_head(page); 674 page = compound_head(page);
670 pte_size <<= compound_order(page); 675 pte_size <<= compound_order(page);
@@ -689,7 +694,6 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
689 } 694 }
690 rcu_read_unlock_sched(); 695 rcu_read_unlock_sched();
691 } 696 }
692 pfn = page_to_pfn(page);
693 } 697 }
694 698
695 ret = -EFAULT; 699 ret = -EFAULT;
@@ -707,8 +711,14 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
707 r = (r & ~(HPTE_R_W|HPTE_R_I|HPTE_R_G)) | HPTE_R_M; 711 r = (r & ~(HPTE_R_W|HPTE_R_I|HPTE_R_G)) | HPTE_R_M;
708 } 712 }
709 713
710 /* Set the HPTE to point to pfn */ 714 /*
711 r = (r & ~(HPTE_R_PP0 - pte_size)) | (pfn << PAGE_SHIFT); 715 * Set the HPTE to point to pfn.
716 * Since the pfn is at PAGE_SIZE granularity, make sure we
717 * don't mask out lower-order bits if psize < PAGE_SIZE.
718 */
719 if (psize < PAGE_SIZE)
720 psize = PAGE_SIZE;
721 r = (r & ~(HPTE_R_PP0 - psize)) | ((pfn << PAGE_SHIFT) & ~(psize - 1));
712 if (hpte_is_writable(r) && !write_ok) 722 if (hpte_is_writable(r) && !write_ok)
713 r = hpte_make_readonly(r); 723 r = hpte_make_readonly(r);
714 ret = RESUME_GUEST; 724 ret = RESUME_GUEST;
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index f4a4c5c82fb2..17fc9496b6ac 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -135,8 +135,9 @@ static void kvmppc_fast_vcpu_kick_hv(struct kvm_vcpu *vcpu)
135static void kvmppc_core_vcpu_load_hv(struct kvm_vcpu *vcpu, int cpu) 135static void kvmppc_core_vcpu_load_hv(struct kvm_vcpu *vcpu, int cpu)
136{ 136{
137 struct kvmppc_vcore *vc = vcpu->arch.vcore; 137 struct kvmppc_vcore *vc = vcpu->arch.vcore;
138 unsigned long flags;
138 139
139 spin_lock(&vcpu->arch.tbacct_lock); 140 spin_lock_irqsave(&vcpu->arch.tbacct_lock, flags);
140 if (vc->runner == vcpu && vc->vcore_state != VCORE_INACTIVE && 141 if (vc->runner == vcpu && vc->vcore_state != VCORE_INACTIVE &&
141 vc->preempt_tb != TB_NIL) { 142 vc->preempt_tb != TB_NIL) {
142 vc->stolen_tb += mftb() - vc->preempt_tb; 143 vc->stolen_tb += mftb() - vc->preempt_tb;
@@ -147,19 +148,20 @@ static void kvmppc_core_vcpu_load_hv(struct kvm_vcpu *vcpu, int cpu)
147 vcpu->arch.busy_stolen += mftb() - vcpu->arch.busy_preempt; 148 vcpu->arch.busy_stolen += mftb() - vcpu->arch.busy_preempt;
148 vcpu->arch.busy_preempt = TB_NIL; 149 vcpu->arch.busy_preempt = TB_NIL;
149 } 150 }
150 spin_unlock(&vcpu->arch.tbacct_lock); 151 spin_unlock_irqrestore(&vcpu->arch.tbacct_lock, flags);
151} 152}
152 153
153static void kvmppc_core_vcpu_put_hv(struct kvm_vcpu *vcpu) 154static void kvmppc_core_vcpu_put_hv(struct kvm_vcpu *vcpu)
154{ 155{
155 struct kvmppc_vcore *vc = vcpu->arch.vcore; 156 struct kvmppc_vcore *vc = vcpu->arch.vcore;
157 unsigned long flags;
156 158
157 spin_lock(&vcpu->arch.tbacct_lock); 159 spin_lock_irqsave(&vcpu->arch.tbacct_lock, flags);
158 if (vc->runner == vcpu && vc->vcore_state != VCORE_INACTIVE) 160 if (vc->runner == vcpu && vc->vcore_state != VCORE_INACTIVE)
159 vc->preempt_tb = mftb(); 161 vc->preempt_tb = mftb();
160 if (vcpu->arch.state == KVMPPC_VCPU_BUSY_IN_HOST) 162 if (vcpu->arch.state == KVMPPC_VCPU_BUSY_IN_HOST)
161 vcpu->arch.busy_preempt = mftb(); 163 vcpu->arch.busy_preempt = mftb();
162 spin_unlock(&vcpu->arch.tbacct_lock); 164 spin_unlock_irqrestore(&vcpu->arch.tbacct_lock, flags);
163} 165}
164 166
165static void kvmppc_set_msr_hv(struct kvm_vcpu *vcpu, u64 msr) 167static void kvmppc_set_msr_hv(struct kvm_vcpu *vcpu, u64 msr)
@@ -504,11 +506,11 @@ static u64 vcore_stolen_time(struct kvmppc_vcore *vc, u64 now)
504 */ 506 */
505 if (vc->vcore_state != VCORE_INACTIVE && 507 if (vc->vcore_state != VCORE_INACTIVE &&
506 vc->runner->arch.run_task != current) { 508 vc->runner->arch.run_task != current) {
507 spin_lock(&vc->runner->arch.tbacct_lock); 509 spin_lock_irq(&vc->runner->arch.tbacct_lock);
508 p = vc->stolen_tb; 510 p = vc->stolen_tb;
509 if (vc->preempt_tb != TB_NIL) 511 if (vc->preempt_tb != TB_NIL)
510 p += now - vc->preempt_tb; 512 p += now - vc->preempt_tb;
511 spin_unlock(&vc->runner->arch.tbacct_lock); 513 spin_unlock_irq(&vc->runner->arch.tbacct_lock);
512 } else { 514 } else {
513 p = vc->stolen_tb; 515 p = vc->stolen_tb;
514 } 516 }
@@ -530,10 +532,10 @@ static void kvmppc_create_dtl_entry(struct kvm_vcpu *vcpu,
530 core_stolen = vcore_stolen_time(vc, now); 532 core_stolen = vcore_stolen_time(vc, now);
531 stolen = core_stolen - vcpu->arch.stolen_logged; 533 stolen = core_stolen - vcpu->arch.stolen_logged;
532 vcpu->arch.stolen_logged = core_stolen; 534 vcpu->arch.stolen_logged = core_stolen;
533 spin_lock(&vcpu->arch.tbacct_lock); 535 spin_lock_irq(&vcpu->arch.tbacct_lock);
534 stolen += vcpu->arch.busy_stolen; 536 stolen += vcpu->arch.busy_stolen;
535 vcpu->arch.busy_stolen = 0; 537 vcpu->arch.busy_stolen = 0;
536 spin_unlock(&vcpu->arch.tbacct_lock); 538 spin_unlock_irq(&vcpu->arch.tbacct_lock);
537 if (!dt || !vpa) 539 if (!dt || !vpa)
538 return; 540 return;
539 memset(dt, 0, sizeof(struct dtl_entry)); 541 memset(dt, 0, sizeof(struct dtl_entry));
@@ -607,7 +609,9 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
607 if (list_empty(&vcpu->kvm->arch.rtas_tokens)) 609 if (list_empty(&vcpu->kvm->arch.rtas_tokens))
608 return RESUME_HOST; 610 return RESUME_HOST;
609 611
612 idx = srcu_read_lock(&vcpu->kvm->srcu);
610 rc = kvmppc_rtas_hcall(vcpu); 613 rc = kvmppc_rtas_hcall(vcpu);
614 srcu_read_unlock(&vcpu->kvm->srcu, idx);
611 615
612 if (rc == -ENOENT) 616 if (rc == -ENOENT)
613 return RESUME_HOST; 617 return RESUME_HOST;
@@ -1286,13 +1290,13 @@ static void kvmppc_remove_runnable(struct kvmppc_vcore *vc,
1286 1290
1287 if (vcpu->arch.state != KVMPPC_VCPU_RUNNABLE) 1291 if (vcpu->arch.state != KVMPPC_VCPU_RUNNABLE)
1288 return; 1292 return;
1289 spin_lock(&vcpu->arch.tbacct_lock); 1293 spin_lock_irq(&vcpu->arch.tbacct_lock);
1290 now = mftb(); 1294 now = mftb();
1291 vcpu->arch.busy_stolen += vcore_stolen_time(vc, now) - 1295 vcpu->arch.busy_stolen += vcore_stolen_time(vc, now) -
1292 vcpu->arch.stolen_logged; 1296 vcpu->arch.stolen_logged;
1293 vcpu->arch.busy_preempt = now; 1297 vcpu->arch.busy_preempt = now;
1294 vcpu->arch.state = KVMPPC_VCPU_BUSY_IN_HOST; 1298 vcpu->arch.state = KVMPPC_VCPU_BUSY_IN_HOST;
1295 spin_unlock(&vcpu->arch.tbacct_lock); 1299 spin_unlock_irq(&vcpu->arch.tbacct_lock);
1296 --vc->n_runnable; 1300 --vc->n_runnable;
1297 list_del(&vcpu->arch.run_list); 1301 list_del(&vcpu->arch.run_list);
1298} 1302}
@@ -1507,7 +1511,7 @@ static void kvmppc_run_core(struct kvmppc_vcore *vc)
1507 kvm_guest_exit(); 1511 kvm_guest_exit();
1508 1512
1509 preempt_enable(); 1513 preempt_enable();
1510 kvm_resched(vcpu); 1514 cond_resched();
1511 1515
1512 spin_lock(&vc->lock); 1516 spin_lock(&vc->lock);
1513 now = get_tb(); 1517 now = get_tb();
diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
index daa19a043677..37fb3caa4c80 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
@@ -225,6 +225,7 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
225 is_io = pa & (HPTE_R_I | HPTE_R_W); 225 is_io = pa & (HPTE_R_I | HPTE_R_W);
226 pte_size = PAGE_SIZE << (pa & KVMPPC_PAGE_ORDER_MASK); 226 pte_size = PAGE_SIZE << (pa & KVMPPC_PAGE_ORDER_MASK);
227 pa &= PAGE_MASK; 227 pa &= PAGE_MASK;
228 pa |= gpa & ~PAGE_MASK;
228 } else { 229 } else {
229 /* Translate to host virtual address */ 230 /* Translate to host virtual address */
230 hva = __gfn_to_hva_memslot(memslot, gfn); 231 hva = __gfn_to_hva_memslot(memslot, gfn);
@@ -239,13 +240,13 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
239 ptel = hpte_make_readonly(ptel); 240 ptel = hpte_make_readonly(ptel);
240 is_io = hpte_cache_bits(pte_val(pte)); 241 is_io = hpte_cache_bits(pte_val(pte));
241 pa = pte_pfn(pte) << PAGE_SHIFT; 242 pa = pte_pfn(pte) << PAGE_SHIFT;
243 pa |= hva & (pte_size - 1);
244 pa |= gpa & ~PAGE_MASK;
242 } 245 }
243 } 246 }
244 247
245 if (pte_size < psize) 248 if (pte_size < psize)
246 return H_PARAMETER; 249 return H_PARAMETER;
247 if (pa && pte_size > psize)
248 pa |= gpa & (pte_size - 1);
249 250
250 ptel &= ~(HPTE_R_PP0 - psize); 251 ptel &= ~(HPTE_R_PP0 - psize);
251 ptel |= pa; 252 ptel |= pa;
@@ -751,6 +752,10 @@ static int slb_base_page_shift[4] = {
751 20, /* 1M, unsupported */ 752 20, /* 1M, unsupported */
752}; 753};
753 754
755/* When called from virtmode, this func should be protected by
756 * preempt_disable(), otherwise, the holding of HPTE_V_HVLOCK
757 * can trigger deadlock issue.
758 */
754long kvmppc_hv_find_lock_hpte(struct kvm *kvm, gva_t eaddr, unsigned long slb_v, 759long kvmppc_hv_find_lock_hpte(struct kvm *kvm, gva_t eaddr, unsigned long slb_v,
755 unsigned long valid) 760 unsigned long valid)
756{ 761{
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index dfa144cb199b..e66d4ec04d95 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -160,7 +160,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
160 160
16113: b machine_check_fwnmi 16113: b machine_check_fwnmi
162 162
163
164kvmppc_primary_no_guest: 163kvmppc_primary_no_guest:
165 /* We handle this much like a ceded vcpu */ 164 /* We handle this much like a ceded vcpu */
166 /* set our bit in napping_threads */ 165 /* set our bit in napping_threads */
@@ -278,12 +277,16 @@ kvm_start_guest:
278 /* Clear our vcpu pointer so we don't come back in early */ 277 /* Clear our vcpu pointer so we don't come back in early */
279 li r0, 0 278 li r0, 0
280 std r0, HSTATE_KVM_VCPU(r13) 279 std r0, HSTATE_KVM_VCPU(r13)
280 /*
281 * Make sure we clear HSTATE_KVM_VCPU(r13) before incrementing
282 * the nap_count, because once the increment to nap_count is
283 * visible we could be given another vcpu.
284 */
281 lwsync 285 lwsync
282 286
283 /* increment the nap count and then go to nap mode */ 287 /* increment the nap count and then go to nap mode */
284 ld r4, HSTATE_KVM_VCORE(r13) 288 ld r4, HSTATE_KVM_VCORE(r13)
285 addi r4, r4, VCORE_NAP_COUNT 289 addi r4, r4, VCORE_NAP_COUNT
286 lwsync /* make previous updates visible */
28751: lwarx r3, 0, r4 29051: lwarx r3, 0, r4
288 addi r3, r3, 1 291 addi r3, r3, 1
289 stwcx. r3, 0, r4 292 stwcx. r3, 0, r4
@@ -889,15 +892,14 @@ kvmppc_interrupt_hv:
889 * guest CR, R12 saved in shadow VCPU SCRATCH1/0 892 * guest CR, R12 saved in shadow VCPU SCRATCH1/0
890 * guest R13 saved in SPRN_SCRATCH0 893 * guest R13 saved in SPRN_SCRATCH0
891 */ 894 */
892 /* abuse host_r2 as third scratch area; we get r2 from PACATOC(r13) */ 895 std r9, HSTATE_SCRATCH2(r13)
893 std r9, HSTATE_HOST_R2(r13)
894 896
895 lbz r9, HSTATE_IN_GUEST(r13) 897 lbz r9, HSTATE_IN_GUEST(r13)
896 cmpwi r9, KVM_GUEST_MODE_HOST_HV 898 cmpwi r9, KVM_GUEST_MODE_HOST_HV
897 beq kvmppc_bad_host_intr 899 beq kvmppc_bad_host_intr
898#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE 900#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
899 cmpwi r9, KVM_GUEST_MODE_GUEST 901 cmpwi r9, KVM_GUEST_MODE_GUEST
900 ld r9, HSTATE_HOST_R2(r13) 902 ld r9, HSTATE_SCRATCH2(r13)
901 beq kvmppc_interrupt_pr 903 beq kvmppc_interrupt_pr
902#endif 904#endif
903 /* We're now back in the host but in guest MMU context */ 905 /* We're now back in the host but in guest MMU context */
@@ -917,7 +919,7 @@ kvmppc_interrupt_hv:
917 std r6, VCPU_GPR(R6)(r9) 919 std r6, VCPU_GPR(R6)(r9)
918 std r7, VCPU_GPR(R7)(r9) 920 std r7, VCPU_GPR(R7)(r9)
919 std r8, VCPU_GPR(R8)(r9) 921 std r8, VCPU_GPR(R8)(r9)
920 ld r0, HSTATE_HOST_R2(r13) 922 ld r0, HSTATE_SCRATCH2(r13)
921 std r0, VCPU_GPR(R9)(r9) 923 std r0, VCPU_GPR(R9)(r9)
922 std r10, VCPU_GPR(R10)(r9) 924 std r10, VCPU_GPR(R10)(r9)
923 std r11, VCPU_GPR(R11)(r9) 925 std r11, VCPU_GPR(R11)(r9)
@@ -1289,14 +1291,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
1289 */ 1291 */
1290 /* Increment the threads-exiting-guest count in the 0xff00 1292 /* Increment the threads-exiting-guest count in the 0xff00
1291 bits of vcore->entry_exit_count */ 1293 bits of vcore->entry_exit_count */
1292 lwsync
1293 ld r5,HSTATE_KVM_VCORE(r13) 1294 ld r5,HSTATE_KVM_VCORE(r13)
1294 addi r6,r5,VCORE_ENTRY_EXIT 1295 addi r6,r5,VCORE_ENTRY_EXIT
129541: lwarx r3,0,r6 129641: lwarx r3,0,r6
1296 addi r0,r3,0x100 1297 addi r0,r3,0x100
1297 stwcx. r0,0,r6 1298 stwcx. r0,0,r6
1298 bne 41b 1299 bne 41b
1299 lwsync 1300 isync /* order stwcx. vs. reading napping_threads */
1300 1301
1301 /* 1302 /*
1302 * At this point we have an interrupt that we have to pass 1303 * At this point we have an interrupt that we have to pass
@@ -1327,6 +1328,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
1327 sld r0,r0,r4 1328 sld r0,r0,r4
1328 andc. r3,r3,r0 /* no sense IPI'ing ourselves */ 1329 andc. r3,r3,r0 /* no sense IPI'ing ourselves */
1329 beq 43f 1330 beq 43f
1331 /* Order entry/exit update vs. IPIs */
1332 sync
1330 mulli r4,r4,PACA_SIZE /* get paca for thread 0 */ 1333 mulli r4,r4,PACA_SIZE /* get paca for thread 0 */
1331 subf r6,r4,r13 1334 subf r6,r4,r13
133242: andi. r0,r3,1 133542: andi. r0,r3,1
@@ -1914,10 +1917,10 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206)
1914 bge kvm_cede_exit 1917 bge kvm_cede_exit
1915 stwcx. r4,0,r6 1918 stwcx. r4,0,r6
1916 bne 31b 1919 bne 31b
1920 /* order napping_threads update vs testing entry_exit_count */
1921 isync
1917 li r0,NAPPING_CEDE 1922 li r0,NAPPING_CEDE
1918 stb r0,HSTATE_NAPPING(r13) 1923 stb r0,HSTATE_NAPPING(r13)
1919 /* order napping_threads update vs testing entry_exit_count */
1920 lwsync
1921 lwz r7,VCORE_ENTRY_EXIT(r5) 1924 lwz r7,VCORE_ENTRY_EXIT(r5)
1922 cmpwi r7,0x100 1925 cmpwi r7,0x100
1923 bge 33f /* another thread already exiting */ 1926 bge 33f /* another thread already exiting */
diff --git a/arch/powerpc/kvm/book3s_interrupts.S b/arch/powerpc/kvm/book3s_interrupts.S
index f4dd041c14ea..f779450cb07c 100644
--- a/arch/powerpc/kvm/book3s_interrupts.S
+++ b/arch/powerpc/kvm/book3s_interrupts.S
@@ -129,29 +129,32 @@ kvm_start_lightweight:
129 * R12 = exit handler id 129 * R12 = exit handler id
130 * R13 = PACA 130 * R13 = PACA
131 * SVCPU.* = guest * 131 * SVCPU.* = guest *
132 * MSR.EE = 1
132 * 133 *
133 */ 134 */
134 135
136 PPC_LL r3, GPR4(r1) /* vcpu pointer */
137
138 /*
139 * kvmppc_copy_from_svcpu can clobber volatile registers, save
140 * the exit handler id to the vcpu and restore it from there later.
141 */
142 stw r12, VCPU_TRAP(r3)
143
135 /* Transfer reg values from shadow vcpu back to vcpu struct */ 144 /* Transfer reg values from shadow vcpu back to vcpu struct */
136 /* On 64-bit, interrupts are still off at this point */ 145 /* On 64-bit, interrupts are still off at this point */
137 PPC_LL r3, GPR4(r1) /* vcpu pointer */ 146
138 GET_SHADOW_VCPU(r4) 147 GET_SHADOW_VCPU(r4)
139 bl FUNC(kvmppc_copy_from_svcpu) 148 bl FUNC(kvmppc_copy_from_svcpu)
140 nop 149 nop
141 150
142#ifdef CONFIG_PPC_BOOK3S_64 151#ifdef CONFIG_PPC_BOOK3S_64
143 /* Re-enable interrupts */
144 ld r3, HSTATE_HOST_MSR(r13)
145 ori r3, r3, MSR_EE
146 MTMSR_EERI(r3)
147
148 /* 152 /*
149 * Reload kernel SPRG3 value. 153 * Reload kernel SPRG3 value.
150 * No need to save guest value as usermode can't modify SPRG3. 154 * No need to save guest value as usermode can't modify SPRG3.
151 */ 155 */
152 ld r3, PACA_SPRG3(r13) 156 ld r3, PACA_SPRG3(r13)
153 mtspr SPRN_SPRG3, r3 157 mtspr SPRN_SPRG3, r3
154
155#endif /* CONFIG_PPC_BOOK3S_64 */ 158#endif /* CONFIG_PPC_BOOK3S_64 */
156 159
157 /* R7 = vcpu */ 160 /* R7 = vcpu */
@@ -177,7 +180,7 @@ kvm_start_lightweight:
177 PPC_STL r31, VCPU_GPR(R31)(r7) 180 PPC_STL r31, VCPU_GPR(R31)(r7)
178 181
179 /* Pass the exit number as 3rd argument to kvmppc_handle_exit */ 182 /* Pass the exit number as 3rd argument to kvmppc_handle_exit */
180 mr r5, r12 183 lwz r5, VCPU_TRAP(r7)
181 184
182 /* Restore r3 (kvm_run) and r4 (vcpu) */ 185 /* Restore r3 (kvm_run) and r4 (vcpu) */
183 REST_2GPRS(3, r1) 186 REST_2GPRS(3, r1)
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 6a5fc7d53de6..c5c052a9729c 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -67,6 +67,7 @@ static void kvmppc_core_vcpu_load_pr(struct kvm_vcpu *vcpu, int cpu)
67 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu); 67 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
68 memcpy(svcpu->slb, to_book3s(vcpu)->slb_shadow, sizeof(svcpu->slb)); 68 memcpy(svcpu->slb, to_book3s(vcpu)->slb_shadow, sizeof(svcpu->slb));
69 svcpu->slb_max = to_book3s(vcpu)->slb_shadow_max; 69 svcpu->slb_max = to_book3s(vcpu)->slb_shadow_max;
70 svcpu->in_use = 0;
70 svcpu_put(svcpu); 71 svcpu_put(svcpu);
71#endif 72#endif
72 vcpu->cpu = smp_processor_id(); 73 vcpu->cpu = smp_processor_id();
@@ -79,6 +80,9 @@ static void kvmppc_core_vcpu_put_pr(struct kvm_vcpu *vcpu)
79{ 80{
80#ifdef CONFIG_PPC_BOOK3S_64 81#ifdef CONFIG_PPC_BOOK3S_64
81 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu); 82 struct kvmppc_book3s_shadow_vcpu *svcpu = svcpu_get(vcpu);
83 if (svcpu->in_use) {
84 kvmppc_copy_from_svcpu(vcpu, svcpu);
85 }
82 memcpy(to_book3s(vcpu)->slb_shadow, svcpu->slb, sizeof(svcpu->slb)); 86 memcpy(to_book3s(vcpu)->slb_shadow, svcpu->slb, sizeof(svcpu->slb));
83 to_book3s(vcpu)->slb_shadow_max = svcpu->slb_max; 87 to_book3s(vcpu)->slb_shadow_max = svcpu->slb_max;
84 svcpu_put(svcpu); 88 svcpu_put(svcpu);
@@ -111,12 +115,26 @@ void kvmppc_copy_to_svcpu(struct kvmppc_book3s_shadow_vcpu *svcpu,
111 svcpu->ctr = vcpu->arch.ctr; 115 svcpu->ctr = vcpu->arch.ctr;
112 svcpu->lr = vcpu->arch.lr; 116 svcpu->lr = vcpu->arch.lr;
113 svcpu->pc = vcpu->arch.pc; 117 svcpu->pc = vcpu->arch.pc;
118 svcpu->in_use = true;
114} 119}
115 120
116/* Copy data touched by real-mode code from shadow vcpu back to vcpu */ 121/* Copy data touched by real-mode code from shadow vcpu back to vcpu */
117void kvmppc_copy_from_svcpu(struct kvm_vcpu *vcpu, 122void kvmppc_copy_from_svcpu(struct kvm_vcpu *vcpu,
118 struct kvmppc_book3s_shadow_vcpu *svcpu) 123 struct kvmppc_book3s_shadow_vcpu *svcpu)
119{ 124{
125 /*
126 * vcpu_put would just call us again because in_use hasn't
127 * been updated yet.
128 */
129 preempt_disable();
130
131 /*
132 * Maybe we were already preempted and synced the svcpu from
133 * our preempt notifiers. Don't bother touching this svcpu then.
134 */
135 if (!svcpu->in_use)
136 goto out;
137
120 vcpu->arch.gpr[0] = svcpu->gpr[0]; 138 vcpu->arch.gpr[0] = svcpu->gpr[0];
121 vcpu->arch.gpr[1] = svcpu->gpr[1]; 139 vcpu->arch.gpr[1] = svcpu->gpr[1];
122 vcpu->arch.gpr[2] = svcpu->gpr[2]; 140 vcpu->arch.gpr[2] = svcpu->gpr[2];
@@ -140,6 +158,10 @@ void kvmppc_copy_from_svcpu(struct kvm_vcpu *vcpu,
140 vcpu->arch.fault_dar = svcpu->fault_dar; 158 vcpu->arch.fault_dar = svcpu->fault_dar;
141 vcpu->arch.fault_dsisr = svcpu->fault_dsisr; 159 vcpu->arch.fault_dsisr = svcpu->fault_dsisr;
142 vcpu->arch.last_inst = svcpu->last_inst; 160 vcpu->arch.last_inst = svcpu->last_inst;
161 svcpu->in_use = false;
162
163out:
164 preempt_enable();
143} 165}
144 166
145static int kvmppc_core_check_requests_pr(struct kvm_vcpu *vcpu) 167static int kvmppc_core_check_requests_pr(struct kvm_vcpu *vcpu)
diff --git a/arch/powerpc/kvm/book3s_rmhandlers.S b/arch/powerpc/kvm/book3s_rmhandlers.S
index c78ffbc371a5..9eec675220e6 100644
--- a/arch/powerpc/kvm/book3s_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_rmhandlers.S
@@ -153,15 +153,11 @@ _GLOBAL(kvmppc_entry_trampoline)
153 153
154 li r6, MSR_IR | MSR_DR 154 li r6, MSR_IR | MSR_DR
155 andc r6, r5, r6 /* Clear DR and IR in MSR value */ 155 andc r6, r5, r6 /* Clear DR and IR in MSR value */
156#ifdef CONFIG_PPC_BOOK3S_32
157 /* 156 /*
158 * Set EE in HOST_MSR so that it's enabled when we get into our 157 * Set EE in HOST_MSR so that it's enabled when we get into our
159 * C exit handler function. On 64-bit we delay enabling 158 * C exit handler function.
160 * interrupts until we have finished transferring stuff
161 * to or from the PACA.
162 */ 159 */
163 ori r5, r5, MSR_EE 160 ori r5, r5, MSR_EE
164#endif
165 mtsrr0 r7 161 mtsrr0 r7
166 mtsrr1 r6 162 mtsrr1 r6
167 RFI 163 RFI
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 07b89c711898..ab62109fdfa3 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -681,7 +681,7 @@ int kvmppc_core_check_requests(struct kvm_vcpu *vcpu)
681int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) 681int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
682{ 682{
683 int ret, s; 683 int ret, s;
684 struct thread_struct thread; 684 struct debug_reg debug;
685 685
686 if (!vcpu->arch.sane) { 686 if (!vcpu->arch.sane) {
687 kvm_run->exit_reason = KVM_EXIT_INTERNAL_ERROR; 687 kvm_run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
@@ -711,9 +711,9 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
711#endif 711#endif
712 712
713 /* Switch to guest debug context */ 713 /* Switch to guest debug context */
714 thread.debug = vcpu->arch.shadow_dbg_reg; 714 debug = vcpu->arch.shadow_dbg_reg;
715 switch_booke_debug_regs(&thread); 715 switch_booke_debug_regs(&debug);
716 thread.debug = current->thread.debug; 716 debug = current->thread.debug;
717 current->thread.debug = vcpu->arch.shadow_dbg_reg; 717 current->thread.debug = vcpu->arch.shadow_dbg_reg;
718 718
719 vcpu->arch.pgdir = current->mm->pgd; 719 vcpu->arch.pgdir = current->mm->pgd;
@@ -725,8 +725,8 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
725 We also get here with interrupts enabled. */ 725 We also get here with interrupts enabled. */
726 726
727 /* Switch back to user space debug context */ 727 /* Switch back to user space debug context */
728 switch_booke_debug_regs(&thread); 728 switch_booke_debug_regs(&debug);
729 current->thread.debug = thread.debug; 729 current->thread.debug = debug;
730 730
731#ifdef CONFIG_PPC_FPU 731#ifdef CONFIG_PPC_FPU
732 kvmppc_save_guest_fp(vcpu); 732 kvmppc_save_guest_fp(vcpu);
diff --git a/arch/powerpc/lib/copyuser_64.S b/arch/powerpc/lib/copyuser_64.S
index d73a59014900..596a285c0755 100644
--- a/arch/powerpc/lib/copyuser_64.S
+++ b/arch/powerpc/lib/copyuser_64.S
@@ -9,6 +9,14 @@
9#include <asm/processor.h> 9#include <asm/processor.h>
10#include <asm/ppc_asm.h> 10#include <asm/ppc_asm.h>
11 11
12#ifdef __BIG_ENDIAN__
13#define sLd sld /* Shift towards low-numbered address. */
14#define sHd srd /* Shift towards high-numbered address. */
15#else
16#define sLd srd /* Shift towards low-numbered address. */
17#define sHd sld /* Shift towards high-numbered address. */
18#endif
19
12 .align 7 20 .align 7
13_GLOBAL(__copy_tofrom_user) 21_GLOBAL(__copy_tofrom_user)
14BEGIN_FTR_SECTION 22BEGIN_FTR_SECTION
@@ -118,10 +126,10 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
118 126
11924: ld r9,0(r4) /* 3+2n loads, 2+2n stores */ 12724: ld r9,0(r4) /* 3+2n loads, 2+2n stores */
12025: ld r0,8(r4) 12825: ld r0,8(r4)
121 sld r6,r9,r10 129 sLd r6,r9,r10
12226: ldu r9,16(r4) 13026: ldu r9,16(r4)
123 srd r7,r0,r11 131 sHd r7,r0,r11
124 sld r8,r0,r10 132 sLd r8,r0,r10
125 or r7,r7,r6 133 or r7,r7,r6
126 blt cr6,79f 134 blt cr6,79f
12727: ld r0,8(r4) 13527: ld r0,8(r4)
@@ -129,35 +137,35 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
129 137
13028: ld r0,0(r4) /* 4+2n loads, 3+2n stores */ 13828: ld r0,0(r4) /* 4+2n loads, 3+2n stores */
13129: ldu r9,8(r4) 13929: ldu r9,8(r4)
132 sld r8,r0,r10 140 sLd r8,r0,r10
133 addi r3,r3,-8 141 addi r3,r3,-8
134 blt cr6,5f 142 blt cr6,5f
13530: ld r0,8(r4) 14330: ld r0,8(r4)
136 srd r12,r9,r11 144 sHd r12,r9,r11
137 sld r6,r9,r10 145 sLd r6,r9,r10
13831: ldu r9,16(r4) 14631: ldu r9,16(r4)
139 or r12,r8,r12 147 or r12,r8,r12
140 srd r7,r0,r11 148 sHd r7,r0,r11
141 sld r8,r0,r10 149 sLd r8,r0,r10
142 addi r3,r3,16 150 addi r3,r3,16
143 beq cr6,78f 151 beq cr6,78f
144 152
1451: or r7,r7,r6 1531: or r7,r7,r6
14632: ld r0,8(r4) 15432: ld r0,8(r4)
14776: std r12,8(r3) 15576: std r12,8(r3)
1482: srd r12,r9,r11 1562: sHd r12,r9,r11
149 sld r6,r9,r10 157 sLd r6,r9,r10
15033: ldu r9,16(r4) 15833: ldu r9,16(r4)
151 or r12,r8,r12 159 or r12,r8,r12
15277: stdu r7,16(r3) 16077: stdu r7,16(r3)
153 srd r7,r0,r11 161 sHd r7,r0,r11
154 sld r8,r0,r10 162 sLd r8,r0,r10
155 bdnz 1b 163 bdnz 1b
156 164
15778: std r12,8(r3) 16578: std r12,8(r3)
158 or r7,r7,r6 166 or r7,r7,r6
15979: std r7,16(r3) 16779: std r7,16(r3)
1605: srd r12,r9,r11 1685: sHd r12,r9,r11
161 or r12,r8,r12 169 or r12,r8,r12
16280: std r12,24(r3) 17080: std r12,24(r3)
163 bne 6f 171 bne 6f
@@ -165,23 +173,38 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD)
165 blr 173 blr
1666: cmpwi cr1,r5,8 1746: cmpwi cr1,r5,8
167 addi r3,r3,32 175 addi r3,r3,32
168 sld r9,r9,r10 176 sLd r9,r9,r10
169 ble cr1,7f 177 ble cr1,7f
17034: ld r0,8(r4) 17834: ld r0,8(r4)
171 srd r7,r0,r11 179 sHd r7,r0,r11
172 or r9,r7,r9 180 or r9,r7,r9
1737: 1817:
174 bf cr7*4+1,1f 182 bf cr7*4+1,1f
183#ifdef __BIG_ENDIAN__
175 rotldi r9,r9,32 184 rotldi r9,r9,32
185#endif
17694: stw r9,0(r3) 18694: stw r9,0(r3)
187#ifdef __LITTLE_ENDIAN__
188 rotrdi r9,r9,32
189#endif
177 addi r3,r3,4 190 addi r3,r3,4
1781: bf cr7*4+2,2f 1911: bf cr7*4+2,2f
192#ifdef __BIG_ENDIAN__
179 rotldi r9,r9,16 193 rotldi r9,r9,16
194#endif
18095: sth r9,0(r3) 19595: sth r9,0(r3)
196#ifdef __LITTLE_ENDIAN__
197 rotrdi r9,r9,16
198#endif
181 addi r3,r3,2 199 addi r3,r3,2
1822: bf cr7*4+3,3f 2002: bf cr7*4+3,3f
201#ifdef __BIG_ENDIAN__
183 rotldi r9,r9,8 202 rotldi r9,r9,8
203#endif
18496: stb r9,0(r3) 20496: stb r9,0(r3)
205#ifdef __LITTLE_ENDIAN__
206 rotrdi r9,r9,8
207#endif
1853: li r3,0 2083: li r3,0
186 blr 209 blr
187 210
diff --git a/arch/powerpc/mm/gup.c b/arch/powerpc/mm/gup.c
index 6936547018b8..c5f734e20b0f 100644
--- a/arch/powerpc/mm/gup.c
+++ b/arch/powerpc/mm/gup.c
@@ -123,6 +123,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
123 struct mm_struct *mm = current->mm; 123 struct mm_struct *mm = current->mm;
124 unsigned long addr, len, end; 124 unsigned long addr, len, end;
125 unsigned long next; 125 unsigned long next;
126 unsigned long flags;
126 pgd_t *pgdp; 127 pgd_t *pgdp;
127 int nr = 0; 128 int nr = 0;
128 129
@@ -156,7 +157,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
156 * So long as we atomically load page table pointers versus teardown, 157 * So long as we atomically load page table pointers versus teardown,
157 * we can follow the address down to the the page and take a ref on it. 158 * we can follow the address down to the the page and take a ref on it.
158 */ 159 */
159 local_irq_disable(); 160 local_irq_save(flags);
160 161
161 pgdp = pgd_offset(mm, addr); 162 pgdp = pgd_offset(mm, addr);
162 do { 163 do {
@@ -179,7 +180,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
179 break; 180 break;
180 } while (pgdp++, addr = next, addr != end); 181 } while (pgdp++, addr = next, addr != end);
181 182
182 local_irq_enable(); 183 local_irq_restore(flags);
183 184
184 return nr; 185 return nr;
185} 186}
diff --git a/arch/powerpc/mm/hugetlbpage-book3e.c b/arch/powerpc/mm/hugetlbpage-book3e.c
index 3bc700655fc8..74551b5e41e5 100644
--- a/arch/powerpc/mm/hugetlbpage-book3e.c
+++ b/arch/powerpc/mm/hugetlbpage-book3e.c
@@ -117,6 +117,5 @@ void flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
117 struct hstate *hstate = hstate_file(vma->vm_file); 117 struct hstate *hstate = hstate_file(vma->vm_file);
118 unsigned long tsize = huge_page_shift(hstate) - 10; 118 unsigned long tsize = huge_page_shift(hstate) - 10;
119 119
120 __flush_tlb_page(vma ? vma->vm_mm : NULL, vmaddr, tsize, 0); 120 __flush_tlb_page(vma->vm_mm, vmaddr, tsize, 0);
121
122} 121}
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 3fa93dc7fe75..8c1dd23652a1 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -209,7 +209,7 @@ void __init do_init_bootmem(void)
209 /* Place all memblock_regions in the same node and merge contiguous 209 /* Place all memblock_regions in the same node and merge contiguous
210 * memblock_regions 210 * memblock_regions
211 */ 211 */
212 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0); 212 memblock_set_node(0, (phys_addr_t)ULLONG_MAX, &memblock.memory, 0);
213 213
214 /* Add all physical memory to the bootmem map, mark each area 214 /* Add all physical memory to the bootmem map, mark each area
215 * present. 215 * present.
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 078d3e00a616..5a944f25e94f 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -670,7 +670,8 @@ static void __init parse_drconf_memory(struct device_node *memory)
670 node_set_online(nid); 670 node_set_online(nid);
671 sz = numa_enforce_memory_limit(base, size); 671 sz = numa_enforce_memory_limit(base, size);
672 if (sz) 672 if (sz)
673 memblock_set_node(base, sz, nid); 673 memblock_set_node(base, sz,
674 &memblock.memory, nid);
674 } while (--ranges); 675 } while (--ranges);
675 } 676 }
676} 677}
@@ -760,7 +761,7 @@ new_range:
760 continue; 761 continue;
761 } 762 }
762 763
763 memblock_set_node(start, size, nid); 764 memblock_set_node(start, size, &memblock.memory, nid);
764 765
765 if (--ranges) 766 if (--ranges)
766 goto new_range; 767 goto new_range;
@@ -797,7 +798,8 @@ static void __init setup_nonnuma(void)
797 798
798 fake_numa_create_new_node(end_pfn, &nid); 799 fake_numa_create_new_node(end_pfn, &nid);
799 memblock_set_node(PFN_PHYS(start_pfn), 800 memblock_set_node(PFN_PHYS(start_pfn),
800 PFN_PHYS(end_pfn - start_pfn), nid); 801 PFN_PHYS(end_pfn - start_pfn),
802 &memblock.memory, nid);
801 node_set_online(nid); 803 node_set_online(nid);
802 } 804 }
803} 805}
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index 3e99c149271a..7ce9cf3b6988 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -258,7 +258,7 @@ static bool slice_scan_available(unsigned long addr,
258 slice = GET_HIGH_SLICE_INDEX(addr); 258 slice = GET_HIGH_SLICE_INDEX(addr);
259 *boundary_addr = (slice + end) ? 259 *boundary_addr = (slice + end) ?
260 ((slice + end) << SLICE_HIGH_SHIFT) : SLICE_LOW_TOP; 260 ((slice + end) << SLICE_HIGH_SHIFT) : SLICE_LOW_TOP;
261 return !!(available.high_slices & (1u << slice)); 261 return !!(available.high_slices & (1ul << slice));
262 } 262 }
263} 263}
264 264
diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c
index 41cd68dee681..358d74303138 100644
--- a/arch/powerpc/mm/tlb_nohash.c
+++ b/arch/powerpc/mm/tlb_nohash.c
@@ -305,7 +305,7 @@ void __flush_tlb_page(struct mm_struct *mm, unsigned long vmaddr,
305void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr) 305void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
306{ 306{
307#ifdef CONFIG_HUGETLB_PAGE 307#ifdef CONFIG_HUGETLB_PAGE
308 if (is_vm_hugetlb_page(vma)) 308 if (vma && is_vm_hugetlb_page(vma))
309 flush_hugetlb_page(vma, vmaddr); 309 flush_hugetlb_page(vma, vmaddr);
310#endif 310#endif
311 311
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index ac3c2a10dafd..555034f8505e 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -223,10 +223,11 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image,
223 } 223 }
224 PPC_DIVWU(r_A, r_A, r_X); 224 PPC_DIVWU(r_A, r_A, r_X);
225 break; 225 break;
226 case BPF_S_ALU_DIV_K: /* A = reciprocal_divide(A, K); */ 226 case BPF_S_ALU_DIV_K: /* A /= K */
227 if (K == 1)
228 break;
227 PPC_LI32(r_scratch1, K); 229 PPC_LI32(r_scratch1, K);
228 /* Top 32 bits of 64bit result -> A */ 230 PPC_DIVWU(r_A, r_A, r_scratch1);
229 PPC_MULHWU(r_A, r_A, r_scratch1);
230 break; 231 break;
231 case BPF_S_ALU_AND_X: 232 case BPF_S_ALU_AND_X:
232 ctx->seen |= SEEN_XREG; 233 ctx->seen |= SEEN_XREG;
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
index be7b1aa4d54c..37f7a89c10f2 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
@@ -245,7 +245,7 @@ static irqreturn_t mpc52xx_lpbfifo_irq(int irq, void *dev_id)
245 245
246 if (dma && !write) { 246 if (dma && !write) {
247 spin_unlock_irqrestore(&lpbfifo.lock, flags); 247 spin_unlock_irqrestore(&lpbfifo.lock, flags);
248 pr_err("bogus LPBFIFO IRQ (dma and not writting)\n"); 248 pr_err("bogus LPBFIFO IRQ (dma and not writing)\n");
249 return IRQ_HANDLED; 249 return IRQ_HANDLED;
250 } 250 }
251 251
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index c2a566fb8bb8..bca2465a9c34 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -403,3 +403,28 @@ config PPC_DOORBELL
403 default n 403 default n
404 404
405endmenu 405endmenu
406
407choice
408 prompt "Endianness selection"
409 default CPU_BIG_ENDIAN
410 help
411 This option selects whether a big endian or little endian kernel will
412 be built.
413
414config CPU_BIG_ENDIAN
415 bool "Build big endian kernel"
416 help
417 Build a big endian kernel.
418
419 If unsure, select this option.
420
421config CPU_LITTLE_ENDIAN
422 bool "Build little endian kernel"
423 help
424 Build a little endian kernel.
425
426 Note that if cross compiling a little endian kernel,
427 CROSS_COMPILE must point to a toolchain capable of targeting
428 little endian powerpc.
429
430endchoice
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c
index 02245cee7818..d7ddcee7feb8 100644
--- a/arch/powerpc/platforms/powernv/eeh-ioda.c
+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
@@ -36,7 +36,6 @@
36#include "powernv.h" 36#include "powernv.h"
37#include "pci.h" 37#include "pci.h"
38 38
39static char *hub_diag = NULL;
40static int ioda_eeh_nb_init = 0; 39static int ioda_eeh_nb_init = 0;
41 40
42static int ioda_eeh_event(struct notifier_block *nb, 41static int ioda_eeh_event(struct notifier_block *nb,
@@ -140,15 +139,6 @@ static int ioda_eeh_post_init(struct pci_controller *hose)
140 ioda_eeh_nb_init = 1; 139 ioda_eeh_nb_init = 1;
141 } 140 }
142 141
143 /* We needn't HUB diag-data on PHB3 */
144 if (phb->type == PNV_PHB_IODA1 && !hub_diag) {
145 hub_diag = (char *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
146 if (!hub_diag) {
147 pr_err("%s: Out of memory !\n", __func__);
148 return -ENOMEM;
149 }
150 }
151
152#ifdef CONFIG_DEBUG_FS 142#ifdef CONFIG_DEBUG_FS
153 if (phb->dbgfs) { 143 if (phb->dbgfs) {
154 debugfs_create_file("err_injct_outbound", 0600, 144 debugfs_create_file("err_injct_outbound", 0600,
@@ -633,11 +623,10 @@ static void ioda_eeh_hub_diag_common(struct OpalIoP7IOCErrorData *data)
633static void ioda_eeh_hub_diag(struct pci_controller *hose) 623static void ioda_eeh_hub_diag(struct pci_controller *hose)
634{ 624{
635 struct pnv_phb *phb = hose->private_data; 625 struct pnv_phb *phb = hose->private_data;
636 struct OpalIoP7IOCErrorData *data; 626 struct OpalIoP7IOCErrorData *data = &phb->diag.hub_diag;
637 long rc; 627 long rc;
638 628
639 data = (struct OpalIoP7IOCErrorData *)ioda_eeh_hub_diag; 629 rc = opal_pci_get_hub_diag_data(phb->hub_id, data, sizeof(*data));
640 rc = opal_pci_get_hub_diag_data(phb->hub_id, data, PAGE_SIZE);
641 if (rc != OPAL_SUCCESS) { 630 if (rc != OPAL_SUCCESS) {
642 pr_warning("%s: Failed to get HUB#%llx diag-data (%ld)\n", 631 pr_warning("%s: Failed to get HUB#%llx diag-data (%ld)\n",
643 __func__, phb->hub_id, rc); 632 __func__, phb->hub_id, rc);
@@ -820,14 +809,15 @@ static void ioda_eeh_phb_diag(struct pci_controller *hose)
820 struct OpalIoPhbErrorCommon *common; 809 struct OpalIoPhbErrorCommon *common;
821 long rc; 810 long rc;
822 811
823 common = (struct OpalIoPhbErrorCommon *)phb->diag.blob; 812 rc = opal_pci_get_phb_diag_data2(phb->opal_id, phb->diag.blob,
824 rc = opal_pci_get_phb_diag_data2(phb->opal_id, common, PAGE_SIZE); 813 PNV_PCI_DIAG_BUF_SIZE);
825 if (rc != OPAL_SUCCESS) { 814 if (rc != OPAL_SUCCESS) {
826 pr_warning("%s: Failed to get diag-data for PHB#%x (%ld)\n", 815 pr_warning("%s: Failed to get diag-data for PHB#%x (%ld)\n",
827 __func__, hose->global_number, rc); 816 __func__, hose->global_number, rc);
828 return; 817 return;
829 } 818 }
830 819
820 common = (struct OpalIoPhbErrorCommon *)phb->diag.blob;
831 switch (common->ioType) { 821 switch (common->ioType) {
832 case OPAL_PHB_ERROR_DATA_TYPE_P7IOC: 822 case OPAL_PHB_ERROR_DATA_TYPE_P7IOC:
833 ioda_eeh_p7ioc_phb_diag(hose, common); 823 ioda_eeh_p7ioc_phb_diag(hose, common);
diff --git a/arch/powerpc/platforms/powernv/opal-flash.c b/arch/powerpc/platforms/powernv/opal-flash.c
index 6ffa6b1ec5b7..d8773079ce19 100644
--- a/arch/powerpc/platforms/powernv/opal-flash.c
+++ b/arch/powerpc/platforms/powernv/opal-flash.c
@@ -126,7 +126,7 @@ struct opal_sg_list {
126 126
127struct validate_flash_t { 127struct validate_flash_t {
128 int status; /* Return status */ 128 int status; /* Return status */
129 void *buf; /* Candiate image buffer */ 129 void *buf; /* Candidate image buffer */
130 uint32_t buf_size; /* Image size */ 130 uint32_t buf_size; /* Image size */
131 uint32_t result; /* Update results token */ 131 uint32_t result; /* Update results token */
132}; 132};
@@ -500,7 +500,7 @@ static int alloc_image_buf(char *buffer, size_t count)
500 500
501 memcpy(&image_header, (void *)buffer, sizeof(struct image_header_t)); 501 memcpy(&image_header, (void *)buffer, sizeof(struct image_header_t));
502 image_data.size = be32_to_cpu(image_header.size); 502 image_data.size = be32_to_cpu(image_header.size);
503 pr_debug("FLASH: Candiate image size = %u\n", image_data.size); 503 pr_debug("FLASH: Candidate image size = %u\n", image_data.size);
504 504
505 if (image_data.size > MAX_IMAGE_SIZE) { 505 if (image_data.size > MAX_IMAGE_SIZE) {
506 pr_warn("FLASH: Too large image\n"); 506 pr_warn("FLASH: Too large image\n");
diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c
index e7e59e4f9892..79d83cad3d67 100644
--- a/arch/powerpc/platforms/powernv/opal-lpc.c
+++ b/arch/powerpc/platforms/powernv/opal-lpc.c
@@ -24,25 +24,25 @@ static int opal_lpc_chip_id = -1;
24static u8 opal_lpc_inb(unsigned long port) 24static u8 opal_lpc_inb(unsigned long port)
25{ 25{
26 int64_t rc; 26 int64_t rc;
27 uint32_t data; 27 __be32 data;
28 28
29 if (opal_lpc_chip_id < 0 || port > 0xffff) 29 if (opal_lpc_chip_id < 0 || port > 0xffff)
30 return 0xff; 30 return 0xff;
31 rc = opal_lpc_read(opal_lpc_chip_id, OPAL_LPC_IO, port, &data, 1); 31 rc = opal_lpc_read(opal_lpc_chip_id, OPAL_LPC_IO, port, &data, 1);
32 return rc ? 0xff : data; 32 return rc ? 0xff : be32_to_cpu(data);
33} 33}
34 34
35static __le16 __opal_lpc_inw(unsigned long port) 35static __le16 __opal_lpc_inw(unsigned long port)
36{ 36{
37 int64_t rc; 37 int64_t rc;
38 uint32_t data; 38 __be32 data;
39 39
40 if (opal_lpc_chip_id < 0 || port > 0xfffe) 40 if (opal_lpc_chip_id < 0 || port > 0xfffe)
41 return 0xffff; 41 return 0xffff;
42 if (port & 1) 42 if (port & 1)
43 return (__le16)opal_lpc_inb(port) << 8 | opal_lpc_inb(port + 1); 43 return (__le16)opal_lpc_inb(port) << 8 | opal_lpc_inb(port + 1);
44 rc = opal_lpc_read(opal_lpc_chip_id, OPAL_LPC_IO, port, &data, 2); 44 rc = opal_lpc_read(opal_lpc_chip_id, OPAL_LPC_IO, port, &data, 2);
45 return rc ? 0xffff : data; 45 return rc ? 0xffff : be32_to_cpu(data);
46} 46}
47static u16 opal_lpc_inw(unsigned long port) 47static u16 opal_lpc_inw(unsigned long port)
48{ 48{
@@ -52,7 +52,7 @@ static u16 opal_lpc_inw(unsigned long port)
52static __le32 __opal_lpc_inl(unsigned long port) 52static __le32 __opal_lpc_inl(unsigned long port)
53{ 53{
54 int64_t rc; 54 int64_t rc;
55 uint32_t data; 55 __be32 data;
56 56
57 if (opal_lpc_chip_id < 0 || port > 0xfffc) 57 if (opal_lpc_chip_id < 0 || port > 0xfffc)
58 return 0xffffffff; 58 return 0xffffffff;
@@ -62,7 +62,7 @@ static __le32 __opal_lpc_inl(unsigned long port)
62 (__le32)opal_lpc_inb(port + 2) << 8 | 62 (__le32)opal_lpc_inb(port + 2) << 8 |
63 opal_lpc_inb(port + 3); 63 opal_lpc_inb(port + 3);
64 rc = opal_lpc_read(opal_lpc_chip_id, OPAL_LPC_IO, port, &data, 4); 64 rc = opal_lpc_read(opal_lpc_chip_id, OPAL_LPC_IO, port, &data, 4);
65 return rc ? 0xffffffff : data; 65 return rc ? 0xffffffff : be32_to_cpu(data);
66} 66}
67 67
68static u32 opal_lpc_inl(unsigned long port) 68static u32 opal_lpc_inl(unsigned long port)
diff --git a/arch/powerpc/platforms/powernv/opal-xscom.c b/arch/powerpc/platforms/powernv/opal-xscom.c
index 4d99a8fd55ac..4fbf276ac99e 100644
--- a/arch/powerpc/platforms/powernv/opal-xscom.c
+++ b/arch/powerpc/platforms/powernv/opal-xscom.c
@@ -96,9 +96,11 @@ static int opal_scom_read(scom_map_t map, u64 reg, u64 *value)
96{ 96{
97 struct opal_scom_map *m = map; 97 struct opal_scom_map *m = map;
98 int64_t rc; 98 int64_t rc;
99 __be64 v;
99 100
100 reg = opal_scom_unmangle(reg); 101 reg = opal_scom_unmangle(reg);
101 rc = opal_xscom_read(m->chip, m->addr + reg, (uint64_t *)__pa(value)); 102 rc = opal_xscom_read(m->chip, m->addr + reg, (__be64 *)__pa(&v));
103 *value = be64_to_cpu(v);
102 return opal_xscom_err_xlate(rc); 104 return opal_xscom_err_xlate(rc);
103} 105}
104 106
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 084cdfa40682..2c6d173842b2 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -720,6 +720,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb,
720 tbl->it_type = TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE; 720 tbl->it_type = TCE_PCI_SWINV_CREATE | TCE_PCI_SWINV_FREE;
721 } 721 }
722 iommu_init_table(tbl, phb->hose->node); 722 iommu_init_table(tbl, phb->hose->node);
723 iommu_register_group(tbl, pci_domain_nr(pe->pbus), pe->pe_number);
723 724
724 if (pe->pdev) 725 if (pe->pdev)
725 set_iommu_table_base(&pe->pdev->dev, tbl); 726 set_iommu_table_base(&pe->pdev->dev, tbl);
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index 911c24ef033e..1ed8d5f40f5a 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -172,11 +172,13 @@ struct pnv_phb {
172 } ioda; 172 } ioda;
173 }; 173 };
174 174
175 /* PHB status structure */ 175 /* PHB and hub status structure */
176 union { 176 union {
177 unsigned char blob[PNV_PCI_DIAG_BUF_SIZE]; 177 unsigned char blob[PNV_PCI_DIAG_BUF_SIZE];
178 struct OpalIoP7IOCPhbErrorData p7ioc; 178 struct OpalIoP7IOCPhbErrorData p7ioc;
179 struct OpalIoP7IOCErrorData hub_diag;
179 } diag; 180 } diag;
181
180}; 182};
181 183
182extern struct pci_ops pnv_pci_ops; 184extern struct pci_ops pnv_pci_ops;
diff --git a/arch/powerpc/platforms/powernv/rng.c b/arch/powerpc/platforms/powernv/rng.c
index 8844628915dc..1cb160dc1609 100644
--- a/arch/powerpc/platforms/powernv/rng.c
+++ b/arch/powerpc/platforms/powernv/rng.c
@@ -19,6 +19,7 @@
19#include <asm/io.h> 19#include <asm/io.h>
20#include <asm/prom.h> 20#include <asm/prom.h>
21#include <asm/machdep.h> 21#include <asm/machdep.h>
22#include <asm/smp.h>
22 23
23 24
24struct powernv_rng { 25struct powernv_rng {
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/lparcfg.c b/arch/powerpc/platforms/pseries/lparcfg.c
index e738007eae64..c9fecf09b8fa 100644
--- a/arch/powerpc/platforms/pseries/lparcfg.c
+++ b/arch/powerpc/platforms/pseries/lparcfg.c
@@ -157,7 +157,7 @@ static void parse_ppp_data(struct seq_file *m)
157{ 157{
158 struct hvcall_ppp_data ppp_data; 158 struct hvcall_ppp_data ppp_data;
159 struct device_node *root; 159 struct device_node *root;
160 const int *perf_level; 160 const __be32 *perf_level;
161 int rc; 161 int rc;
162 162
163 rc = h_get_ppp(&ppp_data); 163 rc = h_get_ppp(&ppp_data);
@@ -201,7 +201,7 @@ static void parse_ppp_data(struct seq_file *m)
201 perf_level = of_get_property(root, 201 perf_level = of_get_property(root,
202 "ibm,partition-performance-parameters-level", 202 "ibm,partition-performance-parameters-level",
203 NULL); 203 NULL);
204 if (perf_level && (*perf_level >= 1)) { 204 if (perf_level && (be32_to_cpup(perf_level) >= 1)) {
205 seq_printf(m, 205 seq_printf(m,
206 "physical_procs_allocated_to_virtualization=%d\n", 206 "physical_procs_allocated_to_virtualization=%d\n",
207 ppp_data.phys_platform_procs); 207 ppp_data.phys_platform_procs);
@@ -435,7 +435,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
435 int partition_potential_processors; 435 int partition_potential_processors;
436 int partition_active_processors; 436 int partition_active_processors;
437 struct device_node *rtas_node; 437 struct device_node *rtas_node;
438 const int *lrdrp = NULL; 438 const __be32 *lrdrp = NULL;
439 439
440 rtas_node = of_find_node_by_path("/rtas"); 440 rtas_node = of_find_node_by_path("/rtas");
441 if (rtas_node) 441 if (rtas_node)
@@ -444,7 +444,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
444 if (lrdrp == NULL) { 444 if (lrdrp == NULL) {
445 partition_potential_processors = vdso_data->processorCount; 445 partition_potential_processors = vdso_data->processorCount;
446 } else { 446 } else {
447 partition_potential_processors = *(lrdrp + 4); 447 partition_potential_processors = be32_to_cpup(lrdrp + 4);
448 } 448 }
449 of_node_put(rtas_node); 449 of_node_put(rtas_node);
450 450
@@ -654,7 +654,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
654 const char *model = ""; 654 const char *model = "";
655 const char *system_id = ""; 655 const char *system_id = "";
656 const char *tmp; 656 const char *tmp;
657 const unsigned int *lp_index_ptr; 657 const __be32 *lp_index_ptr;
658 unsigned int lp_index = 0; 658 unsigned int lp_index = 0;
659 659
660 seq_printf(m, "%s %s\n", MODULE_NAME, MODULE_VERS); 660 seq_printf(m, "%s %s\n", MODULE_NAME, MODULE_VERS);
@@ -670,7 +670,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
670 lp_index_ptr = of_get_property(rootdn, "ibm,partition-no", 670 lp_index_ptr = of_get_property(rootdn, "ibm,partition-no",
671 NULL); 671 NULL);
672 if (lp_index_ptr) 672 if (lp_index_ptr)
673 lp_index = *lp_index_ptr; 673 lp_index = be32_to_cpup(lp_index_ptr);
674 of_node_put(rootdn); 674 of_node_put(rootdn);
675 } 675 }
676 seq_printf(m, "serial_number=%s\n", system_id); 676 seq_printf(m, "serial_number=%s\n", system_id);
diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c
index 6d2f0abce6fa..0c882e83c4ce 100644
--- a/arch/powerpc/platforms/pseries/msi.c
+++ b/arch/powerpc/platforms/pseries/msi.c
@@ -130,7 +130,8 @@ static int check_req(struct pci_dev *pdev, int nvec, char *prop_name)
130{ 130{
131 struct device_node *dn; 131 struct device_node *dn;
132 struct pci_dn *pdn; 132 struct pci_dn *pdn;
133 const u32 *req_msi; 133 const __be32 *p;
134 u32 req_msi;
134 135
135 pdn = pci_get_pdn(pdev); 136 pdn = pci_get_pdn(pdev);
136 if (!pdn) 137 if (!pdn)
@@ -138,19 +139,20 @@ static int check_req(struct pci_dev *pdev, int nvec, char *prop_name)
138 139
139 dn = pdn->node; 140 dn = pdn->node;
140 141
141 req_msi = of_get_property(dn, prop_name, NULL); 142 p = of_get_property(dn, prop_name, NULL);
142 if (!req_msi) { 143 if (!p) {
143 pr_debug("rtas_msi: No %s on %s\n", prop_name, dn->full_name); 144 pr_debug("rtas_msi: No %s on %s\n", prop_name, dn->full_name);
144 return -ENOENT; 145 return -ENOENT;
145 } 146 }
146 147
147 if (*req_msi < nvec) { 148 req_msi = be32_to_cpup(p);
149 if (req_msi < nvec) {
148 pr_debug("rtas_msi: %s requests < %d MSIs\n", prop_name, nvec); 150 pr_debug("rtas_msi: %s requests < %d MSIs\n", prop_name, nvec);
149 151
150 if (*req_msi == 0) /* Be paranoid */ 152 if (req_msi == 0) /* Be paranoid */
151 return -ENOSPC; 153 return -ENOSPC;
152 154
153 return *req_msi; 155 return req_msi;
154 } 156 }
155 157
156 return 0; 158 return 0;
@@ -171,7 +173,7 @@ static int check_req_msix(struct pci_dev *pdev, int nvec)
171static struct device_node *find_pe_total_msi(struct pci_dev *dev, int *total) 173static struct device_node *find_pe_total_msi(struct pci_dev *dev, int *total)
172{ 174{
173 struct device_node *dn; 175 struct device_node *dn;
174 const u32 *p; 176 const __be32 *p;
175 177
176 dn = of_node_get(pci_device_to_OF_node(dev)); 178 dn = of_node_get(pci_device_to_OF_node(dev));
177 while (dn) { 179 while (dn) {
@@ -179,7 +181,7 @@ static struct device_node *find_pe_total_msi(struct pci_dev *dev, int *total)
179 if (p) { 181 if (p) {
180 pr_debug("rtas_msi: found prop on dn %s\n", 182 pr_debug("rtas_msi: found prop on dn %s\n",
181 dn->full_name); 183 dn->full_name);
182 *total = *p; 184 *total = be32_to_cpup(p);
183 return dn; 185 return dn;
184 } 186 }
185 187
@@ -232,13 +234,13 @@ struct msi_counts {
232static void *count_non_bridge_devices(struct device_node *dn, void *data) 234static void *count_non_bridge_devices(struct device_node *dn, void *data)
233{ 235{
234 struct msi_counts *counts = data; 236 struct msi_counts *counts = data;
235 const u32 *p; 237 const __be32 *p;
236 u32 class; 238 u32 class;
237 239
238 pr_debug("rtas_msi: counting %s\n", dn->full_name); 240 pr_debug("rtas_msi: counting %s\n", dn->full_name);
239 241
240 p = of_get_property(dn, "class-code", NULL); 242 p = of_get_property(dn, "class-code", NULL);
241 class = p ? *p : 0; 243 class = p ? be32_to_cpup(p) : 0;
242 244
243 if ((class >> 8) != PCI_CLASS_BRIDGE_PCI) 245 if ((class >> 8) != PCI_CLASS_BRIDGE_PCI)
244 counts->num_devices++; 246 counts->num_devices++;
@@ -249,7 +251,7 @@ static void *count_non_bridge_devices(struct device_node *dn, void *data)
249static void *count_spare_msis(struct device_node *dn, void *data) 251static void *count_spare_msis(struct device_node *dn, void *data)
250{ 252{
251 struct msi_counts *counts = data; 253 struct msi_counts *counts = data;
252 const u32 *p; 254 const __be32 *p;
253 int req; 255 int req;
254 256
255 if (dn == counts->requestor) 257 if (dn == counts->requestor)
@@ -260,11 +262,11 @@ static void *count_spare_msis(struct device_node *dn, void *data)
260 req = 0; 262 req = 0;
261 p = of_get_property(dn, "ibm,req#msi", NULL); 263 p = of_get_property(dn, "ibm,req#msi", NULL);
262 if (p) 264 if (p)
263 req = *p; 265 req = be32_to_cpup(p);
264 266
265 p = of_get_property(dn, "ibm,req#msi-x", NULL); 267 p = of_get_property(dn, "ibm,req#msi-x", NULL);
266 if (p) 268 if (p)
267 req = max(req, (int)*p); 269 req = max(req, (int)be32_to_cpup(p));
268 } 270 }
269 271
270 if (req < counts->quota) 272 if (req < counts->quota)
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index 057fc894be51..d7096f2f7751 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -31,7 +31,7 @@
31#define NVRW_CNT 0x20 31#define NVRW_CNT 0x20
32 32
33/* 33/*
34 * Set oops header version to distingush between old and new format header. 34 * Set oops header version to distinguish between old and new format header.
35 * lnx,oops-log partition max size is 4000, header version > 4000 will 35 * lnx,oops-log partition max size is 4000, header version > 4000 will
36 * help in identifying new header. 36 * help in identifying new header.
37 */ 37 */
@@ -43,8 +43,8 @@ static char nvram_buf[NVRW_CNT]; /* assume this is in the first 4GB */
43static DEFINE_SPINLOCK(nvram_lock); 43static DEFINE_SPINLOCK(nvram_lock);
44 44
45struct err_log_info { 45struct err_log_info {
46 int error_type; 46 __be32 error_type;
47 unsigned int seq_num; 47 __be32 seq_num;
48}; 48};
49 49
50struct nvram_os_partition { 50struct nvram_os_partition {
@@ -79,9 +79,9 @@ static const char *pseries_nvram_os_partitions[] = {
79}; 79};
80 80
81struct oops_log_info { 81struct oops_log_info {
82 u16 version; 82 __be16 version;
83 u16 report_length; 83 __be16 report_length;
84 u64 timestamp; 84 __be64 timestamp;
85} __attribute__((packed)); 85} __attribute__((packed));
86 86
87static void oops_to_nvram(struct kmsg_dumper *dumper, 87static void oops_to_nvram(struct kmsg_dumper *dumper,
@@ -291,8 +291,8 @@ int nvram_write_os_partition(struct nvram_os_partition *part, char * buff,
291 length = part->size; 291 length = part->size;
292 } 292 }
293 293
294 info.error_type = err_type; 294 info.error_type = cpu_to_be32(err_type);
295 info.seq_num = error_log_cnt; 295 info.seq_num = cpu_to_be32(error_log_cnt);
296 296
297 tmp_index = part->index; 297 tmp_index = part->index;
298 298
@@ -364,8 +364,8 @@ int nvram_read_partition(struct nvram_os_partition *part, char *buff,
364 } 364 }
365 365
366 if (part->os_partition) { 366 if (part->os_partition) {
367 *error_log_cnt = info.seq_num; 367 *error_log_cnt = be32_to_cpu(info.seq_num);
368 *err_type = info.error_type; 368 *err_type = be32_to_cpu(info.error_type);
369 } 369 }
370 370
371 return 0; 371 return 0;
@@ -529,9 +529,9 @@ static int zip_oops(size_t text_len)
529 pr_err("nvram: logging uncompressed oops/panic report\n"); 529 pr_err("nvram: logging uncompressed oops/panic report\n");
530 return -1; 530 return -1;
531 } 531 }
532 oops_hdr->version = OOPS_HDR_VERSION; 532 oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION);
533 oops_hdr->report_length = (u16) zipped_len; 533 oops_hdr->report_length = cpu_to_be16(zipped_len);
534 oops_hdr->timestamp = get_seconds(); 534 oops_hdr->timestamp = cpu_to_be64(get_seconds());
535 return 0; 535 return 0;
536} 536}
537 537
@@ -574,9 +574,9 @@ static int nvram_pstore_write(enum pstore_type_id type,
574 clobbering_unread_rtas_event()) 574 clobbering_unread_rtas_event())
575 return -1; 575 return -1;
576 576
577 oops_hdr->version = OOPS_HDR_VERSION; 577 oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION);
578 oops_hdr->report_length = (u16) size; 578 oops_hdr->report_length = cpu_to_be16(size);
579 oops_hdr->timestamp = get_seconds(); 579 oops_hdr->timestamp = cpu_to_be64(get_seconds());
580 580
581 if (compressed) 581 if (compressed)
582 err_type = ERR_TYPE_KERNEL_PANIC_GZ; 582 err_type = ERR_TYPE_KERNEL_PANIC_GZ;
@@ -670,16 +670,16 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
670 size_t length, hdr_size; 670 size_t length, hdr_size;
671 671
672 oops_hdr = (struct oops_log_info *)buff; 672 oops_hdr = (struct oops_log_info *)buff;
673 if (oops_hdr->version < OOPS_HDR_VERSION) { 673 if (be16_to_cpu(oops_hdr->version) < OOPS_HDR_VERSION) {
674 /* Old format oops header had 2-byte record size */ 674 /* Old format oops header had 2-byte record size */
675 hdr_size = sizeof(u16); 675 hdr_size = sizeof(u16);
676 length = oops_hdr->version; 676 length = be16_to_cpu(oops_hdr->version);
677 time->tv_sec = 0; 677 time->tv_sec = 0;
678 time->tv_nsec = 0; 678 time->tv_nsec = 0;
679 } else { 679 } else {
680 hdr_size = sizeof(*oops_hdr); 680 hdr_size = sizeof(*oops_hdr);
681 length = oops_hdr->report_length; 681 length = be16_to_cpu(oops_hdr->report_length);
682 time->tv_sec = oops_hdr->timestamp; 682 time->tv_sec = be64_to_cpu(oops_hdr->timestamp);
683 time->tv_nsec = 0; 683 time->tv_nsec = 0;
684 } 684 }
685 *buf = kmalloc(length, GFP_KERNEL); 685 *buf = kmalloc(length, GFP_KERNEL);
@@ -889,13 +889,13 @@ static void oops_to_nvram(struct kmsg_dumper *dumper,
889 kmsg_dump_get_buffer(dumper, false, 889 kmsg_dump_get_buffer(dumper, false,
890 oops_data, oops_data_sz, &text_len); 890 oops_data, oops_data_sz, &text_len);
891 err_type = ERR_TYPE_KERNEL_PANIC; 891 err_type = ERR_TYPE_KERNEL_PANIC;
892 oops_hdr->version = OOPS_HDR_VERSION; 892 oops_hdr->version = cpu_to_be16(OOPS_HDR_VERSION);
893 oops_hdr->report_length = (u16) text_len; 893 oops_hdr->report_length = cpu_to_be16(text_len);
894 oops_hdr->timestamp = get_seconds(); 894 oops_hdr->timestamp = cpu_to_be64(get_seconds());
895 } 895 }
896 896
897 (void) nvram_write_os_partition(&oops_log_partition, oops_buf, 897 (void) nvram_write_os_partition(&oops_log_partition, oops_buf,
898 (int) (sizeof(*oops_hdr) + oops_hdr->report_length), err_type, 898 (int) (sizeof(*oops_hdr) + text_len), err_type,
899 ++oops_count); 899 ++oops_count);
900 900
901 spin_unlock_irqrestore(&lock, flags); 901 spin_unlock_irqrestore(&lock, flags);
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index 5f93856cdf47..70670a2d9cf2 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -113,7 +113,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
113{ 113{
114 struct device_node *dn, *pdn; 114 struct device_node *dn, *pdn;
115 struct pci_bus *bus; 115 struct pci_bus *bus;
116 const uint32_t *pcie_link_speed_stats; 116 const __be32 *pcie_link_speed_stats;
117 117
118 bus = bridge->bus; 118 bus = bridge->bus;
119 119
@@ -122,7 +122,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
122 return 0; 122 return 0;
123 123
124 for (pdn = dn; pdn != NULL; pdn = of_get_next_parent(pdn)) { 124 for (pdn = dn; pdn != NULL; pdn = of_get_next_parent(pdn)) {
125 pcie_link_speed_stats = (const uint32_t *) of_get_property(pdn, 125 pcie_link_speed_stats = of_get_property(pdn,
126 "ibm,pcie-link-speed-stats", NULL); 126 "ibm,pcie-link-speed-stats", NULL);
127 if (pcie_link_speed_stats) 127 if (pcie_link_speed_stats)
128 break; 128 break;
@@ -135,7 +135,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
135 return 0; 135 return 0;
136 } 136 }
137 137
138 switch (pcie_link_speed_stats[0]) { 138 switch (be32_to_cpup(pcie_link_speed_stats)) {
139 case 0x01: 139 case 0x01:
140 bus->max_bus_speed = PCIE_SPEED_2_5GT; 140 bus->max_bus_speed = PCIE_SPEED_2_5GT;
141 break; 141 break;
@@ -147,7 +147,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
147 break; 147 break;
148 } 148 }
149 149
150 switch (pcie_link_speed_stats[1]) { 150 switch (be32_to_cpup(pcie_link_speed_stats)) {
151 case 0x01: 151 case 0x01:
152 bus->cur_bus_speed = PCIE_SPEED_2_5GT; 152 bus->cur_bus_speed = PCIE_SPEED_2_5GT;
153 break; 153 break;
diff --git a/arch/powerpc/platforms/pseries/rng.c b/arch/powerpc/platforms/pseries/rng.c
index a702f1c08242..72a102758d4e 100644
--- a/arch/powerpc/platforms/pseries/rng.c
+++ b/arch/powerpc/platforms/pseries/rng.c
@@ -13,6 +13,7 @@
13#include <linux/of.h> 13#include <linux/of.h>
14#include <asm/archrandom.h> 14#include <asm/archrandom.h>
15#include <asm/machdep.h> 15#include <asm/machdep.h>
16#include <asm/plpar_wrappers.h>
16 17
17 18
18static int pseries_get_random_long(unsigned long *v) 19static int pseries_get_random_long(unsigned long *v)
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 1f97e2b87a62..6f76ae417f47 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -442,9 +442,35 @@ 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 set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT);
448 474
449 /* Discover PIC type and setup ppc_md accordingly */ 475 /* Discover PIC type and setup ppc_md accordingly */
450 pseries_discover_pic(); 476 pseries_discover_pic();
@@ -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
diff --git a/arch/powerpc/platforms/wsp/chroma.c b/arch/powerpc/platforms/wsp/chroma.c
index 8ef53bc2e70e..aaa46b353715 100644
--- a/arch/powerpc/platforms/wsp/chroma.c
+++ b/arch/powerpc/platforms/wsp/chroma.c
@@ -15,6 +15,7 @@
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/smp.h> 16#include <linux/smp.h>
17#include <linux/time.h> 17#include <linux/time.h>
18#include <linux/of_fdt.h>
18 19
19#include <asm/machdep.h> 20#include <asm/machdep.h>
20#include <asm/udbg.h> 21#include <asm/udbg.h>
diff --git a/arch/powerpc/platforms/wsp/h8.c b/arch/powerpc/platforms/wsp/h8.c
index d18e6cc19df3..a3c87f395750 100644
--- a/arch/powerpc/platforms/wsp/h8.c
+++ b/arch/powerpc/platforms/wsp/h8.c
@@ -10,6 +10,7 @@
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/of.h> 11#include <linux/of.h>
12#include <linux/io.h> 12#include <linux/io.h>
13#include <linux/of_address.h>
13 14
14#include "wsp.h" 15#include "wsp.h"
15 16
diff --git a/arch/powerpc/platforms/wsp/ics.c b/arch/powerpc/platforms/wsp/ics.c
index 2d3b1dd9571d..9cd92e645028 100644
--- a/arch/powerpc/platforms/wsp/ics.c
+++ b/arch/powerpc/platforms/wsp/ics.c
@@ -18,6 +18,8 @@
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/of_address.h>
22#include <linux/of_irq.h>
21 23
22#include <asm/io.h> 24#include <asm/io.h>
23#include <asm/irq.h> 25#include <asm/irq.h>
diff --git a/arch/powerpc/platforms/wsp/opb_pic.c b/arch/powerpc/platforms/wsp/opb_pic.c
index cb565bf93650..3f6729807938 100644
--- a/arch/powerpc/platforms/wsp/opb_pic.c
+++ b/arch/powerpc/platforms/wsp/opb_pic.c
@@ -15,6 +15,8 @@
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/time.h> 17#include <linux/time.h>
18#include <linux/of_address.h>
19#include <linux/of_irq.h>
18 20
19#include <asm/reg_a2.h> 21#include <asm/reg_a2.h>
20#include <asm/irq.h> 22#include <asm/irq.h>
diff --git a/arch/powerpc/platforms/wsp/psr2.c b/arch/powerpc/platforms/wsp/psr2.c
index 508ec8282b96..a87b414c766a 100644
--- a/arch/powerpc/platforms/wsp/psr2.c
+++ b/arch/powerpc/platforms/wsp/psr2.c
@@ -15,6 +15,7 @@
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/smp.h> 16#include <linux/smp.h>
17#include <linux/time.h> 17#include <linux/time.h>
18#include <linux/of_fdt.h>
18 19
19#include <asm/machdep.h> 20#include <asm/machdep.h>
20#include <asm/udbg.h> 21#include <asm/udbg.h>
diff --git a/arch/powerpc/platforms/wsp/scom_wsp.c b/arch/powerpc/platforms/wsp/scom_wsp.c
index 8928507affea..6538b4de34fc 100644
--- a/arch/powerpc/platforms/wsp/scom_wsp.c
+++ b/arch/powerpc/platforms/wsp/scom_wsp.c
@@ -14,6 +14,7 @@
14#include <linux/of.h> 14#include <linux/of.h>
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/of_address.h>
17 18
18#include <asm/cputhreads.h> 19#include <asm/cputhreads.h>
19#include <asm/reg_a2.h> 20#include <asm/reg_a2.h>
diff --git a/arch/powerpc/platforms/wsp/wsp.c b/arch/powerpc/platforms/wsp/wsp.c
index ddb6efe88914..58cd1f00e1ef 100644
--- a/arch/powerpc/platforms/wsp/wsp.c
+++ b/arch/powerpc/platforms/wsp/wsp.c
@@ -13,6 +13,7 @@
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/time.h> 15#include <linux/time.h>
16#include <linux/of_address.h>
16 17
17#include <asm/scom.h> 18#include <asm/scom.h>
18 19
diff --git a/arch/powerpc/sysdev/ppc4xx_ocm.c b/arch/powerpc/sysdev/ppc4xx_ocm.c
index b7c43453236d..85d9e37f5ccb 100644
--- a/arch/powerpc/sysdev/ppc4xx_ocm.c
+++ b/arch/powerpc/sysdev/ppc4xx_ocm.c
@@ -339,7 +339,7 @@ void *ppc4xx_ocm_alloc(phys_addr_t *phys, int size, int align,
339 if (IS_ERR_VALUE(offset)) 339 if (IS_ERR_VALUE(offset))
340 continue; 340 continue;
341 341
342 ocm_blk = kzalloc(sizeof(struct ocm_block *), GFP_KERNEL); 342 ocm_blk = kzalloc(sizeof(struct ocm_block), GFP_KERNEL);
343 if (!ocm_blk) { 343 if (!ocm_blk) {
344 printk(KERN_ERR "PPC4XX OCM: could not allocate ocm block"); 344 printk(KERN_ERR "PPC4XX OCM: could not allocate ocm block");
345 rh_free(ocm_reg->rh, offset); 345 rh_free(ocm_reg->rh, offset);