aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/powerpc/Kconfig.debug9
-rw-r--r--arch/powerpc/boot/Makefile57
-rw-r--r--arch/powerpc/boot/dts/bsc9131rdb.dts34
-rw-r--r--arch/powerpc/boot/dts/bsc9131rdb.dtsi142
-rw-r--r--arch/powerpc/boot/dts/fsl/bsc9131si-post.dtsi193
-rw-r--r--arch/powerpc/boot/dts/fsl/bsc9131si-pre.dtsi (renamed from arch/powerpc/boot/dts/fsl/p3060si-pre.dtsi)84
-rw-r--r--arch/powerpc/boot/dts/fsl/p1021si-post.dtsi16
-rw-r--r--arch/powerpc/boot/dts/fsl/p3060si-post.dtsi302
-rw-r--r--arch/powerpc/boot/dts/mgcoge.dts23
-rw-r--r--arch/powerpc/boot/dts/mpc8536ds.dtsi8
-rw-r--r--arch/powerpc/boot/dts/mpc8544ds.dtsi9
-rw-r--r--arch/powerpc/boot/dts/mpc8572ds.dtsi17
-rw-r--r--arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts8
-rw-r--r--arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts11
-rw-r--r--arch/powerpc/boot/dts/p1010rdb.dtsi12
-rw-r--r--arch/powerpc/boot/dts/p1021rdb-pc.dtsi (renamed from arch/powerpc/boot/dts/p1021rdb.dtsi)2
-rw-r--r--arch/powerpc/boot/dts/p1021rdb-pc_32b.dts (renamed from arch/powerpc/boot/dts/p1021rdb.dts)4
-rw-r--r--arch/powerpc/boot/dts/p1021rdb-pc_36b.dts (renamed from arch/powerpc/boot/dts/p1021rdb_36b.dts)4
-rw-r--r--arch/powerpc/boot/dts/p1022ds.dtsi20
-rw-r--r--arch/powerpc/boot/dts/p1024rdb.dtsi228
-rw-r--r--arch/powerpc/boot/dts/p1024rdb_32b.dts87
-rw-r--r--arch/powerpc/boot/dts/p1024rdb_36b.dts87
-rw-r--r--arch/powerpc/boot/dts/p1025rdb.dtsi40
-rw-r--r--arch/powerpc/boot/dts/p2020ds.dtsi10
-rw-r--r--arch/powerpc/boot/dts/p2020rdb.dts2
-rw-r--r--arch/powerpc/boot/dts/p2041rdb.dts41
-rw-r--r--arch/powerpc/boot/dts/p3060qds.dts242
-rw-r--r--arch/powerpc/boot/dts/sbc8560.dts406
-rw-r--r--arch/powerpc/boot/flatdevtree_env.h27
-rw-r--r--arch/powerpc/configs/83xx/kmeter1_defconfig22
-rw-r--r--arch/powerpc/configs/85xx/sbc8560_defconfig65
-rw-r--r--arch/powerpc/configs/corenet32_smp_defconfig10
-rw-r--r--arch/powerpc/configs/corenet64_smp_defconfig66
-rw-r--r--arch/powerpc/configs/mgcoge_defconfig12
-rw-r--r--arch/powerpc/configs/mpc85xx_defconfig24
-rw-r--r--arch/powerpc/configs/mpc85xx_smp_defconfig25
-rw-r--r--arch/powerpc/configs/ppc64_defconfig2
-rw-r--r--arch/powerpc/configs/pseries_defconfig1
-rw-r--r--arch/powerpc/include/asm/asm-compat.h2
-rw-r--r--arch/powerpc/include/asm/code-patching.h4
-rw-r--r--arch/powerpc/include/asm/device.h3
-rw-r--r--arch/powerpc/include/asm/exception-64s.h4
-rw-r--r--arch/powerpc/include/asm/hw_irq.h14
-rw-r--r--arch/powerpc/include/asm/immap_qe.h4
-rw-r--r--arch/powerpc/include/asm/io.h8
-rw-r--r--arch/powerpc/include/asm/iommu.h18
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_asm.h1
-rw-r--r--arch/powerpc/include/asm/mmu.h7
-rw-r--r--arch/powerpc/include/asm/perf_event.h5
-rw-r--r--arch/powerpc/include/asm/ppc-opcode.h118
-rw-r--r--arch/powerpc/include/asm/ppc_asm.h121
-rw-r--r--arch/powerpc/include/asm/processor.h2
-rw-r--r--arch/powerpc/include/asm/qe.h1
-rw-r--r--arch/powerpc/include/asm/reg.h8
-rw-r--r--arch/powerpc/include/asm/thread_info.h6
-rw-r--r--arch/powerpc/include/asm/trace.h45
-rw-r--r--arch/powerpc/include/asm/vdso.h2
-rw-r--r--arch/powerpc/include/asm/vio.h2
-rw-r--r--arch/powerpc/kernel/asm-offsets.c1
-rw-r--r--arch/powerpc/kernel/cpu_setup_a2.S6
-rw-r--r--arch/powerpc/kernel/dma.c10
-rw-r--r--arch/powerpc/kernel/entry_32.S30
-rw-r--r--arch/powerpc/kernel/entry_64.S134
-rw-r--r--arch/powerpc/kernel/exceptions-64e.S10
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S3
-rw-r--r--arch/powerpc/kernel/fpu.S16
-rw-r--r--arch/powerpc/kernel/ftrace.c81
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S25
-rw-r--r--arch/powerpc/kernel/hw_breakpoint.c2
-rw-r--r--arch/powerpc/kernel/idle_6xx.S4
-rw-r--r--arch/powerpc/kernel/idle_book3e.S2
-rw-r--r--arch/powerpc/kernel/idle_e500.S4
-rw-r--r--arch/powerpc/kernel/idle_power4.S2
-rw-r--r--arch/powerpc/kernel/iommu.c291
-rw-r--r--arch/powerpc/kernel/irq.c50
-rw-r--r--arch/powerpc/kernel/kvm.c2
-rw-r--r--arch/powerpc/kernel/misc_32.S4
-rw-r--r--arch/powerpc/kernel/misc_64.S9
-rw-r--r--arch/powerpc/kernel/module_32.c11
-rw-r--r--arch/powerpc/kernel/pci-common.c1
-rw-r--r--arch/powerpc/kernel/pci_of_scan.c1
-rw-r--r--arch/powerpc/kernel/prom_init.c4
-rw-r--r--arch/powerpc/kernel/setup-common.c27
-rw-r--r--arch/powerpc/kernel/setup_32.c24
-rw-r--r--arch/powerpc/kernel/smp.c5
-rw-r--r--arch/powerpc/kernel/time.c14
-rw-r--r--arch/powerpc/kernel/vdso.c28
-rw-r--r--arch/powerpc/kernel/vdso32/Makefile4
-rw-r--r--arch/powerpc/kernel/vdso32/getcpu.S45
-rw-r--r--arch/powerpc/kernel/vdso32/vdso32.lds.S3
-rw-r--r--arch/powerpc/kernel/vdso64/Makefile2
-rw-r--r--arch/powerpc/kernel/vdso64/getcpu.S45
-rw-r--r--arch/powerpc/kernel/vdso64/vdso64.lds.S1
-rw-r--r--arch/powerpc/kernel/vio.c42
-rw-r--r--arch/powerpc/kvm/book3s_hv.c96
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S229
-rw-r--r--arch/powerpc/kvm/book3s_interrupts.S80
-rw-r--r--arch/powerpc/kvm/book3s_pr_papr.c1
-rw-r--r--arch/powerpc/kvm/book3s_rmhandlers.S1
-rw-r--r--arch/powerpc/kvm/book3s_segment.S2
-rw-r--r--arch/powerpc/kvm/booke_interrupts.S277
-rw-r--r--arch/powerpc/kvm/bookehv_interrupts.S229
-rw-r--r--arch/powerpc/lib/Makefile5
-rw-r--r--arch/powerpc/lib/checksum_64.S27
-rw-r--r--arch/powerpc/lib/code-patching.c14
-rw-r--r--arch/powerpc/lib/copypage_64.S4
-rw-r--r--arch/powerpc/lib/copypage_power7.S165
-rw-r--r--arch/powerpc/lib/copyuser_power7.S157
-rw-r--r--arch/powerpc/lib/crtsavres.S5
-rw-r--r--arch/powerpc/lib/hweight_64.S14
-rw-r--r--arch/powerpc/lib/ldstfp.S12
-rw-r--r--arch/powerpc/lib/memcpy_64.S4
-rw-r--r--arch/powerpc/lib/memcpy_power7.S647
-rw-r--r--arch/powerpc/lib/string.S2
-rw-r--r--arch/powerpc/lib/string_64.S202
-rw-r--r--arch/powerpc/lib/vmx-helper.c (renamed from arch/powerpc/lib/copyuser_power7_vmx.c)27
-rw-r--r--arch/powerpc/mm/hash_low_32.S8
-rw-r--r--arch/powerpc/mm/hash_low_64.S156
-rw-r--r--arch/powerpc/mm/numa.c6
-rw-r--r--arch/powerpc/mm/tlb_low_64e.S10
-rw-r--r--arch/powerpc/mm/tlb_nohash_low.S16
-rw-r--r--arch/powerpc/net/bpf_jit.h106
-rw-r--r--arch/powerpc/net/bpf_jit_64.S2
-rw-r--r--arch/powerpc/net/bpf_jit_comp.c4
-rw-r--r--arch/powerpc/perf/callchain.c6
-rw-r--r--arch/powerpc/perf/core-book3s.c99
-rw-r--r--arch/powerpc/platforms/44x/currituck.c2
-rw-r--r--arch/powerpc/platforms/82xx/km82xx.c5
-rw-r--r--arch/powerpc/platforms/83xx/km83xx.c100
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig43
-rw-r--r--arch/powerpc/platforms/85xx/Makefile4
-rw-r--r--arch/powerpc/platforms/85xx/bsc913x_rdb.c67
-rw-r--r--arch/powerpc/platforms/85xx/corenet_ds.c2
-rw-r--r--arch/powerpc/platforms/85xx/ge_imp3a.c2
-rw-r--r--arch/powerpc/platforms/85xx/mpc8536_ds.c2
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ds.c97
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c2
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_rdb.c22
-rw-r--r--arch/powerpc/platforms/85xx/p1022_ds.c116
-rw-r--r--arch/powerpc/platforms/85xx/p3060_qds.c77
-rw-r--r--arch/powerpc/platforms/85xx/qemu_e500.c72
-rw-r--r--arch/powerpc/platforms/85xx/sbc8560.c254
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_hpcn.c2
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype4
-rw-r--r--arch/powerpc/platforms/cell/beat_hvCall.S28
-rw-r--r--arch/powerpc/platforms/cell/iommu.c1
-rw-r--r--arch/powerpc/platforms/cell/pervasive.c11
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c48
-rw-r--r--arch/powerpc/platforms/powernv/opal-takeover.S10
-rw-r--r--arch/powerpc/platforms/pseries/eeh_event.c6
-rw-r--r--arch/powerpc/platforms/pseries/eeh_pseries.c4
-rw-r--r--arch/powerpc/platforms/pseries/hvCall.S78
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c117
-rw-r--r--arch/powerpc/platforms/pseries/mobility.c8
-rw-r--r--arch/powerpc/platforms/pseries/nvram.c61
-rw-r--r--arch/powerpc/platforms/pseries/processor_idle.c53
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c16
-rw-r--r--arch/powerpc/platforms/pseries/smp.c1
-rw-r--r--arch/powerpc/sysdev/6xx-suspend.S2
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c73
-rw-r--r--arch/powerpc/sysdev/fsl_pci.h8
-rw-r--r--arch/powerpc/sysdev/mpic.c4
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe.c3
-rw-r--r--arch/powerpc/xmon/xmon.c2
165 files changed, 4664 insertions, 3028 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 050cb371a69e..9a5d3cdc3e12 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -653,7 +653,7 @@ config SBUS
653config FSL_SOC 653config FSL_SOC
654 bool 654 bool
655 select HAVE_CAN_FLEXCAN if NET && CAN 655 select HAVE_CAN_FLEXCAN if NET && CAN
656 select PPC_CLOCK if CAN_FLEXCAN 656 select PPC_CLOCK
657 657
658config FSL_PCI 658config FSL_PCI
659 bool 659 bool
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index e5f26890a69e..5416e28a7538 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -331,4 +331,13 @@ config STRICT_DEVMEM
331 331
332 If you are unsure, say Y. 332 If you are unsure, say Y.
333 333
334config FAIL_IOMMU
335 bool "Fault-injection capability for IOMMU"
336 depends on FAULT_INJECTION
337 help
338 Provide fault-injection capability for IOMMU. Each device can
339 be selectively enabled via the fail_iommu property.
340
341 If you are unsure, say N.
342
334endmenu 343endmenu
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index e8461cb18d04..b7d833382be4 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -62,26 +62,45 @@ libfdtheader := fdt.h libfdt.h libfdt_internal.h
62$(addprefix $(obj)/,$(libfdt) libfdt-wrapper.o simpleboot.o epapr.o): \ 62$(addprefix $(obj)/,$(libfdt) libfdt-wrapper.o simpleboot.o epapr.o): \
63 $(addprefix $(obj)/,$(libfdtheader)) 63 $(addprefix $(obj)/,$(libfdtheader))
64 64
65src-wlib := string.S crt0.S crtsavres.S stdio.c main.c \ 65src-wlib-y := string.S crt0.S crtsavres.S stdio.c main.c \
66 $(libfdt) libfdt-wrapper.c \ 66 $(libfdt) libfdt-wrapper.c \
67 ns16550.c serial.c simple_alloc.c div64.S util.S \ 67 ns16550.c serial.c simple_alloc.c div64.S util.S \
68 gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \ 68 gunzip_util.c elf_util.c $(zlib) devtree.c stdlib.c \
69 4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \ 69 oflib.c ofconsole.c cuboot.c mpsc.c cpm-serial.c \
70 cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c uartlite.c \ 70 uartlite.c mpc52xx-psc.c
71 fsl-soc.c mpc8xx.c pq2.c ugecon.c 71src-wlib-$(CONFIG_40x) += 4xx.c planetcore.c
72src-plat := of.c cuboot-52xx.c cuboot-824x.c cuboot-83xx.c cuboot-85xx.c holly.c \ 72src-wlib-$(CONFIG_44x) += 4xx.c ebony.c bamboo.c
73 cuboot-ebony.c cuboot-hotfoot.c epapr.c treeboot-ebony.c \ 73src-wlib-$(CONFIG_8xx) += mpc8xx.c planetcore.c
74 prpmc2800.c \ 74src-wlib-$(CONFIG_PPC_82xx) += pq2.c fsl-soc.c planetcore.c
75 ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \ 75src-wlib-$(CONFIG_EMBEDDED6xx) += mv64x60.c mv64x60_i2c.c ugecon.c
76 cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c \ 76
77 cuboot-bamboo.c cuboot-mpc7448hpc2.c cuboot-taishan.c \ 77src-plat-y := of.c
78 fixed-head.S ep88xc.c ep405.c cuboot-c2k.c \ 78src-plat-$(CONFIG_40x) += fixed-head.S ep405.c cuboot-hotfoot.c \
79 cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \ 79 treeboot-walnut.c cuboot-acadia.c \
80 cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \ 80 cuboot-kilauea.c simpleboot.c \
81 virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \ 81 virtex405-head.S virtex.c
82 cuboot-acadia.c cuboot-amigaone.c cuboot-kilauea.c \ 82src-plat-$(CONFIG_44x) += treeboot-ebony.c cuboot-ebony.c treeboot-bamboo.c \
83 gamecube-head.S gamecube.c wii-head.S wii.c treeboot-iss4xx.c \ 83 cuboot-bamboo.c cuboot-sam440ep.c \
84 treeboot-currituck.c 84 cuboot-sequoia.c cuboot-rainier.c \
85 cuboot-taishan.c cuboot-katmai.c \
86 cuboot-warp.c cuboot-yosemite.c \
87 treeboot-iss4xx.c treeboot-currituck.c \
88 simpleboot.c fixed-head.S virtex.c
89src-plat-$(CONFIG_8xx) += cuboot-8xx.c fixed-head.S ep88xc.c redboot-8xx.c
90src-plat-$(CONFIG_PPC_MPC52xx) += cuboot-52xx.c
91src-plat-$(CONFIG_PPC_82xx) += cuboot-pq2.c fixed-head.S ep8248e.c cuboot-824x.c
92src-plat-$(CONFIG_PPC_83xx) += cuboot-83xx.c fixed-head.S redboot-83xx.c
93src-plat-$(CONFIG_FSL_SOC_BOOKE) += cuboot-85xx.c cuboot-85xx-cpm2.c
94src-plat-$(CONFIG_EMBEDDED6xx) += cuboot-pq2.c cuboot-mpc7448hpc2.c \
95 cuboot-c2k.c gamecube-head.S \
96 gamecube.c wii-head.S wii.c holly.c \
97 prpmc2800.c
98src-plat-$(CONFIG_AMIGAONE) += cuboot-amigaone.c
99src-plat-$(CONFIG_PPC_PS3) += ps3-head.S ps3-hvcall.S ps3.c
100src-plat-$(CONFIG_EPAPR_BOOT) += epapr.c
101
102src-wlib := $(sort $(src-wlib-y))
103src-plat := $(sort $(src-plat-y))
85src-boot := $(src-wlib) $(src-plat) empty.c 104src-boot := $(src-wlib) $(src-plat) empty.c
86 105
87src-boot := $(addprefix $(obj)/, $(src-boot)) 106src-boot := $(addprefix $(obj)/, $(src-boot))
@@ -257,7 +276,6 @@ image-$(CONFIG_TQM8548) += cuImage.tqm8548
257image-$(CONFIG_TQM8555) += cuImage.tqm8555 276image-$(CONFIG_TQM8555) += cuImage.tqm8555
258image-$(CONFIG_TQM8560) += cuImage.tqm8560 277image-$(CONFIG_TQM8560) += cuImage.tqm8560
259image-$(CONFIG_SBC8548) += cuImage.sbc8548 278image-$(CONFIG_SBC8548) += cuImage.sbc8548
260image-$(CONFIG_SBC8560) += cuImage.sbc8560
261image-$(CONFIG_KSI8560) += cuImage.ksi8560 279image-$(CONFIG_KSI8560) += cuImage.ksi8560
262 280
263# Board ports in arch/powerpc/platform/embedded6xx/Kconfig 281# Board ports in arch/powerpc/platform/embedded6xx/Kconfig
@@ -412,4 +430,3 @@ $(wrapper-installed): $(DESTDIR)$(WRAPPER_BINDIR) $(srctree)/$(obj)/wrapper | $(
412 $(call cmd,install_wrapper) 430 $(call cmd,install_wrapper)
413 431
414$(obj)/bootwrapper_install: $(all-installed) 432$(obj)/bootwrapper_install: $(all-installed)
415
diff --git a/arch/powerpc/boot/dts/bsc9131rdb.dts b/arch/powerpc/boot/dts/bsc9131rdb.dts
new file mode 100644
index 000000000000..e13d2d4877b0
--- /dev/null
+++ b/arch/powerpc/boot/dts/bsc9131rdb.dts
@@ -0,0 +1,34 @@
1/*
2 * BSC9131 RDB Device Tree Source
3 *
4 * Copyright 2011-2012 Freescale Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12/include/ "fsl/bsc9131si-pre.dtsi"
13
14/ {
15 model = "fsl,bsc9131rdb";
16 compatible = "fsl,bsc9131rdb";
17
18 memory {
19 device_type = "memory";
20 };
21
22 board_ifc: ifc: ifc@ff71e000 {
23 /* NAND Flash on board */
24 ranges = <0x0 0x0 0x0 0xff800000 0x00004000>;
25 reg = <0x0 0xff71e000 0x0 0x2000>;
26 };
27
28 board_soc: soc: soc@ff700000 {
29 ranges = <0x0 0x0 0xff700000 0x100000>;
30 };
31};
32
33/include/ "bsc9131rdb.dtsi"
34/include/ "fsl/bsc9131si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/bsc9131rdb.dtsi b/arch/powerpc/boot/dts/bsc9131rdb.dtsi
new file mode 100644
index 000000000000..638adda2c218
--- /dev/null
+++ b/arch/powerpc/boot/dts/bsc9131rdb.dtsi
@@ -0,0 +1,142 @@
1/*
2 * BSC9131 RDB Device Tree Source stub (no addresses or top-level ranges)
3 *
4 * Copyright 2011-2012 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
35&board_ifc {
36
37 nand@0,0 {
38 #address-cells = <1>;
39 #size-cells = <1>;
40 compatible = "fsl,ifc-nand";
41 reg = <0x0 0x0 0x4000>;
42
43 partition@0 {
44 /* This location must not be altered */
45 /* 3MB for u-boot Bootloader Image */
46 reg = <0x0 0x00300000>;
47 label = "NAND U-Boot Image";
48 read-only;
49 };
50
51 partition@300000 {
52 /* 1MB for DTB Image */
53 reg = <0x00300000 0x00100000>;
54 label = "NAND DTB Image";
55 };
56
57 partition@400000 {
58 /* 8MB for Linux Kernel Image */
59 reg = <0x00400000 0x00800000>;
60 label = "NAND Linux Kernel Image";
61 };
62
63 partition@c00000 {
64 /* Rest space for Root file System Image */
65 reg = <0x00c00000 0x07400000>;
66 label = "NAND RFS Image";
67 };
68 };
69};
70
71&board_soc {
72 /* BSC9131RDB does not have any device on i2c@3100 */
73 i2c@3100 {
74 status = "disabled";
75 };
76
77 spi@7000 {
78 flash@0 {
79 #address-cells = <1>;
80 #size-cells = <1>;
81 compatible = "spansion,s25sl12801";
82 reg = <0>;
83 spi-max-frequency = <50000000>;
84
85 /* 512KB for u-boot Bootloader Image */
86 partition@0 {
87 reg = <0x0 0x00080000>;
88 label = "SPI Flash U-Boot Image";
89 read-only;
90 };
91
92 /* 512KB for DTB Image */
93 partition@80000 {
94 reg = <0x00080000 0x00080000>;
95 label = "SPI Flash DTB Image";
96 };
97
98 /* 4MB for Linux Kernel Image */
99 partition@100000 {
100 reg = <0x00100000 0x00400000>;
101 label = "SPI Flash Kernel Image";
102 };
103
104 /*11MB for RFS Image */
105 partition@500000 {
106 reg = <0x00500000 0x00B00000>;
107 label = "SPI Flash RFS Image";
108 };
109
110 };
111 };
112
113 usb@22000 {
114 phy_type = "ulpi";
115 };
116
117 mdio@24000 {
118 phy0: ethernet-phy@0 {
119 interrupts = <3 1 0 0>;
120 reg = <0x0>;
121 };
122
123 phy1: ethernet-phy@1 {
124 interrupts = <2 1 0 0>;
125 reg = <0x3>;
126 };
127 };
128
129 sdhci@2e000 {
130 status = "disabled";
131 };
132
133 enet0: ethernet@b0000 {
134 phy-handle = <&phy0>;
135 phy-connection-type = "rgmii-id";
136 };
137
138 enet1: ethernet@b1000 {
139 phy-handle = <&phy1>;
140 phy-connection-type = "rgmii-id";
141 };
142};
diff --git a/arch/powerpc/boot/dts/fsl/bsc9131si-post.dtsi b/arch/powerpc/boot/dts/fsl/bsc9131si-post.dtsi
new file mode 100644
index 000000000000..5180d9d37989
--- /dev/null
+++ b/arch/powerpc/boot/dts/fsl/bsc9131si-post.dtsi
@@ -0,0 +1,193 @@
1/*
2 * BSC9131 Silicon/SoC Device Tree Source (post include)
3 *
4 * Copyright 2011-2012 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
35&ifc {
36 #address-cells = <2>;
37 #size-cells = <1>;
38 compatible = "fsl,ifc", "simple-bus";
39 interrupts = <16 2 0 0 20 2 0 0>;
40};
41
42&soc {
43 #address-cells = <1>;
44 #size-cells = <1>;
45 device_type = "soc";
46 compatible = "fsl,bsc9131-immr", "simple-bus";
47 bus-frequency = <0>; // Filled out by uboot.
48
49 ecm-law@0 {
50 compatible = "fsl,ecm-law";
51 reg = <0x0 0x1000>;
52 fsl,num-laws = <12>;
53 };
54
55 ecm@1000 {
56 compatible = "fsl,bsc9131-ecm", "fsl,ecm";
57 reg = <0x1000 0x1000>;
58 interrupts = <16 2 0 0>;
59 };
60
61 memory-controller@2000 {
62 compatible = "fsl,bsc9131-memory-controller";
63 reg = <0x2000 0x1000>;
64 interrupts = <16 2 0 0>;
65 };
66
67/include/ "pq3-i2c-0.dtsi"
68 i2c@3000 {
69 interrupts = <17 2 0 0>;
70 };
71
72/include/ "pq3-i2c-1.dtsi"
73 i2c@3100 {
74 interrupts = <17 2 0 0>;
75 };
76
77/include/ "pq3-duart-0.dtsi"
78 serial0: serial@4500 {
79 interrupts = <18 2 0 0>;
80 };
81
82 serial1: serial@4600 {
83 interrupts = <18 2 0 0 >;
84 };
85/include/ "pq3-espi-0.dtsi"
86 spi0: spi@7000 {
87 fsl,espi-num-chipselects = <1>;
88 interrupts = <22 0x2 0 0>;
89 };
90
91/include/ "pq3-gpio-0.dtsi"
92 gpio-controller@f000 {
93 interrupts = <19 0x2 0 0>;
94 };
95
96 L2: l2-cache-controller@20000 {
97 compatible = "fsl,bsc9131-l2-cache-controller";
98 reg = <0x20000 0x1000>;
99 cache-line-size = <32>; // 32 bytes
100 cache-size = <0x40000>; // L2,256K
101 interrupts = <16 2 0 0>;
102 };
103
104/include/ "pq3-dma-0.dtsi"
105
106dma@21300 {
107
108 dma-channel@0 {
109 interrupts = <62 2 0 0>;
110 };
111
112 dma-channel@80 {
113 interrupts = <63 2 0 0>;
114 };
115
116 dma-channel@100 {
117 interrupts = <64 2 0 0>;
118 };
119
120 dma-channel@180 {
121 interrupts = <65 2 0 0>;
122 };
123};
124
125/include/ "pq3-usb2-dr-0.dtsi"
126usb@22000 {
127 compatible = "fsl-usb2-dr","fsl-usb2-dr-v2.2";
128 interrupts = <40 0x2 0 0>;
129};
130
131/include/ "pq3-esdhc-0.dtsi"
132 sdhc@2e000 {
133 fsl,sdhci-auto-cmd12;
134 interrupts = <41 0x2 0 0>;
135 };
136
137/include/ "pq3-sec4.4-0.dtsi"
138crypto@30000 {
139 interrupts = <57 2 0 0>;
140
141 sec_jr0: jr@1000 {
142 interrupts = <58 2 0 0>;
143 };
144
145 sec_jr1: jr@2000 {
146 interrupts = <59 2 0 0>;
147 };
148
149 sec_jr2: jr@3000 {
150 interrupts = <60 2 0 0>;
151 };
152
153 sec_jr3: jr@4000 {
154 interrupts = <61 2 0 0>;
155 };
156};
157
158/include/ "pq3-mpic.dtsi"
159
160timer@41100 {
161 compatible = "fsl,mpic-v1.2-msgr", "fsl,mpic-msg";
162 reg = <0x41400 0x200>;
163 interrupts = <
164 0xb0 2
165 0xb1 2
166 0xb2 2
167 0xb3 2>;
168};
169
170/include/ "pq3-etsec2-0.dtsi"
171enet0: ethernet@b0000 {
172 queue-group@b0000 {
173 fsl,rx-bit-map = <0xff>;
174 fsl,tx-bit-map = <0xff>;
175 interrupts = <26 2 0 0 27 2 0 0 28 2 0 0>;
176 };
177};
178
179/include/ "pq3-etsec2-1.dtsi"
180enet1: ethernet@b1000 {
181 queue-group@b1000 {
182 fsl,rx-bit-map = <0xff>;
183 fsl,tx-bit-map = <0xff>;
184 interrupts = <33 2 0 0 34 2 0 0 35 2 0 0>;
185 };
186};
187
188global-utilities@e0000 {
189 compatible = "fsl,bsc9131-guts";
190 reg = <0xe0000 0x1000>;
191 fsl,has-rstcr;
192 };
193};
diff --git a/arch/powerpc/boot/dts/fsl/p3060si-pre.dtsi b/arch/powerpc/boot/dts/fsl/bsc9131si-pre.dtsi
index 00c8e70e7b90..743e4aeda349 100644
--- a/arch/powerpc/boot/dts/fsl/p3060si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/bsc9131si-pre.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * P3060 Silicon/SoC Device Tree Source (pre include) 2 * BSC9131 Silicon/SoC Device Tree Source (pre include)
3 * 3 *
4 * Copyright 2011 Freescale Semiconductor Inc. 4 * Copyright 2011-2012 Freescale Semiconductor Inc.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
@@ -34,92 +34,26 @@
34 34
35/dts-v1/; 35/dts-v1/;
36/ { 36/ {
37 compatible = "fsl,P3060"; 37 compatible = "fsl,BSC9131";
38 #address-cells = <2>; 38 #address-cells = <2>;
39 #size-cells = <2>; 39 #size-cells = <2>;
40 interrupt-parent = <&mpic>; 40 interrupt-parent = <&mpic>;
41 41
42 aliases { 42 aliases {
43 ccsr = &soc;
44 dcsr = &dcsr;
45
46 serial0 = &serial0; 43 serial0 = &serial0;
47 serial1 = &serial1; 44 ethernet0 = &enet0;
48 serial2 = &serial2; 45 ethernet1 = &enet1;
49 serial3 = &serial3;
50 pci0 = &pci0;
51 pci1 = &pci1;
52 usb0 = &usb0;
53 usb1 = &usb1;
54 dma0 = &dma0;
55 dma1 = &dma1;
56 msi0 = &msi0;
57 msi1 = &msi1;
58 msi2 = &msi2;
59
60 crypto = &crypto;
61 sec_jr0 = &sec_jr0;
62 sec_jr1 = &sec_jr1;
63 sec_jr2 = &sec_jr2;
64 sec_jr3 = &sec_jr3;
65 rtic_a = &rtic_a;
66 rtic_b = &rtic_b;
67 rtic_c = &rtic_c;
68 rtic_d = &rtic_d;
69 sec_mon = &sec_mon;
70 }; 46 };
71 47
72 cpus { 48 cpus {
73 #address-cells = <1>; 49 #address-cells = <1>;
74 #size-cells = <0>; 50 #size-cells = <0>;
75 51
76 cpu0: PowerPC,e500mc@0 { 52 PowerPC,BSC9131@0 {
77 device_type = "cpu";
78 reg = <0>;
79 next-level-cache = <&L2_0>;
80 L2_0: l2-cache {
81 next-level-cache = <&cpc>;
82 };
83 };
84 cpu1: PowerPC,e500mc@1 {
85 device_type = "cpu";
86 reg = <1>;
87 next-level-cache = <&L2_1>;
88 L2_1: l2-cache {
89 next-level-cache = <&cpc>;
90 };
91 };
92 cpu4: PowerPC,e500mc@4 {
93 device_type = "cpu";
94 reg = <4>;
95 next-level-cache = <&L2_4>;
96 L2_4: l2-cache {
97 next-level-cache = <&cpc>;
98 };
99 };
100 cpu5: PowerPC,e500mc@5 {
101 device_type = "cpu";
102 reg = <5>;
103 next-level-cache = <&L2_5>;
104 L2_5: l2-cache {
105 next-level-cache = <&cpc>;
106 };
107 };
108 cpu6: PowerPC,e500mc@6 {
109 device_type = "cpu";
110 reg = <6>;
111 next-level-cache = <&L2_6>;
112 L2_6: l2-cache {
113 next-level-cache = <&cpc>;
114 };
115 };
116 cpu7: PowerPC,e500mc@7 {
117 device_type = "cpu"; 53 device_type = "cpu";
118 reg = <7>; 54 compatible = "fsl,e500v2";
119 next-level-cache = <&L2_7>; 55 reg = <0x0>;
120 L2_7: l2-cache { 56 next-level-cache = <&L2>;
121 next-level-cache = <&cpc>;
122 };
123 }; 57 };
124 }; 58 };
125}; 59};
diff --git a/arch/powerpc/boot/dts/fsl/p1021si-post.dtsi b/arch/powerpc/boot/dts/fsl/p1021si-post.dtsi
index 4252ef85fb7a..adb82fd9057f 100644
--- a/arch/powerpc/boot/dts/fsl/p1021si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1021si-post.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * P1021/P1012 Silicon/SoC Device Tree Source (post include) 2 * P1021/P1012 Silicon/SoC Device Tree Source (post include)
3 * 3 *
4 * Copyright 2011 Freescale Semiconductor Inc. 4 * Copyright 2011-2012 Freescale Semiconductor Inc.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
@@ -213,6 +213,20 @@
213 interrupt-parent = <&qeic>; 213 interrupt-parent = <&qeic>;
214 }; 214 };
215 215
216 ucc@2600 {
217 cell-index = <7>;
218 reg = <0x2600 0x200>;
219 interrupts = <42>;
220 interrupt-parent = <&qeic>;
221 };
222
223 ucc@2200 {
224 cell-index = <3>;
225 reg = <0x2200 0x200>;
226 interrupts = <34>;
227 interrupt-parent = <&qeic>;
228 };
229
216 muram@10000 { 230 muram@10000 {
217 #address-cells = <1>; 231 #address-cells = <1>;
218 #size-cells = <1>; 232 #size-cells = <1>;
diff --git a/arch/powerpc/boot/dts/fsl/p3060si-post.dtsi b/arch/powerpc/boot/dts/fsl/p3060si-post.dtsi
deleted file mode 100644
index b3e56929eee2..000000000000
--- a/arch/powerpc/boot/dts/fsl/p3060si-post.dtsi
+++ /dev/null
@@ -1,302 +0,0 @@
1/*
2 * P3060 Silicon/SoC Device Tree Source (post include)
3 *
4 * Copyright 2011 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
35&lbc {
36 compatible = "fsl,p3060-elbc", "fsl,elbc", "simple-bus";
37 interrupts = <25 2 0 0>;
38 #address-cells = <2>;
39 #size-cells = <1>;
40};
41
42/* controller at 0x200000 */
43&pci0 {
44 compatible = "fsl,p3060-pcie", "fsl,qoriq-pcie-v2.2";
45 device_type = "pci";
46 #size-cells = <2>;
47 #address-cells = <3>;
48 bus-range = <0x0 0xff>;
49 clock-frequency = <33333333>;
50 interrupts = <16 2 1 15>;
51 pcie@0 {
52 reg = <0 0 0 0 0>;
53 #interrupt-cells = <1>;
54 #size-cells = <2>;
55 #address-cells = <3>;
56 device_type = "pci";
57 interrupts = <16 2 1 15>;
58 interrupt-map-mask = <0xf800 0 0 7>;
59 interrupt-map = <
60 /* IDSEL 0x0 */
61 0000 0 0 1 &mpic 40 1 0 0
62 0000 0 0 2 &mpic 1 1 0 0
63 0000 0 0 3 &mpic 2 1 0 0
64 0000 0 0 4 &mpic 3 1 0 0
65 >;
66 };
67};
68
69/* controller at 0x201000 */
70&pci1 {
71 compatible = "fsl,p3060-pcie", "fsl,qoriq-pcie-v2.2";
72 device_type = "pci";
73 #size-cells = <2>;
74 #address-cells = <3>;
75 bus-range = <0 0xff>;
76 clock-frequency = <33333333>;
77 interrupts = <16 2 1 14>;
78 pcie@0 {
79 reg = <0 0 0 0 0>;
80 #interrupt-cells = <1>;
81 #size-cells = <2>;
82 #address-cells = <3>;
83 device_type = "pci";
84 interrupts = <16 2 1 14>;
85 interrupt-map-mask = <0xf800 0 0 7>;
86 interrupt-map = <
87 /* IDSEL 0x0 */
88 0000 0 0 1 &mpic 41 1 0 0
89 0000 0 0 2 &mpic 5 1 0 0
90 0000 0 0 3 &mpic 6 1 0 0
91 0000 0 0 4 &mpic 7 1 0 0
92 >;
93 };
94};
95
96&rio {
97 compatible = "fsl,srio";
98 interrupts = <16 2 1 11>;
99 #address-cells = <2>;
100 #size-cells = <2>;
101 fsl,srio-rmu-handle = <&rmu>;
102 ranges;
103
104 port1 {
105 #address-cells = <2>;
106 #size-cells = <2>;
107 cell-index = <1>;
108 };
109
110 port2 {
111 #address-cells = <2>;
112 #size-cells = <2>;
113 cell-index = <2>;
114 };
115};
116
117&dcsr {
118 #address-cells = <1>;
119 #size-cells = <1>;
120 compatible = "fsl,dcsr", "simple-bus";
121
122 dcsr-epu@0 {
123 compatible = "fsl,dcsr-epu";
124 interrupts = <52 2 0 0
125 84 2 0 0
126 85 2 0 0>;
127 reg = <0x0 0x1000>;
128 };
129 dcsr-npc {
130 compatible = "fsl,dcsr-npc";
131 reg = <0x1000 0x1000 0x1000000 0x8000>;
132 };
133 dcsr-nxc@2000 {
134 compatible = "fsl,dcsr-nxc";
135 reg = <0x2000 0x1000>;
136 };
137 dcsr-corenet {
138 compatible = "fsl,dcsr-corenet";
139 reg = <0x8000 0x1000 0xB0000 0x1000>;
140 };
141 dcsr-dpaa@9000 {
142 compatible = "fsl,p3060-dcsr-dpaa", "fsl,dcsr-dpaa";
143 reg = <0x9000 0x1000>;
144 };
145 dcsr-ocn@11000 {
146 compatible = "fsl,p3060-dcsr-ocn", "fsl,dcsr-ocn";
147 reg = <0x11000 0x1000>;
148 };
149 dcsr-ddr@12000 {
150 compatible = "fsl,dcsr-ddr";
151 dev-handle = <&ddr1>;
152 reg = <0x12000 0x1000>;
153 };
154 dcsr-nal@18000 {
155 compatible = "fsl,p3060-dcsr-nal", "fsl,dcsr-nal";
156 reg = <0x18000 0x1000>;
157 };
158 dcsr-rcpm@22000 {
159 compatible = "fsl,p3060-dcsr-rcpm", "fsl,dcsr-rcpm";
160 reg = <0x22000 0x1000>;
161 };
162 dcsr-cpu-sb-proxy@40000 {
163 compatible = "fsl,dcsr-e500mc-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
164 cpu-handle = <&cpu0>;
165 reg = <0x40000 0x1000>;
166 };
167 dcsr-cpu-sb-proxy@41000 {
168 compatible = "fsl,dcsr-e500mc-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
169 cpu-handle = <&cpu1>;
170 reg = <0x41000 0x1000>;
171 };
172 dcsr-cpu-sb-proxy@44000 {
173 compatible = "fsl,dcsr-e500mc-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
174 cpu-handle = <&cpu4>;
175 reg = <0x44000 0x1000>;
176 };
177 dcsr-cpu-sb-proxy@45000 {
178 compatible = "fsl,dcsr-e500mc-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
179 cpu-handle = <&cpu5>;
180 reg = <0x45000 0x1000>;
181 };
182 dcsr-cpu-sb-proxy@46000 {
183 compatible = "fsl,dcsr-e500mc-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
184 cpu-handle = <&cpu6>;
185 reg = <0x46000 0x1000>;
186 };
187 dcsr-cpu-sb-proxy@47000 {
188 compatible = "fsl,dcsr-e500mc-sb-proxy", "fsl,dcsr-cpu-sb-proxy";
189 cpu-handle = <&cpu7>;
190 reg = <0x47000 0x1000>;
191 };
192
193};
194
195&soc {
196 #address-cells = <1>;
197 #size-cells = <1>;
198 device_type = "soc";
199 compatible = "simple-bus";
200
201 soc-sram-error {
202 compatible = "fsl,soc-sram-error";
203 interrupts = <16 2 1 29>;
204 };
205
206 corenet-law@0 {
207 compatible = "fsl,corenet-law";
208 reg = <0x0 0x1000>;
209 fsl,num-laws = <32>;
210 };
211
212 ddr1: memory-controller@8000 {
213 compatible = "fsl,qoriq-memory-controller-v4.4", "fsl,qoriq-memory-controller";
214 reg = <0x8000 0x1000>;
215 interrupts = <16 2 1 23>;
216 };
217
218 cpc: l3-cache-controller@10000 {
219 compatible = "fsl,p3060-l3-cache-controller", "cache";
220 reg = <0x10000 0x1000
221 0x11000 0x1000>;
222 interrupts = <16 2 1 27
223 16 2 1 26>;
224 };
225
226 corenet-cf@18000 {
227 compatible = "fsl,corenet-cf";
228 reg = <0x18000 0x1000>;
229 interrupts = <16 2 1 31>;
230 fsl,ccf-num-csdids = <32>;
231 fsl,ccf-num-snoopids = <32>;
232 };
233
234 iommu@20000 {
235 compatible = "fsl,pamu-v1.0", "fsl,pamu";
236 reg = <0x20000 0x5000>;
237 interrupts = <
238 24 2 0 0
239 16 2 1 30>;
240 };
241
242/include/ "qoriq-rmu-0.dtsi"
243/include/ "qoriq-mpic.dtsi"
244
245 guts: global-utilities@e0000 {
246 compatible = "fsl,qoriq-device-config-1.0";
247 reg = <0xe0000 0xe00>;
248 fsl,has-rstcr;
249 #sleep-cells = <1>;
250 fsl,liodn-bits = <12>;
251 };
252
253 pins: global-utilities@e0e00 {
254 compatible = "fsl,qoriq-pin-control-1.0";
255 reg = <0xe0e00 0x200>;
256 #sleep-cells = <2>;
257 };
258
259 clockgen: global-utilities@e1000 {
260 compatible = "fsl,p3060-clockgen", "fsl,qoriq-clockgen-1.0";
261 reg = <0xe1000 0x1000>;
262 clock-frequency = <0>;
263 };
264
265 rcpm: global-utilities@e2000 {
266 compatible = "fsl,qoriq-rcpm-1.0";
267 reg = <0xe2000 0x1000>;
268 #sleep-cells = <1>;
269 };
270
271 sfp: sfp@e8000 {
272 compatible = "fsl,p3060-sfp", "fsl,qoriq-sfp-1.0";
273 reg = <0xe8000 0x1000>;
274 };
275
276 serdes: serdes@ea000 {
277 compatible = "fsl,p3060-serdes";
278 reg = <0xea000 0x1000>;
279 };
280
281/include/ "qoriq-dma-0.dtsi"
282/include/ "qoriq-dma-1.dtsi"
283/include/ "qoriq-espi-0.dtsi"
284 spi@110000 {
285 fsl,espi-num-chipselects = <4>;
286 };
287
288/include/ "qoriq-i2c-0.dtsi"
289/include/ "qoriq-i2c-1.dtsi"
290/include/ "qoriq-duart-0.dtsi"
291/include/ "qoriq-duart-1.dtsi"
292/include/ "qoriq-gpio-0.dtsi"
293/include/ "qoriq-usb2-mph-0.dtsi"
294 usb@210000 {
295 compatible = "fsl-usb2-mph-v2.2", "fsl,mpc85xx-usb2-mph", "fsl-usb2-mph";
296 };
297/include/ "qoriq-usb2-dr-0.dtsi"
298 usb@211000 {
299 compatible = "fsl-usb2-dr-v2.2", "fsl,mpc85xx-usb2-dr", "fsl-usb2-dr";
300 };
301/include/ "qoriq-sec4.1-0.dtsi"
302};
diff --git a/arch/powerpc/boot/dts/mgcoge.dts b/arch/powerpc/boot/dts/mgcoge.dts
index ededaf5ac015..d72fb5e219d0 100644
--- a/arch/powerpc/boot/dts/mgcoge.dts
+++ b/arch/powerpc/boot/dts/mgcoge.dts
@@ -222,6 +222,29 @@
222 interrupt-parent = <&PIC>; 222 interrupt-parent = <&PIC>;
223 usb-clock = <5>; 223 usb-clock = <5>;
224 }; 224 };
225 spi@11aa0 {
226 cell-index = <0>;
227 compatible = "fsl,spi", "fsl,cpm2-spi";
228 reg = <0x11a80 0x40 0x89fc 0x2>;
229 interrupts = <2 8>;
230 interrupt-parent = <&PIC>;
231 gpios = < &cpm2_pio_d 19 0>;
232 #address-cells = <1>;
233 #size-cells = <0>;
234 ds3106@1 {
235 compatible = "gen,spidev";
236 reg = <0>;
237 spi-max-frequency = <8000000>;
238 };
239 };
240
241 };
242
243 cpm2_pio_d: gpio-controller@10d60 {
244 #gpio-cells = <2>;
245 compatible = "fsl,cpm2-pario-bank";
246 reg = <0x10d60 0x14>;
247 gpio-controller;
225 }; 248 };
226 249
227 cpm2_pio_c: gpio-controller@10d40 { 250 cpm2_pio_c: gpio-controller@10d40 {
diff --git a/arch/powerpc/boot/dts/mpc8536ds.dtsi b/arch/powerpc/boot/dts/mpc8536ds.dtsi
index cc46dbd9746d..d304a2d68c62 100644
--- a/arch/powerpc/boot/dts/mpc8536ds.dtsi
+++ b/arch/powerpc/boot/dts/mpc8536ds.dtsi
@@ -203,6 +203,14 @@
203 reg = <1>; 203 reg = <1>;
204 device_type = "ethernet-phy"; 204 device_type = "ethernet-phy";
205 }; 205 };
206 sgmii_phy0: sgmii-phy@0 {
207 interrupts = <6 1 0 0>;
208 reg = <0x1d>;
209 };
210 sgmii_phy1: sgmii-phy@1 {
211 interrupts = <6 1 0 0>;
212 reg = <0x1c>;
213 };
206 tbi0: tbi-phy@11 { 214 tbi0: tbi-phy@11 {
207 reg = <0x11>; 215 reg = <0x11>;
208 device_type = "tbi-phy"; 216 device_type = "tbi-phy";
diff --git a/arch/powerpc/boot/dts/mpc8544ds.dtsi b/arch/powerpc/boot/dts/mpc8544ds.dtsi
index 270f64b90f4e..77ebc9f1d37c 100644
--- a/arch/powerpc/boot/dts/mpc8544ds.dtsi
+++ b/arch/powerpc/boot/dts/mpc8544ds.dtsi
@@ -51,6 +51,15 @@
51 device_type = "ethernet-phy"; 51 device_type = "ethernet-phy";
52 }; 52 };
53 53
54 sgmii_phy0: sgmii-phy@0 {
55 interrupts = <6 1 0 0>;
56 reg = <0x1c>;
57 };
58 sgmii_phy1: sgmii-phy@1 {
59 interrupts = <6 1 0 0>;
60 reg = <0x1d>;
61 };
62
54 tbi0: tbi-phy@11 { 63 tbi0: tbi-phy@11 {
55 reg = <0x11>; 64 reg = <0x11>;
56 device_type = "tbi-phy"; 65 device_type = "tbi-phy";
diff --git a/arch/powerpc/boot/dts/mpc8572ds.dtsi b/arch/powerpc/boot/dts/mpc8572ds.dtsi
index 14178944e220..357490bb84da 100644
--- a/arch/powerpc/boot/dts/mpc8572ds.dtsi
+++ b/arch/powerpc/boot/dts/mpc8572ds.dtsi
@@ -169,6 +169,23 @@
169 reg = <0x3>; 169 reg = <0x3>;
170 }; 170 };
171 171
172 sgmii_phy0: sgmii-phy@0 {
173 interrupts = <6 1 0 0>;
174 reg = <0x1c>;
175 };
176 sgmii_phy1: sgmii-phy@1 {
177 interrupts = <6 1 0 0>;
178 reg = <0x1d>;
179 };
180 sgmii_phy2: sgmii-phy@2 {
181 interrupts = <7 1 0 0>;
182 reg = <0x1e>;
183 };
184 sgmii_phy3: sgmii-phy@3 {
185 interrupts = <7 1 0 0>;
186 reg = <0x1f>;
187 };
188
172 tbi0: tbi-phy@11 { 189 tbi0: tbi-phy@11 {
173 reg = <0x11>; 190 reg = <0x11>;
174 device_type = "tbi-phy"; 191 device_type = "tbi-phy";
diff --git a/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts b/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts
index d34d12712125..ef9ef56b3eeb 100644
--- a/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts
+++ b/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts
@@ -67,10 +67,10 @@
67 msi@41600 { 67 msi@41600 {
68 msi-available-ranges = <0 0x80>; 68 msi-available-ranges = <0 0x80>;
69 interrupts = < 69 interrupts = <
70 0xe0 0 70 0xe0 0 0 0
71 0xe1 0 71 0xe1 0 0 0
72 0xe2 0 72 0xe2 0 0 0
73 0xe3 0>; 73 0xe3 0 0 0>;
74 }; 74 };
75 timer@42100 { 75 timer@42100 {
76 status = "disabled"; 76 status = "disabled";
diff --git a/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts b/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts
index d6a8fafc0d0d..24564ee108e5 100644
--- a/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts
+++ b/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts
@@ -67,9 +67,6 @@
67 ethernet@24000 { 67 ethernet@24000 {
68 status = "disabled"; 68 status = "disabled";
69 }; 69 };
70 mdio@24520 {
71 status = "disabled";
72 };
73 ptp_clock@24e00 { 70 ptp_clock@24e00 {
74 status = "disabled"; 71 status = "disabled";
75 }; 72 };
@@ -100,10 +97,10 @@
100 msi@41600 { 97 msi@41600 {
101 msi-available-ranges = <0x80 0x80>; 98 msi-available-ranges = <0x80 0x80>;
102 interrupts = < 99 interrupts = <
103 0xe4 0 100 0xe4 0 0 0
104 0xe5 0 101 0xe5 0 0 0
105 0xe6 0 102 0xe6 0 0 0
106 0xe7 0>; 103 0xe7 0 0 0>;
107 }; 104 };
108 global-utilities@e0000 { 105 global-utilities@e0000 {
109 status = "disabled"; 106 status = "disabled";
diff --git a/arch/powerpc/boot/dts/p1010rdb.dtsi b/arch/powerpc/boot/dts/p1010rdb.dtsi
index 49776143a1b8..ec7c27a64671 100644
--- a/arch/powerpc/boot/dts/p1010rdb.dtsi
+++ b/arch/powerpc/boot/dts/p1010rdb.dtsi
@@ -126,12 +126,24 @@
126 126
127&board_soc { 127&board_soc {
128 i2c@3000 { 128 i2c@3000 {
129 eeprom@50 {
130 compatible = "st,24c256";
131 reg = <0x50>;
132 };
133
129 rtc@68 { 134 rtc@68 {
130 compatible = "pericom,pt7c4338"; 135 compatible = "pericom,pt7c4338";
131 reg = <0x68>; 136 reg = <0x68>;
132 }; 137 };
133 }; 138 };
134 139
140 i2c@3100 {
141 eeprom@52 {
142 compatible = "atmel,24c01";
143 reg = <0x52>;
144 };
145 };
146
135 spi@7000 { 147 spi@7000 {
136 flash@0 { 148 flash@0 {
137 #address-cells = <1>; 149 #address-cells = <1>;
diff --git a/arch/powerpc/boot/dts/p1021rdb.dtsi b/arch/powerpc/boot/dts/p1021rdb-pc.dtsi
index b973461ab751..c13abfbbe2e2 100644
--- a/arch/powerpc/boot/dts/p1021rdb.dtsi
+++ b/arch/powerpc/boot/dts/p1021rdb-pc.dtsi
@@ -1,7 +1,7 @@
1/* 1/*
2 * P1021 RDB Device Tree Source stub (no addresses or top-level ranges) 2 * P1021 RDB Device Tree Source stub (no addresses or top-level ranges)
3 * 3 *
4 * Copyright 2011 Freescale Semiconductor Inc. 4 * Copyright 2012 Freescale Semiconductor Inc.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
diff --git a/arch/powerpc/boot/dts/p1021rdb.dts b/arch/powerpc/boot/dts/p1021rdb-pc_32b.dts
index 90b6b4caa273..7cefa12b629a 100644
--- a/arch/powerpc/boot/dts/p1021rdb.dts
+++ b/arch/powerpc/boot/dts/p1021rdb-pc_32b.dts
@@ -1,7 +1,7 @@
1/* 1/*
2 * P1021 RDB Device Tree Source 2 * P1021 RDB Device Tree Source
3 * 3 *
4 * Copyright 2011 Freescale Semiconductor Inc. 4 * Copyright 2012 Freescale Semiconductor Inc.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
@@ -92,5 +92,5 @@
92 }; 92 };
93}; 93};
94 94
95/include/ "p1021rdb.dtsi" 95/include/ "p1021rdb-pc.dtsi"
96/include/ "fsl/p1021si-post.dtsi" 96/include/ "fsl/p1021si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p1021rdb_36b.dts b/arch/powerpc/boot/dts/p1021rdb-pc_36b.dts
index ea6d8b5fa10b..53d0c889039c 100644
--- a/arch/powerpc/boot/dts/p1021rdb_36b.dts
+++ b/arch/powerpc/boot/dts/p1021rdb-pc_36b.dts
@@ -1,7 +1,7 @@
1/* 1/*
2 * P1021 RDB Device Tree Source (36-bit address map) 2 * P1021 RDB Device Tree Source (36-bit address map)
3 * 3 *
4 * Copyright 2011 Freescale Semiconductor Inc. 4 * Copyright 2012 Freescale Semiconductor Inc.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions are met:
@@ -92,5 +92,5 @@
92 }; 92 };
93}; 93};
94 94
95/include/ "p1021rdb.dtsi" 95/include/ "p1021rdb-pc.dtsi"
96/include/ "fsl/p1021si-post.dtsi" 96/include/ "fsl/p1021si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p1022ds.dtsi b/arch/powerpc/boot/dts/p1022ds.dtsi
index 7cdb505036bb..c3344b04d8ff 100644
--- a/arch/powerpc/boot/dts/p1022ds.dtsi
+++ b/arch/powerpc/boot/dts/p1022ds.dtsi
@@ -33,22 +33,6 @@
33 */ 33 */
34 34
35&board_lbc { 35&board_lbc {
36 /*
37 * This node is used to access the pixis via "indirect" mode,
38 * which is done by writing the pixis register index to chip
39 * select 0 and the value to/from chip select 1. Indirect
40 * mode is the only way to access the pixis when DIU video
41 * is enabled. Note that this assumes that the first column
42 * of the 'ranges' property above is the chip select number.
43 */
44 board-control@0,0 {
45 compatible = "fsl,p1022ds-indirect-pixis";
46 reg = <0x0 0x0 1 /* CS0 */
47 0x1 0x0 1>; /* CS1 */
48 interrupt-parent = <&mpic>;
49 interrupts = <8 0 0 0>;
50 };
51
52 nor@0,0 { 36 nor@0,0 {
53 #address-cells = <1>; 37 #address-cells = <1>;
54 #size-cells = <1>; 38 #size-cells = <1>;
@@ -161,6 +145,10 @@
161 * the clock is enabled. 145 * the clock is enabled.
162 */ 146 */
163 }; 147 };
148 rtc@68 {
149 compatible = "dallas,ds1339";
150 reg = <0x68>;
151 };
164 }; 152 };
165 153
166 spi@7000 { 154 spi@7000 {
diff --git a/arch/powerpc/boot/dts/p1024rdb.dtsi b/arch/powerpc/boot/dts/p1024rdb.dtsi
new file mode 100644
index 000000000000..b05dcb40f800
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1024rdb.dtsi
@@ -0,0 +1,228 @@
1/*
2 * P1024 RDB Device Tree Source stub (no addresses or top-level ranges)
3 *
4 * Copyright 2012 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
35&lbc {
36 nor@0,0 {
37 #address-cells = <1>;
38 #size-cells = <1>;
39 compatible = "cfi-flash";
40 reg = <0x0 0x0 0x1000000>;
41 bank-width = <2>;
42 device-width = <1>;
43
44 partition@0 {
45 /* This location must not be altered */
46 /* 256KB for Vitesse 7385 Switch firmware */
47 reg = <0x0 0x00040000>;
48 label = "NOR Vitesse-7385 Firmware";
49 read-only;
50 };
51
52 partition@40000 {
53 /* 256KB for DTB Image */
54 reg = <0x00040000 0x00040000>;
55 label = "NOR DTB Image";
56 };
57
58 partition@80000 {
59 /* 3.5 MB for Linux Kernel Image */
60 reg = <0x00080000 0x00380000>;
61 label = "NOR Linux Kernel Image";
62 };
63
64 partition@400000 {
65 /* 11MB for JFFS2 based Root file System */
66 reg = <0x00400000 0x00b00000>;
67 label = "NOR JFFS2 Root File System";
68 };
69
70 partition@f00000 {
71 /* This location must not be altered */
72 /* 512KB for u-boot Bootloader Image */
73 /* 512KB for u-boot Environment Variables */
74 reg = <0x00f00000 0x00100000>;
75 label = "NOR U-Boot Image";
76 read-only;
77 };
78 };
79
80 nand@1,0 {
81 #address-cells = <1>;
82 #size-cells = <1>;
83 compatible = "fsl,p1020-fcm-nand",
84 "fsl,elbc-fcm-nand";
85 reg = <0x1 0x0 0x40000>;
86
87 partition@0 {
88 /* This location must not be altered */
89 /* 1MB for u-boot Bootloader Image */
90 reg = <0x0 0x00100000>;
91 label = "NAND U-Boot Image";
92 read-only;
93 };
94
95 partition@100000 {
96 /* 1MB for DTB Image */
97 reg = <0x00100000 0x00100000>;
98 label = "NAND DTB Image";
99 };
100
101 partition@200000 {
102 /* 4MB for Linux Kernel Image */
103 reg = <0x00200000 0x00400000>;
104 label = "NAND Linux Kernel Image";
105 };
106
107 partition@600000 {
108 /* 4MB for Compressed Root file System Image */
109 reg = <0x00600000 0x00400000>;
110 label = "NAND Compressed RFS Image";
111 };
112
113 partition@a00000 {
114 /* 15MB for JFFS2 based Root file System */
115 reg = <0x00a00000 0x00f00000>;
116 label = "NAND JFFS2 Root File System";
117 };
118
119 partition@1900000 {
120 /* 7MB for User Writable Area */
121 reg = <0x01900000 0x00700000>;
122 label = "NAND Writable User area";
123 };
124 };
125};
126
127&soc {
128 spi@7000 {
129 flash@0 {
130 #address-cells = <1>;
131 #size-cells = <1>;
132 compatible = "spansion,m25p80";
133 reg = <0>;
134 spi-max-frequency = <40000000>;
135
136 partition@0 {
137 /* 512KB for u-boot Bootloader Image */
138 reg = <0x0 0x00080000>;
139 label = "SPI U-Boot Image";
140 read-only;
141 };
142
143 partition@80000 {
144 /* 512KB for DTB Image */
145 reg = <0x00080000 0x00080000>;
146 label = "SPI DTB Image";
147 };
148
149 partition@100000 {
150 /* 4MB for Linux Kernel Image */
151 reg = <0x00100000 0x00400000>;
152 label = "SPI Linux Kernel Image";
153 };
154
155 partition@500000 {
156 /* 4MB for Compressed RFS Image */
157 reg = <0x00500000 0x00400000>;
158 label = "SPI Compressed RFS Image";
159 };
160
161 partition@900000 {
162 /* 7MB for JFFS2 based RFS */
163 reg = <0x00900000 0x00700000>;
164 label = "SPI JFFS2 RFS";
165 };
166 };
167 };
168
169 i2c@3000 {
170 rtc@68 {
171 compatible = "dallas,ds1339";
172 reg = <0x68>;
173 };
174 };
175
176 usb@22000 {
177 phy_type = "ulpi";
178 };
179
180 usb@23000 {
181 status = "disabled";
182 };
183
184 mdio@24000 {
185 phy0: ethernet-phy@0 {
186 interrupts = <3 1 0 0>;
187 reg = <0x0>;
188 };
189 phy1: ethernet-phy@1 {
190 interrupts = <2 1 0 0>;
191 reg = <0x1>;
192 };
193 phy2: ethernet-phy@2 {
194 interrupts = <1 1 0 0>;
195 reg = <0x2>;
196 };
197 };
198
199 mdio@25000 {
200 tbi0: tbi-phy@11 {
201 reg = <0x11>;
202 device_type = "tbi-phy";
203 };
204 };
205
206 mdio@26000 {
207 tbi1: tbi-phy@11 {
208 reg = <0x11>;
209 device_type = "tbi-phy";
210 };
211 };
212
213 ethernet@b0000 {
214 phy-handle = <&phy2>;
215 phy-connection-type = "rgmii-id";
216 };
217
218 ethernet@b1000 {
219 phy-handle = <&phy0>;
220 tbi-handle = <&tbi0>;
221 phy-connection-type = "sgmii";
222 };
223
224 ethernet@b2000 {
225 phy-handle = <&phy1>;
226 phy-connection-type = "rgmii-id";
227 };
228};
diff --git a/arch/powerpc/boot/dts/p1024rdb_32b.dts b/arch/powerpc/boot/dts/p1024rdb_32b.dts
new file mode 100644
index 000000000000..90e803e9ba5f
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1024rdb_32b.dts
@@ -0,0 +1,87 @@
1/*
2 * P1024 RDB 32Bit Physical Address Map Device Tree Source
3 *
4 * Copyright 2012 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
35/include/ "fsl/p1020si-pre.dtsi"
36/ {
37 model = "fsl,P1024RDB";
38 compatible = "fsl,P1024RDB";
39
40 memory {
41 device_type = "memory";
42 };
43
44 lbc: localbus@ffe05000 {
45 reg = <0x0 0xffe05000 0 0x1000>;
46 ranges = <0x0 0x0 0x0 0xef000000 0x01000000
47 0x1 0x0 0x0 0xff800000 0x00040000>;
48 };
49
50 soc: soc@ffe00000 {
51 ranges = <0x0 0x0 0xffe00000 0x100000>;
52 };
53
54 pci0: pcie@ffe09000 {
55 reg = <0x0 0xffe09000 0 0x1000>;
56 ranges = <0x2000000 0x0 0xe0000000 0x0 0xa0000000 0x0 0x20000000
57 0x1000000 0x0 0x00000000 0x0 0xffc10000 0x0 0x10000>;
58 pcie@0 {
59 ranges = <0x2000000 0x0 0xe0000000
60 0x2000000 0x0 0xe0000000
61 0x0 0x20000000
62
63 0x1000000 0x0 0x0
64 0x1000000 0x0 0x0
65 0x0 0x100000>;
66 };
67 };
68
69 pci1: pcie@ffe0a000 {
70 reg = <0x0 0xffe0a000 0 0x1000>;
71 ranges = <0x2000000 0x0 0xe0000000 0x0 0x80000000 0x0 0x20000000
72 0x1000000 0x0 0x00000000 0x0 0xffc00000 0x0 0x10000>;
73 pcie@0 {
74 reg = <0x0 0x0 0x0 0x0 0x0>;
75 ranges = <0x2000000 0x0 0xe0000000
76 0x2000000 0x0 0xe0000000
77 0x0 0x20000000
78
79 0x1000000 0x0 0x0
80 0x1000000 0x0 0x0
81 0x0 0x100000>;
82 };
83 };
84};
85
86/include/ "p1024rdb.dtsi"
87/include/ "fsl/p1020si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p1024rdb_36b.dts b/arch/powerpc/boot/dts/p1024rdb_36b.dts
new file mode 100644
index 000000000000..3656825b65a1
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1024rdb_36b.dts
@@ -0,0 +1,87 @@
1/*
2 * P1024 RDB 36Bit Physical Address Map Device Tree Source
3 *
4 * Copyright 2012 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
35/include/ "fsl/p1020si-pre.dtsi"
36/ {
37 model = "fsl,P1024RDB";
38 compatible = "fsl,P1024RDB";
39
40 memory {
41 device_type = "memory";
42 };
43
44 lbc: localbus@fffe05000 {
45 reg = <0xf 0xffe05000 0 0x1000>;
46 ranges = <0x0 0x0 0xf 0xef000000 0x01000000
47 0x1 0x0 0xf 0xff800000 0x00040000>;
48 };
49
50 soc: soc@fffe00000 {
51 ranges = <0x0 0xf 0xffe00000 0x100000>;
52 };
53
54 pci0: pcie@fffe09000 {
55 reg = <0xf 0xffe09000 0 0x1000>;
56 ranges = <0x2000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000
57 0x1000000 0x0 0x00000000 0xf 0xffc10000 0x0 0x10000>;
58 pcie@0 {
59 ranges = <0x2000000 0x0 0xe0000000
60 0x2000000 0x0 0xe0000000
61 0x0 0x20000000
62
63 0x1000000 0x0 0x0
64 0x1000000 0x0 0x0
65 0x0 0x100000>;
66 };
67 };
68
69 pci1: pcie@fffe0a000 {
70 reg = <0xf 0xffe0a000 0 0x1000>;
71 ranges = <0x2000000 0x0 0xe0000000 0xc 0x00000000 0x0 0x20000000
72 0x1000000 0x0 0x00000000 0xf 0xffc00000 0x0 0x10000>;
73 pcie@0 {
74 reg = <0x0 0x0 0x0 0x0 0x0>;
75 ranges = <0x2000000 0x0 0xe0000000
76 0x2000000 0x0 0xe0000000
77 0x0 0x20000000
78
79 0x1000000 0x0 0x0
80 0x1000000 0x0 0x0
81 0x0 0x100000>;
82 };
83 };
84};
85
86/include/ "p1024rdb.dtsi"
87/include/ "fsl/p1020si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/p1025rdb.dtsi b/arch/powerpc/boot/dts/p1025rdb.dtsi
index cf3676fc714b..f50256482297 100644
--- a/arch/powerpc/boot/dts/p1025rdb.dtsi
+++ b/arch/powerpc/boot/dts/p1025rdb.dtsi
@@ -282,5 +282,45 @@
282 0x1 0x4 0x2 0x0 0x2 0x0 /* ENET5_RX_DV_SER5_CTS_B */ 282 0x1 0x4 0x2 0x0 0x2 0x0 /* ENET5_RX_DV_SER5_CTS_B */
283 0x1 0x8 0x2 0x0 0x2 0x0>; /* ENET5_RX_ER_SER5_CD_B */ 283 0x1 0x8 0x2 0x0 0x2 0x0>; /* ENET5_RX_ER_SER5_CD_B */
284 }; 284 };
285
286 pio3: ucc_pin@03 {
287 pio-map = <
288 /* port pin dir open_drain assignment has_irq */
289 0x0 0x16 0x2 0x0 0x2 0x0 /* SER7_CD_B*/
290 0x0 0x12 0x2 0x0 0x2 0x0 /* SER7_CTS_B*/
291 0x0 0x13 0x1 0x0 0x2 0x0 /* SER7_RTS_B*/
292 0x0 0x14 0x2 0x0 0x2 0x0 /* SER7_RXD0*/
293 0x0 0x15 0x1 0x0 0x2 0x0>; /* SER7_TXD0*/
294 };
295
296 pio4: ucc_pin@04 {
297 pio-map = <
298 /* port pin dir open_drain assignment has_irq */
299 0x1 0x0 0x2 0x0 0x2 0x0 /* SER3_CD_B*/
300 0x0 0x1c 0x2 0x0 0x2 0x0 /* SER3_CTS_B*/
301 0x0 0x1d 0x1 0x0 0x2 0x0 /* SER3_RTS_B*/
302 0x0 0x1e 0x2 0x0 0x2 0x0 /* SER3_RXD0*/
303 0x0 0x1f 0x1 0x0 0x2 0x0>; /* SER3_TXD0*/
304 };
305 };
306};
307
308&qe {
309 serial2: ucc@2600 {
310 device_type = "serial";
311 compatible = "ucc_uart";
312 port-number = <0>;
313 rx-clock-name = "brg6";
314 tx-clock-name = "brg6";
315 pio-handle = <&pio3>;
316 };
317
318 serial3: ucc@2200 {
319 device_type = "serial";
320 compatible = "ucc_uart";
321 port-number = <1>;
322 rx-clock-name = "brg2";
323 tx-clock-name = "brg2";
324 pio-handle = <&pio4>;
285 }; 325 };
286}; 326};
diff --git a/arch/powerpc/boot/dts/p2020ds.dtsi b/arch/powerpc/boot/dts/p2020ds.dtsi
index d3b939c573b0..e699cf95b063 100644
--- a/arch/powerpc/boot/dts/p2020ds.dtsi
+++ b/arch/powerpc/boot/dts/p2020ds.dtsi
@@ -150,6 +150,16 @@
150 interrupts = <3 1 0 0>; 150 interrupts = <3 1 0 0>;
151 reg = <0x2>; 151 reg = <0x2>;
152 }; 152 };
153
154 sgmii_phy1: sgmii-phy@1 {
155 interrupts = <5 1 0 0>;
156 reg = <0x1c>;
157 };
158 sgmii_phy2: sgmii-phy@2 {
159 interrupts = <5 1 0 0>;
160 reg = <0x1d>;
161 };
162
153 tbi0: tbi-phy@11 { 163 tbi0: tbi-phy@11 {
154 reg = <0x11>; 164 reg = <0x11>;
155 device_type = "tbi-phy"; 165 device_type = "tbi-phy";
diff --git a/arch/powerpc/boot/dts/p2020rdb.dts b/arch/powerpc/boot/dts/p2020rdb.dts
index 153bc76bb48e..4d52bce1d5b0 100644
--- a/arch/powerpc/boot/dts/p2020rdb.dts
+++ b/arch/powerpc/boot/dts/p2020rdb.dts
@@ -34,7 +34,7 @@
34 34
35 /* NOR and NAND Flashes */ 35 /* NOR and NAND Flashes */
36 ranges = <0x0 0x0 0x0 0xef000000 0x01000000 36 ranges = <0x0 0x0 0x0 0xef000000 0x01000000
37 0x1 0x0 0x0 0xff800000 0x00040000 37 0x1 0x0 0x0 0xffa00000 0x00040000
38 0x2 0x0 0x0 0xffb00000 0x00020000>; 38 0x2 0x0 0x0 0xffb00000 0x00020000>;
39 39
40 nor@0,0 { 40 nor@0,0 {
diff --git a/arch/powerpc/boot/dts/p2041rdb.dts b/arch/powerpc/boot/dts/p2041rdb.dts
index 285213976a7f..baab0347dab0 100644
--- a/arch/powerpc/boot/dts/p2041rdb.dts
+++ b/arch/powerpc/boot/dts/p2041rdb.dts
@@ -121,7 +121,8 @@
121 121
122 lbc: localbus@ffe124000 { 122 lbc: localbus@ffe124000 {
123 reg = <0xf 0xfe124000 0 0x1000>; 123 reg = <0xf 0xfe124000 0 0x1000>;
124 ranges = <0 0 0xf 0xe8000000 0x08000000>; 124 ranges = <0 0 0xf 0xe8000000 0x08000000
125 1 0 0xf 0xffa00000 0x00040000>;
125 126
126 flash@0,0 { 127 flash@0,0 {
127 compatible = "cfi-flash"; 128 compatible = "cfi-flash";
@@ -129,6 +130,44 @@
129 bank-width = <2>; 130 bank-width = <2>;
130 device-width = <2>; 131 device-width = <2>;
131 }; 132 };
133
134 nand@1,0 {
135 #address-cells = <1>;
136 #size-cells = <1>;
137 compatible = "fsl,elbc-fcm-nand";
138 reg = <0x1 0x0 0x40000>;
139
140 partition@0 {
141 label = "NAND U-Boot Image";
142 reg = <0x0 0x02000000>;
143 read-only;
144 };
145
146 partition@2000000 {
147 label = "NAND Root File System";
148 reg = <0x02000000 0x10000000>;
149 };
150
151 partition@12000000 {
152 label = "NAND Compressed RFS Image";
153 reg = <0x12000000 0x08000000>;
154 };
155
156 partition@1a000000 {
157 label = "NAND Linux Kernel Image";
158 reg = <0x1a000000 0x04000000>;
159 };
160
161 partition@1e000000 {
162 label = "NAND DTB Image";
163 reg = <0x1e000000 0x01000000>;
164 };
165
166 partition@1f000000 {
167 label = "NAND Writable User area";
168 reg = <0x1f000000 0x01000000>;
169 };
170 };
132 }; 171 };
133 172
134 pci0: pcie@ffe200000 { 173 pci0: pcie@ffe200000 {
diff --git a/arch/powerpc/boot/dts/p3060qds.dts b/arch/powerpc/boot/dts/p3060qds.dts
deleted file mode 100644
index 9ae875c8a211..000000000000
--- a/arch/powerpc/boot/dts/p3060qds.dts
+++ /dev/null
@@ -1,242 +0,0 @@
1/*
2 * P3060QDS Device Tree Source
3 *
4 * Copyright 2011 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
35/include/ "fsl/p3060si-pre.dtsi"
36
37/ {
38 model = "fsl,P3060QDS";
39 compatible = "fsl,P3060QDS";
40 #address-cells = <2>;
41 #size-cells = <2>;
42 interrupt-parent = <&mpic>;
43
44 memory {
45 device_type = "memory";
46 };
47
48 dcsr: dcsr@f00000000 {
49 ranges = <0x00000000 0xf 0x00000000 0x01008000>;
50 };
51
52 soc: soc@ffe000000 {
53 ranges = <0x00000000 0xf 0xfe000000 0x1000000>;
54 reg = <0xf 0xfe000000 0 0x00001000>;
55 spi@110000 {
56 flash@0 {
57 #address-cells = <1>;
58 #size-cells = <1>;
59 compatible = "spansion,s25sl12801";
60 reg = <0>;
61 spi-max-frequency = <40000000>; /* input clock */
62 partition@u-boot {
63 label = "u-boot";
64 reg = <0x00000000 0x00100000>;
65 read-only;
66 };
67 partition@kernel {
68 label = "kernel";
69 reg = <0x00100000 0x00500000>;
70 read-only;
71 };
72 partition@dtb {
73 label = "dtb";
74 reg = <0x00600000 0x00100000>;
75 read-only;
76 };
77 partition@fs {
78 label = "file system";
79 reg = <0x00700000 0x00900000>;
80 };
81 };
82 flash@1 {
83 #address-cells = <1>;
84 #size-cells = <1>;
85 compatible = "spansion,en25q32b";
86 reg = <1>;
87 spi-max-frequency = <40000000>; /* input clock */
88 partition@spi1 {
89 label = "spi1";
90 reg = <0x00000000 0x00400000>;
91 };
92 };
93 flash@2 {
94 #address-cells = <1>;
95 #size-cells = <1>;
96 compatible = "atmel,at45db081d";
97 reg = <2>;
98 spi-max-frequency = <40000000>; /* input clock */
99 partition@spi1 {
100 label = "spi2";
101 reg = <0x00000000 0x00100000>;
102 };
103 };
104 flash@3 {
105 #address-cells = <1>;
106 #size-cells = <1>;
107 compatible = "spansion,sst25wf040";
108 reg = <3>;
109 spi-max-frequency = <40000000>; /* input clock */
110 partition@spi3 {
111 label = "spi3";
112 reg = <0x00000000 0x00080000>;
113 };
114 };
115 };
116
117 i2c@118000 {
118 eeprom@51 {
119 compatible = "at24,24c256";
120 reg = <0x51>;
121 };
122 eeprom@53 {
123 compatible = "at24,24c256";
124 reg = <0x53>;
125 };
126 rtc@68 {
127 compatible = "dallas,ds3232";
128 reg = <0x68>;
129 interrupts = <0x1 0x1 0 0>;
130 };
131 };
132
133 usb0: usb@210000 {
134 phy_type = "ulpi";
135 };
136
137 usb1: usb@211000 {
138 dr_mode = "host";
139 phy_type = "ulpi";
140 };
141 };
142
143 rio: rapidio@ffe0c0000 {
144 reg = <0xf 0xfe0c0000 0 0x11000>;
145
146 port1 {
147 ranges = <0 0 0xc 0x20000000 0 0x10000000>;
148 };
149 port2 {
150 ranges = <0 0 0xc 0x30000000 0 0x10000000>;
151 };
152 };
153
154 lbc: localbus@ffe124000 {
155 reg = <0xf 0xfe124000 0 0x1000>;
156 ranges = <0 0 0xf 0xe8000000 0x08000000
157 2 0 0xf 0xffa00000 0x00040000
158 3 0 0xf 0xffdf0000 0x00008000>;
159
160 flash@0,0 {
161 compatible = "cfi-flash";
162 reg = <0 0 0x08000000>;
163 bank-width = <2>;
164 device-width = <2>;
165 };
166
167 nand@2,0 {
168 #address-cells = <1>;
169 #size-cells = <1>;
170 compatible = "fsl,elbc-fcm-nand";
171 reg = <0x2 0x0 0x40000>;
172
173 partition@0 {
174 label = "NAND U-Boot Image";
175 reg = <0x0 0x02000000>;
176 read-only;
177 };
178
179 partition@2000000 {
180 label = "NAND Root File System";
181 reg = <0x02000000 0x10000000>;
182 };
183
184 partition@12000000 {
185 label = "NAND Compressed RFS Image";
186 reg = <0x12000000 0x08000000>;
187 };
188
189 partition@1a000000 {
190 label = "NAND Linux Kernel Image";
191 reg = <0x1a000000 0x04000000>;
192 };
193
194 partition@1e000000 {
195 label = "NAND DTB Image";
196 reg = <0x1e000000 0x01000000>;
197 };
198
199 partition@1f000000 {
200 label = "NAND Writable User area";
201 reg = <0x1f000000 0x21000000>;
202 };
203 };
204
205 board-control@3,0 {
206 compatible = "fsl,p3060qds-fpga", "fsl,fpga-qixis";
207 reg = <3 0 0x100>;
208 };
209 };
210
211 pci0: pcie@ffe200000 {
212 reg = <0xf 0xfe200000 0 0x1000>;
213 ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000
214 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>;
215 pcie@0 {
216 ranges = <0x02000000 0 0xe0000000
217 0x02000000 0 0xe0000000
218 0 0x20000000
219
220 0x01000000 0 0x00000000
221 0x01000000 0 0x00000000
222 0 0x00010000>;
223 };
224 };
225
226 pci1: pcie@ffe201000 {
227 reg = <0xf 0xfe201000 0 0x1000>;
228 ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000
229 0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>;
230 pcie@0 {
231 ranges = <0x02000000 0 0xe0000000
232 0x02000000 0 0xe0000000
233 0 0x20000000
234
235 0x01000000 0 0x00000000
236 0x01000000 0 0x00000000
237 0 0x00010000>;
238 };
239 };
240};
241
242/include/ "fsl/p3060si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/sbc8560.dts b/arch/powerpc/boot/dts/sbc8560.dts
deleted file mode 100644
index 72078eb15616..000000000000
--- a/arch/powerpc/boot/dts/sbc8560.dts
+++ /dev/null
@@ -1,406 +0,0 @@
1/*
2 * SBC8560 Device Tree Source
3 *
4 * Copyright 2007 Wind River Systems Inc.
5 *
6 * Paul Gortmaker (see MAINTAINERS for contact information)
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14/dts-v1/;
15
16/ {
17 model = "SBC8560";
18 compatible = "SBC8560";
19 #address-cells = <1>;
20 #size-cells = <1>;
21
22 aliases {
23 ethernet0 = &enet0;
24 ethernet1 = &enet1;
25 ethernet2 = &enet2;
26 ethernet3 = &enet3;
27 serial0 = &serial0;
28 serial1 = &serial1;
29 pci0 = &pci0;
30 };
31
32 cpus {
33 #address-cells = <1>;
34 #size-cells = <0>;
35
36 PowerPC,8560@0 {
37 device_type = "cpu";
38 reg = <0>;
39 d-cache-line-size = <0x20>; // 32 bytes
40 i-cache-line-size = <0x20>; // 32 bytes
41 d-cache-size = <0x8000>; // L1, 32K
42 i-cache-size = <0x8000>; // L1, 32K
43 timebase-frequency = <0>; // From uboot
44 bus-frequency = <0>;
45 clock-frequency = <0>;
46 next-level-cache = <&L2>;
47 };
48 };
49
50 memory {
51 device_type = "memory";
52 reg = <0x00000000 0x20000000>;
53 };
54
55 soc@ff700000 {
56 #address-cells = <1>;
57 #size-cells = <1>;
58 device_type = "soc";
59 ranges = <0x0 0xff700000 0x00100000>;
60 clock-frequency = <0>;
61
62 ecm-law@0 {
63 compatible = "fsl,ecm-law";
64 reg = <0x0 0x1000>;
65 fsl,num-laws = <8>;
66 };
67
68 ecm@1000 {
69 compatible = "fsl,mpc8560-ecm", "fsl,ecm";
70 reg = <0x1000 0x1000>;
71 interrupts = <17 2>;
72 interrupt-parent = <&mpic>;
73 };
74
75 memory-controller@2000 {
76 compatible = "fsl,mpc8560-memory-controller";
77 reg = <0x2000 0x1000>;
78 interrupt-parent = <&mpic>;
79 interrupts = <0x12 0x2>;
80 };
81
82 L2: l2-cache-controller@20000 {
83 compatible = "fsl,mpc8560-l2-cache-controller";
84 reg = <0x20000 0x1000>;
85 cache-line-size = <0x20>; // 32 bytes
86 cache-size = <0x40000>; // L2, 256K
87 interrupt-parent = <&mpic>;
88 interrupts = <0x10 0x2>;
89 };
90
91 i2c@3000 {
92 #address-cells = <1>;
93 #size-cells = <0>;
94 cell-index = <0>;
95 compatible = "fsl-i2c";
96 reg = <0x3000 0x100>;
97 interrupts = <0x2b 0x2>;
98 interrupt-parent = <&mpic>;
99 dfsrr;
100 };
101
102 i2c@3100 {
103 #address-cells = <1>;
104 #size-cells = <0>;
105 cell-index = <1>;
106 compatible = "fsl-i2c";
107 reg = <0x3100 0x100>;
108 interrupts = <0x2b 0x2>;
109 interrupt-parent = <&mpic>;
110 dfsrr;
111 };
112
113 dma@21300 {
114 #address-cells = <1>;
115 #size-cells = <1>;
116 compatible = "fsl,mpc8560-dma", "fsl,eloplus-dma";
117 reg = <0x21300 0x4>;
118 ranges = <0x0 0x21100 0x200>;
119 cell-index = <0>;
120 dma-channel@0 {
121 compatible = "fsl,mpc8560-dma-channel",
122 "fsl,eloplus-dma-channel";
123 reg = <0x0 0x80>;
124 cell-index = <0>;
125 interrupt-parent = <&mpic>;
126 interrupts = <20 2>;
127 };
128 dma-channel@80 {
129 compatible = "fsl,mpc8560-dma-channel",
130 "fsl,eloplus-dma-channel";
131 reg = <0x80 0x80>;
132 cell-index = <1>;
133 interrupt-parent = <&mpic>;
134 interrupts = <21 2>;
135 };
136 dma-channel@100 {
137 compatible = "fsl,mpc8560-dma-channel",
138 "fsl,eloplus-dma-channel";
139 reg = <0x100 0x80>;
140 cell-index = <2>;
141 interrupt-parent = <&mpic>;
142 interrupts = <22 2>;
143 };
144 dma-channel@180 {
145 compatible = "fsl,mpc8560-dma-channel",
146 "fsl,eloplus-dma-channel";
147 reg = <0x180 0x80>;
148 cell-index = <3>;
149 interrupt-parent = <&mpic>;
150 interrupts = <23 2>;
151 };
152 };
153
154 enet0: ethernet@24000 {
155 #address-cells = <1>;
156 #size-cells = <1>;
157 cell-index = <0>;
158 device_type = "network";
159 model = "TSEC";
160 compatible = "gianfar";
161 reg = <0x24000 0x1000>;
162 ranges = <0x0 0x24000 0x1000>;
163 local-mac-address = [ 00 00 00 00 00 00 ];
164 interrupts = <0x1d 0x2 0x1e 0x2 0x22 0x2>;
165 interrupt-parent = <&mpic>;
166 tbi-handle = <&tbi0>;
167 phy-handle = <&phy0>;
168
169 mdio@520 {
170 #address-cells = <1>;
171 #size-cells = <0>;
172 compatible = "fsl,gianfar-mdio";
173 reg = <0x520 0x20>;
174 phy0: ethernet-phy@19 {
175 interrupt-parent = <&mpic>;
176 interrupts = <0x6 0x1>;
177 reg = <0x19>;
178 device_type = "ethernet-phy";
179 };
180 phy1: ethernet-phy@1a {
181 interrupt-parent = <&mpic>;
182 interrupts = <0x7 0x1>;
183 reg = <0x1a>;
184 device_type = "ethernet-phy";
185 };
186 phy2: ethernet-phy@1b {
187 interrupt-parent = <&mpic>;
188 interrupts = <0x8 0x1>;
189 reg = <0x1b>;
190 device_type = "ethernet-phy";
191 };
192 phy3: ethernet-phy@1c {
193 interrupt-parent = <&mpic>;
194 interrupts = <0x8 0x1>;
195 reg = <0x1c>;
196 device_type = "ethernet-phy";
197 };
198 tbi0: tbi-phy@11 {
199 reg = <0x11>;
200 device_type = "tbi-phy";
201 };
202 };
203 };
204
205 enet1: ethernet@25000 {
206 #address-cells = <1>;
207 #size-cells = <1>;
208 cell-index = <1>;
209 device_type = "network";
210 model = "TSEC";
211 compatible = "gianfar";
212 reg = <0x25000 0x1000>;
213 ranges = <0x0 0x25000 0x1000>;
214 local-mac-address = [ 00 00 00 00 00 00 ];
215 interrupts = <0x23 0x2 0x24 0x2 0x28 0x2>;
216 interrupt-parent = <&mpic>;
217 tbi-handle = <&tbi1>;
218 phy-handle = <&phy1>;
219
220 mdio@520 {
221 #address-cells = <1>;
222 #size-cells = <0>;
223 compatible = "fsl,gianfar-tbi";
224 reg = <0x520 0x20>;
225
226 tbi1: tbi-phy@11 {
227 reg = <0x11>;
228 device_type = "tbi-phy";
229 };
230 };
231 };
232
233 mpic: pic@40000 {
234 interrupt-controller;
235 #address-cells = <0>;
236 #interrupt-cells = <2>;
237 compatible = "chrp,open-pic";
238 reg = <0x40000 0x40000>;
239 device_type = "open-pic";
240 };
241
242 cpm@919c0 {
243 #address-cells = <1>;
244 #size-cells = <1>;
245 compatible = "fsl,mpc8560-cpm", "fsl,cpm2";
246 reg = <0x919c0 0x30>;
247 ranges;
248
249 muram@80000 {
250 #address-cells = <1>;
251 #size-cells = <1>;
252 ranges = <0x0 0x80000 0x10000>;
253
254 data@0 {
255 compatible = "fsl,cpm-muram-data";
256 reg = <0x0 0x4000 0x9000 0x2000>;
257 };
258 };
259
260 brg@919f0 {
261 compatible = "fsl,mpc8560-brg",
262 "fsl,cpm2-brg",
263 "fsl,cpm-brg";
264 reg = <0x919f0 0x10 0x915f0 0x10>;
265 clock-frequency = <165000000>;
266 };
267
268 cpmpic: pic@90c00 {
269 interrupt-controller;
270 #address-cells = <0>;
271 #interrupt-cells = <2>;
272 interrupts = <0x2e 0x2>;
273 interrupt-parent = <&mpic>;
274 reg = <0x90c00 0x80>;
275 compatible = "fsl,mpc8560-cpm-pic", "fsl,cpm2-pic";
276 };
277
278 enet2: ethernet@91320 {
279 device_type = "network";
280 compatible = "fsl,mpc8560-fcc-enet",
281 "fsl,cpm2-fcc-enet";
282 reg = <0x91320 0x20 0x88500 0x100 0x913b0 0x1>;
283 local-mac-address = [ 00 00 00 00 00 00 ];
284 fsl,cpm-command = <0x16200300>;
285 interrupts = <0x21 0x8>;
286 interrupt-parent = <&cpmpic>;
287 phy-handle = <&phy2>;
288 };
289
290 enet3: ethernet@91340 {
291 device_type = "network";
292 compatible = "fsl,mpc8560-fcc-enet",
293 "fsl,cpm2-fcc-enet";
294 reg = <0x91340 0x20 0x88600 0x100 0x913d0 0x1>;
295 local-mac-address = [ 00 00 00 00 00 00 ];
296 fsl,cpm-command = <0x1a400300>;
297 interrupts = <0x22 0x8>;
298 interrupt-parent = <&cpmpic>;
299 phy-handle = <&phy3>;
300 };
301 };
302
303 global-utilities@e0000 {
304 compatible = "fsl,mpc8560-guts";
305 reg = <0xe0000 0x1000>;
306 };
307 };
308
309 pci0: pci@ff708000 {
310 #interrupt-cells = <1>;
311 #size-cells = <2>;
312 #address-cells = <3>;
313 compatible = "fsl,mpc8540-pcix", "fsl,mpc8540-pci";
314 device_type = "pci";
315 reg = <0xff708000 0x1000>;
316 clock-frequency = <66666666>;
317 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
318 interrupt-map = <
319
320 /* IDSEL 0x02 */
321 0x1000 0x0 0x0 0x1 &mpic 0x2 0x1
322 0x1000 0x0 0x0 0x2 &mpic 0x3 0x1
323 0x1000 0x0 0x0 0x3 &mpic 0x4 0x1
324 0x1000 0x0 0x0 0x4 &mpic 0x5 0x1>;
325
326 interrupt-parent = <&mpic>;
327 interrupts = <0x18 0x2>;
328 bus-range = <0x0 0x0>;
329 ranges = <0x02000000 0x0 0x80000000 0x80000000 0x0 0x20000000
330 0x01000000 0x0 0x00000000 0xe2000000 0x0 0x00100000>;
331 };
332
333 localbus@ff705000 {
334 compatible = "fsl,mpc8560-localbus", "simple-bus";
335 #address-cells = <2>;
336 #size-cells = <1>;
337 reg = <0xff705000 0x100>; // BRx, ORx, etc.
338
339 ranges = <
340 0x0 0x0 0xff800000 0x0800000 // 8MB boot flash
341 0x1 0x0 0xe4000000 0x4000000 // 64MB flash
342 0x3 0x0 0x20000000 0x4000000 // 64MB SDRAM
343 0x4 0x0 0x24000000 0x4000000 // 64MB SDRAM
344 0x5 0x0 0xfc000000 0x0c00000 // EPLD
345 0x6 0x0 0xe0000000 0x4000000 // 64MB flash
346 0x7 0x0 0x80000000 0x0200000 // ATM1,2
347 >;
348
349 epld@5,0 {
350 compatible = "wrs,epld-localbus";
351 #address-cells = <2>;
352 #size-cells = <1>;
353 reg = <0x5 0x0 0xc00000>;
354 ranges = <
355 0x0 0x0 0x5 0x000000 0x1fff // LED disp.
356 0x1 0x0 0x5 0x100000 0x1fff // switches
357 0x2 0x0 0x5 0x200000 0x1fff // ID reg.
358 0x3 0x0 0x5 0x300000 0x1fff // status reg.
359 0x4 0x0 0x5 0x400000 0x1fff // reset reg.
360 0x5 0x0 0x5 0x500000 0x1fff // Wind port
361 0x7 0x0 0x5 0x700000 0x1fff // UART #1
362 0x8 0x0 0x5 0x800000 0x1fff // UART #2
363 0x9 0x0 0x5 0x900000 0x1fff // RTC
364 0xb 0x0 0x5 0xb00000 0x1fff // EEPROM
365 >;
366
367 bidr@2,0 {
368 compatible = "wrs,sbc8560-bidr";
369 reg = <0x2 0x0 0x10>;
370 };
371
372 bcsr@3,0 {
373 compatible = "wrs,sbc8560-bcsr";
374 reg = <0x3 0x0 0x10>;
375 };
376
377 brstcr@4,0 {
378 compatible = "wrs,sbc8560-brstcr";
379 reg = <0x4 0x0 0x10>;
380 };
381
382 serial0: serial@7,0 {
383 device_type = "serial";
384 compatible = "ns16550";
385 reg = <0x7 0x0 0x100>;
386 clock-frequency = <1843200>;
387 interrupts = <0x9 0x2>;
388 interrupt-parent = <&mpic>;
389 };
390
391 serial1: serial@8,0 {
392 device_type = "serial";
393 compatible = "ns16550";
394 reg = <0x8 0x0 0x100>;
395 clock-frequency = <1843200>;
396 interrupts = <0xa 0x2>;
397 interrupt-parent = <&mpic>;
398 };
399
400 rtc@9,0 {
401 compatible = "m48t59";
402 reg = <0x9 0x0 0x1fff>;
403 };
404 };
405 };
406};
diff --git a/arch/powerpc/boot/flatdevtree_env.h b/arch/powerpc/boot/flatdevtree_env.h
deleted file mode 100644
index 66e0ebb1a364..000000000000
--- a/arch/powerpc/boot/flatdevtree_env.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * This file adds the header file glue so that the shared files
3 * flatdevicetree.[ch] can compile and work in the powerpc bootwrapper.
4 *
5 * strncmp & strchr copied from <file:lib/string.c>
6 * Copyright (C) 1991, 1992 Linus Torvalds
7 *
8 * Maintained by: Mark A. Greer <mgreer@mvista.com>
9 */
10#ifndef _PPC_BOOT_FLATDEVTREE_ENV_H_
11#define _PPC_BOOT_FLATDEVTREE_ENV_H_
12
13#include <stdarg.h>
14#include <stddef.h>
15#include "types.h"
16#include "string.h"
17#include "stdio.h"
18#include "ops.h"
19
20#define be16_to_cpu(x) (x)
21#define cpu_to_be16(x) (x)
22#define be32_to_cpu(x) (x)
23#define cpu_to_be32(x) (x)
24#define be64_to_cpu(x) (x)
25#define cpu_to_be64(x) (x)
26
27#endif /* _PPC_BOOT_FLATDEVTREE_ENV_H_ */
diff --git a/arch/powerpc/configs/83xx/kmeter1_defconfig b/arch/powerpc/configs/83xx/kmeter1_defconfig
index 07e1bbadebfe..a0dfef1fcdb7 100644
--- a/arch/powerpc/configs/83xx/kmeter1_defconfig
+++ b/arch/powerpc/configs/83xx/kmeter1_defconfig
@@ -2,14 +2,14 @@ CONFIG_EXPERIMENTAL=y
2# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y 4CONFIG_POSIX_MQUEUE=y
5CONFIG_SPARSE_IRQ=y
6CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
7CONFIG_EXPERT=y 6CONFIG_EXPERT=y
8# CONFIG_HOTPLUG is not set
9CONFIG_SLAB=y 7CONFIG_SLAB=y
10CONFIG_MODULES=y 8CONFIG_MODULES=y
11CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
12# CONFIG_BLK_DEV_BSG is not set 10# CONFIG_BLK_DEV_BSG is not set
11CONFIG_PARTITION_ADVANCED=y
12# CONFIG_MSDOS_PARTITION is not set
13# CONFIG_IOSCHED_DEADLINE is not set 13# CONFIG_IOSCHED_DEADLINE is not set
14# CONFIG_IOSCHED_CFQ is not set 14# CONFIG_IOSCHED_CFQ is not set
15# CONFIG_PPC_CHRP is not set 15# CONFIG_PPC_CHRP is not set
@@ -31,11 +31,10 @@ CONFIG_IP_PNP=y
31# CONFIG_INET_XFRM_MODE_BEET is not set 31# CONFIG_INET_XFRM_MODE_BEET is not set
32# CONFIG_INET_LRO is not set 32# CONFIG_INET_LRO is not set
33# CONFIG_IPV6 is not set 33# CONFIG_IPV6 is not set
34CONFIG_TIPC=y
34CONFIG_BRIDGE=m 35CONFIG_BRIDGE=m
35CONFIG_VLAN_8021Q=y 36CONFIG_VLAN_8021Q=y
36CONFIG_MTD=y 37CONFIG_MTD=y
37CONFIG_MTD_CONCAT=y
38CONFIG_MTD_PARTITIONS=y
39CONFIG_MTD_CMDLINE_PARTS=y 38CONFIG_MTD_CMDLINE_PARTS=y
40CONFIG_MTD_CHAR=y 39CONFIG_MTD_CHAR=y
41CONFIG_MTD_BLOCK=y 40CONFIG_MTD_BLOCK=y
@@ -50,17 +49,15 @@ CONFIG_MTD_UBI_DEBUG=y
50CONFIG_PROC_DEVICETREE=y 49CONFIG_PROC_DEVICETREE=y
51CONFIG_NETDEVICES=y 50CONFIG_NETDEVICES=y
52CONFIG_DUMMY=y 51CONFIG_DUMMY=y
53CONFIG_TUN=y
54CONFIG_MII=y 52CONFIG_MII=y
55CONFIG_MARVELL_PHY=y 53CONFIG_TUN=y
56CONFIG_NET_ETHERNET=y
57CONFIG_UCC_GETH=y 54CONFIG_UCC_GETH=y
58# CONFIG_NETDEV_10000 is not set 55CONFIG_MARVELL_PHY=y
59CONFIG_WAN=y
60CONFIG_HDLC=y
61CONFIG_PPP=y 56CONFIG_PPP=y
62CONFIG_PPP_MULTILINK=y 57CONFIG_PPP_MULTILINK=y
63CONFIG_PPPOE=y 58CONFIG_PPPOE=y
59CONFIG_WAN=y
60CONFIG_HDLC=y
64# CONFIG_INPUT is not set 61# CONFIG_INPUT is not set
65# CONFIG_SERIO is not set 62# CONFIG_SERIO is not set
66# CONFIG_VT is not set 63# CONFIG_VT is not set
@@ -77,10 +74,7 @@ CONFIG_UIO=y
77# CONFIG_DNOTIFY is not set 74# CONFIG_DNOTIFY is not set
78CONFIG_TMPFS=y 75CONFIG_TMPFS=y
79CONFIG_JFFS2_FS=y 76CONFIG_JFFS2_FS=y
77CONFIG_UBIFS_FS=y
80CONFIG_NFS_FS=y 78CONFIG_NFS_FS=y
81CONFIG_NFS_V3=y 79CONFIG_NFS_V3=y
82CONFIG_ROOT_NFS=y 80CONFIG_ROOT_NFS=y
83CONFIG_PARTITION_ADVANCED=y
84# CONFIG_MSDOS_PARTITION is not set
85# CONFIG_RCU_CPU_STALL_DETECTOR is not set
86CONFIG_SYSCTL_SYSCALL_CHECK=y
diff --git a/arch/powerpc/configs/85xx/sbc8560_defconfig b/arch/powerpc/configs/85xx/sbc8560_defconfig
deleted file mode 100644
index f7fdb0318e4c..000000000000
--- a/arch/powerpc/configs/85xx/sbc8560_defconfig
+++ /dev/null
@@ -1,65 +0,0 @@
1CONFIG_PPC_85xx=y
2CONFIG_EXPERIMENTAL=y
3CONFIG_SYSVIPC=y
4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y
6# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
7CONFIG_EXPERT=y
8CONFIG_SLAB=y
9# CONFIG_BLK_DEV_BSG is not set
10CONFIG_SBC8560=y
11CONFIG_BINFMT_MISC=y
12CONFIG_SPARSE_IRQ=y
13# CONFIG_SECCOMP is not set
14CONFIG_NET=y
15CONFIG_PACKET=y
16CONFIG_UNIX=y
17CONFIG_XFRM_USER=y
18CONFIG_INET=y
19CONFIG_IP_MULTICAST=y
20CONFIG_IP_PNP=y
21CONFIG_IP_PNP_DHCP=y
22CONFIG_IP_PNP_BOOTP=y
23CONFIG_SYN_COOKIES=y
24# CONFIG_INET_LRO is not set
25# CONFIG_IPV6 is not set
26CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
27# CONFIG_FW_LOADER is not set
28CONFIG_PROC_DEVICETREE=y
29CONFIG_BLK_DEV_LOOP=y
30CONFIG_BLK_DEV_RAM=y
31CONFIG_BLK_DEV_RAM_SIZE=32768
32CONFIG_NETDEVICES=y
33CONFIG_BROADCOM_PHY=y
34CONFIG_NET_ETHERNET=y
35CONFIG_MII=y
36CONFIG_GIANFAR=y
37# CONFIG_INPUT_MOUSEDEV is not set
38# CONFIG_INPUT_KEYBOARD is not set
39# CONFIG_INPUT_MOUSE is not set
40# CONFIG_SERIO is not set
41# CONFIG_VT is not set
42CONFIG_SERIAL_8250=y
43CONFIG_SERIAL_8250_CONSOLE=y
44CONFIG_SERIAL_8250_NR_UARTS=2
45CONFIG_SERIAL_8250_RUNTIME_UARTS=2
46# CONFIG_HW_RANDOM is not set
47CONFIG_VIDEO_OUTPUT_CONTROL=y
48CONFIG_RTC_CLASS=y
49CONFIG_RTC_DRV_M48T59=y
50CONFIG_INOTIFY=y
51CONFIG_PROC_KCORE=y
52CONFIG_TMPFS=y
53CONFIG_NFS_FS=y
54CONFIG_ROOT_NFS=y
55CONFIG_PARTITION_ADVANCED=y
56# CONFIG_MSDOS_PARTITION is not set
57CONFIG_MAGIC_SYSRQ=y
58CONFIG_DEBUG_KERNEL=y
59CONFIG_DETECT_HUNG_TASK=y
60CONFIG_DEBUG_MUTEXES=y
61# CONFIG_DEBUG_BUGVERBOSE is not set
62# CONFIG_RCU_CPU_STALL_DETECTOR is not set
63CONFIG_SYSCTL_SYSCALL_CHECK=y
64CONFIG_PPC_EARLY_DEBUG=y
65# CONFIG_CRYPTO_ANSI_CPRNG is not set
diff --git a/arch/powerpc/configs/corenet32_smp_defconfig b/arch/powerpc/configs/corenet32_smp_defconfig
index 91db656294e8..cbb98c1234fd 100644
--- a/arch/powerpc/configs/corenet32_smp_defconfig
+++ b/arch/powerpc/configs/corenet32_smp_defconfig
@@ -23,7 +23,6 @@ CONFIG_MODVERSIONS=y
23# CONFIG_BLK_DEV_BSG is not set 23# CONFIG_BLK_DEV_BSG is not set
24CONFIG_P2041_RDB=y 24CONFIG_P2041_RDB=y
25CONFIG_P3041_DS=y 25CONFIG_P3041_DS=y
26CONFIG_P3060_QDS=y
27CONFIG_P4080_DS=y 26CONFIG_P4080_DS=y
28CONFIG_P5020_DS=y 27CONFIG_P5020_DS=y
29CONFIG_HIGHMEM=y 28CONFIG_HIGHMEM=y
@@ -32,10 +31,12 @@ CONFIG_HIGH_RES_TIMERS=y
32# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 31# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
33CONFIG_BINFMT_MISC=m 32CONFIG_BINFMT_MISC=m
34CONFIG_KEXEC=y 33CONFIG_KEXEC=y
34CONFIG_IRQ_ALL_CPUS=y
35CONFIG_FORCE_MAX_ZONEORDER=13 35CONFIG_FORCE_MAX_ZONEORDER=13
36CONFIG_FSL_LBC=y 36CONFIG_FSL_LBC=y
37CONFIG_PCI=y 37CONFIG_PCI=y
38CONFIG_PCIEPORTBUS=y 38CONFIG_PCIEPORTBUS=y
39CONFIG_PCI_MSI=y
39# CONFIG_PCIEASPM is not set 40# CONFIG_PCIEASPM is not set
40CONFIG_RAPIDIO=y 41CONFIG_RAPIDIO=y
41CONFIG_FSL_RIO=y 42CONFIG_FSL_RIO=y
@@ -76,6 +77,11 @@ CONFIG_MTD_BLOCK=y
76CONFIG_MTD_CFI=y 77CONFIG_MTD_CFI=y
77CONFIG_MTD_CFI_AMDSTD=y 78CONFIG_MTD_CFI_AMDSTD=y
78CONFIG_MTD_PHYSMAP_OF=y 79CONFIG_MTD_PHYSMAP_OF=y
80CONFIG_MTD_NAND=y
81CONFIG_MTD_NAND_ECC=y
82CONFIG_MTD_NAND_IDS=y
83CONFIG_MTD_NAND_FSL_IFC=y
84CONFIG_MTD_NAND_FSL_ELBC=y
79CONFIG_MTD_M25P80=y 85CONFIG_MTD_M25P80=y
80CONFIG_PROC_DEVICETREE=y 86CONFIG_PROC_DEVICETREE=y
81CONFIG_BLK_DEV_LOOP=y 87CONFIG_BLK_DEV_LOOP=y
@@ -136,6 +142,8 @@ CONFIG_USB_OHCI_HCD_PPC_OF_LE=y
136CONFIG_USB_STORAGE=y 142CONFIG_USB_STORAGE=y
137CONFIG_MMC=y 143CONFIG_MMC=y
138CONFIG_MMC_SDHCI=y 144CONFIG_MMC_SDHCI=y
145CONFIG_MMC_SDHCI_OF=y
146CONFIG_MMC_SDHCI_OF_ESDHC=y
139CONFIG_EDAC=y 147CONFIG_EDAC=y
140CONFIG_EDAC_MM_EDAC=y 148CONFIG_EDAC_MM_EDAC=y
141CONFIG_EDAC_MPC85XX=y 149CONFIG_EDAC_MPC85XX=y
diff --git a/arch/powerpc/configs/corenet64_smp_defconfig b/arch/powerpc/configs/corenet64_smp_defconfig
index 6798343580f0..dd89de8b0b7f 100644
--- a/arch/powerpc/configs/corenet64_smp_defconfig
+++ b/arch/powerpc/configs/corenet64_smp_defconfig
@@ -6,7 +6,9 @@ CONFIG_NR_CPUS=2
6CONFIG_EXPERIMENTAL=y 6CONFIG_EXPERIMENTAL=y
7CONFIG_SYSVIPC=y 7CONFIG_SYSVIPC=y
8CONFIG_BSD_PROCESS_ACCT=y 8CONFIG_BSD_PROCESS_ACCT=y
9CONFIG_SPARSE_IRQ=y 9CONFIG_IRQ_DOMAIN_DEBUG=y
10CONFIG_NO_HZ=y
11CONFIG_HIGH_RES_TIMERS=y
10CONFIG_IKCONFIG=y 12CONFIG_IKCONFIG=y
11CONFIG_IKCONFIG_PROC=y 13CONFIG_IKCONFIG_PROC=y
12CONFIG_LOG_BUF_SHIFT=14 14CONFIG_LOG_BUF_SHIFT=14
@@ -18,11 +20,14 @@ CONFIG_MODULE_UNLOAD=y
18CONFIG_MODULE_FORCE_UNLOAD=y 20CONFIG_MODULE_FORCE_UNLOAD=y
19CONFIG_MODVERSIONS=y 21CONFIG_MODVERSIONS=y
20# CONFIG_BLK_DEV_BSG is not set 22# CONFIG_BLK_DEV_BSG is not set
23CONFIG_PARTITION_ADVANCED=y
24CONFIG_MAC_PARTITION=y
21CONFIG_P5020_DS=y 25CONFIG_P5020_DS=y
22# CONFIG_PPC_OF_BOOT_TRAMPOLINE is not set 26# CONFIG_PPC_OF_BOOT_TRAMPOLINE is not set
23CONFIG_NO_HZ=y
24CONFIG_HIGH_RES_TIMERS=y
25CONFIG_BINFMT_MISC=m 27CONFIG_BINFMT_MISC=m
28CONFIG_IRQ_ALL_CPUS=y
29CONFIG_PCIEPORTBUS=y
30CONFIG_PCI_MSI=y
26CONFIG_RAPIDIO=y 31CONFIG_RAPIDIO=y
27CONFIG_FSL_RIO=y 32CONFIG_FSL_RIO=y
28CONFIG_NET=y 33CONFIG_NET=y
@@ -51,12 +56,25 @@ CONFIG_INET_ESP=y
51CONFIG_IPV6=y 56CONFIG_IPV6=y
52CONFIG_IP_SCTP=m 57CONFIG_IP_SCTP=m
53CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 58CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
59CONFIG_MTD=y
60CONFIG_MTD_CMDLINE_PARTS=y
61CONFIG_MTD_CHAR=y
62CONFIG_MTD_BLOCK=y
63CONFIG_MTD_CFI=y
64CONFIG_MTD_CFI_AMDSTD=y
65CONFIG_MTD_PHYSMAP_OF=y
66CONFIG_MTD_M25P80=y
67CONFIG_MTD_NAND=y
68CONFIG_MTD_NAND_FSL_ELBC=y
69CONFIG_MTD_NAND_FSL_IFC=y
54CONFIG_PROC_DEVICETREE=y 70CONFIG_PROC_DEVICETREE=y
55CONFIG_BLK_DEV_LOOP=y 71CONFIG_BLK_DEV_LOOP=y
56CONFIG_BLK_DEV_RAM=y 72CONFIG_BLK_DEV_RAM=y
57CONFIG_BLK_DEV_RAM_SIZE=131072 73CONFIG_BLK_DEV_RAM_SIZE=131072
58CONFIG_MISC_DEVICES=y
59CONFIG_EEPROM_LEGACY=y 74CONFIG_EEPROM_LEGACY=y
75CONFIG_ATA=y
76CONFIG_SATA_FSL=y
77CONFIG_SATA_SIL24=y
60CONFIG_NETDEVICES=y 78CONFIG_NETDEVICES=y
61CONFIG_DUMMY=y 79CONFIG_DUMMY=y
62CONFIG_INPUT_FF_MEMLESS=m 80CONFIG_INPUT_FF_MEMLESS=m
@@ -66,39 +84,59 @@ CONFIG_INPUT_FF_MEMLESS=m
66CONFIG_SERIO_LIBPS2=y 84CONFIG_SERIO_LIBPS2=y
67CONFIG_SERIAL_8250=y 85CONFIG_SERIAL_8250=y
68CONFIG_SERIAL_8250_CONSOLE=y 86CONFIG_SERIAL_8250_CONSOLE=y
69CONFIG_SERIAL_8250_EXTENDED=y
70CONFIG_SERIAL_8250_MANY_PORTS=y 87CONFIG_SERIAL_8250_MANY_PORTS=y
71CONFIG_SERIAL_8250_DETECT_IRQ=y 88CONFIG_SERIAL_8250_DETECT_IRQ=y
72CONFIG_SERIAL_8250_RSA=y 89CONFIG_SERIAL_8250_RSA=y
73CONFIG_I2C=y 90CONFIG_I2C=y
74CONFIG_I2C_CHARDEV=y 91CONFIG_I2C_CHARDEV=y
75CONFIG_I2C_MPC=y 92CONFIG_I2C_MPC=y
93CONFIG_SPI=y
94CONFIG_SPI_GPIO=y
95CONFIG_SPI_FSL_SPI=y
96CONFIG_SPI_FSL_ESPI=y
76# CONFIG_HWMON is not set 97# CONFIG_HWMON is not set
77CONFIG_VIDEO_OUTPUT_CONTROL=y 98CONFIG_VIDEO_OUTPUT_CONTROL=y
78# CONFIG_HID_SUPPORT is not set 99CONFIG_USB_HID=m
79# CONFIG_USB_SUPPORT is not set 100CONFIG_USB=y
101CONFIG_USB_MON=y
102CONFIG_USB_EHCI_HCD=y
103CONFIG_USB_EHCI_FSL=y
104CONFIG_USB_STORAGE=y
105CONFIG_MMC=y
106CONFIG_MMC_SDHCI=y
107CONFIG_EDAC=y
108CONFIG_EDAC_MM_EDAC=y
80CONFIG_DMADEVICES=y 109CONFIG_DMADEVICES=y
81CONFIG_FSL_DMA=y 110CONFIG_FSL_DMA=y
82CONFIG_EXT2_FS=y 111CONFIG_EXT2_FS=y
83CONFIG_EXT3_FS=y 112CONFIG_EXT3_FS=y
84# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 113CONFIG_ISO9660_FS=m
114CONFIG_JOLIET=y
115CONFIG_ZISOFS=y
116CONFIG_UDF_FS=m
117CONFIG_MSDOS_FS=m
118CONFIG_VFAT_FS=y
119CONFIG_NTFS_FS=y
85CONFIG_PROC_KCORE=y 120CONFIG_PROC_KCORE=y
86CONFIG_TMPFS=y 121CONFIG_TMPFS=y
87CONFIG_HUGETLBFS=y 122CONFIG_HUGETLBFS=y
88# CONFIG_MISC_FILESYSTEMS is not set 123# CONFIG_MISC_FILESYSTEMS is not set
89CONFIG_PARTITION_ADVANCED=y 124CONFIG_NFS_FS=y
90CONFIG_MAC_PARTITION=y 125CONFIG_NFS_V4=y
91CONFIG_NLS=y 126CONFIG_ROOT_NFS=y
127CONFIG_NFSD=m
128CONFIG_NLS_ISO8859_1=y
92CONFIG_NLS_UTF8=m 129CONFIG_NLS_UTF8=m
93CONFIG_CRC_T10DIF=y 130CONFIG_CRC_T10DIF=y
94CONFIG_CRC_ITU_T=m
95CONFIG_FRAME_WARN=1024 131CONFIG_FRAME_WARN=1024
132CONFIG_MAGIC_SYSRQ=y
96CONFIG_DEBUG_FS=y 133CONFIG_DEBUG_FS=y
134CONFIG_DEBUG_SHIRQ=y
97CONFIG_DETECT_HUNG_TASK=y 135CONFIG_DETECT_HUNG_TASK=y
98CONFIG_DEBUG_INFO=y 136CONFIG_DEBUG_INFO=y
99CONFIG_SYSCTL_SYSCALL_CHECK=y 137CONFIG_CRYPTO_NULL=y
100CONFIG_IRQ_DOMAIN_DEBUG=y
101CONFIG_CRYPTO_PCBC=m 138CONFIG_CRYPTO_PCBC=m
139CONFIG_CRYPTO_MD4=y
102CONFIG_CRYPTO_SHA256=y 140CONFIG_CRYPTO_SHA256=y
103CONFIG_CRYPTO_SHA512=y 141CONFIG_CRYPTO_SHA512=y
104CONFIG_CRYPTO_AES=y 142CONFIG_CRYPTO_AES=y
diff --git a/arch/powerpc/configs/mgcoge_defconfig b/arch/powerpc/configs/mgcoge_defconfig
index 0d36b0e1e268..8fa84f156ef3 100644
--- a/arch/powerpc/configs/mgcoge_defconfig
+++ b/arch/powerpc/configs/mgcoge_defconfig
@@ -2,7 +2,6 @@ CONFIG_EXPERIMENTAL=y
2# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y 4CONFIG_POSIX_MQUEUE=y
5CONFIG_SPARSE_IRQ=y
6CONFIG_IKCONFIG=y 5CONFIG_IKCONFIG=y
7CONFIG_IKCONFIG_PROC=y 6CONFIG_IKCONFIG_PROC=y
8CONFIG_LOG_BUF_SHIFT=14 7CONFIG_LOG_BUF_SHIFT=14
@@ -12,6 +11,7 @@ CONFIG_KALLSYMS_ALL=y
12# CONFIG_PCSPKR_PLATFORM is not set 11# CONFIG_PCSPKR_PLATFORM is not set
13CONFIG_EMBEDDED=y 12CONFIG_EMBEDDED=y
14CONFIG_SLAB=y 13CONFIG_SLAB=y
14CONFIG_PARTITION_ADVANCED=y
15# CONFIG_IOSCHED_CFQ is not set 15# CONFIG_IOSCHED_CFQ is not set
16# CONFIG_PPC_PMAC is not set 16# CONFIG_PPC_PMAC is not set
17CONFIG_PPC_82xx=y 17CONFIG_PPC_82xx=y
@@ -49,12 +49,9 @@ CONFIG_PROC_DEVICETREE=y
49CONFIG_BLK_DEV_LOOP=y 49CONFIG_BLK_DEV_LOOP=y
50CONFIG_BLK_DEV_RAM=y 50CONFIG_BLK_DEV_RAM=y
51CONFIG_NETDEVICES=y 51CONFIG_NETDEVICES=y
52CONFIG_FIXED_PHY=y
53CONFIG_NET_ETHERNET=y
54CONFIG_FS_ENET=y 52CONFIG_FS_ENET=y
55CONFIG_FS_ENET_MDIO_FCC=y 53CONFIG_FS_ENET_MDIO_FCC=y
56# CONFIG_NETDEV_1000 is not set 54CONFIG_FIXED_PHY=y
57# CONFIG_NETDEV_10000 is not set
58# CONFIG_WLAN is not set 55# CONFIG_WLAN is not set
59# CONFIG_INPUT is not set 56# CONFIG_INPUT is not set
60# CONFIG_SERIO is not set 57# CONFIG_SERIO is not set
@@ -64,6 +61,8 @@ CONFIG_SERIAL_CPM_CONSOLE=y
64CONFIG_I2C=y 61CONFIG_I2C=y
65CONFIG_I2C_CHARDEV=y 62CONFIG_I2C_CHARDEV=y
66CONFIG_I2C_CPM=y 63CONFIG_I2C_CPM=y
64CONFIG_SPI=y
65CONFIG_SPI_FSL_SPI=y
67# CONFIG_HWMON is not set 66# CONFIG_HWMON is not set
68CONFIG_USB_GADGET=y 67CONFIG_USB_GADGET=y
69CONFIG_USB_FSL_USB2=y 68CONFIG_USB_FSL_USB2=y
@@ -80,8 +79,6 @@ CONFIG_SQUASHFS=y
80CONFIG_NFS_FS=y 79CONFIG_NFS_FS=y
81CONFIG_NFS_V3=y 80CONFIG_NFS_V3=y
82CONFIG_ROOT_NFS=y 81CONFIG_ROOT_NFS=y
83CONFIG_PARTITION_ADVANCED=y
84CONFIG_NLS=y
85CONFIG_NLS_CODEPAGE_437=y 82CONFIG_NLS_CODEPAGE_437=y
86CONFIG_NLS_ASCII=y 83CONFIG_NLS_ASCII=y
87CONFIG_NLS_ISO8859_1=y 84CONFIG_NLS_ISO8859_1=y
@@ -90,7 +87,6 @@ CONFIG_MAGIC_SYSRQ=y
90CONFIG_DEBUG_FS=y 87CONFIG_DEBUG_FS=y
91# CONFIG_SCHED_DEBUG is not set 88# CONFIG_SCHED_DEBUG is not set
92CONFIG_DEBUG_INFO=y 89CONFIG_DEBUG_INFO=y
93CONFIG_SYSCTL_SYSCALL_CHECK=y
94CONFIG_BDI_SWITCH=y 90CONFIG_BDI_SWITCH=y
95CONFIG_CRYPTO_ECB=y 91CONFIG_CRYPTO_ECB=y
96CONFIG_CRYPTO_PCBC=y 92CONFIG_CRYPTO_PCBC=y
diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
index 62bb723c5b54..03ee911c4577 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -74,6 +74,30 @@ CONFIG_INET_ESP=y
74CONFIG_IPV6=y 74CONFIG_IPV6=y
75CONFIG_IP_SCTP=m 75CONFIG_IP_SCTP=m
76CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 76CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
77CONFIG_MTD=y
78CONFIG_MTD_CMDLINE_PARTS=y
79CONFIG_MTD_CHAR=y
80CONFIG_MTD_BLOCK=y
81CONFIG_MTD_CFI=y
82CONFIG_FTL=y
83CONFIG_MTD_GEN_PROBE=y
84CONFIG_MTD_MAP_BANK_WIDTH_1=y
85CONFIG_MTD_MAP_BANK_WIDTH_2=y
86CONFIG_MTD_MAP_BANK_WIDTH_4=y
87CONFIG_MTD_CFI_I1=y
88CONFIG_MTD_CFI_I2=y
89CONFIG_MTD_CFI_INTELEXT=y
90CONFIG_MTD_CFI_AMDSTD=y
91CONFIG_MTD_CFI_UTIL=y
92CONFIG_MTD_PHYSMAP_OF=y
93CONFIG_MTD_PARTITIONS=y
94CONFIG_MTD_OF_PARTS=y
95CONFIG_MTD_NAND=y
96CONFIG_MTD_NAND_FSL_ELBC=y
97CONFIG_MTD_NAND_FSL_IFC=y
98CONFIG_MTD_NAND_IDS=y
99CONFIG_MTD_NAND_ECC=y
100CONFIG_MTD_M25P80=y
77CONFIG_PROC_DEVICETREE=y 101CONFIG_PROC_DEVICETREE=y
78CONFIG_BLK_DEV_LOOP=y 102CONFIG_BLK_DEV_LOOP=y
79CONFIG_BLK_DEV_NBD=y 103CONFIG_BLK_DEV_NBD=y
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig
index d1828427ae55..fdfa84dc908f 100644
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
@@ -46,6 +46,7 @@ CONFIG_NO_HZ=y
46CONFIG_HIGH_RES_TIMERS=y 46CONFIG_HIGH_RES_TIMERS=y
47CONFIG_BINFMT_MISC=m 47CONFIG_BINFMT_MISC=m
48CONFIG_MATH_EMULATION=y 48CONFIG_MATH_EMULATION=y
49CONFIG_IRQ_ALL_CPUS=y
49CONFIG_FORCE_MAX_ZONEORDER=12 50CONFIG_FORCE_MAX_ZONEORDER=12
50CONFIG_PCI=y 51CONFIG_PCI=y
51CONFIG_PCI_MSI=y 52CONFIG_PCI_MSI=y
@@ -76,6 +77,30 @@ CONFIG_INET_ESP=y
76CONFIG_IPV6=y 77CONFIG_IPV6=y
77CONFIG_IP_SCTP=m 78CONFIG_IP_SCTP=m
78CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 79CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
80CONFIG_MTD=y
81CONFIG_MTD_CMDLINE_PARTS=y
82CONFIG_MTD_CHAR=y
83CONFIG_MTD_BLOCK=y
84CONFIG_MTD_CFI=y
85CONFIG_FTL=y
86CONFIG_MTD_GEN_PROBE=y
87CONFIG_MTD_MAP_BANK_WIDTH_1=y
88CONFIG_MTD_MAP_BANK_WIDTH_2=y
89CONFIG_MTD_MAP_BANK_WIDTH_4=y
90CONFIG_MTD_CFI_I1=y
91CONFIG_MTD_CFI_I2=y
92CONFIG_MTD_CFI_INTELEXT=y
93CONFIG_MTD_CFI_AMDSTD=y
94CONFIG_MTD_CFI_UTIL=y
95CONFIG_MTD_PHYSMAP_OF=y
96CONFIG_MTD_PARTITIONS=y
97CONFIG_MTD_OF_PARTS=y
98CONFIG_MTD_NAND=y
99CONFIG_MTD_NAND_FSL_ELBC=y
100CONFIG_MTD_NAND_FSL_IFC=y
101CONFIG_MTD_NAND_IDS=y
102CONFIG_MTD_NAND_ECC=y
103CONFIG_MTD_M25P80=y
79CONFIG_PROC_DEVICETREE=y 104CONFIG_PROC_DEVICETREE=y
80CONFIG_BLK_DEV_LOOP=y 105CONFIG_BLK_DEV_LOOP=y
81CONFIG_BLK_DEV_NBD=y 106CONFIG_BLK_DEV_NBD=y
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index c1442a3758ae..f2fe0c2b41e4 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -16,6 +16,7 @@ CONFIG_BLK_DEV_INITRD=y
16CONFIG_PROFILING=y 16CONFIG_PROFILING=y
17CONFIG_OPROFILE=y 17CONFIG_OPROFILE=y
18CONFIG_KPROBES=y 18CONFIG_KPROBES=y
19CONFIG_JUMP_LABEL=y
19CONFIG_MODULES=y 20CONFIG_MODULES=y
20CONFIG_MODULE_UNLOAD=y 21CONFIG_MODULE_UNLOAD=y
21CONFIG_MODVERSIONS=y 22CONFIG_MODVERSIONS=y
@@ -489,3 +490,4 @@ CONFIG_VIRTUALIZATION=y
489CONFIG_KVM_BOOK3S_64=m 490CONFIG_KVM_BOOK3S_64=m
490CONFIG_KVM_BOOK3S_64_HV=y 491CONFIG_KVM_BOOK3S_64_HV=y
491CONFIG_VHOST_NET=m 492CONFIG_VHOST_NET=m
493CONFIG_BPF_JIT=y
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index 6608232663cb..187fb8d53605 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -24,6 +24,7 @@ CONFIG_BLK_DEV_INITRD=y
24CONFIG_PROFILING=y 24CONFIG_PROFILING=y
25CONFIG_OPROFILE=y 25CONFIG_OPROFILE=y
26CONFIG_KPROBES=y 26CONFIG_KPROBES=y
27CONFIG_JUMP_LABEL=y
27CONFIG_MODULES=y 28CONFIG_MODULES=y
28CONFIG_MODULE_UNLOAD=y 29CONFIG_MODULE_UNLOAD=y
29CONFIG_MODVERSIONS=y 30CONFIG_MODVERSIONS=y
diff --git a/arch/powerpc/include/asm/asm-compat.h b/arch/powerpc/include/asm/asm-compat.h
index 5d7fbe1950f9..6e82f5f9a6fd 100644
--- a/arch/powerpc/include/asm/asm-compat.h
+++ b/arch/powerpc/include/asm/asm-compat.h
@@ -29,7 +29,7 @@
29#define PPC_LLARX(t, a, b, eh) PPC_LDARX(t, a, b, eh) 29#define PPC_LLARX(t, a, b, eh) PPC_LDARX(t, a, b, eh)
30#define PPC_STLCX stringify_in_c(stdcx.) 30#define PPC_STLCX stringify_in_c(stdcx.)
31#define PPC_CNTLZL stringify_in_c(cntlzd) 31#define PPC_CNTLZL stringify_in_c(cntlzd)
32#define PPC_MTOCRF(FXM, RS) MTOCRF((FXM), (RS)) 32#define PPC_MTOCRF(FXM, RS) MTOCRF((FXM), RS)
33#define PPC_LR_STKOFF 16 33#define PPC_LR_STKOFF 16
34#define PPC_MIN_STKFRM 112 34#define PPC_MIN_STKFRM 112
35#else /* 32-bit */ 35#else /* 32-bit */
diff --git a/arch/powerpc/include/asm/code-patching.h b/arch/powerpc/include/asm/code-patching.h
index 37c32aba79b7..a6f8c7a5cbb7 100644
--- a/arch/powerpc/include/asm/code-patching.h
+++ b/arch/powerpc/include/asm/code-patching.h
@@ -26,8 +26,8 @@ unsigned int create_branch(const unsigned int *addr,
26 unsigned long target, int flags); 26 unsigned long target, int flags);
27unsigned int create_cond_branch(const unsigned int *addr, 27unsigned int create_cond_branch(const unsigned int *addr,
28 unsigned long target, int flags); 28 unsigned long target, int flags);
29void patch_branch(unsigned int *addr, unsigned long target, int flags); 29int patch_branch(unsigned int *addr, unsigned long target, int flags);
30void patch_instruction(unsigned int *addr, unsigned int instr); 30int patch_instruction(unsigned int *addr, unsigned int instr);
31 31
32int instr_is_relative_branch(unsigned int instr); 32int instr_is_relative_branch(unsigned int instr);
33int instr_is_branch_to_addr(const unsigned int *instr, unsigned long addr); 33int instr_is_branch_to_addr(const unsigned int *instr, unsigned long addr);
diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/include/asm/device.h
index 63d5ca49cece..77e97dd0c15d 100644
--- a/arch/powerpc/include/asm/device.h
+++ b/arch/powerpc/include/asm/device.h
@@ -34,6 +34,9 @@ struct dev_archdata {
34#ifdef CONFIG_EEH 34#ifdef CONFIG_EEH
35 struct eeh_dev *edev; 35 struct eeh_dev *edev;
36#endif 36#endif
37#ifdef CONFIG_FAIL_IOMMU
38 int fail_iommu;
39#endif
37}; 40};
38 41
39struct pdev_archdata { 42struct pdev_archdata {
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index d58fc4e4149c..a43c1473915f 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -293,7 +293,7 @@ label##_hv: \
293 293
294#define RUNLATCH_ON \ 294#define RUNLATCH_ON \
295BEGIN_FTR_SECTION \ 295BEGIN_FTR_SECTION \
296 clrrdi r3,r1,THREAD_SHIFT; \ 296 CURRENT_THREAD_INFO(r3, r1); \
297 ld r4,TI_LOCAL_FLAGS(r3); \ 297 ld r4,TI_LOCAL_FLAGS(r3); \
298 andi. r0,r4,_TLF_RUNLATCH; \ 298 andi. r0,r4,_TLF_RUNLATCH; \
299 beql ppc64_runlatch_on_trampoline; \ 299 beql ppc64_runlatch_on_trampoline; \
@@ -332,7 +332,7 @@ label##_common: \
332#ifdef CONFIG_PPC_970_NAP 332#ifdef CONFIG_PPC_970_NAP
333#define FINISH_NAP \ 333#define FINISH_NAP \
334BEGIN_FTR_SECTION \ 334BEGIN_FTR_SECTION \
335 clrrdi r11,r1,THREAD_SHIFT; \ 335 CURRENT_THREAD_INFO(r11, r1); \
336 ld r9,TI_LOCAL_FLAGS(r11); \ 336 ld r9,TI_LOCAL_FLAGS(r11); \
337 andi. r10,r9,_TLF_NAPPING; \ 337 andi. r10,r9,_TLF_NAPPING; \
338 bnel power4_fixup_nap; \ 338 bnel power4_fixup_nap; \
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index 2aadb47efaec..e45c4947a772 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -88,8 +88,8 @@ static inline bool arch_irqs_disabled(void)
88} 88}
89 89
90#ifdef CONFIG_PPC_BOOK3E 90#ifdef CONFIG_PPC_BOOK3E
91#define __hard_irq_enable() asm volatile("wrteei 1" : : : "memory"); 91#define __hard_irq_enable() asm volatile("wrteei 1" : : : "memory")
92#define __hard_irq_disable() asm volatile("wrteei 0" : : : "memory"); 92#define __hard_irq_disable() asm volatile("wrteei 0" : : : "memory")
93#else 93#else
94#define __hard_irq_enable() __mtmsrd(local_paca->kernel_msr | MSR_EE, 1) 94#define __hard_irq_enable() __mtmsrd(local_paca->kernel_msr | MSR_EE, 1)
95#define __hard_irq_disable() __mtmsrd(local_paca->kernel_msr, 1) 95#define __hard_irq_disable() __mtmsrd(local_paca->kernel_msr, 1)
@@ -102,6 +102,14 @@ static inline void hard_irq_disable(void)
102 get_paca()->irq_happened |= PACA_IRQ_HARD_DIS; 102 get_paca()->irq_happened |= PACA_IRQ_HARD_DIS;
103} 103}
104 104
105/* include/linux/interrupt.h needs hard_irq_disable to be a macro */
106#define hard_irq_disable hard_irq_disable
107
108static inline bool lazy_irq_pending(void)
109{
110 return !!(get_paca()->irq_happened & ~PACA_IRQ_HARD_DIS);
111}
112
105/* 113/*
106 * This is called by asynchronous interrupts to conditionally 114 * This is called by asynchronous interrupts to conditionally
107 * re-enable hard interrupts when soft-disabled after having 115 * re-enable hard interrupts when soft-disabled after having
@@ -119,6 +127,8 @@ static inline bool arch_irq_disabled_regs(struct pt_regs *regs)
119 return !regs->softe; 127 return !regs->softe;
120} 128}
121 129
130extern bool prep_irq_for_idle(void);
131
122#else /* CONFIG_PPC64 */ 132#else /* CONFIG_PPC64 */
123 133
124#define SET_MSR_EE(x) mtmsr(x) 134#define SET_MSR_EE(x) mtmsr(x)
diff --git a/arch/powerpc/include/asm/immap_qe.h b/arch/powerpc/include/asm/immap_qe.h
index 0edb6842b13d..61e8490786b8 100644
--- a/arch/powerpc/include/asm/immap_qe.h
+++ b/arch/powerpc/include/asm/immap_qe.h
@@ -26,7 +26,9 @@
26struct qe_iram { 26struct qe_iram {
27 __be32 iadd; /* I-RAM Address Register */ 27 __be32 iadd; /* I-RAM Address Register */
28 __be32 idata; /* I-RAM Data Register */ 28 __be32 idata; /* I-RAM Data Register */
29 u8 res0[0x78]; 29 u8 res0[0x04];
30 __be32 iready; /* I-RAM Ready Register */
31 u8 res1[0x70];
30} __attribute__ ((packed)); 32} __attribute__ ((packed));
31 33
32/* QE Interrupt Controller */ 34/* QE Interrupt Controller */
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index a3855b81eada..f94ef4213e9d 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -20,6 +20,14 @@ extern int check_legacy_ioport(unsigned long base_port);
20#define _PNPWRP 0xa79 20#define _PNPWRP 0xa79
21#define PNPBIOS_BASE 0xf000 21#define PNPBIOS_BASE 0xf000
22 22
23#if defined(CONFIG_PPC64) && defined(CONFIG_PCI)
24extern struct pci_dev *isa_bridge_pcidev;
25/*
26 * has legacy ISA devices ?
27 */
28#define arch_has_dev_port() (isa_bridge_pcidev != NULL)
29#endif
30
23#include <linux/device.h> 31#include <linux/device.h>
24#include <linux/io.h> 32#include <linux/io.h>
25 33
diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h
index 957a83f43646..cbfe678e3dbe 100644
--- a/arch/powerpc/include/asm/iommu.h
+++ b/arch/powerpc/include/asm/iommu.h
@@ -53,6 +53,16 @@ static __inline__ __attribute_const__ int get_iommu_order(unsigned long size)
53 */ 53 */
54#define IOMAP_MAX_ORDER 13 54#define IOMAP_MAX_ORDER 13
55 55
56#define IOMMU_POOL_HASHBITS 2
57#define IOMMU_NR_POOLS (1 << IOMMU_POOL_HASHBITS)
58
59struct iommu_pool {
60 unsigned long start;
61 unsigned long end;
62 unsigned long hint;
63 spinlock_t lock;
64} ____cacheline_aligned_in_smp;
65
56struct iommu_table { 66struct iommu_table {
57 unsigned long it_busno; /* Bus number this table belongs to */ 67 unsigned long it_busno; /* Bus number this table belongs to */
58 unsigned long it_size; /* Size of iommu table in entries */ 68 unsigned long it_size; /* Size of iommu table in entries */
@@ -61,10 +71,10 @@ struct iommu_table {
61 unsigned long it_index; /* which iommu table this is */ 71 unsigned long it_index; /* which iommu table this is */
62 unsigned long it_type; /* type: PCI or Virtual Bus */ 72 unsigned long it_type; /* type: PCI or Virtual Bus */
63 unsigned long it_blocksize; /* Entries in each block (cacheline) */ 73 unsigned long it_blocksize; /* Entries in each block (cacheline) */
64 unsigned long it_hint; /* Hint for next alloc */ 74 unsigned long poolsize;
65 unsigned long it_largehint; /* Hint for large allocs */ 75 unsigned long nr_pools;
66 unsigned long it_halfpoint; /* Breaking point for small/large allocs */ 76 struct iommu_pool large_pool;
67 spinlock_t it_lock; /* Protects it_map */ 77 struct iommu_pool pools[IOMMU_NR_POOLS];
68 unsigned long *it_map; /* A simple allocation bitmap for now */ 78 unsigned long *it_map; /* A simple allocation bitmap for now */
69}; 79};
70 80
diff --git a/arch/powerpc/include/asm/kvm_book3s_asm.h b/arch/powerpc/include/asm/kvm_book3s_asm.h
index 88609b23b775..bfcd00c1485d 100644
--- a/arch/powerpc/include/asm/kvm_book3s_asm.h
+++ b/arch/powerpc/include/asm/kvm_book3s_asm.h
@@ -74,6 +74,7 @@ struct kvmppc_host_state {
74 ulong vmhandler; 74 ulong vmhandler;
75 ulong scratch0; 75 ulong scratch0;
76 ulong scratch1; 76 ulong scratch1;
77 ulong sprg3;
77 u8 in_guest; 78 u8 in_guest;
78 u8 restore_hid5; 79 u8 restore_hid5;
79 u8 napping; 80 u8 napping;
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
index f0145522cfba..e8a26db2e8f3 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -163,12 +163,7 @@ extern u64 ppc64_rma_size;
163 * to think about, feedback welcome. --BenH. 163 * to think about, feedback welcome. --BenH.
164 */ 164 */
165 165
166/* There are #define as they have to be used in assembly 166/* These are #defines as they have to be used in assembly */
167 *
168 * WARNING: If you change this list, make sure to update the array of
169 * names currently in arch/powerpc/mm/hugetlbpage.c or bad things will
170 * happen
171 */
172#define MMU_PAGE_4K 0 167#define MMU_PAGE_4K 0
173#define MMU_PAGE_16K 1 168#define MMU_PAGE_16K 1
174#define MMU_PAGE_64K 2 169#define MMU_PAGE_64K 2
diff --git a/arch/powerpc/include/asm/perf_event.h b/arch/powerpc/include/asm/perf_event.h
index 5c16b891d501..0bb23725b1e7 100644
--- a/arch/powerpc/include/asm/perf_event.h
+++ b/arch/powerpc/include/asm/perf_event.h
@@ -26,8 +26,13 @@
26#include <asm/ptrace.h> 26#include <asm/ptrace.h>
27#include <asm/reg.h> 27#include <asm/reg.h>
28 28
29/*
30 * Overload regs->result to specify whether we should use the MSR (result
31 * is zero) or the SIAR (result is non zero).
32 */
29#define perf_arch_fetch_caller_regs(regs, __ip) \ 33#define perf_arch_fetch_caller_regs(regs, __ip) \
30 do { \ 34 do { \
35 (regs)->result = 0; \
31 (regs)->nip = __ip; \ 36 (regs)->nip = __ip; \
32 (regs)->gpr[1] = *(unsigned long *)__get_SP(); \ 37 (regs)->gpr[1] = *(unsigned long *)__get_SP(); \
33 asm volatile("mfmsr %0" : "=r" ((regs)->msr)); \ 38 asm volatile("mfmsr %0" : "=r" ((regs)->msr)); \
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index d81f99430fe7..4c25319f2fbc 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -15,6 +15,72 @@
15#include <linux/stringify.h> 15#include <linux/stringify.h>
16#include <asm/asm-compat.h> 16#include <asm/asm-compat.h>
17 17
18#define __REG_R0 0
19#define __REG_R1 1
20#define __REG_R2 2
21#define __REG_R3 3
22#define __REG_R4 4
23#define __REG_R5 5
24#define __REG_R6 6
25#define __REG_R7 7
26#define __REG_R8 8
27#define __REG_R9 9
28#define __REG_R10 10
29#define __REG_R11 11
30#define __REG_R12 12
31#define __REG_R13 13
32#define __REG_R14 14
33#define __REG_R15 15
34#define __REG_R16 16
35#define __REG_R17 17
36#define __REG_R18 18
37#define __REG_R19 19
38#define __REG_R20 20
39#define __REG_R21 21
40#define __REG_R22 22
41#define __REG_R23 23
42#define __REG_R24 24
43#define __REG_R25 25
44#define __REG_R26 26
45#define __REG_R27 27
46#define __REG_R28 28
47#define __REG_R29 29
48#define __REG_R30 30
49#define __REG_R31 31
50
51#define __REGA0_0 0
52#define __REGA0_R1 1
53#define __REGA0_R2 2
54#define __REGA0_R3 3
55#define __REGA0_R4 4
56#define __REGA0_R5 5
57#define __REGA0_R6 6
58#define __REGA0_R7 7
59#define __REGA0_R8 8
60#define __REGA0_R9 9
61#define __REGA0_R10 10
62#define __REGA0_R11 11
63#define __REGA0_R12 12
64#define __REGA0_R13 13
65#define __REGA0_R14 14
66#define __REGA0_R15 15
67#define __REGA0_R16 16
68#define __REGA0_R17 17
69#define __REGA0_R18 18
70#define __REGA0_R19 19
71#define __REGA0_R20 20
72#define __REGA0_R21 21
73#define __REGA0_R22 22
74#define __REGA0_R23 23
75#define __REGA0_R24 24
76#define __REGA0_R25 25
77#define __REGA0_R26 26
78#define __REGA0_R27 27
79#define __REGA0_R28 28
80#define __REGA0_R29 29
81#define __REGA0_R30 30
82#define __REGA0_R31 31
83
18/* sorted alphabetically */ 84/* sorted alphabetically */
19#define PPC_INST_DCBA 0x7c0005ec 85#define PPC_INST_DCBA 0x7c0005ec
20#define PPC_INST_DCBA_MASK 0xfc0007fe 86#define PPC_INST_DCBA_MASK 0xfc0007fe
@@ -107,12 +173,19 @@
107#define PPC_INST_NEG 0x7c0000d0 173#define PPC_INST_NEG 0x7c0000d0
108#define PPC_INST_BRANCH 0x48000000 174#define PPC_INST_BRANCH 0x48000000
109#define PPC_INST_BRANCH_COND 0x40800000 175#define PPC_INST_BRANCH_COND 0x40800000
176#define PPC_INST_LBZCIX 0x7c0006aa
177#define PPC_INST_STBCIX 0x7c0007aa
110 178
111/* macros to insert fields into opcodes */ 179/* macros to insert fields into opcodes */
112#define __PPC_RA(a) (((a) & 0x1f) << 16) 180#define ___PPC_RA(a) (((a) & 0x1f) << 16)
113#define __PPC_RB(b) (((b) & 0x1f) << 11) 181#define ___PPC_RB(b) (((b) & 0x1f) << 11)
114#define __PPC_RS(s) (((s) & 0x1f) << 21) 182#define ___PPC_RS(s) (((s) & 0x1f) << 21)
115#define __PPC_RT(s) __PPC_RS(s) 183#define ___PPC_RT(t) ___PPC_RS(t)
184#define __PPC_RA(a) ___PPC_RA(__REG_##a)
185#define __PPC_RA0(a) ___PPC_RA(__REGA0_##a)
186#define __PPC_RB(b) ___PPC_RB(__REG_##b)
187#define __PPC_RS(s) ___PPC_RS(__REG_##s)
188#define __PPC_RT(t) ___PPC_RT(__REG_##t)
116#define __PPC_XA(a) ((((a) & 0x1f) << 16) | (((a) & 0x20) >> 3)) 189#define __PPC_XA(a) ((((a) & 0x1f) << 16) | (((a) & 0x20) >> 3))
117#define __PPC_XB(b) ((((b) & 0x1f) << 11) | (((b) & 0x20) >> 4)) 190#define __PPC_XB(b) ((((b) & 0x1f) << 11) | (((b) & 0x20) >> 4))
118#define __PPC_XS(s) ((((s) & 0x1f) << 21) | (((s) & 0x20) >> 5)) 191#define __PPC_XS(s) ((((s) & 0x1f) << 21) | (((s) & 0x20) >> 5))
@@ -141,13 +214,13 @@
141#define PPC_DCBZL(a, b) stringify_in_c(.long PPC_INST_DCBZL | \ 214#define PPC_DCBZL(a, b) stringify_in_c(.long PPC_INST_DCBZL | \
142 __PPC_RA(a) | __PPC_RB(b)) 215 __PPC_RA(a) | __PPC_RB(b))
143#define PPC_LDARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LDARX | \ 216#define PPC_LDARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LDARX | \
144 __PPC_RT(t) | __PPC_RA(a) | \ 217 ___PPC_RT(t) | ___PPC_RA(a) | \
145 __PPC_RB(b) | __PPC_EH(eh)) 218 ___PPC_RB(b) | __PPC_EH(eh))
146#define PPC_LWARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LWARX | \ 219#define PPC_LWARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LWARX | \
147 __PPC_RT(t) | __PPC_RA(a) | \ 220 ___PPC_RT(t) | ___PPC_RA(a) | \
148 __PPC_RB(b) | __PPC_EH(eh)) 221 ___PPC_RB(b) | __PPC_EH(eh))
149#define PPC_MSGSND(b) stringify_in_c(.long PPC_INST_MSGSND | \ 222#define PPC_MSGSND(b) stringify_in_c(.long PPC_INST_MSGSND | \
150 __PPC_RB(b)) 223 ___PPC_RB(b))
151#define PPC_POPCNTB(a, s) stringify_in_c(.long PPC_INST_POPCNTB | \ 224#define PPC_POPCNTB(a, s) stringify_in_c(.long PPC_INST_POPCNTB | \
152 __PPC_RA(a) | __PPC_RS(s)) 225 __PPC_RA(a) | __PPC_RS(s))
153#define PPC_POPCNTD(a, s) stringify_in_c(.long PPC_INST_POPCNTD | \ 226#define PPC_POPCNTD(a, s) stringify_in_c(.long PPC_INST_POPCNTD | \
@@ -158,34 +231,39 @@
158#define PPC_RFDI stringify_in_c(.long PPC_INST_RFDI) 231#define PPC_RFDI stringify_in_c(.long PPC_INST_RFDI)
159#define PPC_RFMCI stringify_in_c(.long PPC_INST_RFMCI) 232#define PPC_RFMCI stringify_in_c(.long PPC_INST_RFMCI)
160#define PPC_TLBILX(t, a, b) stringify_in_c(.long PPC_INST_TLBILX | \ 233#define PPC_TLBILX(t, a, b) stringify_in_c(.long PPC_INST_TLBILX | \
161 __PPC_T_TLB(t) | __PPC_RA(a) | __PPC_RB(b)) 234 __PPC_T_TLB(t) | __PPC_RA0(a) | __PPC_RB(b))
162#define PPC_TLBILX_ALL(a, b) PPC_TLBILX(0, a, b) 235#define PPC_TLBILX_ALL(a, b) PPC_TLBILX(0, a, b)
163#define PPC_TLBILX_PID(a, b) PPC_TLBILX(1, a, b) 236#define PPC_TLBILX_PID(a, b) PPC_TLBILX(1, a, b)
164#define PPC_TLBILX_VA(a, b) PPC_TLBILX(3, a, b) 237#define PPC_TLBILX_VA(a, b) PPC_TLBILX(3, a, b)
165#define PPC_WAIT(w) stringify_in_c(.long PPC_INST_WAIT | \ 238#define PPC_WAIT(w) stringify_in_c(.long PPC_INST_WAIT | \
166 __PPC_WC(w)) 239 __PPC_WC(w))
167#define PPC_TLBIE(lp,a) stringify_in_c(.long PPC_INST_TLBIE | \ 240#define PPC_TLBIE(lp,a) stringify_in_c(.long PPC_INST_TLBIE | \
168 __PPC_RB(a) | __PPC_RS(lp)) 241 ___PPC_RB(a) | ___PPC_RS(lp))
169#define PPC_TLBSRX_DOT(a,b) stringify_in_c(.long PPC_INST_TLBSRX_DOT | \ 242#define PPC_TLBSRX_DOT(a,b) stringify_in_c(.long PPC_INST_TLBSRX_DOT | \
170 __PPC_RA(a) | __PPC_RB(b)) 243 __PPC_RA0(a) | __PPC_RB(b))
171#define PPC_TLBIVAX(a,b) stringify_in_c(.long PPC_INST_TLBIVAX | \ 244#define PPC_TLBIVAX(a,b) stringify_in_c(.long PPC_INST_TLBIVAX | \
172 __PPC_RA(a) | __PPC_RB(b)) 245 __PPC_RA0(a) | __PPC_RB(b))
173 246
174#define PPC_ERATWE(s, a, w) stringify_in_c(.long PPC_INST_ERATWE | \ 247#define PPC_ERATWE(s, a, w) stringify_in_c(.long PPC_INST_ERATWE | \
175 __PPC_RS(s) | __PPC_RA(a) | __PPC_WS(w)) 248 __PPC_RS(s) | __PPC_RA(a) | __PPC_WS(w))
176#define PPC_ERATRE(s, a, w) stringify_in_c(.long PPC_INST_ERATRE | \ 249#define PPC_ERATRE(s, a, w) stringify_in_c(.long PPC_INST_ERATRE | \
177 __PPC_RS(s) | __PPC_RA(a) | __PPC_WS(w)) 250 __PPC_RS(s) | __PPC_RA(a) | __PPC_WS(w))
178#define PPC_ERATILX(t, a, b) stringify_in_c(.long PPC_INST_ERATILX | \ 251#define PPC_ERATILX(t, a, b) stringify_in_c(.long PPC_INST_ERATILX | \
179 __PPC_T_TLB(t) | __PPC_RA(a) | \ 252 __PPC_T_TLB(t) | __PPC_RA0(a) | \
180 __PPC_RB(b)) 253 __PPC_RB(b))
181#define PPC_ERATIVAX(s, a, b) stringify_in_c(.long PPC_INST_ERATIVAX | \ 254#define PPC_ERATIVAX(s, a, b) stringify_in_c(.long PPC_INST_ERATIVAX | \
182 __PPC_RS(s) | __PPC_RA(a) | __PPC_RB(b)) 255 __PPC_RS(s) | __PPC_RA0(a) | __PPC_RB(b))
183#define PPC_ERATSX(t, a, w) stringify_in_c(.long PPC_INST_ERATSX | \ 256#define PPC_ERATSX(t, a, w) stringify_in_c(.long PPC_INST_ERATSX | \
184 __PPC_RS(t) | __PPC_RA(a) | __PPC_RB(b)) 257 __PPC_RS(t) | __PPC_RA0(a) | __PPC_RB(b))
185#define PPC_ERATSX_DOT(t, a, w) stringify_in_c(.long PPC_INST_ERATSX_DOT | \ 258#define PPC_ERATSX_DOT(t, a, w) stringify_in_c(.long PPC_INST_ERATSX_DOT | \
186 __PPC_RS(t) | __PPC_RA(a) | __PPC_RB(b)) 259 __PPC_RS(t) | __PPC_RA0(a) | __PPC_RB(b))
187#define PPC_SLBFEE_DOT(t, b) stringify_in_c(.long PPC_INST_SLBFEE | \ 260#define PPC_SLBFEE_DOT(t, b) stringify_in_c(.long PPC_INST_SLBFEE | \
188 __PPC_RT(t) | __PPC_RB(b)) 261 __PPC_RT(t) | __PPC_RB(b))
262/* PASemi instructions */
263#define LBZCIX(t,a,b) stringify_in_c(.long PPC_INST_LBZCIX | \
264 __PPC_RT(t) | __PPC_RA(a) | __PPC_RB(b))
265#define STBCIX(s,a,b) stringify_in_c(.long PPC_INST_STBCIX | \
266 __PPC_RS(s) | __PPC_RA(a) | __PPC_RB(b))
189 267
190/* 268/*
191 * Define what the VSX XX1 form instructions will look like, then add 269 * Define what the VSX XX1 form instructions will look like, then add
@@ -194,11 +272,11 @@
194#define VSX_XX1(s, a, b) (__PPC_XS(s) | __PPC_RA(a) | __PPC_RB(b)) 272#define VSX_XX1(s, a, b) (__PPC_XS(s) | __PPC_RA(a) | __PPC_RB(b))
195#define VSX_XX3(t, a, b) (__PPC_XT(t) | __PPC_XA(a) | __PPC_XB(b)) 273#define VSX_XX3(t, a, b) (__PPC_XT(t) | __PPC_XA(a) | __PPC_XB(b))
196#define STXVD2X(s, a, b) stringify_in_c(.long PPC_INST_STXVD2X | \ 274#define STXVD2X(s, a, b) stringify_in_c(.long PPC_INST_STXVD2X | \
197 VSX_XX1((s), (a), (b))) 275 VSX_XX1((s), a, b))
198#define LXVD2X(s, a, b) stringify_in_c(.long PPC_INST_LXVD2X | \ 276#define LXVD2X(s, a, b) stringify_in_c(.long PPC_INST_LXVD2X | \
199 VSX_XX1((s), (a), (b))) 277 VSX_XX1((s), a, b))
200#define XXLOR(t, a, b) stringify_in_c(.long PPC_INST_XXLOR | \ 278#define XXLOR(t, a, b) stringify_in_c(.long PPC_INST_XXLOR | \
201 VSX_XX3((t), (a), (b))) 279 VSX_XX3((t), a, b))
202 280
203#define PPC_NAP stringify_in_c(.long PPC_INST_NAP) 281#define PPC_NAP stringify_in_c(.long PPC_INST_NAP)
204#define PPC_SLEEP stringify_in_c(.long PPC_INST_SLEEP) 282#define PPC_SLEEP stringify_in_c(.long PPC_INST_SLEEP)
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index 15444204a3a1..ea2a86e8ff95 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -126,26 +126,26 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
126#define REST_32VRS(n,b,base) REST_16VRS(n,b,base); REST_16VRS(n+16,b,base) 126#define REST_32VRS(n,b,base) REST_16VRS(n,b,base); REST_16VRS(n+16,b,base)
127 127
128/* Save the lower 32 VSRs in the thread VSR region */ 128/* Save the lower 32 VSRs in the thread VSR region */
129#define SAVE_VSR(n,b,base) li b,THREAD_VSR0+(16*(n)); STXVD2X(n,base,b) 129#define SAVE_VSR(n,b,base) li b,THREAD_VSR0+(16*(n)); STXVD2X(n,R##base,R##b)
130#define SAVE_2VSRS(n,b,base) SAVE_VSR(n,b,base); SAVE_VSR(n+1,b,base) 130#define SAVE_2VSRS(n,b,base) SAVE_VSR(n,b,base); SAVE_VSR(n+1,b,base)
131#define SAVE_4VSRS(n,b,base) SAVE_2VSRS(n,b,base); SAVE_2VSRS(n+2,b,base) 131#define SAVE_4VSRS(n,b,base) SAVE_2VSRS(n,b,base); SAVE_2VSRS(n+2,b,base)
132#define SAVE_8VSRS(n,b,base) SAVE_4VSRS(n,b,base); SAVE_4VSRS(n+4,b,base) 132#define SAVE_8VSRS(n,b,base) SAVE_4VSRS(n,b,base); SAVE_4VSRS(n+4,b,base)
133#define SAVE_16VSRS(n,b,base) SAVE_8VSRS(n,b,base); SAVE_8VSRS(n+8,b,base) 133#define SAVE_16VSRS(n,b,base) SAVE_8VSRS(n,b,base); SAVE_8VSRS(n+8,b,base)
134#define SAVE_32VSRS(n,b,base) SAVE_16VSRS(n,b,base); SAVE_16VSRS(n+16,b,base) 134#define SAVE_32VSRS(n,b,base) SAVE_16VSRS(n,b,base); SAVE_16VSRS(n+16,b,base)
135#define REST_VSR(n,b,base) li b,THREAD_VSR0+(16*(n)); LXVD2X(n,base,b) 135#define REST_VSR(n,b,base) li b,THREAD_VSR0+(16*(n)); LXVD2X(n,R##base,R##b)
136#define REST_2VSRS(n,b,base) REST_VSR(n,b,base); REST_VSR(n+1,b,base) 136#define REST_2VSRS(n,b,base) REST_VSR(n,b,base); REST_VSR(n+1,b,base)
137#define REST_4VSRS(n,b,base) REST_2VSRS(n,b,base); REST_2VSRS(n+2,b,base) 137#define REST_4VSRS(n,b,base) REST_2VSRS(n,b,base); REST_2VSRS(n+2,b,base)
138#define REST_8VSRS(n,b,base) REST_4VSRS(n,b,base); REST_4VSRS(n+4,b,base) 138#define REST_8VSRS(n,b,base) REST_4VSRS(n,b,base); REST_4VSRS(n+4,b,base)
139#define REST_16VSRS(n,b,base) REST_8VSRS(n,b,base); REST_8VSRS(n+8,b,base) 139#define REST_16VSRS(n,b,base) REST_8VSRS(n,b,base); REST_8VSRS(n+8,b,base)
140#define REST_32VSRS(n,b,base) REST_16VSRS(n,b,base); REST_16VSRS(n+16,b,base) 140#define REST_32VSRS(n,b,base) REST_16VSRS(n,b,base); REST_16VSRS(n+16,b,base)
141/* Save the upper 32 VSRs (32-63) in the thread VSX region (0-31) */ 141/* Save the upper 32 VSRs (32-63) in the thread VSX region (0-31) */
142#define SAVE_VSRU(n,b,base) li b,THREAD_VR0+(16*(n)); STXVD2X(n+32,base,b) 142#define SAVE_VSRU(n,b,base) li b,THREAD_VR0+(16*(n)); STXVD2X(n+32,R##base,R##b)
143#define SAVE_2VSRSU(n,b,base) SAVE_VSRU(n,b,base); SAVE_VSRU(n+1,b,base) 143#define SAVE_2VSRSU(n,b,base) SAVE_VSRU(n,b,base); SAVE_VSRU(n+1,b,base)
144#define SAVE_4VSRSU(n,b,base) SAVE_2VSRSU(n,b,base); SAVE_2VSRSU(n+2,b,base) 144#define SAVE_4VSRSU(n,b,base) SAVE_2VSRSU(n,b,base); SAVE_2VSRSU(n+2,b,base)
145#define SAVE_8VSRSU(n,b,base) SAVE_4VSRSU(n,b,base); SAVE_4VSRSU(n+4,b,base) 145#define SAVE_8VSRSU(n,b,base) SAVE_4VSRSU(n,b,base); SAVE_4VSRSU(n+4,b,base)
146#define SAVE_16VSRSU(n,b,base) SAVE_8VSRSU(n,b,base); SAVE_8VSRSU(n+8,b,base) 146#define SAVE_16VSRSU(n,b,base) SAVE_8VSRSU(n,b,base); SAVE_8VSRSU(n+8,b,base)
147#define SAVE_32VSRSU(n,b,base) SAVE_16VSRSU(n,b,base); SAVE_16VSRSU(n+16,b,base) 147#define SAVE_32VSRSU(n,b,base) SAVE_16VSRSU(n,b,base); SAVE_16VSRSU(n+16,b,base)
148#define REST_VSRU(n,b,base) li b,THREAD_VR0+(16*(n)); LXVD2X(n+32,base,b) 148#define REST_VSRU(n,b,base) li b,THREAD_VR0+(16*(n)); LXVD2X(n+32,R##base,R##b)
149#define REST_2VSRSU(n,b,base) REST_VSRU(n,b,base); REST_VSRU(n+1,b,base) 149#define REST_2VSRSU(n,b,base) REST_VSRU(n,b,base); REST_VSRU(n+1,b,base)
150#define REST_4VSRSU(n,b,base) REST_2VSRSU(n,b,base); REST_2VSRSU(n+2,b,base) 150#define REST_4VSRSU(n,b,base) REST_2VSRSU(n,b,base); REST_2VSRSU(n+2,b,base)
151#define REST_8VSRSU(n,b,base) REST_4VSRSU(n,b,base); REST_4VSRSU(n+4,b,base) 151#define REST_8VSRSU(n,b,base) REST_4VSRSU(n,b,base); REST_4VSRSU(n+4,b,base)
@@ -178,9 +178,24 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
178#define HMT_HIGH or 3,3,3 178#define HMT_HIGH or 3,3,3
179#define HMT_EXTRA_HIGH or 7,7,7 # power7 only 179#define HMT_EXTRA_HIGH or 7,7,7 # power7 only
180 180
181#ifdef CONFIG_PPC64
182#define ULONG_SIZE 8
183#else
184#define ULONG_SIZE 4
185#endif
186#define __VCPU_GPR(n) (VCPU_GPRS + (n * ULONG_SIZE))
187#define VCPU_GPR(n) __VCPU_GPR(__REG_##n)
188
181#ifdef __KERNEL__ 189#ifdef __KERNEL__
182#ifdef CONFIG_PPC64 190#ifdef CONFIG_PPC64
183 191
192#define STACKFRAMESIZE 256
193#define __STK_REG(i) (112 + ((i)-14)*8)
194#define STK_REG(i) __STK_REG(__REG_##i)
195
196#define __STK_PARAM(i) (48 + ((i)-3)*8)
197#define STK_PARAM(i) __STK_PARAM(__REG_##i)
198
184#define XGLUE(a,b) a##b 199#define XGLUE(a,b) a##b
185#define GLUE(a,b) XGLUE(a,b) 200#define GLUE(a,b) XGLUE(a,b)
186 201
@@ -295,14 +310,14 @@ n:
295 */ 310 */
296#ifdef __powerpc64__ 311#ifdef __powerpc64__
297#define LOAD_REG_IMMEDIATE(reg,expr) \ 312#define LOAD_REG_IMMEDIATE(reg,expr) \
298 lis (reg),(expr)@highest; \ 313 lis reg,(expr)@highest; \
299 ori (reg),(reg),(expr)@higher; \ 314 ori reg,reg,(expr)@higher; \
300 rldicr (reg),(reg),32,31; \ 315 rldicr reg,reg,32,31; \
301 oris (reg),(reg),(expr)@h; \ 316 oris reg,reg,(expr)@h; \
302 ori (reg),(reg),(expr)@l; 317 ori reg,reg,(expr)@l;
303 318
304#define LOAD_REG_ADDR(reg,name) \ 319#define LOAD_REG_ADDR(reg,name) \
305 ld (reg),name@got(r2) 320 ld reg,name@got(r2)
306 321
307#define LOAD_REG_ADDRBASE(reg,name) LOAD_REG_ADDR(reg,name) 322#define LOAD_REG_ADDRBASE(reg,name) LOAD_REG_ADDR(reg,name)
308#define ADDROFF(name) 0 323#define ADDROFF(name) 0
@@ -313,12 +328,12 @@ n:
313#else /* 32-bit */ 328#else /* 32-bit */
314 329
315#define LOAD_REG_IMMEDIATE(reg,expr) \ 330#define LOAD_REG_IMMEDIATE(reg,expr) \
316 lis (reg),(expr)@ha; \ 331 lis reg,(expr)@ha; \
317 addi (reg),(reg),(expr)@l; 332 addi reg,reg,(expr)@l;
318 333
319#define LOAD_REG_ADDR(reg,name) LOAD_REG_IMMEDIATE(reg, name) 334#define LOAD_REG_ADDR(reg,name) LOAD_REG_IMMEDIATE(reg, name)
320 335
321#define LOAD_REG_ADDRBASE(reg, name) lis (reg),name@ha 336#define LOAD_REG_ADDRBASE(reg, name) lis reg,name@ha
322#define ADDROFF(name) name@l 337#define ADDROFF(name) name@l
323 338
324/* offsets for stack frame layout */ 339/* offsets for stack frame layout */
@@ -372,9 +387,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
372#ifdef CONFIG_PPC64 387#ifdef CONFIG_PPC64
373#define MTOCRF(FXM, RS) \ 388#define MTOCRF(FXM, RS) \
374 BEGIN_FTR_SECTION_NESTED(848); \ 389 BEGIN_FTR_SECTION_NESTED(848); \
375 mtcrf (FXM), (RS); \ 390 mtcrf (FXM), RS; \
376 FTR_SECTION_ELSE_NESTED(848); \ 391 FTR_SECTION_ELSE_NESTED(848); \
377 mtocrf (FXM), (RS); \ 392 mtocrf (FXM), RS; \
378 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_NOEXECUTE, 848) 393 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_NOEXECUTE, 848)
379#endif 394#endif
380 395
@@ -463,6 +478,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
463#ifdef CONFIG_PPC_BOOK3S_64 478#ifdef CONFIG_PPC_BOOK3S_64
464#define RFI rfid 479#define RFI rfid
465#define MTMSRD(r) mtmsrd r 480#define MTMSRD(r) mtmsrd r
481#define MTMSR_EERI(reg) mtmsrd reg,1
466#else 482#else
467#define FIX_SRR1(ra, rb) 483#define FIX_SRR1(ra, rb)
468#ifndef CONFIG_40x 484#ifndef CONFIG_40x
@@ -471,6 +487,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
471#define RFI rfi; b . /* Prevent prefetch past rfi */ 487#define RFI rfi; b . /* Prevent prefetch past rfi */
472#endif 488#endif
473#define MTMSRD(r) mtmsr r 489#define MTMSRD(r) mtmsr r
490#define MTMSR_EERI(reg) mtmsr reg
474#define CLR_TOP32(r) 491#define CLR_TOP32(r)
475#endif 492#endif
476 493
@@ -490,40 +507,46 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
490#define cr7 7 507#define cr7 7
491 508
492 509
493/* General Purpose Registers (GPRs) */ 510/*
494 511 * General Purpose Registers (GPRs)
495#define r0 0 512 *
496#define r1 1 513 * The lower case r0-r31 should be used in preference to the upper
497#define r2 2 514 * case R0-R31 as they provide more error checking in the assembler.
498#define r3 3 515 * Use R0-31 only when really nessesary.
499#define r4 4 516 */
500#define r5 5 517
501#define r6 6 518#define r0 %r0
502#define r7 7 519#define r1 %r1
503#define r8 8 520#define r2 %r2
504#define r9 9 521#define r3 %r3
505#define r10 10 522#define r4 %r4
506#define r11 11 523#define r5 %r5
507#define r12 12 524#define r6 %r6
508#define r13 13 525#define r7 %r7
509#define r14 14 526#define r8 %r8
510#define r15 15 527#define r9 %r9
511#define r16 16 528#define r10 %r10
512#define r17 17 529#define r11 %r11
513#define r18 18 530#define r12 %r12
514#define r19 19 531#define r13 %r13
515#define r20 20 532#define r14 %r14
516#define r21 21 533#define r15 %r15
517#define r22 22 534#define r16 %r16
518#define r23 23 535#define r17 %r17
519#define r24 24 536#define r18 %r18
520#define r25 25 537#define r19 %r19
521#define r26 26 538#define r20 %r20
522#define r27 27 539#define r21 %r21
523#define r28 28 540#define r22 %r22
524#define r29 29 541#define r23 %r23
525#define r30 30 542#define r24 %r24
526#define r31 31 543#define r25 %r25
544#define r26 %r26
545#define r27 %r27
546#define r28 %r28
547#define r29 %r29
548#define r30 %r30
549#define r31 %r31
527 550
528 551
529/* Floating Point Registers (FPRs) */ 552/* Floating Point Registers (FPRs) */
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index 413a5eaef56c..53b6dfa83344 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -389,10 +389,8 @@ extern int powersave_nap; /* set if nap mode can be used in idle loop */
389 389
390#ifdef CONFIG_PSERIES_IDLE 390#ifdef CONFIG_PSERIES_IDLE
391extern void update_smt_snooze_delay(int snooze); 391extern void update_smt_snooze_delay(int snooze);
392extern int pseries_notify_cpuidle_add_cpu(int cpu);
393#else 392#else
394static inline void update_smt_snooze_delay(int snooze) {} 393static inline void update_smt_snooze_delay(int snooze) {}
395static inline int pseries_notify_cpuidle_add_cpu(int cpu) { return 0; }
396#endif 394#endif
397 395
398extern void flush_instruction_cache(void); 396extern void flush_instruction_cache(void);
diff --git a/arch/powerpc/include/asm/qe.h b/arch/powerpc/include/asm/qe.h
index 5e0b6d511e14..229571a49391 100644
--- a/arch/powerpc/include/asm/qe.h
+++ b/arch/powerpc/include/asm/qe.h
@@ -499,6 +499,7 @@ enum comm_dir {
499/* I-RAM */ 499/* I-RAM */
500#define QE_IRAM_IADD_AIE 0x80000000 /* Auto Increment Enable */ 500#define QE_IRAM_IADD_AIE 0x80000000 /* Auto Increment Enable */
501#define QE_IRAM_IADD_BADDR 0x00080000 /* Base Address */ 501#define QE_IRAM_IADD_BADDR 0x00080000 /* Base Address */
502#define QE_IRAM_READY 0x80000000 /* Ready */
502 503
503/* UPC */ 504/* UPC */
504#define UPGCR_PROTOCOL 0x80000000 /* protocol ul2 or pl2 */ 505#define UPGCR_PROTOCOL 0x80000000 /* protocol ul2 or pl2 */
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index f0cb7f461b9d..638608677e2a 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -491,6 +491,7 @@
491#define SPRN_SPRG1 0x111 /* Special Purpose Register General 1 */ 491#define SPRN_SPRG1 0x111 /* Special Purpose Register General 1 */
492#define SPRN_SPRG2 0x112 /* Special Purpose Register General 2 */ 492#define SPRN_SPRG2 0x112 /* Special Purpose Register General 2 */
493#define SPRN_SPRG3 0x113 /* Special Purpose Register General 3 */ 493#define SPRN_SPRG3 0x113 /* Special Purpose Register General 3 */
494#define SPRN_USPRG3 0x103 /* SPRG3 userspace read */
494#define SPRN_SPRG4 0x114 /* Special Purpose Register General 4 */ 495#define SPRN_SPRG4 0x114 /* Special Purpose Register General 4 */
495#define SPRN_SPRG5 0x115 /* Special Purpose Register General 5 */ 496#define SPRN_SPRG5 0x115 /* Special Purpose Register General 5 */
496#define SPRN_SPRG6 0x116 /* Special Purpose Register General 6 */ 497#define SPRN_SPRG6 0x116 /* Special Purpose Register General 6 */
@@ -753,14 +754,14 @@
753 * 64-bit server: 754 * 64-bit server:
754 * - SPRG0 unused (reserved for HV on Power4) 755 * - SPRG0 unused (reserved for HV on Power4)
755 * - SPRG2 scratch for exception vectors 756 * - SPRG2 scratch for exception vectors
756 * - SPRG3 unused (user visible) 757 * - SPRG3 CPU and NUMA node for VDSO getcpu (user visible)
757 * - HSPRG0 stores PACA in HV mode 758 * - HSPRG0 stores PACA in HV mode
758 * - HSPRG1 scratch for "HV" exceptions 759 * - HSPRG1 scratch for "HV" exceptions
759 * 760 *
760 * 64-bit embedded 761 * 64-bit embedded
761 * - SPRG0 generic exception scratch 762 * - SPRG0 generic exception scratch
762 * - SPRG2 TLB exception stack 763 * - SPRG2 TLB exception stack
763 * - SPRG3 unused (user visible) 764 * - SPRG3 CPU and NUMA node for VDSO getcpu (user visible)
764 * - SPRG4 unused (user visible) 765 * - SPRG4 unused (user visible)
765 * - SPRG6 TLB miss scratch (user visible, sorry !) 766 * - SPRG6 TLB miss scratch (user visible, sorry !)
766 * - SPRG7 critical exception scratch 767 * - SPRG7 critical exception scratch
@@ -1024,7 +1025,8 @@
1024/* Macros for setting and retrieving special purpose registers */ 1025/* Macros for setting and retrieving special purpose registers */
1025#ifndef __ASSEMBLY__ 1026#ifndef __ASSEMBLY__
1026#define mfmsr() ({unsigned long rval; \ 1027#define mfmsr() ({unsigned long rval; \
1027 asm volatile("mfmsr %0" : "=r" (rval)); rval;}) 1028 asm volatile("mfmsr %0" : "=r" (rval) : \
1029 : "memory"); rval;})
1028#ifdef CONFIG_PPC_BOOK3S_64 1030#ifdef CONFIG_PPC_BOOK3S_64
1029#define __mtmsrd(v, l) asm volatile("mtmsrd %0," __stringify(l) \ 1031#define __mtmsrd(v, l) asm volatile("mtmsrd %0," __stringify(l) \
1030 : : "r" (v) : "memory") 1032 : : "r" (v) : "memory")
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index 68831e9cf82f..faf93529cbf0 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -22,6 +22,12 @@
22 22
23#define THREAD_SIZE (1 << THREAD_SHIFT) 23#define THREAD_SIZE (1 << THREAD_SHIFT)
24 24
25#ifdef CONFIG_PPC64
26#define CURRENT_THREAD_INFO(dest, sp) clrrdi dest, sp, THREAD_SHIFT
27#else
28#define CURRENT_THREAD_INFO(dest, sp) rlwinm dest, sp, 0, 0, 31-THREAD_SHIFT
29#endif
30
25#ifndef __ASSEMBLY__ 31#ifndef __ASSEMBLY__
26#include <linux/cache.h> 32#include <linux/cache.h>
27#include <asm/processor.h> 33#include <asm/processor.h>
diff --git a/arch/powerpc/include/asm/trace.h b/arch/powerpc/include/asm/trace.h
index cbe2297d68b6..5712f06905a9 100644
--- a/arch/powerpc/include/asm/trace.h
+++ b/arch/powerpc/include/asm/trace.h
@@ -8,7 +8,7 @@
8 8
9struct pt_regs; 9struct pt_regs;
10 10
11TRACE_EVENT(irq_entry, 11DECLARE_EVENT_CLASS(ppc64_interrupt_class,
12 12
13 TP_PROTO(struct pt_regs *regs), 13 TP_PROTO(struct pt_regs *regs),
14 14
@@ -25,55 +25,32 @@ TRACE_EVENT(irq_entry,
25 TP_printk("pt_regs=%p", __entry->regs) 25 TP_printk("pt_regs=%p", __entry->regs)
26); 26);
27 27
28TRACE_EVENT(irq_exit, 28DEFINE_EVENT(ppc64_interrupt_class, irq_entry,
29 29
30 TP_PROTO(struct pt_regs *regs), 30 TP_PROTO(struct pt_regs *regs),
31 31
32 TP_ARGS(regs), 32 TP_ARGS(regs)
33
34 TP_STRUCT__entry(
35 __field(struct pt_regs *, regs)
36 ),
37
38 TP_fast_assign(
39 __entry->regs = regs;
40 ),
41
42 TP_printk("pt_regs=%p", __entry->regs)
43); 33);
44 34
45TRACE_EVENT(timer_interrupt_entry, 35DEFINE_EVENT(ppc64_interrupt_class, irq_exit,
46 36
47 TP_PROTO(struct pt_regs *regs), 37 TP_PROTO(struct pt_regs *regs),
48 38
49 TP_ARGS(regs), 39 TP_ARGS(regs)
50
51 TP_STRUCT__entry(
52 __field(struct pt_regs *, regs)
53 ),
54
55 TP_fast_assign(
56 __entry->regs = regs;
57 ),
58
59 TP_printk("pt_regs=%p", __entry->regs)
60); 40);
61 41
62TRACE_EVENT(timer_interrupt_exit, 42DEFINE_EVENT(ppc64_interrupt_class, timer_interrupt_entry,
63 43
64 TP_PROTO(struct pt_regs *regs), 44 TP_PROTO(struct pt_regs *regs),
65 45
66 TP_ARGS(regs), 46 TP_ARGS(regs)
47);
67 48
68 TP_STRUCT__entry( 49DEFINE_EVENT(ppc64_interrupt_class, timer_interrupt_exit,
69 __field(struct pt_regs *, regs)
70 ),
71 50
72 TP_fast_assign( 51 TP_PROTO(struct pt_regs *regs),
73 __entry->regs = regs;
74 ),
75 52
76 TP_printk("pt_regs=%p", __entry->regs) 53 TP_ARGS(regs)
77); 54);
78 55
79#ifdef CONFIG_PPC_PSERIES 56#ifdef CONFIG_PPC_PSERIES
diff --git a/arch/powerpc/include/asm/vdso.h b/arch/powerpc/include/asm/vdso.h
index dc0419b66f17..50f261bc3e95 100644
--- a/arch/powerpc/include/asm/vdso.h
+++ b/arch/powerpc/include/asm/vdso.h
@@ -22,6 +22,8 @@ extern unsigned long vdso64_rt_sigtramp;
22extern unsigned long vdso32_sigtramp; 22extern unsigned long vdso32_sigtramp;
23extern unsigned long vdso32_rt_sigtramp; 23extern unsigned long vdso32_rt_sigtramp;
24 24
25int __cpuinit vdso_getcpu_init(void);
26
25#else /* __ASSEMBLY__ */ 27#else /* __ASSEMBLY__ */
26 28
27#ifdef __VDSO64__ 29#ifdef __VDSO64__
diff --git a/arch/powerpc/include/asm/vio.h b/arch/powerpc/include/asm/vio.h
index b19adf751dd9..df81cb72d1e0 100644
--- a/arch/powerpc/include/asm/vio.h
+++ b/arch/powerpc/include/asm/vio.h
@@ -44,6 +44,8 @@
44 */ 44 */
45#define VIO_CMO_MIN_ENT 1562624 45#define VIO_CMO_MIN_ENT 1562624
46 46
47extern struct bus_type vio_bus_type;
48
47struct iommu_table; 49struct iommu_table;
48 50
49/* 51/*
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 52c7ad78242e..85b05c463fae 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -533,6 +533,7 @@ int main(void)
533 HSTATE_FIELD(HSTATE_VMHANDLER, vmhandler); 533 HSTATE_FIELD(HSTATE_VMHANDLER, vmhandler);
534 HSTATE_FIELD(HSTATE_SCRATCH0, scratch0); 534 HSTATE_FIELD(HSTATE_SCRATCH0, scratch0);
535 HSTATE_FIELD(HSTATE_SCRATCH1, scratch1); 535 HSTATE_FIELD(HSTATE_SCRATCH1, scratch1);
536 HSTATE_FIELD(HSTATE_SPRG3, sprg3);
536 HSTATE_FIELD(HSTATE_IN_GUEST, in_guest); 537 HSTATE_FIELD(HSTATE_IN_GUEST, in_guest);
537 HSTATE_FIELD(HSTATE_RESTORE_HID5, restore_hid5); 538 HSTATE_FIELD(HSTATE_RESTORE_HID5, restore_hid5);
538 HSTATE_FIELD(HSTATE_NAPPING, napping); 539 HSTATE_FIELD(HSTATE_NAPPING, napping);
diff --git a/arch/powerpc/kernel/cpu_setup_a2.S b/arch/powerpc/kernel/cpu_setup_a2.S
index ebc62f42a237..61f079e05b61 100644
--- a/arch/powerpc/kernel/cpu_setup_a2.S
+++ b/arch/powerpc/kernel/cpu_setup_a2.S
@@ -100,19 +100,19 @@ _icswx_skip_guest:
100 lis r4,(MMUCR0_TLBSEL_I|MMUCR0_ECL)@h 100 lis r4,(MMUCR0_TLBSEL_I|MMUCR0_ECL)@h
101 mtspr SPRN_MMUCR0, r4 101 mtspr SPRN_MMUCR0, r4
102 li r4,A2_IERAT_SIZE-1 102 li r4,A2_IERAT_SIZE-1
103 PPC_ERATWE(r4,r4,3) 103 PPC_ERATWE(R4,R4,3)
104 104
105 /* Now set the D-ERAT watermark to 31 */ 105 /* Now set the D-ERAT watermark to 31 */
106 lis r4,(MMUCR0_TLBSEL_D|MMUCR0_ECL)@h 106 lis r4,(MMUCR0_TLBSEL_D|MMUCR0_ECL)@h
107 mtspr SPRN_MMUCR0, r4 107 mtspr SPRN_MMUCR0, r4
108 li r4,A2_DERAT_SIZE-1 108 li r4,A2_DERAT_SIZE-1
109 PPC_ERATWE(r4,r4,3) 109 PPC_ERATWE(R4,R4,3)
110 110
111 /* And invalidate the beast just in case. That won't get rid of 111 /* And invalidate the beast just in case. That won't get rid of
112 * a bolted entry though it will be in LRU and so will go away eventually 112 * a bolted entry though it will be in LRU and so will go away eventually
113 * but let's not bother for now 113 * but let's not bother for now
114 */ 114 */
115 PPC_ERATILX(0,0,0) 115 PPC_ERATILX(0,0,R0)
1161: 1161:
117 blr 117 blr
118 118
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index b1ec983dcec8..289be751cd75 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -11,6 +11,8 @@
11#include <linux/gfp.h> 11#include <linux/gfp.h>
12#include <linux/memblock.h> 12#include <linux/memblock.h>
13#include <linux/export.h> 13#include <linux/export.h>
14#include <linux/pci.h>
15#include <asm/vio.h>
14#include <asm/bug.h> 16#include <asm/bug.h>
15#include <asm/abs_addr.h> 17#include <asm/abs_addr.h>
16#include <asm/machdep.h> 18#include <asm/machdep.h>
@@ -205,7 +207,13 @@ EXPORT_SYMBOL_GPL(dma_get_required_mask);
205 207
206static int __init dma_init(void) 208static int __init dma_init(void)
207{ 209{
208 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES); 210 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
211#ifdef CONFIG_PCI
212 dma_debug_add_bus(&pci_bus_type);
213#endif
214#ifdef CONFIG_IBMVIO
215 dma_debug_add_bus(&vio_bus_type);
216#endif
209 217
210 return 0; 218 return 0;
211} 219}
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index ba3aeb4bc06a..5207d5a405e2 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -92,7 +92,7 @@ crit_transfer_to_handler:
92 mfspr r8,SPRN_SPRG_THREAD 92 mfspr r8,SPRN_SPRG_THREAD
93 lwz r0,KSP_LIMIT(r8) 93 lwz r0,KSP_LIMIT(r8)
94 stw r0,SAVED_KSP_LIMIT(r11) 94 stw r0,SAVED_KSP_LIMIT(r11)
95 rlwimi r0,r1,0,0,(31-THREAD_SHIFT) 95 CURRENT_THREAD_INFO(r0, r1)
96 stw r0,KSP_LIMIT(r8) 96 stw r0,KSP_LIMIT(r8)
97 /* fall through */ 97 /* fall through */
98#endif 98#endif
@@ -112,7 +112,7 @@ crit_transfer_to_handler:
112 mfspr r8,SPRN_SPRG_THREAD 112 mfspr r8,SPRN_SPRG_THREAD
113 lwz r0,KSP_LIMIT(r8) 113 lwz r0,KSP_LIMIT(r8)
114 stw r0,saved_ksp_limit@l(0) 114 stw r0,saved_ksp_limit@l(0)
115 rlwimi r0,r1,0,0,(31-THREAD_SHIFT) 115 CURRENT_THREAD_INFO(r0, r1)
116 stw r0,KSP_LIMIT(r8) 116 stw r0,KSP_LIMIT(r8)
117 /* fall through */ 117 /* fall through */
118#endif 118#endif
@@ -158,7 +158,7 @@ transfer_to_handler:
158 tophys(r11,r11) 158 tophys(r11,r11)
159 addi r11,r11,global_dbcr0@l 159 addi r11,r11,global_dbcr0@l
160#ifdef CONFIG_SMP 160#ifdef CONFIG_SMP
161 rlwinm r9,r1,0,0,(31-THREAD_SHIFT) 161 CURRENT_THREAD_INFO(r9, r1)
162 lwz r9,TI_CPU(r9) 162 lwz r9,TI_CPU(r9)
163 slwi r9,r9,3 163 slwi r9,r9,3
164 add r11,r11,r9 164 add r11,r11,r9
@@ -179,7 +179,7 @@ transfer_to_handler:
179 ble- stack_ovf /* then the kernel stack overflowed */ 179 ble- stack_ovf /* then the kernel stack overflowed */
1805: 1805:
181#if defined(CONFIG_6xx) || defined(CONFIG_E500) 181#if defined(CONFIG_6xx) || defined(CONFIG_E500)
182 rlwinm r9,r1,0,0,31-THREAD_SHIFT 182 CURRENT_THREAD_INFO(r9, r1)
183 tophys(r9,r9) /* check local flags */ 183 tophys(r9,r9) /* check local flags */
184 lwz r12,TI_LOCAL_FLAGS(r9) 184 lwz r12,TI_LOCAL_FLAGS(r9)
185 mtcrf 0x01,r12 185 mtcrf 0x01,r12
@@ -226,13 +226,7 @@ reenable_mmu: /* re-enable mmu so we can */
226 stw r3,16(r1) 226 stw r3,16(r1)
227 stw r4,20(r1) 227 stw r4,20(r1)
228 stw r5,24(r1) 228 stw r5,24(r1)
229 andi. r12,r12,MSR_PR
230 b 11f
231 bl trace_hardirqs_off 229 bl trace_hardirqs_off
232 b 12f
23311:
234 bl trace_hardirqs_off
23512:
236 lwz r5,24(r1) 230 lwz r5,24(r1)
237 lwz r4,20(r1) 231 lwz r4,20(r1)
238 lwz r3,16(r1) 232 lwz r3,16(r1)
@@ -333,7 +327,7 @@ _GLOBAL(DoSyscall)
333 mtmsr r11 327 mtmsr r11
3341: 3281:
335#endif /* CONFIG_TRACE_IRQFLAGS */ 329#endif /* CONFIG_TRACE_IRQFLAGS */
336 rlwinm r10,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */ 330 CURRENT_THREAD_INFO(r10, r1)
337 lwz r11,TI_FLAGS(r10) 331 lwz r11,TI_FLAGS(r10)
338 andi. r11,r11,_TIF_SYSCALL_T_OR_A 332 andi. r11,r11,_TIF_SYSCALL_T_OR_A
339 bne- syscall_dotrace 333 bne- syscall_dotrace
@@ -354,7 +348,7 @@ ret_from_syscall:
354 bl do_show_syscall_exit 348 bl do_show_syscall_exit
355#endif 349#endif
356 mr r6,r3 350 mr r6,r3
357 rlwinm r12,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */ 351 CURRENT_THREAD_INFO(r12, r1)
358 /* disable interrupts so current_thread_info()->flags can't change */ 352 /* disable interrupts so current_thread_info()->flags can't change */
359 LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */ 353 LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */
360 /* Note: We don't bother telling lockdep about it */ 354 /* Note: We don't bother telling lockdep about it */
@@ -815,7 +809,7 @@ ret_from_except:
815 809
816user_exc_return: /* r10 contains MSR_KERNEL here */ 810user_exc_return: /* r10 contains MSR_KERNEL here */
817 /* Check current_thread_info()->flags */ 811 /* Check current_thread_info()->flags */
818 rlwinm r9,r1,0,0,(31-THREAD_SHIFT) 812 CURRENT_THREAD_INFO(r9, r1)
819 lwz r9,TI_FLAGS(r9) 813 lwz r9,TI_FLAGS(r9)
820 andi. r0,r9,_TIF_USER_WORK_MASK 814 andi. r0,r9,_TIF_USER_WORK_MASK
821 bne do_work 815 bne do_work
@@ -835,7 +829,7 @@ restore_user:
835/* N.B. the only way to get here is from the beq following ret_from_except. */ 829/* N.B. the only way to get here is from the beq following ret_from_except. */
836resume_kernel: 830resume_kernel:
837 /* check current_thread_info->preempt_count */ 831 /* check current_thread_info->preempt_count */
838 rlwinm r9,r1,0,0,(31-THREAD_SHIFT) 832 CURRENT_THREAD_INFO(r9, r1)
839 lwz r0,TI_PREEMPT(r9) 833 lwz r0,TI_PREEMPT(r9)
840 cmpwi 0,r0,0 /* if non-zero, just restore regs and return */ 834 cmpwi 0,r0,0 /* if non-zero, just restore regs and return */
841 bne restore 835 bne restore
@@ -852,7 +846,7 @@ resume_kernel:
852 bl trace_hardirqs_off 846 bl trace_hardirqs_off
853#endif 847#endif
8541: bl preempt_schedule_irq 8481: bl preempt_schedule_irq
855 rlwinm r9,r1,0,0,(31-THREAD_SHIFT) 849 CURRENT_THREAD_INFO(r9, r1)
856 lwz r3,TI_FLAGS(r9) 850 lwz r3,TI_FLAGS(r9)
857 andi. r0,r3,_TIF_NEED_RESCHED 851 andi. r0,r3,_TIF_NEED_RESCHED
858 bne- 1b 852 bne- 1b
@@ -1122,7 +1116,7 @@ ret_from_debug_exc:
1122 lwz r10,SAVED_KSP_LIMIT(r1) 1116 lwz r10,SAVED_KSP_LIMIT(r1)
1123 stw r10,KSP_LIMIT(r9) 1117 stw r10,KSP_LIMIT(r9)
1124 lwz r9,THREAD_INFO-THREAD(r9) 1118 lwz r9,THREAD_INFO-THREAD(r9)
1125 rlwinm r10,r1,0,0,(31-THREAD_SHIFT) 1119 CURRENT_THREAD_INFO(r10, r1)
1126 lwz r10,TI_PREEMPT(r10) 1120 lwz r10,TI_PREEMPT(r10)
1127 stw r10,TI_PREEMPT(r9) 1121 stw r10,TI_PREEMPT(r9)
1128 RESTORE_xSRR(SRR0,SRR1); 1122 RESTORE_xSRR(SRR0,SRR1);
@@ -1156,7 +1150,7 @@ load_dbcr0:
1156 lis r11,global_dbcr0@ha 1150 lis r11,global_dbcr0@ha
1157 addi r11,r11,global_dbcr0@l 1151 addi r11,r11,global_dbcr0@l
1158#ifdef CONFIG_SMP 1152#ifdef CONFIG_SMP
1159 rlwinm r9,r1,0,0,(31-THREAD_SHIFT) 1153 CURRENT_THREAD_INFO(r9, r1)
1160 lwz r9,TI_CPU(r9) 1154 lwz r9,TI_CPU(r9)
1161 slwi r9,r9,3 1155 slwi r9,r9,3
1162 add r11,r11,r9 1156 add r11,r11,r9
@@ -1197,7 +1191,7 @@ recheck:
1197 LOAD_MSR_KERNEL(r10,MSR_KERNEL) 1191 LOAD_MSR_KERNEL(r10,MSR_KERNEL)
1198 SYNC 1192 SYNC
1199 MTMSRD(r10) /* disable interrupts */ 1193 MTMSRD(r10) /* disable interrupts */
1200 rlwinm r9,r1,0,0,(31-THREAD_SHIFT) 1194 CURRENT_THREAD_INFO(r9, r1)
1201 lwz r9,TI_FLAGS(r9) 1195 lwz r9,TI_FLAGS(r9)
1202 andi. r0,r9,_TIF_NEED_RESCHED 1196 andi. r0,r9,_TIF_NEED_RESCHED
1203 bne- do_resched 1197 bne- do_resched
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index ed1718feb9d9..4b01a25e29ef 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -146,7 +146,7 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
146 REST_2GPRS(7,r1) 146 REST_2GPRS(7,r1)
147 addi r9,r1,STACK_FRAME_OVERHEAD 147 addi r9,r1,STACK_FRAME_OVERHEAD
148#endif 148#endif
149 clrrdi r11,r1,THREAD_SHIFT 149 CURRENT_THREAD_INFO(r11, r1)
150 ld r10,TI_FLAGS(r11) 150 ld r10,TI_FLAGS(r11)
151 andi. r11,r10,_TIF_SYSCALL_T_OR_A 151 andi. r11,r10,_TIF_SYSCALL_T_OR_A
152 bne- syscall_dotrace 152 bne- syscall_dotrace
@@ -181,7 +181,7 @@ syscall_exit:
181 bl .do_show_syscall_exit 181 bl .do_show_syscall_exit
182 ld r3,RESULT(r1) 182 ld r3,RESULT(r1)
183#endif 183#endif
184 clrrdi r12,r1,THREAD_SHIFT 184 CURRENT_THREAD_INFO(r12, r1)
185 185
186 ld r8,_MSR(r1) 186 ld r8,_MSR(r1)
187#ifdef CONFIG_PPC_BOOK3S 187#ifdef CONFIG_PPC_BOOK3S
@@ -197,7 +197,16 @@ syscall_exit:
197 wrteei 0 197 wrteei 0
198#else 198#else
199 ld r10,PACAKMSR(r13) 199 ld r10,PACAKMSR(r13)
200 mtmsrd r10,1 200 /*
201 * For performance reasons we clear RI the same time that we
202 * clear EE. We only need to clear RI just before we restore r13
203 * below, but batching it with EE saves us one expensive mtmsrd call.
204 * We have to be careful to restore RI if we branch anywhere from
205 * here (eg syscall_exit_work).
206 */
207 li r9,MSR_RI
208 andc r11,r10,r9
209 mtmsrd r11,1
201#endif /* CONFIG_PPC_BOOK3E */ 210#endif /* CONFIG_PPC_BOOK3E */
202 211
203 ld r9,TI_FLAGS(r12) 212 ld r9,TI_FLAGS(r12)
@@ -214,17 +223,6 @@ BEGIN_FTR_SECTION
214END_FTR_SECTION_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS) 223END_FTR_SECTION_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS)
215 andi. r6,r8,MSR_PR 224 andi. r6,r8,MSR_PR
216 ld r4,_LINK(r1) 225 ld r4,_LINK(r1)
217 /*
218 * Clear RI before restoring r13. If we are returning to
219 * userspace and we take an exception after restoring r13,
220 * we end up corrupting the userspace r13 value.
221 */
222#ifdef CONFIG_PPC_BOOK3S
223 /* No MSR:RI on BookE */
224 li r12,MSR_RI
225 andc r11,r10,r12
226 mtmsrd r11,1 /* clear MSR.RI */
227#endif /* CONFIG_PPC_BOOK3S */
228 226
229 beq- 1f 227 beq- 1f
230 ACCOUNT_CPU_USER_EXIT(r11, r12) 228 ACCOUNT_CPU_USER_EXIT(r11, r12)
@@ -262,7 +260,7 @@ syscall_dotrace:
262 ld r7,GPR7(r1) 260 ld r7,GPR7(r1)
263 ld r8,GPR8(r1) 261 ld r8,GPR8(r1)
264 addi r9,r1,STACK_FRAME_OVERHEAD 262 addi r9,r1,STACK_FRAME_OVERHEAD
265 clrrdi r10,r1,THREAD_SHIFT 263 CURRENT_THREAD_INFO(r10, r1)
266 ld r10,TI_FLAGS(r10) 264 ld r10,TI_FLAGS(r10)
267 b .Lsyscall_dotrace_cont 265 b .Lsyscall_dotrace_cont
268 266
@@ -271,6 +269,9 @@ syscall_enosys:
271 b syscall_exit 269 b syscall_exit
272 270
273syscall_exit_work: 271syscall_exit_work:
272#ifdef CONFIG_PPC_BOOK3S
273 mtmsrd r10,1 /* Restore RI */
274#endif
274 /* If TIF_RESTOREALL is set, don't scribble on either r3 or ccr. 275 /* If TIF_RESTOREALL is set, don't scribble on either r3 or ccr.
275 If TIF_NOERROR is set, just save r3 as it is. */ 276 If TIF_NOERROR is set, just save r3 as it is. */
276 277
@@ -499,7 +500,7 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
4992: 5002:
500#endif /* !CONFIG_PPC_BOOK3S */ 501#endif /* !CONFIG_PPC_BOOK3S */
501 502
502 clrrdi r7,r8,THREAD_SHIFT /* base of new stack */ 503 CURRENT_THREAD_INFO(r7, r8) /* base of new stack */
503 /* Note: this uses SWITCH_FRAME_SIZE rather than INT_FRAME_SIZE 504 /* Note: this uses SWITCH_FRAME_SIZE rather than INT_FRAME_SIZE
504 because we don't need to leave the 288-byte ABI gap at the 505 because we don't need to leave the 288-byte ABI gap at the
505 top of the kernel stack. */ 506 top of the kernel stack. */
@@ -558,27 +559,54 @@ _GLOBAL(ret_from_except_lite)
558 mtmsrd r10,1 /* Update machine state */ 559 mtmsrd r10,1 /* Update machine state */
559#endif /* CONFIG_PPC_BOOK3E */ 560#endif /* CONFIG_PPC_BOOK3E */
560 561
561#ifdef CONFIG_PREEMPT 562 CURRENT_THREAD_INFO(r9, r1)
562 clrrdi r9,r1,THREAD_SHIFT /* current_thread_info() */
563 li r0,_TIF_NEED_RESCHED /* bits to check */
564 ld r3,_MSR(r1) 563 ld r3,_MSR(r1)
565 ld r4,TI_FLAGS(r9) 564 ld r4,TI_FLAGS(r9)
566 /* Move MSR_PR bit in r3 to _TIF_SIGPENDING position in r0 */
567 rlwimi r0,r3,32+TIF_SIGPENDING-MSR_PR_LG,_TIF_SIGPENDING
568 and. r0,r4,r0 /* check NEED_RESCHED and maybe SIGPENDING */
569 bne do_work
570
571#else /* !CONFIG_PREEMPT */
572 ld r3,_MSR(r1) /* Returning to user mode? */
573 andi. r3,r3,MSR_PR 565 andi. r3,r3,MSR_PR
574 beq restore /* if not, just restore regs and return */ 566 beq resume_kernel
575 567
576 /* Check current_thread_info()->flags */ 568 /* Check current_thread_info()->flags */
577 clrrdi r9,r1,THREAD_SHIFT
578 ld r4,TI_FLAGS(r9)
579 andi. r0,r4,_TIF_USER_WORK_MASK 569 andi. r0,r4,_TIF_USER_WORK_MASK
580 bne do_work 570 beq restore
581#endif /* !CONFIG_PREEMPT */ 571
572 andi. r0,r4,_TIF_NEED_RESCHED
573 beq 1f
574 bl .restore_interrupts
575 bl .schedule
576 b .ret_from_except_lite
577
5781: bl .save_nvgprs
579 bl .restore_interrupts
580 addi r3,r1,STACK_FRAME_OVERHEAD
581 bl .do_notify_resume
582 b .ret_from_except
583
584resume_kernel:
585#ifdef CONFIG_PREEMPT
586 /* Check if we need to preempt */
587 andi. r0,r4,_TIF_NEED_RESCHED
588 beq+ restore
589 /* Check that preempt_count() == 0 and interrupts are enabled */
590 lwz r8,TI_PREEMPT(r9)
591 cmpwi cr1,r8,0
592 ld r0,SOFTE(r1)
593 cmpdi r0,0
594 crandc eq,cr1*4+eq,eq
595 bne restore
596
597 /*
598 * Here we are preempting the current task. We want to make
599 * sure we are soft-disabled first
600 */
601 SOFT_DISABLE_INTS(r3,r4)
6021: bl .preempt_schedule_irq
603
604 /* Re-test flags and eventually loop */
605 CURRENT_THREAD_INFO(r9, r1)
606 ld r4,TI_FLAGS(r9)
607 andi. r0,r4,_TIF_NEED_RESCHED
608 bne 1b
609#endif /* CONFIG_PREEMPT */
582 610
583 .globl fast_exc_return_irq 611 .globl fast_exc_return_irq
584fast_exc_return_irq: 612fast_exc_return_irq:
@@ -759,50 +787,6 @@ restore_check_irq_replay:
759#endif /* CONFIG_PPC_BOOK3E */ 787#endif /* CONFIG_PPC_BOOK3E */
7601: b .ret_from_except /* What else to do here ? */ 7881: b .ret_from_except /* What else to do here ? */
761 789
762
763
7643:
765do_work:
766#ifdef CONFIG_PREEMPT
767 andi. r0,r3,MSR_PR /* Returning to user mode? */
768 bne user_work
769 /* Check that preempt_count() == 0 and interrupts are enabled */
770 lwz r8,TI_PREEMPT(r9)
771 cmpwi cr1,r8,0
772 ld r0,SOFTE(r1)
773 cmpdi r0,0
774 crandc eq,cr1*4+eq,eq
775 bne restore
776
777 /*
778 * Here we are preempting the current task. We want to make
779 * sure we are soft-disabled first
780 */
781 SOFT_DISABLE_INTS(r3,r4)
7821: bl .preempt_schedule_irq
783
784 /* Re-test flags and eventually loop */
785 clrrdi r9,r1,THREAD_SHIFT
786 ld r4,TI_FLAGS(r9)
787 andi. r0,r4,_TIF_NEED_RESCHED
788 bne 1b
789 b restore
790
791user_work:
792#endif /* CONFIG_PREEMPT */
793
794 andi. r0,r4,_TIF_NEED_RESCHED
795 beq 1f
796 bl .restore_interrupts
797 bl .schedule
798 b .ret_from_except_lite
799
8001: bl .save_nvgprs
801 bl .restore_interrupts
802 addi r3,r1,STACK_FRAME_OVERHEAD
803 bl .do_notify_resume
804 b .ret_from_except
805
806unrecov_restore: 790unrecov_restore:
807 addi r3,r1,STACK_FRAME_OVERHEAD 791 addi r3,r1,STACK_FRAME_OVERHEAD
808 bl .unrecoverable_exception 792 bl .unrecoverable_exception
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 7215cc2495df..98be7f0cd227 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -222,7 +222,7 @@ exc_##n##_bad_stack: \
222 * interrupts happen before the wait instruction. 222 * interrupts happen before the wait instruction.
223 */ 223 */
224#define CHECK_NAPPING() \ 224#define CHECK_NAPPING() \
225 clrrdi r11,r1,THREAD_SHIFT; \ 225 CURRENT_THREAD_INFO(r11, r1); \
226 ld r10,TI_LOCAL_FLAGS(r11); \ 226 ld r10,TI_LOCAL_FLAGS(r11); \
227 andi. r9,r10,_TLF_NAPPING; \ 227 andi. r9,r10,_TLF_NAPPING; \
228 beq+ 1f; \ 228 beq+ 1f; \
@@ -903,7 +903,7 @@ skpinv: addi r6,r6,1 /* Increment */
903 bne 1b /* If not, repeat */ 903 bne 1b /* If not, repeat */
904 904
905 /* Invalidate all TLBs */ 905 /* Invalidate all TLBs */
906 PPC_TLBILX_ALL(0,0) 906 PPC_TLBILX_ALL(0,R0)
907 sync 907 sync
908 isync 908 isync
909 909
@@ -961,7 +961,7 @@ skpinv: addi r6,r6,1 /* Increment */
961 tlbwe 961 tlbwe
962 962
963 /* Invalidate TLB1 */ 963 /* Invalidate TLB1 */
964 PPC_TLBILX_ALL(0,0) 964 PPC_TLBILX_ALL(0,R0)
965 sync 965 sync
966 isync 966 isync
967 967
@@ -1020,7 +1020,7 @@ skpinv: addi r6,r6,1 /* Increment */
1020 tlbwe 1020 tlbwe
1021 1021
1022 /* Invalidate TLB1 */ 1022 /* Invalidate TLB1 */
1023 PPC_TLBILX_ALL(0,0) 1023 PPC_TLBILX_ALL(0,R0)
1024 sync 1024 sync
1025 isync 1025 isync
1026 1026
@@ -1138,7 +1138,7 @@ a2_tlbinit_after_iprot_flush:
1138 tlbwe 1138 tlbwe
1139#endif /* CONFIG_PPC_EARLY_DEBUG_WSP */ 1139#endif /* CONFIG_PPC_EARLY_DEBUG_WSP */
1140 1140
1141 PPC_TLBILX(0,0,0) 1141 PPC_TLBILX(0,0,R0)
1142 sync 1142 sync
1143 isync 1143 isync
1144 1144
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 1c06d2971545..e894515e77bb 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -239,6 +239,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE)
239 * out of line to handle them 239 * out of line to handle them
240 */ 240 */
241 . = 0xe00 241 . = 0xe00
242hv_exception_trampoline:
242 b h_data_storage_hv 243 b h_data_storage_hv
243 . = 0xe20 244 . = 0xe20
244 b h_instr_storage_hv 245 b h_instr_storage_hv
@@ -851,7 +852,7 @@ BEGIN_FTR_SECTION
851 bne- do_ste_alloc /* If so handle it */ 852 bne- do_ste_alloc /* If so handle it */
852END_MMU_FTR_SECTION_IFCLR(MMU_FTR_SLB) 853END_MMU_FTR_SECTION_IFCLR(MMU_FTR_SLB)
853 854
854 clrrdi r11,r1,THREAD_SHIFT 855 CURRENT_THREAD_INFO(r11, r1)
855 lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */ 856 lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */
856 andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */ 857 andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */
857 bne 77f /* then don't call hash_page now */ 858 bne 77f /* then don't call hash_page now */
diff --git a/arch/powerpc/kernel/fpu.S b/arch/powerpc/kernel/fpu.S
index de369558bf0a..e0ada05f2df3 100644
--- a/arch/powerpc/kernel/fpu.S
+++ b/arch/powerpc/kernel/fpu.S
@@ -26,7 +26,7 @@
26#include <asm/ptrace.h> 26#include <asm/ptrace.h>
27 27
28#ifdef CONFIG_VSX 28#ifdef CONFIG_VSX
29#define REST_32FPVSRS(n,c,base) \ 29#define __REST_32FPVSRS(n,c,base) \
30BEGIN_FTR_SECTION \ 30BEGIN_FTR_SECTION \
31 b 2f; \ 31 b 2f; \
32END_FTR_SECTION_IFSET(CPU_FTR_VSX); \ 32END_FTR_SECTION_IFSET(CPU_FTR_VSX); \
@@ -35,7 +35,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX); \
352: REST_32VSRS(n,c,base); \ 352: REST_32VSRS(n,c,base); \
363: 363:
37 37
38#define SAVE_32FPVSRS(n,c,base) \ 38#define __SAVE_32FPVSRS(n,c,base) \
39BEGIN_FTR_SECTION \ 39BEGIN_FTR_SECTION \
40 b 2f; \ 40 b 2f; \
41END_FTR_SECTION_IFSET(CPU_FTR_VSX); \ 41END_FTR_SECTION_IFSET(CPU_FTR_VSX); \
@@ -44,9 +44,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX); \
442: SAVE_32VSRS(n,c,base); \ 442: SAVE_32VSRS(n,c,base); \
453: 453:
46#else 46#else
47#define REST_32FPVSRS(n,b,base) REST_32FPRS(n, base) 47#define __REST_32FPVSRS(n,b,base) REST_32FPRS(n, base)
48#define SAVE_32FPVSRS(n,b,base) SAVE_32FPRS(n, base) 48#define __SAVE_32FPVSRS(n,b,base) SAVE_32FPRS(n, base)
49#endif 49#endif
50#define REST_32FPVSRS(n,c,base) __REST_32FPVSRS(n,__REG_##c,__REG_##base)
51#define SAVE_32FPVSRS(n,c,base) __SAVE_32FPVSRS(n,__REG_##c,__REG_##base)
50 52
51/* 53/*
52 * This task wants to use the FPU now. 54 * This task wants to use the FPU now.
@@ -79,7 +81,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
79 beq 1f 81 beq 1f
80 toreal(r4) 82 toreal(r4)
81 addi r4,r4,THREAD /* want last_task_used_math->thread */ 83 addi r4,r4,THREAD /* want last_task_used_math->thread */
82 SAVE_32FPVSRS(0, r5, r4) 84 SAVE_32FPVSRS(0, R5, R4)
83 mffs fr0 85 mffs fr0
84 stfd fr0,THREAD_FPSCR(r4) 86 stfd fr0,THREAD_FPSCR(r4)
85 PPC_LL r5,PT_REGS(r4) 87 PPC_LL r5,PT_REGS(r4)
@@ -106,7 +108,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
106#endif 108#endif
107 lfd fr0,THREAD_FPSCR(r5) 109 lfd fr0,THREAD_FPSCR(r5)
108 MTFSF_L(fr0) 110 MTFSF_L(fr0)
109 REST_32FPVSRS(0, r4, r5) 111 REST_32FPVSRS(0, R4, R5)
110#ifndef CONFIG_SMP 112#ifndef CONFIG_SMP
111 subi r4,r5,THREAD 113 subi r4,r5,THREAD
112 fromreal(r4) 114 fromreal(r4)
@@ -140,7 +142,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
140 addi r3,r3,THREAD /* want THREAD of task */ 142 addi r3,r3,THREAD /* want THREAD of task */
141 PPC_LL r5,PT_REGS(r3) 143 PPC_LL r5,PT_REGS(r3)
142 PPC_LCMPI 0,r5,0 144 PPC_LCMPI 0,r5,0
143 SAVE_32FPVSRS(0, r4 ,r3) 145 SAVE_32FPVSRS(0, R4 ,R3)
144 mffs fr0 146 mffs fr0
145 stfd fr0,THREAD_FPSCR(r3) 147 stfd fr0,THREAD_FPSCR(r3)
146 beq 1f 148 beq 1f
diff --git a/arch/powerpc/kernel/ftrace.c b/arch/powerpc/kernel/ftrace.c
index bf99cfa6bbfe..91b46b7f6f0d 100644
--- a/arch/powerpc/kernel/ftrace.c
+++ b/arch/powerpc/kernel/ftrace.c
@@ -63,11 +63,9 @@ ftrace_modify_code(unsigned long ip, unsigned int old, unsigned int new)
63 return -EINVAL; 63 return -EINVAL;
64 64
65 /* replace the text with the new text */ 65 /* replace the text with the new text */
66 if (probe_kernel_write((void *)ip, &new, MCOUNT_INSN_SIZE)) 66 if (patch_instruction((unsigned int *)ip, new))
67 return -EPERM; 67 return -EPERM;
68 68
69 flush_icache_range(ip, ip + 8);
70
71 return 0; 69 return 0;
72} 70}
73 71
@@ -212,12 +210,9 @@ __ftrace_make_nop(struct module *mod,
212 */ 210 */
213 op = 0x48000008; /* b +8 */ 211 op = 0x48000008; /* b +8 */
214 212
215 if (probe_kernel_write((void *)ip, &op, MCOUNT_INSN_SIZE)) 213 if (patch_instruction((unsigned int *)ip, op))
216 return -EPERM; 214 return -EPERM;
217 215
218
219 flush_icache_range(ip, ip + 8);
220
221 return 0; 216 return 0;
222} 217}
223 218
@@ -245,9 +240,9 @@ __ftrace_make_nop(struct module *mod,
245 240
246 /* 241 /*
247 * On PPC32 the trampoline looks like: 242 * On PPC32 the trampoline looks like:
248 * 0x3d, 0x60, 0x00, 0x00 lis r11,sym@ha 243 * 0x3d, 0x80, 0x00, 0x00 lis r12,sym@ha
249 * 0x39, 0x6b, 0x00, 0x00 addi r11,r11,sym@l 244 * 0x39, 0x8c, 0x00, 0x00 addi r12,r12,sym@l
250 * 0x7d, 0x69, 0x03, 0xa6 mtctr r11 245 * 0x7d, 0x89, 0x03, 0xa6 mtctr r12
251 * 0x4e, 0x80, 0x04, 0x20 bctr 246 * 0x4e, 0x80, 0x04, 0x20 bctr
252 */ 247 */
253 248
@@ -262,9 +257,9 @@ __ftrace_make_nop(struct module *mod,
262 pr_devel(" %08x %08x ", jmp[0], jmp[1]); 257 pr_devel(" %08x %08x ", jmp[0], jmp[1]);
263 258
264 /* verify that this is what we expect it to be */ 259 /* verify that this is what we expect it to be */
265 if (((jmp[0] & 0xffff0000) != 0x3d600000) || 260 if (((jmp[0] & 0xffff0000) != 0x3d800000) ||
266 ((jmp[1] & 0xffff0000) != 0x396b0000) || 261 ((jmp[1] & 0xffff0000) != 0x398c0000) ||
267 (jmp[2] != 0x7d6903a6) || 262 (jmp[2] != 0x7d8903a6) ||
268 (jmp[3] != 0x4e800420)) { 263 (jmp[3] != 0x4e800420)) {
269 printk(KERN_ERR "Not a trampoline\n"); 264 printk(KERN_ERR "Not a trampoline\n");
270 return -EINVAL; 265 return -EINVAL;
@@ -286,11 +281,9 @@ __ftrace_make_nop(struct module *mod,
286 281
287 op = PPC_INST_NOP; 282 op = PPC_INST_NOP;
288 283
289 if (probe_kernel_write((void *)ip, &op, MCOUNT_INSN_SIZE)) 284 if (patch_instruction((unsigned int *)ip, op))
290 return -EPERM; 285 return -EPERM;
291 286
292 flush_icache_range(ip, ip + 8);
293
294 return 0; 287 return 0;
295} 288}
296#endif /* PPC64 */ 289#endif /* PPC64 */
@@ -426,11 +419,9 @@ __ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
426 419
427 pr_devel("write to %lx\n", rec->ip); 420 pr_devel("write to %lx\n", rec->ip);
428 421
429 if (probe_kernel_write((void *)ip, &op, MCOUNT_INSN_SIZE)) 422 if (patch_instruction((unsigned int *)ip, op))
430 return -EPERM; 423 return -EPERM;
431 424
432 flush_icache_range(ip, ip + 8);
433
434 return 0; 425 return 0;
435} 426}
436#endif /* CONFIG_PPC64 */ 427#endif /* CONFIG_PPC64 */
@@ -484,6 +475,58 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
484 return ret; 475 return ret;
485} 476}
486 477
478static int __ftrace_replace_code(struct dyn_ftrace *rec, int enable)
479{
480 unsigned long ftrace_addr = (unsigned long)FTRACE_ADDR;
481 int ret;
482
483 ret = ftrace_update_record(rec, enable);
484
485 switch (ret) {
486 case FTRACE_UPDATE_IGNORE:
487 return 0;
488 case FTRACE_UPDATE_MAKE_CALL:
489 return ftrace_make_call(rec, ftrace_addr);
490 case FTRACE_UPDATE_MAKE_NOP:
491 return ftrace_make_nop(NULL, rec, ftrace_addr);
492 }
493
494 return 0;
495}
496
497void ftrace_replace_code(int enable)
498{
499 struct ftrace_rec_iter *iter;
500 struct dyn_ftrace *rec;
501 int ret;
502
503 for (iter = ftrace_rec_iter_start(); iter;
504 iter = ftrace_rec_iter_next(iter)) {
505 rec = ftrace_rec_iter_record(iter);
506 ret = __ftrace_replace_code(rec, enable);
507 if (ret) {
508 ftrace_bug(ret, rec->ip);
509 return;
510 }
511 }
512}
513
514void arch_ftrace_update_code(int command)
515{
516 if (command & FTRACE_UPDATE_CALLS)
517 ftrace_replace_code(1);
518 else if (command & FTRACE_DISABLE_CALLS)
519 ftrace_replace_code(0);
520
521 if (command & FTRACE_UPDATE_TRACE_FUNC)
522 ftrace_update_ftrace_func(ftrace_trace_function);
523
524 if (command & FTRACE_START_FUNC_RET)
525 ftrace_enable_ftrace_graph_caller();
526 else if (command & FTRACE_STOP_FUNC_RET)
527 ftrace_disable_ftrace_graph_caller();
528}
529
487int __init ftrace_dyn_arch_init(void *data) 530int __init ftrace_dyn_arch_init(void *data)
488{ 531{
489 /* caller expects data to be zero */ 532 /* caller expects data to be zero */
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 1f4434a38608..0f59863c3ade 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -192,7 +192,7 @@ _ENTRY(__early_start)
192 li r0,0 192 li r0,0
193 stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1) 193 stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
194 194
195 rlwinm r22,r1,0,0,31-THREAD_SHIFT /* current thread_info */ 195 CURRENT_THREAD_INFO(r22, r1)
196 stw r24, TI_CPU(r22) 196 stw r24, TI_CPU(r22)
197 197
198 bl early_init 198 bl early_init
@@ -556,8 +556,10 @@ END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV)
556 /* SPE Unavailable */ 556 /* SPE Unavailable */
557 START_EXCEPTION(SPEUnavailable) 557 START_EXCEPTION(SPEUnavailable)
558 NORMAL_EXCEPTION_PROLOG(SPE_UNAVAIL) 558 NORMAL_EXCEPTION_PROLOG(SPE_UNAVAIL)
559 bne load_up_spe 559 beq 1f
560 addi r3,r1,STACK_FRAME_OVERHEAD 560 bl load_up_spe
561 b fast_exception_return
5621: addi r3,r1,STACK_FRAME_OVERHEAD
561 EXC_XFER_EE_LITE(0x2010, KernelSPE) 563 EXC_XFER_EE_LITE(0x2010, KernelSPE)
562#else 564#else
563 EXCEPTION(0x2020, SPE_UNAVAIL, SPEUnavailable, \ 565 EXCEPTION(0x2020, SPE_UNAVAIL, SPEUnavailable, \
@@ -778,7 +780,7 @@ tlb_write_entry:
778/* Note that the SPE support is closely modeled after the AltiVec 780/* Note that the SPE support is closely modeled after the AltiVec
779 * support. Changes to one are likely to be applicable to the 781 * support. Changes to one are likely to be applicable to the
780 * other! */ 782 * other! */
781load_up_spe: 783_GLOBAL(load_up_spe)
782/* 784/*
783 * Disable SPE for the task which had SPE previously, 785 * Disable SPE for the task which had SPE previously,
784 * and save its SPE registers in its thread_struct. 786 * and save its SPE registers in its thread_struct.
@@ -826,20 +828,7 @@ load_up_spe:
826 subi r4,r5,THREAD 828 subi r4,r5,THREAD
827 stw r4,last_task_used_spe@l(r3) 829 stw r4,last_task_used_spe@l(r3)
828#endif /* !CONFIG_SMP */ 830#endif /* !CONFIG_SMP */
829 /* restore registers and return */ 831 blr
8302: REST_4GPRS(3, r11)
831 lwz r10,_CCR(r11)
832 REST_GPR(1, r11)
833 mtcr r10
834 lwz r10,_LINK(r11)
835 mtlr r10
836 REST_GPR(10, r11)
837 mtspr SPRN_SRR1,r9
838 mtspr SPRN_SRR0,r12
839 REST_GPR(9, r11)
840 REST_GPR(12, r11)
841 lwz r11,GPR11(r11)
842 rfi
843 832
844/* 833/*
845 * SPE unavailable trap from kernel - print a message, but let 834 * SPE unavailable trap from kernel - print a message, but let
diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
index 2bc0584be81c..f3a82dde61db 100644
--- a/arch/powerpc/kernel/hw_breakpoint.c
+++ b/arch/powerpc/kernel/hw_breakpoint.c
@@ -111,7 +111,7 @@ void arch_unregister_hw_breakpoint(struct perf_event *bp)
111 * and the single_step_dabr_instruction(), then cleanup the breakpoint 111 * and the single_step_dabr_instruction(), then cleanup the breakpoint
112 * restoration variables to prevent dangling pointers. 112 * restoration variables to prevent dangling pointers.
113 */ 113 */
114 if (bp->ctx->task) 114 if (bp->ctx && bp->ctx->task)
115 bp->ctx->task->thread.last_hit_ubp = NULL; 115 bp->ctx->task->thread.last_hit_ubp = NULL;
116} 116}
117 117
diff --git a/arch/powerpc/kernel/idle_6xx.S b/arch/powerpc/kernel/idle_6xx.S
index 15c611de1ee2..1686916cc7f0 100644
--- a/arch/powerpc/kernel/idle_6xx.S
+++ b/arch/powerpc/kernel/idle_6xx.S
@@ -135,7 +135,7 @@ BEGIN_FTR_SECTION
135 DSSALL 135 DSSALL
136 sync 136 sync
137END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 137END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
138 rlwinm r9,r1,0,0,31-THREAD_SHIFT /* current thread_info */ 138 CURRENT_THREAD_INFO(r9, r1)
139 lwz r8,TI_LOCAL_FLAGS(r9) /* set napping bit */ 139 lwz r8,TI_LOCAL_FLAGS(r9) /* set napping bit */
140 ori r8,r8,_TLF_NAPPING /* so when we take an exception */ 140 ori r8,r8,_TLF_NAPPING /* so when we take an exception */
141 stw r8,TI_LOCAL_FLAGS(r9) /* it will return to our caller */ 141 stw r8,TI_LOCAL_FLAGS(r9) /* it will return to our caller */
@@ -158,7 +158,7 @@ _GLOBAL(power_save_ppc32_restore)
158 stw r9,_NIP(r11) /* make it do a blr */ 158 stw r9,_NIP(r11) /* make it do a blr */
159 159
160#ifdef CONFIG_SMP 160#ifdef CONFIG_SMP
161 rlwinm r12,r11,0,0,31-THREAD_SHIFT 161 CURRENT_THREAD_INFO(r12, r11)
162 lwz r11,TI_CPU(r12) /* get cpu number * 4 */ 162 lwz r11,TI_CPU(r12) /* get cpu number * 4 */
163 slwi r11,r11,2 163 slwi r11,r11,2
164#else 164#else
diff --git a/arch/powerpc/kernel/idle_book3e.S b/arch/powerpc/kernel/idle_book3e.S
index ff007b59448d..4c7cb4008585 100644
--- a/arch/powerpc/kernel/idle_book3e.S
+++ b/arch/powerpc/kernel/idle_book3e.S
@@ -60,7 +60,7 @@ _GLOBAL(book3e_idle)
601: /* Let's set the _TLF_NAPPING flag so interrupts make us return 601: /* Let's set the _TLF_NAPPING flag so interrupts make us return
61 * to the right spot 61 * to the right spot
62 */ 62 */
63 clrrdi r11,r1,THREAD_SHIFT 63 CURRENT_THREAD_INFO(r11, r1)
64 ld r10,TI_LOCAL_FLAGS(r11) 64 ld r10,TI_LOCAL_FLAGS(r11)
65 ori r10,r10,_TLF_NAPPING 65 ori r10,r10,_TLF_NAPPING
66 std r10,TI_LOCAL_FLAGS(r11) 66 std r10,TI_LOCAL_FLAGS(r11)
diff --git a/arch/powerpc/kernel/idle_e500.S b/arch/powerpc/kernel/idle_e500.S
index 4f0ab85f3788..15448668988d 100644
--- a/arch/powerpc/kernel/idle_e500.S
+++ b/arch/powerpc/kernel/idle_e500.S
@@ -21,7 +21,7 @@
21 .text 21 .text
22 22
23_GLOBAL(e500_idle) 23_GLOBAL(e500_idle)
24 rlwinm r3,r1,0,0,31-THREAD_SHIFT /* current thread_info */ 24 CURRENT_THREAD_INFO(r3, r1)
25 lwz r4,TI_LOCAL_FLAGS(r3) /* set napping bit */ 25 lwz r4,TI_LOCAL_FLAGS(r3) /* set napping bit */
26 ori r4,r4,_TLF_NAPPING /* so when we take an exception */ 26 ori r4,r4,_TLF_NAPPING /* so when we take an exception */
27 stw r4,TI_LOCAL_FLAGS(r3) /* it will return to our caller */ 27 stw r4,TI_LOCAL_FLAGS(r3) /* it will return to our caller */
@@ -96,7 +96,7 @@ _GLOBAL(power_save_ppc32_restore)
96 stw r9,_NIP(r11) /* make it do a blr */ 96 stw r9,_NIP(r11) /* make it do a blr */
97 97
98#ifdef CONFIG_SMP 98#ifdef CONFIG_SMP
99 rlwinm r12,r1,0,0,31-THREAD_SHIFT 99 CURRENT_THREAD_INFO(r12, r1)
100 lwz r11,TI_CPU(r12) /* get cpu number * 4 */ 100 lwz r11,TI_CPU(r12) /* get cpu number * 4 */
101 slwi r11,r11,2 101 slwi r11,r11,2
102#else 102#else
diff --git a/arch/powerpc/kernel/idle_power4.S b/arch/powerpc/kernel/idle_power4.S
index 2c71b0fc9f91..e3edaa189911 100644
--- a/arch/powerpc/kernel/idle_power4.S
+++ b/arch/powerpc/kernel/idle_power4.S
@@ -59,7 +59,7 @@ BEGIN_FTR_SECTION
59 DSSALL 59 DSSALL
60 sync 60 sync
61END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 61END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
62 clrrdi r9,r1,THREAD_SHIFT /* current thread_info */ 62 CURRENT_THREAD_INFO(r9, r1)
63 ld r8,TI_LOCAL_FLAGS(r9) /* set napping bit */ 63 ld r8,TI_LOCAL_FLAGS(r9) /* set napping bit */
64 ori r8,r8,_TLF_NAPPING /* so when we take an exception */ 64 ori r8,r8,_TLF_NAPPING /* so when we take an exception */
65 std r8,TI_LOCAL_FLAGS(r9) /* it will return to our caller */ 65 std r8,TI_LOCAL_FLAGS(r9) /* it will return to our caller */
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 359f078571c7..ff5a6ce027b8 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -33,6 +33,9 @@
33#include <linux/bitmap.h> 33#include <linux/bitmap.h>
34#include <linux/iommu-helper.h> 34#include <linux/iommu-helper.h>
35#include <linux/crash_dump.h> 35#include <linux/crash_dump.h>
36#include <linux/hash.h>
37#include <linux/fault-inject.h>
38#include <linux/pci.h>
36#include <asm/io.h> 39#include <asm/io.h>
37#include <asm/prom.h> 40#include <asm/prom.h>
38#include <asm/iommu.h> 41#include <asm/iommu.h>
@@ -40,6 +43,7 @@
40#include <asm/machdep.h> 43#include <asm/machdep.h>
41#include <asm/kdump.h> 44#include <asm/kdump.h>
42#include <asm/fadump.h> 45#include <asm/fadump.h>
46#include <asm/vio.h>
43 47
44#define DBG(...) 48#define DBG(...)
45 49
@@ -58,6 +62,114 @@ static int __init setup_iommu(char *str)
58 62
59__setup("iommu=", setup_iommu); 63__setup("iommu=", setup_iommu);
60 64
65static DEFINE_PER_CPU(unsigned int, iommu_pool_hash);
66
67/*
68 * We precalculate the hash to avoid doing it on every allocation.
69 *
70 * The hash is important to spread CPUs across all the pools. For example,
71 * on a POWER7 with 4 way SMT we want interrupts on the primary threads and
72 * with 4 pools all primary threads would map to the same pool.
73 */
74static int __init setup_iommu_pool_hash(void)
75{
76 unsigned int i;
77
78 for_each_possible_cpu(i)
79 per_cpu(iommu_pool_hash, i) = hash_32(i, IOMMU_POOL_HASHBITS);
80
81 return 0;
82}
83subsys_initcall(setup_iommu_pool_hash);
84
85#ifdef CONFIG_FAIL_IOMMU
86
87static DECLARE_FAULT_ATTR(fail_iommu);
88
89static int __init setup_fail_iommu(char *str)
90{
91 return setup_fault_attr(&fail_iommu, str);
92}
93__setup("fail_iommu=", setup_fail_iommu);
94
95static bool should_fail_iommu(struct device *dev)
96{
97 return dev->archdata.fail_iommu && should_fail(&fail_iommu, 1);
98}
99
100static int __init fail_iommu_debugfs(void)
101{
102 struct dentry *dir = fault_create_debugfs_attr("fail_iommu",
103 NULL, &fail_iommu);
104
105 return IS_ERR(dir) ? PTR_ERR(dir) : 0;
106}
107late_initcall(fail_iommu_debugfs);
108
109static ssize_t fail_iommu_show(struct device *dev,
110 struct device_attribute *attr, char *buf)
111{
112 return sprintf(buf, "%d\n", dev->archdata.fail_iommu);
113}
114
115static ssize_t fail_iommu_store(struct device *dev,
116 struct device_attribute *attr, const char *buf,
117 size_t count)
118{
119 int i;
120
121 if (count > 0 && sscanf(buf, "%d", &i) > 0)
122 dev->archdata.fail_iommu = (i == 0) ? 0 : 1;
123
124 return count;
125}
126
127static DEVICE_ATTR(fail_iommu, S_IRUGO|S_IWUSR, fail_iommu_show,
128 fail_iommu_store);
129
130static int fail_iommu_bus_notify(struct notifier_block *nb,
131 unsigned long action, void *data)
132{
133 struct device *dev = data;
134
135 if (action == BUS_NOTIFY_ADD_DEVICE) {
136 if (device_create_file(dev, &dev_attr_fail_iommu))
137 pr_warn("Unable to create IOMMU fault injection sysfs "
138 "entries\n");
139 } else if (action == BUS_NOTIFY_DEL_DEVICE) {
140 device_remove_file(dev, &dev_attr_fail_iommu);
141 }
142
143 return 0;
144}
145
146static struct notifier_block fail_iommu_bus_notifier = {
147 .notifier_call = fail_iommu_bus_notify
148};
149
150static int __init fail_iommu_setup(void)
151{
152#ifdef CONFIG_PCI
153 bus_register_notifier(&pci_bus_type, &fail_iommu_bus_notifier);
154#endif
155#ifdef CONFIG_IBMVIO
156 bus_register_notifier(&vio_bus_type, &fail_iommu_bus_notifier);
157#endif
158
159 return 0;
160}
161/*
162 * Must execute after PCI and VIO subsystem have initialised but before
163 * devices are probed.
164 */
165arch_initcall(fail_iommu_setup);
166#else
167static inline bool should_fail_iommu(struct device *dev)
168{
169 return false;
170}
171#endif
172
61static unsigned long iommu_range_alloc(struct device *dev, 173static unsigned long iommu_range_alloc(struct device *dev,
62 struct iommu_table *tbl, 174 struct iommu_table *tbl,
63 unsigned long npages, 175 unsigned long npages,
@@ -71,6 +183,9 @@ static unsigned long iommu_range_alloc(struct device *dev,
71 int pass = 0; 183 int pass = 0;
72 unsigned long align_mask; 184 unsigned long align_mask;
73 unsigned long boundary_size; 185 unsigned long boundary_size;
186 unsigned long flags;
187 unsigned int pool_nr;
188 struct iommu_pool *pool;
74 189
75 align_mask = 0xffffffffffffffffl >> (64 - align_order); 190 align_mask = 0xffffffffffffffffl >> (64 - align_order);
76 191
@@ -83,36 +198,49 @@ static unsigned long iommu_range_alloc(struct device *dev,
83 return DMA_ERROR_CODE; 198 return DMA_ERROR_CODE;
84 } 199 }
85 200
86 if (handle && *handle) 201 if (should_fail_iommu(dev))
87 start = *handle; 202 return DMA_ERROR_CODE;
203
204 /*
205 * We don't need to disable preemption here because any CPU can
206 * safely use any IOMMU pool.
207 */
208 pool_nr = __raw_get_cpu_var(iommu_pool_hash) & (tbl->nr_pools - 1);
209
210 if (largealloc)
211 pool = &(tbl->large_pool);
88 else 212 else
89 start = largealloc ? tbl->it_largehint : tbl->it_hint; 213 pool = &(tbl->pools[pool_nr]);
90 214
91 /* Use only half of the table for small allocs (15 pages or less) */ 215 spin_lock_irqsave(&(pool->lock), flags);
92 limit = largealloc ? tbl->it_size : tbl->it_halfpoint;
93 216
94 if (largealloc && start < tbl->it_halfpoint) 217again:
95 start = tbl->it_halfpoint; 218 if ((pass == 0) && handle && *handle)
219 start = *handle;
220 else
221 start = pool->hint;
222
223 limit = pool->end;
96 224
97 /* The case below can happen if we have a small segment appended 225 /* The case below can happen if we have a small segment appended
98 * to a large, or when the previous alloc was at the very end of 226 * to a large, or when the previous alloc was at the very end of
99 * the available space. If so, go back to the initial start. 227 * the available space. If so, go back to the initial start.
100 */ 228 */
101 if (start >= limit) 229 if (start >= limit)
102 start = largealloc ? tbl->it_largehint : tbl->it_hint; 230 start = pool->start;
103
104 again:
105 231
106 if (limit + tbl->it_offset > mask) { 232 if (limit + tbl->it_offset > mask) {
107 limit = mask - tbl->it_offset + 1; 233 limit = mask - tbl->it_offset + 1;
108 /* If we're constrained on address range, first try 234 /* If we're constrained on address range, first try
109 * at the masked hint to avoid O(n) search complexity, 235 * at the masked hint to avoid O(n) search complexity,
110 * but on second pass, start at 0. 236 * but on second pass, start at 0 in pool 0.
111 */ 237 */
112 if ((start & mask) >= limit || pass > 0) 238 if ((start & mask) >= limit || pass > 0) {
113 start = 0; 239 pool = &(tbl->pools[0]);
114 else 240 start = pool->start;
241 } else {
115 start &= mask; 242 start &= mask;
243 }
116 } 244 }
117 245
118 if (dev) 246 if (dev)
@@ -126,16 +254,25 @@ static unsigned long iommu_range_alloc(struct device *dev,
126 tbl->it_offset, boundary_size >> IOMMU_PAGE_SHIFT, 254 tbl->it_offset, boundary_size >> IOMMU_PAGE_SHIFT,
127 align_mask); 255 align_mask);
128 if (n == -1) { 256 if (n == -1) {
129 if (likely(pass < 2)) { 257 if (likely(pass == 0)) {
130 /* First failure, just rescan the half of the table. 258 /* First try the pool from the start */
131 * Second failure, rescan the other half of the table. 259 pool->hint = pool->start;
132 */
133 start = (largealloc ^ pass) ? tbl->it_halfpoint : 0;
134 limit = pass ? tbl->it_size : limit;
135 pass++; 260 pass++;
136 goto again; 261 goto again;
262
263 } else if (pass <= tbl->nr_pools) {
264 /* Now try scanning all the other pools */
265 spin_unlock(&(pool->lock));
266 pool_nr = (pool_nr + 1) & (tbl->nr_pools - 1);
267 pool = &tbl->pools[pool_nr];
268 spin_lock(&(pool->lock));
269 pool->hint = pool->start;
270 pass++;
271 goto again;
272
137 } else { 273 } else {
138 /* Third failure, give up */ 274 /* Give up */
275 spin_unlock_irqrestore(&(pool->lock), flags);
139 return DMA_ERROR_CODE; 276 return DMA_ERROR_CODE;
140 } 277 }
141 } 278 }
@@ -145,10 +282,10 @@ static unsigned long iommu_range_alloc(struct device *dev,
145 /* Bump the hint to a new block for small allocs. */ 282 /* Bump the hint to a new block for small allocs. */
146 if (largealloc) { 283 if (largealloc) {
147 /* Don't bump to new block to avoid fragmentation */ 284 /* Don't bump to new block to avoid fragmentation */
148 tbl->it_largehint = end; 285 pool->hint = end;
149 } else { 286 } else {
150 /* Overflow will be taken care of at the next allocation */ 287 /* Overflow will be taken care of at the next allocation */
151 tbl->it_hint = (end + tbl->it_blocksize - 1) & 288 pool->hint = (end + tbl->it_blocksize - 1) &
152 ~(tbl->it_blocksize - 1); 289 ~(tbl->it_blocksize - 1);
153 } 290 }
154 291
@@ -156,6 +293,8 @@ static unsigned long iommu_range_alloc(struct device *dev,
156 if (handle) 293 if (handle)
157 *handle = end; 294 *handle = end;
158 295
296 spin_unlock_irqrestore(&(pool->lock), flags);
297
159 return n; 298 return n;
160} 299}
161 300
@@ -165,18 +304,14 @@ static dma_addr_t iommu_alloc(struct device *dev, struct iommu_table *tbl,
165 unsigned long mask, unsigned int align_order, 304 unsigned long mask, unsigned int align_order,
166 struct dma_attrs *attrs) 305 struct dma_attrs *attrs)
167{ 306{
168 unsigned long entry, flags; 307 unsigned long entry;
169 dma_addr_t ret = DMA_ERROR_CODE; 308 dma_addr_t ret = DMA_ERROR_CODE;
170 int build_fail; 309 int build_fail;
171 310
172 spin_lock_irqsave(&(tbl->it_lock), flags);
173
174 entry = iommu_range_alloc(dev, tbl, npages, NULL, mask, align_order); 311 entry = iommu_range_alloc(dev, tbl, npages, NULL, mask, align_order);
175 312
176 if (unlikely(entry == DMA_ERROR_CODE)) { 313 if (unlikely(entry == DMA_ERROR_CODE))
177 spin_unlock_irqrestore(&(tbl->it_lock), flags);
178 return DMA_ERROR_CODE; 314 return DMA_ERROR_CODE;
179 }
180 315
181 entry += tbl->it_offset; /* Offset into real TCE table */ 316 entry += tbl->it_offset; /* Offset into real TCE table */
182 ret = entry << IOMMU_PAGE_SHIFT; /* Set the return dma address */ 317 ret = entry << IOMMU_PAGE_SHIFT; /* Set the return dma address */
@@ -193,8 +328,6 @@ static dma_addr_t iommu_alloc(struct device *dev, struct iommu_table *tbl,
193 */ 328 */
194 if (unlikely(build_fail)) { 329 if (unlikely(build_fail)) {
195 __iommu_free(tbl, ret, npages); 330 __iommu_free(tbl, ret, npages);
196
197 spin_unlock_irqrestore(&(tbl->it_lock), flags);
198 return DMA_ERROR_CODE; 331 return DMA_ERROR_CODE;
199 } 332 }
200 333
@@ -202,16 +335,14 @@ static dma_addr_t iommu_alloc(struct device *dev, struct iommu_table *tbl,
202 if (ppc_md.tce_flush) 335 if (ppc_md.tce_flush)
203 ppc_md.tce_flush(tbl); 336 ppc_md.tce_flush(tbl);
204 337
205 spin_unlock_irqrestore(&(tbl->it_lock), flags);
206
207 /* Make sure updates are seen by hardware */ 338 /* Make sure updates are seen by hardware */
208 mb(); 339 mb();
209 340
210 return ret; 341 return ret;
211} 342}
212 343
213static void __iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr, 344static bool iommu_free_check(struct iommu_table *tbl, dma_addr_t dma_addr,
214 unsigned int npages) 345 unsigned int npages)
215{ 346{
216 unsigned long entry, free_entry; 347 unsigned long entry, free_entry;
217 348
@@ -231,20 +362,57 @@ static void __iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
231 printk(KERN_INFO "\tindex = 0x%llx\n", (u64)tbl->it_index); 362 printk(KERN_INFO "\tindex = 0x%llx\n", (u64)tbl->it_index);
232 WARN_ON(1); 363 WARN_ON(1);
233 } 364 }
234 return; 365
366 return false;
367 }
368
369 return true;
370}
371
372static struct iommu_pool *get_pool(struct iommu_table *tbl,
373 unsigned long entry)
374{
375 struct iommu_pool *p;
376 unsigned long largepool_start = tbl->large_pool.start;
377
378 /* The large pool is the last pool at the top of the table */
379 if (entry >= largepool_start) {
380 p = &tbl->large_pool;
381 } else {
382 unsigned int pool_nr = entry / tbl->poolsize;
383
384 BUG_ON(pool_nr > tbl->nr_pools);
385 p = &tbl->pools[pool_nr];
235 } 386 }
236 387
388 return p;
389}
390
391static void __iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
392 unsigned int npages)
393{
394 unsigned long entry, free_entry;
395 unsigned long flags;
396 struct iommu_pool *pool;
397
398 entry = dma_addr >> IOMMU_PAGE_SHIFT;
399 free_entry = entry - tbl->it_offset;
400
401 pool = get_pool(tbl, free_entry);
402
403 if (!iommu_free_check(tbl, dma_addr, npages))
404 return;
405
237 ppc_md.tce_free(tbl, entry, npages); 406 ppc_md.tce_free(tbl, entry, npages);
407
408 spin_lock_irqsave(&(pool->lock), flags);
238 bitmap_clear(tbl->it_map, free_entry, npages); 409 bitmap_clear(tbl->it_map, free_entry, npages);
410 spin_unlock_irqrestore(&(pool->lock), flags);
239} 411}
240 412
241static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr, 413static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
242 unsigned int npages) 414 unsigned int npages)
243{ 415{
244 unsigned long flags;
245
246 spin_lock_irqsave(&(tbl->it_lock), flags);
247
248 __iommu_free(tbl, dma_addr, npages); 416 __iommu_free(tbl, dma_addr, npages);
249 417
250 /* Make sure TLB cache is flushed if the HW needs it. We do 418 /* Make sure TLB cache is flushed if the HW needs it. We do
@@ -253,8 +421,6 @@ static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
253 */ 421 */
254 if (ppc_md.tce_flush) 422 if (ppc_md.tce_flush)
255 ppc_md.tce_flush(tbl); 423 ppc_md.tce_flush(tbl);
256
257 spin_unlock_irqrestore(&(tbl->it_lock), flags);
258} 424}
259 425
260int iommu_map_sg(struct device *dev, struct iommu_table *tbl, 426int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
@@ -263,7 +429,6 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
263 struct dma_attrs *attrs) 429 struct dma_attrs *attrs)
264{ 430{
265 dma_addr_t dma_next = 0, dma_addr; 431 dma_addr_t dma_next = 0, dma_addr;
266 unsigned long flags;
267 struct scatterlist *s, *outs, *segstart; 432 struct scatterlist *s, *outs, *segstart;
268 int outcount, incount, i, build_fail = 0; 433 int outcount, incount, i, build_fail = 0;
269 unsigned int align; 434 unsigned int align;
@@ -285,8 +450,6 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
285 450
286 DBG("sg mapping %d elements:\n", nelems); 451 DBG("sg mapping %d elements:\n", nelems);
287 452
288 spin_lock_irqsave(&(tbl->it_lock), flags);
289
290 max_seg_size = dma_get_max_seg_size(dev); 453 max_seg_size = dma_get_max_seg_size(dev);
291 for_each_sg(sglist, s, nelems, i) { 454 for_each_sg(sglist, s, nelems, i) {
292 unsigned long vaddr, npages, entry, slen; 455 unsigned long vaddr, npages, entry, slen;
@@ -369,8 +532,6 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
369 if (ppc_md.tce_flush) 532 if (ppc_md.tce_flush)
370 ppc_md.tce_flush(tbl); 533 ppc_md.tce_flush(tbl);
371 534
372 spin_unlock_irqrestore(&(tbl->it_lock), flags);
373
374 DBG("mapped %d elements:\n", outcount); 535 DBG("mapped %d elements:\n", outcount);
375 536
376 /* For the sake of iommu_unmap_sg, we clear out the length in the 537 /* For the sake of iommu_unmap_sg, we clear out the length in the
@@ -402,7 +563,6 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
402 if (s == outs) 563 if (s == outs)
403 break; 564 break;
404 } 565 }
405 spin_unlock_irqrestore(&(tbl->it_lock), flags);
406 return 0; 566 return 0;
407} 567}
408 568
@@ -412,15 +572,12 @@ void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
412 struct dma_attrs *attrs) 572 struct dma_attrs *attrs)
413{ 573{
414 struct scatterlist *sg; 574 struct scatterlist *sg;
415 unsigned long flags;
416 575
417 BUG_ON(direction == DMA_NONE); 576 BUG_ON(direction == DMA_NONE);
418 577
419 if (!tbl) 578 if (!tbl)
420 return; 579 return;
421 580
422 spin_lock_irqsave(&(tbl->it_lock), flags);
423
424 sg = sglist; 581 sg = sglist;
425 while (nelems--) { 582 while (nelems--) {
426 unsigned int npages; 583 unsigned int npages;
@@ -440,8 +597,6 @@ void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
440 */ 597 */
441 if (ppc_md.tce_flush) 598 if (ppc_md.tce_flush)
442 ppc_md.tce_flush(tbl); 599 ppc_md.tce_flush(tbl);
443
444 spin_unlock_irqrestore(&(tbl->it_lock), flags);
445} 600}
446 601
447static void iommu_table_clear(struct iommu_table *tbl) 602static void iommu_table_clear(struct iommu_table *tbl)
@@ -494,9 +649,8 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid)
494 unsigned long sz; 649 unsigned long sz;
495 static int welcomed = 0; 650 static int welcomed = 0;
496 struct page *page; 651 struct page *page;
497 652 unsigned int i;
498 /* Set aside 1/4 of the table for large allocations. */ 653 struct iommu_pool *p;
499 tbl->it_halfpoint = tbl->it_size * 3 / 4;
500 654
501 /* number of bytes needed for the bitmap */ 655 /* number of bytes needed for the bitmap */
502 sz = (tbl->it_size + 7) >> 3; 656 sz = (tbl->it_size + 7) >> 3;
@@ -515,9 +669,28 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl, int nid)
515 if (tbl->it_offset == 0) 669 if (tbl->it_offset == 0)
516 set_bit(0, tbl->it_map); 670 set_bit(0, tbl->it_map);
517 671
518 tbl->it_hint = 0; 672 /* We only split the IOMMU table if we have 1GB or more of space */
519 tbl->it_largehint = tbl->it_halfpoint; 673 if ((tbl->it_size << IOMMU_PAGE_SHIFT) >= (1UL * 1024 * 1024 * 1024))
520 spin_lock_init(&tbl->it_lock); 674 tbl->nr_pools = IOMMU_NR_POOLS;
675 else
676 tbl->nr_pools = 1;
677
678 /* We reserve the top 1/4 of the table for large allocations */
679 tbl->poolsize = (tbl->it_size * 3 / 4) / tbl->nr_pools;
680
681 for (i = 0; i < tbl->nr_pools; i++) {
682 p = &tbl->pools[i];
683 spin_lock_init(&(p->lock));
684 p->start = tbl->poolsize * i;
685 p->hint = p->start;
686 p->end = p->start + tbl->poolsize;
687 }
688
689 p = &tbl->large_pool;
690 spin_lock_init(&(p->lock));
691 p->start = tbl->poolsize * i;
692 p->hint = p->start;
693 p->end = tbl->it_size;
521 694
522 iommu_table_clear(tbl); 695 iommu_table_clear(tbl);
523 696
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 7835a5e1ea5f..1f017bb7a7ce 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -229,7 +229,7 @@ notrace void arch_local_irq_restore(unsigned long en)
229 */ 229 */
230 if (unlikely(irq_happened != PACA_IRQ_HARD_DIS)) 230 if (unlikely(irq_happened != PACA_IRQ_HARD_DIS))
231 __hard_irq_disable(); 231 __hard_irq_disable();
232#ifdef CONFIG_TRACE_IRQFLAG 232#ifdef CONFIG_TRACE_IRQFLAGS
233 else { 233 else {
234 /* 234 /*
235 * We should already be hard disabled here. We had bugs 235 * We should already be hard disabled here. We had bugs
@@ -277,7 +277,7 @@ EXPORT_SYMBOL(arch_local_irq_restore);
277 * NOTE: This is called with interrupts hard disabled but not marked 277 * NOTE: This is called with interrupts hard disabled but not marked
278 * as such in paca->irq_happened, so we need to resync this. 278 * as such in paca->irq_happened, so we need to resync this.
279 */ 279 */
280void restore_interrupts(void) 280void notrace restore_interrupts(void)
281{ 281{
282 if (irqs_disabled()) { 282 if (irqs_disabled()) {
283 local_paca->irq_happened |= PACA_IRQ_HARD_DIS; 283 local_paca->irq_happened |= PACA_IRQ_HARD_DIS;
@@ -286,6 +286,52 @@ void restore_interrupts(void)
286 __hard_irq_enable(); 286 __hard_irq_enable();
287} 287}
288 288
289/*
290 * This is a helper to use when about to go into idle low-power
291 * when the latter has the side effect of re-enabling interrupts
292 * (such as calling H_CEDE under pHyp).
293 *
294 * You call this function with interrupts soft-disabled (this is
295 * already the case when ppc_md.power_save is called). The function
296 * will return whether to enter power save or just return.
297 *
298 * In the former case, it will have notified lockdep of interrupts
299 * being re-enabled and generally sanitized the lazy irq state,
300 * and in the latter case it will leave with interrupts hard
301 * disabled and marked as such, so the local_irq_enable() call
302 * in cpu_idle() will properly re-enable everything.
303 */
304bool prep_irq_for_idle(void)
305{
306 /*
307 * First we need to hard disable to ensure no interrupt
308 * occurs before we effectively enter the low power state
309 */
310 hard_irq_disable();
311
312 /*
313 * If anything happened while we were soft-disabled,
314 * we return now and do not enter the low power state.
315 */
316 if (lazy_irq_pending())
317 return false;
318
319 /* Tell lockdep we are about to re-enable */
320 trace_hardirqs_on();
321
322 /*
323 * Mark interrupts as soft-enabled and clear the
324 * PACA_IRQ_HARD_DIS from the pending mask since we
325 * are about to hard enable as well as a side effect
326 * of entering the low power state.
327 */
328 local_paca->irq_happened &= ~PACA_IRQ_HARD_DIS;
329 local_paca->soft_enabled = 1;
330
331 /* Tell the caller to enter the low power state */
332 return true;
333}
334
289#endif /* CONFIG_PPC64 */ 335#endif /* CONFIG_PPC64 */
290 336
291int arch_show_interrupts(struct seq_file *p, int prec) 337int arch_show_interrupts(struct seq_file *p, int prec)
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index 1c13307e0308..867db1de8949 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -303,7 +303,7 @@ static void kvm_patch_ins_wrtee(u32 *inst, u32 rt, int imm_one)
303 303
304 if (imm_one) { 304 if (imm_one) {
305 p[kvm_emulate_wrtee_reg_offs] = 305 p[kvm_emulate_wrtee_reg_offs] =
306 KVM_INST_LI | __PPC_RT(30) | MSR_EE; 306 KVM_INST_LI | __PPC_RT(R30) | MSR_EE;
307 } else { 307 } else {
308 /* Make clobbered registers work too */ 308 /* Make clobbered registers work too */
309 switch (get_rt(rt)) { 309 switch (get_rt(rt)) {
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 386d57f66f28..407e293aad2f 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -179,7 +179,7 @@ _GLOBAL(low_choose_750fx_pll)
179 mtspr SPRN_HID1,r4 179 mtspr SPRN_HID1,r4
180 180
181 /* Store new HID1 image */ 181 /* Store new HID1 image */
182 rlwinm r6,r1,0,0,(31-THREAD_SHIFT) 182 CURRENT_THREAD_INFO(r6, r1)
183 lwz r6,TI_CPU(r6) 183 lwz r6,TI_CPU(r6)
184 slwi r6,r6,2 184 slwi r6,r6,2
185 addis r6,r6,nap_save_hid1@ha 185 addis r6,r6,nap_save_hid1@ha
@@ -699,7 +699,7 @@ _GLOBAL(kernel_thread)
699#ifdef CONFIG_SMP 699#ifdef CONFIG_SMP
700_GLOBAL(start_secondary_resume) 700_GLOBAL(start_secondary_resume)
701 /* Reset stack */ 701 /* Reset stack */
702 rlwinm r1,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */ 702 CURRENT_THREAD_INFO(r1, r1)
703 addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD 703 addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
704 li r3,0 704 li r3,0
705 stw r3,0(r1) /* Zero the stack frame pointer */ 705 stw r3,0(r1) /* Zero the stack frame pointer */
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 616921ef1439..565b78625a32 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -301,11 +301,6 @@ _GLOBAL(real_writeb)
301 301
302#ifdef CONFIG_PPC_PASEMI 302#ifdef CONFIG_PPC_PASEMI
303 303
304/* No support in all binutils for these yet, so use defines */
305#define LBZCIX(RT,RA,RB) .long (0x7c0006aa|(RT<<21)|(RA<<16)|(RB << 11))
306#define STBCIX(RS,RA,RB) .long (0x7c0007aa|(RS<<21)|(RA<<16)|(RB << 11))
307
308
309_GLOBAL(real_205_readb) 304_GLOBAL(real_205_readb)
310 mfmsr r7 305 mfmsr r7
311 ori r0,r7,MSR_DR 306 ori r0,r7,MSR_DR
@@ -314,7 +309,7 @@ _GLOBAL(real_205_readb)
314 mtmsrd r0 309 mtmsrd r0
315 sync 310 sync
316 isync 311 isync
317 LBZCIX(r3,0,r3) 312 LBZCIX(R3,R0,R3)
318 isync 313 isync
319 mtmsrd r7 314 mtmsrd r7
320 sync 315 sync
@@ -329,7 +324,7 @@ _GLOBAL(real_205_writeb)
329 mtmsrd r0 324 mtmsrd r0
330 sync 325 sync
331 isync 326 isync
332 STBCIX(r3,0,r4) 327 STBCIX(R3,R0,R4)
333 isync 328 isync
334 mtmsrd r7 329 mtmsrd r7
335 sync 330 sync
diff --git a/arch/powerpc/kernel/module_32.c b/arch/powerpc/kernel/module_32.c
index 0b6d79617d7b..2e3200ca485f 100644
--- a/arch/powerpc/kernel/module_32.c
+++ b/arch/powerpc/kernel/module_32.c
@@ -176,8 +176,8 @@ int module_frob_arch_sections(Elf32_Ehdr *hdr,
176 176
177static inline int entry_matches(struct ppc_plt_entry *entry, Elf32_Addr val) 177static inline int entry_matches(struct ppc_plt_entry *entry, Elf32_Addr val)
178{ 178{
179 if (entry->jump[0] == 0x3d600000 + ((val + 0x8000) >> 16) 179 if (entry->jump[0] == 0x3d800000 + ((val + 0x8000) >> 16)
180 && entry->jump[1] == 0x396b0000 + (val & 0xffff)) 180 && entry->jump[1] == 0x398c0000 + (val & 0xffff))
181 return 1; 181 return 1;
182 return 0; 182 return 0;
183} 183}
@@ -204,10 +204,9 @@ static uint32_t do_plt_call(void *location,
204 entry++; 204 entry++;
205 } 205 }
206 206
207 /* Stolen from Paul Mackerras as well... */ 207 entry->jump[0] = 0x3d800000+((val+0x8000)>>16); /* lis r12,sym@ha */
208 entry->jump[0] = 0x3d600000+((val+0x8000)>>16); /* lis r11,sym@ha */ 208 entry->jump[1] = 0x398c0000 + (val&0xffff); /* addi r12,r12,sym@l*/
209 entry->jump[1] = 0x396b0000 + (val&0xffff); /* addi r11,r11,sym@l*/ 209 entry->jump[2] = 0x7d8903a6; /* mtctr r12 */
210 entry->jump[2] = 0x7d6903a6; /* mtctr r11 */
211 entry->jump[3] = 0x4e800420; /* bctr */ 210 entry->jump[3] = 0x4e800420; /* bctr */
212 211
213 DEBUGP("Initialized plt for 0x%x at %p\n", val, entry); 212 DEBUGP("Initialized plt for 0x%x at %p\n", val, entry);
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 8e78e93c8185..0f75bd500404 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1646,7 +1646,6 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose)
1646 pci_free_resource_list(&resources); 1646 pci_free_resource_list(&resources);
1647 return; 1647 return;
1648 } 1648 }
1649 bus->secondary = hose->first_busno;
1650 hose->bus = bus; 1649 hose->bus = bus;
1651 1650
1652 /* Get probe mode and perform scan */ 1651 /* Get probe mode and perform scan */
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index 89dde171a6fa..d7dd42bd1452 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -198,7 +198,6 @@ EXPORT_SYMBOL(of_create_pci_dev);
198 198
199/** 199/**
200 * of_scan_pci_bridge - Set up a PCI bridge and scan for child nodes 200 * of_scan_pci_bridge - Set up a PCI bridge and scan for child nodes
201 * @node: device tree node of bridge
202 * @dev: pci_dev structure for the bridge 201 * @dev: pci_dev structure for the bridge
203 * 202 *
204 * of_scan_bus() calls this routine for each PCI bridge that it finds, and 203 * of_scan_bus() calls this routine for each PCI bridge that it finds, and
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 1b488e5305c5..0794a3017b1b 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -1312,7 +1312,7 @@ static struct opal_secondary_data {
1312 1312
1313extern char opal_secondary_entry; 1313extern char opal_secondary_entry;
1314 1314
1315static void prom_query_opal(void) 1315static void __init prom_query_opal(void)
1316{ 1316{
1317 long rc; 1317 long rc;
1318 1318
@@ -1436,7 +1436,7 @@ static void __init prom_opal_hold_cpus(void)
1436 prom_debug("prom_opal_hold_cpus: end...\n"); 1436 prom_debug("prom_opal_hold_cpus: end...\n");
1437} 1437}
1438 1438
1439static void prom_opal_takeover(void) 1439static void __init prom_opal_takeover(void)
1440{ 1440{
1441 struct opal_secondary_data *data = &RELOC(opal_secondary_data); 1441 struct opal_secondary_data *data = &RELOC(opal_secondary_data);
1442 struct opal_takeover_args *args = &data->args; 1442 struct opal_takeover_args *args = &data->args;
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index afd4f051f3f2..bdc499c17872 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -720,6 +720,33 @@ static int powerpc_debugfs_init(void)
720arch_initcall(powerpc_debugfs_init); 720arch_initcall(powerpc_debugfs_init);
721#endif 721#endif
722 722
723#ifdef CONFIG_BOOKE_WDT
724extern u32 booke_wdt_enabled;
725extern u32 booke_wdt_period;
726
727/* Checks wdt=x and wdt_period=xx command-line option */
728notrace int __init early_parse_wdt(char *p)
729{
730 if (p && strncmp(p, "0", 1) != 0)
731 booke_wdt_enabled = 1;
732
733 return 0;
734}
735early_param("wdt", early_parse_wdt);
736
737int __init early_parse_wdt_period(char *p)
738{
739 unsigned long ret;
740 if (p) {
741 if (!kstrtol(p, 0, &ret))
742 booke_wdt_period = ret;
743 }
744
745 return 0;
746}
747early_param("wdt_period", early_parse_wdt_period);
748#endif /* CONFIG_BOOKE_WDT */
749
723void ppc_printk_progress(char *s, unsigned short hex) 750void ppc_printk_progress(char *s, unsigned short hex)
724{ 751{
725 pr_info("%s\n", s); 752 pr_info("%s\n", s);
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index ec8a53fa9e8f..a8f54ecb091f 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -149,30 +149,6 @@ notrace void __init machine_init(u64 dt_ptr)
149 ppc_md.progress("id mach(): done", 0x200); 149 ppc_md.progress("id mach(): done", 0x200);
150} 150}
151 151
152#ifdef CONFIG_BOOKE_WDT
153extern u32 booke_wdt_enabled;
154extern u32 booke_wdt_period;
155
156/* Checks wdt=x and wdt_period=xx command-line option */
157notrace int __init early_parse_wdt(char *p)
158{
159 if (p && strncmp(p, "0", 1) != 0)
160 booke_wdt_enabled = 1;
161
162 return 0;
163}
164early_param("wdt", early_parse_wdt);
165
166int __init early_parse_wdt_period (char *p)
167{
168 if (p)
169 booke_wdt_period = simple_strtoul(p, NULL, 0);
170
171 return 0;
172}
173early_param("wdt_period", early_parse_wdt_period);
174#endif /* CONFIG_BOOKE_WDT */
175
176/* Checks "l2cr=xxxx" command-line option */ 152/* Checks "l2cr=xxxx" command-line option */
177int __init ppc_setup_l2cr(char *str) 153int __init ppc_setup_l2cr(char *str)
178{ 154{
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index e4cb34322de4..0321007086f7 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -48,6 +48,7 @@
48#ifdef CONFIG_PPC64 48#ifdef CONFIG_PPC64
49#include <asm/paca.h> 49#include <asm/paca.h>
50#endif 50#endif
51#include <asm/vdso.h>
51#include <asm/debug.h> 52#include <asm/debug.h>
52 53
53#ifdef DEBUG 54#ifdef DEBUG
@@ -570,8 +571,9 @@ void __devinit start_secondary(void *unused)
570#ifdef CONFIG_PPC64 571#ifdef CONFIG_PPC64
571 if (system_state == SYSTEM_RUNNING) 572 if (system_state == SYSTEM_RUNNING)
572 vdso_data->processorCount++; 573 vdso_data->processorCount++;
574
575 vdso_getcpu_init();
573#endif 576#endif
574 ipi_call_lock();
575 notify_cpu_starting(cpu); 577 notify_cpu_starting(cpu);
576 set_cpu_online(cpu, true); 578 set_cpu_online(cpu, true);
577 /* Update sibling maps */ 579 /* Update sibling maps */
@@ -601,7 +603,6 @@ void __devinit start_secondary(void *unused)
601 of_node_put(np); 603 of_node_put(np);
602 } 604 }
603 of_node_put(l2_cache); 605 of_node_put(l2_cache);
604 ipi_call_unlock();
605 606
606 local_irq_enable(); 607 local_irq_enable();
607 608
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 99a995c2a3f2..be171ee73bf8 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -475,6 +475,7 @@ void timer_interrupt(struct pt_regs * regs)
475 struct pt_regs *old_regs; 475 struct pt_regs *old_regs;
476 u64 *next_tb = &__get_cpu_var(decrementers_next_tb); 476 u64 *next_tb = &__get_cpu_var(decrementers_next_tb);
477 struct clock_event_device *evt = &__get_cpu_var(decrementers); 477 struct clock_event_device *evt = &__get_cpu_var(decrementers);
478 u64 now;
478 479
479 /* Ensure a positive value is written to the decrementer, or else 480 /* Ensure a positive value is written to the decrementer, or else
480 * some CPUs will continue to take decrementer exceptions. 481 * some CPUs will continue to take decrementer exceptions.
@@ -509,9 +510,16 @@ void timer_interrupt(struct pt_regs * regs)
509 irq_work_run(); 510 irq_work_run();
510 } 511 }
511 512
512 *next_tb = ~(u64)0; 513 now = get_tb_or_rtc();
513 if (evt->event_handler) 514 if (now >= *next_tb) {
514 evt->event_handler(evt); 515 *next_tb = ~(u64)0;
516 if (evt->event_handler)
517 evt->event_handler(evt);
518 } else {
519 now = *next_tb - now;
520 if (now <= DECREMENTER_MAX)
521 set_dec((int)now);
522 }
515 523
516#ifdef CONFIG_PPC64 524#ifdef CONFIG_PPC64
517 /* collect purr register values often, for accurate calculations */ 525 /* collect purr register values often, for accurate calculations */
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index 9eb5b9b536a7..b67db22e102d 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -706,6 +706,34 @@ static void __init vdso_setup_syscall_map(void)
706 } 706 }
707} 707}
708 708
709#ifdef CONFIG_PPC64
710int __cpuinit vdso_getcpu_init(void)
711{
712 unsigned long cpu, node, val;
713
714 /*
715 * SPRG3 contains the CPU in the bottom 16 bits and the NUMA node in
716 * the next 16 bits. The VDSO uses this to implement getcpu().
717 */
718 cpu = get_cpu();
719 WARN_ON_ONCE(cpu > 0xffff);
720
721 node = cpu_to_node(cpu);
722 WARN_ON_ONCE(node > 0xffff);
723
724 val = (cpu & 0xfff) | ((node & 0xffff) << 16);
725 mtspr(SPRN_SPRG3, val);
726#ifdef CONFIG_KVM_BOOK3S_HANDLER
727 get_paca()->kvm_hstate.sprg3 = val;
728#endif
729
730 put_cpu();
731
732 return 0;
733}
734/* We need to call this before SMP init */
735early_initcall(vdso_getcpu_init);
736#endif
709 737
710static int __init vdso_init(void) 738static int __init vdso_init(void)
711{ 739{
diff --git a/arch/powerpc/kernel/vdso32/Makefile b/arch/powerpc/kernel/vdso32/Makefile
index 9a7946c41738..53e6c9b979ec 100644
--- a/arch/powerpc/kernel/vdso32/Makefile
+++ b/arch/powerpc/kernel/vdso32/Makefile
@@ -1,7 +1,9 @@
1 1
2# List of files in the vdso, has to be asm only for now 2# List of files in the vdso, has to be asm only for now
3 3
4obj-vdso32 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o 4obj-vdso32-$(CONFIG_PPC64) = getcpu.o
5obj-vdso32 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o \
6 $(obj-vdso32-y)
5 7
6# Build rules 8# Build rules
7 9
diff --git a/arch/powerpc/kernel/vdso32/getcpu.S b/arch/powerpc/kernel/vdso32/getcpu.S
new file mode 100644
index 000000000000..47afd08c90f7
--- /dev/null
+++ b/arch/powerpc/kernel/vdso32/getcpu.S
@@ -0,0 +1,45 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 *
16 * Copyright (C) IBM Corporation, 2012
17 *
18 * Author: Anton Blanchard <anton@au.ibm.com>
19 */
20#include <asm/ppc_asm.h>
21#include <asm/vdso.h>
22
23 .text
24/*
25 * Exact prototype of getcpu
26 *
27 * int __kernel_getcpu(unsigned *cpu, unsigned *node);
28 *
29 */
30V_FUNCTION_BEGIN(__kernel_getcpu)
31 .cfi_startproc
32 mfspr r5,SPRN_USPRG3
33 cmpdi cr0,r3,0
34 cmpdi cr1,r4,0
35 clrlwi r6,r5,16
36 rlwinm r7,r5,16,31-15,31-0
37 beq cr0,1f
38 stw r6,0(r3)
391: beq cr1,2f
40 stw r7,0(r4)
412: crclr cr0*4+so
42 li r3,0 /* always success */
43 blr
44 .cfi_endproc
45V_FUNCTION_END(__kernel_getcpu)
diff --git a/arch/powerpc/kernel/vdso32/vdso32.lds.S b/arch/powerpc/kernel/vdso32/vdso32.lds.S
index 0546bcd49cd0..43200ba2e570 100644
--- a/arch/powerpc/kernel/vdso32/vdso32.lds.S
+++ b/arch/powerpc/kernel/vdso32/vdso32.lds.S
@@ -147,6 +147,9 @@ VERSION
147 __kernel_sync_dicache_p5; 147 __kernel_sync_dicache_p5;
148 __kernel_sigtramp32; 148 __kernel_sigtramp32;
149 __kernel_sigtramp_rt32; 149 __kernel_sigtramp_rt32;
150#ifdef CONFIG_PPC64
151 __kernel_getcpu;
152#endif
150 153
151 local: *; 154 local: *;
152 }; 155 };
diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile
index 8c500d8622e4..effca9404b17 100644
--- a/arch/powerpc/kernel/vdso64/Makefile
+++ b/arch/powerpc/kernel/vdso64/Makefile
@@ -1,6 +1,6 @@
1# List of files in the vdso, has to be asm only for now 1# List of files in the vdso, has to be asm only for now
2 2
3obj-vdso64 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o 3obj-vdso64 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o getcpu.o
4 4
5# Build rules 5# Build rules
6 6
diff --git a/arch/powerpc/kernel/vdso64/getcpu.S b/arch/powerpc/kernel/vdso64/getcpu.S
new file mode 100644
index 000000000000..47afd08c90f7
--- /dev/null
+++ b/arch/powerpc/kernel/vdso64/getcpu.S
@@ -0,0 +1,45 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 *
16 * Copyright (C) IBM Corporation, 2012
17 *
18 * Author: Anton Blanchard <anton@au.ibm.com>
19 */
20#include <asm/ppc_asm.h>
21#include <asm/vdso.h>
22
23 .text
24/*
25 * Exact prototype of getcpu
26 *
27 * int __kernel_getcpu(unsigned *cpu, unsigned *node);
28 *
29 */
30V_FUNCTION_BEGIN(__kernel_getcpu)
31 .cfi_startproc
32 mfspr r5,SPRN_USPRG3
33 cmpdi cr0,r3,0
34 cmpdi cr1,r4,0
35 clrlwi r6,r5,16
36 rlwinm r7,r5,16,31-15,31-0
37 beq cr0,1f
38 stw r6,0(r3)
391: beq cr1,2f
40 stw r7,0(r4)
412: crclr cr0*4+so
42 li r3,0 /* always success */
43 blr
44 .cfi_endproc
45V_FUNCTION_END(__kernel_getcpu)
diff --git a/arch/powerpc/kernel/vdso64/vdso64.lds.S b/arch/powerpc/kernel/vdso64/vdso64.lds.S
index 0e615404e247..e6c1758f3588 100644
--- a/arch/powerpc/kernel/vdso64/vdso64.lds.S
+++ b/arch/powerpc/kernel/vdso64/vdso64.lds.S
@@ -146,6 +146,7 @@ VERSION
146 __kernel_sync_dicache; 146 __kernel_sync_dicache;
147 __kernel_sync_dicache_p5; 147 __kernel_sync_dicache_p5;
148 __kernel_sigtramp_rt64; 148 __kernel_sigtramp_rt64;
149 __kernel_getcpu;
149 150
150 local: *; 151 local: *;
151 }; 152 };
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index cb87301ccd55..7a421e8fe7ca 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -37,8 +37,6 @@
37#include <asm/page.h> 37#include <asm/page.h>
38#include <asm/hvcall.h> 38#include <asm/hvcall.h>
39 39
40static struct bus_type vio_bus_type;
41
42static struct vio_dev vio_bus_device = { /* fake "parent" device */ 40static struct vio_dev vio_bus_device = { /* fake "parent" device */
43 .name = "vio", 41 .name = "vio",
44 .type = "", 42 .type = "",
@@ -625,7 +623,7 @@ struct dma_map_ops vio_dma_mapping_ops = {
625 * vio_cmo_set_dev_desired - Set desired entitlement for a device 623 * vio_cmo_set_dev_desired - Set desired entitlement for a device
626 * 624 *
627 * @viodev: struct vio_dev for device to alter 625 * @viodev: struct vio_dev for device to alter
628 * @new_desired: new desired entitlement level in bytes 626 * @desired: new desired entitlement level in bytes
629 * 627 *
630 * For use by devices to request a change to their entitlement at runtime or 628 * For use by devices to request a change to their entitlement at runtime or
631 * through sysfs. The desired entitlement level is changed and a balancing 629 * through sysfs. The desired entitlement level is changed and a balancing
@@ -1262,7 +1260,7 @@ static int vio_bus_remove(struct device *dev)
1262 1260
1263/** 1261/**
1264 * vio_register_driver: - Register a new vio driver 1262 * vio_register_driver: - Register a new vio driver
1265 * @drv: The vio_driver structure to be registered. 1263 * @viodrv: The vio_driver structure to be registered.
1266 */ 1264 */
1267int __vio_register_driver(struct vio_driver *viodrv, struct module *owner, 1265int __vio_register_driver(struct vio_driver *viodrv, struct module *owner,
1268 const char *mod_name) 1266 const char *mod_name)
@@ -1282,7 +1280,7 @@ EXPORT_SYMBOL(__vio_register_driver);
1282 1280
1283/** 1281/**
1284 * vio_unregister_driver - Remove registration of vio driver. 1282 * vio_unregister_driver - Remove registration of vio driver.
1285 * @driver: The vio_driver struct to be removed form registration 1283 * @viodrv: The vio_driver struct to be removed form registration
1286 */ 1284 */
1287void vio_unregister_driver(struct vio_driver *viodrv) 1285void vio_unregister_driver(struct vio_driver *viodrv)
1288{ 1286{
@@ -1397,21 +1395,27 @@ struct vio_dev *vio_register_device_node(struct device_node *of_node)
1397 viodev->name = of_node->name; 1395 viodev->name = of_node->name;
1398 viodev->dev.of_node = of_node_get(of_node); 1396 viodev->dev.of_node = of_node_get(of_node);
1399 1397
1400 if (firmware_has_feature(FW_FEATURE_CMO))
1401 vio_cmo_set_dma_ops(viodev);
1402 else
1403 set_dma_ops(&viodev->dev, &dma_iommu_ops);
1404 set_iommu_table_base(&viodev->dev, vio_build_iommu_table(viodev));
1405 set_dev_node(&viodev->dev, of_node_to_nid(of_node)); 1398 set_dev_node(&viodev->dev, of_node_to_nid(of_node));
1406 1399
1407 /* init generic 'struct device' fields: */ 1400 /* init generic 'struct device' fields: */
1408 viodev->dev.parent = &vio_bus_device.dev; 1401 viodev->dev.parent = &vio_bus_device.dev;
1409 viodev->dev.bus = &vio_bus_type; 1402 viodev->dev.bus = &vio_bus_type;
1410 viodev->dev.release = vio_dev_release; 1403 viodev->dev.release = vio_dev_release;
1411 /* needed to ensure proper operation of coherent allocations 1404
1412 * later, in case driver doesn't set it explicitly */ 1405 if (of_get_property(viodev->dev.of_node, "ibm,my-dma-window", NULL)) {
1413 dma_set_mask(&viodev->dev, DMA_BIT_MASK(64)); 1406 if (firmware_has_feature(FW_FEATURE_CMO))
1414 dma_set_coherent_mask(&viodev->dev, DMA_BIT_MASK(64)); 1407 vio_cmo_set_dma_ops(viodev);
1408 else
1409 set_dma_ops(&viodev->dev, &dma_iommu_ops);
1410
1411 set_iommu_table_base(&viodev->dev,
1412 vio_build_iommu_table(viodev));
1413
1414 /* needed to ensure proper operation of coherent allocations
1415 * later, in case driver doesn't set it explicitly */
1416 dma_set_mask(&viodev->dev, DMA_BIT_MASK(64));
1417 dma_set_coherent_mask(&viodev->dev, DMA_BIT_MASK(64));
1418 }
1415 1419
1416 /* register with generic device framework */ 1420 /* register with generic device framework */
1417 if (device_register(&viodev->dev)) { 1421 if (device_register(&viodev->dev)) {
@@ -1491,12 +1495,18 @@ static int __init vio_bus_init(void)
1491 if (firmware_has_feature(FW_FEATURE_CMO)) 1495 if (firmware_has_feature(FW_FEATURE_CMO))
1492 vio_cmo_bus_init(); 1496 vio_cmo_bus_init();
1493 1497
1498 return 0;
1499}
1500postcore_initcall(vio_bus_init);
1501
1502static int __init vio_device_init(void)
1503{
1494 vio_bus_scan_register_devices("vdevice"); 1504 vio_bus_scan_register_devices("vdevice");
1495 vio_bus_scan_register_devices("ibm,platform-facilities"); 1505 vio_bus_scan_register_devices("ibm,platform-facilities");
1496 1506
1497 return 0; 1507 return 0;
1498} 1508}
1499__initcall(vio_bus_init); 1509device_initcall(vio_device_init);
1500 1510
1501static ssize_t name_show(struct device *dev, 1511static ssize_t name_show(struct device *dev,
1502 struct device_attribute *attr, char *buf) 1512 struct device_attribute *attr, char *buf)
@@ -1568,7 +1578,7 @@ static int vio_hotplug(struct device *dev, struct kobj_uevent_env *env)
1568 return 0; 1578 return 0;
1569} 1579}
1570 1580
1571static struct bus_type vio_bus_type = { 1581struct bus_type vio_bus_type = {
1572 .name = "vio", 1582 .name = "vio",
1573 .dev_attrs = vio_dev_attrs, 1583 .dev_attrs = vio_dev_attrs,
1574 .uevent = vio_hotplug, 1584 .uevent = vio_hotplug,
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index d084e412b3c5..83e929e66f9d 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -268,24 +268,45 @@ static unsigned long do_h_register_vpa(struct kvm_vcpu *vcpu,
268 return err; 268 return err;
269} 269}
270 270
271static void kvmppc_update_vpa(struct kvm *kvm, struct kvmppc_vpa *vpap) 271static void kvmppc_update_vpa(struct kvm_vcpu *vcpu, struct kvmppc_vpa *vpap)
272{ 272{
273 struct kvm *kvm = vcpu->kvm;
273 void *va; 274 void *va;
274 unsigned long nb; 275 unsigned long nb;
276 unsigned long gpa;
275 277
276 vpap->update_pending = 0; 278 /*
277 va = NULL; 279 * We need to pin the page pointed to by vpap->next_gpa,
278 if (vpap->next_gpa) { 280 * but we can't call kvmppc_pin_guest_page under the lock
279 va = kvmppc_pin_guest_page(kvm, vpap->next_gpa, &nb); 281 * as it does get_user_pages() and down_read(). So we
280 if (nb < vpap->len) { 282 * have to drop the lock, pin the page, then get the lock
281 /* 283 * again and check that a new area didn't get registered
282 * If it's now too short, it must be that userspace 284 * in the meantime.
283 * has changed the mappings underlying guest memory, 285 */
284 * so unregister the region. 286 for (;;) {
285 */ 287 gpa = vpap->next_gpa;
288 spin_unlock(&vcpu->arch.vpa_update_lock);
289 va = NULL;
290 nb = 0;
291 if (gpa)
292 va = kvmppc_pin_guest_page(kvm, vpap->next_gpa, &nb);
293 spin_lock(&vcpu->arch.vpa_update_lock);
294 if (gpa == vpap->next_gpa)
295 break;
296 /* sigh... unpin that one and try again */
297 if (va)
286 kvmppc_unpin_guest_page(kvm, va); 298 kvmppc_unpin_guest_page(kvm, va);
287 va = NULL; 299 }
288 } 300
301 vpap->update_pending = 0;
302 if (va && nb < vpap->len) {
303 /*
304 * If it's now too short, it must be that userspace
305 * has changed the mappings underlying guest memory,
306 * so unregister the region.
307 */
308 kvmppc_unpin_guest_page(kvm, va);
309 va = NULL;
289 } 310 }
290 if (vpap->pinned_addr) 311 if (vpap->pinned_addr)
291 kvmppc_unpin_guest_page(kvm, vpap->pinned_addr); 312 kvmppc_unpin_guest_page(kvm, vpap->pinned_addr);
@@ -296,20 +317,18 @@ static void kvmppc_update_vpa(struct kvm *kvm, struct kvmppc_vpa *vpap)
296 317
297static void kvmppc_update_vpas(struct kvm_vcpu *vcpu) 318static void kvmppc_update_vpas(struct kvm_vcpu *vcpu)
298{ 319{
299 struct kvm *kvm = vcpu->kvm;
300
301 spin_lock(&vcpu->arch.vpa_update_lock); 320 spin_lock(&vcpu->arch.vpa_update_lock);
302 if (vcpu->arch.vpa.update_pending) { 321 if (vcpu->arch.vpa.update_pending) {
303 kvmppc_update_vpa(kvm, &vcpu->arch.vpa); 322 kvmppc_update_vpa(vcpu, &vcpu->arch.vpa);
304 init_vpa(vcpu, vcpu->arch.vpa.pinned_addr); 323 init_vpa(vcpu, vcpu->arch.vpa.pinned_addr);
305 } 324 }
306 if (vcpu->arch.dtl.update_pending) { 325 if (vcpu->arch.dtl.update_pending) {
307 kvmppc_update_vpa(kvm, &vcpu->arch.dtl); 326 kvmppc_update_vpa(vcpu, &vcpu->arch.dtl);
308 vcpu->arch.dtl_ptr = vcpu->arch.dtl.pinned_addr; 327 vcpu->arch.dtl_ptr = vcpu->arch.dtl.pinned_addr;
309 vcpu->arch.dtl_index = 0; 328 vcpu->arch.dtl_index = 0;
310 } 329 }
311 if (vcpu->arch.slb_shadow.update_pending) 330 if (vcpu->arch.slb_shadow.update_pending)
312 kvmppc_update_vpa(kvm, &vcpu->arch.slb_shadow); 331 kvmppc_update_vpa(vcpu, &vcpu->arch.slb_shadow);
313 spin_unlock(&vcpu->arch.vpa_update_lock); 332 spin_unlock(&vcpu->arch.vpa_update_lock);
314} 333}
315 334
@@ -800,12 +819,39 @@ static int kvmppc_run_core(struct kvmppc_vcore *vc)
800 struct kvm_vcpu *vcpu, *vcpu0, *vnext; 819 struct kvm_vcpu *vcpu, *vcpu0, *vnext;
801 long ret; 820 long ret;
802 u64 now; 821 u64 now;
803 int ptid, i; 822 int ptid, i, need_vpa_update;
804 823
805 /* don't start if any threads have a signal pending */ 824 /* don't start if any threads have a signal pending */
806 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) 825 need_vpa_update = 0;
826 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) {
807 if (signal_pending(vcpu->arch.run_task)) 827 if (signal_pending(vcpu->arch.run_task))
808 return 0; 828 return 0;
829 need_vpa_update |= vcpu->arch.vpa.update_pending |
830 vcpu->arch.slb_shadow.update_pending |
831 vcpu->arch.dtl.update_pending;
832 }
833
834 /*
835 * Initialize *vc, in particular vc->vcore_state, so we can
836 * drop the vcore lock if necessary.
837 */
838 vc->n_woken = 0;
839 vc->nap_count = 0;
840 vc->entry_exit_count = 0;
841 vc->vcore_state = VCORE_RUNNING;
842 vc->in_guest = 0;
843 vc->napping_threads = 0;
844
845 /*
846 * Updating any of the vpas requires calling kvmppc_pin_guest_page,
847 * which can't be called with any spinlocks held.
848 */
849 if (need_vpa_update) {
850 spin_unlock(&vc->lock);
851 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list)
852 kvmppc_update_vpas(vcpu);
853 spin_lock(&vc->lock);
854 }
809 855
810 /* 856 /*
811 * Make sure we are running on thread 0, and that 857 * Make sure we are running on thread 0, and that
@@ -838,20 +884,10 @@ static int kvmppc_run_core(struct kvmppc_vcore *vc)
838 if (vcpu->arch.ceded) 884 if (vcpu->arch.ceded)
839 vcpu->arch.ptid = ptid++; 885 vcpu->arch.ptid = ptid++;
840 886
841 vc->n_woken = 0;
842 vc->nap_count = 0;
843 vc->entry_exit_count = 0;
844 vc->vcore_state = VCORE_RUNNING;
845 vc->stolen_tb += mftb() - vc->preempt_tb; 887 vc->stolen_tb += mftb() - vc->preempt_tb;
846 vc->in_guest = 0;
847 vc->pcpu = smp_processor_id(); 888 vc->pcpu = smp_processor_id();
848 vc->napping_threads = 0;
849 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) { 889 list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) {
850 kvmppc_start_thread(vcpu); 890 kvmppc_start_thread(vcpu);
851 if (vcpu->arch.vpa.update_pending ||
852 vcpu->arch.slb_shadow.update_pending ||
853 vcpu->arch.dtl.update_pending)
854 kvmppc_update_vpas(vcpu);
855 kvmppc_create_dtl_entry(vcpu, vc); 891 kvmppc_create_dtl_entry(vcpu, vc);
856 } 892 }
857 /* Grab any remaining hw threads so they can't go into the kernel */ 893 /* Grab any remaining hw threads so they can't go into the kernel */
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index a84aafce2a12..5a84c8d3d040 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -72,9 +72,6 @@ _GLOBAL(kvmppc_hv_entry_trampoline)
72 mtsrr1 r6 72 mtsrr1 r6
73 RFI 73 RFI
74 74
75#define ULONG_SIZE 8
76#define VCPU_GPR(n) (VCPU_GPRS + (n * ULONG_SIZE))
77
78/****************************************************************************** 75/******************************************************************************
79 * * 76 * *
80 * Entry code * 77 * Entry code *
@@ -206,24 +203,24 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
206 /* Load up FP, VMX and VSX registers */ 203 /* Load up FP, VMX and VSX registers */
207 bl kvmppc_load_fp 204 bl kvmppc_load_fp
208 205
209 ld r14, VCPU_GPR(r14)(r4) 206 ld r14, VCPU_GPR(R14)(r4)
210 ld r15, VCPU_GPR(r15)(r4) 207 ld r15, VCPU_GPR(R15)(r4)
211 ld r16, VCPU_GPR(r16)(r4) 208 ld r16, VCPU_GPR(R16)(r4)
212 ld r17, VCPU_GPR(r17)(r4) 209 ld r17, VCPU_GPR(R17)(r4)
213 ld r18, VCPU_GPR(r18)(r4) 210 ld r18, VCPU_GPR(R18)(r4)
214 ld r19, VCPU_GPR(r19)(r4) 211 ld r19, VCPU_GPR(R19)(r4)
215 ld r20, VCPU_GPR(r20)(r4) 212 ld r20, VCPU_GPR(R20)(r4)
216 ld r21, VCPU_GPR(r21)(r4) 213 ld r21, VCPU_GPR(R21)(r4)
217 ld r22, VCPU_GPR(r22)(r4) 214 ld r22, VCPU_GPR(R22)(r4)
218 ld r23, VCPU_GPR(r23)(r4) 215 ld r23, VCPU_GPR(R23)(r4)
219 ld r24, VCPU_GPR(r24)(r4) 216 ld r24, VCPU_GPR(R24)(r4)
220 ld r25, VCPU_GPR(r25)(r4) 217 ld r25, VCPU_GPR(R25)(r4)
221 ld r26, VCPU_GPR(r26)(r4) 218 ld r26, VCPU_GPR(R26)(r4)
222 ld r27, VCPU_GPR(r27)(r4) 219 ld r27, VCPU_GPR(R27)(r4)
223 ld r28, VCPU_GPR(r28)(r4) 220 ld r28, VCPU_GPR(R28)(r4)
224 ld r29, VCPU_GPR(r29)(r4) 221 ld r29, VCPU_GPR(R29)(r4)
225 ld r30, VCPU_GPR(r30)(r4) 222 ld r30, VCPU_GPR(R30)(r4)
226 ld r31, VCPU_GPR(r31)(r4) 223 ld r31, VCPU_GPR(R31)(r4)
227 224
228BEGIN_FTR_SECTION 225BEGIN_FTR_SECTION
229 /* Switch DSCR to guest value */ 226 /* Switch DSCR to guest value */
@@ -547,21 +544,21 @@ fast_guest_return:
547 mtlr r5 544 mtlr r5
548 mtcr r6 545 mtcr r6
549 546
550 ld r0, VCPU_GPR(r0)(r4) 547 ld r0, VCPU_GPR(R0)(r4)
551 ld r1, VCPU_GPR(r1)(r4) 548 ld r1, VCPU_GPR(R1)(r4)
552 ld r2, VCPU_GPR(r2)(r4) 549 ld r2, VCPU_GPR(R2)(r4)
553 ld r3, VCPU_GPR(r3)(r4) 550 ld r3, VCPU_GPR(R3)(r4)
554 ld r5, VCPU_GPR(r5)(r4) 551 ld r5, VCPU_GPR(R5)(r4)
555 ld r6, VCPU_GPR(r6)(r4) 552 ld r6, VCPU_GPR(R6)(r4)
556 ld r7, VCPU_GPR(r7)(r4) 553 ld r7, VCPU_GPR(R7)(r4)
557 ld r8, VCPU_GPR(r8)(r4) 554 ld r8, VCPU_GPR(R8)(r4)
558 ld r9, VCPU_GPR(r9)(r4) 555 ld r9, VCPU_GPR(R9)(r4)
559 ld r10, VCPU_GPR(r10)(r4) 556 ld r10, VCPU_GPR(R10)(r4)
560 ld r11, VCPU_GPR(r11)(r4) 557 ld r11, VCPU_GPR(R11)(r4)
561 ld r12, VCPU_GPR(r12)(r4) 558 ld r12, VCPU_GPR(R12)(r4)
562 ld r13, VCPU_GPR(r13)(r4) 559 ld r13, VCPU_GPR(R13)(r4)
563 560
564 ld r4, VCPU_GPR(r4)(r4) 561 ld r4, VCPU_GPR(R4)(r4)
565 562
566 hrfid 563 hrfid
567 b . 564 b .
@@ -590,22 +587,22 @@ kvmppc_interrupt:
590 587
591 /* Save registers */ 588 /* Save registers */
592 589
593 std r0, VCPU_GPR(r0)(r9) 590 std r0, VCPU_GPR(R0)(r9)
594 std r1, VCPU_GPR(r1)(r9) 591 std r1, VCPU_GPR(R1)(r9)
595 std r2, VCPU_GPR(r2)(r9) 592 std r2, VCPU_GPR(R2)(r9)
596 std r3, VCPU_GPR(r3)(r9) 593 std r3, VCPU_GPR(R3)(r9)
597 std r4, VCPU_GPR(r4)(r9) 594 std r4, VCPU_GPR(R4)(r9)
598 std r5, VCPU_GPR(r5)(r9) 595 std r5, VCPU_GPR(R5)(r9)
599 std r6, VCPU_GPR(r6)(r9) 596 std r6, VCPU_GPR(R6)(r9)
600 std r7, VCPU_GPR(r7)(r9) 597 std r7, VCPU_GPR(R7)(r9)
601 std r8, VCPU_GPR(r8)(r9) 598 std r8, VCPU_GPR(R8)(r9)
602 ld r0, HSTATE_HOST_R2(r13) 599 ld r0, HSTATE_HOST_R2(r13)
603 std r0, VCPU_GPR(r9)(r9) 600 std r0, VCPU_GPR(R9)(r9)
604 std r10, VCPU_GPR(r10)(r9) 601 std r10, VCPU_GPR(R10)(r9)
605 std r11, VCPU_GPR(r11)(r9) 602 std r11, VCPU_GPR(R11)(r9)
606 ld r3, HSTATE_SCRATCH0(r13) 603 ld r3, HSTATE_SCRATCH0(r13)
607 lwz r4, HSTATE_SCRATCH1(r13) 604 lwz r4, HSTATE_SCRATCH1(r13)
608 std r3, VCPU_GPR(r12)(r9) 605 std r3, VCPU_GPR(R12)(r9)
609 stw r4, VCPU_CR(r9) 606 stw r4, VCPU_CR(r9)
610 607
611 /* Restore R1/R2 so we can handle faults */ 608 /* Restore R1/R2 so we can handle faults */
@@ -626,7 +623,7 @@ kvmppc_interrupt:
626 623
627 GET_SCRATCH0(r3) 624 GET_SCRATCH0(r3)
628 mflr r4 625 mflr r4
629 std r3, VCPU_GPR(r13)(r9) 626 std r3, VCPU_GPR(R13)(r9)
630 std r4, VCPU_LR(r9) 627 std r4, VCPU_LR(r9)
631 628
632 /* Unset guest mode */ 629 /* Unset guest mode */
@@ -810,7 +807,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_201)
810 lwz r3,VCORE_NAPPING_THREADS(r5) 807 lwz r3,VCORE_NAPPING_THREADS(r5)
811 lwz r4,VCPU_PTID(r9) 808 lwz r4,VCPU_PTID(r9)
812 li r0,1 809 li r0,1
813 sldi r0,r0,r4 810 sld r0,r0,r4
814 andc. r3,r3,r0 /* no sense IPI'ing ourselves */ 811 andc. r3,r3,r0 /* no sense IPI'ing ourselves */
815 beq 43f 812 beq 43f
816 mulli r4,r4,PACA_SIZE /* get paca for thread 0 */ 813 mulli r4,r4,PACA_SIZE /* get paca for thread 0 */
@@ -968,24 +965,24 @@ BEGIN_FTR_SECTION
968END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206) 965END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
969 966
970 /* Save non-volatile GPRs */ 967 /* Save non-volatile GPRs */
971 std r14, VCPU_GPR(r14)(r9) 968 std r14, VCPU_GPR(R14)(r9)
972 std r15, VCPU_GPR(r15)(r9) 969 std r15, VCPU_GPR(R15)(r9)
973 std r16, VCPU_GPR(r16)(r9) 970 std r16, VCPU_GPR(R16)(r9)
974 std r17, VCPU_GPR(r17)(r9) 971 std r17, VCPU_GPR(R17)(r9)
975 std r18, VCPU_GPR(r18)(r9) 972 std r18, VCPU_GPR(R18)(r9)
976 std r19, VCPU_GPR(r19)(r9) 973 std r19, VCPU_GPR(R19)(r9)
977 std r20, VCPU_GPR(r20)(r9) 974 std r20, VCPU_GPR(R20)(r9)
978 std r21, VCPU_GPR(r21)(r9) 975 std r21, VCPU_GPR(R21)(r9)
979 std r22, VCPU_GPR(r22)(r9) 976 std r22, VCPU_GPR(R22)(r9)
980 std r23, VCPU_GPR(r23)(r9) 977 std r23, VCPU_GPR(R23)(r9)
981 std r24, VCPU_GPR(r24)(r9) 978 std r24, VCPU_GPR(R24)(r9)
982 std r25, VCPU_GPR(r25)(r9) 979 std r25, VCPU_GPR(R25)(r9)
983 std r26, VCPU_GPR(r26)(r9) 980 std r26, VCPU_GPR(R26)(r9)
984 std r27, VCPU_GPR(r27)(r9) 981 std r27, VCPU_GPR(R27)(r9)
985 std r28, VCPU_GPR(r28)(r9) 982 std r28, VCPU_GPR(R28)(r9)
986 std r29, VCPU_GPR(r29)(r9) 983 std r29, VCPU_GPR(R29)(r9)
987 std r30, VCPU_GPR(r30)(r9) 984 std r30, VCPU_GPR(R30)(r9)
988 std r31, VCPU_GPR(r31)(r9) 985 std r31, VCPU_GPR(R31)(r9)
989 986
990 /* Save SPRGs */ 987 /* Save SPRGs */
991 mfspr r3, SPRN_SPRG0 988 mfspr r3, SPRN_SPRG0
@@ -1067,6 +1064,10 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
1067 mtspr SPRN_DABR,r5 1064 mtspr SPRN_DABR,r5
1068 mtspr SPRN_DABRX,r6 1065 mtspr SPRN_DABRX,r6
1069 1066
1067 /* Restore SPRG3 */
1068 ld r3,HSTATE_SPRG3(r13)
1069 mtspr SPRN_SPRG3,r3
1070
1070 /* 1071 /*
1071 * Reload DEC. HDEC interrupts were disabled when 1072 * Reload DEC. HDEC interrupts were disabled when
1072 * we reloaded the host's LPCR value. 1073 * we reloaded the host's LPCR value.
@@ -1160,7 +1161,7 @@ kvmppc_hdsi:
1160 andi. r0, r11, MSR_DR /* data relocation enabled? */ 1161 andi. r0, r11, MSR_DR /* data relocation enabled? */
1161 beq 3f 1162 beq 3f
1162 clrrdi r0, r4, 28 1163 clrrdi r0, r4, 28
1163 PPC_SLBFEE_DOT(r5, r0) /* if so, look up SLB */ 1164 PPC_SLBFEE_DOT(R5, R0) /* if so, look up SLB */
1164 bne 1f /* if no SLB entry found */ 1165 bne 1f /* if no SLB entry found */
11654: std r4, VCPU_FAULT_DAR(r9) 11664: std r4, VCPU_FAULT_DAR(r9)
1166 stw r6, VCPU_FAULT_DSISR(r9) 1167 stw r6, VCPU_FAULT_DSISR(r9)
@@ -1234,7 +1235,7 @@ kvmppc_hisi:
1234 andi. r0, r11, MSR_IR /* instruction relocation enabled? */ 1235 andi. r0, r11, MSR_IR /* instruction relocation enabled? */
1235 beq 3f 1236 beq 3f
1236 clrrdi r0, r10, 28 1237 clrrdi r0, r10, 28
1237 PPC_SLBFEE_DOT(r5, r0) /* if so, look up SLB */ 1238 PPC_SLBFEE_DOT(R5, R0) /* if so, look up SLB */
1238 bne 1f /* if no SLB entry found */ 1239 bne 1f /* if no SLB entry found */
12394: 12404:
1240 /* Search the hash table. */ 1241 /* Search the hash table. */
@@ -1278,7 +1279,7 @@ kvmppc_hisi:
1278 */ 1279 */
1279 .globl hcall_try_real_mode 1280 .globl hcall_try_real_mode
1280hcall_try_real_mode: 1281hcall_try_real_mode:
1281 ld r3,VCPU_GPR(r3)(r9) 1282 ld r3,VCPU_GPR(R3)(r9)
1282 andi. r0,r11,MSR_PR 1283 andi. r0,r11,MSR_PR
1283 bne hcall_real_cont 1284 bne hcall_real_cont
1284 clrrdi r3,r3,2 1285 clrrdi r3,r3,2
@@ -1291,12 +1292,12 @@ hcall_try_real_mode:
1291 add r3,r3,r4 1292 add r3,r3,r4
1292 mtctr r3 1293 mtctr r3
1293 mr r3,r9 /* get vcpu pointer */ 1294 mr r3,r9 /* get vcpu pointer */
1294 ld r4,VCPU_GPR(r4)(r9) 1295 ld r4,VCPU_GPR(R4)(r9)
1295 bctrl 1296 bctrl
1296 cmpdi r3,H_TOO_HARD 1297 cmpdi r3,H_TOO_HARD
1297 beq hcall_real_fallback 1298 beq hcall_real_fallback
1298 ld r4,HSTATE_KVM_VCPU(r13) 1299 ld r4,HSTATE_KVM_VCPU(r13)
1299 std r3,VCPU_GPR(r3)(r4) 1300 std r3,VCPU_GPR(R3)(r4)
1300 ld r10,VCPU_PC(r4) 1301 ld r10,VCPU_PC(r4)
1301 ld r11,VCPU_MSR(r4) 1302 ld r11,VCPU_MSR(r4)
1302 b fast_guest_return 1303 b fast_guest_return
@@ -1424,7 +1425,7 @@ _GLOBAL(kvmppc_h_cede)
1424 li r0,0 /* set trap to 0 to say hcall is handled */ 1425 li r0,0 /* set trap to 0 to say hcall is handled */
1425 stw r0,VCPU_TRAP(r3) 1426 stw r0,VCPU_TRAP(r3)
1426 li r0,H_SUCCESS 1427 li r0,H_SUCCESS
1427 std r0,VCPU_GPR(r3)(r3) 1428 std r0,VCPU_GPR(R3)(r3)
1428BEGIN_FTR_SECTION 1429BEGIN_FTR_SECTION
1429 b 2f /* just send it up to host on 970 */ 1430 b 2f /* just send it up to host on 970 */
1430END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206) 1431END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206)
@@ -1443,7 +1444,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206)
1443 addi r6,r5,VCORE_NAPPING_THREADS 1444 addi r6,r5,VCORE_NAPPING_THREADS
144431: lwarx r4,0,r6 144531: lwarx r4,0,r6
1445 or r4,r4,r0 1446 or r4,r4,r0
1446 PPC_POPCNTW(r7,r4) 1447 PPC_POPCNTW(R7,R4)
1447 cmpw r7,r8 1448 cmpw r7,r8
1448 bge 2f 1449 bge 2f
1449 stwcx. r4,0,r6 1450 stwcx. r4,0,r6
@@ -1464,24 +1465,24 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_206)
1464 * DAR, DSISR, DABR, DABRX, DSCR, PMCx, MMCRx, SIAR, SDAR. 1465 * DAR, DSISR, DABR, DABRX, DSCR, PMCx, MMCRx, SIAR, SDAR.
1465 */ 1466 */
1466 /* Save non-volatile GPRs */ 1467 /* Save non-volatile GPRs */
1467 std r14, VCPU_GPR(r14)(r3) 1468 std r14, VCPU_GPR(R14)(r3)
1468 std r15, VCPU_GPR(r15)(r3) 1469 std r15, VCPU_GPR(R15)(r3)
1469 std r16, VCPU_GPR(r16)(r3) 1470 std r16, VCPU_GPR(R16)(r3)
1470 std r17, VCPU_GPR(r17)(r3) 1471 std r17, VCPU_GPR(R17)(r3)
1471 std r18, VCPU_GPR(r18)(r3) 1472 std r18, VCPU_GPR(R18)(r3)
1472 std r19, VCPU_GPR(r19)(r3) 1473 std r19, VCPU_GPR(R19)(r3)
1473 std r20, VCPU_GPR(r20)(r3) 1474 std r20, VCPU_GPR(R20)(r3)
1474 std r21, VCPU_GPR(r21)(r3) 1475 std r21, VCPU_GPR(R21)(r3)
1475 std r22, VCPU_GPR(r22)(r3) 1476 std r22, VCPU_GPR(R22)(r3)
1476 std r23, VCPU_GPR(r23)(r3) 1477 std r23, VCPU_GPR(R23)(r3)
1477 std r24, VCPU_GPR(r24)(r3) 1478 std r24, VCPU_GPR(R24)(r3)
1478 std r25, VCPU_GPR(r25)(r3) 1479 std r25, VCPU_GPR(R25)(r3)
1479 std r26, VCPU_GPR(r26)(r3) 1480 std r26, VCPU_GPR(R26)(r3)
1480 std r27, VCPU_GPR(r27)(r3) 1481 std r27, VCPU_GPR(R27)(r3)
1481 std r28, VCPU_GPR(r28)(r3) 1482 std r28, VCPU_GPR(R28)(r3)
1482 std r29, VCPU_GPR(r29)(r3) 1483 std r29, VCPU_GPR(R29)(r3)
1483 std r30, VCPU_GPR(r30)(r3) 1484 std r30, VCPU_GPR(R30)(r3)
1484 std r31, VCPU_GPR(r31)(r3) 1485 std r31, VCPU_GPR(R31)(r3)
1485 1486
1486 /* save FP state */ 1487 /* save FP state */
1487 bl .kvmppc_save_fp 1488 bl .kvmppc_save_fp
@@ -1513,24 +1514,24 @@ kvm_end_cede:
1513 bl kvmppc_load_fp 1514 bl kvmppc_load_fp
1514 1515
1515 /* Load NV GPRS */ 1516 /* Load NV GPRS */
1516 ld r14, VCPU_GPR(r14)(r4) 1517 ld r14, VCPU_GPR(R14)(r4)
1517 ld r15, VCPU_GPR(r15)(r4) 1518 ld r15, VCPU_GPR(R15)(r4)
1518 ld r16, VCPU_GPR(r16)(r4) 1519 ld r16, VCPU_GPR(R16)(r4)
1519 ld r17, VCPU_GPR(r17)(r4) 1520 ld r17, VCPU_GPR(R17)(r4)
1520 ld r18, VCPU_GPR(r18)(r4) 1521 ld r18, VCPU_GPR(R18)(r4)
1521 ld r19, VCPU_GPR(r19)(r4) 1522 ld r19, VCPU_GPR(R19)(r4)
1522 ld r20, VCPU_GPR(r20)(r4) 1523 ld r20, VCPU_GPR(R20)(r4)
1523 ld r21, VCPU_GPR(r21)(r4) 1524 ld r21, VCPU_GPR(R21)(r4)
1524 ld r22, VCPU_GPR(r22)(r4) 1525 ld r22, VCPU_GPR(R22)(r4)
1525 ld r23, VCPU_GPR(r23)(r4) 1526 ld r23, VCPU_GPR(R23)(r4)
1526 ld r24, VCPU_GPR(r24)(r4) 1527 ld r24, VCPU_GPR(R24)(r4)
1527 ld r25, VCPU_GPR(r25)(r4) 1528 ld r25, VCPU_GPR(R25)(r4)
1528 ld r26, VCPU_GPR(r26)(r4) 1529 ld r26, VCPU_GPR(R26)(r4)
1529 ld r27, VCPU_GPR(r27)(r4) 1530 ld r27, VCPU_GPR(R27)(r4)
1530 ld r28, VCPU_GPR(r28)(r4) 1531 ld r28, VCPU_GPR(R28)(r4)
1531 ld r29, VCPU_GPR(r29)(r4) 1532 ld r29, VCPU_GPR(R29)(r4)
1532 ld r30, VCPU_GPR(r30)(r4) 1533 ld r30, VCPU_GPR(R30)(r4)
1533 ld r31, VCPU_GPR(r31)(r4) 1534 ld r31, VCPU_GPR(R31)(r4)
1534 1535
1535 /* clear our bit in vcore->napping_threads */ 1536 /* clear our bit in vcore->napping_threads */
153633: ld r5,HSTATE_KVM_VCORE(r13) 153733: ld r5,HSTATE_KVM_VCORE(r13)
@@ -1649,7 +1650,7 @@ BEGIN_FTR_SECTION
1649 reg = 0 1650 reg = 0
1650 .rept 32 1651 .rept 32
1651 li r6,reg*16+VCPU_VSRS 1652 li r6,reg*16+VCPU_VSRS
1652 STXVD2X(reg,r6,r3) 1653 STXVD2X(reg,R6,R3)
1653 reg = reg + 1 1654 reg = reg + 1
1654 .endr 1655 .endr
1655FTR_SECTION_ELSE 1656FTR_SECTION_ELSE
@@ -1711,7 +1712,7 @@ BEGIN_FTR_SECTION
1711 reg = 0 1712 reg = 0
1712 .rept 32 1713 .rept 32
1713 li r7,reg*16+VCPU_VSRS 1714 li r7,reg*16+VCPU_VSRS
1714 LXVD2X(reg,r7,r4) 1715 LXVD2X(reg,R7,R4)
1715 reg = reg + 1 1716 reg = reg + 1
1716 .endr 1717 .endr
1717FTR_SECTION_ELSE 1718FTR_SECTION_ELSE
diff --git a/arch/powerpc/kvm/book3s_interrupts.S b/arch/powerpc/kvm/book3s_interrupts.S
index 3e35383bdb21..48cbbf862958 100644
--- a/arch/powerpc/kvm/book3s_interrupts.S
+++ b/arch/powerpc/kvm/book3s_interrupts.S
@@ -25,38 +25,30 @@
25#include <asm/exception-64s.h> 25#include <asm/exception-64s.h>
26 26
27#if defined(CONFIG_PPC_BOOK3S_64) 27#if defined(CONFIG_PPC_BOOK3S_64)
28
29#define ULONG_SIZE 8
30#define FUNC(name) GLUE(.,name) 28#define FUNC(name) GLUE(.,name)
31
32#elif defined(CONFIG_PPC_BOOK3S_32) 29#elif defined(CONFIG_PPC_BOOK3S_32)
33
34#define ULONG_SIZE 4
35#define FUNC(name) name 30#define FUNC(name) name
36
37#endif /* CONFIG_PPC_BOOK3S_XX */ 31#endif /* CONFIG_PPC_BOOK3S_XX */
38 32
39
40#define VCPU_GPR(n) (VCPU_GPRS + (n * ULONG_SIZE))
41#define VCPU_LOAD_NVGPRS(vcpu) \ 33#define VCPU_LOAD_NVGPRS(vcpu) \
42 PPC_LL r14, VCPU_GPR(r14)(vcpu); \ 34 PPC_LL r14, VCPU_GPR(R14)(vcpu); \
43 PPC_LL r15, VCPU_GPR(r15)(vcpu); \ 35 PPC_LL r15, VCPU_GPR(R15)(vcpu); \
44 PPC_LL r16, VCPU_GPR(r16)(vcpu); \ 36 PPC_LL r16, VCPU_GPR(R16)(vcpu); \
45 PPC_LL r17, VCPU_GPR(r17)(vcpu); \ 37 PPC_LL r17, VCPU_GPR(R17)(vcpu); \
46 PPC_LL r18, VCPU_GPR(r18)(vcpu); \ 38 PPC_LL r18, VCPU_GPR(R18)(vcpu); \
47 PPC_LL r19, VCPU_GPR(r19)(vcpu); \ 39 PPC_LL r19, VCPU_GPR(R19)(vcpu); \
48 PPC_LL r20, VCPU_GPR(r20)(vcpu); \ 40 PPC_LL r20, VCPU_GPR(R20)(vcpu); \
49 PPC_LL r21, VCPU_GPR(r21)(vcpu); \ 41 PPC_LL r21, VCPU_GPR(R21)(vcpu); \
50 PPC_LL r22, VCPU_GPR(r22)(vcpu); \ 42 PPC_LL r22, VCPU_GPR(R22)(vcpu); \
51 PPC_LL r23, VCPU_GPR(r23)(vcpu); \ 43 PPC_LL r23, VCPU_GPR(R23)(vcpu); \
52 PPC_LL r24, VCPU_GPR(r24)(vcpu); \ 44 PPC_LL r24, VCPU_GPR(R24)(vcpu); \
53 PPC_LL r25, VCPU_GPR(r25)(vcpu); \ 45 PPC_LL r25, VCPU_GPR(R25)(vcpu); \
54 PPC_LL r26, VCPU_GPR(r26)(vcpu); \ 46 PPC_LL r26, VCPU_GPR(R26)(vcpu); \
55 PPC_LL r27, VCPU_GPR(r27)(vcpu); \ 47 PPC_LL r27, VCPU_GPR(R27)(vcpu); \
56 PPC_LL r28, VCPU_GPR(r28)(vcpu); \ 48 PPC_LL r28, VCPU_GPR(R28)(vcpu); \
57 PPC_LL r29, VCPU_GPR(r29)(vcpu); \ 49 PPC_LL r29, VCPU_GPR(R29)(vcpu); \
58 PPC_LL r30, VCPU_GPR(r30)(vcpu); \ 50 PPC_LL r30, VCPU_GPR(R30)(vcpu); \
59 PPC_LL r31, VCPU_GPR(r31)(vcpu); \ 51 PPC_LL r31, VCPU_GPR(R31)(vcpu); \
60 52
61/***************************************************************************** 53/*****************************************************************************
62 * * 54 * *
@@ -131,24 +123,24 @@ kvmppc_handler_highmem:
131 /* R7 = vcpu */ 123 /* R7 = vcpu */
132 PPC_LL r7, GPR4(r1) 124 PPC_LL r7, GPR4(r1)
133 125
134 PPC_STL r14, VCPU_GPR(r14)(r7) 126 PPC_STL r14, VCPU_GPR(R14)(r7)
135 PPC_STL r15, VCPU_GPR(r15)(r7) 127 PPC_STL r15, VCPU_GPR(R15)(r7)
136 PPC_STL r16, VCPU_GPR(r16)(r7) 128 PPC_STL r16, VCPU_GPR(R16)(r7)
137 PPC_STL r17, VCPU_GPR(r17)(r7) 129 PPC_STL r17, VCPU_GPR(R17)(r7)
138 PPC_STL r18, VCPU_GPR(r18)(r7) 130 PPC_STL r18, VCPU_GPR(R18)(r7)
139 PPC_STL r19, VCPU_GPR(r19)(r7) 131 PPC_STL r19, VCPU_GPR(R19)(r7)
140 PPC_STL r20, VCPU_GPR(r20)(r7) 132 PPC_STL r20, VCPU_GPR(R20)(r7)
141 PPC_STL r21, VCPU_GPR(r21)(r7) 133 PPC_STL r21, VCPU_GPR(R21)(r7)
142 PPC_STL r22, VCPU_GPR(r22)(r7) 134 PPC_STL r22, VCPU_GPR(R22)(r7)
143 PPC_STL r23, VCPU_GPR(r23)(r7) 135 PPC_STL r23, VCPU_GPR(R23)(r7)
144 PPC_STL r24, VCPU_GPR(r24)(r7) 136 PPC_STL r24, VCPU_GPR(R24)(r7)
145 PPC_STL r25, VCPU_GPR(r25)(r7) 137 PPC_STL r25, VCPU_GPR(R25)(r7)
146 PPC_STL r26, VCPU_GPR(r26)(r7) 138 PPC_STL r26, VCPU_GPR(R26)(r7)
147 PPC_STL r27, VCPU_GPR(r27)(r7) 139 PPC_STL r27, VCPU_GPR(R27)(r7)
148 PPC_STL r28, VCPU_GPR(r28)(r7) 140 PPC_STL r28, VCPU_GPR(R28)(r7)
149 PPC_STL r29, VCPU_GPR(r29)(r7) 141 PPC_STL r29, VCPU_GPR(R29)(r7)
150 PPC_STL r30, VCPU_GPR(r30)(r7) 142 PPC_STL r30, VCPU_GPR(R30)(r7)
151 PPC_STL r31, VCPU_GPR(r31)(r7) 143 PPC_STL r31, VCPU_GPR(R31)(r7)
152 144
153 /* Pass the exit number as 3rd argument to kvmppc_handle_exit */ 145 /* Pass the exit number as 3rd argument to kvmppc_handle_exit */
154 mr r5, r12 146 mr r5, r12
diff --git a/arch/powerpc/kvm/book3s_pr_papr.c b/arch/powerpc/kvm/book3s_pr_papr.c
index 3ff9013d6e79..ee02b30878ed 100644
--- a/arch/powerpc/kvm/book3s_pr_papr.c
+++ b/arch/powerpc/kvm/book3s_pr_papr.c
@@ -241,6 +241,7 @@ int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd)
241 case H_PUT_TCE: 241 case H_PUT_TCE:
242 return kvmppc_h_pr_put_tce(vcpu); 242 return kvmppc_h_pr_put_tce(vcpu);
243 case H_CEDE: 243 case H_CEDE:
244 vcpu->arch.shared->msr |= MSR_EE;
244 kvm_vcpu_block(vcpu); 245 kvm_vcpu_block(vcpu);
245 clear_bit(KVM_REQ_UNHALT, &vcpu->requests); 246 clear_bit(KVM_REQ_UNHALT, &vcpu->requests);
246 vcpu->stat.halt_wakeup++; 247 vcpu->stat.halt_wakeup++;
diff --git a/arch/powerpc/kvm/book3s_rmhandlers.S b/arch/powerpc/kvm/book3s_rmhandlers.S
index 34187585c507..ab523f3c1731 100644
--- a/arch/powerpc/kvm/book3s_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_rmhandlers.S
@@ -37,7 +37,6 @@
37#if defined(CONFIG_PPC_BOOK3S_64) 37#if defined(CONFIG_PPC_BOOK3S_64)
38 38
39#define FUNC(name) GLUE(.,name) 39#define FUNC(name) GLUE(.,name)
40#define MTMSR_EERI(reg) mtmsrd (reg),1
41 40
42 .globl kvmppc_skip_interrupt 41 .globl kvmppc_skip_interrupt
43kvmppc_skip_interrupt: 42kvmppc_skip_interrupt:
diff --git a/arch/powerpc/kvm/book3s_segment.S b/arch/powerpc/kvm/book3s_segment.S
index 798491a268b3..1abe4788191a 100644
--- a/arch/powerpc/kvm/book3s_segment.S
+++ b/arch/powerpc/kvm/book3s_segment.S
@@ -23,7 +23,6 @@
23 23
24#define GET_SHADOW_VCPU(reg) \ 24#define GET_SHADOW_VCPU(reg) \
25 mr reg, r13 25 mr reg, r13
26#define MTMSR_EERI(reg) mtmsrd (reg),1
27 26
28#elif defined(CONFIG_PPC_BOOK3S_32) 27#elif defined(CONFIG_PPC_BOOK3S_32)
29 28
@@ -31,7 +30,6 @@
31 tophys(reg, r2); \ 30 tophys(reg, r2); \
32 lwz reg, (THREAD + THREAD_KVM_SVCPU)(reg); \ 31 lwz reg, (THREAD + THREAD_KVM_SVCPU)(reg); \
33 tophys(reg, reg) 32 tophys(reg, reg)
34#define MTMSR_EERI(reg) mtmsr (reg)
35 33
36#endif 34#endif
37 35
diff --git a/arch/powerpc/kvm/booke_interrupts.S b/arch/powerpc/kvm/booke_interrupts.S
index 09456c4719f3..bb46b32f9813 100644
--- a/arch/powerpc/kvm/booke_interrupts.S
+++ b/arch/powerpc/kvm/booke_interrupts.S
@@ -25,8 +25,6 @@
25#include <asm/page.h> 25#include <asm/page.h>
26#include <asm/asm-offsets.h> 26#include <asm/asm-offsets.h>
27 27
28#define VCPU_GPR(n) (VCPU_GPRS + (n * 4))
29
30/* The host stack layout: */ 28/* The host stack layout: */
31#define HOST_R1 0 /* Implied by stwu. */ 29#define HOST_R1 0 /* Implied by stwu. */
32#define HOST_CALLEE_LR 4 30#define HOST_CALLEE_LR 4
@@ -36,8 +34,9 @@
36#define HOST_R2 12 34#define HOST_R2 12
37#define HOST_CR 16 35#define HOST_CR 16
38#define HOST_NV_GPRS 20 36#define HOST_NV_GPRS 20
39#define HOST_NV_GPR(n) (HOST_NV_GPRS + ((n - 14) * 4)) 37#define __HOST_NV_GPR(n) (HOST_NV_GPRS + ((n - 14) * 4))
40#define HOST_MIN_STACK_SIZE (HOST_NV_GPR(31) + 4) 38#define HOST_NV_GPR(n) __HOST_NV_GPR(__REG_##n)
39#define HOST_MIN_STACK_SIZE (HOST_NV_GPR(R31) + 4)
41#define HOST_STACK_SIZE (((HOST_MIN_STACK_SIZE + 15) / 16) * 16) /* Align. */ 40#define HOST_STACK_SIZE (((HOST_MIN_STACK_SIZE + 15) / 16) * 16) /* Align. */
42#define HOST_STACK_LR (HOST_STACK_SIZE + 4) /* In caller stack frame. */ 41#define HOST_STACK_LR (HOST_STACK_SIZE + 4) /* In caller stack frame. */
43 42
@@ -58,12 +57,12 @@ _GLOBAL(kvmppc_handler_\ivor_nr)
58 /* Get pointer to vcpu and record exit number. */ 57 /* Get pointer to vcpu and record exit number. */
59 mtspr \scratch , r4 58 mtspr \scratch , r4
60 mfspr r4, SPRN_SPRG_RVCPU 59 mfspr r4, SPRN_SPRG_RVCPU
61 stw r3, VCPU_GPR(r3)(r4) 60 stw r3, VCPU_GPR(R3)(r4)
62 stw r5, VCPU_GPR(r5)(r4) 61 stw r5, VCPU_GPR(R5)(r4)
63 stw r6, VCPU_GPR(r6)(r4) 62 stw r6, VCPU_GPR(R6)(r4)
64 mfspr r3, \scratch 63 mfspr r3, \scratch
65 mfctr r5 64 mfctr r5
66 stw r3, VCPU_GPR(r4)(r4) 65 stw r3, VCPU_GPR(R4)(r4)
67 stw r5, VCPU_CTR(r4) 66 stw r5, VCPU_CTR(r4)
68 mfspr r3, \srr0 67 mfspr r3, \srr0
69 lis r6, kvmppc_resume_host@h 68 lis r6, kvmppc_resume_host@h
@@ -106,9 +105,9 @@ _GLOBAL(kvmppc_handler_len)
106_GLOBAL(kvmppc_resume_host) 105_GLOBAL(kvmppc_resume_host)
107 mfcr r3 106 mfcr r3
108 stw r3, VCPU_CR(r4) 107 stw r3, VCPU_CR(r4)
109 stw r7, VCPU_GPR(r7)(r4) 108 stw r7, VCPU_GPR(R7)(r4)
110 stw r8, VCPU_GPR(r8)(r4) 109 stw r8, VCPU_GPR(R8)(r4)
111 stw r9, VCPU_GPR(r9)(r4) 110 stw r9, VCPU_GPR(R9)(r4)
112 111
113 li r6, 1 112 li r6, 1
114 slw r6, r6, r5 113 slw r6, r6, r5
@@ -138,23 +137,23 @@ _GLOBAL(kvmppc_resume_host)
138 isync 137 isync
139 stw r9, VCPU_LAST_INST(r4) 138 stw r9, VCPU_LAST_INST(r4)
140 139
141 stw r15, VCPU_GPR(r15)(r4) 140 stw r15, VCPU_GPR(R15)(r4)
142 stw r16, VCPU_GPR(r16)(r4) 141 stw r16, VCPU_GPR(R16)(r4)
143 stw r17, VCPU_GPR(r17)(r4) 142 stw r17, VCPU_GPR(R17)(r4)
144 stw r18, VCPU_GPR(r18)(r4) 143 stw r18, VCPU_GPR(R18)(r4)
145 stw r19, VCPU_GPR(r19)(r4) 144 stw r19, VCPU_GPR(R19)(r4)
146 stw r20, VCPU_GPR(r20)(r4) 145 stw r20, VCPU_GPR(R20)(r4)
147 stw r21, VCPU_GPR(r21)(r4) 146 stw r21, VCPU_GPR(R21)(r4)
148 stw r22, VCPU_GPR(r22)(r4) 147 stw r22, VCPU_GPR(R22)(r4)
149 stw r23, VCPU_GPR(r23)(r4) 148 stw r23, VCPU_GPR(R23)(r4)
150 stw r24, VCPU_GPR(r24)(r4) 149 stw r24, VCPU_GPR(R24)(r4)
151 stw r25, VCPU_GPR(r25)(r4) 150 stw r25, VCPU_GPR(R25)(r4)
152 stw r26, VCPU_GPR(r26)(r4) 151 stw r26, VCPU_GPR(R26)(r4)
153 stw r27, VCPU_GPR(r27)(r4) 152 stw r27, VCPU_GPR(R27)(r4)
154 stw r28, VCPU_GPR(r28)(r4) 153 stw r28, VCPU_GPR(R28)(r4)
155 stw r29, VCPU_GPR(r29)(r4) 154 stw r29, VCPU_GPR(R29)(r4)
156 stw r30, VCPU_GPR(r30)(r4) 155 stw r30, VCPU_GPR(R30)(r4)
157 stw r31, VCPU_GPR(r31)(r4) 156 stw r31, VCPU_GPR(R31)(r4)
158..skip_inst_copy: 157..skip_inst_copy:
159 158
160 /* Also grab DEAR and ESR before the host can clobber them. */ 159 /* Also grab DEAR and ESR before the host can clobber them. */
@@ -172,14 +171,14 @@ _GLOBAL(kvmppc_resume_host)
172..skip_esr: 171..skip_esr:
173 172
174 /* Save remaining volatile guest register state to vcpu. */ 173 /* Save remaining volatile guest register state to vcpu. */
175 stw r0, VCPU_GPR(r0)(r4) 174 stw r0, VCPU_GPR(R0)(r4)
176 stw r1, VCPU_GPR(r1)(r4) 175 stw r1, VCPU_GPR(R1)(r4)
177 stw r2, VCPU_GPR(r2)(r4) 176 stw r2, VCPU_GPR(R2)(r4)
178 stw r10, VCPU_GPR(r10)(r4) 177 stw r10, VCPU_GPR(R10)(r4)
179 stw r11, VCPU_GPR(r11)(r4) 178 stw r11, VCPU_GPR(R11)(r4)
180 stw r12, VCPU_GPR(r12)(r4) 179 stw r12, VCPU_GPR(R12)(r4)
181 stw r13, VCPU_GPR(r13)(r4) 180 stw r13, VCPU_GPR(R13)(r4)
182 stw r14, VCPU_GPR(r14)(r4) /* We need a NV GPR below. */ 181 stw r14, VCPU_GPR(R14)(r4) /* We need a NV GPR below. */
183 mflr r3 182 mflr r3
184 stw r3, VCPU_LR(r4) 183 stw r3, VCPU_LR(r4)
185 mfxer r3 184 mfxer r3
@@ -213,28 +212,28 @@ _GLOBAL(kvmppc_resume_host)
213 212
214 /* Restore vcpu pointer and the nonvolatiles we used. */ 213 /* Restore vcpu pointer and the nonvolatiles we used. */
215 mr r4, r14 214 mr r4, r14
216 lwz r14, VCPU_GPR(r14)(r4) 215 lwz r14, VCPU_GPR(R14)(r4)
217 216
218 /* Sometimes instruction emulation must restore complete GPR state. */ 217 /* Sometimes instruction emulation must restore complete GPR state. */
219 andi. r5, r3, RESUME_FLAG_NV 218 andi. r5, r3, RESUME_FLAG_NV
220 beq ..skip_nv_load 219 beq ..skip_nv_load
221 lwz r15, VCPU_GPR(r15)(r4) 220 lwz r15, VCPU_GPR(R15)(r4)
222 lwz r16, VCPU_GPR(r16)(r4) 221 lwz r16, VCPU_GPR(R16)(r4)
223 lwz r17, VCPU_GPR(r17)(r4) 222 lwz r17, VCPU_GPR(R17)(r4)
224 lwz r18, VCPU_GPR(r18)(r4) 223 lwz r18, VCPU_GPR(R18)(r4)
225 lwz r19, VCPU_GPR(r19)(r4) 224 lwz r19, VCPU_GPR(R19)(r4)
226 lwz r20, VCPU_GPR(r20)(r4) 225 lwz r20, VCPU_GPR(R20)(r4)
227 lwz r21, VCPU_GPR(r21)(r4) 226 lwz r21, VCPU_GPR(R21)(r4)
228 lwz r22, VCPU_GPR(r22)(r4) 227 lwz r22, VCPU_GPR(R22)(r4)
229 lwz r23, VCPU_GPR(r23)(r4) 228 lwz r23, VCPU_GPR(R23)(r4)
230 lwz r24, VCPU_GPR(r24)(r4) 229 lwz r24, VCPU_GPR(R24)(r4)
231 lwz r25, VCPU_GPR(r25)(r4) 230 lwz r25, VCPU_GPR(R25)(r4)
232 lwz r26, VCPU_GPR(r26)(r4) 231 lwz r26, VCPU_GPR(R26)(r4)
233 lwz r27, VCPU_GPR(r27)(r4) 232 lwz r27, VCPU_GPR(R27)(r4)
234 lwz r28, VCPU_GPR(r28)(r4) 233 lwz r28, VCPU_GPR(R28)(r4)
235 lwz r29, VCPU_GPR(r29)(r4) 234 lwz r29, VCPU_GPR(R29)(r4)
236 lwz r30, VCPU_GPR(r30)(r4) 235 lwz r30, VCPU_GPR(R30)(r4)
237 lwz r31, VCPU_GPR(r31)(r4) 236 lwz r31, VCPU_GPR(R31)(r4)
238..skip_nv_load: 237..skip_nv_load:
239 238
240 /* Should we return to the guest? */ 239 /* Should we return to the guest? */
@@ -256,43 +255,43 @@ heavyweight_exit:
256 255
257 /* We already saved guest volatile register state; now save the 256 /* We already saved guest volatile register state; now save the
258 * non-volatiles. */ 257 * non-volatiles. */
259 stw r15, VCPU_GPR(r15)(r4) 258 stw r15, VCPU_GPR(R15)(r4)
260 stw r16, VCPU_GPR(r16)(r4) 259 stw r16, VCPU_GPR(R16)(r4)
261 stw r17, VCPU_GPR(r17)(r4) 260 stw r17, VCPU_GPR(R17)(r4)
262 stw r18, VCPU_GPR(r18)(r4) 261 stw r18, VCPU_GPR(R18)(r4)
263 stw r19, VCPU_GPR(r19)(r4) 262 stw r19, VCPU_GPR(R19)(r4)
264 stw r20, VCPU_GPR(r20)(r4) 263 stw r20, VCPU_GPR(R20)(r4)
265 stw r21, VCPU_GPR(r21)(r4) 264 stw r21, VCPU_GPR(R21)(r4)
266 stw r22, VCPU_GPR(r22)(r4) 265 stw r22, VCPU_GPR(R22)(r4)
267 stw r23, VCPU_GPR(r23)(r4) 266 stw r23, VCPU_GPR(R23)(r4)
268 stw r24, VCPU_GPR(r24)(r4) 267 stw r24, VCPU_GPR(R24)(r4)
269 stw r25, VCPU_GPR(r25)(r4) 268 stw r25, VCPU_GPR(R25)(r4)
270 stw r26, VCPU_GPR(r26)(r4) 269 stw r26, VCPU_GPR(R26)(r4)
271 stw r27, VCPU_GPR(r27)(r4) 270 stw r27, VCPU_GPR(R27)(r4)
272 stw r28, VCPU_GPR(r28)(r4) 271 stw r28, VCPU_GPR(R28)(r4)
273 stw r29, VCPU_GPR(r29)(r4) 272 stw r29, VCPU_GPR(R29)(r4)
274 stw r30, VCPU_GPR(r30)(r4) 273 stw r30, VCPU_GPR(R30)(r4)
275 stw r31, VCPU_GPR(r31)(r4) 274 stw r31, VCPU_GPR(R31)(r4)
276 275
277 /* Load host non-volatile register state from host stack. */ 276 /* Load host non-volatile register state from host stack. */
278 lwz r14, HOST_NV_GPR(r14)(r1) 277 lwz r14, HOST_NV_GPR(R14)(r1)
279 lwz r15, HOST_NV_GPR(r15)(r1) 278 lwz r15, HOST_NV_GPR(R15)(r1)
280 lwz r16, HOST_NV_GPR(r16)(r1) 279 lwz r16, HOST_NV_GPR(R16)(r1)
281 lwz r17, HOST_NV_GPR(r17)(r1) 280 lwz r17, HOST_NV_GPR(R17)(r1)
282 lwz r18, HOST_NV_GPR(r18)(r1) 281 lwz r18, HOST_NV_GPR(R18)(r1)
283 lwz r19, HOST_NV_GPR(r19)(r1) 282 lwz r19, HOST_NV_GPR(R19)(r1)
284 lwz r20, HOST_NV_GPR(r20)(r1) 283 lwz r20, HOST_NV_GPR(R20)(r1)
285 lwz r21, HOST_NV_GPR(r21)(r1) 284 lwz r21, HOST_NV_GPR(R21)(r1)
286 lwz r22, HOST_NV_GPR(r22)(r1) 285 lwz r22, HOST_NV_GPR(R22)(r1)
287 lwz r23, HOST_NV_GPR(r23)(r1) 286 lwz r23, HOST_NV_GPR(R23)(r1)
288 lwz r24, HOST_NV_GPR(r24)(r1) 287 lwz r24, HOST_NV_GPR(R24)(r1)
289 lwz r25, HOST_NV_GPR(r25)(r1) 288 lwz r25, HOST_NV_GPR(R25)(r1)
290 lwz r26, HOST_NV_GPR(r26)(r1) 289 lwz r26, HOST_NV_GPR(R26)(r1)
291 lwz r27, HOST_NV_GPR(r27)(r1) 290 lwz r27, HOST_NV_GPR(R27)(r1)
292 lwz r28, HOST_NV_GPR(r28)(r1) 291 lwz r28, HOST_NV_GPR(R28)(r1)
293 lwz r29, HOST_NV_GPR(r29)(r1) 292 lwz r29, HOST_NV_GPR(R29)(r1)
294 lwz r30, HOST_NV_GPR(r30)(r1) 293 lwz r30, HOST_NV_GPR(R30)(r1)
295 lwz r31, HOST_NV_GPR(r31)(r1) 294 lwz r31, HOST_NV_GPR(R31)(r1)
296 295
297 /* Return to kvm_vcpu_run(). */ 296 /* Return to kvm_vcpu_run(). */
298 lwz r4, HOST_STACK_LR(r1) 297 lwz r4, HOST_STACK_LR(r1)
@@ -320,44 +319,44 @@ _GLOBAL(__kvmppc_vcpu_run)
320 stw r5, HOST_CR(r1) 319 stw r5, HOST_CR(r1)
321 320
322 /* Save host non-volatile register state to stack. */ 321 /* Save host non-volatile register state to stack. */
323 stw r14, HOST_NV_GPR(r14)(r1) 322 stw r14, HOST_NV_GPR(R14)(r1)
324 stw r15, HOST_NV_GPR(r15)(r1) 323 stw r15, HOST_NV_GPR(R15)(r1)
325 stw r16, HOST_NV_GPR(r16)(r1) 324 stw r16, HOST_NV_GPR(R16)(r1)
326 stw r17, HOST_NV_GPR(r17)(r1) 325 stw r17, HOST_NV_GPR(R17)(r1)
327 stw r18, HOST_NV_GPR(r18)(r1) 326 stw r18, HOST_NV_GPR(R18)(r1)
328 stw r19, HOST_NV_GPR(r19)(r1) 327 stw r19, HOST_NV_GPR(R19)(r1)
329 stw r20, HOST_NV_GPR(r20)(r1) 328 stw r20, HOST_NV_GPR(R20)(r1)
330 stw r21, HOST_NV_GPR(r21)(r1) 329 stw r21, HOST_NV_GPR(R21)(r1)
331 stw r22, HOST_NV_GPR(r22)(r1) 330 stw r22, HOST_NV_GPR(R22)(r1)
332 stw r23, HOST_NV_GPR(r23)(r1) 331 stw r23, HOST_NV_GPR(R23)(r1)
333 stw r24, HOST_NV_GPR(r24)(r1) 332 stw r24, HOST_NV_GPR(R24)(r1)
334 stw r25, HOST_NV_GPR(r25)(r1) 333 stw r25, HOST_NV_GPR(R25)(r1)
335 stw r26, HOST_NV_GPR(r26)(r1) 334 stw r26, HOST_NV_GPR(R26)(r1)
336 stw r27, HOST_NV_GPR(r27)(r1) 335 stw r27, HOST_NV_GPR(R27)(r1)
337 stw r28, HOST_NV_GPR(r28)(r1) 336 stw r28, HOST_NV_GPR(R28)(r1)
338 stw r29, HOST_NV_GPR(r29)(r1) 337 stw r29, HOST_NV_GPR(R29)(r1)
339 stw r30, HOST_NV_GPR(r30)(r1) 338 stw r30, HOST_NV_GPR(R30)(r1)
340 stw r31, HOST_NV_GPR(r31)(r1) 339 stw r31, HOST_NV_GPR(R31)(r1)
341 340
342 /* Load guest non-volatiles. */ 341 /* Load guest non-volatiles. */
343 lwz r14, VCPU_GPR(r14)(r4) 342 lwz r14, VCPU_GPR(R14)(r4)
344 lwz r15, VCPU_GPR(r15)(r4) 343 lwz r15, VCPU_GPR(R15)(r4)
345 lwz r16, VCPU_GPR(r16)(r4) 344 lwz r16, VCPU_GPR(R16)(r4)
346 lwz r17, VCPU_GPR(r17)(r4) 345 lwz r17, VCPU_GPR(R17)(r4)
347 lwz r18, VCPU_GPR(r18)(r4) 346 lwz r18, VCPU_GPR(R18)(r4)
348 lwz r19, VCPU_GPR(r19)(r4) 347 lwz r19, VCPU_GPR(R19)(r4)
349 lwz r20, VCPU_GPR(r20)(r4) 348 lwz r20, VCPU_GPR(R20)(r4)
350 lwz r21, VCPU_GPR(r21)(r4) 349 lwz r21, VCPU_GPR(R21)(r4)
351 lwz r22, VCPU_GPR(r22)(r4) 350 lwz r22, VCPU_GPR(R22)(r4)
352 lwz r23, VCPU_GPR(r23)(r4) 351 lwz r23, VCPU_GPR(R23)(r4)
353 lwz r24, VCPU_GPR(r24)(r4) 352 lwz r24, VCPU_GPR(R24)(r4)
354 lwz r25, VCPU_GPR(r25)(r4) 353 lwz r25, VCPU_GPR(R25)(r4)
355 lwz r26, VCPU_GPR(r26)(r4) 354 lwz r26, VCPU_GPR(R26)(r4)
356 lwz r27, VCPU_GPR(r27)(r4) 355 lwz r27, VCPU_GPR(R27)(r4)
357 lwz r28, VCPU_GPR(r28)(r4) 356 lwz r28, VCPU_GPR(R28)(r4)
358 lwz r29, VCPU_GPR(r29)(r4) 357 lwz r29, VCPU_GPR(R29)(r4)
359 lwz r30, VCPU_GPR(r30)(r4) 358 lwz r30, VCPU_GPR(R30)(r4)
360 lwz r31, VCPU_GPR(r31)(r4) 359 lwz r31, VCPU_GPR(R31)(r4)
361 360
362#ifdef CONFIG_SPE 361#ifdef CONFIG_SPE
363 /* save host SPEFSCR and load guest SPEFSCR */ 362 /* save host SPEFSCR and load guest SPEFSCR */
@@ -385,13 +384,13 @@ lightweight_exit:
385#endif 384#endif
386 385
387 /* Load some guest volatiles. */ 386 /* Load some guest volatiles. */
388 lwz r0, VCPU_GPR(r0)(r4) 387 lwz r0, VCPU_GPR(R0)(r4)
389 lwz r2, VCPU_GPR(r2)(r4) 388 lwz r2, VCPU_GPR(R2)(r4)
390 lwz r9, VCPU_GPR(r9)(r4) 389 lwz r9, VCPU_GPR(R9)(r4)
391 lwz r10, VCPU_GPR(r10)(r4) 390 lwz r10, VCPU_GPR(R10)(r4)
392 lwz r11, VCPU_GPR(r11)(r4) 391 lwz r11, VCPU_GPR(R11)(r4)
393 lwz r12, VCPU_GPR(r12)(r4) 392 lwz r12, VCPU_GPR(R12)(r4)
394 lwz r13, VCPU_GPR(r13)(r4) 393 lwz r13, VCPU_GPR(R13)(r4)
395 lwz r3, VCPU_LR(r4) 394 lwz r3, VCPU_LR(r4)
396 mtlr r3 395 mtlr r3
397 lwz r3, VCPU_XER(r4) 396 lwz r3, VCPU_XER(r4)
@@ -410,7 +409,7 @@ lightweight_exit:
410 409
411 /* Can't switch the stack pointer until after IVPR is switched, 410 /* Can't switch the stack pointer until after IVPR is switched,
412 * because host interrupt handlers would get confused. */ 411 * because host interrupt handlers would get confused. */
413 lwz r1, VCPU_GPR(r1)(r4) 412 lwz r1, VCPU_GPR(R1)(r4)
414 413
415 /* 414 /*
416 * Host interrupt handlers may have clobbered these 415 * Host interrupt handlers may have clobbered these
@@ -448,10 +447,10 @@ lightweight_exit:
448 mtcr r5 447 mtcr r5
449 mtsrr0 r6 448 mtsrr0 r6
450 mtsrr1 r7 449 mtsrr1 r7
451 lwz r5, VCPU_GPR(r5)(r4) 450 lwz r5, VCPU_GPR(R5)(r4)
452 lwz r6, VCPU_GPR(r6)(r4) 451 lwz r6, VCPU_GPR(R6)(r4)
453 lwz r7, VCPU_GPR(r7)(r4) 452 lwz r7, VCPU_GPR(R7)(r4)
454 lwz r8, VCPU_GPR(r8)(r4) 453 lwz r8, VCPU_GPR(R8)(r4)
455 454
456 /* Clear any debug events which occurred since we disabled MSR[DE]. 455 /* Clear any debug events which occurred since we disabled MSR[DE].
457 * XXX This gives us a 3-instruction window in which a breakpoint 456 * XXX This gives us a 3-instruction window in which a breakpoint
@@ -460,8 +459,8 @@ lightweight_exit:
460 ori r3, r3, 0xffff 459 ori r3, r3, 0xffff
461 mtspr SPRN_DBSR, r3 460 mtspr SPRN_DBSR, r3
462 461
463 lwz r3, VCPU_GPR(r3)(r4) 462 lwz r3, VCPU_GPR(R3)(r4)
464 lwz r4, VCPU_GPR(r4)(r4) 463 lwz r4, VCPU_GPR(R4)(r4)
465 rfi 464 rfi
466 465
467#ifdef CONFIG_SPE 466#ifdef CONFIG_SPE
diff --git a/arch/powerpc/kvm/bookehv_interrupts.S b/arch/powerpc/kvm/bookehv_interrupts.S
index 0fa2ef7df036..d28c2d43ac1b 100644
--- a/arch/powerpc/kvm/bookehv_interrupts.S
+++ b/arch/powerpc/kvm/bookehv_interrupts.S
@@ -37,7 +37,6 @@
37 37
38#define LONGBYTES (BITS_PER_LONG / 8) 38#define LONGBYTES (BITS_PER_LONG / 8)
39 39
40#define VCPU_GPR(n) (VCPU_GPRS + (n * LONGBYTES))
41#define VCPU_GUEST_SPRG(n) (VCPU_GUEST_SPRGS + (n * LONGBYTES)) 40#define VCPU_GUEST_SPRG(n) (VCPU_GUEST_SPRGS + (n * LONGBYTES))
42 41
43/* The host stack layout: */ 42/* The host stack layout: */
@@ -67,15 +66,15 @@
67 */ 66 */
68.macro kvm_handler_common intno, srr0, flags 67.macro kvm_handler_common intno, srr0, flags
69 /* Restore host stack pointer */ 68 /* Restore host stack pointer */
70 PPC_STL r1, VCPU_GPR(r1)(r4) 69 PPC_STL r1, VCPU_GPR(R1)(r4)
71 PPC_STL r2, VCPU_GPR(r2)(r4) 70 PPC_STL r2, VCPU_GPR(R2)(r4)
72 PPC_LL r1, VCPU_HOST_STACK(r4) 71 PPC_LL r1, VCPU_HOST_STACK(r4)
73 PPC_LL r2, HOST_R2(r1) 72 PPC_LL r2, HOST_R2(r1)
74 73
75 mfspr r10, SPRN_PID 74 mfspr r10, SPRN_PID
76 lwz r8, VCPU_HOST_PID(r4) 75 lwz r8, VCPU_HOST_PID(r4)
77 PPC_LL r11, VCPU_SHARED(r4) 76 PPC_LL r11, VCPU_SHARED(r4)
78 PPC_STL r14, VCPU_GPR(r14)(r4) /* We need a non-volatile GPR. */ 77 PPC_STL r14, VCPU_GPR(R14)(r4) /* We need a non-volatile GPR. */
79 li r14, \intno 78 li r14, \intno
80 79
81 stw r10, VCPU_GUEST_PID(r4) 80 stw r10, VCPU_GUEST_PID(r4)
@@ -137,35 +136,31 @@
137 */ 136 */
138 137
139 mfspr r3, SPRN_EPLC /* will already have correct ELPID and EGS */ 138 mfspr r3, SPRN_EPLC /* will already have correct ELPID and EGS */
140 PPC_STL r15, VCPU_GPR(r15)(r4) 139 PPC_STL r15, VCPU_GPR(R15)(r4)
141 PPC_STL r16, VCPU_GPR(r16)(r4) 140 PPC_STL r16, VCPU_GPR(R16)(r4)
142 PPC_STL r17, VCPU_GPR(r17)(r4) 141 PPC_STL r17, VCPU_GPR(R17)(r4)
143 PPC_STL r18, VCPU_GPR(r18)(r4) 142 PPC_STL r18, VCPU_GPR(R18)(r4)
144 PPC_STL r19, VCPU_GPR(r19)(r4) 143 PPC_STL r19, VCPU_GPR(R19)(r4)
145 mr r8, r3 144 mr r8, r3
146 PPC_STL r20, VCPU_GPR(r20)(r4) 145 PPC_STL r20, VCPU_GPR(R20)(r4)
147 rlwimi r8, r6, EPC_EAS_SHIFT - MSR_IR_LG, EPC_EAS 146 rlwimi r8, r6, EPC_EAS_SHIFT - MSR_IR_LG, EPC_EAS
148 PPC_STL r21, VCPU_GPR(r21)(r4) 147 PPC_STL r21, VCPU_GPR(R21)(r4)
149 rlwimi r8, r6, EPC_EPR_SHIFT - MSR_PR_LG, EPC_EPR 148 rlwimi r8, r6, EPC_EPR_SHIFT - MSR_PR_LG, EPC_EPR
150 PPC_STL r22, VCPU_GPR(r22)(r4) 149 PPC_STL r22, VCPU_GPR(R22)(r4)
151 rlwimi r8, r10, EPC_EPID_SHIFT, EPC_EPID 150 rlwimi r8, r10, EPC_EPID_SHIFT, EPC_EPID
152 PPC_STL r23, VCPU_GPR(r23)(r4) 151 PPC_STL r23, VCPU_GPR(R23)(r4)
153 PPC_STL r24, VCPU_GPR(r24)(r4) 152 PPC_STL r24, VCPU_GPR(R24)(r4)
154 PPC_STL r25, VCPU_GPR(r25)(r4) 153 PPC_STL r25, VCPU_GPR(R25)(r4)
155 PPC_STL r26, VCPU_GPR(r26)(r4) 154 PPC_STL r26, VCPU_GPR(R26)(r4)
156 PPC_STL r27, VCPU_GPR(r27)(r4) 155 PPC_STL r27, VCPU_GPR(R27)(r4)
157 PPC_STL r28, VCPU_GPR(r28)(r4) 156 PPC_STL r28, VCPU_GPR(R28)(r4)
158 PPC_STL r29, VCPU_GPR(r29)(r4) 157 PPC_STL r29, VCPU_GPR(R29)(r4)
159 PPC_STL r30, VCPU_GPR(r30)(r4) 158 PPC_STL r30, VCPU_GPR(R30)(r4)
160 PPC_STL r31, VCPU_GPR(r31)(r4) 159 PPC_STL r31, VCPU_GPR(R31)(r4)
161 mtspr SPRN_EPLC, r8 160 mtspr SPRN_EPLC, r8
162 161
163 /* disable preemption, so we are sure we hit the fixup handler */ 162 /* disable preemption, so we are sure we hit the fixup handler */
164#ifdef CONFIG_PPC64 163 CURRENT_THREAD_INFO(r8, r1)
165 clrrdi r8,r1,THREAD_SHIFT
166#else
167 rlwinm r8,r1,0,0,31-THREAD_SHIFT /* current thread_info */
168#endif
169 li r7, 1 164 li r7, 1
170 stw r7, TI_PREEMPT(r8) 165 stw r7, TI_PREEMPT(r8)
171 166
@@ -211,24 +206,24 @@
211.macro kvm_handler intno srr0, srr1, flags 206.macro kvm_handler intno srr0, srr1, flags
212_GLOBAL(kvmppc_handler_\intno\()_\srr1) 207_GLOBAL(kvmppc_handler_\intno\()_\srr1)
213 GET_VCPU(r11, r10) 208 GET_VCPU(r11, r10)
214 PPC_STL r3, VCPU_GPR(r3)(r11) 209 PPC_STL r3, VCPU_GPR(R3)(r11)
215 mfspr r3, SPRN_SPRG_RSCRATCH0 210 mfspr r3, SPRN_SPRG_RSCRATCH0
216 PPC_STL r4, VCPU_GPR(r4)(r11) 211 PPC_STL r4, VCPU_GPR(R4)(r11)
217 PPC_LL r4, THREAD_NORMSAVE(0)(r10) 212 PPC_LL r4, THREAD_NORMSAVE(0)(r10)
218 PPC_STL r5, VCPU_GPR(r5)(r11) 213 PPC_STL r5, VCPU_GPR(R5)(r11)
219 stw r13, VCPU_CR(r11) 214 stw r13, VCPU_CR(r11)
220 mfspr r5, \srr0 215 mfspr r5, \srr0
221 PPC_STL r3, VCPU_GPR(r10)(r11) 216 PPC_STL r3, VCPU_GPR(R10)(r11)
222 PPC_LL r3, THREAD_NORMSAVE(2)(r10) 217 PPC_LL r3, THREAD_NORMSAVE(2)(r10)
223 PPC_STL r6, VCPU_GPR(r6)(r11) 218 PPC_STL r6, VCPU_GPR(R6)(r11)
224 PPC_STL r4, VCPU_GPR(r11)(r11) 219 PPC_STL r4, VCPU_GPR(R11)(r11)
225 mfspr r6, \srr1 220 mfspr r6, \srr1
226 PPC_STL r7, VCPU_GPR(r7)(r11) 221 PPC_STL r7, VCPU_GPR(R7)(r11)
227 PPC_STL r8, VCPU_GPR(r8)(r11) 222 PPC_STL r8, VCPU_GPR(R8)(r11)
228 PPC_STL r9, VCPU_GPR(r9)(r11) 223 PPC_STL r9, VCPU_GPR(R9)(r11)
229 PPC_STL r3, VCPU_GPR(r13)(r11) 224 PPC_STL r3, VCPU_GPR(R13)(r11)
230 mfctr r7 225 mfctr r7
231 PPC_STL r12, VCPU_GPR(r12)(r11) 226 PPC_STL r12, VCPU_GPR(R12)(r11)
232 PPC_STL r7, VCPU_CTR(r11) 227 PPC_STL r7, VCPU_CTR(r11)
233 mr r4, r11 228 mr r4, r11
234 kvm_handler_common \intno, \srr0, \flags 229 kvm_handler_common \intno, \srr0, \flags
@@ -238,25 +233,25 @@ _GLOBAL(kvmppc_handler_\intno\()_\srr1)
238_GLOBAL(kvmppc_handler_\intno\()_\srr1) 233_GLOBAL(kvmppc_handler_\intno\()_\srr1)
239 mfspr r10, SPRN_SPRG_THREAD 234 mfspr r10, SPRN_SPRG_THREAD
240 GET_VCPU(r11, r10) 235 GET_VCPU(r11, r10)
241 PPC_STL r3, VCPU_GPR(r3)(r11) 236 PPC_STL r3, VCPU_GPR(R3)(r11)
242 mfspr r3, \scratch 237 mfspr r3, \scratch
243 PPC_STL r4, VCPU_GPR(r4)(r11) 238 PPC_STL r4, VCPU_GPR(R4)(r11)
244 PPC_LL r4, GPR9(r8) 239 PPC_LL r4, GPR9(r8)
245 PPC_STL r5, VCPU_GPR(r5)(r11) 240 PPC_STL r5, VCPU_GPR(R5)(r11)
246 stw r9, VCPU_CR(r11) 241 stw r9, VCPU_CR(r11)
247 mfspr r5, \srr0 242 mfspr r5, \srr0
248 PPC_STL r3, VCPU_GPR(r8)(r11) 243 PPC_STL r3, VCPU_GPR(R8)(r11)
249 PPC_LL r3, GPR10(r8) 244 PPC_LL r3, GPR10(r8)
250 PPC_STL r6, VCPU_GPR(r6)(r11) 245 PPC_STL r6, VCPU_GPR(R6)(r11)
251 PPC_STL r4, VCPU_GPR(r9)(r11) 246 PPC_STL r4, VCPU_GPR(R9)(r11)
252 mfspr r6, \srr1 247 mfspr r6, \srr1
253 PPC_LL r4, GPR11(r8) 248 PPC_LL r4, GPR11(r8)
254 PPC_STL r7, VCPU_GPR(r7)(r11) 249 PPC_STL r7, VCPU_GPR(R7)(r11)
255 PPC_STL r3, VCPU_GPR(r10)(r11) 250 PPC_STL r3, VCPU_GPR(R10)(r11)
256 mfctr r7 251 mfctr r7
257 PPC_STL r12, VCPU_GPR(r12)(r11) 252 PPC_STL r12, VCPU_GPR(R12)(r11)
258 PPC_STL r13, VCPU_GPR(r13)(r11) 253 PPC_STL r13, VCPU_GPR(R13)(r11)
259 PPC_STL r4, VCPU_GPR(r11)(r11) 254 PPC_STL r4, VCPU_GPR(R11)(r11)
260 PPC_STL r7, VCPU_CTR(r11) 255 PPC_STL r7, VCPU_CTR(r11)
261 mr r4, r11 256 mr r4, r11
262 kvm_handler_common \intno, \srr0, \flags 257 kvm_handler_common \intno, \srr0, \flags
@@ -310,7 +305,7 @@ kvm_lvl_handler BOOKE_INTERRUPT_DEBUG, \
310_GLOBAL(kvmppc_resume_host) 305_GLOBAL(kvmppc_resume_host)
311 /* Save remaining volatile guest register state to vcpu. */ 306 /* Save remaining volatile guest register state to vcpu. */
312 mfspr r3, SPRN_VRSAVE 307 mfspr r3, SPRN_VRSAVE
313 PPC_STL r0, VCPU_GPR(r0)(r4) 308 PPC_STL r0, VCPU_GPR(R0)(r4)
314 mflr r5 309 mflr r5
315 mfspr r6, SPRN_SPRG4 310 mfspr r6, SPRN_SPRG4
316 PPC_STL r5, VCPU_LR(r4) 311 PPC_STL r5, VCPU_LR(r4)
@@ -358,27 +353,27 @@ _GLOBAL(kvmppc_resume_host)
358 353
359 /* Restore vcpu pointer and the nonvolatiles we used. */ 354 /* Restore vcpu pointer and the nonvolatiles we used. */
360 mr r4, r14 355 mr r4, r14
361 PPC_LL r14, VCPU_GPR(r14)(r4) 356 PPC_LL r14, VCPU_GPR(R14)(r4)
362 357
363 andi. r5, r3, RESUME_FLAG_NV 358 andi. r5, r3, RESUME_FLAG_NV
364 beq skip_nv_load 359 beq skip_nv_load
365 PPC_LL r15, VCPU_GPR(r15)(r4) 360 PPC_LL r15, VCPU_GPR(R15)(r4)
366 PPC_LL r16, VCPU_GPR(r16)(r4) 361 PPC_LL r16, VCPU_GPR(R16)(r4)
367 PPC_LL r17, VCPU_GPR(r17)(r4) 362 PPC_LL r17, VCPU_GPR(R17)(r4)
368 PPC_LL r18, VCPU_GPR(r18)(r4) 363 PPC_LL r18, VCPU_GPR(R18)(r4)
369 PPC_LL r19, VCPU_GPR(r19)(r4) 364 PPC_LL r19, VCPU_GPR(R19)(r4)
370 PPC_LL r20, VCPU_GPR(r20)(r4) 365 PPC_LL r20, VCPU_GPR(R20)(r4)
371 PPC_LL r21, VCPU_GPR(r21)(r4) 366 PPC_LL r21, VCPU_GPR(R21)(r4)
372 PPC_LL r22, VCPU_GPR(r22)(r4) 367 PPC_LL r22, VCPU_GPR(R22)(r4)
373 PPC_LL r23, VCPU_GPR(r23)(r4) 368 PPC_LL r23, VCPU_GPR(R23)(r4)
374 PPC_LL r24, VCPU_GPR(r24)(r4) 369 PPC_LL r24, VCPU_GPR(R24)(r4)
375 PPC_LL r25, VCPU_GPR(r25)(r4) 370 PPC_LL r25, VCPU_GPR(R25)(r4)
376 PPC_LL r26, VCPU_GPR(r26)(r4) 371 PPC_LL r26, VCPU_GPR(R26)(r4)
377 PPC_LL r27, VCPU_GPR(r27)(r4) 372 PPC_LL r27, VCPU_GPR(R27)(r4)
378 PPC_LL r28, VCPU_GPR(r28)(r4) 373 PPC_LL r28, VCPU_GPR(R28)(r4)
379 PPC_LL r29, VCPU_GPR(r29)(r4) 374 PPC_LL r29, VCPU_GPR(R29)(r4)
380 PPC_LL r30, VCPU_GPR(r30)(r4) 375 PPC_LL r30, VCPU_GPR(R30)(r4)
381 PPC_LL r31, VCPU_GPR(r31)(r4) 376 PPC_LL r31, VCPU_GPR(R31)(r4)
382skip_nv_load: 377skip_nv_load:
383 /* Should we return to the guest? */ 378 /* Should we return to the guest? */
384 andi. r5, r3, RESUME_FLAG_HOST 379 andi. r5, r3, RESUME_FLAG_HOST
@@ -396,23 +391,23 @@ heavyweight_exit:
396 * non-volatiles. 391 * non-volatiles.
397 */ 392 */
398 393
399 PPC_STL r15, VCPU_GPR(r15)(r4) 394 PPC_STL r15, VCPU_GPR(R15)(r4)
400 PPC_STL r16, VCPU_GPR(r16)(r4) 395 PPC_STL r16, VCPU_GPR(R16)(r4)
401 PPC_STL r17, VCPU_GPR(r17)(r4) 396 PPC_STL r17, VCPU_GPR(R17)(r4)
402 PPC_STL r18, VCPU_GPR(r18)(r4) 397 PPC_STL r18, VCPU_GPR(R18)(r4)
403 PPC_STL r19, VCPU_GPR(r19)(r4) 398 PPC_STL r19, VCPU_GPR(R19)(r4)
404 PPC_STL r20, VCPU_GPR(r20)(r4) 399 PPC_STL r20, VCPU_GPR(R20)(r4)
405 PPC_STL r21, VCPU_GPR(r21)(r4) 400 PPC_STL r21, VCPU_GPR(R21)(r4)
406 PPC_STL r22, VCPU_GPR(r22)(r4) 401 PPC_STL r22, VCPU_GPR(R22)(r4)
407 PPC_STL r23, VCPU_GPR(r23)(r4) 402 PPC_STL r23, VCPU_GPR(R23)(r4)
408 PPC_STL r24, VCPU_GPR(r24)(r4) 403 PPC_STL r24, VCPU_GPR(R24)(r4)
409 PPC_STL r25, VCPU_GPR(r25)(r4) 404 PPC_STL r25, VCPU_GPR(R25)(r4)
410 PPC_STL r26, VCPU_GPR(r26)(r4) 405 PPC_STL r26, VCPU_GPR(R26)(r4)
411 PPC_STL r27, VCPU_GPR(r27)(r4) 406 PPC_STL r27, VCPU_GPR(R27)(r4)
412 PPC_STL r28, VCPU_GPR(r28)(r4) 407 PPC_STL r28, VCPU_GPR(R28)(r4)
413 PPC_STL r29, VCPU_GPR(r29)(r4) 408 PPC_STL r29, VCPU_GPR(R29)(r4)
414 PPC_STL r30, VCPU_GPR(r30)(r4) 409 PPC_STL r30, VCPU_GPR(R30)(r4)
415 PPC_STL r31, VCPU_GPR(r31)(r4) 410 PPC_STL r31, VCPU_GPR(R31)(r4)
416 411
417 /* Load host non-volatile register state from host stack. */ 412 /* Load host non-volatile register state from host stack. */
418 PPC_LL r14, HOST_NV_GPR(r14)(r1) 413 PPC_LL r14, HOST_NV_GPR(r14)(r1)
@@ -478,24 +473,24 @@ _GLOBAL(__kvmppc_vcpu_run)
478 PPC_STL r31, HOST_NV_GPR(r31)(r1) 473 PPC_STL r31, HOST_NV_GPR(r31)(r1)
479 474
480 /* Load guest non-volatiles. */ 475 /* Load guest non-volatiles. */
481 PPC_LL r14, VCPU_GPR(r14)(r4) 476 PPC_LL r14, VCPU_GPR(R14)(r4)
482 PPC_LL r15, VCPU_GPR(r15)(r4) 477 PPC_LL r15, VCPU_GPR(R15)(r4)
483 PPC_LL r16, VCPU_GPR(r16)(r4) 478 PPC_LL r16, VCPU_GPR(R16)(r4)
484 PPC_LL r17, VCPU_GPR(r17)(r4) 479 PPC_LL r17, VCPU_GPR(R17)(r4)
485 PPC_LL r18, VCPU_GPR(r18)(r4) 480 PPC_LL r18, VCPU_GPR(R18)(r4)
486 PPC_LL r19, VCPU_GPR(r19)(r4) 481 PPC_LL r19, VCPU_GPR(R19)(r4)
487 PPC_LL r20, VCPU_GPR(r20)(r4) 482 PPC_LL r20, VCPU_GPR(R20)(r4)
488 PPC_LL r21, VCPU_GPR(r21)(r4) 483 PPC_LL r21, VCPU_GPR(R21)(r4)
489 PPC_LL r22, VCPU_GPR(r22)(r4) 484 PPC_LL r22, VCPU_GPR(R22)(r4)
490 PPC_LL r23, VCPU_GPR(r23)(r4) 485 PPC_LL r23, VCPU_GPR(R23)(r4)
491 PPC_LL r24, VCPU_GPR(r24)(r4) 486 PPC_LL r24, VCPU_GPR(R24)(r4)
492 PPC_LL r25, VCPU_GPR(r25)(r4) 487 PPC_LL r25, VCPU_GPR(R25)(r4)
493 PPC_LL r26, VCPU_GPR(r26)(r4) 488 PPC_LL r26, VCPU_GPR(R26)(r4)
494 PPC_LL r27, VCPU_GPR(r27)(r4) 489 PPC_LL r27, VCPU_GPR(R27)(r4)
495 PPC_LL r28, VCPU_GPR(r28)(r4) 490 PPC_LL r28, VCPU_GPR(R28)(r4)
496 PPC_LL r29, VCPU_GPR(r29)(r4) 491 PPC_LL r29, VCPU_GPR(R29)(r4)
497 PPC_LL r30, VCPU_GPR(r30)(r4) 492 PPC_LL r30, VCPU_GPR(R30)(r4)
498 PPC_LL r31, VCPU_GPR(r31)(r4) 493 PPC_LL r31, VCPU_GPR(R31)(r4)
499 494
500 495
501lightweight_exit: 496lightweight_exit:
@@ -554,13 +549,13 @@ lightweight_exit:
554 lwz r7, VCPU_CR(r4) 549 lwz r7, VCPU_CR(r4)
555 PPC_LL r8, VCPU_PC(r4) 550 PPC_LL r8, VCPU_PC(r4)
556 PPC_LD(r9, VCPU_SHARED_MSR, r11) 551 PPC_LD(r9, VCPU_SHARED_MSR, r11)
557 PPC_LL r0, VCPU_GPR(r0)(r4) 552 PPC_LL r0, VCPU_GPR(R0)(r4)
558 PPC_LL r1, VCPU_GPR(r1)(r4) 553 PPC_LL r1, VCPU_GPR(R1)(r4)
559 PPC_LL r2, VCPU_GPR(r2)(r4) 554 PPC_LL r2, VCPU_GPR(R2)(r4)
560 PPC_LL r10, VCPU_GPR(r10)(r4) 555 PPC_LL r10, VCPU_GPR(R10)(r4)
561 PPC_LL r11, VCPU_GPR(r11)(r4) 556 PPC_LL r11, VCPU_GPR(R11)(r4)
562 PPC_LL r12, VCPU_GPR(r12)(r4) 557 PPC_LL r12, VCPU_GPR(R12)(r4)
563 PPC_LL r13, VCPU_GPR(r13)(r4) 558 PPC_LL r13, VCPU_GPR(R13)(r4)
564 mtlr r3 559 mtlr r3
565 mtxer r5 560 mtxer r5
566 mtctr r6 561 mtctr r6
@@ -586,12 +581,12 @@ lightweight_exit:
586 mtcr r7 581 mtcr r7
587 582
588 /* Finish loading guest volatiles and jump to guest. */ 583 /* Finish loading guest volatiles and jump to guest. */
589 PPC_LL r5, VCPU_GPR(r5)(r4) 584 PPC_LL r5, VCPU_GPR(R5)(r4)
590 PPC_LL r6, VCPU_GPR(r6)(r4) 585 PPC_LL r6, VCPU_GPR(R6)(r4)
591 PPC_LL r7, VCPU_GPR(r7)(r4) 586 PPC_LL r7, VCPU_GPR(R7)(r4)
592 PPC_LL r8, VCPU_GPR(r8)(r4) 587 PPC_LL r8, VCPU_GPR(R8)(r4)
593 PPC_LL r9, VCPU_GPR(r9)(r4) 588 PPC_LL r9, VCPU_GPR(R9)(r4)
594 589
595 PPC_LL r3, VCPU_GPR(r3)(r4) 590 PPC_LL r3, VCPU_GPR(R3)(r4)
596 PPC_LL r4, VCPU_GPR(r4)(r4) 591 PPC_LL r4, VCPU_GPR(R4)(r4)
597 rfi 592 rfi
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 7735a2c2e6d9..746e0c895cd7 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -17,14 +17,15 @@ obj-$(CONFIG_HAS_IOMEM) += devres.o
17obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \ 17obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \
18 memcpy_64.o usercopy_64.o mem_64.o string.o \ 18 memcpy_64.o usercopy_64.o mem_64.o string.o \
19 checksum_wrappers_64.o hweight_64.o \ 19 checksum_wrappers_64.o hweight_64.o \
20 copyuser_power7.o 20 copyuser_power7.o string_64.o copypage_power7.o \
21 memcpy_power7.o
21obj-$(CONFIG_XMON) += sstep.o ldstfp.o 22obj-$(CONFIG_XMON) += sstep.o ldstfp.o
22obj-$(CONFIG_KPROBES) += sstep.o ldstfp.o 23obj-$(CONFIG_KPROBES) += sstep.o ldstfp.o
23obj-$(CONFIG_HAVE_HW_BREAKPOINT) += sstep.o ldstfp.o 24obj-$(CONFIG_HAVE_HW_BREAKPOINT) += sstep.o ldstfp.o
24 25
25ifeq ($(CONFIG_PPC64),y) 26ifeq ($(CONFIG_PPC64),y)
26obj-$(CONFIG_SMP) += locks.o 27obj-$(CONFIG_SMP) += locks.o
27obj-$(CONFIG_ALTIVEC) += copyuser_power7_vmx.o 28obj-$(CONFIG_ALTIVEC) += vmx-helper.o
28endif 29endif
29 30
30obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o 31obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
diff --git a/arch/powerpc/lib/checksum_64.S b/arch/powerpc/lib/checksum_64.S
index 18245af38aea..167f72555d60 100644
--- a/arch/powerpc/lib/checksum_64.S
+++ b/arch/powerpc/lib/checksum_64.S
@@ -65,9 +65,6 @@ _GLOBAL(csum_tcpudp_magic)
65 srwi r3,r3,16 65 srwi r3,r3,16
66 blr 66 blr
67 67
68#define STACKFRAMESIZE 256
69#define STK_REG(i) (112 + ((i)-14)*8)
70
71/* 68/*
72 * Computes the checksum of a memory block at buff, length len, 69 * Computes the checksum of a memory block at buff, length len,
73 * and adds in "sum" (32-bit). 70 * and adds in "sum" (32-bit).
@@ -114,9 +111,9 @@ _GLOBAL(csum_partial)
114 mtctr r6 111 mtctr r6
115 112
116 stdu r1,-STACKFRAMESIZE(r1) 113 stdu r1,-STACKFRAMESIZE(r1)
117 std r14,STK_REG(r14)(r1) 114 std r14,STK_REG(R14)(r1)
118 std r15,STK_REG(r15)(r1) 115 std r15,STK_REG(R15)(r1)
119 std r16,STK_REG(r16)(r1) 116 std r16,STK_REG(R16)(r1)
120 117
121 ld r6,0(r3) 118 ld r6,0(r3)
122 ld r9,8(r3) 119 ld r9,8(r3)
@@ -175,9 +172,9 @@ _GLOBAL(csum_partial)
175 adde r0,r0,r15 172 adde r0,r0,r15
176 adde r0,r0,r16 173 adde r0,r0,r16
177 174
178 ld r14,STK_REG(r14)(r1) 175 ld r14,STK_REG(R14)(r1)
179 ld r15,STK_REG(r15)(r1) 176 ld r15,STK_REG(R15)(r1)
180 ld r16,STK_REG(r16)(r1) 177 ld r16,STK_REG(R16)(r1)
181 addi r1,r1,STACKFRAMESIZE 178 addi r1,r1,STACKFRAMESIZE
182 179
183 andi. r4,r4,63 180 andi. r4,r4,63
@@ -299,9 +296,9 @@ dest; sth r6,0(r4)
299 mtctr r6 296 mtctr r6
300 297
301 stdu r1,-STACKFRAMESIZE(r1) 298 stdu r1,-STACKFRAMESIZE(r1)
302 std r14,STK_REG(r14)(r1) 299 std r14,STK_REG(R14)(r1)
303 std r15,STK_REG(r15)(r1) 300 std r15,STK_REG(R15)(r1)
304 std r16,STK_REG(r16)(r1) 301 std r16,STK_REG(R16)(r1)
305 302
306source; ld r6,0(r3) 303source; ld r6,0(r3)
307source; ld r9,8(r3) 304source; ld r9,8(r3)
@@ -382,9 +379,9 @@ dest; std r16,56(r4)
382 adde r0,r0,r15 379 adde r0,r0,r15
383 adde r0,r0,r16 380 adde r0,r0,r16
384 381
385 ld r14,STK_REG(r14)(r1) 382 ld r14,STK_REG(R14)(r1)
386 ld r15,STK_REG(r15)(r1) 383 ld r15,STK_REG(R15)(r1)
387 ld r16,STK_REG(r16)(r1) 384 ld r16,STK_REG(R16)(r1)
388 addi r1,r1,STACKFRAMESIZE 385 addi r1,r1,STACKFRAMESIZE
389 386
390 andi. r5,r5,63 387 andi. r5,r5,63
diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c
index 7c975d43e3f3..dd223b3eb333 100644
--- a/arch/powerpc/lib/code-patching.c
+++ b/arch/powerpc/lib/code-patching.c
@@ -13,17 +13,23 @@
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <asm/page.h> 14#include <asm/page.h>
15#include <asm/code-patching.h> 15#include <asm/code-patching.h>
16#include <asm/uaccess.h>
16 17
17 18
18void patch_instruction(unsigned int *addr, unsigned int instr) 19int patch_instruction(unsigned int *addr, unsigned int instr)
19{ 20{
20 *addr = instr; 21 int err;
22
23 err = __put_user(instr, addr);
24 if (err)
25 return err;
21 asm ("dcbst 0, %0; sync; icbi 0,%0; sync; isync" : : "r" (addr)); 26 asm ("dcbst 0, %0; sync; icbi 0,%0; sync; isync" : : "r" (addr));
27 return 0;
22} 28}
23 29
24void patch_branch(unsigned int *addr, unsigned long target, int flags) 30int patch_branch(unsigned int *addr, unsigned long target, int flags)
25{ 31{
26 patch_instruction(addr, create_branch(addr, target, flags)); 32 return patch_instruction(addr, create_branch(addr, target, flags));
27} 33}
28 34
29unsigned int create_branch(const unsigned int *addr, 35unsigned int create_branch(const unsigned int *addr,
diff --git a/arch/powerpc/lib/copypage_64.S b/arch/powerpc/lib/copypage_64.S
index 53dcb6b1b708..9f9434a85264 100644
--- a/arch/powerpc/lib/copypage_64.S
+++ b/arch/powerpc/lib/copypage_64.S
@@ -17,7 +17,11 @@ PPC64_CACHES:
17 .section ".text" 17 .section ".text"
18 18
19_GLOBAL(copy_page) 19_GLOBAL(copy_page)
20BEGIN_FTR_SECTION
20 lis r5,PAGE_SIZE@h 21 lis r5,PAGE_SIZE@h
22FTR_SECTION_ELSE
23 b .copypage_power7
24ALT_FTR_SECTION_END_IFCLR(CPU_FTR_VMX_COPY)
21 ori r5,r5,PAGE_SIZE@l 25 ori r5,r5,PAGE_SIZE@l
22BEGIN_FTR_SECTION 26BEGIN_FTR_SECTION
23 ld r10,PPC64_CACHES@toc(r2) 27 ld r10,PPC64_CACHES@toc(r2)
diff --git a/arch/powerpc/lib/copypage_power7.S b/arch/powerpc/lib/copypage_power7.S
new file mode 100644
index 000000000000..0ef75bf0695c
--- /dev/null
+++ b/arch/powerpc/lib/copypage_power7.S
@@ -0,0 +1,165 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 *
16 * Copyright (C) IBM Corporation, 2012
17 *
18 * Author: Anton Blanchard <anton@au.ibm.com>
19 */
20#include <asm/page.h>
21#include <asm/ppc_asm.h>
22
23_GLOBAL(copypage_power7)
24 /*
25 * We prefetch both the source and destination using enhanced touch
26 * instructions. We use a stream ID of 0 for the load side and
27 * 1 for the store side. Since source and destination are page
28 * aligned we don't need to clear the bottom 7 bits of either
29 * address.
30 */
31 ori r9,r3,1 /* stream=1 */
32
33#ifdef CONFIG_PPC_64K_PAGES
34 lis r7,0x0E01 /* depth=7, units=512 */
35#else
36 lis r7,0x0E00 /* depth=7 */
37 ori r7,r7,0x1000 /* units=32 */
38#endif
39 ori r10,r7,1 /* stream=1 */
40
41 lis r8,0x8000 /* GO=1 */
42 clrldi r8,r8,32
43
44.machine push
45.machine "power4"
46 dcbt r0,r4,0b01000
47 dcbt r0,r7,0b01010
48 dcbtst r0,r9,0b01000
49 dcbtst r0,r10,0b01010
50 eieio
51 dcbt r0,r8,0b01010 /* GO */
52.machine pop
53
54#ifdef CONFIG_ALTIVEC
55 mflr r0
56 std r3,48(r1)
57 std r4,56(r1)
58 std r0,16(r1)
59 stdu r1,-STACKFRAMESIZE(r1)
60 bl .enter_vmx_copy
61 cmpwi r3,0
62 ld r0,STACKFRAMESIZE+16(r1)
63 ld r3,STACKFRAMESIZE+48(r1)
64 ld r4,STACKFRAMESIZE+56(r1)
65 mtlr r0
66
67 li r0,(PAGE_SIZE/128)
68 mtctr r0
69
70 beq .Lnonvmx_copy
71
72 addi r1,r1,STACKFRAMESIZE
73
74 li r6,16
75 li r7,32
76 li r8,48
77 li r9,64
78 li r10,80
79 li r11,96
80 li r12,112
81
82 .align 5
831: lvx vr7,r0,r4
84 lvx vr6,r4,r6
85 lvx vr5,r4,r7
86 lvx vr4,r4,r8
87 lvx vr3,r4,r9
88 lvx vr2,r4,r10
89 lvx vr1,r4,r11
90 lvx vr0,r4,r12
91 addi r4,r4,128
92 stvx vr7,r0,r3
93 stvx vr6,r3,r6
94 stvx vr5,r3,r7
95 stvx vr4,r3,r8
96 stvx vr3,r3,r9
97 stvx vr2,r3,r10
98 stvx vr1,r3,r11
99 stvx vr0,r3,r12
100 addi r3,r3,128
101 bdnz 1b
102
103 b .exit_vmx_copy /* tail call optimise */
104
105#else
106 li r0,(PAGE_SIZE/128)
107 mtctr r0
108
109 stdu r1,-STACKFRAMESIZE(r1)
110#endif
111
112.Lnonvmx_copy:
113 std r14,STK_REG(R14)(r1)
114 std r15,STK_REG(R15)(r1)
115 std r16,STK_REG(R16)(r1)
116 std r17,STK_REG(R17)(r1)
117 std r18,STK_REG(R18)(r1)
118 std r19,STK_REG(R19)(r1)
119 std r20,STK_REG(R20)(r1)
120
1211: ld r0,0(r4)
122 ld r5,8(r4)
123 ld r6,16(r4)
124 ld r7,24(r4)
125 ld r8,32(r4)
126 ld r9,40(r4)
127 ld r10,48(r4)
128 ld r11,56(r4)
129 ld r12,64(r4)
130 ld r14,72(r4)
131 ld r15,80(r4)
132 ld r16,88(r4)
133 ld r17,96(r4)
134 ld r18,104(r4)
135 ld r19,112(r4)
136 ld r20,120(r4)
137 addi r4,r4,128
138 std r0,0(r3)
139 std r5,8(r3)
140 std r6,16(r3)
141 std r7,24(r3)
142 std r8,32(r3)
143 std r9,40(r3)
144 std r10,48(r3)
145 std r11,56(r3)
146 std r12,64(r3)
147 std r14,72(r3)
148 std r15,80(r3)
149 std r16,88(r3)
150 std r17,96(r3)
151 std r18,104(r3)
152 std r19,112(r3)
153 std r20,120(r3)
154 addi r3,r3,128
155 bdnz 1b
156
157 ld r14,STK_REG(R14)(r1)
158 ld r15,STK_REG(R15)(r1)
159 ld r16,STK_REG(R16)(r1)
160 ld r17,STK_REG(R17)(r1)
161 ld r18,STK_REG(R18)(r1)
162 ld r19,STK_REG(R19)(r1)
163 ld r20,STK_REG(R20)(r1)
164 addi r1,r1,STACKFRAMESIZE
165 blr
diff --git a/arch/powerpc/lib/copyuser_power7.S b/arch/powerpc/lib/copyuser_power7.S
index 497db7b23bb1..f9ede7c6606e 100644
--- a/arch/powerpc/lib/copyuser_power7.S
+++ b/arch/powerpc/lib/copyuser_power7.S
@@ -19,9 +19,6 @@
19 */ 19 */
20#include <asm/ppc_asm.h> 20#include <asm/ppc_asm.h>
21 21
22#define STACKFRAMESIZE 256
23#define STK_REG(i) (112 + ((i)-14)*8)
24
25 .macro err1 22 .macro err1
26100: 23100:
27 .section __ex_table,"a" 24 .section __ex_table,"a"
@@ -57,26 +54,26 @@
57 54
58 55
59.Ldo_err4: 56.Ldo_err4:
60 ld r16,STK_REG(r16)(r1) 57 ld r16,STK_REG(R16)(r1)
61 ld r15,STK_REG(r15)(r1) 58 ld r15,STK_REG(R15)(r1)
62 ld r14,STK_REG(r14)(r1) 59 ld r14,STK_REG(R14)(r1)
63.Ldo_err3: 60.Ldo_err3:
64 bl .exit_vmx_copy 61 bl .exit_vmx_usercopy
65 ld r0,STACKFRAMESIZE+16(r1) 62 ld r0,STACKFRAMESIZE+16(r1)
66 mtlr r0 63 mtlr r0
67 b .Lexit 64 b .Lexit
68#endif /* CONFIG_ALTIVEC */ 65#endif /* CONFIG_ALTIVEC */
69 66
70.Ldo_err2: 67.Ldo_err2:
71 ld r22,STK_REG(r22)(r1) 68 ld r22,STK_REG(R22)(r1)
72 ld r21,STK_REG(r21)(r1) 69 ld r21,STK_REG(R21)(r1)
73 ld r20,STK_REG(r20)(r1) 70 ld r20,STK_REG(R20)(r1)
74 ld r19,STK_REG(r19)(r1) 71 ld r19,STK_REG(R19)(r1)
75 ld r18,STK_REG(r18)(r1) 72 ld r18,STK_REG(R18)(r1)
76 ld r17,STK_REG(r17)(r1) 73 ld r17,STK_REG(R17)(r1)
77 ld r16,STK_REG(r16)(r1) 74 ld r16,STK_REG(R16)(r1)
78 ld r15,STK_REG(r15)(r1) 75 ld r15,STK_REG(R15)(r1)
79 ld r14,STK_REG(r14)(r1) 76 ld r14,STK_REG(R14)(r1)
80.Lexit: 77.Lexit:
81 addi r1,r1,STACKFRAMESIZE 78 addi r1,r1,STACKFRAMESIZE
82.Ldo_err1: 79.Ldo_err1:
@@ -137,15 +134,15 @@ err1; stw r0,0(r3)
137 134
138 mflr r0 135 mflr r0
139 stdu r1,-STACKFRAMESIZE(r1) 136 stdu r1,-STACKFRAMESIZE(r1)
140 std r14,STK_REG(r14)(r1) 137 std r14,STK_REG(R14)(r1)
141 std r15,STK_REG(r15)(r1) 138 std r15,STK_REG(R15)(r1)
142 std r16,STK_REG(r16)(r1) 139 std r16,STK_REG(R16)(r1)
143 std r17,STK_REG(r17)(r1) 140 std r17,STK_REG(R17)(r1)
144 std r18,STK_REG(r18)(r1) 141 std r18,STK_REG(R18)(r1)
145 std r19,STK_REG(r19)(r1) 142 std r19,STK_REG(R19)(r1)
146 std r20,STK_REG(r20)(r1) 143 std r20,STK_REG(R20)(r1)
147 std r21,STK_REG(r21)(r1) 144 std r21,STK_REG(R21)(r1)
148 std r22,STK_REG(r22)(r1) 145 std r22,STK_REG(R22)(r1)
149 std r0,STACKFRAMESIZE+16(r1) 146 std r0,STACKFRAMESIZE+16(r1)
150 147
151 srdi r6,r5,7 148 srdi r6,r5,7
@@ -192,15 +189,15 @@ err2; std r21,120(r3)
192 189
193 clrldi r5,r5,(64-7) 190 clrldi r5,r5,(64-7)
194 191
195 ld r14,STK_REG(r14)(r1) 192 ld r14,STK_REG(R14)(r1)
196 ld r15,STK_REG(r15)(r1) 193 ld r15,STK_REG(R15)(r1)
197 ld r16,STK_REG(r16)(r1) 194 ld r16,STK_REG(R16)(r1)
198 ld r17,STK_REG(r17)(r1) 195 ld r17,STK_REG(R17)(r1)
199 ld r18,STK_REG(r18)(r1) 196 ld r18,STK_REG(R18)(r1)
200 ld r19,STK_REG(r19)(r1) 197 ld r19,STK_REG(R19)(r1)
201 ld r20,STK_REG(r20)(r1) 198 ld r20,STK_REG(R20)(r1)
202 ld r21,STK_REG(r21)(r1) 199 ld r21,STK_REG(R21)(r1)
203 ld r22,STK_REG(r22)(r1) 200 ld r22,STK_REG(R22)(r1)
204 addi r1,r1,STACKFRAMESIZE 201 addi r1,r1,STACKFRAMESIZE
205 202
206 /* Up to 127B to go */ 203 /* Up to 127B to go */
@@ -290,7 +287,7 @@ err1; stb r0,0(r3)
290 mflr r0 287 mflr r0
291 std r0,16(r1) 288 std r0,16(r1)
292 stdu r1,-STACKFRAMESIZE(r1) 289 stdu r1,-STACKFRAMESIZE(r1)
293 bl .enter_vmx_copy 290 bl .enter_vmx_usercopy
294 cmpwi r3,0 291 cmpwi r3,0
295 ld r0,STACKFRAMESIZE+16(r1) 292 ld r0,STACKFRAMESIZE+16(r1)
296 ld r3,STACKFRAMESIZE+48(r1) 293 ld r3,STACKFRAMESIZE+48(r1)
@@ -298,6 +295,68 @@ err1; stb r0,0(r3)
298 ld r5,STACKFRAMESIZE+64(r1) 295 ld r5,STACKFRAMESIZE+64(r1)
299 mtlr r0 296 mtlr r0
300 297
298 /*
299 * We prefetch both the source and destination using enhanced touch
300 * instructions. We use a stream ID of 0 for the load side and
301 * 1 for the store side.
302 */
303 clrrdi r6,r4,7
304 clrrdi r9,r3,7
305 ori r9,r9,1 /* stream=1 */
306
307 srdi r7,r5,7 /* length in cachelines, capped at 0x3FF */
308 cmpldi r7,0x3FF
309 ble 1f
310 li r7,0x3FF
3111: lis r0,0x0E00 /* depth=7 */
312 sldi r7,r7,7
313 or r7,r7,r0
314 ori r10,r7,1 /* stream=1 */
315
316 lis r8,0x8000 /* GO=1 */
317 clrldi r8,r8,32
318
319.machine push
320.machine "power4"
321 dcbt r0,r6,0b01000
322 dcbt r0,r7,0b01010
323 dcbtst r0,r9,0b01000
324 dcbtst r0,r10,0b01010
325 eieio
326 dcbt r0,r8,0b01010 /* GO */
327.machine pop
328
329 /*
330 * We prefetch both the source and destination using enhanced touch
331 * instructions. We use a stream ID of 0 for the load side and
332 * 1 for the store side.
333 */
334 clrrdi r6,r4,7
335 clrrdi r9,r3,7
336 ori r9,r9,1 /* stream=1 */
337
338 srdi r7,r5,7 /* length in cachelines, capped at 0x3FF */
339 cmpldi cr1,r7,0x3FF
340 ble cr1,1f
341 li r7,0x3FF
3421: lis r0,0x0E00 /* depth=7 */
343 sldi r7,r7,7
344 or r7,r7,r0
345 ori r10,r7,1 /* stream=1 */
346
347 lis r8,0x8000 /* GO=1 */
348 clrldi r8,r8,32
349
350.machine push
351.machine "power4"
352 dcbt r0,r6,0b01000
353 dcbt r0,r7,0b01010
354 dcbtst r0,r9,0b01000
355 dcbtst r0,r10,0b01010
356 eieio
357 dcbt r0,r8,0b01010 /* GO */
358.machine pop
359
301 beq .Lunwind_stack_nonvmx_copy 360 beq .Lunwind_stack_nonvmx_copy
302 361
303 /* 362 /*
@@ -378,9 +437,9 @@ err3; stvx vr0,r3,r11
3787: sub r5,r5,r6 4377: sub r5,r5,r6
379 srdi r6,r5,7 438 srdi r6,r5,7
380 439
381 std r14,STK_REG(r14)(r1) 440 std r14,STK_REG(R14)(r1)
382 std r15,STK_REG(r15)(r1) 441 std r15,STK_REG(R15)(r1)
383 std r16,STK_REG(r16)(r1) 442 std r16,STK_REG(R16)(r1)
384 443
385 li r12,64 444 li r12,64
386 li r14,80 445 li r14,80
@@ -415,9 +474,9 @@ err4; stvx vr0,r3,r16
415 addi r3,r3,128 474 addi r3,r3,128
416 bdnz 8b 475 bdnz 8b
417 476
418 ld r14,STK_REG(r14)(r1) 477 ld r14,STK_REG(R14)(r1)
419 ld r15,STK_REG(r15)(r1) 478 ld r15,STK_REG(R15)(r1)
420 ld r16,STK_REG(r16)(r1) 479 ld r16,STK_REG(R16)(r1)
421 480
422 /* Up to 127B to go */ 481 /* Up to 127B to go */
423 clrldi r5,r5,(64-7) 482 clrldi r5,r5,(64-7)
@@ -476,7 +535,7 @@ err3; lbz r0,0(r4)
476err3; stb r0,0(r3) 535err3; stb r0,0(r3)
477 536
47815: addi r1,r1,STACKFRAMESIZE 53715: addi r1,r1,STACKFRAMESIZE
479 b .exit_vmx_copy /* tail call optimise */ 538 b .exit_vmx_usercopy /* tail call optimise */
480 539
481.Lvmx_unaligned_copy: 540.Lvmx_unaligned_copy:
482 /* Get the destination 16B aligned */ 541 /* Get the destination 16B aligned */
@@ -563,9 +622,9 @@ err3; stvx vr11,r3,r11
5637: sub r5,r5,r6 6227: sub r5,r5,r6
564 srdi r6,r5,7 623 srdi r6,r5,7
565 624
566 std r14,STK_REG(r14)(r1) 625 std r14,STK_REG(R14)(r1)
567 std r15,STK_REG(r15)(r1) 626 std r15,STK_REG(R15)(r1)
568 std r16,STK_REG(r16)(r1) 627 std r16,STK_REG(R16)(r1)
569 628
570 li r12,64 629 li r12,64
571 li r14,80 630 li r14,80
@@ -608,9 +667,9 @@ err4; stvx vr15,r3,r16
608 addi r3,r3,128 667 addi r3,r3,128
609 bdnz 8b 668 bdnz 8b
610 669
611 ld r14,STK_REG(r14)(r1) 670 ld r14,STK_REG(R14)(r1)
612 ld r15,STK_REG(r15)(r1) 671 ld r15,STK_REG(R15)(r1)
613 ld r16,STK_REG(r16)(r1) 672 ld r16,STK_REG(R16)(r1)
614 673
615 /* Up to 127B to go */ 674 /* Up to 127B to go */
616 clrldi r5,r5,(64-7) 675 clrldi r5,r5,(64-7)
@@ -679,5 +738,5 @@ err3; lbz r0,0(r4)
679err3; stb r0,0(r3) 738err3; stb r0,0(r3)
680 739
68115: addi r1,r1,STACKFRAMESIZE 74015: addi r1,r1,STACKFRAMESIZE
682 b .exit_vmx_copy /* tail call optimise */ 741 b .exit_vmx_usercopy /* tail call optimise */
683#endif /* CONFiG_ALTIVEC */ 742#endif /* CONFiG_ALTIVEC */
diff --git a/arch/powerpc/lib/crtsavres.S b/arch/powerpc/lib/crtsavres.S
index 1c893f05d224..b2c68ce139ae 100644
--- a/arch/powerpc/lib/crtsavres.S
+++ b/arch/powerpc/lib/crtsavres.S
@@ -41,12 +41,13 @@
41#include <asm/ppc_asm.h> 41#include <asm/ppc_asm.h>
42 42
43 .file "crtsavres.S" 43 .file "crtsavres.S"
44 .section ".text"
45 44
46#ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE 45#ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
47 46
48#ifndef CONFIG_PPC64 47#ifndef CONFIG_PPC64
49 48
49 .section ".text"
50
50/* Routines for saving integer registers, called by the compiler. */ 51/* Routines for saving integer registers, called by the compiler. */
51/* Called with r11 pointing to the stack header word of the caller of the */ 52/* Called with r11 pointing to the stack header word of the caller of the */
52/* function, just beyond the end of the integer save area. */ 53/* function, just beyond the end of the integer save area. */
@@ -232,6 +233,8 @@ _GLOBAL(_rest32gpr_31_x)
232 233
233#else /* CONFIG_PPC64 */ 234#else /* CONFIG_PPC64 */
234 235
236 .section ".text.save.restore","ax",@progbits
237
235.globl _savegpr0_14 238.globl _savegpr0_14
236_savegpr0_14: 239_savegpr0_14:
237 std r14,-144(r1) 240 std r14,-144(r1)
diff --git a/arch/powerpc/lib/hweight_64.S b/arch/powerpc/lib/hweight_64.S
index fda27868cf8c..9b96ff2ecd4d 100644
--- a/arch/powerpc/lib/hweight_64.S
+++ b/arch/powerpc/lib/hweight_64.S
@@ -28,7 +28,7 @@ BEGIN_FTR_SECTION
28 nop 28 nop
29 nop 29 nop
30FTR_SECTION_ELSE 30FTR_SECTION_ELSE
31 PPC_POPCNTB(r3,r3) 31 PPC_POPCNTB(R3,R3)
32 clrldi r3,r3,64-8 32 clrldi r3,r3,64-8
33 blr 33 blr
34ALT_FTR_SECTION_END_IFCLR(CPU_FTR_POPCNTB) 34ALT_FTR_SECTION_END_IFCLR(CPU_FTR_POPCNTB)
@@ -42,14 +42,14 @@ BEGIN_FTR_SECTION
42 nop 42 nop
43FTR_SECTION_ELSE 43FTR_SECTION_ELSE
44 BEGIN_FTR_SECTION_NESTED(50) 44 BEGIN_FTR_SECTION_NESTED(50)
45 PPC_POPCNTB(r3,r3) 45 PPC_POPCNTB(R3,R3)
46 srdi r4,r3,8 46 srdi r4,r3,8
47 add r3,r4,r3 47 add r3,r4,r3
48 clrldi r3,r3,64-8 48 clrldi r3,r3,64-8
49 blr 49 blr
50 FTR_SECTION_ELSE_NESTED(50) 50 FTR_SECTION_ELSE_NESTED(50)
51 clrlwi r3,r3,16 51 clrlwi r3,r3,16
52 PPC_POPCNTW(r3,r3) 52 PPC_POPCNTW(R3,R3)
53 clrldi r3,r3,64-8 53 clrldi r3,r3,64-8
54 blr 54 blr
55 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 50) 55 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 50)
@@ -66,7 +66,7 @@ BEGIN_FTR_SECTION
66 nop 66 nop
67FTR_SECTION_ELSE 67FTR_SECTION_ELSE
68 BEGIN_FTR_SECTION_NESTED(51) 68 BEGIN_FTR_SECTION_NESTED(51)
69 PPC_POPCNTB(r3,r3) 69 PPC_POPCNTB(R3,R3)
70 srdi r4,r3,16 70 srdi r4,r3,16
71 add r3,r4,r3 71 add r3,r4,r3
72 srdi r4,r3,8 72 srdi r4,r3,8
@@ -74,7 +74,7 @@ FTR_SECTION_ELSE
74 clrldi r3,r3,64-8 74 clrldi r3,r3,64-8
75 blr 75 blr
76 FTR_SECTION_ELSE_NESTED(51) 76 FTR_SECTION_ELSE_NESTED(51)
77 PPC_POPCNTW(r3,r3) 77 PPC_POPCNTW(R3,R3)
78 clrldi r3,r3,64-8 78 clrldi r3,r3,64-8
79 blr 79 blr
80 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 51) 80 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 51)
@@ -93,7 +93,7 @@ BEGIN_FTR_SECTION
93 nop 93 nop
94FTR_SECTION_ELSE 94FTR_SECTION_ELSE
95 BEGIN_FTR_SECTION_NESTED(52) 95 BEGIN_FTR_SECTION_NESTED(52)
96 PPC_POPCNTB(r3,r3) 96 PPC_POPCNTB(R3,R3)
97 srdi r4,r3,32 97 srdi r4,r3,32
98 add r3,r4,r3 98 add r3,r4,r3
99 srdi r4,r3,16 99 srdi r4,r3,16
@@ -103,7 +103,7 @@ FTR_SECTION_ELSE
103 clrldi r3,r3,64-8 103 clrldi r3,r3,64-8
104 blr 104 blr
105 FTR_SECTION_ELSE_NESTED(52) 105 FTR_SECTION_ELSE_NESTED(52)
106 PPC_POPCNTD(r3,r3) 106 PPC_POPCNTD(R3,R3)
107 clrldi r3,r3,64-8 107 clrldi r3,r3,64-8
108 blr 108 blr
109 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 52) 109 ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 52)
diff --git a/arch/powerpc/lib/ldstfp.S b/arch/powerpc/lib/ldstfp.S
index 6a85380520b6..85aec08ab234 100644
--- a/arch/powerpc/lib/ldstfp.S
+++ b/arch/powerpc/lib/ldstfp.S
@@ -330,13 +330,13 @@ _GLOBAL(do_lxvd2x)
330 MTMSRD(r7) 330 MTMSRD(r7)
331 isync 331 isync
332 beq cr7,1f 332 beq cr7,1f
333 STXVD2X(0,r1,r8) 333 STXVD2X(0,R1,R8)
3341: li r9,-EFAULT 3341: li r9,-EFAULT
3352: LXVD2X(0,0,r4) 3352: LXVD2X(0,R0,R4)
336 li r9,0 336 li r9,0
3373: beq cr7,4f 3373: beq cr7,4f
338 bl put_vsr 338 bl put_vsr
339 LXVD2X(0,r1,r8) 339 LXVD2X(0,R1,R8)
3404: PPC_LL r0,STKFRM+PPC_LR_STKOFF(r1) 3404: PPC_LL r0,STKFRM+PPC_LR_STKOFF(r1)
341 mtlr r0 341 mtlr r0
342 MTMSRD(r6) 342 MTMSRD(r6)
@@ -358,13 +358,13 @@ _GLOBAL(do_stxvd2x)
358 MTMSRD(r7) 358 MTMSRD(r7)
359 isync 359 isync
360 beq cr7,1f 360 beq cr7,1f
361 STXVD2X(0,r1,r8) 361 STXVD2X(0,R1,R8)
362 bl get_vsr 362 bl get_vsr
3631: li r9,-EFAULT 3631: li r9,-EFAULT
3642: STXVD2X(0,0,r4) 3642: STXVD2X(0,R0,R4)
365 li r9,0 365 li r9,0
3663: beq cr7,4f 3663: beq cr7,4f
367 LXVD2X(0,r1,r8) 367 LXVD2X(0,R1,R8)
3684: PPC_LL r0,STKFRM+PPC_LR_STKOFF(r1) 3684: PPC_LL r0,STKFRM+PPC_LR_STKOFF(r1)
369 mtlr r0 369 mtlr r0
370 MTMSRD(r6) 370 MTMSRD(r6)
diff --git a/arch/powerpc/lib/memcpy_64.S b/arch/powerpc/lib/memcpy_64.S
index 82fea3963e15..d2bbbc8d7dc0 100644
--- a/arch/powerpc/lib/memcpy_64.S
+++ b/arch/powerpc/lib/memcpy_64.S
@@ -11,7 +11,11 @@
11 11
12 .align 7 12 .align 7
13_GLOBAL(memcpy) 13_GLOBAL(memcpy)
14BEGIN_FTR_SECTION
14 std r3,48(r1) /* save destination pointer for return value */ 15 std r3,48(r1) /* save destination pointer for return value */
16FTR_SECTION_ELSE
17 b memcpy_power7
18ALT_FTR_SECTION_END_IFCLR(CPU_FTR_VMX_COPY)
15 PPC_MTOCRF(0x01,r5) 19 PPC_MTOCRF(0x01,r5)
16 cmpldi cr1,r5,16 20 cmpldi cr1,r5,16
17 neg r6,r3 # LS 3 bits = # bytes to 8-byte dest bdry 21 neg r6,r3 # LS 3 bits = # bytes to 8-byte dest bdry
diff --git a/arch/powerpc/lib/memcpy_power7.S b/arch/powerpc/lib/memcpy_power7.S
new file mode 100644
index 000000000000..0efdc51bc716
--- /dev/null
+++ b/arch/powerpc/lib/memcpy_power7.S
@@ -0,0 +1,647 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 *
16 * Copyright (C) IBM Corporation, 2012
17 *
18 * Author: Anton Blanchard <anton@au.ibm.com>
19 */
20#include <asm/ppc_asm.h>
21
22_GLOBAL(memcpy_power7)
23#ifdef CONFIG_ALTIVEC
24 cmpldi r5,16
25 cmpldi cr1,r5,4096
26
27 std r3,48(r1)
28
29 blt .Lshort_copy
30 bgt cr1,.Lvmx_copy
31#else
32 cmpldi r5,16
33
34 std r3,48(r1)
35
36 blt .Lshort_copy
37#endif
38
39.Lnonvmx_copy:
40 /* Get the source 8B aligned */
41 neg r6,r4
42 mtocrf 0x01,r6
43 clrldi r6,r6,(64-3)
44
45 bf cr7*4+3,1f
46 lbz r0,0(r4)
47 addi r4,r4,1
48 stb r0,0(r3)
49 addi r3,r3,1
50
511: bf cr7*4+2,2f
52 lhz r0,0(r4)
53 addi r4,r4,2
54 sth r0,0(r3)
55 addi r3,r3,2
56
572: bf cr7*4+1,3f
58 lwz r0,0(r4)
59 addi r4,r4,4
60 stw r0,0(r3)
61 addi r3,r3,4
62
633: sub r5,r5,r6
64 cmpldi r5,128
65 blt 5f
66
67 mflr r0
68 stdu r1,-STACKFRAMESIZE(r1)
69 std r14,STK_REG(R14)(r1)
70 std r15,STK_REG(R15)(r1)
71 std r16,STK_REG(R16)(r1)
72 std r17,STK_REG(R17)(r1)
73 std r18,STK_REG(R18)(r1)
74 std r19,STK_REG(R19)(r1)
75 std r20,STK_REG(R20)(r1)
76 std r21,STK_REG(R21)(r1)
77 std r22,STK_REG(R22)(r1)
78 std r0,STACKFRAMESIZE+16(r1)
79
80 srdi r6,r5,7
81 mtctr r6
82
83 /* Now do cacheline (128B) sized loads and stores. */
84 .align 5
854:
86 ld r0,0(r4)
87 ld r6,8(r4)
88 ld r7,16(r4)
89 ld r8,24(r4)
90 ld r9,32(r4)
91 ld r10,40(r4)
92 ld r11,48(r4)
93 ld r12,56(r4)
94 ld r14,64(r4)
95 ld r15,72(r4)
96 ld r16,80(r4)
97 ld r17,88(r4)
98 ld r18,96(r4)
99 ld r19,104(r4)
100 ld r20,112(r4)
101 ld r21,120(r4)
102 addi r4,r4,128
103 std r0,0(r3)
104 std r6,8(r3)
105 std r7,16(r3)
106 std r8,24(r3)
107 std r9,32(r3)
108 std r10,40(r3)
109 std r11,48(r3)
110 std r12,56(r3)
111 std r14,64(r3)
112 std r15,72(r3)
113 std r16,80(r3)
114 std r17,88(r3)
115 std r18,96(r3)
116 std r19,104(r3)
117 std r20,112(r3)
118 std r21,120(r3)
119 addi r3,r3,128
120 bdnz 4b
121
122 clrldi r5,r5,(64-7)
123
124 ld r14,STK_REG(R14)(r1)
125 ld r15,STK_REG(R15)(r1)
126 ld r16,STK_REG(R16)(r1)
127 ld r17,STK_REG(R17)(r1)
128 ld r18,STK_REG(R18)(r1)
129 ld r19,STK_REG(R19)(r1)
130 ld r20,STK_REG(R20)(r1)
131 ld r21,STK_REG(R21)(r1)
132 ld r22,STK_REG(R22)(r1)
133 addi r1,r1,STACKFRAMESIZE
134
135 /* Up to 127B to go */
1365: srdi r6,r5,4
137 mtocrf 0x01,r6
138
1396: bf cr7*4+1,7f
140 ld r0,0(r4)
141 ld r6,8(r4)
142 ld r7,16(r4)
143 ld r8,24(r4)
144 ld r9,32(r4)
145 ld r10,40(r4)
146 ld r11,48(r4)
147 ld r12,56(r4)
148 addi r4,r4,64
149 std r0,0(r3)
150 std r6,8(r3)
151 std r7,16(r3)
152 std r8,24(r3)
153 std r9,32(r3)
154 std r10,40(r3)
155 std r11,48(r3)
156 std r12,56(r3)
157 addi r3,r3,64
158
159 /* Up to 63B to go */
1607: bf cr7*4+2,8f
161 ld r0,0(r4)
162 ld r6,8(r4)
163 ld r7,16(r4)
164 ld r8,24(r4)
165 addi r4,r4,32
166 std r0,0(r3)
167 std r6,8(r3)
168 std r7,16(r3)
169 std r8,24(r3)
170 addi r3,r3,32
171
172 /* Up to 31B to go */
1738: bf cr7*4+3,9f
174 ld r0,0(r4)
175 ld r6,8(r4)
176 addi r4,r4,16
177 std r0,0(r3)
178 std r6,8(r3)
179 addi r3,r3,16
180
1819: clrldi r5,r5,(64-4)
182
183 /* Up to 15B to go */
184.Lshort_copy:
185 mtocrf 0x01,r5
186 bf cr7*4+0,12f
187 lwz r0,0(r4) /* Less chance of a reject with word ops */
188 lwz r6,4(r4)
189 addi r4,r4,8
190 stw r0,0(r3)
191 stw r6,4(r3)
192 addi r3,r3,8
193
19412: bf cr7*4+1,13f
195 lwz r0,0(r4)
196 addi r4,r4,4
197 stw r0,0(r3)
198 addi r3,r3,4
199
20013: bf cr7*4+2,14f
201 lhz r0,0(r4)
202 addi r4,r4,2
203 sth r0,0(r3)
204 addi r3,r3,2
205
20614: bf cr7*4+3,15f
207 lbz r0,0(r4)
208 stb r0,0(r3)
209
21015: ld r3,48(r1)
211 blr
212
213.Lunwind_stack_nonvmx_copy:
214 addi r1,r1,STACKFRAMESIZE
215 b .Lnonvmx_copy
216
217#ifdef CONFIG_ALTIVEC
218.Lvmx_copy:
219 mflr r0
220 std r4,56(r1)
221 std r5,64(r1)
222 std r0,16(r1)
223 stdu r1,-STACKFRAMESIZE(r1)
224 bl .enter_vmx_copy
225 cmpwi r3,0
226 ld r0,STACKFRAMESIZE+16(r1)
227 ld r3,STACKFRAMESIZE+48(r1)
228 ld r4,STACKFRAMESIZE+56(r1)
229 ld r5,STACKFRAMESIZE+64(r1)
230 mtlr r0
231
232 /*
233 * We prefetch both the source and destination using enhanced touch
234 * instructions. We use a stream ID of 0 for the load side and
235 * 1 for the store side.
236 */
237 clrrdi r6,r4,7
238 clrrdi r9,r3,7
239 ori r9,r9,1 /* stream=1 */
240
241 srdi r7,r5,7 /* length in cachelines, capped at 0x3FF */
242 cmpldi cr1,r7,0x3FF
243 ble cr1,1f
244 li r7,0x3FF
2451: lis r0,0x0E00 /* depth=7 */
246 sldi r7,r7,7
247 or r7,r7,r0
248 ori r10,r7,1 /* stream=1 */
249
250 lis r8,0x8000 /* GO=1 */
251 clrldi r8,r8,32
252
253.machine push
254.machine "power4"
255 dcbt r0,r6,0b01000
256 dcbt r0,r7,0b01010
257 dcbtst r0,r9,0b01000
258 dcbtst r0,r10,0b01010
259 eieio
260 dcbt r0,r8,0b01010 /* GO */
261.machine pop
262
263 beq .Lunwind_stack_nonvmx_copy
264
265 /*
266 * If source and destination are not relatively aligned we use a
267 * slower permute loop.
268 */
269 xor r6,r4,r3
270 rldicl. r6,r6,0,(64-4)
271 bne .Lvmx_unaligned_copy
272
273 /* Get the destination 16B aligned */
274 neg r6,r3
275 mtocrf 0x01,r6
276 clrldi r6,r6,(64-4)
277
278 bf cr7*4+3,1f
279 lbz r0,0(r4)
280 addi r4,r4,1
281 stb r0,0(r3)
282 addi r3,r3,1
283
2841: bf cr7*4+2,2f
285 lhz r0,0(r4)
286 addi r4,r4,2
287 sth r0,0(r3)
288 addi r3,r3,2
289
2902: bf cr7*4+1,3f
291 lwz r0,0(r4)
292 addi r4,r4,4
293 stw r0,0(r3)
294 addi r3,r3,4
295
2963: bf cr7*4+0,4f
297 ld r0,0(r4)
298 addi r4,r4,8
299 std r0,0(r3)
300 addi r3,r3,8
301
3024: sub r5,r5,r6
303
304 /* Get the desination 128B aligned */
305 neg r6,r3
306 srdi r7,r6,4
307 mtocrf 0x01,r7
308 clrldi r6,r6,(64-7)
309
310 li r9,16
311 li r10,32
312 li r11,48
313
314 bf cr7*4+3,5f
315 lvx vr1,r0,r4
316 addi r4,r4,16
317 stvx vr1,r0,r3
318 addi r3,r3,16
319
3205: bf cr7*4+2,6f
321 lvx vr1,r0,r4
322 lvx vr0,r4,r9
323 addi r4,r4,32
324 stvx vr1,r0,r3
325 stvx vr0,r3,r9
326 addi r3,r3,32
327
3286: bf cr7*4+1,7f
329 lvx vr3,r0,r4
330 lvx vr2,r4,r9
331 lvx vr1,r4,r10
332 lvx vr0,r4,r11
333 addi r4,r4,64
334 stvx vr3,r0,r3
335 stvx vr2,r3,r9
336 stvx vr1,r3,r10
337 stvx vr0,r3,r11
338 addi r3,r3,64
339
3407: sub r5,r5,r6
341 srdi r6,r5,7
342
343 std r14,STK_REG(R14)(r1)
344 std r15,STK_REG(R15)(r1)
345 std r16,STK_REG(R16)(r1)
346
347 li r12,64
348 li r14,80
349 li r15,96
350 li r16,112
351
352 mtctr r6
353
354 /*
355 * Now do cacheline sized loads and stores. By this stage the
356 * cacheline stores are also cacheline aligned.
357 */
358 .align 5
3598:
360 lvx vr7,r0,r4
361 lvx vr6,r4,r9
362 lvx vr5,r4,r10
363 lvx vr4,r4,r11
364 lvx vr3,r4,r12
365 lvx vr2,r4,r14
366 lvx vr1,r4,r15
367 lvx vr0,r4,r16
368 addi r4,r4,128
369 stvx vr7,r0,r3
370 stvx vr6,r3,r9
371 stvx vr5,r3,r10
372 stvx vr4,r3,r11
373 stvx vr3,r3,r12
374 stvx vr2,r3,r14
375 stvx vr1,r3,r15
376 stvx vr0,r3,r16
377 addi r3,r3,128
378 bdnz 8b
379
380 ld r14,STK_REG(R14)(r1)
381 ld r15,STK_REG(R15)(r1)
382 ld r16,STK_REG(R16)(r1)
383
384 /* Up to 127B to go */
385 clrldi r5,r5,(64-7)
386 srdi r6,r5,4
387 mtocrf 0x01,r6
388
389 bf cr7*4+1,9f
390 lvx vr3,r0,r4
391 lvx vr2,r4,r9
392 lvx vr1,r4,r10
393 lvx vr0,r4,r11
394 addi r4,r4,64
395 stvx vr3,r0,r3
396 stvx vr2,r3,r9
397 stvx vr1,r3,r10
398 stvx vr0,r3,r11
399 addi r3,r3,64
400
4019: bf cr7*4+2,10f
402 lvx vr1,r0,r4
403 lvx vr0,r4,r9
404 addi r4,r4,32
405 stvx vr1,r0,r3
406 stvx vr0,r3,r9
407 addi r3,r3,32
408
40910: bf cr7*4+3,11f
410 lvx vr1,r0,r4
411 addi r4,r4,16
412 stvx vr1,r0,r3
413 addi r3,r3,16
414
415 /* Up to 15B to go */
41611: clrldi r5,r5,(64-4)
417 mtocrf 0x01,r5
418 bf cr7*4+0,12f
419 ld r0,0(r4)
420 addi r4,r4,8
421 std r0,0(r3)
422 addi r3,r3,8
423
42412: bf cr7*4+1,13f
425 lwz r0,0(r4)
426 addi r4,r4,4
427 stw r0,0(r3)
428 addi r3,r3,4
429
43013: bf cr7*4+2,14f
431 lhz r0,0(r4)
432 addi r4,r4,2
433 sth r0,0(r3)
434 addi r3,r3,2
435
43614: bf cr7*4+3,15f
437 lbz r0,0(r4)
438 stb r0,0(r3)
439
44015: addi r1,r1,STACKFRAMESIZE
441 ld r3,48(r1)
442 b .exit_vmx_copy /* tail call optimise */
443
444.Lvmx_unaligned_copy:
445 /* Get the destination 16B aligned */
446 neg r6,r3
447 mtocrf 0x01,r6
448 clrldi r6,r6,(64-4)
449
450 bf cr7*4+3,1f
451 lbz r0,0(r4)
452 addi r4,r4,1
453 stb r0,0(r3)
454 addi r3,r3,1
455
4561: bf cr7*4+2,2f
457 lhz r0,0(r4)
458 addi r4,r4,2
459 sth r0,0(r3)
460 addi r3,r3,2
461
4622: bf cr7*4+1,3f
463 lwz r0,0(r4)
464 addi r4,r4,4
465 stw r0,0(r3)
466 addi r3,r3,4
467
4683: bf cr7*4+0,4f
469 lwz r0,0(r4) /* Less chance of a reject with word ops */
470 lwz r7,4(r4)
471 addi r4,r4,8
472 stw r0,0(r3)
473 stw r7,4(r3)
474 addi r3,r3,8
475
4764: sub r5,r5,r6
477
478 /* Get the desination 128B aligned */
479 neg r6,r3
480 srdi r7,r6,4
481 mtocrf 0x01,r7
482 clrldi r6,r6,(64-7)
483
484 li r9,16
485 li r10,32
486 li r11,48
487
488 lvsl vr16,0,r4 /* Setup permute control vector */
489 lvx vr0,0,r4
490 addi r4,r4,16
491
492 bf cr7*4+3,5f
493 lvx vr1,r0,r4
494 vperm vr8,vr0,vr1,vr16
495 addi r4,r4,16
496 stvx vr8,r0,r3
497 addi r3,r3,16
498 vor vr0,vr1,vr1
499
5005: bf cr7*4+2,6f
501 lvx vr1,r0,r4
502 vperm vr8,vr0,vr1,vr16
503 lvx vr0,r4,r9
504 vperm vr9,vr1,vr0,vr16
505 addi r4,r4,32
506 stvx vr8,r0,r3
507 stvx vr9,r3,r9
508 addi r3,r3,32
509
5106: bf cr7*4+1,7f
511 lvx vr3,r0,r4
512 vperm vr8,vr0,vr3,vr16
513 lvx vr2,r4,r9
514 vperm vr9,vr3,vr2,vr16
515 lvx vr1,r4,r10
516 vperm vr10,vr2,vr1,vr16
517 lvx vr0,r4,r11
518 vperm vr11,vr1,vr0,vr16
519 addi r4,r4,64
520 stvx vr8,r0,r3
521 stvx vr9,r3,r9
522 stvx vr10,r3,r10
523 stvx vr11,r3,r11
524 addi r3,r3,64
525
5267: sub r5,r5,r6
527 srdi r6,r5,7
528
529 std r14,STK_REG(R14)(r1)
530 std r15,STK_REG(R15)(r1)
531 std r16,STK_REG(R16)(r1)
532
533 li r12,64
534 li r14,80
535 li r15,96
536 li r16,112
537
538 mtctr r6
539
540 /*
541 * Now do cacheline sized loads and stores. By this stage the
542 * cacheline stores are also cacheline aligned.
543 */
544 .align 5
5458:
546 lvx vr7,r0,r4
547 vperm vr8,vr0,vr7,vr16
548 lvx vr6,r4,r9
549 vperm vr9,vr7,vr6,vr16
550 lvx vr5,r4,r10
551 vperm vr10,vr6,vr5,vr16
552 lvx vr4,r4,r11
553 vperm vr11,vr5,vr4,vr16
554 lvx vr3,r4,r12
555 vperm vr12,vr4,vr3,vr16
556 lvx vr2,r4,r14
557 vperm vr13,vr3,vr2,vr16
558 lvx vr1,r4,r15
559 vperm vr14,vr2,vr1,vr16
560 lvx vr0,r4,r16
561 vperm vr15,vr1,vr0,vr16
562 addi r4,r4,128
563 stvx vr8,r0,r3
564 stvx vr9,r3,r9
565 stvx vr10,r3,r10
566 stvx vr11,r3,r11
567 stvx vr12,r3,r12
568 stvx vr13,r3,r14
569 stvx vr14,r3,r15
570 stvx vr15,r3,r16
571 addi r3,r3,128
572 bdnz 8b
573
574 ld r14,STK_REG(R14)(r1)
575 ld r15,STK_REG(R15)(r1)
576 ld r16,STK_REG(R16)(r1)
577
578 /* Up to 127B to go */
579 clrldi r5,r5,(64-7)
580 srdi r6,r5,4
581 mtocrf 0x01,r6
582
583 bf cr7*4+1,9f
584 lvx vr3,r0,r4
585 vperm vr8,vr0,vr3,vr16
586 lvx vr2,r4,r9
587 vperm vr9,vr3,vr2,vr16
588 lvx vr1,r4,r10
589 vperm vr10,vr2,vr1,vr16
590 lvx vr0,r4,r11
591 vperm vr11,vr1,vr0,vr16
592 addi r4,r4,64
593 stvx vr8,r0,r3
594 stvx vr9,r3,r9
595 stvx vr10,r3,r10
596 stvx vr11,r3,r11
597 addi r3,r3,64
598
5999: bf cr7*4+2,10f
600 lvx vr1,r0,r4
601 vperm vr8,vr0,vr1,vr16
602 lvx vr0,r4,r9
603 vperm vr9,vr1,vr0,vr16
604 addi r4,r4,32
605 stvx vr8,r0,r3
606 stvx vr9,r3,r9
607 addi r3,r3,32
608
60910: bf cr7*4+3,11f
610 lvx vr1,r0,r4
611 vperm vr8,vr0,vr1,vr16
612 addi r4,r4,16
613 stvx vr8,r0,r3
614 addi r3,r3,16
615
616 /* Up to 15B to go */
61711: clrldi r5,r5,(64-4)
618 addi r4,r4,-16 /* Unwind the +16 load offset */
619 mtocrf 0x01,r5
620 bf cr7*4+0,12f
621 lwz r0,0(r4) /* Less chance of a reject with word ops */
622 lwz r6,4(r4)
623 addi r4,r4,8
624 stw r0,0(r3)
625 stw r6,4(r3)
626 addi r3,r3,8
627
62812: bf cr7*4+1,13f
629 lwz r0,0(r4)
630 addi r4,r4,4
631 stw r0,0(r3)
632 addi r3,r3,4
633
63413: bf cr7*4+2,14f
635 lhz r0,0(r4)
636 addi r4,r4,2
637 sth r0,0(r3)
638 addi r3,r3,2
639
64014: bf cr7*4+3,15f
641 lbz r0,0(r4)
642 stb r0,0(r3)
643
64415: addi r1,r1,STACKFRAMESIZE
645 ld r3,48(r1)
646 b .exit_vmx_copy /* tail call optimise */
647#endif /* CONFiG_ALTIVEC */
diff --git a/arch/powerpc/lib/string.S b/arch/powerpc/lib/string.S
index 093d6316435c..1b5a0a09d609 100644
--- a/arch/powerpc/lib/string.S
+++ b/arch/powerpc/lib/string.S
@@ -119,6 +119,7 @@ _GLOBAL(memchr)
1192: li r3,0 1192: li r3,0
120 blr 120 blr
121 121
122#ifdef CONFIG_PPC32
122_GLOBAL(__clear_user) 123_GLOBAL(__clear_user)
123 addi r6,r3,-4 124 addi r6,r3,-4
124 li r3,0 125 li r3,0
@@ -160,3 +161,4 @@ _GLOBAL(__clear_user)
160 PPC_LONG 1b,91b 161 PPC_LONG 1b,91b
161 PPC_LONG 8b,92b 162 PPC_LONG 8b,92b
162 .text 163 .text
164#endif
diff --git a/arch/powerpc/lib/string_64.S b/arch/powerpc/lib/string_64.S
new file mode 100644
index 000000000000..3b1e48049faf
--- /dev/null
+++ b/arch/powerpc/lib/string_64.S
@@ -0,0 +1,202 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 *
16 * Copyright (C) IBM Corporation, 2012
17 *
18 * Author: Anton Blanchard <anton@au.ibm.com>
19 */
20
21#include <asm/ppc_asm.h>
22#include <asm/asm-offsets.h>
23
24 .section ".toc","aw"
25PPC64_CACHES:
26 .tc ppc64_caches[TC],ppc64_caches
27 .section ".text"
28
29/**
30 * __clear_user: - Zero a block of memory in user space, with less checking.
31 * @to: Destination address, in user space.
32 * @n: Number of bytes to zero.
33 *
34 * Zero a block of memory in user space. Caller must check
35 * the specified block with access_ok() before calling this function.
36 *
37 * Returns number of bytes that could not be cleared.
38 * On success, this will be zero.
39 */
40
41 .macro err1
42100:
43 .section __ex_table,"a"
44 .align 3
45 .llong 100b,.Ldo_err1
46 .previous
47 .endm
48
49 .macro err2
50200:
51 .section __ex_table,"a"
52 .align 3
53 .llong 200b,.Ldo_err2
54 .previous
55 .endm
56
57 .macro err3
58300:
59 .section __ex_table,"a"
60 .align 3
61 .llong 300b,.Ldo_err3
62 .previous
63 .endm
64
65.Ldo_err1:
66 mr r3,r8
67
68.Ldo_err2:
69 mtctr r4
701:
71err3; stb r0,0(r3)
72 addi r3,r3,1
73 addi r4,r4,-1
74 bdnz 1b
75
76.Ldo_err3:
77 mr r3,r4
78 blr
79
80_GLOBAL(__clear_user)
81 cmpdi r4,32
82 neg r6,r3
83 li r0,0
84 blt .Lshort_clear
85 mr r8,r3
86 mtocrf 0x01,r6
87 clrldi r6,r6,(64-3)
88
89 /* Get the destination 8 byte aligned */
90 bf cr7*4+3,1f
91err1; stb r0,0(r3)
92 addi r3,r3,1
93
941: bf cr7*4+2,2f
95err1; sth r0,0(r3)
96 addi r3,r3,2
97
982: bf cr7*4+1,3f
99err1; stw r0,0(r3)
100 addi r3,r3,4
101
1023: sub r4,r4,r6
103
104 cmpdi r4,32
105 cmpdi cr1,r4,512
106 blt .Lshort_clear
107 bgt cr1,.Llong_clear
108
109.Lmedium_clear:
110 srdi r6,r4,5
111 mtctr r6
112
113 /* Do 32 byte chunks */
1144:
115err2; std r0,0(r3)
116err2; std r0,8(r3)
117err2; std r0,16(r3)
118err2; std r0,24(r3)
119 addi r3,r3,32
120 addi r4,r4,-32
121 bdnz 4b
122
123.Lshort_clear:
124 /* up to 31 bytes to go */
125 cmpdi r4,16
126 blt 6f
127err2; std r0,0(r3)
128err2; std r0,8(r3)
129 addi r3,r3,16
130 addi r4,r4,-16
131
132 /* Up to 15 bytes to go */
1336: mr r8,r3
134 clrldi r4,r4,(64-4)
135 mtocrf 0x01,r4
136 bf cr7*4+0,7f
137err1; std r0,0(r3)
138 addi r3,r3,8
139
1407: bf cr7*4+1,8f
141err1; stw r0,0(r3)
142 addi r3,r3,4
143
1448: bf cr7*4+2,9f
145err1; sth r0,0(r3)
146 addi r3,r3,2
147
1489: bf cr7*4+3,10f
149err1; stb r0,0(r3)
150
15110: li r3,0
152 blr
153
154.Llong_clear:
155 ld r5,PPC64_CACHES@toc(r2)
156
157 bf cr7*4+0,11f
158err2; std r0,0(r3)
159 addi r3,r3,8
160 addi r4,r4,-8
161
162 /* Destination is 16 byte aligned, need to get it cacheline aligned */
16311: lwz r7,DCACHEL1LOGLINESIZE(r5)
164 lwz r9,DCACHEL1LINESIZE(r5)
165
166 /*
167 * With worst case alignment the long clear loop takes a minimum
168 * of 1 byte less than 2 cachelines.
169 */
170 sldi r10,r9,2
171 cmpd r4,r10
172 blt .Lmedium_clear
173
174 neg r6,r3
175 addi r10,r9,-1
176 and. r5,r6,r10
177 beq 13f
178
179 srdi r6,r5,4
180 mtctr r6
181 mr r8,r3
18212:
183err1; std r0,0(r3)
184err1; std r0,8(r3)
185 addi r3,r3,16
186 bdnz 12b
187
188 sub r4,r4,r5
189
19013: srd r6,r4,r7
191 mtctr r6
192 mr r8,r3
19314:
194err1; dcbz r0,r3
195 add r3,r3,r9
196 bdnz 14b
197
198 and r4,r4,r10
199
200 cmpdi r4,32
201 blt .Lshort_clear
202 b .Lmedium_clear
diff --git a/arch/powerpc/lib/copyuser_power7_vmx.c b/arch/powerpc/lib/vmx-helper.c
index bf2654f2b68e..3cf529ceec5b 100644
--- a/arch/powerpc/lib/copyuser_power7_vmx.c
+++ b/arch/powerpc/lib/vmx-helper.c
@@ -22,7 +22,7 @@
22#include <linux/hardirq.h> 22#include <linux/hardirq.h>
23#include <asm/switch_to.h> 23#include <asm/switch_to.h>
24 24
25int enter_vmx_copy(void) 25int enter_vmx_usercopy(void)
26{ 26{
27 if (in_interrupt()) 27 if (in_interrupt())
28 return 0; 28 return 0;
@@ -44,8 +44,31 @@ int enter_vmx_copy(void)
44 * This function must return 0 because we tail call optimise when calling 44 * This function must return 0 because we tail call optimise when calling
45 * from __copy_tofrom_user_power7 which returns 0 on success. 45 * from __copy_tofrom_user_power7 which returns 0 on success.
46 */ 46 */
47int exit_vmx_copy(void) 47int exit_vmx_usercopy(void)
48{ 48{
49 pagefault_enable(); 49 pagefault_enable();
50 return 0; 50 return 0;
51} 51}
52
53int enter_vmx_copy(void)
54{
55 if (in_interrupt())
56 return 0;
57
58 preempt_disable();
59
60 enable_kernel_altivec();
61
62 return 1;
63}
64
65/*
66 * All calls to this function will be optimised into tail calls. We are
67 * passed a pointer to the destination which we return as required by a
68 * memcpy implementation.
69 */
70void *exit_vmx_copy(void *dest)
71{
72 preempt_enable();
73 return dest;
74}
diff --git a/arch/powerpc/mm/hash_low_32.S b/arch/powerpc/mm/hash_low_32.S
index b13d58932bf6..115347f74ce5 100644
--- a/arch/powerpc/mm/hash_low_32.S
+++ b/arch/powerpc/mm/hash_low_32.S
@@ -184,7 +184,7 @@ _GLOBAL(add_hash_page)
184 add r3,r3,r0 /* note create_hpte trims to 24 bits */ 184 add r3,r3,r0 /* note create_hpte trims to 24 bits */
185 185
186#ifdef CONFIG_SMP 186#ifdef CONFIG_SMP
187 rlwinm r8,r1,0,0,(31-THREAD_SHIFT) /* use cpu number to make tag */ 187 CURRENT_THREAD_INFO(r8, r1) /* use cpu number to make tag */
188 lwz r8,TI_CPU(r8) /* to go in mmu_hash_lock */ 188 lwz r8,TI_CPU(r8) /* to go in mmu_hash_lock */
189 oris r8,r8,12 189 oris r8,r8,12
190#endif /* CONFIG_SMP */ 190#endif /* CONFIG_SMP */
@@ -545,7 +545,7 @@ _GLOBAL(flush_hash_pages)
545#ifdef CONFIG_SMP 545#ifdef CONFIG_SMP
546 addis r9,r7,mmu_hash_lock@ha 546 addis r9,r7,mmu_hash_lock@ha
547 addi r9,r9,mmu_hash_lock@l 547 addi r9,r9,mmu_hash_lock@l
548 rlwinm r8,r1,0,0,(31-THREAD_SHIFT) 548 CURRENT_THREAD_INFO(r8, r1)
549 add r8,r8,r7 549 add r8,r8,r7
550 lwz r8,TI_CPU(r8) 550 lwz r8,TI_CPU(r8)
551 oris r8,r8,9 551 oris r8,r8,9
@@ -639,7 +639,7 @@ _GLOBAL(flush_hash_patch_B)
639 */ 639 */
640_GLOBAL(_tlbie) 640_GLOBAL(_tlbie)
641#ifdef CONFIG_SMP 641#ifdef CONFIG_SMP
642 rlwinm r8,r1,0,0,(31-THREAD_SHIFT) 642 CURRENT_THREAD_INFO(r8, r1)
643 lwz r8,TI_CPU(r8) 643 lwz r8,TI_CPU(r8)
644 oris r8,r8,11 644 oris r8,r8,11
645 mfmsr r10 645 mfmsr r10
@@ -677,7 +677,7 @@ _GLOBAL(_tlbie)
677 */ 677 */
678_GLOBAL(_tlbia) 678_GLOBAL(_tlbia)
679#if defined(CONFIG_SMP) 679#if defined(CONFIG_SMP)
680 rlwinm r8,r1,0,0,(31-THREAD_SHIFT) 680 CURRENT_THREAD_INFO(r8, r1)
681 lwz r8,TI_CPU(r8) 681 lwz r8,TI_CPU(r8)
682 oris r8,r8,10 682 oris r8,r8,10
683 mfmsr r10 683 mfmsr r10
diff --git a/arch/powerpc/mm/hash_low_64.S b/arch/powerpc/mm/hash_low_64.S
index a242b5d7cbe4..602aeb06d298 100644
--- a/arch/powerpc/mm/hash_low_64.S
+++ b/arch/powerpc/mm/hash_low_64.S
@@ -34,14 +34,6 @@
34 * | CR save area (SP + 8) 34 * | CR save area (SP + 8)
35 * SP ---> +-- Back chain (SP + 0) 35 * SP ---> +-- Back chain (SP + 0)
36 */ 36 */
37#define STACKFRAMESIZE 256
38
39/* Save parameters offsets */
40#define STK_PARM(i) (STACKFRAMESIZE + 48 + ((i)-3)*8)
41
42/* Save non-volatile offsets */
43#define STK_REG(i) (112 + ((i)-14)*8)
44
45 37
46#ifndef CONFIG_PPC_64K_PAGES 38#ifndef CONFIG_PPC_64K_PAGES
47 39
@@ -64,9 +56,9 @@ _GLOBAL(__hash_page_4K)
64 std r0,16(r1) 56 std r0,16(r1)
65 stdu r1,-STACKFRAMESIZE(r1) 57 stdu r1,-STACKFRAMESIZE(r1)
66 /* Save all params that we need after a function call */ 58 /* Save all params that we need after a function call */
67 std r6,STK_PARM(r6)(r1) 59 std r6,STK_PARAM(R6)(r1)
68 std r8,STK_PARM(r8)(r1) 60 std r8,STK_PARAM(R8)(r1)
69 std r9,STK_PARM(r9)(r1) 61 std r9,STK_PARAM(R9)(r1)
70 62
71 /* Save non-volatile registers. 63 /* Save non-volatile registers.
72 * r31 will hold "old PTE" 64 * r31 will hold "old PTE"
@@ -75,11 +67,11 @@ _GLOBAL(__hash_page_4K)
75 * r28 is a hash value 67 * r28 is a hash value
76 * r27 is hashtab mask (maybe dynamic patched instead ?) 68 * r27 is hashtab mask (maybe dynamic patched instead ?)
77 */ 69 */
78 std r27,STK_REG(r27)(r1) 70 std r27,STK_REG(R27)(r1)
79 std r28,STK_REG(r28)(r1) 71 std r28,STK_REG(R28)(r1)
80 std r29,STK_REG(r29)(r1) 72 std r29,STK_REG(R29)(r1)
81 std r30,STK_REG(r30)(r1) 73 std r30,STK_REG(R30)(r1)
82 std r31,STK_REG(r31)(r1) 74 std r31,STK_REG(R31)(r1)
83 75
84 /* Step 1: 76 /* Step 1:
85 * 77 *
@@ -162,7 +154,7 @@ END_FTR_SECTION(CPU_FTR_NOEXECUTE|CPU_FTR_COHERENT_ICACHE, CPU_FTR_NOEXECUTE)
162 /* At this point, r3 contains new PP bits, save them in 154 /* At this point, r3 contains new PP bits, save them in
163 * place of "access" in the param area (sic) 155 * place of "access" in the param area (sic)
164 */ 156 */
165 std r3,STK_PARM(r4)(r1) 157 std r3,STK_PARAM(R4)(r1)
166 158
167 /* Get htab_hash_mask */ 159 /* Get htab_hash_mask */
168 ld r4,htab_hash_mask@got(2) 160 ld r4,htab_hash_mask@got(2)
@@ -192,11 +184,11 @@ htab_insert_pte:
192 rldicr r3,r0,3,63-3 /* r3 = (hash & mask) << 3 */ 184 rldicr r3,r0,3,63-3 /* r3 = (hash & mask) << 3 */
193 185
194 /* Call ppc_md.hpte_insert */ 186 /* Call ppc_md.hpte_insert */
195 ld r6,STK_PARM(r4)(r1) /* Retrieve new pp bits */ 187 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */
196 mr r4,r29 /* Retrieve va */ 188 mr r4,r29 /* Retrieve va */
197 li r7,0 /* !bolted, !secondary */ 189 li r7,0 /* !bolted, !secondary */
198 li r8,MMU_PAGE_4K /* page size */ 190 li r8,MMU_PAGE_4K /* page size */
199 ld r9,STK_PARM(r9)(r1) /* segment size */ 191 ld r9,STK_PARAM(R9)(r1) /* segment size */
200_GLOBAL(htab_call_hpte_insert1) 192_GLOBAL(htab_call_hpte_insert1)
201 bl . /* Patched by htab_finish_init() */ 193 bl . /* Patched by htab_finish_init() */
202 cmpdi 0,r3,0 194 cmpdi 0,r3,0
@@ -215,11 +207,11 @@ _GLOBAL(htab_call_hpte_insert1)
215 rldicr r3,r0,3,63-3 /* r0 = (~hash & mask) << 3 */ 207 rldicr r3,r0,3,63-3 /* r0 = (~hash & mask) << 3 */
216 208
217 /* Call ppc_md.hpte_insert */ 209 /* Call ppc_md.hpte_insert */
218 ld r6,STK_PARM(r4)(r1) /* Retrieve new pp bits */ 210 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */
219 mr r4,r29 /* Retrieve va */ 211 mr r4,r29 /* Retrieve va */
220 li r7,HPTE_V_SECONDARY /* !bolted, secondary */ 212 li r7,HPTE_V_SECONDARY /* !bolted, secondary */
221 li r8,MMU_PAGE_4K /* page size */ 213 li r8,MMU_PAGE_4K /* page size */
222 ld r9,STK_PARM(r9)(r1) /* segment size */ 214 ld r9,STK_PARAM(R9)(r1) /* segment size */
223_GLOBAL(htab_call_hpte_insert2) 215_GLOBAL(htab_call_hpte_insert2)
224 bl . /* Patched by htab_finish_init() */ 216 bl . /* Patched by htab_finish_init() */
225 cmpdi 0,r3,0 217 cmpdi 0,r3,0
@@ -255,15 +247,15 @@ htab_pte_insert_ok:
255 * (maybe add eieio may be good still ?) 247 * (maybe add eieio may be good still ?)
256 */ 248 */
257htab_write_out_pte: 249htab_write_out_pte:
258 ld r6,STK_PARM(r6)(r1) 250 ld r6,STK_PARAM(R6)(r1)
259 std r30,0(r6) 251 std r30,0(r6)
260 li r3, 0 252 li r3, 0
261htab_bail: 253htab_bail:
262 ld r27,STK_REG(r27)(r1) 254 ld r27,STK_REG(R27)(r1)
263 ld r28,STK_REG(r28)(r1) 255 ld r28,STK_REG(R28)(r1)
264 ld r29,STK_REG(r29)(r1) 256 ld r29,STK_REG(R29)(r1)
265 ld r30,STK_REG(r30)(r1) 257 ld r30,STK_REG(R30)(r1)
266 ld r31,STK_REG(r31)(r1) 258 ld r31,STK_REG(R31)(r1)
267 addi r1,r1,STACKFRAMESIZE 259 addi r1,r1,STACKFRAMESIZE
268 ld r0,16(r1) 260 ld r0,16(r1)
269 mtlr r0 261 mtlr r0
@@ -288,8 +280,8 @@ htab_modify_pte:
288 /* Call ppc_md.hpte_updatepp */ 280 /* Call ppc_md.hpte_updatepp */
289 mr r5,r29 /* va */ 281 mr r5,r29 /* va */
290 li r6,MMU_PAGE_4K /* page size */ 282 li r6,MMU_PAGE_4K /* page size */
291 ld r7,STK_PARM(r9)(r1) /* segment size */ 283 ld r7,STK_PARAM(R9)(r1) /* segment size */
292 ld r8,STK_PARM(r8)(r1) /* get "local" param */ 284 ld r8,STK_PARAM(R8)(r1) /* get "local" param */
293_GLOBAL(htab_call_hpte_updatepp) 285_GLOBAL(htab_call_hpte_updatepp)
294 bl . /* Patched by htab_finish_init() */ 286 bl . /* Patched by htab_finish_init() */
295 287
@@ -312,7 +304,7 @@ htab_wrong_access:
312 304
313htab_pte_insert_failure: 305htab_pte_insert_failure:
314 /* Bail out restoring old PTE */ 306 /* Bail out restoring old PTE */
315 ld r6,STK_PARM(r6)(r1) 307 ld r6,STK_PARAM(R6)(r1)
316 std r31,0(r6) 308 std r31,0(r6)
317 li r3,-1 309 li r3,-1
318 b htab_bail 310 b htab_bail
@@ -340,9 +332,9 @@ _GLOBAL(__hash_page_4K)
340 std r0,16(r1) 332 std r0,16(r1)
341 stdu r1,-STACKFRAMESIZE(r1) 333 stdu r1,-STACKFRAMESIZE(r1)
342 /* Save all params that we need after a function call */ 334 /* Save all params that we need after a function call */
343 std r6,STK_PARM(r6)(r1) 335 std r6,STK_PARAM(R6)(r1)
344 std r8,STK_PARM(r8)(r1) 336 std r8,STK_PARAM(R8)(r1)
345 std r9,STK_PARM(r9)(r1) 337 std r9,STK_PARAM(R9)(r1)
346 338
347 /* Save non-volatile registers. 339 /* Save non-volatile registers.
348 * r31 will hold "old PTE" 340 * r31 will hold "old PTE"
@@ -353,13 +345,13 @@ _GLOBAL(__hash_page_4K)
353 * r26 is the hidx mask 345 * r26 is the hidx mask
354 * r25 is the index in combo page 346 * r25 is the index in combo page
355 */ 347 */
356 std r25,STK_REG(r25)(r1) 348 std r25,STK_REG(R25)(r1)
357 std r26,STK_REG(r26)(r1) 349 std r26,STK_REG(R26)(r1)
358 std r27,STK_REG(r27)(r1) 350 std r27,STK_REG(R27)(r1)
359 std r28,STK_REG(r28)(r1) 351 std r28,STK_REG(R28)(r1)
360 std r29,STK_REG(r29)(r1) 352 std r29,STK_REG(R29)(r1)
361 std r30,STK_REG(r30)(r1) 353 std r30,STK_REG(R30)(r1)
362 std r31,STK_REG(r31)(r1) 354 std r31,STK_REG(R31)(r1)
363 355
364 /* Step 1: 356 /* Step 1:
365 * 357 *
@@ -452,7 +444,7 @@ END_FTR_SECTION(CPU_FTR_NOEXECUTE|CPU_FTR_COHERENT_ICACHE, CPU_FTR_NOEXECUTE)
452 /* At this point, r3 contains new PP bits, save them in 444 /* At this point, r3 contains new PP bits, save them in
453 * place of "access" in the param area (sic) 445 * place of "access" in the param area (sic)
454 */ 446 */
455 std r3,STK_PARM(r4)(r1) 447 std r3,STK_PARAM(R4)(r1)
456 448
457 /* Get htab_hash_mask */ 449 /* Get htab_hash_mask */
458 ld r4,htab_hash_mask@got(2) 450 ld r4,htab_hash_mask@got(2)
@@ -473,7 +465,7 @@ END_FTR_SECTION(CPU_FTR_NOEXECUTE|CPU_FTR_COHERENT_ICACHE, CPU_FTR_NOEXECUTE)
473 andis. r0,r31,_PAGE_COMBO@h 465 andis. r0,r31,_PAGE_COMBO@h
474 beq htab_inval_old_hpte 466 beq htab_inval_old_hpte
475 467
476 ld r6,STK_PARM(r6)(r1) 468 ld r6,STK_PARAM(R6)(r1)
477 ori r26,r6,0x8000 /* Load the hidx mask */ 469 ori r26,r6,0x8000 /* Load the hidx mask */
478 ld r26,0(r26) 470 ld r26,0(r26)
479 addi r5,r25,36 /* Check actual HPTE_SUB bit, this */ 471 addi r5,r25,36 /* Check actual HPTE_SUB bit, this */
@@ -495,11 +487,11 @@ htab_special_pfn:
495 rldicr r3,r0,3,63-3 /* r0 = (hash & mask) << 3 */ 487 rldicr r3,r0,3,63-3 /* r0 = (hash & mask) << 3 */
496 488
497 /* Call ppc_md.hpte_insert */ 489 /* Call ppc_md.hpte_insert */
498 ld r6,STK_PARM(r4)(r1) /* Retrieve new pp bits */ 490 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */
499 mr r4,r29 /* Retrieve va */ 491 mr r4,r29 /* Retrieve va */
500 li r7,0 /* !bolted, !secondary */ 492 li r7,0 /* !bolted, !secondary */
501 li r8,MMU_PAGE_4K /* page size */ 493 li r8,MMU_PAGE_4K /* page size */
502 ld r9,STK_PARM(r9)(r1) /* segment size */ 494 ld r9,STK_PARAM(R9)(r1) /* segment size */
503_GLOBAL(htab_call_hpte_insert1) 495_GLOBAL(htab_call_hpte_insert1)
504 bl . /* patched by htab_finish_init() */ 496 bl . /* patched by htab_finish_init() */
505 cmpdi 0,r3,0 497 cmpdi 0,r3,0
@@ -522,11 +514,11 @@ _GLOBAL(htab_call_hpte_insert1)
522 rldicr r3,r0,3,63-3 /* r0 = (~hash & mask) << 3 */ 514 rldicr r3,r0,3,63-3 /* r0 = (~hash & mask) << 3 */
523 515
524 /* Call ppc_md.hpte_insert */ 516 /* Call ppc_md.hpte_insert */
525 ld r6,STK_PARM(r4)(r1) /* Retrieve new pp bits */ 517 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */
526 mr r4,r29 /* Retrieve va */ 518 mr r4,r29 /* Retrieve va */
527 li r7,HPTE_V_SECONDARY /* !bolted, secondary */ 519 li r7,HPTE_V_SECONDARY /* !bolted, secondary */
528 li r8,MMU_PAGE_4K /* page size */ 520 li r8,MMU_PAGE_4K /* page size */
529 ld r9,STK_PARM(r9)(r1) /* segment size */ 521 ld r9,STK_PARAM(R9)(r1) /* segment size */
530_GLOBAL(htab_call_hpte_insert2) 522_GLOBAL(htab_call_hpte_insert2)
531 bl . /* patched by htab_finish_init() */ 523 bl . /* patched by htab_finish_init() */
532 cmpdi 0,r3,0 524 cmpdi 0,r3,0
@@ -559,8 +551,8 @@ htab_inval_old_hpte:
559 mr r4,r31 /* PTE.pte */ 551 mr r4,r31 /* PTE.pte */
560 li r5,0 /* PTE.hidx */ 552 li r5,0 /* PTE.hidx */
561 li r6,MMU_PAGE_64K /* psize */ 553 li r6,MMU_PAGE_64K /* psize */
562 ld r7,STK_PARM(r9)(r1) /* ssize */ 554 ld r7,STK_PARAM(R9)(r1) /* ssize */
563 ld r8,STK_PARM(r8)(r1) /* local */ 555 ld r8,STK_PARAM(R8)(r1) /* local */
564 bl .flush_hash_page 556 bl .flush_hash_page
565 /* Clear out _PAGE_HPTE_SUB bits in the new linux PTE */ 557 /* Clear out _PAGE_HPTE_SUB bits in the new linux PTE */
566 lis r0,_PAGE_HPTE_SUB@h 558 lis r0,_PAGE_HPTE_SUB@h
@@ -576,7 +568,7 @@ htab_pte_insert_ok:
576 /* Insert slot number & secondary bit in PTE second half, 568 /* Insert slot number & secondary bit in PTE second half,
577 * clear _PAGE_BUSY and set approriate HPTE slot bit 569 * clear _PAGE_BUSY and set approriate HPTE slot bit
578 */ 570 */
579 ld r6,STK_PARM(r6)(r1) 571 ld r6,STK_PARAM(R6)(r1)
580 li r0,_PAGE_BUSY 572 li r0,_PAGE_BUSY
581 andc r30,r30,r0 573 andc r30,r30,r0
582 /* HPTE SUB bit */ 574 /* HPTE SUB bit */
@@ -597,13 +589,13 @@ htab_pte_insert_ok:
597 std r30,0(r6) 589 std r30,0(r6)
598 li r3, 0 590 li r3, 0
599htab_bail: 591htab_bail:
600 ld r25,STK_REG(r25)(r1) 592 ld r25,STK_REG(R25)(r1)
601 ld r26,STK_REG(r26)(r1) 593 ld r26,STK_REG(R26)(r1)
602 ld r27,STK_REG(r27)(r1) 594 ld r27,STK_REG(R27)(r1)
603 ld r28,STK_REG(r28)(r1) 595 ld r28,STK_REG(R28)(r1)
604 ld r29,STK_REG(r29)(r1) 596 ld r29,STK_REG(R29)(r1)
605 ld r30,STK_REG(r30)(r1) 597 ld r30,STK_REG(R30)(r1)
606 ld r31,STK_REG(r31)(r1) 598 ld r31,STK_REG(R31)(r1)
607 addi r1,r1,STACKFRAMESIZE 599 addi r1,r1,STACKFRAMESIZE
608 ld r0,16(r1) 600 ld r0,16(r1)
609 mtlr r0 601 mtlr r0
@@ -630,8 +622,8 @@ htab_modify_pte:
630 /* Call ppc_md.hpte_updatepp */ 622 /* Call ppc_md.hpte_updatepp */
631 mr r5,r29 /* va */ 623 mr r5,r29 /* va */
632 li r6,MMU_PAGE_4K /* page size */ 624 li r6,MMU_PAGE_4K /* page size */
633 ld r7,STK_PARM(r9)(r1) /* segment size */ 625 ld r7,STK_PARAM(R9)(r1) /* segment size */
634 ld r8,STK_PARM(r8)(r1) /* get "local" param */ 626 ld r8,STK_PARAM(R8)(r1) /* get "local" param */
635_GLOBAL(htab_call_hpte_updatepp) 627_GLOBAL(htab_call_hpte_updatepp)
636 bl . /* patched by htab_finish_init() */ 628 bl . /* patched by htab_finish_init() */
637 629
@@ -644,7 +636,7 @@ _GLOBAL(htab_call_hpte_updatepp)
644 /* Clear the BUSY bit and Write out the PTE */ 636 /* Clear the BUSY bit and Write out the PTE */
645 li r0,_PAGE_BUSY 637 li r0,_PAGE_BUSY
646 andc r30,r30,r0 638 andc r30,r30,r0
647 ld r6,STK_PARM(r6)(r1) 639 ld r6,STK_PARAM(R6)(r1)
648 std r30,0(r6) 640 std r30,0(r6)
649 li r3,0 641 li r3,0
650 b htab_bail 642 b htab_bail
@@ -657,7 +649,7 @@ htab_wrong_access:
657 649
658htab_pte_insert_failure: 650htab_pte_insert_failure:
659 /* Bail out restoring old PTE */ 651 /* Bail out restoring old PTE */
660 ld r6,STK_PARM(r6)(r1) 652 ld r6,STK_PARAM(R6)(r1)
661 std r31,0(r6) 653 std r31,0(r6)
662 li r3,-1 654 li r3,-1
663 b htab_bail 655 b htab_bail
@@ -677,9 +669,9 @@ _GLOBAL(__hash_page_64K)
677 std r0,16(r1) 669 std r0,16(r1)
678 stdu r1,-STACKFRAMESIZE(r1) 670 stdu r1,-STACKFRAMESIZE(r1)
679 /* Save all params that we need after a function call */ 671 /* Save all params that we need after a function call */
680 std r6,STK_PARM(r6)(r1) 672 std r6,STK_PARAM(R6)(r1)
681 std r8,STK_PARM(r8)(r1) 673 std r8,STK_PARAM(R8)(r1)
682 std r9,STK_PARM(r9)(r1) 674 std r9,STK_PARAM(R9)(r1)
683 675
684 /* Save non-volatile registers. 676 /* Save non-volatile registers.
685 * r31 will hold "old PTE" 677 * r31 will hold "old PTE"
@@ -688,11 +680,11 @@ _GLOBAL(__hash_page_64K)
688 * r28 is a hash value 680 * r28 is a hash value
689 * r27 is hashtab mask (maybe dynamic patched instead ?) 681 * r27 is hashtab mask (maybe dynamic patched instead ?)
690 */ 682 */
691 std r27,STK_REG(r27)(r1) 683 std r27,STK_REG(R27)(r1)
692 std r28,STK_REG(r28)(r1) 684 std r28,STK_REG(R28)(r1)
693 std r29,STK_REG(r29)(r1) 685 std r29,STK_REG(R29)(r1)
694 std r30,STK_REG(r30)(r1) 686 std r30,STK_REG(R30)(r1)
695 std r31,STK_REG(r31)(r1) 687 std r31,STK_REG(R31)(r1)
696 688
697 /* Step 1: 689 /* Step 1:
698 * 690 *
@@ -780,7 +772,7 @@ END_FTR_SECTION(CPU_FTR_NOEXECUTE|CPU_FTR_COHERENT_ICACHE, CPU_FTR_NOEXECUTE)
780 /* At this point, r3 contains new PP bits, save them in 772 /* At this point, r3 contains new PP bits, save them in
781 * place of "access" in the param area (sic) 773 * place of "access" in the param area (sic)
782 */ 774 */
783 std r3,STK_PARM(r4)(r1) 775 std r3,STK_PARAM(R4)(r1)
784 776
785 /* Get htab_hash_mask */ 777 /* Get htab_hash_mask */
786 ld r4,htab_hash_mask@got(2) 778 ld r4,htab_hash_mask@got(2)
@@ -813,11 +805,11 @@ ht64_insert_pte:
813 rldicr r3,r0,3,63-3 /* r0 = (hash & mask) << 3 */ 805 rldicr r3,r0,3,63-3 /* r0 = (hash & mask) << 3 */
814 806
815 /* Call ppc_md.hpte_insert */ 807 /* Call ppc_md.hpte_insert */
816 ld r6,STK_PARM(r4)(r1) /* Retrieve new pp bits */ 808 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */
817 mr r4,r29 /* Retrieve va */ 809 mr r4,r29 /* Retrieve va */
818 li r7,0 /* !bolted, !secondary */ 810 li r7,0 /* !bolted, !secondary */
819 li r8,MMU_PAGE_64K 811 li r8,MMU_PAGE_64K
820 ld r9,STK_PARM(r9)(r1) /* segment size */ 812 ld r9,STK_PARAM(R9)(r1) /* segment size */
821_GLOBAL(ht64_call_hpte_insert1) 813_GLOBAL(ht64_call_hpte_insert1)
822 bl . /* patched by htab_finish_init() */ 814 bl . /* patched by htab_finish_init() */
823 cmpdi 0,r3,0 815 cmpdi 0,r3,0
@@ -836,11 +828,11 @@ _GLOBAL(ht64_call_hpte_insert1)
836 rldicr r3,r0,3,63-3 /* r0 = (~hash & mask) << 3 */ 828 rldicr r3,r0,3,63-3 /* r0 = (~hash & mask) << 3 */
837 829
838 /* Call ppc_md.hpte_insert */ 830 /* Call ppc_md.hpte_insert */
839 ld r6,STK_PARM(r4)(r1) /* Retrieve new pp bits */ 831 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */
840 mr r4,r29 /* Retrieve va */ 832 mr r4,r29 /* Retrieve va */
841 li r7,HPTE_V_SECONDARY /* !bolted, secondary */ 833 li r7,HPTE_V_SECONDARY /* !bolted, secondary */
842 li r8,MMU_PAGE_64K 834 li r8,MMU_PAGE_64K
843 ld r9,STK_PARM(r9)(r1) /* segment size */ 835 ld r9,STK_PARAM(R9)(r1) /* segment size */
844_GLOBAL(ht64_call_hpte_insert2) 836_GLOBAL(ht64_call_hpte_insert2)
845 bl . /* patched by htab_finish_init() */ 837 bl . /* patched by htab_finish_init() */
846 cmpdi 0,r3,0 838 cmpdi 0,r3,0
@@ -876,15 +868,15 @@ ht64_pte_insert_ok:
876 * (maybe add eieio may be good still ?) 868 * (maybe add eieio may be good still ?)
877 */ 869 */
878ht64_write_out_pte: 870ht64_write_out_pte:
879 ld r6,STK_PARM(r6)(r1) 871 ld r6,STK_PARAM(R6)(r1)
880 std r30,0(r6) 872 std r30,0(r6)
881 li r3, 0 873 li r3, 0
882ht64_bail: 874ht64_bail:
883 ld r27,STK_REG(r27)(r1) 875 ld r27,STK_REG(R27)(r1)
884 ld r28,STK_REG(r28)(r1) 876 ld r28,STK_REG(R28)(r1)
885 ld r29,STK_REG(r29)(r1) 877 ld r29,STK_REG(R29)(r1)
886 ld r30,STK_REG(r30)(r1) 878 ld r30,STK_REG(R30)(r1)
887 ld r31,STK_REG(r31)(r1) 879 ld r31,STK_REG(R31)(r1)
888 addi r1,r1,STACKFRAMESIZE 880 addi r1,r1,STACKFRAMESIZE
889 ld r0,16(r1) 881 ld r0,16(r1)
890 mtlr r0 882 mtlr r0
@@ -909,8 +901,8 @@ ht64_modify_pte:
909 /* Call ppc_md.hpte_updatepp */ 901 /* Call ppc_md.hpte_updatepp */
910 mr r5,r29 /* va */ 902 mr r5,r29 /* va */
911 li r6,MMU_PAGE_64K 903 li r6,MMU_PAGE_64K
912 ld r7,STK_PARM(r9)(r1) /* segment size */ 904 ld r7,STK_PARAM(R9)(r1) /* segment size */
913 ld r8,STK_PARM(r8)(r1) /* get "local" param */ 905 ld r8,STK_PARAM(R8)(r1) /* get "local" param */
914_GLOBAL(ht64_call_hpte_updatepp) 906_GLOBAL(ht64_call_hpte_updatepp)
915 bl . /* patched by htab_finish_init() */ 907 bl . /* patched by htab_finish_init() */
916 908
@@ -933,7 +925,7 @@ ht64_wrong_access:
933 925
934ht64_pte_insert_failure: 926ht64_pte_insert_failure:
935 /* Bail out restoring old PTE */ 927 /* Bail out restoring old PTE */
936 ld r6,STK_PARM(r6)(r1) 928 ld r6,STK_PARAM(R6)(r1)
937 std r31,0(r6) 929 std r31,0(r6)
938 li r3,-1 930 li r3,-1
939 b ht64_bail 931 b ht64_bail
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index b6edbb3b4a54..39b159751c35 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -340,6 +340,8 @@ static int __init find_min_common_depth(void)
340 dbg("Using form 1 affinity\n"); 340 dbg("Using form 1 affinity\n");
341 form1_affinity = 1; 341 form1_affinity = 1;
342 } 342 }
343
344 of_node_put(chosen);
343 } 345 }
344 } 346 }
345 347
@@ -635,11 +637,11 @@ static inline int __init read_usm_ranges(const u32 **usm)
635 */ 637 */
636static void __init parse_drconf_memory(struct device_node *memory) 638static void __init parse_drconf_memory(struct device_node *memory)
637{ 639{
638 const u32 *dm, *usm; 640 const u32 *uninitialized_var(dm), *usm;
639 unsigned int n, rc, ranges, is_kexec_kdump = 0; 641 unsigned int n, rc, ranges, is_kexec_kdump = 0;
640 unsigned long lmb_size, base, size, sz; 642 unsigned long lmb_size, base, size, sz;
641 int nid; 643 int nid;
642 struct assoc_arrays aa; 644 struct assoc_arrays aa = { .arrays = NULL };
643 645
644 n = of_get_drconf_memory(memory, &dm); 646 n = of_get_drconf_memory(memory, &dm);
645 if (!n) 647 if (!n)
diff --git a/arch/powerpc/mm/tlb_low_64e.S b/arch/powerpc/mm/tlb_low_64e.S
index ff672bd8fea9..f09d48e3268d 100644
--- a/arch/powerpc/mm/tlb_low_64e.S
+++ b/arch/powerpc/mm/tlb_low_64e.S
@@ -126,7 +126,7 @@ BEGIN_MMU_FTR_SECTION
126 /* Set the TLB reservation and search for existing entry. Then load 126 /* Set the TLB reservation and search for existing entry. Then load
127 * the entry. 127 * the entry.
128 */ 128 */
129 PPC_TLBSRX_DOT(0,r16) 129 PPC_TLBSRX_DOT(0,R16)
130 ldx r14,r14,r15 /* grab pgd entry */ 130 ldx r14,r14,r15 /* grab pgd entry */
131 beq normal_tlb_miss_done /* tlb exists already, bail */ 131 beq normal_tlb_miss_done /* tlb exists already, bail */
132MMU_FTR_SECTION_ELSE 132MMU_FTR_SECTION_ELSE
@@ -395,7 +395,7 @@ BEGIN_MMU_FTR_SECTION
395 /* Set the TLB reservation and search for existing entry. Then load 395 /* Set the TLB reservation and search for existing entry. Then load
396 * the entry. 396 * the entry.
397 */ 397 */
398 PPC_TLBSRX_DOT(0,r16) 398 PPC_TLBSRX_DOT(0,R16)
399 ld r14,0(r10) 399 ld r14,0(r10)
400 beq normal_tlb_miss_done 400 beq normal_tlb_miss_done
401MMU_FTR_SECTION_ELSE 401MMU_FTR_SECTION_ELSE
@@ -528,7 +528,7 @@ BEGIN_MMU_FTR_SECTION
528 /* Search if we already have a TLB entry for that virtual address, and 528 /* Search if we already have a TLB entry for that virtual address, and
529 * if we do, bail out. 529 * if we do, bail out.
530 */ 530 */
531 PPC_TLBSRX_DOT(0,r16) 531 PPC_TLBSRX_DOT(0,R16)
532 beq virt_page_table_tlb_miss_done 532 beq virt_page_table_tlb_miss_done
533END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_TLBRSRV) 533END_MMU_FTR_SECTION_IFSET(MMU_FTR_USE_TLBRSRV)
534 534
@@ -779,7 +779,7 @@ htw_tlb_miss:
779 * 779 *
780 * MAS1:IND should be already set based on MAS4 780 * MAS1:IND should be already set based on MAS4
781 */ 781 */
782 PPC_TLBSRX_DOT(0,r16) 782 PPC_TLBSRX_DOT(0,R16)
783 beq htw_tlb_miss_done 783 beq htw_tlb_miss_done
784 784
785 /* Now, we need to walk the page tables. First check if we are in 785 /* Now, we need to walk the page tables. First check if we are in
@@ -919,7 +919,7 @@ tlb_load_linear:
919 mtspr SPRN_MAS1,r15 919 mtspr SPRN_MAS1,r15
920 920
921 /* Already somebody there ? */ 921 /* Already somebody there ? */
922 PPC_TLBSRX_DOT(0,r16) 922 PPC_TLBSRX_DOT(0,R16)
923 beq tlb_load_linear_done 923 beq tlb_load_linear_done
924 924
925 /* Now we build the remaining MAS. MAS0 and 2 should be fine 925 /* Now we build the remaining MAS. MAS0 and 2 should be fine
diff --git a/arch/powerpc/mm/tlb_nohash_low.S b/arch/powerpc/mm/tlb_nohash_low.S
index 7c63c0ed4f1b..fab919fd1384 100644
--- a/arch/powerpc/mm/tlb_nohash_low.S
+++ b/arch/powerpc/mm/tlb_nohash_low.S
@@ -266,7 +266,7 @@ BEGIN_MMU_FTR_SECTION
266 andi. r3,r3,MMUCSR0_TLBFI@l 266 andi. r3,r3,MMUCSR0_TLBFI@l
267 bne 1b 267 bne 1b
268MMU_FTR_SECTION_ELSE 268MMU_FTR_SECTION_ELSE
269 PPC_TLBILX_ALL(0,0) 269 PPC_TLBILX_ALL(0,R0)
270ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_USE_TLBILX) 270ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_USE_TLBILX)
271 msync 271 msync
272 isync 272 isync
@@ -279,7 +279,7 @@ BEGIN_MMU_FTR_SECTION
279 wrteei 0 279 wrteei 0
280 mfspr r4,SPRN_MAS6 /* save MAS6 */ 280 mfspr r4,SPRN_MAS6 /* save MAS6 */
281 mtspr SPRN_MAS6,r3 281 mtspr SPRN_MAS6,r3
282 PPC_TLBILX_PID(0,0) 282 PPC_TLBILX_PID(0,R0)
283 mtspr SPRN_MAS6,r4 /* restore MAS6 */ 283 mtspr SPRN_MAS6,r4 /* restore MAS6 */
284 wrtee r10 284 wrtee r10
285MMU_FTR_SECTION_ELSE 285MMU_FTR_SECTION_ELSE
@@ -313,7 +313,7 @@ BEGIN_MMU_FTR_SECTION
313 mtspr SPRN_MAS1,r4 313 mtspr SPRN_MAS1,r4
314 tlbwe 314 tlbwe
315MMU_FTR_SECTION_ELSE 315MMU_FTR_SECTION_ELSE
316 PPC_TLBILX_VA(0,r3) 316 PPC_TLBILX_VA(0,R3)
317ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_USE_TLBILX) 317ALT_MMU_FTR_SECTION_END_IFCLR(MMU_FTR_USE_TLBILX)
318 msync 318 msync
319 isync 319 isync
@@ -331,7 +331,7 @@ _GLOBAL(_tlbil_pid)
331 mfmsr r10 331 mfmsr r10
332 wrteei 0 332 wrteei 0
333 mtspr SPRN_MAS6,r4 333 mtspr SPRN_MAS6,r4
334 PPC_TLBILX_PID(0,0) 334 PPC_TLBILX_PID(0,R0)
335 wrtee r10 335 wrtee r10
336 msync 336 msync
337 isync 337 isync
@@ -343,14 +343,14 @@ _GLOBAL(_tlbil_pid_noind)
343 ori r4,r4,MAS6_SIND 343 ori r4,r4,MAS6_SIND
344 wrteei 0 344 wrteei 0
345 mtspr SPRN_MAS6,r4 345 mtspr SPRN_MAS6,r4
346 PPC_TLBILX_PID(0,0) 346 PPC_TLBILX_PID(0,R0)
347 wrtee r10 347 wrtee r10
348 msync 348 msync
349 isync 349 isync
350 blr 350 blr
351 351
352_GLOBAL(_tlbil_all) 352_GLOBAL(_tlbil_all)
353 PPC_TLBILX_ALL(0,0) 353 PPC_TLBILX_ALL(0,R0)
354 msync 354 msync
355 isync 355 isync
356 blr 356 blr
@@ -364,7 +364,7 @@ _GLOBAL(_tlbil_va)
364 beq 1f 364 beq 1f
365 rlwimi r4,r6,MAS6_SIND_SHIFT,MAS6_SIND 365 rlwimi r4,r6,MAS6_SIND_SHIFT,MAS6_SIND
3661: mtspr SPRN_MAS6,r4 /* assume AS=0 for now */ 3661: mtspr SPRN_MAS6,r4 /* assume AS=0 for now */
367 PPC_TLBILX_VA(0,r3) 367 PPC_TLBILX_VA(0,R3)
368 msync 368 msync
369 isync 369 isync
370 wrtee r10 370 wrtee r10
@@ -379,7 +379,7 @@ _GLOBAL(_tlbivax_bcast)
379 beq 1f 379 beq 1f
380 rlwimi r4,r6,MAS6_SIND_SHIFT,MAS6_SIND 380 rlwimi r4,r6,MAS6_SIND_SHIFT,MAS6_SIND
3811: mtspr SPRN_MAS6,r4 /* assume AS=0 for now */ 3811: mtspr SPRN_MAS6,r4 /* assume AS=0 for now */
382 PPC_TLBIVAX(0,r3) 382 PPC_TLBIVAX(0,R3)
383 eieio 383 eieio
384 tlbsync 384 tlbsync
385 sync 385 sync
diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
index 5c3cf2d04e41..1fc8109bf2f9 100644
--- a/arch/powerpc/net/bpf_jit.h
+++ b/arch/powerpc/net/bpf_jit.h
@@ -75,23 +75,23 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
75#define PPC_NOP() EMIT(PPC_INST_NOP) 75#define PPC_NOP() EMIT(PPC_INST_NOP)
76#define PPC_BLR() EMIT(PPC_INST_BLR) 76#define PPC_BLR() EMIT(PPC_INST_BLR)
77#define PPC_BLRL() EMIT(PPC_INST_BLRL) 77#define PPC_BLRL() EMIT(PPC_INST_BLRL)
78#define PPC_MTLR(r) EMIT(PPC_INST_MTLR | __PPC_RT(r)) 78#define PPC_MTLR(r) EMIT(PPC_INST_MTLR | ___PPC_RT(r))
79#define PPC_ADDI(d, a, i) EMIT(PPC_INST_ADDI | __PPC_RT(d) | \ 79#define PPC_ADDI(d, a, i) EMIT(PPC_INST_ADDI | ___PPC_RT(d) | \
80 __PPC_RA(a) | IMM_L(i)) 80 ___PPC_RA(a) | IMM_L(i))
81#define PPC_MR(d, a) PPC_OR(d, a, a) 81#define PPC_MR(d, a) PPC_OR(d, a, a)
82#define PPC_LI(r, i) PPC_ADDI(r, 0, i) 82#define PPC_LI(r, i) PPC_ADDI(r, 0, i)
83#define PPC_ADDIS(d, a, i) EMIT(PPC_INST_ADDIS | \ 83#define PPC_ADDIS(d, a, i) EMIT(PPC_INST_ADDIS | \
84 __PPC_RS(d) | __PPC_RA(a) | IMM_L(i)) 84 ___PPC_RS(d) | ___PPC_RA(a) | IMM_L(i))
85#define PPC_LIS(r, i) PPC_ADDIS(r, 0, i) 85#define PPC_LIS(r, i) PPC_ADDIS(r, 0, i)
86#define PPC_STD(r, base, i) EMIT(PPC_INST_STD | __PPC_RS(r) | \ 86#define PPC_STD(r, base, i) EMIT(PPC_INST_STD | ___PPC_RS(r) | \
87 __PPC_RA(base) | ((i) & 0xfffc)) 87 ___PPC_RA(base) | ((i) & 0xfffc))
88 88
89#define PPC_LD(r, base, i) EMIT(PPC_INST_LD | __PPC_RT(r) | \ 89#define PPC_LD(r, base, i) EMIT(PPC_INST_LD | ___PPC_RT(r) | \
90 __PPC_RA(base) | IMM_L(i)) 90 ___PPC_RA(base) | IMM_L(i))
91#define PPC_LWZ(r, base, i) EMIT(PPC_INST_LWZ | __PPC_RT(r) | \ 91#define PPC_LWZ(r, base, i) EMIT(PPC_INST_LWZ | ___PPC_RT(r) | \
92 __PPC_RA(base) | IMM_L(i)) 92 ___PPC_RA(base) | IMM_L(i))
93#define PPC_LHZ(r, base, i) EMIT(PPC_INST_LHZ | __PPC_RT(r) | \ 93#define PPC_LHZ(r, base, i) EMIT(PPC_INST_LHZ | ___PPC_RT(r) | \
94 __PPC_RA(base) | IMM_L(i)) 94 ___PPC_RA(base) | IMM_L(i))
95/* Convenience helpers for the above with 'far' offsets: */ 95/* Convenience helpers for the above with 'far' offsets: */
96#define PPC_LD_OFFS(r, base, i) do { if ((i) < 32768) PPC_LD(r, base, i); \ 96#define PPC_LD_OFFS(r, base, i) do { if ((i) < 32768) PPC_LD(r, base, i); \
97 else { PPC_ADDIS(r, base, IMM_HA(i)); \ 97 else { PPC_ADDIS(r, base, IMM_HA(i)); \
@@ -105,52 +105,52 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
105 else { PPC_ADDIS(r, base, IMM_HA(i)); \ 105 else { PPC_ADDIS(r, base, IMM_HA(i)); \
106 PPC_LHZ(r, r, IMM_L(i)); } } while(0) 106 PPC_LHZ(r, r, IMM_L(i)); } } while(0)
107 107
108#define PPC_CMPWI(a, i) EMIT(PPC_INST_CMPWI | __PPC_RA(a) | IMM_L(i)) 108#define PPC_CMPWI(a, i) EMIT(PPC_INST_CMPWI | ___PPC_RA(a) | IMM_L(i))
109#define PPC_CMPDI(a, i) EMIT(PPC_INST_CMPDI | __PPC_RA(a) | IMM_L(i)) 109#define PPC_CMPDI(a, i) EMIT(PPC_INST_CMPDI | ___PPC_RA(a) | IMM_L(i))
110#define PPC_CMPLWI(a, i) EMIT(PPC_INST_CMPLWI | __PPC_RA(a) | IMM_L(i)) 110#define PPC_CMPLWI(a, i) EMIT(PPC_INST_CMPLWI | ___PPC_RA(a) | IMM_L(i))
111#define PPC_CMPLW(a, b) EMIT(PPC_INST_CMPLW | __PPC_RA(a) | __PPC_RB(b)) 111#define PPC_CMPLW(a, b) EMIT(PPC_INST_CMPLW | ___PPC_RA(a) | ___PPC_RB(b))
112 112
113#define PPC_SUB(d, a, b) EMIT(PPC_INST_SUB | __PPC_RT(d) | \ 113#define PPC_SUB(d, a, b) EMIT(PPC_INST_SUB | ___PPC_RT(d) | \
114 __PPC_RB(a) | __PPC_RA(b)) 114 ___PPC_RB(a) | ___PPC_RA(b))
115#define PPC_ADD(d, a, b) EMIT(PPC_INST_ADD | __PPC_RT(d) | \ 115#define PPC_ADD(d, a, b) EMIT(PPC_INST_ADD | ___PPC_RT(d) | \
116 __PPC_RA(a) | __PPC_RB(b)) 116 ___PPC_RA(a) | ___PPC_RB(b))
117#define PPC_MUL(d, a, b) EMIT(PPC_INST_MULLW | __PPC_RT(d) | \ 117#define PPC_MUL(d, a, b) EMIT(PPC_INST_MULLW | ___PPC_RT(d) | \
118 __PPC_RA(a) | __PPC_RB(b)) 118 ___PPC_RA(a) | ___PPC_RB(b))
119#define PPC_MULHWU(d, a, b) EMIT(PPC_INST_MULHWU | __PPC_RT(d) | \ 119#define PPC_MULHWU(d, a, b) EMIT(PPC_INST_MULHWU | ___PPC_RT(d) | \
120 __PPC_RA(a) | __PPC_RB(b)) 120 ___PPC_RA(a) | ___PPC_RB(b))
121#define PPC_MULI(d, a, i) EMIT(PPC_INST_MULLI | __PPC_RT(d) | \ 121#define PPC_MULI(d, a, i) EMIT(PPC_INST_MULLI | ___PPC_RT(d) | \
122 __PPC_RA(a) | IMM_L(i)) 122 ___PPC_RA(a) | IMM_L(i))
123#define PPC_DIVWU(d, a, b) EMIT(PPC_INST_DIVWU | __PPC_RT(d) | \ 123#define PPC_DIVWU(d, a, b) EMIT(PPC_INST_DIVWU | ___PPC_RT(d) | \
124 __PPC_RA(a) | __PPC_RB(b)) 124 ___PPC_RA(a) | ___PPC_RB(b))
125#define PPC_AND(d, a, b) EMIT(PPC_INST_AND | __PPC_RA(d) | \ 125#define PPC_AND(d, a, b) EMIT(PPC_INST_AND | ___PPC_RA(d) | \
126 __PPC_RS(a) | __PPC_RB(b)) 126 ___PPC_RS(a) | ___PPC_RB(b))
127#define PPC_ANDI(d, a, i) EMIT(PPC_INST_ANDI | __PPC_RA(d) | \ 127#define PPC_ANDI(d, a, i) EMIT(PPC_INST_ANDI | ___PPC_RA(d) | \
128 __PPC_RS(a) | IMM_L(i)) 128 ___PPC_RS(a) | IMM_L(i))
129#define PPC_AND_DOT(d, a, b) EMIT(PPC_INST_ANDDOT | __PPC_RA(d) | \ 129#define PPC_AND_DOT(d, a, b) EMIT(PPC_INST_ANDDOT | ___PPC_RA(d) | \
130 __PPC_RS(a) | __PPC_RB(b)) 130 ___PPC_RS(a) | ___PPC_RB(b))
131#define PPC_OR(d, a, b) EMIT(PPC_INST_OR | __PPC_RA(d) | \ 131#define PPC_OR(d, a, b) EMIT(PPC_INST_OR | ___PPC_RA(d) | \
132 __PPC_RS(a) | __PPC_RB(b)) 132 ___PPC_RS(a) | ___PPC_RB(b))
133#define PPC_ORI(d, a, i) EMIT(PPC_INST_ORI | __PPC_RA(d) | \ 133#define PPC_ORI(d, a, i) EMIT(PPC_INST_ORI | ___PPC_RA(d) | \
134 __PPC_RS(a) | IMM_L(i)) 134 ___PPC_RS(a) | IMM_L(i))
135#define PPC_ORIS(d, a, i) EMIT(PPC_INST_ORIS | __PPC_RA(d) | \ 135#define PPC_ORIS(d, a, i) EMIT(PPC_INST_ORIS | ___PPC_RA(d) | \
136 __PPC_RS(a) | IMM_L(i)) 136 ___PPC_RS(a) | IMM_L(i))
137#define PPC_SLW(d, a, s) EMIT(PPC_INST_SLW | __PPC_RA(d) | \ 137#define PPC_SLW(d, a, s) EMIT(PPC_INST_SLW | ___PPC_RA(d) | \
138 __PPC_RS(a) | __PPC_RB(s)) 138 ___PPC_RS(a) | ___PPC_RB(s))
139#define PPC_SRW(d, a, s) EMIT(PPC_INST_SRW | __PPC_RA(d) | \ 139#define PPC_SRW(d, a, s) EMIT(PPC_INST_SRW | ___PPC_RA(d) | \
140 __PPC_RS(a) | __PPC_RB(s)) 140 ___PPC_RS(a) | ___PPC_RB(s))
141/* slwi = rlwinm Rx, Ry, n, 0, 31-n */ 141/* slwi = rlwinm Rx, Ry, n, 0, 31-n */
142#define PPC_SLWI(d, a, i) EMIT(PPC_INST_RLWINM | __PPC_RA(d) | \ 142#define PPC_SLWI(d, a, i) EMIT(PPC_INST_RLWINM | ___PPC_RA(d) | \
143 __PPC_RS(a) | __PPC_SH(i) | \ 143 ___PPC_RS(a) | __PPC_SH(i) | \
144 __PPC_MB(0) | __PPC_ME(31-(i))) 144 __PPC_MB(0) | __PPC_ME(31-(i)))
145/* srwi = rlwinm Rx, Ry, 32-n, n, 31 */ 145/* srwi = rlwinm Rx, Ry, 32-n, n, 31 */
146#define PPC_SRWI(d, a, i) EMIT(PPC_INST_RLWINM | __PPC_RA(d) | \ 146#define PPC_SRWI(d, a, i) EMIT(PPC_INST_RLWINM | ___PPC_RA(d) | \
147 __PPC_RS(a) | __PPC_SH(32-(i)) | \ 147 ___PPC_RS(a) | __PPC_SH(32-(i)) | \
148 __PPC_MB(i) | __PPC_ME(31)) 148 __PPC_MB(i) | __PPC_ME(31))
149/* sldi = rldicr Rx, Ry, n, 63-n */ 149/* sldi = rldicr Rx, Ry, n, 63-n */
150#define PPC_SLDI(d, a, i) EMIT(PPC_INST_RLDICR | __PPC_RA(d) | \ 150#define PPC_SLDI(d, a, i) EMIT(PPC_INST_RLDICR | ___PPC_RA(d) | \
151 __PPC_RS(a) | __PPC_SH(i) | \ 151 ___PPC_RS(a) | __PPC_SH(i) | \
152 __PPC_MB(63-(i)) | (((i) & 0x20) >> 4)) 152 __PPC_MB(63-(i)) | (((i) & 0x20) >> 4))
153#define PPC_NEG(d, a) EMIT(PPC_INST_NEG | __PPC_RT(d) | __PPC_RA(a)) 153#define PPC_NEG(d, a) EMIT(PPC_INST_NEG | ___PPC_RT(d) | ___PPC_RA(a))
154 154
155/* Long jump; (unconditional 'branch') */ 155/* Long jump; (unconditional 'branch') */
156#define PPC_JMP(dest) EMIT(PPC_INST_BRANCH | \ 156#define PPC_JMP(dest) EMIT(PPC_INST_BRANCH | \
diff --git a/arch/powerpc/net/bpf_jit_64.S b/arch/powerpc/net/bpf_jit_64.S
index 55ba3855a97f..7d3a3b5619a2 100644
--- a/arch/powerpc/net/bpf_jit_64.S
+++ b/arch/powerpc/net/bpf_jit_64.S
@@ -105,6 +105,7 @@ sk_load_byte_msh_positive_offset:
105 mr r4, r_addr; \ 105 mr r4, r_addr; \
106 li r6, SIZE; \ 106 li r6, SIZE; \
107 bl skb_copy_bits; \ 107 bl skb_copy_bits; \
108 nop; \
108 /* R3 = 0 on success */ \ 109 /* R3 = 0 on success */ \
109 addi r1, r1, BPF_PPC_SLOWPATH_FRAME; \ 110 addi r1, r1, BPF_PPC_SLOWPATH_FRAME; \
110 ld r0, 16(r1); \ 111 ld r0, 16(r1); \
@@ -156,6 +157,7 @@ bpf_slow_path_byte_msh:
156 mr r4, r_addr; \ 157 mr r4, r_addr; \
157 li r5, SIZE; \ 158 li r5, SIZE; \
158 bl bpf_internal_load_pointer_neg_helper; \ 159 bl bpf_internal_load_pointer_neg_helper; \
160 nop; \
159 /* R3 != 0 on success */ \ 161 /* R3 != 0 on success */ \
160 addi r1, r1, BPF_PPC_SLOWPATH_FRAME; \ 162 addi r1, r1, BPF_PPC_SLOWPATH_FRAME; \
161 ld r0, 16(r1); \ 163 ld r0, 16(r1); \
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 2dc8b1484845..dd1130642d07 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -39,7 +39,7 @@ static void bpf_jit_build_prologue(struct sk_filter *fp, u32 *image,
39 /* Make stackframe */ 39 /* Make stackframe */
40 if (ctx->seen & SEEN_DATAREF) { 40 if (ctx->seen & SEEN_DATAREF) {
41 /* If we call any helpers (for loads), save LR */ 41 /* If we call any helpers (for loads), save LR */
42 EMIT(PPC_INST_MFLR | __PPC_RT(0)); 42 EMIT(PPC_INST_MFLR | __PPC_RT(R0));
43 PPC_STD(0, 1, 16); 43 PPC_STD(0, 1, 16);
44 44
45 /* Back up non-volatile regs. */ 45 /* Back up non-volatile regs. */
@@ -56,7 +56,7 @@ static void bpf_jit_build_prologue(struct sk_filter *fp, u32 *image,
56 PPC_STD(i, 1, -(8*(32-i))); 56 PPC_STD(i, 1, -(8*(32-i)));
57 } 57 }
58 } 58 }
59 EMIT(PPC_INST_STDU | __PPC_RS(1) | __PPC_RA(1) | 59 EMIT(PPC_INST_STDU | __PPC_RS(R1) | __PPC_RA(R1) |
60 (-BPF_PPC_STACKFRAME & 0xfffc)); 60 (-BPF_PPC_STACKFRAME & 0xfffc));
61 } 61 }
62 62
diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c
index e8a18d1cc7c9..74d1e780748b 100644
--- a/arch/powerpc/perf/callchain.c
+++ b/arch/powerpc/perf/callchain.c
@@ -57,7 +57,7 @@ perf_callchain_kernel(struct perf_callchain_entry *entry, struct pt_regs *regs)
57 57
58 lr = regs->link; 58 lr = regs->link;
59 sp = regs->gpr[1]; 59 sp = regs->gpr[1];
60 perf_callchain_store(entry, regs->nip); 60 perf_callchain_store(entry, perf_instruction_pointer(regs));
61 61
62 if (!validate_sp(sp, current, STACK_FRAME_OVERHEAD)) 62 if (!validate_sp(sp, current, STACK_FRAME_OVERHEAD))
63 return; 63 return;
@@ -238,7 +238,7 @@ static void perf_callchain_user_64(struct perf_callchain_entry *entry,
238 struct signal_frame_64 __user *sigframe; 238 struct signal_frame_64 __user *sigframe;
239 unsigned long __user *fp, *uregs; 239 unsigned long __user *fp, *uregs;
240 240
241 next_ip = regs->nip; 241 next_ip = perf_instruction_pointer(regs);
242 lr = regs->link; 242 lr = regs->link;
243 sp = regs->gpr[1]; 243 sp = regs->gpr[1];
244 perf_callchain_store(entry, next_ip); 244 perf_callchain_store(entry, next_ip);
@@ -444,7 +444,7 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry,
444 long level = 0; 444 long level = 0;
445 unsigned int __user *fp, *uregs; 445 unsigned int __user *fp, *uregs;
446 446
447 next_ip = regs->nip; 447 next_ip = perf_instruction_pointer(regs);
448 lr = regs->link; 448 lr = regs->link;
449 sp = regs->gpr[1]; 449 sp = regs->gpr[1];
450 perf_callchain_store(entry, next_ip); 450 perf_callchain_store(entry, next_ip);
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 8f84bcba18da..77b49ddda9d3 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -73,7 +73,10 @@ static inline u32 perf_get_misc_flags(struct pt_regs *regs)
73{ 73{
74 return 0; 74 return 0;
75} 75}
76static inline void perf_read_regs(struct pt_regs *regs) { } 76static inline void perf_read_regs(struct pt_regs *regs)
77{
78 regs->result = 0;
79}
77static inline int perf_intr_is_nmi(struct pt_regs *regs) 80static inline int perf_intr_is_nmi(struct pt_regs *regs)
78{ 81{
79 return 0; 82 return 0;
@@ -116,6 +119,26 @@ static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp)
116 *addrp = mfspr(SPRN_SDAR); 119 *addrp = mfspr(SPRN_SDAR);
117} 120}
118 121
122static bool mmcra_sihv(unsigned long mmcra)
123{
124 unsigned long sihv = MMCRA_SIHV;
125
126 if (ppmu->flags & PPMU_ALT_SIPR)
127 sihv = POWER6_MMCRA_SIHV;
128
129 return !!(mmcra & sihv);
130}
131
132static bool mmcra_sipr(unsigned long mmcra)
133{
134 unsigned long sipr = MMCRA_SIPR;
135
136 if (ppmu->flags & PPMU_ALT_SIPR)
137 sipr = POWER6_MMCRA_SIPR;
138
139 return !!(mmcra & sipr);
140}
141
119static inline u32 perf_flags_from_msr(struct pt_regs *regs) 142static inline u32 perf_flags_from_msr(struct pt_regs *regs)
120{ 143{
121 if (regs->msr & MSR_PR) 144 if (regs->msr & MSR_PR)
@@ -128,19 +151,9 @@ static inline u32 perf_flags_from_msr(struct pt_regs *regs)
128static inline u32 perf_get_misc_flags(struct pt_regs *regs) 151static inline u32 perf_get_misc_flags(struct pt_regs *regs)
129{ 152{
130 unsigned long mmcra = regs->dsisr; 153 unsigned long mmcra = regs->dsisr;
131 unsigned long sihv = MMCRA_SIHV; 154 unsigned long use_siar = regs->result;
132 unsigned long sipr = MMCRA_SIPR;
133 155
134 /* Not a PMU interrupt: Make up flags from regs->msr */ 156 if (!use_siar)
135 if (TRAP(regs) != 0xf00)
136 return perf_flags_from_msr(regs);
137
138 /*
139 * If we don't support continuous sampling and this
140 * is not a marked event, same deal
141 */
142 if ((ppmu->flags & PPMU_NO_CONT_SAMPLING) &&
143 !(mmcra & MMCRA_SAMPLE_ENABLE))
144 return perf_flags_from_msr(regs); 157 return perf_flags_from_msr(regs);
145 158
146 /* 159 /*
@@ -156,15 +169,10 @@ static inline u32 perf_get_misc_flags(struct pt_regs *regs)
156 return PERF_RECORD_MISC_USER; 169 return PERF_RECORD_MISC_USER;
157 } 170 }
158 171
159 if (ppmu->flags & PPMU_ALT_SIPR) {
160 sihv = POWER6_MMCRA_SIHV;
161 sipr = POWER6_MMCRA_SIPR;
162 }
163
164 /* PR has priority over HV, so order below is important */ 172 /* PR has priority over HV, so order below is important */
165 if (mmcra & sipr) 173 if (mmcra_sipr(mmcra))
166 return PERF_RECORD_MISC_USER; 174 return PERF_RECORD_MISC_USER;
167 if ((mmcra & sihv) && (freeze_events_kernel != MMCR0_FCHV)) 175 if (mmcra_sihv(mmcra) && (freeze_events_kernel != MMCR0_FCHV))
168 return PERF_RECORD_MISC_HYPERVISOR; 176 return PERF_RECORD_MISC_HYPERVISOR;
169 return PERF_RECORD_MISC_KERNEL; 177 return PERF_RECORD_MISC_KERNEL;
170} 178}
@@ -172,10 +180,45 @@ static inline u32 perf_get_misc_flags(struct pt_regs *regs)
172/* 180/*
173 * Overload regs->dsisr to store MMCRA so we only need to read it once 181 * Overload regs->dsisr to store MMCRA so we only need to read it once
174 * on each interrupt. 182 * on each interrupt.
183 * Overload regs->result to specify whether we should use the MSR (result
184 * is zero) or the SIAR (result is non zero).
175 */ 185 */
176static inline void perf_read_regs(struct pt_regs *regs) 186static inline void perf_read_regs(struct pt_regs *regs)
177{ 187{
178 regs->dsisr = mfspr(SPRN_MMCRA); 188 unsigned long mmcra = mfspr(SPRN_MMCRA);
189 int marked = mmcra & MMCRA_SAMPLE_ENABLE;
190 int use_siar;
191
192 /*
193 * If this isn't a PMU exception (eg a software event) the SIAR is
194 * not valid. Use pt_regs.
195 *
196 * If it is a marked event use the SIAR.
197 *
198 * If the PMU doesn't update the SIAR for non marked events use
199 * pt_regs.
200 *
201 * If the PMU has HV/PR flags then check to see if they
202 * place the exception in userspace. If so, use pt_regs. In
203 * continuous sampling mode the SIAR and the PMU exception are
204 * not synchronised, so they may be many instructions apart.
205 * This can result in confusing backtraces. We still want
206 * hypervisor samples as well as samples in the kernel with
207 * interrupts off hence the userspace check.
208 */
209 if (TRAP(regs) != 0xf00)
210 use_siar = 0;
211 else if (marked)
212 use_siar = 1;
213 else if ((ppmu->flags & PPMU_NO_CONT_SAMPLING))
214 use_siar = 0;
215 else if (!(ppmu->flags & PPMU_NO_SIPR) && mmcra_sipr(mmcra))
216 use_siar = 0;
217 else
218 use_siar = 1;
219
220 regs->dsisr = mmcra;
221 regs->result = use_siar;
179} 222}
180 223
181/* 224/*
@@ -1329,18 +1372,12 @@ unsigned long perf_misc_flags(struct pt_regs *regs)
1329 */ 1372 */
1330unsigned long perf_instruction_pointer(struct pt_regs *regs) 1373unsigned long perf_instruction_pointer(struct pt_regs *regs)
1331{ 1374{
1332 unsigned long mmcra = regs->dsisr; 1375 unsigned long use_siar = regs->result;
1333 1376
1334 /* Not a PMU interrupt */ 1377 if (use_siar)
1335 if (TRAP(regs) != 0xf00) 1378 return mfspr(SPRN_SIAR) + perf_ip_adjust(regs);
1336 return regs->nip; 1379 else
1337
1338 /* Processor doesn't support sampling non marked events */
1339 if ((ppmu->flags & PPMU_NO_CONT_SAMPLING) &&
1340 !(mmcra & MMCRA_SAMPLE_ENABLE))
1341 return regs->nip; 1380 return regs->nip;
1342
1343 return mfspr(SPRN_SIAR) + perf_ip_adjust(regs);
1344} 1381}
1345 1382
1346static bool pmc_overflow(unsigned long val) 1383static bool pmc_overflow(unsigned long val)
diff --git a/arch/powerpc/platforms/44x/currituck.c b/arch/powerpc/platforms/44x/currituck.c
index 583e67fee37e..9f6c33d63a42 100644
--- a/arch/powerpc/platforms/44x/currituck.c
+++ b/arch/powerpc/platforms/44x/currituck.c
@@ -160,7 +160,7 @@ static void __init ppc47x_setup_arch(void)
160 /* No need to check the DMA config as we /know/ our windows are all of 160 /* No need to check the DMA config as we /know/ our windows are all of
161 * RAM. Lets hope that doesn't change */ 161 * RAM. Lets hope that doesn't change */
162#ifdef CONFIG_SWIOTLB 162#ifdef CONFIG_SWIOTLB
163 if (memblock_end_of_DRAM() > 0xffffffff) { 163 if ((memblock_end_of_DRAM() - 1) > 0xffffffff) {
164 ppc_swiotlb_enable = 1; 164 ppc_swiotlb_enable = 1;
165 set_pci_dma_ops(&swiotlb_dma_ops); 165 set_pci_dma_ops(&swiotlb_dma_ops);
166 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 166 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/82xx/km82xx.c b/arch/powerpc/platforms/82xx/km82xx.c
index 3661bcdc326a..cf964e19573a 100644
--- a/arch/powerpc/platforms/82xx/km82xx.c
+++ b/arch/powerpc/platforms/82xx/km82xx.c
@@ -128,6 +128,11 @@ static __initdata struct cpm_pin km82xx_pins[] = {
128 {3, 23, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, /* TXP */ 128 {3, 23, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, /* TXP */
129 {3, 24, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, /* TXN */ 129 {3, 24, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, /* TXN */
130 {3, 25, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* RXD */ 130 {3, 25, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* RXD */
131
132 /* SPI */
133 {3, 16, CPM_PIN_INPUT | CPM_PIN_SECONDARY},/* SPI_MISO PD16 */
134 {3, 17, CPM_PIN_INPUT | CPM_PIN_SECONDARY},/* SPI_MOSI PD17 */
135 {3, 18, CPM_PIN_INPUT | CPM_PIN_SECONDARY},/* SPI_CLK PD18 */
131}; 136};
132 137
133static void __init init_ioports(void) 138static void __init init_ioports(void)
diff --git a/arch/powerpc/platforms/83xx/km83xx.c b/arch/powerpc/platforms/83xx/km83xx.c
index a266ba876863..89923d723349 100644
--- a/arch/powerpc/platforms/83xx/km83xx.c
+++ b/arch/powerpc/platforms/83xx/km83xx.c
@@ -3,7 +3,7 @@
3 * Author: Heiko Schocher <hs@denx.de> 3 * Author: Heiko Schocher <hs@denx.de>
4 * 4 *
5 * Description: 5 * Description:
6 * Keymile KMETER1 board specific routines. 6 * Keymile 83xx platform specific routines.
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -70,54 +70,88 @@ static void __init mpc83xx_km_setup_arch(void)
70 for_each_node_by_name(np, "spi") 70 for_each_node_by_name(np, "spi")
71 par_io_of_config(np); 71 par_io_of_config(np);
72 72
73 for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;) 73 for_each_node_by_name(np, "ucc")
74 par_io_of_config(np); 74 par_io_of_config(np);
75 } 75 }
76 76
77 np = of_find_compatible_node(NULL, "network", "ucc_geth"); 77 np = of_find_compatible_node(NULL, "network", "ucc_geth");
78 if (np != NULL) { 78 if (np != NULL) {
79 uint svid; 79 /*
80 * handle mpc8360E Erratum QE_ENET10:
81 * RGMII AC values do not meet the specification
82 */
83 uint svid = mfspr(SPRN_SVR);
84 struct device_node *np_par;
85 struct resource res;
86 void __iomem *base;
87 int ret;
88
89 np_par = of_find_node_by_name(NULL, "par_io");
90 if (np_par == NULL) {
91 printk(KERN_WARNING "%s couldn;t find par_io node\n",
92 __func__);
93 return;
94 }
95 /* Map Parallel I/O ports registers */
96 ret = of_address_to_resource(np_par, 0, &res);
97 if (ret) {
98 printk(KERN_WARNING "%s couldn;t map par_io registers\n",
99 __func__);
100 return;
101 }
102
103 base = ioremap(res.start, res.end - res.start + 1);
104
105 /*
106 * set output delay adjustments to default values according
107 * table 5 in Errata Rev. 5, 9/2011:
108 *
109 * write 0b01 to UCC1 bits 18:19
110 * write 0b01 to UCC2 option 1 bits 4:5
111 * write 0b01 to UCC2 option 2 bits 16:17
112 */
113 clrsetbits_be32((base + 0xa8), 0x0c00f000, 0x04005000);
114
115 /*
116 * set output delay adjustments to default values according
117 * table 3-13 in Reference Manual Rev.3 05/2010:
118 *
119 * write 0b01 to UCC2 option 2 bits 16:17
120 * write 0b0101 to UCC1 bits 20:23
121 * write 0b0101 to UCC2 option 1 bits 24:27
122 */
123 clrsetbits_be32((base + 0xac), 0x0000cff0, 0x00004550);
80 124
81 /* handle mpc8360ea rev.2.1 erratum 2: RGMII Timing */
82 svid = mfspr(SPRN_SVR);
83 if (SVR_REV(svid) == 0x0021) { 125 if (SVR_REV(svid) == 0x0021) {
84 struct device_node *np_par; 126 /*
85 struct resource res; 127 * UCC2 option 1: write 0b1010 to bits 24:27
86 void __iomem *base; 128 * at address IMMRBAR+0x14AC
87 int ret; 129 */
88 130 clrsetbits_be32((base + 0xac), 0x000000f0, 0x000000a0);
89 np_par = of_find_node_by_name(NULL, "par_io"); 131 } else if (SVR_REV(svid) == 0x0020) {
90 if (np_par == NULL) { 132 /*
91 printk(KERN_WARNING "%s couldn;t find par_io node\n", 133 * UCC1: write 0b11 to bits 18:19
92 __func__); 134 * at address IMMRBAR+0x14A8
93 return; 135 */
94 } 136 setbits32((base + 0xa8), 0x00003000);
95 /* Map Parallel I/O ports registers */
96 ret = of_address_to_resource(np_par, 0, &res);
97 if (ret) {
98 printk(KERN_WARNING "%s couldn;t map par_io registers\n",
99 __func__);
100 return;
101 }
102 base = ioremap(res.start, resource_size(&res));
103 137
104 /* 138 /*
105 * IMMR + 0x14A8[4:5] = 11 (clk delay for UCC 2) 139 * UCC2 option 1: write 0b11 to bits 4:5
106 * IMMR + 0x14A8[18:19] = 11 (clk delay for UCC 1) 140 * at address IMMRBAR+0x14A8
107 */ 141 */
108 setbits32((base + 0xa8), 0x0c003000); 142 setbits32((base + 0xa8), 0x0c000000);
109 143
110 /* 144 /*
111 * IMMR + 0x14AC[20:27] = 10101010 145 * UCC2 option 2: write 0b11 to bits 16:17
112 * (data delay for both UCC's) 146 * at address IMMRBAR+0x14AC
113 */ 147 */
114 clrsetbits_be32((base + 0xac), 0xff0, 0xaa0); 148 setbits32((base + 0xac), 0x0000c000);
115 iounmap(base);
116 of_node_put(np_par);
117 } 149 }
150 iounmap(base);
151 of_node_put(np_par);
118 of_node_put(np); 152 of_node_put(np);
119 } 153 }
120#endif /* CONFIG_QUICC_ENGINE */ 154#endif /* CONFIG_QUICC_ENGINE */
121} 155}
122 156
123machine_device_initcall(mpc83xx_km, mpc83xx_declare_of_platform_devices); 157machine_device_initcall(mpc83xx_km, mpc83xx_declare_of_platform_devices);
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index f000d81c4e31..159c01e91463 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -23,6 +23,15 @@ config FSL_85XX_CACHE_SRAM
23 cache-sram-size and cache-sram-offset kernel boot 23 cache-sram-size and cache-sram-offset kernel boot
24 parameters should be passed when this option is enabled. 24 parameters should be passed when this option is enabled.
25 25
26config BSC9131_RDB
27 bool "Freescale BSC9131RDB"
28 select DEFAULT_UIMAGE
29 help
30 This option enables support for the Freescale BSC9131RDB board.
31 The BSC9131 is a heterogeneous SoC containing an e500v2 powerpc and a
32 StarCore SC3850 DSP
33 Manufacturer : Freescale Semiconductor, Inc
34
26config MPC8540_ADS 35config MPC8540_ADS
27 bool "Freescale MPC8540 ADS" 36 bool "Freescale MPC8540 ADS"
28 select DEFAULT_UIMAGE 37 select DEFAULT_UIMAGE
@@ -175,12 +184,6 @@ config SBC8548
175 help 184 help
176 This option enables support for the Wind River SBC8548 board 185 This option enables support for the Wind River SBC8548 board
177 186
178config SBC8560
179 bool "Wind River SBC8560"
180 select DEFAULT_UIMAGE
181 help
182 This option enables support for the Wind River SBC8560 board
183
184config GE_IMP3A 187config GE_IMP3A
185 bool "GE Intelligent Platforms IMP3A" 188 bool "GE Intelligent Platforms IMP3A"
186 select DEFAULT_UIMAGE 189 select DEFAULT_UIMAGE
@@ -222,18 +225,6 @@ config P3041_DS
222 help 225 help
223 This option enables support for the P3041 DS board 226 This option enables support for the P3041 DS board
224 227
225config P3060_QDS
226 bool "Freescale P3060 QDS"
227 select DEFAULT_UIMAGE
228 select PPC_E500MC
229 select PHYS_64BIT
230 select SWIOTLB
231 select GPIO_MPC8XXX
232 select HAS_RAPIDIO
233 select PPC_EPAPR_HV_PIC
234 help
235 This option enables support for the P3060 QDS board
236
237config P4080_DS 228config P4080_DS
238 bool "Freescale P4080 DS" 229 bool "Freescale P4080 DS"
239 select DEFAULT_UIMAGE 230 select DEFAULT_UIMAGE
@@ -263,6 +254,22 @@ config P5020_DS
263 help 254 help
264 This option enables support for the P5020 DS board 255 This option enables support for the P5020 DS board
265 256
257config PPC_QEMU_E500
258 bool "QEMU generic e500 platform"
259 depends on EXPERIMENTAL
260 select DEFAULT_UIMAGE
261 help
262 This option enables support for running as a QEMU guest using
263 QEMU's generic e500 machine. This is not required if you're
264 using a QEMU machine that targets a specific board, such as
265 mpc8544ds.
266
267 Unlike most e500 boards that target a specific CPU, this
268 platform works with any e500-family CPU that QEMU supports.
269 Thus, you'll need to make sure CONFIG_PPC_E500MC is set or
270 unset based on the emulated CPU (or actual host CPU in the case
271 of KVM).
272
266endif # FSL_SOC_BOOKE 273endif # FSL_SOC_BOOKE
267 274
268config TQM85xx 275config TQM85xx
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index 2125d4ca068a..3dfe81175036 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -5,6 +5,7 @@ obj-$(CONFIG_SMP) += smp.o
5 5
6obj-y += common.o 6obj-y += common.o
7 7
8obj-$(CONFIG_BSC9131_RDB) += bsc913x_rdb.o
8obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o 9obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o
9obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o 10obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o
10obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o 11obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o
@@ -17,14 +18,13 @@ obj-$(CONFIG_P1022_DS) += p1022_ds.o
17obj-$(CONFIG_P1023_RDS) += p1023_rds.o 18obj-$(CONFIG_P1023_RDS) += p1023_rds.o
18obj-$(CONFIG_P2041_RDB) += p2041_rdb.o corenet_ds.o 19obj-$(CONFIG_P2041_RDB) += p2041_rdb.o corenet_ds.o
19obj-$(CONFIG_P3041_DS) += p3041_ds.o corenet_ds.o 20obj-$(CONFIG_P3041_DS) += p3041_ds.o corenet_ds.o
20obj-$(CONFIG_P3060_QDS) += p3060_qds.o corenet_ds.o
21obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o 21obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o
22obj-$(CONFIG_P5020_DS) += p5020_ds.o corenet_ds.o 22obj-$(CONFIG_P5020_DS) += p5020_ds.o corenet_ds.o
23obj-$(CONFIG_STX_GP3) += stx_gp3.o 23obj-$(CONFIG_STX_GP3) += stx_gp3.o
24obj-$(CONFIG_TQM85xx) += tqm85xx.o 24obj-$(CONFIG_TQM85xx) += tqm85xx.o
25obj-$(CONFIG_SBC8560) += sbc8560.o
26obj-$(CONFIG_SBC8548) += sbc8548.o 25obj-$(CONFIG_SBC8548) += sbc8548.o
27obj-$(CONFIG_SOCRATES) += socrates.o socrates_fpga_pic.o 26obj-$(CONFIG_SOCRATES) += socrates.o socrates_fpga_pic.o
28obj-$(CONFIG_KSI8560) += ksi8560.o 27obj-$(CONFIG_KSI8560) += ksi8560.o
29obj-$(CONFIG_XES_MPC85xx) += xes_mpc85xx.o 28obj-$(CONFIG_XES_MPC85xx) += xes_mpc85xx.o
30obj-$(CONFIG_GE_IMP3A) += ge_imp3a.o 29obj-$(CONFIG_GE_IMP3A) += ge_imp3a.o
30obj-$(CONFIG_PPC_QEMU_E500) += qemu_e500.o
diff --git a/arch/powerpc/platforms/85xx/bsc913x_rdb.c b/arch/powerpc/platforms/85xx/bsc913x_rdb.c
new file mode 100644
index 000000000000..9d57bedb940c
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/bsc913x_rdb.c
@@ -0,0 +1,67 @@
1/*
2 * BSC913xRDB Board Setup
3 *
4 * Author: Priyanka Jain <Priyanka.Jain@freescale.com>
5 *
6 * Copyright 2011-2012 Freescale Semiconductor Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/of_platform.h>
15#include <linux/pci.h>
16#include <asm/mpic.h>
17#include <sysdev/fsl_soc.h>
18#include <asm/udbg.h>
19
20#include "mpc85xx.h"
21
22void __init bsc913x_rdb_pic_init(void)
23{
24 struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
25 MPIC_SINGLE_DEST_CPU,
26 0, 256, " OpenPIC ");
27
28 if (!mpic)
29 pr_err("bsc913x: Failed to allocate MPIC structure\n");
30 else
31 mpic_init(mpic);
32}
33
34/*
35 * Setup the architecture
36 */
37static void __init bsc913x_rdb_setup_arch(void)
38{
39 if (ppc_md.progress)
40 ppc_md.progress("bsc913x_rdb_setup_arch()", 0);
41
42 pr_info("bsc913x board from Freescale Semiconductor\n");
43}
44
45machine_device_initcall(bsc9131_rdb, mpc85xx_common_publish_devices);
46
47/*
48 * Called very early, device-tree isn't unflattened
49 */
50
51static int __init bsc9131_rdb_probe(void)
52{
53 unsigned long root = of_get_flat_dt_root();
54
55 return of_flat_dt_is_compatible(root, "fsl,bsc9131rdb");
56}
57
58define_machine(bsc9131_rdb) {
59 .name = "BSC9131 RDB",
60 .probe = bsc9131_rdb_probe,
61 .setup_arch = bsc913x_rdb_setup_arch,
62 .init_IRQ = bsc913x_rdb_pic_init,
63 .get_irq = mpic_get_irq,
64 .restart = fsl_rstcr_restart,
65 .calibrate_decr = generic_calibrate_decr,
66 .progress = udbg_progress,
67};
diff --git a/arch/powerpc/platforms/85xx/corenet_ds.c b/arch/powerpc/platforms/85xx/corenet_ds.c
index dd3617c531d7..925b02874233 100644
--- a/arch/powerpc/platforms/85xx/corenet_ds.c
+++ b/arch/powerpc/platforms/85xx/corenet_ds.c
@@ -77,7 +77,7 @@ void __init corenet_ds_setup_arch(void)
77#endif 77#endif
78 78
79#ifdef CONFIG_SWIOTLB 79#ifdef CONFIG_SWIOTLB
80 if (memblock_end_of_DRAM() > max) { 80 if ((memblock_end_of_DRAM() - 1) > max) {
81 ppc_swiotlb_enable = 1; 81 ppc_swiotlb_enable = 1;
82 set_pci_dma_ops(&swiotlb_dma_ops); 82 set_pci_dma_ops(&swiotlb_dma_ops);
83 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 83 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/85xx/ge_imp3a.c b/arch/powerpc/platforms/85xx/ge_imp3a.c
index 18014629416d..b6a728b0a8ca 100644
--- a/arch/powerpc/platforms/85xx/ge_imp3a.c
+++ b/arch/powerpc/platforms/85xx/ge_imp3a.c
@@ -125,7 +125,7 @@ static void __init ge_imp3a_setup_arch(void)
125 mpc85xx_smp_init(); 125 mpc85xx_smp_init();
126 126
127#ifdef CONFIG_SWIOTLB 127#ifdef CONFIG_SWIOTLB
128 if (memblock_end_of_DRAM() > max) { 128 if ((memblock_end_of_DRAM() - 1) > max) {
129 ppc_swiotlb_enable = 1; 129 ppc_swiotlb_enable = 1;
130 set_pci_dma_ops(&swiotlb_dma_ops); 130 set_pci_dma_ops(&swiotlb_dma_ops);
131 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 131 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c b/arch/powerpc/platforms/85xx/mpc8536_ds.c
index 585bd22b1406..767c7cf18a9c 100644
--- a/arch/powerpc/platforms/85xx/mpc8536_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c
@@ -75,7 +75,7 @@ static void __init mpc8536_ds_setup_arch(void)
75#endif 75#endif
76 76
77#ifdef CONFIG_SWIOTLB 77#ifdef CONFIG_SWIOTLB
78 if (memblock_end_of_DRAM() > max) { 78 if ((memblock_end_of_DRAM() - 1) > max) {
79 ppc_swiotlb_enable = 1; 79 ppc_swiotlb_enable = 1;
80 set_pci_dma_ops(&swiotlb_dma_ops); 80 set_pci_dma_ops(&swiotlb_dma_ops);
81 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 81 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 1fd91e9e0ffb..6d3265fe7718 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -114,71 +114,53 @@ void __init mpc85xx_ds_pic_init(void)
114} 114}
115 115
116#ifdef CONFIG_PCI 116#ifdef CONFIG_PCI
117static int primary_phb_addr;
118extern int uli_exclude_device(struct pci_controller *hose, 117extern int uli_exclude_device(struct pci_controller *hose,
119 u_char bus, u_char devfn); 118 u_char bus, u_char devfn);
120 119
120static struct device_node *pci_with_uli;
121
121static int mpc85xx_exclude_device(struct pci_controller *hose, 122static int mpc85xx_exclude_device(struct pci_controller *hose,
122 u_char bus, u_char devfn) 123 u_char bus, u_char devfn)
123{ 124{
124 struct device_node* node; 125 if (hose->dn == pci_with_uli)
125 struct resource rsrc;
126
127 node = hose->dn;
128 of_address_to_resource(node, 0, &rsrc);
129
130 if ((rsrc.start & 0xfffff) == primary_phb_addr) {
131 return uli_exclude_device(hose, bus, devfn); 126 return uli_exclude_device(hose, bus, devfn);
132 }
133 127
134 return PCIBIOS_SUCCESSFUL; 128 return PCIBIOS_SUCCESSFUL;
135} 129}
136#endif /* CONFIG_PCI */ 130#endif /* CONFIG_PCI */
137 131
138/* 132static void __init mpc85xx_ds_pci_init(void)
139 * Setup the architecture
140 */
141static void __init mpc85xx_ds_setup_arch(void)
142{ 133{
143#ifdef CONFIG_PCI 134#ifdef CONFIG_PCI
144 struct device_node *np; 135 struct device_node *node;
145 struct pci_controller *hose;
146#endif
147 dma_addr_t max = 0xffffffff;
148 136
149 if (ppc_md.progress) 137 fsl_pci_init();
150 ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
151 138
152#ifdef CONFIG_PCI 139 /* See if we have a ULI under the primary */
153 for_each_node_by_type(np, "pci") { 140
154 if (of_device_is_compatible(np, "fsl,mpc8540-pci") || 141 node = of_find_node_by_name(NULL, "uli1575");
155 of_device_is_compatible(np, "fsl,mpc8548-pcie") || 142 while ((pci_with_uli = of_get_parent(node))) {
156 of_device_is_compatible(np, "fsl,p2020-pcie")) { 143 of_node_put(node);
157 struct resource rsrc; 144 node = pci_with_uli;
158 of_address_to_resource(np, 0, &rsrc); 145
159 if ((rsrc.start & 0xfffff) == primary_phb_addr) 146 if (pci_with_uli == fsl_pci_primary) {
160 fsl_add_bridge(np, 1); 147 ppc_md.pci_exclude_device = mpc85xx_exclude_device;
161 else 148 break;
162 fsl_add_bridge(np, 0);
163
164 hose = pci_find_hose_for_OF_device(np);
165 max = min(max, hose->dma_window_base_cur +
166 hose->dma_window_size);
167 } 149 }
168 } 150 }
169
170 ppc_md.pci_exclude_device = mpc85xx_exclude_device;
171#endif 151#endif
152}
172 153
173 mpc85xx_smp_init(); 154/*
155 * Setup the architecture
156 */
157static void __init mpc85xx_ds_setup_arch(void)
158{
159 if (ppc_md.progress)
160 ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
174 161
175#ifdef CONFIG_SWIOTLB 162 mpc85xx_ds_pci_init();
176 if (memblock_end_of_DRAM() > max) { 163 mpc85xx_smp_init();
177 ppc_swiotlb_enable = 1;
178 set_pci_dma_ops(&swiotlb_dma_ops);
179 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
180 }
181#endif
182 164
183 printk("MPC85xx DS board from Freescale Semiconductor\n"); 165 printk("MPC85xx DS board from Freescale Semiconductor\n");
184} 166}
@@ -190,14 +172,7 @@ static int __init mpc8544_ds_probe(void)
190{ 172{
191 unsigned long root = of_get_flat_dt_root(); 173 unsigned long root = of_get_flat_dt_root();
192 174
193 if (of_flat_dt_is_compatible(root, "MPC8544DS")) { 175 return !!of_flat_dt_is_compatible(root, "MPC8544DS");
194#ifdef CONFIG_PCI
195 primary_phb_addr = 0xb000;
196#endif
197 return 1;
198 }
199
200 return 0;
201} 176}
202 177
203machine_device_initcall(mpc8544_ds, mpc85xx_common_publish_devices); 178machine_device_initcall(mpc8544_ds, mpc85xx_common_publish_devices);
@@ -215,14 +190,7 @@ static int __init mpc8572_ds_probe(void)
215{ 190{
216 unsigned long root = of_get_flat_dt_root(); 191 unsigned long root = of_get_flat_dt_root();
217 192
218 if (of_flat_dt_is_compatible(root, "fsl,MPC8572DS")) { 193 return !!of_flat_dt_is_compatible(root, "fsl,MPC8572DS");
219#ifdef CONFIG_PCI
220 primary_phb_addr = 0x8000;
221#endif
222 return 1;
223 }
224
225 return 0;
226} 194}
227 195
228/* 196/*
@@ -232,14 +200,7 @@ static int __init p2020_ds_probe(void)
232{ 200{
233 unsigned long root = of_get_flat_dt_root(); 201 unsigned long root = of_get_flat_dt_root();
234 202
235 if (of_flat_dt_is_compatible(root, "fsl,P2020DS")) { 203 return !!of_flat_dt_is_compatible(root, "fsl,P2020DS");
236#ifdef CONFIG_PCI
237 primary_phb_addr = 0x9000;
238#endif
239 return 1;
240 }
241
242 return 0;
243} 204}
244 205
245define_machine(mpc8544_ds) { 206define_machine(mpc8544_ds) {
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index d208ebccb91c..8e4b094c553b 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -359,7 +359,7 @@ static void __init mpc85xx_mds_setup_arch(void)
359 mpc85xx_mds_qe_init(); 359 mpc85xx_mds_qe_init();
360 360
361#ifdef CONFIG_SWIOTLB 361#ifdef CONFIG_SWIOTLB
362 if (memblock_end_of_DRAM() > max) { 362 if ((memblock_end_of_DRAM() - 1) > max) {
363 ppc_swiotlb_enable = 1; 363 ppc_swiotlb_enable = 1;
364 set_pci_dma_ops(&swiotlb_dma_ops); 364 set_pci_dma_ops(&swiotlb_dma_ops);
365 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 365 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
index 313fce4f5574..1910fdcb75b2 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
@@ -169,6 +169,7 @@ machine_device_initcall(p1020_rdb_pc, mpc85xx_common_publish_devices);
169machine_device_initcall(p1020_utm_pc, mpc85xx_common_publish_devices); 169machine_device_initcall(p1020_utm_pc, mpc85xx_common_publish_devices);
170machine_device_initcall(p1021_rdb_pc, mpc85xx_common_publish_devices); 170machine_device_initcall(p1021_rdb_pc, mpc85xx_common_publish_devices);
171machine_device_initcall(p1025_rdb, mpc85xx_common_publish_devices); 171machine_device_initcall(p1025_rdb, mpc85xx_common_publish_devices);
172machine_device_initcall(p1024_rdb, mpc85xx_common_publish_devices);
172 173
173/* 174/*
174 * Called very early, device-tree isn't unflattened 175 * Called very early, device-tree isn't unflattened
@@ -237,6 +238,13 @@ static int __init p1020_utm_pc_probe(void)
237 return of_flat_dt_is_compatible(root, "fsl,P1020UTM-PC"); 238 return of_flat_dt_is_compatible(root, "fsl,P1020UTM-PC");
238} 239}
239 240
241static int __init p1024_rdb_probe(void)
242{
243 unsigned long root = of_get_flat_dt_root();
244
245 return of_flat_dt_is_compatible(root, "fsl,P1024RDB");
246}
247
240define_machine(p2020_rdb) { 248define_machine(p2020_rdb) {
241 .name = "P2020 RDB", 249 .name = "P2020 RDB",
242 .probe = p2020_rdb_probe, 250 .probe = p2020_rdb_probe,
@@ -348,3 +356,17 @@ define_machine(p1020_rdb_pc) {
348 .calibrate_decr = generic_calibrate_decr, 356 .calibrate_decr = generic_calibrate_decr,
349 .progress = udbg_progress, 357 .progress = udbg_progress,
350}; 358};
359
360define_machine(p1024_rdb) {
361 .name = "P1024 RDB",
362 .probe = p1024_rdb_probe,
363 .setup_arch = mpc85xx_rdb_setup_arch,
364 .init_IRQ = mpc85xx_rdb_pic_init,
365#ifdef CONFIG_PCI
366 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
367#endif
368 .get_irq = mpic_get_irq,
369 .restart = fsl_rstcr_restart,
370 .calibrate_decr = generic_calibrate_decr,
371 .progress = udbg_progress,
372};
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
index f700c81a1321..89ee02c54561 100644
--- a/arch/powerpc/platforms/85xx/p1022_ds.c
+++ b/arch/powerpc/platforms/85xx/p1022_ds.c
@@ -27,6 +27,7 @@
27#include <sysdev/fsl_pci.h> 27#include <sysdev/fsl_pci.h>
28#include <asm/udbg.h> 28#include <asm/udbg.h>
29#include <asm/fsl_guts.h> 29#include <asm/fsl_guts.h>
30#include <asm/fsl_lbc.h>
30#include "smp.h" 31#include "smp.h"
31 32
32#include "mpc85xx.h" 33#include "mpc85xx.h"
@@ -142,17 +143,73 @@ static void p1022ds_set_gamma_table(enum fsl_diu_monitor_port port,
142{ 143{
143} 144}
144 145
146struct fsl_law {
147 u32 lawbar;
148 u32 reserved1;
149 u32 lawar;
150 u32 reserved[5];
151};
152
153#define LAWBAR_MASK 0x00F00000
154#define LAWBAR_SHIFT 12
155
156#define LAWAR_EN 0x80000000
157#define LAWAR_TGT_MASK 0x01F00000
158#define LAW_TRGT_IF_LBC (0x04 << 20)
159
160#define LAWAR_MASK (LAWAR_EN | LAWAR_TGT_MASK)
161#define LAWAR_MATCH (LAWAR_EN | LAW_TRGT_IF_LBC)
162
163#define BR_BA 0xFFFF8000
164
165/*
166 * Map a BRx value to a physical address
167 *
168 * The localbus BRx registers only store the lower 32 bits of the address. To
169 * obtain the upper four bits, we need to scan the LAW table. The entry which
170 * maps to the localbus will contain the upper four bits.
171 */
172static phys_addr_t lbc_br_to_phys(const void *ecm, unsigned int count, u32 br)
173{
174#ifndef CONFIG_PHYS_64BIT
175 /*
176 * If we only have 32-bit addressing, then the BRx address *is* the
177 * physical address.
178 */
179 return br & BR_BA;
180#else
181 const struct fsl_law *law = ecm + 0xc08;
182 unsigned int i;
183
184 for (i = 0; i < count; i++) {
185 u64 lawbar = in_be32(&law[i].lawbar);
186 u32 lawar = in_be32(&law[i].lawar);
187
188 if ((lawar & LAWAR_MASK) == LAWAR_MATCH)
189 /* Extract the upper four bits */
190 return (br & BR_BA) | ((lawbar & LAWBAR_MASK) << 12);
191 }
192
193 return 0;
194#endif
195}
196
145/** 197/**
146 * p1022ds_set_monitor_port: switch the output to a different monitor port 198 * p1022ds_set_monitor_port: switch the output to a different monitor port
147 *
148 */ 199 */
149static void p1022ds_set_monitor_port(enum fsl_diu_monitor_port port) 200static void p1022ds_set_monitor_port(enum fsl_diu_monitor_port port)
150{ 201{
151 struct device_node *guts_node; 202 struct device_node *guts_node;
152 struct device_node *indirect_node = NULL; 203 struct device_node *lbc_node = NULL;
204 struct device_node *law_node = NULL;
153 struct ccsr_guts __iomem *guts; 205 struct ccsr_guts __iomem *guts;
206 struct fsl_lbc_regs *lbc = NULL;
207 void *ecm = NULL;
154 u8 __iomem *lbc_lcs0_ba = NULL; 208 u8 __iomem *lbc_lcs0_ba = NULL;
155 u8 __iomem *lbc_lcs1_ba = NULL; 209 u8 __iomem *lbc_lcs1_ba = NULL;
210 phys_addr_t cs0_addr, cs1_addr;
211 const __be32 *iprop;
212 unsigned int num_laws;
156 u8 b; 213 u8 b;
157 214
158 /* Map the global utilities registers. */ 215 /* Map the global utilities registers. */
@@ -168,24 +225,42 @@ static void p1022ds_set_monitor_port(enum fsl_diu_monitor_port port)
168 goto exit; 225 goto exit;
169 } 226 }
170 227
171 indirect_node = of_find_compatible_node(NULL, NULL, 228 lbc_node = of_find_compatible_node(NULL, NULL, "fsl,p1022-elbc");
172 "fsl,p1022ds-indirect-pixis"); 229 if (!lbc_node) {
173 if (!indirect_node) { 230 pr_err("p1022ds: missing localbus node\n");
174 pr_err("p1022ds: missing pixis indirect mode node\n"); 231 goto exit;
232 }
233
234 lbc = of_iomap(lbc_node, 0);
235 if (!lbc) {
236 pr_err("p1022ds: could not map localbus node\n");
237 goto exit;
238 }
239
240 law_node = of_find_compatible_node(NULL, NULL, "fsl,ecm-law");
241 if (!law_node) {
242 pr_err("p1022ds: missing local access window node\n");
175 goto exit; 243 goto exit;
176 } 244 }
177 245
178 lbc_lcs0_ba = of_iomap(indirect_node, 0); 246 ecm = of_iomap(law_node, 0);
179 if (!lbc_lcs0_ba) { 247 if (!ecm) {
180 pr_err("p1022ds: could not map localbus chip select 0\n"); 248 pr_err("p1022ds: could not map local access window node\n");
181 goto exit; 249 goto exit;
182 } 250 }
183 251
184 lbc_lcs1_ba = of_iomap(indirect_node, 1); 252 iprop = of_get_property(law_node, "fsl,num-laws", 0);
185 if (!lbc_lcs1_ba) { 253 if (!iprop) {
186 pr_err("p1022ds: could not map localbus chip select 1\n"); 254 pr_err("p1022ds: LAW node is missing fsl,num-laws property\n");
187 goto exit; 255 goto exit;
188 } 256 }
257 num_laws = be32_to_cpup(iprop);
258
259 cs0_addr = lbc_br_to_phys(ecm, num_laws, in_be32(&lbc->bank[0].br));
260 cs1_addr = lbc_br_to_phys(ecm, num_laws, in_be32(&lbc->bank[1].br));
261
262 lbc_lcs0_ba = ioremap(cs0_addr, 1);
263 lbc_lcs1_ba = ioremap(cs1_addr, 1);
189 264
190 /* Make sure we're in indirect mode first. */ 265 /* Make sure we're in indirect mode first. */
191 if ((in_be32(&guts->pmuxcr) & PMUXCR_ELBCDIU_MASK) != 266 if ((in_be32(&guts->pmuxcr) & PMUXCR_ELBCDIU_MASK) !=
@@ -254,10 +329,15 @@ exit:
254 iounmap(lbc_lcs1_ba); 329 iounmap(lbc_lcs1_ba);
255 if (lbc_lcs0_ba) 330 if (lbc_lcs0_ba)
256 iounmap(lbc_lcs0_ba); 331 iounmap(lbc_lcs0_ba);
332 if (lbc)
333 iounmap(lbc);
334 if (ecm)
335 iounmap(ecm);
257 if (guts) 336 if (guts)
258 iounmap(guts); 337 iounmap(guts);
259 338
260 of_node_put(indirect_node); 339 of_node_put(law_node);
340 of_node_put(lbc_node);
261 of_node_put(guts_node); 341 of_node_put(guts_node);
262} 342}
263 343
@@ -348,13 +428,7 @@ void __init p1022_ds_pic_init(void)
348 */ 428 */
349static void __init disable_one_node(struct device_node *np, struct property *new) 429static void __init disable_one_node(struct device_node *np, struct property *new)
350{ 430{
351 struct property *old; 431 prom_update_property(np, new);
352
353 old = of_find_property(np, new->name, NULL);
354 if (old)
355 prom_update_property(np, new, old);
356 else
357 prom_add_property(np, new);
358} 432}
359 433
360/* TRUE if there is a "video=fslfb" command-line parameter. */ 434/* TRUE if there is a "video=fslfb" command-line parameter. */
@@ -450,7 +524,7 @@ static void __init p1022_ds_setup_arch(void)
450 mpc85xx_smp_init(); 524 mpc85xx_smp_init();
451 525
452#ifdef CONFIG_SWIOTLB 526#ifdef CONFIG_SWIOTLB
453 if (memblock_end_of_DRAM() > max) { 527 if ((memblock_end_of_DRAM() - 1) > max) {
454 ppc_swiotlb_enable = 1; 528 ppc_swiotlb_enable = 1;
455 set_pci_dma_ops(&swiotlb_dma_ops); 529 set_pci_dma_ops(&swiotlb_dma_ops);
456 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 530 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/85xx/p3060_qds.c b/arch/powerpc/platforms/85xx/p3060_qds.c
deleted file mode 100644
index 081cf4ac1881..000000000000
--- a/arch/powerpc/platforms/85xx/p3060_qds.c
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 * P3060 QDS Setup
3 *
4 * Copyright 2011 Freescale Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/interrupt.h>
14#include <linux/phy.h>
15#include <asm/machdep.h>
16#include <asm/udbg.h>
17#include <asm/mpic.h>
18#include <linux/of_platform.h>
19#include <sysdev/fsl_soc.h>
20#include <sysdev/fsl_pci.h>
21#include <asm/ehv_pic.h>
22#include "corenet_ds.h"
23
24/*
25 * Called very early, device-tree isn't unflattened
26 */
27static int __init p3060_qds_probe(void)
28{
29 unsigned long root = of_get_flat_dt_root();
30#ifdef CONFIG_SMP
31 extern struct smp_ops_t smp_85xx_ops;
32#endif
33
34 if (of_flat_dt_is_compatible(root, "fsl,P3060QDS"))
35 return 1;
36
37 /* Check if we're running under the Freescale hypervisor */
38 if (of_flat_dt_is_compatible(root, "fsl,P3060QDS-hv")) {
39 ppc_md.init_IRQ = ehv_pic_init;
40 ppc_md.get_irq = ehv_pic_get_irq;
41 ppc_md.restart = fsl_hv_restart;
42 ppc_md.power_off = fsl_hv_halt;
43 ppc_md.halt = fsl_hv_halt;
44#ifdef CONFIG_SMP
45 /*
46 * Disable the timebase sync operations because we can't write
47 * to the timebase registers under the hypervisor.
48 */
49 smp_85xx_ops.give_timebase = NULL;
50 smp_85xx_ops.take_timebase = NULL;
51#endif
52 return 1;
53 }
54
55 return 0;
56}
57
58define_machine(p3060_qds) {
59 .name = "P3060 QDS",
60 .probe = p3060_qds_probe,
61 .setup_arch = corenet_ds_setup_arch,
62 .init_IRQ = corenet_ds_pic_init,
63#ifdef CONFIG_PCI
64 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
65#endif
66 .get_irq = mpic_get_coreint_irq,
67 .restart = fsl_rstcr_restart,
68 .calibrate_decr = generic_calibrate_decr,
69 .progress = udbg_progress,
70 .power_save = e500_idle,
71};
72
73machine_device_initcall(p3060_qds, corenet_ds_publish_devices);
74
75#ifdef CONFIG_SWIOTLB
76machine_arch_initcall(p3060_qds, swiotlb_setup_bus_notifier);
77#endif
diff --git a/arch/powerpc/platforms/85xx/qemu_e500.c b/arch/powerpc/platforms/85xx/qemu_e500.c
new file mode 100644
index 000000000000..95a2e53af71b
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/qemu_e500.c
@@ -0,0 +1,72 @@
1/*
2 * Paravirt target for a generic QEMU e500 machine
3 *
4 * This is intended to be a flexible device-tree-driven platform, not fixed
5 * to a particular piece of hardware or a particular spec of virtual hardware,
6 * beyond the assumption of an e500-family CPU. Some things are still hardcoded
7 * here, such as MPIC, but this is a limitation of the current code rather than
8 * an interface contract with QEMU.
9 *
10 * Copyright 2012 Freescale Semiconductor Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 */
17
18#include <linux/kernel.h>
19#include <linux/of_fdt.h>
20#include <asm/machdep.h>
21#include <asm/time.h>
22#include <asm/udbg.h>
23#include <asm/mpic.h>
24#include <sysdev/fsl_soc.h>
25#include <sysdev/fsl_pci.h>
26#include "smp.h"
27#include "mpc85xx.h"
28
29void __init qemu_e500_pic_init(void)
30{
31 struct mpic *mpic;
32
33 mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU,
34 0, 256, " OpenPIC ");
35
36 BUG_ON(mpic == NULL);
37 mpic_init(mpic);
38}
39
40static void __init qemu_e500_setup_arch(void)
41{
42 ppc_md.progress("qemu_e500_setup_arch()", 0);
43
44 fsl_pci_init();
45 mpc85xx_smp_init();
46}
47
48/*
49 * Called very early, device-tree isn't unflattened
50 */
51static int __init qemu_e500_probe(void)
52{
53 unsigned long root = of_get_flat_dt_root();
54
55 return !!of_flat_dt_is_compatible(root, "fsl,qemu-e500");
56}
57
58machine_device_initcall(qemu_e500, mpc85xx_common_publish_devices);
59
60define_machine(qemu_e500) {
61 .name = "QEMU e500",
62 .probe = qemu_e500_probe,
63 .setup_arch = qemu_e500_setup_arch,
64 .init_IRQ = qemu_e500_pic_init,
65#ifdef CONFIG_PCI
66 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
67#endif
68 .get_irq = mpic_get_irq,
69 .restart = fsl_rstcr_restart,
70 .calibrate_decr = generic_calibrate_decr,
71 .progress = udbg_progress,
72};
diff --git a/arch/powerpc/platforms/85xx/sbc8560.c b/arch/powerpc/platforms/85xx/sbc8560.c
deleted file mode 100644
index b1be632ede43..000000000000
--- a/arch/powerpc/platforms/85xx/sbc8560.c
+++ /dev/null
@@ -1,254 +0,0 @@
1/*
2 * Wind River SBC8560 setup and early boot code.
3 *
4 * Copyright 2007 Wind River Systems Inc.
5 *
6 * By Paul Gortmaker (see MAINTAINERS for contact information)
7 *
8 * Based largely on the MPC8560ADS support - Copyright 2005 Freescale Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/stddef.h>
17#include <linux/kernel.h>
18#include <linux/pci.h>
19#include <linux/kdev_t.h>
20#include <linux/delay.h>
21#include <linux/seq_file.h>
22#include <linux/of_platform.h>
23
24#include <asm/time.h>
25#include <asm/machdep.h>
26#include <asm/pci-bridge.h>
27#include <asm/mpic.h>
28#include <mm/mmu_decl.h>
29#include <asm/udbg.h>
30
31#include <sysdev/fsl_soc.h>
32#include <sysdev/fsl_pci.h>
33
34#include "mpc85xx.h"
35
36#ifdef CONFIG_CPM2
37#include <asm/cpm2.h>
38#include <sysdev/cpm2_pic.h>
39#endif
40
41static void __init sbc8560_pic_init(void)
42{
43 struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN,
44 0, 256, " OpenPIC ");
45 BUG_ON(mpic == NULL);
46 mpic_init(mpic);
47
48 mpc85xx_cpm2_pic_init();
49}
50
51/*
52 * Setup the architecture
53 */
54#ifdef CONFIG_CPM2
55struct cpm_pin {
56 int port, pin, flags;
57};
58
59static const struct cpm_pin sbc8560_pins[] = {
60 /* SCC1 */
61 {3, 29, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
62 {3, 30, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
63 {3, 31, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
64
65 /* SCC2 */
66 {3, 26, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
67 {3, 27, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
68 {3, 28, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
69
70 /* FCC2 */
71 {1, 18, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
72 {1, 19, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
73 {1, 20, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
74 {1, 21, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
75 {1, 22, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
76 {1, 23, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
77 {1, 24, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
78 {1, 25, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
79 {1, 26, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
80 {1, 27, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
81 {1, 28, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
82 {1, 29, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
83 {1, 30, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
84 {1, 31, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
85 {2, 18, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK14 */
86 {2, 19, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK13 */
87
88 /* FCC3 */
89 {1, 4, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
90 {1, 5, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
91 {1, 6, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
92 {1, 7, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
93 {1, 8, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
94 {1, 9, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
95 {1, 10, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
96 {1, 11, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
97 {1, 12, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
98 {1, 13, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
99 {1, 14, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
100 {1, 15, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
101 {1, 16, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
102 {1, 17, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
103 {2, 16, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* CLK16 */
104 {2, 17, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* CLK15 */
105};
106
107static void __init init_ioports(void)
108{
109 int i;
110
111 for (i = 0; i < ARRAY_SIZE(sbc8560_pins); i++) {
112 const struct cpm_pin *pin = &sbc8560_pins[i];
113 cpm2_set_pin(pin->port, pin->pin, pin->flags);
114 }
115
116 cpm2_clk_setup(CPM_CLK_SCC1, CPM_BRG1, CPM_CLK_RX);
117 cpm2_clk_setup(CPM_CLK_SCC1, CPM_BRG1, CPM_CLK_TX);
118 cpm2_clk_setup(CPM_CLK_SCC2, CPM_BRG2, CPM_CLK_RX);
119 cpm2_clk_setup(CPM_CLK_SCC2, CPM_BRG2, CPM_CLK_TX);
120 cpm2_clk_setup(CPM_CLK_FCC2, CPM_CLK13, CPM_CLK_RX);
121 cpm2_clk_setup(CPM_CLK_FCC2, CPM_CLK14, CPM_CLK_TX);
122 cpm2_clk_setup(CPM_CLK_FCC3, CPM_CLK15, CPM_CLK_RX);
123 cpm2_clk_setup(CPM_CLK_FCC3, CPM_CLK16, CPM_CLK_TX);
124}
125#endif
126
127static void __init sbc8560_setup_arch(void)
128{
129#ifdef CONFIG_PCI
130 struct device_node *np;
131#endif
132
133 if (ppc_md.progress)
134 ppc_md.progress("sbc8560_setup_arch()", 0);
135
136#ifdef CONFIG_CPM2
137 cpm2_reset();
138 init_ioports();
139#endif
140
141#ifdef CONFIG_PCI
142 for_each_compatible_node(np, "pci", "fsl,mpc8540-pci")
143 fsl_add_bridge(np, 1);
144#endif
145}
146
147static void sbc8560_show_cpuinfo(struct seq_file *m)
148{
149 uint pvid, svid, phid1;
150
151 pvid = mfspr(SPRN_PVR);
152 svid = mfspr(SPRN_SVR);
153
154 seq_printf(m, "Vendor\t\t: Wind River\n");
155 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
156 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
157
158 /* Display cpu Pll setting */
159 phid1 = mfspr(SPRN_HID1);
160 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
161}
162
163machine_device_initcall(sbc8560, mpc85xx_common_publish_devices);
164
165/*
166 * Called very early, device-tree isn't unflattened
167 */
168static int __init sbc8560_probe(void)
169{
170 unsigned long root = of_get_flat_dt_root();
171
172 return of_flat_dt_is_compatible(root, "SBC8560");
173}
174
175#ifdef CONFIG_RTC_DRV_M48T59
176static int __init sbc8560_rtc_init(void)
177{
178 struct device_node *np;
179 struct resource res;
180 struct platform_device *rtc_dev;
181
182 np = of_find_compatible_node(NULL, NULL, "m48t59");
183 if (np == NULL) {
184 printk("No RTC in DTB. Has it been eaten by wild dogs?\n");
185 return -ENODEV;
186 }
187
188 of_address_to_resource(np, 0, &res);
189 of_node_put(np);
190
191 printk("Found RTC (m48t59) at i/o 0x%x\n", res.start);
192
193 rtc_dev = platform_device_register_simple("rtc-m48t59", 0, &res, 1);
194
195 if (IS_ERR(rtc_dev)) {
196 printk("Registering sbc8560 RTC device failed\n");
197 return PTR_ERR(rtc_dev);
198 }
199
200 return 0;
201}
202
203arch_initcall(sbc8560_rtc_init);
204
205#endif /* M48T59 */
206
207static __u8 __iomem *brstcr;
208
209static int __init sbc8560_bdrstcr_init(void)
210{
211 struct device_node *np;
212 struct resource res;
213
214 np = of_find_compatible_node(NULL, NULL, "wrs,sbc8560-brstcr");
215 if (np == NULL) {
216 printk(KERN_WARNING "sbc8560: No board specific RSTCR in DTB.\n");
217 return -ENODEV;
218 }
219
220 of_address_to_resource(np, 0, &res);
221
222 printk(KERN_INFO "sbc8560: Found BRSTCR at %pR\n", &res);
223
224 brstcr = ioremap(res.start, resource_size(&res));
225 if(!brstcr)
226 printk(KERN_WARNING "sbc8560: ioremap of brstcr failed.\n");
227
228 of_node_put(np);
229
230 return 0;
231}
232
233arch_initcall(sbc8560_bdrstcr_init);
234
235void sbc8560_rstcr_restart(char * cmd)
236{
237 local_irq_disable();
238 if(brstcr)
239 clrbits8(brstcr, 0x80);
240
241 while(1);
242}
243
244define_machine(sbc8560) {
245 .name = "SBC8560",
246 .probe = sbc8560_probe,
247 .setup_arch = sbc8560_setup_arch,
248 .init_IRQ = sbc8560_pic_init,
249 .show_cpuinfo = sbc8560_show_cpuinfo,
250 .get_irq = mpic_get_irq,
251 .restart = sbc8560_rstcr_restart,
252 .calibrate_decr = generic_calibrate_decr,
253 .progress = udbg_progress,
254};
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 3755e61d7ecf..817245bc0219 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -102,7 +102,7 @@ mpc86xx_hpcn_setup_arch(void)
102#endif 102#endif
103 103
104#ifdef CONFIG_SWIOTLB 104#ifdef CONFIG_SWIOTLB
105 if (memblock_end_of_DRAM() > max) { 105 if ((memblock_end_of_DRAM() - 1) > max) {
106 ppc_swiotlb_enable = 1; 106 ppc_swiotlb_enable = 1;
107 set_pci_dma_ops(&swiotlb_dma_ops); 107 set_pci_dma_ops(&swiotlb_dma_ops);
108 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 108 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 61c9550819a2..30fd01de6bed 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -159,6 +159,10 @@ config PPC_E500MC
159 bool "e500mc Support" 159 bool "e500mc Support"
160 select PPC_FPU 160 select PPC_FPU
161 depends on E500 161 depends on E500
162 help
163 This must be enabled for running on e500mc (and derivatives
164 such as e5500/e6500), and must be disabled for running on
165 e500v1 or e500v2.
162 166
163config PPC_FPU 167config PPC_FPU
164 bool 168 bool
diff --git a/arch/powerpc/platforms/cell/beat_hvCall.S b/arch/powerpc/platforms/cell/beat_hvCall.S
index 74c817448948..96c801907126 100644
--- a/arch/powerpc/platforms/cell/beat_hvCall.S
+++ b/arch/powerpc/platforms/cell/beat_hvCall.S
@@ -22,8 +22,6 @@
22 22
23#include <asm/ppc_asm.h> 23#include <asm/ppc_asm.h>
24 24
25#define STK_PARM(i) (48 + ((i)-3)*8)
26
27/* Not implemented on Beat, now */ 25/* Not implemented on Beat, now */
28#define HCALL_INST_PRECALL 26#define HCALL_INST_PRECALL
29#define HCALL_INST_POSTCALL 27#define HCALL_INST_POSTCALL
@@ -74,7 +72,7 @@ _GLOBAL(beat_hcall_norets8)
74 mr r6,r7 72 mr r6,r7
75 mr r7,r8 73 mr r7,r8
76 mr r8,r9 74 mr r8,r9
77 ld r10,STK_PARM(r10)(r1) 75 ld r10,STK_PARAM(R10)(r1)
78 76
79 HVSC /* invoke the hypervisor */ 77 HVSC /* invoke the hypervisor */
80 78
@@ -94,7 +92,7 @@ _GLOBAL(beat_hcall1)
94 92
95 HCALL_INST_PRECALL 93 HCALL_INST_PRECALL
96 94
97 std r4,STK_PARM(r4)(r1) /* save ret buffer */ 95 std r4,STK_PARAM(R4)(r1) /* save ret buffer */
98 96
99 mr r11,r3 97 mr r11,r3
100 mr r3,r5 98 mr r3,r5
@@ -108,7 +106,7 @@ _GLOBAL(beat_hcall1)
108 106
109 HCALL_INST_POSTCALL 107 HCALL_INST_POSTCALL
110 108
111 ld r12,STK_PARM(r4)(r1) 109 ld r12,STK_PARAM(R4)(r1)
112 std r4, 0(r12) 110 std r4, 0(r12)
113 111
114 lwz r0,8(r1) 112 lwz r0,8(r1)
@@ -125,7 +123,7 @@ _GLOBAL(beat_hcall2)
125 123
126 HCALL_INST_PRECALL 124 HCALL_INST_PRECALL
127 125
128 std r4,STK_PARM(r4)(r1) /* save ret buffer */ 126 std r4,STK_PARAM(R4)(r1) /* save ret buffer */
129 127
130 mr r11,r3 128 mr r11,r3
131 mr r3,r5 129 mr r3,r5
@@ -139,7 +137,7 @@ _GLOBAL(beat_hcall2)
139 137
140 HCALL_INST_POSTCALL 138 HCALL_INST_POSTCALL
141 139
142 ld r12,STK_PARM(r4)(r1) 140 ld r12,STK_PARAM(R4)(r1)
143 std r4, 0(r12) 141 std r4, 0(r12)
144 std r5, 8(r12) 142 std r5, 8(r12)
145 143
@@ -157,7 +155,7 @@ _GLOBAL(beat_hcall3)
157 155
158 HCALL_INST_PRECALL 156 HCALL_INST_PRECALL
159 157
160 std r4,STK_PARM(r4)(r1) /* save ret buffer */ 158 std r4,STK_PARAM(R4)(r1) /* save ret buffer */
161 159
162 mr r11,r3 160 mr r11,r3
163 mr r3,r5 161 mr r3,r5
@@ -171,7 +169,7 @@ _GLOBAL(beat_hcall3)
171 169
172 HCALL_INST_POSTCALL 170 HCALL_INST_POSTCALL
173 171
174 ld r12,STK_PARM(r4)(r1) 172 ld r12,STK_PARAM(R4)(r1)
175 std r4, 0(r12) 173 std r4, 0(r12)
176 std r5, 8(r12) 174 std r5, 8(r12)
177 std r6, 16(r12) 175 std r6, 16(r12)
@@ -190,7 +188,7 @@ _GLOBAL(beat_hcall4)
190 188
191 HCALL_INST_PRECALL 189 HCALL_INST_PRECALL
192 190
193 std r4,STK_PARM(r4)(r1) /* save ret buffer */ 191 std r4,STK_PARAM(R4)(r1) /* save ret buffer */
194 192
195 mr r11,r3 193 mr r11,r3
196 mr r3,r5 194 mr r3,r5
@@ -204,7 +202,7 @@ _GLOBAL(beat_hcall4)
204 202
205 HCALL_INST_POSTCALL 203 HCALL_INST_POSTCALL
206 204
207 ld r12,STK_PARM(r4)(r1) 205 ld r12,STK_PARAM(R4)(r1)
208 std r4, 0(r12) 206 std r4, 0(r12)
209 std r5, 8(r12) 207 std r5, 8(r12)
210 std r6, 16(r12) 208 std r6, 16(r12)
@@ -224,7 +222,7 @@ _GLOBAL(beat_hcall5)
224 222
225 HCALL_INST_PRECALL 223 HCALL_INST_PRECALL
226 224
227 std r4,STK_PARM(r4)(r1) /* save ret buffer */ 225 std r4,STK_PARAM(R4)(r1) /* save ret buffer */
228 226
229 mr r11,r3 227 mr r11,r3
230 mr r3,r5 228 mr r3,r5
@@ -238,7 +236,7 @@ _GLOBAL(beat_hcall5)
238 236
239 HCALL_INST_POSTCALL 237 HCALL_INST_POSTCALL
240 238
241 ld r12,STK_PARM(r4)(r1) 239 ld r12,STK_PARAM(R4)(r1)
242 std r4, 0(r12) 240 std r4, 0(r12)
243 std r5, 8(r12) 241 std r5, 8(r12)
244 std r6, 16(r12) 242 std r6, 16(r12)
@@ -259,7 +257,7 @@ _GLOBAL(beat_hcall6)
259 257
260 HCALL_INST_PRECALL 258 HCALL_INST_PRECALL
261 259
262 std r4,STK_PARM(r4)(r1) /* save ret buffer */ 260 std r4,STK_PARAM(R4)(r1) /* save ret buffer */
263 261
264 mr r11,r3 262 mr r11,r3
265 mr r3,r5 263 mr r3,r5
@@ -273,7 +271,7 @@ _GLOBAL(beat_hcall6)
273 271
274 HCALL_INST_POSTCALL 272 HCALL_INST_POSTCALL
275 273
276 ld r12,STK_PARM(r4)(r1) 274 ld r12,STK_PARAM(R4)(r1)
277 std r4, 0(r12) 275 std r4, 0(r12)
278 std r5, 8(r12) 276 std r5, 8(r12)
279 std r6, 16(r12) 277 std r6, 16(r12)
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index b9f509a34c01..c264969c9319 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -518,7 +518,6 @@ cell_iommu_setup_window(struct cbe_iommu *iommu, struct device_node *np,
518 __set_bit(0, window->table.it_map); 518 __set_bit(0, window->table.it_map);
519 tce_build_cell(&window->table, window->table.it_offset, 1, 519 tce_build_cell(&window->table, window->table.it_offset, 1,
520 (unsigned long)iommu->pad_page, DMA_TO_DEVICE, NULL); 520 (unsigned long)iommu->pad_page, DMA_TO_DEVICE, NULL);
521 window->table.it_hint = window->table.it_blocksize;
522 521
523 return window; 522 return window;
524} 523}
diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c
index efdacc829576..d17e98bc0c10 100644
--- a/arch/powerpc/platforms/cell/pervasive.c
+++ b/arch/powerpc/platforms/cell/pervasive.c
@@ -42,11 +42,9 @@ static void cbe_power_save(void)
42{ 42{
43 unsigned long ctrl, thread_switch_control; 43 unsigned long ctrl, thread_switch_control;
44 44
45 /* 45 /* Ensure our interrupt state is properly tracked */
46 * We need to hard disable interrupts, the local_irq_enable() done by 46 if (!prep_irq_for_idle())
47 * our caller upon return will hard re-enable. 47 return;
48 */
49 hard_irq_disable();
50 48
51 ctrl = mfspr(SPRN_CTRLF); 49 ctrl = mfspr(SPRN_CTRLF);
52 50
@@ -81,6 +79,9 @@ static void cbe_power_save(void)
81 */ 79 */
82 ctrl &= ~(CTRL_RUNLATCH | CTRL_TE); 80 ctrl &= ~(CTRL_RUNLATCH | CTRL_TE);
83 mtspr(SPRN_CTRLT, ctrl); 81 mtspr(SPRN_CTRLT, ctrl);
82
83 /* Re-enable interrupts in MSR */
84 __hard_irq_enable();
84} 85}
85 86
86static int cbe_system_reset_exception(struct pt_regs *regs) 87static int cbe_system_reset_exception(struct pt_regs *regs)
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 66519d263da7..d544d7816df3 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -317,28 +317,23 @@ out:
317 return ret; 317 return ret;
318} 318}
319 319
320static int spufs_context_open(struct dentry *dentry, struct vfsmount *mnt) 320static int spufs_context_open(struct path *path)
321{ 321{
322 int ret; 322 int ret;
323 struct file *filp; 323 struct file *filp;
324 324
325 ret = get_unused_fd(); 325 ret = get_unused_fd();
326 if (ret < 0) { 326 if (ret < 0)
327 dput(dentry); 327 return ret;
328 mntput(mnt);
329 goto out;
330 }
331 328
332 filp = dentry_open(dentry, mnt, O_RDONLY, current_cred()); 329 filp = dentry_open(path, O_RDONLY, current_cred());
333 if (IS_ERR(filp)) { 330 if (IS_ERR(filp)) {
334 put_unused_fd(ret); 331 put_unused_fd(ret);
335 ret = PTR_ERR(filp); 332 return PTR_ERR(filp);
336 goto out;
337 } 333 }
338 334
339 filp->f_op = &spufs_context_fops; 335 filp->f_op = &spufs_context_fops;
340 fd_install(ret, filp); 336 fd_install(ret, filp);
341out:
342 return ret; 337 return ret;
343} 338}
344 339
@@ -453,6 +448,7 @@ spufs_create_context(struct inode *inode, struct dentry *dentry,
453 int affinity; 448 int affinity;
454 struct spu_gang *gang; 449 struct spu_gang *gang;
455 struct spu_context *neighbor; 450 struct spu_context *neighbor;
451 struct path path = {.mnt = mnt, .dentry = dentry};
456 452
457 ret = -EPERM; 453 ret = -EPERM;
458 if ((flags & SPU_CREATE_NOSCHED) && 454 if ((flags & SPU_CREATE_NOSCHED) &&
@@ -495,11 +491,7 @@ spufs_create_context(struct inode *inode, struct dentry *dentry,
495 put_spu_context(neighbor); 491 put_spu_context(neighbor);
496 } 492 }
497 493
498 /* 494 ret = spufs_context_open(&path);
499 * get references for dget and mntget, will be released
500 * in error path of *_open().
501 */
502 ret = spufs_context_open(dget(dentry), mntget(mnt));
503 if (ret < 0) { 495 if (ret < 0) {
504 WARN_ON(spufs_rmdir(inode, dentry)); 496 WARN_ON(spufs_rmdir(inode, dentry));
505 if (affinity) 497 if (affinity)
@@ -556,28 +548,27 @@ out:
556 return ret; 548 return ret;
557} 549}
558 550
559static int spufs_gang_open(struct dentry *dentry, struct vfsmount *mnt) 551static int spufs_gang_open(struct path *path)
560{ 552{
561 int ret; 553 int ret;
562 struct file *filp; 554 struct file *filp;
563 555
564 ret = get_unused_fd(); 556 ret = get_unused_fd();
565 if (ret < 0) { 557 if (ret < 0)
566 dput(dentry); 558 return ret;
567 mntput(mnt);
568 goto out;
569 }
570 559
571 filp = dentry_open(dentry, mnt, O_RDONLY, current_cred()); 560 /*
561 * get references for dget and mntget, will be released
562 * in error path of *_open().
563 */
564 filp = dentry_open(path, O_RDONLY, current_cred());
572 if (IS_ERR(filp)) { 565 if (IS_ERR(filp)) {
573 put_unused_fd(ret); 566 put_unused_fd(ret);
574 ret = PTR_ERR(filp); 567 return PTR_ERR(filp);
575 goto out;
576 } 568 }
577 569
578 filp->f_op = &simple_dir_operations; 570 filp->f_op = &simple_dir_operations;
579 fd_install(ret, filp); 571 fd_install(ret, filp);
580out:
581 return ret; 572 return ret;
582} 573}
583 574
@@ -585,17 +576,14 @@ static int spufs_create_gang(struct inode *inode,
585 struct dentry *dentry, 576 struct dentry *dentry,
586 struct vfsmount *mnt, umode_t mode) 577 struct vfsmount *mnt, umode_t mode)
587{ 578{
579 struct path path = {.mnt = mnt, .dentry = dentry};
588 int ret; 580 int ret;
589 581
590 ret = spufs_mkgang(inode, dentry, mode & S_IRWXUGO); 582 ret = spufs_mkgang(inode, dentry, mode & S_IRWXUGO);
591 if (ret) 583 if (ret)
592 goto out; 584 goto out;
593 585
594 /* 586 ret = spufs_gang_open(&path);
595 * get references for dget and mntget, will be released
596 * in error path of *_open().
597 */
598 ret = spufs_gang_open(dget(dentry), mntget(mnt));
599 if (ret < 0) { 587 if (ret < 0) {
600 int err = simple_rmdir(inode, dentry); 588 int err = simple_rmdir(inode, dentry);
601 WARN_ON(err); 589 WARN_ON(err);
diff --git a/arch/powerpc/platforms/powernv/opal-takeover.S b/arch/powerpc/platforms/powernv/opal-takeover.S
index 77b48b2b9309..3cd262897c27 100644
--- a/arch/powerpc/platforms/powernv/opal-takeover.S
+++ b/arch/powerpc/platforms/powernv/opal-takeover.S
@@ -14,8 +14,6 @@
14#include <asm/asm-offsets.h> 14#include <asm/asm-offsets.h>
15#include <asm/opal.h> 15#include <asm/opal.h>
16 16
17#define STK_PARAM(i) (48 + ((i)-3)*8)
18
19#define H_HAL_TAKEOVER 0x5124 17#define H_HAL_TAKEOVER 0x5124
20#define H_HAL_TAKEOVER_QUERY_MAGIC -1 18#define H_HAL_TAKEOVER_QUERY_MAGIC -1
21 19
@@ -23,14 +21,14 @@
23_GLOBAL(opal_query_takeover) 21_GLOBAL(opal_query_takeover)
24 mfcr r0 22 mfcr r0
25 stw r0,8(r1) 23 stw r0,8(r1)
26 std r3,STK_PARAM(r3)(r1) 24 std r3,STK_PARAM(R3)(r1)
27 std r4,STK_PARAM(r4)(r1) 25 std r4,STK_PARAM(R4)(r1)
28 li r3,H_HAL_TAKEOVER 26 li r3,H_HAL_TAKEOVER
29 li r4,H_HAL_TAKEOVER_QUERY_MAGIC 27 li r4,H_HAL_TAKEOVER_QUERY_MAGIC
30 HVSC 28 HVSC
31 ld r10,STK_PARAM(r3)(r1) 29 ld r10,STK_PARAM(R3)(r1)
32 std r4,0(r10) 30 std r4,0(r10)
33 ld r10,STK_PARAM(r4)(r1) 31 ld r10,STK_PARAM(R4)(r1)
34 std r5,0(r10) 32 std r5,0(r10)
35 lwz r0,8(r1) 33 lwz r0,8(r1)
36 mtcrf 0xff,r0 34 mtcrf 0xff,r0
diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/platforms/pseries/eeh_event.c
index 4cb375c0f8d1..fb506317ebb0 100644
--- a/arch/powerpc/platforms/pseries/eeh_event.c
+++ b/arch/powerpc/platforms/pseries/eeh_event.c
@@ -85,8 +85,10 @@ static int eeh_event_handler(void * dummy)
85 set_current_state(TASK_INTERRUPTIBLE); /* Don't add to load average */ 85 set_current_state(TASK_INTERRUPTIBLE); /* Don't add to load average */
86 edev = handle_eeh_events(event); 86 edev = handle_eeh_events(event);
87 87
88 eeh_clear_slot(eeh_dev_to_of_node(edev), EEH_MODE_RECOVERING); 88 if (edev) {
89 pci_dev_put(edev->pdev); 89 eeh_clear_slot(eeh_dev_to_of_node(edev), EEH_MODE_RECOVERING);
90 pci_dev_put(edev->pdev);
91 }
90 92
91 kfree(event); 93 kfree(event);
92 mutex_unlock(&eeh_event_mutex); 94 mutex_unlock(&eeh_event_mutex);
diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
index 8752f79a6af8..c33360ec4f4f 100644
--- a/arch/powerpc/platforms/pseries/eeh_pseries.c
+++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
@@ -81,7 +81,7 @@ static int pseries_eeh_init(void)
81 ibm_get_config_addr_info2 = rtas_token("ibm,get-config-addr-info2"); 81 ibm_get_config_addr_info2 = rtas_token("ibm,get-config-addr-info2");
82 ibm_get_config_addr_info = rtas_token("ibm,get-config-addr-info"); 82 ibm_get_config_addr_info = rtas_token("ibm,get-config-addr-info");
83 ibm_configure_pe = rtas_token("ibm,configure-pe"); 83 ibm_configure_pe = rtas_token("ibm,configure-pe");
84 ibm_configure_bridge = rtas_token ("ibm,configure-bridge"); 84 ibm_configure_bridge = rtas_token("ibm,configure-bridge");
85 85
86 /* necessary sanity check */ 86 /* necessary sanity check */
87 if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE) { 87 if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE) {
@@ -89,7 +89,7 @@ static int pseries_eeh_init(void)
89 __func__); 89 __func__);
90 return -EINVAL; 90 return -EINVAL;
91 } else if (ibm_set_slot_reset == RTAS_UNKNOWN_SERVICE) { 91 } else if (ibm_set_slot_reset == RTAS_UNKNOWN_SERVICE) {
92 pr_warning("%s: RTAS service <ibm, set-slot-reset> invalid\n", 92 pr_warning("%s: RTAS service <ibm,set-slot-reset> invalid\n",
93 __func__); 93 __func__);
94 return -EINVAL; 94 return -EINVAL;
95 } else if (ibm_read_slot_reset_state2 == RTAS_UNKNOWN_SERVICE && 95 } else if (ibm_read_slot_reset_state2 == RTAS_UNKNOWN_SERVICE &&
diff --git a/arch/powerpc/platforms/pseries/hvCall.S b/arch/powerpc/platforms/pseries/hvCall.S
index 3ce73d0052b1..444fe7759e55 100644
--- a/arch/powerpc/platforms/pseries/hvCall.S
+++ b/arch/powerpc/platforms/pseries/hvCall.S
@@ -13,8 +13,6 @@
13#include <asm/asm-offsets.h> 13#include <asm/asm-offsets.h>
14#include <asm/ptrace.h> 14#include <asm/ptrace.h>
15 15
16#define STK_PARM(i) (48 + ((i)-3)*8)
17
18#ifdef CONFIG_TRACEPOINTS 16#ifdef CONFIG_TRACEPOINTS
19 17
20 .section ".toc","aw" 18 .section ".toc","aw"
@@ -26,7 +24,7 @@ hcall_tracepoint_refcount:
26 .section ".text" 24 .section ".text"
27 25
28/* 26/*
29 * precall must preserve all registers. use unused STK_PARM() 27 * precall must preserve all registers. use unused STK_PARAM()
30 * areas to save snapshots and opcode. We branch around this 28 * areas to save snapshots and opcode. We branch around this
31 * in early init (eg when populating the MMU hashtable) by using an 29 * in early init (eg when populating the MMU hashtable) by using an
32 * unconditional cpu feature. 30 * unconditional cpu feature.
@@ -40,28 +38,28 @@ END_FTR_SECTION(0, 1); \
40 cmpdi r12,0; \ 38 cmpdi r12,0; \
41 beq+ 1f; \ 39 beq+ 1f; \
42 mflr r0; \ 40 mflr r0; \
43 std r3,STK_PARM(r3)(r1); \ 41 std r3,STK_PARAM(R3)(r1); \
44 std r4,STK_PARM(r4)(r1); \ 42 std r4,STK_PARAM(R4)(r1); \
45 std r5,STK_PARM(r5)(r1); \ 43 std r5,STK_PARAM(R5)(r1); \
46 std r6,STK_PARM(r6)(r1); \ 44 std r6,STK_PARAM(R6)(r1); \
47 std r7,STK_PARM(r7)(r1); \ 45 std r7,STK_PARAM(R7)(r1); \
48 std r8,STK_PARM(r8)(r1); \ 46 std r8,STK_PARAM(R8)(r1); \
49 std r9,STK_PARM(r9)(r1); \ 47 std r9,STK_PARAM(R9)(r1); \
50 std r10,STK_PARM(r10)(r1); \ 48 std r10,STK_PARAM(R10)(r1); \
51 std r0,16(r1); \ 49 std r0,16(r1); \
52 addi r4,r1,STK_PARM(FIRST_REG); \ 50 addi r4,r1,STK_PARAM(FIRST_REG); \
53 stdu r1,-STACK_FRAME_OVERHEAD(r1); \ 51 stdu r1,-STACK_FRAME_OVERHEAD(r1); \
54 bl .__trace_hcall_entry; \ 52 bl .__trace_hcall_entry; \
55 addi r1,r1,STACK_FRAME_OVERHEAD; \ 53 addi r1,r1,STACK_FRAME_OVERHEAD; \
56 ld r0,16(r1); \ 54 ld r0,16(r1); \
57 ld r3,STK_PARM(r3)(r1); \ 55 ld r3,STK_PARAM(R3)(r1); \
58 ld r4,STK_PARM(r4)(r1); \ 56 ld r4,STK_PARAM(R4)(r1); \
59 ld r5,STK_PARM(r5)(r1); \ 57 ld r5,STK_PARAM(R5)(r1); \
60 ld r6,STK_PARM(r6)(r1); \ 58 ld r6,STK_PARAM(R6)(r1); \
61 ld r7,STK_PARM(r7)(r1); \ 59 ld r7,STK_PARAM(R7)(r1); \
62 ld r8,STK_PARM(r8)(r1); \ 60 ld r8,STK_PARAM(R8)(r1); \
63 ld r9,STK_PARM(r9)(r1); \ 61 ld r9,STK_PARAM(R9)(r1); \
64 ld r10,STK_PARM(r10)(r1); \ 62 ld r10,STK_PARAM(R10)(r1); \
65 mtlr r0; \ 63 mtlr r0; \
661: 641:
67 65
@@ -79,8 +77,8 @@ END_FTR_SECTION(0, 1); \
79 cmpdi r12,0; \ 77 cmpdi r12,0; \
80 beq+ 1f; \ 78 beq+ 1f; \
81 mflr r0; \ 79 mflr r0; \
82 ld r6,STK_PARM(r3)(r1); \ 80 ld r6,STK_PARAM(R3)(r1); \
83 std r3,STK_PARM(r3)(r1); \ 81 std r3,STK_PARAM(R3)(r1); \
84 mr r4,r3; \ 82 mr r4,r3; \
85 mr r3,r6; \ 83 mr r3,r6; \
86 std r0,16(r1); \ 84 std r0,16(r1); \
@@ -88,7 +86,7 @@ END_FTR_SECTION(0, 1); \
88 bl .__trace_hcall_exit; \ 86 bl .__trace_hcall_exit; \
89 addi r1,r1,STACK_FRAME_OVERHEAD; \ 87 addi r1,r1,STACK_FRAME_OVERHEAD; \
90 ld r0,16(r1); \ 88 ld r0,16(r1); \
91 ld r3,STK_PARM(r3)(r1); \ 89 ld r3,STK_PARAM(R3)(r1); \
92 mtlr r0; \ 90 mtlr r0; \
931: 911:
94 92
@@ -114,7 +112,7 @@ _GLOBAL(plpar_hcall_norets)
114 mfcr r0 112 mfcr r0
115 stw r0,8(r1) 113 stw r0,8(r1)
116 114
117 HCALL_INST_PRECALL(r4) 115 HCALL_INST_PRECALL(R4)
118 116
119 HVSC /* invoke the hypervisor */ 117 HVSC /* invoke the hypervisor */
120 118
@@ -130,9 +128,9 @@ _GLOBAL(plpar_hcall)
130 mfcr r0 128 mfcr r0
131 stw r0,8(r1) 129 stw r0,8(r1)
132 130
133 HCALL_INST_PRECALL(r5) 131 HCALL_INST_PRECALL(R5)
134 132
135 std r4,STK_PARM(r4)(r1) /* Save ret buffer */ 133 std r4,STK_PARAM(R4)(r1) /* Save ret buffer */
136 134
137 mr r4,r5 135 mr r4,r5
138 mr r5,r6 136 mr r5,r6
@@ -143,7 +141,7 @@ _GLOBAL(plpar_hcall)
143 141
144 HVSC /* invoke the hypervisor */ 142 HVSC /* invoke the hypervisor */
145 143
146 ld r12,STK_PARM(r4)(r1) 144 ld r12,STK_PARAM(R4)(r1)
147 std r4, 0(r12) 145 std r4, 0(r12)
148 std r5, 8(r12) 146 std r5, 8(r12)
149 std r6, 16(r12) 147 std r6, 16(r12)
@@ -168,7 +166,7 @@ _GLOBAL(plpar_hcall_raw)
168 mfcr r0 166 mfcr r0
169 stw r0,8(r1) 167 stw r0,8(r1)
170 168
171 std r4,STK_PARM(r4)(r1) /* Save ret buffer */ 169 std r4,STK_PARAM(R4)(r1) /* Save ret buffer */
172 170
173 mr r4,r5 171 mr r4,r5
174 mr r5,r6 172 mr r5,r6
@@ -179,7 +177,7 @@ _GLOBAL(plpar_hcall_raw)
179 177
180 HVSC /* invoke the hypervisor */ 178 HVSC /* invoke the hypervisor */
181 179
182 ld r12,STK_PARM(r4)(r1) 180 ld r12,STK_PARAM(R4)(r1)
183 std r4, 0(r12) 181 std r4, 0(r12)
184 std r5, 8(r12) 182 std r5, 8(r12)
185 std r6, 16(r12) 183 std r6, 16(r12)
@@ -196,9 +194,9 @@ _GLOBAL(plpar_hcall9)
196 mfcr r0 194 mfcr r0
197 stw r0,8(r1) 195 stw r0,8(r1)
198 196
199 HCALL_INST_PRECALL(r5) 197 HCALL_INST_PRECALL(R5)
200 198
201 std r4,STK_PARM(r4)(r1) /* Save ret buffer */ 199 std r4,STK_PARAM(R4)(r1) /* Save ret buffer */
202 200
203 mr r4,r5 201 mr r4,r5
204 mr r5,r6 202 mr r5,r6
@@ -206,14 +204,14 @@ _GLOBAL(plpar_hcall9)
206 mr r7,r8 204 mr r7,r8
207 mr r8,r9 205 mr r8,r9
208 mr r9,r10 206 mr r9,r10
209 ld r10,STK_PARM(r11)(r1) /* put arg7 in R10 */ 207 ld r10,STK_PARAM(R11)(r1) /* put arg7 in R10 */
210 ld r11,STK_PARM(r12)(r1) /* put arg8 in R11 */ 208 ld r11,STK_PARAM(R12)(r1) /* put arg8 in R11 */
211 ld r12,STK_PARM(r13)(r1) /* put arg9 in R12 */ 209 ld r12,STK_PARAM(R13)(r1) /* put arg9 in R12 */
212 210
213 HVSC /* invoke the hypervisor */ 211 HVSC /* invoke the hypervisor */
214 212
215 mr r0,r12 213 mr r0,r12
216 ld r12,STK_PARM(r4)(r1) 214 ld r12,STK_PARAM(R4)(r1)
217 std r4, 0(r12) 215 std r4, 0(r12)
218 std r5, 8(r12) 216 std r5, 8(r12)
219 std r6, 16(r12) 217 std r6, 16(r12)
@@ -238,7 +236,7 @@ _GLOBAL(plpar_hcall9_raw)
238 mfcr r0 236 mfcr r0
239 stw r0,8(r1) 237 stw r0,8(r1)
240 238
241 std r4,STK_PARM(r4)(r1) /* Save ret buffer */ 239 std r4,STK_PARAM(R4)(r1) /* Save ret buffer */
242 240
243 mr r4,r5 241 mr r4,r5
244 mr r5,r6 242 mr r5,r6
@@ -246,14 +244,14 @@ _GLOBAL(plpar_hcall9_raw)
246 mr r7,r8 244 mr r7,r8
247 mr r8,r9 245 mr r8,r9
248 mr r9,r10 246 mr r9,r10
249 ld r10,STK_PARM(r11)(r1) /* put arg7 in R10 */ 247 ld r10,STK_PARAM(R11)(r1) /* put arg7 in R10 */
250 ld r11,STK_PARM(r12)(r1) /* put arg8 in R11 */ 248 ld r11,STK_PARAM(R12)(r1) /* put arg8 in R11 */
251 ld r12,STK_PARM(r13)(r1) /* put arg9 in R12 */ 249 ld r12,STK_PARAM(R13)(r1) /* put arg9 in R12 */
252 250
253 HVSC /* invoke the hypervisor */ 251 HVSC /* invoke the hypervisor */
254 252
255 mr r0,r12 253 mr r0,r12
256 ld r12,STK_PARM(r4)(r1) 254 ld r12,STK_PARAM(R4)(r1)
257 std r4, 0(r12) 255 std r4, 0(r12)
258 std r5, 8(r12) 256 std r5, 8(r12)
259 std r6, 16(r12) 257 std r6, 16(r12)
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 0915b1ad66ce..07c09cbbfb19 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -106,7 +106,7 @@ static int tce_build_pSeries(struct iommu_table *tbl, long index,
106 tcep++; 106 tcep++;
107 } 107 }
108 108
109 if (tbl->it_type == TCE_PCI_SWINV_CREATE) 109 if (tbl->it_type & TCE_PCI_SWINV_CREATE)
110 tce_invalidate_pSeries_sw(tbl, tces, tcep - 1); 110 tce_invalidate_pSeries_sw(tbl, tces, tcep - 1);
111 return 0; 111 return 0;
112} 112}
@@ -121,7 +121,7 @@ static void tce_free_pSeries(struct iommu_table *tbl, long index, long npages)
121 while (npages--) 121 while (npages--)
122 *(tcep++) = 0; 122 *(tcep++) = 0;
123 123
124 if (tbl->it_type == TCE_PCI_SWINV_FREE) 124 if (tbl->it_type & TCE_PCI_SWINV_FREE)
125 tce_invalidate_pSeries_sw(tbl, tces, tcep - 1); 125 tce_invalidate_pSeries_sw(tbl, tces, tcep - 1);
126} 126}
127 127
@@ -192,12 +192,15 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
192 long l, limit; 192 long l, limit;
193 long tcenum_start = tcenum, npages_start = npages; 193 long tcenum_start = tcenum, npages_start = npages;
194 int ret = 0; 194 int ret = 0;
195 unsigned long flags;
195 196
196 if (npages == 1) { 197 if (npages == 1) {
197 return tce_build_pSeriesLP(tbl, tcenum, npages, uaddr, 198 return tce_build_pSeriesLP(tbl, tcenum, npages, uaddr,
198 direction, attrs); 199 direction, attrs);
199 } 200 }
200 201
202 local_irq_save(flags); /* to protect tcep and the page behind it */
203
201 tcep = __get_cpu_var(tce_page); 204 tcep = __get_cpu_var(tce_page);
202 205
203 /* This is safe to do since interrupts are off when we're called 206 /* This is safe to do since interrupts are off when we're called
@@ -207,6 +210,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
207 tcep = (u64 *)__get_free_page(GFP_ATOMIC); 210 tcep = (u64 *)__get_free_page(GFP_ATOMIC);
208 /* If allocation fails, fall back to the loop implementation */ 211 /* If allocation fails, fall back to the loop implementation */
209 if (!tcep) { 212 if (!tcep) {
213 local_irq_restore(flags);
210 return tce_build_pSeriesLP(tbl, tcenum, npages, uaddr, 214 return tce_build_pSeriesLP(tbl, tcenum, npages, uaddr,
211 direction, attrs); 215 direction, attrs);
212 } 216 }
@@ -240,6 +244,8 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
240 tcenum += limit; 244 tcenum += limit;
241 } while (npages > 0 && !rc); 245 } while (npages > 0 && !rc);
242 246
247 local_irq_restore(flags);
248
243 if (unlikely(rc == H_NOT_ENOUGH_RESOURCES)) { 249 if (unlikely(rc == H_NOT_ENOUGH_RESOURCES)) {
244 ret = (int)rc; 250 ret = (int)rc;
245 tce_freemulti_pSeriesLP(tbl, tcenum_start, 251 tce_freemulti_pSeriesLP(tbl, tcenum_start,
@@ -707,6 +713,21 @@ static int __init disable_ddw_setup(char *str)
707 713
708early_param("disable_ddw", disable_ddw_setup); 714early_param("disable_ddw", disable_ddw_setup);
709 715
716static inline void __remove_ddw(struct device_node *np, const u32 *ddw_avail, u64 liobn)
717{
718 int ret;
719
720 ret = rtas_call(ddw_avail[2], 1, 1, NULL, liobn);
721 if (ret)
722 pr_warning("%s: failed to remove DMA window: rtas returned "
723 "%d to ibm,remove-pe-dma-window(%x) %llx\n",
724 np->full_name, ret, ddw_avail[2], liobn);
725 else
726 pr_debug("%s: successfully removed DMA window: rtas returned "
727 "%d to ibm,remove-pe-dma-window(%x) %llx\n",
728 np->full_name, ret, ddw_avail[2], liobn);
729}
730
710static void remove_ddw(struct device_node *np) 731static void remove_ddw(struct device_node *np)
711{ 732{
712 struct dynamic_dma_window_prop *dwp; 733 struct dynamic_dma_window_prop *dwp;
@@ -736,15 +757,7 @@ static void remove_ddw(struct device_node *np)
736 pr_debug("%s successfully cleared tces in window.\n", 757 pr_debug("%s successfully cleared tces in window.\n",
737 np->full_name); 758 np->full_name);
738 759
739 ret = rtas_call(ddw_avail[2], 1, 1, NULL, liobn); 760 __remove_ddw(np, ddw_avail, liobn);
740 if (ret)
741 pr_warning("%s: failed to remove direct window: rtas returned "
742 "%d to ibm,remove-pe-dma-window(%x) %llx\n",
743 np->full_name, ret, ddw_avail[2], liobn);
744 else
745 pr_debug("%s: successfully removed direct window: rtas returned "
746 "%d to ibm,remove-pe-dma-window(%x) %llx\n",
747 np->full_name, ret, ddw_avail[2], liobn);
748 761
749delprop: 762delprop:
750 ret = prom_remove_property(np, win64); 763 ret = prom_remove_property(np, win64);
@@ -869,6 +882,35 @@ static int create_ddw(struct pci_dev *dev, const u32 *ddw_avail,
869 return ret; 882 return ret;
870} 883}
871 884
885static void restore_default_window(struct pci_dev *dev,
886 u32 ddw_restore_token, unsigned long liobn)
887{
888 struct eeh_dev *edev;
889 u32 cfg_addr;
890 u64 buid;
891 int ret;
892
893 /*
894 * Get the config address and phb buid of the PE window.
895 * Rely on eeh to retrieve this for us.
896 * Retrieve them from the pci device, not the node with the
897 * dma-window property
898 */
899 edev = pci_dev_to_eeh_dev(dev);
900 cfg_addr = edev->config_addr;
901 if (edev->pe_config_addr)
902 cfg_addr = edev->pe_config_addr;
903 buid = edev->phb->buid;
904
905 do {
906 ret = rtas_call(ddw_restore_token, 3, 1, NULL, cfg_addr,
907 BUID_HI(buid), BUID_LO(buid));
908 } while (rtas_busy_delay(ret));
909 dev_info(&dev->dev,
910 "ibm,reset-pe-dma-windows(%x) %x %x %x returned %d\n",
911 ddw_restore_token, cfg_addr, BUID_HI(buid), BUID_LO(buid), ret);
912}
913
872/* 914/*
873 * If the PE supports dynamic dma windows, and there is space for a table 915 * If the PE supports dynamic dma windows, and there is space for a table
874 * that can map all pages in a linear offset, then setup such a table, 916 * that can map all pages in a linear offset, then setup such a table,
@@ -889,9 +931,13 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
889 u64 dma_addr, max_addr; 931 u64 dma_addr, max_addr;
890 struct device_node *dn; 932 struct device_node *dn;
891 const u32 *uninitialized_var(ddw_avail); 933 const u32 *uninitialized_var(ddw_avail);
934 const u32 *uninitialized_var(ddw_extensions);
935 u32 ddw_restore_token = 0;
892 struct direct_window *window; 936 struct direct_window *window;
893 struct property *win64; 937 struct property *win64;
894 struct dynamic_dma_window_prop *ddwprop; 938 struct dynamic_dma_window_prop *ddwprop;
939 const void *dma_window = NULL;
940 unsigned long liobn, offset, size;
895 941
896 mutex_lock(&direct_window_init_mutex); 942 mutex_lock(&direct_window_init_mutex);
897 943
@@ -911,7 +957,40 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
911 if (!ddw_avail || len < 3 * sizeof(u32)) 957 if (!ddw_avail || len < 3 * sizeof(u32))
912 goto out_unlock; 958 goto out_unlock;
913 959
914 /* 960 /*
961 * the extensions property is only required to exist in certain
962 * levels of firmware and later
963 * the ibm,ddw-extensions property is a list with the first
964 * element containing the number of extensions and each
965 * subsequent entry is a value corresponding to that extension
966 */
967 ddw_extensions = of_get_property(pdn, "ibm,ddw-extensions", &len);
968 if (ddw_extensions) {
969 /*
970 * each new defined extension length should be added to
971 * the top of the switch so the "earlier" entries also
972 * get picked up
973 */
974 switch (ddw_extensions[0]) {
975 /* ibm,reset-pe-dma-windows */
976 case 1:
977 ddw_restore_token = ddw_extensions[1];
978 break;
979 }
980 }
981
982 /*
983 * Only remove the existing DMA window if we can restore back to
984 * the default state. Removing the existing window maximizes the
985 * resources available to firmware for dynamic window creation.
986 */
987 if (ddw_restore_token) {
988 dma_window = of_get_property(pdn, "ibm,dma-window", NULL);
989 of_parse_dma_window(pdn, dma_window, &liobn, &offset, &size);
990 __remove_ddw(pdn, ddw_avail, liobn);
991 }
992
993 /*
915 * Query if there is a second window of size to map the 994 * Query if there is a second window of size to map the
916 * whole partition. Query returns number of windows, largest 995 * whole partition. Query returns number of windows, largest
917 * block assigned to PE (partition endpoint), and two bitmasks 996 * block assigned to PE (partition endpoint), and two bitmasks
@@ -920,7 +999,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
920 dn = pci_device_to_OF_node(dev); 999 dn = pci_device_to_OF_node(dev);
921 ret = query_ddw(dev, ddw_avail, &query); 1000 ret = query_ddw(dev, ddw_avail, &query);
922 if (ret != 0) 1001 if (ret != 0)
923 goto out_unlock; 1002 goto out_restore_window;
924 1003
925 if (query.windows_available == 0) { 1004 if (query.windows_available == 0) {
926 /* 1005 /*
@@ -929,7 +1008,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
929 * trading in for a larger page size. 1008 * trading in for a larger page size.
930 */ 1009 */
931 dev_dbg(&dev->dev, "no free dynamic windows"); 1010 dev_dbg(&dev->dev, "no free dynamic windows");
932 goto out_unlock; 1011 goto out_restore_window;
933 } 1012 }
934 if (query.page_size & 4) { 1013 if (query.page_size & 4) {
935 page_shift = 24; /* 16MB */ 1014 page_shift = 24; /* 16MB */
@@ -940,7 +1019,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
940 } else { 1019 } else {
941 dev_dbg(&dev->dev, "no supported direct page size in mask %x", 1020 dev_dbg(&dev->dev, "no supported direct page size in mask %x",
942 query.page_size); 1021 query.page_size);
943 goto out_unlock; 1022 goto out_restore_window;
944 } 1023 }
945 /* verify the window * number of ptes will map the partition */ 1024 /* verify the window * number of ptes will map the partition */
946 /* check largest block * page size > max memory hotplug addr */ 1025 /* check largest block * page size > max memory hotplug addr */
@@ -949,14 +1028,14 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
949 dev_dbg(&dev->dev, "can't map partiton max 0x%llx with %u " 1028 dev_dbg(&dev->dev, "can't map partiton max 0x%llx with %u "
950 "%llu-sized pages\n", max_addr, query.largest_available_block, 1029 "%llu-sized pages\n", max_addr, query.largest_available_block,
951 1ULL << page_shift); 1030 1ULL << page_shift);
952 goto out_unlock; 1031 goto out_restore_window;
953 } 1032 }
954 len = order_base_2(max_addr); 1033 len = order_base_2(max_addr);
955 win64 = kzalloc(sizeof(struct property), GFP_KERNEL); 1034 win64 = kzalloc(sizeof(struct property), GFP_KERNEL);
956 if (!win64) { 1035 if (!win64) {
957 dev_info(&dev->dev, 1036 dev_info(&dev->dev,
958 "couldn't allocate property for 64bit dma window\n"); 1037 "couldn't allocate property for 64bit dma window\n");
959 goto out_unlock; 1038 goto out_restore_window;
960 } 1039 }
961 win64->name = kstrdup(DIRECT64_PROPNAME, GFP_KERNEL); 1040 win64->name = kstrdup(DIRECT64_PROPNAME, GFP_KERNEL);
962 win64->value = ddwprop = kmalloc(sizeof(*ddwprop), GFP_KERNEL); 1041 win64->value = ddwprop = kmalloc(sizeof(*ddwprop), GFP_KERNEL);
@@ -1018,6 +1097,10 @@ out_free_prop:
1018 kfree(win64->value); 1097 kfree(win64->value);
1019 kfree(win64); 1098 kfree(win64);
1020 1099
1100out_restore_window:
1101 if (ddw_restore_token)
1102 restore_default_window(dev, ddw_restore_token, liobn);
1103
1021out_unlock: 1104out_unlock:
1022 mutex_unlock(&direct_window_init_mutex); 1105 mutex_unlock(&direct_window_init_mutex);
1023 return dma_addr; 1106 return dma_addr;
diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index 029a562af373..dd30b12edfe4 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -67,7 +67,6 @@ static int update_dt_property(struct device_node *dn, struct property **prop,
67 const char *name, u32 vd, char *value) 67 const char *name, u32 vd, char *value)
68{ 68{
69 struct property *new_prop = *prop; 69 struct property *new_prop = *prop;
70 struct property *old_prop;
71 int more = 0; 70 int more = 0;
72 71
73 /* A negative 'vd' value indicates that only part of the new property 72 /* A negative 'vd' value indicates that only part of the new property
@@ -117,12 +116,7 @@ static int update_dt_property(struct device_node *dn, struct property **prop,
117 } 116 }
118 117
119 if (!more) { 118 if (!more) {
120 old_prop = of_find_property(dn, new_prop->name, NULL); 119 prom_update_property(dn, new_prop);
121 if (old_prop)
122 prom_update_property(dn, new_prop, old_prop);
123 else
124 prom_add_property(dn, new_prop);
125
126 new_prop = NULL; 120 new_prop = NULL;
127 } 121 }
128 122
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index 36f957f31842..8733a86ad52e 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -68,9 +68,7 @@ static const char *pseries_nvram_os_partitions[] = {
68}; 68};
69 69
70static void oops_to_nvram(struct kmsg_dumper *dumper, 70static void oops_to_nvram(struct kmsg_dumper *dumper,
71 enum kmsg_dump_reason reason, 71 enum kmsg_dump_reason reason);
72 const char *old_msgs, unsigned long old_len,
73 const char *new_msgs, unsigned long new_len);
74 72
75static struct kmsg_dumper nvram_kmsg_dumper = { 73static struct kmsg_dumper nvram_kmsg_dumper = {
76 .dump = oops_to_nvram 74 .dump = oops_to_nvram
@@ -504,28 +502,6 @@ int __init pSeries_nvram_init(void)
504} 502}
505 503
506/* 504/*
507 * Try to capture the last capture_len bytes of the printk buffer. Return
508 * the amount actually captured.
509 */
510static size_t capture_last_msgs(const char *old_msgs, size_t old_len,
511 const char *new_msgs, size_t new_len,
512 char *captured, size_t capture_len)
513{
514 if (new_len >= capture_len) {
515 memcpy(captured, new_msgs + (new_len - capture_len),
516 capture_len);
517 return capture_len;
518 } else {
519 /* Grab the end of old_msgs. */
520 size_t old_tail_len = min(old_len, capture_len - new_len);
521 memcpy(captured, old_msgs + (old_len - old_tail_len),
522 old_tail_len);
523 memcpy(captured + old_tail_len, new_msgs, new_len);
524 return old_tail_len + new_len;
525 }
526}
527
528/*
529 * Are we using the ibm,rtas-log for oops/panic reports? And if so, 505 * Are we using the ibm,rtas-log for oops/panic reports? And if so,
530 * would logging this oops/panic overwrite an RTAS event that rtas_errd 506 * would logging this oops/panic overwrite an RTAS event that rtas_errd
531 * hasn't had a chance to read and process? Return 1 if so, else 0. 507 * hasn't had a chance to read and process? Return 1 if so, else 0.
@@ -541,27 +517,6 @@ static int clobbering_unread_rtas_event(void)
541 NVRAM_RTAS_READ_TIMEOUT); 517 NVRAM_RTAS_READ_TIMEOUT);
542} 518}
543 519
544/* Squeeze out each line's <n> severity prefix. */
545static size_t elide_severities(char *buf, size_t len)
546{
547 char *in, *out, *buf_end = buf + len;
548 /* Assume a <n> at the very beginning marks the start of a line. */
549 int newline = 1;
550
551 in = out = buf;
552 while (in < buf_end) {
553 if (newline && in+3 <= buf_end &&
554 *in == '<' && isdigit(in[1]) && in[2] == '>') {
555 in += 3;
556 newline = 0;
557 } else {
558 newline = (*in == '\n');
559 *out++ = *in++;
560 }
561 }
562 return out - buf;
563}
564
565/* Derived from logfs_compress() */ 520/* Derived from logfs_compress() */
566static int nvram_compress(const void *in, void *out, size_t inlen, 521static int nvram_compress(const void *in, void *out, size_t inlen,
567 size_t outlen) 522 size_t outlen)
@@ -619,9 +574,7 @@ static int zip_oops(size_t text_len)
619 * partition. If that's too much, go back and capture uncompressed text. 574 * partition. If that's too much, go back and capture uncompressed text.
620 */ 575 */
621static void oops_to_nvram(struct kmsg_dumper *dumper, 576static void oops_to_nvram(struct kmsg_dumper *dumper,
622 enum kmsg_dump_reason reason, 577 enum kmsg_dump_reason reason)
623 const char *old_msgs, unsigned long old_len,
624 const char *new_msgs, unsigned long new_len)
625{ 578{
626 static unsigned int oops_count = 0; 579 static unsigned int oops_count = 0;
627 static bool panicking = false; 580 static bool panicking = false;
@@ -660,14 +613,14 @@ static void oops_to_nvram(struct kmsg_dumper *dumper,
660 return; 613 return;
661 614
662 if (big_oops_buf) { 615 if (big_oops_buf) {
663 text_len = capture_last_msgs(old_msgs, old_len, 616 kmsg_dump_get_buffer(dumper, false,
664 new_msgs, new_len, big_oops_buf, big_oops_buf_sz); 617 big_oops_buf, big_oops_buf_sz, &text_len);
665 text_len = elide_severities(big_oops_buf, text_len);
666 rc = zip_oops(text_len); 618 rc = zip_oops(text_len);
667 } 619 }
668 if (rc != 0) { 620 if (rc != 0) {
669 text_len = capture_last_msgs(old_msgs, old_len, 621 kmsg_dump_rewind(dumper);
670 new_msgs, new_len, oops_data, oops_data_sz); 622 kmsg_dump_get_buffer(dumper, true,
623 oops_data, oops_data_sz, &text_len);
671 err_type = ERR_TYPE_KERNEL_PANIC; 624 err_type = ERR_TYPE_KERNEL_PANIC;
672 *oops_len = (u16) text_len; 625 *oops_len = (u16) text_len;
673 } 626 }
diff --git a/arch/powerpc/platforms/pseries/processor_idle.c b/arch/powerpc/platforms/pseries/processor_idle.c
index 41a34bc4a9a2..455760b1fe6e 100644
--- a/arch/powerpc/platforms/pseries/processor_idle.c
+++ b/arch/powerpc/platforms/pseries/processor_idle.c
@@ -11,6 +11,7 @@
11#include <linux/moduleparam.h> 11#include <linux/moduleparam.h>
12#include <linux/cpuidle.h> 12#include <linux/cpuidle.h>
13#include <linux/cpu.h> 13#include <linux/cpu.h>
14#include <linux/notifier.h>
14 15
15#include <asm/paca.h> 16#include <asm/paca.h>
16#include <asm/reg.h> 17#include <asm/reg.h>
@@ -99,15 +100,18 @@ out:
99static void check_and_cede_processor(void) 100static void check_and_cede_processor(void)
100{ 101{
101 /* 102 /*
102 * Interrupts are soft-disabled at this point, 103 * Ensure our interrupt state is properly tracked,
103 * but not hard disabled. So an interrupt might have 104 * also checks if no interrupt has occurred while we
104 * occurred before entering NAP, and would be potentially 105 * were soft-disabled
105 * lost (edge events, decrementer events, etc...) unless
106 * we first hard disable then check.
107 */ 106 */
108 hard_irq_disable(); 107 if (prep_irq_for_idle()) {
109 if (get_paca()->irq_happened == 0)
110 cede_processor(); 108 cede_processor();
109#ifdef CONFIG_TRACE_IRQFLAGS
110 /* Ensure that H_CEDE returns with IRQs on */
111 if (WARN_ON(!(mfmsr() & MSR_EE)))
112 __hard_irq_enable();
113#endif
114 }
111} 115}
112 116
113static int dedicated_cede_loop(struct cpuidle_device *dev, 117static int dedicated_cede_loop(struct cpuidle_device *dev,
@@ -186,17 +190,40 @@ static struct cpuidle_state shared_states[MAX_IDLE_STATE_COUNT] = {
186 .enter = &shared_cede_loop }, 190 .enter = &shared_cede_loop },
187}; 191};
188 192
189int pseries_notify_cpuidle_add_cpu(int cpu) 193static int pseries_cpuidle_add_cpu_notifier(struct notifier_block *n,
194 unsigned long action, void *hcpu)
190{ 195{
196 int hotcpu = (unsigned long)hcpu;
191 struct cpuidle_device *dev = 197 struct cpuidle_device *dev =
192 per_cpu_ptr(pseries_cpuidle_devices, cpu); 198 per_cpu_ptr(pseries_cpuidle_devices, hotcpu);
199
193 if (dev && cpuidle_get_driver()) { 200 if (dev && cpuidle_get_driver()) {
194 cpuidle_disable_device(dev); 201 switch (action) {
195 cpuidle_enable_device(dev); 202 case CPU_ONLINE:
203 case CPU_ONLINE_FROZEN:
204 cpuidle_pause_and_lock();
205 cpuidle_enable_device(dev);
206 cpuidle_resume_and_unlock();
207 break;
208
209 case CPU_DEAD:
210 case CPU_DEAD_FROZEN:
211 cpuidle_pause_and_lock();
212 cpuidle_disable_device(dev);
213 cpuidle_resume_and_unlock();
214 break;
215
216 default:
217 return NOTIFY_DONE;
218 }
196 } 219 }
197 return 0; 220 return NOTIFY_OK;
198} 221}
199 222
223static struct notifier_block setup_hotplug_notifier = {
224 .notifier_call = pseries_cpuidle_add_cpu_notifier,
225};
226
200/* 227/*
201 * pseries_cpuidle_driver_init() 228 * pseries_cpuidle_driver_init()
202 */ 229 */
@@ -321,6 +348,7 @@ static int __init pseries_processor_idle_init(void)
321 return retval; 348 return retval;
322 } 349 }
323 350
351 register_cpu_notifier(&setup_hotplug_notifier);
324 printk(KERN_DEBUG "pseries_idle_driver registered\n"); 352 printk(KERN_DEBUG "pseries_idle_driver registered\n");
325 353
326 return 0; 354 return 0;
@@ -329,6 +357,7 @@ static int __init pseries_processor_idle_init(void)
329static void __exit pseries_processor_idle_exit(void) 357static void __exit pseries_processor_idle_exit(void)
330{ 358{
331 359
360 unregister_cpu_notifier(&setup_hotplug_notifier);
332 pseries_idle_devices_uninit(); 361 pseries_idle_devices_uninit();
333 cpuidle_unregister_driver(&pseries_idle_driver); 362 cpuidle_unregister_driver(&pseries_idle_driver);
334 363
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 7b3bf76ef834..39f71fba9b38 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -432,7 +432,7 @@ static int do_update_property(char *buf, size_t bufsize)
432 unsigned char *value; 432 unsigned char *value;
433 char *name, *end, *next_prop; 433 char *name, *end, *next_prop;
434 int rc, length; 434 int rc, length;
435 struct property *newprop, *oldprop; 435 struct property *newprop;
436 buf = parse_node(buf, bufsize, &np); 436 buf = parse_node(buf, bufsize, &np);
437 end = buf + bufsize; 437 end = buf + bufsize;
438 438
@@ -443,6 +443,9 @@ static int do_update_property(char *buf, size_t bufsize)
443 if (!next_prop) 443 if (!next_prop)
444 return -EINVAL; 444 return -EINVAL;
445 445
446 if (!strlen(name))
447 return -ENODEV;
448
446 newprop = new_property(name, length, value, NULL); 449 newprop = new_property(name, length, value, NULL);
447 if (!newprop) 450 if (!newprop)
448 return -ENOMEM; 451 return -ENOMEM;
@@ -450,18 +453,11 @@ static int do_update_property(char *buf, size_t bufsize)
450 if (!strcmp(name, "slb-size") || !strcmp(name, "ibm,slb-size")) 453 if (!strcmp(name, "slb-size") || !strcmp(name, "ibm,slb-size"))
451 slb_set_size(*(int *)value); 454 slb_set_size(*(int *)value);
452 455
453 oldprop = of_find_property(np, name,NULL);
454 if (!oldprop) {
455 if (strlen(name))
456 return prom_add_property(np, newprop);
457 return -ENODEV;
458 }
459
460 upd_value.node = np; 456 upd_value.node = np;
461 upd_value.property = newprop; 457 upd_value.property = newprop;
462 pSeries_reconfig_notify(PSERIES_UPDATE_PROPERTY, &upd_value); 458 pSeries_reconfig_notify(PSERIES_UPDATE_PROPERTY, &upd_value);
463 459
464 rc = prom_update_property(np, newprop, oldprop); 460 rc = prom_update_property(np, newprop);
465 if (rc) 461 if (rc)
466 return rc; 462 return rc;
467 463
@@ -486,7 +482,7 @@ static int do_update_property(char *buf, size_t bufsize)
486 482
487 rc = pSeries_reconfig_notify(action, value); 483 rc = pSeries_reconfig_notify(action, value);
488 if (rc) { 484 if (rc) {
489 prom_update_property(np, oldprop, newprop); 485 prom_update_property(np, newprop);
490 return rc; 486 return rc;
491 } 487 }
492 } 488 }
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index e16bb8d48550..71706bc34a0d 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -147,7 +147,6 @@ static void __devinit smp_xics_setup_cpu(int cpu)
147 set_cpu_current_state(cpu, CPU_STATE_ONLINE); 147 set_cpu_current_state(cpu, CPU_STATE_ONLINE);
148 set_default_offline_state(cpu); 148 set_default_offline_state(cpu);
149#endif 149#endif
150 pseries_notify_cpuidle_add_cpu(cpu);
151} 150}
152 151
153static int __devinit smp_pSeries_kick_cpu(int nr) 152static int __devinit smp_pSeries_kick_cpu(int nr)
diff --git a/arch/powerpc/sysdev/6xx-suspend.S b/arch/powerpc/sysdev/6xx-suspend.S
index 21cda085d926..cf48e9cb2575 100644
--- a/arch/powerpc/sysdev/6xx-suspend.S
+++ b/arch/powerpc/sysdev/6xx-suspend.S
@@ -29,7 +29,7 @@ _GLOBAL(mpc6xx_enter_standby)
29 ori r5, r5, ret_from_standby@l 29 ori r5, r5, ret_from_standby@l
30 mtlr r5 30 mtlr r5
31 31
32 rlwinm r5, r1, 0, 0, 31-THREAD_SHIFT 32 CURRENT_THREAD_INFO(r5, r1)
33 lwz r6, TI_LOCAL_FLAGS(r5) 33 lwz r6, TI_LOCAL_FLAGS(r5)
34 ori r6, r6, _TLF_SLEEPING 34 ori r6, r6, _TLF_SLEEPING
35 stw r6, TI_LOCAL_FLAGS(r5) 35 stw r6, TI_LOCAL_FLAGS(r5)
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 6073288fed29..a7b2a600d0a4 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * MPC83xx/85xx/86xx PCI/PCIE support routing. 2 * MPC83xx/85xx/86xx PCI/PCIE support routing.
3 * 3 *
4 * Copyright 2007-2011 Freescale Semiconductor, Inc. 4 * Copyright 2007-2012 Freescale Semiconductor, Inc.
5 * Copyright 2008-2009 MontaVista Software, Inc. 5 * Copyright 2008-2009 MontaVista Software, Inc.
6 * 6 *
7 * Initial author: Xianghua Xiao <x.xiao@freescale.com> 7 * Initial author: Xianghua Xiao <x.xiao@freescale.com>
@@ -36,7 +36,7 @@
36 36
37static int fsl_pcie_bus_fixup, is_mpc83xx_pci; 37static int fsl_pcie_bus_fixup, is_mpc83xx_pci;
38 38
39static void __init quirk_fsl_pcie_header(struct pci_dev *dev) 39static void __devinit quirk_fsl_pcie_header(struct pci_dev *dev)
40{ 40{
41 u8 progif; 41 u8 progif;
42 42
@@ -807,3 +807,72 @@ u64 fsl_pci_immrbar_base(struct pci_controller *hose)
807 807
808 return 0; 808 return 0;
809} 809}
810
811#if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx)
812static const struct of_device_id pci_ids[] = {
813 { .compatible = "fsl,mpc8540-pci", },
814 { .compatible = "fsl,mpc8548-pcie", },
815 { .compatible = "fsl,mpc8610-pci", },
816 { .compatible = "fsl,mpc8641-pcie", },
817 { .compatible = "fsl,p1022-pcie", },
818 { .compatible = "fsl,p1010-pcie", },
819 { .compatible = "fsl,p1023-pcie", },
820 { .compatible = "fsl,p4080-pcie", },
821 { .compatible = "fsl,qoriq-pcie-v2.3", },
822 { .compatible = "fsl,qoriq-pcie-v2.2", },
823 {},
824};
825
826struct device_node *fsl_pci_primary;
827
828void __devinit fsl_pci_init(void)
829{
830 struct device_node *node;
831 struct pci_controller *hose;
832 dma_addr_t max = 0xffffffff;
833
834 /* Callers can specify the primary bus using other means. */
835 if (!fsl_pci_primary) {
836 /* If a PCI host bridge contains an ISA node, it's primary. */
837 node = of_find_node_by_type(NULL, "isa");
838 while ((fsl_pci_primary = of_get_parent(node))) {
839 of_node_put(node);
840 node = fsl_pci_primary;
841
842 if (of_match_node(pci_ids, node))
843 break;
844 }
845 }
846
847 node = NULL;
848 for_each_node_by_type(node, "pci") {
849 if (of_match_node(pci_ids, node)) {
850 /*
851 * If there's no PCI host bridge with ISA, arbitrarily
852 * designate one as primary. This can go away once
853 * various bugs with primary-less systems are fixed.
854 */
855 if (!fsl_pci_primary)
856 fsl_pci_primary = node;
857
858 fsl_add_bridge(node, fsl_pci_primary == node);
859 hose = pci_find_hose_for_OF_device(node);
860 max = min(max, hose->dma_window_base_cur +
861 hose->dma_window_size);
862 }
863 }
864
865#ifdef CONFIG_SWIOTLB
866 /*
867 * if we couldn't map all of DRAM via the dma windows
868 * we need SWIOTLB to handle buffers located outside of
869 * dma capable memory region
870 */
871 if (memblock_end_of_DRAM() - 1 > max) {
872 ppc_swiotlb_enable = 1;
873 set_pci_dma_ops(&swiotlb_dma_ops);
874 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
875 }
876#endif
877}
878#endif
diff --git a/arch/powerpc/sysdev/fsl_pci.h b/arch/powerpc/sysdev/fsl_pci.h
index a39ed5cc2c5a..baa0fd18289f 100644
--- a/arch/powerpc/sysdev/fsl_pci.h
+++ b/arch/powerpc/sysdev/fsl_pci.h
@@ -93,5 +93,13 @@ extern void fsl_pcibios_fixup_bus(struct pci_bus *bus);
93extern int mpc83xx_add_bridge(struct device_node *dev); 93extern int mpc83xx_add_bridge(struct device_node *dev);
94u64 fsl_pci_immrbar_base(struct pci_controller *hose); 94u64 fsl_pci_immrbar_base(struct pci_controller *hose);
95 95
96extern struct device_node *fsl_pci_primary;
97
98#ifdef CONFIG_FSL_PCI
99void fsl_pci_init(void);
100#else
101static inline void fsl_pci_init(void) {}
102#endif
103
96#endif /* __POWERPC_FSL_PCI_H */ 104#endif /* __POWERPC_FSL_PCI_H */
97#endif /* __KERNEL__ */ 105#endif /* __KERNEL__ */
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 395af1347749..bfc6211e5422 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1211,7 +1211,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1211 if (of_get_property(node, "single-cpu-affinity", NULL)) 1211 if (of_get_property(node, "single-cpu-affinity", NULL))
1212 flags |= MPIC_SINGLE_DEST_CPU; 1212 flags |= MPIC_SINGLE_DEST_CPU;
1213 if (of_device_is_compatible(node, "fsl,mpic")) 1213 if (of_device_is_compatible(node, "fsl,mpic"))
1214 flags |= MPIC_FSL; 1214 flags |= MPIC_FSL | MPIC_LARGE_VECTORS;
1215 1215
1216 mpic = kzalloc(sizeof(struct mpic), GFP_KERNEL); 1216 mpic = kzalloc(sizeof(struct mpic), GFP_KERNEL);
1217 if (mpic == NULL) 1217 if (mpic == NULL)
@@ -1376,7 +1376,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1376 mpic->isu_mask = (1 << mpic->isu_shift) - 1; 1376 mpic->isu_mask = (1 << mpic->isu_shift) - 1;
1377 1377
1378 mpic->irqhost = irq_domain_add_linear(mpic->node, 1378 mpic->irqhost = irq_domain_add_linear(mpic->node,
1379 last_irq + 1, 1379 intvec_top,
1380 &mpic_host_ops, mpic); 1380 &mpic_host_ops, mpic);
1381 1381
1382 /* 1382 /*
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 818e763f8265..b04367529729 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -395,6 +395,9 @@ static void qe_upload_microcode(const void *base,
395 395
396 for (i = 0; i < be32_to_cpu(ucode->count); i++) 396 for (i = 0; i < be32_to_cpu(ucode->count); i++)
397 out_be32(&qe_immr->iram.idata, be32_to_cpu(code[i])); 397 out_be32(&qe_immr->iram.idata, be32_to_cpu(code[i]));
398
399 /* Set I-RAM Ready Register */
400 out_be32(&qe_immr->iram.iready, be32_to_cpu(QE_IRAM_READY));
398} 401}
399 402
400/* 403/*
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 0f3ab06d2222..eab3492a45c5 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -971,7 +971,7 @@ static int cpu_cmd(void)
971 /* print cpus waiting or in xmon */ 971 /* print cpus waiting or in xmon */
972 printf("cpus stopped:"); 972 printf("cpus stopped:");
973 count = 0; 973 count = 0;
974 for (cpu = 0; cpu < NR_CPUS; ++cpu) { 974 for_each_possible_cpu(cpu) {
975 if (cpumask_test_cpu(cpu, &cpus_in_xmon)) { 975 if (cpumask_test_cpu(cpu, &cpus_in_xmon)) {
976 if (count == 0) 976 if (count == 0)
977 printf(" %x", cpu); 977 printf(" %x", cpu);