Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc

Pull powerpc updates from Benjamin Herrenschmidt:
"Some highlights in addition to the usual batch of fixes:

- 64TB address space support for 64-bit processes by Aneesh Kumar

- Gavin Shan did a major cleanup & re-organization of our EEH support
code (IBM fancy PCI error handling & recovery infrastructure) which
paves the way for supporting different platform backends, along
with some rework of the PCIe code for the PowerNV platform in order
to remove home made resource allocations and instead use the
generic code (which is possible after some small improvements to it
done by Gavin).

- Uprobes support by Ananth N Mavinakayanahalli

- A pile of embedded updates from Freescale folks, including new SoC
and board supports, more KVM stuff including preparing for 64-bit
BookE KVM support, ePAPR 1.1 updates, etc..."

Fixup trivial conflicts in drivers/scsi/ipr.c

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (146 commits)
powerpc/iommu: Fix multiple issues with IOMMU pools code
powerpc: Fix VMX fix for memcpy case
driver/mtd:IFC NAND:Initialise internal SRAM before any write
powerpc/fsl-pci: use 'Header Type' to identify PCIE mode
powerpc/eeh: Don't release eeh_mutex in eeh_phb_pe_get
powerpc: Remove tlb batching hack for nighthawk
powerpc: Set paca->data_offset = 0 for boot cpu
powerpc/perf: Sample only if SIAR-Valid bit is set in P7+
powerpc/fsl-pci: fix warning when CONFIG_SWIOTLB is disabled
powerpc/mpc85xx: Update interrupt handling for IFC controller
powerpc/85xx: Enable USB support in p1023rds_defconfig
powerpc/smp: Do not disable IPI interrupts during suspend
powerpc/eeh: Fix crash on converting OF node to edev
powerpc/eeh: Lock module while handling EEH event
powerpc/kprobe: Don't emulate store when kprobe stwu r1
powerpc/kprobe: Complete kprobe and migrate exception frame
powerpc/kprobe: Introduce a new thread flag
powerpc: Remove unused __get_user64() and __put_user64()
powerpc/eeh: Global mutex to protect PE tree
powerpc/eeh: Remove EEH PE for normal PCI hotplug
...

+6440 -3257
+41
Documentation/devicetree/bindings/misc/ifm-csi.txt
··· 1 + IFM camera sensor interface on mpc5200 LocalPlus bus 2 + 3 + Required properties: 4 + - compatible: "ifm,o2d-csi" 5 + - reg: specifies sensor chip select number and associated address range 6 + - interrupts: external interrupt line number and interrupt sense mode 7 + of the interrupt line signaling frame valid events 8 + - gpios: three gpio-specifiers for "capture", "reset" and "master enable" 9 + GPIOs (strictly in this order). 10 + - ifm,csi-clk-handle: the phandle to a node in the DT describing the sensor 11 + clock generator. This node is usually a general purpose timer controller. 12 + - ifm,csi-addr-bus-width: address bus width (valid values are 16, 24, 25) 13 + - ifm,csi-data-bus-width: data bus width (valid values are 8 and 16) 14 + - ifm,csi-wait-cycles: sensor bus wait cycles 15 + 16 + Optional properties: 17 + - ifm,csi-byte-swap: if this property is present, the byte swapping on 18 + the bus will be enabled. 19 + 20 + Example: 21 + 22 + csi@3,0 { 23 + compatible = "ifm,o2d-csi"; 24 + reg = <3 0 0x00100000>; /* CS 3, 1 MiB range */ 25 + interrupts = <1 1 2>; /* IRQ1, edge falling */ 26 + 27 + ifm,csi-clk-handle = <&timer7>; 28 + gpios = <&gpio_simple 23 0 /* image_capture */ 29 + &gpio_simple 26 0 /* image_reset */ 30 + &gpio_simple 29 0>; /* image_master_en */ 31 + 32 + ifm,csi-addr-bus-width = <24>; 33 + ifm,csi-data-bus-width = <8>; 34 + ifm,csi-wait-cycles = <0>; 35 + }; 36 + 37 + The base address of the used chip select is specified in the 38 + ranges property of the parent localbus node, for example: 39 + 40 + ranges = <0 0 0xff000000 0x01000000 41 + 3 0 0xe3000000 0x00100000>;
+6 -3
Documentation/devicetree/bindings/powerpc/fsl/ifc.txt
··· 12 12 - #size-cells : Either one or two, depending on how large each chipselect 13 13 can be. 14 14 - reg : Offset and length of the register set for the device 15 - - interrupts : IFC has two interrupts. The first one is the "common" 16 - interrupt(CM_EVTER_STAT), and second is the NAND interrupt 17 - (NAND_EVTER_STAT). 15 + - interrupts: IFC may have one or two interrupts. If two interrupt 16 + specifiers are present, the first is the "common" 17 + interrupt (CM_EVTER_STAT), and the second is the NAND 18 + interrupt (NAND_EVTER_STAT). If there is only one, 19 + that interrupt reports both types of event. 20 + 18 21 19 22 - ranges : Each range corresponds to a single chipselect, and covers 20 23 the entire access window as configured.
+15 -2
arch/powerpc/Kconfig
··· 215 215 config ARCH_SUSPEND_POSSIBLE 216 216 def_bool y 217 217 depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx || \ 218 - (PPC_85xx && !SMP) || PPC_86xx || PPC_PSERIES || 44x || 40x 218 + (PPC_85xx && !PPC_E500MC) || PPC_86xx || PPC_PSERIES \ 219 + || 44x || 40x 219 220 220 221 config PPC_DCR_NATIVE 221 222 bool ··· 238 237 default n 239 238 240 239 config ARCH_SUPPORTS_DEBUG_PAGEALLOC 240 + def_bool y 241 + 242 + config ARCH_SUPPORTS_UPROBES 241 243 def_bool y 242 244 243 245 config PPC_ADV_DEBUG_REGS ··· 329 325 330 326 config HOTPLUG_CPU 331 327 bool "Support for enabling/disabling CPUs" 332 - depends on SMP && HOTPLUG && EXPERIMENTAL && (PPC_PSERIES || PPC_PMAC || PPC_POWERNV) 328 + depends on SMP && HOTPLUG && EXPERIMENTAL && (PPC_PSERIES || \ 329 + PPC_PMAC || PPC_POWERNV || (PPC_85xx && !PPC_E500MC)) 333 330 ---help--- 334 331 Say Y here to be able to disable and re-enable individual 335 332 CPUs at runtime on SMP machines. ··· 561 556 SMT scheduler support improves the CPU scheduler's decision making 562 557 when dealing with POWER5 cpus at a cost of slightly increased 563 558 overhead in some places. If unsure say N here. 559 + 560 + config PPC_DENORMALISATION 561 + bool "PowerPC denormalisation exception handling" 562 + depends on PPC_BOOK3S_64 563 + default "n" 564 + ---help--- 565 + Add support for handling denormalisation of single precision 566 + values. Useful for bare metal only. If unsure say Y here. 564 567 565 568 config CMDLINE_BOOL 566 569 bool "Default bootloader kernel arguments"
+1
arch/powerpc/boot/Makefile
··· 107 107 obj-boot := $(addsuffix .o, $(basename $(src-boot))) 108 108 obj-wlib := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-wlib)))) 109 109 obj-plat := $(addsuffix .o, $(basename $(addprefix $(obj)/, $(src-plat)))) 110 + obj-plat: $(libfdt) 110 111 111 112 quiet_cmd_copy_zlib = COPY $@ 112 113 cmd_copy_zlib = sed "s@__used@@;s@<linux/\([^>]*\).*@\"\1\"@" $< > $@
+58
arch/powerpc/boot/dts/fsl/e500mc_power_isa.dtsi
··· 1 + /* 2 + * e500mc Power ISA Device Tree Source (include) 3 + * 4 + * Copyright 2012 Freescale Semiconductor Inc. 5 + * 6 + * Redistribution and use in source and binary forms, with or without 7 + * modification, are permitted provided that the following conditions are met: 8 + * * Redistributions of source code must retain the above copyright 9 + * notice, this list of conditions and the following disclaimer. 10 + * * Redistributions in binary form must reproduce the above copyright 11 + * notice, this list of conditions and the following disclaimer in the 12 + * documentation and/or other materials provided with the distribution. 13 + * * Neither the name of Freescale Semiconductor nor the 14 + * names of its contributors may be used to endorse or promote products 15 + * derived from this software without specific prior written permission. 16 + * 17 + * 18 + * ALTERNATIVELY, this software may be distributed under the terms of the 19 + * GNU General Public License ("GPL") as published by the Free Software 20 + * Foundation, either version 2 of that License or (at your option) any 21 + * later version. 22 + * 23 + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY 24 + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY 27 + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 + */ 34 + 35 + / { 36 + cpus { 37 + power-isa-version = "2.06"; 38 + power-isa-b; // Base 39 + power-isa-e; // Embedded 40 + power-isa-atb; // Alternate Time Base 41 + power-isa-cs; // Cache Specification 42 + power-isa-ds; // Decorated Storage 43 + power-isa-e.ed; // Embedded.Enhanced Debug 44 + power-isa-e.pd; // Embedded.External PID 45 + power-isa-e.hv; // Embedded.Hypervisor 46 + power-isa-e.le; // Embedded.Little-Endian 47 + power-isa-e.pm; // Embedded.Performance Monitor 48 + power-isa-e.pc; // Embedded.Processor Control 49 + power-isa-ecl; // Embedded Cache Locking 50 + power-isa-exp; // External Proxy 51 + power-isa-fp; // Floating Point 52 + power-isa-fp.r; // Floating Point.Record 53 + power-isa-mmc; // Memory Coherence 54 + power-isa-scpm; // Store Conditional Page Mobility 55 + power-isa-wt; // Wait 56 + mmu-type = "power-embedded"; 57 + }; 58 + };
+52
arch/powerpc/boot/dts/fsl/e500v2_power_isa.dtsi
··· 1 + /* 2 + * e500v2 Power ISA Device Tree Source (include) 3 + * 4 + * Copyright 2012 Freescale Semiconductor Inc. 5 + * 6 + * Redistribution and use in source and binary forms, with or without 7 + * modification, are permitted provided that the following conditions are met: 8 + * * Redistributions of source code must retain the above copyright 9 + * notice, this list of conditions and the following disclaimer. 10 + * * Redistributions in binary form must reproduce the above copyright 11 + * notice, this list of conditions and the following disclaimer in the 12 + * documentation and/or other materials provided with the distribution. 13 + * * Neither the name of Freescale Semiconductor nor the 14 + * names of its contributors may be used to endorse or promote products 15 + * derived from this software without specific prior written permission. 16 + * 17 + * 18 + * ALTERNATIVELY, this software may be distributed under the terms of the 19 + * GNU General Public License ("GPL") as published by the Free Software 20 + * Foundation, either version 2 of that License or (at your option) any 21 + * later version. 22 + * 23 + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY 24 + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY 27 + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 + */ 34 + 35 + / { 36 + cpus { 37 + power-isa-version = "2.03"; 38 + power-isa-b; // Base 39 + power-isa-e; // Embedded 40 + power-isa-atb; // Alternate Time Base 41 + power-isa-cs; // Cache Specification 42 + power-isa-e.le; // Embedded.Little-Endian 43 + power-isa-e.pm; // Embedded.Performance Monitor 44 + power-isa-ecl; // Embedded Cache Locking 45 + power-isa-mmc; // Memory Coherence 46 + power-isa-sp; // Signal Processing Engine 47 + power-isa-sp.fd; // SPE.Embedded Float Scalar Double 48 + power-isa-sp.fs; // SPE.Embedded Float Scalar Single 49 + power-isa-sp.fv; // SPE.Embedded Float Vector 50 + mmu-type = "power-embedded"; 51 + }; 52 + };
+59
arch/powerpc/boot/dts/fsl/e5500_power_isa.dtsi
··· 1 + /* 2 + * e5500 Power ISA Device Tree Source (include) 3 + * 4 + * Copyright 2012 Freescale Semiconductor Inc. 5 + * 6 + * Redistribution and use in source and binary forms, with or without 7 + * modification, are permitted provided that the following conditions are met: 8 + * * Redistributions of source code must retain the above copyright 9 + * notice, this list of conditions and the following disclaimer. 10 + * * Redistributions in binary form must reproduce the above copyright 11 + * notice, this list of conditions and the following disclaimer in the 12 + * documentation and/or other materials provided with the distribution. 13 + * * Neither the name of Freescale Semiconductor nor the 14 + * names of its contributors may be used to endorse or promote products 15 + * derived from this software without specific prior written permission. 16 + * 17 + * 18 + * ALTERNATIVELY, this software may be distributed under the terms of the 19 + * GNU General Public License ("GPL") as published by the Free Software 20 + * Foundation, either version 2 of that License or (at your option) any 21 + * later version. 22 + * 23 + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY 24 + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY 27 + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 + */ 34 + 35 + / { 36 + cpus { 37 + power-isa-version = "2.06"; 38 + power-isa-b; // Base 39 + power-isa-e; // Embedded 40 + power-isa-atb; // Alternate Time Base 41 + power-isa-cs; // Cache Specification 42 + power-isa-ds; // Decorated Storage 43 + power-isa-e.ed; // Embedded.Enhanced Debug 44 + power-isa-e.pd; // Embedded.External PID 45 + power-isa-e.hv; // Embedded.Hypervisor 46 + power-isa-e.le; // Embedded.Little-Endian 47 + power-isa-e.pm; // Embedded.Performance Monitor 48 + power-isa-e.pc; // Embedded.Processor Control 49 + power-isa-ecl; // Embedded Cache Locking 50 + power-isa-exp; // External Proxy 51 + power-isa-fp; // Floating Point 52 + power-isa-fp.r; // Floating Point.Record 53 + power-isa-mmc; // Memory Coherence 54 + power-isa-scpm; // Store Conditional Page Mobility 55 + power-isa-wt; // Wait 56 + power-isa-64; // 64-bit 57 + mmu-type = "power-embedded"; 58 + }; 59 + };
+3
arch/powerpc/boot/dts/fsl/mpc8536si-pre.dtsi
··· 33 33 */ 34 34 35 35 /dts-v1/; 36 + 37 + /include/ "e500v2_power_isa.dtsi" 38 + 36 39 / { 37 40 compatible = "fsl,MPC8536"; 38 41 #address-cells = <2>;
+3
arch/powerpc/boot/dts/fsl/mpc8544si-pre.dtsi
··· 33 33 */ 34 34 35 35 /dts-v1/; 36 + 37 + /include/ "e500v2_power_isa.dtsi" 38 + 36 39 / { 37 40 compatible = "fsl,MPC8544"; 38 41 #address-cells = <2>;
+3
arch/powerpc/boot/dts/fsl/mpc8548si-pre.dtsi
··· 33 33 */ 34 34 35 35 /dts-v1/; 36 + 37 + /include/ "e500v2_power_isa.dtsi" 38 + 36 39 / { 37 40 compatible = "fsl,MPC8548"; 38 41 #address-cells = <2>;
+3
arch/powerpc/boot/dts/fsl/mpc8568si-pre.dtsi
··· 33 33 */ 34 34 35 35 /dts-v1/; 36 + 37 + /include/ "e500v2_power_isa.dtsi" 38 + 36 39 / { 37 40 compatible = "fsl,MPC8568"; 38 41 #address-cells = <2>;
+3
arch/powerpc/boot/dts/fsl/mpc8569si-pre.dtsi
··· 33 33 */ 34 34 35 35 /dts-v1/; 36 + 37 + /include/ "e500v2_power_isa.dtsi" 38 + 36 39 / { 37 40 compatible = "fsl,MPC8569"; 38 41 #address-cells = <2>;
+3
arch/powerpc/boot/dts/fsl/mpc8572si-pre.dtsi
··· 33 33 */ 34 34 35 35 /dts-v1/; 36 + 37 + /include/ "e500v2_power_isa.dtsi" 38 + 36 39 / { 37 40 compatible = "fsl,MPC8572"; 38 41 #address-cells = <2>;
+3
arch/powerpc/boot/dts/fsl/p1010si-pre.dtsi
··· 33 33 */ 34 34 35 35 /dts-v1/; 36 + 37 + /include/ "e500v2_power_isa.dtsi" 38 + 36 39 / { 37 40 compatible = "fsl,P1010"; 38 41 #address-cells = <2>;
+3
arch/powerpc/boot/dts/fsl/p1020si-pre.dtsi
··· 33 33 */ 34 34 35 35 /dts-v1/; 36 + 37 + /include/ "e500v2_power_isa.dtsi" 38 + 36 39 / { 37 40 compatible = "fsl,P1020"; 38 41 #address-cells = <2>;
+3
arch/powerpc/boot/dts/fsl/p1021si-pre.dtsi
··· 33 33 */ 34 34 35 35 /dts-v1/; 36 + 37 + /include/ "e500v2_power_isa.dtsi" 38 + 36 39 / { 37 40 compatible = "fsl,P1021"; 38 41 #address-cells = <2>;
+3
arch/powerpc/boot/dts/fsl/p1022si-pre.dtsi
··· 33 33 */ 34 34 35 35 /dts-v1/; 36 + 37 + /include/ "e500v2_power_isa.dtsi" 38 + 36 39 / { 37 40 compatible = "fsl,P1022"; 38 41 #address-cells = <2>;
+3
arch/powerpc/boot/dts/fsl/p1023si-pre.dtsi
··· 33 33 */ 34 34 35 35 /dts-v1/; 36 + 37 + /include/ "e500v2_power_isa.dtsi" 38 + 36 39 / { 37 40 compatible = "fsl,P1023"; 38 41 #address-cells = <2>;
+3
arch/powerpc/boot/dts/fsl/p2020si-pre.dtsi
··· 33 33 */ 34 34 35 35 /dts-v1/; 36 + 37 + /include/ "e500v2_power_isa.dtsi" 38 + 36 39 / { 37 40 compatible = "fsl,P2020"; 38 41 #address-cells = <2>;
+3
arch/powerpc/boot/dts/fsl/p2041si-pre.dtsi
··· 33 33 */ 34 34 35 35 /dts-v1/; 36 + 37 + /include/ "e500mc_power_isa.dtsi" 38 + 36 39 / { 37 40 compatible = "fsl,P2041"; 38 41 #address-cells = <2>;
+3
arch/powerpc/boot/dts/fsl/p3041si-pre.dtsi
··· 33 33 */ 34 34 35 35 /dts-v1/; 36 + 37 + /include/ "e500mc_power_isa.dtsi" 38 + 36 39 / { 37 40 compatible = "fsl,P3041"; 38 41 #address-cells = <2>;
+3
arch/powerpc/boot/dts/fsl/p4080si-pre.dtsi
··· 33 33 */ 34 34 35 35 /dts-v1/; 36 + 37 + /include/ "e500mc_power_isa.dtsi" 38 + 36 39 / { 37 40 compatible = "fsl,P4080"; 38 41 #address-cells = <2>;
+3
arch/powerpc/boot/dts/fsl/p5020si-pre.dtsi
··· 33 33 */ 34 34 35 35 /dts-v1/; 36 + 37 + /include/ "e5500_power_isa.dtsi" 38 + 36 39 / { 37 40 compatible = "fsl,P5020"; 38 41 #address-cells = <2>;
+320
arch/powerpc/boot/dts/fsl/p5040si-post.dtsi
··· 1 + /* 2 + * P5040 Silicon/SoC Device Tree Source (post include) 3 + * 4 + * Copyright 2012 Freescale Semiconductor Inc. 5 + * 6 + * Redistribution and use in source and binary forms, with or without 7 + * modification, are permitted provided that the following conditions are met: 8 + * * Redistributions of source code must retain the above copyright 9 + * notice, this list of conditions and the following disclaimer. 10 + * * Redistributions in binary form must reproduce the above copyright 11 + * notice, this list of conditions and the following disclaimer in the 12 + * documentation and/or other materials provided with the distribution. 13 + * * Neither the name of Freescale Semiconductor nor the 14 + * names of its contributors may be used to endorse or promote products 15 + * derived from this software without specific prior written permission. 16 + * 17 + * 18 + * ALTERNATIVELY, this software may be distributed under the terms of the 19 + * GNU General Public License ("GPL") as published by the Free Software 20 + * Foundation, either version 2 of that License or (at your option) any 21 + * later version. 22 + * 23 + * This software is provided by Freescale Semiconductor "as is" and any 24 + * express or implied warranties, including, but not limited to, the implied 25 + * warranties of merchantability and fitness for a particular purpose are 26 + * disclaimed. In no event shall Freescale Semiconductor be liable for any 27 + * direct, indirect, incidental, special, exemplary, or consequential damages 28 + * (including, but not limited to, procurement of substitute goods or services; 29 + * loss of use, data, or profits; or business interruption) however caused and 30 + * on any theory of liability, whether in contract, strict liability, or tort 31 + * (including negligence or otherwise) arising in any way out of the use of this 32 + * software, even if advised of the possibility of such damage. 33 + */ 34 + 35 + &lbc { 36 + compatible = "fsl,p5040-elbc", "fsl,elbc", "simple-bus"; 37 + interrupts = <25 2 0 0>; 38 + #address-cells = <2>; 39 + #size-cells = <1>; 40 + }; 41 + 42 + /* controller at 0x200000 */ 43 + &pci0 { 44 + compatible = "fsl,p5040-pcie", "fsl,qoriq-pcie-v2.4"; 45 + device_type = "pci"; 46 + #size-cells = <2>; 47 + #address-cells = <3>; 48 + bus-range = <0x0 0xff>; 49 + clock-frequency = <33333333>; 50 + interrupts = <16 2 1 15>; 51 + pcie@0 { 52 + reg = <0 0 0 0 0>; 53 + #interrupt-cells = <1>; 54 + #size-cells = <2>; 55 + #address-cells = <3>; 56 + device_type = "pci"; 57 + interrupts = <16 2 1 15>; 58 + interrupt-map-mask = <0xf800 0 0 7>; 59 + interrupt-map = < 60 + /* IDSEL 0x0 */ 61 + 0000 0 0 1 &mpic 40 1 0 0 62 + 0000 0 0 2 &mpic 1 1 0 0 63 + 0000 0 0 3 &mpic 2 1 0 0 64 + 0000 0 0 4 &mpic 3 1 0 0 65 + >; 66 + }; 67 + }; 68 + 69 + /* controller at 0x201000 */ 70 + &pci1 { 71 + compatible = "fsl,p5040-pcie", "fsl,qoriq-pcie-v2.4"; 72 + device_type = "pci"; 73 + #size-cells = <2>; 74 + #address-cells = <3>; 75 + bus-range = <0 0xff>; 76 + clock-frequency = <33333333>; 77 + interrupts = <16 2 1 14>; 78 + pcie@0 { 79 + reg = <0 0 0 0 0>; 80 + #interrupt-cells = <1>; 81 + #size-cells = <2>; 82 + #address-cells = <3>; 83 + device_type = "pci"; 84 + interrupts = <16 2 1 14>; 85 + interrupt-map-mask = <0xf800 0 0 7>; 86 + interrupt-map = < 87 + /* IDSEL 0x0 */ 88 + 0000 0 0 1 &mpic 41 1 0 0 89 + 0000 0 0 2 &mpic 5 1 0 0 90 + 0000 0 0 3 &mpic 6 1 0 0 91 + 0000 0 0 4 &mpic 7 1 0 0 92 + >; 93 + }; 94 + }; 95 + 96 + /* controller at 0x202000 */ 97 + &pci2 { 98 + compatible = "fsl,p5040-pcie", "fsl,qoriq-pcie-v2.4"; 99 + device_type = "pci"; 100 + #size-cells = <2>; 101 + #address-cells = <3>; 102 + bus-range = <0x0 0xff>; 103 + clock-frequency = <33333333>; 104 + interrupts = <16 2 1 13>; 105 + pcie@0 { 106 + reg = <0 0 0 0 0>; 107 + #interrupt-cells = <1>; 108 + #size-cells = <2>; 109 + #address-cells = <3>; 110 + device_type = "pci"; 111 + interrupts = <16 2 1 13>; 112 + interrupt-map-mask = <0xf800 0 0 7>; 113 + interrupt-map = < 114 + /* IDSEL 0x0 */ 115 + 0000 0 0 1 &mpic 42 1 0 0 116 + 0000 0 0 2 &mpic 9 1 0 0 117 + 0000 0 0 3 &mpic 10 1 0 0 118 + 0000 0 0 4 &mpic 11 1 0 0 119 + >; 120 + }; 121 + }; 122 + 123 + &dcsr { 124 + #address-cells = <1>; 125 + #size-cells = <1>; 126 + compatible = "fsl,dcsr", "simple-bus"; 127 + 128 + dcsr-epu@0 { 129 + compatible = "fsl,dcsr-epu"; 130 + interrupts = <52 2 0 0 131 + 84 2 0 0 132 + 85 2 0 0>; 133 + reg = <0x0 0x1000>; 134 + }; 135 + dcsr-npc { 136 + compatible = "fsl,dcsr-npc"; 137 + reg = <0x1000 0x1000 0x1000000 0x8000>; 138 + }; 139 + dcsr-nxc@2000 { 140 + compatible = "fsl,dcsr-nxc"; 141 + reg = <0x2000 0x1000>; 142 + }; 143 + dcsr-corenet { 144 + compatible = "fsl,dcsr-corenet"; 145 + reg = <0x8000 0x1000 0xB0000 0x1000>; 146 + }; 147 + dcsr-dpaa@9000 { 148 + compatible = "fsl,p5040-dcsr-dpaa", "fsl,dcsr-dpaa"; 149 + reg = <0x9000 0x1000>; 150 + }; 151 + dcsr-ocn@11000 { 152 + compatible = "fsl,p5040-dcsr-ocn", "fsl,dcsr-ocn"; 153 + reg = <0x11000 0x1000>; 154 + }; 155 + dcsr-ddr@12000 { 156 + compatible = "fsl,dcsr-ddr"; 157 + dev-handle = <&ddr1>; 158 + reg = <0x12000 0x1000>; 159 + }; 160 + dcsr-ddr@13000 { 161 + compatible = "fsl,dcsr-ddr"; 162 + dev-handle = <&ddr2>; 163 + reg = <0x13000 0x1000>; 164 + }; 165 + dcsr-nal@18000 { 166 + compatible = "fsl,p5040-dcsr-nal", "fsl,dcsr-nal"; 167 + reg = <0x18000 0x1000>; 168 + }; 169 + dcsr-rcpm@22000 { 170 + compatible = "fsl,p5040-dcsr-rcpm", "fsl,dcsr-rcpm"; 171 + reg = <0x22000 0x1000>; 172 + }; 173 + dcsr-cpu-sb-proxy@40000 { 174 + compatible = "fsl,dcsr-e5500-sb-proxy", "fsl,dcsr-cpu-sb-proxy"; 175 + cpu-handle = <&cpu0>; 176 + reg = <0x40000 0x1000>; 177 + }; 178 + dcsr-cpu-sb-proxy@41000 { 179 + compatible = "fsl,dcsr-e5500-sb-proxy", "fsl,dcsr-cpu-sb-proxy"; 180 + cpu-handle = <&cpu1>; 181 + reg = <0x41000 0x1000>; 182 + }; 183 + dcsr-cpu-sb-proxy@42000 { 184 + compatible = "fsl,dcsr-e5500-sb-proxy", "fsl,dcsr-cpu-sb-proxy"; 185 + cpu-handle = <&cpu2>; 186 + reg = <0x42000 0x1000>; 187 + }; 188 + dcsr-cpu-sb-proxy@43000 { 189 + compatible = "fsl,dcsr-e5500-sb-proxy", "fsl,dcsr-cpu-sb-proxy"; 190 + cpu-handle = <&cpu3>; 191 + reg = <0x43000 0x1000>; 192 + }; 193 + }; 194 + 195 + &soc { 196 + #address-cells = <1>; 197 + #size-cells = <1>; 198 + device_type = "soc"; 199 + compatible = "simple-bus"; 200 + 201 + soc-sram-error { 202 + compatible = "fsl,soc-sram-error"; 203 + interrupts = <16 2 1 29>; 204 + }; 205 + 206 + corenet-law@0 { 207 + compatible = "fsl,corenet-law"; 208 + reg = <0x0 0x1000>; 209 + fsl,num-laws = <32>; 210 + }; 211 + 212 + ddr1: memory-controller@8000 { 213 + compatible = "fsl,qoriq-memory-controller-v4.5", "fsl,qoriq-memory-controller"; 214 + reg = <0x8000 0x1000>; 215 + interrupts = <16 2 1 23>; 216 + }; 217 + 218 + ddr2: memory-controller@9000 { 219 + compatible = "fsl,qoriq-memory-controller-v4.5","fsl,qoriq-memory-controller"; 220 + reg = <0x9000 0x1000>; 221 + interrupts = <16 2 1 22>; 222 + }; 223 + 224 + cpc: l3-cache-controller@10000 { 225 + compatible = "fsl,p5040-l3-cache-controller", "fsl,p4080-l3-cache-controller", "cache"; 226 + reg = <0x10000 0x1000 227 + 0x11000 0x1000>; 228 + interrupts = <16 2 1 27 229 + 16 2 1 26>; 230 + }; 231 + 232 + corenet-cf@18000 { 233 + compatible = "fsl,corenet-cf"; 234 + reg = <0x18000 0x1000>; 235 + interrupts = <16 2 1 31>; 236 + fsl,ccf-num-csdids = <32>; 237 + fsl,ccf-num-snoopids = <32>; 238 + }; 239 + 240 + iommu@20000 { 241 + compatible = "fsl,pamu-v1.0", "fsl,pamu"; 242 + reg = <0x20000 0x5000>; 243 + interrupts = < 244 + 24 2 0 0 245 + 16 2 1 30>; 246 + }; 247 + 248 + /include/ "qoriq-mpic.dtsi" 249 + 250 + guts: global-utilities@e0000 { 251 + compatible = "fsl,p5040-device-config", "fsl,qoriq-device-config-1.0"; 252 + reg = <0xe0000 0xe00>; 253 + fsl,has-rstcr; 254 + #sleep-cells = <1>; 255 + fsl,liodn-bits = <12>; 256 + }; 257 + 258 + pins: global-utilities@e0e00 { 259 + compatible = "fsl,p5040-pin-control", "fsl,qoriq-pin-control-1.0"; 260 + reg = <0xe0e00 0x200>; 261 + #sleep-cells = <2>; 262 + }; 263 + 264 + clockgen: global-utilities@e1000 { 265 + compatible = "fsl,p5040-clockgen", "fsl,qoriq-clockgen-1.0"; 266 + reg = <0xe1000 0x1000>; 267 + clock-frequency = <0>; 268 + }; 269 + 270 + rcpm: global-utilities@e2000 { 271 + compatible = "fsl,p5040-rcpm", "fsl,qoriq-rcpm-1.0"; 272 + reg = <0xe2000 0x1000>; 273 + #sleep-cells = <1>; 274 + }; 275 + 276 + sfp: sfp@e8000 { 277 + compatible = "fsl,p5040-sfp", "fsl,qoriq-sfp-1.0"; 278 + reg = <0xe8000 0x1000>; 279 + }; 280 + 281 + serdes: serdes@ea000 { 282 + compatible = "fsl,p5040-serdes"; 283 + reg = <0xea000 0x1000>; 284 + }; 285 + 286 + /include/ "qoriq-dma-0.dtsi" 287 + /include/ "qoriq-dma-1.dtsi" 288 + /include/ "qoriq-espi-0.dtsi" 289 + spi@110000 { 290 + fsl,espi-num-chipselects = <4>; 291 + }; 292 + 293 + /include/ "qoriq-esdhc-0.dtsi" 294 + sdhc@114000 { 295 + sdhci,auto-cmd12; 296 + }; 297 + 298 + /include/ "qoriq-i2c-0.dtsi" 299 + /include/ "qoriq-i2c-1.dtsi" 300 + /include/ "qoriq-duart-0.dtsi" 301 + /include/ "qoriq-duart-1.dtsi" 302 + /include/ "qoriq-gpio-0.dtsi" 303 + /include/ "qoriq-usb2-mph-0.dtsi" 304 + usb0: usb@210000 { 305 + compatible = "fsl-usb2-mph-v1.6", "fsl,mpc85xx-usb2-mph", "fsl-usb2-mph"; 306 + phy_type = "utmi"; 307 + port0; 308 + }; 309 + 310 + /include/ "qoriq-usb2-dr-0.dtsi" 311 + usb1: usb@211000 { 312 + compatible = "fsl-usb2-dr-v1.6", "fsl,mpc85xx-usb2-dr", "fsl-usb2-dr"; 313 + dr_mode = "host"; 314 + phy_type = "utmi"; 315 + }; 316 + 317 + /include/ "qoriq-sata2-0.dtsi" 318 + /include/ "qoriq-sata2-1.dtsi" 319 + /include/ "qoriq-sec5.2-0.dtsi" 320 + };
+114
arch/powerpc/boot/dts/fsl/p5040si-pre.dtsi
··· 1 + /* 2 + * P5040 Silicon/SoC Device Tree Source (pre include) 3 + * 4 + * Copyright 2012 Freescale Semiconductor Inc. 5 + * 6 + * Redistribution and use in source and binary forms, with or without 7 + * modification, are permitted provided that the following conditions are met: 8 + * * Redistributions of source code must retain the above copyright 9 + * notice, this list of conditions and the following disclaimer. 10 + * * Redistributions in binary form must reproduce the above copyright 11 + * notice, this list of conditions and the following disclaimer in the 12 + * documentation and/or other materials provided with the distribution. 13 + * * Neither the name of Freescale Semiconductor nor the 14 + * names of its contributors may be used to endorse or promote products 15 + * derived from this software without specific prior written permission. 16 + * 17 + * 18 + * ALTERNATIVELY, this software may be distributed under the terms of the 19 + * GNU General Public License ("GPL") as published by the Free Software 20 + * Foundation, either version 2 of that License or (at your option) any 21 + * later version. 22 + * 23 + * This software is provided by Freescale Semiconductor "as is" and any 24 + * express or implied warranties, including, but not limited to, the implied 25 + * warranties of merchantability and fitness for a particular purpose are 26 + * disclaimed. In no event shall Freescale Semiconductor be liable for any 27 + * direct, indirect, incidental, special, exemplary, or consequential damages 28 + * (including, but not limited to, procurement of substitute goods or services; 29 + * loss of use, data, or profits; or business interruption) however caused and 30 + * on any theory of liability, whether in contract, strict liability, or tort 31 + * (including negligence or otherwise) arising in any way out of the use of this 32 + * software, even if advised of the possibility of such damage. 33 + */ 34 + 35 + /dts-v1/; 36 + 37 + /include/ "e5500_power_isa.dtsi" 38 + 39 + / { 40 + compatible = "fsl,P5040"; 41 + #address-cells = <2>; 42 + #size-cells = <2>; 43 + interrupt-parent = <&mpic>; 44 + 45 + aliases { 46 + ccsr = &soc; 47 + dcsr = &dcsr; 48 + 49 + serial0 = &serial0; 50 + serial1 = &serial1; 51 + serial2 = &serial2; 52 + serial3 = &serial3; 53 + pci0 = &pci0; 54 + pci1 = &pci1; 55 + pci2 = &pci2; 56 + usb0 = &usb0; 57 + usb1 = &usb1; 58 + dma0 = &dma0; 59 + dma1 = &dma1; 60 + sdhc = &sdhc; 61 + msi0 = &msi0; 62 + msi1 = &msi1; 63 + msi2 = &msi2; 64 + 65 + crypto = &crypto; 66 + sec_jr0 = &sec_jr0; 67 + sec_jr1 = &sec_jr1; 68 + sec_jr2 = &sec_jr2; 69 + sec_jr3 = &sec_jr3; 70 + rtic_a = &rtic_a; 71 + rtic_b = &rtic_b; 72 + rtic_c = &rtic_c; 73 + rtic_d = &rtic_d; 74 + sec_mon = &sec_mon; 75 + }; 76 + 77 + cpus { 78 + #address-cells = <1>; 79 + #size-cells = <0>; 80 + 81 + cpu0: PowerPC,e5500@0 { 82 + device_type = "cpu"; 83 + reg = <0>; 84 + next-level-cache = <&L2_0>; 85 + L2_0: l2-cache { 86 + next-level-cache = <&cpc>; 87 + }; 88 + }; 89 + cpu1: PowerPC,e5500@1 { 90 + device_type = "cpu"; 91 + reg = <1>; 92 + next-level-cache = <&L2_1>; 93 + L2_1: l2-cache { 94 + next-level-cache = <&cpc>; 95 + }; 96 + }; 97 + cpu2: PowerPC,e5500@2 { 98 + device_type = "cpu"; 99 + reg = <2>; 100 + next-level-cache = <&L2_2>; 101 + L2_2: l2-cache { 102 + next-level-cache = <&cpc>; 103 + }; 104 + }; 105 + cpu3: PowerPC,e5500@3 { 106 + device_type = "cpu"; 107 + reg = <3>; 108 + next-level-cache = <&L2_3>; 109 + L2_3: l2-cache { 110 + next-level-cache = <&cpc>; 111 + }; 112 + }; 113 + }; 114 + };
+118
arch/powerpc/boot/dts/fsl/qoriq-sec5.2-0.dtsi
··· 1 + /* 2 + * QorIQ Sec/Crypto 5.2 device tree stub [ controller @ offset 0x300000 ] 3 + * 4 + * Copyright 2011-2012 Freescale Semiconductor Inc. 5 + * 6 + * Redistribution and use in source and binary forms, with or without 7 + * modification, are permitted provided that the following conditions are met: 8 + * * Redistributions of source code must retain the above copyright 9 + * notice, this list of conditions and the following disclaimer. 10 + * * Redistributions in binary form must reproduce the above copyright 11 + * notice, this list of conditions and the following disclaimer in the 12 + * documentation and/or other materials provided with the distribution. 13 + * * Neither the name of Freescale Semiconductor nor the 14 + * names of its contributors may be used to endorse or promote products 15 + * derived from this software without specific prior written permission. 16 + * 17 + * 18 + * ALTERNATIVELY, this software may be distributed under the terms of the 19 + * GNU General Public License ("GPL") as published by the Free Software 20 + * Foundation, either version 2 of that License or (at your option) any 21 + * later version. 22 + * 23 + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY 24 + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY 27 + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 + */ 34 + 35 + crypto: crypto@300000 { 36 + compatible = "fsl,sec-v5.2", "fsl,sec-v5.0", "fsl,sec-v4.0"; 37 + #address-cells = <1>; 38 + #size-cells = <1>; 39 + reg = <0x300000 0x10000>; 40 + ranges = <0 0x300000 0x10000>; 41 + interrupts = <92 2 0 0>; 42 + 43 + sec_jr0: jr@1000 { 44 + compatible = "fsl,sec-v5.2-job-ring", 45 + "fsl,sec-v5.0-job-ring", 46 + "fsl,sec-v4.0-job-ring"; 47 + reg = <0x1000 0x1000>; 48 + interrupts = <88 2 0 0>; 49 + }; 50 + 51 + sec_jr1: jr@2000 { 52 + compatible = "fsl,sec-v5.2-job-ring", 53 + "fsl,sec-v5.0-job-ring", 54 + "fsl,sec-v4.0-job-ring"; 55 + reg = <0x2000 0x1000>; 56 + interrupts = <89 2 0 0>; 57 + }; 58 + 59 + sec_jr2: jr@3000 { 60 + compatible = "fsl,sec-v5.2-job-ring", 61 + "fsl,sec-v5.0-job-ring", 62 + "fsl,sec-v4.0-job-ring"; 63 + reg = <0x3000 0x1000>; 64 + interrupts = <90 2 0 0>; 65 + }; 66 + 67 + sec_jr3: jr@4000 { 68 + compatible = "fsl,sec-v5.2-job-ring", 69 + "fsl,sec-v5.0-job-ring", 70 + "fsl,sec-v4.0-job-ring"; 71 + reg = <0x4000 0x1000>; 72 + interrupts = <91 2 0 0>; 73 + }; 74 + 75 + rtic@6000 { 76 + compatible = "fsl,sec-v5.2-rtic", 77 + "fsl,sec-v5.0-rtic", 78 + "fsl,sec-v4.0-rtic"; 79 + #address-cells = <1>; 80 + #size-cells = <1>; 81 + reg = <0x6000 0x100>; 82 + ranges = <0x0 0x6100 0xe00>; 83 + 84 + rtic_a: rtic-a@0 { 85 + compatible = "fsl,sec-v5.2-rtic-memory", 86 + "fsl,sec-v5.0-rtic-memory", 87 + "fsl,sec-v4.0-rtic-memory"; 88 + reg = <0x00 0x20 0x100 0x80>; 89 + }; 90 + 91 + rtic_b: rtic-b@20 { 92 + compatible = "fsl,sec-v5.2-rtic-memory", 93 + "fsl,sec-v5.0-rtic-memory", 94 + "fsl,sec-v4.0-rtic-memory"; 95 + reg = <0x20 0x20 0x200 0x80>; 96 + }; 97 + 98 + rtic_c: rtic-c@40 { 99 + compatible = "fsl,sec-v5.2-rtic-memory", 100 + "fsl,sec-v5.0-rtic-memory", 101 + "fsl,sec-v4.0-rtic-memory"; 102 + reg = <0x40 0x20 0x300 0x80>; 103 + }; 104 + 105 + rtic_d: rtic-d@60 { 106 + compatible = "fsl,sec-v5.2-rtic-memory", 107 + "fsl,sec-v5.0-rtic-memory", 108 + "fsl,sec-v4.0-rtic-memory"; 109 + reg = <0x60 0x20 0x500 0x80>; 110 + }; 111 + }; 112 + }; 113 + 114 + sec_mon: sec_mon@314000 { 115 + compatible = "fsl,sec-v5.2-mon", "fsl,sec-v5.0-mon", "fsl,sec-v4.0-mon"; 116 + reg = <0x314000 0x1000>; 117 + interrupts = <93 2 0 0>; 118 + };
+4
arch/powerpc/boot/dts/mpc8536ds.dtsi
··· 132 132 reg = <0x68>; 133 133 interrupts = <0 0x1 0 0>; 134 134 }; 135 + adt7461@4c { 136 + compatible = "adi,adt7461"; 137 + reg = <0x4c>; 138 + }; 135 139 }; 136 140 137 141 spi@7000 {
+2
arch/powerpc/boot/dts/mpc8540ads.dts
··· 11 11 12 12 /dts-v1/; 13 13 14 + /include/ "fsl/e500v2_power_isa.dtsi" 15 + 14 16 / { 15 17 model = "MPC8540ADS"; 16 18 compatible = "MPC8540ADS", "MPC85xxADS";
+2
arch/powerpc/boot/dts/mpc8541cds.dts
··· 11 11 12 12 /dts-v1/; 13 13 14 + /include/ "fsl/e500v2_power_isa.dtsi" 15 + 14 16 / { 15 17 model = "MPC8541CDS"; 16 18 compatible = "MPC8541CDS", "MPC85xxCDS";
+3 -1
arch/powerpc/boot/dts/mpc8544ds.dts
··· 20 20 reg = <0 0 0 0>; // Filled by U-Boot 21 21 }; 22 22 23 - lbc: localbus@e0005000 { 23 + board_lbc: lbc: localbus@e0005000 { 24 24 reg = <0 0xe0005000 0 0x1000>; 25 + 26 + ranges = <0x0 0x0 0x0 0xff800000 0x800000>; 25 27 }; 26 28 27 29 board_soc: soc: soc8544@e0000000 {
+39
arch/powerpc/boot/dts/mpc8544ds.dtsi
··· 32 32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 33 */ 34 34 35 + &board_lbc { 36 + nor@0,0 { 37 + #address-cells = <1>; 38 + #size-cells = <1>; 39 + compatible = "cfi-flash"; 40 + reg = <0x0 0x0 0x800000>; 41 + bank-width = <2>; 42 + device-width = <1>; 43 + 44 + partition@0 { 45 + reg = <0x0 0x10000>; 46 + label = "dtb-nor"; 47 + }; 48 + 49 + partition@20000 { 50 + reg = <0x20000 0x30000>; 51 + label = "diagnostic-nor"; 52 + read-only; 53 + }; 54 + 55 + partition@200000 { 56 + reg = <0x200000 0x200000>; 57 + label = "dink-nor"; 58 + read-only; 59 + }; 60 + 61 + partition@400000 { 62 + reg = <0x400000 0x380000>; 63 + label = "kernel-nor"; 64 + }; 65 + 66 + partition@780000 { 67 + reg = <0x780000 0x80000>; 68 + label = "u-boot-nor"; 69 + read-only; 70 + }; 71 + }; 72 + }; 73 + 35 74 &board_soc { 36 75 enet0: ethernet@24000 { 37 76 phy-handle = <&phy0>;
+2
arch/powerpc/boot/dts/mpc8555cds.dts
··· 11 11 12 12 /dts-v1/; 13 13 14 + /include/ "fsl/e500v2_power_isa.dtsi" 15 + 14 16 / { 15 17 model = "MPC8555CDS"; 16 18 compatible = "MPC8555CDS", "MPC85xxCDS";
+2
arch/powerpc/boot/dts/mpc8560ads.dts
··· 11 11 12 12 /dts-v1/; 13 13 14 + /include/ "fsl/e500v2_power_isa.dtsi" 15 + 14 16 / { 15 17 model = "MPC8560ADS"; 16 18 compatible = "MPC8560ADS", "MPC85xxADS";
+47
arch/powerpc/boot/dts/o2d.dts
··· 1 + /* 2 + * O2D Device Tree Source 3 + * 4 + * Copyright (C) 2012 DENX Software Engineering 5 + * Anatolij Gustschin <agust@denx.de> 6 + * 7 + * This program is free software; you can redistribute it and/or modify it 8 + * under the terms of the GNU General Public License as published by the 9 + * Free Software Foundation; either version 2 of the License, or (at your 10 + * option) any later version. 11 + */ 12 + 13 + /include/ "o2d.dtsi" 14 + 15 + / { 16 + model = "ifm,o2d"; 17 + compatible = "ifm,o2d"; 18 + 19 + memory { 20 + reg = <0x00000000 0x08000000>; // 128MB 21 + }; 22 + 23 + localbus { 24 + ranges = <0 0 0xfc000000 0x02000000 25 + 3 0 0xe3000000 0x00100000>; 26 + 27 + flash@0,0 { 28 + compatible = "cfi-flash"; 29 + reg = <0 0 0x02000000>; 30 + bank-width = <2>; 31 + device-width = <2>; 32 + #size-cells = <1>; 33 + #address-cells = <1>; 34 + 35 + partition@60000 { 36 + label = "kernel"; 37 + reg = <0x00060000 0x00260000>; 38 + read-only; 39 + }; 40 + /* o2d specific partitions */ 41 + partition@2c0000 { 42 + label = "o2d user defined"; 43 + reg = <0x002c0000 0x01d40000>; 44 + }; 45 + }; 46 + }; 47 + };
+139
arch/powerpc/boot/dts/o2d.dtsi
··· 1 + /* 2 + * O2D base Device Tree Source 3 + * 4 + * Copyright (C) 2012 DENX Software Engineering 5 + * Anatolij Gustschin <agust@denx.de> 6 + * 7 + * This program is free software; you can redistribute it and/or modify it 8 + * under the terms of the GNU General Public License as published by the 9 + * Free Software Foundation; either version 2 of the License, or (at your 10 + * option) any later version. 11 + */ 12 + 13 + /include/ "mpc5200b.dtsi" 14 + 15 + / { 16 + model = "ifm,o2d"; 17 + compatible = "ifm,o2d"; 18 + 19 + memory { 20 + reg = <0x00000000 0x04000000>; // 64MB 21 + }; 22 + 23 + soc5200@f0000000 { 24 + 25 + gpio_simple: gpio@b00 { 26 + }; 27 + 28 + timer@600 { // General Purpose Timer 29 + #gpio-cells = <2>; 30 + gpio-controller; 31 + fsl,has-wdt; 32 + fsl,wdt-on-boot = <0>; 33 + }; 34 + 35 + timer@610 { 36 + #gpio-cells = <2>; 37 + gpio-controller; 38 + }; 39 + 40 + timer7: timer@670 { 41 + }; 42 + 43 + rtc@800 { 44 + status = "disabled"; 45 + }; 46 + 47 + psc@2000 { // PSC1 48 + compatible = "fsl,mpc5200b-psc-spi","fsl,mpc5200-psc-spi"; 49 + #address-cells = <1>; 50 + #size-cells = <0>; 51 + cell-index = <0>; 52 + 53 + spidev@0 { 54 + compatible = "spidev"; 55 + spi-max-frequency = <250000>; 56 + reg = <0>; 57 + }; 58 + }; 59 + 60 + psc@2200 { // PSC2 61 + status = "disabled"; 62 + }; 63 + 64 + psc@2400 { // PSC3 65 + status = "disabled"; 66 + }; 67 + 68 + psc@2600 { // PSC4 69 + compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; 70 + }; 71 + 72 + psc@2800 { // PSC5 73 + compatible = "fsl,mpc5200b-psc-uart","fsl,mpc5200-psc-uart"; 74 + }; 75 + 76 + psc@2c00 { // PSC6 77 + status = "disabled"; 78 + }; 79 + 80 + ethernet@3000 { 81 + phy-handle = <&phy0>; 82 + }; 83 + 84 + mdio@3000 { 85 + phy0: ethernet-phy@0 { 86 + reg = <0>; 87 + }; 88 + }; 89 + 90 + sclpc@3c00 { 91 + compatible = "fsl,mpc5200-lpbfifo"; 92 + reg = <0x3c00 0x60>; 93 + interrupts = <3 23 0>; 94 + }; 95 + }; 96 + 97 + localbus { 98 + ranges = <0 0 0xff000000 0x01000000 99 + 3 0 0xe3000000 0x00100000>; 100 + 101 + // flash device at LocalPlus Bus CS0 102 + flash@0,0 { 103 + compatible = "cfi-flash"; 104 + reg = <0 0 0x01000000>; 105 + bank-width = <1>; 106 + device-width = <2>; 107 + #size-cells = <1>; 108 + #address-cells = <1>; 109 + no-unaligned-direct-access; 110 + 111 + /* common layout for all machines */ 112 + partition@0 { 113 + label = "u-boot"; 114 + reg = <0x00000000 0x00040000>; 115 + read-only; 116 + }; 117 + partition@40000 { 118 + label = "env"; 119 + reg = <0x00040000 0x00020000>; 120 + read-only; 121 + }; 122 + }; 123 + 124 + csi@3,0 { 125 + compatible = "ifm,o2d-csi"; 126 + reg = <3 0 0x00100000>; 127 + ifm,csi-clk-handle = <&timer7>; 128 + gpios = <&gpio_simple 23 0 /* imag_capture */ 129 + &gpio_simple 26 0 /* imag_reset */ 130 + &gpio_simple 29 0>; /* imag_master_en */ 131 + 132 + interrupts = <1 1 2>; /* IRQ1, edge falling */ 133 + 134 + ifm,csi-addr-bus-width = <24>; 135 + ifm,csi-data-bus-width = <8>; 136 + ifm,csi-wait-cycles = <0>; 137 + }; 138 + }; 139 + };
+52
arch/powerpc/boot/dts/o2d300.dts
··· 1 + /* 2 + * O2D300 Device Tree Source 3 + * 4 + * Copyright (C) 2012 DENX Software Engineering 5 + * Anatolij Gustschin <agust@denx.de> 6 + * 7 + * This program is free software; you can redistribute it and/or modify it 8 + * under the terms of the GNU General Public License as published by the 9 + * Free Software Foundation; either version 2 of the License, or (at your 10 + * option) any later version. 11 + */ 12 + 13 + /include/ "o2d.dtsi" 14 + 15 + / { 16 + model = "ifm,o2d300"; 17 + compatible = "ifm,o2d"; 18 + 19 + localbus { 20 + ranges = <0 0 0xfc000000 0x02000000 21 + 3 0 0xe3000000 0x00100000>; 22 + flash@0,0 { 23 + compatible = "cfi-flash"; 24 + reg = <0 0 0x02000000>; 25 + bank-width = <2>; 26 + device-width = <2>; 27 + #size-cells = <1>; 28 + #address-cells = <1>; 29 + 30 + partition@40000 { 31 + label = "env_1"; 32 + reg = <0x00040000 0x00020000>; 33 + read-only; 34 + }; 35 + partition@60000 { 36 + label = "env_2"; 37 + reg = <0x00060000 0x00020000>; 38 + read-only; 39 + }; 40 + partition@80000 { 41 + label = "kernel"; 42 + reg = <0x00080000 0x00260000>; 43 + read-only; 44 + }; 45 + /* o2d300 specific partitions */ 46 + partition@2e0000 { 47 + label = "o2d300 user defined"; 48 + reg = <0x002e0000 0x01d20000>; 49 + }; 50 + }; 51 + }; 52 + };
+48
arch/powerpc/boot/dts/o2dnt2.dts
··· 1 + /* 2 + * O2DNT2 Device Tree Source 3 + * 4 + * Copyright (C) 2012 DENX Software Engineering 5 + * Anatolij Gustschin <agust@denx.de> 6 + * 7 + * This program is free software; you can redistribute it and/or modify it 8 + * under the terms of the GNU General Public License as published by the 9 + * Free Software Foundation; either version 2 of the License, or (at your 10 + * option) any later version. 11 + */ 12 + 13 + /include/ "o2d.dtsi" 14 + 15 + / { 16 + model = "ifm,o2dnt2"; 17 + compatible = "ifm,o2d"; 18 + 19 + memory { 20 + reg = <0x00000000 0x08000000>; // 128MB 21 + }; 22 + 23 + localbus { 24 + ranges = <0 0 0xfc000000 0x02000000 25 + 3 0 0xe3000000 0x00100000>; 26 + 27 + flash@0,0 { 28 + compatible = "cfi-flash"; 29 + reg = <0 0 0x02000000>; 30 + bank-width = <2>; 31 + device-width = <2>; 32 + #size-cells = <1>; 33 + #address-cells = <1>; 34 + 35 + partition@60000 { 36 + label = "kernel"; 37 + reg = <0x00060000 0x00260000>; 38 + read-only; 39 + }; 40 + 41 + /* o2dnt2 specific partitions */ 42 + partition@2c0000 { 43 + label = "o2dnt2 user defined"; 44 + reg = <0x002c0000 0x01d40000>; 45 + }; 46 + }; 47 + }; 48 + };
+33
arch/powerpc/boot/dts/o2i.dts
··· 1 + /* 2 + * O2I Device Tree Source 3 + * 4 + * Copyright (C) 2012 DENX Software Engineering 5 + * Anatolij Gustschin <agust@denx.de> 6 + * 7 + * This program is free software; you can redistribute it and/or modify it 8 + * under the terms of the GNU General Public License as published by the 9 + * Free Software Foundation; either version 2 of the License, or (at your 10 + * option) any later version. 11 + */ 12 + 13 + /include/ "o2d.dtsi" 14 + 15 + / { 16 + model = "ifm,o2i"; 17 + compatible = "ifm,o2d"; 18 + 19 + localbus { 20 + flash@0,0 { 21 + partition@60000 { 22 + label = "kernel"; 23 + reg = <0x00060000 0x00260000>; 24 + read-only; 25 + }; 26 + /* o2i specific partitions */ 27 + partition@2c0000 { 28 + label = "o2i user defined"; 29 + reg = <0x002c0000 0x00d40000>; 30 + }; 31 + }; 32 + }; 33 + };
+33
arch/powerpc/boot/dts/o2mnt.dts
··· 1 + /* 2 + * O2MNT Device Tree Source 3 + * 4 + * Copyright (C) 2012 DENX Software Engineering 5 + * Anatolij Gustschin <agust@denx.de> 6 + * 7 + * This program is free software; you can redistribute it and/or modify it 8 + * under the terms of the GNU General Public License as published by the 9 + * Free Software Foundation; either version 2 of the License, or (at your 10 + * option) any later version. 11 + */ 12 + 13 + /include/ "o2d.dtsi" 14 + 15 + / { 16 + model = "ifm,o2mnt"; 17 + compatible = "ifm,o2d"; 18 + 19 + localbus { 20 + flash@0,0 { 21 + partition@60000 { 22 + label = "kernel"; 23 + reg = <0x00060000 0x00260000>; 24 + read-only; 25 + }; 26 + /* add o2mnt specific partitions */ 27 + partition@2c0000 { 28 + label = "o2mnt user defined"; 29 + reg = <0x002c0000 0x00d40000>; 30 + }; 31 + }; 32 + }; 33 + };
+48
arch/powerpc/boot/dts/o3dnt.dts
··· 1 + /* 2 + * O3DNT Device Tree Source 3 + * 4 + * Copyright (C) 2012 DENX Software Engineering 5 + * Anatolij Gustschin <agust@denx.de> 6 + * 7 + * This program is free software; you can redistribute it and/or modify it 8 + * under the terms of the GNU General Public License as published by the 9 + * Free Software Foundation; either version 2 of the License, or (at your 10 + * option) any later version. 11 + */ 12 + 13 + /include/ "o2d.dtsi" 14 + 15 + / { 16 + model = "ifm,o3dnt"; 17 + compatible = "ifm,o2d"; 18 + 19 + memory { 20 + reg = <0x00000000 0x04000000>; // 64MB 21 + }; 22 + 23 + localbus { 24 + ranges = <0 0 0xfc000000 0x01000000 25 + 3 0 0xe3000000 0x00100000>; 26 + 27 + flash@0,0 { 28 + compatible = "cfi-flash"; 29 + reg = <0 0 0x01000000>; 30 + bank-width = <2>; 31 + device-width = <2>; 32 + #size-cells = <1>; 33 + #address-cells = <1>; 34 + 35 + partition@60000 { 36 + label = "kernel"; 37 + reg = <0x00060000 0x00260000>; 38 + read-only; 39 + }; 40 + 41 + /* o3dnt specific partitions */ 42 + partition@2c0000 { 43 + label = "o3dnt user defined"; 44 + reg = <0x002c0000 0x00d40000>; 45 + }; 46 + }; 47 + }; 48 + };
-63
arch/powerpc/boot/dts/p1020rdb_camp_core0.dts
··· 1 - /* 2 - * P1020 RDB Core0 Device Tree Source in CAMP mode. 3 - * 4 - * In CAMP mode, each core needs to have its own dts. Only mpic and L2 cache 5 - * can be shared, all the other devices must be assigned to one core only. 6 - * This dts file allows core0 to have memory, l2, i2c, spi, gpio, tdm, dma, usb, 7 - * eth1, eth2, sdhc, crypto, global-util, message, pci0, pci1, msi. 8 - * 9 - * Please note to add "-b 0" for core0's dts compiling. 10 - * 11 - * Copyright 2011 Freescale Semiconductor Inc. 12 - * 13 - * This program is free software; you can redistribute it and/or modify it 14 - * under the terms of the GNU General Public License as published by the 15 - * Free Software Foundation; either version 2 of the License, or (at your 16 - * option) any later version. 17 - */ 18 - 19 - /include/ "p1020rdb.dts" 20 - 21 - / { 22 - model = "fsl,P1020RDB"; 23 - compatible = "fsl,P1020RDB", "fsl,MPC85XXRDB-CAMP"; 24 - 25 - aliases { 26 - ethernet1 = &enet1; 27 - ethernet2 = &enet2; 28 - serial0 = &serial0; 29 - pci0 = &pci0; 30 - pci1 = &pci1; 31 - }; 32 - 33 - cpus { 34 - PowerPC,P1020@1 { 35 - status = "disabled"; 36 - }; 37 - }; 38 - 39 - memory { 40 - device_type = "memory"; 41 - }; 42 - 43 - localbus@ffe05000 { 44 - status = "disabled"; 45 - }; 46 - 47 - soc@ffe00000 { 48 - serial1: serial@4600 { 49 - status = "disabled"; 50 - }; 51 - 52 - enet0: ethernet@b0000 { 53 - status = "disabled"; 54 - }; 55 - 56 - mpic: pic@40000 { 57 - protected-sources = < 58 - 42 29 30 34 /* serial1, enet0-queue-group0 */ 59 - 17 18 24 45 /* enet0-queue-group1, crypto */ 60 - >; 61 - }; 62 - }; 63 - };
-141
arch/powerpc/boot/dts/p1020rdb_camp_core1.dts
··· 1 - /* 2 - * P1020 RDB Core1 Device Tree Source in CAMP mode. 3 - * 4 - * In CAMP mode, each core needs to have its own dts. Only mpic and L2 cache 5 - * can be shared, all the other devices must be assigned to one core only. 6 - * This dts allows core1 to have l2, eth0, crypto. 7 - * 8 - * Please note to add "-b 1" for core1's dts compiling. 9 - * 10 - * Copyright 2011 Freescale Semiconductor Inc. 11 - * 12 - * This program is free software; you can redistribute it and/or modify it 13 - * under the terms of the GNU General Public License as published by the 14 - * Free Software Foundation; either version 2 of the License, or (at your 15 - * option) any later version. 16 - */ 17 - 18 - /include/ "p1020rdb.dts" 19 - 20 - / { 21 - model = "fsl,P1020RDB"; 22 - compatible = "fsl,P1020RDB", "fsl,MPC85XXRDB-CAMP"; 23 - 24 - aliases { 25 - ethernet0 = &enet0; 26 - serial0 = &serial1; 27 - }; 28 - 29 - cpus { 30 - PowerPC,P1020@0 { 31 - status = "disabled"; 32 - }; 33 - }; 34 - 35 - memory { 36 - device_type = "memory"; 37 - }; 38 - 39 - localbus@ffe05000 { 40 - status = "disabled"; 41 - }; 42 - 43 - soc@ffe00000 { 44 - ecm-law@0 { 45 - status = "disabled"; 46 - }; 47 - 48 - ecm@1000 { 49 - status = "disabled"; 50 - }; 51 - 52 - memory-controller@2000 { 53 - status = "disabled"; 54 - }; 55 - 56 - i2c@3000 { 57 - status = "disabled"; 58 - }; 59 - 60 - i2c@3100 { 61 - status = "disabled"; 62 - }; 63 - 64 - serial0: serial@4500 { 65 - status = "disabled"; 66 - }; 67 - 68 - spi@7000 { 69 - status = "disabled"; 70 - }; 71 - 72 - gpio: gpio-controller@f000 { 73 - status = "disabled"; 74 - }; 75 - 76 - dma@21300 { 77 - status = "disabled"; 78 - }; 79 - 80 - mdio@24000 { 81 - status = "disabled"; 82 - }; 83 - 84 - mdio@25000 { 85 - status = "disabled"; 86 - }; 87 - 88 - enet1: ethernet@b1000 { 89 - status = "disabled"; 90 - }; 91 - 92 - enet2: ethernet@b2000 { 93 - status = "disabled"; 94 - }; 95 - 96 - usb@22000 { 97 - status = "disabled"; 98 - }; 99 - 100 - sdhci@2e000 { 101 - status = "disabled"; 102 - }; 103 - 104 - mpic: pic@40000 { 105 - protected-sources = < 106 - 16 /* ecm, mem, L2, pci0, pci1 */ 107 - 43 42 59 /* i2c, serial0, spi */ 108 - 47 63 62 /* gpio, tdm */ 109 - 20 21 22 23 /* dma */ 110 - 03 02 /* mdio */ 111 - 35 36 40 /* enet1-queue-group0 */ 112 - 51 52 67 /* enet1-queue-group1 */ 113 - 31 32 33 /* enet2-queue-group0 */ 114 - 25 26 27 /* enet2-queue-group1 */ 115 - 28 72 58 /* usb, sdhci, crypto */ 116 - 0xb0 0xb1 0xb2 /* message */ 117 - 0xb3 0xb4 0xb5 118 - 0xb6 0xb7 119 - 0xe0 0xe1 0xe2 /* msi */ 120 - 0xe3 0xe4 0xe5 121 - 0xe6 0xe7 /* sdhci, crypto , pci */ 122 - >; 123 - }; 124 - 125 - msi@41600 { 126 - status = "disabled"; 127 - }; 128 - 129 - global-utilities@e0000 { //global utilities block 130 - status = "disabled"; 131 - }; 132 - }; 133 - 134 - pci0: pcie@ffe09000 { 135 - status = "disabled"; 136 - }; 137 - 138 - pci1: pcie@ffe0a000 { 139 - status = "disabled"; 140 - }; 141 - };
+4
arch/powerpc/boot/dts/p1022ds.dtsi
··· 149 149 compatible = "dallas,ds1339"; 150 150 reg = <0x68>; 151 151 }; 152 + adt7461@4c { 153 + compatible = "adi,adt7461"; 154 + reg = <0x4c>; 155 + }; 152 156 }; 153 157 154 158 spi@7000 {
+188
arch/powerpc/boot/dts/p1022rdk.dts
··· 1 + /* 2 + * P1022 RDK 32-bit Physical Address Map Device Tree Source 3 + * 4 + * Copyright 2012 Freescale Semiconductor Inc. 5 + * 6 + * Redistribution and use in source and binary forms, with or without 7 + * modification, are permitted provided that the following conditions are met: 8 + * * Redistributions of source code must retain the above copyright 9 + * notice, this list of conditions and the following disclaimer. 10 + * * Redistributions in binary form must reproduce the above copyright 11 + * notice, this list of conditions and the following disclaimer in the 12 + * documentation and/or other materials provided with the distribution. 13 + * * Neither the name of Freescale Semiconductor nor the 14 + * names of its contributors may be used to endorse or promote products 15 + * derived from this software without specific prior written permission. 16 + * 17 + * 18 + * ALTERNATIVELY, this software may be distributed under the terms of the 19 + * GNU General Public License ("GPL") as published by the Free Software 20 + * Foundation, either version 2 of that License or (at your option) any 21 + * later version. 22 + * 23 + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor "AS IS" AND ANY 24 + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY 27 + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 + */ 34 + 35 + /include/ "fsl/p1022si-pre.dtsi" 36 + / { 37 + model = "fsl,P1022RDK"; 38 + compatible = "fsl,P1022RDK"; 39 + 40 + memory { 41 + device_type = "memory"; 42 + }; 43 + 44 + board_lbc: lbc: localbus@ffe05000 { 45 + /* The P1022 RDK does not have any localbus devices */ 46 + status = "disabled"; 47 + }; 48 + 49 + board_soc: soc: soc@ffe00000 { 50 + ranges = <0x0 0x0 0xffe00000 0x100000>; 51 + 52 + i2c@3100 { 53 + wm8960:codec@1a { 54 + compatible = "wlf,wm8960"; 55 + reg = <0x1a>; 56 + /* MCLK source is a stand-alone oscillator */ 57 + clock-frequency = <12288000>; 58 + }; 59 + rtc@68 { 60 + compatible = "stm,m41t62"; 61 + reg = <0x68>; 62 + }; 63 + adt7461@4c{ 64 + compatible = "adi,adt7461"; 65 + reg = <0x4c>; 66 + }; 67 + zl6100@21{ 68 + compatible = "isil,zl6100"; 69 + reg = <0x21>; 70 + }; 71 + zl6100@24{ 72 + compatible = "isil,zl6100"; 73 + reg = <0x24>; 74 + }; 75 + zl6100@26{ 76 + compatible = "isil,zl6100"; 77 + reg = <0x26>; 78 + }; 79 + zl6100@29{ 80 + compatible = "isil,zl6100"; 81 + reg = <0x29>; 82 + }; 83 + }; 84 + 85 + spi@7000 { 86 + flash@0 { 87 + #address-cells = <1>; 88 + #size-cells = <1>; 89 + compatible = "spansion,m25p80"; 90 + reg = <0>; 91 + spi-max-frequency = <1000000>; 92 + partition@0 { 93 + label = "full-spi-flash"; 94 + reg = <0x00000000 0x00100000>; 95 + }; 96 + }; 97 + }; 98 + 99 + ssi@15000 { 100 + fsl,mode = "i2s-slave"; 101 + codec-handle = <&wm8960>; 102 + }; 103 + 104 + usb@22000 { 105 + phy_type = "ulpi"; 106 + }; 107 + 108 + usb@23000 { 109 + phy_type = "ulpi"; 110 + }; 111 + 112 + mdio@24000 { 113 + phy0: ethernet-phy@0 { 114 + interrupts = <3 1 0 0>; 115 + reg = <0x1>; 116 + }; 117 + phy1: ethernet-phy@1 { 118 + interrupts = <9 1 0 0>; 119 + reg = <0x2>; 120 + }; 121 + }; 122 + 123 + mdio@25000 { 124 + tbi0: tbi-phy@11 { 125 + reg = <0x11>; 126 + device_type = "tbi-phy"; 127 + }; 128 + }; 129 + 130 + ethernet@b0000 { 131 + phy-handle = <&phy0>; 132 + phy-connection-type = "rgmii-id"; 133 + }; 134 + 135 + ethernet@b1000 { 136 + phy-handle = <&phy1>; 137 + tbi-handle = <&tbi0>; 138 + phy-connection-type = "sgmii"; 139 + }; 140 + }; 141 + 142 + pci0: pcie@ffe09000 { 143 + ranges = <0x2000000 0x0 0xe0000000 0 0xa0000000 0x0 0x20000000 144 + 0x1000000 0x0 0x00000000 0 0xffc10000 0x0 0x10000>; 145 + reg = <0x0 0xffe09000 0 0x1000>; 146 + pcie@0 { 147 + ranges = <0x2000000 0x0 0xe0000000 148 + 0x2000000 0x0 0xe0000000 149 + 0x0 0x20000000 150 + 151 + 0x1000000 0x0 0x0 152 + 0x1000000 0x0 0x0 153 + 0x0 0x100000>; 154 + }; 155 + }; 156 + 157 + pci1: pcie@ffe0a000 { 158 + ranges = <0x2000000 0x0 0xe0000000 0 0xc0000000 0x0 0x20000000 159 + 0x1000000 0x0 0x00000000 0 0xffc20000 0x0 0x10000>; 160 + reg = <0 0xffe0a000 0 0x1000>; 161 + pcie@0 { 162 + ranges = <0x2000000 0x0 0xe0000000 163 + 0x2000000 0x0 0xe0000000 164 + 0x0 0x20000000 165 + 166 + 0x1000000 0x0 0x0 167 + 0x1000000 0x0 0x0 168 + 0x0 0x100000>; 169 + }; 170 + }; 171 + 172 + pci2: pcie@ffe0b000 { 173 + ranges = <0x2000000 0x0 0xe0000000 0 0x80000000 0x0 0x20000000 174 + 0x1000000 0x0 0x00000000 0 0xffc00000 0x0 0x10000>; 175 + reg = <0 0xffe0b000 0 0x1000>; 176 + pcie@0 { 177 + ranges = <0x2000000 0x0 0xe0000000 178 + 0x2000000 0x0 0xe0000000 179 + 0x0 0x20000000 180 + 181 + 0x1000000 0x0 0x0 182 + 0x1000000 0x0 0x0 183 + 0x0 0x100000>; 184 + }; 185 + }; 186 + }; 187 + 188 + /include/ "fsl/p1022si-post.dtsi"
-67
arch/powerpc/boot/dts/p2020rdb_camp_core0.dts
··· 1 - /* 2 - * P2020 RDB Core0 Device Tree Source in CAMP mode. 3 - * 4 - * In CAMP mode, each core needs to have its own dts. Only mpic and L2 cache 5 - * can be shared, all the other devices must be assigned to one core only. 6 - * This dts file allows core0 to have memory, l2, i2c, spi, gpio, dma1, usb, 7 - * eth1, eth2, sdhc, crypto, global-util, pci0. 8 - * 9 - * Copyright 2009-2011 Freescale Semiconductor Inc. 10 - * 11 - * This program is free software; you can redistribute it and/or modify it 12 - * under the terms of the GNU General Public License as published by the 13 - * Free Software Foundation; either version 2 of the License, or (at your 14 - * option) any later version. 15 - */ 16 - 17 - /include/ "p2020rdb.dts" 18 - 19 - / { 20 - model = "fsl,P2020RDB"; 21 - compatible = "fsl,P2020RDB", "fsl,MPC85XXRDB-CAMP"; 22 - 23 - cpus { 24 - PowerPC,P2020@1 { 25 - status = "disabled"; 26 - }; 27 - }; 28 - 29 - localbus@ffe05000 { 30 - status = "disabled"; 31 - }; 32 - 33 - soc@ffe00000 { 34 - serial1: serial@4600 { 35 - status = "disabled"; 36 - }; 37 - 38 - dma@c300 { 39 - status = "disabled"; 40 - }; 41 - 42 - enet0: ethernet@24000 { 43 - status = "disabled"; 44 - }; 45 - 46 - mpic: pic@40000 { 47 - protected-sources = < 48 - 42 76 77 78 79 /* serial1 , dma2 */ 49 - 29 30 34 26 /* enet0, pci1 */ 50 - 0xe0 0xe1 0xe2 0xe3 /* msi */ 51 - 0xe4 0xe5 0xe6 0xe7 52 - >; 53 - }; 54 - 55 - msi@41600 { 56 - status = "disabled"; 57 - }; 58 - }; 59 - 60 - pci0: pcie@ffe08000 { 61 - status = "disabled"; 62 - }; 63 - 64 - pci2: pcie@ffe0a000 { 65 - status = "disabled"; 66 - }; 67 - };
-125
arch/powerpc/boot/dts/p2020rdb_camp_core1.dts
··· 1 - /* 2 - * P2020 RDB Core1 Device Tree Source in CAMP mode. 3 - * 4 - * In CAMP mode, each core needs to have its own dts. Only mpic and L2 cache 5 - * can be shared, all the other devices must be assigned to one core only. 6 - * This dts allows core1 to have l2, dma2, eth0, pci1, msi. 7 - * 8 - * Please note to add "-b 1" for core1's dts compiling. 9 - * 10 - * Copyright 2009-2011 Freescale Semiconductor Inc. 11 - * 12 - * This program is free software; you can redistribute it and/or modify it 13 - * under the terms of the GNU General Public License as published by the 14 - * Free Software Foundation; either version 2 of the License, or (at your 15 - * option) any later version. 16 - */ 17 - 18 - /include/ "p2020rdb.dts" 19 - 20 - / { 21 - model = "fsl,P2020RDB"; 22 - compatible = "fsl,P2020RDB", "fsl,MPC85XXRDB-CAMP"; 23 - 24 - cpus { 25 - PowerPC,P2020@0 { 26 - status = "disabled"; 27 - }; 28 - }; 29 - 30 - localbus@ffe05000 { 31 - status = "disabled"; 32 - }; 33 - 34 - soc@ffe00000 { 35 - ecm-law@0 { 36 - status = "disabled"; 37 - }; 38 - 39 - ecm@1000 { 40 - status = "disabled"; 41 - }; 42 - 43 - memory-controller@2000 { 44 - status = "disabled"; 45 - }; 46 - 47 - i2c@3000 { 48 - status = "disabled"; 49 - }; 50 - 51 - i2c@3100 { 52 - status = "disabled"; 53 - }; 54 - 55 - serial0: serial@4500 { 56 - status = "disabled"; 57 - }; 58 - 59 - spi@7000 { 60 - status = "disabled"; 61 - }; 62 - 63 - gpio: gpio-controller@f000 { 64 - status = "disabled"; 65 - }; 66 - 67 - dma@21300 { 68 - status = "disabled"; 69 - }; 70 - 71 - usb@22000 { 72 - status = "disabled"; 73 - }; 74 - 75 - mdio@24520 { 76 - status = "disabled"; 77 - }; 78 - 79 - mdio@25520 { 80 - status = "disabled"; 81 - }; 82 - 83 - mdio@26520 { 84 - status = "disabled"; 85 - }; 86 - 87 - enet1: ethernet@25000 { 88 - status = "disabled"; 89 - }; 90 - 91 - enet2: ethernet@26000 { 92 - status = "disabled"; 93 - }; 94 - 95 - sdhci@2e000 { 96 - status = "disabled"; 97 - }; 98 - 99 - crypto@30000 { 100 - status = "disabled"; 101 - }; 102 - 103 - mpic: pic@40000 { 104 - protected-sources = < 105 - 17 18 43 42 59 47 /*ecm, mem, i2c, serial0, spi,gpio */ 106 - 16 20 21 22 23 28 /* L2, dma1, USB */ 107 - 03 35 36 40 31 32 33 /* mdio, enet1, enet2 */ 108 - 72 45 58 25 /* sdhci, crypto , pci */ 109 - >; 110 - }; 111 - 112 - global-utilities@e0000 { //global utilities block 113 - status = "disabled"; 114 - }; 115 - 116 - }; 117 - 118 - pci0: pcie@ffe08000 { 119 - status = "disabled"; 120 - }; 121 - 122 - pci1: pcie@ffe09000 { 123 - status = "disabled"; 124 - }; 125 - };
+4
arch/powerpc/boot/dts/p2041rdb.dts
··· 94 94 compatible = "pericom,pt7c4338"; 95 95 reg = <0x68>; 96 96 }; 97 + adt7461@4c { 98 + compatible = "adi,adt7461"; 99 + reg = <0x4c>; 100 + }; 97 101 }; 98 102 99 103 i2c@118100 {
+4
arch/powerpc/boot/dts/p3041ds.dts
··· 98 98 reg = <0x68>; 99 99 interrupts = <0x1 0x1 0 0>; 100 100 }; 101 + adt7461@4c { 102 + compatible = "adi,adt7461"; 103 + reg = <0x4c>; 104 + }; 101 105 }; 102 106 }; 103 107
+4
arch/powerpc/boot/dts/p4080ds.dts
··· 96 96 reg = <0x68>; 97 97 interrupts = <0x1 0x1 0 0>; 98 98 }; 99 + adt7461@4c { 100 + compatible = "adi,adt7461"; 101 + reg = <0x4c>; 102 + }; 99 103 }; 100 104 101 105 usb0: usb@210000 {
+4
arch/powerpc/boot/dts/p5020ds.dts
··· 98 98 reg = <0x68>; 99 99 interrupts = <0x1 0x1 0 0>; 100 100 }; 101 + adt7461@4c { 102 + compatible = "adi,adt7461"; 103 + reg = <0x4c>; 104 + }; 101 105 }; 102 106 }; 103 107
+207
arch/powerpc/boot/dts/p5040ds.dts
··· 1 + /* 2 + * P5040DS Device Tree Source 3 + * 4 + * Copyright 2012 Freescale Semiconductor Inc. 5 + * 6 + * Redistribution and use in source and binary forms, with or without 7 + * modification, are permitted provided that the following conditions are met: 8 + * * Redistributions of source code must retain the above copyright 9 + * notice, this list of conditions and the following disclaimer. 10 + * * Redistributions in binary form must reproduce the above copyright 11 + * notice, this list of conditions and the following disclaimer in the 12 + * documentation and/or other materials provided with the distribution. 13 + * * Neither the name of Freescale Semiconductor nor the 14 + * names of its contributors may be used to endorse or promote products 15 + * derived from this software without specific prior written permission. 16 + * 17 + * 18 + * ALTERNATIVELY, this software may be distributed under the terms of the 19 + * GNU General Public License ("GPL") as published by the Free Software 20 + * Foundation, either version 2 of that License or (at your option) any 21 + * later version. 22 + * 23 + * This software is provided by Freescale Semiconductor "as is" and any 24 + * express or implied warranties, including, but not limited to, the implied 25 + * warranties of merchantability and fitness for a particular purpose are 26 + * disclaimed. In no event shall Freescale Semiconductor be liable for any 27 + * direct, indirect, incidental, special, exemplary, or consequential damages 28 + * (including, but not limited to, procurement of substitute goods or services; 29 + * loss of use, data, or profits; or business interruption) however caused and 30 + * on any theory of liability, whether in contract, strict liability, or tort 31 + * (including negligence or otherwise) arising in any way out of the use of this 32 + * software, even if advised of the possibility of such damage. 33 + */ 34 + 35 + /include/ "fsl/p5040si-pre.dtsi" 36 + 37 + / { 38 + model = "fsl,P5040DS"; 39 + compatible = "fsl,P5040DS"; 40 + #address-cells = <2>; 41 + #size-cells = <2>; 42 + interrupt-parent = <&mpic>; 43 + 44 + memory { 45 + device_type = "memory"; 46 + }; 47 + 48 + dcsr: dcsr@f00000000 { 49 + ranges = <0x00000000 0xf 0x00000000 0x01008000>; 50 + }; 51 + 52 + soc: soc@ffe000000 { 53 + ranges = <0x00000000 0xf 0xfe000000 0x1000000>; 54 + reg = <0xf 0xfe000000 0 0x00001000>; 55 + spi@110000 { 56 + flash@0 { 57 + #address-cells = <1>; 58 + #size-cells = <1>; 59 + compatible = "spansion,s25sl12801"; 60 + reg = <0>; 61 + spi-max-frequency = <40000000>; /* input clock */ 62 + partition@u-boot { 63 + label = "u-boot"; 64 + reg = <0x00000000 0x00100000>; 65 + }; 66 + partition@kernel { 67 + label = "kernel"; 68 + reg = <0x00100000 0x00500000>; 69 + }; 70 + partition@dtb { 71 + label = "dtb"; 72 + reg = <0x00600000 0x00100000>; 73 + }; 74 + partition@fs { 75 + label = "file system"; 76 + reg = <0x00700000 0x00900000>; 77 + }; 78 + }; 79 + }; 80 + 81 + i2c@118100 { 82 + eeprom@51 { 83 + compatible = "at24,24c256"; 84 + reg = <0x51>; 85 + }; 86 + eeprom@52 { 87 + compatible = "at24,24c256"; 88 + reg = <0x52>; 89 + }; 90 + }; 91 + 92 + i2c@119100 { 93 + rtc@68 { 94 + compatible = "dallas,ds3232"; 95 + reg = <0x68>; 96 + interrupts = <0x1 0x1 0 0>; 97 + }; 98 + adt7461@4c { 99 + compatible = "adi,adt7461"; 100 + reg = <0x4c>; 101 + }; 102 + }; 103 + }; 104 + 105 + lbc: localbus@ffe124000 { 106 + reg = <0xf 0xfe124000 0 0x1000>; 107 + ranges = <0 0 0xf 0xe8000000 0x08000000 108 + 2 0 0xf 0xffa00000 0x00040000 109 + 3 0 0xf 0xffdf0000 0x00008000>; 110 + 111 + flash@0,0 { 112 + compatible = "cfi-flash"; 113 + reg = <0 0 0x08000000>; 114 + bank-width = <2>; 115 + device-width = <2>; 116 + }; 117 + 118 + nand@2,0 { 119 + #address-cells = <1>; 120 + #size-cells = <1>; 121 + compatible = "fsl,elbc-fcm-nand"; 122 + reg = <0x2 0x0 0x40000>; 123 + 124 + partition@0 { 125 + label = "NAND U-Boot Image"; 126 + reg = <0x0 0x02000000>; 127 + }; 128 + 129 + partition@2000000 { 130 + label = "NAND Root File System"; 131 + reg = <0x02000000 0x10000000>; 132 + }; 133 + 134 + partition@12000000 { 135 + label = "NAND Compressed RFS Image"; 136 + reg = <0x12000000 0x08000000>; 137 + }; 138 + 139 + partition@1a000000 { 140 + label = "NAND Linux Kernel Image"; 141 + reg = <0x1a000000 0x04000000>; 142 + }; 143 + 144 + partition@1e000000 { 145 + label = "NAND DTB Image"; 146 + reg = <0x1e000000 0x01000000>; 147 + }; 148 + 149 + partition@1f000000 { 150 + label = "NAND Writable User area"; 151 + reg = <0x1f000000 0x01000000>; 152 + }; 153 + }; 154 + 155 + board-control@3,0 { 156 + compatible = "fsl,p5040ds-fpga", "fsl,fpga-ngpixis"; 157 + reg = <3 0 0x40>; 158 + }; 159 + }; 160 + 161 + pci0: pcie@ffe200000 { 162 + reg = <0xf 0xfe200000 0 0x1000>; 163 + ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000 164 + 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>; 165 + pcie@0 { 166 + ranges = <0x02000000 0 0xe0000000 167 + 0x02000000 0 0xe0000000 168 + 0 0x20000000 169 + 170 + 0x01000000 0 0x00000000 171 + 0x01000000 0 0x00000000 172 + 0 0x00010000>; 173 + }; 174 + }; 175 + 176 + pci1: pcie@ffe201000 { 177 + reg = <0xf 0xfe201000 0 0x1000>; 178 + ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000 179 + 0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>; 180 + pcie@0 { 181 + ranges = <0x02000000 0 0xe0000000 182 + 0x02000000 0 0xe0000000 183 + 0 0x20000000 184 + 185 + 0x01000000 0 0x00000000 186 + 0x01000000 0 0x00000000 187 + 0 0x00010000>; 188 + }; 189 + }; 190 + 191 + pci2: pcie@ffe202000 { 192 + reg = <0xf 0xfe202000 0 0x1000>; 193 + ranges = <0x02000000 0 0xe0000000 0xc 0x40000000 0 0x20000000 194 + 0x01000000 0 0x00000000 0xf 0xf8020000 0 0x00010000>; 195 + pcie@0 { 196 + ranges = <0x02000000 0 0xe0000000 197 + 0x02000000 0 0xe0000000 198 + 0 0x20000000 199 + 200 + 0x01000000 0 0x00000000 201 + 0x01000000 0 0x00000000 202 + 0 0x00010000>; 203 + }; 204 + }; 205 + }; 206 + 207 + /include/ "fsl/p5040si-post.dtsi"
+6
arch/powerpc/configs/85xx/p1023rds_defconfig
··· 112 112 CONFIG_SND_MIXER_OSS=y 113 113 CONFIG_SND_PCM_OSS=y 114 114 # CONFIG_SND_SUPPORT_OLD_API is not set 115 + CONFIG_USB=y 116 + CONFIG_USB_DEVICEFS=y 117 + CONFIG_USB_MON=y 118 + CONFIG_USB_EHCI_HCD=y 119 + CONFIG_USB_EHCI_FSL=y 120 + CONFIG_USB_STORAGE=y 115 121 CONFIG_EDAC=y 116 122 CONFIG_EDAC_MM_EDAC=y 117 123 CONFIG_RTC_CLASS=y
+1
arch/powerpc/configs/corenet32_smp_defconfig
··· 27 27 CONFIG_P3041_DS=y 28 28 CONFIG_P4080_DS=y 29 29 CONFIG_P5020_DS=y 30 + CONFIG_P5040_DS=y 30 31 CONFIG_HIGHMEM=y 31 32 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 32 33 CONFIG_BINFMT_MISC=m
+1
arch/powerpc/configs/corenet64_smp_defconfig
··· 23 23 CONFIG_PARTITION_ADVANCED=y 24 24 CONFIG_MAC_PARTITION=y 25 25 CONFIG_P5020_DS=y 26 + CONFIG_P5040_DS=y 26 27 # CONFIG_PPC_OF_BOOT_TRAMPOLINE is not set 27 28 CONFIG_BINFMT_MISC=m 28 29 CONFIG_IRQ_ALL_CPUS=y
+1
arch/powerpc/configs/mpc85xx_defconfig
··· 30 30 CONFIG_MPC85xx_RDB=y 31 31 CONFIG_P1010_RDB=y 32 32 CONFIG_P1022_DS=y 33 + CONFIG_P1022_RDK=y 33 34 CONFIG_P1023_RDS=y 34 35 CONFIG_SOCRATES=y 35 36 CONFIG_KSI8560=y
+1
arch/powerpc/configs/mpc85xx_smp_defconfig
··· 32 32 CONFIG_MPC85xx_RDB=y 33 33 CONFIG_P1010_RDB=y 34 34 CONFIG_P1022_DS=y 35 + CONFIG_P1022_RDK=y 35 36 CONFIG_P1023_RDS=y 36 37 CONFIG_SOCRATES=y 37 38 CONFIG_KSI8560=y
+1
arch/powerpc/configs/ppc64_defconfig
··· 51 51 CONFIG_IRQ_ALL_CPUS=y 52 52 CONFIG_MEMORY_HOTREMOVE=y 53 53 CONFIG_SCHED_SMT=y 54 + CONFIG_PPC_DENORMALISATION=y 54 55 CONFIG_PCCARD=y 55 56 CONFIG_ELECTRA_CF=y 56 57 CONFIG_HOTPLUG_PCI=m
+1
arch/powerpc/configs/pseries_defconfig
··· 48 48 CONFIG_PPC_64K_PAGES=y 49 49 CONFIG_PPC_SUBPAGE_PROT=y 50 50 CONFIG_SCHED_SMT=y 51 + CONFIG_PPC_DENORMALISATION=y 51 52 CONFIG_HOTPLUG_PCI=m 52 53 CONFIG_HOTPLUG_PCI_RPA=m 53 54 CONFIG_HOTPLUG_PCI_RPA_DLPAR=m
-56
arch/powerpc/include/asm/abs_addr.h
··· 1 - #ifndef _ASM_POWERPC_ABS_ADDR_H 2 - #define _ASM_POWERPC_ABS_ADDR_H 3 - #ifdef __KERNEL__ 4 - 5 - 6 - /* 7 - * c 2001 PPC 64 Team, IBM Corp 8 - * 9 - * This program is free software; you can redistribute it and/or 10 - * modify it under the terms of the GNU General Public License 11 - * as published by the Free Software Foundation; either version 12 - * 2 of the License, or (at your option) any later version. 13 - */ 14 - 15 - #include <linux/memblock.h> 16 - 17 - #include <asm/types.h> 18 - #include <asm/page.h> 19 - #include <asm/prom.h> 20 - 21 - struct mschunks_map { 22 - unsigned long num_chunks; 23 - unsigned long chunk_size; 24 - unsigned long chunk_shift; 25 - unsigned long chunk_mask; 26 - u32 *mapping; 27 - }; 28 - 29 - extern struct mschunks_map mschunks_map; 30 - 31 - /* Chunks are 256 KB */ 32 - #define MSCHUNKS_CHUNK_SHIFT (18) 33 - #define MSCHUNKS_CHUNK_SIZE (1UL << MSCHUNKS_CHUNK_SHIFT) 34 - #define MSCHUNKS_OFFSET_MASK (MSCHUNKS_CHUNK_SIZE - 1) 35 - 36 - static inline unsigned long chunk_to_addr(unsigned long chunk) 37 - { 38 - return chunk << MSCHUNKS_CHUNK_SHIFT; 39 - } 40 - 41 - static inline unsigned long addr_to_chunk(unsigned long addr) 42 - { 43 - return addr >> MSCHUNKS_CHUNK_SHIFT; 44 - } 45 - 46 - static inline unsigned long phys_to_abs(unsigned long pa) 47 - { 48 - return pa; 49 - } 50 - 51 - /* Convenience macros */ 52 - #define virt_to_abs(va) phys_to_abs(__pa(va)) 53 - #define abs_to_virt(aa) __va(aa) 54 - 55 - #endif /* __KERNEL__ */ 56 - #endif /* _ASM_POWERPC_ABS_ADDR_H */
+2
arch/powerpc/include/asm/cacheflush.h
··· 30 30 #define flush_dcache_mmap_lock(mapping) do { } while (0) 31 31 #define flush_dcache_mmap_unlock(mapping) do { } while (0) 32 32 33 + extern void __flush_disable_L1(void); 34 + 33 35 extern void __flush_icache_range(unsigned long, unsigned long); 34 36 static inline void flush_icache_range(unsigned long start, unsigned long stop) 35 37 {
+1 -1
arch/powerpc/include/asm/debug.h
··· 44 44 static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; } 45 45 #endif 46 46 47 - extern int set_dabr(unsigned long dabr); 47 + extern int set_dabr(unsigned long dabr, unsigned long dabrx); 48 48 #ifdef CONFIG_PPC_ADV_DEBUG_REGS 49 49 extern void do_send_trap(struct pt_regs *regs, unsigned long address, 50 50 unsigned long error_code, int signal_code, int brkpt);
+101 -40
arch/powerpc/include/asm/eeh.h
··· 32 32 #ifdef CONFIG_EEH 33 33 34 34 /* 35 + * The struct is used to trace PE related EEH functionality. 36 + * In theory, there will have one instance of the struct to 37 + * be created against particular PE. In nature, PEs corelate 38 + * to each other. the struct has to reflect that hierarchy in 39 + * order to easily pick up those affected PEs when one particular 40 + * PE has EEH errors. 41 + * 42 + * Also, one particular PE might be composed of PCI device, PCI 43 + * bus and its subordinate components. The struct also need ship 44 + * the information. Further more, one particular PE is only meaingful 45 + * in the corresponding PHB. Therefore, the root PEs should be created 46 + * against existing PHBs in on-to-one fashion. 47 + */ 48 + #define EEH_PE_INVALID (1 << 0) /* Invalid */ 49 + #define EEH_PE_PHB (1 << 1) /* PHB PE */ 50 + #define EEH_PE_DEVICE (1 << 2) /* Device PE */ 51 + #define EEH_PE_BUS (1 << 3) /* Bus PE */ 52 + 53 + #define EEH_PE_ISOLATED (1 << 0) /* Isolated PE */ 54 + #define EEH_PE_RECOVERING (1 << 1) /* Recovering PE */ 55 + 56 + struct eeh_pe { 57 + int type; /* PE type: PHB/Bus/Device */ 58 + int state; /* PE EEH dependent mode */ 59 + int config_addr; /* Traditional PCI address */ 60 + int addr; /* PE configuration address */ 61 + struct pci_controller *phb; /* Associated PHB */ 62 + int check_count; /* Times of ignored error */ 63 + int freeze_count; /* Times of froze up */ 64 + int false_positives; /* Times of reported #ff's */ 65 + struct eeh_pe *parent; /* Parent PE */ 66 + struct list_head child_list; /* Link PE to the child list */ 67 + struct list_head edevs; /* Link list of EEH devices */ 68 + struct list_head child; /* Child PEs */ 69 + }; 70 + 71 + #define eeh_pe_for_each_dev(pe, edev) \ 72 + list_for_each_entry(edev, &pe->edevs, list) 73 + 74 + /* 35 75 * The struct is used to trace EEH state for the associated 36 76 * PCI device node or PCI device. In future, it might 37 77 * represent PE as well so that the EEH device to form 38 78 * another tree except the currently existing tree of PCI 39 79 * buses and PCI devices 40 80 */ 41 - #define EEH_MODE_SUPPORTED (1<<0) /* EEH supported on the device */ 42 - #define EEH_MODE_NOCHECK (1<<1) /* EEH check should be skipped */ 43 - #define EEH_MODE_ISOLATED (1<<2) /* The device has been isolated */ 44 - #define EEH_MODE_RECOVERING (1<<3) /* Recovering the device */ 45 - #define EEH_MODE_IRQ_DISABLED (1<<4) /* Interrupt disabled */ 81 + #define EEH_DEV_IRQ_DISABLED (1<<0) /* Interrupt disabled */ 46 82 47 83 struct eeh_dev { 48 84 int mode; /* EEH mode */ 49 85 int class_code; /* Class code of the device */ 50 86 int config_addr; /* Config address */ 51 87 int pe_config_addr; /* PE config address */ 52 - int check_count; /* Times of ignored error */ 53 - int freeze_count; /* Times of froze up */ 54 - int false_positives; /* Times of reported #ff's */ 55 88 u32 config_space[16]; /* Saved PCI config space */ 89 + struct eeh_pe *pe; /* Associated PE */ 90 + struct list_head list; /* Form link list in the PE */ 56 91 struct pci_controller *phb; /* Associated PHB */ 57 92 struct device_node *dn; /* Associated device node */ 58 93 struct pci_dev *pdev; /* Associated PCI device */ ··· 130 95 struct eeh_ops { 131 96 char *name; 132 97 int (*init)(void); 133 - int (*set_option)(struct device_node *dn, int option); 134 - int (*get_pe_addr)(struct device_node *dn); 135 - int (*get_state)(struct device_node *dn, int *state); 136 - int (*reset)(struct device_node *dn, int option); 137 - int (*wait_state)(struct device_node *dn, int max_wait); 138 - int (*get_log)(struct device_node *dn, int severity, char *drv_log, unsigned long len); 139 - int (*configure_bridge)(struct device_node *dn); 98 + void* (*of_probe)(struct device_node *dn, void *flag); 99 + void* (*dev_probe)(struct pci_dev *dev, void *flag); 100 + int (*set_option)(struct eeh_pe *pe, int option); 101 + int (*get_pe_addr)(struct eeh_pe *pe); 102 + int (*get_state)(struct eeh_pe *pe, int *state); 103 + int (*reset)(struct eeh_pe *pe, int option); 104 + int (*wait_state)(struct eeh_pe *pe, int max_wait); 105 + int (*get_log)(struct eeh_pe *pe, int severity, char *drv_log, unsigned long len); 106 + int (*configure_bridge)(struct eeh_pe *pe); 140 107 int (*read_config)(struct device_node *dn, int where, int size, u32 *val); 141 108 int (*write_config)(struct device_node *dn, int where, int size, u32 val); 142 109 }; 143 110 144 111 extern struct eeh_ops *eeh_ops; 145 112 extern int eeh_subsystem_enabled; 113 + extern struct mutex eeh_mutex; 114 + extern int eeh_probe_mode; 115 + 116 + #define EEH_PROBE_MODE_DEV (1<<0) /* From PCI device */ 117 + #define EEH_PROBE_MODE_DEVTREE (1<<1) /* From device tree */ 118 + 119 + static inline void eeh_probe_mode_set(int flag) 120 + { 121 + eeh_probe_mode = flag; 122 + } 123 + 124 + static inline int eeh_probe_mode_devtree(void) 125 + { 126 + return (eeh_probe_mode == EEH_PROBE_MODE_DEVTREE); 127 + } 128 + 129 + static inline int eeh_probe_mode_dev(void) 130 + { 131 + return (eeh_probe_mode == EEH_PROBE_MODE_DEV); 132 + } 133 + 134 + static inline void eeh_lock(void) 135 + { 136 + mutex_lock(&eeh_mutex); 137 + } 138 + 139 + static inline void eeh_unlock(void) 140 + { 141 + mutex_unlock(&eeh_mutex); 142 + } 146 143 147 144 /* 148 145 * Max number of EEH freezes allowed before we consider the device ··· 182 115 */ 183 116 #define EEH_MAX_ALLOWED_FREEZES 5 184 117 118 + typedef void *(*eeh_traverse_func)(void *data, void *flag); 119 + int __devinit eeh_phb_pe_create(struct pci_controller *phb); 120 + int eeh_add_to_parent_pe(struct eeh_dev *edev); 121 + int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe); 122 + void *eeh_pe_dev_traverse(struct eeh_pe *root, 123 + eeh_traverse_func fn, void *flag); 124 + void eeh_pe_restore_bars(struct eeh_pe *pe); 125 + struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe); 126 + 185 127 void * __devinit eeh_dev_init(struct device_node *dn, void *data); 186 128 void __devinit eeh_dev_phb_init_dynamic(struct pci_controller *phb); 187 - void __init eeh_dev_phb_init(void); 188 - void __init eeh_init(void); 189 - #ifdef CONFIG_PPC_PSERIES 190 - int __init eeh_pseries_init(void); 191 - #endif 192 129 int __init eeh_ops_register(struct eeh_ops *ops); 193 130 int __exit eeh_ops_unregister(const char *name); 194 131 unsigned long eeh_check_failure(const volatile void __iomem *token, 195 132 unsigned long val); 196 - int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev); 197 - void __init pci_addr_cache_build(void); 133 + int eeh_dev_check_failure(struct eeh_dev *edev); 134 + void __init eeh_addr_cache_build(void); 198 135 void eeh_add_device_tree_early(struct device_node *); 199 136 void eeh_add_device_tree_late(struct pci_bus *); 200 - void eeh_remove_bus_device(struct pci_dev *); 137 + void eeh_remove_bus_device(struct pci_dev *, int); 201 138 202 139 /** 203 140 * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure. ··· 227 156 228 157 static inline void eeh_dev_phb_init_dynamic(struct pci_controller *phb) { } 229 158 230 - static inline void eeh_dev_phb_init(void) { } 231 - 232 - static inline void eeh_init(void) { } 233 - 234 - #ifdef CONFIG_PPC_PSERIES 235 - static inline int eeh_pseries_init(void) 236 - { 237 - return 0; 238 - } 239 - #endif /* CONFIG_PPC_PSERIES */ 240 - 241 159 static inline unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val) 242 160 { 243 161 return val; 244 162 } 245 163 246 - static inline int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev) 247 - { 248 - return 0; 249 - } 164 + #define eeh_dev_check_failure(x) (0) 250 165 251 - static inline void pci_addr_cache_build(void) { } 166 + static inline void eeh_addr_cache_build(void) { } 252 167 253 168 static inline void eeh_add_device_tree_early(struct device_node *dn) { } 254 169 255 170 static inline void eeh_add_device_tree_late(struct pci_bus *bus) { } 256 171 257 - static inline void eeh_remove_bus_device(struct pci_dev *dev) { } 172 + static inline void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe) { } 173 + 174 + static inline void eeh_lock(void) { } 175 + static inline void eeh_unlock(void) { } 176 + 258 177 #define EEH_POSSIBLE_ERROR(val, type) (0) 259 178 #define EEH_IO_ERROR_VALUE(size) (-1UL) 260 179 #endif /* CONFIG_EEH */
+3 -3
arch/powerpc/include/asm/eeh_event.h
··· 28 28 */ 29 29 struct eeh_event { 30 30 struct list_head list; /* to form event queue */ 31 - struct eeh_dev *edev; /* EEH device */ 31 + struct eeh_pe *pe; /* EEH PE */ 32 32 }; 33 33 34 - int eeh_send_failure_event(struct eeh_dev *edev); 35 - struct eeh_dev *handle_eeh_events(struct eeh_event *); 34 + int eeh_send_failure_event(struct eeh_pe *pe); 35 + void eeh_handle_event(struct eeh_pe *pe); 36 36 37 37 #endif /* __KERNEL__ */ 38 38 #endif /* ASM_POWERPC_EEH_EVENT_H */
+4 -2
arch/powerpc/include/asm/exception-64e.h
··· 37 37 * critical data 38 38 */ 39 39 40 + #define PACA_EXGDBELL PACA_EXGEN 40 41 41 42 /* We are out of SPRGs so we save some things in the PACA. The normal 42 43 * exception frame is smaller than the CRIT or MC one though ··· 46 45 #define EX_CR (1 * 8) 47 46 #define EX_R10 (2 * 8) 48 47 #define EX_R11 (3 * 8) 49 - #define EX_R14 (4 * 8) 50 - #define EX_R15 (5 * 8) 48 + #define EX_R13 (4 * 8) 49 + #define EX_R14 (5 * 8) 50 + #define EX_R15 (6 * 8) 51 51 52 52 /* 53 53 * The TLB miss exception uses different slots.
+2
arch/powerpc/include/asm/fsl_guts.h
··· 48 48 __be32 dmuxcr; /* 0x.0068 - DMA Mux Control Register */ 49 49 u8 res06c[0x70 - 0x6c]; 50 50 __be32 devdisr; /* 0x.0070 - Device Disable Control */ 51 + #define CCSR_GUTS_DEVDISR_TB1 0x00001000 52 + #define CCSR_GUTS_DEVDISR_TB0 0x00004000 51 53 __be32 devdisr2; /* 0x.0074 - Device Disable Control 2 */ 52 54 u8 res078[0x7c - 0x78]; 53 55 __be32 pmjcr; /* 0x.007c - 4 Power Management Jog Control Register */
+8 -6
arch/powerpc/include/asm/fsl_ifc.h
··· 768 768 */ 769 769 struct fsl_ifc_regs { 770 770 __be32 ifc_rev; 771 - u32 res1[0x3]; 771 + u32 res1[0x2]; 772 772 struct { 773 + __be32 cspr_ext; 773 774 __be32 cspr; 774 - u32 res2[0x2]; 775 + u32 res2; 775 776 } cspr_cs[FSL_IFC_BANK_COUNT]; 776 - u32 res3[0x18]; 777 + u32 res3[0x19]; 777 778 struct { 778 779 __be32 amask; 779 780 u32 res4[0x2]; 780 781 } amask_cs[FSL_IFC_BANK_COUNT]; 781 - u32 res5[0x18]; 782 + u32 res5[0x17]; 782 783 struct { 784 + __be32 csor_ext; 783 785 __be32 csor; 784 - u32 res6[0x2]; 786 + u32 res6; 785 787 } csor_cs[FSL_IFC_BANK_COUNT]; 786 - u32 res7[0x18]; 788 + u32 res7[0x19]; 787 789 struct { 788 790 __be32 ftim[4]; 789 791 u32 res8[0x8];
-5
arch/powerpc/include/asm/hvcall.h
··· 152 152 #define H_VASI_RESUMED 5 153 153 #define H_VASI_COMPLETED 6 154 154 155 - /* DABRX flags */ 156 - #define H_DABRX_HYPERVISOR (1UL<<(63-61)) 157 - #define H_DABRX_KERNEL (1UL<<(63-62)) 158 - #define H_DABRX_USER (1UL<<(63-63)) 159 - 160 155 /* Each control block has to be on a 4K boundary */ 161 156 #define H_CB_ALIGNMENT 4096 162 157
+5 -4
arch/powerpc/include/asm/hw_breakpoint.h
··· 27 27 #ifdef CONFIG_HAVE_HW_BREAKPOINT 28 28 29 29 struct arch_hw_breakpoint { 30 - bool extraneous_interrupt; 31 - u8 len; /* length of the target data symbol */ 32 - int type; 33 30 unsigned long address; 31 + unsigned long dabrx; 32 + int type; 33 + u8 len; /* length of the target data symbol */ 34 + bool extraneous_interrupt; 34 35 }; 35 36 36 37 #include <linux/kdebug.h> ··· 62 61 struct perf_sample_data *data, struct pt_regs *regs); 63 62 static inline void hw_breakpoint_disable(void) 64 63 { 65 - set_dabr(0); 64 + set_dabr(0, 0); 66 65 } 67 66 extern void thread_change_pc(struct task_struct *tsk, struct pt_regs *regs); 68 67
+2 -13
arch/powerpc/include/asm/kprobes.h
··· 29 29 #include <linux/types.h> 30 30 #include <linux/ptrace.h> 31 31 #include <linux/percpu.h> 32 + #include <asm/probes.h> 32 33 33 34 #define __ARCH_WANT_KPROBES_INSN_SLOT 34 35 35 36 struct pt_regs; 36 37 struct kprobe; 37 38 38 - typedef unsigned int kprobe_opcode_t; 39 - #define BREAKPOINT_INSTRUCTION 0x7fe00008 /* trap */ 39 + typedef ppc_opcode_t kprobe_opcode_t; 40 40 #define MAX_INSN_SIZE 1 41 - 42 - #define IS_TW(instr) (((instr) & 0xfc0007fe) == 0x7c000008) 43 - #define IS_TD(instr) (((instr) & 0xfc0007fe) == 0x7c000088) 44 - #define IS_TDI(instr) (((instr) & 0xfc000000) == 0x08000000) 45 - #define IS_TWI(instr) (((instr) & 0xfc000000) == 0x0c000000) 46 41 47 42 #ifdef CONFIG_PPC64 48 43 /* ··· 67 72 addr = (kprobe_opcode_t *)kallsyms_lookup_name(dot_name); \ 68 73 } \ 69 74 } 70 - 71 - #define is_trap(instr) (IS_TW(instr) || IS_TD(instr) || \ 72 - IS_TWI(instr) || IS_TDI(instr)) 73 - #else 74 - /* Use stock kprobe_lookup_name since ppc32 doesn't use function descriptors */ 75 - #define is_trap(instr) (IS_TW(instr) || IS_TWI(instr)) 76 75 #endif 77 76 78 77 #define flush_insn_slot(p) do { } while (0)
+1 -1
arch/powerpc/include/asm/kvm_book3s.h
··· 59 59 struct hlist_node list_vpte; 60 60 struct hlist_node list_vpte_long; 61 61 struct rcu_head rcu_head; 62 - u64 host_va; 62 + u64 host_vpn; 63 63 u64 pfn; 64 64 ulong slot; 65 65 struct kvmppc_pte pte;
-1
arch/powerpc/include/asm/kvm_book3s_asm.h
··· 74 74 ulong vmhandler; 75 75 ulong scratch0; 76 76 ulong scratch1; 77 - ulong sprg3; 78 77 u8 in_guest; 79 78 u8 restore_hid5; 80 79 u8 napping;
+5 -4
arch/powerpc/include/asm/machdep.h
··· 34 34 char *name; 35 35 #ifdef CONFIG_PPC64 36 36 void (*hpte_invalidate)(unsigned long slot, 37 - unsigned long va, 37 + unsigned long vpn, 38 38 int psize, int ssize, 39 39 int local); 40 40 long (*hpte_updatepp)(unsigned long slot, 41 41 unsigned long newpp, 42 - unsigned long va, 42 + unsigned long vpn, 43 43 int psize, int ssize, 44 44 int local); 45 45 void (*hpte_updateboltedpp)(unsigned long newpp, 46 46 unsigned long ea, 47 47 int psize, int ssize); 48 48 long (*hpte_insert)(unsigned long hpte_group, 49 - unsigned long va, 49 + unsigned long vpn, 50 50 unsigned long prpn, 51 51 unsigned long rflags, 52 52 unsigned long vflags, ··· 180 180 void (*enable_pmcs)(void); 181 181 182 182 /* Set DABR for this platform, leave empty for default implemenation */ 183 - int (*set_dabr)(unsigned long dabr); 183 + int (*set_dabr)(unsigned long dabr, 184 + unsigned long dabrx); 184 185 185 186 #ifdef CONFIG_PPC32 /* XXX for now */ 186 187 /* A general init function, called by ppc_init in init/main.c.
+121 -50
arch/powerpc/include/asm/mmu-hash64.h
··· 16 16 #include <asm/page.h> 17 17 18 18 /* 19 + * This is necessary to get the definition of PGTABLE_RANGE which we 20 + * need for various slices related matters. Note that this isn't the 21 + * complete pgtable.h but only a portion of it. 22 + */ 23 + #include <asm/pgtable-ppc64.h> 24 + 25 + /* 19 26 * Segment table 20 27 */ 21 28 ··· 161 154 #define MMU_SEGSIZE_256M 0 162 155 #define MMU_SEGSIZE_1T 1 163 156 157 + /* 158 + * encode page number shift. 159 + * in order to fit the 78 bit va in a 64 bit variable we shift the va by 160 + * 12 bits. This enable us to address upto 76 bit va. 161 + * For hpt hash from a va we can ignore the page size bits of va and for 162 + * hpte encoding we ignore up to 23 bits of va. So ignoring lower 12 bits ensure 163 + * we work in all cases including 4k page size. 164 + */ 165 + #define VPN_SHIFT 12 164 166 165 167 #ifndef __ASSEMBLY__ 168 + 169 + static inline int segment_shift(int ssize) 170 + { 171 + if (ssize == MMU_SEGSIZE_256M) 172 + return SID_SHIFT; 173 + return SID_SHIFT_1T; 174 + } 166 175 167 176 /* 168 177 * The current system page and segment sizes ··· 203 180 extern int mmu_ci_restrictions; 204 181 205 182 /* 183 + * This computes the AVPN and B fields of the first dword of a HPTE, 184 + * for use when we want to match an existing PTE. The bottom 7 bits 185 + * of the returned value are zero. 186 + */ 187 + static inline unsigned long hpte_encode_avpn(unsigned long vpn, int psize, 188 + int ssize) 189 + { 190 + unsigned long v; 191 + /* 192 + * The AVA field omits the low-order 23 bits of the 78 bits VA. 193 + * These bits are not needed in the PTE, because the 194 + * low-order b of these bits are part of the byte offset 195 + * into the virtual page and, if b < 23, the high-order 196 + * 23-b of these bits are always used in selecting the 197 + * PTEGs to be searched 198 + */ 199 + v = (vpn >> (23 - VPN_SHIFT)) & ~(mmu_psize_defs[psize].avpnm); 200 + v <<= HPTE_V_AVPN_SHIFT; 201 + v |= ((unsigned long) ssize) << HPTE_V_SSIZE_SHIFT; 202 + return v; 203 + } 204 + 205 + /* 206 206 * This function sets the AVPN and L fields of the HPTE appropriately 207 207 * for the page size 208 208 */ 209 - static inline unsigned long hpte_encode_v(unsigned long va, int psize, 210 - int ssize) 209 + static inline unsigned long hpte_encode_v(unsigned long vpn, 210 + int psize, int ssize) 211 211 { 212 212 unsigned long v; 213 - v = (va >> 23) & ~(mmu_psize_defs[psize].avpnm); 214 - v <<= HPTE_V_AVPN_SHIFT; 213 + v = hpte_encode_avpn(vpn, psize, ssize); 215 214 if (psize != MMU_PAGE_4K) 216 215 v |= HPTE_V_LARGE; 217 - v |= ((unsigned long) ssize) << HPTE_V_SSIZE_SHIFT; 218 216 return v; 219 217 } 220 218 ··· 260 216 } 261 217 262 218 /* 263 - * Build a VA given VSID, EA and segment size 219 + * Build a VPN_SHIFT bit shifted va given VSID, EA and segment size. 264 220 */ 265 - static inline unsigned long hpt_va(unsigned long ea, unsigned long vsid, 266 - int ssize) 221 + static inline unsigned long hpt_vpn(unsigned long ea, 222 + unsigned long vsid, int ssize) 267 223 { 268 - if (ssize == MMU_SEGSIZE_256M) 269 - return (vsid << 28) | (ea & 0xfffffffUL); 270 - return (vsid << 40) | (ea & 0xffffffffffUL); 224 + unsigned long mask; 225 + int s_shift = segment_shift(ssize); 226 + 227 + mask = (1ul << (s_shift - VPN_SHIFT)) - 1; 228 + return (vsid << (s_shift - VPN_SHIFT)) | ((ea >> VPN_SHIFT) & mask); 271 229 } 272 230 273 231 /* 274 232 * This hashes a virtual address 275 233 */ 276 - 277 - static inline unsigned long hpt_hash(unsigned long va, unsigned int shift, 278 - int ssize) 234 + static inline unsigned long hpt_hash(unsigned long vpn, 235 + unsigned int shift, int ssize) 279 236 { 237 + int mask; 280 238 unsigned long hash, vsid; 281 239 240 + /* VPN_SHIFT can be atmost 12 */ 282 241 if (ssize == MMU_SEGSIZE_256M) { 283 - hash = (va >> 28) ^ ((va & 0x0fffffffUL) >> shift); 242 + mask = (1ul << (SID_SHIFT - VPN_SHIFT)) - 1; 243 + hash = (vpn >> (SID_SHIFT - VPN_SHIFT)) ^ 244 + ((vpn & mask) >> (shift - VPN_SHIFT)); 284 245 } else { 285 - vsid = va >> 40; 286 - hash = vsid ^ (vsid << 25) ^ ((va & 0xffffffffffUL) >> shift); 246 + mask = (1ul << (SID_SHIFT_1T - VPN_SHIFT)) - 1; 247 + vsid = vpn >> (SID_SHIFT_1T - VPN_SHIFT); 248 + hash = vsid ^ (vsid << 25) ^ 249 + ((vpn & mask) >> (shift - VPN_SHIFT)) ; 287 250 } 288 251 return hash & 0x7fffffffffUL; 289 252 } ··· 331 280 #endif /* __ASSEMBLY__ */ 332 281 333 282 /* 334 - * VSID allocation 283 + * VSID allocation (256MB segment) 335 284 * 336 - * We first generate a 36-bit "proto-VSID". For kernel addresses this 337 - * is equal to the ESID, for user addresses it is: 338 - * (context << 15) | (esid & 0x7fff) 285 + * We first generate a 38-bit "proto-VSID". For kernel addresses this 286 + * is equal to the ESID | 1 << 37, for user addresses it is: 287 + * (context << USER_ESID_BITS) | (esid & ((1U << USER_ESID_BITS) - 1) 339 288 * 340 - * The two forms are distinguishable because the top bit is 0 for user 341 - * addresses, whereas the top two bits are 1 for kernel addresses. 342 - * Proto-VSIDs with the top two bits equal to 0b10 are reserved for 343 - * now. 289 + * This splits the proto-VSID into the below range 290 + * 0 - (2^(CONTEXT_BITS + USER_ESID_BITS) - 1) : User proto-VSID range 291 + * 2^(CONTEXT_BITS + USER_ESID_BITS) - 2^(VSID_BITS) : Kernel proto-VSID range 292 + * 293 + * We also have CONTEXT_BITS + USER_ESID_BITS = VSID_BITS - 1 294 + * That is, we assign half of the space to user processes and half 295 + * to the kernel. 344 296 * 345 297 * The proto-VSIDs are then scrambled into real VSIDs with the 346 298 * multiplicative hash: 347 299 * 348 300 * VSID = (proto-VSID * VSID_MULTIPLIER) % VSID_MODULUS 349 - * where VSID_MULTIPLIER = 268435399 = 0xFFFFFC7 350 - * VSID_MODULUS = 2^36-1 = 0xFFFFFFFFF 351 301 * 352 - * This scramble is only well defined for proto-VSIDs below 353 - * 0xFFFFFFFFF, so both proto-VSID and actual VSID 0xFFFFFFFFF are 354 - * reserved. VSID_MULTIPLIER is prime, so in particular it is 302 + * VSID_MULTIPLIER is prime, so in particular it is 355 303 * co-prime to VSID_MODULUS, making this a 1:1 scrambling function. 356 304 * Because the modulus is 2^n-1 we can compute it efficiently without 357 305 * a divide or extra multiply (see below). 358 306 * 359 307 * This scheme has several advantages over older methods: 360 308 * 361 - * - We have VSIDs allocated for every kernel address 309 + * - We have VSIDs allocated for every kernel address 362 310 * (i.e. everything above 0xC000000000000000), except the very top 363 311 * segment, which simplifies several things. 364 312 * 365 - * - We allow for 16 significant bits of ESID and 19 bits of 366 - * context for user addresses. i.e. 16T (44 bits) of address space for 367 - * up to half a million contexts. 313 + * - We allow for USER_ESID_BITS significant bits of ESID and 314 + * CONTEXT_BITS bits of context for user addresses. 315 + * i.e. 64T (46 bits) of address space for up to half a million contexts. 368 316 * 369 - * - The scramble function gives robust scattering in the hash 317 + * - The scramble function gives robust scattering in the hash 370 318 * table (at least based on some initial results). The previous 371 319 * method was more susceptible to pathological cases giving excessive 372 320 * hash collisions. 373 321 */ 374 - /* 375 - * WARNING - If you change these you must make sure the asm 376 - * implementations in slb_allocate (slb_low.S), do_stab_bolted 377 - * (head.S) and ASM_VSID_SCRAMBLE (below) are changed accordingly. 378 - */ 379 322 380 - #define VSID_MULTIPLIER_256M ASM_CONST(200730139) /* 28-bit prime */ 381 - #define VSID_BITS_256M 36 323 + /* 324 + * This should be computed such that protovosid * vsid_mulitplier 325 + * doesn't overflow 64 bits. It should also be co-prime to vsid_modulus 326 + */ 327 + #define VSID_MULTIPLIER_256M ASM_CONST(12538073) /* 24-bit prime */ 328 + #define VSID_BITS_256M 38 382 329 #define VSID_MODULUS_256M ((1UL<<VSID_BITS_256M)-1) 383 330 384 331 #define VSID_MULTIPLIER_1T ASM_CONST(12538073) /* 24-bit prime */ 385 - #define VSID_BITS_1T 24 332 + #define VSID_BITS_1T 26 386 333 #define VSID_MODULUS_1T ((1UL<<VSID_BITS_1T)-1) 387 334 388 335 #define CONTEXT_BITS 19 389 - #define USER_ESID_BITS 16 390 - #define USER_ESID_BITS_1T 4 336 + #define USER_ESID_BITS 18 337 + #define USER_ESID_BITS_1T 6 391 338 392 339 #define USER_VSID_RANGE (1UL << (USER_ESID_BITS + SID_SHIFT)) 393 340 ··· 421 372 srdi rx,rx,VSID_BITS_##size; /* extract 2^VSID_BITS bit */ \ 422 373 add rt,rt,rx 423 374 375 + /* 4 bits per slice and we have one slice per 1TB */ 376 + #define SLICE_ARRAY_SIZE (PGTABLE_RANGE >> 41) 424 377 425 378 #ifndef __ASSEMBLY__ 426 379 ··· 467 416 468 417 #ifdef CONFIG_PPC_MM_SLICES 469 418 u64 low_slices_psize; /* SLB page size encodings */ 470 - u64 high_slices_psize; /* 4 bits per slice for now */ 419 + unsigned char high_slices_psize[SLICE_ARRAY_SIZE]; 471 420 #else 472 421 u16 sllp; /* SLB page size encoding */ 473 422 #endif ··· 503 452 }) 504 453 #endif /* 1 */ 505 454 506 - /* This is only valid for addresses >= PAGE_OFFSET */ 455 + /* 456 + * This is only valid for addresses >= PAGE_OFFSET 457 + * The proto-VSID space is divided into two class 458 + * User: 0 to 2^(CONTEXT_BITS + USER_ESID_BITS) -1 459 + * kernel: 2^(CONTEXT_BITS + USER_ESID_BITS) to 2^(VSID_BITS) - 1 460 + * 461 + * With KERNEL_START at 0xc000000000000000, the proto vsid for 462 + * the kernel ends up with 0xc00000000 (36 bits). With 64TB 463 + * support we need to have kernel proto-VSID in the 464 + * [2^37 to 2^38 - 1] range due to the increased USER_ESID_BITS. 465 + */ 507 466 static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize) 508 467 { 509 - if (ssize == MMU_SEGSIZE_256M) 510 - return vsid_scramble(ea >> SID_SHIFT, 256M); 511 - return vsid_scramble(ea >> SID_SHIFT_1T, 1T); 468 + unsigned long proto_vsid; 469 + /* 470 + * We need to make sure proto_vsid for the kernel is 471 + * >= 2^(CONTEXT_BITS + USER_ESID_BITS[_1T]) 472 + */ 473 + if (ssize == MMU_SEGSIZE_256M) { 474 + proto_vsid = ea >> SID_SHIFT; 475 + proto_vsid |= (1UL << (CONTEXT_BITS + USER_ESID_BITS)); 476 + return vsid_scramble(proto_vsid, 256M); 477 + } 478 + proto_vsid = ea >> SID_SHIFT_1T; 479 + proto_vsid |= (1UL << (CONTEXT_BITS + USER_ESID_BITS_1T)); 480 + return vsid_scramble(proto_vsid, 1T); 512 481 } 513 482 514 483 /* Returns the segment size indicator for a user address */
+9
arch/powerpc/include/asm/mmu.h
··· 146 146 extern u64 ppc64_rma_size; 147 147 #endif /* CONFIG_PPC64 */ 148 148 149 + struct mm_struct; 150 + #ifdef CONFIG_DEBUG_VM 151 + extern void assert_pte_locked(struct mm_struct *mm, unsigned long addr); 152 + #else /* CONFIG_DEBUG_VM */ 153 + static inline void assert_pte_locked(struct mm_struct *mm, unsigned long addr) 154 + { 155 + } 156 + #endif /* !CONFIG_DEBUG_VM */ 157 + 149 158 #endif /* !__ASSEMBLY__ */ 150 159 151 160 /* The kernel use the constants below to index in the page sizes array.
+2
arch/powerpc/include/asm/mpc52xx.h
··· 307 307 size_t size; 308 308 size_t pos; /* current position of transfer */ 309 309 int flags; 310 + int defer_xfer_start; 310 311 311 312 /* What to do when finished */ 312 313 void (*callback)(struct mpc52xx_lpbfifo_request *); ··· 324 323 extern int mpc52xx_lpbfifo_submit(struct mpc52xx_lpbfifo_request *req); 325 324 extern void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req); 326 325 extern void mpc52xx_lpbfifo_poll(void); 326 + extern int mpc52xx_lpbfifo_start_xfer(struct mpc52xx_lpbfifo_request *req); 327 327 328 328 /* mpc52xx_pic.c */ 329 329 extern void mpc52xx_init_irq(void);
+19
arch/powerpc/include/asm/mpic.h
··· 63 63 */ 64 64 #define MPIC_TIMER_BASE 0x01100 65 65 #define MPIC_TIMER_STRIDE 0x40 66 + #define MPIC_TIMER_GROUP_STRIDE 0x1000 66 67 67 68 #define MPIC_TIMER_CURRENT_CNT 0x00000 68 69 #define MPIC_TIMER_BASE_CNT 0x00010 ··· 111 110 #define MPIC_VECPRI_SENSE_MASK 0x00400000 112 111 #define MPIC_IRQ_DESTINATION 0x00010 113 112 113 + #define MPIC_FSL_BRR1 0x00000 114 + #define MPIC_FSL_BRR1_VER 0x0000ffff 115 + 114 116 #define MPIC_MAX_IRQ_SOURCES 2048 115 117 #define MPIC_MAX_CPUS 32 116 118 #define MPIC_MAX_ISU 32 119 + 120 + #define MPIC_MAX_ERR 32 121 + #define MPIC_FSL_ERR_INT 16 117 122 118 123 /* 119 124 * Tsi108 implementation of MPIC has many differences from the original one ··· 273 266 struct irq_chip hc_ipi; 274 267 #endif 275 268 struct irq_chip hc_tm; 269 + struct irq_chip hc_err; 276 270 const char *name; 277 271 /* Flags */ 278 272 unsigned int flags; ··· 287 279 /* vector numbers used for internal sources (ipi/timers) */ 288 280 unsigned int ipi_vecs[4]; 289 281 unsigned int timer_vecs[8]; 282 + /* vector numbers used for FSL MPIC error interrupts */ 283 + unsigned int err_int_vecs[MPIC_MAX_ERR]; 290 284 291 285 /* Spurious vector to program into unused sources */ 292 286 unsigned int spurious_vec; ··· 306 296 phys_addr_t paddr; 307 297 308 298 /* The various ioremap'ed bases */ 299 + struct mpic_reg_bank thiscpuregs; 309 300 struct mpic_reg_bank gregs; 310 301 struct mpic_reg_bank tmregs; 311 302 struct mpic_reg_bank cpuregs[MPIC_MAX_CPUS]; 312 303 struct mpic_reg_bank isus[MPIC_MAX_ISU]; 304 + 305 + /* ioremap'ed base for error interrupt registers */ 306 + u32 __iomem *err_regs; 313 307 314 308 /* Protected sources */ 315 309 unsigned long *protected; ··· 379 365 #define MPIC_NO_RESET 0x00004000 380 366 /* Freescale MPIC (compatible includes "fsl,mpic") */ 381 367 #define MPIC_FSL 0x00008000 368 + /* Freescale MPIC supports EIMR (error interrupt mask register). 369 + * This flag is set for MPIC version >= 4.1 (version determined 370 + * from the BRR1 register). 371 + */ 372 + #define MPIC_FSL_HAS_EIMR 0x00010000 382 373 383 374 /* MPIC HW modification ID */ 384 375 #define MPIC_REGSET_MASK 0xf0000000
+2 -1
arch/powerpc/include/asm/paca.h
··· 100 100 /* SLB related definitions */ 101 101 u16 vmalloc_sllp; 102 102 u16 slb_cache_ptr; 103 - u16 slb_cache[SLB_CACHE_ENTRIES]; 103 + u32 slb_cache[SLB_CACHE_ENTRIES]; 104 104 #endif /* CONFIG_PPC_STD_MMU_64 */ 105 105 106 106 #ifdef CONFIG_PPC_BOOK3E ··· 136 136 u8 io_sync; /* writel() needs spin_unlock sync */ 137 137 u8 irq_work_pending; /* IRQ_WORK interrupt while soft-disable */ 138 138 u8 nap_state_lost; /* NV GPR values lost in power7_idle */ 139 + u64 sprg3; /* Saved user-visible sprg */ 139 140 140 141 #ifdef CONFIG_PPC_POWERNV 141 142 /* Pointer to OPAL machine check event structure set by the
+9 -1
arch/powerpc/include/asm/page_64.h
··· 78 78 #define GET_LOW_SLICE_INDEX(addr) ((addr) >> SLICE_LOW_SHIFT) 79 79 #define GET_HIGH_SLICE_INDEX(addr) ((addr) >> SLICE_HIGH_SHIFT) 80 80 81 + /* 82 + * 1 bit per slice and we have one slice per 1TB 83 + * Right now we support only 64TB. 84 + * IF we change this we will have to change the type 85 + * of high_slices 86 + */ 87 + #define SLICE_MASK_SIZE 8 88 + 81 89 #ifndef __ASSEMBLY__ 82 90 83 91 struct slice_mask { 84 92 u16 low_slices; 85 - u16 high_slices; 93 + u64 high_slices; 86 94 }; 87 95 88 96 struct mm_struct;
+11
arch/powerpc/include/asm/pci-bridge.h
··· 182 182 #if defined(CONFIG_EEH) 183 183 static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn) 184 184 { 185 + /* 186 + * For those OF nodes whose parent isn't PCI bridge, they 187 + * don't have PCI_DN actually. So we have to skip them for 188 + * any EEH operations. 189 + */ 190 + if (!dn || !PCI_DN(dn)) 191 + return NULL; 192 + 185 193 return PCI_DN(dn)->edev; 186 194 } 195 + #else 196 + #define of_node_to_eeh_dev(x) (NULL) 187 197 #endif 188 198 189 199 /** Find the bus corresponding to the indicated device node */ 190 200 extern struct pci_bus *pcibios_find_pci_bus(struct device_node *dn); 191 201 192 202 /** Remove all of the PCI devices under this bus */ 203 + extern void __pcibios_remove_pci_devices(struct pci_bus *bus, int purge_pe); 193 204 extern void pcibios_remove_pci_devices(struct pci_bus *bus); 194 205 195 206 /** Discover new pci devices under this bus, and add them */
+1
arch/powerpc/include/asm/perf_event_server.h
··· 49 49 #define PPMU_ALT_SIPR 2 /* uses alternate posn for SIPR/HV */ 50 50 #define PPMU_NO_SIPR 4 /* no SIPR/HV in MMCRA at all */ 51 51 #define PPMU_NO_CONT_SAMPLING 8 /* no continuous sampling */ 52 + #define PPMU_SIAR_VALID 16 /* Processor has SIAR Valid bit */ 52 53 53 54 /* 54 55 * Values for flags to get_alternatives()
+2 -2
arch/powerpc/include/asm/pgtable-ppc64-4k.h
··· 7 7 */ 8 8 #define PTE_INDEX_SIZE 9 9 9 #define PMD_INDEX_SIZE 7 10 - #define PUD_INDEX_SIZE 7 10 + #define PUD_INDEX_SIZE 9 11 11 #define PGD_INDEX_SIZE 9 12 12 13 13 #ifndef __ASSEMBLY__ ··· 19 19 20 20 #define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) 21 21 #define PTRS_PER_PMD (1 << PMD_INDEX_SIZE) 22 - #define PTRS_PER_PUD (1 << PMD_INDEX_SIZE) 22 + #define PTRS_PER_PUD (1 << PUD_INDEX_SIZE) 23 23 #define PTRS_PER_PGD (1 << PGD_INDEX_SIZE) 24 24 25 25 /* PMD_SHIFT determines what a second-level page table entry can map */
+1 -1
arch/powerpc/include/asm/pgtable-ppc64-64k.h
··· 7 7 #define PTE_INDEX_SIZE 12 8 8 #define PMD_INDEX_SIZE 12 9 9 #define PUD_INDEX_SIZE 0 10 - #define PGD_INDEX_SIZE 4 10 + #define PGD_INDEX_SIZE 6 11 11 12 12 #ifndef __ASSEMBLY__ 13 13 #define PTE_TABLE_SIZE (sizeof(real_pte_t) << PTE_INDEX_SIZE)
+3 -16
arch/powerpc/include/asm/pgtable-ppc64.h
··· 21 21 #define PGTABLE_RANGE (ASM_CONST(1) << PGTABLE_EADDR_SIZE) 22 22 23 23 24 - /* Some sanity checking */ 25 - #if TASK_SIZE_USER64 > PGTABLE_RANGE 26 - #error TASK_SIZE_USER64 exceeds pagetable range 27 - #endif 28 - 29 - #ifdef CONFIG_PPC_STD_MMU_64 30 - #if TASK_SIZE_USER64 > (1UL << (USER_ESID_BITS + SID_SHIFT)) 31 - #error TASK_SIZE_USER64 exceeds user VSID range 32 - #endif 33 - #endif 34 - 35 24 /* 36 25 * Define the address range of the kernel non-linear virtual area 37 26 */ ··· 30 41 #else 31 42 #define KERN_VIRT_START ASM_CONST(0xD000000000000000) 32 43 #endif 33 - #define KERN_VIRT_SIZE PGTABLE_RANGE 44 + #define KERN_VIRT_SIZE ASM_CONST(0x0000100000000000) 34 45 35 46 /* 36 47 * The vmalloc space starts at the beginning of that region, and ··· 105 116 #endif /* CONFIG_PPC_MM_SLICES */ 106 117 107 118 #ifndef __ASSEMBLY__ 108 - 109 - #include <linux/stddef.h> 110 - #include <asm/tlbflush.h> 111 119 112 120 /* 113 121 * This is the default implementation of various PTE accessors, it's ··· 184 198 /* to find an entry in a kernel page-table-directory */ 185 199 /* This now only contains the vmalloc pages */ 186 200 #define pgd_offset_k(address) pgd_offset(&init_mm, address) 187 - 201 + extern void hpte_need_flush(struct mm_struct *mm, unsigned long addr, 202 + pte_t *ptep, unsigned long pte, int huge); 188 203 189 204 /* Atomic PTE updates */ 190 205 static inline unsigned long pte_update(struct mm_struct *mm,
+2 -8
arch/powerpc/include/asm/pgtable.h
··· 9 9 10 10 struct mm_struct; 11 11 12 - #ifdef CONFIG_DEBUG_VM 13 - extern void assert_pte_locked(struct mm_struct *mm, unsigned long addr); 14 - #else /* CONFIG_DEBUG_VM */ 15 - static inline void assert_pte_locked(struct mm_struct *mm, unsigned long addr) 16 - { 17 - } 18 - #endif /* !CONFIG_DEBUG_VM */ 19 - 20 12 #endif /* !__ASSEMBLY__ */ 21 13 22 14 #if defined(CONFIG_PPC64) ··· 18 26 #endif 19 27 20 28 #ifndef __ASSEMBLY__ 29 + 30 + #include <asm/tlbflush.h> 21 31 22 32 /* Generic accessors to PTE bits */ 23 33 static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
+3
arch/powerpc/include/asm/ppc-opcode.h
··· 126 126 #define PPC_INST_TLBIVAX 0x7c000624 127 127 #define PPC_INST_TLBSRX_DOT 0x7c0006a5 128 128 #define PPC_INST_XXLOR 0xf0000510 129 + #define PPC_INST_XVCPSGNDP 0xf0000780 129 130 130 131 #define PPC_INST_NAP 0x4c000364 131 132 #define PPC_INST_SLEEP 0x4c0003a4 ··· 278 277 VSX_XX1((s), a, b)) 279 278 #define XXLOR(t, a, b) stringify_in_c(.long PPC_INST_XXLOR | \ 280 279 VSX_XX3((t), a, b)) 280 + #define XVCPSGNDP(t, a, b) stringify_in_c(.long (PPC_INST_XVCPSGNDP | \ 281 + VSX_XX3((t), (a), (b)))) 281 282 282 283 #define PPC_NAP stringify_in_c(.long PPC_INST_NAP) 283 284 #define PPC_SLEEP stringify_in_c(.long PPC_INST_SLEEP)
+9 -11
arch/powerpc/include/asm/ppc-pci.h
··· 47 47 48 48 #ifdef CONFIG_EEH 49 49 50 - void pci_addr_cache_build(void); 51 - void pci_addr_cache_insert_device(struct pci_dev *dev); 52 - void pci_addr_cache_remove_device(struct pci_dev *dev); 53 - struct pci_dev *pci_addr_cache_get_device(unsigned long addr); 54 - void eeh_slot_error_detail(struct eeh_dev *edev, int severity); 55 - int eeh_pci_enable(struct eeh_dev *edev, int function); 56 - int eeh_reset_pe(struct eeh_dev *); 57 - void eeh_restore_bars(struct eeh_dev *); 50 + void eeh_addr_cache_insert_dev(struct pci_dev *dev); 51 + void eeh_addr_cache_rmv_dev(struct pci_dev *dev); 52 + struct eeh_dev *eeh_addr_cache_get_dev(unsigned long addr); 53 + void eeh_slot_error_detail(struct eeh_pe *pe, int severity); 54 + int eeh_pci_enable(struct eeh_pe *pe, int function); 55 + int eeh_reset_pe(struct eeh_pe *); 56 + void eeh_save_bars(struct eeh_dev *edev); 58 57 int rtas_write_config(struct pci_dn *, int where, int size, u32 val); 59 58 int rtas_read_config(struct pci_dn *, int where, int size, u32 *val); 60 - void eeh_mark_slot(struct device_node *dn, int mode_flag); 61 - void eeh_clear_slot(struct device_node *dn, int mode_flag); 62 - struct device_node *eeh_find_device_pe(struct device_node *dn); 59 + void eeh_pe_state_mark(struct eeh_pe *pe, int state); 60 + void eeh_pe_state_clear(struct eeh_pe *pe, int state); 63 61 64 62 void eeh_sysfs_add_device(struct pci_dev *pdev); 65 63 void eeh_sysfs_remove_device(struct pci_dev *pdev);
+42
arch/powerpc/include/asm/probes.h
··· 1 + #ifndef _ASM_POWERPC_PROBES_H 2 + #define _ASM_POWERPC_PROBES_H 3 + #ifdef __KERNEL__ 4 + /* 5 + * Definitions common to probes files 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License as published by 9 + * the Free Software Foundation; either version 2 of the License, or 10 + * (at your option) any later version. 11 + * 12 + * This program is distributed in the hope that it will be useful, 13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 + * GNU General Public License for more details. 16 + * 17 + * You should have received a copy of the GNU General Public License 18 + * along with this program; if not, write to the Free Software 19 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 + * 21 + * Copyright IBM Corporation, 2012 22 + */ 23 + #include <linux/types.h> 24 + 25 + typedef u32 ppc_opcode_t; 26 + #define BREAKPOINT_INSTRUCTION 0x7fe00008 /* trap */ 27 + 28 + /* Trap definitions per ISA */ 29 + #define IS_TW(instr) (((instr) & 0xfc0007fe) == 0x7c000008) 30 + #define IS_TD(instr) (((instr) & 0xfc0007fe) == 0x7c000088) 31 + #define IS_TDI(instr) (((instr) & 0xfc000000) == 0x08000000) 32 + #define IS_TWI(instr) (((instr) & 0xfc000000) == 0x0c000000) 33 + 34 + #ifdef CONFIG_PPC64 35 + #define is_trap(instr) (IS_TW(instr) || IS_TD(instr) || \ 36 + IS_TWI(instr) || IS_TDI(instr)) 37 + #else 38 + #define is_trap(instr) (IS_TW(instr) || IS_TWI(instr)) 39 + #endif /* CONFIG_PPC64 */ 40 + 41 + #endif /* __KERNEL__ */ 42 + #endif /* _ASM_POWERPC_PROBES_H */
+4 -2
arch/powerpc/include/asm/processor.h
··· 97 97 #endif 98 98 99 99 #ifdef CONFIG_PPC64 100 - /* 64-bit user address space is 44-bits (16TB user VM) */ 101 - #define TASK_SIZE_USER64 (0x0000100000000000UL) 100 + /* 64-bit user address space is 46-bits (64TB user VM) */ 101 + #define TASK_SIZE_USER64 (0x0000400000000000UL) 102 102 103 103 /* 104 104 * 32-bit user address space is 4GB - 1 page ··· 219 219 #endif /* CONFIG_HAVE_HW_BREAKPOINT */ 220 220 #endif 221 221 unsigned long dabr; /* Data address breakpoint register */ 222 + unsigned long dabrx; /* ... extension */ 223 + unsigned long trap_nr; /* last trap # on this thread */ 222 224 #ifdef CONFIG_ALTIVEC 223 225 /* Complete AltiVec register set */ 224 226 vector128 vr[32] __attribute__((aligned(16)));
+10 -8
arch/powerpc/include/asm/pte-hash64-64k.h
··· 58 58 /* Trick: we set __end to va + 64k, which happens works for 59 59 * a 16M page as well as we want only one iteration 60 60 */ 61 - #define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \ 62 - do { \ 63 - unsigned long __end = va + PAGE_SIZE; \ 64 - unsigned __split = (psize == MMU_PAGE_4K || \ 65 - psize == MMU_PAGE_64K_AP); \ 66 - shift = mmu_psize_defs[psize].shift; \ 67 - for (index = 0; va < __end; index++, va += (1L << shift)) { \ 68 - if (!__split || __rpte_sub_valid(rpte, index)) do { \ 61 + #define pte_iterate_hashed_subpages(rpte, psize, vpn, index, shift) \ 62 + do { \ 63 + unsigned long __end = vpn + (1UL << (PAGE_SHIFT - VPN_SHIFT)); \ 64 + unsigned __split = (psize == MMU_PAGE_4K || \ 65 + psize == MMU_PAGE_64K_AP); \ 66 + shift = mmu_psize_defs[psize].shift; \ 67 + for (index = 0; vpn < __end; index++, \ 68 + vpn += (1L << (shift - VPN_SHIFT))) { \ 69 + if (!__split || __rpte_sub_valid(rpte, index)) \ 70 + do { 69 71 70 72 #define pte_iterate_hashed_end() } while(0); } } while(0) 71 73
+32 -22
arch/powerpc/include/asm/reg.h
··· 208 208 #define SPRN_DABRX 0x3F7 /* Data Address Breakpoint Register Extension */ 209 209 #define DABRX_USER (1UL << 0) 210 210 #define DABRX_KERNEL (1UL << 1) 211 + #define DABRX_HYP (1UL << 2) 212 + #define DABRX_BTI (1UL << 3) 213 + #define DABRX_ALL (DABRX_BTI | DABRX_HYP | DABRX_KERNEL | DABRX_USER) 211 214 #define SPRN_DAR 0x013 /* Data Address Register */ 212 215 #define SPRN_DBCR 0x136 /* e300 Data Breakpoint Control Reg */ 213 216 #define SPRN_DSISR 0x012 /* Data Storage Interrupt Status Register */ ··· 524 521 525 522 #define SPRN_HSRR0 0x13A /* Save/Restore Register 0 */ 526 523 #define SPRN_HSRR1 0x13B /* Save/Restore Register 1 */ 524 + #define HSRR1_DENORM 0x00100000 /* Denorm exception */ 527 525 528 526 #define SPRN_TBCTL 0x35f /* PA6T Timebase control register */ 529 527 #define TBCTL_FREEZE 0x0000000000000000ull /* Freeze all tbs */ ··· 606 602 #define POWER6_MMCRA_SIPR 0x0000020000000000ULL 607 603 #define POWER6_MMCRA_THRM 0x00000020UL 608 604 #define POWER6_MMCRA_OTHER 0x0000000EUL 605 + 606 + #define POWER7P_MMCRA_SIAR_VALID 0x10000000 /* P7+ SIAR contents valid */ 607 + #define POWER7P_MMCRA_SDAR_VALID 0x08000000 /* P7+ SDAR contents valid */ 608 + 609 609 #define SPRN_PMC1 787 610 610 #define SPRN_PMC2 788 611 611 #define SPRN_PMC3 789 ··· 769 761 * 64-bit embedded 770 762 * - SPRG0 generic exception scratch 771 763 * - SPRG2 TLB exception stack 772 - * - SPRG3 CPU and NUMA node for VDSO getcpu (user visible) 764 + * - SPRG3 critical exception scratch and 765 + * CPU and NUMA node for VDSO getcpu (user visible) 773 766 * - SPRG4 unused (user visible) 774 767 * - SPRG6 TLB miss scratch (user visible, sorry !) 775 768 * - SPRG7 critical exception scratch ··· 867 858 868 859 #ifdef CONFIG_PPC_BOOK3E_64 869 860 #define SPRN_SPRG_MC_SCRATCH SPRN_SPRG8 870 - #define SPRN_SPRG_CRIT_SCRATCH SPRN_SPRG7 861 + #define SPRN_SPRG_CRIT_SCRATCH SPRN_SPRG3 871 862 #define SPRN_SPRG_DBG_SCRATCH SPRN_SPRG9 872 863 #define SPRN_SPRG_TLB_EXFRAME SPRN_SPRG2 873 864 #define SPRN_SPRG_TLB_SCRATCH SPRN_SPRG6 874 865 #define SPRN_SPRG_GEN_SCRATCH SPRN_SPRG0 866 + #define SPRN_SPRG_GDBELL_SCRATCH SPRN_SPRG_GEN_SCRATCH 875 867 876 868 #define SET_PACA(rX) mtspr SPRN_SPRG_PACA,rX 877 869 #define GET_PACA(rX) mfspr rX,SPRN_SPRG_PACA ··· 947 937 #define PVR_VER(pvr) (((pvr) >> 16) & 0xFFFF) /* Version field */ 948 938 #define PVR_REV(pvr) (((pvr) >> 0) & 0xFFFF) /* Revison field */ 949 939 950 - #define __is_processor(pv) (PVR_VER(mfspr(SPRN_PVR)) == (pv)) 940 + #define pvr_version_is(pvr) (PVR_VER(mfspr(SPRN_PVR)) == (pvr)) 951 941 952 942 /* 953 943 * IBM has further subdivided the standard PowerPC 16-bit version and ··· 1012 1002 #define PVR_476_ISS 0x00052000 1013 1003 1014 1004 /* 64-bit processors */ 1015 - /* XXX the prefix should be PVR_, we'll do a global sweep to fix it one day */ 1016 - #define PV_NORTHSTAR 0x0033 1017 - #define PV_PULSAR 0x0034 1018 - #define PV_POWER4 0x0035 1019 - #define PV_ICESTAR 0x0036 1020 - #define PV_SSTAR 0x0037 1021 - #define PV_POWER4p 0x0038 1022 - #define PV_970 0x0039 1023 - #define PV_POWER5 0x003A 1024 - #define PV_POWER5p 0x003B 1025 - #define PV_970FX 0x003C 1026 - #define PV_POWER6 0x003E 1027 - #define PV_POWER7 0x003F 1028 - #define PV_630 0x0040 1029 - #define PV_630p 0x0041 1030 - #define PV_970MP 0x0044 1031 - #define PV_970GX 0x0045 1032 - #define PV_BE 0x0070 1033 - #define PV_PA6T 0x0090 1005 + #define PVR_NORTHSTAR 0x0033 1006 + #define PVR_PULSAR 0x0034 1007 + #define PVR_POWER4 0x0035 1008 + #define PVR_ICESTAR 0x0036 1009 + #define PVR_SSTAR 0x0037 1010 + #define PVR_POWER4p 0x0038 1011 + #define PVR_970 0x0039 1012 + #define PVR_POWER5 0x003A 1013 + #define PVR_POWER5p 0x003B 1014 + #define PVR_970FX 0x003C 1015 + #define PVR_POWER6 0x003E 1016 + #define PVR_POWER7 0x003F 1017 + #define PVR_630 0x0040 1018 + #define PVR_630p 0x0041 1019 + #define PVR_970MP 0x0044 1020 + #define PVR_970GX 0x0045 1021 + #define PVR_POWER7p 0x004A 1022 + #define PVR_BE 0x0070 1023 + #define PVR_PA6T 0x0090 1034 1024 1035 1025 /* Macros for setting and retrieving special purpose registers */ 1036 1026 #ifndef __ASSEMBLY__
+1 -1
arch/powerpc/include/asm/setup.h
··· 9 9 extern unsigned int rtas_data; 10 10 extern int mem_init_done; /* set on boot once kmalloc can be called */ 11 11 extern int init_bootmem_done; /* set once bootmem is available */ 12 - extern phys_addr_t memory_limit; 12 + extern unsigned long long memory_limit; 13 13 extern unsigned long klimit; 14 14 extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask); 15 15
+2
arch/powerpc/include/asm/smp.h
··· 65 65 void generic_cpu_die(unsigned int cpu); 66 66 void generic_mach_cpu_die(void); 67 67 void generic_set_cpu_dead(unsigned int cpu); 68 + void generic_set_cpu_up(unsigned int cpu); 68 69 int generic_check_cpu_restart(unsigned int cpu); 69 70 #endif 70 71 ··· 191 190 extern unsigned long __secondary_hold_acknowledge; 192 191 extern char __secondary_hold; 193 192 193 + extern void __early_start(void); 194 194 #endif /* __ASSEMBLY__ */ 195 195 196 196 #endif /* __KERNEL__ */
+2 -2
arch/powerpc/include/asm/sparsemem.h
··· 10 10 */ 11 11 #define SECTION_SIZE_BITS 24 12 12 13 - #define MAX_PHYSADDR_BITS 44 14 - #define MAX_PHYSMEM_BITS 44 13 + #define MAX_PHYSADDR_BITS 46 14 + #define MAX_PHYSMEM_BITS 46 15 15 16 16 #endif /* CONFIG_SPARSEMEM */ 17 17
+6
arch/powerpc/include/asm/swiotlb.h
··· 22 22 23 23 extern void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev); 24 24 25 + #ifdef CONFIG_SWIOTLB 26 + void swiotlb_detect_4g(void); 27 + #else 28 + static inline void swiotlb_detect_4g(void) {} 29 + #endif 30 + 25 31 #endif /* __ASM_SWIOTLB_H */
+6 -1
arch/powerpc/include/asm/thread_info.h
··· 102 102 #define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */ 103 103 #define TIF_NOERROR 12 /* Force successful syscall return */ 104 104 #define TIF_NOTIFY_RESUME 13 /* callback before returning to user */ 105 + #define TIF_UPROBE 14 /* breakpointed or single-stepping */ 105 106 #define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */ 107 + #define TIF_EMULATE_STACK_STORE 16 /* Is an instruction emulation 108 + for stack store? */ 106 109 107 110 /* as above, but as bit values */ 108 111 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) ··· 121 118 #define _TIF_RESTOREALL (1<<TIF_RESTOREALL) 122 119 #define _TIF_NOERROR (1<<TIF_NOERROR) 123 120 #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 121 + #define _TIF_UPROBE (1<<TIF_UPROBE) 124 122 #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) 123 + #define _TIF_EMULATE_STACK_STORE (1<<TIF_EMULATE_STACK_STORE) 125 124 #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ 126 125 _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT) 127 126 128 127 #define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ 129 - _TIF_NOTIFY_RESUME) 128 + _TIF_NOTIFY_RESUME | _TIF_UPROBE) 130 129 #define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR) 131 130 132 131 /* Bits in local_flags */
+2 -5
arch/powerpc/include/asm/tlbflush.h
··· 95 95 unsigned long index; 96 96 struct mm_struct *mm; 97 97 real_pte_t pte[PPC64_TLB_BATCH_NR]; 98 - unsigned long vaddr[PPC64_TLB_BATCH_NR]; 98 + unsigned long vpn[PPC64_TLB_BATCH_NR]; 99 99 unsigned int psize; 100 100 int ssize; 101 101 }; 102 102 DECLARE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch); 103 103 104 104 extern void __flush_tlb_pending(struct ppc64_tlb_batch *batch); 105 - 106 - extern void hpte_need_flush(struct mm_struct *mm, unsigned long addr, 107 - pte_t *ptep, unsigned long pte, int huge); 108 105 109 106 #define __HAVE_ARCH_ENTER_LAZY_MMU_MODE 110 107 ··· 124 127 #define arch_flush_lazy_mmu_mode() do {} while (0) 125 128 126 129 127 - extern void flush_hash_page(unsigned long va, real_pte_t pte, int psize, 130 + extern void flush_hash_page(unsigned long vpn, real_pte_t pte, int psize, 128 131 int ssize, int local); 129 132 extern void flush_hash_range(unsigned long number, int local); 130 133
-11
arch/powerpc/include/asm/uaccess.h
··· 98 98 * PowerPC, we can just do these as direct assignments. (Of course, the 99 99 * exception handling means that it's no longer "just"...) 100 100 * 101 - * The "user64" versions of the user access functions are versions that 102 - * allow access of 64-bit data. The "get_user" functions do not 103 - * properly handle 64-bit data because the value gets down cast to a long. 104 - * The "put_user" functions already handle 64-bit data properly but we add 105 - * "user64" versions for completeness 106 101 */ 107 102 #define get_user(x, ptr) \ 108 103 __get_user_check((x), (ptr), sizeof(*(ptr))) ··· 108 113 __get_user_nocheck((x), (ptr), sizeof(*(ptr))) 109 114 #define __put_user(x, ptr) \ 110 115 __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) 111 - 112 - #ifndef __powerpc64__ 113 - #define __get_user64(x, ptr) \ 114 - __get_user64_nocheck((x), (ptr), sizeof(*(ptr))) 115 - #define __put_user64(x, ptr) __put_user(x, ptr) 116 - #endif 117 116 118 117 #define __get_user_inatomic(x, ptr) \ 119 118 __get_user_nosleep((x), (ptr), sizeof(*(ptr)))
+54
arch/powerpc/include/asm/uprobes.h
··· 1 + #ifndef _ASM_UPROBES_H 2 + #define _ASM_UPROBES_H 3 + /* 4 + * User-space Probes (UProbes) for powerpc 5 + * 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 8 + * the Free Software Foundation; either version 2 of the License, or 9 + * (at your option) any later version. 10 + * 11 + * This program is distributed in the hope that it will be useful, 12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + * GNU General Public License for more details. 15 + * 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 18 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 + * 20 + * Copyright IBM Corporation, 2007-2012 21 + * 22 + * Adapted from the x86 port by Ananth N Mavinakayanahalli <ananth@in.ibm.com> 23 + */ 24 + 25 + #include <linux/notifier.h> 26 + #include <asm/probes.h> 27 + 28 + typedef ppc_opcode_t uprobe_opcode_t; 29 + 30 + #define MAX_UINSN_BYTES 4 31 + #define UPROBE_XOL_SLOT_BYTES (MAX_UINSN_BYTES) 32 + 33 + /* The following alias is needed for reference from arch-agnostic code */ 34 + #define UPROBE_SWBP_INSN BREAKPOINT_INSTRUCTION 35 + #define UPROBE_SWBP_INSN_SIZE 4 /* swbp insn size in bytes */ 36 + 37 + struct arch_uprobe { 38 + union { 39 + u8 insn[MAX_UINSN_BYTES]; 40 + u32 ainsn; 41 + }; 42 + }; 43 + 44 + struct arch_uprobe_task { 45 + unsigned long saved_trap_nr; 46 + }; 47 + 48 + extern int arch_uprobe_analyze_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long addr); 49 + extern int arch_uprobe_pre_xol(struct arch_uprobe *aup, struct pt_regs *regs); 50 + extern int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs); 51 + extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk); 52 + extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data); 53 + extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs); 54 + #endif /* _ASM_UPROBES_H */
+1
arch/powerpc/kernel/Makefile
··· 96 96 obj-$(CONFIG_BOOTX_TEXT) += btext.o 97 97 obj-$(CONFIG_SMP) += smp.o 98 98 obj-$(CONFIG_KPROBES) += kprobes.o 99 + obj-$(CONFIG_UPROBES) += uprobes.o 99 100 obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o 100 101 obj-$(CONFIG_STACKTRACE) += stacktrace.o 101 102 obj-$(CONFIG_SWIOTLB) += dma-swiotlb.o
+1 -1
arch/powerpc/kernel/asm-offsets.c
··· 206 206 DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); 207 207 DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save)); 208 208 DEFINE(PACA_NAPSTATELOST, offsetof(struct paca_struct, nap_state_lost)); 209 + DEFINE(PACA_SPRG3, offsetof(struct paca_struct, sprg3)); 209 210 #endif /* CONFIG_PPC64 */ 210 211 211 212 /* RTAS */ ··· 535 534 HSTATE_FIELD(HSTATE_VMHANDLER, vmhandler); 536 535 HSTATE_FIELD(HSTATE_SCRATCH0, scratch0); 537 536 HSTATE_FIELD(HSTATE_SCRATCH1, scratch1); 538 - HSTATE_FIELD(HSTATE_SPRG3, sprg3); 539 537 HSTATE_FIELD(HSTATE_IN_GUEST, in_guest); 540 538 HSTATE_FIELD(HSTATE_RESTORE_HID5, restore_hid5); 541 539 HSTATE_FIELD(HSTATE_NAPPING, napping);
+65 -9
arch/powerpc/kernel/cpu_setup_fsl_booke.S
··· 16 16 #include <asm/processor.h> 17 17 #include <asm/cputable.h> 18 18 #include <asm/ppc_asm.h> 19 + #include <asm/mmu-book3e.h> 20 + #include <asm/asm-offsets.h> 19 21 20 22 _GLOBAL(__e500_icache_setup) 21 23 mfspr r0, SPRN_L1CSR1 ··· 75 73 mtlr r4 76 74 blr 77 75 _GLOBAL(__setup_cpu_e500mc) 78 - mr r5, r4 79 - mflr r4 76 + _GLOBAL(__setup_cpu_e5500) 77 + mflr r5 80 78 bl __e500_icache_setup 81 79 bl __e500_dcache_setup 82 80 bl __setup_e500mc_ivors 83 - mtlr r4 81 + /* 82 + * We only want to touch IVOR38-41 if we're running on hardware 83 + * that supports category E.HV. The architectural way to determine 84 + * this is MMUCFG[LPIDSIZE]. 85 + */ 86 + mfspr r3, SPRN_MMUCFG 87 + rlwinm. r3, r3, 0, MMUCFG_LPIDSIZE 88 + beq 1f 89 + bl __setup_ehv_ivors 90 + b 2f 91 + 1: 92 + lwz r3, CPU_SPEC_FEATURES(r4) 93 + /* We need this check as cpu_setup is also called for 94 + * the secondary cores. So, if we have already cleared 95 + * the feature on the primary core, avoid doing it on the 96 + * secondary core. 97 + */ 98 + andis. r6, r3, CPU_FTR_EMB_HV@h 99 + beq 2f 100 + rlwinm r3, r3, 0, ~CPU_FTR_EMB_HV 101 + stw r3, CPU_SPEC_FEATURES(r4) 102 + 2: 103 + mtlr r5 84 104 blr 85 105 #endif 86 - /* Right now, restore and setup are the same thing */ 106 + 107 + #ifdef CONFIG_PPC_BOOK3E_64 87 108 _GLOBAL(__restore_cpu_e5500) 88 - _GLOBAL(__setup_cpu_e5500) 89 109 mflr r4 90 110 bl __e500_icache_setup 91 111 bl __e500_dcache_setup 92 - #ifdef CONFIG_PPC_BOOK3E_64 93 112 bl .__setup_base_ivors 94 113 bl .setup_perfmon_ivor 95 114 bl .setup_doorbell_ivors 115 + /* 116 + * We only want to touch IVOR38-41 if we're running on hardware 117 + * that supports category E.HV. The architectural way to determine 118 + * this is MMUCFG[LPIDSIZE]. 119 + */ 120 + mfspr r10,SPRN_MMUCFG 121 + rlwinm. r10,r10,0,MMUCFG_LPIDSIZE 122 + beq 1f 96 123 bl .setup_ehv_ivors 97 - #else 98 - bl __setup_e500mc_ivors 99 - #endif 124 + 1: 100 125 mtlr r4 101 126 blr 127 + 128 + _GLOBAL(__setup_cpu_e5500) 129 + mflr r5 130 + bl __e500_icache_setup 131 + bl __e500_dcache_setup 132 + bl .__setup_base_ivors 133 + bl .setup_perfmon_ivor 134 + bl .setup_doorbell_ivors 135 + /* 136 + * We only want to touch IVOR38-41 if we're running on hardware 137 + * that supports category E.HV. The architectural way to determine 138 + * this is MMUCFG[LPIDSIZE]. 139 + */ 140 + mfspr r10,SPRN_MMUCFG 141 + rlwinm. r10,r10,0,MMUCFG_LPIDSIZE 142 + beq 1f 143 + bl .setup_ehv_ivors 144 + b 2f 145 + 1: 146 + ld r10,CPU_SPEC_FEATURES(r4) 147 + LOAD_REG_IMMEDIATE(r9,CPU_FTR_EMB_HV) 148 + andc r10,r10,r9 149 + std r10,CPU_SPEC_FEATURES(r4) 150 + 2: 151 + mtlr r5 152 + blr 153 + #endif
+4
arch/powerpc/kernel/cputable.c
··· 2016 2016 .oprofile_cpu_type = "ppc/e500mc", 2017 2017 .oprofile_type = PPC_OPROFILE_FSL_EMB, 2018 2018 .cpu_setup = __setup_cpu_e5500, 2019 + #ifndef CONFIG_PPC32 2019 2020 .cpu_restore = __restore_cpu_e5500, 2021 + #endif 2020 2022 .machine_check = machine_check_e500mc, 2021 2023 .platform = "ppce5500", 2022 2024 }, ··· 2036 2034 .oprofile_cpu_type = "ppc/e6500", 2037 2035 .oprofile_type = PPC_OPROFILE_FSL_EMB, 2038 2036 .cpu_setup = __setup_cpu_e5500, 2037 + #ifndef CONFIG_PPC32 2039 2038 .cpu_restore = __restore_cpu_e5500, 2039 + #endif 2040 2040 .machine_check = machine_check_e500mc, 2041 2041 .platform = "ppce6500", 2042 2042 },
+21 -1
arch/powerpc/kernel/dma-swiotlb.c
··· 12 12 */ 13 13 14 14 #include <linux/dma-mapping.h> 15 + #include <linux/memblock.h> 15 16 #include <linux/pfn.h> 16 17 #include <linux/of_platform.h> 17 18 #include <linux/platform_device.h> ··· 21 20 #include <asm/machdep.h> 22 21 #include <asm/swiotlb.h> 23 22 #include <asm/dma.h> 24 - #include <asm/abs_addr.h> 25 23 26 24 unsigned int ppc_swiotlb_enable; 27 25 ··· 105 105 &ppc_swiotlb_plat_bus_notifier); 106 106 return 0; 107 107 } 108 + 109 + void swiotlb_detect_4g(void) 110 + { 111 + if ((memblock_end_of_DRAM() - 1) > 0xffffffff) 112 + ppc_swiotlb_enable = 1; 113 + } 114 + 115 + static int __init swiotlb_late_init(void) 116 + { 117 + if (ppc_swiotlb_enable) { 118 + swiotlb_print_info(); 119 + set_pci_dma_ops(&swiotlb_dma_ops); 120 + ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 121 + } else { 122 + swiotlb_free(); 123 + } 124 + 125 + return 0; 126 + } 127 + subsys_initcall(swiotlb_late_init);
+1 -2
arch/powerpc/kernel/dma.c
··· 14 14 #include <linux/pci.h> 15 15 #include <asm/vio.h> 16 16 #include <asm/bug.h> 17 - #include <asm/abs_addr.h> 18 17 #include <asm/machdep.h> 19 18 20 19 /* ··· 49 50 return NULL; 50 51 ret = page_address(page); 51 52 memset(ret, 0, size); 52 - *dma_handle = virt_to_abs(ret) + get_dma_offset(dev); 53 + *dma_handle = __pa(ret) + get_dma_offset(dev); 53 54 54 55 return ret; 55 56 #endif
+41 -6
arch/powerpc/kernel/entry_32.S
··· 831 831 bnel- load_dbcr0 832 832 #endif 833 833 834 - #ifdef CONFIG_PREEMPT 835 834 b restore 836 835 837 836 /* N.B. the only way to get here is from the beq following ret_from_except. */ 838 837 resume_kernel: 839 - /* check current_thread_info->preempt_count */ 838 + /* check current_thread_info, _TIF_EMULATE_STACK_STORE */ 840 839 CURRENT_THREAD_INFO(r9, r1) 840 + lwz r8,TI_FLAGS(r9) 841 + andis. r8,r8,_TIF_EMULATE_STACK_STORE@h 842 + beq+ 1f 843 + 844 + addi r8,r1,INT_FRAME_SIZE /* Get the kprobed function entry */ 845 + 846 + lwz r3,GPR1(r1) 847 + subi r3,r3,INT_FRAME_SIZE /* dst: Allocate a trampoline exception frame */ 848 + mr r4,r1 /* src: current exception frame */ 849 + mr r1,r3 /* Reroute the trampoline frame to r1 */ 850 + 851 + /* Copy from the original to the trampoline. */ 852 + li r5,INT_FRAME_SIZE/4 /* size: INT_FRAME_SIZE */ 853 + li r6,0 /* start offset: 0 */ 854 + mtctr r5 855 + 2: lwzx r0,r6,r4 856 + stwx r0,r6,r3 857 + addi r6,r6,4 858 + bdnz 2b 859 + 860 + /* Do real store operation to complete stwu */ 861 + lwz r5,GPR1(r1) 862 + stw r8,0(r5) 863 + 864 + /* Clear _TIF_EMULATE_STACK_STORE flag */ 865 + lis r11,_TIF_EMULATE_STACK_STORE@h 866 + addi r5,r9,TI_FLAGS 867 + 0: lwarx r8,0,r5 868 + andc r8,r8,r11 869 + #ifdef CONFIG_IBM405_ERR77 870 + dcbt 0,r5 871 + #endif 872 + stwcx. r8,0,r5 873 + bne- 0b 874 + 1: 875 + 876 + #ifdef CONFIG_PREEMPT 877 + /* check current_thread_info->preempt_count */ 841 878 lwz r0,TI_PREEMPT(r9) 842 879 cmpwi 0,r0,0 /* if non-zero, just restore regs and return */ 843 880 bne restore 844 - lwz r0,TI_FLAGS(r9) 845 - andi. r0,r0,_TIF_NEED_RESCHED 881 + andi. r8,r8,_TIF_NEED_RESCHED 846 882 beq+ restore 883 + lwz r3,_MSR(r1) 847 884 andi. r0,r3,MSR_EE /* interrupts off? */ 848 885 beq restore /* don't schedule if so */ 849 886 #ifdef CONFIG_TRACE_IRQFLAGS ··· 901 864 */ 902 865 bl trace_hardirqs_on 903 866 #endif 904 - #else 905 - resume_kernel: 906 867 #endif /* CONFIG_PREEMPT */ 907 868 908 869 /* interrupts are hard-disabled at this point */
+35
arch/powerpc/kernel/entry_64.S
··· 593 593 b .ret_from_except 594 594 595 595 resume_kernel: 596 + /* check current_thread_info, _TIF_EMULATE_STACK_STORE */ 597 + CURRENT_THREAD_INFO(r9, r1) 598 + ld r8,TI_FLAGS(r9) 599 + andis. r8,r8,_TIF_EMULATE_STACK_STORE@h 600 + beq+ 1f 601 + 602 + addi r8,r1,INT_FRAME_SIZE /* Get the kprobed function entry */ 603 + 604 + lwz r3,GPR1(r1) 605 + subi r3,r3,INT_FRAME_SIZE /* dst: Allocate a trampoline exception frame */ 606 + mr r4,r1 /* src: current exception frame */ 607 + mr r1,r3 /* Reroute the trampoline frame to r1 */ 608 + 609 + /* Copy from the original to the trampoline. */ 610 + li r5,INT_FRAME_SIZE/8 /* size: INT_FRAME_SIZE */ 611 + li r6,0 /* start offset: 0 */ 612 + mtctr r5 613 + 2: ldx r0,r6,r4 614 + stdx r0,r6,r3 615 + addi r6,r6,8 616 + bdnz 2b 617 + 618 + /* Do real store operation to complete stwu */ 619 + lwz r5,GPR1(r1) 620 + std r8,0(r5) 621 + 622 + /* Clear _TIF_EMULATE_STACK_STORE flag */ 623 + lis r11,_TIF_EMULATE_STACK_STORE@h 624 + addi r5,r9,TI_FLAGS 625 + ldarx r4,0,r5 626 + andc r4,r4,r11 627 + stdcx. r4,0,r5 628 + bne- 0b 629 + 1: 630 + 596 631 #ifdef CONFIG_PREEMPT 597 632 /* Check if we need to preempt */ 598 633 andi. r0,r4,_TIF_NEED_RESCHED
+129 -89
arch/powerpc/kernel/exceptions-64e.S
··· 25 25 #include <asm/ppc-opcode.h> 26 26 #include <asm/mmu.h> 27 27 #include <asm/hw_irq.h> 28 + #include <asm/kvm_asm.h> 29 + #include <asm/kvm_booke_hv_asm.h> 28 30 29 31 /* XXX This will ultimately add space for a special exception save 30 32 * structure used to save things like SRR0/SRR1, SPRGs, MAS, etc... ··· 37 35 #define SPECIAL_EXC_FRAME_SIZE INT_FRAME_SIZE 38 36 39 37 /* Exception prolog code for all exceptions */ 40 - #define EXCEPTION_PROLOG(n, type, addition) \ 38 + #define EXCEPTION_PROLOG(n, intnum, type, addition) \ 41 39 mtspr SPRN_SPRG_##type##_SCRATCH,r13; /* get spare registers */ \ 42 40 mfspr r13,SPRN_SPRG_PACA; /* get PACA */ \ 43 41 std r10,PACA_EX##type+EX_R10(r13); \ 44 42 std r11,PACA_EX##type+EX_R11(r13); \ 43 + PROLOG_STORE_RESTORE_SCRATCH_##type; \ 45 44 mfcr r10; /* save CR */ \ 45 + mfspr r11,SPRN_##type##_SRR1;/* what are we coming from */ \ 46 + DO_KVM intnum,SPRN_##type##_SRR1; /* KVM hook */ \ 47 + stw r10,PACA_EX##type+EX_CR(r13); /* save old CR in the PACA */ \ 46 48 addition; /* additional code for that exc. */ \ 47 49 std r1,PACA_EX##type+EX_R1(r13); /* save old r1 in the PACA */ \ 48 - stw r10,PACA_EX##type+EX_CR(r13); /* save old CR in the PACA */ \ 49 - mfspr r11,SPRN_##type##_SRR1;/* what are we coming from */ \ 50 50 type##_SET_KSTACK; /* get special stack if necessary */\ 51 51 andi. r10,r11,MSR_PR; /* save stack pointer */ \ 52 52 beq 1f; /* branch around if supervisor */ \ ··· 62 58 subi r1,r1,INT_FRAME_SIZE; /* alloc frame on kernel stack */ 63 59 #define SPRN_GEN_SRR0 SPRN_SRR0 64 60 #define SPRN_GEN_SRR1 SPRN_SRR1 61 + 62 + #define GDBELL_SET_KSTACK GEN_SET_KSTACK 63 + #define SPRN_GDBELL_SRR0 SPRN_GSRR0 64 + #define SPRN_GDBELL_SRR1 SPRN_GSRR1 65 65 66 66 #define CRIT_SET_KSTACK \ 67 67 ld r1,PACA_CRIT_STACK(r13); \ ··· 85 77 #define SPRN_MC_SRR0 SPRN_MCSRR0 86 78 #define SPRN_MC_SRR1 SPRN_MCSRR1 87 79 88 - #define NORMAL_EXCEPTION_PROLOG(n, addition) \ 89 - EXCEPTION_PROLOG(n, GEN, addition##_GEN(n)) 80 + #define NORMAL_EXCEPTION_PROLOG(n, intnum, addition) \ 81 + EXCEPTION_PROLOG(n, intnum, GEN, addition##_GEN(n)) 90 82 91 - #define CRIT_EXCEPTION_PROLOG(n, addition) \ 92 - EXCEPTION_PROLOG(n, CRIT, addition##_CRIT(n)) 83 + #define CRIT_EXCEPTION_PROLOG(n, intnum, addition) \ 84 + EXCEPTION_PROLOG(n, intnum, CRIT, addition##_CRIT(n)) 93 85 94 - #define DBG_EXCEPTION_PROLOG(n, addition) \ 95 - EXCEPTION_PROLOG(n, DBG, addition##_DBG(n)) 86 + #define DBG_EXCEPTION_PROLOG(n, intnum, addition) \ 87 + EXCEPTION_PROLOG(n, intnum, DBG, addition##_DBG(n)) 96 88 97 - #define MC_EXCEPTION_PROLOG(n, addition) \ 98 - EXCEPTION_PROLOG(n, MC, addition##_MC(n)) 89 + #define MC_EXCEPTION_PROLOG(n, intnum, addition) \ 90 + EXCEPTION_PROLOG(n, intnum, MC, addition##_MC(n)) 99 91 92 + #define GDBELL_EXCEPTION_PROLOG(n, intnum, addition) \ 93 + EXCEPTION_PROLOG(n, intnum, GDBELL, addition##_GDBELL(n)) 94 + 95 + /* 96 + * Store user-visible scratch in PACA exception slots and restore proper value 97 + */ 98 + #define PROLOG_STORE_RESTORE_SCRATCH_GEN 99 + #define PROLOG_STORE_RESTORE_SCRATCH_GDBELL 100 + #define PROLOG_STORE_RESTORE_SCRATCH_DBG 101 + #define PROLOG_STORE_RESTORE_SCRATCH_MC 102 + 103 + #define PROLOG_STORE_RESTORE_SCRATCH_CRIT \ 104 + mfspr r10,SPRN_SPRG_CRIT_SCRATCH; /* get r13 */ \ 105 + std r10,PACA_EXCRIT+EX_R13(r13); \ 106 + ld r11,PACA_SPRG3(r13); \ 107 + mtspr SPRN_SPRG_CRIT_SCRATCH,r11; 100 108 101 109 /* Variants of the "addition" argument for the prolog 102 110 */ 103 111 #define PROLOG_ADDITION_NONE_GEN(n) 112 + #define PROLOG_ADDITION_NONE_GDBELL(n) 104 113 #define PROLOG_ADDITION_NONE_CRIT(n) 105 114 #define PROLOG_ADDITION_NONE_DBG(n) 106 115 #define PROLOG_ADDITION_NONE_MC(n) 107 116 108 117 #define PROLOG_ADDITION_MASKABLE_GEN(n) \ 109 - lbz r11,PACASOFTIRQEN(r13); /* are irqs soft-disabled ? */ \ 110 - cmpwi cr0,r11,0; /* yes -> go out of line */ \ 118 + lbz r10,PACASOFTIRQEN(r13); /* are irqs soft-disabled ? */ \ 119 + cmpwi cr0,r10,0; /* yes -> go out of line */ \ 111 120 beq masked_interrupt_book3e_##n 112 121 113 122 #define PROLOG_ADDITION_2REGS_GEN(n) \ ··· 258 233 1: 259 234 260 235 261 - #define MASKABLE_EXCEPTION(trapnum, label, hdlr, ack) \ 236 + #define MASKABLE_EXCEPTION(trapnum, intnum, label, hdlr, ack) \ 262 237 START_EXCEPTION(label); \ 263 - NORMAL_EXCEPTION_PROLOG(trapnum, PROLOG_ADDITION_MASKABLE) \ 238 + NORMAL_EXCEPTION_PROLOG(trapnum, intnum, PROLOG_ADDITION_MASKABLE)\ 264 239 EXCEPTION_COMMON(trapnum, PACA_EXGEN, INTS_DISABLE) \ 265 240 ack(r8); \ 266 241 CHECK_NAPPING(); \ ··· 311 286 312 287 /* Critical Input Interrupt */ 313 288 START_EXCEPTION(critical_input); 314 - CRIT_EXCEPTION_PROLOG(0x100, PROLOG_ADDITION_NONE) 289 + CRIT_EXCEPTION_PROLOG(0x100, BOOKE_INTERRUPT_CRITICAL, 290 + PROLOG_ADDITION_NONE) 315 291 // EXCEPTION_COMMON(0x100, PACA_EXCRIT, INTS_DISABLE) 316 292 // bl special_reg_save_crit 317 293 // CHECK_NAPPING(); ··· 323 297 324 298 /* Machine Check Interrupt */ 325 299 START_EXCEPTION(machine_check); 326 - CRIT_EXCEPTION_PROLOG(0x200, PROLOG_ADDITION_NONE) 300 + MC_EXCEPTION_PROLOG(0x200, BOOKE_INTERRUPT_MACHINE_CHECK, 301 + PROLOG_ADDITION_NONE) 327 302 // EXCEPTION_COMMON(0x200, PACA_EXMC, INTS_DISABLE) 328 303 // bl special_reg_save_mc 329 304 // addi r3,r1,STACK_FRAME_OVERHEAD ··· 335 308 336 309 /* Data Storage Interrupt */ 337 310 START_EXCEPTION(data_storage) 338 - NORMAL_EXCEPTION_PROLOG(0x300, PROLOG_ADDITION_2REGS) 311 + NORMAL_EXCEPTION_PROLOG(0x300, BOOKE_INTERRUPT_DATA_STORAGE, 312 + PROLOG_ADDITION_2REGS) 339 313 mfspr r14,SPRN_DEAR 340 314 mfspr r15,SPRN_ESR 341 315 EXCEPTION_COMMON(0x300, PACA_EXGEN, INTS_DISABLE) ··· 344 316 345 317 /* Instruction Storage Interrupt */ 346 318 START_EXCEPTION(instruction_storage); 347 - NORMAL_EXCEPTION_PROLOG(0x400, PROLOG_ADDITION_2REGS) 319 + NORMAL_EXCEPTION_PROLOG(0x400, BOOKE_INTERRUPT_INST_STORAGE, 320 + PROLOG_ADDITION_2REGS) 348 321 li r15,0 349 322 mr r14,r10 350 323 EXCEPTION_COMMON(0x400, PACA_EXGEN, INTS_DISABLE) 351 324 b storage_fault_common 352 325 353 326 /* External Input Interrupt */ 354 - MASKABLE_EXCEPTION(0x500, external_input, .do_IRQ, ACK_NONE) 327 + MASKABLE_EXCEPTION(0x500, BOOKE_INTERRUPT_EXTERNAL, 328 + external_input, .do_IRQ, ACK_NONE) 355 329 356 330 /* Alignment */ 357 331 START_EXCEPTION(alignment); 358 - NORMAL_EXCEPTION_PROLOG(0x600, PROLOG_ADDITION_2REGS) 332 + NORMAL_EXCEPTION_PROLOG(0x600, BOOKE_INTERRUPT_ALIGNMENT, 333 + PROLOG_ADDITION_2REGS) 359 334 mfspr r14,SPRN_DEAR 360 335 mfspr r15,SPRN_ESR 361 336 EXCEPTION_COMMON(0x600, PACA_EXGEN, INTS_KEEP) ··· 366 335 367 336 /* Program Interrupt */ 368 337 START_EXCEPTION(program); 369 - NORMAL_EXCEPTION_PROLOG(0x700, PROLOG_ADDITION_1REG) 338 + NORMAL_EXCEPTION_PROLOG(0x700, BOOKE_INTERRUPT_PROGRAM, 339 + PROLOG_ADDITION_1REG) 370 340 mfspr r14,SPRN_ESR 371 341 EXCEPTION_COMMON(0x700, PACA_EXGEN, INTS_DISABLE) 372 342 std r14,_DSISR(r1) ··· 379 347 380 348 /* Floating Point Unavailable Interrupt */ 381 349 START_EXCEPTION(fp_unavailable); 382 - NORMAL_EXCEPTION_PROLOG(0x800, PROLOG_ADDITION_NONE) 350 + NORMAL_EXCEPTION_PROLOG(0x800, BOOKE_INTERRUPT_FP_UNAVAIL, 351 + PROLOG_ADDITION_NONE) 383 352 /* we can probably do a shorter exception entry for that one... */ 384 353 EXCEPTION_COMMON(0x800, PACA_EXGEN, INTS_KEEP) 385 354 ld r12,_MSR(r1) ··· 395 362 b .ret_from_except 396 363 397 364 /* Decrementer Interrupt */ 398 - MASKABLE_EXCEPTION(0x900, decrementer, .timer_interrupt, ACK_DEC) 365 + MASKABLE_EXCEPTION(0x900, BOOKE_INTERRUPT_DECREMENTER, 366 + decrementer, .timer_interrupt, ACK_DEC) 399 367 400 368 /* Fixed Interval Timer Interrupt */ 401 - MASKABLE_EXCEPTION(0x980, fixed_interval, .unknown_exception, ACK_FIT) 369 + MASKABLE_EXCEPTION(0x980, BOOKE_INTERRUPT_FIT, 370 + fixed_interval, .unknown_exception, ACK_FIT) 402 371 403 372 /* Watchdog Timer Interrupt */ 404 373 START_EXCEPTION(watchdog); 405 - CRIT_EXCEPTION_PROLOG(0x9f0, PROLOG_ADDITION_NONE) 374 + CRIT_EXCEPTION_PROLOG(0x9f0, BOOKE_INTERRUPT_WATCHDOG, 375 + PROLOG_ADDITION_NONE) 406 376 // EXCEPTION_COMMON(0x9f0, PACA_EXCRIT, INTS_DISABLE) 407 377 // bl special_reg_save_crit 408 378 // CHECK_NAPPING(); ··· 424 388 425 389 /* Auxiliary Processor Unavailable Interrupt */ 426 390 START_EXCEPTION(ap_unavailable); 427 - NORMAL_EXCEPTION_PROLOG(0xf20, PROLOG_ADDITION_NONE) 391 + NORMAL_EXCEPTION_PROLOG(0xf20, BOOKE_INTERRUPT_AP_UNAVAIL, 392 + PROLOG_ADDITION_NONE) 428 393 EXCEPTION_COMMON(0xf20, PACA_EXGEN, INTS_DISABLE) 429 394 bl .save_nvgprs 430 395 addi r3,r1,STACK_FRAME_OVERHEAD ··· 434 397 435 398 /* Debug exception as a critical interrupt*/ 436 399 START_EXCEPTION(debug_crit); 437 - CRIT_EXCEPTION_PROLOG(0xd00, PROLOG_ADDITION_2REGS) 400 + CRIT_EXCEPTION_PROLOG(0xd00, BOOKE_INTERRUPT_DEBUG, 401 + PROLOG_ADDITION_2REGS) 438 402 439 403 /* 440 404 * If there is a single step or branch-taken exception in an ··· 469 431 mtcr r10 470 432 ld r10,PACA_EXCRIT+EX_R10(r13) /* restore registers */ 471 433 ld r11,PACA_EXCRIT+EX_R11(r13) 472 - mfspr r13,SPRN_SPRG_CRIT_SCRATCH 434 + ld r13,PACA_EXCRIT+EX_R13(r13) 473 435 rfci 474 436 475 437 /* Normal debug exception */ ··· 482 444 /* Now we mash up things to make it look like we are coming on a 483 445 * normal exception 484 446 */ 485 - mfspr r15,SPRN_SPRG_CRIT_SCRATCH 447 + ld r15,PACA_EXCRIT+EX_R13(r13) 486 448 mtspr SPRN_SPRG_GEN_SCRATCH,r15 487 449 mfspr r14,SPRN_DBSR 488 450 EXCEPTION_COMMON(0xd00, PACA_EXCRIT, INTS_DISABLE) ··· 500 462 501 463 /* Debug exception as a debug interrupt*/ 502 464 START_EXCEPTION(debug_debug); 503 - DBG_EXCEPTION_PROLOG(0xd08, PROLOG_ADDITION_2REGS) 465 + DBG_EXCEPTION_PROLOG(0xd00, BOOKE_INTERRUPT_DEBUG, 466 + PROLOG_ADDITION_2REGS) 504 467 505 468 /* 506 469 * If there is a single step or branch-taken exception in an ··· 562 523 b .ret_from_except 563 524 564 525 START_EXCEPTION(perfmon); 565 - NORMAL_EXCEPTION_PROLOG(0x260, PROLOG_ADDITION_NONE) 526 + NORMAL_EXCEPTION_PROLOG(0x260, BOOKE_INTERRUPT_PERFORMANCE_MONITOR, 527 + PROLOG_ADDITION_NONE) 566 528 EXCEPTION_COMMON(0x260, PACA_EXGEN, INTS_DISABLE) 567 529 addi r3,r1,STACK_FRAME_OVERHEAD 568 530 bl .performance_monitor_exception 569 531 b .ret_from_except_lite 570 532 571 533 /* Doorbell interrupt */ 572 - MASKABLE_EXCEPTION(0x280, doorbell, .doorbell_exception, ACK_NONE) 534 + MASKABLE_EXCEPTION(0x280, BOOKE_INTERRUPT_DOORBELL, 535 + doorbell, .doorbell_exception, ACK_NONE) 573 536 574 537 /* Doorbell critical Interrupt */ 575 538 START_EXCEPTION(doorbell_crit); 576 - CRIT_EXCEPTION_PROLOG(0x2a0, PROLOG_ADDITION_NONE) 539 + CRIT_EXCEPTION_PROLOG(0x2a0, BOOKE_INTERRUPT_DOORBELL_CRITICAL, 540 + PROLOG_ADDITION_NONE) 577 541 // EXCEPTION_COMMON(0x2a0, PACA_EXCRIT, INTS_DISABLE) 578 542 // bl special_reg_save_crit 579 543 // CHECK_NAPPING(); ··· 585 543 // b ret_from_crit_except 586 544 b . 587 545 588 - /* Guest Doorbell */ 589 - MASKABLE_EXCEPTION(0x2c0, guest_doorbell, .unknown_exception, ACK_NONE) 546 + /* 547 + * Guest doorbell interrupt 548 + * This general exception use GSRRx save/restore registers 549 + */ 550 + START_EXCEPTION(guest_doorbell); 551 + GDBELL_EXCEPTION_PROLOG(0x2c0, BOOKE_INTERRUPT_GUEST_DBELL, 552 + PROLOG_ADDITION_NONE) 553 + EXCEPTION_COMMON(0x2c0, PACA_EXGEN, INTS_KEEP) 554 + addi r3,r1,STACK_FRAME_OVERHEAD 555 + bl .save_nvgprs 556 + INTS_RESTORE_HARD 557 + bl .unknown_exception 558 + b .ret_from_except 590 559 591 560 /* Guest Doorbell critical Interrupt */ 592 561 START_EXCEPTION(guest_doorbell_crit); 593 - CRIT_EXCEPTION_PROLOG(0x2e0, PROLOG_ADDITION_NONE) 562 + CRIT_EXCEPTION_PROLOG(0x2e0, BOOKE_INTERRUPT_GUEST_DBELL_CRIT, 563 + PROLOG_ADDITION_NONE) 594 564 // EXCEPTION_COMMON(0x2e0, PACA_EXCRIT, INTS_DISABLE) 595 565 // bl special_reg_save_crit 596 566 // CHECK_NAPPING(); ··· 613 559 614 560 /* Hypervisor call */ 615 561 START_EXCEPTION(hypercall); 616 - NORMAL_EXCEPTION_PROLOG(0x310, PROLOG_ADDITION_NONE) 562 + NORMAL_EXCEPTION_PROLOG(0x310, BOOKE_INTERRUPT_HV_SYSCALL, 563 + PROLOG_ADDITION_NONE) 617 564 EXCEPTION_COMMON(0x310, PACA_EXGEN, INTS_KEEP) 618 565 addi r3,r1,STACK_FRAME_OVERHEAD 619 566 bl .save_nvgprs ··· 624 569 625 570 /* Embedded Hypervisor priviledged */ 626 571 START_EXCEPTION(ehpriv); 627 - NORMAL_EXCEPTION_PROLOG(0x320, PROLOG_ADDITION_NONE) 572 + NORMAL_EXCEPTION_PROLOG(0x320, BOOKE_INTERRUPT_HV_PRIV, 573 + PROLOG_ADDITION_NONE) 628 574 EXCEPTION_COMMON(0x320, PACA_EXGEN, INTS_KEEP) 629 575 addi r3,r1,STACK_FRAME_OVERHEAD 630 576 bl .save_nvgprs ··· 638 582 * accordingly and if the interrupt is level sensitive, we hard disable 639 583 */ 640 584 641 - masked_interrupt_book3e_0x500: 642 - /* XXX When adding support for EPR, use PACA_IRQ_EE_EDGE */ 643 - li r11,PACA_IRQ_EE 644 - b masked_interrupt_book3e_full_mask 645 - 646 - masked_interrupt_book3e_0x900: 647 - ACK_DEC(r11); 648 - li r11,PACA_IRQ_DEC 649 - b masked_interrupt_book3e_no_mask 650 - masked_interrupt_book3e_0x980: 651 - ACK_FIT(r11); 652 - li r11,PACA_IRQ_DEC 653 - b masked_interrupt_book3e_no_mask 654 - masked_interrupt_book3e_0x280: 655 - masked_interrupt_book3e_0x2c0: 656 - li r11,PACA_IRQ_DBELL 657 - b masked_interrupt_book3e_no_mask 658 - 659 - masked_interrupt_book3e_no_mask: 660 - mtcr r10 585 + .macro masked_interrupt_book3e paca_irq full_mask 661 586 lbz r10,PACAIRQHAPPENED(r13) 662 - or r10,r10,r11 587 + ori r10,r10,\paca_irq 663 588 stb r10,PACAIRQHAPPENED(r13) 664 - b 1f 665 - masked_interrupt_book3e_full_mask: 666 - mtcr r10 667 - lbz r10,PACAIRQHAPPENED(r13) 668 - or r10,r10,r11 669 - stb r10,PACAIRQHAPPENED(r13) 670 - mfspr r10,SPRN_SRR1 671 - rldicl r11,r10,48,1 /* clear MSR_EE */ 672 - rotldi r10,r11,16 673 - mtspr SPRN_SRR1,r10 674 - 1: ld r10,PACA_EXGEN+EX_R10(r13); 675 - ld r11,PACA_EXGEN+EX_R11(r13); 676 - mfspr r13,SPRN_SPRG_GEN_SCRATCH; 589 + 590 + .if \full_mask == 1 591 + rldicl r10,r11,48,1 /* clear MSR_EE */ 592 + rotldi r11,r10,16 593 + mtspr SPRN_SRR1,r11 594 + .endif 595 + 596 + lwz r11,PACA_EXGEN+EX_CR(r13) 597 + mtcr r11 598 + ld r10,PACA_EXGEN+EX_R10(r13) 599 + ld r11,PACA_EXGEN+EX_R11(r13) 600 + mfspr r13,SPRN_SPRG_GEN_SCRATCH 677 601 rfi 678 602 b . 603 + .endm 604 + 605 + masked_interrupt_book3e_0x500: 606 + // XXX When adding support for EPR, use PACA_IRQ_EE_EDGE 607 + masked_interrupt_book3e PACA_IRQ_EE 1 608 + 609 + masked_interrupt_book3e_0x900: 610 + ACK_DEC(r10); 611 + masked_interrupt_book3e PACA_IRQ_DEC 0 612 + 613 + masked_interrupt_book3e_0x980: 614 + ACK_FIT(r10); 615 + masked_interrupt_book3e PACA_IRQ_DEC 0 616 + 617 + masked_interrupt_book3e_0x280: 618 + masked_interrupt_book3e_0x2c0: 619 + masked_interrupt_book3e PACA_IRQ_DBELL 0 620 + 679 621 /* 680 622 * Called from arch_local_irq_enable when an interrupt needs 681 623 * to be resent. r3 contains either 0x500,0x900,0x260 or 0x280 ··· 1356 1302 _GLOBAL(setup_doorbell_ivors) 1357 1303 SET_IVOR(36, 0x280) /* Processor Doorbell */ 1358 1304 SET_IVOR(37, 0x2a0) /* Processor Doorbell Crit */ 1359 - 1360 - /* Check MMUCFG[LPIDSIZE] to determine if we have category E.HV */ 1361 - mfspr r10,SPRN_MMUCFG 1362 - rlwinm. r10,r10,0,MMUCFG_LPIDSIZE 1363 - beqlr 1364 - 1365 - SET_IVOR(38, 0x2c0) /* Guest Processor Doorbell */ 1366 - SET_IVOR(39, 0x2e0) /* Guest Processor Doorbell Crit/MC */ 1367 1305 blr 1368 1306 1369 1307 _GLOBAL(setup_ehv_ivors) 1370 - /* 1371 - * We may be running as a guest and lack E.HV even on a chip 1372 - * that normally has it. 1373 - */ 1374 - mfspr r10,SPRN_MMUCFG 1375 - rlwinm. r10,r10,0,MMUCFG_LPIDSIZE 1376 - beqlr 1377 - 1378 1308 SET_IVOR(40, 0x300) /* Embedded Hypervisor System Call */ 1379 1309 SET_IVOR(41, 0x320) /* Embedded Hypervisor Privilege */ 1310 + SET_IVOR(38, 0x2c0) /* Guest Processor Doorbell */ 1311 + SET_IVOR(39, 0x2e0) /* Guest Processor Doorbell Crit/MC */ 1380 1312 blr
+126 -1
arch/powerpc/kernel/exceptions-64s.S
··· 275 275 STD_EXCEPTION_PSERIES(0x1300, 0x1300, instruction_breakpoint) 276 276 KVM_HANDLER_PR_SKIP(PACA_EXGEN, EXC_STD, 0x1300) 277 277 278 + . = 0x1500 279 + .global denorm_Hypervisor 280 + denorm_exception_hv: 281 + HMT_MEDIUM 282 + mtspr SPRN_SPRG_HSCRATCH0,r13 283 + mfspr r13,SPRN_SPRG_HPACA 284 + std r9,PACA_EXGEN+EX_R9(r13) 285 + std r10,PACA_EXGEN+EX_R10(r13) 286 + std r11,PACA_EXGEN+EX_R11(r13) 287 + std r12,PACA_EXGEN+EX_R12(r13) 288 + mfspr r9,SPRN_SPRG_HSCRATCH0 289 + std r9,PACA_EXGEN+EX_R13(r13) 290 + mfcr r9 291 + 292 + #ifdef CONFIG_PPC_DENORMALISATION 293 + mfspr r10,SPRN_HSRR1 294 + mfspr r11,SPRN_HSRR0 /* save HSRR0 */ 295 + andis. r10,r10,(HSRR1_DENORM)@h /* denorm? */ 296 + addi r11,r11,-4 /* HSRR0 is next instruction */ 297 + bne+ denorm_assist 298 + #endif 299 + 300 + EXCEPTION_PROLOG_PSERIES_1(denorm_common, EXC_HV) 301 + KVM_HANDLER_SKIP(PACA_EXGEN, EXC_STD, 0x1500) 302 + 278 303 #ifdef CONFIG_CBE_RAS 279 304 STD_EXCEPTION_HV(0x1600, 0x1602, cbe_maintenance) 280 305 KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1602) ··· 360 335 KVM_HANDLER_PR(PACA_EXSLB, EXC_STD, 0x480) 361 336 KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0x900) 362 337 KVM_HANDLER(PACA_EXGEN, EXC_HV, 0x982) 338 + 339 + #ifdef CONFIG_PPC_DENORMALISATION 340 + denorm_assist: 341 + BEGIN_FTR_SECTION 342 + /* 343 + * To denormalise we need to move a copy of the register to itself. 344 + * For POWER6 do that here for all FP regs. 345 + */ 346 + mfmsr r10 347 + ori r10,r10,(MSR_FP|MSR_FE0|MSR_FE1) 348 + xori r10,r10,(MSR_FE0|MSR_FE1) 349 + mtmsrd r10 350 + sync 351 + fmr 0,0 352 + fmr 1,1 353 + fmr 2,2 354 + fmr 3,3 355 + fmr 4,4 356 + fmr 5,5 357 + fmr 6,6 358 + fmr 7,7 359 + fmr 8,8 360 + fmr 9,9 361 + fmr 10,10 362 + fmr 11,11 363 + fmr 12,12 364 + fmr 13,13 365 + fmr 14,14 366 + fmr 15,15 367 + fmr 16,16 368 + fmr 17,17 369 + fmr 18,18 370 + fmr 19,19 371 + fmr 20,20 372 + fmr 21,21 373 + fmr 22,22 374 + fmr 23,23 375 + fmr 24,24 376 + fmr 25,25 377 + fmr 26,26 378 + fmr 27,27 379 + fmr 28,28 380 + fmr 29,29 381 + fmr 30,30 382 + fmr 31,31 383 + FTR_SECTION_ELSE 384 + /* 385 + * To denormalise we need to move a copy of the register to itself. 386 + * For POWER7 do that here for the first 32 VSX registers only. 387 + */ 388 + mfmsr r10 389 + oris r10,r10,MSR_VSX@h 390 + mtmsrd r10 391 + sync 392 + XVCPSGNDP(0,0,0) 393 + XVCPSGNDP(1,1,1) 394 + XVCPSGNDP(2,2,2) 395 + XVCPSGNDP(3,3,3) 396 + XVCPSGNDP(4,4,4) 397 + XVCPSGNDP(5,5,5) 398 + XVCPSGNDP(6,6,6) 399 + XVCPSGNDP(7,7,7) 400 + XVCPSGNDP(8,8,8) 401 + XVCPSGNDP(9,9,9) 402 + XVCPSGNDP(10,10,10) 403 + XVCPSGNDP(11,11,11) 404 + XVCPSGNDP(12,12,12) 405 + XVCPSGNDP(13,13,13) 406 + XVCPSGNDP(14,14,14) 407 + XVCPSGNDP(15,15,15) 408 + XVCPSGNDP(16,16,16) 409 + XVCPSGNDP(17,17,17) 410 + XVCPSGNDP(18,18,18) 411 + XVCPSGNDP(19,19,19) 412 + XVCPSGNDP(20,20,20) 413 + XVCPSGNDP(21,21,21) 414 + XVCPSGNDP(22,22,22) 415 + XVCPSGNDP(23,23,23) 416 + XVCPSGNDP(24,24,24) 417 + XVCPSGNDP(25,25,25) 418 + XVCPSGNDP(26,26,26) 419 + XVCPSGNDP(27,27,27) 420 + XVCPSGNDP(28,28,28) 421 + XVCPSGNDP(29,29,29) 422 + XVCPSGNDP(30,30,30) 423 + XVCPSGNDP(31,31,31) 424 + ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_206) 425 + mtspr SPRN_HSRR0,r11 426 + mtcrf 0x80,r9 427 + ld r9,PACA_EXGEN+EX_R9(r13) 428 + ld r10,PACA_EXGEN+EX_R10(r13) 429 + ld r11,PACA_EXGEN+EX_R11(r13) 430 + ld r12,PACA_EXGEN+EX_R12(r13) 431 + ld r13,PACA_EXGEN+EX_R13(r13) 432 + HRFID 433 + b . 434 + #endif 363 435 364 436 .align 7 365 437 /* moved from 0xe00 */ ··· 617 495 STD_EXCEPTION_COMMON(0xe60, hmi_exception, .unknown_exception) 618 496 STD_EXCEPTION_COMMON_ASYNC(0xf00, performance_monitor, .performance_monitor_exception) 619 497 STD_EXCEPTION_COMMON(0x1300, instruction_breakpoint, .instruction_breakpoint_exception) 498 + STD_EXCEPTION_COMMON(0x1502, denorm, .unknown_exception) 620 499 #ifdef CONFIG_ALTIVEC 621 500 STD_EXCEPTION_COMMON(0x1700, altivec_assist, .altivec_assist_exception) 622 501 #else ··· 1083 960 rldimi r10,r11,7,52 /* r10 = first ste of the group */ 1084 961 1085 962 /* Calculate VSID */ 1086 - /* This is a kernel address, so protovsid = ESID */ 963 + /* This is a kernel address, so protovsid = ESID | 1 << 37 */ 964 + li r9,0x1 965 + rldimi r11,r9,(CONTEXT_BITS + USER_ESID_BITS),0 1087 966 ASM_VSID_SCRAMBLE(r11, r9, 256M) 1088 967 rldic r9,r11,12,16 /* r9 = vsid << 12 */ 1089 968
+1 -2
arch/powerpc/kernel/fadump.c
··· 289 289 else 290 290 memory_limit = memblock_end_of_DRAM(); 291 291 printk(KERN_INFO "Adjusted memory_limit for firmware-assisted" 292 - " dump, now %#016llx\n", 293 - (unsigned long long)memory_limit); 292 + " dump, now %#016llx\n", memory_limit); 294 293 } 295 294 if (memory_limit) 296 295 memory_boundary = memory_limit;
+32 -14
arch/powerpc/kernel/head_fsl_booke.S
··· 895 895 mtspr SPRN_IVOR36,r3 896 896 li r3,CriticalDoorbell@l 897 897 mtspr SPRN_IVOR37,r3 898 + sync 899 + blr 898 900 899 - /* 900 - * We only want to touch IVOR38-41 if we're running on hardware 901 - * that supports category E.HV. The architectural way to determine 902 - * this is MMUCFG[LPIDSIZE]. 903 - */ 904 - mfspr r3, SPRN_MMUCFG 905 - andis. r3, r3, MMUCFG_LPIDSIZE@h 906 - beq no_hv 901 + /* setup ehv ivors for */ 902 + _GLOBAL(__setup_ehv_ivors) 907 903 li r3,GuestDoorbell@l 908 904 mtspr SPRN_IVOR38,r3 909 905 li r3,CriticalGuestDoorbell@l ··· 908 912 mtspr SPRN_IVOR40,r3 909 913 li r3,Ehvpriv@l 910 914 mtspr SPRN_IVOR41,r3 911 - skip_hv_ivors: 912 915 sync 913 916 blr 914 - no_hv: 915 - lwz r3, CPU_SPEC_FEATURES(r5) 916 - rlwinm r3, r3, 0, ~CPU_FTR_EMB_HV 917 - stw r3, CPU_SPEC_FEATURES(r5) 918 - b skip_hv_ivors 919 917 920 918 #ifdef CONFIG_SPE 921 919 /* ··· 1029 1039 1030 1040 /* restore HID0 */ 1031 1041 mtspr SPRN_HID0,r8 1042 + isync 1043 + 1044 + blr 1045 + 1046 + /* Flush L1 d-cache, invalidate and disable d-cache and i-cache */ 1047 + _GLOBAL(__flush_disable_L1) 1048 + mflr r10 1049 + bl flush_dcache_L1 /* Flush L1 d-cache */ 1050 + mtlr r10 1051 + 1052 + mfspr r4, SPRN_L1CSR0 /* Invalidate and disable d-cache */ 1053 + li r5, 2 1054 + rlwimi r4, r5, 0, 3 1055 + 1056 + msync 1057 + isync 1058 + mtspr SPRN_L1CSR0, r4 1059 + isync 1060 + 1061 + 1: mfspr r4, SPRN_L1CSR0 /* Wait for the invalidate to finish */ 1062 + andi. r4, r4, 2 1063 + bne 1b 1064 + 1065 + mfspr r4, SPRN_L1CSR1 /* Invalidate and disable i-cache */ 1066 + li r5, 2 1067 + rlwimi r4, r5, 0, 3 1068 + 1069 + mtspr SPRN_L1CSR1, r4 1032 1070 isync 1033 1071 1034 1072 blr
+16 -9
arch/powerpc/kernel/hw_breakpoint.c
··· 73 73 * If so, DABR will be populated in single_step_dabr_instruction(). 74 74 */ 75 75 if (current->thread.last_hit_ubp != bp) 76 - set_dabr(info->address | info->type | DABR_TRANSLATION); 76 + set_dabr(info->address | info->type | DABR_TRANSLATION, info->dabrx); 77 77 78 78 return 0; 79 79 } ··· 97 97 } 98 98 99 99 *slot = NULL; 100 - set_dabr(0); 100 + set_dabr(0, 0); 101 101 } 102 102 103 103 /* ··· 170 170 171 171 info->address = bp->attr.bp_addr; 172 172 info->len = bp->attr.bp_len; 173 + info->dabrx = DABRX_ALL; 174 + if (bp->attr.exclude_user) 175 + info->dabrx &= ~DABRX_USER; 176 + if (bp->attr.exclude_kernel) 177 + info->dabrx &= ~DABRX_KERNEL; 178 + if (bp->attr.exclude_hv) 179 + info->dabrx &= ~DABRX_HYP; 173 180 174 181 /* 175 182 * Since breakpoint length can be a maximum of HW_BREAKPOINT_LEN(8) ··· 204 197 205 198 info = counter_arch_bp(tsk->thread.last_hit_ubp); 206 199 regs->msr &= ~MSR_SE; 207 - set_dabr(info->address | info->type | DABR_TRANSLATION); 200 + set_dabr(info->address | info->type | DABR_TRANSLATION, info->dabrx); 208 201 tsk->thread.last_hit_ubp = NULL; 209 202 } 210 203 ··· 222 215 unsigned long dar = regs->dar; 223 216 224 217 /* Disable breakpoints during exception handling */ 225 - set_dabr(0); 218 + set_dabr(0, 0); 226 219 227 220 /* 228 221 * The counter may be concurrently released but that can only ··· 288 281 if (!info->extraneous_interrupt) 289 282 perf_bp_event(bp, regs); 290 283 291 - set_dabr(info->address | info->type | DABR_TRANSLATION); 284 + set_dabr(info->address | info->type | DABR_TRANSLATION, info->dabrx); 292 285 out: 293 286 rcu_read_unlock(); 294 287 return rc; ··· 301 294 { 302 295 struct pt_regs *regs = args->regs; 303 296 struct perf_event *bp = NULL; 304 - struct arch_hw_breakpoint *bp_info; 297 + struct arch_hw_breakpoint *info; 305 298 306 299 bp = current->thread.last_hit_ubp; 307 300 /* ··· 311 304 if (!bp) 312 305 return NOTIFY_DONE; 313 306 314 - bp_info = counter_arch_bp(bp); 307 + info = counter_arch_bp(bp); 315 308 316 309 /* 317 310 * We shall invoke the user-defined callback function in the single 318 311 * stepping handler to confirm to 'trigger-after-execute' semantics 319 312 */ 320 - if (!bp_info->extraneous_interrupt) 313 + if (!info->extraneous_interrupt) 321 314 perf_bp_event(bp, regs); 322 315 323 - set_dabr(bp_info->address | bp_info->type | DABR_TRANSLATION); 316 + set_dabr(info->address | info->type | DABR_TRANSLATION, info->dabrx); 324 317 current->thread.last_hit_ubp = NULL; 325 318 326 319 /*
-1
arch/powerpc/kernel/ibmebus.c
··· 47 47 #include <linux/stat.h> 48 48 #include <linux/of_platform.h> 49 49 #include <asm/ibmebus.h> 50 - #include <asm/abs_addr.h> 51 50 52 51 static struct device ibmebus_bus_device = { /* fake "parent" device */ 53 52 .init_name = "ibmebus",
+4 -1
arch/powerpc/kernel/iommu.c
··· 215 215 spin_lock_irqsave(&(pool->lock), flags); 216 216 217 217 again: 218 - if ((pass == 0) && handle && *handle) 218 + if ((pass == 0) && handle && *handle && 219 + (*handle >= pool->start) && (*handle < pool->end)) 219 220 start = *handle; 220 221 else 221 222 start = pool->hint; ··· 237 236 * but on second pass, start at 0 in pool 0. 238 237 */ 239 238 if ((start & mask) >= limit || pass > 0) { 239 + spin_unlock(&(pool->lock)); 240 240 pool = &(tbl->pools[0]); 241 + spin_lock(&(pool->lock)); 241 242 start = pool->start; 242 243 } else { 243 244 start &= mask;
+4 -4
arch/powerpc/kernel/irq.c
··· 489 489 struct pt_regs *old_regs = set_irq_regs(regs); 490 490 unsigned int irq; 491 491 492 - trace_irq_entry(regs); 493 - 494 492 irq_enter(); 493 + 494 + trace_irq_entry(regs); 495 495 496 496 check_stack_overflow(); 497 497 ··· 511 511 else 512 512 __get_cpu_var(irq_stat).spurious_irqs++; 513 513 514 + trace_irq_exit(regs); 515 + 514 516 irq_exit(); 515 517 set_irq_regs(old_regs); 516 - 517 - trace_irq_exit(regs); 518 518 } 519 519 520 520 void __init init_IRQ(void)
+13 -1
arch/powerpc/kernel/machine_kexec.c
··· 165 165 if (memory_limit && memory_limit <= crashk_res.end) { 166 166 memory_limit = crashk_res.end + 1; 167 167 printk("Adjusted memory limit for crashkernel, now 0x%llx\n", 168 - (unsigned long long)memory_limit); 168 + memory_limit); 169 169 } 170 170 171 171 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB " ··· 204 204 .value = &crashk_size, 205 205 }; 206 206 207 + static struct property memory_limit_prop = { 208 + .name = "linux,memory-limit", 209 + .length = sizeof(unsigned long long), 210 + .value = &memory_limit, 211 + }; 212 + 207 213 static void __init export_crashk_values(struct device_node *node) 208 214 { 209 215 struct property *prop; ··· 229 223 crashk_size = resource_size(&crashk_res); 230 224 prom_add_property(node, &crashk_size_prop); 231 225 } 226 + 227 + /* 228 + * memory_limit is required by the kexec-tools to limit the 229 + * crash regions to the actual memory used. 230 + */ 231 + prom_update_property(node, &memory_limit_prop); 232 232 } 233 233 234 234 static int __init kexec_setup(void)
+1
arch/powerpc/kernel/paca.c
··· 142 142 new_paca->hw_cpu_id = 0xffff; 143 143 new_paca->kexec_state = KEXEC_STATE_NONE; 144 144 new_paca->__current = &init_task; 145 + new_paca->data_offset = 0xfeeeeeeeeeeeeeeeULL; 145 146 #ifdef CONFIG_PPC_STD_MMU_64 146 147 new_paca->slb_shadow_ptr = &slb_shadow[cpu]; 147 148 #endif /* CONFIG_PPC_STD_MMU_64 */
+12 -4
arch/powerpc/kernel/pci-common.c
··· 980 980 if (i >= 3 && bus->self->transparent) 981 981 continue; 982 982 983 - /* If we are going to re-assign everything, mark the resource 984 - * as unset and move it down to 0 983 + /* If we're going to reassign everything, we can 984 + * shrink the P2P resource to have size as being 985 + * of 0 in order to save space. 985 986 */ 986 987 if (pci_has_flag(PCI_REASSIGN_ALL_RSRC)) { 987 988 res->flags |= IORESOURCE_UNSET; 988 - res->end -= res->start; 989 989 res->start = 0; 990 + res->end = -1; 990 991 continue; 991 992 } 992 993 ··· 1249 1248 pr_warning("PCI: Cannot allocate resource region " 1250 1249 "%d of PCI bridge %d, will remap\n", i, bus->number); 1251 1250 clear_resource: 1252 - res->start = res->end = 0; 1251 + /* The resource might be figured out when doing 1252 + * reassignment based on the resources required 1253 + * by the downstream PCI devices. Here we set 1254 + * the size of the resource to be 0 in order to 1255 + * save more space. 1256 + */ 1257 + res->start = 0; 1258 + res->end = -1; 1253 1259 res->flags = 0; 1254 1260 } 1255 1261
+9 -7
arch/powerpc/kernel/process.c
··· 258 258 { 259 259 siginfo_t info; 260 260 261 + current->thread.trap_nr = signal_code; 261 262 if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code, 262 263 11, SIGSEGV) == NOTIFY_STOP) 263 264 return; ··· 276 275 { 277 276 siginfo_t info; 278 277 278 + current->thread.trap_nr = TRAP_HWBKPT; 279 279 if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code, 280 280 11, SIGSEGV) == NOTIFY_STOP) 281 281 return; ··· 285 283 return; 286 284 287 285 /* Clear the DABR */ 288 - set_dabr(0); 286 + set_dabr(0, 0); 289 287 290 288 /* Deliver the signal to userspace */ 291 289 info.si_signo = SIGTRAP; ··· 366 364 { 367 365 if (thread->dabr) { 368 366 thread->dabr = 0; 369 - set_dabr(0); 367 + thread->dabrx = 0; 368 + set_dabr(0, 0); 370 369 } 371 370 } 372 371 #endif /* !CONFIG_HAVE_HW_BREAKPOINT */ 373 372 #endif /* CONFIG_PPC_ADV_DEBUG_REGS */ 374 373 375 - int set_dabr(unsigned long dabr) 374 + int set_dabr(unsigned long dabr, unsigned long dabrx) 376 375 { 377 376 __get_cpu_var(current_dabr) = dabr; 378 377 379 378 if (ppc_md.set_dabr) 380 - return ppc_md.set_dabr(dabr); 379 + return ppc_md.set_dabr(dabr, dabrx); 381 380 382 381 /* XXX should we have a CPU_FTR_HAS_DABR ? */ 383 382 #ifdef CONFIG_PPC_ADV_DEBUG_REGS ··· 388 385 #endif 389 386 #elif defined(CONFIG_PPC_BOOK3S) 390 387 mtspr(SPRN_DABR, dabr); 388 + mtspr(SPRN_DABRX, dabrx); 391 389 #endif 392 - 393 - 394 390 return 0; 395 391 } 396 392 ··· 482 480 */ 483 481 #ifndef CONFIG_HAVE_HW_BREAKPOINT 484 482 if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) 485 - set_dabr(new->thread.dabr); 483 + set_dabr(new->thread.dabr, new->thread.dabrx); 486 484 #endif /* CONFIG_HAVE_HW_BREAKPOINT */ 487 485 #endif 488 486
+2 -2
arch/powerpc/kernel/prom.c
··· 78 78 return 1; 79 79 80 80 memory_limit = PAGE_ALIGN(memparse(p, &p)); 81 - DBG("memory limit = 0x%llx\n", (unsigned long long)memory_limit); 81 + DBG("memory limit = 0x%llx\n", memory_limit); 82 82 83 83 return 0; 84 84 } ··· 661 661 662 662 /* make sure we've parsed cmdline for mem= before this */ 663 663 if (memory_limit) 664 - first_memblock_size = min(first_memblock_size, memory_limit); 664 + first_memblock_size = min_t(u64, first_memblock_size, memory_limit); 665 665 setup_initial_memory_limit(memstart_addr, first_memblock_size); 666 666 /* Reserve MEMBLOCK regions used by kernel, initrd, dt, etc... */ 667 667 memblock_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
+1 -1
arch/powerpc/kernel/prom_init.c
··· 1748 1748 * else will impact performance, so we always allocate 8MB. 1749 1749 * Anton 1750 1750 */ 1751 - if (__is_processor(PV_POWER4) || __is_processor(PV_POWER4p)) 1751 + if (pvr_version_is(PVR_POWER4) || pvr_version_is(PVR_POWER4p)) 1752 1752 minsize = 8UL << 20; 1753 1753 else 1754 1754 minsize = 4UL << 20;
+3
arch/powerpc/kernel/ptrace.c
··· 960 960 thread->ptrace_bps[0] = bp; 961 961 ptrace_put_breakpoints(task); 962 962 thread->dabr = data; 963 + thread->dabrx = DABRX_ALL; 963 964 return 0; 964 965 } 965 966 ··· 984 983 985 984 /* Move contents to the DABR register */ 986 985 task->thread.dabr = data; 986 + task->thread.dabrx = DABRX_ALL; 987 987 #else /* CONFIG_PPC_ADV_DEBUG_REGS */ 988 988 /* As described above, it was assumed 3 bits were passed with the data 989 989 * address, but we will assume only the mode bits will be passed ··· 1399 1397 dabr |= DABR_DATA_WRITE; 1400 1398 1401 1399 child->thread.dabr = dabr; 1400 + child->thread.dabrx = DABRX_ALL; 1402 1401 1403 1402 return 1; 1404 1403 #endif /* !CONFIG_PPC_ADV_DEBUG_DVCS */
+3 -4
arch/powerpc/kernel/rtas_flash.c
··· 21 21 #include <asm/delay.h> 22 22 #include <asm/uaccess.h> 23 23 #include <asm/rtas.h> 24 - #include <asm/abs_addr.h> 25 24 26 25 #define MODULE_VERS "1.0" 27 26 #define MODULE_NAME "rtas_flash" ··· 581 582 flist = (struct flash_block_list *)&rtas_data_buf[0]; 582 583 flist->num_blocks = 0; 583 584 flist->next = rtas_firmware_flash_list; 584 - rtas_block_list = virt_to_abs(flist); 585 + rtas_block_list = __pa(flist); 585 586 if (rtas_block_list >= 4UL*1024*1024*1024) { 586 587 printk(KERN_ALERT "FLASH: kernel bug...flash list header addr above 4GB\n"); 587 588 spin_unlock(&rtas_data_buf_lock); ··· 595 596 for (f = flist; f; f = next) { 596 597 /* Translate data addrs to absolute */ 597 598 for (i = 0; i < f->num_blocks; i++) { 598 - f->blocks[i].data = (char *)virt_to_abs(f->blocks[i].data); 599 + f->blocks[i].data = (char *)__pa(f->blocks[i].data); 599 600 image_size += f->blocks[i].length; 600 601 } 601 602 next = f->next; 602 603 /* Don't translate NULL pointer for last entry */ 603 604 if (f->next) 604 - f->next = (struct flash_block_list *)virt_to_abs(f->next); 605 + f->next = (struct flash_block_list *)__pa(f->next); 605 606 else 606 607 f->next = NULL; 607 608 /* make num_blocks into the version/length field */
+1 -4
arch/powerpc/kernel/rtas_pci.c
··· 81 81 return PCIBIOS_DEVICE_NOT_FOUND; 82 82 83 83 if (returnval == EEH_IO_ERROR_VALUE(size) && 84 - eeh_dn_check_failure (pdn->node, NULL)) 84 + eeh_dev_check_failure(of_node_to_eeh_dev(pdn->node))) 85 85 return PCIBIOS_DEVICE_NOT_FOUND; 86 86 87 87 return PCIBIOS_SUCCESSFUL; ··· 274 274 275 275 of_node_put(root); 276 276 pci_devs_phb_init(); 277 - 278 - /* Create EEH devices for all PHBs */ 279 - eeh_dev_phb_init(); 280 277 281 278 /* 282 279 * PCI_PROBE_ONLY and PCI_REASSIGN_ALL_BUS can be set via properties
+2
arch/powerpc/kernel/setup_64.c
··· 208 208 209 209 /* Fix up paca fields required for the boot cpu */ 210 210 get_paca()->cpu_start = 1; 211 + /* Allow percpu accesses to "work" until we setup percpu data */ 212 + get_paca()->data_offset = 0; 211 213 212 214 /* Probe the machine type */ 213 215 probe_machine();
+7 -1
arch/powerpc/kernel/signal.c
··· 11 11 12 12 #include <linux/tracehook.h> 13 13 #include <linux/signal.h> 14 + #include <linux/uprobes.h> 14 15 #include <linux/key.h> 15 16 #include <asm/hw_breakpoint.h> 16 17 #include <asm/uaccess.h> ··· 131 130 * triggered inside the kernel. 132 131 */ 133 132 if (current->thread.dabr) 134 - set_dabr(current->thread.dabr); 133 + set_dabr(current->thread.dabr, current->thread.dabrx); 135 134 #endif 136 135 /* Re-enable the breakpoints for the signal stack */ 137 136 thread_change_pc(current, regs); ··· 158 157 159 158 void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) 160 159 { 160 + if (thread_info_flags & _TIF_UPROBE) { 161 + clear_thread_flag(TIF_UPROBE); 162 + uprobe_notify_resume(regs); 163 + } 164 + 161 165 if (thread_info_flags & _TIF_SIGPENDING) 162 166 do_signal(regs); 163 167
+12 -2
arch/powerpc/kernel/smp.c
··· 102 102 * Ok it's not there, so it might be soft-unplugged, let's 103 103 * try to bring it back 104 104 */ 105 - per_cpu(cpu_state, nr) = CPU_UP_PREPARE; 105 + generic_set_cpu_up(nr); 106 106 smp_wmb(); 107 107 smp_send_reschedule(nr); 108 108 #endif /* CONFIG_HOTPLUG_CPU */ ··· 171 171 } 172 172 #endif 173 173 err = request_irq(virq, smp_ipi_action[msg], 174 - IRQF_PERCPU | IRQF_NO_THREAD, 174 + IRQF_PERCPU | IRQF_NO_THREAD | IRQF_NO_SUSPEND, 175 175 smp_ipi_name[msg], 0); 176 176 WARN(err < 0, "unable to request_irq %d for %s (rc %d)\n", 177 177 virq, smp_ipi_name[msg], err); ··· 411 411 void generic_set_cpu_dead(unsigned int cpu) 412 412 { 413 413 per_cpu(cpu_state, cpu) = CPU_DEAD; 414 + } 415 + 416 + /* 417 + * The cpu_state should be set to CPU_UP_PREPARE in kick_cpu(), otherwise 418 + * the cpu_state is always CPU_DEAD after calling generic_set_cpu_dead(), 419 + * which makes the delay in generic_cpu_die() not happen. 420 + */ 421 + void generic_set_cpu_up(unsigned int cpu) 422 + { 423 + per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; 414 424 } 415 425 416 426 int generic_check_cpu_restart(unsigned int cpu)
+4 -4
arch/powerpc/kernel/time.c
··· 508 508 */ 509 509 may_hard_irq_enable(); 510 510 511 - trace_timer_interrupt_entry(regs); 512 - 513 511 __get_cpu_var(irq_stat).timer_irqs++; 514 512 515 513 #if defined(CONFIG_PPC32) && defined(CONFIG_PMAC) ··· 517 519 518 520 old_regs = set_irq_regs(regs); 519 521 irq_enter(); 522 + 523 + trace_timer_interrupt_entry(regs); 520 524 521 525 if (test_irq_work_pending()) { 522 526 clear_irq_work_pending(); ··· 544 544 } 545 545 #endif 546 546 547 + trace_timer_interrupt_exit(regs); 548 + 547 549 irq_exit(); 548 550 set_irq_regs(old_regs); 549 - 550 - trace_timer_interrupt_exit(regs); 551 551 } 552 552 553 553 /*
+1
arch/powerpc/kernel/traps.c
··· 251 251 if (arch_irqs_disabled() && !arch_irq_disabled_regs(regs)) 252 252 local_irq_enable(); 253 253 254 + current->thread.trap_nr = code; 254 255 memset(&info, 0, sizeof(info)); 255 256 info.si_signo = signr; 256 257 info.si_code = code;
+184
arch/powerpc/kernel/uprobes.c
··· 1 + /* 2 + * User-space Probes (UProbes) for powerpc 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + * This program is distributed in the hope that it will be useful, 10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 + * GNU General Public License for more details. 13 + * 14 + * You should have received a copy of the GNU General Public License 15 + * along with this program; if not, write to the Free Software 16 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 + * 18 + * Copyright IBM Corporation, 2007-2012 19 + * 20 + * Adapted from the x86 port by Ananth N Mavinakayanahalli <ananth@in.ibm.com> 21 + */ 22 + #include <linux/kernel.h> 23 + #include <linux/sched.h> 24 + #include <linux/ptrace.h> 25 + #include <linux/uprobes.h> 26 + #include <linux/uaccess.h> 27 + #include <linux/kdebug.h> 28 + 29 + #include <asm/sstep.h> 30 + 31 + #define UPROBE_TRAP_NR UINT_MAX 32 + 33 + /** 34 + * arch_uprobe_analyze_insn 35 + * @mm: the probed address space. 36 + * @arch_uprobe: the probepoint information. 37 + * @addr: vaddr to probe. 38 + * Return 0 on success or a -ve number on error. 39 + */ 40 + int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe, 41 + struct mm_struct *mm, unsigned long addr) 42 + { 43 + if (addr & 0x03) 44 + return -EINVAL; 45 + 46 + /* 47 + * We currently don't support a uprobe on an already 48 + * existing breakpoint instruction underneath 49 + */ 50 + if (is_trap(auprobe->ainsn)) 51 + return -ENOTSUPP; 52 + return 0; 53 + } 54 + 55 + /* 56 + * arch_uprobe_pre_xol - prepare to execute out of line. 57 + * @auprobe: the probepoint information. 58 + * @regs: reflects the saved user state of current task. 59 + */ 60 + int arch_uprobe_pre_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) 61 + { 62 + struct arch_uprobe_task *autask = &current->utask->autask; 63 + 64 + autask->saved_trap_nr = current->thread.trap_nr; 65 + current->thread.trap_nr = UPROBE_TRAP_NR; 66 + regs->nip = current->utask->xol_vaddr; 67 + return 0; 68 + } 69 + 70 + /** 71 + * uprobe_get_swbp_addr - compute address of swbp given post-swbp regs 72 + * @regs: Reflects the saved state of the task after it has hit a breakpoint 73 + * instruction. 74 + * Return the address of the breakpoint instruction. 75 + */ 76 + unsigned long uprobe_get_swbp_addr(struct pt_regs *regs) 77 + { 78 + return instruction_pointer(regs); 79 + } 80 + 81 + /* 82 + * If xol insn itself traps and generates a signal (SIGILL/SIGSEGV/etc), 83 + * then detect the case where a singlestepped instruction jumps back to its 84 + * own address. It is assumed that anything like do_page_fault/do_trap/etc 85 + * sets thread.trap_nr != UINT_MAX. 86 + * 87 + * arch_uprobe_pre_xol/arch_uprobe_post_xol save/restore thread.trap_nr, 88 + * arch_uprobe_xol_was_trapped() simply checks that ->trap_nr is not equal to 89 + * UPROBE_TRAP_NR == UINT_MAX set by arch_uprobe_pre_xol(). 90 + */ 91 + bool arch_uprobe_xol_was_trapped(struct task_struct *t) 92 + { 93 + if (t->thread.trap_nr != UPROBE_TRAP_NR) 94 + return true; 95 + 96 + return false; 97 + } 98 + 99 + /* 100 + * Called after single-stepping. To avoid the SMP problems that can 101 + * occur when we temporarily put back the original opcode to 102 + * single-step, we single-stepped a copy of the instruction. 103 + * 104 + * This function prepares to resume execution after the single-step. 105 + */ 106 + int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) 107 + { 108 + struct uprobe_task *utask = current->utask; 109 + 110 + WARN_ON_ONCE(current->thread.trap_nr != UPROBE_TRAP_NR); 111 + 112 + current->thread.trap_nr = utask->autask.saved_trap_nr; 113 + 114 + /* 115 + * On powerpc, except for loads and stores, most instructions 116 + * including ones that alter code flow (branches, calls, returns) 117 + * are emulated in the kernel. We get here only if the emulation 118 + * support doesn't exist and have to fix-up the next instruction 119 + * to be executed. 120 + */ 121 + regs->nip = utask->vaddr + MAX_UINSN_BYTES; 122 + return 0; 123 + } 124 + 125 + /* callback routine for handling exceptions. */ 126 + int arch_uprobe_exception_notify(struct notifier_block *self, 127 + unsigned long val, void *data) 128 + { 129 + struct die_args *args = data; 130 + struct pt_regs *regs = args->regs; 131 + 132 + /* regs == NULL is a kernel bug */ 133 + if (WARN_ON(!regs)) 134 + return NOTIFY_DONE; 135 + 136 + /* We are only interested in userspace traps */ 137 + if (!user_mode(regs)) 138 + return NOTIFY_DONE; 139 + 140 + switch (val) { 141 + case DIE_BPT: 142 + if (uprobe_pre_sstep_notifier(regs)) 143 + return NOTIFY_STOP; 144 + break; 145 + case DIE_SSTEP: 146 + if (uprobe_post_sstep_notifier(regs)) 147 + return NOTIFY_STOP; 148 + default: 149 + break; 150 + } 151 + return NOTIFY_DONE; 152 + } 153 + 154 + /* 155 + * This function gets called when XOL instruction either gets trapped or 156 + * the thread has a fatal signal, so reset the instruction pointer to its 157 + * probed address. 158 + */ 159 + void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) 160 + { 161 + struct uprobe_task *utask = current->utask; 162 + 163 + current->thread.trap_nr = utask->autask.saved_trap_nr; 164 + instruction_pointer_set(regs, utask->vaddr); 165 + } 166 + 167 + /* 168 + * See if the instruction can be emulated. 169 + * Returns true if instruction was emulated, false otherwise. 170 + */ 171 + bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs) 172 + { 173 + int ret; 174 + 175 + /* 176 + * emulate_step() returns 1 if the insn was successfully emulated. 177 + * For all other cases, we need to single-step in hardware. 178 + */ 179 + ret = emulate_step(regs, auprobe->ainsn); 180 + if (ret > 0) 181 + return true; 182 + 183 + return false; 184 + }
+1 -3
arch/powerpc/kernel/vdso.c
··· 723 723 724 724 val = (cpu & 0xfff) | ((node & 0xffff) << 16); 725 725 mtspr(SPRN_SPRG3, val); 726 - #ifdef CONFIG_KVM_BOOK3S_HANDLER 727 - get_paca()->kvm_hstate.sprg3 = val; 728 - #endif 726 + get_paca()->sprg3 = val; 729 727 730 728 put_cpu(); 731 729
-1
arch/powerpc/kernel/vio.c
··· 33 33 #include <asm/prom.h> 34 34 #include <asm/firmware.h> 35 35 #include <asm/tce.h> 36 - #include <asm/abs_addr.h> 37 36 #include <asm/page.h> 38 37 #include <asm/hvcall.h> 39 38
+4 -4
arch/powerpc/kvm/book3s_32_mmu_host.c
··· 141 141 int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte) 142 142 { 143 143 pfn_t hpaddr; 144 - u64 va; 144 + u64 vpn; 145 145 u64 vsid; 146 146 struct kvmppc_sid_map *map; 147 147 volatile u32 *pteg; ··· 173 173 BUG_ON(!map); 174 174 175 175 vsid = map->host_vsid; 176 - va = (vsid << SID_SHIFT) | (eaddr & ~ESID_MASK); 176 + vpn = (vsid << (SID_SHIFT - VPN_SHIFT)) | ((eaddr & ~ESID_MASK) >> VPN_SHIFT) 177 177 178 178 next_pteg: 179 179 if (rr == 16) { ··· 244 244 dprintk_mmu("KVM: %c%c Map 0x%llx: [%lx] 0x%llx (0x%llx) -> %lx\n", 245 245 orig_pte->may_write ? 'w' : '-', 246 246 orig_pte->may_execute ? 'x' : '-', 247 - orig_pte->eaddr, (ulong)pteg, va, 247 + orig_pte->eaddr, (ulong)pteg, vpn, 248 248 orig_pte->vpage, hpaddr); 249 249 250 250 pte->slot = (ulong)&pteg[rr]; 251 - pte->host_va = va; 251 + pte->host_vpn = vpn; 252 252 pte->pte = *orig_pte; 253 253 pte->pfn = hpaddr >> PAGE_SHIFT; 254 254
+10 -7
arch/powerpc/kvm/book3s_64_mmu_host.c
··· 33 33 34 34 void kvmppc_mmu_invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte) 35 35 { 36 - ppc_md.hpte_invalidate(pte->slot, pte->host_va, 36 + ppc_md.hpte_invalidate(pte->slot, pte->host_vpn, 37 37 MMU_PAGE_4K, MMU_SEGSIZE_256M, 38 38 false); 39 39 } ··· 80 80 81 81 int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte) 82 82 { 83 + unsigned long vpn; 83 84 pfn_t hpaddr; 84 - ulong hash, hpteg, va; 85 + ulong hash, hpteg; 85 86 u64 vsid; 86 87 int ret; 87 88 int rflags = 0x192; ··· 118 117 } 119 118 120 119 vsid = map->host_vsid; 121 - va = hpt_va(orig_pte->eaddr, vsid, MMU_SEGSIZE_256M); 120 + vpn = hpt_vpn(orig_pte->eaddr, vsid, MMU_SEGSIZE_256M); 122 121 123 122 if (!orig_pte->may_write) 124 123 rflags |= HPTE_R_PP; ··· 130 129 else 131 130 kvmppc_mmu_flush_icache(hpaddr >> PAGE_SHIFT); 132 131 133 - hash = hpt_hash(va, PTE_SIZE, MMU_SEGSIZE_256M); 132 + hash = hpt_hash(vpn, PTE_SIZE, MMU_SEGSIZE_256M); 134 133 135 134 map_again: 136 135 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP); ··· 142 141 goto out; 143 142 } 144 143 145 - ret = ppc_md.hpte_insert(hpteg, va, hpaddr, rflags, vflags, MMU_PAGE_4K, MMU_SEGSIZE_256M); 144 + ret = ppc_md.hpte_insert(hpteg, vpn, hpaddr, rflags, vflags, 145 + MMU_PAGE_4K, MMU_SEGSIZE_256M); 146 146 147 147 if (ret < 0) { 148 148 /* If we couldn't map a primary PTE, try a secondary */ ··· 154 152 } else { 155 153 struct hpte_cache *pte = kvmppc_mmu_hpte_cache_next(vcpu); 156 154 157 - trace_kvm_book3s_64_mmu_map(rflags, hpteg, va, hpaddr, orig_pte); 155 + trace_kvm_book3s_64_mmu_map(rflags, hpteg, 156 + vpn, hpaddr, orig_pte); 158 157 159 158 /* The ppc_md code may give us a secondary entry even though we 160 159 asked for a primary. Fix up. */ ··· 165 162 } 166 163 167 164 pte->slot = hpteg + (ret & 7); 168 - pte->host_va = va; 165 + pte->host_vpn = vpn; 169 166 pte->pte = *orig_pte; 170 167 pte->pfn = hpaddr >> PAGE_SHIFT; 171 168
+1 -1
arch/powerpc/kvm/book3s_hv_rmhandlers.S
··· 1065 1065 mtspr SPRN_DABRX,r6 1066 1066 1067 1067 /* Restore SPRG3 */ 1068 - ld r3,HSTATE_SPRG3(r13) 1068 + ld r3,PACA_SPRG3(r13) 1069 1069 mtspr SPRN_SPRG3,r3 1070 1070 1071 1071 /*
+7 -7
arch/powerpc/kvm/trace.h
··· 189 189 TP_ARGS(pte), 190 190 191 191 TP_STRUCT__entry( 192 - __field( u64, host_va ) 192 + __field( u64, host_vpn ) 193 193 __field( u64, pfn ) 194 194 __field( ulong, eaddr ) 195 195 __field( u64, vpage ) ··· 198 198 ), 199 199 200 200 TP_fast_assign( 201 - __entry->host_va = pte->host_va; 201 + __entry->host_vpn = pte->host_vpn; 202 202 __entry->pfn = pte->pfn; 203 203 __entry->eaddr = pte->pte.eaddr; 204 204 __entry->vpage = pte->pte.vpage; ··· 208 208 (pte->pte.may_execute ? 0x1 : 0); 209 209 ), 210 210 211 - TP_printk("Map: hva=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]", 212 - __entry->host_va, __entry->pfn, __entry->eaddr, 211 + TP_printk("Map: hvpn=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]", 212 + __entry->host_vpn, __entry->pfn, __entry->eaddr, 213 213 __entry->vpage, __entry->raddr, __entry->flags) 214 214 ); 215 215 ··· 218 218 TP_ARGS(pte), 219 219 220 220 TP_STRUCT__entry( 221 - __field( u64, host_va ) 221 + __field( u64, host_vpn ) 222 222 __field( u64, pfn ) 223 223 __field( ulong, eaddr ) 224 224 __field( u64, vpage ) ··· 227 227 ), 228 228 229 229 TP_fast_assign( 230 - __entry->host_va = pte->host_va; 230 + __entry->host_vpn = pte->host_vpn; 231 231 __entry->pfn = pte->pfn; 232 232 __entry->eaddr = pte->pte.eaddr; 233 233 __entry->vpage = pte->pte.vpage; ··· 238 238 ), 239 239 240 240 TP_printk("Flush: hva=%llx pfn=%llx ea=%lx vp=%llx ra=%lx [%x]", 241 - __entry->host_va, __entry->pfn, __entry->eaddr, 241 + __entry->host_vpn, __entry->pfn, __entry->eaddr, 242 242 __entry->vpage, __entry->raddr, __entry->flags) 243 243 ); 244 244
+2 -2
arch/powerpc/lib/memcpy_power7.S
··· 239 239 ori r9,r9,1 /* stream=1 */ 240 240 241 241 srdi r7,r5,7 /* length in cachelines, capped at 0x3FF */ 242 - cmpldi cr1,r7,0x3FF 243 - ble cr1,1f 242 + cmpldi r7,0x3FF 243 + ble 1f 244 244 li r7,0x3FF 245 245 1: lis r0,0x0E00 /* depth=7 */ 246 246 sldi r7,r7,7
+34 -2
arch/powerpc/lib/sstep.c
··· 566 566 unsigned long int ea; 567 567 unsigned int cr, mb, me, sh; 568 568 int err; 569 - unsigned long old_ra; 569 + unsigned long old_ra, val3; 570 570 long ival; 571 571 572 572 opcode = instr >> 26; ··· 1486 1486 goto ldst_done; 1487 1487 1488 1488 case 36: /* stw */ 1489 - case 37: /* stwu */ 1490 1489 val = regs->gpr[rd]; 1491 1490 err = write_mem(val, dform_ea(instr, regs), 4, regs); 1491 + goto ldst_done; 1492 + 1493 + case 37: /* stwu */ 1494 + val = regs->gpr[rd]; 1495 + val3 = dform_ea(instr, regs); 1496 + /* 1497 + * For PPC32 we always use stwu to change stack point with r1. So 1498 + * this emulated store may corrupt the exception frame, now we 1499 + * have to provide the exception frame trampoline, which is pushed 1500 + * below the kprobed function stack. So we only update gpr[1] but 1501 + * don't emulate the real store operation. We will do real store 1502 + * operation safely in exception return code by checking this flag. 1503 + */ 1504 + if ((ra == 1) && !(regs->msr & MSR_PR) \ 1505 + && (val3 >= (regs->gpr[1] - STACK_INT_FRAME_SIZE))) { 1506 + /* 1507 + * Check if we will touch kernel sack overflow 1508 + */ 1509 + if (val3 - STACK_INT_FRAME_SIZE <= current->thread.ksp_limit) { 1510 + printk(KERN_CRIT "Can't kprobe this since Kernel stack overflow.\n"); 1511 + err = -EINVAL; 1512 + break; 1513 + } 1514 + 1515 + /* 1516 + * Check if we already set since that means we'll 1517 + * lose the previous value. 1518 + */ 1519 + WARN_ON(test_thread_flag(TIF_EMULATE_STACK_STORE)); 1520 + set_thread_flag(TIF_EMULATE_STACK_STORE); 1521 + err = 0; 1522 + } else 1523 + err = write_mem(val, val3, 4, regs); 1492 1524 goto ldst_done; 1493 1525 1494 1526 case 38: /* stb */
+1
arch/powerpc/mm/fault.c
··· 133 133 up_read(&current->mm->mmap_sem); 134 134 135 135 if (user_mode(regs)) { 136 + current->thread.trap_nr = BUS_ADRERR; 136 137 info.si_signo = SIGBUS; 137 138 info.si_errno = 0; 138 139 info.si_code = BUS_ADRERR;
+60 -37
arch/powerpc/mm/hash_low_64.S
··· 63 63 /* Save non-volatile registers. 64 64 * r31 will hold "old PTE" 65 65 * r30 is "new PTE" 66 - * r29 is "va" 66 + * r29 is vpn 67 67 * r28 is a hash value 68 68 * r27 is hashtab mask (maybe dynamic patched instead ?) 69 69 */ ··· 111 111 cmpdi r9,0 /* check segment size */ 112 112 bne 3f 113 113 END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT) 114 - /* Calc va and put it in r29 */ 115 - rldicr r29,r5,28,63-28 116 - rldicl r3,r3,0,36 117 - or r29,r3,r29 114 + /* Calc vpn and put it in r29 */ 115 + sldi r29,r5,SID_SHIFT - VPN_SHIFT 116 + rldicl r28,r3,64 - VPN_SHIFT,64 - (SID_SHIFT - VPN_SHIFT) 117 + or r29,r28,r29 118 118 119 119 /* Calculate hash value for primary slot and store it in r28 */ 120 120 rldicl r5,r5,0,25 /* vsid & 0x0000007fffffffff */ ··· 122 122 xor r28,r5,r0 123 123 b 4f 124 124 125 - 3: /* Calc VA and hash in r29 and r28 for 1T segment */ 126 - sldi r29,r5,40 /* vsid << 40 */ 127 - clrldi r3,r3,24 /* ea & 0xffffffffff */ 125 + 3: /* Calc vpn and put it in r29 */ 126 + sldi r29,r5,SID_SHIFT_1T - VPN_SHIFT 127 + rldicl r28,r3,64 - VPN_SHIFT,64 - (SID_SHIFT_1T - VPN_SHIFT) 128 + or r29,r28,r29 129 + 130 + /* 131 + * calculate hash value for primary slot and 132 + * store it in r28 for 1T segment 133 + */ 128 134 rldic r28,r5,25,25 /* (vsid << 25) & 0x7fffffffff */ 129 135 clrldi r5,r5,40 /* vsid & 0xffffff */ 130 136 rldicl r0,r3,64-12,36 /* (ea >> 12) & 0xfffffff */ 131 137 xor r28,r28,r5 132 - or r29,r3,r29 /* VA */ 133 138 xor r28,r28,r0 /* hash */ 134 139 135 140 /* Convert linux PTE bits into HW equivalents */ ··· 190 185 191 186 /* Call ppc_md.hpte_insert */ 192 187 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */ 193 - mr r4,r29 /* Retrieve va */ 188 + mr r4,r29 /* Retrieve vpn */ 194 189 li r7,0 /* !bolted, !secondary */ 195 190 li r8,MMU_PAGE_4K /* page size */ 196 191 ld r9,STK_PARAM(R9)(r1) /* segment size */ ··· 213 208 214 209 /* Call ppc_md.hpte_insert */ 215 210 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */ 216 - mr r4,r29 /* Retrieve va */ 211 + mr r4,r29 /* Retrieve vpn */ 217 212 li r7,HPTE_V_SECONDARY /* !bolted, secondary */ 218 213 li r8,MMU_PAGE_4K /* page size */ 219 214 ld r9,STK_PARAM(R9)(r1) /* segment size */ ··· 283 278 add r3,r0,r3 /* add slot idx */ 284 279 285 280 /* Call ppc_md.hpte_updatepp */ 286 - mr r5,r29 /* va */ 281 + mr r5,r29 /* vpn */ 287 282 li r6,MMU_PAGE_4K /* page size */ 288 283 ld r7,STK_PARAM(R9)(r1) /* segment size */ 289 284 ld r8,STK_PARAM(R8)(r1) /* get "local" param */ ··· 344 339 /* Save non-volatile registers. 345 340 * r31 will hold "old PTE" 346 341 * r30 is "new PTE" 347 - * r29 is "va" 342 + * r29 is vpn 348 343 * r28 is a hash value 349 344 * r27 is hashtab mask (maybe dynamic patched instead ?) 350 345 * r26 is the hidx mask ··· 399 394 cmpdi r9,0 /* check segment size */ 400 395 bne 3f 401 396 END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT) 402 - /* Calc va and put it in r29 */ 403 - rldicr r29,r5,28,63-28 /* r29 = (vsid << 28) */ 404 - rldicl r3,r3,0,36 /* r3 = (ea & 0x0fffffff) */ 405 - or r29,r3,r29 /* r29 = va */ 397 + /* Calc vpn and put it in r29 */ 398 + sldi r29,r5,SID_SHIFT - VPN_SHIFT 399 + /* 400 + * clrldi r3,r3,64 - SID_SHIFT --> ea & 0xfffffff 401 + * srdi r28,r3,VPN_SHIFT 402 + */ 403 + rldicl r28,r3,64 - VPN_SHIFT,64 - (SID_SHIFT - VPN_SHIFT) 404 + or r29,r28,r29 406 405 407 406 /* Calculate hash value for primary slot and store it in r28 */ 408 407 rldicl r5,r5,0,25 /* vsid & 0x0000007fffffffff */ ··· 414 405 xor r28,r5,r0 415 406 b 4f 416 407 417 - 3: /* Calc VA and hash in r29 and r28 for 1T segment */ 418 - sldi r29,r5,40 /* vsid << 40 */ 419 - clrldi r3,r3,24 /* ea & 0xffffffffff */ 408 + 3: /* Calc vpn and put it in r29 */ 409 + sldi r29,r5,SID_SHIFT_1T - VPN_SHIFT 410 + /* 411 + * clrldi r3,r3,64 - SID_SHIFT_1T --> ea & 0xffffffffff 412 + * srdi r28,r3,VPN_SHIFT 413 + */ 414 + rldicl r28,r3,64 - VPN_SHIFT,64 - (SID_SHIFT_1T - VPN_SHIFT) 415 + or r29,r28,r29 416 + 417 + /* 418 + * Calculate hash value for primary slot and 419 + * store it in r28 for 1T segment 420 + */ 420 421 rldic r28,r5,25,25 /* (vsid << 25) & 0x7fffffffff */ 421 422 clrldi r5,r5,40 /* vsid & 0xffffff */ 422 423 rldicl r0,r3,64-12,36 /* (ea >> 12) & 0xfffffff */ 423 424 xor r28,r28,r5 424 - or r29,r3,r29 /* VA */ 425 425 xor r28,r28,r0 /* hash */ 426 426 427 427 /* Convert linux PTE bits into HW equivalents */ ··· 506 488 507 489 /* Call ppc_md.hpte_insert */ 508 490 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */ 509 - mr r4,r29 /* Retrieve va */ 491 + mr r4,r29 /* Retrieve vpn */ 510 492 li r7,0 /* !bolted, !secondary */ 511 493 li r8,MMU_PAGE_4K /* page size */ 512 494 ld r9,STK_PARAM(R9)(r1) /* segment size */ ··· 533 515 534 516 /* Call ppc_md.hpte_insert */ 535 517 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */ 536 - mr r4,r29 /* Retrieve va */ 518 + mr r4,r29 /* Retrieve vpn */ 537 519 li r7,HPTE_V_SECONDARY /* !bolted, secondary */ 538 520 li r8,MMU_PAGE_4K /* page size */ 539 521 ld r9,STK_PARAM(R9)(r1) /* segment size */ ··· 565 547 * useless now that the segment has been switched to 4k pages. 566 548 */ 567 549 htab_inval_old_hpte: 568 - mr r3,r29 /* virtual addr */ 550 + mr r3,r29 /* vpn */ 569 551 mr r4,r31 /* PTE.pte */ 570 552 li r5,0 /* PTE.hidx */ 571 553 li r6,MMU_PAGE_64K /* psize */ ··· 638 620 add r3,r0,r3 /* add slot idx */ 639 621 640 622 /* Call ppc_md.hpte_updatepp */ 641 - mr r5,r29 /* va */ 623 + mr r5,r29 /* vpn */ 642 624 li r6,MMU_PAGE_4K /* page size */ 643 625 ld r7,STK_PARAM(R9)(r1) /* segment size */ 644 626 ld r8,STK_PARAM(R8)(r1) /* get "local" param */ ··· 694 676 /* Save non-volatile registers. 695 677 * r31 will hold "old PTE" 696 678 * r30 is "new PTE" 697 - * r29 is "va" 679 + * r29 is vpn 698 680 * r28 is a hash value 699 681 * r27 is hashtab mask (maybe dynamic patched instead ?) 700 682 */ ··· 747 729 cmpdi r9,0 /* check segment size */ 748 730 bne 3f 749 731 END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT) 750 - /* Calc va and put it in r29 */ 751 - rldicr r29,r5,28,63-28 752 - rldicl r3,r3,0,36 753 - or r29,r3,r29 732 + /* Calc vpn and put it in r29 */ 733 + sldi r29,r5,SID_SHIFT - VPN_SHIFT 734 + rldicl r28,r3,64 - VPN_SHIFT,64 - (SID_SHIFT - VPN_SHIFT) 735 + or r29,r28,r29 754 736 755 737 /* Calculate hash value for primary slot and store it in r28 */ 756 738 rldicl r5,r5,0,25 /* vsid & 0x0000007fffffffff */ ··· 758 740 xor r28,r5,r0 759 741 b 4f 760 742 761 - 3: /* Calc VA and hash in r29 and r28 for 1T segment */ 762 - sldi r29,r5,40 /* vsid << 40 */ 763 - clrldi r3,r3,24 /* ea & 0xffffffffff */ 743 + 3: /* Calc vpn and put it in r29 */ 744 + sldi r29,r5,SID_SHIFT_1T - VPN_SHIFT 745 + rldicl r28,r3,64 - VPN_SHIFT,64 - (SID_SHIFT_1T - VPN_SHIFT) 746 + or r29,r28,r29 747 + 748 + /* 749 + * calculate hash value for primary slot and 750 + * store it in r28 for 1T segment 751 + */ 764 752 rldic r28,r5,25,25 /* (vsid << 25) & 0x7fffffffff */ 765 753 clrldi r5,r5,40 /* vsid & 0xffffff */ 766 754 rldicl r0,r3,64-16,40 /* (ea >> 16) & 0xffffff */ 767 755 xor r28,r28,r5 768 - or r29,r3,r29 /* VA */ 769 756 xor r28,r28,r0 /* hash */ 770 757 771 758 /* Convert linux PTE bits into HW equivalents */ ··· 829 806 830 807 /* Call ppc_md.hpte_insert */ 831 808 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */ 832 - mr r4,r29 /* Retrieve va */ 809 + mr r4,r29 /* Retrieve vpn */ 833 810 li r7,0 /* !bolted, !secondary */ 834 811 li r8,MMU_PAGE_64K 835 812 ld r9,STK_PARAM(R9)(r1) /* segment size */ ··· 852 829 853 830 /* Call ppc_md.hpte_insert */ 854 831 ld r6,STK_PARAM(R4)(r1) /* Retrieve new pp bits */ 855 - mr r4,r29 /* Retrieve va */ 832 + mr r4,r29 /* Retrieve vpn */ 856 833 li r7,HPTE_V_SECONDARY /* !bolted, secondary */ 857 834 li r8,MMU_PAGE_64K 858 835 ld r9,STK_PARAM(R9)(r1) /* segment size */ ··· 922 899 add r3,r0,r3 /* add slot idx */ 923 900 924 901 /* Call ppc_md.hpte_updatepp */ 925 - mr r5,r29 /* va */ 902 + mr r5,r29 /* vpn */ 926 903 li r6,MMU_PAGE_64K 927 904 ld r7,STK_PARAM(R9)(r1) /* segment size */ 928 905 ld r8,STK_PARAM(R8)(r1) /* get "local" param */
+104 -98
arch/powerpc/mm/hash_native_64.c
··· 14 14 15 15 #include <linux/spinlock.h> 16 16 #include <linux/bitops.h> 17 + #include <linux/of.h> 17 18 #include <linux/threads.h> 18 19 #include <linux/smp.h> 19 20 20 - #include <asm/abs_addr.h> 21 21 #include <asm/machdep.h> 22 22 #include <asm/mmu.h> 23 23 #include <asm/mmu_context.h> ··· 39 39 40 40 DEFINE_RAW_SPINLOCK(native_tlbie_lock); 41 41 42 - static inline void __tlbie(unsigned long va, int psize, int ssize) 42 + static inline void __tlbie(unsigned long vpn, int psize, int ssize) 43 43 { 44 + unsigned long va; 44 45 unsigned int penc; 45 46 46 - /* clear top 16 bits, non SLS segment */ 47 + /* 48 + * We need 14 to 65 bits of va for a tlibe of 4K page 49 + * With vpn we ignore the lower VPN_SHIFT bits already. 50 + * And top two bits are already ignored because we can 51 + * only accomadate 76 bits in a 64 bit vpn with a VPN_SHIFT 52 + * of 12. 53 + */ 54 + va = vpn << VPN_SHIFT; 55 + /* 56 + * clear top 16 bits of 64bit va, non SLS segment 57 + * Older versions of the architecture (2.02 and earler) require the 58 + * masking of the top 16 bits. 59 + */ 47 60 va &= ~(0xffffULL << 48); 48 61 49 62 switch (psize) { 50 63 case MMU_PAGE_4K: 51 - va &= ~0xffful; 52 64 va |= ssize << 8; 53 65 asm volatile(ASM_FTR_IFCLR("tlbie %0,0", PPC_TLBIE(%1,%0), %2) 54 66 : : "r" (va), "r"(0), "i" (CPU_FTR_ARCH_206) 55 67 : "memory"); 56 68 break; 57 69 default: 70 + /* We need 14 to 14 + i bits of va */ 58 71 penc = mmu_psize_defs[psize].penc; 59 72 va &= ~((1ul << mmu_psize_defs[psize].shift) - 1); 60 73 va |= penc << 12; ··· 80 67 } 81 68 } 82 69 83 - static inline void __tlbiel(unsigned long va, int psize, int ssize) 70 + static inline void __tlbiel(unsigned long vpn, int psize, int ssize) 84 71 { 72 + unsigned long va; 85 73 unsigned int penc; 86 74 87 - /* clear top 16 bits, non SLS segment */ 75 + /* VPN_SHIFT can be atmost 12 */ 76 + va = vpn << VPN_SHIFT; 77 + /* 78 + * clear top 16 bits of 64 bit va, non SLS segment 79 + * Older versions of the architecture (2.02 and earler) require the 80 + * masking of the top 16 bits. 81 + */ 88 82 va &= ~(0xffffULL << 48); 89 83 90 84 switch (psize) { 91 85 case MMU_PAGE_4K: 92 - va &= ~0xffful; 93 86 va |= ssize << 8; 94 87 asm volatile(".long 0x7c000224 | (%0 << 11) | (0 << 21)" 95 88 : : "r"(va) : "memory"); 96 89 break; 97 90 default: 91 + /* We need 14 to 14 + i bits of va */ 98 92 penc = mmu_psize_defs[psize].penc; 99 93 va &= ~((1ul << mmu_psize_defs[psize].shift) - 1); 100 94 va |= penc << 12; ··· 114 94 115 95 } 116 96 117 - static inline void tlbie(unsigned long va, int psize, int ssize, int local) 97 + static inline void tlbie(unsigned long vpn, int psize, int ssize, int local) 118 98 { 119 99 unsigned int use_local = local && mmu_has_feature(MMU_FTR_TLBIEL); 120 100 int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE); ··· 125 105 raw_spin_lock(&native_tlbie_lock); 126 106 asm volatile("ptesync": : :"memory"); 127 107 if (use_local) { 128 - __tlbiel(va, psize, ssize); 108 + __tlbiel(vpn, psize, ssize); 129 109 asm volatile("ptesync": : :"memory"); 130 110 } else { 131 - __tlbie(va, psize, ssize); 111 + __tlbie(vpn, psize, ssize); 132 112 asm volatile("eieio; tlbsync; ptesync": : :"memory"); 133 113 } 134 114 if (lock_tlbie && !use_local) ··· 154 134 clear_bit_unlock(HPTE_LOCK_BIT, word); 155 135 } 156 136 157 - static long native_hpte_insert(unsigned long hpte_group, unsigned long va, 137 + static long native_hpte_insert(unsigned long hpte_group, unsigned long vpn, 158 138 unsigned long pa, unsigned long rflags, 159 139 unsigned long vflags, int psize, int ssize) 160 140 { ··· 163 143 int i; 164 144 165 145 if (!(vflags & HPTE_V_BOLTED)) { 166 - DBG_LOW(" insert(group=%lx, va=%016lx, pa=%016lx," 146 + DBG_LOW(" insert(group=%lx, vpn=%016lx, pa=%016lx," 167 147 " rflags=%lx, vflags=%lx, psize=%d)\n", 168 - hpte_group, va, pa, rflags, vflags, psize); 148 + hpte_group, vpn, pa, rflags, vflags, psize); 169 149 } 170 150 171 151 for (i = 0; i < HPTES_PER_GROUP; i++) { ··· 183 163 if (i == HPTES_PER_GROUP) 184 164 return -1; 185 165 186 - hpte_v = hpte_encode_v(va, psize, ssize) | vflags | HPTE_V_VALID; 166 + hpte_v = hpte_encode_v(vpn, psize, ssize) | vflags | HPTE_V_VALID; 187 167 hpte_r = hpte_encode_r(pa, psize) | rflags; 188 168 189 169 if (!(vflags & HPTE_V_BOLTED)) { ··· 245 225 } 246 226 247 227 static long native_hpte_updatepp(unsigned long slot, unsigned long newpp, 248 - unsigned long va, int psize, int ssize, 228 + unsigned long vpn, int psize, int ssize, 249 229 int local) 250 230 { 251 231 struct hash_pte *hptep = htab_address + slot; 252 232 unsigned long hpte_v, want_v; 253 233 int ret = 0; 254 234 255 - want_v = hpte_encode_v(va, psize, ssize); 235 + want_v = hpte_encode_v(vpn, psize, ssize); 256 236 257 - DBG_LOW(" update(va=%016lx, avpnv=%016lx, hash=%016lx, newpp=%x)", 258 - va, want_v & HPTE_V_AVPN, slot, newpp); 237 + DBG_LOW(" update(vpn=%016lx, avpnv=%016lx, group=%lx, newpp=%lx)", 238 + vpn, want_v & HPTE_V_AVPN, slot, newpp); 259 239 260 240 native_lock_hpte(hptep); 261 241 ··· 274 254 native_unlock_hpte(hptep); 275 255 276 256 /* Ensure it is out of the tlb too. */ 277 - tlbie(va, psize, ssize, local); 257 + tlbie(vpn, psize, ssize, local); 278 258 279 259 return ret; 280 260 } 281 261 282 - static long native_hpte_find(unsigned long va, int psize, int ssize) 262 + static long native_hpte_find(unsigned long vpn, int psize, int ssize) 283 263 { 284 264 struct hash_pte *hptep; 285 265 unsigned long hash; ··· 287 267 long slot; 288 268 unsigned long want_v, hpte_v; 289 269 290 - hash = hpt_hash(va, mmu_psize_defs[psize].shift, ssize); 291 - want_v = hpte_encode_v(va, psize, ssize); 270 + hash = hpt_hash(vpn, mmu_psize_defs[psize].shift, ssize); 271 + want_v = hpte_encode_v(vpn, psize, ssize); 292 272 293 273 /* Bolted mappings are only ever in the primary group */ 294 274 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; ··· 315 295 static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea, 316 296 int psize, int ssize) 317 297 { 318 - unsigned long vsid, va; 298 + unsigned long vpn; 299 + unsigned long vsid; 319 300 long slot; 320 301 struct hash_pte *hptep; 321 302 322 303 vsid = get_kernel_vsid(ea, ssize); 323 - va = hpt_va(ea, vsid, ssize); 304 + vpn = hpt_vpn(ea, vsid, ssize); 324 305 325 - slot = native_hpte_find(va, psize, ssize); 306 + slot = native_hpte_find(vpn, psize, ssize); 326 307 if (slot == -1) 327 308 panic("could not find page to bolt\n"); 328 309 hptep = htab_address + slot; ··· 333 312 (newpp & (HPTE_R_PP | HPTE_R_N)); 334 313 335 314 /* Ensure it is out of the tlb too. */ 336 - tlbie(va, psize, ssize, 0); 315 + tlbie(vpn, psize, ssize, 0); 337 316 } 338 317 339 - static void native_hpte_invalidate(unsigned long slot, unsigned long va, 318 + static void native_hpte_invalidate(unsigned long slot, unsigned long vpn, 340 319 int psize, int ssize, int local) 341 320 { 342 321 struct hash_pte *hptep = htab_address + slot; ··· 346 325 347 326 local_irq_save(flags); 348 327 349 - DBG_LOW(" invalidate(va=%016lx, hash: %x)\n", va, slot); 328 + DBG_LOW(" invalidate(vpn=%016lx, hash: %lx)\n", vpn, slot); 350 329 351 - want_v = hpte_encode_v(va, psize, ssize); 330 + want_v = hpte_encode_v(vpn, psize, ssize); 352 331 native_lock_hpte(hptep); 353 332 hpte_v = hptep->v; 354 333 ··· 360 339 hptep->v = 0; 361 340 362 341 /* Invalidate the TLB */ 363 - tlbie(va, psize, ssize, local); 342 + tlbie(vpn, psize, ssize, local); 364 343 365 344 local_irq_restore(flags); 366 345 } ··· 370 349 #define LP_MASK(i) ((0xFF >> (i)) << LP_SHIFT) 371 350 372 351 static void hpte_decode(struct hash_pte *hpte, unsigned long slot, 373 - int *psize, int *ssize, unsigned long *va) 352 + int *psize, int *ssize, unsigned long *vpn) 374 353 { 354 + unsigned long avpn, pteg, vpi; 375 355 unsigned long hpte_r = hpte->r; 376 356 unsigned long hpte_v = hpte->v; 377 - unsigned long avpn; 357 + unsigned long vsid, seg_off; 378 358 int i, size, shift, penc; 379 359 380 360 if (!(hpte_v & HPTE_V_LARGE)) ··· 402 380 } 403 381 404 382 /* This works for all page sizes, and for 256M and 1T segments */ 405 - shift = mmu_psize_defs[size].shift; 406 - avpn = (HPTE_V_AVPN_VAL(hpte_v) & ~mmu_psize_defs[size].avpnm) << 23; 407 - 408 - if (shift < 23) { 409 - unsigned long vpi, vsid, pteg; 410 - 411 - pteg = slot / HPTES_PER_GROUP; 412 - if (hpte_v & HPTE_V_SECONDARY) 413 - pteg = ~pteg; 414 - switch (hpte_v >> HPTE_V_SSIZE_SHIFT) { 415 - case MMU_SEGSIZE_256M: 416 - vpi = ((avpn >> 28) ^ pteg) & htab_hash_mask; 417 - break; 418 - case MMU_SEGSIZE_1T: 419 - vsid = avpn >> 40; 420 - vpi = (vsid ^ (vsid << 25) ^ pteg) & htab_hash_mask; 421 - break; 422 - default: 423 - avpn = vpi = size = 0; 424 - } 425 - avpn |= (vpi << mmu_psize_defs[size].shift); 426 - } 427 - 428 - *va = avpn; 429 - *psize = size; 430 383 *ssize = hpte_v >> HPTE_V_SSIZE_SHIFT; 384 + shift = mmu_psize_defs[size].shift; 385 + 386 + avpn = (HPTE_V_AVPN_VAL(hpte_v) & ~mmu_psize_defs[size].avpnm); 387 + pteg = slot / HPTES_PER_GROUP; 388 + if (hpte_v & HPTE_V_SECONDARY) 389 + pteg = ~pteg; 390 + 391 + switch (*ssize) { 392 + case MMU_SEGSIZE_256M: 393 + /* We only have 28 - 23 bits of seg_off in avpn */ 394 + seg_off = (avpn & 0x1f) << 23; 395 + vsid = avpn >> 5; 396 + /* We can find more bits from the pteg value */ 397 + if (shift < 23) { 398 + vpi = (vsid ^ pteg) & htab_hash_mask; 399 + seg_off |= vpi << shift; 400 + } 401 + *vpn = vsid << (SID_SHIFT - VPN_SHIFT) | seg_off >> VPN_SHIFT; 402 + case MMU_SEGSIZE_1T: 403 + /* We only have 40 - 23 bits of seg_off in avpn */ 404 + seg_off = (avpn & 0x1ffff) << 23; 405 + vsid = avpn >> 17; 406 + if (shift < 23) { 407 + vpi = (vsid ^ (vsid << 25) ^ pteg) & htab_hash_mask; 408 + seg_off |= vpi << shift; 409 + } 410 + *vpn = vsid << (SID_SHIFT_1T - VPN_SHIFT) | seg_off >> VPN_SHIFT; 411 + default: 412 + *vpn = size = 0; 413 + } 414 + *psize = size; 431 415 } 432 416 433 417 /* ··· 446 418 */ 447 419 static void native_hpte_clear(void) 448 420 { 421 + unsigned long vpn = 0; 449 422 unsigned long slot, slots, flags; 450 423 struct hash_pte *hptep = htab_address; 451 - unsigned long hpte_v, va; 424 + unsigned long hpte_v; 452 425 unsigned long pteg_count; 453 426 int psize, ssize; 454 427 ··· 477 448 * already hold the native_tlbie_lock. 478 449 */ 479 450 if (hpte_v & HPTE_V_VALID) { 480 - hpte_decode(hptep, slot, &psize, &ssize, &va); 451 + hpte_decode(hptep, slot, &psize, &ssize, &vpn); 481 452 hptep->v = 0; 482 - __tlbie(va, psize, ssize); 453 + __tlbie(vpn, psize, ssize); 483 454 } 484 455 } 485 456 ··· 494 465 */ 495 466 static void native_flush_hash_range(unsigned long number, int local) 496 467 { 497 - unsigned long va, hash, index, hidx, shift, slot; 468 + unsigned long vpn; 469 + unsigned long hash, index, hidx, shift, slot; 498 470 struct hash_pte *hptep; 499 471 unsigned long hpte_v; 500 472 unsigned long want_v; ··· 509 479 local_irq_save(flags); 510 480 511 481 for (i = 0; i < number; i++) { 512 - va = batch->vaddr[i]; 482 + vpn = batch->vpn[i]; 513 483 pte = batch->pte[i]; 514 484 515 - pte_iterate_hashed_subpages(pte, psize, va, index, shift) { 516 - hash = hpt_hash(va, shift, ssize); 485 + pte_iterate_hashed_subpages(pte, psize, vpn, index, shift) { 486 + hash = hpt_hash(vpn, shift, ssize); 517 487 hidx = __rpte_to_hidx(pte, index); 518 488 if (hidx & _PTEIDX_SECONDARY) 519 489 hash = ~hash; 520 490 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 521 491 slot += hidx & _PTEIDX_GROUP_IX; 522 492 hptep = htab_address + slot; 523 - want_v = hpte_encode_v(va, psize, ssize); 493 + want_v = hpte_encode_v(vpn, psize, ssize); 524 494 native_lock_hpte(hptep); 525 495 hpte_v = hptep->v; 526 496 if (!HPTE_V_COMPARE(hpte_v, want_v) || ··· 535 505 mmu_psize_defs[psize].tlbiel && local) { 536 506 asm volatile("ptesync":::"memory"); 537 507 for (i = 0; i < number; i++) { 538 - va = batch->vaddr[i]; 508 + vpn = batch->vpn[i]; 539 509 pte = batch->pte[i]; 540 510 541 - pte_iterate_hashed_subpages(pte, psize, va, index, 542 - shift) { 543 - __tlbiel(va, psize, ssize); 511 + pte_iterate_hashed_subpages(pte, psize, 512 + vpn, index, shift) { 513 + __tlbiel(vpn, psize, ssize); 544 514 } pte_iterate_hashed_end(); 545 515 } 546 516 asm volatile("ptesync":::"memory"); ··· 552 522 553 523 asm volatile("ptesync":::"memory"); 554 524 for (i = 0; i < number; i++) { 555 - va = batch->vaddr[i]; 525 + vpn = batch->vpn[i]; 556 526 pte = batch->pte[i]; 557 527 558 - pte_iterate_hashed_subpages(pte, psize, va, index, 559 - shift) { 560 - __tlbie(va, psize, ssize); 528 + pte_iterate_hashed_subpages(pte, psize, 529 + vpn, index, shift) { 530 + __tlbie(vpn, psize, ssize); 561 531 } pte_iterate_hashed_end(); 562 532 } 563 533 asm volatile("eieio; tlbsync; ptesync":::"memory"); ··· 569 539 local_irq_restore(flags); 570 540 } 571 541 572 - #ifdef CONFIG_PPC_PSERIES 573 - /* Disable TLB batching on nighthawk */ 574 - static inline int tlb_batching_enabled(void) 575 - { 576 - struct device_node *root = of_find_node_by_path("/"); 577 - int enabled = 1; 578 - 579 - if (root) { 580 - const char *model = of_get_property(root, "model", NULL); 581 - if (model && !strcmp(model, "IBM,9076-N81")) 582 - enabled = 0; 583 - of_node_put(root); 584 - } 585 - 586 - return enabled; 587 - } 588 - #else 589 - static inline int tlb_batching_enabled(void) 590 - { 591 - return 1; 592 - } 593 - #endif 594 - 595 542 void __init hpte_init_native(void) 596 543 { 597 544 ppc_md.hpte_invalidate = native_hpte_invalidate; ··· 577 570 ppc_md.hpte_insert = native_hpte_insert; 578 571 ppc_md.hpte_remove = native_hpte_remove; 579 572 ppc_md.hpte_clear_all = native_hpte_clear; 580 - if (tlb_batching_enabled()) 581 - ppc_md.flush_hash_range = native_flush_hash_range; 573 + ppc_md.flush_hash_range = native_flush_hash_range; 582 574 }
+25 -23
arch/powerpc/mm/hash_utils_64.c
··· 43 43 #include <asm/uaccess.h> 44 44 #include <asm/machdep.h> 45 45 #include <asm/prom.h> 46 - #include <asm/abs_addr.h> 47 46 #include <asm/tlbflush.h> 48 47 #include <asm/io.h> 49 48 #include <asm/eeh.h> ··· 191 192 vaddr += step, paddr += step) { 192 193 unsigned long hash, hpteg; 193 194 unsigned long vsid = get_kernel_vsid(vaddr, ssize); 194 - unsigned long va = hpt_va(vaddr, vsid, ssize); 195 + unsigned long vpn = hpt_vpn(vaddr, vsid, ssize); 195 196 unsigned long tprot = prot; 196 197 197 198 /* Make kernel text executable */ 198 199 if (overlaps_kernel_text(vaddr, vaddr + step)) 199 200 tprot &= ~HPTE_R_N; 200 201 201 - hash = hpt_hash(va, shift, ssize); 202 + hash = hpt_hash(vpn, shift, ssize); 202 203 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP); 203 204 204 205 BUG_ON(!ppc_md.hpte_insert); 205 - ret = ppc_md.hpte_insert(hpteg, va, paddr, tprot, 206 + ret = ppc_md.hpte_insert(hpteg, vpn, paddr, tprot, 206 207 HPTE_V_BOLTED, psize, ssize); 207 208 208 209 if (ret < 0) ··· 650 651 DBG("Hash table allocated at %lx, size: %lx\n", table, 651 652 htab_size_bytes); 652 653 653 - htab_address = abs_to_virt(table); 654 + htab_address = __va(table); 654 655 655 656 /* htab absolute addr + encoded htabsize */ 656 657 _SDR1 = table + __ilog2(pteg_count) - 11; ··· 803 804 #ifdef CONFIG_PPC_MM_SLICES 804 805 unsigned int get_paca_psize(unsigned long addr) 805 806 { 806 - unsigned long index, slices; 807 + u64 lpsizes; 808 + unsigned char *hpsizes; 809 + unsigned long index, mask_index; 807 810 808 811 if (addr < SLICE_LOW_TOP) { 809 - slices = get_paca()->context.low_slices_psize; 812 + lpsizes = get_paca()->context.low_slices_psize; 810 813 index = GET_LOW_SLICE_INDEX(addr); 811 - } else { 812 - slices = get_paca()->context.high_slices_psize; 813 - index = GET_HIGH_SLICE_INDEX(addr); 814 + return (lpsizes >> (index * 4)) & 0xF; 814 815 } 815 - return (slices >> (index * 4)) & 0xF; 816 + hpsizes = get_paca()->context.high_slices_psize; 817 + index = GET_HIGH_SLICE_INDEX(addr); 818 + mask_index = index & 0x1; 819 + return (hpsizes[index >> 1] >> (mask_index * 4)) & 0xF; 816 820 } 817 821 818 822 #else ··· 1155 1153 /* WARNING: This is called from hash_low_64.S, if you change this prototype, 1156 1154 * do not forget to update the assembly call site ! 1157 1155 */ 1158 - void flush_hash_page(unsigned long va, real_pte_t pte, int psize, int ssize, 1156 + void flush_hash_page(unsigned long vpn, real_pte_t pte, int psize, int ssize, 1159 1157 int local) 1160 1158 { 1161 1159 unsigned long hash, index, shift, hidx, slot; 1162 1160 1163 - DBG_LOW("flush_hash_page(va=%016lx)\n", va); 1164 - pte_iterate_hashed_subpages(pte, psize, va, index, shift) { 1165 - hash = hpt_hash(va, shift, ssize); 1161 + DBG_LOW("flush_hash_page(vpn=%016lx)\n", vpn); 1162 + pte_iterate_hashed_subpages(pte, psize, vpn, index, shift) { 1163 + hash = hpt_hash(vpn, shift, ssize); 1166 1164 hidx = __rpte_to_hidx(pte, index); 1167 1165 if (hidx & _PTEIDX_SECONDARY) 1168 1166 hash = ~hash; 1169 1167 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 1170 1168 slot += hidx & _PTEIDX_GROUP_IX; 1171 1169 DBG_LOW(" sub %ld: hash=%lx, hidx=%lx\n", index, slot, hidx); 1172 - ppc_md.hpte_invalidate(slot, va, psize, ssize, local); 1170 + ppc_md.hpte_invalidate(slot, vpn, psize, ssize, local); 1173 1171 } pte_iterate_hashed_end(); 1174 1172 } 1175 1173 ··· 1183 1181 &__get_cpu_var(ppc64_tlb_batch); 1184 1182 1185 1183 for (i = 0; i < number; i++) 1186 - flush_hash_page(batch->vaddr[i], batch->pte[i], 1184 + flush_hash_page(batch->vpn[i], batch->pte[i], 1187 1185 batch->psize, batch->ssize, local); 1188 1186 } 1189 1187 } ··· 1210 1208 { 1211 1209 unsigned long hash, hpteg; 1212 1210 unsigned long vsid = get_kernel_vsid(vaddr, mmu_kernel_ssize); 1213 - unsigned long va = hpt_va(vaddr, vsid, mmu_kernel_ssize); 1211 + unsigned long vpn = hpt_vpn(vaddr, vsid, mmu_kernel_ssize); 1214 1212 unsigned long mode = htab_convert_pte_flags(PAGE_KERNEL); 1215 1213 int ret; 1216 1214 1217 - hash = hpt_hash(va, PAGE_SHIFT, mmu_kernel_ssize); 1215 + hash = hpt_hash(vpn, PAGE_SHIFT, mmu_kernel_ssize); 1218 1216 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP); 1219 1217 1220 - ret = ppc_md.hpte_insert(hpteg, va, __pa(vaddr), 1218 + ret = ppc_md.hpte_insert(hpteg, vpn, __pa(vaddr), 1221 1219 mode, HPTE_V_BOLTED, 1222 1220 mmu_linear_psize, mmu_kernel_ssize); 1223 1221 BUG_ON (ret < 0); ··· 1231 1229 { 1232 1230 unsigned long hash, hidx, slot; 1233 1231 unsigned long vsid = get_kernel_vsid(vaddr, mmu_kernel_ssize); 1234 - unsigned long va = hpt_va(vaddr, vsid, mmu_kernel_ssize); 1232 + unsigned long vpn = hpt_vpn(vaddr, vsid, mmu_kernel_ssize); 1235 1233 1236 - hash = hpt_hash(va, PAGE_SHIFT, mmu_kernel_ssize); 1234 + hash = hpt_hash(vpn, PAGE_SHIFT, mmu_kernel_ssize); 1237 1235 spin_lock(&linear_map_hash_lock); 1238 1236 BUG_ON(!(linear_map_hash_slots[lmi] & 0x80)); 1239 1237 hidx = linear_map_hash_slots[lmi] & 0x7f; ··· 1243 1241 hash = ~hash; 1244 1242 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 1245 1243 slot += hidx & _PTEIDX_GROUP_IX; 1246 - ppc_md.hpte_invalidate(slot, va, mmu_linear_psize, mmu_kernel_ssize, 0); 1244 + ppc_md.hpte_invalidate(slot, vpn, mmu_linear_psize, mmu_kernel_ssize, 0); 1247 1245 } 1248 1246 1249 1247 void kernel_map_pages(struct page *page, int numpages, int enable)
+8 -7
arch/powerpc/mm/hugetlbpage-hash64.c
··· 18 18 pte_t *ptep, unsigned long trap, int local, int ssize, 19 19 unsigned int shift, unsigned int mmu_psize) 20 20 { 21 + unsigned long vpn; 21 22 unsigned long old_pte, new_pte; 22 - unsigned long va, rflags, pa, sz; 23 + unsigned long rflags, pa, sz; 23 24 long slot; 24 25 25 26 BUG_ON(shift != mmu_psize_defs[mmu_psize].shift); 26 27 27 28 /* Search the Linux page table for a match with va */ 28 - va = hpt_va(ea, vsid, ssize); 29 + vpn = hpt_vpn(ea, vsid, ssize); 29 30 30 31 /* At this point, we have a pte (old_pte) which can be used to build 31 32 * or update an HPTE. There are 2 cases: ··· 70 69 /* There MIGHT be an HPTE for this pte */ 71 70 unsigned long hash, slot; 72 71 73 - hash = hpt_hash(va, shift, ssize); 72 + hash = hpt_hash(vpn, shift, ssize); 74 73 if (old_pte & _PAGE_F_SECOND) 75 74 hash = ~hash; 76 75 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 77 76 slot += (old_pte & _PAGE_F_GIX) >> 12; 78 77 79 - if (ppc_md.hpte_updatepp(slot, rflags, va, mmu_psize, 78 + if (ppc_md.hpte_updatepp(slot, rflags, vpn, mmu_psize, 80 79 ssize, local) == -1) 81 80 old_pte &= ~_PAGE_HPTEFLAGS; 82 81 } 83 82 84 83 if (likely(!(old_pte & _PAGE_HASHPTE))) { 85 - unsigned long hash = hpt_hash(va, shift, ssize); 84 + unsigned long hash = hpt_hash(vpn, shift, ssize); 86 85 unsigned long hpte_group; 87 86 88 87 pa = pte_pfn(__pte(old_pte)) << PAGE_SHIFT; ··· 102 101 _PAGE_COHERENT | _PAGE_GUARDED)); 103 102 104 103 /* Insert into the hash table, primary slot */ 105 - slot = ppc_md.hpte_insert(hpte_group, va, pa, rflags, 0, 104 + slot = ppc_md.hpte_insert(hpte_group, vpn, pa, rflags, 0, 106 105 mmu_psize, ssize); 107 106 108 107 /* Primary is full, try the secondary */ 109 108 if (unlikely(slot == -1)) { 110 109 hpte_group = ((~hash & htab_hash_mask) * 111 110 HPTES_PER_GROUP) & ~0x7UL; 112 - slot = ppc_md.hpte_insert(hpte_group, va, pa, rflags, 111 + slot = ppc_md.hpte_insert(hpte_group, vpn, pa, rflags, 113 112 HPTE_V_SECONDARY, 114 113 mmu_psize, ssize); 115 114 if (slot == -1) {
-1
arch/powerpc/mm/init_64.c
··· 62 62 #include <asm/cputable.h> 63 63 #include <asm/sections.h> 64 64 #include <asm/iommu.h> 65 - #include <asm/abs_addr.h> 66 65 #include <asm/vdso.h> 67 66 68 67 #include "mmu_decl.h"
+2 -3
arch/powerpc/mm/mem.c
··· 62 62 63 63 int init_bootmem_done; 64 64 int mem_init_done; 65 - phys_addr_t memory_limit; 65 + unsigned long long memory_limit; 66 66 67 67 #ifdef CONFIG_HIGHMEM 68 68 pte_t *kmap_pte; ··· 300 300 unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize; 301 301 302 302 #ifdef CONFIG_SWIOTLB 303 - if (ppc_swiotlb_enable) 304 - swiotlb_init(1); 303 + swiotlb_init(0); 305 304 #endif 306 305 307 306 num_physpages = memblock_phys_mem_size() >> PAGE_SHIFT;
+6 -4
arch/powerpc/mm/mmu_context_hash64.c
··· 30 30 static DEFINE_IDA(mmu_context_ida); 31 31 32 32 /* 33 - * The proto-VSID space has 2^35 - 1 segments available for user mappings. 34 - * Each segment contains 2^28 bytes. Each context maps 2^44 bytes, 35 - * so we can support 2^19-1 contexts (19 == 35 + 28 - 44). 33 + * 256MB segment 34 + * The proto-VSID space has 2^(CONTEX_BITS + USER_ESID_BITS) - 1 segments 35 + * available for user mappings. Each segment contains 2^28 bytes. Each 36 + * context maps 2^46 bytes (64TB) so we can support 2^19-1 contexts 37 + * (19 == 37 + 28 - 46). 36 38 */ 37 - #define MAX_CONTEXT ((1UL << 19) - 1) 39 + #define MAX_CONTEXT ((1UL << CONTEXT_BITS) - 1) 38 40 39 41 int __init_new_context(void) 40 42 {
+11 -2
arch/powerpc/mm/pgtable_64.c
··· 51 51 #include <asm/processor.h> 52 52 #include <asm/cputable.h> 53 53 #include <asm/sections.h> 54 - #include <asm/abs_addr.h> 55 54 #include <asm/firmware.h> 56 55 57 56 #include "mmu_decl.h" 58 57 59 - unsigned long ioremap_bot = IOREMAP_BASE; 58 + /* Some sanity checking */ 59 + #if TASK_SIZE_USER64 > PGTABLE_RANGE 60 + #error TASK_SIZE_USER64 exceeds pagetable range 61 + #endif 60 62 63 + #ifdef CONFIG_PPC_STD_MMU_64 64 + #if TASK_SIZE_USER64 > (1UL << (USER_ESID_BITS + SID_SHIFT)) 65 + #error TASK_SIZE_USER64 exceeds user VSID range 66 + #endif 67 + #endif 68 + 69 + unsigned long ioremap_bot = IOREMAP_BASE; 61 70 62 71 #ifdef CONFIG_PPC_MMU_NOHASH 63 72 static void *early_alloc_pgtable(unsigned long size)
+48 -14
arch/powerpc/mm/slb_low.S
··· 56 56 */ 57 57 _GLOBAL(slb_miss_kernel_load_linear) 58 58 li r11,0 59 + li r9,0x1 60 + /* 61 + * for 1T we shift 12 bits more. slb_finish_load_1T will do 62 + * the necessary adjustment 63 + */ 64 + rldimi r10,r9,(CONTEXT_BITS + USER_ESID_BITS),0 59 65 BEGIN_FTR_SECTION 60 66 b slb_finish_load 61 67 END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT) ··· 91 85 _GLOBAL(slb_miss_kernel_load_io) 92 86 li r11,0 93 87 6: 88 + li r9,0x1 89 + /* 90 + * for 1T we shift 12 bits more. slb_finish_load_1T will do 91 + * the necessary adjustment 92 + */ 93 + rldimi r10,r9,(CONTEXT_BITS + USER_ESID_BITS),0 94 94 BEGIN_FTR_SECTION 95 95 b slb_finish_load 96 96 END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT) ··· 120 108 * between 4k and 64k standard page size 121 109 */ 122 110 #ifdef CONFIG_PPC_MM_SLICES 111 + /* r10 have esid */ 123 112 cmpldi r10,16 124 - 125 - /* Get the slice index * 4 in r11 and matching slice size mask in r9 */ 126 - ld r9,PACALOWSLICESPSIZE(r13) 127 - sldi r11,r10,2 113 + /* below SLICE_LOW_TOP */ 128 114 blt 5f 129 - ld r9,PACAHIGHSLICEPSIZE(r13) 130 - srdi r11,r10,(SLICE_HIGH_SHIFT - SLICE_LOW_SHIFT - 2) 131 - andi. r11,r11,0x3c 115 + /* 116 + * Handle hpsizes, 117 + * r9 is get_paca()->context.high_slices_psize[index], r11 is mask_index 118 + */ 119 + srdi r11,r10,(SLICE_HIGH_SHIFT - SLICE_LOW_SHIFT + 1) /* index */ 120 + addi r9,r11,PACAHIGHSLICEPSIZE 121 + lbzx r9,r13,r9 /* r9 is hpsizes[r11] */ 122 + /* r11 = (r10 >> (SLICE_HIGH_SHIFT - SLICE_LOW_SHIFT)) & 0x1 */ 123 + rldicl r11,r10,(64 - (SLICE_HIGH_SHIFT - SLICE_LOW_SHIFT)),63 124 + b 6f 132 125 133 - 5: /* Extract the psize and multiply to get an array offset */ 126 + 5: 127 + /* 128 + * Handle lpsizes 129 + * r9 is get_paca()->context.low_slices_psize, r11 is index 130 + */ 131 + ld r9,PACALOWSLICESPSIZE(r13) 132 + mr r11,r10 133 + 6: 134 + sldi r11,r11,2 /* index * 4 */ 135 + /* Extract the psize and multiply to get an array offset */ 134 136 srd r9,r9,r11 135 137 andi. r9,r9,0xf 136 138 mulli r9,r9,MMUPSIZEDEFSIZE ··· 235 209 */ 236 210 slb_finish_load: 237 211 ASM_VSID_SCRAMBLE(r10,r9,256M) 238 - rldimi r11,r10,SLB_VSID_SHIFT,16 /* combine VSID and flags */ 212 + /* 213 + * bits above VSID_BITS_256M need to be ignored from r10 214 + * also combine VSID and flags 215 + */ 216 + rldimi r11,r10,SLB_VSID_SHIFT,(64 - (SLB_VSID_SHIFT + VSID_BITS_256M)) 239 217 240 218 /* r3 = EA, r11 = VSID data */ 241 219 /* ··· 282 252 bge 1f 283 253 284 254 /* still room in the slb cache */ 285 - sldi r11,r3,1 /* r11 = offset * sizeof(u16) */ 286 - rldicl r10,r10,36,28 /* get low 16 bits of the ESID */ 287 - add r11,r11,r13 /* r11 = (u16 *)paca + offset */ 288 - sth r10,PACASLBCACHE(r11) /* paca->slb_cache[offset] = esid */ 255 + sldi r11,r3,2 /* r11 = offset * sizeof(u32) */ 256 + srdi r10,r10,28 /* get the 36 bits of the ESID */ 257 + add r11,r11,r13 /* r11 = (u32 *)paca + offset */ 258 + stw r10,PACASLBCACHE(r11) /* paca->slb_cache[offset] = esid */ 289 259 addi r3,r3,1 /* offset++ */ 290 260 b 2f 291 261 1: /* offset >= SLB_CACHE_ENTRIES */ ··· 303 273 slb_finish_load_1T: 304 274 srdi r10,r10,40-28 /* get 1T ESID */ 305 275 ASM_VSID_SCRAMBLE(r10,r9,1T) 306 - rldimi r11,r10,SLB_VSID_SHIFT_1T,16 /* combine VSID and flags */ 276 + /* 277 + * bits above VSID_BITS_1T need to be ignored from r10 278 + * also combine VSID and flags 279 + */ 280 + rldimi r11,r10,SLB_VSID_SHIFT_1T,(64 - (SLB_VSID_SHIFT_1T + VSID_BITS_1T)) 307 281 li r10,MMU_SEGSIZE_1T 308 282 rldimi r11,r10,SLB_VSID_SSIZE_SHIFT,0 /* insert segment size */ 309 283
+73 -39
arch/powerpc/mm/slice.c
··· 34 34 #include <asm/mmu.h> 35 35 #include <asm/spu.h> 36 36 37 + /* some sanity checks */ 38 + #if (PGTABLE_RANGE >> 43) > SLICE_MASK_SIZE 39 + #error PGTABLE_RANGE exceeds slice_mask high_slices size 40 + #endif 41 + 37 42 static DEFINE_SPINLOCK(slice_convert_lock); 38 43 39 44 ··· 47 42 48 43 static void slice_print_mask(const char *label, struct slice_mask mask) 49 44 { 50 - char *p, buf[16 + 3 + 16 + 1]; 45 + char *p, buf[16 + 3 + 64 + 1]; 51 46 int i; 52 47 53 48 if (!_slice_debug) ··· 59 54 *(p++) = '-'; 60 55 *(p++) = ' '; 61 56 for (i = 0; i < SLICE_NUM_HIGH; i++) 62 - *(p++) = (mask.high_slices & (1 << i)) ? '1' : '0'; 57 + *(p++) = (mask.high_slices & (1ul << i)) ? '1' : '0'; 63 58 *(p++) = 0; 64 59 65 60 printk(KERN_DEBUG "%s:%s\n", label, buf); ··· 89 84 } 90 85 91 86 if ((start + len) > SLICE_LOW_TOP) 92 - ret.high_slices = (1u << (GET_HIGH_SLICE_INDEX(end) + 1)) 93 - - (1u << GET_HIGH_SLICE_INDEX(start)); 87 + ret.high_slices = (1ul << (GET_HIGH_SLICE_INDEX(end) + 1)) 88 + - (1ul << GET_HIGH_SLICE_INDEX(start)); 94 89 95 90 return ret; 96 91 } ··· 140 135 141 136 for (i = 0; i < SLICE_NUM_HIGH; i++) 142 137 if (!slice_high_has_vma(mm, i)) 143 - ret.high_slices |= 1u << i; 138 + ret.high_slices |= 1ul << i; 144 139 145 140 return ret; 146 141 } 147 142 148 143 static struct slice_mask slice_mask_for_size(struct mm_struct *mm, int psize) 149 144 { 145 + unsigned char *hpsizes; 146 + int index, mask_index; 150 147 struct slice_mask ret = { 0, 0 }; 151 148 unsigned long i; 152 - u64 psizes; 149 + u64 lpsizes; 153 150 154 - psizes = mm->context.low_slices_psize; 151 + lpsizes = mm->context.low_slices_psize; 155 152 for (i = 0; i < SLICE_NUM_LOW; i++) 156 - if (((psizes >> (i * 4)) & 0xf) == psize) 153 + if (((lpsizes >> (i * 4)) & 0xf) == psize) 157 154 ret.low_slices |= 1u << i; 158 155 159 - psizes = mm->context.high_slices_psize; 160 - for (i = 0; i < SLICE_NUM_HIGH; i++) 161 - if (((psizes >> (i * 4)) & 0xf) == psize) 162 - ret.high_slices |= 1u << i; 156 + hpsizes = mm->context.high_slices_psize; 157 + for (i = 0; i < SLICE_NUM_HIGH; i++) { 158 + mask_index = i & 0x1; 159 + index = i >> 1; 160 + if (((hpsizes[index] >> (mask_index * 4)) & 0xf) == psize) 161 + ret.high_slices |= 1ul << i; 162 + } 163 163 164 164 return ret; 165 165 } ··· 193 183 194 184 static void slice_convert(struct mm_struct *mm, struct slice_mask mask, int psize) 195 185 { 186 + int index, mask_index; 196 187 /* Write the new slice psize bits */ 197 - u64 lpsizes, hpsizes; 188 + unsigned char *hpsizes; 189 + u64 lpsizes; 198 190 unsigned long i, flags; 199 191 200 192 slice_dbg("slice_convert(mm=%p, psize=%d)\n", mm, psize); ··· 213 201 lpsizes = (lpsizes & ~(0xful << (i * 4))) | 214 202 (((unsigned long)psize) << (i * 4)); 215 203 216 - hpsizes = mm->context.high_slices_psize; 217 - for (i = 0; i < SLICE_NUM_HIGH; i++) 218 - if (mask.high_slices & (1u << i)) 219 - hpsizes = (hpsizes & ~(0xful << (i * 4))) | 220 - (((unsigned long)psize) << (i * 4)); 221 - 204 + /* Assign the value back */ 222 205 mm->context.low_slices_psize = lpsizes; 223 - mm->context.high_slices_psize = hpsizes; 206 + 207 + hpsizes = mm->context.high_slices_psize; 208 + for (i = 0; i < SLICE_NUM_HIGH; i++) { 209 + mask_index = i & 0x1; 210 + index = i >> 1; 211 + if (mask.high_slices & (1ul << i)) 212 + hpsizes[index] = (hpsizes[index] & 213 + ~(0xf << (mask_index * 4))) | 214 + (((unsigned long)psize) << (mask_index * 4)); 215 + } 224 216 225 217 slice_dbg(" lsps=%lx, hsps=%lx\n", 226 218 mm->context.low_slices_psize, ··· 603 587 604 588 unsigned int get_slice_psize(struct mm_struct *mm, unsigned long addr) 605 589 { 606 - u64 psizes; 607 - int index; 590 + unsigned char *hpsizes; 591 + int index, mask_index; 608 592 609 593 if (addr < SLICE_LOW_TOP) { 610 - psizes = mm->context.low_slices_psize; 594 + u64 lpsizes; 595 + lpsizes = mm->context.low_slices_psize; 611 596 index = GET_LOW_SLICE_INDEX(addr); 612 - } else { 613 - psizes = mm->context.high_slices_psize; 614 - index = GET_HIGH_SLICE_INDEX(addr); 597 + return (lpsizes >> (index * 4)) & 0xf; 615 598 } 616 - 617 - return (psizes >> (index * 4)) & 0xf; 599 + hpsizes = mm->context.high_slices_psize; 600 + index = GET_HIGH_SLICE_INDEX(addr); 601 + mask_index = index & 0x1; 602 + return (hpsizes[index >> 1] >> (mask_index * 4)) & 0xf; 618 603 } 619 604 EXPORT_SYMBOL_GPL(get_slice_psize); 620 605 ··· 635 618 */ 636 619 void slice_set_user_psize(struct mm_struct *mm, unsigned int psize) 637 620 { 638 - unsigned long flags, lpsizes, hpsizes; 621 + int index, mask_index; 622 + unsigned char *hpsizes; 623 + unsigned long flags, lpsizes; 639 624 unsigned int old_psize; 640 625 int i; 641 626 ··· 658 639 if (((lpsizes >> (i * 4)) & 0xf) == old_psize) 659 640 lpsizes = (lpsizes & ~(0xful << (i * 4))) | 660 641 (((unsigned long)psize) << (i * 4)); 642 + /* Assign the value back */ 643 + mm->context.low_slices_psize = lpsizes; 661 644 662 645 hpsizes = mm->context.high_slices_psize; 663 - for (i = 0; i < SLICE_NUM_HIGH; i++) 664 - if (((hpsizes >> (i * 4)) & 0xf) == old_psize) 665 - hpsizes = (hpsizes & ~(0xful << (i * 4))) | 666 - (((unsigned long)psize) << (i * 4)); 646 + for (i = 0; i < SLICE_NUM_HIGH; i++) { 647 + mask_index = i & 0x1; 648 + index = i >> 1; 649 + if (((hpsizes[index] >> (mask_index * 4)) & 0xf) == old_psize) 650 + hpsizes[index] = (hpsizes[index] & 651 + ~(0xf << (mask_index * 4))) | 652 + (((unsigned long)psize) << (mask_index * 4)); 653 + } 667 654 668 - mm->context.low_slices_psize = lpsizes; 669 - mm->context.high_slices_psize = hpsizes; 655 + 656 + 670 657 671 658 slice_dbg(" lsps=%lx, hsps=%lx\n", 672 659 mm->context.low_slices_psize, ··· 685 660 void slice_set_psize(struct mm_struct *mm, unsigned long address, 686 661 unsigned int psize) 687 662 { 663 + unsigned char *hpsizes; 688 664 unsigned long i, flags; 689 - u64 *p; 665 + u64 *lpsizes; 690 666 691 667 spin_lock_irqsave(&slice_convert_lock, flags); 692 668 if (address < SLICE_LOW_TOP) { 693 669 i = GET_LOW_SLICE_INDEX(address); 694 - p = &mm->context.low_slices_psize; 670 + lpsizes = &mm->context.low_slices_psize; 671 + *lpsizes = (*lpsizes & ~(0xful << (i * 4))) | 672 + ((unsigned long) psize << (i * 4)); 695 673 } else { 674 + int index, mask_index; 696 675 i = GET_HIGH_SLICE_INDEX(address); 697 - p = &mm->context.high_slices_psize; 676 + hpsizes = mm->context.high_slices_psize; 677 + mask_index = i & 0x1; 678 + index = i >> 1; 679 + hpsizes[index] = (hpsizes[index] & 680 + ~(0xf << (mask_index * 4))) | 681 + (((unsigned long)psize) << (mask_index * 4)); 698 682 } 699 - *p = (*p & ~(0xful << (i * 4))) | ((unsigned long) psize << (i * 4)); 683 + 700 684 spin_unlock_irqrestore(&slice_convert_lock, flags); 701 685 702 686 #ifdef CONFIG_SPU_BASE
+1 -2
arch/powerpc/mm/stab.c
··· 20 20 #include <asm/paca.h> 21 21 #include <asm/cputable.h> 22 22 #include <asm/prom.h> 23 - #include <asm/abs_addr.h> 24 23 25 24 struct stab_entry { 26 25 unsigned long esid_data; ··· 256 257 memset((void *)newstab, 0, HW_PAGE_SIZE); 257 258 258 259 paca[cpu].stab_addr = newstab; 259 - paca[cpu].stab_real = virt_to_abs(newstab); 260 + paca[cpu].stab_real = __pa(newstab); 260 261 printk(KERN_INFO "Segment table for CPU %d at 0x%llx " 261 262 "virtual, 0x%llx absolute\n", 262 263 cpu, paca[cpu].stab_addr, paca[cpu].stab_real);
+4 -2
arch/powerpc/mm/subpage-prot.c
··· 95 95 struct mm_struct *mm = current->mm; 96 96 struct subpage_prot_table *spt = &mm->context.spt; 97 97 u32 **spm, *spp; 98 - int i, nw; 98 + unsigned long i; 99 + size_t nw; 99 100 unsigned long next, limit; 100 101 101 102 down_write(&mm->mmap_sem); ··· 145 144 struct mm_struct *mm = current->mm; 146 145 struct subpage_prot_table *spt = &mm->context.spt; 147 146 u32 **spm, *spp; 148 - int i, nw; 147 + unsigned long i; 148 + size_t nw; 149 149 unsigned long next, limit; 150 150 int err; 151 151
+6 -5
arch/powerpc/mm/tlb_hash64.c
··· 42 42 void hpte_need_flush(struct mm_struct *mm, unsigned long addr, 43 43 pte_t *ptep, unsigned long pte, int huge) 44 44 { 45 + unsigned long vpn; 45 46 struct ppc64_tlb_batch *batch = &get_cpu_var(ppc64_tlb_batch); 46 - unsigned long vsid, vaddr; 47 + unsigned long vsid; 47 48 unsigned int psize; 48 49 int ssize; 49 50 real_pte_t rpte; ··· 87 86 vsid = get_kernel_vsid(addr, mmu_kernel_ssize); 88 87 ssize = mmu_kernel_ssize; 89 88 } 90 - vaddr = hpt_va(addr, vsid, ssize); 89 + vpn = hpt_vpn(addr, vsid, ssize); 91 90 rpte = __real_pte(__pte(pte), ptep); 92 91 93 92 /* ··· 97 96 * and decide to use local invalidates instead... 98 97 */ 99 98 if (!batch->active) { 100 - flush_hash_page(vaddr, rpte, psize, ssize, 0); 99 + flush_hash_page(vpn, rpte, psize, ssize, 0); 101 100 put_cpu_var(ppc64_tlb_batch); 102 101 return; 103 102 } ··· 123 122 batch->ssize = ssize; 124 123 } 125 124 batch->pte[i] = rpte; 126 - batch->vaddr[i] = vaddr; 125 + batch->vpn[i] = vpn; 127 126 batch->index = ++i; 128 127 if (i >= PPC64_TLB_BATCH_NR) 129 128 __flush_tlb_pending(batch); ··· 147 146 if (cpumask_equal(mm_cpumask(batch->mm), tmp)) 148 147 local = 1; 149 148 if (i == 1) 150 - flush_hash_page(batch->vaddr[0], batch->pte[0], 149 + flush_hash_page(batch->vpn[0], batch->pte[0], 151 150 batch->psize, batch->ssize, local); 152 151 else 153 152 flush_hash_range(i, local);
+13 -5
arch/powerpc/mm/tlb_low_64e.S
··· 20 20 #include <asm/pgtable.h> 21 21 #include <asm/exception-64e.h> 22 22 #include <asm/ppc-opcode.h> 23 + #include <asm/kvm_asm.h> 24 + #include <asm/kvm_booke_hv_asm.h> 23 25 24 26 #ifdef CONFIG_PPC_64K_PAGES 25 27 #define VPTE_PMD_SHIFT (PTE_INDEX_SIZE+1) ··· 39 37 * * 40 38 **********************************************************************/ 41 39 42 - .macro tlb_prolog_bolted addr 43 - mtspr SPRN_SPRG_TLB_SCRATCH,r13 40 + .macro tlb_prolog_bolted intnum addr 41 + mtspr SPRN_SPRG_GEN_SCRATCH,r13 44 42 mfspr r13,SPRN_SPRG_PACA 45 43 std r10,PACA_EXTLB+EX_TLB_R10(r13) 46 44 mfcr r10 47 45 std r11,PACA_EXTLB+EX_TLB_R11(r13) 46 + #ifdef CONFIG_KVM_BOOKE_HV 47 + BEGIN_FTR_SECTION 48 + mfspr r11, SPRN_SRR1 49 + END_FTR_SECTION_IFSET(CPU_FTR_EMB_HV) 50 + #endif 51 + DO_KVM \intnum, SPRN_SRR1 48 52 std r16,PACA_EXTLB+EX_TLB_R16(r13) 49 53 mfspr r16,\addr /* get faulting address */ 50 54 std r14,PACA_EXTLB+EX_TLB_R14(r13) ··· 69 61 ld r15,PACA_EXTLB+EX_TLB_R15(r13) 70 62 TLB_MISS_RESTORE_STATS_BOLTED 71 63 ld r16,PACA_EXTLB+EX_TLB_R16(r13) 72 - mfspr r13,SPRN_SPRG_TLB_SCRATCH 64 + mfspr r13,SPRN_SPRG_GEN_SCRATCH 73 65 .endm 74 66 75 67 /* Data TLB miss */ 76 68 START_EXCEPTION(data_tlb_miss_bolted) 77 - tlb_prolog_bolted SPRN_DEAR 69 + tlb_prolog_bolted BOOKE_INTERRUPT_DTLB_MISS SPRN_DEAR 78 70 79 71 /* We need _PAGE_PRESENT and _PAGE_ACCESSED set */ 80 72 ··· 222 214 223 215 /* Instruction TLB miss */ 224 216 START_EXCEPTION(instruction_tlb_miss_bolted) 225 - tlb_prolog_bolted SPRN_SRR0 217 + tlb_prolog_bolted BOOKE_INTERRUPT_ITLB_MISS SPRN_SRR0 226 218 227 219 rldicl. r10,r16,64-PGTABLE_EADDR_SIZE,PGTABLE_EADDR_SIZE+4 228 220 srdi r15,r16,60 /* get region */
+107 -9
arch/powerpc/oprofile/op_model_power4.c
··· 21 21 #include <asm/reg.h> 22 22 23 23 #define dbg(args...) 24 + #define OPROFILE_PM_PMCSEL_MSK 0xffULL 25 + #define OPROFILE_PM_UNIT_SHIFT 60 26 + #define OPROFILE_PM_UNIT_MSK 0xfULL 27 + #define OPROFILE_MAX_PMC_NUM 3 28 + #define OPROFILE_PMSEL_FIELD_WIDTH 8 29 + #define OPROFILE_UNIT_FIELD_WIDTH 4 30 + #define MMCRA_SIAR_VALID_MASK 0x10000000ULL 24 31 25 32 static unsigned long reset_value[OP_MAX_COUNTER]; 26 33 ··· 38 31 static u32 mmcr0_val; 39 32 static u64 mmcr1_val; 40 33 static u64 mmcra_val; 34 + static u32 cntr_marked_events; 35 + 36 + static int power7_marked_instr_event(u64 mmcr1) 37 + { 38 + u64 psel, unit; 39 + int pmc, cntr_marked_events = 0; 40 + 41 + /* Given the MMCR1 value, look at the field for each counter to 42 + * determine if it is a marked event. Code based on the function 43 + * power7_marked_instr_event() in file arch/powerpc/perf/power7-pmu.c. 44 + */ 45 + for (pmc = 0; pmc < 4; pmc++) { 46 + psel = mmcr1 & (OPROFILE_PM_PMCSEL_MSK 47 + << (OPROFILE_MAX_PMC_NUM - pmc) 48 + * OPROFILE_MAX_PMC_NUM); 49 + psel = (psel >> ((OPROFILE_MAX_PMC_NUM - pmc) 50 + * OPROFILE_PMSEL_FIELD_WIDTH)) & ~1ULL; 51 + unit = mmcr1 & (OPROFILE_PM_UNIT_MSK 52 + << (OPROFILE_PM_UNIT_SHIFT 53 + - (pmc * OPROFILE_PMSEL_FIELD_WIDTH ))); 54 + unit = unit >> (OPROFILE_PM_UNIT_SHIFT 55 + - (pmc * OPROFILE_PMSEL_FIELD_WIDTH)); 56 + 57 + switch (psel >> 4) { 58 + case 2: 59 + cntr_marked_events |= (pmc == 1 || pmc == 3) << pmc; 60 + break; 61 + case 3: 62 + if (psel == 0x3c) { 63 + cntr_marked_events |= (pmc == 0) << pmc; 64 + break; 65 + } 66 + 67 + if (psel == 0x3e) { 68 + cntr_marked_events |= (pmc != 1) << pmc; 69 + break; 70 + } 71 + 72 + cntr_marked_events |= 1 << pmc; 73 + break; 74 + case 4: 75 + case 5: 76 + cntr_marked_events |= (unit == 0xd) << pmc; 77 + break; 78 + case 6: 79 + if (psel == 0x64) 80 + cntr_marked_events |= (pmc >= 2) << pmc; 81 + break; 82 + case 8: 83 + cntr_marked_events |= (unit == 0xd) << pmc; 84 + break; 85 + } 86 + } 87 + return cntr_marked_events; 88 + } 41 89 42 90 static int power4_reg_setup(struct op_counter_config *ctr, 43 91 struct op_system_config *sys, ··· 109 47 mmcr1_val = sys->mmcr1; 110 48 mmcra_val = sys->mmcra; 111 49 50 + /* Power 7+ and newer architectures: 51 + * Determine which counter events in the group (the group of events is 52 + * specified by the bit settings in the MMCR1 register) are marked 53 + * events for use in the interrupt handler. Do the calculation once 54 + * before OProfile starts. Information is used in the interrupt 55 + * handler. Starting with Power 7+ we only record the sample for 56 + * marked events if the SIAR valid bit is set. For non marked events 57 + * the sample is always recorded. 58 + */ 59 + if (pvr_version_is(PVR_POWER7p)) 60 + cntr_marked_events = power7_marked_instr_event(mmcr1_val); 61 + else 62 + cntr_marked_events = 0; /* For older processors, set the bit map 63 + * to zero so the sample will always be 64 + * be recorded. 65 + */ 66 + 112 67 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i) 113 68 reset_value[i] = 0x80000000UL - ctr[i].count; 114 69 ··· 140 61 else 141 62 mmcr0_val |= MMCR0_PROBLEM_DISABLE; 142 63 143 - if (__is_processor(PV_POWER4) || __is_processor(PV_POWER4p) || 144 - __is_processor(PV_970) || __is_processor(PV_970FX) || 145 - __is_processor(PV_970MP) || __is_processor(PV_970GX) || 146 - __is_processor(PV_POWER5) || __is_processor(PV_POWER5p)) 64 + if (pvr_version_is(PVR_POWER4) || pvr_version_is(PVR_POWER4p) || 65 + pvr_version_is(PVR_970) || pvr_version_is(PVR_970FX) || 66 + pvr_version_is(PVR_970MP) || pvr_version_is(PVR_970GX) || 67 + pvr_version_is(PVR_POWER5) || pvr_version_is(PVR_POWER5p)) 147 68 use_slot_nums = 1; 148 69 149 70 return 0; ··· 163 84 */ 164 85 static inline int mmcra_must_set_sample(void) 165 86 { 166 - if (__is_processor(PV_POWER4) || __is_processor(PV_POWER4p) || 167 - __is_processor(PV_970) || __is_processor(PV_970FX) || 168 - __is_processor(PV_970MP) || __is_processor(PV_970GX)) 87 + if (pvr_version_is(PVR_POWER4) || pvr_version_is(PVR_POWER4p) || 88 + pvr_version_is(PVR_970) || pvr_version_is(PVR_970FX) || 89 + pvr_version_is(PVR_970MP) || pvr_version_is(PVR_970GX)) 169 90 return 1; 170 91 171 92 return 0; ··· 355 276 * PMCs because a user might set a period of less than 256 and we 356 277 * don't want to mistakenly reset them. 357 278 */ 358 - if (__is_processor(PV_POWER7) && ((0x80000000 - val) <= 256)) 279 + if (pvr_version_is(PVR_POWER7) && ((0x80000000 - val) <= 256)) 359 280 return true; 360 281 361 282 return false; ··· 370 291 int i; 371 292 unsigned int mmcr0; 372 293 unsigned long mmcra; 294 + bool siar_valid = false; 373 295 374 296 mmcra = mfspr(SPRN_MMCRA); 375 297 ··· 380 300 /* set the PMM bit (see comment below) */ 381 301 mtmsrd(mfmsr() | MSR_PMM); 382 302 303 + /* Check that the SIAR valid bit in MMCRA is set to 1. */ 304 + if ((mmcra & MMCRA_SIAR_VALID_MASK) == MMCRA_SIAR_VALID_MASK) 305 + siar_valid = true; 306 + 383 307 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i) { 384 308 val = classic_ctr_read(i); 385 309 if (pmc_overflow(val)) { 386 310 if (oprofile_running && ctr[i].enabled) { 387 - oprofile_add_ext_sample(pc, regs, i, is_kernel); 311 + /* Power 7+ and newer architectures: 312 + * If the event is a marked event, then only 313 + * save the sample if the SIAR valid bit is 314 + * set. If the event is not marked, then 315 + * always save the sample. 316 + * Note, the Sample enable bit in the MMCRA 317 + * register must be set to 1 if the group 318 + * contains a marked event. 319 + */ 320 + if ((siar_valid && 321 + (cntr_marked_events & (1 << i))) 322 + || !(cntr_marked_events & (1 << i))) 323 + oprofile_add_ext_sample(pc, regs, i, 324 + is_kernel); 325 + 388 326 classic_ctr_write(i, reset_value[i]); 389 327 } else { 390 328 classic_ctr_write(i, 0);
+39 -7
arch/powerpc/perf/core-book3s.c
··· 82 82 return 0; 83 83 } 84 84 85 + static inline int siar_valid(struct pt_regs *regs) 86 + { 87 + return 1; 88 + } 89 + 85 90 #endif /* CONFIG_PPC32 */ 86 91 87 92 /* ··· 111 106 * If we're not doing instruction sampling, give them the SDAR 112 107 * (sampled data address). If we are doing instruction sampling, then 113 108 * only give them the SDAR if it corresponds to the instruction 114 - * pointed to by SIAR; this is indicated by the [POWER6_]MMCRA_SDSYNC 115 - * bit in MMCRA. 109 + * pointed to by SIAR; this is indicated by the [POWER6_]MMCRA_SDSYNC or 110 + * the [POWER7P_]MMCRA_SDAR_VALID bit in MMCRA. 116 111 */ 117 112 static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp) 118 113 { 119 114 unsigned long mmcra = regs->dsisr; 120 - unsigned long sdsync = (ppmu->flags & PPMU_ALT_SIPR) ? 121 - POWER6_MMCRA_SDSYNC : MMCRA_SDSYNC; 115 + unsigned long sdsync; 116 + 117 + if (ppmu->flags & PPMU_SIAR_VALID) 118 + sdsync = POWER7P_MMCRA_SDAR_VALID; 119 + else if (ppmu->flags & PPMU_ALT_SIPR) 120 + sdsync = POWER6_MMCRA_SDSYNC; 121 + else 122 + sdsync = MMCRA_SDSYNC; 122 123 123 124 if (!(mmcra & MMCRA_SAMPLE_ENABLE) || (mmcra & sdsync)) 124 125 *addrp = mfspr(SPRN_SDAR); ··· 239 228 static inline int perf_intr_is_nmi(struct pt_regs *regs) 240 229 { 241 230 return !regs->softe; 231 + } 232 + 233 + /* 234 + * On processors like P7+ that have the SIAR-Valid bit, marked instructions 235 + * must be sampled only if the SIAR-valid bit is set. 236 + * 237 + * For unmarked instructions and for processors that don't have the SIAR-Valid 238 + * bit, assume that SIAR is valid. 239 + */ 240 + static inline int siar_valid(struct pt_regs *regs) 241 + { 242 + unsigned long mmcra = regs->dsisr; 243 + int marked = mmcra & MMCRA_SAMPLE_ENABLE; 244 + 245 + if ((ppmu->flags & PPMU_SIAR_VALID) && marked) 246 + return mmcra & POWER7P_MMCRA_SIAR_VALID; 247 + 248 + return 1; 242 249 } 243 250 244 251 #endif /* CONFIG_PPC64 */ ··· 1320 1291 .event_idx = power_pmu_event_idx, 1321 1292 }; 1322 1293 1294 + 1323 1295 /* 1324 1296 * A counter has overflowed; update its count and record 1325 1297 * things if requested. Note that interrupts are hard-disabled ··· 1354 1324 left += period; 1355 1325 if (left <= 0) 1356 1326 left = period; 1357 - record = 1; 1327 + record = siar_valid(regs); 1358 1328 event->hw.last_period = event->hw.sample_period; 1359 1329 } 1360 1330 if (left < 0x80000000LL) ··· 1404 1374 { 1405 1375 unsigned long use_siar = regs->result; 1406 1376 1407 - if (use_siar) 1377 + if (use_siar && siar_valid(regs)) 1408 1378 return mfspr(SPRN_SIAR) + perf_ip_adjust(regs); 1379 + else if (use_siar) 1380 + return 0; // no valid instruction pointer 1409 1381 else 1410 1382 return regs->nip; 1411 1383 } ··· 1428 1396 * PMCs because a user might set a period of less than 256 and we 1429 1397 * don't want to mistakenly reset them. 1430 1398 */ 1431 - if (__is_processor(PV_POWER7) && ((0x80000000 - val) <= 256)) 1399 + if (pvr_version_is(PVR_POWER7) && ((0x80000000 - val) <= 256)) 1432 1400 return true; 1433 1401 1434 1402 return false;
+3
arch/powerpc/perf/power7-pmu.c
··· 373 373 strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power7")) 374 374 return -ENODEV; 375 375 376 + if (pvr_version_is(PVR_POWER7p)) 377 + power7_pmu.flags |= PPMU_SIAR_VALID; 378 + 376 379 return register_power_pmu(&power7_pmu); 377 380 } 378 381
+2 -8
arch/powerpc/platforms/44x/currituck.c
··· 21 21 */ 22 22 23 23 #include <linux/init.h> 24 - #include <linux/memblock.h> 25 24 #include <linux/of.h> 26 25 #include <linux/of_platform.h> 27 26 #include <linux/rtc.h> ··· 158 159 159 160 /* No need to check the DMA config as we /know/ our windows are all of 160 161 * RAM. Lets hope that doesn't change */ 161 - #ifdef CONFIG_SWIOTLB 162 - if ((memblock_end_of_DRAM() - 1) > 0xffffffff) { 163 - ppc_swiotlb_enable = 1; 164 - set_pci_dma_ops(&swiotlb_dma_ops); 165 - ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 166 - } 167 - #endif 162 + swiotlb_detect_4g(); 163 + 168 164 ppc47x_smp_init(); 169 165 } 170 166
+1
arch/powerpc/platforms/512x/Kconfig
··· 2 2 bool "512x-based boards" 3 3 depends on 6xx 4 4 select FSL_SOC 5 + select FB_FSL_DIU 5 6 select IPIC 6 7 select PPC_CLOCK 7 8 select PPC_PCI_CHOICE
+4 -2
arch/powerpc/platforms/512x/clock.c
··· 54 54 static struct clk *mpc5121_clk_get(struct device *dev, const char *id) 55 55 { 56 56 struct clk *p, *clk = ERR_PTR(-ENOENT); 57 - int dev_match = 0; 58 - int id_match = 0; 57 + int dev_match; 58 + int id_match; 59 59 60 60 if (dev == NULL || id == NULL) 61 61 return clk; 62 62 63 63 mutex_lock(&clocks_mutex); 64 64 list_for_each_entry(p, &clocks, node) { 65 + dev_match = id_match = 0; 66 + 65 67 if (dev == p->dev) 66 68 dev_match++; 67 69 if (strcmp(id, p->name) == 0)
-6
arch/powerpc/platforms/512x/mpc512x_shared.c
··· 191 191 192 192 static struct fsl_diu_shared_fb __attribute__ ((__aligned__(8))) diu_shared_fb; 193 193 194 - #if defined(CONFIG_FB_FSL_DIU) || \ 195 - defined(CONFIG_FB_FSL_DIU_MODULE) 196 194 static inline void mpc512x_free_bootmem(struct page *page) 197 195 { 198 196 __ClearPageReserved(page); ··· 218 220 } 219 221 diu_ops.release_bootmem = NULL; 220 222 } 221 - #endif 222 223 223 224 /* 224 225 * Check if DIU was pre-initialized. If so, perform steps ··· 320 323 } 321 324 } 322 325 323 - #if defined(CONFIG_FB_FSL_DIU) || \ 324 - defined(CONFIG_FB_FSL_DIU_MODULE) 325 326 diu_ops.get_pixel_format = mpc512x_get_pixel_format; 326 327 diu_ops.set_gamma_table = mpc512x_set_gamma_table; 327 328 diu_ops.set_monitor_port = mpc512x_set_monitor_port; 328 329 diu_ops.set_pixel_clock = mpc512x_set_pixel_clock; 329 330 diu_ops.valid_monitor_port = mpc512x_valid_monitor_port; 330 331 diu_ops.release_bootmem = mpc512x_release_bootmem; 331 - #endif 332 332 } 333 333 334 334 void __init mpc512x_init_IRQ(void)
+1
arch/powerpc/platforms/52xx/mpc5200_simple.c
··· 52 52 static const char *board[] __initdata = { 53 53 "anonymous,a4m072", 54 54 "anon,charon", 55 + "ifm,o2d", 55 56 "intercontrol,digsy-mtc", 56 57 "manroland,mucmc52", 57 58 "manroland,uc101",
+34 -1
arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
··· 170 170 out_be32(lpbfifo.regs + LPBFIFO_REG_CONTROL, bit_fields); 171 171 172 172 /* Kick it off */ 173 - out_8(lpbfifo.regs + LPBFIFO_REG_PACKET_SIZE, 0x01); 173 + if (!lpbfifo.req->defer_xfer_start) 174 + out_8(lpbfifo.regs + LPBFIFO_REG_PACKET_SIZE, 0x01); 174 175 if (dma) 175 176 bcom_enable(lpbfifo.bcom_cur_task); 176 177 } ··· 421 420 return 0; 422 421 } 423 422 EXPORT_SYMBOL(mpc52xx_lpbfifo_submit); 423 + 424 + int mpc52xx_lpbfifo_start_xfer(struct mpc52xx_lpbfifo_request *req) 425 + { 426 + unsigned long flags; 427 + 428 + if (!lpbfifo.regs) 429 + return -ENODEV; 430 + 431 + spin_lock_irqsave(&lpbfifo.lock, flags); 432 + 433 + /* 434 + * If the req pointer is already set and a transfer was 435 + * started on submit, then this transfer is in progress 436 + */ 437 + if (lpbfifo.req && !lpbfifo.req->defer_xfer_start) { 438 + spin_unlock_irqrestore(&lpbfifo.lock, flags); 439 + return -EBUSY; 440 + } 441 + 442 + /* 443 + * If the req was previously submitted but not 444 + * started, start it now 445 + */ 446 + if (lpbfifo.req && lpbfifo.req == req && 447 + lpbfifo.req->defer_xfer_start) { 448 + out_8(lpbfifo.regs + LPBFIFO_REG_PACKET_SIZE, 0x01); 449 + } 450 + 451 + spin_unlock_irqrestore(&lpbfifo.lock, flags); 452 + return 0; 453 + } 454 + EXPORT_SYMBOL(mpc52xx_lpbfifo_start_xfer); 424 455 425 456 void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req) 426 457 {
+21
arch/powerpc/platforms/85xx/Kconfig
··· 104 104 help 105 105 This option enables support for the Freescale P1022DS reference board. 106 106 107 + config P1022_RDK 108 + bool "Freescale / iVeia P1022 RDK" 109 + select DEFAULT_UIMAGE 110 + help 111 + This option enables support for the Freescale / iVeia P1022RDK 112 + reference board. 113 + 107 114 config P1023_RDS 108 115 bool "Freescale P1023 RDS" 109 116 select DEFAULT_UIMAGE ··· 260 253 select PPC_EPAPR_HV_PIC 261 254 help 262 255 This option enables support for the P5020 DS board 256 + 257 + config P5040_DS 258 + bool "Freescale P5040 DS" 259 + select DEFAULT_UIMAGE 260 + select E500 261 + select PPC_E500MC 262 + select PHYS_64BIT 263 + select SWIOTLB 264 + select ARCH_REQUIRE_GPIOLIB 265 + select GPIO_MPC8XXX 266 + select HAS_RAPIDIO 267 + select PPC_EPAPR_HV_PIC 268 + help 269 + This option enables support for the P5040 DS board 263 270 264 271 config PPC_QEMU_E500 265 272 bool "QEMU generic e500 platform"
+2
arch/powerpc/platforms/85xx/Makefile
··· 15 15 obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o 16 16 obj-$(CONFIG_P1010_RDB) += p1010rdb.o 17 17 obj-$(CONFIG_P1022_DS) += p1022_ds.o 18 + obj-$(CONFIG_P1022_RDK) += p1022_rdk.o 18 19 obj-$(CONFIG_P1023_RDS) += p1023_rds.o 19 20 obj-$(CONFIG_P2041_RDB) += p2041_rdb.o corenet_ds.o 20 21 obj-$(CONFIG_P3041_DS) += p3041_ds.o corenet_ds.o 21 22 obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o 22 23 obj-$(CONFIG_P5020_DS) += p5020_ds.o corenet_ds.o 24 + obj-$(CONFIG_P5040_DS) += p5040_ds.o corenet_ds.o 23 25 obj-$(CONFIG_STX_GP3) += stx_gp3.o 24 26 obj-$(CONFIG_TQM85xx) += tqm85xx.o 25 27 obj-$(CONFIG_SBC8548) += sbc8548.o
+10
arch/powerpc/platforms/85xx/common.c
··· 27 27 { .compatible = "fsl,mpc8548-guts", }, 28 28 /* Probably unnecessary? */ 29 29 { .compatible = "gpio-leds", }, 30 + /* For all PCI controllers */ 31 + { .compatible = "fsl,mpc8540-pci", }, 32 + { .compatible = "fsl,mpc8548-pcie", }, 33 + { .compatible = "fsl,p1022-pcie", }, 34 + { .compatible = "fsl,p1010-pcie", }, 35 + { .compatible = "fsl,p1023-pcie", }, 36 + { .compatible = "fsl,p4080-pcie", }, 37 + { .compatible = "fsl,qoriq-pcie-v2.4", }, 38 + { .compatible = "fsl,qoriq-pcie-v2.3", }, 39 + { .compatible = "fsl,qoriq-pcie-v2.2", }, 30 40 {}, 31 41 }; 32 42
+11 -27
arch/powerpc/platforms/85xx/corenet_ds.c
··· 16 16 #include <linux/kdev_t.h> 17 17 #include <linux/delay.h> 18 18 #include <linux/interrupt.h> 19 - #include <linux/memblock.h> 20 19 21 20 #include <asm/time.h> 22 21 #include <asm/machdep.h> ··· 51 52 */ 52 53 void __init corenet_ds_setup_arch(void) 53 54 { 54 - #ifdef CONFIG_PCI 55 - struct device_node *np; 56 - struct pci_controller *hose; 57 - #endif 58 - dma_addr_t max = 0xffffffff; 59 - 60 55 mpc85xx_smp_init(); 61 56 62 - #ifdef CONFIG_PCI 63 - for_each_node_by_type(np, "pci") { 64 - if (of_device_is_compatible(np, "fsl,p4080-pcie") || 65 - of_device_is_compatible(np, "fsl,qoriq-pcie-v2.2")) { 66 - fsl_add_bridge(np, 0); 67 - hose = pci_find_hose_for_OF_device(np); 68 - max = min(max, hose->dma_window_base_cur + 69 - hose->dma_window_size); 70 - } 71 - } 72 - 73 - #ifdef CONFIG_PPC64 57 + #if defined(CONFIG_PCI) && defined(CONFIG_PPC64) 74 58 pci_devs_phb_init(); 75 59 #endif 76 - #endif 77 60 78 - #ifdef CONFIG_SWIOTLB 79 - if ((memblock_end_of_DRAM() - 1) > max) { 80 - ppc_swiotlb_enable = 1; 81 - set_pci_dma_ops(&swiotlb_dma_ops); 82 - ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 83 - } 84 - #endif 61 + fsl_pci_assign_primary(); 62 + 63 + swiotlb_detect_4g(); 64 + 85 65 pr_info("%s board from Freescale Semiconductor\n", ppc_md.name); 86 66 } 87 67 ··· 76 98 }, 77 99 { 78 100 .compatible = "fsl,qoriq-pcie-v2.2", 101 + }, 102 + { 103 + .compatible = "fsl,qoriq-pcie-v2.3", 104 + }, 105 + { 106 + .compatible = "fsl,qoriq-pcie-v2.4", 79 107 }, 80 108 /* The following two are for the Freescale hypervisor */ 81 109 {
+21 -43
arch/powerpc/platforms/85xx/ge_imp3a.c
··· 22 22 #include <linux/seq_file.h> 23 23 #include <linux/interrupt.h> 24 24 #include <linux/of_platform.h> 25 - #include <linux/memblock.h> 26 25 27 26 #include <asm/time.h> 28 27 #include <asm/machdep.h> ··· 83 84 of_node_put(cascade_node); 84 85 } 85 86 87 + static void ge_imp3a_pci_assign_primary(void) 88 + { 86 89 #ifdef CONFIG_PCI 87 - static int primary_phb_addr; 88 - #endif /* CONFIG_PCI */ 90 + struct device_node *np; 91 + struct resource rsrc; 92 + 93 + for_each_node_by_type(np, "pci") { 94 + if (of_device_is_compatible(np, "fsl,mpc8540-pci") || 95 + of_device_is_compatible(np, "fsl,mpc8548-pcie") || 96 + of_device_is_compatible(np, "fsl,p2020-pcie")) { 97 + of_address_to_resource(np, 0, &rsrc); 98 + if ((rsrc.start & 0xfffff) == 0x9000) 99 + fsl_pci_primary = np; 100 + } 101 + } 102 + #endif 103 + } 89 104 90 105 /* 91 106 * Setup the architecture ··· 107 94 static void __init ge_imp3a_setup_arch(void) 108 95 { 109 96 struct device_node *regs; 110 - #ifdef CONFIG_PCI 111 - struct device_node *np; 112 - struct pci_controller *hose; 113 - #endif 114 - dma_addr_t max = 0xffffffff; 115 97 116 98 if (ppc_md.progress) 117 99 ppc_md.progress("ge_imp3a_setup_arch()", 0); 118 100 119 - #ifdef CONFIG_PCI 120 - for_each_node_by_type(np, "pci") { 121 - if (of_device_is_compatible(np, "fsl,mpc8540-pci") || 122 - of_device_is_compatible(np, "fsl,mpc8548-pcie") || 123 - of_device_is_compatible(np, "fsl,p2020-pcie")) { 124 - struct resource rsrc; 125 - of_address_to_resource(np, 0, &rsrc); 126 - if ((rsrc.start & 0xfffff) == primary_phb_addr) 127 - fsl_add_bridge(np, 1); 128 - else 129 - fsl_add_bridge(np, 0); 130 - 131 - hose = pci_find_hose_for_OF_device(np); 132 - max = min(max, hose->dma_window_base_cur + 133 - hose->dma_window_size); 134 - } 135 - } 136 - #endif 137 - 138 101 mpc85xx_smp_init(); 139 102 140 - #ifdef CONFIG_SWIOTLB 141 - if ((memblock_end_of_DRAM() - 1) > max) { 142 - ppc_swiotlb_enable = 1; 143 - set_pci_dma_ops(&swiotlb_dma_ops); 144 - ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 145 - } 146 - #endif 103 + ge_imp3a_pci_assign_primary(); 104 + 105 + swiotlb_detect_4g(); 147 106 148 107 /* Remap basic board registers */ 149 108 regs = of_find_compatible_node(NULL, NULL, "ge,imp3a-fpga-regs"); ··· 200 215 { 201 216 unsigned long root = of_get_flat_dt_root(); 202 217 203 - if (of_flat_dt_is_compatible(root, "ge,IMP3A")) { 204 - #ifdef CONFIG_PCI 205 - primary_phb_addr = 0x9000; 206 - #endif 207 - return 1; 208 - } 209 - 210 - return 0; 218 + return of_flat_dt_is_compatible(root, "ge,IMP3A"); 211 219 } 212 220 213 - machine_device_initcall(ge_imp3a, mpc85xx_common_publish_devices); 221 + machine_arch_initcall(ge_imp3a, mpc85xx_common_publish_devices); 214 222 215 223 machine_arch_initcall(ge_imp3a, swiotlb_setup_bus_notifier); 216 224
+3 -33
arch/powerpc/platforms/85xx/mpc8536_ds.c
··· 17 17 #include <linux/seq_file.h> 18 18 #include <linux/interrupt.h> 19 19 #include <linux/of_platform.h> 20 - #include <linux/memblock.h> 21 20 22 21 #include <asm/time.h> 23 22 #include <asm/machdep.h> ··· 45 46 */ 46 47 static void __init mpc8536_ds_setup_arch(void) 47 48 { 48 - #ifdef CONFIG_PCI 49 - struct device_node *np; 50 - struct pci_controller *hose; 51 - #endif 52 - dma_addr_t max = 0xffffffff; 53 - 54 49 if (ppc_md.progress) 55 50 ppc_md.progress("mpc8536_ds_setup_arch()", 0); 56 51 57 - #ifdef CONFIG_PCI 58 - for_each_node_by_type(np, "pci") { 59 - if (of_device_is_compatible(np, "fsl,mpc8540-pci") || 60 - of_device_is_compatible(np, "fsl,mpc8548-pcie")) { 61 - struct resource rsrc; 62 - of_address_to_resource(np, 0, &rsrc); 63 - if ((rsrc.start & 0xfffff) == 0x8000) 64 - fsl_add_bridge(np, 1); 65 - else 66 - fsl_add_bridge(np, 0); 52 + fsl_pci_assign_primary(); 67 53 68 - hose = pci_find_hose_for_OF_device(np); 69 - max = min(max, hose->dma_window_base_cur + 70 - hose->dma_window_size); 71 - } 72 - } 73 - 74 - #endif 75 - 76 - #ifdef CONFIG_SWIOTLB 77 - if ((memblock_end_of_DRAM() - 1) > max) { 78 - ppc_swiotlb_enable = 1; 79 - set_pci_dma_ops(&swiotlb_dma_ops); 80 - ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 81 - } 82 - #endif 54 + swiotlb_detect_4g(); 83 55 84 56 printk("MPC8536 DS board from Freescale Semiconductor\n"); 85 57 } 86 58 87 - machine_device_initcall(mpc8536_ds, mpc85xx_common_publish_devices); 59 + machine_arch_initcall(mpc8536_ds, mpc85xx_common_publish_devices); 88 60 89 61 machine_arch_initcall(mpc8536_ds, swiotlb_setup_bus_notifier); 90 62
+3 -8
arch/powerpc/platforms/85xx/mpc85xx_ads.c
··· 137 137 138 138 static void __init mpc85xx_ads_setup_arch(void) 139 139 { 140 - #ifdef CONFIG_PCI 141 - struct device_node *np; 142 - #endif 143 - 144 140 if (ppc_md.progress) 145 141 ppc_md.progress("mpc85xx_ads_setup_arch()", 0); 146 142 ··· 146 150 #endif 147 151 148 152 #ifdef CONFIG_PCI 149 - for_each_compatible_node(np, "pci", "fsl,mpc8540-pci") 150 - fsl_add_bridge(np, 1); 151 - 152 153 ppc_md.pci_exclude_device = mpc85xx_exclude_device; 153 154 #endif 155 + 156 + fsl_pci_assign_primary(); 154 157 } 155 158 156 159 static void mpc85xx_ads_show_cpuinfo(struct seq_file *m) ··· 168 173 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 169 174 } 170 175 171 - machine_device_initcall(mpc85xx_ads, mpc85xx_common_publish_devices); 176 + machine_arch_initcall(mpc85xx_ads, mpc85xx_common_publish_devices); 172 177 173 178 /* 174 179 * Called very early, device-tree isn't unflattened
+31 -13
arch/powerpc/platforms/85xx/mpc85xx_cds.c
··· 276 276 277 277 #endif /* CONFIG_PPC_I8259 */ 278 278 279 + static void mpc85xx_cds_pci_assign_primary(void) 280 + { 281 + #ifdef CONFIG_PCI 282 + struct device_node *np; 283 + 284 + if (fsl_pci_primary) 285 + return; 286 + 287 + /* 288 + * MPC85xx_CDS has ISA bridge but unfortunately there is no 289 + * isa node in device tree. We now looking for i8259 node as 290 + * a workaround for such a broken device tree. This routine 291 + * is for complying to all device trees. 292 + */ 293 + np = of_find_node_by_name(NULL, "i8259"); 294 + while ((fsl_pci_primary = of_get_parent(np))) { 295 + of_node_put(np); 296 + np = fsl_pci_primary; 297 + 298 + if ((of_device_is_compatible(np, "fsl,mpc8540-pci") || 299 + of_device_is_compatible(np, "fsl,mpc8548-pcie")) && 300 + of_device_is_available(np)) 301 + return; 302 + } 303 + #endif 304 + } 305 + 279 306 /* 280 307 * Setup the architecture 281 308 */ ··· 336 309 } 337 310 338 311 #ifdef CONFIG_PCI 339 - for_each_node_by_type(np, "pci") { 340 - if (of_device_is_compatible(np, "fsl,mpc8540-pci") || 341 - of_device_is_compatible(np, "fsl,mpc8548-pcie")) { 342 - struct resource rsrc; 343 - of_address_to_resource(np, 0, &rsrc); 344 - if ((rsrc.start & 0xfffff) == 0x8000) 345 - fsl_add_bridge(np, 1); 346 - else 347 - fsl_add_bridge(np, 0); 348 - } 349 - } 350 - 351 312 ppc_md.pci_irq_fixup = mpc85xx_cds_pci_irq_fixup; 352 313 ppc_md.pci_exclude_device = mpc85xx_exclude_device; 353 314 #endif 315 + 316 + mpc85xx_cds_pci_assign_primary(); 317 + fsl_pci_assign_primary(); 354 318 } 355 319 356 320 static void mpc85xx_cds_show_cpuinfo(struct seq_file *m) ··· 373 355 return of_flat_dt_is_compatible(root, "MPC85xxCDS"); 374 356 } 375 357 376 - machine_device_initcall(mpc85xx_cds, mpc85xx_common_publish_devices); 358 + machine_arch_initcall(mpc85xx_cds, mpc85xx_common_publish_devices); 377 359 378 360 define_machine(mpc85xx_cds) { 379 361 .name = "MPC85xx CDS",
+7 -8
arch/powerpc/platforms/85xx/mpc85xx_ds.c
··· 20 20 #include <linux/seq_file.h> 21 21 #include <linux/interrupt.h> 22 22 #include <linux/of_platform.h> 23 - #include <linux/memblock.h> 24 23 25 24 #include <asm/time.h> 26 25 #include <asm/machdep.h> ··· 128 129 } 129 130 #endif /* CONFIG_PCI */ 130 131 131 - static void __init mpc85xx_ds_pci_init(void) 132 + static void __init mpc85xx_ds_uli_init(void) 132 133 { 133 134 #ifdef CONFIG_PCI 134 135 struct device_node *node; 135 - 136 - fsl_pci_init(); 137 136 138 137 /* See if we have a ULI under the primary */ 139 138 ··· 156 159 if (ppc_md.progress) 157 160 ppc_md.progress("mpc85xx_ds_setup_arch()", 0); 158 161 159 - mpc85xx_ds_pci_init(); 162 + swiotlb_detect_4g(); 163 + fsl_pci_assign_primary(); 164 + mpc85xx_ds_uli_init(); 160 165 mpc85xx_smp_init(); 161 166 162 167 printk("MPC85xx DS board from Freescale Semiconductor\n"); ··· 174 175 return !!of_flat_dt_is_compatible(root, "MPC8544DS"); 175 176 } 176 177 177 - machine_device_initcall(mpc8544_ds, mpc85xx_common_publish_devices); 178 - machine_device_initcall(mpc8572_ds, mpc85xx_common_publish_devices); 179 - machine_device_initcall(p2020_ds, mpc85xx_common_publish_devices); 178 + machine_arch_initcall(mpc8544_ds, mpc85xx_common_publish_devices); 179 + machine_arch_initcall(mpc8572_ds, mpc85xx_common_publish_devices); 180 + machine_arch_initcall(p2020_ds, mpc85xx_common_publish_devices); 180 181 181 182 machine_arch_initcall(mpc8544_ds, swiotlb_setup_bus_notifier); 182 183 machine_arch_initcall(mpc8572_ds, swiotlb_setup_bus_notifier);
+6 -34
arch/powerpc/platforms/85xx/mpc85xx_mds.c
··· 327 327 328 328 static void __init mpc85xx_mds_setup_arch(void) 329 329 { 330 - #ifdef CONFIG_PCI 331 - struct pci_controller *hose; 332 - struct device_node *np; 333 - #endif 334 - dma_addr_t max = 0xffffffff; 335 - 336 330 if (ppc_md.progress) 337 331 ppc_md.progress("mpc85xx_mds_setup_arch()", 0); 338 - 339 - #ifdef CONFIG_PCI 340 - for_each_node_by_type(np, "pci") { 341 - if (of_device_is_compatible(np, "fsl,mpc8540-pci") || 342 - of_device_is_compatible(np, "fsl,mpc8548-pcie")) { 343 - struct resource rsrc; 344 - of_address_to_resource(np, 0, &rsrc); 345 - if ((rsrc.start & 0xfffff) == 0x8000) 346 - fsl_add_bridge(np, 1); 347 - else 348 - fsl_add_bridge(np, 0); 349 - 350 - hose = pci_find_hose_for_OF_device(np); 351 - max = min(max, hose->dma_window_base_cur + 352 - hose->dma_window_size); 353 - } 354 - } 355 - #endif 356 332 357 333 mpc85xx_smp_init(); 358 334 359 335 mpc85xx_mds_qe_init(); 360 336 361 - #ifdef CONFIG_SWIOTLB 362 - if ((memblock_end_of_DRAM() - 1) > max) { 363 - ppc_swiotlb_enable = 1; 364 - set_pci_dma_ops(&swiotlb_dma_ops); 365 - ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 366 - } 367 - #endif 337 + fsl_pci_assign_primary(); 338 + 339 + swiotlb_detect_4g(); 368 340 } 369 341 370 342 ··· 381 409 return mpc85xx_common_publish_devices(); 382 410 } 383 411 384 - machine_device_initcall(mpc8568_mds, mpc85xx_publish_devices); 385 - machine_device_initcall(mpc8569_mds, mpc85xx_publish_devices); 386 - machine_device_initcall(p1021_mds, mpc85xx_common_publish_devices); 412 + machine_arch_initcall(mpc8568_mds, mpc85xx_publish_devices); 413 + machine_arch_initcall(mpc8569_mds, mpc85xx_publish_devices); 414 + machine_arch_initcall(p1021_mds, mpc85xx_common_publish_devices); 387 415 388 416 machine_arch_initcall(mpc8568_mds, swiotlb_setup_bus_notifier); 389 417 machine_arch_initcall(mpc8569_mds, swiotlb_setup_bus_notifier);
+12 -18
arch/powerpc/platforms/85xx/mpc85xx_rdb.c
··· 86 86 */ 87 87 static void __init mpc85xx_rdb_setup_arch(void) 88 88 { 89 - #if defined(CONFIG_PCI) || defined(CONFIG_QUICC_ENGINE) 89 + #ifdef CONFIG_QUICC_ENGINE 90 90 struct device_node *np; 91 91 #endif 92 92 93 93 if (ppc_md.progress) 94 94 ppc_md.progress("mpc85xx_rdb_setup_arch()", 0); 95 95 96 - #ifdef CONFIG_PCI 97 - for_each_node_by_type(np, "pci") { 98 - if (of_device_is_compatible(np, "fsl,mpc8548-pcie")) 99 - fsl_add_bridge(np, 0); 100 - } 101 - 102 - #endif 103 - 104 96 mpc85xx_smp_init(); 97 + 98 + fsl_pci_assign_primary(); 105 99 106 100 #ifdef CONFIG_QUICC_ENGINE 107 101 np = of_find_compatible_node(NULL, NULL, "fsl,qe"); ··· 155 161 printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n"); 156 162 } 157 163 158 - machine_device_initcall(p2020_rdb, mpc85xx_common_publish_devices); 159 - machine_device_initcall(p2020_rdb_pc, mpc85xx_common_publish_devices); 160 - machine_device_initcall(p1020_mbg_pc, mpc85xx_common_publish_devices); 161 - machine_device_initcall(p1020_rdb, mpc85xx_common_publish_devices); 162 - machine_device_initcall(p1020_rdb_pc, mpc85xx_common_publish_devices); 163 - machine_device_initcall(p1020_utm_pc, mpc85xx_common_publish_devices); 164 - machine_device_initcall(p1021_rdb_pc, mpc85xx_common_publish_devices); 165 - machine_device_initcall(p1025_rdb, mpc85xx_common_publish_devices); 166 - machine_device_initcall(p1024_rdb, mpc85xx_common_publish_devices); 164 + machine_arch_initcall(p2020_rdb, mpc85xx_common_publish_devices); 165 + machine_arch_initcall(p2020_rdb_pc, mpc85xx_common_publish_devices); 166 + machine_arch_initcall(p1020_mbg_pc, mpc85xx_common_publish_devices); 167 + machine_arch_initcall(p1020_rdb, mpc85xx_common_publish_devices); 168 + machine_arch_initcall(p1020_rdb_pc, mpc85xx_common_publish_devices); 169 + machine_arch_initcall(p1020_utm_pc, mpc85xx_common_publish_devices); 170 + machine_arch_initcall(p1021_rdb_pc, mpc85xx_common_publish_devices); 171 + machine_arch_initcall(p1025_rdb, mpc85xx_common_publish_devices); 172 + machine_arch_initcall(p1024_rdb, mpc85xx_common_publish_devices); 167 173 168 174 /* 169 175 * Called very early, device-tree isn't unflattened
+2 -12
arch/powerpc/platforms/85xx/p1010rdb.c
··· 46 46 */ 47 47 static void __init p1010_rdb_setup_arch(void) 48 48 { 49 - #ifdef CONFIG_PCI 50 - struct device_node *np; 51 - #endif 52 - 53 49 if (ppc_md.progress) 54 50 ppc_md.progress("p1010_rdb_setup_arch()", 0); 55 51 56 - #ifdef CONFIG_PCI 57 - for_each_node_by_type(np, "pci") { 58 - if (of_device_is_compatible(np, "fsl,p1010-pcie")) 59 - fsl_add_bridge(np, 0); 60 - } 61 - 62 - #endif 52 + fsl_pci_assign_primary(); 63 53 64 54 printk(KERN_INFO "P1010 RDB board from Freescale Semiconductor\n"); 65 55 } 66 56 67 - machine_device_initcall(p1010_rdb, mpc85xx_common_publish_devices); 57 + machine_arch_initcall(p1010_rdb, mpc85xx_common_publish_devices); 68 58 machine_arch_initcall(p1010_rdb, swiotlb_setup_bus_notifier); 69 59 70 60 /*
+4 -32
arch/powerpc/platforms/85xx/p1022_ds.c
··· 18 18 19 19 #include <linux/pci.h> 20 20 #include <linux/of_platform.h> 21 - #include <linux/memblock.h> 22 21 #include <asm/div64.h> 23 22 #include <asm/mpic.h> 24 23 #include <asm/swiotlb.h> ··· 506 507 */ 507 508 static void __init p1022_ds_setup_arch(void) 508 509 { 509 - #ifdef CONFIG_PCI 510 - struct device_node *np; 511 - #endif 512 - dma_addr_t max = 0xffffffff; 513 - 514 510 if (ppc_md.progress) 515 511 ppc_md.progress("p1022_ds_setup_arch()", 0); 516 - 517 - #ifdef CONFIG_PCI 518 - for_each_compatible_node(np, "pci", "fsl,p1022-pcie") { 519 - struct resource rsrc; 520 - struct pci_controller *hose; 521 - 522 - of_address_to_resource(np, 0, &rsrc); 523 - 524 - if ((rsrc.start & 0xfffff) == 0x8000) 525 - fsl_add_bridge(np, 1); 526 - else 527 - fsl_add_bridge(np, 0); 528 - 529 - hose = pci_find_hose_for_OF_device(np); 530 - max = min(max, hose->dma_window_base_cur + 531 - hose->dma_window_size); 532 - } 533 - #endif 534 512 535 513 #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 536 514 diu_ops.get_pixel_format = p1022ds_get_pixel_format; ··· 577 601 578 602 mpc85xx_smp_init(); 579 603 580 - #ifdef CONFIG_SWIOTLB 581 - if ((memblock_end_of_DRAM() - 1) > max) { 582 - ppc_swiotlb_enable = 1; 583 - set_pci_dma_ops(&swiotlb_dma_ops); 584 - ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 585 - } 586 - #endif 604 + fsl_pci_assign_primary(); 605 + 606 + swiotlb_detect_4g(); 587 607 588 608 pr_info("Freescale P1022 DS reference board\n"); 589 609 } 590 610 591 - machine_device_initcall(p1022_ds, mpc85xx_common_publish_devices); 611 + machine_arch_initcall(p1022_ds, mpc85xx_common_publish_devices); 592 612 593 613 machine_arch_initcall(p1022_ds, swiotlb_setup_bus_notifier); 594 614
+167
arch/powerpc/platforms/85xx/p1022_rdk.c
··· 1 + /* 2 + * P1022 RDK board specific routines 3 + * 4 + * Copyright 2012 Freescale Semiconductor, Inc. 5 + * 6 + * Author: Timur Tabi <timur@freescale.com> 7 + * 8 + * Based on p1022_ds.c 9 + * 10 + * This file is licensed under the terms of the GNU General Public License 11 + * version 2. This program is licensed "as is" without any warranty of any 12 + * kind, whether express or implied. 13 + */ 14 + 15 + #include <linux/pci.h> 16 + #include <linux/of_platform.h> 17 + #include <asm/div64.h> 18 + #include <asm/mpic.h> 19 + #include <asm/swiotlb.h> 20 + 21 + #include <sysdev/fsl_soc.h> 22 + #include <sysdev/fsl_pci.h> 23 + #include <asm/udbg.h> 24 + #include <asm/fsl_guts.h> 25 + #include "smp.h" 26 + 27 + #include "mpc85xx.h" 28 + 29 + #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 30 + 31 + /* DIU Pixel Clock bits of the CLKDVDR Global Utilities register */ 32 + #define CLKDVDR_PXCKEN 0x80000000 33 + #define CLKDVDR_PXCKINV 0x10000000 34 + #define CLKDVDR_PXCKDLY 0x06000000 35 + #define CLKDVDR_PXCLK_MASK 0x00FF0000 36 + 37 + /** 38 + * p1022rdk_set_monitor_port: switch the output to a different monitor port 39 + */ 40 + static void p1022rdk_set_monitor_port(enum fsl_diu_monitor_port port) 41 + { 42 + if (port != FSL_DIU_PORT_DVI) { 43 + pr_err("p1022rdk: unsupported monitor port %i\n", port); 44 + return; 45 + } 46 + } 47 + 48 + /** 49 + * p1022rdk_set_pixel_clock: program the DIU's clock 50 + * 51 + * @pixclock: the wavelength, in picoseconds, of the clock 52 + */ 53 + void p1022rdk_set_pixel_clock(unsigned int pixclock) 54 + { 55 + struct device_node *guts_np = NULL; 56 + struct ccsr_guts __iomem *guts; 57 + unsigned long freq; 58 + u64 temp; 59 + u32 pxclk; 60 + 61 + /* Map the global utilities registers. */ 62 + guts_np = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts"); 63 + if (!guts_np) { 64 + pr_err("p1022rdk: missing global utilties device node\n"); 65 + return; 66 + } 67 + 68 + guts = of_iomap(guts_np, 0); 69 + of_node_put(guts_np); 70 + if (!guts) { 71 + pr_err("p1022rdk: could not map global utilties device\n"); 72 + return; 73 + } 74 + 75 + /* Convert pixclock from a wavelength to a frequency */ 76 + temp = 1000000000000ULL; 77 + do_div(temp, pixclock); 78 + freq = temp; 79 + 80 + /* 81 + * 'pxclk' is the ratio of the platform clock to the pixel clock. 82 + * This number is programmed into the CLKDVDR register, and the valid 83 + * range of values is 2-255. 84 + */ 85 + pxclk = DIV_ROUND_CLOSEST(fsl_get_sys_freq(), freq); 86 + pxclk = clamp_t(u32, pxclk, 2, 255); 87 + 88 + /* Disable the pixel clock, and set it to non-inverted and no delay */ 89 + clrbits32(&guts->clkdvdr, 90 + CLKDVDR_PXCKEN | CLKDVDR_PXCKDLY | CLKDVDR_PXCLK_MASK); 91 + 92 + /* Enable the clock and set the pxclk */ 93 + setbits32(&guts->clkdvdr, CLKDVDR_PXCKEN | (pxclk << 16)); 94 + 95 + iounmap(guts); 96 + } 97 + 98 + /** 99 + * p1022rdk_valid_monitor_port: set the monitor port for sysfs 100 + */ 101 + enum fsl_diu_monitor_port 102 + p1022rdk_valid_monitor_port(enum fsl_diu_monitor_port port) 103 + { 104 + return FSL_DIU_PORT_DVI; 105 + } 106 + 107 + #endif 108 + 109 + void __init p1022_rdk_pic_init(void) 110 + { 111 + struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN | 112 + MPIC_SINGLE_DEST_CPU, 113 + 0, 256, " OpenPIC "); 114 + BUG_ON(mpic == NULL); 115 + mpic_init(mpic); 116 + } 117 + 118 + /* 119 + * Setup the architecture 120 + */ 121 + static void __init p1022_rdk_setup_arch(void) 122 + { 123 + if (ppc_md.progress) 124 + ppc_md.progress("p1022_rdk_setup_arch()", 0); 125 + 126 + #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 127 + diu_ops.set_monitor_port = p1022rdk_set_monitor_port; 128 + diu_ops.set_pixel_clock = p1022rdk_set_pixel_clock; 129 + diu_ops.valid_monitor_port = p1022rdk_valid_monitor_port; 130 + #endif 131 + 132 + mpc85xx_smp_init(); 133 + 134 + fsl_pci_assign_primary(); 135 + 136 + swiotlb_detect_4g(); 137 + 138 + pr_info("Freescale / iVeia P1022 RDK reference board\n"); 139 + } 140 + 141 + machine_arch_initcall(p1022_rdk, mpc85xx_common_publish_devices); 142 + 143 + machine_arch_initcall(p1022_rdk, swiotlb_setup_bus_notifier); 144 + 145 + /* 146 + * Called very early, device-tree isn't unflattened 147 + */ 148 + static int __init p1022_rdk_probe(void) 149 + { 150 + unsigned long root = of_get_flat_dt_root(); 151 + 152 + return of_flat_dt_is_compatible(root, "fsl,p1022rdk"); 153 + } 154 + 155 + define_machine(p1022_rdk) { 156 + .name = "P1022 RDK", 157 + .probe = p1022_rdk_probe, 158 + .setup_arch = p1022_rdk_setup_arch, 159 + .init_IRQ = p1022_rdk_pic_init, 160 + #ifdef CONFIG_PCI 161 + .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 162 + #endif 163 + .get_irq = mpic_get_irq, 164 + .restart = fsl_rstcr_restart, 165 + .calibrate_decr = generic_calibrate_decr, 166 + .progress = udbg_progress, 167 + };
+3 -6
arch/powerpc/platforms/85xx/p1023_rds.c
··· 80 80 } 81 81 } 82 82 83 - #ifdef CONFIG_PCI 84 - for_each_compatible_node(np, "pci", "fsl,p1023-pcie") 85 - fsl_add_bridge(np, 0); 86 - #endif 87 - 88 83 mpc85xx_smp_init(); 84 + 85 + fsl_pci_assign_primary(); 89 86 } 90 87 91 - machine_device_initcall(p1023_rds, mpc85xx_common_publish_devices); 88 + machine_arch_initcall(p1023_rds, mpc85xx_common_publish_devices); 92 89 93 90 static void __init mpc85xx_rds_pic_init(void) 94 91 {
+1 -1
arch/powerpc/platforms/85xx/p2041_rdb.c
··· 80 80 .power_save = e500_idle, 81 81 }; 82 82 83 - machine_device_initcall(p2041_rdb, corenet_ds_publish_devices); 83 + machine_arch_initcall(p2041_rdb, corenet_ds_publish_devices); 84 84 85 85 #ifdef CONFIG_SWIOTLB 86 86 machine_arch_initcall(p2041_rdb, swiotlb_setup_bus_notifier);
+1 -1
arch/powerpc/platforms/85xx/p3041_ds.c
··· 82 82 .power_save = e500_idle, 83 83 }; 84 84 85 - machine_device_initcall(p3041_ds, corenet_ds_publish_devices); 85 + machine_arch_initcall(p3041_ds, corenet_ds_publish_devices); 86 86 87 87 #ifdef CONFIG_SWIOTLB 88 88 machine_arch_initcall(p3041_ds, swiotlb_setup_bus_notifier);
+1 -1
arch/powerpc/platforms/85xx/p4080_ds.c
··· 81 81 .power_save = e500_idle, 82 82 }; 83 83 84 - machine_device_initcall(p4080_ds, corenet_ds_publish_devices); 84 + machine_arch_initcall(p4080_ds, corenet_ds_publish_devices); 85 85 #ifdef CONFIG_SWIOTLB 86 86 machine_arch_initcall(p4080_ds, swiotlb_setup_bus_notifier); 87 87 #endif
+1 -1
arch/powerpc/platforms/85xx/p5020_ds.c
··· 91 91 #endif 92 92 }; 93 93 94 - machine_device_initcall(p5020_ds, corenet_ds_publish_devices); 94 + machine_arch_initcall(p5020_ds, corenet_ds_publish_devices); 95 95 96 96 #ifdef CONFIG_SWIOTLB 97 97 machine_arch_initcall(p5020_ds, swiotlb_setup_bus_notifier);
+89
arch/powerpc/platforms/85xx/p5040_ds.c
··· 1 + /* 2 + * P5040 DS Setup 3 + * 4 + * Copyright 2009-2010 Freescale Semiconductor Inc. 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 10 + */ 11 + 12 + #include <linux/kernel.h> 13 + #include <linux/pci.h> 14 + 15 + #include <asm/machdep.h> 16 + #include <asm/udbg.h> 17 + #include <asm/mpic.h> 18 + 19 + #include <linux/of_fdt.h> 20 + 21 + #include <sysdev/fsl_soc.h> 22 + #include <sysdev/fsl_pci.h> 23 + #include <asm/ehv_pic.h> 24 + 25 + #include "corenet_ds.h" 26 + 27 + /* 28 + * Called very early, device-tree isn't unflattened 29 + */ 30 + static int __init p5040_ds_probe(void) 31 + { 32 + unsigned long root = of_get_flat_dt_root(); 33 + #ifdef CONFIG_SMP 34 + extern struct smp_ops_t smp_85xx_ops; 35 + #endif 36 + 37 + if (of_flat_dt_is_compatible(root, "fsl,P5040DS")) 38 + return 1; 39 + 40 + /* Check if we're running under the Freescale hypervisor */ 41 + if (of_flat_dt_is_compatible(root, "fsl,P5040DS-hv")) { 42 + ppc_md.init_IRQ = ehv_pic_init; 43 + ppc_md.get_irq = ehv_pic_get_irq; 44 + ppc_md.restart = fsl_hv_restart; 45 + ppc_md.power_off = fsl_hv_halt; 46 + ppc_md.halt = fsl_hv_halt; 47 + #ifdef CONFIG_SMP 48 + /* 49 + * Disable the timebase sync operations because we can't write 50 + * to the timebase registers under the hypervisor. 51 + */ 52 + smp_85xx_ops.give_timebase = NULL; 53 + smp_85xx_ops.take_timebase = NULL; 54 + #endif 55 + return 1; 56 + } 57 + 58 + return 0; 59 + } 60 + 61 + define_machine(p5040_ds) { 62 + .name = "P5040 DS", 63 + .probe = p5040_ds_probe, 64 + .setup_arch = corenet_ds_setup_arch, 65 + .init_IRQ = corenet_ds_pic_init, 66 + #ifdef CONFIG_PCI 67 + .pcibios_fixup_bus = fsl_pcibios_fixup_bus, 68 + #endif 69 + /* coreint doesn't play nice with lazy EE, use legacy mpic for now */ 70 + #ifdef CONFIG_PPC64 71 + .get_irq = mpic_get_irq, 72 + #else 73 + .get_irq = mpic_get_coreint_irq, 74 + #endif 75 + .restart = fsl_rstcr_restart, 76 + .calibrate_decr = generic_calibrate_decr, 77 + .progress = udbg_progress, 78 + #ifdef CONFIG_PPC64 79 + .power_save = book3e_idle, 80 + #else 81 + .power_save = e500_idle, 82 + #endif 83 + }; 84 + 85 + machine_arch_initcall(p5040_ds, corenet_ds_publish_devices); 86 + 87 + #ifdef CONFIG_SWIOTLB 88 + machine_arch_initcall(p5040_ds, swiotlb_setup_bus_notifier); 89 + #endif
+3 -2
arch/powerpc/platforms/85xx/qemu_e500.c
··· 41 41 { 42 42 ppc_md.progress("qemu_e500_setup_arch()", 0); 43 43 44 - fsl_pci_init(); 44 + fsl_pci_assign_primary(); 45 + swiotlb_detect_4g(); 45 46 mpc85xx_smp_init(); 46 47 } 47 48 ··· 56 55 return !!of_flat_dt_is_compatible(root, "fsl,qemu-e500"); 57 56 } 58 57 59 - machine_device_initcall(qemu_e500, mpc85xx_common_publish_devices); 58 + machine_arch_initcall(qemu_e500, mpc85xx_common_publish_devices); 60 59 61 60 define_machine(qemu_e500) { 62 61 .name = "QEMU e500",
+3 -18
arch/powerpc/platforms/85xx/sbc8548.c
··· 88 88 */ 89 89 static void __init sbc8548_setup_arch(void) 90 90 { 91 - #ifdef CONFIG_PCI 92 - struct device_node *np; 93 - #endif 94 - 95 91 if (ppc_md.progress) 96 92 ppc_md.progress("sbc8548_setup_arch()", 0); 97 93 98 - #ifdef CONFIG_PCI 99 - for_each_node_by_type(np, "pci") { 100 - if (of_device_is_compatible(np, "fsl,mpc8540-pci") || 101 - of_device_is_compatible(np, "fsl,mpc8548-pcie")) { 102 - struct resource rsrc; 103 - of_address_to_resource(np, 0, &rsrc); 104 - if ((rsrc.start & 0xfffff) == 0x8000) 105 - fsl_add_bridge(np, 1); 106 - else 107 - fsl_add_bridge(np, 0); 108 - } 109 - } 110 - #endif 94 + fsl_pci_assign_primary(); 95 + 111 96 sbc_rev = sbc8548_hw_rev(); 112 97 } 113 98 ··· 113 128 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 114 129 } 115 130 116 - machine_device_initcall(sbc8548, mpc85xx_common_publish_devices); 131 + machine_arch_initcall(sbc8548, mpc85xx_common_publish_devices); 117 132 118 133 /* 119 134 * Called very early, device-tree isn't unflattened
+181 -35
arch/powerpc/platforms/85xx/smp.c
··· 2 2 * Author: Andy Fleming <afleming@freescale.com> 3 3 * Kumar Gala <galak@kernel.crashing.org> 4 4 * 5 - * Copyright 2006-2008, 2011 Freescale Semiconductor Inc. 5 + * Copyright 2006-2008, 2011-2012 Freescale Semiconductor Inc. 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify it 8 8 * under the terms of the GNU General Public License as published by the ··· 17 17 #include <linux/of.h> 18 18 #include <linux/kexec.h> 19 19 #include <linux/highmem.h> 20 + #include <linux/cpu.h> 20 21 21 22 #include <asm/machdep.h> 22 23 #include <asm/pgtable.h> ··· 25 24 #include <asm/mpic.h> 26 25 #include <asm/cacheflush.h> 27 26 #include <asm/dbell.h> 27 + #include <asm/fsl_guts.h> 28 28 29 29 #include <sysdev/fsl_soc.h> 30 30 #include <sysdev/mpic.h> 31 31 #include "smp.h" 32 32 33 - extern void __early_start(void); 33 + struct epapr_spin_table { 34 + u32 addr_h; 35 + u32 addr_l; 36 + u32 r3_h; 37 + u32 r3_l; 38 + u32 reserved; 39 + u32 pir; 40 + }; 34 41 35 - #define BOOT_ENTRY_ADDR_UPPER 0 36 - #define BOOT_ENTRY_ADDR_LOWER 1 37 - #define BOOT_ENTRY_R3_UPPER 2 38 - #define BOOT_ENTRY_R3_LOWER 3 39 - #define BOOT_ENTRY_RESV 4 40 - #define BOOT_ENTRY_PIR 5 41 - #define BOOT_ENTRY_R6_UPPER 6 42 - #define BOOT_ENTRY_R6_LOWER 7 43 - #define NUM_BOOT_ENTRY 8 44 - #define SIZE_BOOT_ENTRY (NUM_BOOT_ENTRY * sizeof(u32)) 42 + static struct ccsr_guts __iomem *guts; 43 + static u64 timebase; 44 + static int tb_req; 45 + static int tb_valid; 45 46 46 - static int __init 47 - smp_85xx_kick_cpu(int nr) 47 + static void mpc85xx_timebase_freeze(int freeze) 48 + { 49 + uint32_t mask; 50 + 51 + mask = CCSR_GUTS_DEVDISR_TB0 | CCSR_GUTS_DEVDISR_TB1; 52 + if (freeze) 53 + setbits32(&guts->devdisr, mask); 54 + else 55 + clrbits32(&guts->devdisr, mask); 56 + 57 + in_be32(&guts->devdisr); 58 + } 59 + 60 + static void mpc85xx_give_timebase(void) 61 + { 62 + unsigned long flags; 63 + 64 + local_irq_save(flags); 65 + 66 + while (!tb_req) 67 + barrier(); 68 + tb_req = 0; 69 + 70 + mpc85xx_timebase_freeze(1); 71 + timebase = get_tb(); 72 + mb(); 73 + tb_valid = 1; 74 + 75 + while (tb_valid) 76 + barrier(); 77 + 78 + mpc85xx_timebase_freeze(0); 79 + 80 + local_irq_restore(flags); 81 + } 82 + 83 + static void mpc85xx_take_timebase(void) 84 + { 85 + unsigned long flags; 86 + 87 + local_irq_save(flags); 88 + 89 + tb_req = 1; 90 + while (!tb_valid) 91 + barrier(); 92 + 93 + set_tb(timebase >> 32, timebase & 0xffffffff); 94 + isync(); 95 + tb_valid = 0; 96 + 97 + local_irq_restore(flags); 98 + } 99 + 100 + #ifdef CONFIG_HOTPLUG_CPU 101 + static void __cpuinit smp_85xx_mach_cpu_die(void) 102 + { 103 + unsigned int cpu = smp_processor_id(); 104 + u32 tmp; 105 + 106 + local_irq_disable(); 107 + idle_task_exit(); 108 + generic_set_cpu_dead(cpu); 109 + mb(); 110 + 111 + mtspr(SPRN_TCR, 0); 112 + 113 + __flush_disable_L1(); 114 + tmp = (mfspr(SPRN_HID0) & ~(HID0_DOZE|HID0_SLEEP)) | HID0_NAP; 115 + mtspr(SPRN_HID0, tmp); 116 + isync(); 117 + 118 + /* Enter NAP mode. */ 119 + tmp = mfmsr(); 120 + tmp |= MSR_WE; 121 + mb(); 122 + mtmsr(tmp); 123 + isync(); 124 + 125 + while (1) 126 + ; 127 + } 128 + #endif 129 + 130 + static int __cpuinit smp_85xx_kick_cpu(int nr) 48 131 { 49 132 unsigned long flags; 50 133 const u64 *cpu_rel_addr; 51 - __iomem u32 *bptr_vaddr; 134 + __iomem struct epapr_spin_table *spin_table; 52 135 struct device_node *np; 53 - int n = 0, hw_cpu = get_hard_smp_processor_id(nr); 136 + int hw_cpu = get_hard_smp_processor_id(nr); 54 137 int ioremappable; 138 + int ret = 0; 55 139 56 140 WARN_ON(nr < 0 || nr >= NR_CPUS); 57 141 WARN_ON(hw_cpu < 0 || hw_cpu >= NR_CPUS); ··· 161 75 162 76 /* Map the spin table */ 163 77 if (ioremappable) 164 - bptr_vaddr = ioremap(*cpu_rel_addr, SIZE_BOOT_ENTRY); 78 + spin_table = ioremap(*cpu_rel_addr, 79 + sizeof(struct epapr_spin_table)); 165 80 else 166 - bptr_vaddr = phys_to_virt(*cpu_rel_addr); 81 + spin_table = phys_to_virt(*cpu_rel_addr); 167 82 168 83 local_irq_save(flags); 169 - 170 - out_be32(bptr_vaddr + BOOT_ENTRY_PIR, hw_cpu); 171 84 #ifdef CONFIG_PPC32 172 - out_be32(bptr_vaddr + BOOT_ENTRY_ADDR_LOWER, __pa(__early_start)); 85 + #ifdef CONFIG_HOTPLUG_CPU 86 + /* Corresponding to generic_set_cpu_dead() */ 87 + generic_set_cpu_up(nr); 88 + 89 + if (system_state == SYSTEM_RUNNING) { 90 + out_be32(&spin_table->addr_l, 0); 91 + 92 + /* 93 + * We don't set the BPTR register here since it already points 94 + * to the boot page properly. 95 + */ 96 + mpic_reset_core(hw_cpu); 97 + 98 + /* wait until core is ready... */ 99 + if (!spin_event_timeout(in_be32(&spin_table->addr_l) == 1, 100 + 10000, 100)) { 101 + pr_err("%s: timeout waiting for core %d to reset\n", 102 + __func__, hw_cpu); 103 + ret = -ENOENT; 104 + goto out; 105 + } 106 + 107 + /* clear the acknowledge status */ 108 + __secondary_hold_acknowledge = -1; 109 + } 110 + #endif 111 + out_be32(&spin_table->pir, hw_cpu); 112 + out_be32(&spin_table->addr_l, __pa(__early_start)); 173 113 174 114 if (!ioremappable) 175 - flush_dcache_range((ulong)bptr_vaddr, 176 - (ulong)(bptr_vaddr + SIZE_BOOT_ENTRY)); 115 + flush_dcache_range((ulong)spin_table, 116 + (ulong)spin_table + sizeof(struct epapr_spin_table)); 177 117 178 118 /* Wait a bit for the CPU to ack. */ 179 - while ((__secondary_hold_acknowledge != hw_cpu) && (++n < 1000)) 180 - mdelay(1); 119 + if (!spin_event_timeout(__secondary_hold_acknowledge == hw_cpu, 120 + 10000, 100)) { 121 + pr_err("%s: timeout waiting for core %d to ack\n", 122 + __func__, hw_cpu); 123 + ret = -ENOENT; 124 + goto out; 125 + } 126 + out: 181 127 #else 182 128 smp_generic_kick_cpu(nr); 183 129 184 - out_be64((u64 *)(bptr_vaddr + BOOT_ENTRY_ADDR_UPPER), 185 - __pa((u64)*((unsigned long long *) generic_secondary_smp_init))); 130 + out_be32(&spin_table->pir, hw_cpu); 131 + out_be64((u64 *)(&spin_table->addr_h), 132 + __pa((u64)*((unsigned long long *)generic_secondary_smp_init))); 186 133 187 134 if (!ioremappable) 188 - flush_dcache_range((ulong)bptr_vaddr, 189 - (ulong)(bptr_vaddr + SIZE_BOOT_ENTRY)); 135 + flush_dcache_range((ulong)spin_table, 136 + (ulong)spin_table + sizeof(struct epapr_spin_table)); 190 137 #endif 191 138 192 139 local_irq_restore(flags); 193 140 194 141 if (ioremappable) 195 - iounmap(bptr_vaddr); 142 + iounmap(spin_table); 196 143 197 - pr_debug("waited %d msecs for CPU #%d.\n", n, nr); 198 - 199 - return 0; 144 + return ret; 200 145 } 201 146 202 147 struct smp_ops_t smp_85xx_ops = { 203 148 .kick_cpu = smp_85xx_kick_cpu, 149 + #ifdef CONFIG_HOTPLUG_CPU 150 + .cpu_disable = generic_cpu_disable, 151 + .cpu_die = generic_cpu_die, 152 + #endif 204 153 #ifdef CONFIG_KEXEC 205 154 .give_timebase = smp_generic_give_timebase, 206 155 .take_timebase = smp_generic_take_timebase, ··· 339 218 } 340 219 #endif /* CONFIG_KEXEC */ 341 220 342 - static void __init 343 - smp_85xx_setup_cpu(int cpu_nr) 221 + static void __cpuinit smp_85xx_setup_cpu(int cpu_nr) 344 222 { 345 223 if (smp_85xx_ops.probe == smp_mpic_probe) 346 224 mpic_setup_this_cpu(); ··· 347 227 if (cpu_has_feature(CPU_FTR_DBELL)) 348 228 doorbell_setup_this_cpu(); 349 229 } 230 + 231 + static const struct of_device_id mpc85xx_smp_guts_ids[] = { 232 + { .compatible = "fsl,mpc8572-guts", }, 233 + { .compatible = "fsl,p1020-guts", }, 234 + { .compatible = "fsl,p1021-guts", }, 235 + { .compatible = "fsl,p1022-guts", }, 236 + { .compatible = "fsl,p1023-guts", }, 237 + { .compatible = "fsl,p2020-guts", }, 238 + {}, 239 + }; 350 240 351 241 void __init mpc85xx_smp_init(void) 352 242 { ··· 377 247 */ 378 248 smp_85xx_ops.message_pass = NULL; 379 249 smp_85xx_ops.cause_ipi = doorbell_cause_ipi; 250 + } 251 + 252 + np = of_find_matching_node(NULL, mpc85xx_smp_guts_ids); 253 + if (np) { 254 + guts = of_iomap(np, 0); 255 + of_node_put(np); 256 + if (!guts) { 257 + pr_err("%s: Could not map guts node address\n", 258 + __func__); 259 + return; 260 + } 261 + smp_85xx_ops.give_timebase = mpc85xx_give_timebase; 262 + smp_85xx_ops.take_timebase = mpc85xx_take_timebase; 263 + #ifdef CONFIG_HOTPLUG_CPU 264 + ppc_md.cpu_die = smp_85xx_mach_cpu_die; 265 + #endif 380 266 } 381 267 382 268 smp_ops = &smp_85xx_ops;
+2 -9
arch/powerpc/platforms/85xx/socrates.c
··· 66 66 */ 67 67 static void __init socrates_setup_arch(void) 68 68 { 69 - #ifdef CONFIG_PCI 70 - struct device_node *np; 71 - #endif 72 - 73 69 if (ppc_md.progress) 74 70 ppc_md.progress("socrates_setup_arch()", 0); 75 71 76 - #ifdef CONFIG_PCI 77 - for_each_compatible_node(np, "pci", "fsl,mpc8540-pci") 78 - fsl_add_bridge(np, 1); 79 - #endif 72 + fsl_pci_assign_primary(); 80 73 } 81 74 82 - machine_device_initcall(socrates, mpc85xx_common_publish_devices); 75 + machine_arch_initcall(socrates, mpc85xx_common_publish_devices); 83 76 84 77 /* 85 78 * Called very early, device-tree isn't unflattened
+3 -10
arch/powerpc/platforms/85xx/stx_gp3.c
··· 60 60 */ 61 61 static void __init stx_gp3_setup_arch(void) 62 62 { 63 - #ifdef CONFIG_PCI 64 - struct device_node *np; 65 - #endif 66 - 67 63 if (ppc_md.progress) 68 64 ppc_md.progress("stx_gp3_setup_arch()", 0); 69 65 66 + fsl_pci_assign_primary(); 67 + 70 68 #ifdef CONFIG_CPM2 71 69 cpm2_reset(); 72 - #endif 73 - 74 - #ifdef CONFIG_PCI 75 - for_each_compatible_node(np, "pci", "fsl,mpc8540-pci") 76 - fsl_add_bridge(np, 1); 77 70 #endif 78 71 } 79 72 ··· 86 93 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 87 94 } 88 95 89 - machine_device_initcall(stx_gp3, mpc85xx_common_publish_devices); 96 + machine_arch_initcall(stx_gp3, mpc85xx_common_publish_devices); 90 97 91 98 /* 92 99 * Called very early, device-tree isn't unflattened
+2 -19
arch/powerpc/platforms/85xx/tqm85xx.c
··· 59 59 */ 60 60 static void __init tqm85xx_setup_arch(void) 61 61 { 62 - #ifdef CONFIG_PCI 63 - struct device_node *np; 64 - #endif 65 - 66 62 if (ppc_md.progress) 67 63 ppc_md.progress("tqm85xx_setup_arch()", 0); 68 64 ··· 66 70 cpm2_reset(); 67 71 #endif 68 72 69 - #ifdef CONFIG_PCI 70 - for_each_node_by_type(np, "pci") { 71 - if (of_device_is_compatible(np, "fsl,mpc8540-pci") || 72 - of_device_is_compatible(np, "fsl,mpc8548-pcie")) { 73 - struct resource rsrc; 74 - if (!of_address_to_resource(np, 0, &rsrc)) { 75 - if ((rsrc.start & 0xfffff) == 0x8000) 76 - fsl_add_bridge(np, 1); 77 - else 78 - fsl_add_bridge(np, 0); 79 - } 80 - } 81 - } 82 - #endif 73 + fsl_pci_assign_primary(); 83 74 } 84 75 85 76 static void tqm85xx_show_cpuinfo(struct seq_file *m) ··· 106 123 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520, 107 124 tqm85xx_ti1520_fixup); 108 125 109 - machine_device_initcall(tqm85xx, mpc85xx_common_publish_devices); 126 + machine_arch_initcall(tqm85xx, mpc85xx_common_publish_devices); 110 127 111 128 static const char * const board[] __initconst = { 112 129 "tqc,tqm8540",
+8 -48
arch/powerpc/platforms/85xx/xes_mpc85xx.c
··· 111 111 } 112 112 } 113 113 114 - #ifdef CONFIG_PCI 115 - static int primary_phb_addr; 116 - #endif 117 - 118 114 /* 119 115 * Setup the architecture 120 116 */ 121 117 static void __init xes_mpc85xx_setup_arch(void) 122 118 { 123 - #ifdef CONFIG_PCI 124 - struct device_node *np; 125 - #endif 126 119 struct device_node *root; 127 120 const char *model = "Unknown"; 128 121 ··· 130 137 131 138 xes_mpc85xx_fixups(); 132 139 133 - #ifdef CONFIG_PCI 134 - for_each_node_by_type(np, "pci") { 135 - if (of_device_is_compatible(np, "fsl,mpc8540-pci") || 136 - of_device_is_compatible(np, "fsl,mpc8548-pcie")) { 137 - struct resource rsrc; 138 - of_address_to_resource(np, 0, &rsrc); 139 - if ((rsrc.start & 0xfffff) == primary_phb_addr) 140 - fsl_add_bridge(np, 1); 141 - else 142 - fsl_add_bridge(np, 0); 143 - } 144 - } 145 - #endif 146 - 147 140 mpc85xx_smp_init(); 141 + 142 + fsl_pci_assign_primary(); 148 143 } 149 144 150 - machine_device_initcall(xes_mpc8572, mpc85xx_common_publish_devices); 151 - machine_device_initcall(xes_mpc8548, mpc85xx_common_publish_devices); 152 - machine_device_initcall(xes_mpc8540, mpc85xx_common_publish_devices); 145 + machine_arch_initcall(xes_mpc8572, mpc85xx_common_publish_devices); 146 + machine_arch_initcall(xes_mpc8548, mpc85xx_common_publish_devices); 147 + machine_arch_initcall(xes_mpc8540, mpc85xx_common_publish_devices); 153 148 154 149 /* 155 150 * Called very early, device-tree isn't unflattened ··· 146 165 { 147 166 unsigned long root = of_get_flat_dt_root(); 148 167 149 - if (of_flat_dt_is_compatible(root, "xes,MPC8572")) { 150 - #ifdef CONFIG_PCI 151 - primary_phb_addr = 0x8000; 152 - #endif 153 - return 1; 154 - } else { 155 - return 0; 156 - } 168 + return of_flat_dt_is_compatible(root, "xes,MPC8572"); 157 169 } 158 170 159 171 static int __init xes_mpc8548_probe(void) 160 172 { 161 173 unsigned long root = of_get_flat_dt_root(); 162 174 163 - if (of_flat_dt_is_compatible(root, "xes,MPC8548")) { 164 - #ifdef CONFIG_PCI 165 - primary_phb_addr = 0xb000; 166 - #endif 167 - return 1; 168 - } else { 169 - return 0; 170 - } 175 + return of_flat_dt_is_compatible(root, "xes,MPC8548"); 171 176 } 172 177 173 178 static int __init xes_mpc8540_probe(void) 174 179 { 175 180 unsigned long root = of_get_flat_dt_root(); 176 181 177 - if (of_flat_dt_is_compatible(root, "xes,MPC8540")) { 178 - #ifdef CONFIG_PCI 179 - primary_phb_addr = 0xb000; 180 - #endif 181 - return 1; 182 - } else { 183 - return 0; 184 - } 182 + return of_flat_dt_is_compatible(root, "xes,MPC8540"); 185 183 } 186 184 187 185 define_machine(xes_mpc8572) {
+4 -8
arch/powerpc/platforms/86xx/gef_ppc9a.c
··· 73 73 static void __init gef_ppc9a_setup_arch(void) 74 74 { 75 75 struct device_node *regs; 76 - #ifdef CONFIG_PCI 77 - struct device_node *np; 78 - 79 - for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") { 80 - fsl_add_bridge(np, 1); 81 - } 82 - #endif 83 76 84 77 printk(KERN_INFO "GE Intelligent Platforms PPC9A 6U VME SBC\n"); 85 78 86 79 #ifdef CONFIG_SMP 87 80 mpc86xx_smp_init(); 88 81 #endif 82 + 83 + fsl_pci_assign_primary(); 89 84 90 85 /* Remap basic board registers */ 91 86 regs = of_find_compatible_node(NULL, NULL, "gef,ppc9a-fpga-regs"); ··· 216 221 static __initdata struct of_device_id of_bus_ids[] = { 217 222 { .compatible = "simple-bus", }, 218 223 { .compatible = "gianfar", }, 224 + { .compatible = "fsl,mpc8641-pcie", }, 219 225 {}, 220 226 }; 221 227 ··· 227 231 228 232 return 0; 229 233 } 230 - machine_device_initcall(gef_ppc9a, declare_of_platform_devices); 234 + machine_arch_initcall(gef_ppc9a, declare_of_platform_devices); 231 235 232 236 define_machine(gef_ppc9a) { 233 237 .name = "GE PPC9A",
+4 -9
arch/powerpc/platforms/86xx/gef_sbc310.c
··· 73 73 static void __init gef_sbc310_setup_arch(void) 74 74 { 75 75 struct device_node *regs; 76 - #ifdef CONFIG_PCI 77 - struct device_node *np; 78 - 79 - for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") { 80 - fsl_add_bridge(np, 1); 81 - } 82 - #endif 83 - 84 76 printk(KERN_INFO "GE Intelligent Platforms SBC310 6U VPX SBC\n"); 85 77 86 78 #ifdef CONFIG_SMP 87 79 mpc86xx_smp_init(); 88 80 #endif 81 + 82 + fsl_pci_assign_primary(); 89 83 90 84 /* Remap basic board registers */ 91 85 regs = of_find_compatible_node(NULL, NULL, "gef,fpga-regs"); ··· 203 209 static __initdata struct of_device_id of_bus_ids[] = { 204 210 { .compatible = "simple-bus", }, 205 211 { .compatible = "gianfar", }, 212 + { .compatible = "fsl,mpc8641-pcie", }, 206 213 {}, 207 214 }; 208 215 ··· 214 219 215 220 return 0; 216 221 } 217 - machine_device_initcall(gef_sbc310, declare_of_platform_devices); 222 + machine_arch_initcall(gef_sbc310, declare_of_platform_devices); 218 223 219 224 define_machine(gef_sbc310) { 220 225 .name = "GE SBC310",
+4 -8
arch/powerpc/platforms/86xx/gef_sbc610.c
··· 73 73 static void __init gef_sbc610_setup_arch(void) 74 74 { 75 75 struct device_node *regs; 76 - #ifdef CONFIG_PCI 77 - struct device_node *np; 78 - 79 - for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") { 80 - fsl_add_bridge(np, 1); 81 - } 82 - #endif 83 76 84 77 printk(KERN_INFO "GE Intelligent Platforms SBC610 6U VPX SBC\n"); 85 78 86 79 #ifdef CONFIG_SMP 87 80 mpc86xx_smp_init(); 88 81 #endif 82 + 83 + fsl_pci_assign_primary(); 89 84 90 85 /* Remap basic board registers */ 91 86 regs = of_find_compatible_node(NULL, NULL, "gef,fpga-regs"); ··· 193 198 static __initdata struct of_device_id of_bus_ids[] = { 194 199 { .compatible = "simple-bus", }, 195 200 { .compatible = "gianfar", }, 201 + { .compatible = "fsl,mpc8641-pcie", }, 196 202 {}, 197 203 }; 198 204 ··· 204 208 205 209 return 0; 206 210 } 207 - machine_device_initcall(gef_sbc610, declare_of_platform_devices); 211 + machine_arch_initcall(gef_sbc610, declare_of_platform_devices); 208 212 209 213 define_machine(gef_sbc610) { 210 214 .name = "GE SBC610",
+6 -15
arch/powerpc/platforms/86xx/mpc8610_hpcd.c
··· 91 91 { .compatible = "simple-bus", }, 92 92 /* So that the DMA channel nodes can be probed individually: */ 93 93 { .compatible = "fsl,eloplus-dma", }, 94 + /* PCI controllers */ 95 + { .compatible = "fsl,mpc8610-pci", }, 96 + { .compatible = "fsl,mpc8641-pcie", }, 94 97 {} 95 98 }; 96 99 ··· 110 107 111 108 return 0; 112 109 } 113 - machine_device_initcall(mpc86xx_hpcd, mpc8610_declare_of_platform_devices); 110 + machine_arch_initcall(mpc86xx_hpcd, mpc8610_declare_of_platform_devices); 114 111 115 112 #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 116 113 ··· 281 278 static void __init mpc86xx_hpcd_setup_arch(void) 282 279 { 283 280 struct resource r; 284 - struct device_node *np; 285 281 unsigned char *pixis; 286 282 287 283 if (ppc_md.progress) 288 284 ppc_md.progress("mpc86xx_hpcd_setup_arch()", 0); 289 285 290 - #ifdef CONFIG_PCI 291 - for_each_node_by_type(np, "pci") { 292 - if (of_device_is_compatible(np, "fsl,mpc8610-pci") 293 - || of_device_is_compatible(np, "fsl,mpc8641-pcie")) { 294 - struct resource rsrc; 295 - of_address_to_resource(np, 0, &rsrc); 296 - if ((rsrc.start & 0xfffff) == 0xa000) 297 - fsl_add_bridge(np, 1); 298 - else 299 - fsl_add_bridge(np, 0); 300 - } 301 - } 302 - #endif 286 + fsl_pci_assign_primary(); 287 + 303 288 #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) 304 289 diu_ops.get_pixel_format = mpc8610hpcd_get_pixel_format; 305 290 diu_ops.set_gamma_table = mpc8610hpcd_set_gamma_table;
+6 -36
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
··· 19 19 #include <linux/delay.h> 20 20 #include <linux/seq_file.h> 21 21 #include <linux/of_platform.h> 22 - #include <linux/memblock.h> 23 22 24 23 #include <asm/time.h> 25 24 #include <asm/machdep.h> ··· 50 51 static int mpc86xx_exclude_device(struct pci_controller *hose, 51 52 u_char bus, u_char devfn) 52 53 { 53 - struct device_node* node; 54 - struct resource rsrc; 55 - 56 - node = hose->dn; 57 - of_address_to_resource(node, 0, &rsrc); 58 - 59 - if ((rsrc.start & 0xfffff) == 0x8000) { 54 + if (hose->dn == fsl_pci_primary) 60 55 return uli_exclude_device(hose, bus, devfn); 61 - } 62 56 63 57 return PCIBIOS_SUCCESSFUL; 64 58 } ··· 61 69 static void __init 62 70 mpc86xx_hpcn_setup_arch(void) 63 71 { 64 - #ifdef CONFIG_PCI 65 - struct device_node *np; 66 - struct pci_controller *hose; 67 - #endif 68 - dma_addr_t max = 0xffffffff; 69 - 70 72 if (ppc_md.progress) 71 73 ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0); 72 74 73 75 #ifdef CONFIG_PCI 74 - for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") { 75 - struct resource rsrc; 76 - of_address_to_resource(np, 0, &rsrc); 77 - if ((rsrc.start & 0xfffff) == 0x8000) 78 - fsl_add_bridge(np, 1); 79 - else 80 - fsl_add_bridge(np, 0); 81 - hose = pci_find_hose_for_OF_device(np); 82 - max = min(max, hose->dma_window_base_cur + 83 - hose->dma_window_size); 84 - } 85 - 86 76 ppc_md.pci_exclude_device = mpc86xx_exclude_device; 87 - 88 77 #endif 89 78 90 79 printk("MPC86xx HPCN board from Freescale Semiconductor\n"); ··· 74 101 mpc86xx_smp_init(); 75 102 #endif 76 103 77 - #ifdef CONFIG_SWIOTLB 78 - if ((memblock_end_of_DRAM() - 1) > max) { 79 - ppc_swiotlb_enable = 1; 80 - set_pci_dma_ops(&swiotlb_dma_ops); 81 - ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 82 - } 83 - #endif 104 + fsl_pci_assign_primary(); 105 + 106 + swiotlb_detect_4g(); 84 107 } 85 108 86 109 ··· 131 162 { .compatible = "simple-bus", }, 132 163 { .compatible = "fsl,srio", }, 133 164 { .compatible = "gianfar", }, 165 + { .compatible = "fsl,mpc8641-pcie", }, 134 166 {}, 135 167 }; 136 168 ··· 141 171 142 172 return 0; 143 173 } 144 - machine_device_initcall(mpc86xx_hpcn, declare_of_platform_devices); 174 + machine_arch_initcall(mpc86xx_hpcn, declare_of_platform_devices); 145 175 machine_arch_initcall(mpc86xx_hpcn, swiotlb_setup_bus_notifier); 146 176 147 177 define_machine(mpc86xx_hpcn) {
+4 -10
arch/powerpc/platforms/86xx/sbc8641d.c
··· 38 38 static void __init 39 39 sbc8641_setup_arch(void) 40 40 { 41 - #ifdef CONFIG_PCI 42 - struct device_node *np; 43 - #endif 44 - 45 41 if (ppc_md.progress) 46 42 ppc_md.progress("sbc8641_setup_arch()", 0); 47 - 48 - #ifdef CONFIG_PCI 49 - for_each_compatible_node(np, "pci", "fsl,mpc8641-pcie") 50 - fsl_add_bridge(np, 0); 51 - #endif 52 43 53 44 printk("SBC8641 board from Wind River\n"); 54 45 55 46 #ifdef CONFIG_SMP 56 47 mpc86xx_smp_init(); 57 48 #endif 49 + 50 + fsl_pci_assign_primary(); 58 51 } 59 52 60 53 ··· 95 102 static __initdata struct of_device_id of_bus_ids[] = { 96 103 { .compatible = "simple-bus", }, 97 104 { .compatible = "gianfar", }, 105 + { .compatible = "fsl,mpc8641-pcie", }, 98 106 {}, 99 107 }; 100 108 ··· 105 111 106 112 return 0; 107 113 } 108 - machine_device_initcall(sbc8641, declare_of_platform_devices); 114 + machine_arch_initcall(sbc8641, declare_of_platform_devices); 109 115 110 116 define_machine(sbc8641) { 111 117 .name = "SBC8641D",
+2 -2
arch/powerpc/platforms/cell/beat.c
··· 136 136 return BEAT_NVRAM_SIZE; 137 137 } 138 138 139 - int beat_set_xdabr(unsigned long dabr) 139 + int beat_set_xdabr(unsigned long dabr, unsigned long dabrx) 140 140 { 141 - if (beat_set_dabr(dabr, DABRX_KERNEL | DABRX_USER)) 141 + if (beat_set_dabr(dabr, dabrx)) 142 142 return -1; 143 143 return 0; 144 144 }
+1 -1
arch/powerpc/platforms/cell/beat.h
··· 32 32 ssize_t beat_nvram_get_size(void); 33 33 ssize_t beat_nvram_read(char *, size_t, loff_t *); 34 34 ssize_t beat_nvram_write(char *, size_t, loff_t *); 35 - int beat_set_xdabr(unsigned long); 35 + int beat_set_xdabr(unsigned long, unsigned long); 36 36 void beat_power_save(void); 37 37 void beat_kexec_cpu_down(int, int); 38 38
+23 -22
arch/powerpc/platforms/cell/beat_htab.c
··· 88 88 } 89 89 90 90 static long beat_lpar_hpte_insert(unsigned long hpte_group, 91 - unsigned long va, unsigned long pa, 91 + unsigned long vpn, unsigned long pa, 92 92 unsigned long rflags, unsigned long vflags, 93 93 int psize, int ssize) 94 94 { ··· 103 103 "rflags=%lx, vflags=%lx, psize=%d)\n", 104 104 hpte_group, va, pa, rflags, vflags, psize); 105 105 106 - hpte_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M) | 106 + hpte_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M) | 107 107 vflags | HPTE_V_VALID; 108 108 hpte_r = hpte_encode_r(pa, psize) | rflags; 109 109 ··· 184 184 */ 185 185 static long beat_lpar_hpte_updatepp(unsigned long slot, 186 186 unsigned long newpp, 187 - unsigned long va, 187 + unsigned long vpn, 188 188 int psize, int ssize, int local) 189 189 { 190 190 unsigned long lpar_rc; 191 191 u64 dummy0, dummy1; 192 192 unsigned long want_v; 193 193 194 - want_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M); 194 + want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M); 195 195 196 196 DBG_LOW(" update: " 197 197 "avpnv=%016lx, slot=%016lx, psize: %d, newpp %016lx ... ", ··· 220 220 return 0; 221 221 } 222 222 223 - static long beat_lpar_hpte_find(unsigned long va, int psize) 223 + static long beat_lpar_hpte_find(unsigned long vpn, int psize) 224 224 { 225 225 unsigned long hash; 226 226 unsigned long i, j; 227 227 long slot; 228 228 unsigned long want_v, hpte_v; 229 229 230 - hash = hpt_hash(va, mmu_psize_defs[psize].shift, MMU_SEGSIZE_256M); 231 - want_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M); 230 + hash = hpt_hash(vpn, mmu_psize_defs[psize].shift, MMU_SEGSIZE_256M); 231 + want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M); 232 232 233 233 for (j = 0; j < 2; j++) { 234 234 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; ··· 255 255 unsigned long ea, 256 256 int psize, int ssize) 257 257 { 258 - unsigned long lpar_rc, slot, vsid, va; 258 + unsigned long vpn; 259 + unsigned long lpar_rc, slot, vsid; 259 260 u64 dummy0, dummy1; 260 261 261 262 vsid = get_kernel_vsid(ea, MMU_SEGSIZE_256M); 262 - va = (vsid << 28) | (ea & 0x0fffffff); 263 + vpn = hpt_vpn(ea, vsid, MMU_SEGSIZE_256M); 263 264 264 265 raw_spin_lock(&beat_htab_lock); 265 - slot = beat_lpar_hpte_find(va, psize); 266 + slot = beat_lpar_hpte_find(vpn, psize); 266 267 BUG_ON(slot == -1); 267 268 268 269 lpar_rc = beat_write_htab_entry(0, slot, 0, newpp, 0, 7, ··· 273 272 BUG_ON(lpar_rc != 0); 274 273 } 275 274 276 - static void beat_lpar_hpte_invalidate(unsigned long slot, unsigned long va, 275 + static void beat_lpar_hpte_invalidate(unsigned long slot, unsigned long vpn, 277 276 int psize, int ssize, int local) 278 277 { 279 278 unsigned long want_v; ··· 283 282 284 283 DBG_LOW(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n", 285 284 slot, va, psize, local); 286 - want_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M); 285 + want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M); 287 286 288 287 raw_spin_lock_irqsave(&beat_htab_lock, flags); 289 288 dummy1 = beat_lpar_hpte_getword0(slot); ··· 312 311 } 313 312 314 313 static long beat_lpar_hpte_insert_v3(unsigned long hpte_group, 315 - unsigned long va, unsigned long pa, 314 + unsigned long vpn, unsigned long pa, 316 315 unsigned long rflags, unsigned long vflags, 317 316 int psize, int ssize) 318 317 { ··· 323 322 return -1; 324 323 325 324 if (!(vflags & HPTE_V_BOLTED)) 326 - DBG_LOW("hpte_insert(group=%lx, va=%016lx, pa=%016lx, " 325 + DBG_LOW("hpte_insert(group=%lx, vpn=%016lx, pa=%016lx, " 327 326 "rflags=%lx, vflags=%lx, psize=%d)\n", 328 - hpte_group, va, pa, rflags, vflags, psize); 327 + hpte_group, vpn, pa, rflags, vflags, psize); 329 328 330 - hpte_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M) | 329 + hpte_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M) | 331 330 vflags | HPTE_V_VALID; 332 331 hpte_r = hpte_encode_r(pa, psize) | rflags; 333 332 ··· 365 364 */ 366 365 static long beat_lpar_hpte_updatepp_v3(unsigned long slot, 367 366 unsigned long newpp, 368 - unsigned long va, 367 + unsigned long vpn, 369 368 int psize, int ssize, int local) 370 369 { 371 370 unsigned long lpar_rc; 372 371 unsigned long want_v; 373 372 unsigned long pss; 374 373 375 - want_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M); 374 + want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M); 376 375 pss = (psize == MMU_PAGE_4K) ? -1UL : mmu_psize_defs[psize].penc; 377 376 378 377 DBG_LOW(" update: " ··· 393 392 return 0; 394 393 } 395 394 396 - static void beat_lpar_hpte_invalidate_v3(unsigned long slot, unsigned long va, 395 + static void beat_lpar_hpte_invalidate_v3(unsigned long slot, unsigned long vpn, 397 396 int psize, int ssize, int local) 398 397 { 399 398 unsigned long want_v; 400 399 unsigned long lpar_rc; 401 400 unsigned long pss; 402 401 403 - DBG_LOW(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n", 404 - slot, va, psize, local); 405 - want_v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M); 402 + DBG_LOW(" inval : slot=%lx, vpn=%016lx, psize: %d, local: %d\n", 403 + slot, vpn, psize, local); 404 + want_v = hpte_encode_v(vpn, psize, MMU_SEGSIZE_256M); 406 405 pss = (psize == MMU_PAGE_4K) ? -1UL : mmu_psize_defs[psize].penc; 407 406 408 407 lpar_rc = beat_invalidate_htab_entry3(0, slot, want_v, pss);
+3 -3
arch/powerpc/platforms/pasemi/iommu.c
··· 19 19 20 20 #undef DEBUG 21 21 22 + #include <linux/memblock.h> 22 23 #include <linux/types.h> 23 24 #include <linux/spinlock.h> 24 25 #include <linux/pci.h> 25 26 #include <asm/iommu.h> 26 27 #include <asm/machdep.h> 27 - #include <asm/abs_addr.h> 28 28 #include <asm/firmware.h> 29 29 30 30 #define IOBMAP_PAGE_SHIFT 12 ··· 99 99 ip = ((u32 *)tbl->it_base) + index; 100 100 101 101 while (npages--) { 102 - rpn = virt_to_abs(uaddr) >> IOBMAP_PAGE_SHIFT; 102 + rpn = __pa(uaddr) >> IOBMAP_PAGE_SHIFT; 103 103 104 104 *(ip++) = IOBMAP_L2E_V | rpn; 105 105 /* invalidate tlb, can be optimized more */ ··· 258 258 return; 259 259 #endif 260 260 /* For 2G space, 8x64 pages (2^21 bytes) is max total l2 size */ 261 - iob_l2_base = (u32 *)abs_to_virt(memblock_alloc_base(1UL<<21, 1UL<<21, 0x80000000)); 261 + iob_l2_base = (u32 *)__va(memblock_alloc_base(1UL<<21, 1UL<<21, 0x80000000)); 262 262 263 263 printk(KERN_INFO "IOBMAP L2 allocated at: %p\n", iob_l2_base); 264 264 }
+183 -516
arch/powerpc/platforms/powernv/pci-ioda.c
··· 30 30 #include <asm/opal.h> 31 31 #include <asm/iommu.h> 32 32 #include <asm/tce.h> 33 - #include <asm/abs_addr.h> 34 33 35 34 #include "powernv.h" 36 35 #include "pci.h" 37 - 38 - struct resource_wrap { 39 - struct list_head link; 40 - resource_size_t size; 41 - resource_size_t align; 42 - struct pci_dev *dev; /* Set if it's a device */ 43 - struct pci_bus *bus; /* Set if it's a bridge */ 44 - }; 45 36 46 37 static int __pe_printk(const char *level, const struct pnv_ioda_pe *pe, 47 38 struct va_format *vaf) ··· 69 78 define_pe_printk_level(pe_warn, KERN_WARNING); 70 79 define_pe_printk_level(pe_info, KERN_INFO); 71 80 72 - 73 - /* Calculate resource usage & alignment requirement of a single 74 - * device. This will also assign all resources within the device 75 - * for a given type starting at 0 for the biggest one and then 76 - * assigning in decreasing order of size. 77 - */ 78 - static void __devinit pnv_ioda_calc_dev(struct pci_dev *dev, unsigned int flags, 79 - resource_size_t *size, 80 - resource_size_t *align) 81 - { 82 - resource_size_t start; 83 - struct resource *r; 84 - int i; 85 - 86 - pr_devel(" -> CDR %s\n", pci_name(dev)); 87 - 88 - *size = *align = 0; 89 - 90 - /* Clear the resources out and mark them all unset */ 91 - for (i = 0; i <= PCI_ROM_RESOURCE; i++) { 92 - r = &dev->resource[i]; 93 - if (!(r->flags & flags)) 94 - continue; 95 - if (r->start) { 96 - r->end -= r->start; 97 - r->start = 0; 98 - } 99 - r->flags |= IORESOURCE_UNSET; 100 - } 101 - 102 - /* We currently keep all memory resources together, we 103 - * will handle prefetch & 64-bit separately in the future 104 - * but for now we stick everybody in M32 105 - */ 106 - start = 0; 107 - for (;;) { 108 - resource_size_t max_size = 0; 109 - int max_no = -1; 110 - 111 - /* Find next biggest resource */ 112 - for (i = 0; i <= PCI_ROM_RESOURCE; i++) { 113 - r = &dev->resource[i]; 114 - if (!(r->flags & IORESOURCE_UNSET) || 115 - !(r->flags & flags)) 116 - continue; 117 - if (resource_size(r) > max_size) { 118 - max_size = resource_size(r); 119 - max_no = i; 120 - } 121 - } 122 - if (max_no < 0) 123 - break; 124 - r = &dev->resource[max_no]; 125 - if (max_size > *align) 126 - *align = max_size; 127 - *size += max_size; 128 - r->start = start; 129 - start += max_size; 130 - r->end = r->start + max_size - 1; 131 - r->flags &= ~IORESOURCE_UNSET; 132 - pr_devel(" -> R%d %016llx..%016llx\n", 133 - max_no, r->start, r->end); 134 - } 135 - pr_devel(" <- CDR %s size=%llx align=%llx\n", 136 - pci_name(dev), *size, *align); 137 - } 138 - 139 - /* Allocate a resource "wrap" for a given device or bridge and 140 - * insert it at the right position in the sorted list 141 - */ 142 - static void __devinit pnv_ioda_add_wrap(struct list_head *list, 143 - struct pci_bus *bus, 144 - struct pci_dev *dev, 145 - resource_size_t size, 146 - resource_size_t align) 147 - { 148 - struct resource_wrap *w1, *w = kzalloc(sizeof(*w), GFP_KERNEL); 149 - 150 - w->size = size; 151 - w->align = align; 152 - w->dev = dev; 153 - w->bus = bus; 154 - 155 - list_for_each_entry(w1, list, link) { 156 - if (w1->align < align) { 157 - list_add_tail(&w->link, &w1->link); 158 - return; 159 - } 160 - } 161 - list_add_tail(&w->link, list); 162 - } 163 - 164 - /* Offset device resources of a given type */ 165 - static void __devinit pnv_ioda_offset_dev(struct pci_dev *dev, 166 - unsigned int flags, 167 - resource_size_t offset) 168 - { 169 - struct resource *r; 170 - int i; 171 - 172 - pr_devel(" -> ODR %s [%x] +%016llx\n", pci_name(dev), flags, offset); 173 - 174 - for (i = 0; i <= PCI_ROM_RESOURCE; i++) { 175 - r = &dev->resource[i]; 176 - if (r->flags & flags) { 177 - dev->resource[i].start += offset; 178 - dev->resource[i].end += offset; 179 - } 180 - } 181 - 182 - pr_devel(" <- ODR %s [%x] +%016llx\n", pci_name(dev), flags, offset); 183 - } 184 - 185 - /* Offset bus resources (& all children) of a given type */ 186 - static void __devinit pnv_ioda_offset_bus(struct pci_bus *bus, 187 - unsigned int flags, 188 - resource_size_t offset) 189 - { 190 - struct resource *r; 191 - struct pci_dev *dev; 192 - struct pci_bus *cbus; 193 - int i; 194 - 195 - pr_devel(" -> OBR %s [%x] +%016llx\n", 196 - bus->self ? pci_name(bus->self) : "root", flags, offset); 197 - 198 - pci_bus_for_each_resource(bus, r, i) { 199 - if (r && (r->flags & flags)) { 200 - r->start += offset; 201 - r->end += offset; 202 - } 203 - } 204 - list_for_each_entry(dev, &bus->devices, bus_list) 205 - pnv_ioda_offset_dev(dev, flags, offset); 206 - list_for_each_entry(cbus, &bus->children, node) 207 - pnv_ioda_offset_bus(cbus, flags, offset); 208 - 209 - pr_devel(" <- OBR %s [%x]\n", 210 - bus->self ? pci_name(bus->self) : "root", flags); 211 - } 212 - 213 - /* This is the guts of our IODA resource allocation. This is called 214 - * recursively for each bus in the system. It calculates all the 215 - * necessary size and requirements for children and assign them 216 - * resources such that: 217 - * 218 - * - Each function fits in it's own contiguous set of IO/M32 219 - * segment 220 - * 221 - * - All segments behind a P2P bridge are contiguous and obey 222 - * alignment constraints of those bridges 223 - */ 224 - static void __devinit pnv_ioda_calc_bus(struct pci_bus *bus, unsigned int flags, 225 - resource_size_t *size, 226 - resource_size_t *align) 227 - { 228 - struct pci_controller *hose = pci_bus_to_host(bus); 229 - struct pnv_phb *phb = hose->private_data; 230 - resource_size_t dev_size, dev_align, start; 231 - resource_size_t min_align, min_balign; 232 - struct pci_dev *cdev; 233 - struct pci_bus *cbus; 234 - struct list_head head; 235 - struct resource_wrap *w; 236 - unsigned int bres; 237 - 238 - *size = *align = 0; 239 - 240 - pr_devel("-> CBR %s [%x]\n", 241 - bus->self ? pci_name(bus->self) : "root", flags); 242 - 243 - /* Calculate alignment requirements based on the type 244 - * of resource we are working on 245 - */ 246 - if (flags & IORESOURCE_IO) { 247 - bres = 0; 248 - min_align = phb->ioda.io_segsize; 249 - min_balign = 0x1000; 250 - } else { 251 - bres = 1; 252 - min_align = phb->ioda.m32_segsize; 253 - min_balign = 0x100000; 254 - } 255 - 256 - /* Gather all our children resources ordered by alignment */ 257 - INIT_LIST_HEAD(&head); 258 - 259 - /* - Busses */ 260 - list_for_each_entry(cbus, &bus->children, node) { 261 - pnv_ioda_calc_bus(cbus, flags, &dev_size, &dev_align); 262 - pnv_ioda_add_wrap(&head, cbus, NULL, dev_size, dev_align); 263 - } 264 - 265 - /* - Devices */ 266 - list_for_each_entry(cdev, &bus->devices, bus_list) { 267 - pnv_ioda_calc_dev(cdev, flags, &dev_size, &dev_align); 268 - /* Align them to segment size */ 269 - if (dev_align < min_align) 270 - dev_align = min_align; 271 - pnv_ioda_add_wrap(&head, NULL, cdev, dev_size, dev_align); 272 - } 273 - if (list_empty(&head)) 274 - goto empty; 275 - 276 - /* Now we can do two things: assign offsets to them within that 277 - * level and get our total alignment & size requirements. The 278 - * assignment algorithm is going to be uber-trivial for now, we 279 - * can try to be smarter later at filling out holes. 280 - */ 281 - if (bus->self) { 282 - /* No offset for downstream bridges */ 283 - start = 0; 284 - } else { 285 - /* Offset from the root */ 286 - if (flags & IORESOURCE_IO) 287 - /* Don't hand out IO 0 */ 288 - start = hose->io_resource.start + 0x1000; 289 - else 290 - start = hose->mem_resources[0].start; 291 - } 292 - while(!list_empty(&head)) { 293 - w = list_first_entry(&head, struct resource_wrap, link); 294 - list_del(&w->link); 295 - if (w->size) { 296 - if (start) { 297 - start = ALIGN(start, w->align); 298 - if (w->dev) 299 - pnv_ioda_offset_dev(w->dev,flags,start); 300 - else if (w->bus) 301 - pnv_ioda_offset_bus(w->bus,flags,start); 302 - } 303 - if (w->align > *align) 304 - *align = w->align; 305 - } 306 - start += w->size; 307 - kfree(w); 308 - } 309 - *size = start; 310 - 311 - /* Align and setup bridge resources */ 312 - *align = max_t(resource_size_t, *align, 313 - max_t(resource_size_t, min_align, min_balign)); 314 - *size = ALIGN(*size, 315 - max_t(resource_size_t, min_align, min_balign)); 316 - empty: 317 - /* Only setup P2P's, not the PHB itself */ 318 - if (bus->self) { 319 - struct resource *res = bus->resource[bres]; 320 - 321 - if (WARN_ON(res == NULL)) 322 - return; 323 - 324 - /* 325 - * FIXME: We should probably export and call 326 - * pci_bridge_check_ranges() to properly re-initialize 327 - * the PCI portion of the flags here, and to detect 328 - * what the bridge actually supports. 329 - */ 330 - res->start = 0; 331 - res->flags = (*size) ? flags : 0; 332 - res->end = (*size) ? (*size - 1) : 0; 333 - } 334 - 335 - pr_devel("<- CBR %s [%x] *size=%016llx *align=%016llx\n", 336 - bus->self ? pci_name(bus->self) : "root", flags,*size,*align); 337 - } 338 - 339 81 static struct pci_dn *pnv_ioda_get_pdn(struct pci_dev *dev) 340 82 { 341 83 struct device_node *np; ··· 77 353 if (!np) 78 354 return NULL; 79 355 return PCI_DN(np); 80 - } 81 - 82 - static void __devinit pnv_ioda_setup_pe_segments(struct pci_dev *dev) 83 - { 84 - struct pci_controller *hose = pci_bus_to_host(dev->bus); 85 - struct pnv_phb *phb = hose->private_data; 86 - struct pci_dn *pdn = pnv_ioda_get_pdn(dev); 87 - unsigned int pe, i; 88 - resource_size_t pos; 89 - struct resource io_res; 90 - struct resource m32_res; 91 - struct pci_bus_region region; 92 - int rc; 93 - 94 - /* Anything not referenced in the device-tree gets PE#0 */ 95 - pe = pdn ? pdn->pe_number : 0; 96 - 97 - /* Calculate the device min/max */ 98 - io_res.start = m32_res.start = (resource_size_t)-1; 99 - io_res.end = m32_res.end = 0; 100 - io_res.flags = IORESOURCE_IO; 101 - m32_res.flags = IORESOURCE_MEM; 102 - 103 - for (i = 0; i <= PCI_ROM_RESOURCE; i++) { 104 - struct resource *r = NULL; 105 - if (dev->resource[i].flags & IORESOURCE_IO) 106 - r = &io_res; 107 - if (dev->resource[i].flags & IORESOURCE_MEM) 108 - r = &m32_res; 109 - if (!r) 110 - continue; 111 - if (dev->resource[i].start < r->start) 112 - r->start = dev->resource[i].start; 113 - if (dev->resource[i].end > r->end) 114 - r->end = dev->resource[i].end; 115 - } 116 - 117 - /* Setup IO segments */ 118 - if (io_res.start < io_res.end) { 119 - pcibios_resource_to_bus(dev, &region, &io_res); 120 - pos = region.start; 121 - i = pos / phb->ioda.io_segsize; 122 - while(i < phb->ioda.total_pe && pos <= region.end) { 123 - if (phb->ioda.io_segmap[i]) { 124 - pr_err("%s: Trying to use IO seg #%d which is" 125 - " already used by PE# %d\n", 126 - pci_name(dev), i, 127 - phb->ioda.io_segmap[i]); 128 - /* XXX DO SOMETHING TO DISABLE DEVICE ? */ 129 - break; 130 - } 131 - phb->ioda.io_segmap[i] = pe; 132 - rc = opal_pci_map_pe_mmio_window(phb->opal_id, pe, 133 - OPAL_IO_WINDOW_TYPE, 134 - 0, i); 135 - if (rc != OPAL_SUCCESS) { 136 - pr_err("%s: OPAL error %d setting up mapping" 137 - " for IO seg# %d\n", 138 - pci_name(dev), rc, i); 139 - /* XXX DO SOMETHING TO DISABLE DEVICE ? */ 140 - break; 141 - } 142 - pos += phb->ioda.io_segsize; 143 - i++; 144 - }; 145 - } 146 - 147 - /* Setup M32 segments */ 148 - if (m32_res.start < m32_res.end) { 149 - pcibios_resource_to_bus(dev, &region, &m32_res); 150 - pos = region.start; 151 - i = pos / phb->ioda.m32_segsize; 152 - while(i < phb->ioda.total_pe && pos <= region.end) { 153 - if (phb->ioda.m32_segmap[i]) { 154 - pr_err("%s: Trying to use M32 seg #%d which is" 155 - " already used by PE# %d\n", 156 - pci_name(dev), i, 157 - phb->ioda.m32_segmap[i]); 158 - /* XXX DO SOMETHING TO DISABLE DEVICE ? */ 159 - break; 160 - } 161 - phb->ioda.m32_segmap[i] = pe; 162 - rc = opal_pci_map_pe_mmio_window(phb->opal_id, pe, 163 - OPAL_M32_WINDOW_TYPE, 164 - 0, i); 165 - if (rc != OPAL_SUCCESS) { 166 - pr_err("%s: OPAL error %d setting up mapping" 167 - " for M32 seg# %d\n", 168 - pci_name(dev), rc, i); 169 - /* XXX DO SOMETHING TO DISABLE DEVICE ? */ 170 - break; 171 - } 172 - pos += phb->ioda.m32_segsize; 173 - i++; 174 - } 175 - } 176 - } 177 - 178 - /* Check if a resource still fits in the total IO or M32 range 179 - * for a given PHB 180 - */ 181 - static int __devinit pnv_ioda_resource_fit(struct pci_controller *hose, 182 - struct resource *r) 183 - { 184 - struct resource *bounds; 185 - 186 - if (r->flags & IORESOURCE_IO) 187 - bounds = &hose->io_resource; 188 - else if (r->flags & IORESOURCE_MEM) 189 - bounds = &hose->mem_resources[0]; 190 - else 191 - return 1; 192 - 193 - if (r->start >= bounds->start && r->end <= bounds->end) 194 - return 1; 195 - r->flags = 0; 196 - return 0; 197 - } 198 - 199 - static void __devinit pnv_ioda_update_resources(struct pci_bus *bus) 200 - { 201 - struct pci_controller *hose = pci_bus_to_host(bus); 202 - struct pci_bus *cbus; 203 - struct pci_dev *cdev; 204 - unsigned int i; 205 - 206 - /* We used to clear all device enables here. However it looks like 207 - * clearing MEM enable causes Obsidian (IPR SCS) to go bonkers, 208 - * and shoot fatal errors to the PHB which in turns fences itself 209 - * and we can't recover from that ... yet. So for now, let's leave 210 - * the enables as-is and hope for the best. 211 - */ 212 - 213 - /* Check if bus resources fit in our IO or M32 range */ 214 - for (i = 0; bus->self && (i < 2); i++) { 215 - struct resource *r = bus->resource[i]; 216 - if (r && !pnv_ioda_resource_fit(hose, r)) 217 - pr_err("%s: Bus %d resource %d disabled, no room\n", 218 - pci_name(bus->self), bus->number, i); 219 - } 220 - 221 - /* Update self if it's not a PHB */ 222 - if (bus->self) 223 - pci_setup_bridge(bus); 224 - 225 - /* Update child devices */ 226 - list_for_each_entry(cdev, &bus->devices, bus_list) { 227 - /* Check if resource fits, if not, disabled it */ 228 - for (i = 0; i <= PCI_ROM_RESOURCE; i++) { 229 - struct resource *r = &cdev->resource[i]; 230 - if (!pnv_ioda_resource_fit(hose, r)) 231 - pr_err("%s: Resource %d disabled, no room\n", 232 - pci_name(cdev), i); 233 - } 234 - 235 - /* Assign segments */ 236 - pnv_ioda_setup_pe_segments(cdev); 237 - 238 - /* Update HW BARs */ 239 - for (i = 0; i <= PCI_ROM_RESOURCE; i++) 240 - pci_update_resource(cdev, i); 241 - } 242 - 243 - /* Update child busses */ 244 - list_for_each_entry(cbus, &bus->children, node) 245 - pnv_ioda_update_resources(cbus); 246 356 } 247 357 248 358 static int __devinit pnv_ioda_alloc_pe(struct pnv_phb *phb) ··· 106 548 * but in the meantime, we need to protect them to avoid warnings 107 549 */ 108 550 #ifdef CONFIG_PCI_MSI 109 - static struct pnv_ioda_pe * __devinit __pnv_ioda_get_one_pe(struct pci_dev *dev) 551 + static struct pnv_ioda_pe * __devinit pnv_ioda_get_pe(struct pci_dev *dev) 110 552 { 111 553 struct pci_controller *hose = pci_bus_to_host(dev->bus); 112 554 struct pnv_phb *phb = hose->private_data; ··· 117 559 if (pdn->pe_number == IODA_INVALID_PE) 118 560 return NULL; 119 561 return &phb->ioda.pe_array[pdn->pe_number]; 120 - } 121 - 122 - static struct pnv_ioda_pe * __devinit pnv_ioda_get_pe(struct pci_dev *dev) 123 - { 124 - struct pnv_ioda_pe *pe = __pnv_ioda_get_one_pe(dev); 125 - 126 - while (!pe && dev->bus->self) { 127 - dev = dev->bus->self; 128 - pe = __pnv_ioda_get_one_pe(dev); 129 - if (pe) 130 - pe = pe->bus_pe; 131 - } 132 - return pe; 133 562 } 134 563 #endif /* CONFIG_PCI_MSI */ 135 564 ··· 134 589 dcomp = OPAL_IGNORE_RID_DEVICE_NUMBER; 135 590 fcomp = OPAL_IGNORE_RID_FUNCTION_NUMBER; 136 591 parent = pe->pbus->self; 137 - count = pe->pbus->busn_res.end - pe->pbus->busn_res.start + 1; 592 + if (pe->flags & PNV_IODA_PE_BUS_ALL) 593 + count = pe->pbus->busn_res.end - pe->pbus->busn_res.start + 1; 594 + else 595 + count = 1; 596 + 138 597 switch(count) { 139 598 case 1: bcomp = OpalPciBusAll; break; 140 599 case 2: bcomp = OpalPciBus7Bits; break; ··· 215 666 { 216 667 struct pnv_ioda_pe *lpe; 217 668 218 - list_for_each_entry(lpe, &phb->ioda.pe_list, link) { 669 + list_for_each_entry(lpe, &phb->ioda.pe_dma_list, dma_link) { 219 670 if (lpe->dma_weight < pe->dma_weight) { 220 - list_add_tail(&pe->link, &lpe->link); 671 + list_add_tail(&pe->dma_link, &lpe->dma_link); 221 672 return; 222 673 } 223 674 } 224 - list_add_tail(&pe->link, &phb->ioda.pe_list); 675 + list_add_tail(&pe->dma_link, &phb->ioda.pe_dma_list); 225 676 } 226 677 227 678 static unsigned int pnv_ioda_dma_weight(struct pci_dev *dev) ··· 248 699 return 10; 249 700 } 250 701 702 + #if 0 251 703 static struct pnv_ioda_pe * __devinit pnv_ioda_setup_dev_PE(struct pci_dev *dev) 252 704 { 253 705 struct pci_controller *hose = pci_bus_to_host(dev->bus); ··· 317 767 318 768 return pe; 319 769 } 770 + #endif /* Useful for SRIOV case */ 320 771 321 772 static void pnv_ioda_setup_same_PE(struct pci_bus *bus, struct pnv_ioda_pe *pe) 322 773 { ··· 335 784 pdn->pcidev = dev; 336 785 pdn->pe_number = pe->pe_number; 337 786 pe->dma_weight += pnv_ioda_dma_weight(dev); 338 - if (dev->subordinate) 787 + if ((pe->flags & PNV_IODA_PE_BUS_ALL) && dev->subordinate) 339 788 pnv_ioda_setup_same_PE(dev->subordinate, pe); 340 789 } 341 790 } 342 791 343 - static void __devinit pnv_ioda_setup_bus_PE(struct pci_dev *dev, 344 - struct pnv_ioda_pe *ppe) 792 + /* 793 + * There're 2 types of PCI bus sensitive PEs: One that is compromised of 794 + * single PCI bus. Another one that contains the primary PCI bus and its 795 + * subordinate PCI devices and buses. The second type of PE is normally 796 + * orgiriated by PCIe-to-PCI bridge or PLX switch downstream ports. 797 + */ 798 + static void __devinit pnv_ioda_setup_bus_PE(struct pci_bus *bus, int all) 345 799 { 346 - struct pci_controller *hose = pci_bus_to_host(dev->bus); 800 + struct pci_controller *hose = pci_bus_to_host(bus); 347 801 struct pnv_phb *phb = hose->private_data; 348 - struct pci_bus *bus = dev->subordinate; 349 802 struct pnv_ioda_pe *pe; 350 803 int pe_num; 351 804 352 - if (!bus) { 353 - pr_warning("%s: Bridge without a subordinate bus !\n", 354 - pci_name(dev)); 355 - return; 356 - } 357 805 pe_num = pnv_ioda_alloc_pe(phb); 358 806 if (pe_num == IODA_INVALID_PE) { 359 - pr_warning("%s: Not enough PE# available, disabling bus\n", 360 - pci_name(dev)); 807 + pr_warning("%s: Not enough PE# available for PCI bus %04x:%02x\n", 808 + __func__, pci_domain_nr(bus), bus->number); 361 809 return; 362 810 } 363 811 364 812 pe = &phb->ioda.pe_array[pe_num]; 365 - ppe->bus_pe = pe; 813 + pe->flags = (all ? PNV_IODA_PE_BUS_ALL : PNV_IODA_PE_BUS); 366 814 pe->pbus = bus; 367 815 pe->pdev = NULL; 368 816 pe->tce32_seg = -1; ··· 369 819 pe->rid = bus->busn_res.start << 8; 370 820 pe->dma_weight = 0; 371 821 372 - pe_info(pe, "Secondary busses %pR associated with PE\n", 373 - &bus->busn_res); 822 + if (all) 823 + pe_info(pe, "Secondary bus %d..%d associated with PE#%d\n", 824 + bus->busn_res.start, bus->busn_res.end, pe_num); 825 + else 826 + pe_info(pe, "Secondary bus %d associated with PE#%d\n", 827 + bus->busn_res.start, pe_num); 374 828 375 829 if (pnv_ioda_configure_pe(phb, pe)) { 376 830 /* XXX What do we do here ? */ ··· 386 832 387 833 /* Associate it with all child devices */ 388 834 pnv_ioda_setup_same_PE(bus, pe); 835 + 836 + /* Put PE to the list */ 837 + list_add_tail(&pe->list, &phb->ioda.pe_list); 389 838 390 839 /* Account for one DMA PE if at least one DMA capable device exist 391 840 * below the bridge ··· 405 848 static void __devinit pnv_ioda_setup_PEs(struct pci_bus *bus) 406 849 { 407 850 struct pci_dev *dev; 408 - struct pnv_ioda_pe *pe; 851 + 852 + pnv_ioda_setup_bus_PE(bus, 0); 409 853 410 854 list_for_each_entry(dev, &bus->devices, bus_list) { 411 - pe = pnv_ioda_setup_dev_PE(dev); 412 - if (pe == NULL) 413 - continue; 414 - /* Leaving the PCIe domain ... single PE# */ 415 - if (pci_pcie_type(dev) == PCI_EXP_TYPE_PCI_BRIDGE) 416 - pnv_ioda_setup_bus_PE(dev, pe); 417 - else if (dev->subordinate) 418 - pnv_ioda_setup_PEs(dev->subordinate); 855 + if (dev->subordinate) { 856 + if (pci_pcie_type(dev) == PCI_EXP_TYPE_PCI_BRIDGE) 857 + pnv_ioda_setup_bus_PE(dev->subordinate, 1); 858 + else 859 + pnv_ioda_setup_PEs(dev->subordinate); 860 + } 861 + } 862 + } 863 + 864 + /* 865 + * Configure PEs so that the downstream PCI buses and devices 866 + * could have their associated PE#. Unfortunately, we didn't 867 + * figure out the way to identify the PLX bridge yet. So we 868 + * simply put the PCI bus and the subordinate behind the root 869 + * port to PE# here. The game rule here is expected to be changed 870 + * as soon as we can detected PLX bridge correctly. 871 + */ 872 + static void __devinit pnv_pci_ioda_setup_PEs(void) 873 + { 874 + struct pci_controller *hose, *tmp; 875 + 876 + list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 877 + pnv_ioda_setup_PEs(hose->bus); 419 878 } 420 879 } 421 880 ··· 573 1000 remaining = phb->ioda.tce32_count; 574 1001 tw = phb->ioda.dma_weight; 575 1002 base = 0; 576 - list_for_each_entry(pe, &phb->ioda.pe_list, link) { 1003 + list_for_each_entry(pe, &phb->ioda.pe_dma_list, dma_link) { 577 1004 if (!pe->dma_weight) 578 1005 continue; 579 1006 if (!remaining) { ··· 682 1109 static void pnv_pci_init_ioda_msis(struct pnv_phb *phb) { } 683 1110 #endif /* CONFIG_PCI_MSI */ 684 1111 685 - /* This is the starting point of our IODA specific resource 686 - * allocation process 1112 + /* 1113 + * This function is supposed to be called on basis of PE from top 1114 + * to bottom style. So the the I/O or MMIO segment assigned to 1115 + * parent PE could be overrided by its child PEs if necessary. 687 1116 */ 688 - static void __devinit pnv_pci_ioda_fixup_phb(struct pci_controller *hose) 1117 + static void __devinit pnv_ioda_setup_pe_seg(struct pci_controller *hose, 1118 + struct pnv_ioda_pe *pe) 689 1119 { 690 - resource_size_t size, align; 691 - struct pci_bus *child; 1120 + struct pnv_phb *phb = hose->private_data; 1121 + struct pci_bus_region region; 1122 + struct resource *res; 1123 + int i, index; 1124 + int rc; 692 1125 693 - /* Associate PEs per functions */ 694 - pnv_ioda_setup_PEs(hose->bus); 1126 + /* 1127 + * NOTE: We only care PCI bus based PE for now. For PCI 1128 + * device based PE, for example SRIOV sensitive VF should 1129 + * be figured out later. 1130 + */ 1131 + BUG_ON(!(pe->flags & (PNV_IODA_PE_BUS | PNV_IODA_PE_BUS_ALL))); 695 1132 696 - /* Calculate all resources */ 697 - pnv_ioda_calc_bus(hose->bus, IORESOURCE_IO, &size, &align); 698 - pnv_ioda_calc_bus(hose->bus, IORESOURCE_MEM, &size, &align); 699 - 700 - /* Apply then to HW */ 701 - pnv_ioda_update_resources(hose->bus); 702 - 703 - /* Setup DMA */ 704 - pnv_ioda_setup_dma(hose->private_data); 705 - 706 - /* Configure PCI Express settings */ 707 - list_for_each_entry(child, &hose->bus->children, node) { 708 - struct pci_dev *self = child->self; 709 - if (!self) 1133 + pci_bus_for_each_resource(pe->pbus, res, i) { 1134 + if (!res || !res->flags || 1135 + res->start > res->end) 710 1136 continue; 711 - pcie_bus_configure_settings(child, self->pcie_mpss); 1137 + 1138 + if (res->flags & IORESOURCE_IO) { 1139 + region.start = res->start - phb->ioda.io_pci_base; 1140 + region.end = res->end - phb->ioda.io_pci_base; 1141 + index = region.start / phb->ioda.io_segsize; 1142 + 1143 + while (index < phb->ioda.total_pe && 1144 + region.start <= region.end) { 1145 + phb->ioda.io_segmap[index] = pe->pe_number; 1146 + rc = opal_pci_map_pe_mmio_window(phb->opal_id, 1147 + pe->pe_number, OPAL_IO_WINDOW_TYPE, 0, index); 1148 + if (rc != OPAL_SUCCESS) { 1149 + pr_err("%s: OPAL error %d when mapping IO " 1150 + "segment #%d to PE#%d\n", 1151 + __func__, rc, index, pe->pe_number); 1152 + break; 1153 + } 1154 + 1155 + region.start += phb->ioda.io_segsize; 1156 + index++; 1157 + } 1158 + } else if (res->flags & IORESOURCE_MEM) { 1159 + region.start = res->start - 1160 + hose->pci_mem_offset - 1161 + phb->ioda.m32_pci_base; 1162 + region.end = res->end - 1163 + hose->pci_mem_offset - 1164 + phb->ioda.m32_pci_base; 1165 + index = region.start / phb->ioda.m32_segsize; 1166 + 1167 + while (index < phb->ioda.total_pe && 1168 + region.start <= region.end) { 1169 + phb->ioda.m32_segmap[index] = pe->pe_number; 1170 + rc = opal_pci_map_pe_mmio_window(phb->opal_id, 1171 + pe->pe_number, OPAL_M32_WINDOW_TYPE, 0, index); 1172 + if (rc != OPAL_SUCCESS) { 1173 + pr_err("%s: OPAL error %d when mapping M32 " 1174 + "segment#%d to PE#%d", 1175 + __func__, rc, index, pe->pe_number); 1176 + break; 1177 + } 1178 + 1179 + region.start += phb->ioda.m32_segsize; 1180 + index++; 1181 + } 1182 + } 712 1183 } 1184 + } 1185 + 1186 + static void __devinit pnv_pci_ioda_setup_seg(void) 1187 + { 1188 + struct pci_controller *tmp, *hose; 1189 + struct pnv_phb *phb; 1190 + struct pnv_ioda_pe *pe; 1191 + 1192 + list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 1193 + phb = hose->private_data; 1194 + list_for_each_entry(pe, &phb->ioda.pe_list, list) { 1195 + pnv_ioda_setup_pe_seg(hose, pe); 1196 + } 1197 + } 1198 + } 1199 + 1200 + static void __devinit pnv_pci_ioda_setup_DMA(void) 1201 + { 1202 + struct pci_controller *hose, *tmp; 1203 + struct pnv_phb *phb; 1204 + 1205 + list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 1206 + pnv_ioda_setup_dma(hose->private_data); 1207 + 1208 + /* Mark the PHB initialization done */ 1209 + phb = hose->private_data; 1210 + phb->initialized = 1; 1211 + } 1212 + } 1213 + 1214 + static void __devinit pnv_pci_ioda_fixup(void) 1215 + { 1216 + pnv_pci_ioda_setup_PEs(); 1217 + pnv_pci_ioda_setup_seg(); 1218 + pnv_pci_ioda_setup_DMA(); 713 1219 } 714 1220 715 1221 /* ··· 834 1182 */ 835 1183 static int __devinit pnv_pci_enable_device_hook(struct pci_dev *dev) 836 1184 { 837 - struct pci_dn *pdn = pnv_ioda_get_pdn(dev); 1185 + struct pci_controller *hose = pci_bus_to_host(dev->bus); 1186 + struct pnv_phb *phb = hose->private_data; 1187 + struct pci_dn *pdn; 838 1188 1189 + /* The function is probably called while the PEs have 1190 + * not be created yet. For example, resource reassignment 1191 + * during PCI probe period. We just skip the check if 1192 + * PEs isn't ready. 1193 + */ 1194 + if (!phb->initialized) 1195 + return 0; 1196 + 1197 + pdn = pnv_ioda_get_pdn(dev); 839 1198 if (!pdn || pdn->pe_number == IODA_INVALID_PE) 840 1199 return -EINVAL; 1200 + 841 1201 return 0; 842 1202 } 843 1203 ··· 940 1276 /* Allocate aux data & arrays */ 941 1277 size = _ALIGN_UP(phb->ioda.total_pe / 8, sizeof(unsigned long)); 942 1278 m32map_off = size; 943 - size += phb->ioda.total_pe; 1279 + size += phb->ioda.total_pe * sizeof(phb->ioda.m32_segmap[0]); 944 1280 iomap_off = size; 945 - size += phb->ioda.total_pe; 1281 + size += phb->ioda.total_pe * sizeof(phb->ioda.io_segmap[0]); 946 1282 pemap_off = size; 947 1283 size += phb->ioda.total_pe * sizeof(struct pnv_ioda_pe); 948 1284 aux = alloc_bootmem(size); ··· 953 1289 phb->ioda.pe_array = aux + pemap_off; 954 1290 set_bit(0, phb->ioda.pe_alloc); 955 1291 1292 + INIT_LIST_HEAD(&phb->ioda.pe_dma_list); 956 1293 INIT_LIST_HEAD(&phb->ioda.pe_list); 957 1294 958 1295 /* Calculate how many 32-bit TCE segments we have */ ··· 1002 1337 /* Setup MSI support */ 1003 1338 pnv_pci_init_ioda_msis(phb); 1004 1339 1005 - /* We set both PCI_PROBE_ONLY and PCI_REASSIGN_ALL_RSRC. This is an 1006 - * odd combination which essentially means that we skip all resource 1007 - * fixups and assignments in the generic code, and do it all 1008 - * ourselves here 1340 + /* 1341 + * We pass the PCI probe flag PCI_REASSIGN_ALL_RSRC here 1342 + * to let the PCI core do resource assignment. It's supposed 1343 + * that the PCI core will do correct I/O and MMIO alignment 1344 + * for the P2P bridge bars so that each PCI bus (excluding 1345 + * the child P2P bridges) can form individual PE. 1009 1346 */ 1010 - ppc_md.pcibios_fixup_phb = pnv_pci_ioda_fixup_phb; 1347 + ppc_md.pcibios_fixup = pnv_pci_ioda_fixup; 1011 1348 ppc_md.pcibios_enable_device_hook = pnv_pci_enable_device_hook; 1012 1349 ppc_md.pcibios_window_alignment = pnv_pci_window_alignment; 1013 - pci_add_flags(PCI_PROBE_ONLY | PCI_REASSIGN_ALL_RSRC); 1350 + pci_add_flags(PCI_REASSIGN_ALL_RSRC); 1014 1351 1015 1352 /* Reset IODA tables to a clean state */ 1016 1353 rc = opal_pci_reset(phb_id, OPAL_PCI_IODA_TABLE_RESET, OPAL_ASSERT_RESET);
-1
arch/powerpc/platforms/powernv/pci-p5ioc2.c
··· 30 30 #include <asm/opal.h> 31 31 #include <asm/iommu.h> 32 32 #include <asm/tce.h> 33 - #include <asm/abs_addr.h> 34 33 35 34 #include "powernv.h" 36 35 #include "pci.h"
+6 -1
arch/powerpc/platforms/powernv/pci.c
··· 30 30 #include <asm/opal.h> 31 31 #include <asm/iommu.h> 32 32 #include <asm/tce.h> 33 - #include <asm/abs_addr.h> 34 33 #include <asm/firmware.h> 35 34 36 35 #include "powernv.h" ··· 446 447 pnv_tce_invalidate(tbl, tces, tcep - 1); 447 448 } 448 449 450 + static unsigned long pnv_tce_get(struct iommu_table *tbl, long index) 451 + { 452 + return ((u64 *)tbl->it_base)[index - tbl->it_offset]; 453 + } 454 + 449 455 void pnv_pci_setup_iommu_table(struct iommu_table *tbl, 450 456 void *tce_mem, u64 tce_size, 451 457 u64 dma_offset) ··· 601 597 ppc_md.pci_dma_dev_setup = pnv_pci_dma_dev_setup; 602 598 ppc_md.tce_build = pnv_tce_build; 603 599 ppc_md.tce_free = pnv_tce_free; 600 + ppc_md.tce_get = pnv_tce_get; 604 601 ppc_md.pci_probe_mode = pnv_pci_probe_mode; 605 602 set_pci_dma_ops(&dma_iommu_ops); 606 603
+14 -7
arch/powerpc/platforms/powernv/pci.h
··· 17 17 }; 18 18 19 19 #define PNV_PCI_DIAG_BUF_SIZE 4096 20 + #define PNV_IODA_PE_DEV (1 << 0) /* PE has single PCI device */ 21 + #define PNV_IODA_PE_BUS (1 << 1) /* PE has primary PCI bus */ 22 + #define PNV_IODA_PE_BUS_ALL (1 << 2) /* PE has subordinate buses */ 20 23 21 24 /* Data associated with a PE, including IOMMU tracking etc.. */ 22 25 struct pnv_ioda_pe { 26 + unsigned long flags; 27 + 23 28 /* A PE can be associated with a single device or an 24 29 * entire bus (& children). In the former case, pdev 25 30 * is populated, in the later case, pbus is. ··· 45 40 */ 46 41 unsigned int dma_weight; 47 42 48 - /* This is a PCI-E -> PCI-X bridge, this points to the 49 - * corresponding bus PE 50 - */ 51 - struct pnv_ioda_pe *bus_pe; 52 - 53 43 /* "Base" iommu table, ie, 4K TCEs, 32-bit DMA */ 54 44 int tce32_seg; 55 45 int tce32_segcount; ··· 59 59 int mve_number; 60 60 61 61 /* Link in list of PE#s */ 62 - struct list_head link; 62 + struct list_head dma_link; 63 + struct list_head list; 63 64 }; 64 65 65 66 struct pnv_phb { ··· 69 68 enum pnv_phb_model model; 70 69 u64 opal_id; 71 70 void __iomem *regs; 71 + int initialized; 72 72 spinlock_t lock; 73 73 74 74 #ifdef CONFIG_PCI_MSI ··· 109 107 unsigned int *io_segmap; 110 108 struct pnv_ioda_pe *pe_array; 111 109 110 + /* Sorted list of used PE's based 111 + * on the sequence of creation 112 + */ 113 + struct list_head pe_list; 114 + 112 115 /* Reverse map of PEs, will have to extend if 113 116 * we are to support more than 256 PEs, indexed 114 117 * bus { bus, devfn } ··· 132 125 /* Sorted list of used PE's, sorted at 133 126 * boot for resource allocation purposes 134 127 */ 135 - struct list_head pe_list; 128 + struct list_head pe_dma_list; 136 129 } ioda; 137 130 }; 138 131
+11 -11
arch/powerpc/platforms/ps3/htab.c
··· 43 43 44 44 static DEFINE_SPINLOCK(ps3_htab_lock); 45 45 46 - static long ps3_hpte_insert(unsigned long hpte_group, unsigned long va, 46 + static long ps3_hpte_insert(unsigned long hpte_group, unsigned long vpn, 47 47 unsigned long pa, unsigned long rflags, unsigned long vflags, 48 48 int psize, int ssize) 49 49 { ··· 61 61 */ 62 62 vflags &= ~HPTE_V_SECONDARY; 63 63 64 - hpte_v = hpte_encode_v(va, psize, ssize) | vflags | HPTE_V_VALID; 64 + hpte_v = hpte_encode_v(vpn, psize, ssize) | vflags | HPTE_V_VALID; 65 65 hpte_r = hpte_encode_r(ps3_mm_phys_to_lpar(pa), psize) | rflags; 66 66 67 67 spin_lock_irqsave(&ps3_htab_lock, flags); ··· 75 75 76 76 if (result) { 77 77 /* all entries bolted !*/ 78 - pr_info("%s:result=%d va=%lx pa=%lx ix=%lx v=%llx r=%llx\n", 79 - __func__, result, va, pa, hpte_group, hpte_v, hpte_r); 78 + pr_info("%s:result=%d vpn=%lx pa=%lx ix=%lx v=%llx r=%llx\n", 79 + __func__, result, vpn, pa, hpte_group, hpte_v, hpte_r); 80 80 BUG(); 81 81 } 82 82 ··· 107 107 } 108 108 109 109 static long ps3_hpte_updatepp(unsigned long slot, unsigned long newpp, 110 - unsigned long va, int psize, int ssize, int local) 110 + unsigned long vpn, int psize, int ssize, int local) 111 111 { 112 112 int result; 113 113 u64 hpte_v, want_v, hpte_rs; ··· 115 115 unsigned long flags; 116 116 long ret; 117 117 118 - want_v = hpte_encode_v(va, psize, ssize); 118 + want_v = hpte_encode_v(vpn, psize, ssize); 119 119 120 120 spin_lock_irqsave(&ps3_htab_lock, flags); 121 121 ··· 125 125 &hpte_rs); 126 126 127 127 if (result) { 128 - pr_info("%s: res=%d read va=%lx slot=%lx psize=%d\n", 129 - __func__, result, va, slot, psize); 128 + pr_info("%s: res=%d read vpn=%lx slot=%lx psize=%d\n", 129 + __func__, result, vpn, slot, psize); 130 130 BUG(); 131 131 } 132 132 ··· 159 159 panic("ps3_hpte_updateboltedpp() not implemented"); 160 160 } 161 161 162 - static void ps3_hpte_invalidate(unsigned long slot, unsigned long va, 162 + static void ps3_hpte_invalidate(unsigned long slot, unsigned long vpn, 163 163 int psize, int ssize, int local) 164 164 { 165 165 unsigned long flags; ··· 170 170 result = lv1_write_htab_entry(PS3_LPAR_VAS_ID_CURRENT, slot, 0, 0); 171 171 172 172 if (result) { 173 - pr_info("%s: res=%d va=%lx slot=%lx psize=%d\n", 174 - __func__, result, va, slot, psize); 173 + pr_info("%s: res=%d vpn=%lx slot=%lx psize=%d\n", 174 + __func__, result, vpn, slot, psize); 175 175 BUG(); 176 176 } 177 177
+7 -3
arch/powerpc/platforms/ps3/setup.c
··· 184 184 #define prealloc_ps3flash_bounce_buffer() do { } while (0) 185 185 #endif 186 186 187 - static int ps3_set_dabr(unsigned long dabr) 187 + static int ps3_set_dabr(unsigned long dabr, unsigned long dabrx) 188 188 { 189 - enum {DABR_USER = 1, DABR_KERNEL = 2,}; 189 + /* Have to set at least one bit in the DABRX */ 190 + if (dabrx == 0 && dabr == 0) 191 + dabrx = DABRX_USER; 192 + /* hypervisor only allows us to set BTI, Kernel and user */ 193 + dabrx &= DABRX_BTI | DABRX_KERNEL | DABRX_USER; 190 194 191 - return lv1_set_dabr(dabr, DABR_KERNEL | DABR_USER) ? -1 : 0; 195 + return lv1_set_dabr(dabr, dabrx) ? -1 : 0; 192 196 } 193 197 194 198 static void __init ps3_setup_arch(void)
+3 -2
arch/powerpc/platforms/pseries/Makefile
··· 6 6 firmware.o power.o dlpar.o mobility.o 7 7 obj-$(CONFIG_SMP) += smp.o 8 8 obj-$(CONFIG_SCANLOG) += scanlog.o 9 - obj-$(CONFIG_EEH) += eeh.o eeh_dev.o eeh_cache.o eeh_driver.o \ 10 - eeh_event.o eeh_sysfs.o eeh_pseries.o 9 + obj-$(CONFIG_EEH) += eeh.o eeh_pe.o eeh_dev.o eeh_cache.o \ 10 + eeh_driver.o eeh_event.o eeh_sysfs.o \ 11 + eeh_pseries.o 11 12 obj-$(CONFIG_KEXEC) += kexec.o 12 13 obj-$(CONFIG_PCI) += pci.o pci_dlpar.o 13 14 obj-$(CONFIG_PSERIES_MSI) += msi.o
+123 -420
arch/powerpc/platforms/pseries/eeh.c
··· 92 92 int eeh_subsystem_enabled; 93 93 EXPORT_SYMBOL(eeh_subsystem_enabled); 94 94 95 + /* 96 + * EEH probe mode support. The intention is to support multiple 97 + * platforms for EEH. Some platforms like pSeries do PCI emunation 98 + * based on device tree. However, other platforms like powernv probe 99 + * PCI devices from hardware. The flag is used to distinguish that. 100 + * In addition, struct eeh_ops::probe would be invoked for particular 101 + * OF node or PCI device so that the corresponding PE would be created 102 + * there. 103 + */ 104 + int eeh_probe_mode; 105 + 106 + /* Global EEH mutex */ 107 + DEFINE_MUTEX(eeh_mutex); 108 + 95 109 /* Lock to avoid races due to multiple reports of an error */ 96 110 static DEFINE_RAW_SPINLOCK(confirm_error_lock); 97 111 ··· 218 204 } 219 205 } 220 206 221 - /* Gather status on devices under the bridge */ 222 - if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) { 223 - struct device_node *child; 224 - 225 - for_each_child_of_node(dn, child) { 226 - if (of_node_to_eeh_dev(child)) 227 - n += eeh_gather_pci_data(of_node_to_eeh_dev(child), buf+n, len-n); 228 - } 229 - } 230 - 231 207 return n; 232 208 } 233 209 234 210 /** 235 211 * eeh_slot_error_detail - Generate combined log including driver log and error log 236 - * @edev: device to report error log for 212 + * @pe: EEH PE 237 213 * @severity: temporary or permanent error log 238 214 * 239 215 * This routine should be called to generate the combined log, which ··· 231 227 * out from the config space of the corresponding PCI device, while 232 228 * the error log is fetched through platform dependent function call. 233 229 */ 234 - void eeh_slot_error_detail(struct eeh_dev *edev, int severity) 230 + void eeh_slot_error_detail(struct eeh_pe *pe, int severity) 235 231 { 236 232 size_t loglen = 0; 233 + struct eeh_dev *edev; 234 + 235 + eeh_pci_enable(pe, EEH_OPT_THAW_MMIO); 236 + eeh_ops->configure_bridge(pe); 237 + eeh_pe_restore_bars(pe); 238 + 237 239 pci_regs_buf[0] = 0; 240 + eeh_pe_for_each_dev(pe, edev) { 241 + loglen += eeh_gather_pci_data(edev, pci_regs_buf, 242 + EEH_PCI_REGS_LOG_LEN); 243 + } 238 244 239 - eeh_pci_enable(edev, EEH_OPT_THAW_MMIO); 240 - eeh_ops->configure_bridge(eeh_dev_to_of_node(edev)); 241 - eeh_restore_bars(edev); 242 - loglen = eeh_gather_pci_data(edev, pci_regs_buf, EEH_PCI_REGS_LOG_LEN); 243 - 244 - eeh_ops->get_log(eeh_dev_to_of_node(edev), severity, pci_regs_buf, loglen); 245 + eeh_ops->get_log(pe, severity, pci_regs_buf, loglen); 245 246 } 246 247 247 248 /** ··· 270 261 } 271 262 272 263 /** 273 - * eeh_find_device_pe - Retrieve the PE for the given device 274 - * @dn: device node 275 - * 276 - * Return the PE under which this device lies 277 - */ 278 - struct device_node *eeh_find_device_pe(struct device_node *dn) 279 - { 280 - while (dn->parent && of_node_to_eeh_dev(dn->parent) && 281 - (of_node_to_eeh_dev(dn->parent)->mode & EEH_MODE_SUPPORTED)) { 282 - dn = dn->parent; 283 - } 284 - return dn; 285 - } 286 - 287 - /** 288 - * __eeh_mark_slot - Mark all child devices as failed 289 - * @parent: parent device 290 - * @mode_flag: failure flag 291 - * 292 - * Mark all devices that are children of this device as failed. 293 - * Mark the device driver too, so that it can see the failure 294 - * immediately; this is critical, since some drivers poll 295 - * status registers in interrupts ... If a driver is polling, 296 - * and the slot is frozen, then the driver can deadlock in 297 - * an interrupt context, which is bad. 298 - */ 299 - static void __eeh_mark_slot(struct device_node *parent, int mode_flag) 300 - { 301 - struct device_node *dn; 302 - 303 - for_each_child_of_node(parent, dn) { 304 - if (of_node_to_eeh_dev(dn)) { 305 - /* Mark the pci device driver too */ 306 - struct pci_dev *dev = of_node_to_eeh_dev(dn)->pdev; 307 - 308 - of_node_to_eeh_dev(dn)->mode |= mode_flag; 309 - 310 - if (dev && dev->driver) 311 - dev->error_state = pci_channel_io_frozen; 312 - 313 - __eeh_mark_slot(dn, mode_flag); 314 - } 315 - } 316 - } 317 - 318 - /** 319 - * eeh_mark_slot - Mark the indicated device and its children as failed 320 - * @dn: parent device 321 - * @mode_flag: failure flag 322 - * 323 - * Mark the indicated device and its child devices as failed. 324 - * The device drivers are marked as failed as well. 325 - */ 326 - void eeh_mark_slot(struct device_node *dn, int mode_flag) 327 - { 328 - struct pci_dev *dev; 329 - dn = eeh_find_device_pe(dn); 330 - 331 - /* Back up one, since config addrs might be shared */ 332 - if (!pcibios_find_pci_bus(dn) && of_node_to_eeh_dev(dn->parent)) 333 - dn = dn->parent; 334 - 335 - of_node_to_eeh_dev(dn)->mode |= mode_flag; 336 - 337 - /* Mark the pci device too */ 338 - dev = of_node_to_eeh_dev(dn)->pdev; 339 - if (dev) 340 - dev->error_state = pci_channel_io_frozen; 341 - 342 - __eeh_mark_slot(dn, mode_flag); 343 - } 344 - 345 - /** 346 - * __eeh_clear_slot - Clear failure flag for the child devices 347 - * @parent: parent device 348 - * @mode_flag: flag to be cleared 349 - * 350 - * Clear failure flag for the child devices. 351 - */ 352 - static void __eeh_clear_slot(struct device_node *parent, int mode_flag) 353 - { 354 - struct device_node *dn; 355 - 356 - for_each_child_of_node(parent, dn) { 357 - if (of_node_to_eeh_dev(dn)) { 358 - of_node_to_eeh_dev(dn)->mode &= ~mode_flag; 359 - of_node_to_eeh_dev(dn)->check_count = 0; 360 - __eeh_clear_slot(dn, mode_flag); 361 - } 362 - } 363 - } 364 - 365 - /** 366 - * eeh_clear_slot - Clear failure flag for the indicated device and its children 367 - * @dn: parent device 368 - * @mode_flag: flag to be cleared 369 - * 370 - * Clear failure flag for the indicated device and its children. 371 - */ 372 - void eeh_clear_slot(struct device_node *dn, int mode_flag) 373 - { 374 - unsigned long flags; 375 - raw_spin_lock_irqsave(&confirm_error_lock, flags); 376 - 377 - dn = eeh_find_device_pe(dn); 378 - 379 - /* Back up one, since config addrs might be shared */ 380 - if (!pcibios_find_pci_bus(dn) && of_node_to_eeh_dev(dn->parent)) 381 - dn = dn->parent; 382 - 383 - of_node_to_eeh_dev(dn)->mode &= ~mode_flag; 384 - of_node_to_eeh_dev(dn)->check_count = 0; 385 - __eeh_clear_slot(dn, mode_flag); 386 - raw_spin_unlock_irqrestore(&confirm_error_lock, flags); 387 - } 388 - 389 - /** 390 - * eeh_dn_check_failure - Check if all 1's data is due to EEH slot freeze 391 - * @dn: device node 392 - * @dev: pci device, if known 264 + * eeh_dev_check_failure - Check if all 1's data is due to EEH slot freeze 265 + * @edev: eeh device 393 266 * 394 267 * Check for an EEH failure for the given device node. Call this 395 268 * routine if the result of a read was all 0xff's and you want to ··· 283 392 * 284 393 * It is safe to call this routine in an interrupt context. 285 394 */ 286 - int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev) 395 + int eeh_dev_check_failure(struct eeh_dev *edev) 287 396 { 288 397 int ret; 289 398 unsigned long flags; 290 - struct eeh_dev *edev; 399 + struct device_node *dn; 400 + struct pci_dev *dev; 401 + struct eeh_pe *pe; 291 402 int rc = 0; 292 403 const char *location; 293 404 ··· 298 405 if (!eeh_subsystem_enabled) 299 406 return 0; 300 407 301 - if (!dn) { 408 + if (!edev) { 302 409 eeh_stats.no_dn++; 303 410 return 0; 304 411 } 305 - dn = eeh_find_device_pe(dn); 306 - edev = of_node_to_eeh_dev(dn); 412 + dn = eeh_dev_to_of_node(edev); 413 + dev = eeh_dev_to_pci_dev(edev); 414 + pe = edev->pe; 307 415 308 416 /* Access to IO BARs might get this far and still not want checking. */ 309 - if (!(edev->mode & EEH_MODE_SUPPORTED) || 310 - edev->mode & EEH_MODE_NOCHECK) { 417 + if (!pe) { 311 418 eeh_stats.ignored_check++; 312 - pr_debug("EEH: Ignored check (%x) for %s %s\n", 313 - edev->mode, eeh_pci_name(dev), dn->full_name); 419 + pr_debug("EEH: Ignored check for %s %s\n", 420 + eeh_pci_name(dev), dn->full_name); 314 421 return 0; 315 422 } 316 423 317 - if (!edev->config_addr && !edev->pe_config_addr) { 424 + if (!pe->addr && !pe->config_addr) { 318 425 eeh_stats.no_cfg_addr++; 319 426 return 0; 320 427 } ··· 327 434 */ 328 435 raw_spin_lock_irqsave(&confirm_error_lock, flags); 329 436 rc = 1; 330 - if (edev->mode & EEH_MODE_ISOLATED) { 331 - edev->check_count++; 332 - if (edev->check_count % EEH_MAX_FAILS == 0) { 437 + if (pe->state & EEH_PE_ISOLATED) { 438 + pe->check_count++; 439 + if (pe->check_count % EEH_MAX_FAILS == 0) { 333 440 location = of_get_property(dn, "ibm,loc-code", NULL); 334 441 printk(KERN_ERR "EEH: %d reads ignored for recovering device at " 335 442 "location=%s driver=%s pci addr=%s\n", 336 - edev->check_count, location, 443 + pe->check_count, location, 337 444 eeh_driver_name(dev), eeh_pci_name(dev)); 338 445 printk(KERN_ERR "EEH: Might be infinite loop in %s driver\n", 339 446 eeh_driver_name(dev)); ··· 349 456 * function zero of a multi-function device. 350 457 * In any case they must share a common PHB. 351 458 */ 352 - ret = eeh_ops->get_state(dn, NULL); 459 + ret = eeh_ops->get_state(pe, NULL); 353 460 354 461 /* Note that config-io to empty slots may fail; 355 462 * they are empty when they don't have children. ··· 362 469 (ret & (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) == 363 470 (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) { 364 471 eeh_stats.false_positives++; 365 - edev->false_positives ++; 472 + pe->false_positives++; 366 473 rc = 0; 367 474 goto dn_unlock; 368 475 } ··· 373 480 * with other functions on this device, and functions under 374 481 * bridges. 375 482 */ 376 - eeh_mark_slot(dn, EEH_MODE_ISOLATED); 483 + eeh_pe_state_mark(pe, EEH_PE_ISOLATED); 377 484 raw_spin_unlock_irqrestore(&confirm_error_lock, flags); 378 485 379 - eeh_send_failure_event(edev); 486 + eeh_send_failure_event(pe); 380 487 381 488 /* Most EEH events are due to device driver bugs. Having 382 489 * a stack trace will help the device-driver authors figure ··· 390 497 return rc; 391 498 } 392 499 393 - EXPORT_SYMBOL_GPL(eeh_dn_check_failure); 500 + EXPORT_SYMBOL_GPL(eeh_dev_check_failure); 394 501 395 502 /** 396 503 * eeh_check_failure - Check if all 1's data is due to EEH slot freeze ··· 407 514 unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val) 408 515 { 409 516 unsigned long addr; 410 - struct pci_dev *dev; 411 - struct device_node *dn; 517 + struct eeh_dev *edev; 412 518 413 519 /* Finding the phys addr + pci device; this is pretty quick. */ 414 520 addr = eeh_token_to_phys((unsigned long __force) token); 415 - dev = pci_addr_cache_get_device(addr); 416 - if (!dev) { 521 + edev = eeh_addr_cache_get_dev(addr); 522 + if (!edev) { 417 523 eeh_stats.no_device++; 418 524 return val; 419 525 } 420 526 421 - dn = pci_device_to_OF_node(dev); 422 - eeh_dn_check_failure(dn, dev); 527 + eeh_dev_check_failure(edev); 423 528 424 - pci_dev_put(dev); 529 + pci_dev_put(eeh_dev_to_pci_dev(edev)); 425 530 return val; 426 531 } 427 532 ··· 428 537 429 538 /** 430 539 * eeh_pci_enable - Enable MMIO or DMA transfers for this slot 431 - * @edev: pci device node 540 + * @pe: EEH PE 432 541 * 433 542 * This routine should be called to reenable frozen MMIO or DMA 434 543 * so that it would work correctly again. It's useful while doing 435 544 * recovery or log collection on the indicated device. 436 545 */ 437 - int eeh_pci_enable(struct eeh_dev *edev, int function) 546 + int eeh_pci_enable(struct eeh_pe *pe, int function) 438 547 { 439 548 int rc; 440 - struct device_node *dn = eeh_dev_to_of_node(edev); 441 549 442 - rc = eeh_ops->set_option(dn, function); 550 + rc = eeh_ops->set_option(pe, function); 443 551 if (rc) 444 - printk(KERN_WARNING "EEH: Unexpected state change %d, err=%d dn=%s\n", 445 - function, rc, dn->full_name); 552 + pr_warning("%s: Unexpected state change %d on PHB#%d-PE#%x, err=%d\n", 553 + __func__, function, pe->phb->global_number, pe->addr, rc); 446 554 447 - rc = eeh_ops->wait_state(dn, PCI_BUS_RESET_WAIT_MSEC); 555 + rc = eeh_ops->wait_state(pe, PCI_BUS_RESET_WAIT_MSEC); 448 556 if (rc > 0 && (rc & EEH_STATE_MMIO_ENABLED) && 449 557 (function == EEH_OPT_THAW_MMIO)) 450 558 return 0; ··· 461 571 */ 462 572 int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state) 463 573 { 464 - struct device_node *dn = pci_device_to_OF_node(dev); 574 + struct eeh_dev *edev = pci_dev_to_eeh_dev(dev); 575 + struct eeh_pe *pe = edev->pe; 576 + 577 + if (!pe) { 578 + pr_err("%s: No PE found on PCI device %s\n", 579 + __func__, pci_name(dev)); 580 + return -EINVAL; 581 + } 465 582 466 583 switch (state) { 467 584 case pcie_deassert_reset: 468 - eeh_ops->reset(dn, EEH_RESET_DEACTIVATE); 585 + eeh_ops->reset(pe, EEH_RESET_DEACTIVATE); 469 586 break; 470 587 case pcie_hot_reset: 471 - eeh_ops->reset(dn, EEH_RESET_HOT); 588 + eeh_ops->reset(pe, EEH_RESET_HOT); 472 589 break; 473 590 case pcie_warm_reset: 474 - eeh_ops->reset(dn, EEH_RESET_FUNDAMENTAL); 591 + eeh_ops->reset(pe, EEH_RESET_FUNDAMENTAL); 475 592 break; 476 593 default: 477 594 return -EINVAL; ··· 488 591 } 489 592 490 593 /** 491 - * __eeh_set_pe_freset - Check the required reset for child devices 492 - * @parent: parent device 493 - * @freset: return value 494 - * 495 - * Each device might have its preferred reset type: fundamental or 496 - * hot reset. The routine is used to collect the information from 497 - * the child devices so that they could be reset accordingly. 498 - */ 499 - void __eeh_set_pe_freset(struct device_node *parent, unsigned int *freset) 500 - { 501 - struct device_node *dn; 502 - 503 - for_each_child_of_node(parent, dn) { 504 - if (of_node_to_eeh_dev(dn)) { 505 - struct pci_dev *dev = of_node_to_eeh_dev(dn)->pdev; 506 - 507 - if (dev && dev->driver) 508 - *freset |= dev->needs_freset; 509 - 510 - __eeh_set_pe_freset(dn, freset); 511 - } 512 - } 513 - } 514 - 515 - /** 516 - * eeh_set_pe_freset - Check the required reset for the indicated device and its children 517 - * @dn: parent device 518 - * @freset: return value 594 + * eeh_set_pe_freset - Check the required reset for the indicated device 595 + * @data: EEH device 596 + * @flag: return value 519 597 * 520 598 * Each device might have its preferred reset type: fundamental or 521 599 * hot reset. The routine is used to collected the information for 522 600 * the indicated device and its children so that the bunch of the 523 601 * devices could be reset properly. 524 602 */ 525 - void eeh_set_pe_freset(struct device_node *dn, unsigned int *freset) 603 + static void *eeh_set_dev_freset(void *data, void *flag) 526 604 { 527 605 struct pci_dev *dev; 528 - dn = eeh_find_device_pe(dn); 606 + unsigned int *freset = (unsigned int *)flag; 607 + struct eeh_dev *edev = (struct eeh_dev *)data; 529 608 530 - /* Back up one, since config addrs might be shared */ 531 - if (!pcibios_find_pci_bus(dn) && of_node_to_eeh_dev(dn->parent)) 532 - dn = dn->parent; 533 - 534 - dev = of_node_to_eeh_dev(dn)->pdev; 609 + dev = eeh_dev_to_pci_dev(edev); 535 610 if (dev) 536 611 *freset |= dev->needs_freset; 537 612 538 - __eeh_set_pe_freset(dn, freset); 613 + return NULL; 539 614 } 540 615 541 616 /** 542 617 * eeh_reset_pe_once - Assert the pci #RST line for 1/4 second 543 - * @edev: pci device node to be reset. 618 + * @pe: EEH PE 544 619 * 545 620 * Assert the PCI #RST line for 1/4 second. 546 621 */ 547 - static void eeh_reset_pe_once(struct eeh_dev *edev) 622 + static void eeh_reset_pe_once(struct eeh_pe *pe) 548 623 { 549 624 unsigned int freset = 0; 550 - struct device_node *dn = eeh_dev_to_of_node(edev); 551 625 552 626 /* Determine type of EEH reset required for 553 627 * Partitionable Endpoint, a hot-reset (1) ··· 526 658 * A fundamental reset required by any device under 527 659 * Partitionable Endpoint trumps hot-reset. 528 660 */ 529 - eeh_set_pe_freset(dn, &freset); 661 + eeh_pe_dev_traverse(pe, eeh_set_dev_freset, &freset); 530 662 531 663 if (freset) 532 - eeh_ops->reset(dn, EEH_RESET_FUNDAMENTAL); 664 + eeh_ops->reset(pe, EEH_RESET_FUNDAMENTAL); 533 665 else 534 - eeh_ops->reset(dn, EEH_RESET_HOT); 666 + eeh_ops->reset(pe, EEH_RESET_HOT); 535 667 536 668 /* The PCI bus requires that the reset be held high for at least 537 669 * a 100 milliseconds. We wait a bit longer 'just in case'. ··· 543 675 * pci slot reset line is dropped. Make sure we don't miss 544 676 * these, and clear the flag now. 545 677 */ 546 - eeh_clear_slot(dn, EEH_MODE_ISOLATED); 678 + eeh_pe_state_clear(pe, EEH_PE_ISOLATED); 547 679 548 - eeh_ops->reset(dn, EEH_RESET_DEACTIVATE); 680 + eeh_ops->reset(pe, EEH_RESET_DEACTIVATE); 549 681 550 682 /* After a PCI slot has been reset, the PCI Express spec requires 551 683 * a 1.5 second idle time for the bus to stabilize, before starting ··· 557 689 558 690 /** 559 691 * eeh_reset_pe - Reset the indicated PE 560 - * @edev: PCI device associated EEH device 692 + * @pe: EEH PE 561 693 * 562 694 * This routine should be called to reset indicated device, including 563 695 * PE. A PE might include multiple PCI devices and sometimes PCI bridges 564 696 * might be involved as well. 565 697 */ 566 - int eeh_reset_pe(struct eeh_dev *edev) 698 + int eeh_reset_pe(struct eeh_pe *pe) 567 699 { 568 700 int i, rc; 569 - struct device_node *dn = eeh_dev_to_of_node(edev); 570 701 571 702 /* Take three shots at resetting the bus */ 572 703 for (i=0; i<3; i++) { 573 - eeh_reset_pe_once(edev); 704 + eeh_reset_pe_once(pe); 574 705 575 - rc = eeh_ops->wait_state(dn, PCI_BUS_RESET_WAIT_MSEC); 706 + rc = eeh_ops->wait_state(pe, PCI_BUS_RESET_WAIT_MSEC); 576 707 if (rc == (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE)) 577 708 return 0; 578 709 579 710 if (rc < 0) { 580 - printk(KERN_ERR "EEH: unrecoverable slot failure %s\n", 581 - dn->full_name); 711 + pr_err("%s: Unrecoverable slot failure on PHB#%d-PE#%x", 712 + __func__, pe->phb->global_number, pe->addr); 582 713 return -1; 583 714 } 584 - printk(KERN_ERR "EEH: bus reset %d failed on slot %s, rc=%d\n", 585 - i+1, dn->full_name, rc); 715 + pr_err("EEH: bus reset %d failed on PHB#%d-PE#%x, rc=%d\n", 716 + i+1, pe->phb->global_number, pe->addr, rc); 586 717 } 587 718 588 719 return -1; 589 - } 590 - 591 - /** Save and restore of PCI BARs 592 - * 593 - * Although firmware will set up BARs during boot, it doesn't 594 - * set up device BAR's after a device reset, although it will, 595 - * if requested, set up bridge configuration. Thus, we need to 596 - * configure the PCI devices ourselves. 597 - */ 598 - 599 - /** 600 - * eeh_restore_one_device_bars - Restore the Base Address Registers for one device 601 - * @edev: PCI device associated EEH device 602 - * 603 - * Loads the PCI configuration space base address registers, 604 - * the expansion ROM base address, the latency timer, and etc. 605 - * from the saved values in the device node. 606 - */ 607 - static inline void eeh_restore_one_device_bars(struct eeh_dev *edev) 608 - { 609 - int i; 610 - u32 cmd; 611 - struct device_node *dn = eeh_dev_to_of_node(edev); 612 - 613 - if (!edev->phb) 614 - return; 615 - 616 - for (i=4; i<10; i++) { 617 - eeh_ops->write_config(dn, i*4, 4, edev->config_space[i]); 618 - } 619 - 620 - /* 12 == Expansion ROM Address */ 621 - eeh_ops->write_config(dn, 12*4, 4, edev->config_space[12]); 622 - 623 - #define BYTE_SWAP(OFF) (8*((OFF)/4)+3-(OFF)) 624 - #define SAVED_BYTE(OFF) (((u8 *)(edev->config_space))[BYTE_SWAP(OFF)]) 625 - 626 - eeh_ops->write_config(dn, PCI_CACHE_LINE_SIZE, 1, 627 - SAVED_BYTE(PCI_CACHE_LINE_SIZE)); 628 - 629 - eeh_ops->write_config(dn, PCI_LATENCY_TIMER, 1, 630 - SAVED_BYTE(PCI_LATENCY_TIMER)); 631 - 632 - /* max latency, min grant, interrupt pin and line */ 633 - eeh_ops->write_config(dn, 15*4, 4, edev->config_space[15]); 634 - 635 - /* Restore PERR & SERR bits, some devices require it, 636 - * don't touch the other command bits 637 - */ 638 - eeh_ops->read_config(dn, PCI_COMMAND, 4, &cmd); 639 - if (edev->config_space[1] & PCI_COMMAND_PARITY) 640 - cmd |= PCI_COMMAND_PARITY; 641 - else 642 - cmd &= ~PCI_COMMAND_PARITY; 643 - if (edev->config_space[1] & PCI_COMMAND_SERR) 644 - cmd |= PCI_COMMAND_SERR; 645 - else 646 - cmd &= ~PCI_COMMAND_SERR; 647 - eeh_ops->write_config(dn, PCI_COMMAND, 4, cmd); 648 - } 649 - 650 - /** 651 - * eeh_restore_bars - Restore the PCI config space info 652 - * @edev: EEH device 653 - * 654 - * This routine performs a recursive walk to the children 655 - * of this device as well. 656 - */ 657 - void eeh_restore_bars(struct eeh_dev *edev) 658 - { 659 - struct device_node *dn; 660 - if (!edev) 661 - return; 662 - 663 - if ((edev->mode & EEH_MODE_SUPPORTED) && !IS_BRIDGE(edev->class_code)) 664 - eeh_restore_one_device_bars(edev); 665 - 666 - for_each_child_of_node(eeh_dev_to_of_node(edev), dn) 667 - eeh_restore_bars(of_node_to_eeh_dev(dn)); 668 720 } 669 721 670 722 /** ··· 596 808 * PCI devices are added individually; but, for the restore, 597 809 * an entire slot is reset at a time. 598 810 */ 599 - static void eeh_save_bars(struct eeh_dev *edev) 811 + void eeh_save_bars(struct eeh_dev *edev) 600 812 { 601 813 int i; 602 814 struct device_node *dn; ··· 607 819 608 820 for (i = 0; i < 16; i++) 609 821 eeh_ops->read_config(dn, i * 4, 4, &edev->config_space[i]); 610 - } 611 - 612 - /** 613 - * eeh_early_enable - Early enable EEH on the indicated device 614 - * @dn: device node 615 - * @data: BUID 616 - * 617 - * Enable EEH functionality on the specified PCI device. The function 618 - * is expected to be called before real PCI probing is done. However, 619 - * the PHBs have been initialized at this point. 620 - */ 621 - static void *eeh_early_enable(struct device_node *dn, void *data) 622 - { 623 - int ret; 624 - const u32 *class_code = of_get_property(dn, "class-code", NULL); 625 - const u32 *vendor_id = of_get_property(dn, "vendor-id", NULL); 626 - const u32 *device_id = of_get_property(dn, "device-id", NULL); 627 - const u32 *regs; 628 - int enable; 629 - struct eeh_dev *edev = of_node_to_eeh_dev(dn); 630 - 631 - edev->class_code = 0; 632 - edev->mode = 0; 633 - edev->check_count = 0; 634 - edev->freeze_count = 0; 635 - edev->false_positives = 0; 636 - 637 - if (!of_device_is_available(dn)) 638 - return NULL; 639 - 640 - /* Ignore bad nodes. */ 641 - if (!class_code || !vendor_id || !device_id) 642 - return NULL; 643 - 644 - /* There is nothing to check on PCI to ISA bridges */ 645 - if (dn->type && !strcmp(dn->type, "isa")) { 646 - edev->mode |= EEH_MODE_NOCHECK; 647 - return NULL; 648 - } 649 - edev->class_code = *class_code; 650 - 651 - /* Ok... see if this device supports EEH. Some do, some don't, 652 - * and the only way to find out is to check each and every one. 653 - */ 654 - regs = of_get_property(dn, "reg", NULL); 655 - if (regs) { 656 - /* First register entry is addr (00BBSS00) */ 657 - /* Try to enable eeh */ 658 - ret = eeh_ops->set_option(dn, EEH_OPT_ENABLE); 659 - 660 - enable = 0; 661 - if (ret == 0) { 662 - edev->config_addr = regs[0]; 663 - 664 - /* If the newer, better, ibm,get-config-addr-info is supported, 665 - * then use that instead. 666 - */ 667 - edev->pe_config_addr = eeh_ops->get_pe_addr(dn); 668 - 669 - /* Some older systems (Power4) allow the 670 - * ibm,set-eeh-option call to succeed even on nodes 671 - * where EEH is not supported. Verify support 672 - * explicitly. 673 - */ 674 - ret = eeh_ops->get_state(dn, NULL); 675 - if (ret > 0 && ret != EEH_STATE_NOT_SUPPORT) 676 - enable = 1; 677 - } 678 - 679 - if (enable) { 680 - eeh_subsystem_enabled = 1; 681 - edev->mode |= EEH_MODE_SUPPORTED; 682 - 683 - pr_debug("EEH: %s: eeh enabled, config=%x pe_config=%x\n", 684 - dn->full_name, edev->config_addr, 685 - edev->pe_config_addr); 686 - } else { 687 - 688 - /* This device doesn't support EEH, but it may have an 689 - * EEH parent, in which case we mark it as supported. 690 - */ 691 - if (dn->parent && of_node_to_eeh_dev(dn->parent) && 692 - (of_node_to_eeh_dev(dn->parent)->mode & EEH_MODE_SUPPORTED)) { 693 - /* Parent supports EEH. */ 694 - edev->mode |= EEH_MODE_SUPPORTED; 695 - edev->config_addr = of_node_to_eeh_dev(dn->parent)->config_addr; 696 - return NULL; 697 - } 698 - } 699 - } else { 700 - printk(KERN_WARNING "EEH: %s: unable to get reg property.\n", 701 - dn->full_name); 702 - } 703 - 704 - eeh_save_bars(edev); 705 - return NULL; 706 822 } 707 823 708 824 /** ··· 674 982 * Even if force-off is set, the EEH hardware is still enabled, so that 675 983 * newer systems can boot. 676 984 */ 677 - void __init eeh_init(void) 985 + static int __init eeh_init(void) 678 986 { 679 987 struct pci_controller *hose, *tmp; 680 988 struct device_node *phb; ··· 684 992 if (!eeh_ops) { 685 993 pr_warning("%s: Platform EEH operation not found\n", 686 994 __func__); 687 - return; 995 + return -EEXIST; 688 996 } else if ((ret = eeh_ops->init())) { 689 997 pr_warning("%s: Failed to call platform init function (%d)\n", 690 998 __func__, ret); 691 - return; 999 + return ret; 692 1000 } 693 1001 694 1002 raw_spin_lock_init(&confirm_error_lock); 695 1003 696 1004 /* Enable EEH for all adapters */ 697 - list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 698 - phb = hose->dn; 699 - traverse_pci_devices(phb, eeh_early_enable, NULL); 1005 + if (eeh_probe_mode_devtree()) { 1006 + list_for_each_entry_safe(hose, tmp, 1007 + &hose_list, list_node) { 1008 + phb = hose->dn; 1009 + traverse_pci_devices(phb, eeh_ops->of_probe, NULL); 1010 + } 700 1011 } 701 1012 702 1013 if (eeh_subsystem_enabled) 703 - printk(KERN_INFO "EEH: PCI Enhanced I/O Error Handling Enabled\n"); 1014 + pr_info("EEH: PCI Enhanced I/O Error Handling Enabled\n"); 704 1015 else 705 - printk(KERN_WARNING "EEH: No capable adapters found\n"); 1016 + pr_warning("EEH: No capable adapters found\n"); 1017 + 1018 + return ret; 706 1019 } 1020 + 1021 + core_initcall_sync(eeh_init); 707 1022 708 1023 /** 709 1024 * eeh_add_device_early - Enable EEH for the indicated device_node ··· 728 1029 { 729 1030 struct pci_controller *phb; 730 1031 731 - if (!dn || !of_node_to_eeh_dev(dn)) 1032 + if (!of_node_to_eeh_dev(dn)) 732 1033 return; 733 1034 phb = of_node_to_eeh_dev(dn)->phb; 734 1035 ··· 736 1037 if (NULL == phb || 0 == phb->buid) 737 1038 return; 738 1039 739 - eeh_early_enable(dn, NULL); 1040 + /* FIXME: hotplug support on POWERNV */ 1041 + eeh_ops->of_probe(dn, NULL); 740 1042 } 741 1043 742 1044 /** ··· 787 1087 edev->pdev = dev; 788 1088 dev->dev.archdata.edev = edev; 789 1089 790 - pci_addr_cache_insert_device(dev); 1090 + eeh_addr_cache_insert_dev(dev); 791 1091 eeh_sysfs_add_device(dev); 792 1092 } 793 1093 ··· 817 1117 /** 818 1118 * eeh_remove_device - Undo EEH setup for the indicated pci device 819 1119 * @dev: pci device to be removed 1120 + * @purge_pe: remove the PE or not 820 1121 * 821 1122 * This routine should be called when a device is removed from 822 1123 * a running system (e.g. by hotplug or dlpar). It unregisters ··· 825 1124 * this device will no longer be detected after this call; thus, 826 1125 * i/o errors affecting this slot may leave this device unusable. 827 1126 */ 828 - static void eeh_remove_device(struct pci_dev *dev) 1127 + static void eeh_remove_device(struct pci_dev *dev, int purge_pe) 829 1128 { 830 1129 struct eeh_dev *edev; 831 1130 ··· 844 1143 dev->dev.archdata.edev = NULL; 845 1144 pci_dev_put(dev); 846 1145 847 - pci_addr_cache_remove_device(dev); 1146 + eeh_rmv_from_parent_pe(edev, purge_pe); 1147 + eeh_addr_cache_rmv_dev(dev); 848 1148 eeh_sysfs_remove_device(dev); 849 1149 } 850 1150 851 1151 /** 852 1152 * eeh_remove_bus_device - Undo EEH setup for the indicated PCI device 853 1153 * @dev: PCI device 1154 + * @purge_pe: remove the corresponding PE or not 854 1155 * 855 1156 * This routine must be called when a device is removed from the 856 1157 * running system through hotplug or dlpar. The corresponding 857 1158 * PCI address cache will be removed. 858 1159 */ 859 - void eeh_remove_bus_device(struct pci_dev *dev) 1160 + void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe) 860 1161 { 861 1162 struct pci_bus *bus = dev->subordinate; 862 1163 struct pci_dev *child, *tmp; 863 1164 864 - eeh_remove_device(dev); 1165 + eeh_remove_device(dev, purge_pe); 865 1166 866 1167 if (bus && dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { 867 1168 list_for_each_entry_safe(child, tmp, &bus->devices, bus_list) 868 - eeh_remove_bus_device(child); 1169 + eeh_remove_bus_device(child, purge_pe); 869 1170 } 870 1171 } 871 1172 EXPORT_SYMBOL_GPL(eeh_remove_bus_device);
+30 -29
arch/powerpc/platforms/pseries/eeh_cache.c
··· 50 50 struct rb_node rb_node; 51 51 unsigned long addr_lo; 52 52 unsigned long addr_hi; 53 + struct eeh_dev *edev; 53 54 struct pci_dev *pcidev; 54 55 unsigned int flags; 55 56 }; ··· 60 59 spinlock_t piar_lock; 61 60 } pci_io_addr_cache_root; 62 61 63 - static inline struct pci_dev *__pci_addr_cache_get_device(unsigned long addr) 62 + static inline struct eeh_dev *__eeh_addr_cache_get_device(unsigned long addr) 64 63 { 65 64 struct rb_node *n = pci_io_addr_cache_root.rb_root.rb_node; 66 65 ··· 75 74 n = n->rb_right; 76 75 } else { 77 76 pci_dev_get(piar->pcidev); 78 - return piar->pcidev; 77 + return piar->edev; 79 78 } 80 79 } 81 80 } ··· 84 83 } 85 84 86 85 /** 87 - * pci_addr_cache_get_device - Get device, given only address 86 + * eeh_addr_cache_get_dev - Get device, given only address 88 87 * @addr: mmio (PIO) phys address or i/o port number 89 88 * 90 89 * Given an mmio phys address, or a port number, find a pci device ··· 93 92 * from zero (that is, they do *not* have pci_io_addr added in). 94 93 * It is safe to call this function within an interrupt. 95 94 */ 96 - struct pci_dev *pci_addr_cache_get_device(unsigned long addr) 95 + struct eeh_dev *eeh_addr_cache_get_dev(unsigned long addr) 97 96 { 98 - struct pci_dev *dev; 97 + struct eeh_dev *edev; 99 98 unsigned long flags; 100 99 101 100 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); 102 - dev = __pci_addr_cache_get_device(addr); 101 + edev = __eeh_addr_cache_get_device(addr); 103 102 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); 104 - return dev; 103 + return edev; 105 104 } 106 105 107 106 #ifdef DEBUG ··· 109 108 * Handy-dandy debug print routine, does nothing more 110 109 * than print out the contents of our addr cache. 111 110 */ 112 - static void pci_addr_cache_print(struct pci_io_addr_cache *cache) 111 + static void eeh_addr_cache_print(struct pci_io_addr_cache *cache) 113 112 { 114 113 struct rb_node *n; 115 114 int cnt = 0; ··· 118 117 while (n) { 119 118 struct pci_io_addr_range *piar; 120 119 piar = rb_entry(n, struct pci_io_addr_range, rb_node); 121 - printk(KERN_DEBUG "PCI: %s addr range %d [%lx-%lx]: %s\n", 120 + pr_debug("PCI: %s addr range %d [%lx-%lx]: %s\n", 122 121 (piar->flags & IORESOURCE_IO) ? "i/o" : "mem", cnt, 123 122 piar->addr_lo, piar->addr_hi, pci_name(piar->pcidev)); 124 123 cnt++; ··· 129 128 130 129 /* Insert address range into the rb tree. */ 131 130 static struct pci_io_addr_range * 132 - pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo, 131 + eeh_addr_cache_insert(struct pci_dev *dev, unsigned long alo, 133 132 unsigned long ahi, unsigned int flags) 134 133 { 135 134 struct rb_node **p = &pci_io_addr_cache_root.rb_root.rb_node; ··· 147 146 } else { 148 147 if (dev != piar->pcidev || 149 148 alo != piar->addr_lo || ahi != piar->addr_hi) { 150 - printk(KERN_WARNING "PIAR: overlapping address range\n"); 149 + pr_warning("PIAR: overlapping address range\n"); 151 150 } 152 151 return piar; 153 152 } 154 153 } 155 - piar = kmalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC); 154 + piar = kzalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC); 156 155 if (!piar) 157 156 return NULL; 158 157 159 158 pci_dev_get(dev); 160 159 piar->addr_lo = alo; 161 160 piar->addr_hi = ahi; 161 + piar->edev = pci_dev_to_eeh_dev(dev); 162 162 piar->pcidev = dev; 163 163 piar->flags = flags; 164 164 165 165 #ifdef DEBUG 166 - printk(KERN_DEBUG "PIAR: insert range=[%lx:%lx] dev=%s\n", 166 + pr_debug("PIAR: insert range=[%lx:%lx] dev=%s\n", 167 167 alo, ahi, pci_name(dev)); 168 168 #endif 169 169 ··· 174 172 return piar; 175 173 } 176 174 177 - static void __pci_addr_cache_insert_device(struct pci_dev *dev) 175 + static void __eeh_addr_cache_insert_dev(struct pci_dev *dev) 178 176 { 179 177 struct device_node *dn; 180 178 struct eeh_dev *edev; ··· 182 180 183 181 dn = pci_device_to_OF_node(dev); 184 182 if (!dn) { 185 - printk(KERN_WARNING "PCI: no pci dn found for dev=%s\n", pci_name(dev)); 183 + pr_warning("PCI: no pci dn found for dev=%s\n", pci_name(dev)); 186 184 return; 187 185 } 188 186 ··· 194 192 } 195 193 196 194 /* Skip any devices for which EEH is not enabled. */ 197 - if (!(edev->mode & EEH_MODE_SUPPORTED) || 198 - edev->mode & EEH_MODE_NOCHECK) { 195 + if (!edev->pe) { 199 196 #ifdef DEBUG 200 197 pr_info("PCI: skip building address cache for=%s - %s\n", 201 198 pci_name(dev), dn->full_name); ··· 213 212 continue; 214 213 if (start == 0 || ~start == 0 || end == 0 || ~end == 0) 215 214 continue; 216 - pci_addr_cache_insert(dev, start, end, flags); 215 + eeh_addr_cache_insert(dev, start, end, flags); 217 216 } 218 217 } 219 218 220 219 /** 221 - * pci_addr_cache_insert_device - Add a device to the address cache 220 + * eeh_addr_cache_insert_dev - Add a device to the address cache 222 221 * @dev: PCI device whose I/O addresses we are interested in. 223 222 * 224 223 * In order to support the fast lookup of devices based on addresses, 225 224 * we maintain a cache of devices that can be quickly searched. 226 225 * This routine adds a device to that cache. 227 226 */ 228 - void pci_addr_cache_insert_device(struct pci_dev *dev) 227 + void eeh_addr_cache_insert_dev(struct pci_dev *dev) 229 228 { 230 229 unsigned long flags; 231 230 ··· 234 233 return; 235 234 236 235 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); 237 - __pci_addr_cache_insert_device(dev); 236 + __eeh_addr_cache_insert_dev(dev); 238 237 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); 239 238 } 240 239 241 - static inline void __pci_addr_cache_remove_device(struct pci_dev *dev) 240 + static inline void __eeh_addr_cache_rmv_dev(struct pci_dev *dev) 242 241 { 243 242 struct rb_node *n; 244 243 ··· 259 258 } 260 259 261 260 /** 262 - * pci_addr_cache_remove_device - remove pci device from addr cache 261 + * eeh_addr_cache_rmv_dev - remove pci device from addr cache 263 262 * @dev: device to remove 264 263 * 265 264 * Remove a device from the addr-cache tree. ··· 267 266 * the tree multiple times (once per resource). 268 267 * But so what; device removal doesn't need to be that fast. 269 268 */ 270 - void pci_addr_cache_remove_device(struct pci_dev *dev) 269 + void eeh_addr_cache_rmv_dev(struct pci_dev *dev) 271 270 { 272 271 unsigned long flags; 273 272 274 273 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); 275 - __pci_addr_cache_remove_device(dev); 274 + __eeh_addr_cache_rmv_dev(dev); 276 275 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); 277 276 } 278 277 279 278 /** 280 - * pci_addr_cache_build - Build a cache of I/O addresses 279 + * eeh_addr_cache_build - Build a cache of I/O addresses 281 280 * 282 281 * Build a cache of pci i/o addresses. This cache will be used to 283 282 * find the pci device that corresponds to a given address. ··· 285 284 * Must be run late in boot process, after the pci controllers 286 285 * have been scanned for devices (after all device resources are known). 287 286 */ 288 - void __init pci_addr_cache_build(void) 287 + void __init eeh_addr_cache_build(void) 289 288 { 290 289 struct device_node *dn; 291 290 struct eeh_dev *edev; ··· 294 293 spin_lock_init(&pci_io_addr_cache_root.piar_lock); 295 294 296 295 for_each_pci_dev(dev) { 297 - pci_addr_cache_insert_device(dev); 296 + eeh_addr_cache_insert_dev(dev); 298 297 299 298 dn = pci_device_to_OF_node(dev); 300 299 if (!dn) ··· 313 312 314 313 #ifdef DEBUG 315 314 /* Verify tree built up above, echo back the list of addrs. */ 316 - pci_addr_cache_print(&pci_io_addr_cache_root); 315 + eeh_addr_cache_print(&pci_io_addr_cache_root); 317 316 #endif 318 317 } 319 318
+12 -2
arch/powerpc/platforms/pseries/eeh_dev.c
··· 55 55 struct eeh_dev *edev; 56 56 57 57 /* Allocate EEH device */ 58 - edev = zalloc_maybe_bootmem(sizeof(*edev), GFP_KERNEL); 58 + edev = kzalloc(sizeof(*edev), GFP_KERNEL); 59 59 if (!edev) { 60 60 pr_warning("%s: out of memory\n", __func__); 61 61 return NULL; ··· 65 65 PCI_DN(dn)->edev = edev; 66 66 edev->dn = dn; 67 67 edev->phb = phb; 68 + INIT_LIST_HEAD(&edev->list); 68 69 69 70 return NULL; 70 71 } ··· 81 80 { 82 81 struct device_node *dn = phb->dn; 83 82 83 + /* EEH PE for PHB */ 84 + eeh_phb_pe_create(phb); 85 + 84 86 /* EEH device for PHB */ 85 87 eeh_dev_init(dn, phb); 86 88 ··· 97 93 * Scan all the existing PHBs and create EEH devices for their OF 98 94 * nodes and their children OF nodes 99 95 */ 100 - void __init eeh_dev_phb_init(void) 96 + static int __init eeh_dev_phb_init(void) 101 97 { 102 98 struct pci_controller *phb, *tmp; 103 99 104 100 list_for_each_entry_safe(phb, tmp, &hose_list, list_node) 105 101 eeh_dev_phb_init_dynamic(phb); 102 + 103 + pr_info("EEH: devices created\n"); 104 + 105 + return 0; 106 106 } 107 + 108 + core_initcall(eeh_dev_phb_init);
+162 -148
arch/powerpc/platforms/pseries/eeh_driver.c
··· 25 25 #include <linux/delay.h> 26 26 #include <linux/interrupt.h> 27 27 #include <linux/irq.h> 28 + #include <linux/module.h> 28 29 #include <linux/pci.h> 29 30 #include <asm/eeh.h> 30 31 #include <asm/eeh_event.h> ··· 46 45 if (pdev && pdev->dev.driver) 47 46 return pdev->dev.driver->name; 48 47 return ""; 48 + } 49 + 50 + /** 51 + * eeh_pcid_get - Get the PCI device driver 52 + * @pdev: PCI device 53 + * 54 + * The function is used to retrieve the PCI device driver for 55 + * the indicated PCI device. Besides, we will increase the reference 56 + * of the PCI device driver to prevent that being unloaded on 57 + * the fly. Otherwise, kernel crash would be seen. 58 + */ 59 + static inline struct pci_driver *eeh_pcid_get(struct pci_dev *pdev) 60 + { 61 + if (!pdev || !pdev->driver) 62 + return NULL; 63 + 64 + if (!try_module_get(pdev->driver->driver.owner)) 65 + return NULL; 66 + 67 + return pdev->driver; 68 + } 69 + 70 + /** 71 + * eeh_pcid_put - Dereference on the PCI device driver 72 + * @pdev: PCI device 73 + * 74 + * The function is called to do dereference on the PCI device 75 + * driver of the indicated PCI device. 76 + */ 77 + static inline void eeh_pcid_put(struct pci_dev *pdev) 78 + { 79 + if (!pdev || !pdev->driver) 80 + return; 81 + 82 + module_put(pdev->driver->driver.owner); 49 83 } 50 84 51 85 #if 0 ··· 129 93 if (!irq_has_action(dev->irq)) 130 94 return; 131 95 132 - edev->mode |= EEH_MODE_IRQ_DISABLED; 96 + edev->mode |= EEH_DEV_IRQ_DISABLED; 133 97 disable_irq_nosync(dev->irq); 134 98 } 135 99 ··· 144 108 { 145 109 struct eeh_dev *edev = pci_dev_to_eeh_dev(dev); 146 110 147 - if ((edev->mode) & EEH_MODE_IRQ_DISABLED) { 148 - edev->mode &= ~EEH_MODE_IRQ_DISABLED; 111 + if ((edev->mode) & EEH_DEV_IRQ_DISABLED) { 112 + edev->mode &= ~EEH_DEV_IRQ_DISABLED; 149 113 enable_irq(dev->irq); 150 114 } 151 115 } 152 116 153 117 /** 154 118 * eeh_report_error - Report pci error to each device driver 155 - * @dev: PCI device 119 + * @data: eeh device 156 120 * @userdata: return value 157 121 * 158 122 * Report an EEH error to each device driver, collect up and 159 123 * merge the device driver responses. Cumulative response 160 124 * passed back in "userdata". 161 125 */ 162 - static int eeh_report_error(struct pci_dev *dev, void *userdata) 126 + static void *eeh_report_error(void *data, void *userdata) 163 127 { 128 + struct eeh_dev *edev = (struct eeh_dev *)data; 129 + struct pci_dev *dev = eeh_dev_to_pci_dev(edev); 164 130 enum pci_ers_result rc, *res = userdata; 165 - struct pci_driver *driver = dev->driver; 131 + struct pci_driver *driver; 166 132 133 + /* We might not have the associated PCI device, 134 + * then we should continue for next one. 135 + */ 136 + if (!dev) return NULL; 167 137 dev->error_state = pci_channel_io_frozen; 168 138 169 - if (!driver) 170 - return 0; 139 + driver = eeh_pcid_get(dev); 140 + if (!driver) return NULL; 171 141 172 142 eeh_disable_irq(dev); 173 143 174 144 if (!driver->err_handler || 175 - !driver->err_handler->error_detected) 176 - return 0; 145 + !driver->err_handler->error_detected) { 146 + eeh_pcid_put(dev); 147 + return NULL; 148 + } 177 149 178 150 rc = driver->err_handler->error_detected(dev, pci_channel_io_frozen); 179 151 ··· 189 145 if (rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; 190 146 if (*res == PCI_ERS_RESULT_NONE) *res = rc; 191 147 192 - return 0; 148 + eeh_pcid_put(dev); 149 + return NULL; 193 150 } 194 151 195 152 /** 196 153 * eeh_report_mmio_enabled - Tell drivers that MMIO has been enabled 197 - * @dev: PCI device 154 + * @data: eeh device 198 155 * @userdata: return value 199 156 * 200 157 * Tells each device driver that IO ports, MMIO and config space I/O 201 158 * are now enabled. Collects up and merges the device driver responses. 202 159 * Cumulative response passed back in "userdata". 203 160 */ 204 - static int eeh_report_mmio_enabled(struct pci_dev *dev, void *userdata) 161 + static void *eeh_report_mmio_enabled(void *data, void *userdata) 205 162 { 163 + struct eeh_dev *edev = (struct eeh_dev *)data; 164 + struct pci_dev *dev = eeh_dev_to_pci_dev(edev); 206 165 enum pci_ers_result rc, *res = userdata; 207 - struct pci_driver *driver = dev->driver; 166 + struct pci_driver *driver; 208 167 209 - if (!driver || 210 - !driver->err_handler || 211 - !driver->err_handler->mmio_enabled) 212 - return 0; 168 + driver = eeh_pcid_get(dev); 169 + if (!driver) return NULL; 170 + 171 + if (!driver->err_handler || 172 + !driver->err_handler->mmio_enabled) { 173 + eeh_pcid_put(dev); 174 + return NULL; 175 + } 213 176 214 177 rc = driver->err_handler->mmio_enabled(dev); 215 178 ··· 224 173 if (rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; 225 174 if (*res == PCI_ERS_RESULT_NONE) *res = rc; 226 175 227 - return 0; 176 + eeh_pcid_put(dev); 177 + return NULL; 228 178 } 229 179 230 180 /** 231 181 * eeh_report_reset - Tell device that slot has been reset 232 - * @dev: PCI device 182 + * @data: eeh device 233 183 * @userdata: return value 234 184 * 235 185 * This routine must be called while EEH tries to reset particular ··· 238 186 * some actions, usually to save data the driver needs so that the 239 187 * driver can work again while the device is recovered. 240 188 */ 241 - static int eeh_report_reset(struct pci_dev *dev, void *userdata) 189 + static void *eeh_report_reset(void *data, void *userdata) 242 190 { 191 + struct eeh_dev *edev = (struct eeh_dev *)data; 192 + struct pci_dev *dev = eeh_dev_to_pci_dev(edev); 243 193 enum pci_ers_result rc, *res = userdata; 244 - struct pci_driver *driver = dev->driver; 194 + struct pci_driver *driver; 245 195 246 - if (!driver) 247 - return 0; 248 - 196 + if (!dev) return NULL; 249 197 dev->error_state = pci_channel_io_normal; 198 + 199 + driver = eeh_pcid_get(dev); 200 + if (!driver) return NULL; 250 201 251 202 eeh_enable_irq(dev); 252 203 253 204 if (!driver->err_handler || 254 - !driver->err_handler->slot_reset) 255 - return 0; 205 + !driver->err_handler->slot_reset) { 206 + eeh_pcid_put(dev); 207 + return NULL; 208 + } 256 209 257 210 rc = driver->err_handler->slot_reset(dev); 258 211 if ((*res == PCI_ERS_RESULT_NONE) || ··· 265 208 if (*res == PCI_ERS_RESULT_DISCONNECT && 266 209 rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; 267 210 268 - return 0; 211 + eeh_pcid_put(dev); 212 + return NULL; 269 213 } 270 214 271 215 /** 272 216 * eeh_report_resume - Tell device to resume normal operations 273 - * @dev: PCI device 217 + * @data: eeh device 274 218 * @userdata: return value 275 219 * 276 220 * This routine must be called to notify the device driver that it 277 221 * could resume so that the device driver can do some initialization 278 222 * to make the recovered device work again. 279 223 */ 280 - static int eeh_report_resume(struct pci_dev *dev, void *userdata) 224 + static void *eeh_report_resume(void *data, void *userdata) 281 225 { 282 - struct pci_driver *driver = dev->driver; 226 + struct eeh_dev *edev = (struct eeh_dev *)data; 227 + struct pci_dev *dev = eeh_dev_to_pci_dev(edev); 228 + struct pci_driver *driver; 283 229 230 + if (!dev) return NULL; 284 231 dev->error_state = pci_channel_io_normal; 285 232 286 - if (!driver) 287 - return 0; 233 + driver = eeh_pcid_get(dev); 234 + if (!driver) return NULL; 288 235 289 236 eeh_enable_irq(dev); 290 237 291 238 if (!driver->err_handler || 292 - !driver->err_handler->resume) 293 - return 0; 239 + !driver->err_handler->resume) { 240 + eeh_pcid_put(dev); 241 + return NULL; 242 + } 294 243 295 244 driver->err_handler->resume(dev); 296 245 297 - return 0; 246 + eeh_pcid_put(dev); 247 + return NULL; 298 248 } 299 249 300 250 /** 301 251 * eeh_report_failure - Tell device driver that device is dead. 302 - * @dev: PCI device 252 + * @data: eeh device 303 253 * @userdata: return value 304 254 * 305 255 * This informs the device driver that the device is permanently 306 256 * dead, and that no further recovery attempts will be made on it. 307 257 */ 308 - static int eeh_report_failure(struct pci_dev *dev, void *userdata) 258 + static void *eeh_report_failure(void *data, void *userdata) 309 259 { 310 - struct pci_driver *driver = dev->driver; 260 + struct eeh_dev *edev = (struct eeh_dev *)data; 261 + struct pci_dev *dev = eeh_dev_to_pci_dev(edev); 262 + struct pci_driver *driver; 311 263 264 + if (!dev) return NULL; 312 265 dev->error_state = pci_channel_io_perm_failure; 313 266 314 - if (!driver) 315 - return 0; 267 + driver = eeh_pcid_get(dev); 268 + if (!driver) return NULL; 316 269 317 270 eeh_disable_irq(dev); 318 271 319 272 if (!driver->err_handler || 320 - !driver->err_handler->error_detected) 321 - return 0; 273 + !driver->err_handler->error_detected) { 274 + eeh_pcid_put(dev); 275 + return NULL; 276 + } 322 277 323 278 driver->err_handler->error_detected(dev, pci_channel_io_perm_failure); 324 279 325 - return 0; 280 + eeh_pcid_put(dev); 281 + return NULL; 326 282 } 327 283 328 284 /** 329 285 * eeh_reset_device - Perform actual reset of a pci slot 330 - * @edev: PE associated EEH device 286 + * @pe: EEH PE 331 287 * @bus: PCI bus corresponding to the isolcated slot 332 288 * 333 289 * This routine must be called to do reset on the indicated PE. 334 290 * During the reset, udev might be invoked because those affected 335 291 * PCI devices will be removed and then added. 336 292 */ 337 - static int eeh_reset_device(struct eeh_dev *edev, struct pci_bus *bus) 293 + static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus) 338 294 { 339 - struct device_node *dn; 340 295 int cnt, rc; 341 296 342 297 /* pcibios will clear the counter; save the value */ 343 - cnt = edev->freeze_count; 298 + cnt = pe->freeze_count; 344 299 300 + /* 301 + * We don't remove the corresponding PE instances because 302 + * we need the information afterwords. The attached EEH 303 + * devices are expected to be attached soon when calling 304 + * into pcibios_add_pci_devices(). 305 + */ 345 306 if (bus) 346 - pcibios_remove_pci_devices(bus); 307 + __pcibios_remove_pci_devices(bus, 0); 347 308 348 309 /* Reset the pci controller. (Asserts RST#; resets config space). 349 310 * Reconfigure bridges and devices. Don't try to bring the system 350 311 * up if the reset failed for some reason. 351 312 */ 352 - rc = eeh_reset_pe(edev); 313 + rc = eeh_reset_pe(pe); 353 314 if (rc) 354 315 return rc; 355 316 356 - /* Walk over all functions on this device. */ 357 - dn = eeh_dev_to_of_node(edev); 358 - if (!pcibios_find_pci_bus(dn) && of_node_to_eeh_dev(dn->parent)) 359 - dn = dn->parent->child; 360 - 361 - while (dn) { 362 - struct eeh_dev *pedev = of_node_to_eeh_dev(dn); 363 - 364 - /* On Power4, always true because eeh_pe_config_addr=0 */ 365 - if (edev->pe_config_addr == pedev->pe_config_addr) { 366 - eeh_ops->configure_bridge(dn); 367 - eeh_restore_bars(pedev); 368 - } 369 - dn = dn->sibling; 370 - } 317 + /* Restore PE */ 318 + eeh_ops->configure_bridge(pe); 319 + eeh_pe_restore_bars(pe); 371 320 372 321 /* Give the system 5 seconds to finish running the user-space 373 322 * hotplug shutdown scripts, e.g. ifdown for ethernet. Yes, ··· 385 322 ssleep(5); 386 323 pcibios_add_pci_devices(bus); 387 324 } 388 - edev->freeze_count = cnt; 325 + pe->freeze_count = cnt; 389 326 390 327 return 0; 391 328 } ··· 397 334 398 335 /** 399 336 * eeh_handle_event - Reset a PCI device after hard lockup. 400 - * @event: EEH event 337 + * @pe: EEH PE 401 338 * 402 339 * While PHB detects address or data parity errors on particular PCI 403 340 * slot, the associated PE will be frozen. Besides, DMA's occurring ··· 412 349 * drivers (which cause a second set of hotplug events to go out to 413 350 * userspace). 414 351 */ 415 - struct eeh_dev *handle_eeh_events(struct eeh_event *event) 352 + void eeh_handle_event(struct eeh_pe *pe) 416 353 { 417 - struct device_node *frozen_dn; 418 - struct eeh_dev *frozen_edev; 419 354 struct pci_bus *frozen_bus; 420 355 int rc = 0; 421 356 enum pci_ers_result result = PCI_ERS_RESULT_NONE; 422 - const char *location, *pci_str, *drv_str, *bus_pci_str, *bus_drv_str; 423 357 424 - frozen_dn = eeh_find_device_pe(eeh_dev_to_of_node(event->edev)); 425 - if (!frozen_dn) { 426 - location = of_get_property(eeh_dev_to_of_node(event->edev), "ibm,loc-code", NULL); 427 - location = location ? location : "unknown"; 428 - printk(KERN_ERR "EEH: Error: Cannot find partition endpoint " 429 - "for location=%s pci addr=%s\n", 430 - location, eeh_pci_name(eeh_dev_to_pci_dev(event->edev))); 431 - return NULL; 432 - } 433 - 434 - frozen_bus = pcibios_find_pci_bus(frozen_dn); 435 - location = of_get_property(frozen_dn, "ibm,loc-code", NULL); 436 - location = location ? location : "unknown"; 437 - 438 - /* There are two different styles for coming up with the PE. 439 - * In the old style, it was the highest EEH-capable device 440 - * which was always an EADS pci bridge. In the new style, 441 - * there might not be any EADS bridges, and even when there are, 442 - * the firmware marks them as "EEH incapable". So another 443 - * two-step is needed to find the pci bus.. 444 - */ 445 - if (!frozen_bus) 446 - frozen_bus = pcibios_find_pci_bus(frozen_dn->parent); 447 - 358 + frozen_bus = eeh_pe_bus_get(pe); 448 359 if (!frozen_bus) { 449 - printk(KERN_ERR "EEH: Cannot find PCI bus " 450 - "for location=%s dn=%s\n", 451 - location, frozen_dn->full_name); 452 - return NULL; 360 + pr_err("%s: Cannot find PCI bus for PHB#%d-PE#%x\n", 361 + __func__, pe->phb->global_number, pe->addr); 362 + return; 453 363 } 454 364 455 - frozen_edev = of_node_to_eeh_dev(frozen_dn); 456 - frozen_edev->freeze_count++; 457 - pci_str = eeh_pci_name(eeh_dev_to_pci_dev(event->edev)); 458 - drv_str = eeh_pcid_name(eeh_dev_to_pci_dev(event->edev)); 459 - 460 - if (frozen_edev->freeze_count > EEH_MAX_ALLOWED_FREEZES) 365 + pe->freeze_count++; 366 + if (pe->freeze_count > EEH_MAX_ALLOWED_FREEZES) 461 367 goto excess_failures; 462 - 463 - printk(KERN_WARNING 464 - "EEH: This PCI device has failed %d times in the last hour:\n", 465 - frozen_edev->freeze_count); 466 - 467 - if (frozen_edev->pdev) { 468 - bus_pci_str = pci_name(frozen_edev->pdev); 469 - bus_drv_str = eeh_pcid_name(frozen_edev->pdev); 470 - printk(KERN_WARNING 471 - "EEH: Bus location=%s driver=%s pci addr=%s\n", 472 - location, bus_drv_str, bus_pci_str); 473 - } 474 - 475 - printk(KERN_WARNING 476 - "EEH: Device location=%s driver=%s pci addr=%s\n", 477 - location, drv_str, pci_str); 368 + pr_warning("EEH: This PCI device has failed %d times in the last hour\n", 369 + pe->freeze_count); 478 370 479 371 /* Walk the various device drivers attached to this slot through 480 372 * a reset sequence, giving each an opportunity to do what it needs ··· 437 419 * status ... if any child can't handle the reset, then the entire 438 420 * slot is dlpar removed and added. 439 421 */ 440 - pci_walk_bus(frozen_bus, eeh_report_error, &result); 422 + eeh_pe_dev_traverse(pe, eeh_report_error, &result); 441 423 442 424 /* Get the current PCI slot state. This can take a long time, 443 425 * sometimes over 3 seconds for certain systems. 444 426 */ 445 - rc = eeh_ops->wait_state(eeh_dev_to_of_node(frozen_edev), MAX_WAIT_FOR_RECOVERY*1000); 427 + rc = eeh_ops->wait_state(pe, MAX_WAIT_FOR_RECOVERY*1000); 446 428 if (rc < 0 || rc == EEH_STATE_NOT_SUPPORT) { 447 429 printk(KERN_WARNING "EEH: Permanent failure\n"); 448 430 goto hard_fail; ··· 452 434 * don't post the error log until after all dev drivers 453 435 * have been informed. 454 436 */ 455 - eeh_slot_error_detail(frozen_edev, EEH_LOG_TEMP); 437 + eeh_slot_error_detail(pe, EEH_LOG_TEMP); 456 438 457 439 /* If all device drivers were EEH-unaware, then shut 458 440 * down all of the device drivers, and hope they 459 441 * go down willingly, without panicing the system. 460 442 */ 461 443 if (result == PCI_ERS_RESULT_NONE) { 462 - rc = eeh_reset_device(frozen_edev, frozen_bus); 444 + rc = eeh_reset_device(pe, frozen_bus); 463 445 if (rc) { 464 446 printk(KERN_WARNING "EEH: Unable to reset, rc=%d\n", rc); 465 447 goto hard_fail; ··· 468 450 469 451 /* If all devices reported they can proceed, then re-enable MMIO */ 470 452 if (result == PCI_ERS_RESULT_CAN_RECOVER) { 471 - rc = eeh_pci_enable(frozen_edev, EEH_OPT_THAW_MMIO); 453 + rc = eeh_pci_enable(pe, EEH_OPT_THAW_MMIO); 472 454 473 455 if (rc < 0) 474 456 goto hard_fail; ··· 476 458 result = PCI_ERS_RESULT_NEED_RESET; 477 459 } else { 478 460 result = PCI_ERS_RESULT_NONE; 479 - pci_walk_bus(frozen_bus, eeh_report_mmio_enabled, &result); 461 + eeh_pe_dev_traverse(pe, eeh_report_mmio_enabled, &result); 480 462 } 481 463 } 482 464 483 465 /* If all devices reported they can proceed, then re-enable DMA */ 484 466 if (result == PCI_ERS_RESULT_CAN_RECOVER) { 485 - rc = eeh_pci_enable(frozen_edev, EEH_OPT_THAW_DMA); 467 + rc = eeh_pci_enable(pe, EEH_OPT_THAW_DMA); 486 468 487 469 if (rc < 0) 488 470 goto hard_fail; ··· 500 482 501 483 /* If any device called out for a reset, then reset the slot */ 502 484 if (result == PCI_ERS_RESULT_NEED_RESET) { 503 - rc = eeh_reset_device(frozen_edev, NULL); 485 + rc = eeh_reset_device(pe, NULL); 504 486 if (rc) { 505 487 printk(KERN_WARNING "EEH: Cannot reset, rc=%d\n", rc); 506 488 goto hard_fail; 507 489 } 508 490 result = PCI_ERS_RESULT_NONE; 509 - pci_walk_bus(frozen_bus, eeh_report_reset, &result); 491 + eeh_pe_dev_traverse(pe, eeh_report_reset, &result); 510 492 } 511 493 512 494 /* All devices should claim they have recovered by now. */ ··· 517 499 } 518 500 519 501 /* Tell all device drivers that they can resume operations */ 520 - pci_walk_bus(frozen_bus, eeh_report_resume, NULL); 502 + eeh_pe_dev_traverse(pe, eeh_report_resume, NULL); 521 503 522 - return frozen_edev; 504 + return; 523 505 524 506 excess_failures: 525 507 /* ··· 527 509 * are due to poorly seated PCI cards. Only 10% or so are 528 510 * due to actual, failed cards. 529 511 */ 530 - printk(KERN_ERR 531 - "EEH: PCI device at location=%s driver=%s pci addr=%s\n" 532 - "has failed %d times in the last hour " 533 - "and has been permanently disabled.\n" 534 - "Please try reseating this device or replacing it.\n", 535 - location, drv_str, pci_str, frozen_edev->freeze_count); 512 + pr_err("EEH: PHB#%d-PE#%x has failed %d times in the\n" 513 + "last hour and has been permanently disabled.\n" 514 + "Please try reseating or replacing it.\n", 515 + pe->phb->global_number, pe->addr, 516 + pe->freeze_count); 536 517 goto perm_error; 537 518 538 519 hard_fail: 539 - printk(KERN_ERR 540 - "EEH: Unable to recover from failure of PCI device " 541 - "at location=%s driver=%s pci addr=%s\n" 542 - "Please try reseating this device or replacing it.\n", 543 - location, drv_str, pci_str); 520 + pr_err("EEH: Unable to recover from failure from PHB#%d-PE#%x.\n" 521 + "Please try reseating or replacing it\n", 522 + pe->phb->global_number, pe->addr); 544 523 545 524 perm_error: 546 - eeh_slot_error_detail(frozen_edev, EEH_LOG_PERM); 525 + eeh_slot_error_detail(pe, EEH_LOG_PERM); 547 526 548 527 /* Notify all devices that they're about to go down. */ 549 - pci_walk_bus(frozen_bus, eeh_report_failure, NULL); 528 + eeh_pe_dev_traverse(pe, eeh_report_failure, NULL); 550 529 551 530 /* Shut down the device drivers for good. */ 552 - pcibios_remove_pci_devices(frozen_bus); 553 - 554 - return NULL; 531 + if (frozen_bus) 532 + pcibios_remove_pci_devices(frozen_bus); 555 533 } 556 534
+17 -35
arch/powerpc/platforms/pseries/eeh_event.c
··· 57 57 { 58 58 unsigned long flags; 59 59 struct eeh_event *event; 60 - struct eeh_dev *edev; 60 + struct eeh_pe *pe; 61 61 62 62 set_task_comm(current, "eehd"); 63 63 ··· 76 76 77 77 /* Serialize processing of EEH events */ 78 78 mutex_lock(&eeh_event_mutex); 79 - edev = event->edev; 80 - eeh_mark_slot(eeh_dev_to_of_node(edev), EEH_MODE_RECOVERING); 81 - 82 - printk(KERN_INFO "EEH: Detected PCI bus error on device %s\n", 83 - eeh_pci_name(edev->pdev)); 79 + pe = event->pe; 80 + eeh_pe_state_mark(pe, EEH_PE_RECOVERING); 81 + pr_info("EEH: Detected PCI bus error on PHB#%d-PE#%x\n", 82 + pe->phb->global_number, pe->addr); 84 83 85 84 set_current_state(TASK_INTERRUPTIBLE); /* Don't add to load average */ 86 - edev = handle_eeh_events(event); 87 - 88 - if (edev) { 89 - eeh_clear_slot(eeh_dev_to_of_node(edev), EEH_MODE_RECOVERING); 90 - pci_dev_put(edev->pdev); 91 - } 85 + eeh_handle_event(pe); 86 + eeh_pe_state_clear(pe, EEH_PE_RECOVERING); 92 87 93 88 kfree(event); 94 89 mutex_unlock(&eeh_event_mutex); 95 90 96 91 /* If there are no new errors after an hour, clear the counter. */ 97 - if (edev && edev->freeze_count>0) { 92 + if (pe && pe->freeze_count > 0) { 98 93 msleep_interruptible(3600*1000); 99 - if (edev->freeze_count>0) 100 - edev->freeze_count--; 94 + if (pe->freeze_count > 0) 95 + pe->freeze_count--; 101 96 102 97 } 103 98 ··· 114 119 115 120 /** 116 121 * eeh_send_failure_event - Generate a PCI error event 117 - * @edev: EEH device 122 + * @pe: EEH PE 118 123 * 119 124 * This routine can be called within an interrupt context; 120 125 * the actual event will be delivered in a normal context 121 126 * (from a workqueue). 122 127 */ 123 - int eeh_send_failure_event(struct eeh_dev *edev) 128 + int eeh_send_failure_event(struct eeh_pe *pe) 124 129 { 125 130 unsigned long flags; 126 131 struct eeh_event *event; 127 - struct device_node *dn = eeh_dev_to_of_node(edev); 128 - const char *location; 129 132 130 - if (!mem_init_done) { 131 - printk(KERN_ERR "EEH: event during early boot not handled\n"); 132 - location = of_get_property(dn, "ibm,loc-code", NULL); 133 - printk(KERN_ERR "EEH: device node = %s\n", dn->full_name); 134 - printk(KERN_ERR "EEH: PCI location = %s\n", location); 135 - return 1; 133 + event = kzalloc(sizeof(*event), GFP_ATOMIC); 134 + if (!event) { 135 + pr_err("EEH: out of memory, event not handled\n"); 136 + return -ENOMEM; 136 137 } 137 - event = kmalloc(sizeof(*event), GFP_ATOMIC); 138 - if (event == NULL) { 139 - printk(KERN_ERR "EEH: out of memory, event not handled\n"); 140 - return 1; 141 - } 142 - 143 - if (edev->pdev) 144 - pci_dev_get(edev->pdev); 145 - 146 - event->edev = edev; 138 + event->pe = pe; 147 139 148 140 /* We may or may not be called in an interrupt context */ 149 141 spin_lock_irqsave(&eeh_eventlist_lock, flags);
+652
arch/powerpc/platforms/pseries/eeh_pe.c
··· 1 + /* 2 + * The file intends to implement PE based on the information from 3 + * platforms. Basically, there have 3 types of PEs: PHB/Bus/Device. 4 + * All the PEs should be organized as hierarchy tree. The first level 5 + * of the tree will be associated to existing PHBs since the particular 6 + * PE is only meaningful in one PHB domain. 7 + * 8 + * Copyright Benjamin Herrenschmidt & Gavin Shan, IBM Corporation 2012. 9 + * 10 + * This program is free software; you can redistribute it and/or modify 11 + * it under the terms of the GNU General Public License as published by 12 + * the Free Software Foundation; either version 2 of the License, or 13 + * (at your option) any later version. 14 + * 15 + * This program is distributed in the hope that it will be useful, 16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 + * GNU General Public License for more details. 19 + * 20 + * You should have received a copy of the GNU General Public License 21 + * along with this program; if not, write to the Free Software 22 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 + */ 24 + 25 + #include <linux/export.h> 26 + #include <linux/gfp.h> 27 + #include <linux/init.h> 28 + #include <linux/kernel.h> 29 + #include <linux/pci.h> 30 + #include <linux/string.h> 31 + 32 + #include <asm/pci-bridge.h> 33 + #include <asm/ppc-pci.h> 34 + 35 + static LIST_HEAD(eeh_phb_pe); 36 + 37 + /** 38 + * eeh_pe_alloc - Allocate PE 39 + * @phb: PCI controller 40 + * @type: PE type 41 + * 42 + * Allocate PE instance dynamically. 43 + */ 44 + static struct eeh_pe *eeh_pe_alloc(struct pci_controller *phb, int type) 45 + { 46 + struct eeh_pe *pe; 47 + 48 + /* Allocate PHB PE */ 49 + pe = kzalloc(sizeof(struct eeh_pe), GFP_KERNEL); 50 + if (!pe) return NULL; 51 + 52 + /* Initialize PHB PE */ 53 + pe->type = type; 54 + pe->phb = phb; 55 + INIT_LIST_HEAD(&pe->child_list); 56 + INIT_LIST_HEAD(&pe->child); 57 + INIT_LIST_HEAD(&pe->edevs); 58 + 59 + return pe; 60 + } 61 + 62 + /** 63 + * eeh_phb_pe_create - Create PHB PE 64 + * @phb: PCI controller 65 + * 66 + * The function should be called while the PHB is detected during 67 + * system boot or PCI hotplug in order to create PHB PE. 68 + */ 69 + int __devinit eeh_phb_pe_create(struct pci_controller *phb) 70 + { 71 + struct eeh_pe *pe; 72 + 73 + /* Allocate PHB PE */ 74 + pe = eeh_pe_alloc(phb, EEH_PE_PHB); 75 + if (!pe) { 76 + pr_err("%s: out of memory!\n", __func__); 77 + return -ENOMEM; 78 + } 79 + 80 + /* Put it into the list */ 81 + eeh_lock(); 82 + list_add_tail(&pe->child, &eeh_phb_pe); 83 + eeh_unlock(); 84 + 85 + pr_debug("EEH: Add PE for PHB#%d\n", phb->global_number); 86 + 87 + return 0; 88 + } 89 + 90 + /** 91 + * eeh_phb_pe_get - Retrieve PHB PE based on the given PHB 92 + * @phb: PCI controller 93 + * 94 + * The overall PEs form hierarchy tree. The first layer of the 95 + * hierarchy tree is composed of PHB PEs. The function is used 96 + * to retrieve the corresponding PHB PE according to the given PHB. 97 + */ 98 + static struct eeh_pe *eeh_phb_pe_get(struct pci_controller *phb) 99 + { 100 + struct eeh_pe *pe; 101 + 102 + list_for_each_entry(pe, &eeh_phb_pe, child) { 103 + /* 104 + * Actually, we needn't check the type since 105 + * the PE for PHB has been determined when that 106 + * was created. 107 + */ 108 + if ((pe->type & EEH_PE_PHB) && pe->phb == phb) 109 + return pe; 110 + } 111 + 112 + return NULL; 113 + } 114 + 115 + /** 116 + * eeh_pe_next - Retrieve the next PE in the tree 117 + * @pe: current PE 118 + * @root: root PE 119 + * 120 + * The function is used to retrieve the next PE in the 121 + * hierarchy PE tree. 122 + */ 123 + static struct eeh_pe *eeh_pe_next(struct eeh_pe *pe, 124 + struct eeh_pe *root) 125 + { 126 + struct list_head *next = pe->child_list.next; 127 + 128 + if (next == &pe->child_list) { 129 + while (1) { 130 + if (pe == root) 131 + return NULL; 132 + next = pe->child.next; 133 + if (next != &pe->parent->child_list) 134 + break; 135 + pe = pe->parent; 136 + } 137 + } 138 + 139 + return list_entry(next, struct eeh_pe, child); 140 + } 141 + 142 + /** 143 + * eeh_pe_traverse - Traverse PEs in the specified PHB 144 + * @root: root PE 145 + * @fn: callback 146 + * @flag: extra parameter to callback 147 + * 148 + * The function is used to traverse the specified PE and its 149 + * child PEs. The traversing is to be terminated once the 150 + * callback returns something other than NULL, or no more PEs 151 + * to be traversed. 152 + */ 153 + static void *eeh_pe_traverse(struct eeh_pe *root, 154 + eeh_traverse_func fn, void *flag) 155 + { 156 + struct eeh_pe *pe; 157 + void *ret; 158 + 159 + for (pe = root; pe; pe = eeh_pe_next(pe, root)) { 160 + ret = fn(pe, flag); 161 + if (ret) return ret; 162 + } 163 + 164 + return NULL; 165 + } 166 + 167 + /** 168 + * eeh_pe_dev_traverse - Traverse the devices from the PE 169 + * @root: EEH PE 170 + * @fn: function callback 171 + * @flag: extra parameter to callback 172 + * 173 + * The function is used to traverse the devices of the specified 174 + * PE and its child PEs. 175 + */ 176 + void *eeh_pe_dev_traverse(struct eeh_pe *root, 177 + eeh_traverse_func fn, void *flag) 178 + { 179 + struct eeh_pe *pe; 180 + struct eeh_dev *edev; 181 + void *ret; 182 + 183 + if (!root) { 184 + pr_warning("%s: Invalid PE %p\n", __func__, root); 185 + return NULL; 186 + } 187 + 188 + eeh_lock(); 189 + 190 + /* Traverse root PE */ 191 + for (pe = root; pe; pe = eeh_pe_next(pe, root)) { 192 + eeh_pe_for_each_dev(pe, edev) { 193 + ret = fn(edev, flag); 194 + if (ret) { 195 + eeh_unlock(); 196 + return ret; 197 + } 198 + } 199 + } 200 + 201 + eeh_unlock(); 202 + 203 + return NULL; 204 + } 205 + 206 + /** 207 + * __eeh_pe_get - Check the PE address 208 + * @data: EEH PE 209 + * @flag: EEH device 210 + * 211 + * For one particular PE, it can be identified by PE address 212 + * or tranditional BDF address. BDF address is composed of 213 + * Bus/Device/Function number. The extra data referred by flag 214 + * indicates which type of address should be used. 215 + */ 216 + static void *__eeh_pe_get(void *data, void *flag) 217 + { 218 + struct eeh_pe *pe = (struct eeh_pe *)data; 219 + struct eeh_dev *edev = (struct eeh_dev *)flag; 220 + 221 + /* Unexpected PHB PE */ 222 + if (pe->type & EEH_PE_PHB) 223 + return NULL; 224 + 225 + /* We prefer PE address */ 226 + if (edev->pe_config_addr && 227 + (edev->pe_config_addr == pe->addr)) 228 + return pe; 229 + 230 + /* Try BDF address */ 231 + if (edev->pe_config_addr && 232 + (edev->config_addr == pe->config_addr)) 233 + return pe; 234 + 235 + return NULL; 236 + } 237 + 238 + /** 239 + * eeh_pe_get - Search PE based on the given address 240 + * @edev: EEH device 241 + * 242 + * Search the corresponding PE based on the specified address which 243 + * is included in the eeh device. The function is used to check if 244 + * the associated PE has been created against the PE address. It's 245 + * notable that the PE address has 2 format: traditional PE address 246 + * which is composed of PCI bus/device/function number, or unified 247 + * PE address. 248 + */ 249 + static struct eeh_pe *eeh_pe_get(struct eeh_dev *edev) 250 + { 251 + struct eeh_pe *root = eeh_phb_pe_get(edev->phb); 252 + struct eeh_pe *pe; 253 + 254 + pe = eeh_pe_traverse(root, __eeh_pe_get, edev); 255 + 256 + return pe; 257 + } 258 + 259 + /** 260 + * eeh_pe_get_parent - Retrieve the parent PE 261 + * @edev: EEH device 262 + * 263 + * The whole PEs existing in the system are organized as hierarchy 264 + * tree. The function is used to retrieve the parent PE according 265 + * to the parent EEH device. 266 + */ 267 + static struct eeh_pe *eeh_pe_get_parent(struct eeh_dev *edev) 268 + { 269 + struct device_node *dn; 270 + struct eeh_dev *parent; 271 + 272 + /* 273 + * It might have the case for the indirect parent 274 + * EEH device already having associated PE, but 275 + * the direct parent EEH device doesn't have yet. 276 + */ 277 + dn = edev->dn->parent; 278 + while (dn) { 279 + /* We're poking out of PCI territory */ 280 + if (!PCI_DN(dn)) return NULL; 281 + 282 + parent = of_node_to_eeh_dev(dn); 283 + /* We're poking out of PCI territory */ 284 + if (!parent) return NULL; 285 + 286 + if (parent->pe) 287 + return parent->pe; 288 + 289 + dn = dn->parent; 290 + } 291 + 292 + return NULL; 293 + } 294 + 295 + /** 296 + * eeh_add_to_parent_pe - Add EEH device to parent PE 297 + * @edev: EEH device 298 + * 299 + * Add EEH device to the parent PE. If the parent PE already 300 + * exists, the PE type will be changed to EEH_PE_BUS. Otherwise, 301 + * we have to create new PE to hold the EEH device and the new 302 + * PE will be linked to its parent PE as well. 303 + */ 304 + int eeh_add_to_parent_pe(struct eeh_dev *edev) 305 + { 306 + struct eeh_pe *pe, *parent; 307 + 308 + eeh_lock(); 309 + 310 + /* 311 + * Search the PE has been existing or not according 312 + * to the PE address. If that has been existing, the 313 + * PE should be composed of PCI bus and its subordinate 314 + * components. 315 + */ 316 + pe = eeh_pe_get(edev); 317 + if (pe && !(pe->type & EEH_PE_INVALID)) { 318 + if (!edev->pe_config_addr) { 319 + eeh_unlock(); 320 + pr_err("%s: PE with addr 0x%x already exists\n", 321 + __func__, edev->config_addr); 322 + return -EEXIST; 323 + } 324 + 325 + /* Mark the PE as type of PCI bus */ 326 + pe->type = EEH_PE_BUS; 327 + edev->pe = pe; 328 + 329 + /* Put the edev to PE */ 330 + list_add_tail(&edev->list, &pe->edevs); 331 + eeh_unlock(); 332 + pr_debug("EEH: Add %s to Bus PE#%x\n", 333 + edev->dn->full_name, pe->addr); 334 + 335 + return 0; 336 + } else if (pe && (pe->type & EEH_PE_INVALID)) { 337 + list_add_tail(&edev->list, &pe->edevs); 338 + edev->pe = pe; 339 + /* 340 + * We're running to here because of PCI hotplug caused by 341 + * EEH recovery. We need clear EEH_PE_INVALID until the top. 342 + */ 343 + parent = pe; 344 + while (parent) { 345 + if (!(parent->type & EEH_PE_INVALID)) 346 + break; 347 + parent->type &= ~EEH_PE_INVALID; 348 + parent = parent->parent; 349 + } 350 + eeh_unlock(); 351 + pr_debug("EEH: Add %s to Device PE#%x, Parent PE#%x\n", 352 + edev->dn->full_name, pe->addr, pe->parent->addr); 353 + 354 + return 0; 355 + } 356 + 357 + /* Create a new EEH PE */ 358 + pe = eeh_pe_alloc(edev->phb, EEH_PE_DEVICE); 359 + if (!pe) { 360 + eeh_unlock(); 361 + pr_err("%s: out of memory!\n", __func__); 362 + return -ENOMEM; 363 + } 364 + pe->addr = edev->pe_config_addr; 365 + pe->config_addr = edev->config_addr; 366 + 367 + /* 368 + * Put the new EEH PE into hierarchy tree. If the parent 369 + * can't be found, the newly created PE will be attached 370 + * to PHB directly. Otherwise, we have to associate the 371 + * PE with its parent. 372 + */ 373 + parent = eeh_pe_get_parent(edev); 374 + if (!parent) { 375 + parent = eeh_phb_pe_get(edev->phb); 376 + if (!parent) { 377 + eeh_unlock(); 378 + pr_err("%s: No PHB PE is found (PHB Domain=%d)\n", 379 + __func__, edev->phb->global_number); 380 + edev->pe = NULL; 381 + kfree(pe); 382 + return -EEXIST; 383 + } 384 + } 385 + pe->parent = parent; 386 + 387 + /* 388 + * Put the newly created PE into the child list and 389 + * link the EEH device accordingly. 390 + */ 391 + list_add_tail(&pe->child, &parent->child_list); 392 + list_add_tail(&edev->list, &pe->edevs); 393 + edev->pe = pe; 394 + eeh_unlock(); 395 + pr_debug("EEH: Add %s to Device PE#%x, Parent PE#%x\n", 396 + edev->dn->full_name, pe->addr, pe->parent->addr); 397 + 398 + return 0; 399 + } 400 + 401 + /** 402 + * eeh_rmv_from_parent_pe - Remove one EEH device from the associated PE 403 + * @edev: EEH device 404 + * @purge_pe: remove PE or not 405 + * 406 + * The PE hierarchy tree might be changed when doing PCI hotplug. 407 + * Also, the PCI devices or buses could be removed from the system 408 + * during EEH recovery. So we have to call the function remove the 409 + * corresponding PE accordingly if necessary. 410 + */ 411 + int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe) 412 + { 413 + struct eeh_pe *pe, *parent, *child; 414 + int cnt; 415 + 416 + if (!edev->pe) { 417 + pr_warning("%s: No PE found for EEH device %s\n", 418 + __func__, edev->dn->full_name); 419 + return -EEXIST; 420 + } 421 + 422 + eeh_lock(); 423 + 424 + /* Remove the EEH device */ 425 + pe = edev->pe; 426 + edev->pe = NULL; 427 + list_del(&edev->list); 428 + 429 + /* 430 + * Check if the parent PE includes any EEH devices. 431 + * If not, we should delete that. Also, we should 432 + * delete the parent PE if it doesn't have associated 433 + * child PEs and EEH devices. 434 + */ 435 + while (1) { 436 + parent = pe->parent; 437 + if (pe->type & EEH_PE_PHB) 438 + break; 439 + 440 + if (purge_pe) { 441 + if (list_empty(&pe->edevs) && 442 + list_empty(&pe->child_list)) { 443 + list_del(&pe->child); 444 + kfree(pe); 445 + } else { 446 + break; 447 + } 448 + } else { 449 + if (list_empty(&pe->edevs)) { 450 + cnt = 0; 451 + list_for_each_entry(child, &pe->child_list, child) { 452 + if (!(pe->type & EEH_PE_INVALID)) { 453 + cnt++; 454 + break; 455 + } 456 + } 457 + 458 + if (!cnt) 459 + pe->type |= EEH_PE_INVALID; 460 + else 461 + break; 462 + } 463 + } 464 + 465 + pe = parent; 466 + } 467 + 468 + eeh_unlock(); 469 + 470 + return 0; 471 + } 472 + 473 + /** 474 + * __eeh_pe_state_mark - Mark the state for the PE 475 + * @data: EEH PE 476 + * @flag: state 477 + * 478 + * The function is used to mark the indicated state for the given 479 + * PE. Also, the associated PCI devices will be put into IO frozen 480 + * state as well. 481 + */ 482 + static void *__eeh_pe_state_mark(void *data, void *flag) 483 + { 484 + struct eeh_pe *pe = (struct eeh_pe *)data; 485 + int state = *((int *)flag); 486 + struct eeh_dev *tmp; 487 + struct pci_dev *pdev; 488 + 489 + /* 490 + * Mark the PE with the indicated state. Also, 491 + * the associated PCI device will be put into 492 + * I/O frozen state to avoid I/O accesses from 493 + * the PCI device driver. 494 + */ 495 + pe->state |= state; 496 + eeh_pe_for_each_dev(pe, tmp) { 497 + pdev = eeh_dev_to_pci_dev(tmp); 498 + if (pdev) 499 + pdev->error_state = pci_channel_io_frozen; 500 + } 501 + 502 + return NULL; 503 + } 504 + 505 + /** 506 + * eeh_pe_state_mark - Mark specified state for PE and its associated device 507 + * @pe: EEH PE 508 + * 509 + * EEH error affects the current PE and its child PEs. The function 510 + * is used to mark appropriate state for the affected PEs and the 511 + * associated devices. 512 + */ 513 + void eeh_pe_state_mark(struct eeh_pe *pe, int state) 514 + { 515 + eeh_lock(); 516 + eeh_pe_traverse(pe, __eeh_pe_state_mark, &state); 517 + eeh_unlock(); 518 + } 519 + 520 + /** 521 + * __eeh_pe_state_clear - Clear state for the PE 522 + * @data: EEH PE 523 + * @flag: state 524 + * 525 + * The function is used to clear the indicated state from the 526 + * given PE. Besides, we also clear the check count of the PE 527 + * as well. 528 + */ 529 + static void *__eeh_pe_state_clear(void *data, void *flag) 530 + { 531 + struct eeh_pe *pe = (struct eeh_pe *)data; 532 + int state = *((int *)flag); 533 + 534 + pe->state &= ~state; 535 + pe->check_count = 0; 536 + 537 + return NULL; 538 + } 539 + 540 + /** 541 + * eeh_pe_state_clear - Clear state for the PE and its children 542 + * @pe: PE 543 + * @state: state to be cleared 544 + * 545 + * When the PE and its children has been recovered from error, 546 + * we need clear the error state for that. The function is used 547 + * for the purpose. 548 + */ 549 + void eeh_pe_state_clear(struct eeh_pe *pe, int state) 550 + { 551 + eeh_lock(); 552 + eeh_pe_traverse(pe, __eeh_pe_state_clear, &state); 553 + eeh_unlock(); 554 + } 555 + 556 + /** 557 + * eeh_restore_one_device_bars - Restore the Base Address Registers for one device 558 + * @data: EEH device 559 + * @flag: Unused 560 + * 561 + * Loads the PCI configuration space base address registers, 562 + * the expansion ROM base address, the latency timer, and etc. 563 + * from the saved values in the device node. 564 + */ 565 + static void *eeh_restore_one_device_bars(void *data, void *flag) 566 + { 567 + int i; 568 + u32 cmd; 569 + struct eeh_dev *edev = (struct eeh_dev *)data; 570 + struct device_node *dn = eeh_dev_to_of_node(edev); 571 + 572 + for (i = 4; i < 10; i++) 573 + eeh_ops->write_config(dn, i*4, 4, edev->config_space[i]); 574 + /* 12 == Expansion ROM Address */ 575 + eeh_ops->write_config(dn, 12*4, 4, edev->config_space[12]); 576 + 577 + #define BYTE_SWAP(OFF) (8*((OFF)/4)+3-(OFF)) 578 + #define SAVED_BYTE(OFF) (((u8 *)(edev->config_space))[BYTE_SWAP(OFF)]) 579 + 580 + eeh_ops->write_config(dn, PCI_CACHE_LINE_SIZE, 1, 581 + SAVED_BYTE(PCI_CACHE_LINE_SIZE)); 582 + eeh_ops->write_config(dn, PCI_LATENCY_TIMER, 1, 583 + SAVED_BYTE(PCI_LATENCY_TIMER)); 584 + 585 + /* max latency, min grant, interrupt pin and line */ 586 + eeh_ops->write_config(dn, 15*4, 4, edev->config_space[15]); 587 + 588 + /* 589 + * Restore PERR & SERR bits, some devices require it, 590 + * don't touch the other command bits 591 + */ 592 + eeh_ops->read_config(dn, PCI_COMMAND, 4, &cmd); 593 + if (edev->config_space[1] & PCI_COMMAND_PARITY) 594 + cmd |= PCI_COMMAND_PARITY; 595 + else 596 + cmd &= ~PCI_COMMAND_PARITY; 597 + if (edev->config_space[1] & PCI_COMMAND_SERR) 598 + cmd |= PCI_COMMAND_SERR; 599 + else 600 + cmd &= ~PCI_COMMAND_SERR; 601 + eeh_ops->write_config(dn, PCI_COMMAND, 4, cmd); 602 + 603 + return NULL; 604 + } 605 + 606 + /** 607 + * eeh_pe_restore_bars - Restore the PCI config space info 608 + * @pe: EEH PE 609 + * 610 + * This routine performs a recursive walk to the children 611 + * of this device as well. 612 + */ 613 + void eeh_pe_restore_bars(struct eeh_pe *pe) 614 + { 615 + /* 616 + * We needn't take the EEH lock since eeh_pe_dev_traverse() 617 + * will take that. 618 + */ 619 + eeh_pe_dev_traverse(pe, eeh_restore_one_device_bars, NULL); 620 + } 621 + 622 + /** 623 + * eeh_pe_bus_get - Retrieve PCI bus according to the given PE 624 + * @pe: EEH PE 625 + * 626 + * Retrieve the PCI bus according to the given PE. Basically, 627 + * there're 3 types of PEs: PHB/Bus/Device. For PHB PE, the 628 + * primary PCI bus will be retrieved. The parent bus will be 629 + * returned for BUS PE. However, we don't have associated PCI 630 + * bus for DEVICE PE. 631 + */ 632 + struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe) 633 + { 634 + struct pci_bus *bus = NULL; 635 + struct eeh_dev *edev; 636 + struct pci_dev *pdev; 637 + 638 + eeh_lock(); 639 + 640 + if (pe->type & EEH_PE_PHB) { 641 + bus = pe->phb->bus; 642 + } else if (pe->type & EEH_PE_BUS) { 643 + edev = list_first_entry(&pe->edevs, struct eeh_dev, list); 644 + pdev = eeh_dev_to_pci_dev(edev); 645 + if (pdev) 646 + bus = pdev->bus; 647 + } 648 + 649 + eeh_unlock(); 650 + 651 + return bus; 652 + }
+169 -78
arch/powerpc/platforms/pseries/eeh_pseries.c
··· 129 129 eeh_error_buf_size = RTAS_ERROR_LOG_MAX; 130 130 } 131 131 132 + /* Set EEH probe mode */ 133 + eeh_probe_mode_set(EEH_PROBE_MODE_DEVTREE); 134 + 132 135 return 0; 133 136 } 134 137 135 138 /** 139 + * pseries_eeh_of_probe - EEH probe on the given device 140 + * @dn: OF node 141 + * @flag: Unused 142 + * 143 + * When EEH module is installed during system boot, all PCI devices 144 + * are checked one by one to see if it supports EEH. The function 145 + * is introduced for the purpose. 146 + */ 147 + static void *pseries_eeh_of_probe(struct device_node *dn, void *flag) 148 + { 149 + struct eeh_dev *edev; 150 + struct eeh_pe pe; 151 + const u32 *class_code, *vendor_id, *device_id; 152 + const u32 *regs; 153 + int enable = 0; 154 + int ret; 155 + 156 + /* Retrieve OF node and eeh device */ 157 + edev = of_node_to_eeh_dev(dn); 158 + if (!of_device_is_available(dn)) 159 + return NULL; 160 + 161 + /* Retrieve class/vendor/device IDs */ 162 + class_code = of_get_property(dn, "class-code", NULL); 163 + vendor_id = of_get_property(dn, "vendor-id", NULL); 164 + device_id = of_get_property(dn, "device-id", NULL); 165 + 166 + /* Skip for bad OF node or PCI-ISA bridge */ 167 + if (!class_code || !vendor_id || !device_id) 168 + return NULL; 169 + if (dn->type && !strcmp(dn->type, "isa")) 170 + return NULL; 171 + 172 + /* Update class code and mode of eeh device */ 173 + edev->class_code = *class_code; 174 + edev->mode = 0; 175 + 176 + /* Retrieve the device address */ 177 + regs = of_get_property(dn, "reg", NULL); 178 + if (!regs) { 179 + pr_warning("%s: OF node property %s::reg not found\n", 180 + __func__, dn->full_name); 181 + return NULL; 182 + } 183 + 184 + /* Initialize the fake PE */ 185 + memset(&pe, 0, sizeof(struct eeh_pe)); 186 + pe.phb = edev->phb; 187 + pe.config_addr = regs[0]; 188 + 189 + /* Enable EEH on the device */ 190 + ret = eeh_ops->set_option(&pe, EEH_OPT_ENABLE); 191 + if (!ret) { 192 + edev->config_addr = regs[0]; 193 + /* Retrieve PE address */ 194 + edev->pe_config_addr = eeh_ops->get_pe_addr(&pe); 195 + pe.addr = edev->pe_config_addr; 196 + 197 + /* Some older systems (Power4) allow the ibm,set-eeh-option 198 + * call to succeed even on nodes where EEH is not supported. 199 + * Verify support explicitly. 200 + */ 201 + ret = eeh_ops->get_state(&pe, NULL); 202 + if (ret > 0 && ret != EEH_STATE_NOT_SUPPORT) 203 + enable = 1; 204 + 205 + if (enable) { 206 + eeh_subsystem_enabled = 1; 207 + eeh_add_to_parent_pe(edev); 208 + 209 + pr_debug("%s: EEH enabled on %s PHB#%d-PE#%x, config addr#%x\n", 210 + __func__, dn->full_name, pe.phb->global_number, 211 + pe.addr, pe.config_addr); 212 + } else if (dn->parent && of_node_to_eeh_dev(dn->parent) && 213 + (of_node_to_eeh_dev(dn->parent))->pe) { 214 + /* This device doesn't support EEH, but it may have an 215 + * EEH parent, in which case we mark it as supported. 216 + */ 217 + edev->config_addr = of_node_to_eeh_dev(dn->parent)->config_addr; 218 + edev->pe_config_addr = of_node_to_eeh_dev(dn->parent)->pe_config_addr; 219 + eeh_add_to_parent_pe(edev); 220 + } 221 + } 222 + 223 + /* Save memory bars */ 224 + eeh_save_bars(edev); 225 + 226 + return NULL; 227 + } 228 + 229 + /** 136 230 * pseries_eeh_set_option - Initialize EEH or MMIO/DMA reenable 137 - * @dn: device node 231 + * @pe: EEH PE 138 232 * @option: operation to be issued 139 233 * 140 234 * The function is used to control the EEH functionality globally. 141 235 * Currently, following options are support according to PAPR: 142 236 * Enable EEH, Disable EEH, Enable MMIO and Enable DMA 143 237 */ 144 - static int pseries_eeh_set_option(struct device_node *dn, int option) 238 + static int pseries_eeh_set_option(struct eeh_pe *pe, int option) 145 239 { 146 240 int ret = 0; 147 - struct eeh_dev *edev; 148 - const u32 *reg; 149 241 int config_addr; 150 - 151 - edev = of_node_to_eeh_dev(dn); 152 242 153 243 /* 154 244 * When we're enabling or disabling EEH functioality on ··· 249 159 switch (option) { 250 160 case EEH_OPT_DISABLE: 251 161 case EEH_OPT_ENABLE: 252 - reg = of_get_property(dn, "reg", NULL); 253 - config_addr = reg[0]; 254 - break; 255 - 256 162 case EEH_OPT_THAW_MMIO: 257 163 case EEH_OPT_THAW_DMA: 258 - config_addr = edev->config_addr; 259 - if (edev->pe_config_addr) 260 - config_addr = edev->pe_config_addr; 164 + config_addr = pe->config_addr; 165 + if (pe->addr) 166 + config_addr = pe->addr; 261 167 break; 262 168 263 169 default: ··· 263 177 } 264 178 265 179 ret = rtas_call(ibm_set_eeh_option, 4, 1, NULL, 266 - config_addr, BUID_HI(edev->phb->buid), 267 - BUID_LO(edev->phb->buid), option); 180 + config_addr, BUID_HI(pe->phb->buid), 181 + BUID_LO(pe->phb->buid), option); 268 182 269 183 return ret; 270 184 } 271 185 272 186 /** 273 187 * pseries_eeh_get_pe_addr - Retrieve PE address 274 - * @dn: device node 188 + * @pe: EEH PE 275 189 * 276 190 * Retrieve the assocated PE address. Actually, there're 2 RTAS 277 191 * function calls dedicated for the purpose. We need implement ··· 282 196 * It's notable that zero'ed return value means invalid PE config 283 197 * address. 284 198 */ 285 - static int pseries_eeh_get_pe_addr(struct device_node *dn) 199 + static int pseries_eeh_get_pe_addr(struct eeh_pe *pe) 286 200 { 287 - struct eeh_dev *edev; 288 201 int ret = 0; 289 202 int rets[3]; 290 - 291 - edev = of_node_to_eeh_dev(dn); 292 203 293 204 if (ibm_get_config_addr_info2 != RTAS_UNKNOWN_SERVICE) { 294 205 /* ··· 294 211 * meaningless. 295 212 */ 296 213 ret = rtas_call(ibm_get_config_addr_info2, 4, 2, rets, 297 - edev->config_addr, BUID_HI(edev->phb->buid), 298 - BUID_LO(edev->phb->buid), 1); 214 + pe->config_addr, BUID_HI(pe->phb->buid), 215 + BUID_LO(pe->phb->buid), 1); 299 216 if (ret || (rets[0] == 0)) 300 217 return 0; 301 218 302 219 /* Retrieve the associated PE config address */ 303 220 ret = rtas_call(ibm_get_config_addr_info2, 4, 2, rets, 304 - edev->config_addr, BUID_HI(edev->phb->buid), 305 - BUID_LO(edev->phb->buid), 0); 221 + pe->config_addr, BUID_HI(pe->phb->buid), 222 + BUID_LO(pe->phb->buid), 0); 306 223 if (ret) { 307 - pr_warning("%s: Failed to get PE address for %s\n", 308 - __func__, dn->full_name); 224 + pr_warning("%s: Failed to get address for PHB#%d-PE#%x\n", 225 + __func__, pe->phb->global_number, pe->config_addr); 309 226 return 0; 310 227 } 311 228 ··· 314 231 315 232 if (ibm_get_config_addr_info != RTAS_UNKNOWN_SERVICE) { 316 233 ret = rtas_call(ibm_get_config_addr_info, 4, 2, rets, 317 - edev->config_addr, BUID_HI(edev->phb->buid), 318 - BUID_LO(edev->phb->buid), 0); 234 + pe->config_addr, BUID_HI(pe->phb->buid), 235 + BUID_LO(pe->phb->buid), 0); 319 236 if (ret) { 320 - pr_warning("%s: Failed to get PE address for %s\n", 321 - __func__, dn->full_name); 237 + pr_warning("%s: Failed to get address for PHB#%d-PE#%x\n", 238 + __func__, pe->phb->global_number, pe->config_addr); 322 239 return 0; 323 240 } 324 241 ··· 330 247 331 248 /** 332 249 * pseries_eeh_get_state - Retrieve PE state 333 - * @dn: PE associated device node 250 + * @pe: EEH PE 334 251 * @state: return value 335 252 * 336 253 * Retrieve the state of the specified PE. On RTAS compliant ··· 341 258 * RTAS calls for the purpose, we need to try the new one and back 342 259 * to the old one if the new one couldn't work properly. 343 260 */ 344 - static int pseries_eeh_get_state(struct device_node *dn, int *state) 261 + static int pseries_eeh_get_state(struct eeh_pe *pe, int *state) 345 262 { 346 - struct eeh_dev *edev; 347 263 int config_addr; 348 264 int ret; 349 265 int rets[4]; 350 266 int result; 351 267 352 268 /* Figure out PE config address if possible */ 353 - edev = of_node_to_eeh_dev(dn); 354 - config_addr = edev->config_addr; 355 - if (edev->pe_config_addr) 356 - config_addr = edev->pe_config_addr; 269 + config_addr = pe->config_addr; 270 + if (pe->addr) 271 + config_addr = pe->addr; 357 272 358 273 if (ibm_read_slot_reset_state2 != RTAS_UNKNOWN_SERVICE) { 359 274 ret = rtas_call(ibm_read_slot_reset_state2, 3, 4, rets, 360 - config_addr, BUID_HI(edev->phb->buid), 361 - BUID_LO(edev->phb->buid)); 275 + config_addr, BUID_HI(pe->phb->buid), 276 + BUID_LO(pe->phb->buid)); 362 277 } else if (ibm_read_slot_reset_state != RTAS_UNKNOWN_SERVICE) { 363 278 /* Fake PE unavailable info */ 364 279 rets[2] = 0; 365 280 ret = rtas_call(ibm_read_slot_reset_state, 3, 3, rets, 366 - config_addr, BUID_HI(edev->phb->buid), 367 - BUID_LO(edev->phb->buid)); 281 + config_addr, BUID_HI(pe->phb->buid), 282 + BUID_LO(pe->phb->buid)); 368 283 } else { 369 284 return EEH_STATE_NOT_SUPPORT; 370 285 } ··· 414 333 415 334 /** 416 335 * pseries_eeh_reset - Reset the specified PE 417 - * @dn: PE associated device node 336 + * @pe: EEH PE 418 337 * @option: reset option 419 338 * 420 339 * Reset the specified PE 421 340 */ 422 - static int pseries_eeh_reset(struct device_node *dn, int option) 341 + static int pseries_eeh_reset(struct eeh_pe *pe, int option) 423 342 { 424 - struct eeh_dev *edev; 425 343 int config_addr; 426 344 int ret; 427 345 428 346 /* Figure out PE address */ 429 - edev = of_node_to_eeh_dev(dn); 430 - config_addr = edev->config_addr; 431 - if (edev->pe_config_addr) 432 - config_addr = edev->pe_config_addr; 347 + config_addr = pe->config_addr; 348 + if (pe->addr) 349 + config_addr = pe->addr; 433 350 434 351 /* Reset PE through RTAS call */ 435 352 ret = rtas_call(ibm_set_slot_reset, 4, 1, NULL, 436 - config_addr, BUID_HI(edev->phb->buid), 437 - BUID_LO(edev->phb->buid), option); 353 + config_addr, BUID_HI(pe->phb->buid), 354 + BUID_LO(pe->phb->buid), option); 438 355 439 356 /* If fundamental-reset not supported, try hot-reset */ 440 357 if (option == EEH_RESET_FUNDAMENTAL && 441 358 ret == -8) { 442 359 ret = rtas_call(ibm_set_slot_reset, 4, 1, NULL, 443 - config_addr, BUID_HI(edev->phb->buid), 444 - BUID_LO(edev->phb->buid), EEH_RESET_HOT); 360 + config_addr, BUID_HI(pe->phb->buid), 361 + BUID_LO(pe->phb->buid), EEH_RESET_HOT); 445 362 } 446 363 447 364 return ret; ··· 447 368 448 369 /** 449 370 * pseries_eeh_wait_state - Wait for PE state 450 - * @dn: PE associated device node 371 + * @pe: EEH PE 451 372 * @max_wait: maximal period in microsecond 452 373 * 453 374 * Wait for the state of associated PE. It might take some time 454 375 * to retrieve the PE's state. 455 376 */ 456 - static int pseries_eeh_wait_state(struct device_node *dn, int max_wait) 377 + static int pseries_eeh_wait_state(struct eeh_pe *pe, int max_wait) 457 378 { 458 379 int ret; 459 380 int mwait; ··· 470 391 #define EEH_STATE_MAX_WAIT_TIME (300 * 1000) 471 392 472 393 while (1) { 473 - ret = pseries_eeh_get_state(dn, &mwait); 394 + ret = pseries_eeh_get_state(pe, &mwait); 474 395 475 396 /* 476 397 * If the PE's state is temporarily unavailable, ··· 505 426 506 427 /** 507 428 * pseries_eeh_get_log - Retrieve error log 508 - * @dn: device node 429 + * @pe: EEH PE 509 430 * @severity: temporary or permanent error log 510 431 * @drv_log: driver log to be combined with retrieved error log 511 432 * @len: length of driver log ··· 514 435 * Actually, the error will be retrieved through the dedicated 515 436 * RTAS call. 516 437 */ 517 - static int pseries_eeh_get_log(struct device_node *dn, int severity, char *drv_log, unsigned long len) 438 + static int pseries_eeh_get_log(struct eeh_pe *pe, int severity, char *drv_log, unsigned long len) 518 439 { 519 - struct eeh_dev *edev; 520 440 int config_addr; 521 441 unsigned long flags; 522 442 int ret; 523 443 524 - edev = of_node_to_eeh_dev(dn); 525 444 spin_lock_irqsave(&slot_errbuf_lock, flags); 526 445 memset(slot_errbuf, 0, eeh_error_buf_size); 527 446 528 447 /* Figure out the PE address */ 529 - config_addr = edev->config_addr; 530 - if (edev->pe_config_addr) 531 - config_addr = edev->pe_config_addr; 448 + config_addr = pe->config_addr; 449 + if (pe->addr) 450 + config_addr = pe->addr; 532 451 533 452 ret = rtas_call(ibm_slot_error_detail, 8, 1, NULL, config_addr, 534 - BUID_HI(edev->phb->buid), BUID_LO(edev->phb->buid), 453 + BUID_HI(pe->phb->buid), BUID_LO(pe->phb->buid), 535 454 virt_to_phys(drv_log), len, 536 455 virt_to_phys(slot_errbuf), eeh_error_buf_size, 537 456 severity); ··· 542 465 543 466 /** 544 467 * pseries_eeh_configure_bridge - Configure PCI bridges in the indicated PE 545 - * @dn: PE associated device node 468 + * @pe: EEH PE 546 469 * 547 470 * The function will be called to reconfigure the bridges included 548 471 * in the specified PE so that the mulfunctional PE would be recovered 549 472 * again. 550 473 */ 551 - static int pseries_eeh_configure_bridge(struct device_node *dn) 474 + static int pseries_eeh_configure_bridge(struct eeh_pe *pe) 552 475 { 553 - struct eeh_dev *edev; 554 476 int config_addr; 555 477 int ret; 556 478 557 479 /* Figure out the PE address */ 558 - edev = of_node_to_eeh_dev(dn); 559 - config_addr = edev->config_addr; 560 - if (edev->pe_config_addr) 561 - config_addr = edev->pe_config_addr; 480 + config_addr = pe->config_addr; 481 + if (pe->addr) 482 + config_addr = pe->addr; 562 483 563 484 /* Use new configure-pe function, if supported */ 564 485 if (ibm_configure_pe != RTAS_UNKNOWN_SERVICE) { 565 486 ret = rtas_call(ibm_configure_pe, 3, 1, NULL, 566 - config_addr, BUID_HI(edev->phb->buid), 567 - BUID_LO(edev->phb->buid)); 487 + config_addr, BUID_HI(pe->phb->buid), 488 + BUID_LO(pe->phb->buid)); 568 489 } else if (ibm_configure_bridge != RTAS_UNKNOWN_SERVICE) { 569 490 ret = rtas_call(ibm_configure_bridge, 3, 1, NULL, 570 - config_addr, BUID_HI(edev->phb->buid), 571 - BUID_LO(edev->phb->buid)); 491 + config_addr, BUID_HI(pe->phb->buid), 492 + BUID_LO(pe->phb->buid)); 572 493 } else { 573 494 return -EFAULT; 574 495 } 575 496 576 497 if (ret) 577 - pr_warning("%s: Unable to configure bridge %d for %s\n", 578 - __func__, ret, dn->full_name); 498 + pr_warning("%s: Unable to configure bridge PHB#%d-PE#%x (%d)\n", 499 + __func__, pe->phb->global_number, pe->addr, ret); 579 500 580 501 return ret; 581 502 } ··· 617 542 static struct eeh_ops pseries_eeh_ops = { 618 543 .name = "pseries", 619 544 .init = pseries_eeh_init, 545 + .of_probe = pseries_eeh_of_probe, 546 + .dev_probe = NULL, 620 547 .set_option = pseries_eeh_set_option, 621 548 .get_pe_addr = pseries_eeh_get_pe_addr, 622 549 .get_state = pseries_eeh_get_state, ··· 636 559 * EEH initialization on pseries platform. This function should be 637 560 * called before any EEH related functions. 638 561 */ 639 - int __init eeh_pseries_init(void) 562 + static int __init eeh_pseries_init(void) 640 563 { 641 - return eeh_ops_register(&pseries_eeh_ops); 564 + int ret = -EINVAL; 565 + 566 + if (!machine_is(pseries)) 567 + return ret; 568 + 569 + ret = eeh_ops_register(&pseries_eeh_ops); 570 + if (!ret) 571 + pr_info("EEH: pSeries platform initialized\n"); 572 + else 573 + pr_info("EEH: pSeries platform initialization failure (%d)\n", 574 + ret); 575 + 576 + return ret; 642 577 } 578 + 579 + early_initcall(eeh_pseries_init);
-9
arch/powerpc/platforms/pseries/eeh_sysfs.c
··· 53 53 EEH_SHOW_ATTR(eeh_mode, mode, "0x%x"); 54 54 EEH_SHOW_ATTR(eeh_config_addr, config_addr, "0x%x"); 55 55 EEH_SHOW_ATTR(eeh_pe_config_addr, pe_config_addr, "0x%x"); 56 - EEH_SHOW_ATTR(eeh_check_count, check_count, "%d" ); 57 - EEH_SHOW_ATTR(eeh_freeze_count, freeze_count, "%d" ); 58 - EEH_SHOW_ATTR(eeh_false_positives, false_positives, "%d" ); 59 56 60 57 void eeh_sysfs_add_device(struct pci_dev *pdev) 61 58 { ··· 61 64 rc += device_create_file(&pdev->dev, &dev_attr_eeh_mode); 62 65 rc += device_create_file(&pdev->dev, &dev_attr_eeh_config_addr); 63 66 rc += device_create_file(&pdev->dev, &dev_attr_eeh_pe_config_addr); 64 - rc += device_create_file(&pdev->dev, &dev_attr_eeh_check_count); 65 - rc += device_create_file(&pdev->dev, &dev_attr_eeh_false_positives); 66 - rc += device_create_file(&pdev->dev, &dev_attr_eeh_freeze_count); 67 67 68 68 if (rc) 69 69 printk(KERN_WARNING "EEH: Unable to create sysfs entries\n"); ··· 71 77 device_remove_file(&pdev->dev, &dev_attr_eeh_mode); 72 78 device_remove_file(&pdev->dev, &dev_attr_eeh_config_addr); 73 79 device_remove_file(&pdev->dev, &dev_attr_eeh_pe_config_addr); 74 - device_remove_file(&pdev->dev, &dev_attr_eeh_check_count); 75 - device_remove_file(&pdev->dev, &dev_attr_eeh_false_positives); 76 - device_remove_file(&pdev->dev, &dev_attr_eeh_freeze_count); 77 80 } 78 81
+6 -6
arch/powerpc/platforms/pseries/iommu.c
··· 28 28 #include <linux/types.h> 29 29 #include <linux/slab.h> 30 30 #include <linux/mm.h> 31 + #include <linux/memblock.h> 31 32 #include <linux/spinlock.h> 32 33 #include <linux/sched.h> /* for show_stack */ 33 34 #include <linux/string.h> ··· 42 41 #include <asm/iommu.h> 43 42 #include <asm/pci-bridge.h> 44 43 #include <asm/machdep.h> 45 - #include <asm/abs_addr.h> 46 44 #include <asm/pSeries_reconfig.h> 47 45 #include <asm/firmware.h> 48 46 #include <asm/tce.h> ··· 99 99 100 100 while (npages--) { 101 101 /* can't move this out since we might cross MEMBLOCK boundary */ 102 - rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT; 102 + rpn = __pa(uaddr) >> TCE_SHIFT; 103 103 *tcep = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT; 104 104 105 105 uaddr += TCE_PAGE_SIZE; ··· 148 148 int ret = 0; 149 149 long tcenum_start = tcenum, npages_start = npages; 150 150 151 - rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT; 151 + rpn = __pa(uaddr) >> TCE_SHIFT; 152 152 proto_tce = TCE_PCI_READ; 153 153 if (direction != DMA_TO_DEVICE) 154 154 proto_tce |= TCE_PCI_WRITE; ··· 217 217 __get_cpu_var(tce_page) = tcep; 218 218 } 219 219 220 - rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT; 220 + rpn = __pa(uaddr) >> TCE_SHIFT; 221 221 proto_tce = TCE_PCI_READ; 222 222 if (direction != DMA_TO_DEVICE) 223 223 proto_tce |= TCE_PCI_WRITE; ··· 237 237 238 238 rc = plpar_tce_put_indirect((u64)tbl->it_index, 239 239 (u64)tcenum << 12, 240 - (u64)virt_to_abs(tcep), 240 + (u64)__pa(tcep), 241 241 limit); 242 242 243 243 npages -= limit; ··· 441 441 442 442 rc = plpar_tce_put_indirect(liobn, 443 443 dma_offset, 444 - (u64)virt_to_abs(tcep), 444 + (u64)__pa(tcep), 445 445 limit); 446 446 447 447 num_tce -= limit;
+31 -46
arch/powerpc/platforms/pseries/lpar.c
··· 31 31 #include <asm/page.h> 32 32 #include <asm/pgtable.h> 33 33 #include <asm/machdep.h> 34 - #include <asm/abs_addr.h> 35 34 #include <asm/mmu_context.h> 36 35 #include <asm/iommu.h> 37 36 #include <asm/tlbflush.h> ··· 107 108 } 108 109 109 110 static long pSeries_lpar_hpte_insert(unsigned long hpte_group, 110 - unsigned long va, unsigned long pa, 111 - unsigned long rflags, unsigned long vflags, 112 - int psize, int ssize) 111 + unsigned long vpn, unsigned long pa, 112 + unsigned long rflags, unsigned long vflags, 113 + int psize, int ssize) 113 114 { 114 115 unsigned long lpar_rc; 115 116 unsigned long flags; ··· 117 118 unsigned long hpte_v, hpte_r; 118 119 119 120 if (!(vflags & HPTE_V_BOLTED)) 120 - pr_devel("hpte_insert(group=%lx, va=%016lx, pa=%016lx, " 121 - "rflags=%lx, vflags=%lx, psize=%d)\n", 122 - hpte_group, va, pa, rflags, vflags, psize); 121 + pr_devel("hpte_insert(group=%lx, vpn=%016lx, " 122 + "pa=%016lx, rflags=%lx, vflags=%lx, psize=%d)\n", 123 + hpte_group, vpn, pa, rflags, vflags, psize); 123 124 124 - hpte_v = hpte_encode_v(va, psize, ssize) | vflags | HPTE_V_VALID; 125 + hpte_v = hpte_encode_v(vpn, psize, ssize) | vflags | HPTE_V_VALID; 125 126 hpte_r = hpte_encode_r(pa, psize) | rflags; 126 127 127 128 if (!(vflags & HPTE_V_BOLTED)) ··· 226 227 } 227 228 228 229 /* 229 - * This computes the AVPN and B fields of the first dword of a HPTE, 230 - * for use when we want to match an existing PTE. The bottom 7 bits 231 - * of the returned value are zero. 232 - */ 233 - static inline unsigned long hpte_encode_avpn(unsigned long va, int psize, 234 - int ssize) 235 - { 236 - unsigned long v; 237 - 238 - v = (va >> 23) & ~(mmu_psize_defs[psize].avpnm); 239 - v <<= HPTE_V_AVPN_SHIFT; 240 - v |= ((unsigned long) ssize) << HPTE_V_SSIZE_SHIFT; 241 - return v; 242 - } 243 - 244 - /* 245 230 * NOTE: for updatepp ops we are fortunate that the linux "newpp" bits and 246 231 * the low 3 bits of flags happen to line up. So no transform is needed. 247 232 * We can probably optimize here and assume the high bits of newpp are ··· 233 250 */ 234 251 static long pSeries_lpar_hpte_updatepp(unsigned long slot, 235 252 unsigned long newpp, 236 - unsigned long va, 253 + unsigned long vpn, 237 254 int psize, int ssize, int local) 238 255 { 239 256 unsigned long lpar_rc; 240 257 unsigned long flags = (newpp & 7) | H_AVPN; 241 258 unsigned long want_v; 242 259 243 - want_v = hpte_encode_avpn(va, psize, ssize); 260 + want_v = hpte_encode_avpn(vpn, psize, ssize); 244 261 245 262 pr_devel(" update: avpnv=%016lx, hash=%016lx, f=%lx, psize: %d ...", 246 263 want_v, slot, flags, psize); ··· 278 295 return dword0; 279 296 } 280 297 281 - static long pSeries_lpar_hpte_find(unsigned long va, int psize, int ssize) 298 + static long pSeries_lpar_hpte_find(unsigned long vpn, int psize, int ssize) 282 299 { 283 300 unsigned long hash; 284 301 unsigned long i; 285 302 long slot; 286 303 unsigned long want_v, hpte_v; 287 304 288 - hash = hpt_hash(va, mmu_psize_defs[psize].shift, ssize); 289 - want_v = hpte_encode_avpn(va, psize, ssize); 305 + hash = hpt_hash(vpn, mmu_psize_defs[psize].shift, ssize); 306 + want_v = hpte_encode_avpn(vpn, psize, ssize); 290 307 291 308 /* Bolted entries are always in the primary group */ 292 309 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; ··· 306 323 unsigned long ea, 307 324 int psize, int ssize) 308 325 { 309 - unsigned long lpar_rc, slot, vsid, va, flags; 326 + unsigned long vpn; 327 + unsigned long lpar_rc, slot, vsid, flags; 310 328 311 329 vsid = get_kernel_vsid(ea, ssize); 312 - va = hpt_va(ea, vsid, ssize); 330 + vpn = hpt_vpn(ea, vsid, ssize); 313 331 314 - slot = pSeries_lpar_hpte_find(va, psize, ssize); 332 + slot = pSeries_lpar_hpte_find(vpn, psize, ssize); 315 333 BUG_ON(slot == -1); 316 334 317 335 flags = newpp & 7; ··· 321 337 BUG_ON(lpar_rc != H_SUCCESS); 322 338 } 323 339 324 - static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long va, 340 + static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long vpn, 325 341 int psize, int ssize, int local) 326 342 { 327 343 unsigned long want_v; 328 344 unsigned long lpar_rc; 329 345 unsigned long dummy1, dummy2; 330 346 331 - pr_devel(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n", 332 - slot, va, psize, local); 347 + pr_devel(" inval : slot=%lx, vpn=%016lx, psize: %d, local: %d\n", 348 + slot, vpn, psize, local); 333 349 334 - want_v = hpte_encode_avpn(va, psize, ssize); 350 + want_v = hpte_encode_avpn(vpn, psize, ssize); 335 351 lpar_rc = plpar_pte_remove(H_AVPN, slot, want_v, &dummy1, &dummy2); 336 352 if (lpar_rc == H_NOT_FOUND) 337 353 return; ··· 342 358 static void pSeries_lpar_hpte_removebolted(unsigned long ea, 343 359 int psize, int ssize) 344 360 { 345 - unsigned long slot, vsid, va; 361 + unsigned long vpn; 362 + unsigned long slot, vsid; 346 363 347 364 vsid = get_kernel_vsid(ea, ssize); 348 - va = hpt_va(ea, vsid, ssize); 365 + vpn = hpt_vpn(ea, vsid, ssize); 349 366 350 - slot = pSeries_lpar_hpte_find(va, psize, ssize); 367 + slot = pSeries_lpar_hpte_find(vpn, psize, ssize); 351 368 BUG_ON(slot == -1); 352 369 353 - pSeries_lpar_hpte_invalidate(slot, va, psize, ssize, 0); 370 + pSeries_lpar_hpte_invalidate(slot, vpn, psize, ssize, 0); 354 371 } 355 372 356 373 /* Flag bits for H_BULK_REMOVE */ ··· 367 382 */ 368 383 static void pSeries_lpar_flush_hash_range(unsigned long number, int local) 369 384 { 385 + unsigned long vpn; 370 386 unsigned long i, pix, rc; 371 387 unsigned long flags = 0; 372 388 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); 373 389 int lock_tlbie = !mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE); 374 390 unsigned long param[9]; 375 - unsigned long va; 376 391 unsigned long hash, index, shift, hidx, slot; 377 392 real_pte_t pte; 378 393 int psize, ssize; ··· 384 399 ssize = batch->ssize; 385 400 pix = 0; 386 401 for (i = 0; i < number; i++) { 387 - va = batch->vaddr[i]; 402 + vpn = batch->vpn[i]; 388 403 pte = batch->pte[i]; 389 - pte_iterate_hashed_subpages(pte, psize, va, index, shift) { 390 - hash = hpt_hash(va, shift, ssize); 404 + pte_iterate_hashed_subpages(pte, psize, vpn, index, shift) { 405 + hash = hpt_hash(vpn, shift, ssize); 391 406 hidx = __rpte_to_hidx(pte, index); 392 407 if (hidx & _PTEIDX_SECONDARY) 393 408 hash = ~hash; 394 409 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 395 410 slot += hidx & _PTEIDX_GROUP_IX; 396 411 if (!firmware_has_feature(FW_FEATURE_BULK_REMOVE)) { 397 - pSeries_lpar_hpte_invalidate(slot, va, psize, 412 + pSeries_lpar_hpte_invalidate(slot, vpn, psize, 398 413 ssize, local); 399 414 } else { 400 415 param[pix] = HBR_REQUEST | HBR_AVPN | slot; 401 - param[pix+1] = hpte_encode_avpn(va, psize, 416 + param[pix+1] = hpte_encode_avpn(vpn, psize, 402 417 ssize); 403 418 pix += 2; 404 419 if (pix == 8) {
+24 -2
arch/powerpc/platforms/pseries/msi.c
··· 210 210 static struct device_node *find_pe_dn(struct pci_dev *dev, int *total) 211 211 { 212 212 struct device_node *dn; 213 + struct eeh_dev *edev; 213 214 214 215 /* Found our PE and assume 8 at that point. */ 215 216 ··· 218 217 if (!dn) 219 218 return NULL; 220 219 221 - dn = eeh_find_device_pe(dn); 220 + /* Get the top level device in the PE */ 221 + edev = of_node_to_eeh_dev(dn); 222 + edev = list_first_entry(&edev->pe->edevs, struct eeh_dev, list); 223 + dn = eeh_dev_to_of_node(edev); 222 224 if (!dn) 223 225 return NULL; 224 226 ··· 391 387 return 0; 392 388 } 393 389 394 - static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) 390 + static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type) 395 391 { 396 392 struct pci_dn *pdn; 397 393 int hwirq, virq, i, rc; 398 394 struct msi_desc *entry; 399 395 struct msi_msg msg; 396 + int nvec = nvec_in; 400 397 401 398 pdn = get_pdn(pdev); 402 399 if (!pdn) ··· 407 402 return -EINVAL; 408 403 409 404 /* 405 + * Firmware currently refuse any non power of two allocation 406 + * so we round up if the quota will allow it. 407 + */ 408 + if (type == PCI_CAP_ID_MSIX) { 409 + int m = roundup_pow_of_two(nvec); 410 + int quota = msi_quota_for_device(pdev, m); 411 + 412 + if (quota >= m) 413 + nvec = m; 414 + } 415 + 416 + /* 410 417 * Try the new more explicit firmware interface, if that fails fall 411 418 * back to the old interface. The old interface is known to never 412 419 * return MSI-Xs. 413 420 */ 421 + again: 414 422 if (type == PCI_CAP_ID_MSI) { 415 423 rc = rtas_change_msi(pdn, RTAS_CHANGE_MSI_FN, nvec); 416 424 ··· 435 417 rc = rtas_change_msi(pdn, RTAS_CHANGE_MSIX_FN, nvec); 436 418 437 419 if (rc != nvec) { 420 + if (nvec != nvec_in) { 421 + nvec = nvec_in; 422 + goto again; 423 + } 438 424 pr_debug("rtas_msi: rtas_change_msi() failed\n"); 439 425 return rc; 440 426 }
+1 -1
arch/powerpc/platforms/pseries/pci.c
··· 73 73 { 74 74 pSeries_request_regions(); 75 75 76 - pci_addr_cache_build(); 76 + eeh_addr_cache_build(); 77 77 } 78 78 79 79 /*
+30 -14
arch/powerpc/platforms/pseries/pci_dlpar.c
··· 65 65 EXPORT_SYMBOL_GPL(pcibios_find_pci_bus); 66 66 67 67 /** 68 + * __pcibios_remove_pci_devices - remove all devices under this bus 69 + * @bus: the indicated PCI bus 70 + * @purge_pe: destroy the PE on removal of PCI devices 71 + * 72 + * Remove all of the PCI devices under this bus both from the 73 + * linux pci device tree, and from the powerpc EEH address cache. 74 + * By default, the corresponding PE will be destroied during the 75 + * normal PCI hotplug path. For PCI hotplug during EEH recovery, 76 + * the corresponding PE won't be destroied and deallocated. 77 + */ 78 + void __pcibios_remove_pci_devices(struct pci_bus *bus, int purge_pe) 79 + { 80 + struct pci_dev *dev, *tmp; 81 + struct pci_bus *child_bus; 82 + 83 + /* First go down child busses */ 84 + list_for_each_entry(child_bus, &bus->children, node) 85 + __pcibios_remove_pci_devices(child_bus, purge_pe); 86 + 87 + pr_debug("PCI: Removing devices on bus %04x:%02x\n", 88 + pci_domain_nr(bus), bus->number); 89 + list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) { 90 + pr_debug(" * Removing %s...\n", pci_name(dev)); 91 + eeh_remove_bus_device(dev, purge_pe); 92 + pci_stop_and_remove_bus_device(dev); 93 + } 94 + } 95 + 96 + /** 68 97 * pcibios_remove_pci_devices - remove all devices under this bus 69 98 * 70 99 * Remove all of the PCI devices under this bus both from the ··· 101 72 */ 102 73 void pcibios_remove_pci_devices(struct pci_bus *bus) 103 74 { 104 - struct pci_dev *dev, *tmp; 105 - struct pci_bus *child_bus; 106 - 107 - /* First go down child busses */ 108 - list_for_each_entry(child_bus, &bus->children, node) 109 - pcibios_remove_pci_devices(child_bus); 110 - 111 - pr_debug("PCI: Removing devices on bus %04x:%02x\n", 112 - pci_domain_nr(bus), bus->number); 113 - list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) { 114 - pr_debug(" * Removing %s...\n", pci_name(dev)); 115 - eeh_remove_bus_device(dev); 116 - pci_stop_and_remove_bus_device(dev); 117 - } 75 + __pcibios_remove_pci_devices(bus, 1); 118 76 } 119 77 EXPORT_SYMBOL_GPL(pcibios_remove_pci_devices); 120 78
+12 -10
arch/powerpc/platforms/pseries/setup.c
··· 388 388 389 389 /* Find and initialize PCI host bridges */ 390 390 init_pci_config_tokens(); 391 - eeh_pseries_init(); 392 391 find_and_init_phbs(); 393 392 pSeries_reconfig_notifier_register(&pci_dn_reconfig_nb); 394 - eeh_init(); 395 393 396 394 pSeries_nvram_init(); 397 395 ··· 414 416 } 415 417 machine_arch_initcall(pseries, pSeries_init_panel); 416 418 417 - static int pseries_set_dabr(unsigned long dabr) 419 + static int pseries_set_dabr(unsigned long dabr, unsigned long dabrx) 418 420 { 419 421 return plpar_hcall_norets(H_SET_DABR, dabr); 420 422 } 421 423 422 - static int pseries_set_xdabr(unsigned long dabr) 424 + static int pseries_set_xdabr(unsigned long dabr, unsigned long dabrx) 423 425 { 424 - /* We want to catch accesses from kernel and userspace */ 425 - return plpar_hcall_norets(H_SET_XDABR, dabr, 426 - H_DABRX_KERNEL | H_DABRX_USER); 426 + /* Have to set at least one bit in the DABRX according to PAPR */ 427 + if (dabrx == 0 && dabr == 0) 428 + dabrx = DABRX_USER; 429 + /* PAPR says we can only set kernel and user bits */ 430 + dabrx &= DABRX_KERNEL | DABRX_USER; 431 + 432 + return plpar_hcall_norets(H_SET_XDABR, dabr, dabrx); 427 433 } 428 434 429 435 #define CMO_CHARACTERISTICS_TOKEN 44 ··· 531 529 if (firmware_has_feature(FW_FEATURE_LPAR)) 532 530 hvc_vio_init_early(); 533 531 #endif 534 - if (firmware_has_feature(FW_FEATURE_DABR)) 535 - ppc_md.set_dabr = pseries_set_dabr; 536 - else if (firmware_has_feature(FW_FEATURE_XDABR)) 532 + if (firmware_has_feature(FW_FEATURE_XDABR)) 537 533 ppc_md.set_dabr = pseries_set_xdabr; 534 + else if (firmware_has_feature(FW_FEATURE_DABR)) 535 + ppc_md.set_dabr = pseries_set_dabr; 538 536 539 537 pSeries_cmo_feature_init(); 540 538 iommu_init_early_pSeries();
+1 -1
arch/powerpc/sysdev/Makefile
··· 15 15 obj-$(CONFIG_PPC_PMI) += pmi.o 16 16 obj-$(CONFIG_U3_DART) += dart_iommu.o 17 17 obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o 18 - obj-$(CONFIG_FSL_SOC) += fsl_soc.o 18 + obj-$(CONFIG_FSL_SOC) += fsl_soc.o fsl_mpic_err.o 19 19 obj-$(CONFIG_FSL_PCI) += fsl_pci.o $(fsl-msi-obj-y) 20 20 obj-$(CONFIG_FSL_PMC) += fsl_pmc.o 21 21 obj-$(CONFIG_FSL_LBC) += fsl_lbc.o
+15 -4
arch/powerpc/sysdev/dart_iommu.c
··· 43 43 #include <asm/iommu.h> 44 44 #include <asm/pci-bridge.h> 45 45 #include <asm/machdep.h> 46 - #include <asm/abs_addr.h> 47 46 #include <asm/cacheflush.h> 48 47 #include <asm/ppc-pci.h> 49 48 ··· 73 74 74 75 #define DBG(...) 75 76 77 + static DEFINE_SPINLOCK(invalidate_lock); 78 + 76 79 static inline void dart_tlb_invalidate_all(void) 77 80 { 78 81 unsigned long l = 0; 79 82 unsigned int reg, inv_bit; 80 83 unsigned long limit; 84 + unsigned long flags; 85 + 86 + spin_lock_irqsave(&invalidate_lock, flags); 81 87 82 88 DBG("dart: flush\n"); 83 89 ··· 115 111 panic("DART: TLB did not flush after waiting a long " 116 112 "time. Buggy U3 ?"); 117 113 } 114 + 115 + spin_unlock_irqrestore(&invalidate_lock, flags); 118 116 } 119 117 120 118 static inline void dart_tlb_invalidate_one(unsigned long bus_rpn) 121 119 { 122 120 unsigned int reg; 123 121 unsigned int l, limit; 122 + unsigned long flags; 123 + 124 + spin_lock_irqsave(&invalidate_lock, flags); 124 125 125 126 reg = DART_CNTL_U4_ENABLE | DART_CNTL_U4_IONE | 126 127 (bus_rpn & DART_CNTL_U4_IONE_MASK); ··· 147 138 panic("DART: TLB did not flush after waiting a long " 148 139 "time. Buggy U4 ?"); 149 140 } 141 + 142 + spin_unlock_irqrestore(&invalidate_lock, flags); 150 143 } 151 144 152 145 static void dart_flush(struct iommu_table *tbl) ··· 178 167 */ 179 168 l = npages; 180 169 while (l--) { 181 - rpn = virt_to_abs(uaddr) >> DART_PAGE_SHIFT; 170 + rpn = __pa(uaddr) >> DART_PAGE_SHIFT; 182 171 183 172 *(dp++) = DARTMAP_VALID | (rpn & DARTMAP_RPNMASK); 184 173 ··· 255 244 panic("DART: Cannot map registers!"); 256 245 257 246 /* Map in DART table */ 258 - dart_vbase = ioremap(virt_to_abs(dart_tablebase), dart_tablesize); 247 + dart_vbase = ioremap(__pa(dart_tablebase), dart_tablesize); 259 248 260 249 /* Fill initial table */ 261 250 for (i = 0; i < dart_tablesize/4; i++) ··· 474 463 * will blow up an entire large page anyway in the kernel mapping 475 464 */ 476 465 dart_tablebase = (unsigned long) 477 - abs_to_virt(memblock_alloc_base(1UL<<24, 1UL<<24, 0x80000000L)); 466 + __va(memblock_alloc_base(1UL<<24, 1UL<<24, 0x80000000L)); 478 467 479 468 printk(KERN_INFO "DART table allocated at: %lx\n", dart_tablebase); 480 469 }
+10
arch/powerpc/sysdev/fsl_85xx_l2ctlr.c
··· 193 193 { 194 194 .compatible = "fsl,mpc8548-l2-cache-controller", 195 195 }, 196 + { .compatible = "fsl,mpc8544-l2-cache-controller",}, 197 + { .compatible = "fsl,mpc8572-l2-cache-controller",}, 198 + { .compatible = "fsl,mpc8536-l2-cache-controller",}, 199 + { .compatible = "fsl,p1021-l2-cache-controller",}, 200 + { .compatible = "fsl,p1012-l2-cache-controller",}, 201 + { .compatible = "fsl,p1025-l2-cache-controller",}, 202 + { .compatible = "fsl,p1016-l2-cache-controller",}, 203 + { .compatible = "fsl,p1024-l2-cache-controller",}, 204 + { .compatible = "fsl,p1015-l2-cache-controller",}, 205 + { .compatible = "fsl,p1010-l2-cache-controller",}, 196 206 {}, 197 207 }; 198 208
+8 -12
arch/powerpc/sysdev/fsl_ifc.c
··· 244 244 /* get the nand machine irq */ 245 245 fsl_ifc_ctrl_dev->nand_irq = 246 246 irq_of_parse_and_map(dev->dev.of_node, 1); 247 - if (fsl_ifc_ctrl_dev->nand_irq == NO_IRQ) { 248 - dev_err(&dev->dev, "failed to get irq resource " 249 - "for NAND Machine\n"); 250 - ret = -ENODEV; 251 - goto err; 252 - } 253 247 254 248 fsl_ifc_ctrl_dev->dev = &dev->dev; 255 249 ··· 261 267 goto err_irq; 262 268 } 263 269 264 - ret = request_irq(fsl_ifc_ctrl_dev->nand_irq, fsl_ifc_nand_irq, 0, 265 - "fsl-ifc-nand", fsl_ifc_ctrl_dev); 266 - if (ret != 0) { 267 - dev_err(&dev->dev, "failed to install irq (%d)\n", 268 - fsl_ifc_ctrl_dev->nand_irq); 269 - goto err_nandirq; 270 + if (fsl_ifc_ctrl_dev->nand_irq) { 271 + ret = request_irq(fsl_ifc_ctrl_dev->nand_irq, fsl_ifc_nand_irq, 272 + 0, "fsl-ifc-nand", fsl_ifc_ctrl_dev); 273 + if (ret != 0) { 274 + dev_err(&dev->dev, "failed to install irq (%d)\n", 275 + fsl_ifc_ctrl_dev->nand_irq); 276 + goto err_nandirq; 277 + } 270 278 } 271 279 272 280 return 0;
+149
arch/powerpc/sysdev/fsl_mpic_err.c
··· 1 + /* 2 + * Copyright (C) 2012 Freescale Semiconductor, Inc. 3 + * 4 + * Author: Varun Sethi <varun.sethi@freescale.com> 5 + * 6 + * This program is free software; you can redistribute it and/or 7 + * modify it under the terms of the GNU General Public License 8 + * as published by the Free Software Foundation; version 2 of the 9 + * License. 10 + * 11 + */ 12 + 13 + #include <linux/irq.h> 14 + #include <linux/smp.h> 15 + #include <linux/interrupt.h> 16 + 17 + #include <asm/io.h> 18 + #include <asm/irq.h> 19 + #include <asm/mpic.h> 20 + 21 + #include "mpic.h" 22 + 23 + #define MPIC_ERR_INT_BASE 0x3900 24 + #define MPIC_ERR_INT_EISR 0x0000 25 + #define MPIC_ERR_INT_EIMR 0x0010 26 + 27 + static inline u32 mpic_fsl_err_read(u32 __iomem *base, unsigned int err_reg) 28 + { 29 + return in_be32(base + (err_reg >> 2)); 30 + } 31 + 32 + static inline void mpic_fsl_err_write(u32 __iomem *base, u32 value) 33 + { 34 + out_be32(base + (MPIC_ERR_INT_EIMR >> 2), value); 35 + } 36 + 37 + static void fsl_mpic_mask_err(struct irq_data *d) 38 + { 39 + u32 eimr; 40 + struct mpic *mpic = irq_data_get_irq_chip_data(d); 41 + unsigned int src = virq_to_hw(d->irq) - mpic->err_int_vecs[0]; 42 + 43 + eimr = mpic_fsl_err_read(mpic->err_regs, MPIC_ERR_INT_EIMR); 44 + eimr |= (1 << (31 - src)); 45 + mpic_fsl_err_write(mpic->err_regs, eimr); 46 + } 47 + 48 + static void fsl_mpic_unmask_err(struct irq_data *d) 49 + { 50 + u32 eimr; 51 + struct mpic *mpic = irq_data_get_irq_chip_data(d); 52 + unsigned int src = virq_to_hw(d->irq) - mpic->err_int_vecs[0]; 53 + 54 + eimr = mpic_fsl_err_read(mpic->err_regs, MPIC_ERR_INT_EIMR); 55 + eimr &= ~(1 << (31 - src)); 56 + mpic_fsl_err_write(mpic->err_regs, eimr); 57 + } 58 + 59 + static struct irq_chip fsl_mpic_err_chip = { 60 + .irq_disable = fsl_mpic_mask_err, 61 + .irq_mask = fsl_mpic_mask_err, 62 + .irq_unmask = fsl_mpic_unmask_err, 63 + }; 64 + 65 + int mpic_setup_error_int(struct mpic *mpic, int intvec) 66 + { 67 + int i; 68 + 69 + mpic->err_regs = ioremap(mpic->paddr + MPIC_ERR_INT_BASE, 0x1000); 70 + if (!mpic->err_regs) { 71 + pr_err("could not map mpic error registers\n"); 72 + return -ENOMEM; 73 + } 74 + mpic->hc_err = fsl_mpic_err_chip; 75 + mpic->hc_err.name = mpic->name; 76 + mpic->flags |= MPIC_FSL_HAS_EIMR; 77 + /* allocate interrupt vectors for error interrupts */ 78 + for (i = MPIC_MAX_ERR - 1; i >= 0; i--) 79 + mpic->err_int_vecs[i] = --intvec; 80 + 81 + return 0; 82 + } 83 + 84 + int mpic_map_error_int(struct mpic *mpic, unsigned int virq, irq_hw_number_t hw) 85 + { 86 + if ((mpic->flags & MPIC_FSL_HAS_EIMR) && 87 + (hw >= mpic->err_int_vecs[0] && 88 + hw <= mpic->err_int_vecs[MPIC_MAX_ERR - 1])) { 89 + WARN_ON(mpic->flags & MPIC_SECONDARY); 90 + 91 + pr_debug("mpic: mapping as Error Interrupt\n"); 92 + irq_set_chip_data(virq, mpic); 93 + irq_set_chip_and_handler(virq, &mpic->hc_err, 94 + handle_level_irq); 95 + return 1; 96 + } 97 + 98 + return 0; 99 + } 100 + 101 + static irqreturn_t fsl_error_int_handler(int irq, void *data) 102 + { 103 + struct mpic *mpic = (struct mpic *) data; 104 + u32 eisr, eimr; 105 + int errint; 106 + unsigned int cascade_irq; 107 + 108 + eisr = mpic_fsl_err_read(mpic->err_regs, MPIC_ERR_INT_EISR); 109 + eimr = mpic_fsl_err_read(mpic->err_regs, MPIC_ERR_INT_EIMR); 110 + 111 + if (!(eisr & ~eimr)) 112 + return IRQ_NONE; 113 + 114 + while (eisr) { 115 + errint = __builtin_clz(eisr); 116 + cascade_irq = irq_linear_revmap(mpic->irqhost, 117 + mpic->err_int_vecs[errint]); 118 + WARN_ON(cascade_irq == NO_IRQ); 119 + if (cascade_irq != NO_IRQ) { 120 + generic_handle_irq(cascade_irq); 121 + } else { 122 + eimr |= 1 << (31 - errint); 123 + mpic_fsl_err_write(mpic->err_regs, eimr); 124 + } 125 + eisr &= ~(1 << (31 - errint)); 126 + } 127 + 128 + return IRQ_HANDLED; 129 + } 130 + 131 + void mpic_err_int_init(struct mpic *mpic, irq_hw_number_t irqnum) 132 + { 133 + unsigned int virq; 134 + int ret; 135 + 136 + virq = irq_create_mapping(mpic->irqhost, irqnum); 137 + if (virq == NO_IRQ) { 138 + pr_err("Error interrupt setup failed\n"); 139 + return; 140 + } 141 + 142 + /* Mask all error interrupts */ 143 + mpic_fsl_err_write(mpic->err_regs, ~0); 144 + 145 + ret = request_irq(virq, fsl_error_int_handler, IRQF_NO_THREAD, 146 + "mpic-error-int", mpic); 147 + if (ret) 148 + pr_err("Failed to register error interrupt handler\n"); 149 + }
+99 -62
arch/powerpc/sysdev/fsl_pci.c
··· 38 38 39 39 static void __devinit quirk_fsl_pcie_header(struct pci_dev *dev) 40 40 { 41 - u8 progif; 41 + u8 hdr_type; 42 42 43 43 /* if we aren't a PCIe don't bother */ 44 44 if (!pci_find_capability(dev, PCI_CAP_ID_EXP)) 45 45 return; 46 46 47 47 /* if we aren't in host mode don't bother */ 48 - pci_read_config_byte(dev, PCI_CLASS_PROG, &progif); 49 - if (progif & 0x1) 48 + pci_read_config_byte(dev, PCI_HEADER_TYPE, &hdr_type); 49 + if ((hdr_type & 0x7f) != PCI_HEADER_TYPE_BRIDGE) 50 50 return; 51 51 52 52 dev->class = PCI_CLASS_BRIDGE_PCI << 8; ··· 143 143 pr_debug("PCI memory map start 0x%016llx, size 0x%016llx\n", 144 144 (u64)rsrc->start, (u64)resource_size(rsrc)); 145 145 146 - if (of_device_is_compatible(hose->dn, "fsl,qoriq-pcie-v2.2")) { 147 - win_idx = 2; 148 - start_idx = 0; 149 - end_idx = 3; 150 - } 151 - 152 146 pci = ioremap(rsrc->start, resource_size(rsrc)); 153 147 if (!pci) { 154 148 dev_err(hose->parent, "Unable to map ATMU registers\n"); 155 149 return; 150 + } 151 + 152 + if (early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) { 153 + if (in_be32(&pci->block_rev1) >= PCIE_IP_REV_2_2) { 154 + win_idx = 2; 155 + start_idx = 0; 156 + end_idx = 3; 157 + } 156 158 } 157 159 158 160 /* Disable all windows (except powar0 since it's ignored) */ ··· 427 425 struct pci_controller *hose; 428 426 struct resource rsrc; 429 427 const int *bus_range; 430 - u8 progif; 428 + u8 hdr_type, progif; 431 429 432 430 if (!of_device_is_available(dev)) { 433 431 pr_warning("%s: disabled\n", dev->full_name); ··· 459 457 setup_indirect_pci(hose, rsrc.start, rsrc.start + 0x4, 460 458 PPC_INDIRECT_TYPE_BIG_ENDIAN); 461 459 462 - early_read_config_byte(hose, 0, 0, PCI_CLASS_PROG, &progif); 463 - if ((progif & 1) == 1) { 464 - /* unmap cfg_data & cfg_addr separately if not on same page */ 465 - if (((unsigned long)hose->cfg_data & PAGE_MASK) != 466 - ((unsigned long)hose->cfg_addr & PAGE_MASK)) 467 - iounmap(hose->cfg_data); 468 - iounmap(hose->cfg_addr); 469 - pcibios_free_controller(hose); 470 - return -ENODEV; 460 + if (early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) { 461 + /* For PCIE read HEADER_TYPE to identify controler mode */ 462 + early_read_config_byte(hose, 0, 0, PCI_HEADER_TYPE, &hdr_type); 463 + if ((hdr_type & 0x7f) != PCI_HEADER_TYPE_BRIDGE) 464 + goto no_bridge; 465 + 466 + } else { 467 + /* For PCI read PROG to identify controller mode */ 468 + early_read_config_byte(hose, 0, 0, PCI_CLASS_PROG, &progif); 469 + if ((progif & 1) == 1) 470 + goto no_bridge; 471 471 } 472 472 473 473 setup_pci_cmd(hose); ··· 498 494 setup_pci_atmu(hose, &rsrc); 499 495 500 496 return 0; 497 + 498 + no_bridge: 499 + /* unmap cfg_data & cfg_addr separately if not on same page */ 500 + if (((unsigned long)hose->cfg_data & PAGE_MASK) != 501 + ((unsigned long)hose->cfg_addr & PAGE_MASK)) 502 + iounmap(hose->cfg_data); 503 + iounmap(hose->cfg_addr); 504 + pcibios_free_controller(hose); 505 + return -ENODEV; 501 506 } 502 507 #endif /* CONFIG_FSL_SOC_BOOKE || CONFIG_PPC_86xx */ 503 508 ··· 831 818 { .compatible = "fsl,p1010-pcie", }, 832 819 { .compatible = "fsl,p1023-pcie", }, 833 820 { .compatible = "fsl,p4080-pcie", }, 821 + { .compatible = "fsl,qoriq-pcie-v2.4", }, 834 822 { .compatible = "fsl,qoriq-pcie-v2.3", }, 835 823 { .compatible = "fsl,qoriq-pcie-v2.2", }, 836 824 {}, ··· 839 825 840 826 struct device_node *fsl_pci_primary; 841 827 842 - void __devinit fsl_pci_init(void) 828 + void fsl_pci_assign_primary(void) 829 + { 830 + struct device_node *np; 831 + 832 + /* Callers can specify the primary bus using other means. */ 833 + if (fsl_pci_primary) 834 + return; 835 + 836 + /* If a PCI host bridge contains an ISA node, it's primary. */ 837 + np = of_find_node_by_type(NULL, "isa"); 838 + while ((fsl_pci_primary = of_get_parent(np))) { 839 + of_node_put(np); 840 + np = fsl_pci_primary; 841 + 842 + if (of_match_node(pci_ids, np) && of_device_is_available(np)) 843 + return; 844 + } 845 + 846 + /* 847 + * If there's no PCI host bridge with ISA, arbitrarily 848 + * designate one as primary. This can go away once 849 + * various bugs with primary-less systems are fixed. 850 + */ 851 + for_each_matching_node(np, pci_ids) { 852 + if (of_device_is_available(np)) { 853 + fsl_pci_primary = np; 854 + of_node_put(np); 855 + return; 856 + } 857 + } 858 + } 859 + 860 + static int __devinit fsl_pci_probe(struct platform_device *pdev) 843 861 { 844 862 int ret; 845 863 struct device_node *node; 864 + #ifdef CONFIG_SWIOTLB 846 865 struct pci_controller *hose; 847 - dma_addr_t max = 0xffffffff; 866 + #endif 848 867 849 - /* Callers can specify the primary bus using other means. */ 850 - if (!fsl_pci_primary) { 851 - /* If a PCI host bridge contains an ISA node, it's primary. */ 852 - node = of_find_node_by_type(NULL, "isa"); 853 - while ((fsl_pci_primary = of_get_parent(node))) { 854 - of_node_put(node); 855 - node = fsl_pci_primary; 856 - 857 - if (of_match_node(pci_ids, node)) 858 - break; 859 - } 860 - } 861 - 862 - node = NULL; 863 - for_each_node_by_type(node, "pci") { 864 - if (of_match_node(pci_ids, node)) { 865 - /* 866 - * If there's no PCI host bridge with ISA, arbitrarily 867 - * designate one as primary. This can go away once 868 - * various bugs with primary-less systems are fixed. 869 - */ 870 - if (!fsl_pci_primary) 871 - fsl_pci_primary = node; 872 - 873 - ret = fsl_add_bridge(node, fsl_pci_primary == node); 874 - if (ret == 0) { 875 - hose = pci_find_hose_for_OF_device(node); 876 - max = min(max, hose->dma_window_base_cur + 877 - hose->dma_window_size); 878 - } 879 - } 880 - } 868 + node = pdev->dev.of_node; 869 + ret = fsl_add_bridge(node, fsl_pci_primary == node); 881 870 882 871 #ifdef CONFIG_SWIOTLB 883 - /* 884 - * if we couldn't map all of DRAM via the dma windows 885 - * we need SWIOTLB to handle buffers located outside of 886 - * dma capable memory region 887 - */ 888 - if (memblock_end_of_DRAM() - 1 > max) { 889 - ppc_swiotlb_enable = 1; 890 - set_pci_dma_ops(&swiotlb_dma_ops); 891 - ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; 872 + if (ret == 0) { 873 + hose = pci_find_hose_for_OF_device(pdev->dev.of_node); 874 + 875 + /* 876 + * if we couldn't map all of DRAM via the dma windows 877 + * we need SWIOTLB to handle buffers located outside of 878 + * dma capable memory region 879 + */ 880 + if (memblock_end_of_DRAM() - 1 > hose->dma_window_base_cur + 881 + hose->dma_window_size) 882 + ppc_swiotlb_enable = 1; 892 883 } 893 884 #endif 885 + 886 + mpc85xx_pci_err_probe(pdev); 887 + 888 + return 0; 894 889 } 890 + 891 + static struct platform_driver fsl_pci_driver = { 892 + .driver = { 893 + .name = "fsl-pci", 894 + .of_match_table = pci_ids, 895 + }, 896 + .probe = fsl_pci_probe, 897 + }; 898 + 899 + static int __init fsl_pci_init(void) 900 + { 901 + return platform_driver_register(&fsl_pci_driver); 902 + } 903 + arch_initcall(fsl_pci_init); 895 904 #endif
+16 -4
arch/powerpc/sysdev/fsl_pci.h
··· 16 16 17 17 #define PCIE_LTSSM 0x0404 /* PCIE Link Training and Status */ 18 18 #define PCIE_LTSSM_L0 0x16 /* L0 state */ 19 + #define PCIE_IP_REV_2_2 0x02080202 /* PCIE IP block version Rev2.2 */ 19 20 #define PIWAR_EN 0x80000000 /* Enable */ 20 21 #define PIWAR_PF 0x20000000 /* prefetch */ 21 22 #define PIWAR_TGI_LOCAL 0x00f00000 /* target - local memory */ ··· 58 57 __be32 pex_pme_mes_disr; /* 0x.024 - PCIE PME and message disable register */ 59 58 __be32 pex_pme_mes_ier; /* 0x.028 - PCIE PME and message interrupt enable register */ 60 59 __be32 pex_pmcr; /* 0x.02c - PCIE power management command register */ 61 - u8 res3[3024]; 60 + u8 res3[3016]; 61 + __be32 block_rev1; /* 0x.bf8 - PCIE Block Revision register 1 */ 62 + __be32 block_rev2; /* 0x.bfc - PCIE Block Revision register 2 */ 62 63 63 64 /* PCI/PCI Express outbound window 0-4 64 65 * Window 0 is the default window and is the only window enabled upon reset. ··· 98 95 99 96 extern struct device_node *fsl_pci_primary; 100 97 101 - #ifdef CONFIG_FSL_PCI 102 - void fsl_pci_init(void); 98 + #ifdef CONFIG_PCI 99 + void fsl_pci_assign_primary(void); 103 100 #else 104 - static inline void fsl_pci_init(void) {} 101 + static inline void fsl_pci_assign_primary(void) {} 102 + #endif 103 + 104 + #ifdef CONFIG_EDAC_MPC85XX 105 + int mpc85xx_pci_err_probe(struct platform_device *op); 106 + #else 107 + static inline int mpc85xx_pci_err_probe(struct platform_device *op) 108 + { 109 + return -ENOTSUPP; 110 + } 105 111 #endif 106 112 107 113 #endif /* __POWERPC_FSL_PCI_H */
+85 -17
arch/powerpc/sysdev/mpic.c
··· 6 6 * with various broken implementations of this HW. 7 7 * 8 8 * Copyright (C) 2004 Benjamin Herrenschmidt, IBM Corp. 9 - * Copyright 2010-2011 Freescale Semiconductor, Inc. 9 + * Copyright 2010-2012 Freescale Semiconductor, Inc. 10 10 * 11 11 * This file is subject to the terms and conditions of the GNU General Public 12 12 * License. See the file COPYING in the main directory of this archive ··· 221 221 _mpic_write(mpic->reg_type, &mpic->gregs, offset, value); 222 222 } 223 223 224 + static inline unsigned int mpic_tm_offset(struct mpic *mpic, unsigned int tm) 225 + { 226 + return (tm >> 2) * MPIC_TIMER_GROUP_STRIDE + 227 + (tm & 3) * MPIC_INFO(TIMER_STRIDE); 228 + } 229 + 224 230 static inline u32 _mpic_tm_read(struct mpic *mpic, unsigned int tm) 225 231 { 226 - unsigned int offset = MPIC_INFO(TIMER_VECTOR_PRI) + 227 - ((tm & 3) * MPIC_INFO(TIMER_STRIDE)); 228 - 229 - if (tm >= 4) 230 - offset += 0x1000 / 4; 232 + unsigned int offset = mpic_tm_offset(mpic, tm) + 233 + MPIC_INFO(TIMER_VECTOR_PRI); 231 234 232 235 return _mpic_read(mpic->reg_type, &mpic->tmregs, offset); 233 236 } 234 237 235 238 static inline void _mpic_tm_write(struct mpic *mpic, unsigned int tm, u32 value) 236 239 { 237 - unsigned int offset = MPIC_INFO(TIMER_VECTOR_PRI) + 238 - ((tm & 3) * MPIC_INFO(TIMER_STRIDE)); 239 - 240 - if (tm >= 4) 241 - offset += 0x1000 / 4; 240 + unsigned int offset = mpic_tm_offset(mpic, tm) + 241 + MPIC_INFO(TIMER_VECTOR_PRI); 242 242 243 243 _mpic_write(mpic->reg_type, &mpic->tmregs, offset, value); 244 244 } ··· 1026 1026 return 0; 1027 1027 } 1028 1028 1029 + if (mpic_map_error_int(mpic, virq, hw)) 1030 + return 0; 1031 + 1029 1032 if (hw >= mpic->num_sources) 1030 1033 return -EINVAL; 1031 1034 ··· 1088 1085 */ 1089 1086 switch (intspec[2]) { 1090 1087 case 0: 1091 - case 1: /* no EISR/EIMR support for now, treat as shared IRQ */ 1088 + break; 1089 + case 1: 1090 + if (!(mpic->flags & MPIC_FSL_HAS_EIMR)) 1091 + break; 1092 + 1093 + if (intspec[3] >= ARRAY_SIZE(mpic->err_int_vecs)) 1094 + return -EINVAL; 1095 + 1096 + *out_hwirq = mpic->err_int_vecs[intspec[3]]; 1097 + 1092 1098 break; 1093 1099 case 2: 1094 1100 if (intspec[0] >= ARRAY_SIZE(mpic->ipi_vecs)) ··· 1313 1301 mpic_map(mpic, mpic->paddr, &mpic->gregs, MPIC_INFO(GREG_BASE), 0x1000); 1314 1302 mpic_map(mpic, mpic->paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000); 1315 1303 1304 + if (mpic->flags & MPIC_FSL) { 1305 + u32 brr1, version; 1306 + int ret; 1307 + 1308 + /* 1309 + * Yes, Freescale really did put global registers in the 1310 + * magic per-cpu area -- and they don't even show up in the 1311 + * non-magic per-cpu copies that this driver normally uses. 1312 + */ 1313 + mpic_map(mpic, mpic->paddr, &mpic->thiscpuregs, 1314 + MPIC_CPU_THISBASE, 0x1000); 1315 + 1316 + brr1 = _mpic_read(mpic->reg_type, &mpic->thiscpuregs, 1317 + MPIC_FSL_BRR1); 1318 + version = brr1 & MPIC_FSL_BRR1_VER; 1319 + 1320 + /* Error interrupt mask register (EIMR) is required for 1321 + * handling individual device error interrupts. EIMR 1322 + * was added in MPIC version 4.1. 1323 + * 1324 + * Over here we reserve vector number space for error 1325 + * interrupt vectors. This space is stolen from the 1326 + * global vector number space, as in case of ipis 1327 + * and timer interrupts. 1328 + * 1329 + * Available vector space = intvec_top - 12, where 12 1330 + * is the number of vectors which have been consumed by 1331 + * ipis and timer interrupts. 1332 + */ 1333 + if (version >= 0x401) { 1334 + ret = mpic_setup_error_int(mpic, intvec_top - 12); 1335 + if (ret) 1336 + return NULL; 1337 + } 1338 + } 1339 + 1316 1340 /* Reset */ 1317 1341 1318 1342 /* When using a device-node, reset requests are only honored if the MPIC ··· 1488 1440 void __init mpic_init(struct mpic *mpic) 1489 1441 { 1490 1442 int i, cpu; 1443 + int num_timers = 4; 1491 1444 1492 1445 BUG_ON(mpic->num_sources == 0); 1493 1446 ··· 1497 1448 /* Set current processor priority to max */ 1498 1449 mpic_cpu_write(MPIC_INFO(CPU_CURRENT_TASK_PRI), 0xf); 1499 1450 1451 + if (mpic->flags & MPIC_FSL) { 1452 + u32 brr1 = _mpic_read(mpic->reg_type, &mpic->thiscpuregs, 1453 + MPIC_FSL_BRR1); 1454 + u32 version = brr1 & MPIC_FSL_BRR1_VER; 1455 + 1456 + /* 1457 + * Timer group B is present at the latest in MPIC 3.1 (e.g. 1458 + * mpc8536). It is not present in MPIC 2.0 (e.g. mpc8544). 1459 + * I don't know about the status of intermediate versions (or 1460 + * whether they even exist). 1461 + */ 1462 + if (version >= 0x0301) 1463 + num_timers = 8; 1464 + } 1465 + 1466 + /* FSL mpic error interrupt intialization */ 1467 + if (mpic->flags & MPIC_FSL_HAS_EIMR) 1468 + mpic_err_int_init(mpic, MPIC_FSL_ERR_INT); 1469 + 1500 1470 /* Initialize timers to our reserved vectors and mask them for now */ 1501 - for (i = 0; i < 4; i++) { 1471 + for (i = 0; i < num_timers; i++) { 1472 + unsigned int offset = mpic_tm_offset(mpic, i); 1473 + 1502 1474 mpic_write(mpic->tmregs, 1503 - i * MPIC_INFO(TIMER_STRIDE) + 1504 - MPIC_INFO(TIMER_DESTINATION), 1475 + offset + MPIC_INFO(TIMER_DESTINATION), 1505 1476 1 << hard_smp_processor_id()); 1506 1477 mpic_write(mpic->tmregs, 1507 - i * MPIC_INFO(TIMER_STRIDE) + 1508 - MPIC_INFO(TIMER_VECTOR_PRI), 1478 + offset + MPIC_INFO(TIMER_VECTOR_PRI), 1509 1479 MPIC_VECPRI_MASK | 1510 1480 (9 << MPIC_VECPRI_PRIORITY_SHIFT) | 1511 1481 (mpic->timer_vecs[0] + i));
+22
arch/powerpc/sysdev/mpic.h
··· 40 40 const struct cpumask *cpumask, bool force); 41 41 extern void mpic_reset_core(int cpu); 42 42 43 + #ifdef CONFIG_FSL_SOC 44 + extern int mpic_map_error_int(struct mpic *mpic, unsigned int virq, irq_hw_number_t hw); 45 + extern void mpic_err_int_init(struct mpic *mpic, irq_hw_number_t irqnum); 46 + extern int mpic_setup_error_int(struct mpic *mpic, int intvec); 47 + #else 48 + static inline int mpic_map_error_int(struct mpic *mpic, unsigned int virq, irq_hw_number_t hw) 49 + { 50 + return 0; 51 + } 52 + 53 + 54 + static inline void mpic_err_int_init(struct mpic *mpic, irq_hw_number_t irqnum) 55 + { 56 + return; 57 + } 58 + 59 + static inline int mpic_setup_error_int(struct mpic *mpic, int intvec) 60 + { 61 + return -1; 62 + } 63 + #endif 64 + 43 65 #endif /* _POWERPC_SYSDEV_MPIC_H */
+108 -3
arch/powerpc/xmon/xmon.c
··· 60 60 static unsigned long xmon_taken = 1; 61 61 static int xmon_owner; 62 62 static int xmon_gate; 63 + #else 64 + #define xmon_owner 0 63 65 #endif /* CONFIG_SMP */ 64 66 65 67 static unsigned long in_xmon __read_mostly = 0; ··· 204 202 di dump instructions\n\ 205 203 df dump float values\n\ 206 204 dd dump double values\n\ 207 - dl dump the kernel log buffer\n\ 205 + dl dump the kernel log buffer\n" 206 + #ifdef CONFIG_PPC64 207 + "\ 208 + dp[#] dump paca for current cpu, or cpu #\n\ 209 + dpa dump paca for all possible cpus\n" 210 + #endif 211 + "\ 208 212 dr dump stream of raw bytes\n\ 209 213 e print exception information\n\ 210 214 f flush cache\n\ ··· 748 740 static void insert_cpu_bpts(void) 749 741 { 750 742 if (dabr.enabled) 751 - set_dabr(dabr.address | (dabr.enabled & 7)); 743 + set_dabr(dabr.address | (dabr.enabled & 7), DABRX_ALL); 752 744 if (iabr && cpu_has_feature(CPU_FTR_IABR)) 753 745 mtspr(SPRN_IABR, iabr->address 754 746 | (iabr->enabled & (BP_IABR|BP_IABR_TE))); ··· 776 768 777 769 static void remove_cpu_bpts(void) 778 770 { 779 - set_dabr(0); 771 + set_dabr(0, 0); 780 772 if (cpu_has_feature(CPU_FTR_IABR)) 781 773 mtspr(SPRN_IABR, 0); 782 774 } ··· 2017 2009 printf("\n"); 2018 2010 } 2019 2011 2012 + #ifdef CONFIG_PPC64 2013 + static void dump_one_paca(int cpu) 2014 + { 2015 + struct paca_struct *p; 2016 + 2017 + if (setjmp(bus_error_jmp) != 0) { 2018 + printf("*** Error dumping paca for cpu 0x%x!\n", cpu); 2019 + return; 2020 + } 2021 + 2022 + catch_memory_errors = 1; 2023 + sync(); 2024 + 2025 + p = &paca[cpu]; 2026 + 2027 + printf("paca for cpu 0x%x @ %p:\n", cpu, p); 2028 + 2029 + printf(" %-*s = %s\n", 16, "possible", cpu_possible(cpu) ? "yes" : "no"); 2030 + printf(" %-*s = %s\n", 16, "present", cpu_present(cpu) ? "yes" : "no"); 2031 + printf(" %-*s = %s\n", 16, "online", cpu_online(cpu) ? "yes" : "no"); 2032 + 2033 + #define DUMP(paca, name, format) \ 2034 + printf(" %-*s = %#-*"format"\t(0x%lx)\n", 16, #name, 18, paca->name, \ 2035 + offsetof(struct paca_struct, name)); 2036 + 2037 + DUMP(p, lock_token, "x"); 2038 + DUMP(p, paca_index, "x"); 2039 + DUMP(p, kernel_toc, "lx"); 2040 + DUMP(p, kernelbase, "lx"); 2041 + DUMP(p, kernel_msr, "lx"); 2042 + #ifdef CONFIG_PPC_STD_MMU_64 2043 + DUMP(p, stab_real, "lx"); 2044 + DUMP(p, stab_addr, "lx"); 2045 + #endif 2046 + DUMP(p, emergency_sp, "p"); 2047 + DUMP(p, data_offset, "lx"); 2048 + DUMP(p, hw_cpu_id, "x"); 2049 + DUMP(p, cpu_start, "x"); 2050 + DUMP(p, kexec_state, "x"); 2051 + DUMP(p, __current, "p"); 2052 + DUMP(p, kstack, "lx"); 2053 + DUMP(p, stab_rr, "lx"); 2054 + DUMP(p, saved_r1, "lx"); 2055 + DUMP(p, trap_save, "x"); 2056 + DUMP(p, soft_enabled, "x"); 2057 + DUMP(p, irq_happened, "x"); 2058 + DUMP(p, io_sync, "x"); 2059 + DUMP(p, irq_work_pending, "x"); 2060 + DUMP(p, nap_state_lost, "x"); 2061 + 2062 + #undef DUMP 2063 + 2064 + catch_memory_errors = 0; 2065 + sync(); 2066 + } 2067 + 2068 + static void dump_all_pacas(void) 2069 + { 2070 + int cpu; 2071 + 2072 + if (num_possible_cpus() == 0) { 2073 + printf("No possible cpus, use 'dp #' to dump individual cpus\n"); 2074 + return; 2075 + } 2076 + 2077 + for_each_possible_cpu(cpu) 2078 + dump_one_paca(cpu); 2079 + } 2080 + 2081 + static void dump_pacas(void) 2082 + { 2083 + unsigned long num; 2084 + int c; 2085 + 2086 + c = inchar(); 2087 + if (c == 'a') { 2088 + dump_all_pacas(); 2089 + return; 2090 + } 2091 + 2092 + termch = c; /* Put c back, it wasn't 'a' */ 2093 + 2094 + if (scanhex(&num)) 2095 + dump_one_paca(num); 2096 + else 2097 + dump_one_paca(xmon_owner); 2098 + } 2099 + #endif 2100 + 2020 2101 #define isxdigit(c) (('0' <= (c) && (c) <= '9') \ 2021 2102 || ('a' <= (c) && (c) <= 'f') \ 2022 2103 || ('A' <= (c) && (c) <= 'F')) ··· 2115 2018 int c; 2116 2019 2117 2020 c = inchar(); 2021 + 2022 + #ifdef CONFIG_PPC64 2023 + if (c == 'p') { 2024 + dump_pacas(); 2025 + return; 2026 + } 2027 + #endif 2028 + 2118 2029 if ((isxdigit(c) && c != 'f' && c != 'd') || c == '\n') 2119 2030 termch = c; 2120 2031 scanhex((void *)&adrs);
+8 -9
drivers/crypto/nx/nx.c
··· 34 34 #include <linux/device.h> 35 35 #include <linux/of.h> 36 36 #include <asm/pSeries_reconfig.h> 37 - #include <asm/abs_addr.h> 38 37 #include <asm/hvcall.h> 39 38 #include <asm/vio.h> 40 39 ··· 103 104 /* determine the start and end for this address range - slightly 104 105 * different if this is in VMALLOC_REGION */ 105 106 if (is_vmalloc_addr(start_addr)) 106 - sg_addr = phys_to_abs(page_to_phys(vmalloc_to_page(start_addr))) 107 + sg_addr = page_to_phys(vmalloc_to_page(start_addr)) 107 108 + offset_in_page(sg_addr); 108 109 else 109 - sg_addr = virt_to_abs(sg_addr); 110 + sg_addr = __pa(sg_addr); 110 111 111 112 end_addr = sg_addr + len; 112 113 ··· 264 265 nx_ctx->csbcpb->csb.valid |= NX_CSB_VALID_BIT; 265 266 266 267 nx_ctx->op.flags = function; 267 - nx_ctx->op.csbcpb = virt_to_abs(nx_ctx->csbcpb); 268 - nx_ctx->op.in = virt_to_abs(nx_ctx->in_sg); 269 - nx_ctx->op.out = virt_to_abs(nx_ctx->out_sg); 268 + nx_ctx->op.csbcpb = __pa(nx_ctx->csbcpb); 269 + nx_ctx->op.in = __pa(nx_ctx->in_sg); 270 + nx_ctx->op.out = __pa(nx_ctx->out_sg); 270 271 271 272 if (nx_ctx->csbcpb_aead) { 272 273 nx_ctx->csbcpb_aead->csb.valid |= NX_CSB_VALID_BIT; 273 274 274 275 nx_ctx->op_aead.flags = function; 275 - nx_ctx->op_aead.csbcpb = virt_to_abs(nx_ctx->csbcpb_aead); 276 - nx_ctx->op_aead.in = virt_to_abs(nx_ctx->in_sg); 277 - nx_ctx->op_aead.out = virt_to_abs(nx_ctx->out_sg); 276 + nx_ctx->op_aead.csbcpb = __pa(nx_ctx->csbcpb_aead); 277 + nx_ctx->op_aead.in = __pa(nx_ctx->in_sg); 278 + nx_ctx->op_aead.out = __pa(nx_ctx->out_sg); 278 279 } 279 280 } 280 281
+12 -31
drivers/edac/mpc85xx_edac.c
··· 212 212 return IRQ_HANDLED; 213 213 } 214 214 215 - static int __devinit mpc85xx_pci_err_probe(struct platform_device *op) 215 + int __devinit mpc85xx_pci_err_probe(struct platform_device *op) 216 216 { 217 217 struct edac_pci_ctl_info *pci; 218 218 struct mpc85xx_pci_pdata *pdata; ··· 225 225 pci = edac_pci_alloc_ctl_info(sizeof(*pdata), "mpc85xx_pci_err"); 226 226 if (!pci) 227 227 return -ENOMEM; 228 + 229 + /* make sure error reporting method is sane */ 230 + switch (edac_op_state) { 231 + case EDAC_OPSTATE_POLL: 232 + case EDAC_OPSTATE_INT: 233 + break; 234 + default: 235 + edac_op_state = EDAC_OPSTATE_INT; 236 + break; 237 + } 228 238 229 239 pdata = pci->pvt_info; 230 240 pdata->name = "mpc85xx_pci_err"; ··· 325 315 devres_release_group(&op->dev, mpc85xx_pci_err_probe); 326 316 return res; 327 317 } 318 + EXPORT_SYMBOL(mpc85xx_pci_err_probe); 328 319 329 320 static int mpc85xx_pci_err_remove(struct platform_device *op) 330 321 { ··· 348 337 349 338 return 0; 350 339 } 351 - 352 - static struct of_device_id mpc85xx_pci_err_of_match[] = { 353 - { 354 - .compatible = "fsl,mpc8540-pcix", 355 - }, 356 - { 357 - .compatible = "fsl,mpc8540-pci", 358 - }, 359 - {}, 360 - }; 361 - MODULE_DEVICE_TABLE(of, mpc85xx_pci_err_of_match); 362 - 363 - static struct platform_driver mpc85xx_pci_err_driver = { 364 - .probe = mpc85xx_pci_err_probe, 365 - .remove = __devexit_p(mpc85xx_pci_err_remove), 366 - .driver = { 367 - .name = "mpc85xx_pci_err", 368 - .owner = THIS_MODULE, 369 - .of_match_table = mpc85xx_pci_err_of_match, 370 - }, 371 - }; 372 340 373 341 #endif /* CONFIG_PCI */ 374 342 ··· 1200 1210 if (res) 1201 1211 printk(KERN_WARNING EDAC_MOD_STR "L2 fails to register\n"); 1202 1212 1203 - #ifdef CONFIG_PCI 1204 - res = platform_driver_register(&mpc85xx_pci_err_driver); 1205 - if (res) 1206 - printk(KERN_WARNING EDAC_MOD_STR "PCI fails to register\n"); 1207 - #endif 1208 - 1209 1213 #ifdef CONFIG_FSL_SOC_BOOKE 1210 1214 pvr = mfspr(SPRN_PVR); 1211 1215 ··· 1235 1251 (PVR_VER(pvr) == PVR_VER_E500V2)) { 1236 1252 on_each_cpu(mpc85xx_mc_restore_hid1, NULL, 0); 1237 1253 } 1238 - #endif 1239 - #ifdef CONFIG_PCI 1240 - platform_driver_unregister(&mpc85xx_pci_err_driver); 1241 1254 #endif 1242 1255 platform_driver_unregister(&mpc85xx_l2_err_driver); 1243 1256 platform_driver_unregister(&mpc85xx_mc_err_driver);
+1 -1
drivers/infiniband/hw/ehca/ehca_cq.c
··· 220 220 cq = ERR_PTR(-EAGAIN); 221 221 goto create_cq_exit4; 222 222 } 223 - rpage = virt_to_abs(vpage); 223 + rpage = __pa(vpage); 224 224 225 225 h_ret = hipz_h_register_rpage_cq(adapter_handle, 226 226 my_cq->ipz_cq_handle,
+1 -1
drivers/infiniband/hw/ehca/ehca_eq.c
··· 101 101 if (!vpage) 102 102 goto create_eq_exit2; 103 103 104 - rpage = virt_to_abs(vpage); 104 + rpage = __pa(vpage); 105 105 h_ret = hipz_h_register_rpage_eq(shca->ipz_hca_handle, 106 106 eq->ipz_eq_handle, 107 107 &eq->pf,
+20 -25
drivers/infiniband/hw/ehca/ehca_mrmw.c
··· 1136 1136 } 1137 1137 1138 1138 if (rnum > 1) { 1139 - rpage = virt_to_abs(kpage); 1139 + rpage = __pa(kpage); 1140 1140 if (!rpage) { 1141 1141 ehca_err(&shca->ib_device, "kpage=%p i=%x", 1142 1142 kpage, i); ··· 1231 1231 pginfo->num_kpages, pginfo->num_hwpages, kpage); 1232 1232 goto ehca_rereg_mr_rereg1_exit1; 1233 1233 } 1234 - rpage = virt_to_abs(kpage); 1234 + rpage = __pa(kpage); 1235 1235 if (!rpage) { 1236 1236 ehca_err(&shca->ib_device, "kpage=%p", kpage); 1237 1237 ret = -EFAULT; ··· 1525 1525 unsigned long ret = idx; 1526 1526 ret |= dir << EHCA_DIR_INDEX_SHIFT; 1527 1527 ret |= top << EHCA_TOP_INDEX_SHIFT; 1528 - return abs_to_virt(ret << SECTION_SIZE_BITS); 1528 + return __va(ret << SECTION_SIZE_BITS); 1529 1529 } 1530 1530 1531 1531 #define ehca_bmap_valid(entry) \ ··· 1537 1537 { 1538 1538 u64 h_ret = 0; 1539 1539 unsigned long page = 0; 1540 - u64 rpage = virt_to_abs(kpage); 1540 + u64 rpage = __pa(kpage); 1541 1541 int page_count; 1542 1542 1543 1543 void *sectbase = ehca_calc_sectbase(top, dir, idx); ··· 1553 1553 for (rnum = 0; (rnum < MAX_RPAGES) && (page < page_count); 1554 1554 rnum++) { 1555 1555 void *pg = sectbase + ((page++) * pginfo->hwpage_size); 1556 - kpage[rnum] = virt_to_abs(pg); 1556 + kpage[rnum] = __pa(pg); 1557 1557 } 1558 1558 1559 1559 h_ret = hipz_h_register_rpage_mr(shca->ipz_hca_handle, mr, ··· 1870 1870 for (i = pginfo->u.usr.next_nmap; i < chunk->nmap; ) { 1871 1871 pgaddr = page_to_pfn(sg_page(&chunk->page_list[i])) 1872 1872 << PAGE_SHIFT ; 1873 - *kpage = phys_to_abs(pgaddr + 1874 - (pginfo->next_hwpage * 1875 - pginfo->hwpage_size)); 1873 + *kpage = pgaddr + (pginfo->next_hwpage * 1874 + pginfo->hwpage_size); 1876 1875 if ( !(*kpage) ) { 1877 1876 ehca_gen_err("pgaddr=%llx " 1878 1877 "chunk->page_list[i]=%llx " ··· 1926 1927 u64 pgaddr = page_to_pfn(sg_page(&page_list[t])) << PAGE_SHIFT; 1927 1928 if (ehca_debug_level >= 3) 1928 1929 ehca_gen_dbg("chunk_page=%llx value=%016llx", pgaddr, 1929 - *(u64 *)abs_to_virt(phys_to_abs(pgaddr))); 1930 + *(u64 *)__va(pgaddr)); 1930 1931 if (pgaddr - PAGE_SIZE != *prev_pgaddr) { 1931 1932 ehca_gen_err("uncontiguous page found pgaddr=%llx " 1932 1933 "prev_pgaddr=%llx page_list_i=%x", ··· 1961 1962 if (nr_kpages == kpages_per_hwpage) { 1962 1963 pgaddr = ( page_to_pfn(sg_page(&chunk->page_list[i])) 1963 1964 << PAGE_SHIFT ); 1964 - *kpage = phys_to_abs(pgaddr); 1965 + *kpage = pgaddr; 1965 1966 if ( !(*kpage) ) { 1966 1967 ehca_gen_err("pgaddr=%llx i=%x", 1967 1968 pgaddr, i); ··· 1989 1990 (pginfo->hwpage_size - 1)) >> 1990 1991 PAGE_SHIFT; 1991 1992 nr_kpages -= pginfo->kpage_cnt; 1992 - *kpage = phys_to_abs( 1993 - pgaddr & 1994 - ~(pginfo->hwpage_size - 1)); 1993 + *kpage = pgaddr & 1994 + ~(pginfo->hwpage_size - 1); 1995 1995 } 1996 1996 if (ehca_debug_level >= 3) { 1997 - u64 val = *(u64 *)abs_to_virt( 1998 - phys_to_abs(pgaddr)); 1997 + u64 val = *(u64 *)__va(pgaddr); 1999 1998 ehca_gen_dbg("kpage=%llx chunk_page=%llx " 2000 1999 "value=%016llx", 2001 2000 *kpage, pgaddr, val); ··· 2081 2084 pginfo->num_hwpages, i); 2082 2085 return -EFAULT; 2083 2086 } 2084 - *kpage = phys_to_abs( 2085 - (pbuf->addr & ~(pginfo->hwpage_size - 1)) + 2086 - (pginfo->next_hwpage * pginfo->hwpage_size)); 2087 + *kpage = (pbuf->addr & ~(pginfo->hwpage_size - 1)) + 2088 + (pginfo->next_hwpage * pginfo->hwpage_size); 2087 2089 if ( !(*kpage) && pbuf->addr ) { 2088 2090 ehca_gen_err("pbuf->addr=%llx pbuf->size=%llx " 2089 2091 "next_hwpage=%llx", pbuf->addr, ··· 2120 2124 /* loop over desired page_list entries */ 2121 2125 fmrlist = pginfo->u.fmr.page_list + pginfo->u.fmr.next_listelem; 2122 2126 for (i = 0; i < number; i++) { 2123 - *kpage = phys_to_abs((*fmrlist & ~(pginfo->hwpage_size - 1)) + 2124 - pginfo->next_hwpage * pginfo->hwpage_size); 2127 + *kpage = (*fmrlist & ~(pginfo->hwpage_size - 1)) + 2128 + pginfo->next_hwpage * pginfo->hwpage_size; 2125 2129 if ( !(*kpage) ) { 2126 2130 ehca_gen_err("*fmrlist=%llx fmrlist=%p " 2127 2131 "next_listelem=%llx next_hwpage=%llx", ··· 2148 2152 u64 prev = *kpage; 2149 2153 /* check if adrs are contiguous */ 2150 2154 for (j = 1; j < cnt_per_hwpage; j++) { 2151 - u64 p = phys_to_abs(fmrlist[j] & 2152 - ~(pginfo->hwpage_size - 1)); 2155 + u64 p = fmrlist[j] & ~(pginfo->hwpage_size - 1); 2153 2156 if (prev + pginfo->u.fmr.fmr_pgsize != p) { 2154 2157 ehca_gen_err("uncontiguous fmr pages " 2155 2158 "found prev=%llx p=%llx " ··· 2383 2388 memset(ehca_bmap, 0xFF, EHCA_TOP_MAP_SIZE); 2384 2389 } 2385 2390 2386 - start_section = phys_to_abs(pfn * PAGE_SIZE) / EHCA_SECTSIZE; 2387 - end_section = phys_to_abs((pfn + nr_pages) * PAGE_SIZE) / EHCA_SECTSIZE; 2391 + start_section = (pfn * PAGE_SIZE) / EHCA_SECTSIZE; 2392 + end_section = ((pfn + nr_pages) * PAGE_SIZE) / EHCA_SECTSIZE; 2388 2393 for (i = start_section; i < end_section; i++) { 2389 2394 int ret; 2390 2395 top = ehca_calc_index(i, EHCA_TOP_INDEX_SHIFT); ··· 2503 2508 if (!ehca_bmap) 2504 2509 return EHCA_INVAL_ADDR; 2505 2510 2506 - abs_addr = virt_to_abs(caddr); 2511 + abs_addr = __pa(caddr); 2507 2512 top = ehca_calc_index(abs_addr, EHCA_TOP_INDEX_SHIFT + EHCA_SECTSHIFT); 2508 2513 if (!ehca_bmap_valid(ehca_bmap->top[top])) 2509 2514 return EHCA_INVAL_ADDR;
+3 -3
drivers/infiniband/hw/ehca/ehca_qp.c
··· 321 321 ret = -EINVAL; 322 322 goto init_qp_queue1; 323 323 } 324 - rpage = virt_to_abs(vpage); 324 + rpage = __pa(vpage); 325 325 326 326 h_ret = hipz_h_register_rpage_qp(ipz_hca_handle, 327 327 my_qp->ipz_qp_handle, ··· 1094 1094 ehca_dbg(&shca->ib_device, "qp_num=%x bad_send_wqe_p=%p", 1095 1095 qp_num, bad_send_wqe_p); 1096 1096 /* convert wqe pointer to vadr */ 1097 - bad_send_wqe_v = abs_to_virt((u64)bad_send_wqe_p); 1097 + bad_send_wqe_v = __va((u64)bad_send_wqe_p); 1098 1098 if (ehca_debug_level >= 2) 1099 1099 ehca_dmp(bad_send_wqe_v, 32, "qp_num=%x bad_wqe", qp_num); 1100 1100 squeue = &my_qp->ipz_squeue; ··· 1138 1138 /* convert real to abs address */ 1139 1139 wqe_p = wqe_p & (~(1UL << 63)); 1140 1140 1141 - wqe_v = abs_to_virt(wqe_p); 1141 + wqe_v = __va(wqe_p); 1142 1142 1143 1143 if (ipz_queue_abs_to_offset(ipz_queue, wqe_p, &q_ofs)) { 1144 1144 ehca_gen_err("Invalid offset for calculating left cqes "
+1 -1
drivers/infiniband/hw/ehca/ehca_reqs.c
··· 135 135 mad_hdr->attr_mod); 136 136 } 137 137 for (j = 0; j < send_wr->num_sge; j++) { 138 - u8 *data = (u8 *)abs_to_virt(sge->addr); 138 + u8 *data = __va(sge->addr); 139 139 ehca_gen_dbg("send_wr#%x sge#%x addr=%p length=%x " 140 140 "lkey=%x", 141 141 idx, j, data, sge->length, sge->lkey);
-1
drivers/infiniband/hw/ehca/ehca_tools.h
··· 59 59 #include <linux/device.h> 60 60 61 61 #include <linux/atomic.h> 62 - #include <asm/abs_addr.h> 63 62 #include <asm/ibmebus.h> 64 63 #include <asm/io.h> 65 64 #include <asm/pgtable.h>
+6 -6
drivers/infiniband/hw/ehca/hcp_if.c
··· 396 396 struct hipz_query_port *query_port_response_block) 397 397 { 398 398 u64 ret; 399 - u64 r_cb = virt_to_abs(query_port_response_block); 399 + u64 r_cb = __pa(query_port_response_block); 400 400 401 401 if (r_cb & (EHCA_PAGESIZE-1)) { 402 402 ehca_gen_err("response block not page aligned"); ··· 438 438 u64 hipz_h_query_hca(const struct ipz_adapter_handle adapter_handle, 439 439 struct hipz_query_hca *query_hca_rblock) 440 440 { 441 - u64 r_cb = virt_to_abs(query_hca_rblock); 441 + u64 r_cb = __pa(query_hca_rblock); 442 442 443 443 if (r_cb & (EHCA_PAGESIZE-1)) { 444 444 ehca_gen_err("response_block=%p not page aligned", ··· 577 577 adapter_handle.handle, /* r4 */ 578 578 qp_handle.handle, /* r5 */ 579 579 update_mask, /* r6 */ 580 - virt_to_abs(mqpcb), /* r7 */ 580 + __pa(mqpcb), /* r7 */ 581 581 0, 0, 0, 0, 0); 582 582 583 583 if (ret == H_NOT_ENOUGH_RESOURCES) ··· 595 595 return ehca_plpar_hcall_norets(H_QUERY_QP, 596 596 adapter_handle.handle, /* r4 */ 597 597 qp_handle.handle, /* r5 */ 598 - virt_to_abs(qqpcb), /* r6 */ 598 + __pa(qqpcb), /* r6 */ 599 599 0, 0, 0, 0); 600 600 } 601 601 ··· 787 787 if (count > 1) { 788 788 u64 *kpage; 789 789 int i; 790 - kpage = (u64 *)abs_to_virt(logical_address_of_page); 790 + kpage = __va(logical_address_of_page); 791 791 for (i = 0; i < count; i++) 792 792 ehca_gen_dbg("kpage[%d]=%p", 793 793 i, (void *)kpage[i]); ··· 944 944 void *rblock, 945 945 unsigned long *byte_count) 946 946 { 947 - u64 r_cb = virt_to_abs(rblock); 947 + u64 r_cb = __pa(rblock); 948 948 949 949 if (r_cb & (EHCA_PAGESIZE-1)) { 950 950 ehca_gen_err("rblock not page aligned.");
+1 -1
drivers/infiniband/hw/ehca/ipz_pt_fn.c
··· 81 81 { 82 82 int i; 83 83 for (i = 0; i < queue->queue_length / queue->pagesize; i++) { 84 - u64 page = (u64)virt_to_abs(queue->queue_pages[i]); 84 + u64 page = __pa(queue->queue_pages[i]); 85 85 if (addr >= page && addr < page + queue->pagesize) { 86 86 *q_offset = addr - page + i * queue->pagesize; 87 87 return 0;
+1 -2
drivers/macintosh/smu.c
··· 45 45 #include <asm/pmac_feature.h> 46 46 #include <asm/smu.h> 47 47 #include <asm/sections.h> 48 - #include <asm/abs_addr.h> 49 48 #include <asm/uaccess.h> 50 49 51 50 #define VERSION "0.7" ··· 501 502 * 32 bits value safely 502 503 */ 503 504 smu->cmd_buf_abs = (u32)smu_cmdbuf_abs; 504 - smu->cmd_buf = (struct smu_cmd_buf *)abs_to_virt(smu_cmdbuf_abs); 505 + smu->cmd_buf = __va(smu_cmdbuf_abs); 505 506 506 507 smu->db_node = of_find_node_by_name(NULL, "smu-doorbell"); 507 508 if (smu->db_node == NULL) {
+55 -1
drivers/mtd/nand/fsl_ifc_nand.c
··· 31 31 #include <linux/mtd/nand_ecc.h> 32 32 #include <asm/fsl_ifc.h> 33 33 34 + #define FSL_IFC_V1_1_0 0x01010000 34 35 #define ERR_BYTE 0xFF /* Value returned for read 35 36 bytes when read failed */ 36 37 #define IFC_TIMEOUT_MSECS 500 /* Maximum number of mSecs to wait ··· 774 773 return 0; 775 774 } 776 775 776 + static void fsl_ifc_sram_init(struct fsl_ifc_mtd *priv) 777 + { 778 + struct fsl_ifc_ctrl *ctrl = priv->ctrl; 779 + struct fsl_ifc_regs __iomem *ifc = ctrl->regs; 780 + uint32_t csor = 0, csor_8k = 0, csor_ext = 0; 781 + uint32_t cs = priv->bank; 782 + 783 + /* Save CSOR and CSOR_ext */ 784 + csor = in_be32(&ifc->csor_cs[cs].csor); 785 + csor_ext = in_be32(&ifc->csor_cs[cs].csor_ext); 786 + 787 + /* chage PageSize 8K and SpareSize 1K*/ 788 + csor_8k = (csor & ~(CSOR_NAND_PGS_MASK)) | 0x0018C000; 789 + out_be32(&ifc->csor_cs[cs].csor, csor_8k); 790 + out_be32(&ifc->csor_cs[cs].csor_ext, 0x0000400); 791 + 792 + /* READID */ 793 + out_be32(&ifc->ifc_nand.nand_fir0, 794 + (IFC_FIR_OP_CMD0 << IFC_NAND_FIR0_OP0_SHIFT) | 795 + (IFC_FIR_OP_UA << IFC_NAND_FIR0_OP1_SHIFT) | 796 + (IFC_FIR_OP_RB << IFC_NAND_FIR0_OP2_SHIFT)); 797 + out_be32(&ifc->ifc_nand.nand_fcr0, 798 + NAND_CMD_READID << IFC_NAND_FCR0_CMD0_SHIFT); 799 + out_be32(&ifc->ifc_nand.row3, 0x0); 800 + 801 + out_be32(&ifc->ifc_nand.nand_fbcr, 0x0); 802 + 803 + /* Program ROW0/COL0 */ 804 + out_be32(&ifc->ifc_nand.row0, 0x0); 805 + out_be32(&ifc->ifc_nand.col0, 0x0); 806 + 807 + /* set the chip select for NAND Transaction */ 808 + out_be32(&ifc->ifc_nand.nand_csel, cs << IFC_NAND_CSEL_SHIFT); 809 + 810 + /* start read seq */ 811 + out_be32(&ifc->ifc_nand.nandseq_strt, IFC_NAND_SEQ_STRT_FIR_STRT); 812 + 813 + /* wait for command complete flag or timeout */ 814 + wait_event_timeout(ctrl->nand_wait, ctrl->nand_stat, 815 + IFC_TIMEOUT_MSECS * HZ/1000); 816 + 817 + if (ctrl->nand_stat != IFC_NAND_EVTER_STAT_OPC) 818 + printk(KERN_ERR "fsl-ifc: Failed to Initialise SRAM\n"); 819 + 820 + /* Restore CSOR and CSOR_ext */ 821 + out_be32(&ifc->csor_cs[cs].csor, csor); 822 + out_be32(&ifc->csor_cs[cs].csor_ext, csor_ext); 823 + } 824 + 777 825 static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv) 778 826 { 779 827 struct fsl_ifc_ctrl *ctrl = priv->ctrl; 780 828 struct fsl_ifc_regs __iomem *ifc = ctrl->regs; 781 829 struct nand_chip *chip = &priv->chip; 782 830 struct nand_ecclayout *layout; 783 - u32 csor; 831 + u32 csor, ver; 784 832 785 833 /* Fill in fsl_ifc_mtd structure */ 786 834 priv->mtd.priv = chip; ··· 923 873 } else { 924 874 chip->ecc.mode = NAND_ECC_SOFT; 925 875 } 876 + 877 + ver = in_be32(&ifc->ifc_rev); 878 + if (ver == FSL_IFC_V1_1_0) 879 + fsl_ifc_sram_init(priv); 926 880 927 881 return 0; 928 882 }
-1
drivers/net/ethernet/ibm/ehea/ehea.h
··· 35 35 #include <linux/if_vlan.h> 36 36 37 37 #include <asm/ibmebus.h> 38 - #include <asm/abs_addr.h> 39 38 #include <asm/io.h> 40 39 41 40 #define DRV_NAME "ehea"
+6 -6
drivers/net/ethernet/ibm/ehea/ehea_phyp.c
··· 141 141 qp_category, /* R5 */ 142 142 qp_handle, /* R6 */ 143 143 sel_mask, /* R7 */ 144 - virt_to_abs(cb_addr), /* R8 */ 144 + __pa(cb_addr), /* R8 */ 145 145 0, 0); 146 146 } 147 147 ··· 415 415 (u64) cat, /* R5 */ 416 416 qp_handle, /* R6 */ 417 417 sel_mask, /* R7 */ 418 - virt_to_abs(cb_addr), /* R8 */ 418 + __pa(cb_addr), /* R8 */ 419 419 0, 0, 0, 0); /* R9-R12 */ 420 420 421 421 *inv_attr_id = outs[0]; ··· 528 528 { 529 529 u64 hret, cb_logaddr; 530 530 531 - cb_logaddr = virt_to_abs(cb_addr); 531 + cb_logaddr = __pa(cb_addr); 532 532 533 533 hret = ehea_plpar_hcall_norets(H_QUERY_HEA, 534 534 adapter_handle, /* R4 */ ··· 545 545 void *cb_addr) 546 546 { 547 547 u64 port_info; 548 - u64 cb_logaddr = virt_to_abs(cb_addr); 548 + u64 cb_logaddr = __pa(cb_addr); 549 549 u64 arr_index = 0; 550 550 551 551 port_info = EHEA_BMASK_SET(H_MEHEAPORT_CAT, cb_cat) ··· 567 567 unsigned long outs[PLPAR_HCALL9_BUFSIZE]; 568 568 u64 port_info; 569 569 u64 arr_index = 0; 570 - u64 cb_logaddr = virt_to_abs(cb_addr); 570 + u64 cb_logaddr = __pa(cb_addr); 571 571 572 572 port_info = EHEA_BMASK_SET(H_MEHEAPORT_CAT, cb_cat) 573 573 | EHEA_BMASK_SET(H_MEHEAPORT_PN, port_num); ··· 621 621 return ehea_plpar_hcall_norets(H_ERROR_DATA, 622 622 adapter_handle, /* R4 */ 623 623 ressource_handle, /* R5 */ 624 - virt_to_abs(rblock), /* R6 */ 624 + __pa(rblock), /* R6 */ 625 625 0, 0, 0, 0); /* R7-R12 */ 626 626 }
+7 -7
drivers/net/ethernet/ibm/ehea/ehea_qmr.c
··· 163 163 goto out_kill_hwq; 164 164 } 165 165 166 - rpage = virt_to_abs(vpage); 166 + rpage = __pa(vpage); 167 167 hret = ehea_h_register_rpage(adapter->handle, 168 168 0, EHEA_CQ_REGISTER_ORIG, 169 169 cq->fw_handle, rpage, 1); ··· 290 290 goto out_kill_hwq; 291 291 } 292 292 293 - rpage = virt_to_abs(vpage); 293 + rpage = __pa(vpage); 294 294 295 295 hret = ehea_h_register_rpage(adapter->handle, 0, 296 296 EHEA_EQ_REGISTER_ORIG, ··· 395 395 pr_err("hw_qpageit_get_inc failed\n"); 396 396 goto out_kill_hwq; 397 397 } 398 - rpage = virt_to_abs(vpage); 398 + rpage = __pa(vpage); 399 399 hret = ehea_h_register_rpage(adapter->handle, 400 400 0, h_call_q_selector, 401 401 qp->fw_handle, rpage, 1); ··· 790 790 if (!ehea_bmap) 791 791 return EHEA_INVAL_ADDR; 792 792 793 - index = virt_to_abs(caddr) >> SECTION_SIZE_BITS; 793 + index = __pa(caddr) >> SECTION_SIZE_BITS; 794 794 top = (index >> EHEA_TOP_INDEX_SHIFT) & EHEA_INDEX_MASK; 795 795 if (!ehea_bmap->top[top]) 796 796 return EHEA_INVAL_ADDR; ··· 812 812 unsigned long ret = idx; 813 813 ret |= dir << EHEA_DIR_INDEX_SHIFT; 814 814 ret |= top << EHEA_TOP_INDEX_SHIFT; 815 - return abs_to_virt(ret << SECTION_SIZE_BITS); 815 + return __va(ret << SECTION_SIZE_BITS); 816 816 } 817 817 818 818 static u64 ehea_reg_mr_section(int top, int dir, int idx, u64 *pt, ··· 822 822 void *pg; 823 823 u64 j, m, hret; 824 824 unsigned long k = 0; 825 - u64 pt_abs = virt_to_abs(pt); 825 + u64 pt_abs = __pa(pt); 826 826 827 827 void *sectbase = ehea_calc_sectbase(top, dir, idx); 828 828 ··· 830 830 831 831 for (m = 0; m < EHEA_MAX_RPAGE; m++) { 832 832 pg = sectbase + ((k++) * EHEA_PAGESIZE); 833 - pt[m] = virt_to_abs(pg); 833 + pt[m] = __pa(pg); 834 834 } 835 835 hret = ehea_h_register_rpage_mr(adapter->handle, mr->handle, 0, 836 836 0, pt_abs, EHEA_MAX_RPAGE);
+1 -1
drivers/pci/hotplug/rpadlpar_core.c
··· 388 388 /* Remove the EADS bridge device itself */ 389 389 BUG_ON(!bus->self); 390 390 pr_debug("PCI: Now removing bridge device %s\n", pci_name(bus->self)); 391 - eeh_remove_bus_device(bus->self); 391 + eeh_remove_bus_device(bus->self, true); 392 392 pci_stop_and_remove_bus_device(bus->self); 393 393 394 394 return 0;
+9 -9
drivers/scsi/ipr.c
··· 6373 6373 6374 6374 #ifdef CONFIG_PPC_PSERIES 6375 6375 static const u16 ipr_blocked_processors[] = { 6376 - PV_NORTHSTAR, 6377 - PV_PULSAR, 6378 - PV_POWER4, 6379 - PV_ICESTAR, 6380 - PV_SSTAR, 6381 - PV_POWER4p, 6382 - PV_630, 6383 - PV_630p 6376 + PVR_NORTHSTAR, 6377 + PVR_PULSAR, 6378 + PVR_POWER4, 6379 + PVR_ICESTAR, 6380 + PVR_SSTAR, 6381 + PVR_POWER4p, 6382 + PVR_630, 6383 + PVR_630p 6384 6384 }; 6385 6385 6386 6386 /** ··· 6400 6400 6401 6401 if ((ioa_cfg->type == 0x5702) && (ioa_cfg->pdev->revision < 4)) { 6402 6402 for (i = 0; i < ARRAY_SIZE(ipr_blocked_processors); i++) { 6403 - if (__is_processor(ipr_blocked_processors[i])) 6403 + if (pvr_version_is(ipr_blocked_processors[i])) 6404 6404 return 1; 6405 6405 } 6406 6406 }
+26 -7
drivers/tty/hvc/hvc_console.c
··· 245 245 kfree(hp); 246 246 } 247 247 248 + static void hvc_check_console(int index) 249 + { 250 + /* Already enabled, bail out */ 251 + if (hvc_console.flags & CON_ENABLED) 252 + return; 253 + 254 + /* If this index is what the user requested, then register 255 + * now (setup won't fail at this point). It's ok to just 256 + * call register again if previously .setup failed. 257 + */ 258 + if (index == hvc_console.index) 259 + register_console(&hvc_console); 260 + } 261 + 248 262 /* 249 263 * hvc_instantiate() is an early console discovery method which locates 250 264 * consoles * prior to the vio subsystem discovering them. Hotplugged ··· 289 275 if (last_hvc < index) 290 276 last_hvc = index; 291 277 292 - /* if this index is what the user requested, then register 293 - * now (setup won't fail at this point). It's ok to just 294 - * call register again if previously .setup failed. 295 - */ 296 - if (index == hvc_console.index) 297 - register_console(&hvc_console); 278 + /* check if we need to re-register the kernel console */ 279 + hvc_check_console(index); 298 280 299 281 return 0; 300 282 } ··· 887 877 i = ++last_hvc; 888 878 889 879 hp->index = i; 880 + cons_ops[i] = ops; 881 + vtermnos[i] = vtermno; 890 882 891 883 list_add_tail(&(hp->next), &hvc_structs); 892 884 spin_unlock(&hvc_structs_lock); 885 + 886 + /* check if we need to re-register the kernel console */ 887 + hvc_check_console(i); 893 888 894 889 return hp; 895 890 } ··· 908 893 tty = tty_port_tty_get(&hp->port); 909 894 910 895 spin_lock_irqsave(&hp->lock, flags); 911 - if (hp->index < MAX_NR_HVC_CONSOLES) 896 + if (hp->index < MAX_NR_HVC_CONSOLES) { 897 + console_lock(); 912 898 vtermnos[hp->index] = -1; 899 + cons_ops[hp->index] = NULL; 900 + console_unlock(); 901 + } 913 902 914 903 /* Don't whack hp->irq because tty_hangup() will need to free the irq. */ 915 904
+70 -53
drivers/tty/hvc/hvc_vio.c
··· 230 230 .tiocmset = hvterm_hvsi_tiocmset, 231 231 }; 232 232 233 + static void udbg_hvc_putc(char c) 234 + { 235 + int count = -1; 236 + 237 + if (!hvterm_privs[0]) 238 + return; 239 + 240 + if (c == '\n') 241 + udbg_hvc_putc('\r'); 242 + 243 + do { 244 + switch(hvterm_privs[0]->proto) { 245 + case HV_PROTOCOL_RAW: 246 + count = hvterm_raw_put_chars(0, &c, 1); 247 + break; 248 + case HV_PROTOCOL_HVSI: 249 + count = hvterm_hvsi_put_chars(0, &c, 1); 250 + break; 251 + } 252 + } while(count == 0); 253 + } 254 + 255 + static int udbg_hvc_getc_poll(void) 256 + { 257 + int rc = 0; 258 + char c; 259 + 260 + if (!hvterm_privs[0]) 261 + return -1; 262 + 263 + switch(hvterm_privs[0]->proto) { 264 + case HV_PROTOCOL_RAW: 265 + rc = hvterm_raw_get_chars(0, &c, 1); 266 + break; 267 + case HV_PROTOCOL_HVSI: 268 + rc = hvterm_hvsi_get_chars(0, &c, 1); 269 + break; 270 + } 271 + if (!rc) 272 + return -1; 273 + return c; 274 + } 275 + 276 + static int udbg_hvc_getc(void) 277 + { 278 + int ch; 279 + 280 + if (!hvterm_privs[0]) 281 + return -1; 282 + 283 + for (;;) { 284 + ch = udbg_hvc_getc_poll(); 285 + if (ch == -1) { 286 + /* This shouldn't be needed...but... */ 287 + volatile unsigned long delay; 288 + for (delay=0; delay < 2000000; delay++) 289 + ; 290 + } else { 291 + return ch; 292 + } 293 + } 294 + } 295 + 233 296 static int __devinit hvc_vio_probe(struct vio_dev *vdev, 234 297 const struct vio_device_id *id) 235 298 { ··· 352 289 return PTR_ERR(hp); 353 290 dev_set_drvdata(&vdev->dev, hp); 354 291 292 + /* register udbg if it's not there already for console 0 */ 293 + if (hp->index == 0 && !udbg_putc) { 294 + udbg_putc = udbg_hvc_putc; 295 + udbg_getc = udbg_hvc_getc; 296 + udbg_getc_poll = udbg_hvc_getc_poll; 297 + } 298 + 355 299 return 0; 356 300 } 357 301 ··· 400 330 vio_unregister_driver(&hvc_vio_driver); 401 331 } 402 332 module_exit(hvc_vio_exit); 403 - 404 - static void udbg_hvc_putc(char c) 405 - { 406 - int count = -1; 407 - 408 - if (c == '\n') 409 - udbg_hvc_putc('\r'); 410 - 411 - do { 412 - switch(hvterm_priv0.proto) { 413 - case HV_PROTOCOL_RAW: 414 - count = hvterm_raw_put_chars(0, &c, 1); 415 - break; 416 - case HV_PROTOCOL_HVSI: 417 - count = hvterm_hvsi_put_chars(0, &c, 1); 418 - break; 419 - } 420 - } while(count == 0); 421 - } 422 - 423 - static int udbg_hvc_getc_poll(void) 424 - { 425 - int rc = 0; 426 - char c; 427 - 428 - switch(hvterm_priv0.proto) { 429 - case HV_PROTOCOL_RAW: 430 - rc = hvterm_raw_get_chars(0, &c, 1); 431 - break; 432 - case HV_PROTOCOL_HVSI: 433 - rc = hvterm_hvsi_get_chars(0, &c, 1); 434 - break; 435 - } 436 - if (!rc) 437 - return -1; 438 - return c; 439 - } 440 - 441 - static int udbg_hvc_getc(void) 442 - { 443 - int ch; 444 - for (;;) { 445 - ch = udbg_hvc_getc_poll(); 446 - if (ch == -1) { 447 - /* This shouldn't be needed...but... */ 448 - volatile unsigned long delay; 449 - for (delay=0; delay < 2000000; delay++) 450 - ; 451 - } else { 452 - return ch; 453 - } 454 - } 455 - } 456 333 457 334 void __init hvc_vio_init_early(void) 458 335 {
+1 -2
drivers/video/ps3fb.c
··· 31 31 #include <linux/fb.h> 32 32 #include <linux/init.h> 33 33 34 - #include <asm/abs_addr.h> 35 34 #include <asm/cell-regs.h> 36 35 #include <asm/lv1call.h> 37 36 #include <asm/ps3av.h> ··· 1140 1141 */ 1141 1142 fb_start = ps3fb_videomemory.address + GPU_FB_START; 1142 1143 info->screen_base = (char __force __iomem *)fb_start; 1143 - info->fix.smem_start = virt_to_abs(fb_start); 1144 + info->fix.smem_start = __pa(fb_start); 1144 1145 info->fix.smem_len = ps3fb_videomemory.size - GPU_FB_START; 1145 1146 1146 1147 info->pseudo_palette = par->pseudo_palette;