summaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-09-03 19:41:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-03 19:41:38 -0400
commitff474e8ca8547d09cb82ebab56d4c96f9eea01ce (patch)
treec004122f04a405eddb7929cd0297ccdce016f1b8 /arch/powerpc
parent4c92b5bb14226faa16d29a1df5752baf1ff22b53 (diff)
parent390fd5929f52bdfb9dfcc03820041ba556780f4a (diff)
Merge tag 'powerpc-4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc updates from Michael Ellerman: - support "hybrid" iommu/direct DMA ops for coherent_mask < dma_mask from Benjamin Herrenschmidt - EEH fixes for SRIOV from Gavin - introduce rtas_get_sensor_fast() for IRQ handlers from Thomas Huth - use hardware RNG for arch_get_random_seed_* not arch_get_random_* from Paul Mackerras - seccomp filter support from Michael Ellerman - opal_cec_reboot2() handling for HMIs & machine checks from Mahesh Salgaonkar - add powerpc timebase as a trace clock source from Naveen N. Rao - misc cleanups in the xmon, signal & SLB code from Anshuman Khandual - add an inline function to update POWER8 HID0 from Gautham R. Shenoy - fix pte_pagesize_index() crash on 4K w/64K hash from Michael Ellerman - drop support for 64K local store on 4K kernels from Michael Ellerman - move dma_get_required_mask() from pnv_phb to pci_controller_ops from Andrew Donnellan - initialize distance lookup table from drconf path from Nikunj A Dadhania - enable RTC class support from Vaibhav Jain - disable automatically blocked PCI config from Gavin Shan - add LEDs driver for PowerNV platform from Vasant Hegde - fix endianness issues in the HVSI driver from Laurent Dufour - kexec endian fixes from Samuel Mendoza-Jonas - fix corrupted pdn list from Gavin Shan - fix fenced PHB caused by eeh_slot_error_detail() from Gavin Shan - Freescale updates from Scott: Highlights include 32-bit memcpy/memset optimizations, checksum optimizations, 85xx config fragments and updates, device tree updates, e6500 fixes for non-SMP, and misc cleanup and minor fixes. - a ton of cxl updates & fixes: - add explicit precision specifiers from Rasmus Villemoes - use more common format specifier from Rasmus Villemoes - destroy cxl_adapter_idr on module_exit from Johannes Thumshirn - destroy afu->contexts_idr on release of an afu from Johannes Thumshirn - compile with -Werror from Daniel Axtens - EEH support from Daniel Axtens - plug irq_bitmap getting leaked in cxl_context from Vaibhav Jain - add alternate MMIO error handling from Ian Munsie - allow release of contexts which have been OPENED but not STARTED from Andrew Donnellan - remove use of macro DEFINE_PCI_DEVICE_TABLE from Vaishali Thakkar - release irqs if memory allocation fails from Vaibhav Jain - remove racy attempt to force EEH invocation in reset from Daniel Axtens - fix + cleanup error paths in cxl_dev_context_init from Ian Munsie - fix force unmapping mmaps of contexts allocated through the kernel api from Ian Munsie - set up and enable PSL Timebase from Philippe Bergheaud * tag 'powerpc-4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (140 commits) cxl: Set up and enable PSL Timebase cxl: Fix force unmapping mmaps of contexts allocated through the kernel api cxl: Fix + cleanup error paths in cxl_dev_context_init powerpc/eeh: Fix fenced PHB caused by eeh_slot_error_detail() powerpc/pseries: Cleanup on pci_dn_reconfig_notifier() powerpc/pseries: Fix corrupted pdn list powerpc/powernv: Enable LEDS support powerpc/iommu: Set default DMA offset in dma_dev_setup cxl: Remove racy attempt to force EEH invocation in reset cxl: Release irqs if memory allocation fails cxl: Remove use of macro DEFINE_PCI_DEVICE_TABLE powerpc/powernv: Fix mis-merge of OPAL support for LEDS driver powerpc/powernv: Reset HILE before kexec_sequence() powerpc/kexec: Reset secondary cpu endianness before kexec powerpc/hvsi: Fix endianness issues in the HVSI driver leds/powernv: Add driver for PowerNV platform powerpc/powernv: Create LED platform device powerpc/powernv: Add OPAL interfaces for accessing and modifying system LED states powerpc/powernv: Fix the log message when disabling VF cxl: Allow release of contexts which have been OPENED but not STARTED ...
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/Kconfig22
-rw-r--r--arch/powerpc/Makefile20
-rw-r--r--arch/powerpc/boot/dts/fsl/p1022si-post.dtsi2
-rw-r--r--arch/powerpc/boot/dts/fsl/p1022si-pre.dtsi2
-rw-r--r--arch/powerpc/boot/dts/fsl/t1040si-post.dtsi5
-rw-r--r--arch/powerpc/boot/dts/t1023rdb.dts13
-rw-r--r--arch/powerpc/boot/dts/t1024rdb.dts6
-rw-r--r--arch/powerpc/boot/dts/t1040d4rdb.dts46
-rw-r--r--arch/powerpc/boot/dts/t1042d4rdb.dts53
-rw-r--r--arch/powerpc/boot/dts/t104xd4rdb.dtsi205
-rw-r--r--arch/powerpc/configs/85xx-32bit.config5
-rw-r--r--arch/powerpc/configs/85xx-64bit.config4
-rw-r--r--arch/powerpc/configs/85xx-hw.config142
-rw-r--r--arch/powerpc/configs/85xx-smp.config2
-rw-r--r--arch/powerpc/configs/altivec.config1
-rw-r--r--arch/powerpc/configs/corenet32_smp_defconfig185
-rw-r--r--arch/powerpc/configs/corenet_basic_defconfig1
-rw-r--r--arch/powerpc/configs/fsl-emb-nonhw.config (renamed from arch/powerpc/configs/corenet64_smp_defconfig)264
-rw-r--r--arch/powerpc/configs/mpc85xx_basic_defconfig23
-rw-r--r--arch/powerpc/configs/mpc85xx_defconfig252
-rw-r--r--arch/powerpc/configs/mpc85xx_smp_defconfig244
-rw-r--r--arch/powerpc/configs/ppc64_defconfig3
-rw-r--r--arch/powerpc/configs/pseries_defconfig6
-rw-r--r--arch/powerpc/include/asm/Kbuild1
-rw-r--r--arch/powerpc/include/asm/archrandom.h28
-rw-r--r--arch/powerpc/include/asm/cacheflush.h7
-rw-r--r--arch/powerpc/include/asm/checksum.h37
-rw-r--r--arch/powerpc/include/asm/compat.h7
-rw-r--r--arch/powerpc/include/asm/device.h15
-rw-r--r--arch/powerpc/include/asm/dma-mapping.h14
-rw-r--r--arch/powerpc/include/asm/iommu.h31
-rw-r--r--arch/powerpc/include/asm/machdep.h2
-rw-r--r--arch/powerpc/include/asm/opal-api.h124
-rw-r--r--arch/powerpc/include/asm/opal.h8
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h1
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64.h8
-rw-r--r--arch/powerpc/include/asm/pgtable.h11
-rw-r--r--arch/powerpc/include/asm/ppc-pci.h1
-rw-r--r--arch/powerpc/include/asm/processor.h1
-rw-r--r--arch/powerpc/include/asm/pte-common.h3
-rw-r--r--arch/powerpc/include/asm/reg.h12
-rw-r--r--arch/powerpc/include/asm/rtas.h1
-rw-r--r--arch/powerpc/include/asm/spu_csa.h6
-rw-r--r--arch/powerpc/include/asm/syscall.h54
-rw-r--r--arch/powerpc/include/asm/trace_clock.h19
-rw-r--r--arch/powerpc/include/uapi/asm/Kbuild1
-rw-r--r--arch/powerpc/include/uapi/asm/errno.h2
-rw-r--r--arch/powerpc/include/uapi/asm/sigcontext.h4
-rw-r--r--arch/powerpc/kernel/Makefile1
-rw-r--r--arch/powerpc/kernel/asm-offsets.c1
-rw-r--r--arch/powerpc/kernel/dma-iommu.c2
-rw-r--r--arch/powerpc/kernel/dma-swiotlb.c4
-rw-r--r--arch/powerpc/kernel/dma.c118
-rw-r--r--arch/powerpc/kernel/eeh.c31
-rw-r--r--arch/powerpc/kernel/eeh_pe.c22
-rw-r--r--arch/powerpc/kernel/entry_32.S7
-rw-r--r--arch/powerpc/kernel/entry_64.S28
-rw-r--r--arch/powerpc/kernel/exceptions-64e.S13
-rw-r--r--arch/powerpc/kernel/fsl_booke_entry_mapping.S15
-rw-r--r--arch/powerpc/kernel/kvm.c1
-rw-r--r--arch/powerpc/kernel/misc_64.S13
-rw-r--r--arch/powerpc/kernel/nvram_64.c10
-rw-r--r--arch/powerpc/kernel/pci-common.c72
-rw-r--r--arch/powerpc/kernel/process.c14
-rw-r--r--arch/powerpc/kernel/prom.c25
-rw-r--r--arch/powerpc/kernel/prom_init.c25
-rw-r--r--arch/powerpc/kernel/ptrace.c89
-rw-r--r--arch/powerpc/kernel/rtas.c25
-rw-r--r--arch/powerpc/kernel/signal_32.c5
-rw-r--r--arch/powerpc/kernel/signal_64.c21
-rw-r--r--arch/powerpc/kernel/trace_clock.c15
-rw-r--r--arch/powerpc/lib/checksum_32.S16
-rw-r--r--arch/powerpc/lib/checksum_64.S21
-rw-r--r--arch/powerpc/lib/copy_32.S109
-rw-r--r--arch/powerpc/mm/fsl_booke_mmu.c2
-rw-r--r--arch/powerpc/mm/hash_low_64.S4
-rw-r--r--arch/powerpc/mm/hash_utils_64.c12
-rw-r--r--arch/powerpc/mm/hugetlbpage.c8
-rw-r--r--arch/powerpc/mm/mem.c14
-rw-r--r--arch/powerpc/mm/numa.c16
-rw-r--r--arch/powerpc/mm/pgtable_64.c10
-rw-r--r--arch/powerpc/mm/slb.c24
-rw-r--r--arch/powerpc/mm/tlb_low_64e.S10
-rw-r--r--arch/powerpc/oprofile/op_model_power4.c4
-rw-r--r--arch/powerpc/perf/core-book3s.c4
-rw-r--r--arch/powerpc/perf/hv-24x7.c24
-rw-r--r--arch/powerpc/platforms/512x/Kconfig4
-rw-r--r--arch/powerpc/platforms/85xx/c293pcie.c4
-rw-r--r--arch/powerpc/platforms/85xx/corenet_generic.c2
-rw-r--r--arch/powerpc/platforms/cell/Kconfig15
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c55
-rw-r--r--arch/powerpc/platforms/cell/spufs/lscsa_alloc.c124
-rw-r--r--arch/powerpc/platforms/powernv/eeh-powernv.c12
-rw-r--r--arch/powerpc/platforms/powernv/opal-hmi.c177
-rw-r--r--arch/powerpc/platforms/powernv/opal-power.c147
-rw-r--r--arch/powerpc/platforms/powernv/opal-wrappers.S4
-rw-r--r--arch/powerpc/platforms/powernv/opal.c47
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c147
-rw-r--r--arch/powerpc/platforms/powernv/pci.c11
-rw-r--r--arch/powerpc/platforms/powernv/pci.h7
-rw-r--r--arch/powerpc/platforms/powernv/powernv.h6
-rw-r--r--arch/powerpc/platforms/powernv/rng.c2
-rw-r--r--arch/powerpc/platforms/powernv/setup.c16
-rw-r--r--arch/powerpc/platforms/powernv/subcore.c4
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c3
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c3
-rw-r--r--arch/powerpc/platforms/pseries/ras.c3
-rw-r--r--arch/powerpc/platforms/pseries/rng.c2
-rw-r--r--arch/powerpc/platforms/pseries/setup.c23
-rw-r--r--arch/powerpc/sysdev/cpm_common.c2
-rw-r--r--arch/powerpc/sysdev/dart_iommu.c16
-rw-r--r--arch/powerpc/sysdev/ppc4xx_hsta_msi.c4
-rw-r--r--arch/powerpc/xmon/xmon.c8
113 files changed, 2009 insertions, 1578 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 5ef27113b898..b447918b9e2c 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -82,6 +82,9 @@ config GENERIC_HWEIGHT
82 bool 82 bool
83 default y 83 default y
84 84
85config ARCH_HAS_DMA_SET_COHERENT_MASK
86 bool
87
85config PPC 88config PPC
86 bool 89 bool
87 default y 90 default y
@@ -155,6 +158,8 @@ config PPC
155 select HAVE_PERF_EVENTS_NMI if PPC64 158 select HAVE_PERF_EVENTS_NMI if PPC64
156 select EDAC_SUPPORT 159 select EDAC_SUPPORT
157 select EDAC_ATOMIC_SCRUB 160 select EDAC_ATOMIC_SCRUB
161 select ARCH_HAS_DMA_SET_COHERENT_MASK
162 select HAVE_ARCH_SECCOMP_FILTER
158 163
159config GENERIC_CSUM 164config GENERIC_CSUM
160 def_bool CPU_LITTLE_ENDIAN 165 def_bool CPU_LITTLE_ENDIAN
@@ -514,11 +519,6 @@ config NODES_SPAN_OTHER_NODES
514 def_bool y 519 def_bool y
515 depends on NEED_MULTIPLE_NODES 520 depends on NEED_MULTIPLE_NODES
516 521
517config PPC_HAS_HASH_64K
518 bool
519 depends on PPC64
520 default n
521
522config STDBINUTILS 522config STDBINUTILS
523 bool "Using standard binutils settings" 523 bool "Using standard binutils settings"
524 depends on 44x 524 depends on 44x
@@ -560,16 +560,16 @@ config PPC_4K_PAGES
560 bool "4k page size" 560 bool "4k page size"
561 561
562config PPC_16K_PAGES 562config PPC_16K_PAGES
563 bool "16k page size" if 44x || PPC_8xx 563 bool "16k page size"
564 depends on 44x || PPC_8xx
564 565
565config PPC_64K_PAGES 566config PPC_64K_PAGES
566 bool "64k page size" if 44x || PPC_STD_MMU_64 || PPC_BOOK3E_64 567 bool "64k page size"
567 depends on !PPC_FSL_BOOK3E 568 depends on !PPC_FSL_BOOK3E && (44x || PPC_STD_MMU_64 || PPC_BOOK3E_64)
568 select PPC_HAS_HASH_64K if PPC_STD_MMU_64
569 569
570config PPC_256K_PAGES 570config PPC_256K_PAGES
571 bool "256k page size" if 44x 571 bool "256k page size"
572 depends on !STDBINUTILS 572 depends on 44x && !STDBINUTILS
573 help 573 help
574 Make the page size 256k. 574 Make the page size 256k.
575 575
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 05f464eb6952..4ca54fdd8768 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -288,6 +288,26 @@ PHONY += pseries_le_defconfig
288pseries_le_defconfig: 288pseries_le_defconfig:
289 $(call merge_into_defconfig,pseries_defconfig,le) 289 $(call merge_into_defconfig,pseries_defconfig,le)
290 290
291PHONY += mpc85xx_defconfig
292mpc85xx_defconfig:
293 $(call merge_into_defconfig,mpc85xx_basic_defconfig,\
294 85xx-32bit 85xx-hw fsl-emb-nonhw)
295
296PHONY += mpc85xx_smp_defconfig
297mpc85xx_smp_defconfig:
298 $(call merge_into_defconfig,mpc85xx_basic_defconfig,\
299 85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw)
300
301PHONY += corenet32_smp_defconfig
302corenet32_smp_defconfig:
303 $(call merge_into_defconfig,corenet_basic_defconfig,\
304 85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw)
305
306PHONY += corenet64_smp_defconfig
307corenet64_smp_defconfig:
308 $(call merge_into_defconfig,corenet_basic_defconfig,\
309 85xx-64bit 85xx-smp altivec 85xx-hw fsl-emb-nonhw)
310
291define archhelp 311define archhelp
292 @echo '* zImage - Build default images selected by kernel config' 312 @echo '* zImage - Build default images selected by kernel config'
293 @echo ' zImage.* - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)' 313 @echo ' zImage.* - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)'
diff --git a/arch/powerpc/boot/dts/fsl/p1022si-post.dtsi b/arch/powerpc/boot/dts/fsl/p1022si-post.dtsi
index ebf202234549..426bf4103b9e 100644
--- a/arch/powerpc/boot/dts/fsl/p1022si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1022si-post.dtsi
@@ -175,7 +175,7 @@
175 175
176/include/ "pq3-gpio-0.dtsi" 176/include/ "pq3-gpio-0.dtsi"
177 177
178 display@10000 { 178 display: display@10000 {
179 compatible = "fsl,diu", "fsl,p1022-diu"; 179 compatible = "fsl,diu", "fsl,p1022-diu";
180 reg = <0x10000 1000>; 180 reg = <0x10000 1000>;
181 interrupts = <64 2 0 0>; 181 interrupts = <64 2 0 0>;
diff --git a/arch/powerpc/boot/dts/fsl/p1022si-pre.dtsi b/arch/powerpc/boot/dts/fsl/p1022si-pre.dtsi
index 1956dea040cc..de76ae8992c6 100644
--- a/arch/powerpc/boot/dts/fsl/p1022si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/p1022si-pre.dtsi
@@ -50,6 +50,8 @@
50 pci0 = &pci0; 50 pci0 = &pci0;
51 pci1 = &pci1; 51 pci1 = &pci1;
52 pci2 = &pci2; 52 pci2 = &pci2;
53 vga = &display;
54 display = &display;
53 }; 55 };
54 56
55 cpus { 57 cpus {
diff --git a/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi b/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi
index 9e9f7e201d43..9770d0278493 100644
--- a/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi
+++ b/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi
@@ -484,6 +484,11 @@
484 reg = <0xea000 0x4000>; 484 reg = <0xea000 0x4000>;
485 }; 485 };
486 486
487 scfg: global-utilities@fc000 {
488 compatible = "fsl,t1040-scfg";
489 reg = <0xfc000 0x1000>;
490 };
491
487/include/ "elo3-dma-0.dtsi" 492/include/ "elo3-dma-0.dtsi"
488/include/ "elo3-dma-1.dtsi" 493/include/ "elo3-dma-1.dtsi"
489/include/ "qoriq-espi-0.dtsi" 494/include/ "qoriq-espi-0.dtsi"
diff --git a/arch/powerpc/boot/dts/t1023rdb.dts b/arch/powerpc/boot/dts/t1023rdb.dts
index 06b090aba066..d3fa8294cd49 100644
--- a/arch/powerpc/boot/dts/t1023rdb.dts
+++ b/arch/powerpc/boot/dts/t1023rdb.dts
@@ -60,7 +60,7 @@
60 #address-cells = <1>; 60 #address-cells = <1>;
61 #size-cells = <1>; 61 #size-cells = <1>;
62 compatible = "fsl,ifc-nand"; 62 compatible = "fsl,ifc-nand";
63 reg = <0x2 0x0 0x10000>; 63 reg = <0x1 0x0 0x10000>;
64 }; 64 };
65 }; 65 };
66 66
@@ -99,6 +99,17 @@
99 }; 99 };
100 100
101 i2c@118100 { 101 i2c@118100 {
102 current-sensor@40 {
103 compatible = "ti,ina220";
104 reg = <0x40>;
105 shunt-resistor = <1000>;
106 };
107
108 current-sensor@41 {
109 compatible = "ti,ina220";
110 reg = <0x41>;
111 shunt-resistor = <1000>;
112 };
102 }; 113 };
103 }; 114 };
104 115
diff --git a/arch/powerpc/boot/dts/t1024rdb.dts b/arch/powerpc/boot/dts/t1024rdb.dts
index 733e723ffed6..bf05e324fda2 100644
--- a/arch/powerpc/boot/dts/t1024rdb.dts
+++ b/arch/powerpc/boot/dts/t1024rdb.dts
@@ -114,6 +114,12 @@
114 reg = <0x4c>; 114 reg = <0x4c>;
115 }; 115 };
116 116
117 current-sensor@40 {
118 compatible = "ti,ina220";
119 reg = <0x40>;
120 shunt-resistor = <1000>;
121 };
122
117 eeprom@50 { 123 eeprom@50 {
118 compatible = "atmel,24c256"; 124 compatible = "atmel,24c256";
119 reg = <0x50>; 125 reg = <0x50>;
diff --git a/arch/powerpc/boot/dts/t1040d4rdb.dts b/arch/powerpc/boot/dts/t1040d4rdb.dts
new file mode 100644
index 000000000000..2d1315a1670e
--- /dev/null
+++ b/arch/powerpc/boot/dts/t1040d4rdb.dts
@@ -0,0 +1,46 @@
1/*
2 * T1040D4RDB Device Tree Source
3 *
4 * Copyright 2015 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/t104xsi-pre.dtsi"
36/include/ "t104xd4rdb.dtsi"
37
38/ {
39 model = "fsl,T1040D4RDB";
40 compatible = "fsl,T1040D4RDB";
41 #address-cells = <2>;
42 #size-cells = <2>;
43 interrupt-parent = <&mpic>;
44};
45
46/include/ "fsl/t1040si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/t1042d4rdb.dts b/arch/powerpc/boot/dts/t1042d4rdb.dts
new file mode 100644
index 000000000000..846f8c87e85a
--- /dev/null
+++ b/arch/powerpc/boot/dts/t1042d4rdb.dts
@@ -0,0 +1,53 @@
1/*
2 * T1042D4RDB Device Tree Source
3 *
4 * Copyright 2015 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/t104xsi-pre.dtsi"
36/include/ "t104xd4rdb.dtsi"
37
38/ {
39 model = "fsl,T1042D4RDB";
40 compatible = "fsl,T1042D4RDB";
41 #address-cells = <2>;
42 #size-cells = <2>;
43 interrupt-parent = <&mpic>;
44
45 ifc: localbus@ffe124000 {
46 cpld@3,0 {
47 compatible = "fsl,t1040d4rdb-cpld",
48 "fsl,deepsleep-cpld";
49 };
50 };
51};
52
53/include/ "fsl/t1040si-post.dtsi"
diff --git a/arch/powerpc/boot/dts/t104xd4rdb.dtsi b/arch/powerpc/boot/dts/t104xd4rdb.dtsi
new file mode 100644
index 000000000000..491367bd3883
--- /dev/null
+++ b/arch/powerpc/boot/dts/t104xd4rdb.dtsi
@@ -0,0 +1,205 @@
1/*
2 * T1040D4RDB/T1042D4RDB Device Tree Source
3 *
4 * Copyright 2015 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/ {
36 reserved-memory {
37 #address-cells = <2>;
38 #size-cells = <2>;
39 ranges;
40
41 bman_fbpr: bman-fbpr {
42 size = <0 0x1000000>;
43 alignment = <0 0x1000000>;
44 };
45 qman_fqd: qman-fqd {
46 size = <0 0x400000>;
47 alignment = <0 0x400000>;
48 };
49 qman_pfdr: qman-pfdr {
50 size = <0 0x2000000>;
51 alignment = <0 0x2000000>;
52 };
53 };
54
55 ifc: localbus@ffe124000 {
56 reg = <0xf 0xfe124000 0 0x2000>;
57 ranges = <0 0 0xf 0xe8000000 0x08000000
58 2 0 0xf 0xff800000 0x00010000
59 3 0 0xf 0xffdf0000 0x00008000>;
60
61 nor@0,0 {
62 #address-cells = <1>;
63 #size-cells = <1>;
64 compatible = "cfi-flash";
65 reg = <0x0 0x0 0x8000000>;
66 bank-width = <2>;
67 device-width = <1>;
68 };
69
70 nand@2,0 {
71 #address-cells = <1>;
72 #size-cells = <1>;
73 compatible = "fsl,ifc-nand";
74 reg = <0x2 0x0 0x10000>;
75 };
76
77 cpld@3,0 {
78 compatible = "fsl,t1040d4rdb-cpld";
79 reg = <3 0 0x300>;
80 };
81 };
82
83 memory {
84 device_type = "memory";
85 };
86
87 dcsr: dcsr@f00000000 {
88 ranges = <0x00000000 0xf 0x00000000 0x01072000>;
89 };
90
91 bportals: bman-portals@ff4000000 {
92 ranges = <0x0 0xf 0xf4000000 0x2000000>;
93 };
94
95 qportals: qman-portals@ff6000000 {
96 ranges = <0x0 0xf 0xf6000000 0x2000000>;
97 };
98
99 soc: soc@ffe000000 {
100 ranges = <0x00000000 0xf 0xfe000000 0x1000000>;
101 reg = <0xf 0xfe000000 0 0x00001000>;
102
103 spi@110000 {
104 flash@0 {
105 #address-cells = <1>;
106 #size-cells = <1>;
107 compatible = "micron,n25q512ax3";
108 reg = <0>;
109 /* input clock */
110 spi-max-frequency = <10000000>;
111 };
112 };
113 i2c@118000 {
114 hwmon@4c {
115 compatible = "adi,adt7461";
116 reg = <0x4c>;
117 };
118
119 rtc@68 {
120 compatible = "dallas,ds1337";
121 reg = <0x68>;
122 interrupts = <0x2 0x1 0 0>;
123 };
124 };
125
126 i2c@118100 {
127 mux@77 {
128 /*
129 * Child nodes of mux depend on which i2c
130 * devices are connected via the mini PCI
131 * connector slot1, the mini PCI connector
132 * slot2, the HDMI connector, and the PEX
133 * slot. Systems with such devices attached
134 * should provide a wrapper .dts file that
135 * includes this one, and adds those nodes
136 */
137 compatible = "nxp,pca9546";
138 reg = <0x77>;
139 #address-cells = <1>;
140 #size-cells = <0>;
141 };
142 };
143
144 };
145
146 pci0: pcie@ffe240000 {
147 reg = <0xf 0xfe240000 0 0x10000>;
148 ranges = <0x02000000 0 0xe0000000 0xc 0x0 0x0 0x10000000
149 0x01000000 0 0x0 0xf 0xf8000000 0x0 0x00010000>;
150 pcie@0 {
151 ranges = <0x02000000 0 0xe0000000
152 0x02000000 0 0xe0000000
153 0 0x10000000
154
155 0x01000000 0 0x00000000
156 0x01000000 0 0x00000000
157 0 0x00010000>;
158 };
159 };
160
161 pci1: pcie@ffe250000 {
162 reg = <0xf 0xfe250000 0 0x10000>;
163 ranges = <0x02000000 0 0xe0000000 0xc 0x10000000 0 0x10000000
164 0x01000000 0 0 0xf 0xf8010000 0 0x00010000>;
165 pcie@0 {
166 ranges = <0x02000000 0 0xe0000000
167 0x02000000 0 0xe0000000
168 0 0x10000000
169
170 0x01000000 0 0x00000000
171 0x01000000 0 0x00000000
172 0 0x00010000>;
173 };
174 };
175
176 pci2: pcie@ffe260000 {
177 reg = <0xf 0xfe260000 0 0x10000>;
178 ranges = <0x02000000 0 0xe0000000 0xc 0x20000000 0 0x10000000
179 0x01000000 0 0x00000000 0xf 0xf8020000 0 0x00010000>;
180 pcie@0 {
181 ranges = <0x02000000 0 0xe0000000
182 0x02000000 0 0xe0000000
183 0 0x10000000
184
185 0x01000000 0 0x00000000
186 0x01000000 0 0x00000000
187 0 0x00010000>;
188 };
189 };
190
191 pci3: pcie@ffe270000 {
192 reg = <0xf 0xfe270000 0 0x10000>;
193 ranges = <0x02000000 0 0xe0000000 0xc 0x30000000 0 0x10000000
194 0x01000000 0 0x00000000 0xf 0xf8030000 0 0x00010000>;
195 pcie@0 {
196 ranges = <0x02000000 0 0xe0000000
197 0x02000000 0 0xe0000000
198 0 0x10000000
199
200 0x01000000 0 0x00000000
201 0x01000000 0 0x00000000
202 0 0x00010000>;
203 };
204 };
205};
diff --git a/arch/powerpc/configs/85xx-32bit.config b/arch/powerpc/configs/85xx-32bit.config
new file mode 100644
index 000000000000..6b8894d727a2
--- /dev/null
+++ b/arch/powerpc/configs/85xx-32bit.config
@@ -0,0 +1,5 @@
1CONFIG_HIGHMEM=y
2CONFIG_KEXEC=y
3CONFIG_PPC_85xx=y
4CONFIG_PROC_KCORE=y
5CONFIG_PHYS_64BIT=y
diff --git a/arch/powerpc/configs/85xx-64bit.config b/arch/powerpc/configs/85xx-64bit.config
new file mode 100644
index 000000000000..4aba81222885
--- /dev/null
+++ b/arch/powerpc/configs/85xx-64bit.config
@@ -0,0 +1,4 @@
1CONFIG_MATH_EMULATION=y
2CONFIG_MATH_EMULATION_HW_UNIMPLEMENTED=y
3CONFIG_PPC64=y
4CONFIG_PPC_BOOK3E_64=y
diff --git a/arch/powerpc/configs/85xx-hw.config b/arch/powerpc/configs/85xx-hw.config
new file mode 100644
index 000000000000..528ff0e714e6
--- /dev/null
+++ b/arch/powerpc/configs/85xx-hw.config
@@ -0,0 +1,142 @@
1CONFIG_AQUANTIA_PHY=y
2CONFIG_AT803X_PHY=y
3CONFIG_ATA=y
4CONFIG_BLK_DEV_SD=y
5CONFIG_BLK_DEV_SR_VENDOR=y
6CONFIG_BLK_DEV_SR=y
7CONFIG_BROADCOM_PHY=y
8CONFIG_C293_PCIE=y
9CONFIG_CHR_DEV_SG=y
10CONFIG_CHR_DEV_ST=y
11CONFIG_CICADA_PHY=y
12CONFIG_CLK_QORIQ=y
13CONFIG_CRYPTO_DEV_FSL_CAAM=y
14CONFIG_CRYPTO_DEV_TALITOS=y
15CONFIG_DAVICOM_PHY=y
16CONFIG_DMADEVICES=y
17CONFIG_E1000E=y
18CONFIG_E1000=y
19CONFIG_EDAC_MM_EDAC=y
20CONFIG_EDAC_MPC85XX=y
21CONFIG_EDAC=y
22CONFIG_EEPROM_AT24=y
23CONFIG_EEPROM_LEGACY=y
24CONFIG_FB_FSL_DIU=y
25CONFIG_FS_ENET=y
26CONFIG_FSL_CORENET_CF=y
27CONFIG_FSL_DMA=y
28CONFIG_FSL_HV_MANAGER=y
29CONFIG_FSL_PQ_MDIO=y
30CONFIG_FSL_RIO=y
31CONFIG_FSL_XGMAC_MDIO=y
32CONFIG_GIANFAR=y
33CONFIG_GPIO_MPC8XXX=y
34CONFIG_HID_A4TECH=y
35CONFIG_HID_APPLE=y
36CONFIG_HID_BELKIN=y
37CONFIG_HID_CHERRY=y
38CONFIG_HID_CHICONY=y
39CONFIG_HID_CYPRESS=y
40CONFIG_HID_EZKEY=y
41CONFIG_HID_GYRATION=y
42CONFIG_HID_LOGITECH=y
43CONFIG_HID_MICROSOFT=y
44CONFIG_HID_MONTEREY=y
45CONFIG_HID_PANTHERLORD=y
46CONFIG_HID_PETALYNX=y
47CONFIG_HID_SAMSUNG=y
48CONFIG_HID_SUNPLUS=y
49CONFIG_I2C_CHARDEV=y
50CONFIG_I2C_CPM=m
51CONFIG_I2C_MPC=y
52CONFIG_I2C_MUX_PCA954x=y
53CONFIG_I2C_MUX=y
54CONFIG_I2C=y
55CONFIG_IGB=y
56CONFIG_INPUT_FF_MEMLESS=m
57# CONFIG_INPUT_KEYBOARD is not set
58# CONFIG_INPUT_MOUSEDEV is not set
59# CONFIG_INPUT_MOUSE is not set
60CONFIG_MARVELL_PHY=y
61CONFIG_MDIO_BUS_MUX_GPIO=y
62CONFIG_MDIO_BUS_MUX_MMIOREG=y
63CONFIG_MMC_SDHCI_OF_ESDHC=y
64CONFIG_MMC_SDHCI_PLTFM=y
65CONFIG_MMC_SDHCI=y
66CONFIG_MMC=y
67CONFIG_MTD_BLOCK=y
68CONFIG_MTD_CFI_AMDSTD=y
69CONFIG_MTD_CFI_INTELEXT=y
70CONFIG_MTD_CFI=y
71CONFIG_MTD_CMDLINE_PARTS=y
72CONFIG_MTD_M25P80=y
73CONFIG_MTD_NAND_FSL_ELBC=y
74CONFIG_MTD_NAND_FSL_IFC=y
75CONFIG_MTD_NAND=y
76CONFIG_MTD_PHYSMAP_OF=y
77CONFIG_MTD_PHYSMAP=y
78CONFIG_MTD_PLATRAM=y
79CONFIG_MTD_SPI_NOR=y
80CONFIG_NETDEVICES=y
81CONFIG_NVRAM=y
82CONFIG_PATA_ALI=y
83CONFIG_PATA_SIL680=y
84CONFIG_PATA_VIA=y
85# CONFIG_PCIEASPM is not set
86CONFIG_PCIEPORTBUS=y
87CONFIG_PCI_MSI=y
88CONFIG_PCI=y
89CONFIG_PPC_EPAPR_HV_BYTECHAN=y
90# CONFIG_PPC_OF_BOOT_TRAMPOLINE is not set
91CONFIG_QE_GPIO=y
92CONFIG_QUICC_ENGINE=y
93CONFIG_RAPIDIO=y
94CONFIG_RTC_CLASS=y
95CONFIG_RTC_DRV_CMOS=y
96CONFIG_RTC_DRV_DS1307=y
97CONFIG_RTC_DRV_DS1374=y
98CONFIG_RTC_DRV_DS3232=y
99CONFIG_SATA_AHCI=y
100CONFIG_SATA_FSL=y
101CONFIG_SATA_SIL24=y
102CONFIG_SATA_SIL=y
103CONFIG_SCSI_LOGGING=y
104CONFIG_SCSI_SYM53C8XX_2=y
105CONFIG_SENSORS_INA2XX=y
106CONFIG_SENSORS_LM90=y
107CONFIG_SERIAL_8250_CONSOLE=y
108CONFIG_SERIAL_8250_DETECT_IRQ=y
109CONFIG_SERIAL_8250_MANY_PORTS=y
110CONFIG_SERIAL_8250_NR_UARTS=6
111CONFIG_SERIAL_8250_RSA=y
112CONFIG_SERIAL_8250_RUNTIME_UARTS=6
113CONFIG_SERIAL_8250=y
114CONFIG_SERIAL_QE=m
115CONFIG_SERIO_LIBPS2=y
116# CONFIG_SND_DRIVERS is not set
117CONFIG_SND_INTEL8X0=y
118CONFIG_SND_POWERPC_SOC=y
119# CONFIG_SND_PPC is not set
120CONFIG_SND_SOC=y
121# CONFIG_SND_SUPPORT_OLD_API is not set
122# CONFIG_SND_USB is not set
123CONFIG_SND=y
124CONFIG_SOUND=y
125CONFIG_SPI_FSL_ESPI=y
126CONFIG_SPI_FSL_SPI=y
127CONFIG_SPI_GPIO=y
128CONFIG_SPI=y
129CONFIG_TERANETICS_PHY=y
130CONFIG_UCC_GETH=y
131CONFIG_USB_EHCI_FSL=y
132CONFIG_USB_EHCI_HCD=y
133CONFIG_USB_HID=m
134CONFIG_USB_MON=y
135CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
136CONFIG_USB_OHCI_HCD_PPC_OF_LE=y
137CONFIG_USB_OHCI_HCD=y
138CONFIG_USB_STORAGE=y
139CONFIG_USB=y
140# CONFIG_VGA_CONSOLE is not set
141CONFIG_VIRT_DRIVERS=y
142CONFIG_VITESSE_PHY=y
diff --git a/arch/powerpc/configs/85xx-smp.config b/arch/powerpc/configs/85xx-smp.config
new file mode 100644
index 000000000000..3b4d1e54636d
--- /dev/null
+++ b/arch/powerpc/configs/85xx-smp.config
@@ -0,0 +1,2 @@
1CONFIG_NR_CPUS=24
2CONFIG_SMP=y
diff --git a/arch/powerpc/configs/altivec.config b/arch/powerpc/configs/altivec.config
new file mode 100644
index 000000000000..58a697cb5a62
--- /dev/null
+++ b/arch/powerpc/configs/altivec.config
@@ -0,0 +1 @@
CONFIG_ALTIVEC=y
diff --git a/arch/powerpc/configs/corenet32_smp_defconfig b/arch/powerpc/configs/corenet32_smp_defconfig
deleted file mode 100644
index 37659937bd12..000000000000
--- a/arch/powerpc/configs/corenet32_smp_defconfig
+++ /dev/null
@@ -1,185 +0,0 @@
1CONFIG_PPC_85xx=y
2CONFIG_SMP=y
3CONFIG_NR_CPUS=8
4CONFIG_SYSVIPC=y
5CONFIG_POSIX_MQUEUE=y
6CONFIG_AUDIT=y
7CONFIG_NO_HZ=y
8CONFIG_HIGH_RES_TIMERS=y
9CONFIG_BSD_PROCESS_ACCT=y
10CONFIG_IKCONFIG=y
11CONFIG_IKCONFIG_PROC=y
12CONFIG_LOG_BUF_SHIFT=14
13CONFIG_BLK_DEV_INITRD=y
14CONFIG_KALLSYMS_ALL=y
15CONFIG_EMBEDDED=y
16CONFIG_PERF_EVENTS=y
17CONFIG_SLAB=y
18CONFIG_MODULES=y
19CONFIG_MODULE_UNLOAD=y
20CONFIG_MODULE_FORCE_UNLOAD=y
21CONFIG_MODVERSIONS=y
22# CONFIG_BLK_DEV_BSG is not set
23CONFIG_PARTITION_ADVANCED=y
24CONFIG_MAC_PARTITION=y
25CONFIG_CORENET_GENERIC=y
26CONFIG_HIGHMEM=y
27# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
28CONFIG_BINFMT_MISC=m
29CONFIG_KEXEC=y
30CONFIG_FORCE_MAX_ZONEORDER=13
31CONFIG_PCI=y
32CONFIG_PCIEPORTBUS=y
33# CONFIG_PCIEASPM is not set
34CONFIG_PCI_MSI=y
35CONFIG_RAPIDIO=y
36CONFIG_FSL_RIO=y
37CONFIG_NET=y
38CONFIG_PACKET=y
39CONFIG_UNIX=y
40CONFIG_XFRM_USER=y
41CONFIG_XFRM_SUB_POLICY=y
42CONFIG_XFRM_STATISTICS=y
43CONFIG_NET_KEY=y
44CONFIG_NET_KEY_MIGRATE=y
45CONFIG_INET=y
46CONFIG_IP_MULTICAST=y
47CONFIG_IP_ADVANCED_ROUTER=y
48CONFIG_IP_MULTIPLE_TABLES=y
49CONFIG_IP_ROUTE_MULTIPATH=y
50CONFIG_IP_ROUTE_VERBOSE=y
51CONFIG_IP_PNP=y
52CONFIG_IP_PNP_DHCP=y
53CONFIG_IP_PNP_BOOTP=y
54CONFIG_IP_PNP_RARP=y
55CONFIG_NET_IPIP=y
56CONFIG_IP_MROUTE=y
57CONFIG_IP_PIMSM_V1=y
58CONFIG_IP_PIMSM_V2=y
59CONFIG_INET_AH=y
60CONFIG_INET_ESP=y
61CONFIG_INET_IPCOMP=y
62# CONFIG_INET_LRO is not set
63CONFIG_IPV6=y
64CONFIG_IP_SCTP=m
65CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
66CONFIG_DEVTMPFS=y
67CONFIG_DEVTMPFS_MOUNT=y
68CONFIG_MTD=y
69CONFIG_MTD_CMDLINE_PARTS=y
70CONFIG_MTD_BLOCK=y
71CONFIG_MTD_CFI=y
72CONFIG_MTD_CFI_INTELEXT=y
73CONFIG_MTD_CFI_AMDSTD=y
74CONFIG_MTD_PHYSMAP_OF=y
75CONFIG_MTD_NAND=y
76CONFIG_MTD_NAND_FSL_ELBC=y
77CONFIG_MTD_NAND_FSL_IFC=y
78CONFIG_MTD_SPI_NOR=y
79CONFIG_BLK_DEV_LOOP=y
80CONFIG_BLK_DEV_RAM=y
81CONFIG_BLK_DEV_RAM_SIZE=131072
82CONFIG_BLK_DEV_SD=y
83CONFIG_CHR_DEV_ST=y
84CONFIG_BLK_DEV_SR=y
85CONFIG_CHR_DEV_SG=y
86CONFIG_SCSI_LOGGING=y
87CONFIG_SCSI_SYM53C8XX_2=y
88CONFIG_ATA=y
89CONFIG_SATA_AHCI=y
90CONFIG_SATA_FSL=y
91CONFIG_SATA_SIL24=y
92CONFIG_SATA_SIL=y
93CONFIG_PATA_SIL680=y
94CONFIG_NETDEVICES=y
95CONFIG_FSL_PQ_MDIO=y
96CONFIG_FSL_XGMAC_MDIO=y
97CONFIG_E1000=y
98CONFIG_E1000E=y
99CONFIG_AT803X_PHY=y
100CONFIG_VITESSE_PHY=y
101CONFIG_FIXED_PHY=y
102CONFIG_MDIO_BUS_MUX_GPIO=y
103CONFIG_MDIO_BUS_MUX_MMIOREG=y
104# CONFIG_INPUT_MOUSEDEV is not set
105# CONFIG_INPUT_KEYBOARD is not set
106# CONFIG_INPUT_MOUSE is not set
107CONFIG_SERIO_LIBPS2=y
108# CONFIG_LEGACY_PTYS is not set
109CONFIG_PPC_EPAPR_HV_BYTECHAN=y
110CONFIG_SERIAL_8250=y
111CONFIG_SERIAL_8250_CONSOLE=y
112CONFIG_SERIAL_8250_MANY_PORTS=y
113CONFIG_SERIAL_8250_DETECT_IRQ=y
114CONFIG_SERIAL_8250_RSA=y
115CONFIG_NVRAM=y
116CONFIG_I2C=y
117CONFIG_I2C_CHARDEV=y
118CONFIG_I2C_MPC=y
119CONFIG_I2C_MUX=y
120CONFIG_I2C_MUX_PCA954x=y
121CONFIG_SPI=y
122CONFIG_SPI_GPIO=y
123CONFIG_SPI_FSL_SPI=y
124CONFIG_SPI_FSL_ESPI=y
125CONFIG_SENSORS_LM90=y
126CONFIG_SENSORS_INA2XX=y
127CONFIG_USB_HID=m
128CONFIG_USB=y
129CONFIG_USB_MON=y
130CONFIG_USB_EHCI_HCD=y
131CONFIG_USB_EHCI_FSL=y
132CONFIG_USB_OHCI_HCD=y
133CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
134CONFIG_USB_OHCI_HCD_PPC_OF_LE=y
135CONFIG_USB_STORAGE=y
136CONFIG_MMC=y
137CONFIG_MMC_SDHCI=y
138CONFIG_EDAC=y
139CONFIG_EDAC_MM_EDAC=y
140CONFIG_EDAC_MPC85XX=y
141CONFIG_RTC_CLASS=y
142CONFIG_RTC_DRV_DS1307=y
143CONFIG_RTC_DRV_DS1374=y
144CONFIG_RTC_DRV_DS3232=y
145CONFIG_UIO=y
146CONFIG_VIRT_DRIVERS=y
147CONFIG_FSL_HV_MANAGER=y
148CONFIG_STAGING=y
149CONFIG_FSL_CORENET_CF=y
150CONFIG_CLK_QORIQ=y
151CONFIG_EXT2_FS=y
152CONFIG_EXT3_FS=y
153# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
154CONFIG_ISO9660_FS=m
155CONFIG_JOLIET=y
156CONFIG_ZISOFS=y
157CONFIG_UDF_FS=m
158CONFIG_MSDOS_FS=m
159CONFIG_VFAT_FS=y
160CONFIG_NTFS_FS=y
161CONFIG_PROC_KCORE=y
162CONFIG_TMPFS=y
163CONFIG_HUGETLBFS=y
164CONFIG_JFFS2_FS=y
165CONFIG_CRAMFS=y
166CONFIG_NFS_FS=y
167CONFIG_NFS_V4=y
168CONFIG_ROOT_NFS=y
169CONFIG_NFSD=m
170CONFIG_NLS_CODEPAGE_437=y
171CONFIG_NLS_CODEPAGE_850=y
172CONFIG_NLS_ISO8859_1=y
173CONFIG_NLS_UTF8=m
174CONFIG_DEBUG_INFO=y
175CONFIG_MAGIC_SYSRQ=y
176CONFIG_DEBUG_SHIRQ=y
177CONFIG_DETECT_HUNG_TASK=y
178CONFIG_RCU_TRACE=y
179CONFIG_CRYPTO_NULL=y
180CONFIG_CRYPTO_PCBC=m
181CONFIG_CRYPTO_MD4=y
182CONFIG_CRYPTO_SHA256=y
183CONFIG_CRYPTO_SHA512=y
184# CONFIG_CRYPTO_ANSI_CPRNG is not set
185CONFIG_CRYPTO_DEV_FSL_CAAM=y
diff --git a/arch/powerpc/configs/corenet_basic_defconfig b/arch/powerpc/configs/corenet_basic_defconfig
new file mode 100644
index 000000000000..b568d465e59e
--- /dev/null
+++ b/arch/powerpc/configs/corenet_basic_defconfig
@@ -0,0 +1 @@
CONFIG_CORENET_GENERIC=y
diff --git a/arch/powerpc/configs/corenet64_smp_defconfig b/arch/powerpc/configs/fsl-emb-nonhw.config
index 33cd1df818ad..41e4d359524d 100644
--- a/arch/powerpc/configs/corenet64_smp_defconfig
+++ b/arch/powerpc/configs/fsl-emb-nonhw.config
@@ -1,176 +1,126 @@
1CONFIG_PPC64=y 1CONFIG_ADFS_FS=m
2CONFIG_PPC_BOOK3E_64=y 2CONFIG_AFFS_FS=m
3CONFIG_ALTIVEC=y 3CONFIG_AUDIT=y
4CONFIG_SMP=y 4CONFIG_BEFS_FS=m
5CONFIG_NR_CPUS=24 5CONFIG_BFS_FS=m
6CONFIG_SYSVIPC=y 6CONFIG_BINFMT_MISC=m
7CONFIG_FHANDLE=y 7# CONFIG_BLK_DEV_BSG is not set
8CONFIG_IRQ_DOMAIN_DEBUG=y 8CONFIG_BLK_DEV_INITRD=y
9CONFIG_NO_HZ=y 9CONFIG_BLK_DEV_LOOP=y
10CONFIG_HIGH_RES_TIMERS=y 10CONFIG_BLK_DEV_NBD=y
11CONFIG_BLK_DEV_RAM_SIZE=131072
12CONFIG_BLK_DEV_RAM=y
11CONFIG_BSD_PROCESS_ACCT=y 13CONFIG_BSD_PROCESS_ACCT=y
12CONFIG_IKCONFIG=y
13CONFIG_IKCONFIG_PROC=y
14CONFIG_LOG_BUF_SHIFT=14
15CONFIG_CGROUPS=y
16CONFIG_CPUSETS=y
17CONFIG_CGROUP_CPUACCT=y 14CONFIG_CGROUP_CPUACCT=y
18CONFIG_CGROUP_SCHED=y 15CONFIG_CGROUP_SCHED=y
19CONFIG_BLK_DEV_INITRD=y 16CONFIG_CGROUPS=y
17# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
18CONFIG_CRC_T10DIF=y
19CONFIG_CPUSETS=y
20CONFIG_CRAMFS=y
21CONFIG_CRYPTO_MD4=y
22CONFIG_CRYPTO_NULL=y
23CONFIG_CRYPTO_PCBC=m
24CONFIG_CRYPTO_SHA256=y
25CONFIG_CRYPTO_SHA512=y
26CONFIG_DEBUG_FS=y
27CONFIG_DEBUG_INFO=y
28CONFIG_DEBUG_SHIRQ=y
29CONFIG_DETECT_HUNG_TASK=y
30CONFIG_DEVTMPFS_MOUNT=y
31CONFIG_DEVTMPFS=y
32CONFIG_DUMMY=y
33CONFIG_EFS_FS=m
20CONFIG_EXPERT=y 34CONFIG_EXPERT=y
21CONFIG_KALLSYMS_ALL=y 35CONFIG_EXT2_FS=y
22CONFIG_MODULES=y 36# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
23CONFIG_MODULE_UNLOAD=y 37CONFIG_EXT3_FS=y
24CONFIG_MODULE_FORCE_UNLOAD=y 38CONFIG_FB=y
25CONFIG_MODVERSIONS=y 39CONFIG_FHANDLE=y
26# CONFIG_BLK_DEV_BSG is not set 40CONFIG_FIXED_PHY=y
27CONFIG_PARTITION_ADVANCED=y 41CONFIG_FONT_8x16=y
28CONFIG_MAC_PARTITION=y 42CONFIG_FONT_8x8=y
29CONFIG_CORENET_GENERIC=y 43CONFIG_FONTS=y
30# CONFIG_PPC_OF_BOOT_TRAMPOLINE is not set 44CONFIG_FORCE_MAX_ZONEORDER=13
31CONFIG_BINFMT_MISC=m 45CONFIG_FRAMEBUFFER_CONSOLE=y
32CONFIG_MATH_EMULATION=y 46CONFIG_FRAME_WARN=1024
33CONFIG_MATH_EMULATION_HW_UNIMPLEMENTED=y 47CONFIG_FTL=y
34CONFIG_PCIEPORTBUS=y 48CONFIG_HFS_FS=m
35CONFIG_PCI_MSI=y 49CONFIG_HFSPLUS_FS=m
36CONFIG_RAPIDIO=y 50CONFIG_HIGH_RES_TIMERS=y
37CONFIG_FSL_RIO=y 51CONFIG_HPFS_FS=m
38CONFIG_NET=y 52CONFIG_HUGETLBFS=y
39CONFIG_PACKET=y 53CONFIG_IKCONFIG_PROC=y
40CONFIG_UNIX=y 54CONFIG_IKCONFIG=y
41CONFIG_XFRM_USER=y 55CONFIG_INET_AH=y
42CONFIG_NET_KEY=y 56CONFIG_INET_ESP=y
57CONFIG_INET_IPCOMP=y
58# CONFIG_INET_LRO is not set
59# CONFIG_INET_XFRM_MODE_BEET is not set
43CONFIG_INET=y 60CONFIG_INET=y
44CONFIG_IP_MULTICAST=y
45CONFIG_IP_ADVANCED_ROUTER=y 61CONFIG_IP_ADVANCED_ROUTER=y
46CONFIG_IP_MULTIPLE_TABLES=y
47CONFIG_IP_ROUTE_MULTIPATH=y
48CONFIG_IP_ROUTE_VERBOSE=y
49CONFIG_IP_PNP=y
50CONFIG_IP_PNP_DHCP=y
51CONFIG_IP_PNP_BOOTP=y
52CONFIG_IP_PNP_RARP=y
53CONFIG_NET_IPIP=y
54CONFIG_IP_MROUTE=y 62CONFIG_IP_MROUTE=y
63CONFIG_IP_MULTICAST=y
64CONFIG_IP_MULTIPLE_TABLES=y
55CONFIG_IP_PIMSM_V1=y 65CONFIG_IP_PIMSM_V1=y
56CONFIG_IP_PIMSM_V2=y 66CONFIG_IP_PIMSM_V2=y
57CONFIG_INET_ESP=y 67CONFIG_IP_PNP_BOOTP=y
58# CONFIG_INET_XFRM_MODE_BEET is not set 68CONFIG_IP_PNP_DHCP=y
59# CONFIG_INET_LRO is not set 69CONFIG_IP_PNP_RARP=y
60CONFIG_IPV6=y 70CONFIG_IP_PNP=y
71CONFIG_IP_ROUTE_MULTIPATH=y
72CONFIG_IP_ROUTE_VERBOSE=y
61CONFIG_IP_SCTP=m 73CONFIG_IP_SCTP=m
62CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 74CONFIG_IPV6=y
63CONFIG_DEVTMPFS=y 75CONFIG_IRQ_DOMAIN_DEBUG=y
64CONFIG_DEVTMPFS_MOUNT=y
65CONFIG_MTD=y
66CONFIG_MTD_CMDLINE_PARTS=y
67CONFIG_MTD_BLOCK=y
68CONFIG_FTL=y
69CONFIG_MTD_CFI=y
70CONFIG_MTD_CFI_INTELEXT=y
71CONFIG_MTD_CFI_AMDSTD=y
72CONFIG_MTD_PHYSMAP_OF=y
73CONFIG_MTD_NAND=y
74CONFIG_MTD_NAND_FSL_ELBC=y
75CONFIG_MTD_NAND_FSL_IFC=y
76CONFIG_MTD_SPI_NOR=y
77CONFIG_MTD_UBI=y
78CONFIG_BLK_DEV_LOOP=y
79CONFIG_BLK_DEV_RAM=y
80CONFIG_BLK_DEV_RAM_SIZE=131072
81CONFIG_EEPROM_LEGACY=y
82CONFIG_BLK_DEV_SD=y
83CONFIG_BLK_DEV_SR=y
84CONFIG_BLK_DEV_SR_VENDOR=y
85CONFIG_CHR_DEV_SG=y
86CONFIG_ATA=y
87CONFIG_SATA_FSL=y
88CONFIG_SATA_SIL24=y
89CONFIG_NETDEVICES=y
90CONFIG_DUMMY=y
91CONFIG_FSL_PQ_MDIO=y
92CONFIG_FSL_XGMAC_MDIO=y
93CONFIG_E1000E=y
94CONFIG_VITESSE_PHY=y
95CONFIG_FIXED_PHY=y
96CONFIG_MDIO_BUS_MUX_GPIO=y
97CONFIG_MDIO_BUS_MUX_MMIOREG=y
98CONFIG_INPUT_FF_MEMLESS=m
99# CONFIG_INPUT_MOUSEDEV is not set
100# CONFIG_INPUT_KEYBOARD is not set
101# CONFIG_INPUT_MOUSE is not set
102CONFIG_SERIO_LIBPS2=y
103CONFIG_PPC_EPAPR_HV_BYTECHAN=y
104CONFIG_SERIAL_8250=y
105CONFIG_SERIAL_8250_CONSOLE=y
106CONFIG_SERIAL_8250_MANY_PORTS=y
107CONFIG_SERIAL_8250_DETECT_IRQ=y
108CONFIG_SERIAL_8250_RSA=y
109CONFIG_I2C=y
110CONFIG_I2C_CHARDEV=y
111CONFIG_I2C_MPC=y
112CONFIG_I2C_MUX=y
113CONFIG_I2C_MUX_PCA954x=y
114CONFIG_SPI=y
115CONFIG_SPI_GPIO=y
116CONFIG_SPI_FSL_SPI=y
117CONFIG_SPI_FSL_ESPI=y
118CONFIG_SENSORS_LM90=y
119CONFIG_SENSORS_INA2XX=y
120CONFIG_USB_HID=m
121CONFIG_USB=y
122CONFIG_USB_MON=y
123CONFIG_USB_EHCI_HCD=y
124CONFIG_USB_EHCI_FSL=y
125CONFIG_USB_STORAGE=y
126CONFIG_MMC=y
127CONFIG_MMC_SDHCI=y
128CONFIG_EDAC=y
129CONFIG_EDAC_MM_EDAC=y
130CONFIG_RTC_CLASS=y
131CONFIG_RTC_DRV_DS1307=y
132CONFIG_RTC_DRV_DS1374=y
133CONFIG_RTC_DRV_DS3232=y
134CONFIG_DMADEVICES=y
135CONFIG_FSL_DMA=y
136CONFIG_VIRT_DRIVERS=y
137CONFIG_FSL_HV_MANAGER=y
138CONFIG_CLK_QORIQ=y
139CONFIG_FSL_CORENET_CF=y
140CONFIG_EXT2_FS=y
141CONFIG_EXT3_FS=y
142CONFIG_ISO9660_FS=m 76CONFIG_ISO9660_FS=m
77CONFIG_JFFS2_FS_DEBUG=1
78CONFIG_JFFS2_FS=y
143CONFIG_JOLIET=y 79CONFIG_JOLIET=y
144CONFIG_ZISOFS=y 80CONFIG_KALLSYMS_ALL=y
145CONFIG_UDF_FS=m 81# CONFIG_LEGACY_PTYS is not set
82CONFIG_LOG_BUF_SHIFT=14
83CONFIG_MAC_PARTITION=y
84CONFIG_MAGIC_SYSRQ=y
85CONFIG_MODULE_FORCE_UNLOAD=y
86CONFIG_MODULES=y
87CONFIG_MODULE_UNLOAD=y
88CONFIG_MODVERSIONS=y
146CONFIG_MSDOS_FS=m 89CONFIG_MSDOS_FS=m
147CONFIG_VFAT_FS=y 90CONFIG_MTD_UBI=y
148CONFIG_NTFS_FS=y 91CONFIG_MTD=y
149CONFIG_PROC_KCORE=y 92CONFIG_NET_IPIP=y
150CONFIG_TMPFS=y 93CONFIG_NET_KEY_MIGRATE=y
151CONFIG_HUGETLBFS=y 94CONFIG_NET_KEY=y
152CONFIG_JFFS2_FS=y 95CONFIG_NET=y
153CONFIG_JFFS2_FS_DEBUG=1 96CONFIG_NFSD=y
154CONFIG_UBIFS_FS=y
155CONFIG_NFS_FS=y 97CONFIG_NFS_FS=y
156CONFIG_NFS_V4=y 98CONFIG_NFS_V4=y
157CONFIG_ROOT_NFS=y
158CONFIG_NFSD=m
159CONFIG_NLS_CODEPAGE_437=y 99CONFIG_NLS_CODEPAGE_437=y
160CONFIG_NLS_CODEPAGE_850=y 100CONFIG_NLS_CODEPAGE_850=y
161CONFIG_NLS_ISO8859_1=y 101CONFIG_NLS_ISO8859_1=y
162CONFIG_NLS_UTF8=m 102CONFIG_NLS_UTF8=m
163CONFIG_CRC_T10DIF=y 103CONFIG_NO_HZ=y
164CONFIG_DEBUG_INFO=y 104CONFIG_NTFS_FS=y
165CONFIG_FRAME_WARN=1024 105CONFIG_PACKET=y
166CONFIG_DEBUG_FS=y 106CONFIG_PARTITION_ADVANCED=y
167CONFIG_MAGIC_SYSRQ=y 107CONFIG_PERF_EVENTS=y
168CONFIG_DEBUG_SHIRQ=y 108CONFIG_POSIX_MQUEUE=y
169CONFIG_DETECT_HUNG_TASK=y 109CONFIG_QNX4FS_FS=m
170CONFIG_CRYPTO_NULL=y 110CONFIG_RCU_TRACE=y
171CONFIG_CRYPTO_PCBC=m 111CONFIG_ROOT_NFS=y
172CONFIG_CRYPTO_MD4=y 112CONFIG_SYSV_FS=m
173CONFIG_CRYPTO_SHA256=y 113CONFIG_SYSVIPC=y
174CONFIG_CRYPTO_SHA512=y 114CONFIG_TMPFS=y
175# CONFIG_CRYPTO_ANSI_CPRNG is not set 115CONFIG_UBIFS_FS=y
176CONFIG_CRYPTO_DEV_FSL_CAAM=y 116CONFIG_UDF_FS=m
117CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
118CONFIG_UFS_FS=m
119CONFIG_UIO=y
120CONFIG_UNIX=y
121CONFIG_VFAT_FS=y
122CONFIG_VXFS_FS=m
123CONFIG_XFRM_STATISTICS=y
124CONFIG_XFRM_SUB_POLICY=y
125CONFIG_XFRM_USER=y
126CONFIG_ZISOFS=y
diff --git a/arch/powerpc/configs/mpc85xx_basic_defconfig b/arch/powerpc/configs/mpc85xx_basic_defconfig
new file mode 100644
index 000000000000..850bd195d0e8
--- /dev/null
+++ b/arch/powerpc/configs/mpc85xx_basic_defconfig
@@ -0,0 +1,23 @@
1CONFIG_MATH_EMULATION=y
2CONFIG_MPC8536_DS=y
3CONFIG_MPC8540_ADS=y
4CONFIG_MPC8560_ADS=y
5CONFIG_MPC85xx_CDS=y
6CONFIG_MPC85xx_DS=y
7CONFIG_MPC85xx_MDS=y
8CONFIG_MPC85xx_RDB=y
9CONFIG_KSI8560=y
10CONFIG_MVME2500=y
11CONFIG_P1010_RDB=y
12CONFIG_P1022_DS=y
13CONFIG_P1022_RDK=y
14CONFIG_P1023_RDB=y
15CONFIG_SBC8548=y
16CONFIG_SOCRATES=y
17CONFIG_STX_GP3=y
18CONFIG_TQM8540=y
19CONFIG_TQM8541=y
20CONFIG_TQM8548=y
21CONFIG_TQM8555=y
22CONFIG_TQM8560=y
23CONFIG_XES_MPC85xx=y
diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
deleted file mode 100644
index 6ecf7bdbc2f9..000000000000
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ /dev/null
@@ -1,252 +0,0 @@
1CONFIG_PPC_85xx=y
2CONFIG_PHYS_64BIT=y
3CONFIG_SYSVIPC=y
4CONFIG_POSIX_MQUEUE=y
5CONFIG_AUDIT=y
6CONFIG_IRQ_DOMAIN_DEBUG=y
7CONFIG_NO_HZ=y
8CONFIG_HIGH_RES_TIMERS=y
9CONFIG_BSD_PROCESS_ACCT=y
10CONFIG_IKCONFIG=y
11CONFIG_IKCONFIG_PROC=y
12CONFIG_LOG_BUF_SHIFT=14
13CONFIG_BLK_DEV_INITRD=y
14CONFIG_EXPERT=y
15CONFIG_KALLSYMS_ALL=y
16CONFIG_MODULES=y
17CONFIG_MODULE_UNLOAD=y
18CONFIG_MODULE_FORCE_UNLOAD=y
19CONFIG_MODVERSIONS=y
20# CONFIG_BLK_DEV_BSG is not set
21CONFIG_PARTITION_ADVANCED=y
22CONFIG_MAC_PARTITION=y
23CONFIG_C293_PCIE=y
24CONFIG_MPC8540_ADS=y
25CONFIG_MPC8560_ADS=y
26CONFIG_MPC85xx_CDS=y
27CONFIG_MPC85xx_MDS=y
28CONFIG_MPC8536_DS=y
29CONFIG_MPC85xx_DS=y
30CONFIG_MPC85xx_RDB=y
31CONFIG_P1010_RDB=y
32CONFIG_P1022_DS=y
33CONFIG_P1022_RDK=y
34CONFIG_P1023_RDB=y
35CONFIG_SOCRATES=y
36CONFIG_KSI8560=y
37CONFIG_XES_MPC85xx=y
38CONFIG_STX_GP3=y
39CONFIG_TQM8540=y
40CONFIG_TQM8541=y
41CONFIG_TQM8548=y
42CONFIG_TQM8555=y
43CONFIG_TQM8560=y
44CONFIG_SBC8548=y
45CONFIG_MVME2500=y
46CONFIG_QUICC_ENGINE=y
47CONFIG_QE_GPIO=y
48CONFIG_HIGHMEM=y
49CONFIG_BINFMT_MISC=m
50CONFIG_MATH_EMULATION=y
51CONFIG_FORCE_MAX_ZONEORDER=12
52CONFIG_PCI=y
53CONFIG_PCIEPORTBUS=y
54# CONFIG_PCIEASPM is not set
55CONFIG_PCI_MSI=y
56CONFIG_RAPIDIO=y
57CONFIG_NET=y
58CONFIG_PACKET=y
59CONFIG_UNIX=y
60CONFIG_XFRM_USER=y
61CONFIG_NET_KEY=y
62CONFIG_INET=y
63CONFIG_IP_MULTICAST=y
64CONFIG_IP_ADVANCED_ROUTER=y
65CONFIG_IP_MULTIPLE_TABLES=y
66CONFIG_IP_ROUTE_MULTIPATH=y
67CONFIG_IP_ROUTE_VERBOSE=y
68CONFIG_IP_PNP=y
69CONFIG_IP_PNP_DHCP=y
70CONFIG_IP_PNP_BOOTP=y
71CONFIG_IP_PNP_RARP=y
72CONFIG_NET_IPIP=y
73CONFIG_IP_MROUTE=y
74CONFIG_IP_PIMSM_V1=y
75CONFIG_IP_PIMSM_V2=y
76CONFIG_INET_ESP=y
77# CONFIG_INET_XFRM_MODE_BEET is not set
78# CONFIG_INET_LRO is not set
79CONFIG_IPV6=y
80CONFIG_IP_SCTP=m
81CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
82CONFIG_DEVTMPFS=y
83CONFIG_DEVTMPFS_MOUNT=y
84CONFIG_MTD=y
85CONFIG_MTD_CMDLINE_PARTS=y
86CONFIG_MTD_BLOCK=y
87CONFIG_FTL=y
88CONFIG_MTD_CFI=y
89CONFIG_MTD_CFI_INTELEXT=y
90CONFIG_MTD_CFI_AMDSTD=y
91CONFIG_MTD_PHYSMAP=y
92CONFIG_MTD_PHYSMAP_OF=y
93CONFIG_MTD_PLATRAM=y
94CONFIG_MTD_M25P80=y
95CONFIG_MTD_NAND=y
96CONFIG_MTD_NAND_FSL_ELBC=y
97CONFIG_MTD_NAND_FSL_IFC=y
98CONFIG_MTD_SPI_NOR=y
99CONFIG_MTD_UBI=y
100CONFIG_BLK_DEV_LOOP=y
101CONFIG_BLK_DEV_NBD=y
102CONFIG_BLK_DEV_RAM=y
103CONFIG_BLK_DEV_RAM_SIZE=131072
104CONFIG_EEPROM_AT24=y
105CONFIG_EEPROM_LEGACY=y
106CONFIG_BLK_DEV_SD=y
107CONFIG_CHR_DEV_ST=y
108CONFIG_BLK_DEV_SR=y
109CONFIG_CHR_DEV_SG=y
110CONFIG_SCSI_LOGGING=y
111CONFIG_ATA=y
112CONFIG_SATA_AHCI=y
113CONFIG_SATA_FSL=y
114CONFIG_SATA_SIL24=y
115CONFIG_PATA_ALI=y
116CONFIG_PATA_VIA=y
117CONFIG_NETDEVICES=y
118CONFIG_DUMMY=y
119CONFIG_FS_ENET=y
120CONFIG_UCC_GETH=y
121CONFIG_GIANFAR=y
122CONFIG_E1000=y
123CONFIG_E1000E=y
124CONFIG_IGB=y
125CONFIG_AT803X_PHY=y
126CONFIG_MARVELL_PHY=y
127CONFIG_DAVICOM_PHY=y
128CONFIG_CICADA_PHY=y
129CONFIG_VITESSE_PHY=y
130CONFIG_BROADCOM_PHY=y
131CONFIG_FIXED_PHY=y
132CONFIG_INPUT_FF_MEMLESS=m
133# CONFIG_INPUT_MOUSEDEV is not set
134# CONFIG_INPUT_KEYBOARD is not set
135# CONFIG_INPUT_MOUSE is not set
136CONFIG_SERIO_LIBPS2=y
137CONFIG_SERIAL_8250=y
138CONFIG_SERIAL_8250_CONSOLE=y
139CONFIG_SERIAL_8250_NR_UARTS=6
140CONFIG_SERIAL_8250_RUNTIME_UARTS=6
141CONFIG_SERIAL_8250_MANY_PORTS=y
142CONFIG_SERIAL_8250_DETECT_IRQ=y
143CONFIG_SERIAL_8250_RSA=y
144CONFIG_SERIAL_QE=m
145CONFIG_NVRAM=y
146CONFIG_I2C_CHARDEV=y
147CONFIG_I2C_CPM=m
148CONFIG_I2C_MPC=y
149CONFIG_SPI=y
150CONFIG_SPI_FSL_SPI=y
151CONFIG_SPI_FSL_ESPI=y
152CONFIG_GPIO_MPC8XXX=y
153CONFIG_SENSORS_LM90=y
154CONFIG_FB=y
155CONFIG_FB_FSL_DIU=y
156# CONFIG_VGA_CONSOLE is not set
157CONFIG_FRAMEBUFFER_CONSOLE=y
158CONFIG_SOUND=y
159CONFIG_SND=y
160# CONFIG_SND_SUPPORT_OLD_API is not set
161# CONFIG_SND_DRIVERS is not set
162CONFIG_SND_INTEL8X0=y
163# CONFIG_SND_PPC is not set
164# CONFIG_SND_USB is not set
165CONFIG_SND_SOC=y
166CONFIG_SND_POWERPC_SOC=y
167CONFIG_HID_A4TECH=y
168CONFIG_HID_APPLE=y
169CONFIG_HID_BELKIN=y
170CONFIG_HID_CHERRY=y
171CONFIG_HID_CHICONY=y
172CONFIG_HID_CYPRESS=y
173CONFIG_HID_EZKEY=y
174CONFIG_HID_GYRATION=y
175CONFIG_HID_LOGITECH=y
176CONFIG_HID_MICROSOFT=y
177CONFIG_HID_MONTEREY=y
178CONFIG_HID_PANTHERLORD=y
179CONFIG_HID_PETALYNX=y
180CONFIG_HID_SAMSUNG=y
181CONFIG_HID_SUNPLUS=y
182CONFIG_USB=y
183CONFIG_USB_MON=y
184CONFIG_USB_EHCI_HCD=y
185CONFIG_USB_EHCI_FSL=y
186CONFIG_USB_OHCI_HCD=y
187CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
188CONFIG_USB_OHCI_HCD_PPC_OF_LE=y
189CONFIG_USB_STORAGE=y
190CONFIG_MMC=y
191CONFIG_MMC_SDHCI=y
192CONFIG_MMC_SDHCI_PLTFM=y
193CONFIG_MMC_SDHCI_OF_ESDHC=y
194CONFIG_EDAC=y
195CONFIG_EDAC_MM_EDAC=y
196CONFIG_EDAC_MPC85XX=y
197CONFIG_RTC_CLASS=y
198CONFIG_RTC_DRV_DS1307=y
199CONFIG_RTC_DRV_DS1374=y
200CONFIG_RTC_DRV_DS3232=y
201CONFIG_RTC_DRV_CMOS=y
202CONFIG_DMADEVICES=y
203CONFIG_FSL_DMA=y
204CONFIG_EXT2_FS=y
205CONFIG_EXT3_FS=y
206# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
207CONFIG_ISO9660_FS=m
208CONFIG_JOLIET=y
209CONFIG_ZISOFS=y
210CONFIG_UDF_FS=m
211CONFIG_MSDOS_FS=m
212CONFIG_VFAT_FS=y
213CONFIG_NTFS_FS=y
214CONFIG_PROC_KCORE=y
215CONFIG_TMPFS=y
216CONFIG_HUGETLBFS=y
217CONFIG_ADFS_FS=m
218CONFIG_AFFS_FS=m
219CONFIG_HFS_FS=m
220CONFIG_HFSPLUS_FS=m
221CONFIG_BEFS_FS=m
222CONFIG_BFS_FS=m
223CONFIG_EFS_FS=m
224CONFIG_JFFS2_FS=y
225CONFIG_JFFS2_FS_DEBUG=1
226CONFIG_UBIFS_FS=y
227CONFIG_CRAMFS=y
228CONFIG_VXFS_FS=m
229CONFIG_HPFS_FS=m
230CONFIG_QNX4FS_FS=m
231CONFIG_SYSV_FS=m
232CONFIG_UFS_FS=m
233CONFIG_NFS_FS=y
234CONFIG_NFS_V4=y
235CONFIG_ROOT_NFS=y
236CONFIG_NFSD=y
237CONFIG_NLS_CODEPAGE_437=y
238CONFIG_NLS_CODEPAGE_850=y
239CONFIG_NLS_ISO8859_1=y
240CONFIG_CRC_T10DIF=y
241CONFIG_FONTS=y
242CONFIG_FONT_8x8=y
243CONFIG_FONT_8x16=y
244CONFIG_DEBUG_INFO=y
245CONFIG_DEBUG_FS=y
246CONFIG_DETECT_HUNG_TASK=y
247CONFIG_CRYPTO_PCBC=m
248CONFIG_CRYPTO_SHA256=y
249CONFIG_CRYPTO_SHA512=y
250# CONFIG_CRYPTO_ANSI_CPRNG is not set
251CONFIG_CRYPTO_DEV_FSL_CAAM=y
252CONFIG_CRYPTO_DEV_TALITOS=y
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig
deleted file mode 100644
index b6c7111ea913..000000000000
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ /dev/null
@@ -1,244 +0,0 @@
1CONFIG_PPC_85xx=y
2CONFIG_PHYS_64BIT=y
3CONFIG_SMP=y
4CONFIG_NR_CPUS=8
5CONFIG_SYSVIPC=y
6CONFIG_POSIX_MQUEUE=y
7CONFIG_AUDIT=y
8CONFIG_IRQ_DOMAIN_DEBUG=y
9CONFIG_NO_HZ=y
10CONFIG_HIGH_RES_TIMERS=y
11CONFIG_BSD_PROCESS_ACCT=y
12CONFIG_IKCONFIG=y
13CONFIG_IKCONFIG_PROC=y
14CONFIG_LOG_BUF_SHIFT=14
15CONFIG_BLK_DEV_INITRD=y
16CONFIG_EXPERT=y
17CONFIG_KALLSYMS_ALL=y
18CONFIG_MODULES=y
19CONFIG_MODULE_UNLOAD=y
20CONFIG_MODULE_FORCE_UNLOAD=y
21CONFIG_MODVERSIONS=y
22# CONFIG_BLK_DEV_BSG is not set
23CONFIG_PARTITION_ADVANCED=y
24CONFIG_MAC_PARTITION=y
25CONFIG_C293_PCIE=y
26CONFIG_MPC8540_ADS=y
27CONFIG_MPC8560_ADS=y
28CONFIG_MPC85xx_CDS=y
29CONFIG_MPC85xx_MDS=y
30CONFIG_MPC8536_DS=y
31CONFIG_MPC85xx_DS=y
32CONFIG_MPC85xx_RDB=y
33CONFIG_P1010_RDB=y
34CONFIG_P1022_DS=y
35CONFIG_P1022_RDK=y
36CONFIG_P1023_RDB=y
37CONFIG_SOCRATES=y
38CONFIG_KSI8560=y
39CONFIG_XES_MPC85xx=y
40CONFIG_STX_GP3=y
41CONFIG_TQM8540=y
42CONFIG_TQM8541=y
43CONFIG_TQM8548=y
44CONFIG_TQM8555=y
45CONFIG_TQM8560=y
46CONFIG_SBC8548=y
47CONFIG_QUICC_ENGINE=y
48CONFIG_QE_GPIO=y
49CONFIG_HIGHMEM=y
50CONFIG_BINFMT_MISC=m
51CONFIG_MATH_EMULATION=y
52CONFIG_FORCE_MAX_ZONEORDER=12
53CONFIG_PCI=y
54CONFIG_PCI_MSI=y
55CONFIG_RAPIDIO=y
56CONFIG_NET=y
57CONFIG_PACKET=y
58CONFIG_UNIX=y
59CONFIG_XFRM_USER=y
60CONFIG_NET_KEY=y
61CONFIG_INET=y
62CONFIG_IP_MULTICAST=y
63CONFIG_IP_ADVANCED_ROUTER=y
64CONFIG_IP_MULTIPLE_TABLES=y
65CONFIG_IP_ROUTE_MULTIPATH=y
66CONFIG_IP_ROUTE_VERBOSE=y
67CONFIG_IP_PNP=y
68CONFIG_IP_PNP_DHCP=y
69CONFIG_IP_PNP_BOOTP=y
70CONFIG_IP_PNP_RARP=y
71CONFIG_NET_IPIP=y
72CONFIG_IP_MROUTE=y
73CONFIG_IP_PIMSM_V1=y
74CONFIG_IP_PIMSM_V2=y
75CONFIG_INET_ESP=y
76# CONFIG_INET_XFRM_MODE_BEET is not set
77# CONFIG_INET_LRO is not set
78CONFIG_IPV6=y
79CONFIG_IP_SCTP=m
80CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
81CONFIG_DEVTMPFS=y
82CONFIG_DEVTMPFS_MOUNT=y
83CONFIG_MTD=y
84CONFIG_MTD_CMDLINE_PARTS=y
85CONFIG_MTD_BLOCK=y
86CONFIG_FTL=y
87CONFIG_MTD_CFI=y
88CONFIG_MTD_CFI_INTELEXT=y
89CONFIG_MTD_CFI_AMDSTD=y
90CONFIG_MTD_PHYSMAP_OF=y
91CONFIG_MTD_NAND=y
92CONFIG_MTD_NAND_FSL_ELBC=y
93CONFIG_MTD_NAND_FSL_IFC=y
94CONFIG_MTD_SPI_NOR=y
95CONFIG_MTD_UBI=y
96CONFIG_BLK_DEV_LOOP=y
97CONFIG_BLK_DEV_NBD=y
98CONFIG_BLK_DEV_RAM=y
99CONFIG_BLK_DEV_RAM_SIZE=131072
100CONFIG_EEPROM_AT24=y
101CONFIG_EEPROM_LEGACY=y
102CONFIG_BLK_DEV_SD=y
103CONFIG_CHR_DEV_ST=y
104CONFIG_BLK_DEV_SR=y
105CONFIG_CHR_DEV_SG=y
106CONFIG_SCSI_LOGGING=y
107CONFIG_ATA=y
108CONFIG_SATA_AHCI=y
109CONFIG_SATA_FSL=y
110CONFIG_SATA_SIL24=y
111CONFIG_PATA_ALI=y
112CONFIG_NETDEVICES=y
113CONFIG_DUMMY=y
114CONFIG_FS_ENET=y
115CONFIG_UCC_GETH=y
116CONFIG_GIANFAR=y
117CONFIG_E1000E=y
118CONFIG_AT803X_PHY=y
119CONFIG_MARVELL_PHY=y
120CONFIG_DAVICOM_PHY=y
121CONFIG_CICADA_PHY=y
122CONFIG_VITESSE_PHY=y
123CONFIG_FIXED_PHY=y
124CONFIG_INPUT_FF_MEMLESS=m
125# CONFIG_INPUT_MOUSEDEV is not set
126# CONFIG_INPUT_KEYBOARD is not set
127# CONFIG_INPUT_MOUSE is not set
128CONFIG_SERIO_LIBPS2=y
129CONFIG_SERIAL_8250=y
130CONFIG_SERIAL_8250_CONSOLE=y
131CONFIG_SERIAL_8250_NR_UARTS=2
132CONFIG_SERIAL_8250_RUNTIME_UARTS=2
133CONFIG_SERIAL_8250_MANY_PORTS=y
134CONFIG_SERIAL_8250_DETECT_IRQ=y
135CONFIG_SERIAL_8250_RSA=y
136CONFIG_SERIAL_QE=m
137CONFIG_NVRAM=y
138CONFIG_I2C=y
139CONFIG_I2C_CHARDEV=y
140CONFIG_I2C_CPM=m
141CONFIG_I2C_MPC=y
142CONFIG_SPI=y
143CONFIG_SPI_FSL_SPI=y
144CONFIG_SPI_FSL_ESPI=y
145CONFIG_GPIO_MPC8XXX=y
146CONFIG_SENSORS_LM90=y
147CONFIG_FB=y
148CONFIG_FB_FSL_DIU=y
149# CONFIG_VGA_CONSOLE is not set
150CONFIG_FRAMEBUFFER_CONSOLE=y
151CONFIG_SOUND=y
152CONFIG_SND=y
153# CONFIG_SND_SUPPORT_OLD_API is not set
154# CONFIG_SND_DRIVERS is not set
155CONFIG_SND_INTEL8X0=y
156# CONFIG_SND_PPC is not set
157# CONFIG_SND_USB is not set
158CONFIG_SND_SOC=y
159CONFIG_SND_POWERPC_SOC=y
160CONFIG_HID_A4TECH=y
161CONFIG_HID_APPLE=y
162CONFIG_HID_BELKIN=y
163CONFIG_HID_CHERRY=y
164CONFIG_HID_CHICONY=y
165CONFIG_HID_CYPRESS=y
166CONFIG_HID_EZKEY=y
167CONFIG_HID_GYRATION=y
168CONFIG_HID_LOGITECH=y
169CONFIG_HID_MICROSOFT=y
170CONFIG_HID_MONTEREY=y
171CONFIG_HID_PANTHERLORD=y
172CONFIG_HID_PETALYNX=y
173CONFIG_HID_SAMSUNG=y
174CONFIG_HID_SUNPLUS=y
175CONFIG_USB=y
176CONFIG_USB_MON=y
177CONFIG_USB_EHCI_HCD=y
178CONFIG_USB_EHCI_FSL=y
179CONFIG_USB_OHCI_HCD=y
180CONFIG_USB_OHCI_HCD_PPC_OF_BE=y
181CONFIG_USB_OHCI_HCD_PPC_OF_LE=y
182CONFIG_USB_STORAGE=y
183CONFIG_MMC=y
184CONFIG_MMC_SDHCI=y
185CONFIG_MMC_SDHCI_PLTFM=y
186CONFIG_MMC_SDHCI_OF_ESDHC=y
187CONFIG_EDAC=y
188CONFIG_EDAC_MM_EDAC=y
189CONFIG_RTC_CLASS=y
190CONFIG_RTC_DRV_DS1307=y
191CONFIG_RTC_DRV_DS1374=y
192CONFIG_RTC_DRV_DS3232=y
193CONFIG_RTC_DRV_CMOS=y
194CONFIG_DMADEVICES=y
195CONFIG_FSL_DMA=y
196CONFIG_EXT2_FS=y
197CONFIG_EXT3_FS=y
198# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
199CONFIG_ISO9660_FS=m
200CONFIG_JOLIET=y
201CONFIG_ZISOFS=y
202CONFIG_UDF_FS=m
203CONFIG_MSDOS_FS=m
204CONFIG_VFAT_FS=y
205CONFIG_NTFS_FS=y
206CONFIG_PROC_KCORE=y
207CONFIG_TMPFS=y
208CONFIG_HUGETLBFS=y
209CONFIG_ADFS_FS=m
210CONFIG_AFFS_FS=m
211CONFIG_HFS_FS=m
212CONFIG_HFSPLUS_FS=m
213CONFIG_BEFS_FS=m
214CONFIG_BFS_FS=m
215CONFIG_EFS_FS=m
216CONFIG_JFFS2_FS=y
217CONFIG_JFFS2_FS_DEBUG=1
218CONFIG_UBIFS_FS=y
219CONFIG_CRAMFS=y
220CONFIG_VXFS_FS=m
221CONFIG_HPFS_FS=m
222CONFIG_QNX4FS_FS=m
223CONFIG_SYSV_FS=m
224CONFIG_UFS_FS=m
225CONFIG_NFS_FS=y
226CONFIG_NFS_V4=y
227CONFIG_ROOT_NFS=y
228CONFIG_NFSD=y
229CONFIG_NLS_CODEPAGE_437=y
230CONFIG_NLS_CODEPAGE_850=y
231CONFIG_NLS_ISO8859_1=y
232CONFIG_CRC_T10DIF=y
233CONFIG_FONTS=y
234CONFIG_FONT_8x8=y
235CONFIG_FONT_8x16=y
236CONFIG_DEBUG_INFO=y
237CONFIG_DEBUG_FS=y
238CONFIG_DETECT_HUNG_TASK=y
239CONFIG_CRYPTO_PCBC=m
240CONFIG_CRYPTO_SHA256=y
241CONFIG_CRYPTO_SHA512=y
242# CONFIG_CRYPTO_ANSI_CPRNG is not set
243CONFIG_CRYPTO_DEV_FSL_CAAM=y
244CONFIG_CRYPTO_DEV_TALITOS=y
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index a97efc2146fd..6bc0ee4b1070 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -355,3 +355,6 @@ CONFIG_CRYPTO_DEV_NX_ENCRYPT=m
355CONFIG_VIRTUALIZATION=y 355CONFIG_VIRTUALIZATION=y
356CONFIG_KVM_BOOK3S_64=m 356CONFIG_KVM_BOOK3S_64=m
357CONFIG_KVM_BOOK3S_64_HV=m 357CONFIG_KVM_BOOK3S_64_HV=m
358CONFIG_NEW_LEDS=y
359CONFIG_LEDS_CLASS=m
360CONFIG_LEDS_POWERNV=m
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index 0d9efcedaf34..7991f37e5fe2 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -190,7 +190,8 @@ CONFIG_HVC_RTAS=y
190CONFIG_HVCS=m 190CONFIG_HVCS=m
191CONFIG_VIRTIO_CONSOLE=m 191CONFIG_VIRTIO_CONSOLE=m
192CONFIG_IBM_BSR=m 192CONFIG_IBM_BSR=m
193CONFIG_GEN_RTC=y 193CONFIG_RTC_CLASS=y
194CONFIG_RTC_DRV_GENERIC=y
194CONFIG_RAW_DRIVER=y 195CONFIG_RAW_DRIVER=y
195CONFIG_MAX_RAW_DEVS=1024 196CONFIG_MAX_RAW_DEVS=1024
196CONFIG_FB=y 197CONFIG_FB=y
@@ -319,3 +320,6 @@ CONFIG_CRYPTO_DEV_NX_ENCRYPT=m
319CONFIG_VIRTUALIZATION=y 320CONFIG_VIRTUALIZATION=y
320CONFIG_KVM_BOOK3S_64=m 321CONFIG_KVM_BOOK3S_64=m
321CONFIG_KVM_BOOK3S_64_HV=m 322CONFIG_KVM_BOOK3S_64_HV=m
323CONFIG_NEW_LEDS=y
324CONFIG_LEDS_CLASS=m
325CONFIG_LEDS_POWERNV=m
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index 050712e1ce41..ab9f4e0ed4cf 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -6,5 +6,4 @@ generic-y += local64.h
6generic-y += mcs_spinlock.h 6generic-y += mcs_spinlock.h
7generic-y += preempt.h 7generic-y += preempt.h
8generic-y += rwsem.h 8generic-y += rwsem.h
9generic-y += trace_clock.h
10generic-y += vtime.h 9generic-y += vtime.h
diff --git a/arch/powerpc/include/asm/archrandom.h b/arch/powerpc/include/asm/archrandom.h
index 0cc6eedc4780..85e88f7a59c0 100644
--- a/arch/powerpc/include/asm/archrandom.h
+++ b/arch/powerpc/include/asm/archrandom.h
@@ -7,14 +7,23 @@
7 7
8static inline int arch_get_random_long(unsigned long *v) 8static inline int arch_get_random_long(unsigned long *v)
9{ 9{
10 if (ppc_md.get_random_long)
11 return ppc_md.get_random_long(v);
12
13 return 0; 10 return 0;
14} 11}
15 12
16static inline int arch_get_random_int(unsigned int *v) 13static inline int arch_get_random_int(unsigned int *v)
17{ 14{
15 return 0;
16}
17
18static inline int arch_get_random_seed_long(unsigned long *v)
19{
20 if (ppc_md.get_random_seed)
21 return ppc_md.get_random_seed(v);
22
23 return 0;
24}
25static inline int arch_get_random_seed_int(unsigned int *v)
26{
18 unsigned long val; 27 unsigned long val;
19 int rc; 28 int rc;
20 29
@@ -27,22 +36,13 @@ static inline int arch_get_random_int(unsigned int *v)
27 36
28static inline int arch_has_random(void) 37static inline int arch_has_random(void)
29{ 38{
30 return !!ppc_md.get_random_long;
31}
32
33static inline int arch_get_random_seed_long(unsigned long *v)
34{
35 return 0;
36}
37static inline int arch_get_random_seed_int(unsigned int *v)
38{
39 return 0; 39 return 0;
40} 40}
41
41static inline int arch_has_random_seed(void) 42static inline int arch_has_random_seed(void)
42{ 43{
43 return 0; 44 return !!ppc_md.get_random_seed;
44} 45}
45
46#endif /* CONFIG_ARCH_RANDOM */ 46#endif /* CONFIG_ARCH_RANDOM */
47 47
48#ifdef CONFIG_PPC_POWERNV 48#ifdef CONFIG_PPC_POWERNV
diff --git a/arch/powerpc/include/asm/cacheflush.h b/arch/powerpc/include/asm/cacheflush.h
index 30b35fff2dea..6229e6b6037b 100644
--- a/arch/powerpc/include/asm/cacheflush.h
+++ b/arch/powerpc/include/asm/cacheflush.h
@@ -40,7 +40,12 @@ extern void __flush_dcache_icache(void *page_va);
40extern void flush_dcache_icache_page(struct page *page); 40extern void flush_dcache_icache_page(struct page *page);
41#if defined(CONFIG_PPC32) && !defined(CONFIG_BOOKE) 41#if defined(CONFIG_PPC32) && !defined(CONFIG_BOOKE)
42extern void __flush_dcache_icache_phys(unsigned long physaddr); 42extern void __flush_dcache_icache_phys(unsigned long physaddr);
43#endif /* CONFIG_PPC32 && !CONFIG_BOOKE */ 43#else
44static inline void __flush_dcache_icache_phys(unsigned long physaddr)
45{
46 BUG();
47}
48#endif
44 49
45extern void flush_dcache_range(unsigned long start, unsigned long stop); 50extern void flush_dcache_range(unsigned long start, unsigned long stop);
46#ifdef CONFIG_PPC32 51#ifdef CONFIG_PPC32
diff --git a/arch/powerpc/include/asm/checksum.h b/arch/powerpc/include/asm/checksum.h
index 8251a3ba870f..e8d9ef4755a4 100644
--- a/arch/powerpc/include/asm/checksum.h
+++ b/arch/powerpc/include/asm/checksum.h
@@ -20,15 +20,6 @@
20extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl); 20extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
21 21
22/* 22/*
23 * computes the checksum of the TCP/UDP pseudo-header
24 * returns a 16-bit checksum, already complemented
25 */
26extern __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
27 unsigned short len,
28 unsigned short proto,
29 __wsum sum);
30
31/*
32 * computes the checksum of a memory block at buff, length len, 23 * computes the checksum of a memory block at buff, length len,
33 * and adds in "sum" (32-bit) 24 * and adds in "sum" (32-bit)
34 * 25 *
@@ -127,6 +118,34 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
127#endif 118#endif
128} 119}
129 120
121/*
122 * computes the checksum of the TCP/UDP pseudo-header
123 * returns a 16-bit checksum, already complemented
124 */
125static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
126 unsigned short len,
127 unsigned short proto,
128 __wsum sum)
129{
130 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
131}
132
133#define HAVE_ARCH_CSUM_ADD
134static inline __wsum csum_add(__wsum csum, __wsum addend)
135{
136#ifdef __powerpc64__
137 u64 res = (__force u64)csum;
138
139 res += (__force u64)addend;
140 return (__force __wsum)((u32)res + (res >> 32));
141#else
142 asm("addc %0,%0,%1;"
143 "addze %0,%0;"
144 : "+r" (csum) : "r" (addend));
145 return csum;
146#endif
147}
148
130#endif 149#endif
131#endif /* __KERNEL__ */ 150#endif /* __KERNEL__ */
132#endif 151#endif
diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h
index b142b8e0ed9e..4f2df589ec1d 100644
--- a/arch/powerpc/include/asm/compat.h
+++ b/arch/powerpc/include/asm/compat.h
@@ -174,6 +174,13 @@ typedef struct compat_siginfo {
174 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 174 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
175 int _fd; 175 int _fd;
176 } _sigpoll; 176 } _sigpoll;
177
178 /* SIGSYS */
179 struct {
180 unsigned int _call_addr; /* calling insn */
181 int _syscall; /* triggering system call number */
182 unsigned int _arch; /* AUDIT_ARCH_* of syscall */
183 } _sigsys;
177 } _sifields; 184 } _sifields;
178} compat_siginfo_t; 185} compat_siginfo_t;
179 186
diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/include/asm/device.h
index e9bdda88f1fb..406c2b1ff82d 100644
--- a/arch/powerpc/include/asm/device.h
+++ b/arch/powerpc/include/asm/device.h
@@ -10,6 +10,7 @@ struct dma_map_ops;
10struct device_node; 10struct device_node;
11#ifdef CONFIG_PPC64 11#ifdef CONFIG_PPC64
12struct pci_dn; 12struct pci_dn;
13struct iommu_table;
13#endif 14#endif
14 15
15/* 16/*
@@ -23,13 +24,15 @@ struct dev_archdata {
23 struct dma_map_ops *dma_ops; 24 struct dma_map_ops *dma_ops;
24 25
25 /* 26 /*
26 * When an iommu is in use, dma_data is used as a ptr to the base of the 27 * These two used to be a union. However, with the hybrid ops we need
27 * iommu_table. Otherwise, it is a simple numerical offset. 28 * both so here we store both a DMA offset for direct mappings and
29 * an iommu_table for remapped DMA.
28 */ 30 */
29 union { 31 dma_addr_t dma_offset;
30 dma_addr_t dma_offset; 32
31 void *iommu_table_base; 33#ifdef CONFIG_PPC64
32 } dma_data; 34 struct iommu_table *iommu_table_base;
35#endif
33 36
34#ifdef CONFIG_IOMMU_API 37#ifdef CONFIG_IOMMU_API
35 void *iommu_domain; 38 void *iommu_domain;
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 9103687b0436..710f60e380e0 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -21,12 +21,12 @@
21#define DMA_ERROR_CODE (~(dma_addr_t)0x0) 21#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
22 22
23/* Some dma direct funcs must be visible for use in other dma_ops */ 23/* Some dma direct funcs must be visible for use in other dma_ops */
24extern void *dma_direct_alloc_coherent(struct device *dev, size_t size, 24extern void *__dma_direct_alloc_coherent(struct device *dev, size_t size,
25 dma_addr_t *dma_handle, gfp_t flag, 25 dma_addr_t *dma_handle, gfp_t flag,
26 struct dma_attrs *attrs);
27extern void __dma_direct_free_coherent(struct device *dev, size_t size,
28 void *vaddr, dma_addr_t dma_handle,
26 struct dma_attrs *attrs); 29 struct dma_attrs *attrs);
27extern void dma_direct_free_coherent(struct device *dev, size_t size,
28 void *vaddr, dma_addr_t dma_handle,
29 struct dma_attrs *attrs);
30extern int dma_direct_mmap_coherent(struct device *dev, 30extern int dma_direct_mmap_coherent(struct device *dev,
31 struct vm_area_struct *vma, 31 struct vm_area_struct *vma,
32 void *cpu_addr, dma_addr_t handle, 32 void *cpu_addr, dma_addr_t handle,
@@ -106,7 +106,7 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
106static inline dma_addr_t get_dma_offset(struct device *dev) 106static inline dma_addr_t get_dma_offset(struct device *dev)
107{ 107{
108 if (dev) 108 if (dev)
109 return dev->archdata.dma_data.dma_offset; 109 return dev->archdata.dma_offset;
110 110
111 return PCI_DRAM_OFFSET; 111 return PCI_DRAM_OFFSET;
112} 112}
@@ -114,7 +114,7 @@ static inline dma_addr_t get_dma_offset(struct device *dev)
114static inline void set_dma_offset(struct device *dev, dma_addr_t off) 114static inline void set_dma_offset(struct device *dev, dma_addr_t off)
115{ 115{
116 if (dev) 116 if (dev)
117 dev->archdata.dma_data.dma_offset = off; 117 dev->archdata.dma_offset = off;
118} 118}
119 119
120/* this will be removed soon */ 120/* this will be removed soon */
diff --git a/arch/powerpc/include/asm/iommu.h b/arch/powerpc/include/asm/iommu.h
index ca18cff90900..7b87bab09564 100644
--- a/arch/powerpc/include/asm/iommu.h
+++ b/arch/powerpc/include/asm/iommu.h
@@ -2,17 +2,17 @@
2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation 2 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation
3 * Rewrite, cleanup: 3 * Rewrite, cleanup:
4 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation 4 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or 8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version. 9 * (at your option) any later version.
10 * 10 *
11 * This program is distributed in the hope that it will be useful, 11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU General Public License 16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -131,16 +131,21 @@ int get_iommu_order(unsigned long size, struct iommu_table *tbl)
131 131
132struct scatterlist; 132struct scatterlist;
133 133
134static inline void set_iommu_table_base(struct device *dev, void *base) 134#ifdef CONFIG_PPC64
135
136static inline void set_iommu_table_base(struct device *dev,
137 struct iommu_table *base)
135{ 138{
136 dev->archdata.dma_data.iommu_table_base = base; 139 dev->archdata.iommu_table_base = base;
137} 140}
138 141
139static inline void *get_iommu_table_base(struct device *dev) 142static inline void *get_iommu_table_base(struct device *dev)
140{ 143{
141 return dev->archdata.dma_data.iommu_table_base; 144 return dev->archdata.iommu_table_base;
142} 145}
143 146
147extern int dma_iommu_dma_supported(struct device *dev, u64 mask);
148
144/* Frees table for an individual device node */ 149/* Frees table for an individual device node */
145extern void iommu_free_table(struct iommu_table *tbl, const char *node_name); 150extern void iommu_free_table(struct iommu_table *tbl, const char *node_name);
146 151
@@ -225,6 +230,20 @@ static inline int __init tce_iommu_bus_notifier_init(void)
225} 230}
226#endif /* !CONFIG_IOMMU_API */ 231#endif /* !CONFIG_IOMMU_API */
227 232
233#else
234
235static inline void *get_iommu_table_base(struct device *dev)
236{
237 return NULL;
238}
239
240static inline int dma_iommu_dma_supported(struct device *dev, u64 mask)
241{
242 return 0;
243}
244
245#endif /* CONFIG_PPC64 */
246
228extern int ppc_iommu_map_sg(struct device *dev, struct iommu_table *tbl, 247extern int ppc_iommu_map_sg(struct device *dev, struct iommu_table *tbl,
229 struct scatterlist *sglist, int nelems, 248 struct scatterlist *sglist, int nelems,
230 unsigned long mask, 249 unsigned long mask,
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 952579f5e79a..cab6753f1be5 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -249,7 +249,7 @@ struct machdep_calls {
249#endif 249#endif
250 250
251#ifdef CONFIG_ARCH_RANDOM 251#ifdef CONFIG_ARCH_RANDOM
252 int (*get_random_long)(unsigned long *v); 252 int (*get_random_seed)(unsigned long *v);
253#endif 253#endif
254}; 254};
255 255
diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h
index 64dc9f547fb6..8374afed9d0a 100644
--- a/arch/powerpc/include/asm/opal-api.h
+++ b/arch/powerpc/include/asm/opal-api.h
@@ -154,7 +154,10 @@
154#define OPAL_FLASH_WRITE 111 154#define OPAL_FLASH_WRITE 111
155#define OPAL_FLASH_ERASE 112 155#define OPAL_FLASH_ERASE 112
156#define OPAL_PRD_MSG 113 156#define OPAL_PRD_MSG 113
157#define OPAL_LAST 113 157#define OPAL_LEDS_GET_INDICATOR 114
158#define OPAL_LEDS_SET_INDICATOR 115
159#define OPAL_CEC_REBOOT2 116
160#define OPAL_LAST 116
158 161
159/* Device tree flags */ 162/* Device tree flags */
160 163
@@ -340,6 +343,18 @@ enum OpalPciResetState {
340 OPAL_ASSERT_RESET = 1 343 OPAL_ASSERT_RESET = 1
341}; 344};
342 345
346enum OpalSlotLedType {
347 OPAL_SLOT_LED_TYPE_ID = 0, /* IDENTIFY LED */
348 OPAL_SLOT_LED_TYPE_FAULT = 1, /* FAULT LED */
349 OPAL_SLOT_LED_TYPE_ATTN = 2, /* System Attention LED */
350 OPAL_SLOT_LED_TYPE_MAX = 3
351};
352
353enum OpalSlotLedState {
354 OPAL_SLOT_LED_STATE_OFF = 0, /* LED is OFF */
355 OPAL_SLOT_LED_STATE_ON = 1 /* LED is ON */
356};
357
343/* 358/*
344 * Address cycle types for LPC accesses. These also correspond 359 * Address cycle types for LPC accesses. These also correspond
345 * to the content of the first cell of the "reg" property for 360 * to the content of the first cell of the "reg" property for
@@ -438,6 +453,7 @@ struct OpalMemoryErrorData {
438/* HMI interrupt event */ 453/* HMI interrupt event */
439enum OpalHMI_Version { 454enum OpalHMI_Version {
440 OpalHMIEvt_V1 = 1, 455 OpalHMIEvt_V1 = 1,
456 OpalHMIEvt_V2 = 2,
441}; 457};
442 458
443enum OpalHMI_Severity { 459enum OpalHMI_Severity {
@@ -468,6 +484,49 @@ enum OpalHMI_ErrType {
468 OpalHMI_ERROR_CAPP_RECOVERY, 484 OpalHMI_ERROR_CAPP_RECOVERY,
469}; 485};
470 486
487enum OpalHMI_XstopType {
488 CHECKSTOP_TYPE_UNKNOWN = 0,
489 CHECKSTOP_TYPE_CORE = 1,
490 CHECKSTOP_TYPE_NX = 2,
491};
492
493enum OpalHMI_CoreXstopReason {
494 CORE_CHECKSTOP_IFU_REGFILE = 0x00000001,
495 CORE_CHECKSTOP_IFU_LOGIC = 0x00000002,
496 CORE_CHECKSTOP_PC_DURING_RECOV = 0x00000004,
497 CORE_CHECKSTOP_ISU_REGFILE = 0x00000008,
498 CORE_CHECKSTOP_ISU_LOGIC = 0x00000010,
499 CORE_CHECKSTOP_FXU_LOGIC = 0x00000020,
500 CORE_CHECKSTOP_VSU_LOGIC = 0x00000040,
501 CORE_CHECKSTOP_PC_RECOV_IN_MAINT_MODE = 0x00000080,
502 CORE_CHECKSTOP_LSU_REGFILE = 0x00000100,
503 CORE_CHECKSTOP_PC_FWD_PROGRESS = 0x00000200,
504 CORE_CHECKSTOP_LSU_LOGIC = 0x00000400,
505 CORE_CHECKSTOP_PC_LOGIC = 0x00000800,
506 CORE_CHECKSTOP_PC_HYP_RESOURCE = 0x00001000,
507 CORE_CHECKSTOP_PC_HANG_RECOV_FAILED = 0x00002000,
508 CORE_CHECKSTOP_PC_AMBI_HANG_DETECTED = 0x00004000,
509 CORE_CHECKSTOP_PC_DEBUG_TRIG_ERR_INJ = 0x00008000,
510 CORE_CHECKSTOP_PC_SPRD_HYP_ERR_INJ = 0x00010000,
511};
512
513enum OpalHMI_NestAccelXstopReason {
514 NX_CHECKSTOP_SHM_INVAL_STATE_ERR = 0x00000001,
515 NX_CHECKSTOP_DMA_INVAL_STATE_ERR_1 = 0x00000002,
516 NX_CHECKSTOP_DMA_INVAL_STATE_ERR_2 = 0x00000004,
517 NX_CHECKSTOP_DMA_CH0_INVAL_STATE_ERR = 0x00000008,
518 NX_CHECKSTOP_DMA_CH1_INVAL_STATE_ERR = 0x00000010,
519 NX_CHECKSTOP_DMA_CH2_INVAL_STATE_ERR = 0x00000020,
520 NX_CHECKSTOP_DMA_CH3_INVAL_STATE_ERR = 0x00000040,
521 NX_CHECKSTOP_DMA_CH4_INVAL_STATE_ERR = 0x00000080,
522 NX_CHECKSTOP_DMA_CH5_INVAL_STATE_ERR = 0x00000100,
523 NX_CHECKSTOP_DMA_CH6_INVAL_STATE_ERR = 0x00000200,
524 NX_CHECKSTOP_DMA_CH7_INVAL_STATE_ERR = 0x00000400,
525 NX_CHECKSTOP_DMA_CRB_UE = 0x00000800,
526 NX_CHECKSTOP_DMA_CRB_SUE = 0x00001000,
527 NX_CHECKSTOP_PBI_ISN_UE = 0x00002000,
528};
529
471struct OpalHMIEvent { 530struct OpalHMIEvent {
472 uint8_t version; /* 0x00 */ 531 uint8_t version; /* 0x00 */
473 uint8_t severity; /* 0x01 */ 532 uint8_t severity; /* 0x01 */
@@ -478,6 +537,23 @@ struct OpalHMIEvent {
478 __be64 hmer; 537 __be64 hmer;
479 /* TFMR register. Valid only for TFAC and TFMR_PARITY error type. */ 538 /* TFMR register. Valid only for TFAC and TFMR_PARITY error type. */
480 __be64 tfmr; 539 __be64 tfmr;
540
541 /* version 2 and later */
542 union {
543 /*
544 * checkstop info (Core/NX).
545 * Valid for OpalHMI_ERROR_MALFUNC_ALERT.
546 */
547 struct {
548 uint8_t xstop_type; /* enum OpalHMI_XstopType */
549 uint8_t reserved_1[3];
550 __be32 xstop_reason;
551 union {
552 __be32 pir; /* for CHECKSTOP_TYPE_CORE */
553 __be32 chip_id; /* for CHECKSTOP_TYPE_NX */
554 } u;
555 } xstop_error;
556 } u;
481}; 557};
482 558
483enum { 559enum {
@@ -768,6 +844,52 @@ struct opal_i2c_request {
768 __be64 buffer_ra; /* Buffer real address */ 844 __be64 buffer_ra; /* Buffer real address */
769}; 845};
770 846
847/*
848 * EPOW status sharing (OPAL and the host)
849 *
850 * The host will pass on OPAL, a buffer of length OPAL_SYSEPOW_MAX
851 * with individual elements being 16 bits wide to fetch the system
852 * wide EPOW status. Each element in the buffer will contain the
853 * EPOW status in it's bit representation for a particular EPOW sub
854 * class as defiend here. So multiple detailed EPOW status bits
855 * specific for any sub class can be represented in a single buffer
856 * element as it's bit representation.
857 */
858
859/* System EPOW type */
860enum OpalSysEpow {
861 OPAL_SYSEPOW_POWER = 0, /* Power EPOW */
862 OPAL_SYSEPOW_TEMP = 1, /* Temperature EPOW */
863 OPAL_SYSEPOW_COOLING = 2, /* Cooling EPOW */
864 OPAL_SYSEPOW_MAX = 3, /* Max EPOW categories */
865};
866
867/* Power EPOW */
868enum OpalSysPower {
869 OPAL_SYSPOWER_UPS = 0x0001, /* System on UPS power */
870 OPAL_SYSPOWER_CHNG = 0x0002, /* System power config change */
871 OPAL_SYSPOWER_FAIL = 0x0004, /* System impending power failure */
872 OPAL_SYSPOWER_INCL = 0x0008, /* System incomplete power */
873};
874
875/* Temperature EPOW */
876enum OpalSysTemp {
877 OPAL_SYSTEMP_AMB = 0x0001, /* System over ambient temperature */
878 OPAL_SYSTEMP_INT = 0x0002, /* System over internal temperature */
879 OPAL_SYSTEMP_HMD = 0x0004, /* System over ambient humidity */
880};
881
882/* Cooling EPOW */
883enum OpalSysCooling {
884 OPAL_SYSCOOL_INSF = 0x0001, /* System insufficient cooling */
885};
886
887/* Argument to OPAL_CEC_REBOOT2() */
888enum {
889 OPAL_REBOOT_NORMAL = 0,
890 OPAL_REBOOT_PLATFORM_ERROR = 1,
891};
892
771#endif /* __ASSEMBLY__ */ 893#endif /* __ASSEMBLY__ */
772 894
773#endif /* __OPAL_API_H */ 895#endif /* __OPAL_API_H */
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 958e941c0cda..800115910e43 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -44,6 +44,7 @@ int64_t opal_tpo_write(uint64_t token, uint32_t year_mon_day,
44 uint32_t hour_min); 44 uint32_t hour_min);
45int64_t opal_cec_power_down(uint64_t request); 45int64_t opal_cec_power_down(uint64_t request);
46int64_t opal_cec_reboot(void); 46int64_t opal_cec_reboot(void);
47int64_t opal_cec_reboot2(uint32_t reboot_type, char *diag);
47int64_t opal_read_nvram(uint64_t buffer, uint64_t size, uint64_t offset); 48int64_t opal_read_nvram(uint64_t buffer, uint64_t size, uint64_t offset);
48int64_t opal_write_nvram(uint64_t buffer, uint64_t size, uint64_t offset); 49int64_t opal_write_nvram(uint64_t buffer, uint64_t size, uint64_t offset);
49int64_t opal_handle_interrupt(uint64_t isn, __be64 *outstanding_event_mask); 50int64_t opal_handle_interrupt(uint64_t isn, __be64 *outstanding_event_mask);
@@ -141,7 +142,8 @@ int64_t opal_pci_fence_phb(uint64_t phb_id);
141int64_t opal_pci_reinit(uint64_t phb_id, uint64_t reinit_scope, uint64_t data); 142int64_t opal_pci_reinit(uint64_t phb_id, uint64_t reinit_scope, uint64_t data);
142int64_t opal_pci_mask_pe_error(uint64_t phb_id, uint16_t pe_number, uint8_t error_type, uint8_t mask_action); 143int64_t opal_pci_mask_pe_error(uint64_t phb_id, uint16_t pe_number, uint8_t error_type, uint8_t mask_action);
143int64_t opal_set_slot_led_status(uint64_t phb_id, uint64_t slot_id, uint8_t led_type, uint8_t led_action); 144int64_t opal_set_slot_led_status(uint64_t phb_id, uint64_t slot_id, uint8_t led_type, uint8_t led_action);
144int64_t opal_get_epow_status(__be64 *status); 145int64_t opal_get_epow_status(__be16 *epow_status, __be16 *num_epow_classes);
146int64_t opal_get_dpo_status(__be64 *dpo_timeout);
145int64_t opal_set_system_attention_led(uint8_t led_action); 147int64_t opal_set_system_attention_led(uint8_t led_action);
146int64_t opal_pci_next_error(uint64_t phb_id, __be64 *first_frozen_pe, 148int64_t opal_pci_next_error(uint64_t phb_id, __be64 *first_frozen_pe,
147 __be16 *pci_error_type, __be16 *severity); 149 __be16 *pci_error_type, __be16 *severity);
@@ -195,6 +197,10 @@ int64_t opal_ipmi_recv(uint64_t interface, struct opal_ipmi_msg *msg,
195int64_t opal_i2c_request(uint64_t async_token, uint32_t bus_id, 197int64_t opal_i2c_request(uint64_t async_token, uint32_t bus_id,
196 struct opal_i2c_request *oreq); 198 struct opal_i2c_request *oreq);
197int64_t opal_prd_msg(struct opal_prd_msg *msg); 199int64_t opal_prd_msg(struct opal_prd_msg *msg);
200int64_t opal_leds_get_ind(char *loc_code, __be64 *led_mask,
201 __be64 *led_value, __be64 *max_led_type);
202int64_t opal_leds_set_ind(uint64_t token, char *loc_code, const u64 led_mask,
203 const u64 led_value, __be64 *max_led_type);
198 204
199int64_t opal_flash_read(uint64_t id, uint64_t offset, uint64_t buf, 205int64_t opal_flash_read(uint64_t id, uint64_t offset, uint64_t buf,
200 uint64_t size, uint64_t token); 206 uint64_t size, uint64_t token);
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 712add590445..37fc53587bb4 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -42,6 +42,7 @@ struct pci_controller_ops {
42#endif 42#endif
43 43
44 int (*dma_set_mask)(struct pci_dev *dev, u64 dma_mask); 44 int (*dma_set_mask)(struct pci_dev *dev, u64 dma_mask);
45 u64 (*dma_get_required_mask)(struct pci_dev *dev);
45 46
46 void (*shutdown)(struct pci_controller *); 47 void (*shutdown)(struct pci_controller *);
47}; 48};
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index 3bb7488bd24b..fa1dfb7f7b48 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -134,11 +134,11 @@
134 134
135#define pte_iterate_hashed_end() } while(0) 135#define pte_iterate_hashed_end() } while(0)
136 136
137#ifdef CONFIG_PPC_HAS_HASH_64K 137/*
138#define pte_pagesize_index(mm, addr, pte) get_slice_psize(mm, addr) 138 * We expect this to be called only for user addresses or kernel virtual
139#else 139 * addresses other than the linear mapping.
140 */
140#define pte_pagesize_index(mm, addr, pte) MMU_PAGE_4K 141#define pte_pagesize_index(mm, addr, pte) MMU_PAGE_4K
141#endif
142 142
143#endif /* __real_pte */ 143#endif /* __real_pte */
144 144
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index 11a38635dd65..0717693c8428 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -169,6 +169,17 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr,
169 * cases, and 32-bit non-hash with 32-bit PTEs. 169 * cases, and 32-bit non-hash with 32-bit PTEs.
170 */ 170 */
171 *ptep = pte; 171 *ptep = pte;
172
173#ifdef CONFIG_PPC_BOOK3E_64
174 /*
175 * With hardware tablewalk, a sync is needed to ensure that
176 * subsequent accesses see the PTE we just wrote. Unlike userspace
177 * mappings, we can't tolerate spurious faults, so make sure
178 * the new PTE will be seen the first time.
179 */
180 if (is_kernel_addr(addr))
181 mb();
182#endif
172#endif 183#endif
173} 184}
174 185
diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h
index 4122a86d6858..ca0c5bff7849 100644
--- a/arch/powerpc/include/asm/ppc-pci.h
+++ b/arch/powerpc/include/asm/ppc-pci.h
@@ -61,6 +61,7 @@ int rtas_write_config(struct pci_dn *, int where, int size, u32 val);
61int rtas_read_config(struct pci_dn *, int where, int size, u32 *val); 61int rtas_read_config(struct pci_dn *, int where, int size, u32 *val);
62void eeh_pe_state_mark(struct eeh_pe *pe, int state); 62void eeh_pe_state_mark(struct eeh_pe *pe, int state);
63void eeh_pe_state_clear(struct eeh_pe *pe, int state); 63void eeh_pe_state_clear(struct eeh_pe *pe, int state);
64void eeh_pe_state_mark_with_cfg(struct eeh_pe *pe, int state);
64void eeh_pe_dev_mode_mark(struct eeh_pe *pe, int mode); 65void eeh_pe_dev_mode_mark(struct eeh_pe *pe, int mode);
65 66
66void eeh_sysfs_add_device(struct pci_dev *pdev); 67void eeh_sysfs_add_device(struct pci_dev *pdev);
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index 28ded5d9b579..5afea361beaa 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -264,7 +264,6 @@ struct thread_struct {
264 u64 tm_tfhar; /* Transaction fail handler addr */ 264 u64 tm_tfhar; /* Transaction fail handler addr */
265 u64 tm_texasr; /* Transaction exception & summary */ 265 u64 tm_texasr; /* Transaction exception & summary */
266 u64 tm_tfiar; /* Transaction fail instr address reg */ 266 u64 tm_tfiar; /* Transaction fail instr address reg */
267 unsigned long tm_orig_msr; /* Thread's MSR on ctx switch */
268 struct pt_regs ckpt_regs; /* Checkpointed registers */ 267 struct pt_regs ckpt_regs; /* Checkpointed registers */
269 268
270 unsigned long tm_tar; 269 unsigned long tm_tar;
diff --git a/arch/powerpc/include/asm/pte-common.h b/arch/powerpc/include/asm/pte-common.h
index b7c8d079c121..71537a319fc8 100644
--- a/arch/powerpc/include/asm/pte-common.h
+++ b/arch/powerpc/include/asm/pte-common.h
@@ -109,7 +109,8 @@ extern unsigned long bad_call_to_PMD_PAGE_SIZE(void);
109 * the processor might need it for DMA coherency. 109 * the processor might need it for DMA coherency.
110 */ 110 */
111#define _PAGE_BASE_NC (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_PSIZE) 111#define _PAGE_BASE_NC (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_PSIZE)
112#if defined(CONFIG_SMP) || defined(CONFIG_PPC_STD_MMU) 112#if defined(CONFIG_SMP) || defined(CONFIG_PPC_STD_MMU) || \
113 defined(CONFIG_PPC_E500MC)
113#define _PAGE_BASE (_PAGE_BASE_NC | _PAGE_COHERENT) 114#define _PAGE_BASE (_PAGE_BASE_NC | _PAGE_COHERENT)
114#else 115#else
115#define _PAGE_BASE (_PAGE_BASE_NC) 116#define _PAGE_BASE (_PAGE_BASE_NC)
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index af56b5c6c81a..aa1cc5f015ee 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -1193,8 +1193,7 @@
1193#ifdef CONFIG_PPC_BOOK3S_64 1193#ifdef CONFIG_PPC_BOOK3S_64
1194#define __mtmsrd(v, l) asm volatile("mtmsrd %0," __stringify(l) \ 1194#define __mtmsrd(v, l) asm volatile("mtmsrd %0," __stringify(l) \
1195 : : "r" (v) : "memory") 1195 : : "r" (v) : "memory")
1196#define mtmsrd(v) __mtmsrd((v), 0) 1196#define mtmsr(v) __mtmsrd((v), 0)
1197#define mtmsr(v) mtmsrd(v)
1198#else 1197#else
1199#define mtmsr(v) asm volatile("mtmsr %0" : \ 1198#define mtmsr(v) asm volatile("mtmsr %0" : \
1200 : "r" ((unsigned long)(v)) \ 1199 : "r" ((unsigned long)(v)) \
@@ -1281,6 +1280,15 @@ struct pt_regs;
1281 1280
1282extern void ppc_save_regs(struct pt_regs *regs); 1281extern void ppc_save_regs(struct pt_regs *regs);
1283 1282
1283static inline void update_power8_hid0(unsigned long hid0)
1284{
1285 /*
1286 * The HID0 update on Power8 should at the very least be
1287 * preceded by a a SYNC instruction followed by an ISYNC
1288 * instruction
1289 */
1290 asm volatile("sync; mtspr %0,%1; isync":: "i"(SPRN_HID0), "r"(hid0));
1291}
1284#endif /* __ASSEMBLY__ */ 1292#endif /* __ASSEMBLY__ */
1285#endif /* __KERNEL__ */ 1293#endif /* __KERNEL__ */
1286#endif /* _ASM_POWERPC_REG_H */ 1294#endif /* _ASM_POWERPC_REG_H */
diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
index 7a4ede16b283..b77ef369c0f0 100644
--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -343,6 +343,7 @@ extern void rtas_power_off(void);
343extern void rtas_halt(void); 343extern void rtas_halt(void);
344extern void rtas_os_term(char *str); 344extern void rtas_os_term(char *str);
345extern int rtas_get_sensor(int sensor, int index, int *state); 345extern int rtas_get_sensor(int sensor, int index, int *state);
346extern int rtas_get_sensor_fast(int sensor, int index, int *state);
346extern int rtas_get_power_level(int powerdomain, int *level); 347extern int rtas_get_power_level(int powerdomain, int *level);
347extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); 348extern int rtas_set_power_level(int powerdomain, int level, int *setlevel);
348extern bool rtas_indicator_present(int token, int *maxindex); 349extern bool rtas_indicator_present(int token, int *maxindex);
diff --git a/arch/powerpc/include/asm/spu_csa.h b/arch/powerpc/include/asm/spu_csa.h
index a40fd491250c..51f80b41cda3 100644
--- a/arch/powerpc/include/asm/spu_csa.h
+++ b/arch/powerpc/include/asm/spu_csa.h
@@ -241,12 +241,6 @@ struct spu_priv2_collapsed {
241 */ 241 */
242struct spu_state { 242struct spu_state {
243 struct spu_lscsa *lscsa; 243 struct spu_lscsa *lscsa;
244#ifdef CONFIG_SPU_FS_64K_LS
245 int use_big_pages;
246 /* One struct page per 64k page */
247#define SPU_LSCSA_NUM_BIG_PAGES (sizeof(struct spu_lscsa) / 0x10000)
248 struct page *lscsa_pages[SPU_LSCSA_NUM_BIG_PAGES];
249#endif
250 struct spu_problem_collapsed prob; 244 struct spu_problem_collapsed prob;
251 struct spu_priv1_collapsed priv1; 245 struct spu_priv1_collapsed priv1;
252 struct spu_priv2_collapsed priv2; 246 struct spu_priv2_collapsed priv2;
diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h
index ff21b7a2f0cc..ab9f3f0a8637 100644
--- a/arch/powerpc/include/asm/syscall.h
+++ b/arch/powerpc/include/asm/syscall.h
@@ -22,10 +22,15 @@
22extern const unsigned long sys_call_table[]; 22extern const unsigned long sys_call_table[];
23#endif /* CONFIG_FTRACE_SYSCALLS */ 23#endif /* CONFIG_FTRACE_SYSCALLS */
24 24
25static inline long syscall_get_nr(struct task_struct *task, 25static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
26 struct pt_regs *regs)
27{ 26{
28 return TRAP(regs) == 0xc00 ? regs->gpr[0] : -1L; 27 /*
28 * Note that we are returning an int here. That means 0xffffffff, ie.
29 * 32-bit negative 1, will be interpreted as -1 on a 64-bit kernel.
30 * This is important for seccomp so that compat tasks can set r0 = -1
31 * to reject the syscall.
32 */
33 return TRAP(regs) == 0xc00 ? regs->gpr[0] : -1;
29} 34}
30 35
31static inline void syscall_rollback(struct task_struct *task, 36static inline void syscall_rollback(struct task_struct *task,
@@ -34,12 +39,6 @@ static inline void syscall_rollback(struct task_struct *task,
34 regs->gpr[3] = regs->orig_gpr3; 39 regs->gpr[3] = regs->orig_gpr3;
35} 40}
36 41
37static inline long syscall_get_error(struct task_struct *task,
38 struct pt_regs *regs)
39{
40 return (regs->ccr & 0x10000000) ? -regs->gpr[3] : 0;
41}
42
43static inline long syscall_get_return_value(struct task_struct *task, 42static inline long syscall_get_return_value(struct task_struct *task,
44 struct pt_regs *regs) 43 struct pt_regs *regs)
45{ 44{
@@ -50,9 +49,15 @@ static inline void syscall_set_return_value(struct task_struct *task,
50 struct pt_regs *regs, 49 struct pt_regs *regs,
51 int error, long val) 50 int error, long val)
52{ 51{
52 /*
53 * In the general case it's not obvious that we must deal with CCR
54 * here, as the syscall exit path will also do that for us. However
55 * there are some places, eg. the signal code, which check ccr to
56 * decide if the value in r3 is actually an error.
57 */
53 if (error) { 58 if (error) {
54 regs->ccr |= 0x10000000L; 59 regs->ccr |= 0x10000000L;
55 regs->gpr[3] = -error; 60 regs->gpr[3] = error;
56 } else { 61 } else {
57 regs->ccr &= ~0x10000000L; 62 regs->ccr &= ~0x10000000L;
58 regs->gpr[3] = val; 63 regs->gpr[3] = val;
@@ -64,19 +69,22 @@ static inline void syscall_get_arguments(struct task_struct *task,
64 unsigned int i, unsigned int n, 69 unsigned int i, unsigned int n,
65 unsigned long *args) 70 unsigned long *args)
66{ 71{
72 unsigned long val, mask = -1UL;
73
67 BUG_ON(i + n > 6); 74 BUG_ON(i + n > 6);
68#ifdef CONFIG_PPC64 75
69 if (test_tsk_thread_flag(task, TIF_32BIT)) { 76#ifdef CONFIG_COMPAT
70 /* 77 if (test_tsk_thread_flag(task, TIF_32BIT))
71 * Zero-extend 32-bit argument values. The high bits are 78 mask = 0xffffffff;
72 * garbage ignored by the actual syscall dispatch.
73 */
74 while (n-- > 0)
75 args[n] = (u32) regs->gpr[3 + i + n];
76 return;
77 }
78#endif 79#endif
79 memcpy(args, &regs->gpr[3 + i], n * sizeof(args[0])); 80 while (n--) {
81 if (n == 0 && i == 0)
82 val = regs->orig_gpr3;
83 else
84 val = regs->gpr[3 + i + n];
85
86 args[n] = val & mask;
87 }
80} 88}
81 89
82static inline void syscall_set_arguments(struct task_struct *task, 90static inline void syscall_set_arguments(struct task_struct *task,
@@ -86,6 +94,10 @@ static inline void syscall_set_arguments(struct task_struct *task,
86{ 94{
87 BUG_ON(i + n > 6); 95 BUG_ON(i + n > 6);
88 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0])); 96 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0]));
97
98 /* Also copy the first argument into orig_gpr3 */
99 if (i == 0 && n > 0)
100 regs->orig_gpr3 = args[0];
89} 101}
90 102
91static inline int syscall_get_arch(void) 103static inline int syscall_get_arch(void)
diff --git a/arch/powerpc/include/asm/trace_clock.h b/arch/powerpc/include/asm/trace_clock.h
new file mode 100644
index 000000000000..cf1ee75ca069
--- /dev/null
+++ b/arch/powerpc/include/asm/trace_clock.h
@@ -0,0 +1,19 @@
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, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * Copyright (C) 2015 Naveen N. Rao, IBM Corporation
7 */
8
9#ifndef _ASM_PPC_TRACE_CLOCK_H
10#define _ASM_PPC_TRACE_CLOCK_H
11
12#include <linux/compiler.h>
13#include <linux/types.h>
14
15extern u64 notrace trace_clock_ppc_tb(void);
16
17#define ARCH_TRACE_CLOCKS { trace_clock_ppc_tb, "ppc-tb", 0 },
18
19#endif /* _ASM_PPC_TRACE_CLOCK_H */
diff --git a/arch/powerpc/include/uapi/asm/Kbuild b/arch/powerpc/include/uapi/asm/Kbuild
index f44a027818af..dab3717e3ea0 100644
--- a/arch/powerpc/include/uapi/asm/Kbuild
+++ b/arch/powerpc/include/uapi/asm/Kbuild
@@ -6,6 +6,7 @@ header-y += bitsperlong.h
6header-y += bootx.h 6header-y += bootx.h
7header-y += byteorder.h 7header-y += byteorder.h
8header-y += cputable.h 8header-y += cputable.h
9header-y += eeh.h
9header-y += elf.h 10header-y += elf.h
10header-y += epapr_hcalls.h 11header-y += epapr_hcalls.h
11header-y += errno.h 12header-y += errno.h
diff --git a/arch/powerpc/include/uapi/asm/errno.h b/arch/powerpc/include/uapi/asm/errno.h
index 8c145fd17d86..e8b6b5f7de7c 100644
--- a/arch/powerpc/include/uapi/asm/errno.h
+++ b/arch/powerpc/include/uapi/asm/errno.h
@@ -6,6 +6,4 @@
6#undef EDEADLOCK 6#undef EDEADLOCK
7#define EDEADLOCK 58 /* File locking deadlock error */ 7#define EDEADLOCK 58 /* File locking deadlock error */
8 8
9#define _LAST_ERRNO 516
10
11#endif /* _ASM_POWERPC_ERRNO_H */ 9#endif /* _ASM_POWERPC_ERRNO_H */
diff --git a/arch/powerpc/include/uapi/asm/sigcontext.h b/arch/powerpc/include/uapi/asm/sigcontext.h
index 9c1f24fd5d11..3ad0c7f001a9 100644
--- a/arch/powerpc/include/uapi/asm/sigcontext.h
+++ b/arch/powerpc/include/uapi/asm/sigcontext.h
@@ -28,7 +28,7 @@ struct sigcontext {
28/* 28/*
29 * To maintain compatibility with current implementations the sigcontext is 29 * To maintain compatibility with current implementations the sigcontext is
30 * extended by appending a pointer (v_regs) to a quadword type (elf_vrreg_t) 30 * extended by appending a pointer (v_regs) to a quadword type (elf_vrreg_t)
31 * followed by an unstructured (vmx_reserve) field of 69 doublewords. This 31 * followed by an unstructured (vmx_reserve) field of 101 doublewords. This
32 * allows the array of vector registers to be quadword aligned independent of 32 * allows the array of vector registers to be quadword aligned independent of
33 * the alignment of the containing sigcontext or ucontext. It is the 33 * the alignment of the containing sigcontext or ucontext. It is the
34 * responsibility of the code setting the sigcontext to set this pointer to 34 * responsibility of the code setting the sigcontext to set this pointer to
@@ -80,7 +80,7 @@ struct sigcontext {
80 * registers and vscr/vrsave. 80 * registers and vscr/vrsave.
81 */ 81 */
82 elf_vrreg_t __user *v_regs; 82 elf_vrreg_t __user *v_regs;
83 long vmx_reserve[ELF_NVRREG+ELF_NVRREG+32+1]; 83 long vmx_reserve[ELF_NVRREG + ELF_NVRREG + 1 + 32];
84#endif 84#endif
85}; 85};
86 86
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 12868b1c4e05..ba336930d448 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -118,6 +118,7 @@ obj-$(CONFIG_PPC_IO_WORKAROUNDS) += io-workarounds.o
118obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o 118obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
119obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o 119obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
120obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o 120obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o
121obj-$(CONFIG_TRACING) += trace_clock.o
121 122
122ifneq ($(CONFIG_PPC_INDIRECT_PIO),y) 123ifneq ($(CONFIG_PPC_INDIRECT_PIO),y)
123obj-y += iomap.o 124obj-y += iomap.o
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 98230579d99c..810f433731dc 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -213,7 +213,6 @@ int main(void)
213 offsetof(struct tlb_core_data, esel_max)); 213 offsetof(struct tlb_core_data, esel_max));
214 DEFINE(TCD_ESEL_FIRST, 214 DEFINE(TCD_ESEL_FIRST,
215 offsetof(struct tlb_core_data, esel_first)); 215 offsetof(struct tlb_core_data, esel_first));
216 DEFINE(TCD_LOCK, offsetof(struct tlb_core_data, lock));
217#endif /* CONFIG_PPC_BOOK3E */ 216#endif /* CONFIG_PPC_BOOK3E */
218 217
219#ifdef CONFIG_PPC_STD_MMU_64 218#ifdef CONFIG_PPC_STD_MMU_64
diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
index 4c68bfe4108a..41a7d9d49a5a 100644
--- a/arch/powerpc/kernel/dma-iommu.c
+++ b/arch/powerpc/kernel/dma-iommu.c
@@ -73,7 +73,7 @@ static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist,
73} 73}
74 74
75/* We support DMA to/from any memory page via the iommu */ 75/* We support DMA to/from any memory page via the iommu */
76static int dma_iommu_dma_supported(struct device *dev, u64 mask) 76int dma_iommu_dma_supported(struct device *dev, u64 mask)
77{ 77{
78 struct iommu_table *tbl = get_iommu_table_base(dev); 78 struct iommu_table *tbl = get_iommu_table_base(dev);
79 79
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index 6e8d764ce47b..c6689f658b50 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -47,8 +47,8 @@ static u64 swiotlb_powerpc_get_required(struct device *dev)
47 * for everything else. 47 * for everything else.
48 */ 48 */
49struct dma_map_ops swiotlb_dma_ops = { 49struct dma_map_ops swiotlb_dma_ops = {
50 .alloc = dma_direct_alloc_coherent, 50 .alloc = __dma_direct_alloc_coherent,
51 .free = dma_direct_free_coherent, 51 .free = __dma_direct_free_coherent,
52 .mmap = dma_direct_mmap_coherent, 52 .mmap = dma_direct_mmap_coherent,
53 .map_sg = swiotlb_map_sg_attrs, 53 .map_sg = swiotlb_map_sg_attrs,
54 .unmap_sg = swiotlb_unmap_sg_attrs, 54 .unmap_sg = swiotlb_unmap_sg_attrs,
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index 35e4dcc5dce3..59503ed98e5f 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -16,6 +16,7 @@
16#include <asm/bug.h> 16#include <asm/bug.h>
17#include <asm/machdep.h> 17#include <asm/machdep.h>
18#include <asm/swiotlb.h> 18#include <asm/swiotlb.h>
19#include <asm/iommu.h>
19 20
20/* 21/*
21 * Generic direct DMA implementation 22 * Generic direct DMA implementation
@@ -39,9 +40,31 @@ static u64 __maybe_unused get_pfn_limit(struct device *dev)
39 return pfn; 40 return pfn;
40} 41}
41 42
42void *dma_direct_alloc_coherent(struct device *dev, size_t size, 43static int dma_direct_dma_supported(struct device *dev, u64 mask)
43 dma_addr_t *dma_handle, gfp_t flag, 44{
44 struct dma_attrs *attrs) 45#ifdef CONFIG_PPC64
46 u64 limit = get_dma_offset(dev) + (memblock_end_of_DRAM() - 1);
47
48 /* Limit fits in the mask, we are good */
49 if (mask >= limit)
50 return 1;
51
52#ifdef CONFIG_FSL_SOC
53 /* Freescale gets another chance via ZONE_DMA/ZONE_DMA32, however
54 * that will have to be refined if/when they support iommus
55 */
56 return 1;
57#endif
58 /* Sorry ... */
59 return 0;
60#else
61 return 1;
62#endif
63}
64
65void *__dma_direct_alloc_coherent(struct device *dev, size_t size,
66 dma_addr_t *dma_handle, gfp_t flag,
67 struct dma_attrs *attrs)
45{ 68{
46 void *ret; 69 void *ret;
47#ifdef CONFIG_NOT_COHERENT_CACHE 70#ifdef CONFIG_NOT_COHERENT_CACHE
@@ -96,9 +119,9 @@ void *dma_direct_alloc_coherent(struct device *dev, size_t size,
96#endif 119#endif
97} 120}
98 121
99void dma_direct_free_coherent(struct device *dev, size_t size, 122void __dma_direct_free_coherent(struct device *dev, size_t size,
100 void *vaddr, dma_addr_t dma_handle, 123 void *vaddr, dma_addr_t dma_handle,
101 struct dma_attrs *attrs) 124 struct dma_attrs *attrs)
102{ 125{
103#ifdef CONFIG_NOT_COHERENT_CACHE 126#ifdef CONFIG_NOT_COHERENT_CACHE
104 __dma_free_coherent(size, vaddr); 127 __dma_free_coherent(size, vaddr);
@@ -107,6 +130,51 @@ void dma_direct_free_coherent(struct device *dev, size_t size,
107#endif 130#endif
108} 131}
109 132
133static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
134 dma_addr_t *dma_handle, gfp_t flag,
135 struct dma_attrs *attrs)
136{
137 struct iommu_table *iommu;
138
139 /* The coherent mask may be smaller than the real mask, check if
140 * we can really use the direct ops
141 */
142 if (dma_direct_dma_supported(dev, dev->coherent_dma_mask))
143 return __dma_direct_alloc_coherent(dev, size, dma_handle,
144 flag, attrs);
145
146 /* Ok we can't ... do we have an iommu ? If not, fail */
147 iommu = get_iommu_table_base(dev);
148 if (!iommu)
149 return NULL;
150
151 /* Try to use the iommu */
152 return iommu_alloc_coherent(dev, iommu, size, dma_handle,
153 dev->coherent_dma_mask, flag,
154 dev_to_node(dev));
155}
156
157static void dma_direct_free_coherent(struct device *dev, size_t size,
158 void *vaddr, dma_addr_t dma_handle,
159 struct dma_attrs *attrs)
160{
161 struct iommu_table *iommu;
162
163 /* See comments in dma_direct_alloc_coherent() */
164 if (dma_direct_dma_supported(dev, dev->coherent_dma_mask))
165 return __dma_direct_free_coherent(dev, size, vaddr, dma_handle,
166 attrs);
167 /* Maybe we used an iommu ... */
168 iommu = get_iommu_table_base(dev);
169
170 /* If we hit that we should have never allocated in the first
171 * place so how come we are freeing ?
172 */
173 if (WARN_ON(!iommu))
174 return;
175 iommu_free_coherent(iommu, size, vaddr, dma_handle);
176}
177
110int dma_direct_mmap_coherent(struct device *dev, struct vm_area_struct *vma, 178int dma_direct_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
111 void *cpu_addr, dma_addr_t handle, size_t size, 179 void *cpu_addr, dma_addr_t handle, size_t size,
112 struct dma_attrs *attrs) 180 struct dma_attrs *attrs)
@@ -147,18 +215,6 @@ static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg,
147{ 215{
148} 216}
149 217
150static int dma_direct_dma_supported(struct device *dev, u64 mask)
151{
152#ifdef CONFIG_PPC64
153 /* Could be improved so platforms can set the limit in case
154 * they have limited DMA windows
155 */
156 return mask >= get_dma_offset(dev) + (memblock_end_of_DRAM() - 1);
157#else
158 return 1;
159#endif
160}
161
162static u64 dma_direct_get_required_mask(struct device *dev) 218static u64 dma_direct_get_required_mask(struct device *dev)
163{ 219{
164 u64 end, mask; 220 u64 end, mask;
@@ -230,6 +286,25 @@ struct dma_map_ops dma_direct_ops = {
230}; 286};
231EXPORT_SYMBOL(dma_direct_ops); 287EXPORT_SYMBOL(dma_direct_ops);
232 288
289int dma_set_coherent_mask(struct device *dev, u64 mask)
290{
291 if (!dma_supported(dev, mask)) {
292 /*
293 * We need to special case the direct DMA ops which can
294 * support a fallback for coherent allocations. There
295 * is no dma_op->set_coherent_mask() so we have to do
296 * things the hard way:
297 */
298 if (get_dma_ops(dev) != &dma_direct_ops ||
299 get_iommu_table_base(dev) == NULL ||
300 !dma_iommu_dma_supported(dev, mask))
301 return -EIO;
302 }
303 dev->coherent_dma_mask = mask;
304 return 0;
305}
306EXPORT_SYMBOL_GPL(dma_set_coherent_mask);
307
233#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16) 308#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
234 309
235int __dma_set_mask(struct device *dev, u64 dma_mask) 310int __dma_set_mask(struct device *dev, u64 dma_mask)
@@ -278,6 +353,13 @@ u64 dma_get_required_mask(struct device *dev)
278 if (ppc_md.dma_get_required_mask) 353 if (ppc_md.dma_get_required_mask)
279 return ppc_md.dma_get_required_mask(dev); 354 return ppc_md.dma_get_required_mask(dev);
280 355
356 if (dev_is_pci(dev)) {
357 struct pci_dev *pdev = to_pci_dev(dev);
358 struct pci_controller *phb = pci_bus_to_host(pdev->bus);
359 if (phb->controller_ops.dma_get_required_mask)
360 return phb->controller_ops.dma_get_required_mask(pdev);
361 }
362
281 return __dma_get_required_mask(dev); 363 return __dma_get_required_mask(dev);
282} 364}
283EXPORT_SYMBOL_GPL(dma_get_required_mask); 365EXPORT_SYMBOL_GPL(dma_get_required_mask);
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index af9b597b10af..e968533e3e05 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -308,11 +308,26 @@ void eeh_slot_error_detail(struct eeh_pe *pe, int severity)
308 if (!(pe->type & EEH_PE_PHB)) { 308 if (!(pe->type & EEH_PE_PHB)) {
309 if (eeh_has_flag(EEH_ENABLE_IO_FOR_LOG)) 309 if (eeh_has_flag(EEH_ENABLE_IO_FOR_LOG))
310 eeh_pci_enable(pe, EEH_OPT_THAW_MMIO); 310 eeh_pci_enable(pe, EEH_OPT_THAW_MMIO);
311
312 /*
313 * The config space of some PCI devices can't be accessed
314 * when their PEs are in frozen state. Otherwise, fenced
315 * PHB might be seen. Those PEs are identified with flag
316 * EEH_PE_CFG_RESTRICTED, indicating EEH_PE_CFG_BLOCKED
317 * is set automatically when the PE is put to EEH_PE_ISOLATED.
318 *
319 * Restoring BARs possibly triggers PCI config access in
320 * (OPAL) firmware and then causes fenced PHB. If the
321 * PCI config is blocked with flag EEH_PE_CFG_BLOCKED, it's
322 * pointless to restore BARs and dump config space.
323 */
311 eeh_ops->configure_bridge(pe); 324 eeh_ops->configure_bridge(pe);
312 eeh_pe_restore_bars(pe); 325 if (!(pe->state & EEH_PE_CFG_BLOCKED)) {
326 eeh_pe_restore_bars(pe);
313 327
314 pci_regs_buf[0] = 0; 328 pci_regs_buf[0] = 0;
315 eeh_pe_traverse(pe, eeh_dump_pe_log, &loglen); 329 eeh_pe_traverse(pe, eeh_dump_pe_log, &loglen);
330 }
316 } 331 }
317 332
318 eeh_ops->get_log(pe, severity, pci_regs_buf, loglen); 333 eeh_ops->get_log(pe, severity, pci_regs_buf, loglen);
@@ -750,14 +765,14 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state stat
750 eeh_pe_state_clear(pe, EEH_PE_ISOLATED); 765 eeh_pe_state_clear(pe, EEH_PE_ISOLATED);
751 break; 766 break;
752 case pcie_hot_reset: 767 case pcie_hot_reset:
753 eeh_pe_state_mark(pe, EEH_PE_ISOLATED); 768 eeh_pe_state_mark_with_cfg(pe, EEH_PE_ISOLATED);
754 eeh_ops->set_option(pe, EEH_OPT_FREEZE_PE); 769 eeh_ops->set_option(pe, EEH_OPT_FREEZE_PE);
755 eeh_pe_dev_traverse(pe, eeh_disable_and_save_dev_state, dev); 770 eeh_pe_dev_traverse(pe, eeh_disable_and_save_dev_state, dev);
756 eeh_pe_state_mark(pe, EEH_PE_CFG_BLOCKED); 771 eeh_pe_state_mark(pe, EEH_PE_CFG_BLOCKED);
757 eeh_ops->reset(pe, EEH_RESET_HOT); 772 eeh_ops->reset(pe, EEH_RESET_HOT);
758 break; 773 break;
759 case pcie_warm_reset: 774 case pcie_warm_reset:
760 eeh_pe_state_mark(pe, EEH_PE_ISOLATED); 775 eeh_pe_state_mark_with_cfg(pe, EEH_PE_ISOLATED);
761 eeh_ops->set_option(pe, EEH_OPT_FREEZE_PE); 776 eeh_ops->set_option(pe, EEH_OPT_FREEZE_PE);
762 eeh_pe_dev_traverse(pe, eeh_disable_and_save_dev_state, dev); 777 eeh_pe_dev_traverse(pe, eeh_disable_and_save_dev_state, dev);
763 eeh_pe_state_mark(pe, EEH_PE_CFG_BLOCKED); 778 eeh_pe_state_mark(pe, EEH_PE_CFG_BLOCKED);
@@ -1116,9 +1131,6 @@ void eeh_add_device_late(struct pci_dev *dev)
1116 return; 1131 return;
1117 } 1132 }
1118 1133
1119 if (eeh_has_flag(EEH_PROBE_MODE_DEV))
1120 eeh_ops->probe(pdn, NULL);
1121
1122 /* 1134 /*
1123 * The EEH cache might not be removed correctly because of 1135 * The EEH cache might not be removed correctly because of
1124 * unbalanced kref to the device during unplug time, which 1136 * unbalanced kref to the device during unplug time, which
@@ -1142,6 +1154,9 @@ void eeh_add_device_late(struct pci_dev *dev)
1142 dev->dev.archdata.edev = NULL; 1154 dev->dev.archdata.edev = NULL;
1143 } 1155 }
1144 1156
1157 if (eeh_has_flag(EEH_PROBE_MODE_DEV))
1158 eeh_ops->probe(pdn, NULL);
1159
1145 edev->pdev = dev; 1160 edev->pdev = dev;
1146 dev->dev.archdata.edev = edev; 1161 dev->dev.archdata.edev = edev;
1147 1162
diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
index 35f0b62259bb..8654cb166c19 100644
--- a/arch/powerpc/kernel/eeh_pe.c
+++ b/arch/powerpc/kernel/eeh_pe.c
@@ -657,6 +657,28 @@ void eeh_pe_state_clear(struct eeh_pe *pe, int state)
657 eeh_pe_traverse(pe, __eeh_pe_state_clear, &state); 657 eeh_pe_traverse(pe, __eeh_pe_state_clear, &state);
658} 658}
659 659
660/**
661 * eeh_pe_state_mark_with_cfg - Mark PE state with unblocked config space
662 * @pe: PE
663 * @state: PE state to be set
664 *
665 * Set specified flag to PE and its child PEs. The PCI config space
666 * of some PEs is blocked automatically when EEH_PE_ISOLATED is set,
667 * which isn't needed in some situations. The function allows to set
668 * the specified flag to indicated PEs without blocking their PCI
669 * config space.
670 */
671void eeh_pe_state_mark_with_cfg(struct eeh_pe *pe, int state)
672{
673 eeh_pe_traverse(pe, __eeh_pe_state_mark, &state);
674 if (!(state & EEH_PE_ISOLATED))
675 return;
676
677 /* Clear EEH_PE_CFG_BLOCKED, which might be set just now */
678 state = EEH_PE_CFG_BLOCKED;
679 eeh_pe_traverse(pe, __eeh_pe_state_clear, &state);
680}
681
660/* 682/*
661 * Some PCI bridges (e.g. PLX bridges) have primary/secondary 683 * Some PCI bridges (e.g. PLX bridges) have primary/secondary
662 * buses assigned explicitly by firmware, and we probably have 684 * buses assigned explicitly by firmware, and we probably have
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 46fc0f4d8982..2405631e91a2 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/err.h>
23#include <linux/sys.h> 24#include <linux/sys.h>
24#include <linux/threads.h> 25#include <linux/threads.h>
25#include <asm/reg.h> 26#include <asm/reg.h>
@@ -354,7 +355,7 @@ ret_from_syscall:
354 SYNC 355 SYNC
355 MTMSRD(r10) 356 MTMSRD(r10)
356 lwz r9,TI_FLAGS(r12) 357 lwz r9,TI_FLAGS(r12)
357 li r8,-_LAST_ERRNO 358 li r8,-MAX_ERRNO
358 andi. r0,r9,(_TIF_SYSCALL_DOTRACE|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK) 359 andi. r0,r9,(_TIF_SYSCALL_DOTRACE|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK)
359 bne- syscall_exit_work 360 bne- syscall_exit_work
360 cmplw 0,r3,r8 361 cmplw 0,r3,r8
@@ -457,6 +458,10 @@ syscall_dotrace:
457 lwz r7,GPR7(r1) 458 lwz r7,GPR7(r1)
458 lwz r8,GPR8(r1) 459 lwz r8,GPR8(r1)
459 REST_NVGPRS(r1) 460 REST_NVGPRS(r1)
461
462 cmplwi r0,NR_syscalls
463 /* Return code is already in r3 thanks to do_syscall_trace_enter() */
464 bge- ret_from_syscall
460 b syscall_dotrace_cont 465 b syscall_dotrace_cont
461 466
462syscall_exit_work: 467syscall_exit_work:
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 579e0f9a2d57..a94f155db78e 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <linux/errno.h> 21#include <linux/errno.h>
22#include <linux/err.h>
22#include <asm/unistd.h> 23#include <asm/unistd.h>
23#include <asm/processor.h> 24#include <asm/processor.h>
24#include <asm/page.h> 25#include <asm/page.h>
@@ -150,8 +151,7 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
150 CURRENT_THREAD_INFO(r11, r1) 151 CURRENT_THREAD_INFO(r11, r1)
151 ld r10,TI_FLAGS(r11) 152 ld r10,TI_FLAGS(r11)
152 andi. r11,r10,_TIF_SYSCALL_DOTRACE 153 andi. r11,r10,_TIF_SYSCALL_DOTRACE
153 bne syscall_dotrace 154 bne syscall_dotrace /* does not return */
154.Lsyscall_dotrace_cont:
155 cmpldi 0,r0,NR_syscalls 155 cmpldi 0,r0,NR_syscalls
156 bge- syscall_enosys 156 bge- syscall_enosys
157 157
@@ -207,7 +207,7 @@ system_call: /* label this so stack traces look sane */
207#endif /* CONFIG_PPC_BOOK3E */ 207#endif /* CONFIG_PPC_BOOK3E */
208 208
209 ld r9,TI_FLAGS(r12) 209 ld r9,TI_FLAGS(r12)
210 li r11,-_LAST_ERRNO 210 li r11,-MAX_ERRNO
211 andi. r0,r9,(_TIF_SYSCALL_DOTRACE|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK) 211 andi. r0,r9,(_TIF_SYSCALL_DOTRACE|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK)
212 bne- syscall_exit_work 212 bne- syscall_exit_work
213 cmpld r3,r11 213 cmpld r3,r11
@@ -245,22 +245,34 @@ syscall_dotrace:
245 bl save_nvgprs 245 bl save_nvgprs
246 addi r3,r1,STACK_FRAME_OVERHEAD 246 addi r3,r1,STACK_FRAME_OVERHEAD
247 bl do_syscall_trace_enter 247 bl do_syscall_trace_enter
248
248 /* 249 /*
249 * Restore argument registers possibly just changed. 250 * We use the return value of do_syscall_trace_enter() as the syscall
250 * We use the return value of do_syscall_trace_enter 251 * number. If the syscall was rejected for any reason do_syscall_trace_enter()
251 * for the call number to look up in the table (r0). 252 * returns an invalid syscall number and the test below against
253 * NR_syscalls will fail.
252 */ 254 */
253 mr r0,r3 255 mr r0,r3
256
257 /* Restore argument registers just clobbered and/or possibly changed. */
254 ld r3,GPR3(r1) 258 ld r3,GPR3(r1)
255 ld r4,GPR4(r1) 259 ld r4,GPR4(r1)
256 ld r5,GPR5(r1) 260 ld r5,GPR5(r1)
257 ld r6,GPR6(r1) 261 ld r6,GPR6(r1)
258 ld r7,GPR7(r1) 262 ld r7,GPR7(r1)
259 ld r8,GPR8(r1) 263 ld r8,GPR8(r1)
264
265 /* Repopulate r9 and r10 for the system_call path */
260 addi r9,r1,STACK_FRAME_OVERHEAD 266 addi r9,r1,STACK_FRAME_OVERHEAD
261 CURRENT_THREAD_INFO(r10, r1) 267 CURRENT_THREAD_INFO(r10, r1)
262 ld r10,TI_FLAGS(r10) 268 ld r10,TI_FLAGS(r10)
263 b .Lsyscall_dotrace_cont 269
270 cmpldi r0,NR_syscalls
271 blt+ system_call
272
273 /* Return code is already in r3 thanks to do_syscall_trace_enter() */
274 b .Lsyscall_exit
275
264 276
265syscall_enosys: 277syscall_enosys:
266 li r3,-ENOSYS 278 li r3,-ENOSYS
@@ -277,7 +289,7 @@ syscall_exit_work:
277 beq+ 0f 289 beq+ 0f
278 REST_NVGPRS(r1) 290 REST_NVGPRS(r1)
279 b 2f 291 b 2f
2800: cmpld r3,r11 /* r10 is -LAST_ERRNO */ 2920: cmpld r3,r11 /* r11 is -MAX_ERRNO */
281 blt+ 1f 293 blt+ 1f
282 andi. r0,r9,_TIF_NOERROR 294 andi. r0,r9,_TIF_NOERROR
283 bne- 1f 295 bne- 1f
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 3e68d1c69718..f3bd5e747ed8 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -1313,11 +1313,14 @@ skpinv: addi r6,r6,1 /* Increment */
1313 sync 1313 sync
1314 isync 1314 isync
1315 1315
1316/* The mapping only needs to be cache-coherent on SMP */ 1316/*
1317#ifdef CONFIG_SMP 1317 * The mapping only needs to be cache-coherent on SMP, except on
1318#define M_IF_SMP MAS2_M 1318 * Freescale e500mc derivatives where it's also needed for coherent DMA.
1319 */
1320#if defined(CONFIG_SMP) || defined(CONFIG_PPC_E500MC)
1321#define M_IF_NEEDED MAS2_M
1319#else 1322#else
1320#define M_IF_SMP 0 1323#define M_IF_NEEDED 0
1321#endif 1324#endif
1322 1325
1323/* 6. Setup KERNELBASE mapping in TLB[0] 1326/* 6. Setup KERNELBASE mapping in TLB[0]
@@ -1332,7 +1335,7 @@ skpinv: addi r6,r6,1 /* Increment */
1332 ori r6,r6,(MAS1_TSIZE(BOOK3E_PAGESZ_1GB))@l 1335 ori r6,r6,(MAS1_TSIZE(BOOK3E_PAGESZ_1GB))@l
1333 mtspr SPRN_MAS1,r6 1336 mtspr SPRN_MAS1,r6
1334 1337
1335 LOAD_REG_IMMEDIATE(r6, PAGE_OFFSET | M_IF_SMP) 1338 LOAD_REG_IMMEDIATE(r6, PAGE_OFFSET | M_IF_NEEDED)
1336 mtspr SPRN_MAS2,r6 1339 mtspr SPRN_MAS2,r6
1337 1340
1338 rlwinm r5,r5,0,0,25 1341 rlwinm r5,r5,0,0,25
diff --git a/arch/powerpc/kernel/fsl_booke_entry_mapping.S b/arch/powerpc/kernel/fsl_booke_entry_mapping.S
index f22e7e44fbf3..83dd0f6776b3 100644
--- a/arch/powerpc/kernel/fsl_booke_entry_mapping.S
+++ b/arch/powerpc/kernel/fsl_booke_entry_mapping.S
@@ -152,11 +152,14 @@ skpinv: addi r6,r6,1 /* Increment */
152 tlbivax 0,r9 152 tlbivax 0,r9
153 TLBSYNC 153 TLBSYNC
154 154
155/* The mapping only needs to be cache-coherent on SMP */ 155/*
156#ifdef CONFIG_SMP 156 * The mapping only needs to be cache-coherent on SMP, except on
157#define M_IF_SMP MAS2_M 157 * Freescale e500mc derivatives where it's also needed for coherent DMA.
158 */
159#if defined(CONFIG_SMP) || defined(CONFIG_PPC_E500MC)
160#define M_IF_NEEDED MAS2_M
158#else 161#else
159#define M_IF_SMP 0 162#define M_IF_NEEDED 0
160#endif 163#endif
161 164
162#if defined(ENTRY_MAPPING_BOOT_SETUP) 165#if defined(ENTRY_MAPPING_BOOT_SETUP)
@@ -167,8 +170,8 @@ skpinv: addi r6,r6,1 /* Increment */
167 lis r6,(MAS1_VALID|MAS1_IPROT)@h 170 lis r6,(MAS1_VALID|MAS1_IPROT)@h
168 ori r6,r6,(MAS1_TSIZE(BOOK3E_PAGESZ_64M))@l 171 ori r6,r6,(MAS1_TSIZE(BOOK3E_PAGESZ_64M))@l
169 mtspr SPRN_MAS1,r6 172 mtspr SPRN_MAS1,r6
170 lis r6,MAS2_VAL(PAGE_OFFSET, BOOK3E_PAGESZ_64M, M_IF_SMP)@h 173 lis r6,MAS2_VAL(PAGE_OFFSET, BOOK3E_PAGESZ_64M, M_IF_NEEDED)@h
171 ori r6,r6,MAS2_VAL(PAGE_OFFSET, BOOK3E_PAGESZ_64M, M_IF_SMP)@l 174 ori r6,r6,MAS2_VAL(PAGE_OFFSET, BOOK3E_PAGESZ_64M, M_IF_NEEDED)@l
172 mtspr SPRN_MAS2,r6 175 mtspr SPRN_MAS2,r6
173 mtspr SPRN_MAS3,r8 176 mtspr SPRN_MAS3,r8
174 tlbwe 177 tlbwe
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index 33aa4ddf597d..9ad37f827a97 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -649,7 +649,6 @@ static void kvm_check_ins(u32 *inst, u32 features)
649 kvm_patch_ins_mtsrin(inst, inst_rt, inst_rb); 649 kvm_patch_ins_mtsrin(inst, inst_rt, inst_rb);
650 } 650 }
651 break; 651 break;
652 break;
653#endif 652#endif
654 } 653 }
655 654
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 4e314b90c75d..6e4168cf4698 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -475,9 +475,18 @@ _GLOBAL(kexec_wait)
475#ifdef CONFIG_KEXEC /* use no memory without kexec */ 475#ifdef CONFIG_KEXEC /* use no memory without kexec */
476 lwz r4,0(r5) 476 lwz r4,0(r5)
477 cmpwi 0,r4,0 477 cmpwi 0,r4,0
478 bnea 0x60 478 beq 99b
479#ifdef CONFIG_PPC_BOOK3S_64
480 li r10,0x60
481 mfmsr r11
482 clrrdi r11,r11,1 /* Clear MSR_LE */
483 mtsrr0 r10
484 mtsrr1 r11
485 rfid
486#else
487 ba 0x60
488#endif
479#endif 489#endif
480 b 99b
481 490
482/* this can be in text because we won't change it until we are 491/* this can be in text because we won't change it until we are
483 * running in real anyways 492 * running in real anyways
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index 1e703f8ebad4..98ba106a59ef 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -541,10 +541,9 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
541 time->tv_sec = be64_to_cpu(oops_hdr->timestamp); 541 time->tv_sec = be64_to_cpu(oops_hdr->timestamp);
542 time->tv_nsec = 0; 542 time->tv_nsec = 0;
543 } 543 }
544 *buf = kmalloc(length, GFP_KERNEL); 544 *buf = kmemdup(buff + hdr_size, length, GFP_KERNEL);
545 if (*buf == NULL) 545 if (*buf == NULL)
546 return -ENOMEM; 546 return -ENOMEM;
547 memcpy(*buf, buff + hdr_size, length);
548 kfree(buff); 547 kfree(buff);
549 548
550 if (err_type == ERR_TYPE_KERNEL_PANIC_GZ) 549 if (err_type == ERR_TYPE_KERNEL_PANIC_GZ)
@@ -582,9 +581,10 @@ static int nvram_pstore_init(void)
582 spin_lock_init(&nvram_pstore_info.buf_lock); 581 spin_lock_init(&nvram_pstore_info.buf_lock);
583 582
584 rc = pstore_register(&nvram_pstore_info); 583 rc = pstore_register(&nvram_pstore_info);
585 if (rc != 0) 584 if (rc && (rc != -EPERM))
586 pr_err("nvram: pstore_register() failed, defaults to " 585 /* Print error only when pstore.backend == nvram */
587 "kmsg_dump; returned %d\n", rc); 586 pr_err("nvram: pstore_register() failed, returned %d. "
587 "Defaults to kmsg_dump\n", rc);
588 588
589 return rc; 589 return rc;
590} 590}
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 02c1d5dcee4d..a1d0632d97c6 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -823,23 +823,15 @@ static void pcibios_fixup_resources(struct pci_dev *dev)
823 (reg.start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) { 823 (reg.start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) {
824 /* Only print message if not re-assigning */ 824 /* Only print message if not re-assigning */
825 if (!pci_has_flag(PCI_REASSIGN_ALL_RSRC)) 825 if (!pci_has_flag(PCI_REASSIGN_ALL_RSRC))
826 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] " 826 pr_debug("PCI:%s Resource %d %pR is unassigned\n",
827 "is unassigned\n", 827 pci_name(dev), i, res);
828 pci_name(dev), i,
829 (unsigned long long)res->start,
830 (unsigned long long)res->end,
831 (unsigned int)res->flags);
832 res->end -= res->start; 828 res->end -= res->start;
833 res->start = 0; 829 res->start = 0;
834 res->flags |= IORESOURCE_UNSET; 830 res->flags |= IORESOURCE_UNSET;
835 continue; 831 continue;
836 } 832 }
837 833
838 pr_debug("PCI:%s Resource %d %016llx-%016llx [%x]\n", 834 pr_debug("PCI:%s Resource %d %pR\n", pci_name(dev), i, res);
839 pci_name(dev), i,
840 (unsigned long long)res->start,\
841 (unsigned long long)res->end,
842 (unsigned int)res->flags);
843 } 835 }
844 836
845 /* Call machine specific resource fixup */ 837 /* Call machine specific resource fixup */
@@ -943,11 +935,7 @@ static void pcibios_fixup_bridge(struct pci_bus *bus)
943 continue; 935 continue;
944 } 936 }
945 937
946 pr_debug("PCI:%s Bus rsrc %d %016llx-%016llx [%x]\n", 938 pr_debug("PCI:%s Bus rsrc %d %pR\n", pci_name(dev), i, res);
947 pci_name(dev), i,
948 (unsigned long long)res->start,\
949 (unsigned long long)res->end,
950 (unsigned int)res->flags);
951 939
952 /* Try to detect uninitialized P2P bridge resources, 940 /* Try to detect uninitialized P2P bridge resources,
953 * and clear them out so they get re-assigned later 941 * and clear them out so they get re-assigned later
@@ -1126,10 +1114,8 @@ static int reparent_resources(struct resource *parent,
1126 *pp = NULL; 1114 *pp = NULL;
1127 for (p = res->child; p != NULL; p = p->sibling) { 1115 for (p = res->child; p != NULL; p = p->sibling) {
1128 p->parent = res; 1116 p->parent = res;
1129 pr_debug("PCI: Reparented %s [%llx..%llx] under %s\n", 1117 pr_debug("PCI: Reparented %s %pR under %s\n",
1130 p->name, 1118 p->name, p, res->name);
1131 (unsigned long long)p->start,
1132 (unsigned long long)p->end, res->name);
1133 } 1119 }
1134 return 0; 1120 return 0;
1135} 1121}
@@ -1198,14 +1184,9 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)
1198 } 1184 }
1199 } 1185 }
1200 1186
1201 pr_debug("PCI: %s (bus %d) bridge rsrc %d: %016llx-%016llx " 1187 pr_debug("PCI: %s (bus %d) bridge rsrc %d: %pR, parent %p (%s)\n",
1202 "[0x%x], parent %p (%s)\n", 1188 bus->self ? pci_name(bus->self) : "PHB", bus->number,
1203 bus->self ? pci_name(bus->self) : "PHB", 1189 i, res, pr, (pr && pr->name) ? pr->name : "nil");
1204 bus->number, i,
1205 (unsigned long long)res->start,
1206 (unsigned long long)res->end,
1207 (unsigned int)res->flags,
1208 pr, (pr && pr->name) ? pr->name : "nil");
1209 1190
1210 if (pr && !(pr->flags & IORESOURCE_UNSET)) { 1191 if (pr && !(pr->flags & IORESOURCE_UNSET)) {
1211 struct pci_dev *dev = bus->self; 1192 struct pci_dev *dev = bus->self;
@@ -1247,11 +1228,8 @@ static inline void alloc_resource(struct pci_dev *dev, int idx)
1247{ 1228{
1248 struct resource *pr, *r = &dev->resource[idx]; 1229 struct resource *pr, *r = &dev->resource[idx];
1249 1230
1250 pr_debug("PCI: Allocating %s: Resource %d: %016llx..%016llx [%x]\n", 1231 pr_debug("PCI: Allocating %s: Resource %d: %pR\n",
1251 pci_name(dev), idx, 1232 pci_name(dev), idx, r);
1252 (unsigned long long)r->start,
1253 (unsigned long long)r->end,
1254 (unsigned int)r->flags);
1255 1233
1256 pr = pci_find_parent_resource(dev, r); 1234 pr = pci_find_parent_resource(dev, r);
1257 if (!pr || (pr->flags & IORESOURCE_UNSET) || 1235 if (!pr || (pr->flags & IORESOURCE_UNSET) ||
@@ -1259,11 +1237,7 @@ static inline void alloc_resource(struct pci_dev *dev, int idx)
1259 printk(KERN_WARNING "PCI: Cannot allocate resource region %d" 1237 printk(KERN_WARNING "PCI: Cannot allocate resource region %d"
1260 " of device %s, will remap\n", idx, pci_name(dev)); 1238 " of device %s, will remap\n", idx, pci_name(dev));
1261 if (pr) 1239 if (pr)
1262 pr_debug("PCI: parent is %p: %016llx-%016llx [%x]\n", 1240 pr_debug("PCI: parent is %p: %pR\n", pr, pr);
1263 pr,
1264 (unsigned long long)pr->start,
1265 (unsigned long long)pr->end,
1266 (unsigned int)pr->flags);
1267 /* We'll assign a new address later */ 1241 /* We'll assign a new address later */
1268 r->flags |= IORESOURCE_UNSET; 1242 r->flags |= IORESOURCE_UNSET;
1269 r->end -= r->start; 1243 r->end -= r->start;
@@ -1425,12 +1399,8 @@ void pcibios_claim_one_bus(struct pci_bus *bus)
1425 if (r->parent || !r->start || !r->flags) 1399 if (r->parent || !r->start || !r->flags)
1426 continue; 1400 continue;
1427 1401
1428 pr_debug("PCI: Claiming %s: " 1402 pr_debug("PCI: Claiming %s: Resource %d: %pR\n",
1429 "Resource %d: %016llx..%016llx [%x]\n", 1403 pci_name(dev), i, r);
1430 pci_name(dev), i,
1431 (unsigned long long)r->start,
1432 (unsigned long long)r->end,
1433 (unsigned int)r->flags);
1434 1404
1435 if (pci_claim_resource(dev, i) == 0) 1405 if (pci_claim_resource(dev, i) == 0)
1436 continue; 1406 continue;
@@ -1514,11 +1484,8 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose,
1514 } else { 1484 } else {
1515 offset = pcibios_io_space_offset(hose); 1485 offset = pcibios_io_space_offset(hose);
1516 1486
1517 pr_debug("PCI: PHB IO resource = %08llx-%08llx [%lx] off 0x%08llx\n", 1487 pr_debug("PCI: PHB IO resource = %pR off 0x%08llx\n",
1518 (unsigned long long)res->start, 1488 res, (unsigned long long)offset);
1519 (unsigned long long)res->end,
1520 (unsigned long)res->flags,
1521 (unsigned long long)offset);
1522 pci_add_resource_offset(resources, res, offset); 1489 pci_add_resource_offset(resources, res, offset);
1523 } 1490 }
1524 1491
@@ -1535,11 +1502,8 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose,
1535 offset = hose->mem_offset[i]; 1502 offset = hose->mem_offset[i];
1536 1503
1537 1504
1538 pr_debug("PCI: PHB MEM resource %d = %08llx-%08llx [%lx] off 0x%08llx\n", i, 1505 pr_debug("PCI: PHB MEM resource %d = %pR off 0x%08llx\n", i,
1539 (unsigned long long)res->start, 1506 res, (unsigned long long)offset);
1540 (unsigned long long)res->end,
1541 (unsigned long)res->flags,
1542 (unsigned long long)offset);
1543 1507
1544 pci_add_resource_offset(resources, res, offset); 1508 pci_add_resource_offset(resources, res, offset);
1545 } 1509 }
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 64e6e9d9e656..75b6676c1a0b 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -86,7 +86,7 @@ void giveup_fpu_maybe_transactional(struct task_struct *tsk)
86 if (tsk == current && tsk->thread.regs && 86 if (tsk == current && tsk->thread.regs &&
87 MSR_TM_ACTIVE(tsk->thread.regs->msr) && 87 MSR_TM_ACTIVE(tsk->thread.regs->msr) &&
88 !test_thread_flag(TIF_RESTORE_TM)) { 88 !test_thread_flag(TIF_RESTORE_TM)) {
89 tsk->thread.tm_orig_msr = tsk->thread.regs->msr; 89 tsk->thread.ckpt_regs.msr = tsk->thread.regs->msr;
90 set_thread_flag(TIF_RESTORE_TM); 90 set_thread_flag(TIF_RESTORE_TM);
91 } 91 }
92 92
@@ -104,7 +104,7 @@ void giveup_altivec_maybe_transactional(struct task_struct *tsk)
104 if (tsk == current && tsk->thread.regs && 104 if (tsk == current && tsk->thread.regs &&
105 MSR_TM_ACTIVE(tsk->thread.regs->msr) && 105 MSR_TM_ACTIVE(tsk->thread.regs->msr) &&
106 !test_thread_flag(TIF_RESTORE_TM)) { 106 !test_thread_flag(TIF_RESTORE_TM)) {
107 tsk->thread.tm_orig_msr = tsk->thread.regs->msr; 107 tsk->thread.ckpt_regs.msr = tsk->thread.regs->msr;
108 set_thread_flag(TIF_RESTORE_TM); 108 set_thread_flag(TIF_RESTORE_TM);
109 } 109 }
110 110
@@ -540,7 +540,7 @@ static void tm_reclaim_thread(struct thread_struct *thr,
540 * the thread will no longer be transactional. 540 * the thread will no longer be transactional.
541 */ 541 */
542 if (test_ti_thread_flag(ti, TIF_RESTORE_TM)) { 542 if (test_ti_thread_flag(ti, TIF_RESTORE_TM)) {
543 msr_diff = thr->tm_orig_msr & ~thr->regs->msr; 543 msr_diff = thr->ckpt_regs.msr & ~thr->regs->msr;
544 if (msr_diff & MSR_FP) 544 if (msr_diff & MSR_FP)
545 memcpy(&thr->transact_fp, &thr->fp_state, 545 memcpy(&thr->transact_fp, &thr->fp_state,
546 sizeof(struct thread_fp_state)); 546 sizeof(struct thread_fp_state));
@@ -591,10 +591,10 @@ static inline void tm_reclaim_task(struct task_struct *tsk)
591 /* Stash the original thread MSR, as giveup_fpu et al will 591 /* Stash the original thread MSR, as giveup_fpu et al will
592 * modify it. We hold onto it to see whether the task used 592 * modify it. We hold onto it to see whether the task used
593 * FP & vector regs. If the TIF_RESTORE_TM flag is set, 593 * FP & vector regs. If the TIF_RESTORE_TM flag is set,
594 * tm_orig_msr is already set. 594 * ckpt_regs.msr is already set.
595 */ 595 */
596 if (!test_ti_thread_flag(task_thread_info(tsk), TIF_RESTORE_TM)) 596 if (!test_ti_thread_flag(task_thread_info(tsk), TIF_RESTORE_TM))
597 thr->tm_orig_msr = thr->regs->msr; 597 thr->ckpt_regs.msr = thr->regs->msr;
598 598
599 TM_DEBUG("--- tm_reclaim on pid %d (NIP=%lx, " 599 TM_DEBUG("--- tm_reclaim on pid %d (NIP=%lx, "
600 "ccr=%lx, msr=%lx, trap=%lx)\n", 600 "ccr=%lx, msr=%lx, trap=%lx)\n",
@@ -663,7 +663,7 @@ static inline void tm_recheckpoint_new_task(struct task_struct *new)
663 tm_restore_sprs(&new->thread); 663 tm_restore_sprs(&new->thread);
664 return; 664 return;
665 } 665 }
666 msr = new->thread.tm_orig_msr; 666 msr = new->thread.ckpt_regs.msr;
667 /* Recheckpoint to restore original checkpointed register state. */ 667 /* Recheckpoint to restore original checkpointed register state. */
668 TM_DEBUG("*** tm_recheckpoint of pid %d " 668 TM_DEBUG("*** tm_recheckpoint of pid %d "
669 "(new->msr 0x%lx, new->origmsr 0x%lx)\n", 669 "(new->msr 0x%lx, new->origmsr 0x%lx)\n",
@@ -723,7 +723,7 @@ void restore_tm_state(struct pt_regs *regs)
723 if (!MSR_TM_ACTIVE(regs->msr)) 723 if (!MSR_TM_ACTIVE(regs->msr))
724 return; 724 return;
725 725
726 msr_diff = current->thread.tm_orig_msr & ~regs->msr; 726 msr_diff = current->thread.ckpt_regs.msr & ~regs->msr;
727 msr_diff &= MSR_FP | MSR_VEC | MSR_VSX; 727 msr_diff &= MSR_FP | MSR_VEC | MSR_VSX;
728 if (msr_diff & MSR_FP) { 728 if (msr_diff & MSR_FP) {
729 fp_enable(); 729 fp_enable();
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 8b888b12a475..bef76c5033e4 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -218,22 +218,18 @@ static void __init check_cpu_pa_features(unsigned long node)
218} 218}
219 219
220#ifdef CONFIG_PPC_STD_MMU_64 220#ifdef CONFIG_PPC_STD_MMU_64
221static void __init check_cpu_slb_size(unsigned long node) 221static void __init init_mmu_slb_size(unsigned long node)
222{ 222{
223 const __be32 *slb_size_ptr; 223 const __be32 *slb_size_ptr;
224 224
225 slb_size_ptr = of_get_flat_dt_prop(node, "slb-size", NULL); 225 slb_size_ptr = of_get_flat_dt_prop(node, "slb-size", NULL) ? :
226 if (slb_size_ptr != NULL) { 226 of_get_flat_dt_prop(node, "ibm,slb-size", NULL);
227 mmu_slb_size = be32_to_cpup(slb_size_ptr); 227
228 return; 228 if (slb_size_ptr)
229 }
230 slb_size_ptr = of_get_flat_dt_prop(node, "ibm,slb-size", NULL);
231 if (slb_size_ptr != NULL) {
232 mmu_slb_size = be32_to_cpup(slb_size_ptr); 229 mmu_slb_size = be32_to_cpup(slb_size_ptr);
233 }
234} 230}
235#else 231#else
236#define check_cpu_slb_size(node) do { } while(0) 232#define init_mmu_slb_size(node) do { } while(0)
237#endif 233#endif
238 234
239static struct feature_property { 235static struct feature_property {
@@ -380,7 +376,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
380 376
381 check_cpu_feature_properties(node); 377 check_cpu_feature_properties(node);
382 check_cpu_pa_features(node); 378 check_cpu_pa_features(node);
383 check_cpu_slb_size(node); 379 init_mmu_slb_size(node);
384 380
385#ifdef CONFIG_PPC64 381#ifdef CONFIG_PPC64
386 if (nthreads > 1) 382 if (nthreads > 1)
@@ -476,9 +472,10 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node)
476 flags = of_read_number(&dm[3], 1); 472 flags = of_read_number(&dm[3], 1);
477 /* skip DRC index, pad, assoc. list index, flags */ 473 /* skip DRC index, pad, assoc. list index, flags */
478 dm += 4; 474 dm += 4;
479 /* skip this block if the reserved bit is set in flags (0x80) 475 /* skip this block if the reserved bit is set in flags
480 or if the block is not assigned to this partition (0x8) */ 476 or if the block is not assigned to this partition */
481 if ((flags & 0x80) || !(flags & 0x8)) 477 if ((flags & DRCONF_MEM_RESERVED) ||
478 !(flags & DRCONF_MEM_ASSIGNED))
482 continue; 479 continue;
483 size = memblock_size; 480 size = memblock_size;
484 rngs = 1; 481 rngs = 1;
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index fcca8077e6a2..15099c41622e 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -641,6 +641,15 @@ static void __init early_cmdline_parse(void)
641#define W(x) ((x) >> 24) & 0xff, ((x) >> 16) & 0xff, \ 641#define W(x) ((x) >> 24) & 0xff, ((x) >> 16) & 0xff, \
642 ((x) >> 8) & 0xff, (x) & 0xff 642 ((x) >> 8) & 0xff, (x) & 0xff
643 643
644/* Firmware expects the value to be n - 1, where n is the # of vectors */
645#define NUM_VECTORS(n) ((n) - 1)
646
647/*
648 * Firmware expects 1 + n - 2, where n is the length of the option vector in
649 * bytes. The 1 accounts for the length byte itself, the - 2 .. ?
650 */
651#define VECTOR_LENGTH(n) (1 + (n) - 2)
652
644unsigned char ibm_architecture_vec[] = { 653unsigned char ibm_architecture_vec[] = {
645 W(0xfffe0000), W(0x003a0000), /* POWER5/POWER5+ */ 654 W(0xfffe0000), W(0x003a0000), /* POWER5/POWER5+ */
646 W(0xffff0000), W(0x003e0000), /* POWER6 */ 655 W(0xffff0000), W(0x003e0000), /* POWER6 */
@@ -651,16 +660,16 @@ unsigned char ibm_architecture_vec[] = {
651 W(0xffffffff), W(0x0f000003), /* all 2.06-compliant */ 660 W(0xffffffff), W(0x0f000003), /* all 2.06-compliant */
652 W(0xffffffff), W(0x0f000002), /* all 2.05-compliant */ 661 W(0xffffffff), W(0x0f000002), /* all 2.05-compliant */
653 W(0xfffffffe), W(0x0f000001), /* all 2.04-compliant and earlier */ 662 W(0xfffffffe), W(0x0f000001), /* all 2.04-compliant and earlier */
654 6 - 1, /* 6 option vectors */ 663 NUM_VECTORS(6), /* 6 option vectors */
655 664
656 /* option vector 1: processor architectures supported */ 665 /* option vector 1: processor architectures supported */
657 3 - 2, /* length */ 666 VECTOR_LENGTH(2), /* length */
658 0, /* don't ignore, don't halt */ 667 0, /* don't ignore, don't halt */
659 OV1_PPC_2_00 | OV1_PPC_2_01 | OV1_PPC_2_02 | OV1_PPC_2_03 | 668 OV1_PPC_2_00 | OV1_PPC_2_01 | OV1_PPC_2_02 | OV1_PPC_2_03 |
660 OV1_PPC_2_04 | OV1_PPC_2_05 | OV1_PPC_2_06 | OV1_PPC_2_07, 669 OV1_PPC_2_04 | OV1_PPC_2_05 | OV1_PPC_2_06 | OV1_PPC_2_07,
661 670
662 /* option vector 2: Open Firmware options supported */ 671 /* option vector 2: Open Firmware options supported */
663 34 - 2, /* length */ 672 VECTOR_LENGTH(33), /* length */
664 OV2_REAL_MODE, 673 OV2_REAL_MODE,
665 0, 0, 674 0, 0,
666 W(0xffffffff), /* real_base */ 675 W(0xffffffff), /* real_base */
@@ -674,17 +683,17 @@ unsigned char ibm_architecture_vec[] = {
674 48, /* max log_2(hash table size) */ 683 48, /* max log_2(hash table size) */
675 684
676 /* option vector 3: processor options supported */ 685 /* option vector 3: processor options supported */
677 3 - 2, /* length */ 686 VECTOR_LENGTH(2), /* length */
678 0, /* don't ignore, don't halt */ 687 0, /* don't ignore, don't halt */
679 OV3_FP | OV3_VMX | OV3_DFP, 688 OV3_FP | OV3_VMX | OV3_DFP,
680 689
681 /* option vector 4: IBM PAPR implementation */ 690 /* option vector 4: IBM PAPR implementation */
682 3 - 2, /* length */ 691 VECTOR_LENGTH(2), /* length */
683 0, /* don't halt */ 692 0, /* don't halt */
684 OV4_MIN_ENT_CAP, /* minimum VP entitled capacity */ 693 OV4_MIN_ENT_CAP, /* minimum VP entitled capacity */
685 694
686 /* option vector 5: PAPR/OF options */ 695 /* option vector 5: PAPR/OF options */
687 19 - 2, /* length */ 696 VECTOR_LENGTH(18), /* length */
688 0, /* don't ignore, don't halt */ 697 0, /* don't ignore, don't halt */
689 OV5_FEAT(OV5_LPAR) | OV5_FEAT(OV5_SPLPAR) | OV5_FEAT(OV5_LARGE_PAGES) | 698 OV5_FEAT(OV5_LPAR) | OV5_FEAT(OV5_SPLPAR) | OV5_FEAT(OV5_LARGE_PAGES) |
690 OV5_FEAT(OV5_DRCONF_MEMORY) | OV5_FEAT(OV5_DONATE_DEDICATE_CPU) | 699 OV5_FEAT(OV5_DRCONF_MEMORY) | OV5_FEAT(OV5_DONATE_DEDICATE_CPU) |
@@ -717,12 +726,12 @@ unsigned char ibm_architecture_vec[] = {
717 OV5_FEAT(OV5_PFO_HW_RNG) | OV5_FEAT(OV5_PFO_HW_ENCR) | 726 OV5_FEAT(OV5_PFO_HW_RNG) | OV5_FEAT(OV5_PFO_HW_ENCR) |
718 OV5_FEAT(OV5_PFO_HW_842), 727 OV5_FEAT(OV5_PFO_HW_842),
719 OV5_FEAT(OV5_SUB_PROCESSORS), 728 OV5_FEAT(OV5_SUB_PROCESSORS),
729
720 /* option vector 6: IBM PAPR hints */ 730 /* option vector 6: IBM PAPR hints */
721 4 - 2, /* length */ 731 VECTOR_LENGTH(3), /* length */
722 0, 732 0,
723 0, 733 0,
724 OV6_LINUX, 734 OV6_LINUX,
725
726}; 735};
727 736
728/* Old method - ELF header with PT_NOTE sections only works on BE */ 737/* Old method - ELF header with PT_NOTE sections only works on BE */
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index f21897b42057..737c0d0b53ac 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1762,26 +1762,81 @@ long arch_ptrace(struct task_struct *child, long request,
1762 return ret; 1762 return ret;
1763} 1763}
1764 1764
1765/* 1765#ifdef CONFIG_SECCOMP
1766 * We must return the syscall number to actually look up in the table. 1766static int do_seccomp(struct pt_regs *regs)
1767 * This can be -1L to skip running any syscall at all. 1767{
1768 if (!test_thread_flag(TIF_SECCOMP))
1769 return 0;
1770
1771 /*
1772 * The ABI we present to seccomp tracers is that r3 contains
1773 * the syscall return value and orig_gpr3 contains the first
1774 * syscall parameter. This is different to the ptrace ABI where
1775 * both r3 and orig_gpr3 contain the first syscall parameter.
1776 */
1777 regs->gpr[3] = -ENOSYS;
1778
1779 /*
1780 * We use the __ version here because we have already checked
1781 * TIF_SECCOMP. If this fails, there is nothing left to do, we
1782 * have already loaded -ENOSYS into r3, or seccomp has put
1783 * something else in r3 (via SECCOMP_RET_ERRNO/TRACE).
1784 */
1785 if (__secure_computing())
1786 return -1;
1787
1788 /*
1789 * The syscall was allowed by seccomp, restore the register
1790 * state to what ptrace and audit expect.
1791 * Note that we use orig_gpr3, which means a seccomp tracer can
1792 * modify the first syscall parameter (in orig_gpr3) and also
1793 * allow the syscall to proceed.
1794 */
1795 regs->gpr[3] = regs->orig_gpr3;
1796
1797 return 0;
1798}
1799#else
1800static inline int do_seccomp(struct pt_regs *regs) { return 0; }
1801#endif /* CONFIG_SECCOMP */
1802
1803/**
1804 * do_syscall_trace_enter() - Do syscall tracing on kernel entry.
1805 * @regs: the pt_regs of the task to trace (current)
1806 *
1807 * Performs various types of tracing on syscall entry. This includes seccomp,
1808 * ptrace, syscall tracepoints and audit.
1809 *
1810 * The pt_regs are potentially visible to userspace via ptrace, so their
1811 * contents is ABI.
1812 *
1813 * One or more of the tracers may modify the contents of pt_regs, in particular
1814 * to modify arguments or even the syscall number itself.
1815 *
1816 * It's also possible that a tracer can choose to reject the system call. In
1817 * that case this function will return an illegal syscall number, and will put
1818 * an appropriate return value in regs->r3.
1819 *
1820 * Return: the (possibly changed) syscall number.
1768 */ 1821 */
1769long do_syscall_trace_enter(struct pt_regs *regs) 1822long do_syscall_trace_enter(struct pt_regs *regs)
1770{ 1823{
1771 long ret = 0; 1824 bool abort = false;
1772 1825
1773 user_exit(); 1826 user_exit();
1774 1827
1775 secure_computing_strict(regs->gpr[0]); 1828 if (do_seccomp(regs))
1829 return -1;
1776 1830
1777 if (test_thread_flag(TIF_SYSCALL_TRACE) && 1831 if (test_thread_flag(TIF_SYSCALL_TRACE)) {
1778 tracehook_report_syscall_entry(regs))
1779 /* 1832 /*
1780 * Tracing decided this syscall should not happen. 1833 * The tracer may decide to abort the syscall, if so tracehook
1781 * We'll return a bogus call number to get an ENOSYS 1834 * will return !0. Note that the tracer may also just change
1782 * error, but leave the original number in regs->gpr[0]. 1835 * regs->gpr[0] to an invalid syscall number, that is handled
1836 * below on the exit path.
1783 */ 1837 */
1784 ret = -1L; 1838 abort = tracehook_report_syscall_entry(regs) != 0;
1839 }
1785 1840
1786 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) 1841 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
1787 trace_sys_enter(regs, regs->gpr[0]); 1842 trace_sys_enter(regs, regs->gpr[0]);
@@ -1798,7 +1853,17 @@ long do_syscall_trace_enter(struct pt_regs *regs)
1798 regs->gpr[5] & 0xffffffff, 1853 regs->gpr[5] & 0xffffffff,
1799 regs->gpr[6] & 0xffffffff); 1854 regs->gpr[6] & 0xffffffff);
1800 1855
1801 return ret ?: regs->gpr[0]; 1856 if (abort || regs->gpr[0] >= NR_syscalls) {
1857 /*
1858 * If we are aborting explicitly, or if the syscall number is
1859 * now invalid, set the return value to -ENOSYS.
1860 */
1861 regs->gpr[3] = -ENOSYS;
1862 return -1;
1863 }
1864
1865 /* Return the possibly modified but valid syscall number */
1866 return regs->gpr[0];
1802} 1867}
1803 1868
1804void do_syscall_trace_leave(struct pt_regs *regs) 1869void do_syscall_trace_leave(struct pt_regs *regs)
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 7a488c108410..84bf934cf748 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -478,8 +478,9 @@ unsigned int rtas_busy_delay_time(int status)
478 478
479 if (status == RTAS_BUSY) { 479 if (status == RTAS_BUSY) {
480 ms = 1; 480 ms = 1;
481 } else if (status >= 9900 && status <= 9905) { 481 } else if (status >= RTAS_EXTENDED_DELAY_MIN &&
482 order = status - 9900; 482 status <= RTAS_EXTENDED_DELAY_MAX) {
483 order = status - RTAS_EXTENDED_DELAY_MIN;
483 for (ms = 1; order > 0; order--) 484 for (ms = 1; order > 0; order--)
484 ms *= 10; 485 ms *= 10;
485 } 486 }
@@ -584,6 +585,23 @@ int rtas_get_sensor(int sensor, int index, int *state)
584} 585}
585EXPORT_SYMBOL(rtas_get_sensor); 586EXPORT_SYMBOL(rtas_get_sensor);
586 587
588int rtas_get_sensor_fast(int sensor, int index, int *state)
589{
590 int token = rtas_token("get-sensor-state");
591 int rc;
592
593 if (token == RTAS_UNKNOWN_SERVICE)
594 return -ENOENT;
595
596 rc = rtas_call(token, 2, 2, state, sensor, index);
597 WARN_ON(rc == RTAS_BUSY || (rc >= RTAS_EXTENDED_DELAY_MIN &&
598 rc <= RTAS_EXTENDED_DELAY_MAX));
599
600 if (rc < 0)
601 return rtas_error_rc(rc);
602 return rc;
603}
604
587bool rtas_indicator_present(int token, int *maxindex) 605bool rtas_indicator_present(int token, int *maxindex)
588{ 606{
589 int proplen, count, i; 607 int proplen, count, i;
@@ -641,7 +659,8 @@ int rtas_set_indicator_fast(int indicator, int index, int new_value)
641 659
642 rc = rtas_call(token, 3, 1, NULL, indicator, index, new_value); 660 rc = rtas_call(token, 3, 1, NULL, indicator, index, new_value);
643 661
644 WARN_ON(rc == -2 || (rc >= 9900 && rc <= 9905)); 662 WARN_ON(rc == RTAS_BUSY || (rc >= RTAS_EXTENDED_DELAY_MIN &&
663 rc <= RTAS_EXTENDED_DELAY_MAX));
645 664
646 if (rc < 0) 665 if (rc < 0)
647 return rtas_error_rc(rc); 666 return rtas_error_rc(rc);
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index da50e0c9c57e..0dbee465af7a 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -949,6 +949,11 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *d, const siginfo_t *s)
949 err |= __put_user(s->si_overrun, &d->si_overrun); 949 err |= __put_user(s->si_overrun, &d->si_overrun);
950 err |= __put_user(s->si_int, &d->si_int); 950 err |= __put_user(s->si_int, &d->si_int);
951 break; 951 break;
952 case __SI_SYS >> 16:
953 err |= __put_user(ptr_to_compat(s->si_call_addr), &d->si_call_addr);
954 err |= __put_user(s->si_syscall, &d->si_syscall);
955 err |= __put_user(s->si_arch, &d->si_arch);
956 break;
952 case __SI_RT >> 16: /* This is not generated by the kernel as of now. */ 957 case __SI_RT >> 16: /* This is not generated by the kernel as of now. */
953 case __SI_MESGQ >> 16: 958 case __SI_MESGQ >> 16:
954 err |= __put_user(s->si_int, &d->si_int); 959 err |= __put_user(s->si_int, &d->si_int);
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index c7c24d2e2bdb..20756dfb9f34 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -74,6 +74,19 @@ static const char fmt64[] = KERN_INFO \
74 "%s[%d]: bad frame in %s: %016lx nip %016lx lr %016lx\n"; 74 "%s[%d]: bad frame in %s: %016lx nip %016lx lr %016lx\n";
75 75
76/* 76/*
77 * This computes a quad word aligned pointer inside the vmx_reserve array
78 * element. For historical reasons sigcontext might not be quad word aligned,
79 * but the location we write the VMX regs to must be. See the comment in
80 * sigcontext for more detail.
81 */
82#ifdef CONFIG_ALTIVEC
83static elf_vrreg_t __user *sigcontext_vmx_regs(struct sigcontext __user *sc)
84{
85 return (elf_vrreg_t __user *) (((unsigned long)sc->vmx_reserve + 15) & ~0xful);
86}
87#endif
88
89/*
77 * Set up the sigcontext for the signal frame. 90 * Set up the sigcontext for the signal frame.
78 */ 91 */
79 92
@@ -90,7 +103,7 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
90 * v_regs pointer or not 103 * v_regs pointer or not
91 */ 104 */
92#ifdef CONFIG_ALTIVEC 105#ifdef CONFIG_ALTIVEC
93 elf_vrreg_t __user *v_regs = (elf_vrreg_t __user *)(((unsigned long)sc->vmx_reserve + 15) & ~0xful); 106 elf_vrreg_t __user *v_regs = sigcontext_vmx_regs(sc);
94#endif 107#endif
95 unsigned long msr = regs->msr; 108 unsigned long msr = regs->msr;
96 long err = 0; 109 long err = 0;
@@ -181,10 +194,8 @@ static long setup_tm_sigcontexts(struct sigcontext __user *sc,
181 * v_regs pointer or not. 194 * v_regs pointer or not.
182 */ 195 */
183#ifdef CONFIG_ALTIVEC 196#ifdef CONFIG_ALTIVEC
184 elf_vrreg_t __user *v_regs = (elf_vrreg_t __user *) 197 elf_vrreg_t __user *v_regs = sigcontext_vmx_regs(sc);
185 (((unsigned long)sc->vmx_reserve + 15) & ~0xful); 198 elf_vrreg_t __user *tm_v_regs = sigcontext_vmx_regs(tm_sc);
186 elf_vrreg_t __user *tm_v_regs = (elf_vrreg_t __user *)
187 (((unsigned long)tm_sc->vmx_reserve + 15) & ~0xful);
188#endif 199#endif
189 unsigned long msr = regs->msr; 200 unsigned long msr = regs->msr;
190 long err = 0; 201 long err = 0;
diff --git a/arch/powerpc/kernel/trace_clock.c b/arch/powerpc/kernel/trace_clock.c
new file mode 100644
index 000000000000..49170690946d
--- /dev/null
+++ b/arch/powerpc/kernel/trace_clock.c
@@ -0,0 +1,15 @@
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, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * Copyright (C) 2015 Naveen N. Rao, IBM Corporation
7 */
8
9#include <asm/trace_clock.h>
10#include <asm/time.h>
11
12u64 notrace trace_clock_ppc_tb(void)
13{
14 return get_tb();
15}
diff --git a/arch/powerpc/lib/checksum_32.S b/arch/powerpc/lib/checksum_32.S
index 7874e8a80455..6d67e057f15e 100644
--- a/arch/powerpc/lib/checksum_32.S
+++ b/arch/powerpc/lib/checksum_32.S
@@ -41,22 +41,6 @@ _GLOBAL(ip_fast_csum)
41 blr 41 blr
42 42
43/* 43/*
44 * Compute checksum of TCP or UDP pseudo-header:
45 * csum_tcpudp_magic(saddr, daddr, len, proto, sum)
46 */
47_GLOBAL(csum_tcpudp_magic)
48 rlwimi r5,r6,16,0,15 /* put proto in upper half of len */
49 addc r0,r3,r4 /* add 4 32-bit words together */
50 adde r0,r0,r5
51 adde r0,r0,r7
52 addze r0,r0 /* add in final carry */
53 rlwinm r3,r0,16,0,31 /* fold two halves together */
54 add r3,r0,r3
55 not r3,r3
56 srwi r3,r3,16
57 blr
58
59/*
60 * computes the checksum of a memory block at buff, length len, 44 * computes the checksum of a memory block at buff, length len,
61 * and adds in "sum" (32-bit) 45 * and adds in "sum" (32-bit)
62 * 46 *
diff --git a/arch/powerpc/lib/checksum_64.S b/arch/powerpc/lib/checksum_64.S
index 57a072065057..f3ef35436612 100644
--- a/arch/powerpc/lib/checksum_64.S
+++ b/arch/powerpc/lib/checksum_64.S
@@ -45,27 +45,6 @@ _GLOBAL(ip_fast_csum)
45 blr 45 blr
46 46
47/* 47/*
48 * Compute checksum of TCP or UDP pseudo-header:
49 * csum_tcpudp_magic(r3=saddr, r4=daddr, r5=len, r6=proto, r7=sum)
50 * No real gain trying to do this specially for 64 bit, but
51 * the 32 bit addition may spill into the upper bits of
52 * the doubleword so we still must fold it down from 64.
53 */
54_GLOBAL(csum_tcpudp_magic)
55 rlwimi r5,r6,16,0,15 /* put proto in upper half of len */
56 addc r0,r3,r4 /* add 4 32-bit words together */
57 adde r0,r0,r5
58 adde r0,r0,r7
59 rldicl r4,r0,32,0 /* fold 64 bit value */
60 add r0,r4,r0
61 srdi r0,r0,32
62 rlwinm r3,r0,16,0,31 /* fold two halves together */
63 add r3,r0,r3
64 not r3,r3
65 srwi r3,r3,16
66 blr
67
68/*
69 * Computes the checksum of a memory block at buff, length len, 48 * Computes the checksum of a memory block at buff, length len,
70 * and adds in "sum" (32-bit). 49 * and adds in "sum" (32-bit).
71 * 50 *
diff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S
index 6813f80d1eec..2ef50c629470 100644
--- a/arch/powerpc/lib/copy_32.S
+++ b/arch/powerpc/lib/copy_32.S
@@ -69,9 +69,15 @@ CACHELINE_BYTES = L1_CACHE_BYTES
69LG_CACHELINE_BYTES = L1_CACHE_SHIFT 69LG_CACHELINE_BYTES = L1_CACHE_SHIFT
70CACHELINE_MASK = (L1_CACHE_BYTES-1) 70CACHELINE_MASK = (L1_CACHE_BYTES-1)
71 71
72/*
73 * Use dcbz on the complete cache lines in the destination
74 * to set them to zero. This requires that the destination
75 * area is cacheable. -- paulus
76 */
72_GLOBAL(memset) 77_GLOBAL(memset)
73 rlwimi r4,r4,8,16,23 78 rlwimi r4,r4,8,16,23
74 rlwimi r4,r4,16,0,15 79 rlwimi r4,r4,16,0,15
80
75 addi r6,r3,-4 81 addi r6,r3,-4
76 cmplwi 0,r5,4 82 cmplwi 0,r5,4
77 blt 7f 83 blt 7f
@@ -80,7 +86,29 @@ _GLOBAL(memset)
80 andi. r0,r6,3 86 andi. r0,r6,3
81 add r5,r0,r5 87 add r5,r0,r5
82 subf r6,r0,r6 88 subf r6,r0,r6
83 srwi r0,r5,2 89 cmplwi 0,r4,0
90 bne 2f /* Use normal procedure if r4 is not zero */
91
92 clrlwi r7,r6,32-LG_CACHELINE_BYTES
93 add r8,r7,r5
94 srwi r9,r8,LG_CACHELINE_BYTES
95 addic. r9,r9,-1 /* total number of complete cachelines */
96 ble 2f
97 xori r0,r7,CACHELINE_MASK & ~3
98 srwi. r0,r0,2
99 beq 3f
100 mtctr r0
1014: stwu r4,4(r6)
102 bdnz 4b
1033: mtctr r9
104 li r7,4
10510: dcbz r7,r6
106 addi r6,r6,CACHELINE_BYTES
107 bdnz 10b
108 clrlwi r5,r8,32-LG_CACHELINE_BYTES
109 addi r5,r5,4
110
1112: srwi r0,r5,2
84 mtctr r0 112 mtctr r0
85 bdz 6f 113 bdz 6f
861: stwu r4,4(r6) 1141: stwu r4,4(r6)
@@ -94,12 +122,91 @@ _GLOBAL(memset)
94 bdnz 8b 122 bdnz 8b
95 blr 123 blr
96 124
125/*
126 * This version uses dcbz on the complete cache lines in the
127 * destination area to reduce memory traffic. This requires that
128 * the destination area is cacheable.
129 * We only use this version if the source and dest don't overlap.
130 * -- paulus.
131 */
97_GLOBAL(memmove) 132_GLOBAL(memmove)
98 cmplw 0,r3,r4 133 cmplw 0,r3,r4
99 bgt backwards_memcpy 134 bgt backwards_memcpy
100 /* fall through */ 135 /* fall through */
101 136
102_GLOBAL(memcpy) 137_GLOBAL(memcpy)
138 add r7,r3,r5 /* test if the src & dst overlap */
139 add r8,r4,r5
140 cmplw 0,r4,r7
141 cmplw 1,r3,r8
142 crand 0,0,4 /* cr0.lt &= cr1.lt */
143 blt generic_memcpy /* if regions overlap */
144
145 addi r4,r4,-4
146 addi r6,r3,-4
147 neg r0,r3
148 andi. r0,r0,CACHELINE_MASK /* # bytes to start of cache line */
149 beq 58f
150
151 cmplw 0,r5,r0 /* is this more than total to do? */
152 blt 63f /* if not much to do */
153 andi. r8,r0,3 /* get it word-aligned first */
154 subf r5,r0,r5
155 mtctr r8
156 beq+ 61f
15770: lbz r9,4(r4) /* do some bytes */
158 addi r4,r4,1
159 addi r6,r6,1
160 stb r9,3(r6)
161 bdnz 70b
16261: srwi. r0,r0,2
163 mtctr r0
164 beq 58f
16572: lwzu r9,4(r4) /* do some words */
166 stwu r9,4(r6)
167 bdnz 72b
168
16958: srwi. r0,r5,LG_CACHELINE_BYTES /* # complete cachelines */
170 clrlwi r5,r5,32-LG_CACHELINE_BYTES
171 li r11,4
172 mtctr r0
173 beq 63f
17453:
175 dcbz r11,r6
176 COPY_16_BYTES
177#if L1_CACHE_BYTES >= 32
178 COPY_16_BYTES
179#if L1_CACHE_BYTES >= 64
180 COPY_16_BYTES
181 COPY_16_BYTES
182#if L1_CACHE_BYTES >= 128
183 COPY_16_BYTES
184 COPY_16_BYTES
185 COPY_16_BYTES
186 COPY_16_BYTES
187#endif
188#endif
189#endif
190 bdnz 53b
191
19263: srwi. r0,r5,2
193 mtctr r0
194 beq 64f
19530: lwzu r0,4(r4)
196 stwu r0,4(r6)
197 bdnz 30b
198
19964: andi. r0,r5,3
200 mtctr r0
201 beq+ 65f
202 addi r4,r4,3
203 addi r6,r6,3
20440: lbzu r0,1(r4)
205 stbu r0,1(r6)
206 bdnz 40b
20765: blr
208
209_GLOBAL(generic_memcpy)
103 srwi. r7,r5,3 210 srwi. r7,r5,3
104 addi r6,r3,-4 211 addi r6,r3,-4
105 addi r4,r4,-4 212 addi r4,r4,-4
diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
index 9c90e66cffb6..354ba3c09ef3 100644
--- a/arch/powerpc/mm/fsl_booke_mmu.c
+++ b/arch/powerpc/mm/fsl_booke_mmu.c
@@ -112,7 +112,7 @@ static void settlbcam(int index, unsigned long virt, phys_addr_t phys,
112 112
113 tsize = __ilog2(size) - 10; 113 tsize = __ilog2(size) - 10;
114 114
115#ifdef CONFIG_SMP 115#if defined(CONFIG_SMP) || defined(CONFIG_PPC_E500MC)
116 if ((flags & _PAGE_NO_CACHE) == 0) 116 if ((flags & _PAGE_NO_CACHE) == 0)
117 flags |= _PAGE_COHERENT; 117 flags |= _PAGE_COHERENT;
118#endif 118#endif
diff --git a/arch/powerpc/mm/hash_low_64.S b/arch/powerpc/mm/hash_low_64.S
index 463174a4a647..3b49e3295901 100644
--- a/arch/powerpc/mm/hash_low_64.S
+++ b/arch/powerpc/mm/hash_low_64.S
@@ -701,7 +701,7 @@ htab_pte_insert_failure:
701 701
702#endif /* CONFIG_PPC_64K_PAGES */ 702#endif /* CONFIG_PPC_64K_PAGES */
703 703
704#ifdef CONFIG_PPC_HAS_HASH_64K 704#ifdef CONFIG_PPC_64K_PAGES
705 705
706/***************************************************************************** 706/*****************************************************************************
707 * * 707 * *
@@ -993,7 +993,7 @@ ht64_pte_insert_failure:
993 b ht64_bail 993 b ht64_bail
994 994
995 995
996#endif /* CONFIG_PPC_HAS_HASH_64K */ 996#endif /* CONFIG_PPC_64K_PAGES */
997 997
998 998
999/***************************************************************************** 999/*****************************************************************************
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 5ec987f65b2c..aee70171355b 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -640,7 +640,7 @@ extern u32 ht64_call_hpte_updatepp[];
640 640
641static void __init htab_finish_init(void) 641static void __init htab_finish_init(void)
642{ 642{
643#ifdef CONFIG_PPC_HAS_HASH_64K 643#ifdef CONFIG_PPC_64K_PAGES
644 patch_branch(ht64_call_hpte_insert1, 644 patch_branch(ht64_call_hpte_insert1,
645 ppc_function_entry(ppc_md.hpte_insert), 645 ppc_function_entry(ppc_md.hpte_insert),
646 BRANCH_SET_LINK); 646 BRANCH_SET_LINK);
@@ -653,7 +653,7 @@ static void __init htab_finish_init(void)
653 patch_branch(ht64_call_hpte_updatepp, 653 patch_branch(ht64_call_hpte_updatepp,
654 ppc_function_entry(ppc_md.hpte_updatepp), 654 ppc_function_entry(ppc_md.hpte_updatepp),
655 BRANCH_SET_LINK); 655 BRANCH_SET_LINK);
656#endif /* CONFIG_PPC_HAS_HASH_64K */ 656#endif /* CONFIG_PPC_64K_PAGES */
657 657
658 patch_branch(htab_call_hpte_insert1, 658 patch_branch(htab_call_hpte_insert1,
659 ppc_function_entry(ppc_md.hpte_insert), 659 ppc_function_entry(ppc_md.hpte_insert),
@@ -1151,12 +1151,12 @@ int hash_page_mm(struct mm_struct *mm, unsigned long ea,
1151 check_paca_psize(ea, mm, psize, user_region); 1151 check_paca_psize(ea, mm, psize, user_region);
1152#endif /* CONFIG_PPC_64K_PAGES */ 1152#endif /* CONFIG_PPC_64K_PAGES */
1153 1153
1154#ifdef CONFIG_PPC_HAS_HASH_64K 1154#ifdef CONFIG_PPC_64K_PAGES
1155 if (psize == MMU_PAGE_64K) 1155 if (psize == MMU_PAGE_64K)
1156 rc = __hash_page_64K(ea, access, vsid, ptep, trap, 1156 rc = __hash_page_64K(ea, access, vsid, ptep, trap,
1157 flags, ssize); 1157 flags, ssize);
1158 else 1158 else
1159#endif /* CONFIG_PPC_HAS_HASH_64K */ 1159#endif /* CONFIG_PPC_64K_PAGES */
1160 { 1160 {
1161 int spp = subpage_protection(mm, ea); 1161 int spp = subpage_protection(mm, ea);
1162 if (access & spp) 1162 if (access & spp)
@@ -1264,12 +1264,12 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
1264 update_flags |= HPTE_LOCAL_UPDATE; 1264 update_flags |= HPTE_LOCAL_UPDATE;
1265 1265
1266 /* Hash it in */ 1266 /* Hash it in */
1267#ifdef CONFIG_PPC_HAS_HASH_64K 1267#ifdef CONFIG_PPC_64K_PAGES
1268 if (mm->context.user_psize == MMU_PAGE_64K) 1268 if (mm->context.user_psize == MMU_PAGE_64K)
1269 rc = __hash_page_64K(ea, access, vsid, ptep, trap, 1269 rc = __hash_page_64K(ea, access, vsid, ptep, trap,
1270 update_flags, ssize); 1270 update_flags, ssize);
1271 else 1271 else
1272#endif /* CONFIG_PPC_HAS_HASH_64K */ 1272#endif /* CONFIG_PPC_64K_PAGES */
1273 rc = __hash_page_4K(ea, access, vsid, ptep, trap, update_flags, 1273 rc = __hash_page_4K(ea, access, vsid, ptep, trap, update_flags,
1274 ssize, subpage_protection(mm, ea)); 1274 ssize, subpage_protection(mm, ea));
1275 1275
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index bb0bd7025cb8..06c14523b787 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -808,14 +808,6 @@ static int __init add_huge_page_size(unsigned long long size)
808 if ((mmu_psize = shift_to_mmu_psize(shift)) < 0) 808 if ((mmu_psize = shift_to_mmu_psize(shift)) < 0)
809 return -EINVAL; 809 return -EINVAL;
810 810
811#ifdef CONFIG_SPU_FS_64K_LS
812 /* Disable support for 64K huge pages when 64K SPU local store
813 * support is enabled as the current implementation conflicts.
814 */
815 if (shift == PAGE_SHIFT_64K)
816 return -EINVAL;
817#endif /* CONFIG_SPU_FS_64K_LS */
818
819 BUG_ON(mmu_psize_defs[mmu_psize].shift != shift); 811 BUG_ON(mmu_psize_defs[mmu_psize].shift != shift);
820 812
821 /* Return if huge page size has already been setup */ 813 /* Return if huge page size has already been setup */
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 0f11819d8f1d..e1fe333da946 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -414,17 +414,17 @@ void flush_dcache_icache_page(struct page *page)
414 return; 414 return;
415 } 415 }
416#endif 416#endif
417#ifdef CONFIG_BOOKE 417#if defined(CONFIG_8xx) || defined(CONFIG_PPC64)
418 { 418 /* On 8xx there is no need to kmap since highmem is not supported */
419 __flush_dcache_icache(page_address(page));
420#else
421 if (IS_ENABLED(CONFIG_BOOKE) || sizeof(phys_addr_t) > sizeof(void *)) {
419 void *start = kmap_atomic(page); 422 void *start = kmap_atomic(page);
420 __flush_dcache_icache(start); 423 __flush_dcache_icache(start);
421 kunmap_atomic(start); 424 kunmap_atomic(start);
425 } else {
426 __flush_dcache_icache_phys(page_to_pfn(page) << PAGE_SHIFT);
422 } 427 }
423#elif defined(CONFIG_8xx) || defined(CONFIG_PPC64)
424 /* On 8xx there is no need to kmap since highmem is not supported */
425 __flush_dcache_icache(page_address(page));
426#else
427 __flush_dcache_icache_phys(page_to_pfn(page) << PAGE_SHIFT);
428#endif 428#endif
429} 429}
430EXPORT_SYMBOL(flush_dcache_icache_page); 430EXPORT_SYMBOL(flush_dcache_icache_page);
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 5e80621d9324..8b9502adaf79 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -225,7 +225,7 @@ static void initialize_distance_lookup_table(int nid,
225 for (i = 0; i < distance_ref_points_depth; i++) { 225 for (i = 0; i < distance_ref_points_depth; i++) {
226 const __be32 *entry; 226 const __be32 *entry;
227 227
228 entry = &associativity[be32_to_cpu(distance_ref_points[i])]; 228 entry = &associativity[be32_to_cpu(distance_ref_points[i]) - 1];
229 distance_lookup_table[nid][i] = of_read_number(entry, 1); 229 distance_lookup_table[nid][i] = of_read_number(entry, 1);
230 } 230 }
231} 231}
@@ -248,8 +248,12 @@ static int associativity_to_nid(const __be32 *associativity)
248 nid = -1; 248 nid = -1;
249 249
250 if (nid > 0 && 250 if (nid > 0 &&
251 of_read_number(associativity, 1) >= distance_ref_points_depth) 251 of_read_number(associativity, 1) >= distance_ref_points_depth) {
252 initialize_distance_lookup_table(nid, associativity); 252 /*
253 * Skip the length field and send start of associativity array
254 */
255 initialize_distance_lookup_table(nid, associativity + 1);
256 }
253 257
254out: 258out:
255 return nid; 259 return nid;
@@ -507,6 +511,12 @@ static int of_drconf_to_nid_single(struct of_drconf_cell *drmem,
507 511
508 if (nid == 0xffff || nid >= MAX_NUMNODES) 512 if (nid == 0xffff || nid >= MAX_NUMNODES)
509 nid = default_nid; 513 nid = default_nid;
514
515 if (nid > 0) {
516 index = drmem->aa_index * aa->array_sz;
517 initialize_distance_lookup_table(nid,
518 &aa->arrays[index]);
519 }
510 } 520 }
511 521
512 return nid; 522 return nid;
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index 876232d64126..e92cb2146b18 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -149,17 +149,7 @@ int map_kernel_page(unsigned long ea, unsigned long pa, int flags)
149#endif /* !CONFIG_PPC_MMU_NOHASH */ 149#endif /* !CONFIG_PPC_MMU_NOHASH */
150 } 150 }
151 151
152#ifdef CONFIG_PPC_BOOK3E_64
153 /*
154 * With hardware tablewalk, a sync is needed to ensure that
155 * subsequent accesses see the PTE we just wrote. Unlike userspace
156 * mappings, we can't tolerate spurious faults, so make sure
157 * the new PTE will be seen the first time.
158 */
159 mb();
160#else
161 smp_wmb(); 152 smp_wmb();
162#endif
163 return 0; 153 return 0;
164} 154}
165 155
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index 6e450ca66526..8a32a2be3c53 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -41,9 +41,9 @@ static void slb_allocate(unsigned long ea)
41 (((ssize) == MMU_SEGSIZE_256M)? ESID_MASK: ESID_MASK_1T) 41 (((ssize) == MMU_SEGSIZE_256M)? ESID_MASK: ESID_MASK_1T)
42 42
43static inline unsigned long mk_esid_data(unsigned long ea, int ssize, 43static inline unsigned long mk_esid_data(unsigned long ea, int ssize,
44 unsigned long slot) 44 unsigned long entry)
45{ 45{
46 return (ea & slb_esid_mask(ssize)) | SLB_ESID_V | slot; 46 return (ea & slb_esid_mask(ssize)) | SLB_ESID_V | entry;
47} 47}
48 48
49static inline unsigned long mk_vsid_data(unsigned long ea, int ssize, 49static inline unsigned long mk_vsid_data(unsigned long ea, int ssize,
@@ -249,11 +249,24 @@ void switch_slb(struct task_struct *tsk, struct mm_struct *mm)
249static inline void patch_slb_encoding(unsigned int *insn_addr, 249static inline void patch_slb_encoding(unsigned int *insn_addr,
250 unsigned int immed) 250 unsigned int immed)
251{ 251{
252 int insn = (*insn_addr & 0xffff0000) | immed; 252
253 /*
254 * This function patches either an li or a cmpldi instruction with
255 * a new immediate value. This relies on the fact that both li
256 * (which is actually addi) and cmpldi both take a 16-bit immediate
257 * value, and it is situated in the same location in the instruction,
258 * ie. bits 16-31 (Big endian bit order) or the lower 16 bits.
259 * The signedness of the immediate operand differs between the two
260 * instructions however this code is only ever patching a small value,
261 * much less than 1 << 15, so we can get away with it.
262 * To patch the value we read the existing instruction, clear the
263 * immediate value, and or in our new value, then write the instruction
264 * back.
265 */
266 unsigned int insn = (*insn_addr & 0xffff0000) | immed;
253 patch_instruction(insn_addr, insn); 267 patch_instruction(insn_addr, insn);
254} 268}
255 269
256extern u32 slb_compare_rr_to_size[];
257extern u32 slb_miss_kernel_load_linear[]; 270extern u32 slb_miss_kernel_load_linear[];
258extern u32 slb_miss_kernel_load_io[]; 271extern u32 slb_miss_kernel_load_io[];
259extern u32 slb_compare_rr_to_size[]; 272extern u32 slb_compare_rr_to_size[];
@@ -309,12 +322,11 @@ void slb_initialize(void)
309 lflags = SLB_VSID_KERNEL | linear_llp; 322 lflags = SLB_VSID_KERNEL | linear_llp;
310 vflags = SLB_VSID_KERNEL | vmalloc_llp; 323 vflags = SLB_VSID_KERNEL | vmalloc_llp;
311 324
312 /* Invalidate the entire SLB (even slot 0) & all the ERATS */ 325 /* Invalidate the entire SLB (even entry 0) & all the ERATS */
313 asm volatile("isync":::"memory"); 326 asm volatile("isync":::"memory");
314 asm volatile("slbmte %0,%0"::"r" (0) : "memory"); 327 asm volatile("slbmte %0,%0"::"r" (0) : "memory");
315 asm volatile("isync; slbia; isync":::"memory"); 328 asm volatile("isync; slbia; isync":::"memory");
316 create_shadowed_slbe(PAGE_OFFSET, mmu_kernel_ssize, lflags, 0); 329 create_shadowed_slbe(PAGE_OFFSET, mmu_kernel_ssize, lflags, 0);
317
318 create_shadowed_slbe(VMALLOC_START, mmu_kernel_ssize, vflags, 1); 330 create_shadowed_slbe(VMALLOC_START, mmu_kernel_ssize, vflags, 1);
319 331
320 /* For the boot cpu, we're running on the stack in init_thread_union, 332 /* For the boot cpu, we're running on the stack in init_thread_union,
diff --git a/arch/powerpc/mm/tlb_low_64e.S b/arch/powerpc/mm/tlb_low_64e.S
index 765b419883f2..e4185581c5a7 100644
--- a/arch/powerpc/mm/tlb_low_64e.S
+++ b/arch/powerpc/mm/tlb_low_64e.S
@@ -308,11 +308,11 @@ BEGIN_FTR_SECTION /* CPU_FTR_SMT */
308 * 308 *
309 * MAS6:IND should be already set based on MAS4 309 * MAS6:IND should be already set based on MAS4
310 */ 310 */
3111: lbarx r15,0,r11
312 lhz r10,PACAPACAINDEX(r13) 311 lhz r10,PACAPACAINDEX(r13)
313 cmpdi r15,0
314 cmpdi cr1,r15,1 /* set cr1.eq = 0 for non-recursive */
315 addi r10,r10,1 312 addi r10,r10,1
313 crclr cr1*4+eq /* set cr1.eq = 0 for non-recursive */
3141: lbarx r15,0,r11
315 cmpdi r15,0
316 bne 2f 316 bne 2f
317 stbcx. r10,0,r11 317 stbcx. r10,0,r11
318 bne 1b 318 bne 1b
@@ -320,9 +320,9 @@ BEGIN_FTR_SECTION /* CPU_FTR_SMT */
320 .subsection 1 320 .subsection 1
3212: cmpd cr1,r15,r10 /* recursive lock due to mcheck/crit/etc? */ 3212: cmpd cr1,r15,r10 /* recursive lock due to mcheck/crit/etc? */
322 beq cr1,3b /* unlock will happen if cr1.eq = 0 */ 322 beq cr1,3b /* unlock will happen if cr1.eq = 0 */
323 lbz r15,0(r11) 32310: lbz r15,0(r11)
324 cmpdi r15,0 324 cmpdi r15,0
325 bne 2b 325 bne 10b
326 b 1b 326 b 1b
327 .previous 327 .previous
328 328
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
index 962fe7b3e3fb..4b32e9404bbe 100644
--- a/arch/powerpc/oprofile/op_model_power4.c
+++ b/arch/powerpc/oprofile/op_model_power4.c
@@ -207,7 +207,7 @@ static int power4_start(struct op_counter_config *ctr)
207 unsigned int mmcr0; 207 unsigned int mmcr0;
208 208
209 /* set the PMM bit (see comment below) */ 209 /* set the PMM bit (see comment below) */
210 mtmsrd(mfmsr() | MSR_PMM); 210 mtmsr(mfmsr() | MSR_PMM);
211 211
212 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i) { 212 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i) {
213 if (ctr[i].enabled) { 213 if (ctr[i].enabled) {
@@ -377,7 +377,7 @@ static void power4_handle_interrupt(struct pt_regs *regs,
377 is_kernel = get_kernel(pc, mmcra); 377 is_kernel = get_kernel(pc, mmcra);
378 378
379 /* set the PMM bit (see comment below) */ 379 /* set the PMM bit (see comment below) */
380 mtmsrd(mfmsr() | MSR_PMM); 380 mtmsr(mfmsr() | MSR_PMM);
381 381
382 /* Check that the SIAR valid bit in MMCRA is set to 1. */ 382 /* Check that the SIAR valid bit in MMCRA is set to 1. */
383 if ((mmcra & MMCRA_SIAR_VALID_MASK) == MMCRA_SIAR_VALID_MASK) 383 if ((mmcra & MMCRA_SIAR_VALID_MASK) == MMCRA_SIAR_VALID_MASK)
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index d90893b76e7c..b0382f3f1095 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -53,7 +53,7 @@ struct cpu_hw_events {
53 53
54 /* BHRB bits */ 54 /* BHRB bits */
55 u64 bhrb_filter; /* BHRB HW branch filter */ 55 u64 bhrb_filter; /* BHRB HW branch filter */
56 int bhrb_users; 56 unsigned int bhrb_users;
57 void *bhrb_context; 57 void *bhrb_context;
58 struct perf_branch_stack bhrb_stack; 58 struct perf_branch_stack bhrb_stack;
59 struct perf_branch_entry bhrb_entries[BHRB_MAX_ENTRIES]; 59 struct perf_branch_entry bhrb_entries[BHRB_MAX_ENTRIES];
@@ -369,8 +369,8 @@ static void power_pmu_bhrb_disable(struct perf_event *event)
369 if (!ppmu->bhrb_nr) 369 if (!ppmu->bhrb_nr)
370 return; 370 return;
371 371
372 WARN_ON_ONCE(!cpuhw->bhrb_users);
372 cpuhw->bhrb_users--; 373 cpuhw->bhrb_users--;
373 WARN_ON_ONCE(cpuhw->bhrb_users < 0);
374 perf_sched_cb_dec(event->ctx->pmu); 374 perf_sched_cb_dec(event->ctx->pmu);
375 375
376 if (!cpuhw->disabled && !cpuhw->bhrb_users) { 376 if (!cpuhw->disabled && !cpuhw->bhrb_users) {
diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
index df956295c2a7..527c8b98e97e 100644
--- a/arch/powerpc/perf/hv-24x7.c
+++ b/arch/powerpc/perf/hv-24x7.c
@@ -416,7 +416,7 @@ out_val:
416} 416}
417 417
418static struct attribute *event_to_desc_attr(struct hv_24x7_event_data *event, 418static struct attribute *event_to_desc_attr(struct hv_24x7_event_data *event,
419 int nonce) 419 int nonce)
420{ 420{
421 int nl, dl; 421 int nl, dl;
422 char *name = event_name(event, &nl); 422 char *name = event_name(event, &nl);
@@ -444,7 +444,7 @@ event_to_long_desc_attr(struct hv_24x7_event_data *event, int nonce)
444} 444}
445 445
446static ssize_t event_data_to_attrs(unsigned ix, struct attribute **attrs, 446static ssize_t event_data_to_attrs(unsigned ix, struct attribute **attrs,
447 struct hv_24x7_event_data *event, int nonce) 447 struct hv_24x7_event_data *event, int nonce)
448{ 448{
449 unsigned i; 449 unsigned i;
450 450
@@ -512,7 +512,7 @@ static int memord(const void *d1, size_t s1, const void *d2, size_t s2)
512} 512}
513 513
514static int ev_uniq_ord(const void *v1, size_t s1, unsigned d1, const void *v2, 514static int ev_uniq_ord(const void *v1, size_t s1, unsigned d1, const void *v2,
515 size_t s2, unsigned d2) 515 size_t s2, unsigned d2)
516{ 516{
517 int r = memord(v1, s1, v2, s2); 517 int r = memord(v1, s1, v2, s2);
518 518
@@ -526,7 +526,7 @@ static int ev_uniq_ord(const void *v1, size_t s1, unsigned d1, const void *v2,
526} 526}
527 527
528static int event_uniq_add(struct rb_root *root, const char *name, int nl, 528static int event_uniq_add(struct rb_root *root, const char *name, int nl,
529 unsigned domain) 529 unsigned domain)
530{ 530{
531 struct rb_node **new = &(root->rb_node), *parent = NULL; 531 struct rb_node **new = &(root->rb_node), *parent = NULL;
532 struct event_uniq *data; 532 struct event_uniq *data;
@@ -650,8 +650,8 @@ static ssize_t catalog_event_len_validate(struct hv_24x7_event_data *event,
650#define MAX_4K (SIZE_MAX / 4096) 650#define MAX_4K (SIZE_MAX / 4096)
651 651
652static int create_events_from_catalog(struct attribute ***events_, 652static int create_events_from_catalog(struct attribute ***events_,
653 struct attribute ***event_descs_, 653 struct attribute ***event_descs_,
654 struct attribute ***event_long_descs_) 654 struct attribute ***event_long_descs_)
655{ 655{
656 unsigned long hret; 656 unsigned long hret;
657 size_t catalog_len, catalog_page_len, event_entry_count, 657 size_t catalog_len, catalog_page_len, event_entry_count,
@@ -1008,8 +1008,8 @@ static const struct attribute_group *attr_groups[] = {
1008}; 1008};
1009 1009
1010static void log_24x7_hcall(struct hv_24x7_request_buffer *request_buffer, 1010static void log_24x7_hcall(struct hv_24x7_request_buffer *request_buffer,
1011 struct hv_24x7_data_result_buffer *result_buffer, 1011 struct hv_24x7_data_result_buffer *result_buffer,
1012 unsigned long ret) 1012 unsigned long ret)
1013{ 1013{
1014 struct hv_24x7_request *req; 1014 struct hv_24x7_request *req;
1015 1015
@@ -1026,7 +1026,7 @@ static void log_24x7_hcall(struct hv_24x7_request_buffer *request_buffer,
1026 * Start the process for a new H_GET_24x7_DATA hcall. 1026 * Start the process for a new H_GET_24x7_DATA hcall.
1027 */ 1027 */
1028static void init_24x7_request(struct hv_24x7_request_buffer *request_buffer, 1028static void init_24x7_request(struct hv_24x7_request_buffer *request_buffer,
1029 struct hv_24x7_data_result_buffer *result_buffer) 1029 struct hv_24x7_data_result_buffer *result_buffer)
1030{ 1030{
1031 1031
1032 memset(request_buffer, 0, 4096); 1032 memset(request_buffer, 0, 4096);
@@ -1041,7 +1041,7 @@ static void init_24x7_request(struct hv_24x7_request_buffer *request_buffer,
1041 * by 'init_24x7_request()' and 'add_event_to_24x7_request()'. 1041 * by 'init_24x7_request()' and 'add_event_to_24x7_request()'.
1042 */ 1042 */
1043static int make_24x7_request(struct hv_24x7_request_buffer *request_buffer, 1043static int make_24x7_request(struct hv_24x7_request_buffer *request_buffer,
1044 struct hv_24x7_data_result_buffer *result_buffer) 1044 struct hv_24x7_data_result_buffer *result_buffer)
1045{ 1045{
1046 unsigned long ret; 1046 unsigned long ret;
1047 1047
@@ -1104,7 +1104,6 @@ static unsigned long single_24x7_request(struct perf_event *event, u64 *count)
1104 unsigned long ret; 1104 unsigned long ret;
1105 struct hv_24x7_request_buffer *request_buffer; 1105 struct hv_24x7_request_buffer *request_buffer;
1106 struct hv_24x7_data_result_buffer *result_buffer; 1106 struct hv_24x7_data_result_buffer *result_buffer;
1107 struct hv_24x7_result *resb;
1108 1107
1109 BUILD_BUG_ON(sizeof(*request_buffer) > 4096); 1108 BUILD_BUG_ON(sizeof(*request_buffer) > 4096);
1110 BUILD_BUG_ON(sizeof(*result_buffer) > 4096); 1109 BUILD_BUG_ON(sizeof(*result_buffer) > 4096);
@@ -1125,8 +1124,7 @@ static unsigned long single_24x7_request(struct perf_event *event, u64 *count)
1125 } 1124 }
1126 1125
1127 /* process result from hcall */ 1126 /* process result from hcall */
1128 resb = &result_buffer->results[0]; 1127 *count = be64_to_cpu(result_buffer->results[0].elements[0].element_data[0]);
1129 *count = be64_to_cpu(resb->elements[0].element_data[0]);
1130 1128
1131out: 1129out:
1132 put_cpu_var(hv_24x7_reqb); 1130 put_cpu_var(hv_24x7_reqb);
diff --git a/arch/powerpc/platforms/512x/Kconfig b/arch/powerpc/platforms/512x/Kconfig
index 5aa3f4b5332c..48bf38d0de35 100644
--- a/arch/powerpc/platforms/512x/Kconfig
+++ b/arch/powerpc/platforms/512x/Kconfig
@@ -7,8 +7,8 @@ config PPC_MPC512x
7 select PPC_PCI_CHOICE 7 select PPC_PCI_CHOICE
8 select FSL_PCI if PCI 8 select FSL_PCI if PCI
9 select ARCH_WANT_OPTIONAL_GPIOLIB 9 select ARCH_WANT_OPTIONAL_GPIOLIB
10 select USB_EHCI_BIG_ENDIAN_MMIO 10 select USB_EHCI_BIG_ENDIAN_MMIO if USB_EHCI_HCD
11 select USB_EHCI_BIG_ENDIAN_DESC 11 select USB_EHCI_BIG_ENDIAN_DESC if USB_EHCI_HCD
12 12
13config MPC5121_ADS 13config MPC5121_ADS
14 bool "Freescale MPC5121E ADS" 14 bool "Freescale MPC5121E ADS"
diff --git a/arch/powerpc/platforms/85xx/c293pcie.c b/arch/powerpc/platforms/85xx/c293pcie.c
index 84476b646005..61bc851e9a8e 100644
--- a/arch/powerpc/platforms/85xx/c293pcie.c
+++ b/arch/powerpc/platforms/85xx/c293pcie.c
@@ -66,10 +66,6 @@ define_machine(c293_pcie) {
66 .probe = c293_pcie_probe, 66 .probe = c293_pcie_probe,
67 .setup_arch = c293_pcie_setup_arch, 67 .setup_arch = c293_pcie_setup_arch,
68 .init_IRQ = c293_pcie_pic_init, 68 .init_IRQ = c293_pcie_pic_init,
69#ifdef CONFIG_PCI
70 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
71 .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
72#endif
73 .get_irq = mpic_get_irq, 69 .get_irq = mpic_get_irq,
74 .restart = fsl_rstcr_restart, 70 .restart = fsl_rstcr_restart,
75 .calibrate_decr = generic_calibrate_decr, 71 .calibrate_decr = generic_calibrate_decr,
diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c
index bd839dc287fe..b39557120cbb 100644
--- a/arch/powerpc/platforms/85xx/corenet_generic.c
+++ b/arch/powerpc/platforms/85xx/corenet_generic.c
@@ -153,6 +153,8 @@ static const char * const boards[] __initconst = {
153 "fsl,T1023RDB", 153 "fsl,T1023RDB",
154 "fsl,T1024QDS", 154 "fsl,T1024QDS",
155 "fsl,T1024RDB", 155 "fsl,T1024RDB",
156 "fsl,T1040D4RDB",
157 "fsl,T1042D4RDB",
156 "fsl,T1040QDS", 158 "fsl,T1040QDS",
157 "fsl,T1042QDS", 159 "fsl,T1042QDS",
158 "fsl,T1040RDB", 160 "fsl,T1040RDB",
diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig
index 2f23133ab3d1..b0ac1773cea6 100644
--- a/arch/powerpc/platforms/cell/Kconfig
+++ b/arch/powerpc/platforms/cell/Kconfig
@@ -57,21 +57,6 @@ config SPU_FS
57 Units on machines implementing the Broadband Processor 57 Units on machines implementing the Broadband Processor
58 Architecture. 58 Architecture.
59 59
60config SPU_FS_64K_LS
61 bool "Use 64K pages to map SPE local store"
62 # we depend on PPC_MM_SLICES for now rather than selecting
63 # it because we depend on hugetlbfs hooks being present. We
64 # will fix that when the generic code has been improved to
65 # not require hijacking hugetlbfs hooks.
66 depends on SPU_FS && PPC_MM_SLICES && !PPC_64K_PAGES
67 default y
68 select PPC_HAS_HASH_64K
69 help
70 This option causes SPE local stores to be mapped in process
71 address spaces using 64K pages while the rest of the kernel
72 uses 4K pages. This can improve performances of applications
73 using multiple SPEs by lowering the TLB pressure on them.
74
75config SPU_BASE 60config SPU_BASE
76 bool 61 bool
77 default n 62 default n
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index d966bbe58b8f..5038fd578e65 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -239,23 +239,6 @@ spufs_mem_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
239 unsigned long address = (unsigned long)vmf->virtual_address; 239 unsigned long address = (unsigned long)vmf->virtual_address;
240 unsigned long pfn, offset; 240 unsigned long pfn, offset;
241 241
242#ifdef CONFIG_SPU_FS_64K_LS
243 struct spu_state *csa = &ctx->csa;
244 int psize;
245
246 /* Check what page size we are using */
247 psize = get_slice_psize(vma->vm_mm, address);
248
249 /* Some sanity checking */
250 BUG_ON(csa->use_big_pages != (psize == MMU_PAGE_64K));
251
252 /* Wow, 64K, cool, we need to align the address though */
253 if (csa->use_big_pages) {
254 BUG_ON(vma->vm_start & 0xffff);
255 address &= ~0xfffful;
256 }
257#endif /* CONFIG_SPU_FS_64K_LS */
258
259 offset = vmf->pgoff << PAGE_SHIFT; 242 offset = vmf->pgoff << PAGE_SHIFT;
260 if (offset >= LS_SIZE) 243 if (offset >= LS_SIZE)
261 return VM_FAULT_SIGBUS; 244 return VM_FAULT_SIGBUS;
@@ -310,22 +293,6 @@ static const struct vm_operations_struct spufs_mem_mmap_vmops = {
310 293
311static int spufs_mem_mmap(struct file *file, struct vm_area_struct *vma) 294static int spufs_mem_mmap(struct file *file, struct vm_area_struct *vma)
312{ 295{
313#ifdef CONFIG_SPU_FS_64K_LS
314 struct spu_context *ctx = file->private_data;
315 struct spu_state *csa = &ctx->csa;
316
317 /* Sanity check VMA alignment */
318 if (csa->use_big_pages) {
319 pr_debug("spufs_mem_mmap 64K, start=0x%lx, end=0x%lx,"
320 " pgoff=0x%lx\n", vma->vm_start, vma->vm_end,
321 vma->vm_pgoff);
322 if (vma->vm_start & 0xffff)
323 return -EINVAL;
324 if (vma->vm_pgoff & 0xf)
325 return -EINVAL;
326 }
327#endif /* CONFIG_SPU_FS_64K_LS */
328
329 if (!(vma->vm_flags & VM_SHARED)) 296 if (!(vma->vm_flags & VM_SHARED))
330 return -EINVAL; 297 return -EINVAL;
331 298
@@ -336,25 +303,6 @@ static int spufs_mem_mmap(struct file *file, struct vm_area_struct *vma)
336 return 0; 303 return 0;
337} 304}
338 305
339#ifdef CONFIG_SPU_FS_64K_LS
340static unsigned long spufs_get_unmapped_area(struct file *file,
341 unsigned long addr, unsigned long len, unsigned long pgoff,
342 unsigned long flags)
343{
344 struct spu_context *ctx = file->private_data;
345 struct spu_state *csa = &ctx->csa;
346
347 /* If not using big pages, fallback to normal MM g_u_a */
348 if (!csa->use_big_pages)
349 return current->mm->get_unmapped_area(file, addr, len,
350 pgoff, flags);
351
352 /* Else, try to obtain a 64K pages slice */
353 return slice_get_unmapped_area(addr, len, flags,
354 MMU_PAGE_64K, 1);
355}
356#endif /* CONFIG_SPU_FS_64K_LS */
357
358static const struct file_operations spufs_mem_fops = { 306static const struct file_operations spufs_mem_fops = {
359 .open = spufs_mem_open, 307 .open = spufs_mem_open,
360 .release = spufs_mem_release, 308 .release = spufs_mem_release,
@@ -362,9 +310,6 @@ static const struct file_operations spufs_mem_fops = {
362 .write = spufs_mem_write, 310 .write = spufs_mem_write,
363 .llseek = generic_file_llseek, 311 .llseek = generic_file_llseek,
364 .mmap = spufs_mem_mmap, 312 .mmap = spufs_mem_mmap,
365#ifdef CONFIG_SPU_FS_64K_LS
366 .get_unmapped_area = spufs_get_unmapped_area,
367#endif
368}; 313};
369 314
370static int spufs_ps_fault(struct vm_area_struct *vma, 315static int spufs_ps_fault(struct vm_area_struct *vma,
diff --git a/arch/powerpc/platforms/cell/spufs/lscsa_alloc.c b/arch/powerpc/platforms/cell/spufs/lscsa_alloc.c
index 147069938cfe..b847e9403566 100644
--- a/arch/powerpc/platforms/cell/spufs/lscsa_alloc.c
+++ b/arch/powerpc/platforms/cell/spufs/lscsa_alloc.c
@@ -31,7 +31,7 @@
31 31
32#include "spufs.h" 32#include "spufs.h"
33 33
34static int spu_alloc_lscsa_std(struct spu_state *csa) 34int spu_alloc_lscsa(struct spu_state *csa)
35{ 35{
36 struct spu_lscsa *lscsa; 36 struct spu_lscsa *lscsa;
37 unsigned char *p; 37 unsigned char *p;
@@ -48,7 +48,7 @@ static int spu_alloc_lscsa_std(struct spu_state *csa)
48 return 0; 48 return 0;
49} 49}
50 50
51static void spu_free_lscsa_std(struct spu_state *csa) 51void spu_free_lscsa(struct spu_state *csa)
52{ 52{
53 /* Clear reserved bit before vfree. */ 53 /* Clear reserved bit before vfree. */
54 unsigned char *p; 54 unsigned char *p;
@@ -61,123 +61,3 @@ static void spu_free_lscsa_std(struct spu_state *csa)
61 61
62 vfree(csa->lscsa); 62 vfree(csa->lscsa);
63} 63}
64
65#ifdef CONFIG_SPU_FS_64K_LS
66
67#define SPU_64K_PAGE_SHIFT 16
68#define SPU_64K_PAGE_ORDER (SPU_64K_PAGE_SHIFT - PAGE_SHIFT)
69#define SPU_64K_PAGE_COUNT (1ul << SPU_64K_PAGE_ORDER)
70
71int spu_alloc_lscsa(struct spu_state *csa)
72{
73 struct page **pgarray;
74 unsigned char *p;
75 int i, j, n_4k;
76
77 /* Check availability of 64K pages */
78 if (!spu_64k_pages_available())
79 goto fail;
80
81 csa->use_big_pages = 1;
82
83 pr_debug("spu_alloc_lscsa(csa=0x%p), trying to allocate 64K pages\n",
84 csa);
85
86 /* First try to allocate our 64K pages. We need 5 of them
87 * with the current implementation. In the future, we should try
88 * to separate the lscsa with the actual local store image, thus
89 * allowing us to require only 4 64K pages per context
90 */
91 for (i = 0; i < SPU_LSCSA_NUM_BIG_PAGES; i++) {
92 /* XXX This is likely to fail, we should use a special pool
93 * similar to what hugetlbfs does.
94 */
95 csa->lscsa_pages[i] = alloc_pages(GFP_KERNEL,
96 SPU_64K_PAGE_ORDER);
97 if (csa->lscsa_pages[i] == NULL)
98 goto fail;
99 }
100
101 pr_debug(" success ! creating vmap...\n");
102
103 /* Now we need to create a vmalloc mapping of these for the kernel
104 * and SPU context switch code to use. Currently, we stick to a
105 * normal kernel vmalloc mapping, which in our case will be 4K
106 */
107 n_4k = SPU_64K_PAGE_COUNT * SPU_LSCSA_NUM_BIG_PAGES;
108 pgarray = kmalloc(sizeof(struct page *) * n_4k, GFP_KERNEL);
109 if (pgarray == NULL)
110 goto fail;
111 for (i = 0; i < SPU_LSCSA_NUM_BIG_PAGES; i++)
112 for (j = 0; j < SPU_64K_PAGE_COUNT; j++)
113 /* We assume all the struct page's are contiguous
114 * which should be hopefully the case for an order 4
115 * allocation..
116 */
117 pgarray[i * SPU_64K_PAGE_COUNT + j] =
118 csa->lscsa_pages[i] + j;
119 csa->lscsa = vmap(pgarray, n_4k, VM_USERMAP, PAGE_KERNEL);
120 kfree(pgarray);
121 if (csa->lscsa == NULL)
122 goto fail;
123
124 memset(csa->lscsa, 0, sizeof(struct spu_lscsa));
125
126 /* Set LS pages reserved to allow for user-space mapping.
127 *
128 * XXX isn't that a bit obsolete ? I think we should just
129 * make sure the page count is high enough. Anyway, won't harm
130 * for now
131 */
132 for (p = csa->lscsa->ls; p < csa->lscsa->ls + LS_SIZE; p += PAGE_SIZE)
133 SetPageReserved(vmalloc_to_page(p));
134
135 pr_debug(" all good !\n");
136
137 return 0;
138fail:
139 pr_debug("spufs: failed to allocate lscsa 64K pages, falling back\n");
140 spu_free_lscsa(csa);
141 return spu_alloc_lscsa_std(csa);
142}
143
144void spu_free_lscsa(struct spu_state *csa)
145{
146 unsigned char *p;
147 int i;
148
149 if (!csa->use_big_pages) {
150 spu_free_lscsa_std(csa);
151 return;
152 }
153 csa->use_big_pages = 0;
154
155 if (csa->lscsa == NULL)
156 goto free_pages;
157
158 for (p = csa->lscsa->ls; p < csa->lscsa->ls + LS_SIZE; p += PAGE_SIZE)
159 ClearPageReserved(vmalloc_to_page(p));
160
161 vunmap(csa->lscsa);
162 csa->lscsa = NULL;
163
164 free_pages:
165
166 for (i = 0; i < SPU_LSCSA_NUM_BIG_PAGES; i++)
167 if (csa->lscsa_pages[i])
168 __free_pages(csa->lscsa_pages[i], SPU_64K_PAGE_ORDER);
169}
170
171#else /* CONFIG_SPU_FS_64K_LS */
172
173int spu_alloc_lscsa(struct spu_state *csa)
174{
175 return spu_alloc_lscsa_std(csa);
176}
177
178void spu_free_lscsa(struct spu_state *csa)
179{
180 spu_free_lscsa_std(csa);
181}
182
183#endif /* !defined(CONFIG_SPU_FS_64K_LS) */
diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
index 7cf0df859d05..3bb6acb76339 100644
--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -1394,11 +1394,19 @@ static int pnv_eeh_next_error(struct eeh_pe **pe)
1394 */ 1394 */
1395 if (pnv_eeh_get_pe(hose, 1395 if (pnv_eeh_get_pe(hose,
1396 be64_to_cpu(frozen_pe_no), pe)) { 1396 be64_to_cpu(frozen_pe_no), pe)) {
1397 /* Try best to clear it */
1398 pr_info("EEH: Clear non-existing PHB#%x-PE#%llx\n", 1397 pr_info("EEH: Clear non-existing PHB#%x-PE#%llx\n",
1399 hose->global_number, frozen_pe_no); 1398 hose->global_number, be64_to_cpu(frozen_pe_no));
1400 pr_info("EEH: PHB location: %s\n", 1399 pr_info("EEH: PHB location: %s\n",
1401 eeh_pe_loc_get(phb_pe)); 1400 eeh_pe_loc_get(phb_pe));
1401
1402 /* Dump PHB diag-data */
1403 rc = opal_pci_get_phb_diag_data2(phb->opal_id,
1404 phb->diag.blob, PNV_PCI_DIAG_BUF_SIZE);
1405 if (rc == OPAL_SUCCESS)
1406 pnv_pci_dump_phb_diag_data(hose,
1407 phb->diag.blob);
1408
1409 /* Try best to clear it */
1402 opal_pci_eeh_freeze_clear(phb->opal_id, 1410 opal_pci_eeh_freeze_clear(phb->opal_id,
1403 frozen_pe_no, 1411 frozen_pe_no,
1404 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL); 1412 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
diff --git a/arch/powerpc/platforms/powernv/opal-hmi.c b/arch/powerpc/platforms/powernv/opal-hmi.c
index a8f49d380449..d000f4e21981 100644
--- a/arch/powerpc/platforms/powernv/opal-hmi.c
+++ b/arch/powerpc/platforms/powernv/opal-hmi.c
@@ -35,9 +35,134 @@ struct OpalHmiEvtNode {
35 struct list_head list; 35 struct list_head list;
36 struct OpalHMIEvent hmi_evt; 36 struct OpalHMIEvent hmi_evt;
37}; 37};
38
39struct xstop_reason {
40 uint32_t xstop_reason;
41 const char *unit_failed;
42 const char *description;
43};
44
38static LIST_HEAD(opal_hmi_evt_list); 45static LIST_HEAD(opal_hmi_evt_list);
39static DEFINE_SPINLOCK(opal_hmi_evt_lock); 46static DEFINE_SPINLOCK(opal_hmi_evt_lock);
40 47
48static void print_core_checkstop_reason(const char *level,
49 struct OpalHMIEvent *hmi_evt)
50{
51 int i;
52 static const struct xstop_reason xstop_reason[] = {
53 { CORE_CHECKSTOP_IFU_REGFILE, "IFU",
54 "RegFile core check stop" },
55 { CORE_CHECKSTOP_IFU_LOGIC, "IFU", "Logic core check stop" },
56 { CORE_CHECKSTOP_PC_DURING_RECOV, "PC",
57 "Core checkstop during recovery" },
58 { CORE_CHECKSTOP_ISU_REGFILE, "ISU",
59 "RegFile core check stop (mapper error)" },
60 { CORE_CHECKSTOP_ISU_LOGIC, "ISU", "Logic core check stop" },
61 { CORE_CHECKSTOP_FXU_LOGIC, "FXU", "Logic core check stop" },
62 { CORE_CHECKSTOP_VSU_LOGIC, "VSU", "Logic core check stop" },
63 { CORE_CHECKSTOP_PC_RECOV_IN_MAINT_MODE, "PC",
64 "Recovery in maintenance mode" },
65 { CORE_CHECKSTOP_LSU_REGFILE, "LSU",
66 "RegFile core check stop" },
67 { CORE_CHECKSTOP_PC_FWD_PROGRESS, "PC",
68 "Forward Progress Error" },
69 { CORE_CHECKSTOP_LSU_LOGIC, "LSU", "Logic core check stop" },
70 { CORE_CHECKSTOP_PC_LOGIC, "PC", "Logic core check stop" },
71 { CORE_CHECKSTOP_PC_HYP_RESOURCE, "PC",
72 "Hypervisor Resource error - core check stop" },
73 { CORE_CHECKSTOP_PC_HANG_RECOV_FAILED, "PC",
74 "Hang Recovery Failed (core check stop)" },
75 { CORE_CHECKSTOP_PC_AMBI_HANG_DETECTED, "PC",
76 "Ambiguous Hang Detected (unknown source)" },
77 { CORE_CHECKSTOP_PC_DEBUG_TRIG_ERR_INJ, "PC",
78 "Debug Trigger Error inject" },
79 { CORE_CHECKSTOP_PC_SPRD_HYP_ERR_INJ, "PC",
80 "Hypervisor check stop via SPRC/SPRD" },
81 };
82
83 /* Validity check */
84 if (!hmi_evt->u.xstop_error.xstop_reason) {
85 printk("%s Unknown Core check stop.\n", level);
86 return;
87 }
88
89 printk("%s CPU PIR: %08x\n", level,
90 be32_to_cpu(hmi_evt->u.xstop_error.u.pir));
91 for (i = 0; i < ARRAY_SIZE(xstop_reason); i++)
92 if (be32_to_cpu(hmi_evt->u.xstop_error.xstop_reason) &
93 xstop_reason[i].xstop_reason)
94 printk("%s [Unit: %-3s] %s\n", level,
95 xstop_reason[i].unit_failed,
96 xstop_reason[i].description);
97}
98
99static void print_nx_checkstop_reason(const char *level,
100 struct OpalHMIEvent *hmi_evt)
101{
102 int i;
103 static const struct xstop_reason xstop_reason[] = {
104 { NX_CHECKSTOP_SHM_INVAL_STATE_ERR, "DMA & Engine",
105 "SHM invalid state error" },
106 { NX_CHECKSTOP_DMA_INVAL_STATE_ERR_1, "DMA & Engine",
107 "DMA invalid state error bit 15" },
108 { NX_CHECKSTOP_DMA_INVAL_STATE_ERR_2, "DMA & Engine",
109 "DMA invalid state error bit 16" },
110 { NX_CHECKSTOP_DMA_CH0_INVAL_STATE_ERR, "DMA & Engine",
111 "Channel 0 invalid state error" },
112 { NX_CHECKSTOP_DMA_CH1_INVAL_STATE_ERR, "DMA & Engine",
113 "Channel 1 invalid state error" },
114 { NX_CHECKSTOP_DMA_CH2_INVAL_STATE_ERR, "DMA & Engine",
115 "Channel 2 invalid state error" },
116 { NX_CHECKSTOP_DMA_CH3_INVAL_STATE_ERR, "DMA & Engine",
117 "Channel 3 invalid state error" },
118 { NX_CHECKSTOP_DMA_CH4_INVAL_STATE_ERR, "DMA & Engine",
119 "Channel 4 invalid state error" },
120 { NX_CHECKSTOP_DMA_CH5_INVAL_STATE_ERR, "DMA & Engine",
121 "Channel 5 invalid state error" },
122 { NX_CHECKSTOP_DMA_CH6_INVAL_STATE_ERR, "DMA & Engine",
123 "Channel 6 invalid state error" },
124 { NX_CHECKSTOP_DMA_CH7_INVAL_STATE_ERR, "DMA & Engine",
125 "Channel 7 invalid state error" },
126 { NX_CHECKSTOP_DMA_CRB_UE, "DMA & Engine",
127 "UE error on CRB(CSB address, CCB)" },
128 { NX_CHECKSTOP_DMA_CRB_SUE, "DMA & Engine",
129 "SUE error on CRB(CSB address, CCB)" },
130 { NX_CHECKSTOP_PBI_ISN_UE, "PowerBus Interface",
131 "CRB Kill ISN received while holding ISN with UE error" },
132 };
133
134 /* Validity check */
135 if (!hmi_evt->u.xstop_error.xstop_reason) {
136 printk("%s Unknown NX check stop.\n", level);
137 return;
138 }
139
140 printk("%s NX checkstop on CHIP ID: %x\n", level,
141 be32_to_cpu(hmi_evt->u.xstop_error.u.chip_id));
142 for (i = 0; i < ARRAY_SIZE(xstop_reason); i++)
143 if (be32_to_cpu(hmi_evt->u.xstop_error.xstop_reason) &
144 xstop_reason[i].xstop_reason)
145 printk("%s [Unit: %-3s] %s\n", level,
146 xstop_reason[i].unit_failed,
147 xstop_reason[i].description);
148}
149
150static void print_checkstop_reason(const char *level,
151 struct OpalHMIEvent *hmi_evt)
152{
153 switch (hmi_evt->u.xstop_error.xstop_type) {
154 case CHECKSTOP_TYPE_CORE:
155 print_core_checkstop_reason(level, hmi_evt);
156 break;
157 case CHECKSTOP_TYPE_NX:
158 print_nx_checkstop_reason(level, hmi_evt);
159 break;
160 case CHECKSTOP_TYPE_UNKNOWN:
161 printk("%s Unknown Malfunction Alert.\n", level);
162 break;
163 }
164}
165
41static void print_hmi_event_info(struct OpalHMIEvent *hmi_evt) 166static void print_hmi_event_info(struct OpalHMIEvent *hmi_evt)
42{ 167{
43 const char *level, *sevstr, *error_info; 168 const char *level, *sevstr, *error_info;
@@ -95,6 +220,13 @@ static void print_hmi_event_info(struct OpalHMIEvent *hmi_evt)
95 (hmi_evt->type == OpalHMI_ERROR_TFMR_PARITY)) 220 (hmi_evt->type == OpalHMI_ERROR_TFMR_PARITY))
96 printk("%s TFMR: %016llx\n", level, 221 printk("%s TFMR: %016llx\n", level,
97 be64_to_cpu(hmi_evt->tfmr)); 222 be64_to_cpu(hmi_evt->tfmr));
223
224 if (hmi_evt->version < OpalHMIEvt_V2)
225 return;
226
227 /* OpalHMIEvt_V2 and above provides reason for malfunction alert. */
228 if (hmi_evt->type == OpalHMI_ERROR_MALFUNC_ALERT)
229 print_checkstop_reason(level, hmi_evt);
98} 230}
99 231
100static void hmi_event_handler(struct work_struct *work) 232static void hmi_event_handler(struct work_struct *work)
@@ -103,6 +235,8 @@ static void hmi_event_handler(struct work_struct *work)
103 struct OpalHMIEvent *hmi_evt; 235 struct OpalHMIEvent *hmi_evt;
104 struct OpalHmiEvtNode *msg_node; 236 struct OpalHmiEvtNode *msg_node;
105 uint8_t disposition; 237 uint8_t disposition;
238 struct opal_msg msg;
239 int unrecoverable = 0;
106 240
107 spin_lock_irqsave(&opal_hmi_evt_lock, flags); 241 spin_lock_irqsave(&opal_hmi_evt_lock, flags);
108 while (!list_empty(&opal_hmi_evt_list)) { 242 while (!list_empty(&opal_hmi_evt_list)) {
@@ -118,14 +252,53 @@ static void hmi_event_handler(struct work_struct *work)
118 252
119 /* 253 /*
120 * Check if HMI event has been recovered or not. If not 254 * Check if HMI event has been recovered or not. If not
121 * then we can't continue, invoke panic. 255 * then kernel can't continue, we need to panic.
256 * But before we do that, display all the HMI event
257 * available on the list and set unrecoverable flag to 1.
122 */ 258 */
123 if (disposition != OpalHMI_DISPOSITION_RECOVERED) 259 if (disposition != OpalHMI_DISPOSITION_RECOVERED)
124 panic("Unrecoverable HMI exception"); 260 unrecoverable = 1;
125 261
126 spin_lock_irqsave(&opal_hmi_evt_lock, flags); 262 spin_lock_irqsave(&opal_hmi_evt_lock, flags);
127 } 263 }
128 spin_unlock_irqrestore(&opal_hmi_evt_lock, flags); 264 spin_unlock_irqrestore(&opal_hmi_evt_lock, flags);
265
266 if (unrecoverable) {
267 int ret;
268
269 /* Pull all HMI events from OPAL before we panic. */
270 while (opal_get_msg(__pa(&msg), sizeof(msg)) == OPAL_SUCCESS) {
271 u32 type;
272
273 type = be32_to_cpu(msg.msg_type);
274
275 /* skip if not HMI event */
276 if (type != OPAL_MSG_HMI_EVT)
277 continue;
278
279 /* HMI event info starts from param[0] */
280 hmi_evt = (struct OpalHMIEvent *)&msg.params[0];
281 print_hmi_event_info(hmi_evt);
282 }
283
284 /*
285 * Unrecoverable HMI exception. We need to inform BMC/OCC
286 * about this error so that it can collect relevant data
287 * for error analysis before rebooting.
288 */
289 ret = opal_cec_reboot2(OPAL_REBOOT_PLATFORM_ERROR,
290 "Unrecoverable HMI exception");
291 if (ret == OPAL_UNSUPPORTED) {
292 pr_emerg("Reboot type %d not supported\n",
293 OPAL_REBOOT_PLATFORM_ERROR);
294 }
295
296 /*
297 * Fall through and panic if opal_cec_reboot2() returns
298 * OPAL_UNSUPPORTED.
299 */
300 panic("Unrecoverable HMI exception");
301 }
129} 302}
130 303
131static DECLARE_WORK(hmi_event_work, hmi_event_handler); 304static DECLARE_WORK(hmi_event_work, hmi_event_handler);
diff --git a/arch/powerpc/platforms/powernv/opal-power.c b/arch/powerpc/platforms/powernv/opal-power.c
index ac46c2c24f99..58dc3308237f 100644
--- a/arch/powerpc/platforms/powernv/opal-power.c
+++ b/arch/powerpc/platforms/powernv/opal-power.c
@@ -9,9 +9,12 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#define pr_fmt(fmt) "opal-power: " fmt
13
12#include <linux/kernel.h> 14#include <linux/kernel.h>
13#include <linux/reboot.h> 15#include <linux/reboot.h>
14#include <linux/notifier.h> 16#include <linux/notifier.h>
17#include <linux/of.h>
15 18
16#include <asm/opal.h> 19#include <asm/opal.h>
17#include <asm/machdep.h> 20#include <asm/machdep.h>
@@ -19,30 +22,116 @@
19#define SOFT_OFF 0x00 22#define SOFT_OFF 0x00
20#define SOFT_REBOOT 0x01 23#define SOFT_REBOOT 0x01
21 24
25/* Detect EPOW event */
26static bool detect_epow(void)
27{
28 u16 epow;
29 int i, rc;
30 __be16 epow_classes;
31 __be16 opal_epow_status[OPAL_SYSEPOW_MAX] = {0};
32
33 /*
34 * Check for EPOW event. Kernel sends supported EPOW classes info
35 * to OPAL. OPAL returns EPOW info along with classes present.
36 */
37 epow_classes = cpu_to_be16(OPAL_SYSEPOW_MAX);
38 rc = opal_get_epow_status(opal_epow_status, &epow_classes);
39 if (rc != OPAL_SUCCESS) {
40 pr_err("Failed to get EPOW event information\n");
41 return false;
42 }
43
44 /* Look for EPOW events present */
45 for (i = 0; i < be16_to_cpu(epow_classes); i++) {
46 epow = be16_to_cpu(opal_epow_status[i]);
47
48 /* Filter events which do not need shutdown. */
49 if (i == OPAL_SYSEPOW_POWER)
50 epow &= ~(OPAL_SYSPOWER_CHNG | OPAL_SYSPOWER_FAIL |
51 OPAL_SYSPOWER_INCL);
52 if (epow)
53 return true;
54 }
55
56 return false;
57}
58
59/* Check for existing EPOW, DPO events */
60static bool poweroff_pending(void)
61{
62 int rc;
63 __be64 opal_dpo_timeout;
64
65 /* Check for DPO event */
66 rc = opal_get_dpo_status(&opal_dpo_timeout);
67 if (rc == OPAL_SUCCESS) {
68 pr_info("Existing DPO event detected.\n");
69 return true;
70 }
71
72 /* Check for EPOW event */
73 if (detect_epow()) {
74 pr_info("Existing EPOW event detected.\n");
75 return true;
76 }
77
78 return false;
79}
80
81/* OPAL power-control events notifier */
22static int opal_power_control_event(struct notifier_block *nb, 82static int opal_power_control_event(struct notifier_block *nb,
23 unsigned long msg_type, void *msg) 83 unsigned long msg_type, void *msg)
24{ 84{
25 struct opal_msg *power_msg = msg;
26 uint64_t type; 85 uint64_t type;
27 86
28 type = be64_to_cpu(power_msg->params[0]); 87 switch (msg_type) {
29 88 case OPAL_MSG_EPOW:
30 switch (type) { 89 if (detect_epow()) {
31 case SOFT_REBOOT: 90 pr_info("EPOW msg received. Powering off system\n");
32 pr_info("OPAL: reboot requested\n"); 91 orderly_poweroff(true);
33 orderly_reboot(); 92 }
34 break; 93 break;
35 case SOFT_OFF: 94 case OPAL_MSG_DPO:
36 pr_info("OPAL: poweroff requested\n"); 95 pr_info("DPO msg received. Powering off system\n");
37 orderly_poweroff(true); 96 orderly_poweroff(true);
38 break; 97 break;
98 case OPAL_MSG_SHUTDOWN:
99 type = be64_to_cpu(((struct opal_msg *)msg)->params[0]);
100 switch (type) {
101 case SOFT_REBOOT:
102 pr_info("Reboot requested\n");
103 orderly_reboot();
104 break;
105 case SOFT_OFF:
106 pr_info("Poweroff requested\n");
107 orderly_poweroff(true);
108 break;
109 default:
110 pr_err("Unknown power-control type %llu\n", type);
111 }
112 break;
39 default: 113 default:
40 pr_err("OPAL: power control type unexpected %016llx\n", type); 114 pr_err("Unknown OPAL message type %lu\n", msg_type);
41 } 115 }
42 116
43 return 0; 117 return 0;
44} 118}
45 119
120/* OPAL EPOW event notifier block */
121static struct notifier_block opal_epow_nb = {
122 .notifier_call = opal_power_control_event,
123 .next = NULL,
124 .priority = 0,
125};
126
127/* OPAL DPO event notifier block */
128static struct notifier_block opal_dpo_nb = {
129 .notifier_call = opal_power_control_event,
130 .next = NULL,
131 .priority = 0,
132};
133
134/* OPAL power-control event notifier block */
46static struct notifier_block opal_power_control_nb = { 135static struct notifier_block opal_power_control_nb = {
47 .notifier_call = opal_power_control_event, 136 .notifier_call = opal_power_control_event,
48 .next = NULL, 137 .next = NULL,
@@ -51,16 +140,40 @@ static struct notifier_block opal_power_control_nb = {
51 140
52static int __init opal_power_control_init(void) 141static int __init opal_power_control_init(void)
53{ 142{
54 int ret; 143 int ret, supported = 0;
144 struct device_node *np;
55 145
146 /* Register OPAL power-control events notifier */
56 ret = opal_message_notifier_register(OPAL_MSG_SHUTDOWN, 147 ret = opal_message_notifier_register(OPAL_MSG_SHUTDOWN,
57 &opal_power_control_nb); 148 &opal_power_control_nb);
58 if (ret) { 149 if (ret)
59 pr_err("%s: Can't register OPAL event notifier (%d)\n", 150 pr_err("Failed to register SHUTDOWN notifier, ret = %d\n", ret);
60 __func__, ret); 151
61 return ret; 152 /* Determine OPAL EPOW, DPO support */
153 np = of_find_node_by_path("/ibm,opal/epow");
154 if (np) {
155 supported = of_device_is_compatible(np, "ibm,opal-v3-epow");
156 of_node_put(np);
62 } 157 }
63 158
159 if (!supported)
160 return 0;
161 pr_info("OPAL EPOW, DPO support detected.\n");
162
163 /* Register EPOW event notifier */
164 ret = opal_message_notifier_register(OPAL_MSG_EPOW, &opal_epow_nb);
165 if (ret)
166 pr_err("Failed to register EPOW notifier, ret = %d\n", ret);
167
168 /* Register DPO event notifier */
169 ret = opal_message_notifier_register(OPAL_MSG_DPO, &opal_dpo_nb);
170 if (ret)
171 pr_err("Failed to register DPO notifier, ret = %d\n", ret);
172
173 /* Check for any pending EPOW or DPO events. */
174 if (poweroff_pending())
175 orderly_poweroff(true);
176
64 return 0; 177 return 0;
65} 178}
66machine_subsys_initcall(powernv, opal_power_control_init); 179machine_subsys_initcall(powernv, opal_power_control_init);
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index d6a7b8252e4d..b7a464fef7a7 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -202,6 +202,7 @@ OPAL_CALL(opal_rtc_read, OPAL_RTC_READ);
202OPAL_CALL(opal_rtc_write, OPAL_RTC_WRITE); 202OPAL_CALL(opal_rtc_write, OPAL_RTC_WRITE);
203OPAL_CALL(opal_cec_power_down, OPAL_CEC_POWER_DOWN); 203OPAL_CALL(opal_cec_power_down, OPAL_CEC_POWER_DOWN);
204OPAL_CALL(opal_cec_reboot, OPAL_CEC_REBOOT); 204OPAL_CALL(opal_cec_reboot, OPAL_CEC_REBOOT);
205OPAL_CALL(opal_cec_reboot2, OPAL_CEC_REBOOT2);
205OPAL_CALL(opal_read_nvram, OPAL_READ_NVRAM); 206OPAL_CALL(opal_read_nvram, OPAL_READ_NVRAM);
206OPAL_CALL(opal_write_nvram, OPAL_WRITE_NVRAM); 207OPAL_CALL(opal_write_nvram, OPAL_WRITE_NVRAM);
207OPAL_CALL(opal_handle_interrupt, OPAL_HANDLE_INTERRUPT); 208OPAL_CALL(opal_handle_interrupt, OPAL_HANDLE_INTERRUPT);
@@ -249,6 +250,7 @@ OPAL_CALL(opal_pci_reinit, OPAL_PCI_REINIT);
249OPAL_CALL(opal_pci_mask_pe_error, OPAL_PCI_MASK_PE_ERROR); 250OPAL_CALL(opal_pci_mask_pe_error, OPAL_PCI_MASK_PE_ERROR);
250OPAL_CALL(opal_set_slot_led_status, OPAL_SET_SLOT_LED_STATUS); 251OPAL_CALL(opal_set_slot_led_status, OPAL_SET_SLOT_LED_STATUS);
251OPAL_CALL(opal_get_epow_status, OPAL_GET_EPOW_STATUS); 252OPAL_CALL(opal_get_epow_status, OPAL_GET_EPOW_STATUS);
253OPAL_CALL(opal_get_dpo_status, OPAL_GET_DPO_STATUS);
252OPAL_CALL(opal_set_system_attention_led, OPAL_SET_SYSTEM_ATTENTION_LED); 254OPAL_CALL(opal_set_system_attention_led, OPAL_SET_SYSTEM_ATTENTION_LED);
253OPAL_CALL(opal_pci_next_error, OPAL_PCI_NEXT_ERROR); 255OPAL_CALL(opal_pci_next_error, OPAL_PCI_NEXT_ERROR);
254OPAL_CALL(opal_pci_poll, OPAL_PCI_POLL); 256OPAL_CALL(opal_pci_poll, OPAL_PCI_POLL);
@@ -297,3 +299,5 @@ OPAL_CALL(opal_flash_read, OPAL_FLASH_READ);
297OPAL_CALL(opal_flash_write, OPAL_FLASH_WRITE); 299OPAL_CALL(opal_flash_write, OPAL_FLASH_WRITE);
298OPAL_CALL(opal_flash_erase, OPAL_FLASH_ERASE); 300OPAL_CALL(opal_flash_erase, OPAL_FLASH_ERASE);
299OPAL_CALL(opal_prd_msg, OPAL_PRD_MSG); 301OPAL_CALL(opal_prd_msg, OPAL_PRD_MSG);
302OPAL_CALL(opal_leds_get_ind, OPAL_LEDS_GET_INDICATOR);
303OPAL_CALL(opal_leds_set_ind, OPAL_LEDS_SET_INDICATOR);
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index f084afa0e3ba..230f3a7cdea4 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -441,6 +441,7 @@ static int opal_recover_mce(struct pt_regs *regs,
441int opal_machine_check(struct pt_regs *regs) 441int opal_machine_check(struct pt_regs *regs)
442{ 442{
443 struct machine_check_event evt; 443 struct machine_check_event evt;
444 int ret;
444 445
445 if (!get_mce_event(&evt, MCE_EVENT_RELEASE)) 446 if (!get_mce_event(&evt, MCE_EVENT_RELEASE))
446 return 0; 447 return 0;
@@ -455,6 +456,40 @@ int opal_machine_check(struct pt_regs *regs)
455 456
456 if (opal_recover_mce(regs, &evt)) 457 if (opal_recover_mce(regs, &evt))
457 return 1; 458 return 1;
459
460 /*
461 * Unrecovered machine check, we are heading to panic path.
462 *
463 * We may have hit this MCE in very early stage of kernel
464 * initialization even before opal-prd has started running. If
465 * this is the case then this MCE error may go un-noticed or
466 * un-analyzed if we go down panic path. We need to inform
467 * BMC/OCC about this error so that they can collect relevant
468 * data for error analysis before rebooting.
469 * Use opal_cec_reboot2(OPAL_REBOOT_PLATFORM_ERROR) to do so.
470 * This function may not return on BMC based system.
471 */
472 ret = opal_cec_reboot2(OPAL_REBOOT_PLATFORM_ERROR,
473 "Unrecoverable Machine Check exception");
474 if (ret == OPAL_UNSUPPORTED) {
475 pr_emerg("Reboot type %d not supported\n",
476 OPAL_REBOOT_PLATFORM_ERROR);
477 }
478
479 /*
480 * We reached here. There can be three possibilities:
481 * 1. We are running on a firmware level that do not support
482 * opal_cec_reboot2()
483 * 2. We are running on a firmware level that do not support
484 * OPAL_REBOOT_PLATFORM_ERROR reboot type.
485 * 3. We are running on FSP based system that does not need opal
486 * to trigger checkstop explicitly for error analysis. The FSP
487 * PRD component would have already got notified about this
488 * error through other channels.
489 *
490 * In any case, let us just fall through. We anyway heading
491 * down to panic path.
492 */
458 return 0; 493 return 0;
459} 494}
460 495
@@ -648,7 +683,7 @@ static void opal_init_heartbeat(void)
648 683
649static int __init opal_init(void) 684static int __init opal_init(void)
650{ 685{
651 struct device_node *np, *consoles; 686 struct device_node *np, *consoles, *leds;
652 int rc; 687 int rc;
653 688
654 opal_node = of_find_node_by_path("/ibm,opal"); 689 opal_node = of_find_node_by_path("/ibm,opal");
@@ -689,6 +724,13 @@ static int __init opal_init(void)
689 /* Setup a heatbeat thread if requested by OPAL */ 724 /* Setup a heatbeat thread if requested by OPAL */
690 opal_init_heartbeat(); 725 opal_init_heartbeat();
691 726
727 /* Create leds platform devices */
728 leds = of_find_node_by_path("/ibm,opal/leds");
729 if (leds) {
730 of_platform_device_create(leds, "opal_leds", NULL);
731 of_node_put(leds);
732 }
733
692 /* Create "opal" kobject under /sys/firmware */ 734 /* Create "opal" kobject under /sys/firmware */
693 rc = opal_sysfs_init(); 735 rc = opal_sysfs_init();
694 if (rc == 0) { 736 if (rc == 0) {
@@ -841,3 +883,6 @@ EXPORT_SYMBOL_GPL(opal_rtc_write);
841EXPORT_SYMBOL_GPL(opal_tpo_read); 883EXPORT_SYMBOL_GPL(opal_tpo_read);
842EXPORT_SYMBOL_GPL(opal_tpo_write); 884EXPORT_SYMBOL_GPL(opal_tpo_write);
843EXPORT_SYMBOL_GPL(opal_i2c_request); 885EXPORT_SYMBOL_GPL(opal_i2c_request);
886/* Export these symbols for PowerNV LED class driver */
887EXPORT_SYMBOL_GPL(opal_leds_get_ind);
888EXPORT_SYMBOL_GPL(opal_leds_set_ind);
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 85cbc96eff6c..2927cd5c8303 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -140,11 +140,9 @@ static void pnv_ioda_reserve_pe(struct pnv_phb *phb, int pe_no)
140 return; 140 return;
141 } 141 }
142 142
143 if (test_and_set_bit(pe_no, phb->ioda.pe_alloc)) { 143 if (test_and_set_bit(pe_no, phb->ioda.pe_alloc))
144 pr_warn("%s: PE %d was assigned on PHB#%x\n", 144 pr_debug("%s: PE %d was reserved on PHB#%x\n",
145 __func__, pe_no, phb->hose->global_number); 145 __func__, pe_no, phb->hose->global_number);
146 return;
147 }
148 146
149 phb->ioda.pe_array[pe_no].phb = phb; 147 phb->ioda.pe_array[pe_no].phb = phb;
150 phb->ioda.pe_array[pe_no].pe_number = pe_no; 148 phb->ioda.pe_array[pe_no].pe_number = pe_no;
@@ -231,61 +229,60 @@ fail:
231 return -EIO; 229 return -EIO;
232} 230}
233 231
234static void pnv_ioda2_reserve_m64_pe(struct pnv_phb *phb) 232static void pnv_ioda2_reserve_dev_m64_pe(struct pci_dev *pdev,
233 unsigned long *pe_bitmap)
235{ 234{
236 resource_size_t sgsz = phb->ioda.m64_segsize; 235 struct pci_controller *hose = pci_bus_to_host(pdev->bus);
237 struct pci_dev *pdev; 236 struct pnv_phb *phb = hose->private_data;
238 struct resource *r; 237 struct resource *r;
239 int base, step, i; 238 resource_size_t base, sgsz, start, end;
240 239 int segno, i;
241 /* 240
242 * Root bus always has full M64 range and root port has 241 base = phb->ioda.m64_base;
243 * M64 range used in reality. So we're checking root port 242 sgsz = phb->ioda.m64_segsize;
244 * instead of root bus. 243 for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
245 */ 244 r = &pdev->resource[i];
246 list_for_each_entry(pdev, &phb->hose->bus->devices, bus_list) { 245 if (!r->parent || !pnv_pci_is_mem_pref_64(r->flags))
247 for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++) { 246 continue;
248 r = &pdev->resource[PCI_BRIDGE_RESOURCES + i];
249 if (!r->parent ||
250 !pnv_pci_is_mem_pref_64(r->flags))
251 continue;
252 247
253 base = (r->start - phb->ioda.m64_base) / sgsz; 248 start = _ALIGN_DOWN(r->start - base, sgsz);
254 for (step = 0; step < resource_size(r) / sgsz; step++) 249 end = _ALIGN_UP(r->end - base, sgsz);
255 pnv_ioda_reserve_pe(phb, base + step); 250 for (segno = start / sgsz; segno < end / sgsz; segno++) {
251 if (pe_bitmap)
252 set_bit(segno, pe_bitmap);
253 else
254 pnv_ioda_reserve_pe(phb, segno);
256 } 255 }
257 } 256 }
258} 257}
259 258
260static int pnv_ioda2_pick_m64_pe(struct pnv_phb *phb, 259static void pnv_ioda2_reserve_m64_pe(struct pci_bus *bus,
261 struct pci_bus *bus, int all) 260 unsigned long *pe_bitmap,
261 bool all)
262{ 262{
263 resource_size_t segsz = phb->ioda.m64_segsize;
264 struct pci_dev *pdev; 263 struct pci_dev *pdev;
265 struct resource *r; 264
265 list_for_each_entry(pdev, &bus->devices, bus_list) {
266 pnv_ioda2_reserve_dev_m64_pe(pdev, pe_bitmap);
267
268 if (all && pdev->subordinate)
269 pnv_ioda2_reserve_m64_pe(pdev->subordinate,
270 pe_bitmap, all);
271 }
272}
273
274static int pnv_ioda2_pick_m64_pe(struct pci_bus *bus, bool all)
275{
276 struct pci_controller *hose = pci_bus_to_host(bus);
277 struct pnv_phb *phb = hose->private_data;
266 struct pnv_ioda_pe *master_pe, *pe; 278 struct pnv_ioda_pe *master_pe, *pe;
267 unsigned long size, *pe_alloc; 279 unsigned long size, *pe_alloc;
268 bool found; 280 int i;
269 int start, i, j;
270 281
271 /* Root bus shouldn't use M64 */ 282 /* Root bus shouldn't use M64 */
272 if (pci_is_root_bus(bus)) 283 if (pci_is_root_bus(bus))
273 return IODA_INVALID_PE; 284 return IODA_INVALID_PE;
274 285
275 /* We support only one M64 window on each bus */
276 found = false;
277 pci_bus_for_each_resource(bus, r, i) {
278 if (r && r->parent &&
279 pnv_pci_is_mem_pref_64(r->flags)) {
280 found = true;
281 break;
282 }
283 }
284
285 /* No M64 window found ? */
286 if (!found)
287 return IODA_INVALID_PE;
288
289 /* Allocate bitmap */ 286 /* Allocate bitmap */
290 size = _ALIGN_UP(phb->ioda.total_pe / 8, sizeof(unsigned long)); 287 size = _ALIGN_UP(phb->ioda.total_pe / 8, sizeof(unsigned long));
291 pe_alloc = kzalloc(size, GFP_KERNEL); 288 pe_alloc = kzalloc(size, GFP_KERNEL);
@@ -295,35 +292,8 @@ static int pnv_ioda2_pick_m64_pe(struct pnv_phb *phb,
295 return IODA_INVALID_PE; 292 return IODA_INVALID_PE;
296 } 293 }
297 294
298 /* 295 /* Figure out reserved PE numbers by the PE */
299 * Figure out reserved PE numbers by the PE 296 pnv_ioda2_reserve_m64_pe(bus, pe_alloc, all);
300 * the its child PEs.
301 */
302 start = (r->start - phb->ioda.m64_base) / segsz;
303 for (i = 0; i < resource_size(r) / segsz; i++)
304 set_bit(start + i, pe_alloc);
305
306 if (all)
307 goto done;
308
309 /*
310 * If the PE doesn't cover all subordinate buses,
311 * we need subtract from reserved PEs for children.
312 */
313 list_for_each_entry(pdev, &bus->devices, bus_list) {
314 if (!pdev->subordinate)
315 continue;
316
317 pci_bus_for_each_resource(pdev->subordinate, r, i) {
318 if (!r || !r->parent ||
319 !pnv_pci_is_mem_pref_64(r->flags))
320 continue;
321
322 start = (r->start - phb->ioda.m64_base) / segsz;
323 for (j = 0; j < resource_size(r) / segsz ; j++)
324 clear_bit(start + j, pe_alloc);
325 }
326 }
327 297
328 /* 298 /*
329 * the current bus might not own M64 window and that's all 299 * the current bus might not own M64 window and that's all
@@ -339,7 +309,6 @@ static int pnv_ioda2_pick_m64_pe(struct pnv_phb *phb,
339 * Figure out the master PE and put all slave PEs to master 309 * Figure out the master PE and put all slave PEs to master
340 * PE's list to form compound PE. 310 * PE's list to form compound PE.
341 */ 311 */
342done:
343 master_pe = NULL; 312 master_pe = NULL;
344 i = -1; 313 i = -1;
345 while ((i = find_next_bit(pe_alloc, phb->ioda.total_pe, i + 1)) < 314 while ((i = find_next_bit(pe_alloc, phb->ioda.total_pe, i + 1)) <
@@ -653,7 +622,7 @@ static int pnv_ioda_set_peltv(struct pnv_phb *phb,
653 pdev = pe->pdev->bus->self; 622 pdev = pe->pdev->bus->self;
654#ifdef CONFIG_PCI_IOV 623#ifdef CONFIG_PCI_IOV
655 else if (pe->flags & PNV_IODA_PE_VF) 624 else if (pe->flags & PNV_IODA_PE_VF)
656 pdev = pe->parent_dev->bus->self; 625 pdev = pe->parent_dev;
657#endif /* CONFIG_PCI_IOV */ 626#endif /* CONFIG_PCI_IOV */
658 while (pdev) { 627 while (pdev) {
659 struct pci_dn *pdn = pci_get_pdn(pdev); 628 struct pci_dn *pdn = pci_get_pdn(pdev);
@@ -732,7 +701,7 @@ static int pnv_ioda_deconfigure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe)
732 parent = parent->bus->self; 701 parent = parent->bus->self;
733 } 702 }
734 703
735 opal_pci_eeh_freeze_set(phb->opal_id, pe->pe_number, 704 opal_pci_eeh_freeze_clear(phb->opal_id, pe->pe_number,
736 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL); 705 OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
737 706
738 /* Disassociate PE in PELT */ 707 /* Disassociate PE in PELT */
@@ -946,8 +915,9 @@ static int pnv_pci_vf_resource_shift(struct pci_dev *dev, int offset)
946 res2 = *res; 915 res2 = *res;
947 res->start += size * offset; 916 res->start += size * offset;
948 917
949 dev_info(&dev->dev, "VF BAR%d: %pR shifted to %pR (enabling %d VFs shifted by %d)\n", 918 dev_info(&dev->dev, "VF BAR%d: %pR shifted to %pR (%sabling %d VFs shifted by %d)\n",
950 i, &res2, res, num_vfs, offset); 919 i, &res2, res, (offset > 0) ? "En" : "Dis",
920 num_vfs, offset);
951 pci_update_resource(dev, i + PCI_IOV_RESOURCES); 921 pci_update_resource(dev, i + PCI_IOV_RESOURCES);
952 } 922 }
953 return 0; 923 return 0;
@@ -1050,7 +1020,7 @@ static void pnv_ioda_setup_same_PE(struct pci_bus *bus, struct pnv_ioda_pe *pe)
1050 * subordinate PCI devices and buses. The second type of PE is normally 1020 * subordinate PCI devices and buses. The second type of PE is normally
1051 * orgiriated by PCIe-to-PCI bridge or PLX switch downstream ports. 1021 * orgiriated by PCIe-to-PCI bridge or PLX switch downstream ports.
1052 */ 1022 */
1053static void pnv_ioda_setup_bus_PE(struct pci_bus *bus, int all) 1023static void pnv_ioda_setup_bus_PE(struct pci_bus *bus, bool all)
1054{ 1024{
1055 struct pci_controller *hose = pci_bus_to_host(bus); 1025 struct pci_controller *hose = pci_bus_to_host(bus);
1056 struct pnv_phb *phb = hose->private_data; 1026 struct pnv_phb *phb = hose->private_data;
@@ -1059,7 +1029,7 @@ static void pnv_ioda_setup_bus_PE(struct pci_bus *bus, int all)
1059 1029
1060 /* Check if PE is determined by M64 */ 1030 /* Check if PE is determined by M64 */
1061 if (phb->pick_m64_pe) 1031 if (phb->pick_m64_pe)
1062 pe_num = phb->pick_m64_pe(phb, bus, all); 1032 pe_num = phb->pick_m64_pe(bus, all);
1063 1033
1064 /* The PE number isn't pinned by M64 */ 1034 /* The PE number isn't pinned by M64 */
1065 if (pe_num == IODA_INVALID_PE) 1035 if (pe_num == IODA_INVALID_PE)
@@ -1117,12 +1087,12 @@ static void pnv_ioda_setup_PEs(struct pci_bus *bus)
1117{ 1087{
1118 struct pci_dev *dev; 1088 struct pci_dev *dev;
1119 1089
1120 pnv_ioda_setup_bus_PE(bus, 0); 1090 pnv_ioda_setup_bus_PE(bus, false);
1121 1091
1122 list_for_each_entry(dev, &bus->devices, bus_list) { 1092 list_for_each_entry(dev, &bus->devices, bus_list) {
1123 if (dev->subordinate) { 1093 if (dev->subordinate) {
1124 if (pci_pcie_type(dev) == PCI_EXP_TYPE_PCI_BRIDGE) 1094 if (pci_pcie_type(dev) == PCI_EXP_TYPE_PCI_BRIDGE)
1125 pnv_ioda_setup_bus_PE(dev->subordinate, 1); 1095 pnv_ioda_setup_bus_PE(dev->subordinate, true);
1126 else 1096 else
1127 pnv_ioda_setup_PEs(dev->subordinate); 1097 pnv_ioda_setup_PEs(dev->subordinate);
1128 } 1098 }
@@ -1147,7 +1117,7 @@ static void pnv_pci_ioda_setup_PEs(void)
1147 1117
1148 /* M64 layout might affect PE allocation */ 1118 /* M64 layout might affect PE allocation */
1149 if (phb->reserve_m64_pe) 1119 if (phb->reserve_m64_pe)
1150 phb->reserve_m64_pe(phb); 1120 phb->reserve_m64_pe(hose->bus, NULL, true);
1151 1121
1152 pnv_ioda_setup_PEs(hose->bus); 1122 pnv_ioda_setup_PEs(hose->bus);
1153 } 1123 }
@@ -1590,6 +1560,7 @@ static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev
1590 1560
1591 pe = &phb->ioda.pe_array[pdn->pe_number]; 1561 pe = &phb->ioda.pe_array[pdn->pe_number];
1592 WARN_ON(get_dma_ops(&pdev->dev) != &dma_iommu_ops); 1562 WARN_ON(get_dma_ops(&pdev->dev) != &dma_iommu_ops);
1563 set_dma_offset(&pdev->dev, pe->tce_bypass_base);
1593 set_iommu_table_base(&pdev->dev, pe->table_group.tables[0]); 1564 set_iommu_table_base(&pdev->dev, pe->table_group.tables[0]);
1594 /* 1565 /*
1595 * Note: iommu_add_device() will fail here as 1566 * Note: iommu_add_device() will fail here as
@@ -1620,19 +1591,18 @@ static int pnv_pci_ioda_dma_set_mask(struct pci_dev *pdev, u64 dma_mask)
1620 if (bypass) { 1591 if (bypass) {
1621 dev_info(&pdev->dev, "Using 64-bit DMA iommu bypass\n"); 1592 dev_info(&pdev->dev, "Using 64-bit DMA iommu bypass\n");
1622 set_dma_ops(&pdev->dev, &dma_direct_ops); 1593 set_dma_ops(&pdev->dev, &dma_direct_ops);
1623 set_dma_offset(&pdev->dev, pe->tce_bypass_base);
1624 } else { 1594 } else {
1625 dev_info(&pdev->dev, "Using 32-bit DMA via iommu\n"); 1595 dev_info(&pdev->dev, "Using 32-bit DMA via iommu\n");
1626 set_dma_ops(&pdev->dev, &dma_iommu_ops); 1596 set_dma_ops(&pdev->dev, &dma_iommu_ops);
1627 set_iommu_table_base(&pdev->dev, pe->table_group.tables[0]);
1628 } 1597 }
1629 *pdev->dev.dma_mask = dma_mask; 1598 *pdev->dev.dma_mask = dma_mask;
1630 return 0; 1599 return 0;
1631} 1600}
1632 1601
1633static u64 pnv_pci_ioda_dma_get_required_mask(struct pnv_phb *phb, 1602static u64 pnv_pci_ioda_dma_get_required_mask(struct pci_dev *pdev)
1634 struct pci_dev *pdev)
1635{ 1603{
1604 struct pci_controller *hose = pci_bus_to_host(pdev->bus);
1605 struct pnv_phb *phb = hose->private_data;
1636 struct pci_dn *pdn = pci_get_pdn(pdev); 1606 struct pci_dn *pdn = pci_get_pdn(pdev);
1637 struct pnv_ioda_pe *pe; 1607 struct pnv_ioda_pe *pe;
1638 u64 end, mask; 1608 u64 end, mask;
@@ -1659,6 +1629,7 @@ static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe,
1659 1629
1660 list_for_each_entry(dev, &bus->devices, bus_list) { 1630 list_for_each_entry(dev, &bus->devices, bus_list) {
1661 set_iommu_table_base(&dev->dev, pe->table_group.tables[0]); 1631 set_iommu_table_base(&dev->dev, pe->table_group.tables[0]);
1632 set_dma_offset(&dev->dev, pe->tce_bypass_base);
1662 iommu_add_device(&dev->dev); 1633 iommu_add_device(&dev->dev);
1663 1634
1664 if ((pe->flags & PNV_IODA_PE_BUS_ALL) && dev->subordinate) 1635 if ((pe->flags & PNV_IODA_PE_BUS_ALL) && dev->subordinate)
@@ -3057,6 +3028,7 @@ static const struct pci_controller_ops pnv_pci_ioda_controller_ops = {
3057 .window_alignment = pnv_pci_window_alignment, 3028 .window_alignment = pnv_pci_window_alignment,
3058 .reset_secondary_bus = pnv_pci_reset_secondary_bus, 3029 .reset_secondary_bus = pnv_pci_reset_secondary_bus,
3059 .dma_set_mask = pnv_pci_ioda_dma_set_mask, 3030 .dma_set_mask = pnv_pci_ioda_dma_set_mask,
3031 .dma_get_required_mask = pnv_pci_ioda_dma_get_required_mask,
3060 .shutdown = pnv_pci_ioda_shutdown, 3032 .shutdown = pnv_pci_ioda_shutdown,
3061}; 3033};
3062 3034
@@ -3203,7 +3175,6 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
3203 3175
3204 /* Setup TCEs */ 3176 /* Setup TCEs */
3205 phb->dma_dev_setup = pnv_pci_ioda_dma_dev_setup; 3177 phb->dma_dev_setup = pnv_pci_ioda_dma_dev_setup;
3206 phb->dma_get_required_mask = pnv_pci_ioda_dma_get_required_mask;
3207 3178
3208 /* Setup MSI support */ 3179 /* Setup MSI support */
3209 pnv_pci_init_ioda_msis(phb); 3180 pnv_pci_init_ioda_msis(phb);
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index bc6d4e02e29c..9b2480b265c0 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -761,17 +761,6 @@ void pnv_pci_dma_dev_setup(struct pci_dev *pdev)
761 phb->dma_dev_setup(phb, pdev); 761 phb->dma_dev_setup(phb, pdev);
762} 762}
763 763
764u64 pnv_pci_dma_get_required_mask(struct pci_dev *pdev)
765{
766 struct pci_controller *hose = pci_bus_to_host(pdev->bus);
767 struct pnv_phb *phb = hose->private_data;
768
769 if (phb && phb->dma_get_required_mask)
770 return phb->dma_get_required_mask(phb, pdev);
771
772 return __dma_get_required_mask(&pdev->dev);
773}
774
775void pnv_pci_shutdown(void) 764void pnv_pci_shutdown(void)
776{ 765{
777 struct pci_controller *hose; 766 struct pci_controller *hose;
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index 8ef2d28aded0..c8ff50e90766 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -105,13 +105,12 @@ struct pnv_phb {
105 unsigned int hwirq, unsigned int virq, 105 unsigned int hwirq, unsigned int virq,
106 unsigned int is_64, struct msi_msg *msg); 106 unsigned int is_64, struct msi_msg *msg);
107 void (*dma_dev_setup)(struct pnv_phb *phb, struct pci_dev *pdev); 107 void (*dma_dev_setup)(struct pnv_phb *phb, struct pci_dev *pdev);
108 u64 (*dma_get_required_mask)(struct pnv_phb *phb,
109 struct pci_dev *pdev);
110 void (*fixup_phb)(struct pci_controller *hose); 108 void (*fixup_phb)(struct pci_controller *hose);
111 u32 (*bdfn_to_pe)(struct pnv_phb *phb, struct pci_bus *bus, u32 devfn); 109 u32 (*bdfn_to_pe)(struct pnv_phb *phb, struct pci_bus *bus, u32 devfn);
112 int (*init_m64)(struct pnv_phb *phb); 110 int (*init_m64)(struct pnv_phb *phb);
113 void (*reserve_m64_pe)(struct pnv_phb *phb); 111 void (*reserve_m64_pe)(struct pci_bus *bus,
114 int (*pick_m64_pe)(struct pnv_phb *phb, struct pci_bus *bus, int all); 112 unsigned long *pe_bitmap, bool all);
113 int (*pick_m64_pe)(struct pci_bus *bus, bool all);
115 int (*get_pe_state)(struct pnv_phb *phb, int pe_no); 114 int (*get_pe_state)(struct pnv_phb *phb, int pe_no);
116 void (*freeze_pe)(struct pnv_phb *phb, int pe_no); 115 void (*freeze_pe)(struct pnv_phb *phb, int pe_no);
117 int (*unfreeze_pe)(struct pnv_phb *phb, int pe_no, int opt); 116 int (*unfreeze_pe)(struct pnv_phb *phb, int pe_no, int opt);
diff --git a/arch/powerpc/platforms/powernv/powernv.h b/arch/powerpc/platforms/powernv/powernv.h
index 9269e30e4ca0..6dbc0a1da1f6 100644
--- a/arch/powerpc/platforms/powernv/powernv.h
+++ b/arch/powerpc/platforms/powernv/powernv.h
@@ -12,15 +12,9 @@ struct pci_dev;
12#ifdef CONFIG_PCI 12#ifdef CONFIG_PCI
13extern void pnv_pci_init(void); 13extern void pnv_pci_init(void);
14extern void pnv_pci_shutdown(void); 14extern void pnv_pci_shutdown(void);
15extern u64 pnv_pci_dma_get_required_mask(struct pci_dev *pdev);
16#else 15#else
17static inline void pnv_pci_init(void) { } 16static inline void pnv_pci_init(void) { }
18static inline void pnv_pci_shutdown(void) { } 17static inline void pnv_pci_shutdown(void) { }
19
20static inline u64 pnv_pci_dma_get_required_mask(struct pci_dev *pdev)
21{
22 return 0;
23}
24#endif 18#endif
25 19
26extern u32 pnv_get_supported_cpuidle_states(void); 20extern u32 pnv_get_supported_cpuidle_states(void);
diff --git a/arch/powerpc/platforms/powernv/rng.c b/arch/powerpc/platforms/powernv/rng.c
index 6eb808ff637e..5dcbdea1afac 100644
--- a/arch/powerpc/platforms/powernv/rng.c
+++ b/arch/powerpc/platforms/powernv/rng.c
@@ -128,7 +128,7 @@ static __init int rng_create(struct device_node *dn)
128 128
129 pr_info_once("Registering arch random hook.\n"); 129 pr_info_once("Registering arch random hook.\n");
130 130
131 ppc_md.get_random_long = powernv_get_random_long; 131 ppc_md.get_random_seed = powernv_get_random_long;
132 132
133 return 0; 133 return 0;
134} 134}
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index 53737e019ae3..685b3cbe1362 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -165,14 +165,6 @@ static void pnv_progress(char *s, unsigned short hex)
165{ 165{
166} 166}
167 167
168static u64 pnv_dma_get_required_mask(struct device *dev)
169{
170 if (dev_is_pci(dev))
171 return pnv_pci_dma_get_required_mask(to_pci_dev(dev));
172
173 return __dma_get_required_mask(dev);
174}
175
176static void pnv_shutdown(void) 168static void pnv_shutdown(void)
177{ 169{
178 /* Let the PCI code clear up IODA tables */ 170 /* Let the PCI code clear up IODA tables */
@@ -243,6 +235,13 @@ static void pnv_kexec_cpu_down(int crash_shutdown, int secondary)
243 } else { 235 } else {
244 /* Primary waits for the secondaries to have reached OPAL */ 236 /* Primary waits for the secondaries to have reached OPAL */
245 pnv_kexec_wait_secondaries_down(); 237 pnv_kexec_wait_secondaries_down();
238
239 /*
240 * We might be running as little-endian - now that interrupts
241 * are disabled, reset the HILE bit to big-endian so we don't
242 * take interrupts in the wrong endian later
243 */
244 opal_reinit_cpus(OPAL_REINIT_CPUS_HILE_BE);
246 } 245 }
247} 246}
248#endif /* CONFIG_KEXEC */ 247#endif /* CONFIG_KEXEC */
@@ -314,7 +313,6 @@ define_machine(powernv) {
314 .machine_shutdown = pnv_shutdown, 313 .machine_shutdown = pnv_shutdown,
315 .power_save = power7_idle, 314 .power_save = power7_idle,
316 .calibrate_decr = generic_calibrate_decr, 315 .calibrate_decr = generic_calibrate_decr,
317 .dma_get_required_mask = pnv_dma_get_required_mask,
318#ifdef CONFIG_KEXEC 316#ifdef CONFIG_KEXEC
319 .kexec_cpu_down = pnv_kexec_cpu_down, 317 .kexec_cpu_down = pnv_kexec_cpu_down,
320#endif 318#endif
diff --git a/arch/powerpc/platforms/powernv/subcore.c b/arch/powerpc/platforms/powernv/subcore.c
index f60f80ada903..503a73f59359 100644
--- a/arch/powerpc/platforms/powernv/subcore.c
+++ b/arch/powerpc/platforms/powernv/subcore.c
@@ -190,7 +190,7 @@ static void unsplit_core(void)
190 190
191 hid0 = mfspr(SPRN_HID0); 191 hid0 = mfspr(SPRN_HID0);
192 hid0 &= ~HID0_POWER8_DYNLPARDIS; 192 hid0 &= ~HID0_POWER8_DYNLPARDIS;
193 mtspr(SPRN_HID0, hid0); 193 update_power8_hid0(hid0);
194 update_hid_in_slw(hid0); 194 update_hid_in_slw(hid0);
195 195
196 while (mfspr(SPRN_HID0) & mask) 196 while (mfspr(SPRN_HID0) & mask)
@@ -227,7 +227,7 @@ static void split_core(int new_mode)
227 /* Write new mode */ 227 /* Write new mode */
228 hid0 = mfspr(SPRN_HID0); 228 hid0 = mfspr(SPRN_HID0);
229 hid0 |= HID0_POWER8_DYNLPARDIS | split_parms[i].value; 229 hid0 |= HID0_POWER8_DYNLPARDIS | split_parms[i].value;
230 mtspr(SPRN_HID0, hid0); 230 update_power8_hid0(hid0);
231 update_hid_in_slw(hid0); 231 update_hid_in_slw(hid0);
232 232
233 /* Wait for it to happen */ 233 /* Wait for it to happen */
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 0ced387e1463..e9ff44cd5d86 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -92,13 +92,12 @@ static struct property *dlpar_clone_drconf_property(struct device_node *dn)
92 return NULL; 92 return NULL;
93 93
94 new_prop->name = kstrdup(prop->name, GFP_KERNEL); 94 new_prop->name = kstrdup(prop->name, GFP_KERNEL);
95 new_prop->value = kmalloc(prop->length, GFP_KERNEL); 95 new_prop->value = kmemdup(prop->value, prop->length, GFP_KERNEL);
96 if (!new_prop->name || !new_prop->value) { 96 if (!new_prop->name || !new_prop->value) {
97 dlpar_free_drconf_property(new_prop); 97 dlpar_free_drconf_property(new_prop);
98 return NULL; 98 return NULL;
99 } 99 }
100 100
101 memcpy(new_prop->value, prop->value, prop->length);
102 new_prop->length = prop->length; 101 new_prop->length = prop->length;
103 102
104 /* Convert the property to cpu endian-ness */ 103 /* Convert the property to cpu endian-ness */
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 10510dea16b3..0946b98d75d4 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -1253,11 +1253,10 @@ static int dma_set_mask_pSeriesLP(struct device *dev, u64 dma_mask)
1253 } 1253 }
1254 } 1254 }
1255 1255
1256 /* fall back on iommu ops, restore table pointer with ops */ 1256 /* fall back on iommu ops */
1257 if (!ddw_enabled && get_dma_ops(dev) != &dma_iommu_ops) { 1257 if (!ddw_enabled && get_dma_ops(dev) != &dma_iommu_ops) {
1258 dev_info(dev, "Restoring 32-bit DMA via iommu\n"); 1258 dev_info(dev, "Restoring 32-bit DMA via iommu\n");
1259 set_dma_ops(dev, &dma_iommu_ops); 1259 set_dma_ops(dev, &dma_iommu_ops);
1260 pci_dma_dev_setup_pSeriesLP(pdev);
1261 } 1260 }
1262 1261
1263check_mask: 1262check_mask:
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index 02e4a1745516..3b6647e574b6 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -189,7 +189,8 @@ static irqreturn_t ras_epow_interrupt(int irq, void *dev_id)
189 int state; 189 int state;
190 int critical; 190 int critical;
191 191
192 status = rtas_get_sensor(EPOW_SENSOR_TOKEN, EPOW_SENSOR_INDEX, &state); 192 status = rtas_get_sensor_fast(EPOW_SENSOR_TOKEN, EPOW_SENSOR_INDEX,
193 &state);
193 194
194 if (state > 3) 195 if (state > 3)
195 critical = 1; /* Time Critical */ 196 critical = 1; /* Time Critical */
diff --git a/arch/powerpc/platforms/pseries/rng.c b/arch/powerpc/platforms/pseries/rng.c
index e09608770909..31ca557af60b 100644
--- a/arch/powerpc/platforms/pseries/rng.c
+++ b/arch/powerpc/platforms/pseries/rng.c
@@ -38,7 +38,7 @@ static __init int rng_init(void)
38 38
39 pr_info("Registering arch random hook.\n"); 39 pr_info("Registering arch random hook.\n");
40 40
41 ppc_md.get_random_long = pseries_get_random_long; 41 ppc_md.get_random_seed = pseries_get_random_long;
42 42
43 return 0; 43 return 0;
44} 44}
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index df6a7041922b..39a74fad3e04 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -254,19 +254,26 @@ static void __init pseries_discover_pic(void)
254static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *data) 254static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *data)
255{ 255{
256 struct of_reconfig_data *rd = data; 256 struct of_reconfig_data *rd = data;
257 struct device_node *np = rd->dn; 257 struct device_node *parent, *np = rd->dn;
258 struct pci_dn *pci = NULL; 258 struct pci_dn *pdn;
259 int err = NOTIFY_OK; 259 int err = NOTIFY_OK;
260 260
261 switch (action) { 261 switch (action) {
262 case OF_RECONFIG_ATTACH_NODE: 262 case OF_RECONFIG_ATTACH_NODE:
263 pci = np->parent->data; 263 parent = of_get_parent(np);
264 if (pci) { 264 pdn = parent ? PCI_DN(parent) : NULL;
265 update_dn_pci_info(np, pci->phb); 265 if (pdn) {
266 266 /* Create pdn and EEH device */
267 /* Create EEH device for the OF node */ 267 update_dn_pci_info(np, pdn->phb);
268 eeh_dev_init(PCI_DN(np), pci->phb); 268 eeh_dev_init(PCI_DN(np), pdn->phb);
269 } 269 }
270
271 of_node_put(parent);
272 break;
273 case OF_RECONFIG_DETACH_NODE:
274 pdn = PCI_DN(np);
275 if (pdn)
276 list_del(&pdn->list);
270 break; 277 break;
271 default: 278 default:
272 err = NOTIFY_DONE; 279 err = NOTIFY_DONE;
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c
index 4f7869571290..e2ea51961979 100644
--- a/arch/powerpc/sysdev/cpm_common.c
+++ b/arch/powerpc/sysdev/cpm_common.c
@@ -147,7 +147,7 @@ unsigned long cpm_muram_alloc(unsigned long size, unsigned long align)
147 spin_lock_irqsave(&cpm_muram_lock, flags); 147 spin_lock_irqsave(&cpm_muram_lock, flags);
148 cpm_muram_info.alignment = align; 148 cpm_muram_info.alignment = align;
149 start = rh_alloc(&cpm_muram_info, size, "commproc"); 149 start = rh_alloc(&cpm_muram_info, size, "commproc");
150 memset(cpm_muram_addr(start), 0, size); 150 memset_io(cpm_muram_addr(start), 0, size);
151 spin_unlock_irqrestore(&cpm_muram_lock, flags); 151 spin_unlock_irqrestore(&cpm_muram_lock, flags);
152 152
153 return start; 153 return start;
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 90bcdfeedf48..b7348637eae0 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -313,20 +313,11 @@ static void iommu_table_dart_setup(void)
313 set_bit(iommu_table_dart.it_size - 1, iommu_table_dart.it_map); 313 set_bit(iommu_table_dart.it_size - 1, iommu_table_dart.it_map);
314} 314}
315 315
316static void dma_dev_setup_dart(struct device *dev)
317{
318 /* We only have one iommu table on the mac for now, which makes
319 * things simple. Setup all PCI devices to point to this table
320 */
321 if (get_dma_ops(dev) == &dma_direct_ops)
322 set_dma_offset(dev, DART_U4_BYPASS_BASE);
323 else
324 set_iommu_table_base(dev, &iommu_table_dart);
325}
326
327static void pci_dma_dev_setup_dart(struct pci_dev *dev) 316static void pci_dma_dev_setup_dart(struct pci_dev *dev)
328{ 317{
329 dma_dev_setup_dart(&dev->dev); 318 if (dart_is_u4)
319 set_dma_offset(&dev->dev, DART_U4_BYPASS_BASE);
320 set_iommu_table_base(&dev->dev, &iommu_table_dart);
330} 321}
331 322
332static void pci_dma_bus_setup_dart(struct pci_bus *bus) 323static void pci_dma_bus_setup_dart(struct pci_bus *bus)
@@ -370,7 +361,6 @@ static int dart_dma_set_mask(struct device *dev, u64 dma_mask)
370 dev_info(dev, "Using 32-bit DMA via iommu\n"); 361 dev_info(dev, "Using 32-bit DMA via iommu\n");
371 set_dma_ops(dev, &dma_iommu_ops); 362 set_dma_ops(dev, &dma_iommu_ops);
372 } 363 }
373 dma_dev_setup_dart(dev);
374 364
375 *dev->dma_mask = dma_mask; 365 *dev->dma_mask = dma_mask;
376 return 0; 366 return 0;
diff --git a/arch/powerpc/sysdev/ppc4xx_hsta_msi.c b/arch/powerpc/sysdev/ppc4xx_hsta_msi.c
index af3c144b92c1..52a93dcae262 100644
--- a/arch/powerpc/sysdev/ppc4xx_hsta_msi.c
+++ b/arch/powerpc/sysdev/ppc4xx_hsta_msi.c
@@ -132,7 +132,7 @@ static int hsta_msi_probe(struct platform_device *pdev)
132 struct pci_controller *phb; 132 struct pci_controller *phb;
133 133
134 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 134 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
135 if (IS_ERR(mem)) { 135 if (!mem) {
136 dev_err(dev, "Unable to get mmio space\n"); 136 dev_err(dev, "Unable to get mmio space\n");
137 return -EINVAL; 137 return -EINVAL;
138 } 138 }
@@ -157,7 +157,7 @@ static int hsta_msi_probe(struct platform_device *pdev)
157 goto out; 157 goto out;
158 158
159 ppc4xx_hsta_msi.irq_map = kmalloc(sizeof(int) * irq_count, GFP_KERNEL); 159 ppc4xx_hsta_msi.irq_map = kmalloc(sizeof(int) * irq_count, GFP_KERNEL);
160 if (IS_ERR(ppc4xx_hsta_msi.irq_map)) { 160 if (!ppc4xx_hsta_msi.irq_map) {
161 ret = -ENOMEM; 161 ret = -ENOMEM;
162 goto out1; 162 goto out1;
163 } 163 }
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index e599259d84fc..6ef1231c6e9c 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1987,7 +1987,6 @@ memex(void)
1987 case '^': 1987 case '^':
1988 adrs -= size; 1988 adrs -= size;
1989 break; 1989 break;
1990 break;
1991 case '/': 1990 case '/':
1992 if (nslash > 0) 1991 if (nslash > 0)
1993 adrs -= 1 << nslash; 1992 adrs -= 1 << nslash;
@@ -2731,7 +2730,7 @@ static void xmon_print_symbol(unsigned long address, const char *mid,
2731void dump_segments(void) 2730void dump_segments(void)
2732{ 2731{
2733 int i; 2732 int i;
2734 unsigned long esid,vsid,valid; 2733 unsigned long esid,vsid;
2735 unsigned long llp; 2734 unsigned long llp;
2736 2735
2737 printf("SLB contents of cpu 0x%x\n", smp_processor_id()); 2736 printf("SLB contents of cpu 0x%x\n", smp_processor_id());
@@ -2739,10 +2738,9 @@ void dump_segments(void)
2739 for (i = 0; i < mmu_slb_size; i++) { 2738 for (i = 0; i < mmu_slb_size; i++) {
2740 asm volatile("slbmfee %0,%1" : "=r" (esid) : "r" (i)); 2739 asm volatile("slbmfee %0,%1" : "=r" (esid) : "r" (i));
2741 asm volatile("slbmfev %0,%1" : "=r" (vsid) : "r" (i)); 2740 asm volatile("slbmfev %0,%1" : "=r" (vsid) : "r" (i));
2742 valid = (esid & SLB_ESID_V); 2741 if (esid || vsid) {
2743 if (valid | esid | vsid) {
2744 printf("%02d %016lx %016lx", i, esid, vsid); 2742 printf("%02d %016lx %016lx", i, esid, vsid);
2745 if (valid) { 2743 if (esid & SLB_ESID_V) {
2746 llp = vsid & SLB_VSID_LLP; 2744 llp = vsid & SLB_VSID_LLP;
2747 if (vsid & SLB_VSID_B_1T) { 2745 if (vsid & SLB_VSID_B_1T) {
2748 printf(" 1T ESID=%9lx VSID=%13lx LLP:%3lx \n", 2746 printf(" 1T ESID=%9lx VSID=%13lx LLP:%3lx \n",