aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/40x/ep405.c2
-rw-r--r--arch/powerpc/platforms/40x/ppc40x_simple.c2
-rw-r--r--arch/powerpc/platforms/40x/virtex.c2
-rw-r--r--arch/powerpc/platforms/40x/walnut.c2
-rw-r--r--arch/powerpc/platforms/44x/Kconfig6
-rw-r--r--arch/powerpc/platforms/44x/canyonlands.c2
-rw-r--r--arch/powerpc/platforms/44x/ebony.c2
-rw-r--r--arch/powerpc/platforms/44x/iss4xx.c2
-rw-r--r--arch/powerpc/platforms/44x/ppc44x_simple.c2
-rw-r--r--arch/powerpc/platforms/44x/ppc476.c2
-rw-r--r--arch/powerpc/platforms/44x/sam440ep.c2
-rw-r--r--arch/powerpc/platforms/44x/virtex.c2
-rw-r--r--arch/powerpc/platforms/44x/warp.c2
-rw-r--r--arch/powerpc/platforms/512x/mpc512x_shared.c2
-rw-r--r--arch/powerpc/platforms/52xx/lite5200.c4
-rw-r--r--arch/powerpc/platforms/52xx/media5200.c2
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_common.c12
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c2
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pic.c4
-rw-r--r--arch/powerpc/platforms/82xx/ep8248e.c2
-rw-r--r--arch/powerpc/platforms/82xx/km82xx.c2
-rw-r--r--arch/powerpc/platforms/82xx/mpc8272_ads.c2
-rw-r--r--arch/powerpc/platforms/82xx/pq2fads.c2
-rw-r--r--arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c2
-rw-r--r--arch/powerpc/platforms/83xx/misc.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_itx.c2
-rw-r--r--arch/powerpc/platforms/83xx/suspend.c4
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig2
-rw-r--r--arch/powerpc/platforms/85xx/common.c2
-rw-r--r--arch/powerpc/platforms/85xx/corenet_generic.c14
-rw-r--r--arch/powerpc/platforms/85xx/ppa8548.c2
-rw-r--r--arch/powerpc/platforms/85xx/qemu_e500.c10
-rw-r--r--arch/powerpc/platforms/85xx/sgy_cts1000.c4
-rw-r--r--arch/powerpc/platforms/86xx/gef_ppc9a.c2
-rw-r--r--arch/powerpc/platforms/86xx/gef_sbc310.c2
-rw-r--r--arch/powerpc/platforms/86xx/gef_sbc610.c2
-rw-r--r--arch/powerpc/platforms/86xx/mpc8610_hpcd.c2
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_hpcn.c2
-rw-r--r--arch/powerpc/platforms/86xx/sbc8641d.c2
-rw-r--r--arch/powerpc/platforms/8xx/adder875.c2
-rw-r--r--arch/powerpc/platforms/8xx/ep88xc.c2
-rw-r--r--arch/powerpc/platforms/8xx/mpc86xads_setup.c2
-rw-r--r--arch/powerpc/platforms/8xx/mpc885ads_setup.c2
-rw-r--r--arch/powerpc/platforms/8xx/tqm8xx_setup.c2
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype6
-rw-r--r--arch/powerpc/platforms/cell/Kconfig1
-rw-r--r--arch/powerpc/platforms/cell/Makefile2
-rw-r--r--arch/powerpc/platforms/cell/celleb_pci.c2
-rw-r--r--arch/powerpc/platforms/cell/celleb_setup.c2
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c55
-rw-r--r--arch/powerpc/platforms/cell/spu_fault.c94
-rw-r--r--arch/powerpc/platforms/cell/spufs/fault.c4
-rw-r--r--arch/powerpc/platforms/chrp/setup.c2
-rw-r--r--arch/powerpc/platforms/embedded6xx/gamecube.c2
-rw-r--r--arch/powerpc/platforms/embedded6xx/linkstation.c2
-rw-r--r--arch/powerpc/platforms/embedded6xx/mvme5100.c2
-rw-r--r--arch/powerpc/platforms/embedded6xx/storcenter.c2
-rw-r--r--arch/powerpc/platforms/embedded6xx/wii.c2
-rw-r--r--arch/powerpc/platforms/pasemi/gpio_mdio.c2
-rw-r--r--arch/powerpc/platforms/pasemi/setup.c2
-rw-r--r--arch/powerpc/platforms/powermac/setup.c8
-rw-r--r--arch/powerpc/platforms/powernv/eeh-ioda.c226
-rw-r--r--arch/powerpc/platforms/powernv/eeh-powernv.c26
-rw-r--r--arch/powerpc/platforms/powernv/opal-dump.c18
-rw-r--r--arch/powerpc/platforms/powernv/opal-elog.c4
-rw-r--r--arch/powerpc/platforms/powernv/opal-lpc.c4
-rw-r--r--arch/powerpc/platforms/powernv/opal-nvram.c2
-rw-r--r--arch/powerpc/platforms/powernv/opal-rtc.c15
-rw-r--r--arch/powerpc/platforms/powernv/opal-tracepoints.c2
-rw-r--r--arch/powerpc/platforms/powernv/opal-wrappers.S3
-rw-r--r--arch/powerpc/platforms/powernv/opal.c6
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c290
-rw-r--r--arch/powerpc/platforms/powernv/pci.c11
-rw-r--r--arch/powerpc/platforms/powernv/pci.h4
-rw-r--r--arch/powerpc/platforms/powernv/powernv.h6
-rw-r--r--arch/powerpc/platforms/powernv/setup.c11
-rw-r--r--arch/powerpc/platforms/powernv/smp.c8
-rw-r--r--arch/powerpc/platforms/powernv/subcore.c1
-rw-r--r--arch/powerpc/platforms/pseries/cmm.c1
-rw-r--r--arch/powerpc/platforms/pseries/dlpar.c29
-rw-r--r--arch/powerpc/platforms/pseries/eeh_pseries.c40
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-cpu.c10
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c1
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c51
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c4
-rw-r--r--arch/powerpc/platforms/pseries/nvram.c12
-rw-r--r--arch/powerpc/platforms/pseries/pci.c1
-rw-r--r--arch/powerpc/platforms/pseries/ras.c2
-rw-r--r--arch/powerpc/platforms/pseries/setup.c2
89 files changed, 718 insertions, 392 deletions
diff --git a/arch/powerpc/platforms/40x/ep405.c b/arch/powerpc/platforms/40x/ep405.c
index b0389bbe4f94..ddc12a1926ef 100644
--- a/arch/powerpc/platforms/40x/ep405.c
+++ b/arch/powerpc/platforms/40x/ep405.c
@@ -49,7 +49,7 @@ static void __iomem *bcsr_regs;
49/* there's more, can't be bothered typing them tho */ 49/* there's more, can't be bothered typing them tho */
50 50
51 51
52static __initdata struct of_device_id ep405_of_bus[] = { 52static const struct of_device_id ep405_of_bus[] __initconst = {
53 { .compatible = "ibm,plb3", }, 53 { .compatible = "ibm,plb3", },
54 { .compatible = "ibm,opb", }, 54 { .compatible = "ibm,opb", },
55 { .compatible = "ibm,ebc", }, 55 { .compatible = "ibm,ebc", },
diff --git a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c
index 8f3920e5a046..b0c46375dd95 100644
--- a/arch/powerpc/platforms/40x/ppc40x_simple.c
+++ b/arch/powerpc/platforms/40x/ppc40x_simple.c
@@ -24,7 +24,7 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/of_platform.h> 25#include <linux/of_platform.h>
26 26
27static __initdata struct of_device_id ppc40x_of_bus[] = { 27static const struct of_device_id ppc40x_of_bus[] __initconst = {
28 { .compatible = "ibm,plb3", }, 28 { .compatible = "ibm,plb3", },
29 { .compatible = "ibm,plb4", }, 29 { .compatible = "ibm,plb4", },
30 { .compatible = "ibm,opb", }, 30 { .compatible = "ibm,opb", },
diff --git a/arch/powerpc/platforms/40x/virtex.c b/arch/powerpc/platforms/40x/virtex.c
index d0fc6866b00c..9aa7ae2f4164 100644
--- a/arch/powerpc/platforms/40x/virtex.c
+++ b/arch/powerpc/platforms/40x/virtex.c
@@ -17,7 +17,7 @@
17#include <asm/xilinx_pci.h> 17#include <asm/xilinx_pci.h>
18#include <asm/ppc4xx.h> 18#include <asm/ppc4xx.h>
19 19
20static struct of_device_id xilinx_of_bus_ids[] __initdata = { 20static const struct of_device_id xilinx_of_bus_ids[] __initconst = {
21 { .compatible = "xlnx,plb-v46-1.00.a", }, 21 { .compatible = "xlnx,plb-v46-1.00.a", },
22 { .compatible = "xlnx,plb-v34-1.01.a", }, 22 { .compatible = "xlnx,plb-v34-1.01.a", },
23 { .compatible = "xlnx,plb-v34-1.02.a", }, 23 { .compatible = "xlnx,plb-v34-1.02.a", },
diff --git a/arch/powerpc/platforms/40x/walnut.c b/arch/powerpc/platforms/40x/walnut.c
index 8b691df72f74..f7ac2d0fcb44 100644
--- a/arch/powerpc/platforms/40x/walnut.c
+++ b/arch/powerpc/platforms/40x/walnut.c
@@ -28,7 +28,7 @@
28#include <asm/pci-bridge.h> 28#include <asm/pci-bridge.h>
29#include <asm/ppc4xx.h> 29#include <asm/ppc4xx.h>
30 30
31static __initdata struct of_device_id walnut_of_bus[] = { 31static const struct of_device_id walnut_of_bus[] __initconst = {
32 { .compatible = "ibm,plb3", }, 32 { .compatible = "ibm,plb3", },
33 { .compatible = "ibm,opb", }, 33 { .compatible = "ibm,opb", },
34 { .compatible = "ibm,ebc", }, 34 { .compatible = "ibm,ebc", },
diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
index 4d88f6a19058..82f2da28cd27 100644
--- a/arch/powerpc/platforms/44x/Kconfig
+++ b/arch/powerpc/platforms/44x/Kconfig
@@ -215,9 +215,9 @@ config AKEBONO
215 select NET_VENDOR_IBM 215 select NET_VENDOR_IBM
216 select IBM_EMAC_EMAC4 216 select IBM_EMAC_EMAC4
217 select IBM_EMAC_RGMII_WOL 217 select IBM_EMAC_RGMII_WOL
218 select USB 218 select USB if USB_SUPPORT
219 select USB_OHCI_HCD_PLATFORM 219 select USB_OHCI_HCD_PLATFORM if USB_OHCI_HCD
220 select USB_EHCI_HCD_PLATFORM 220 select USB_EHCI_HCD_PLATFORM if USB_EHCI_HCD
221 select MMC_SDHCI 221 select MMC_SDHCI
222 select MMC_SDHCI_PLTFM 222 select MMC_SDHCI_PLTFM
223 select MMC_SDHCI_OF_476GTR 223 select MMC_SDHCI_OF_476GTR
diff --git a/arch/powerpc/platforms/44x/canyonlands.c b/arch/powerpc/platforms/44x/canyonlands.c
index e300dd4c89bf..22ca5430c9cb 100644
--- a/arch/powerpc/platforms/44x/canyonlands.c
+++ b/arch/powerpc/platforms/44x/canyonlands.c
@@ -33,7 +33,7 @@
33 33
34#define BCSR_USB_EN 0x11 34#define BCSR_USB_EN 0x11
35 35
36static __initdata struct of_device_id ppc460ex_of_bus[] = { 36static const struct of_device_id ppc460ex_of_bus[] __initconst = {
37 { .compatible = "ibm,plb4", }, 37 { .compatible = "ibm,plb4", },
38 { .compatible = "ibm,opb", }, 38 { .compatible = "ibm,opb", },
39 { .compatible = "ibm,ebc", }, 39 { .compatible = "ibm,ebc", },
diff --git a/arch/powerpc/platforms/44x/ebony.c b/arch/powerpc/platforms/44x/ebony.c
index 6a4232bbdf88..ae893226392d 100644
--- a/arch/powerpc/platforms/44x/ebony.c
+++ b/arch/powerpc/platforms/44x/ebony.c
@@ -28,7 +28,7 @@
28#include <asm/pci-bridge.h> 28#include <asm/pci-bridge.h>
29#include <asm/ppc4xx.h> 29#include <asm/ppc4xx.h>
30 30
31static __initdata struct of_device_id ebony_of_bus[] = { 31static const struct of_device_id ebony_of_bus[] __initconst = {
32 { .compatible = "ibm,plb4", }, 32 { .compatible = "ibm,plb4", },
33 { .compatible = "ibm,opb", }, 33 { .compatible = "ibm,opb", },
34 { .compatible = "ibm,ebc", }, 34 { .compatible = "ibm,ebc", },
diff --git a/arch/powerpc/platforms/44x/iss4xx.c b/arch/powerpc/platforms/44x/iss4xx.c
index 4241bc825800..c7c6758b3cfe 100644
--- a/arch/powerpc/platforms/44x/iss4xx.c
+++ b/arch/powerpc/platforms/44x/iss4xx.c
@@ -32,7 +32,7 @@
32#include <asm/mpic.h> 32#include <asm/mpic.h>
33#include <asm/mmu.h> 33#include <asm/mmu.h>
34 34
35static __initdata struct of_device_id iss4xx_of_bus[] = { 35static const struct of_device_id iss4xx_of_bus[] __initconst = {
36 { .compatible = "ibm,plb4", }, 36 { .compatible = "ibm,plb4", },
37 { .compatible = "ibm,plb6", }, 37 { .compatible = "ibm,plb6", },
38 { .compatible = "ibm,opb", }, 38 { .compatible = "ibm,opb", },
diff --git a/arch/powerpc/platforms/44x/ppc44x_simple.c b/arch/powerpc/platforms/44x/ppc44x_simple.c
index 3ffb915446e3..573c3d2689c6 100644
--- a/arch/powerpc/platforms/44x/ppc44x_simple.c
+++ b/arch/powerpc/platforms/44x/ppc44x_simple.c
@@ -24,7 +24,7 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/of_platform.h> 25#include <linux/of_platform.h>
26 26
27static __initdata struct of_device_id ppc44x_of_bus[] = { 27static const struct of_device_id ppc44x_of_bus[] __initconst = {
28 { .compatible = "ibm,plb4", }, 28 { .compatible = "ibm,plb4", },
29 { .compatible = "ibm,opb", }, 29 { .compatible = "ibm,opb", },
30 { .compatible = "ibm,ebc", }, 30 { .compatible = "ibm,ebc", },
diff --git a/arch/powerpc/platforms/44x/ppc476.c b/arch/powerpc/platforms/44x/ppc476.c
index 33986c1a05da..58db9d083969 100644
--- a/arch/powerpc/platforms/44x/ppc476.c
+++ b/arch/powerpc/platforms/44x/ppc476.c
@@ -38,7 +38,7 @@
38#include <linux/pci.h> 38#include <linux/pci.h>
39#include <linux/i2c.h> 39#include <linux/i2c.h>
40 40
41static struct of_device_id ppc47x_of_bus[] __initdata = { 41static const struct of_device_id ppc47x_of_bus[] __initconst = {
42 { .compatible = "ibm,plb4", }, 42 { .compatible = "ibm,plb4", },
43 { .compatible = "ibm,plb6", }, 43 { .compatible = "ibm,plb6", },
44 { .compatible = "ibm,opb", }, 44 { .compatible = "ibm,opb", },
diff --git a/arch/powerpc/platforms/44x/sam440ep.c b/arch/powerpc/platforms/44x/sam440ep.c
index 9e09b835758b..3ee4a03c1496 100644
--- a/arch/powerpc/platforms/44x/sam440ep.c
+++ b/arch/powerpc/platforms/44x/sam440ep.c
@@ -29,7 +29,7 @@
29#include <asm/ppc4xx.h> 29#include <asm/ppc4xx.h>
30#include <linux/i2c.h> 30#include <linux/i2c.h>
31 31
32static __initdata struct of_device_id sam440ep_of_bus[] = { 32static const struct of_device_id sam440ep_of_bus[] __initconst = {
33 { .compatible = "ibm,plb4", }, 33 { .compatible = "ibm,plb4", },
34 { .compatible = "ibm,opb", }, 34 { .compatible = "ibm,opb", },
35 { .compatible = "ibm,ebc", }, 35 { .compatible = "ibm,ebc", },
diff --git a/arch/powerpc/platforms/44x/virtex.c b/arch/powerpc/platforms/44x/virtex.c
index cf96ccaa760c..ad272c17c640 100644
--- a/arch/powerpc/platforms/44x/virtex.c
+++ b/arch/powerpc/platforms/44x/virtex.c
@@ -21,7 +21,7 @@
21#include <asm/ppc4xx.h> 21#include <asm/ppc4xx.h>
22#include "44x.h" 22#include "44x.h"
23 23
24static struct of_device_id xilinx_of_bus_ids[] __initdata = { 24static const struct of_device_id xilinx_of_bus_ids[] __initconst = {
25 { .compatible = "simple-bus", }, 25 { .compatible = "simple-bus", },
26 { .compatible = "xlnx,plb-v46-1.00.a", }, 26 { .compatible = "xlnx,plb-v46-1.00.a", },
27 { .compatible = "xlnx,plb-v46-1.02.a", }, 27 { .compatible = "xlnx,plb-v46-1.02.a", },
diff --git a/arch/powerpc/platforms/44x/warp.c b/arch/powerpc/platforms/44x/warp.c
index 3a104284b338..501333cf42cf 100644
--- a/arch/powerpc/platforms/44x/warp.c
+++ b/arch/powerpc/platforms/44x/warp.c
@@ -28,7 +28,7 @@
28#include <asm/dma.h> 28#include <asm/dma.h>
29 29
30 30
31static __initdata struct of_device_id warp_of_bus[] = { 31static const struct of_device_id warp_of_bus[] __initconst = {
32 { .compatible = "ibm,plb4", }, 32 { .compatible = "ibm,plb4", },
33 { .compatible = "ibm,opb", }, 33 { .compatible = "ibm,opb", },
34 { .compatible = "ibm,ebc", }, 34 { .compatible = "ibm,ebc", },
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c
index adb95f03d4d4..e996e007bc44 100644
--- a/arch/powerpc/platforms/512x/mpc512x_shared.c
+++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
@@ -337,7 +337,7 @@ void __init mpc512x_init_IRQ(void)
337/* 337/*
338 * Nodes to do bus probe on, soc and localbus 338 * Nodes to do bus probe on, soc and localbus
339 */ 339 */
340static struct of_device_id __initdata of_bus_ids[] = { 340static const struct of_device_id of_bus_ids[] __initconst = {
341 { .compatible = "fsl,mpc5121-immr", }, 341 { .compatible = "fsl,mpc5121-immr", },
342 { .compatible = "fsl,mpc5121-localbus", }, 342 { .compatible = "fsl,mpc5121-localbus", },
343 { .compatible = "fsl,mpc5121-mbx", }, 343 { .compatible = "fsl,mpc5121-mbx", },
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index 1843bc932011..7492de3cf6d0 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -34,13 +34,13 @@
34 */ 34 */
35 35
36/* mpc5200 device tree match tables */ 36/* mpc5200 device tree match tables */
37static struct of_device_id mpc5200_cdm_ids[] __initdata = { 37static const struct of_device_id mpc5200_cdm_ids[] __initconst = {
38 { .compatible = "fsl,mpc5200-cdm", }, 38 { .compatible = "fsl,mpc5200-cdm", },
39 { .compatible = "mpc5200-cdm", }, 39 { .compatible = "mpc5200-cdm", },
40 {} 40 {}
41}; 41};
42 42
43static struct of_device_id mpc5200_gpio_ids[] __initdata = { 43static const struct of_device_id mpc5200_gpio_ids[] __initconst = {
44 { .compatible = "fsl,mpc5200-gpio", }, 44 { .compatible = "fsl,mpc5200-gpio", },
45 { .compatible = "mpc5200-gpio", }, 45 { .compatible = "mpc5200-gpio", },
46 {} 46 {}
diff --git a/arch/powerpc/platforms/52xx/media5200.c b/arch/powerpc/platforms/52xx/media5200.c
index 070d315dd6cd..32cae33c4266 100644
--- a/arch/powerpc/platforms/52xx/media5200.c
+++ b/arch/powerpc/platforms/52xx/media5200.c
@@ -30,7 +30,7 @@
30#include <asm/machdep.h> 30#include <asm/machdep.h>
31#include <asm/mpc52xx.h> 31#include <asm/mpc52xx.h>
32 32
33static struct of_device_id mpc5200_gpio_ids[] __initdata = { 33static const struct of_device_id mpc5200_gpio_ids[] __initconst = {
34 { .compatible = "fsl,mpc5200-gpio", }, 34 { .compatible = "fsl,mpc5200-gpio", },
35 { .compatible = "mpc5200-gpio", }, 35 { .compatible = "mpc5200-gpio", },
36 {} 36 {}
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index d7e94f49532a..26993826a797 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -23,12 +23,12 @@
23#include <asm/mpc52xx.h> 23#include <asm/mpc52xx.h>
24 24
25/* MPC5200 device tree match tables */ 25/* MPC5200 device tree match tables */
26static struct of_device_id mpc52xx_xlb_ids[] __initdata = { 26static const struct of_device_id mpc52xx_xlb_ids[] __initconst = {
27 { .compatible = "fsl,mpc5200-xlb", }, 27 { .compatible = "fsl,mpc5200-xlb", },
28 { .compatible = "mpc5200-xlb", }, 28 { .compatible = "mpc5200-xlb", },
29 {} 29 {}
30}; 30};
31static struct of_device_id mpc52xx_bus_ids[] __initdata = { 31static const struct of_device_id mpc52xx_bus_ids[] __initconst = {
32 { .compatible = "fsl,mpc5200-immr", }, 32 { .compatible = "fsl,mpc5200-immr", },
33 { .compatible = "fsl,mpc5200b-immr", }, 33 { .compatible = "fsl,mpc5200b-immr", },
34 { .compatible = "simple-bus", }, 34 { .compatible = "simple-bus", },
@@ -108,21 +108,21 @@ void __init mpc52xx_declare_of_platform_devices(void)
108/* 108/*
109 * match tables used by mpc52xx_map_common_devices() 109 * match tables used by mpc52xx_map_common_devices()
110 */ 110 */
111static struct of_device_id mpc52xx_gpt_ids[] __initdata = { 111static const struct of_device_id mpc52xx_gpt_ids[] __initconst = {
112 { .compatible = "fsl,mpc5200-gpt", }, 112 { .compatible = "fsl,mpc5200-gpt", },
113 { .compatible = "mpc5200-gpt", }, /* old */ 113 { .compatible = "mpc5200-gpt", }, /* old */
114 {} 114 {}
115}; 115};
116static struct of_device_id mpc52xx_cdm_ids[] __initdata = { 116static const struct of_device_id mpc52xx_cdm_ids[] __initconst = {
117 { .compatible = "fsl,mpc5200-cdm", }, 117 { .compatible = "fsl,mpc5200-cdm", },
118 { .compatible = "mpc5200-cdm", }, /* old */ 118 { .compatible = "mpc5200-cdm", }, /* old */
119 {} 119 {}
120}; 120};
121static const struct of_device_id mpc52xx_gpio_simple[] = { 121static const struct of_device_id mpc52xx_gpio_simple[] __initconst = {
122 { .compatible = "fsl,mpc5200-gpio", }, 122 { .compatible = "fsl,mpc5200-gpio", },
123 {} 123 {}
124}; 124};
125static const struct of_device_id mpc52xx_gpio_wkup[] = { 125static const struct of_device_id mpc52xx_gpio_wkup[] __initconst = {
126 { .compatible = "fsl,mpc5200-gpio-wkup", }, 126 { .compatible = "fsl,mpc5200-gpio-wkup", },
127 {} 127 {}
128}; 128};
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
index 37f7a89c10f2..f8f0081759fb 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
@@ -564,7 +564,7 @@ static int mpc52xx_lpbfifo_remove(struct platform_device *op)
564 return 0; 564 return 0;
565} 565}
566 566
567static struct of_device_id mpc52xx_lpbfifo_match[] = { 567static const struct of_device_id mpc52xx_lpbfifo_match[] = {
568 { .compatible = "fsl,mpc5200-lpbfifo", }, 568 { .compatible = "fsl,mpc5200-lpbfifo", },
569 {}, 569 {},
570}; 570};
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index 2898b737deb7..2944bc84b9d6 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -119,12 +119,12 @@
119 119
120 120
121/* MPC5200 device tree match tables */ 121/* MPC5200 device tree match tables */
122static struct of_device_id mpc52xx_pic_ids[] __initdata = { 122static const struct of_device_id mpc52xx_pic_ids[] __initconst = {
123 { .compatible = "fsl,mpc5200-pic", }, 123 { .compatible = "fsl,mpc5200-pic", },
124 { .compatible = "mpc5200-pic", }, 124 { .compatible = "mpc5200-pic", },
125 {} 125 {}
126}; 126};
127static struct of_device_id mpc52xx_sdma_ids[] __initdata = { 127static const struct of_device_id mpc52xx_sdma_ids[] __initconst = {
128 { .compatible = "fsl,mpc5200-bestcomm", }, 128 { .compatible = "fsl,mpc5200-bestcomm", },
129 { .compatible = "mpc5200-bestcomm", }, 129 { .compatible = "mpc5200-bestcomm", },
130 {} 130 {}
diff --git a/arch/powerpc/platforms/82xx/ep8248e.c b/arch/powerpc/platforms/82xx/ep8248e.c
index 79799b29ffe2..3d0c3a01143d 100644
--- a/arch/powerpc/platforms/82xx/ep8248e.c
+++ b/arch/powerpc/platforms/82xx/ep8248e.c
@@ -298,7 +298,7 @@ static void __init ep8248e_setup_arch(void)
298 ppc_md.progress("ep8248e_setup_arch(), finish", 0); 298 ppc_md.progress("ep8248e_setup_arch(), finish", 0);
299} 299}
300 300
301static __initdata struct of_device_id of_bus_ids[] = { 301static const struct of_device_id of_bus_ids[] __initconst = {
302 { .compatible = "simple-bus", }, 302 { .compatible = "simple-bus", },
303 { .compatible = "fsl,ep8248e-bcsr", }, 303 { .compatible = "fsl,ep8248e-bcsr", },
304 {}, 304 {},
diff --git a/arch/powerpc/platforms/82xx/km82xx.c b/arch/powerpc/platforms/82xx/km82xx.c
index 058cc1895c88..387b446f4161 100644
--- a/arch/powerpc/platforms/82xx/km82xx.c
+++ b/arch/powerpc/platforms/82xx/km82xx.c
@@ -180,7 +180,7 @@ static void __init km82xx_setup_arch(void)
180 ppc_md.progress("km82xx_setup_arch(), finish", 0); 180 ppc_md.progress("km82xx_setup_arch(), finish", 0);
181} 181}
182 182
183static __initdata struct of_device_id of_bus_ids[] = { 183static const struct of_device_id of_bus_ids[] __initconst = {
184 { .compatible = "simple-bus", }, 184 { .compatible = "simple-bus", },
185 {}, 185 {},
186}; 186};
diff --git a/arch/powerpc/platforms/82xx/mpc8272_ads.c b/arch/powerpc/platforms/82xx/mpc8272_ads.c
index 6a14cf50f4a2..d24deacf07d0 100644
--- a/arch/powerpc/platforms/82xx/mpc8272_ads.c
+++ b/arch/powerpc/platforms/82xx/mpc8272_ads.c
@@ -181,7 +181,7 @@ static void __init mpc8272_ads_setup_arch(void)
181 ppc_md.progress("mpc8272_ads_setup_arch(), finish", 0); 181 ppc_md.progress("mpc8272_ads_setup_arch(), finish", 0);
182} 182}
183 183
184static struct of_device_id __initdata of_bus_ids[] = { 184static const struct of_device_id of_bus_ids[] __initconst = {
185 { .name = "soc", }, 185 { .name = "soc", },
186 { .name = "cpm", }, 186 { .name = "cpm", },
187 { .name = "localbus", }, 187 { .name = "localbus", },
diff --git a/arch/powerpc/platforms/82xx/pq2fads.c b/arch/powerpc/platforms/82xx/pq2fads.c
index e5f82ec8df17..3a5164ad10ad 100644
--- a/arch/powerpc/platforms/82xx/pq2fads.c
+++ b/arch/powerpc/platforms/82xx/pq2fads.c
@@ -168,7 +168,7 @@ static int __init pq2fads_probe(void)
168 return of_flat_dt_is_compatible(root, "fsl,pq2fads"); 168 return of_flat_dt_is_compatible(root, "fsl,pq2fads");
169} 169}
170 170
171static struct of_device_id __initdata of_bus_ids[] = { 171static const struct of_device_id of_bus_ids[] __initconst = {
172 { .name = "soc", }, 172 { .name = "soc", },
173 { .name = "cpm", }, 173 { .name = "cpm", },
174 { .name = "localbus", }, 174 { .name = "localbus", },
diff --git a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
index 73997027b085..463fa91ee5b6 100644
--- a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
+++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
@@ -214,7 +214,7 @@ static const struct i2c_device_id mcu_ids[] = {
214}; 214};
215MODULE_DEVICE_TABLE(i2c, mcu_ids); 215MODULE_DEVICE_TABLE(i2c, mcu_ids);
216 216
217static struct of_device_id mcu_of_match_table[] = { 217static const struct of_device_id mcu_of_match_table[] = {
218 { .compatible = "fsl,mcu-mpc8349emitx", }, 218 { .compatible = "fsl,mcu-mpc8349emitx", },
219 { }, 219 { },
220}; 220};
diff --git a/arch/powerpc/platforms/83xx/misc.c b/arch/powerpc/platforms/83xx/misc.c
index 125336f750c6..ef9d01a049c1 100644
--- a/arch/powerpc/platforms/83xx/misc.c
+++ b/arch/powerpc/platforms/83xx/misc.c
@@ -114,7 +114,7 @@ void __init mpc83xx_ipic_and_qe_init_IRQ(void)
114} 114}
115#endif /* CONFIG_QUICC_ENGINE */ 115#endif /* CONFIG_QUICC_ENGINE */
116 116
117static struct of_device_id __initdata of_bus_ids[] = { 117static const struct of_device_id of_bus_ids[] __initconst = {
118 { .type = "soc", }, 118 { .type = "soc", },
119 { .compatible = "soc", }, 119 { .compatible = "soc", },
120 { .compatible = "simple-bus" }, 120 { .compatible = "simple-bus" },
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c
index a494fa57bdf9..80aea8c4b5a3 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
@@ -38,7 +38,7 @@
38 38
39#include "mpc83xx.h" 39#include "mpc83xx.h"
40 40
41static struct of_device_id __initdata mpc834x_itx_ids[] = { 41static const struct of_device_id mpc834x_itx_ids[] __initconst = {
42 { .compatible = "fsl,pq2pro-localbus", }, 42 { .compatible = "fsl,pq2pro-localbus", },
43 {}, 43 {},
44}; 44};
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index 4b4c081df94d..eeb80e25214d 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -321,7 +321,7 @@ static const struct platform_suspend_ops mpc83xx_suspend_ops = {
321 .end = mpc83xx_suspend_end, 321 .end = mpc83xx_suspend_end,
322}; 322};
323 323
324static struct of_device_id pmc_match[]; 324static const struct of_device_id pmc_match[];
325static int pmc_probe(struct platform_device *ofdev) 325static int pmc_probe(struct platform_device *ofdev)
326{ 326{
327 const struct of_device_id *match; 327 const struct of_device_id *match;
@@ -420,7 +420,7 @@ static struct pmc_type pmc_types[] = {
420 } 420 }
421}; 421};
422 422
423static struct of_device_id pmc_match[] = { 423static const struct of_device_id pmc_match[] = {
424 { 424 {
425 .compatible = "fsl,mpc8313-pmc", 425 .compatible = "fsl,mpc8313-pmc",
426 .data = &pmc_types[0], 426 .data = &pmc_types[0],
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index 0c1e6903597e..f22635a71d01 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -276,7 +276,7 @@ config CORENET_GENERIC
276 For 64bit kernel, the following boards are supported: 276 For 64bit kernel, the following boards are supported:
277 T208x QDS/RDB, T4240 QDS/RDB and B4 QDS 277 T208x QDS/RDB, T4240 QDS/RDB and B4 QDS
278 The following boards are supported for both 32bit and 64bit kernel: 278 The following boards are supported for both 32bit and 64bit kernel:
279 P5020 DS, P5040 DS and T104xQDS 279 P5020 DS, P5040 DS and T104xQDS/RDB
280 280
281endif # FSL_SOC_BOOKE 281endif # FSL_SOC_BOOKE
282 282
diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c
index b564b5e23f7c..4a9ad871a168 100644
--- a/arch/powerpc/platforms/85xx/common.c
+++ b/arch/powerpc/platforms/85xx/common.c
@@ -14,7 +14,7 @@
14 14
15#include "mpc85xx.h" 15#include "mpc85xx.h"
16 16
17static struct of_device_id __initdata mpc85xx_common_ids[] = { 17static const struct of_device_id mpc85xx_common_ids[] __initconst = {
18 { .type = "soc", }, 18 { .type = "soc", },
19 { .compatible = "soc", }, 19 { .compatible = "soc", },
20 { .compatible = "simple-bus", }, 20 { .compatible = "simple-bus", },
diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c
index d22dd85e50bf..e56b89a792ed 100644
--- a/arch/powerpc/platforms/85xx/corenet_generic.c
+++ b/arch/powerpc/platforms/85xx/corenet_generic.c
@@ -20,6 +20,7 @@
20#include <asm/time.h> 20#include <asm/time.h>
21#include <asm/machdep.h> 21#include <asm/machdep.h>
22#include <asm/pci-bridge.h> 22#include <asm/pci-bridge.h>
23#include <asm/pgtable.h>
23#include <asm/ppc-pci.h> 24#include <asm/ppc-pci.h>
24#include <mm/mmu_decl.h> 25#include <mm/mmu_decl.h>
25#include <asm/prom.h> 26#include <asm/prom.h>
@@ -67,6 +68,16 @@ void __init corenet_gen_setup_arch(void)
67 68
68 swiotlb_detect_4g(); 69 swiotlb_detect_4g();
69 70
71#if defined(CONFIG_FSL_PCI) && defined(CONFIG_ZONE_DMA32)
72 /*
73 * Inbound windows don't cover the full lower 4 GiB
74 * due to conflicts with PCICSRBAR and outbound windows,
75 * so limit the DMA32 zone to 2 GiB, to allow consistent
76 * allocations to succeed.
77 */
78 limit_zone_pfn(ZONE_DMA32, 1UL << (31 - PAGE_SHIFT));
79#endif
80
70 pr_info("%s board\n", ppc_md.name); 81 pr_info("%s board\n", ppc_md.name);
71 82
72 mpc85xx_qe_init(); 83 mpc85xx_qe_init();
@@ -129,6 +140,9 @@ static const char * const boards[] __initconst = {
129 "fsl,B4220QDS", 140 "fsl,B4220QDS",
130 "fsl,T1040QDS", 141 "fsl,T1040QDS",
131 "fsl,T1042QDS", 142 "fsl,T1042QDS",
143 "fsl,T1040RDB",
144 "fsl,T1042RDB",
145 "fsl,T1042RDB_PI",
132 "keymile,kmcoge4", 146 "keymile,kmcoge4",
133 NULL 147 NULL
134}; 148};
diff --git a/arch/powerpc/platforms/85xx/ppa8548.c b/arch/powerpc/platforms/85xx/ppa8548.c
index 3daff7c63569..12019f17f297 100644
--- a/arch/powerpc/platforms/85xx/ppa8548.c
+++ b/arch/powerpc/platforms/85xx/ppa8548.c
@@ -59,7 +59,7 @@ static void ppa8548_show_cpuinfo(struct seq_file *m)
59 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 59 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
60} 60}
61 61
62static struct of_device_id __initdata of_bus_ids[] = { 62static const struct of_device_id of_bus_ids[] __initconst = {
63 { .name = "soc", }, 63 { .name = "soc", },
64 { .type = "soc", }, 64 { .type = "soc", },
65 { .compatible = "simple-bus", }, 65 { .compatible = "simple-bus", },
diff --git a/arch/powerpc/platforms/85xx/qemu_e500.c b/arch/powerpc/platforms/85xx/qemu_e500.c
index 7f2673293549..8ad2fe6f200a 100644
--- a/arch/powerpc/platforms/85xx/qemu_e500.c
+++ b/arch/powerpc/platforms/85xx/qemu_e500.c
@@ -18,6 +18,7 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/of_fdt.h> 19#include <linux/of_fdt.h>
20#include <asm/machdep.h> 20#include <asm/machdep.h>
21#include <asm/pgtable.h>
21#include <asm/time.h> 22#include <asm/time.h>
22#include <asm/udbg.h> 23#include <asm/udbg.h>
23#include <asm/mpic.h> 24#include <asm/mpic.h>
@@ -44,6 +45,15 @@ static void __init qemu_e500_setup_arch(void)
44 45
45 fsl_pci_assign_primary(); 46 fsl_pci_assign_primary();
46 swiotlb_detect_4g(); 47 swiotlb_detect_4g();
48#if defined(CONFIG_FSL_PCI) && defined(CONFIG_ZONE_DMA32)
49 /*
50 * Inbound windows don't cover the full lower 4 GiB
51 * due to conflicts with PCICSRBAR and outbound windows,
52 * so limit the DMA32 zone to 2 GiB, to allow consistent
53 * allocations to succeed.
54 */
55 limit_zone_pfn(ZONE_DMA32, 1UL << (31 - PAGE_SHIFT));
56#endif
47 mpc85xx_smp_init(); 57 mpc85xx_smp_init();
48} 58}
49 59
diff --git a/arch/powerpc/platforms/85xx/sgy_cts1000.c b/arch/powerpc/platforms/85xx/sgy_cts1000.c
index bb75add67084..8162b0412117 100644
--- a/arch/powerpc/platforms/85xx/sgy_cts1000.c
+++ b/arch/powerpc/platforms/85xx/sgy_cts1000.c
@@ -24,7 +24,7 @@
24 24
25static struct device_node *halt_node; 25static struct device_node *halt_node;
26 26
27static struct of_device_id child_match[] = { 27static const struct of_device_id child_match[] = {
28 { 28 {
29 .compatible = "sgy,gpio-halt", 29 .compatible = "sgy,gpio-halt",
30 }, 30 },
@@ -147,7 +147,7 @@ static int gpio_halt_remove(struct platform_device *pdev)
147 return 0; 147 return 0;
148} 148}
149 149
150static struct of_device_id gpio_halt_match[] = { 150static const struct of_device_id gpio_halt_match[] = {
151 /* We match on the gpio bus itself and scan the children since they 151 /* We match on the gpio bus itself and scan the children since they
152 * wont be matched against us. We know the bus wont match until it 152 * wont be matched against us. We know the bus wont match until it
153 * has been registered too. */ 153 * has been registered too. */
diff --git a/arch/powerpc/platforms/86xx/gef_ppc9a.c b/arch/powerpc/platforms/86xx/gef_ppc9a.c
index c23f3443880a..bf17933b20f3 100644
--- a/arch/powerpc/platforms/86xx/gef_ppc9a.c
+++ b/arch/powerpc/platforms/86xx/gef_ppc9a.c
@@ -213,7 +213,7 @@ static long __init mpc86xx_time_init(void)
213 return 0; 213 return 0;
214} 214}
215 215
216static __initdata struct of_device_id of_bus_ids[] = { 216static const struct of_device_id of_bus_ids[] __initconst = {
217 { .compatible = "simple-bus", }, 217 { .compatible = "simple-bus", },
218 { .compatible = "gianfar", }, 218 { .compatible = "gianfar", },
219 { .compatible = "fsl,mpc8641-pcie", }, 219 { .compatible = "fsl,mpc8641-pcie", },
diff --git a/arch/powerpc/platforms/86xx/gef_sbc310.c b/arch/powerpc/platforms/86xx/gef_sbc310.c
index 8a6ac20686ea..8facf5873866 100644
--- a/arch/powerpc/platforms/86xx/gef_sbc310.c
+++ b/arch/powerpc/platforms/86xx/gef_sbc310.c
@@ -200,7 +200,7 @@ static long __init mpc86xx_time_init(void)
200 return 0; 200 return 0;
201} 201}
202 202
203static __initdata struct of_device_id of_bus_ids[] = { 203static const struct of_device_id of_bus_ids[] __initconst = {
204 { .compatible = "simple-bus", }, 204 { .compatible = "simple-bus", },
205 { .compatible = "gianfar", }, 205 { .compatible = "gianfar", },
206 { .compatible = "fsl,mpc8641-pcie", }, 206 { .compatible = "fsl,mpc8641-pcie", },
diff --git a/arch/powerpc/platforms/86xx/gef_sbc610.c b/arch/powerpc/platforms/86xx/gef_sbc610.c
index 06c72636f299..8c9058df5642 100644
--- a/arch/powerpc/platforms/86xx/gef_sbc610.c
+++ b/arch/powerpc/platforms/86xx/gef_sbc610.c
@@ -190,7 +190,7 @@ static long __init mpc86xx_time_init(void)
190 return 0; 190 return 0;
191} 191}
192 192
193static __initdata struct of_device_id of_bus_ids[] = { 193static const struct of_device_id of_bus_ids[] __initconst = {
194 { .compatible = "simple-bus", }, 194 { .compatible = "simple-bus", },
195 { .compatible = "gianfar", }, 195 { .compatible = "gianfar", },
196 { .compatible = "fsl,mpc8641-pcie", }, 196 { .compatible = "fsl,mpc8641-pcie", },
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
index d479d68fbb2b..55413a547ea8 100644
--- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
+++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
@@ -85,7 +85,7 @@ static void __init mpc8610_suspend_init(void)
85static inline void mpc8610_suspend_init(void) { } 85static inline void mpc8610_suspend_init(void) { }
86#endif /* CONFIG_SUSPEND */ 86#endif /* CONFIG_SUSPEND */
87 87
88static struct of_device_id __initdata mpc8610_ids[] = { 88static const struct of_device_id mpc8610_ids[] __initconst = {
89 { .compatible = "fsl,mpc8610-immr", }, 89 { .compatible = "fsl,mpc8610-immr", },
90 { .compatible = "fsl,mpc8610-guts", }, 90 { .compatible = "fsl,mpc8610-guts", },
91 { .compatible = "simple-bus", }, 91 { .compatible = "simple-bus", },
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index e8bf3fae5606..07ccb1b0cc7d 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -127,7 +127,7 @@ mpc86xx_time_init(void)
127 return 0; 127 return 0;
128} 128}
129 129
130static __initdata struct of_device_id of_bus_ids[] = { 130static const struct of_device_id of_bus_ids[] __initconst = {
131 { .compatible = "simple-bus", }, 131 { .compatible = "simple-bus", },
132 { .compatible = "fsl,srio", }, 132 { .compatible = "fsl,srio", },
133 { .compatible = "gianfar", }, 133 { .compatible = "gianfar", },
diff --git a/arch/powerpc/platforms/86xx/sbc8641d.c b/arch/powerpc/platforms/86xx/sbc8641d.c
index b47a8fd0f3d3..6810b71d54a7 100644
--- a/arch/powerpc/platforms/86xx/sbc8641d.c
+++ b/arch/powerpc/platforms/86xx/sbc8641d.c
@@ -92,7 +92,7 @@ mpc86xx_time_init(void)
92 return 0; 92 return 0;
93} 93}
94 94
95static __initdata struct of_device_id of_bus_ids[] = { 95static const struct of_device_id of_bus_ids[] __initconst = {
96 { .compatible = "simple-bus", }, 96 { .compatible = "simple-bus", },
97 { .compatible = "gianfar", }, 97 { .compatible = "gianfar", },
98 { .compatible = "fsl,mpc8641-pcie", }, 98 { .compatible = "fsl,mpc8641-pcie", },
diff --git a/arch/powerpc/platforms/8xx/adder875.c b/arch/powerpc/platforms/8xx/adder875.c
index 82363e98f50e..61cae4c1edb8 100644
--- a/arch/powerpc/platforms/8xx/adder875.c
+++ b/arch/powerpc/platforms/8xx/adder875.c
@@ -92,7 +92,7 @@ static int __init adder875_probe(void)
92 return of_flat_dt_is_compatible(root, "analogue-and-micro,adder875"); 92 return of_flat_dt_is_compatible(root, "analogue-and-micro,adder875");
93} 93}
94 94
95static __initdata struct of_device_id of_bus_ids[] = { 95static const struct of_device_id of_bus_ids[] __initconst = {
96 { .compatible = "simple-bus", }, 96 { .compatible = "simple-bus", },
97 {}, 97 {},
98}; 98};
diff --git a/arch/powerpc/platforms/8xx/ep88xc.c b/arch/powerpc/platforms/8xx/ep88xc.c
index e62166681d08..2bedeb7d5f8f 100644
--- a/arch/powerpc/platforms/8xx/ep88xc.c
+++ b/arch/powerpc/platforms/8xx/ep88xc.c
@@ -147,7 +147,7 @@ static int __init ep88xc_probe(void)
147 return of_flat_dt_is_compatible(root, "fsl,ep88xc"); 147 return of_flat_dt_is_compatible(root, "fsl,ep88xc");
148} 148}
149 149
150static struct of_device_id __initdata of_bus_ids[] = { 150static const struct of_device_id of_bus_ids[] __initconst = {
151 { .name = "soc", }, 151 { .name = "soc", },
152 { .name = "cpm", }, 152 { .name = "cpm", },
153 { .name = "localbus", }, 153 { .name = "localbus", },
diff --git a/arch/powerpc/platforms/8xx/mpc86xads_setup.c b/arch/powerpc/platforms/8xx/mpc86xads_setup.c
index 63084640c5c5..78180c5e73ff 100644
--- a/arch/powerpc/platforms/8xx/mpc86xads_setup.c
+++ b/arch/powerpc/platforms/8xx/mpc86xads_setup.c
@@ -122,7 +122,7 @@ static int __init mpc86xads_probe(void)
122 return of_flat_dt_is_compatible(root, "fsl,mpc866ads"); 122 return of_flat_dt_is_compatible(root, "fsl,mpc866ads");
123} 123}
124 124
125static struct of_device_id __initdata of_bus_ids[] = { 125static const struct of_device_id of_bus_ids[] __initconst = {
126 { .name = "soc", }, 126 { .name = "soc", },
127 { .name = "cpm", }, 127 { .name = "cpm", },
128 { .name = "localbus", }, 128 { .name = "localbus", },
diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
index 5921dcb498fd..4d62bf9dc789 100644
--- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c
+++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
@@ -197,7 +197,7 @@ static int __init mpc885ads_probe(void)
197 return of_flat_dt_is_compatible(root, "fsl,mpc885ads"); 197 return of_flat_dt_is_compatible(root, "fsl,mpc885ads");
198} 198}
199 199
200static struct of_device_id __initdata of_bus_ids[] = { 200static const struct of_device_id of_bus_ids[] __initconst = {
201 { .name = "soc", }, 201 { .name = "soc", },
202 { .name = "cpm", }, 202 { .name = "cpm", },
203 { .name = "localbus", }, 203 { .name = "localbus", },
diff --git a/arch/powerpc/platforms/8xx/tqm8xx_setup.c b/arch/powerpc/platforms/8xx/tqm8xx_setup.c
index dda607807def..bee47a2b23e6 100644
--- a/arch/powerpc/platforms/8xx/tqm8xx_setup.c
+++ b/arch/powerpc/platforms/8xx/tqm8xx_setup.c
@@ -124,7 +124,7 @@ static int __init tqm8xx_probe(void)
124 return of_flat_dt_is_compatible(node, "tqc,tqm8xx"); 124 return of_flat_dt_is_compatible(node, "tqc,tqm8xx");
125} 125}
126 126
127static struct of_device_id __initdata of_bus_ids[] = { 127static const struct of_device_id of_bus_ids[] __initconst = {
128 { .name = "soc", }, 128 { .name = "soc", },
129 { .name = "cpm", }, 129 { .name = "cpm", },
130 { .name = "localbus", }, 130 { .name = "localbus", },
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 7d9ee3d8c618..76483e3acd60 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -116,6 +116,12 @@ config POWER6_CPU
116config POWER7_CPU 116config POWER7_CPU
117 bool "POWER7" 117 bool "POWER7"
118 depends on PPC_BOOK3S_64 118 depends on PPC_BOOK3S_64
119 select ARCH_HAS_FAST_MULTIPLIER
120
121config POWER8_CPU
122 bool "POWER8"
123 depends on PPC_BOOK3S_64
124 select ARCH_HAS_FAST_MULTIPLIER
119 125
120config E5500_CPU 126config E5500_CPU
121 bool "Freescale e5500" 127 bool "Freescale e5500"
diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig
index 9978f594cac0..870b6dbd4d18 100644
--- a/arch/powerpc/platforms/cell/Kconfig
+++ b/arch/powerpc/platforms/cell/Kconfig
@@ -86,6 +86,7 @@ config SPU_FS_64K_LS
86config SPU_BASE 86config SPU_BASE
87 bool 87 bool
88 default n 88 default n
89 select PPC_COPRO_BASE
89 90
90config CBE_RAS 91config CBE_RAS
91 bool "RAS features for bare metal Cell BE" 92 bool "RAS features for bare metal Cell BE"
diff --git a/arch/powerpc/platforms/cell/Makefile b/arch/powerpc/platforms/cell/Makefile
index fe053e7c73ee..2d16884f67b9 100644
--- a/arch/powerpc/platforms/cell/Makefile
+++ b/arch/powerpc/platforms/cell/Makefile
@@ -20,7 +20,7 @@ spu-manage-$(CONFIG_PPC_CELL_COMMON) += spu_manage.o
20 20
21obj-$(CONFIG_SPU_BASE) += spu_callbacks.o spu_base.o \ 21obj-$(CONFIG_SPU_BASE) += spu_callbacks.o spu_base.o \
22 spu_notify.o \ 22 spu_notify.o \
23 spu_syscalls.o spu_fault.o \ 23 spu_syscalls.o \
24 $(spu-priv1-y) \ 24 $(spu-priv1-y) \
25 $(spu-manage-y) \ 25 $(spu-manage-y) \
26 spufs/ 26 spufs/
diff --git a/arch/powerpc/platforms/cell/celleb_pci.c b/arch/powerpc/platforms/cell/celleb_pci.c
index 173568140a32..2b98a36ef8fb 100644
--- a/arch/powerpc/platforms/cell/celleb_pci.c
+++ b/arch/powerpc/platforms/cell/celleb_pci.c
@@ -454,7 +454,7 @@ static struct celleb_phb_spec celleb_fake_pci_spec __initdata = {
454 .setup = celleb_setup_fake_pci, 454 .setup = celleb_setup_fake_pci,
455}; 455};
456 456
457static struct of_device_id celleb_phb_match[] __initdata = { 457static const struct of_device_id celleb_phb_match[] __initconst = {
458 { 458 {
459 .name = "pci-pseudo", 459 .name = "pci-pseudo",
460 .data = &celleb_fake_pci_spec, 460 .data = &celleb_fake_pci_spec,
diff --git a/arch/powerpc/platforms/cell/celleb_setup.c b/arch/powerpc/platforms/cell/celleb_setup.c
index 1d5a4d8ddad9..34e8ce2976aa 100644
--- a/arch/powerpc/platforms/cell/celleb_setup.c
+++ b/arch/powerpc/platforms/cell/celleb_setup.c
@@ -102,7 +102,7 @@ static void __init celleb_setup_arch_common(void)
102#endif 102#endif
103} 103}
104 104
105static struct of_device_id celleb_bus_ids[] __initdata = { 105static const struct of_device_id celleb_bus_ids[] __initconst = {
106 { .type = "scc", }, 106 { .type = "scc", },
107 { .type = "ioif", }, /* old style */ 107 { .type = "ioif", }, /* old style */
108 {}, 108 {},
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index 2930d1e81a05..ffcbd242e669 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -76,10 +76,6 @@ static LIST_HEAD(spu_full_list);
76static DEFINE_SPINLOCK(spu_full_list_lock); 76static DEFINE_SPINLOCK(spu_full_list_lock);
77static DEFINE_MUTEX(spu_full_list_mutex); 77static DEFINE_MUTEX(spu_full_list_mutex);
78 78
79struct spu_slb {
80 u64 esid, vsid;
81};
82
83void spu_invalidate_slbs(struct spu *spu) 79void spu_invalidate_slbs(struct spu *spu)
84{ 80{
85 struct spu_priv2 __iomem *priv2 = spu->priv2; 81 struct spu_priv2 __iomem *priv2 = spu->priv2;
@@ -149,7 +145,7 @@ static void spu_restart_dma(struct spu *spu)
149 } 145 }
150} 146}
151 147
152static inline void spu_load_slb(struct spu *spu, int slbe, struct spu_slb *slb) 148static inline void spu_load_slb(struct spu *spu, int slbe, struct copro_slb *slb)
153{ 149{
154 struct spu_priv2 __iomem *priv2 = spu->priv2; 150 struct spu_priv2 __iomem *priv2 = spu->priv2;
155 151
@@ -167,45 +163,12 @@ static inline void spu_load_slb(struct spu *spu, int slbe, struct spu_slb *slb)
167 163
168static int __spu_trap_data_seg(struct spu *spu, unsigned long ea) 164static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
169{ 165{
170 struct mm_struct *mm = spu->mm; 166 struct copro_slb slb;
171 struct spu_slb slb; 167 int ret;
172 int psize;
173
174 pr_debug("%s\n", __func__);
175
176 slb.esid = (ea & ESID_MASK) | SLB_ESID_V;
177 168
178 switch(REGION_ID(ea)) { 169 ret = copro_calculate_slb(spu->mm, ea, &slb);
179 case USER_REGION_ID: 170 if (ret)
180#ifdef CONFIG_PPC_MM_SLICES 171 return ret;
181 psize = get_slice_psize(mm, ea);
182#else
183 psize = mm->context.user_psize;
184#endif
185 slb.vsid = (get_vsid(mm->context.id, ea, MMU_SEGSIZE_256M)
186 << SLB_VSID_SHIFT) | SLB_VSID_USER;
187 break;
188 case VMALLOC_REGION_ID:
189 if (ea < VMALLOC_END)
190 psize = mmu_vmalloc_psize;
191 else
192 psize = mmu_io_psize;
193 slb.vsid = (get_kernel_vsid(ea, MMU_SEGSIZE_256M)
194 << SLB_VSID_SHIFT) | SLB_VSID_KERNEL;
195 break;
196 case KERNEL_REGION_ID:
197 psize = mmu_linear_psize;
198 slb.vsid = (get_kernel_vsid(ea, MMU_SEGSIZE_256M)
199 << SLB_VSID_SHIFT) | SLB_VSID_KERNEL;
200 break;
201 default:
202 /* Future: support kernel segments so that drivers
203 * can use SPUs.
204 */
205 pr_debug("invalid region access at %016lx\n", ea);
206 return 1;
207 }
208 slb.vsid |= mmu_psize_defs[psize].sllp;
209 172
210 spu_load_slb(spu, spu->slb_replace, &slb); 173 spu_load_slb(spu, spu->slb_replace, &slb);
211 174
@@ -253,7 +216,7 @@ static int __spu_trap_data_map(struct spu *spu, unsigned long ea, u64 dsisr)
253 return 0; 216 return 0;
254} 217}
255 218
256static void __spu_kernel_slb(void *addr, struct spu_slb *slb) 219static void __spu_kernel_slb(void *addr, struct copro_slb *slb)
257{ 220{
258 unsigned long ea = (unsigned long)addr; 221 unsigned long ea = (unsigned long)addr;
259 u64 llp; 222 u64 llp;
@@ -272,7 +235,7 @@ static void __spu_kernel_slb(void *addr, struct spu_slb *slb)
272 * Given an array of @nr_slbs SLB entries, @slbs, return non-zero if the 235 * Given an array of @nr_slbs SLB entries, @slbs, return non-zero if the
273 * address @new_addr is present. 236 * address @new_addr is present.
274 */ 237 */
275static inline int __slb_present(struct spu_slb *slbs, int nr_slbs, 238static inline int __slb_present(struct copro_slb *slbs, int nr_slbs,
276 void *new_addr) 239 void *new_addr)
277{ 240{
278 unsigned long ea = (unsigned long)new_addr; 241 unsigned long ea = (unsigned long)new_addr;
@@ -297,7 +260,7 @@ static inline int __slb_present(struct spu_slb *slbs, int nr_slbs,
297void spu_setup_kernel_slbs(struct spu *spu, struct spu_lscsa *lscsa, 260void spu_setup_kernel_slbs(struct spu *spu, struct spu_lscsa *lscsa,
298 void *code, int code_size) 261 void *code, int code_size)
299{ 262{
300 struct spu_slb slbs[4]; 263 struct copro_slb slbs[4];
301 int i, nr_slbs = 0; 264 int i, nr_slbs = 0;
302 /* start and end addresses of both mappings */ 265 /* start and end addresses of both mappings */
303 void *addrs[] = { 266 void *addrs[] = {
diff --git a/arch/powerpc/platforms/cell/spu_fault.c b/arch/powerpc/platforms/cell/spu_fault.c
deleted file mode 100644
index 641e7273d75a..000000000000
--- a/arch/powerpc/platforms/cell/spu_fault.c
+++ /dev/null
@@ -1,94 +0,0 @@
1/*
2 * SPU mm fault handler
3 *
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2007
5 *
6 * Author: Arnd Bergmann <arndb@de.ibm.com>
7 * Author: Jeremy Kerr <jk@ozlabs.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
12 * any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23#include <linux/sched.h>
24#include <linux/mm.h>
25#include <linux/export.h>
26
27#include <asm/spu.h>
28#include <asm/spu_csa.h>
29
30/*
31 * This ought to be kept in sync with the powerpc specific do_page_fault
32 * function. Currently, there are a few corner cases that we haven't had
33 * to handle fortunately.
34 */
35int spu_handle_mm_fault(struct mm_struct *mm, unsigned long ea,
36 unsigned long dsisr, unsigned *flt)
37{
38 struct vm_area_struct *vma;
39 unsigned long is_write;
40 int ret;
41
42 if (mm == NULL)
43 return -EFAULT;
44
45 if (mm->pgd == NULL)
46 return -EFAULT;
47
48 down_read(&mm->mmap_sem);
49 ret = -EFAULT;
50 vma = find_vma(mm, ea);
51 if (!vma)
52 goto out_unlock;
53
54 if (ea < vma->vm_start) {
55 if (!(vma->vm_flags & VM_GROWSDOWN))
56 goto out_unlock;
57 if (expand_stack(vma, ea))
58 goto out_unlock;
59 }
60
61 is_write = dsisr & MFC_DSISR_ACCESS_PUT;
62 if (is_write) {
63 if (!(vma->vm_flags & VM_WRITE))
64 goto out_unlock;
65 } else {
66 if (dsisr & MFC_DSISR_ACCESS_DENIED)
67 goto out_unlock;
68 if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
69 goto out_unlock;
70 }
71
72 ret = 0;
73 *flt = handle_mm_fault(mm, vma, ea, is_write ? FAULT_FLAG_WRITE : 0);
74 if (unlikely(*flt & VM_FAULT_ERROR)) {
75 if (*flt & VM_FAULT_OOM) {
76 ret = -ENOMEM;
77 goto out_unlock;
78 } else if (*flt & VM_FAULT_SIGBUS) {
79 ret = -EFAULT;
80 goto out_unlock;
81 }
82 BUG();
83 }
84
85 if (*flt & VM_FAULT_MAJOR)
86 current->maj_flt++;
87 else
88 current->min_flt++;
89
90out_unlock:
91 up_read(&mm->mmap_sem);
92 return ret;
93}
94EXPORT_SYMBOL_GPL(spu_handle_mm_fault);
diff --git a/arch/powerpc/platforms/cell/spufs/fault.c b/arch/powerpc/platforms/cell/spufs/fault.c
index 8cb6260cc80f..e45894a08118 100644
--- a/arch/powerpc/platforms/cell/spufs/fault.c
+++ b/arch/powerpc/platforms/cell/spufs/fault.c
@@ -138,7 +138,7 @@ int spufs_handle_class1(struct spu_context *ctx)
138 if (ctx->state == SPU_STATE_RUNNABLE) 138 if (ctx->state == SPU_STATE_RUNNABLE)
139 ctx->spu->stats.hash_flt++; 139 ctx->spu->stats.hash_flt++;
140 140
141 /* we must not hold the lock when entering spu_handle_mm_fault */ 141 /* we must not hold the lock when entering copro_handle_mm_fault */
142 spu_release(ctx); 142 spu_release(ctx);
143 143
144 access = (_PAGE_PRESENT | _PAGE_USER); 144 access = (_PAGE_PRESENT | _PAGE_USER);
@@ -149,7 +149,7 @@ int spufs_handle_class1(struct spu_context *ctx)
149 149
150 /* hashing failed, so try the actual fault handler */ 150 /* hashing failed, so try the actual fault handler */
151 if (ret) 151 if (ret)
152 ret = spu_handle_mm_fault(current->mm, ea, dsisr, &flt); 152 ret = copro_handle_mm_fault(current->mm, ea, dsisr, &flt);
153 153
154 /* 154 /*
155 * This is nasty: we need the state_mutex for all the bookkeeping even 155 * This is nasty: we need the state_mutex for all the bookkeeping even
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 7044fd36197b..5b77b1919fd2 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -258,7 +258,7 @@ static void chrp_init_early(void)
258 struct device_node *node; 258 struct device_node *node;
259 const char *property; 259 const char *property;
260 260
261 if (strstr(cmd_line, "console=")) 261 if (strstr(boot_command_line, "console="))
262 return; 262 return;
263 /* find the boot console from /chosen/stdout */ 263 /* find the boot console from /chosen/stdout */
264 if (!of_chosen) 264 if (!of_chosen)
diff --git a/arch/powerpc/platforms/embedded6xx/gamecube.c b/arch/powerpc/platforms/embedded6xx/gamecube.c
index a138e14bad2e..bd4ba5d7d568 100644
--- a/arch/powerpc/platforms/embedded6xx/gamecube.c
+++ b/arch/powerpc/platforms/embedded6xx/gamecube.c
@@ -90,7 +90,7 @@ define_machine(gamecube) {
90}; 90};
91 91
92 92
93static struct of_device_id gamecube_of_bus[] = { 93static const struct of_device_id gamecube_of_bus[] = {
94 { .compatible = "nintendo,flipper", }, 94 { .compatible = "nintendo,flipper", },
95 { }, 95 { },
96}; 96};
diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c b/arch/powerpc/platforms/embedded6xx/linkstation.c
index 455e7c087422..168e1d80b2e5 100644
--- a/arch/powerpc/platforms/embedded6xx/linkstation.c
+++ b/arch/powerpc/platforms/embedded6xx/linkstation.c
@@ -21,7 +21,7 @@
21 21
22#include "mpc10x.h" 22#include "mpc10x.h"
23 23
24static __initdata struct of_device_id of_bus_ids[] = { 24static const struct of_device_id of_bus_ids[] __initconst = {
25 { .type = "soc", }, 25 { .type = "soc", },
26 { .compatible = "simple-bus", }, 26 { .compatible = "simple-bus", },
27 {}, 27 {},
diff --git a/arch/powerpc/platforms/embedded6xx/mvme5100.c b/arch/powerpc/platforms/embedded6xx/mvme5100.c
index 25e3bfb64efb..1613303177e6 100644
--- a/arch/powerpc/platforms/embedded6xx/mvme5100.c
+++ b/arch/powerpc/platforms/embedded6xx/mvme5100.c
@@ -149,7 +149,7 @@ static int __init mvme5100_add_bridge(struct device_node *dev)
149 return 0; 149 return 0;
150} 150}
151 151
152static struct of_device_id mvme5100_of_bus_ids[] __initdata = { 152static const struct of_device_id mvme5100_of_bus_ids[] __initconst = {
153 { .compatible = "hawk-bridge", }, 153 { .compatible = "hawk-bridge", },
154 {}, 154 {},
155}; 155};
diff --git a/arch/powerpc/platforms/embedded6xx/storcenter.c b/arch/powerpc/platforms/embedded6xx/storcenter.c
index c458b60d14c4..d572833ebd00 100644
--- a/arch/powerpc/platforms/embedded6xx/storcenter.c
+++ b/arch/powerpc/platforms/embedded6xx/storcenter.c
@@ -24,7 +24,7 @@
24#include "mpc10x.h" 24#include "mpc10x.h"
25 25
26 26
27static __initdata struct of_device_id storcenter_of_bus[] = { 27static const struct of_device_id storcenter_of_bus[] __initconst = {
28 { .name = "soc", }, 28 { .name = "soc", },
29 {}, 29 {},
30}; 30};
diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c
index 6d8dadf19f0b..388e29bab8f6 100644
--- a/arch/powerpc/platforms/embedded6xx/wii.c
+++ b/arch/powerpc/platforms/embedded6xx/wii.c
@@ -235,7 +235,7 @@ define_machine(wii) {
235 .machine_shutdown = wii_shutdown, 235 .machine_shutdown = wii_shutdown,
236}; 236};
237 237
238static struct of_device_id wii_of_bus[] = { 238static const struct of_device_id wii_of_bus[] = {
239 { .compatible = "nintendo,hollywood", }, 239 { .compatible = "nintendo,hollywood", },
240 { }, 240 { },
241}; 241};
diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c
index 15adee544638..ada33358950d 100644
--- a/arch/powerpc/platforms/pasemi/gpio_mdio.c
+++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c
@@ -290,7 +290,7 @@ static int gpio_mdio_remove(struct platform_device *dev)
290 return 0; 290 return 0;
291} 291}
292 292
293static struct of_device_id gpio_mdio_match[] = 293static const struct of_device_id gpio_mdio_match[] =
294{ 294{
295 { 295 {
296 .compatible = "gpio-mdio", 296 .compatible = "gpio-mdio",
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c
index 8c54de6d8ec4..d71b2c7e8403 100644
--- a/arch/powerpc/platforms/pasemi/setup.c
+++ b/arch/powerpc/platforms/pasemi/setup.c
@@ -393,7 +393,7 @@ static inline void pasemi_pcmcia_init(void)
393#endif 393#endif
394 394
395 395
396static struct of_device_id pasemi_bus_ids[] = { 396static const struct of_device_id pasemi_bus_ids[] = {
397 /* Unfortunately needed for legacy firmwares */ 397 /* Unfortunately needed for legacy firmwares */
398 { .type = "localbus", }, 398 { .type = "localbus", },
399 { .type = "sdc", }, 399 { .type = "sdc", },
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 141f8899a633..b127a29ac526 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -336,7 +336,7 @@ static void __init pmac_setup_arch(void)
336#endif 336#endif
337 337
338#ifdef CONFIG_ADB 338#ifdef CONFIG_ADB
339 if (strstr(cmd_line, "adb_sync")) { 339 if (strstr(boot_command_line, "adb_sync")) {
340 extern int __adb_probe_sync; 340 extern int __adb_probe_sync;
341 __adb_probe_sync = 1; 341 __adb_probe_sync = 1;
342 } 342 }
@@ -460,7 +460,7 @@ pmac_halt(void)
460static void __init pmac_init_early(void) 460static void __init pmac_init_early(void)
461{ 461{
462 /* Enable early btext debug if requested */ 462 /* Enable early btext debug if requested */
463 if (strstr(cmd_line, "btextdbg")) { 463 if (strstr(boot_command_line, "btextdbg")) {
464 udbg_adb_init_early(); 464 udbg_adb_init_early();
465 register_early_udbg_console(); 465 register_early_udbg_console();
466 } 466 }
@@ -469,8 +469,8 @@ static void __init pmac_init_early(void)
469 pmac_feature_init(); 469 pmac_feature_init();
470 470
471 /* Initialize debug stuff */ 471 /* Initialize debug stuff */
472 udbg_scc_init(!!strstr(cmd_line, "sccdbg")); 472 udbg_scc_init(!!strstr(boot_command_line, "sccdbg"));
473 udbg_adb_init(!!strstr(cmd_line, "btextdbg")); 473 udbg_adb_init(!!strstr(boot_command_line, "btextdbg"));
474 474
475#ifdef CONFIG_PPC64 475#ifdef CONFIG_PPC64
476 iommu_init_early_dart(); 476 iommu_init_early_dart();
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c
index c945bed4dc9e..426814a2ede3 100644
--- a/arch/powerpc/platforms/powernv/eeh-ioda.c
+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
@@ -66,6 +66,54 @@ static struct notifier_block ioda_eeh_nb = {
66}; 66};
67 67
68#ifdef CONFIG_DEBUG_FS 68#ifdef CONFIG_DEBUG_FS
69static ssize_t ioda_eeh_ei_write(struct file *filp,
70 const char __user *user_buf,
71 size_t count, loff_t *ppos)
72{
73 struct pci_controller *hose = filp->private_data;
74 struct pnv_phb *phb = hose->private_data;
75 struct eeh_dev *edev;
76 struct eeh_pe *pe;
77 int pe_no, type, func;
78 unsigned long addr, mask;
79 char buf[50];
80 int ret;
81
82 if (!phb->eeh_ops || !phb->eeh_ops->err_inject)
83 return -ENXIO;
84
85 ret = simple_write_to_buffer(buf, sizeof(buf), ppos, user_buf, count);
86 if (!ret)
87 return -EFAULT;
88
89 /* Retrieve parameters */
90 ret = sscanf(buf, "%x:%x:%x:%lx:%lx",
91 &pe_no, &type, &func, &addr, &mask);
92 if (ret != 5)
93 return -EINVAL;
94
95 /* Retrieve PE */
96 edev = kzalloc(sizeof(*edev), GFP_KERNEL);
97 if (!edev)
98 return -ENOMEM;
99 edev->phb = hose;
100 edev->pe_config_addr = pe_no;
101 pe = eeh_pe_get(edev);
102 kfree(edev);
103 if (!pe)
104 return -ENODEV;
105
106 /* Do error injection */
107 ret = phb->eeh_ops->err_inject(pe, type, func, addr, mask);
108 return ret < 0 ? ret : count;
109}
110
111static const struct file_operations ioda_eeh_ei_fops = {
112 .open = simple_open,
113 .llseek = no_llseek,
114 .write = ioda_eeh_ei_write,
115};
116
69static int ioda_eeh_dbgfs_set(void *data, int offset, u64 val) 117static int ioda_eeh_dbgfs_set(void *data, int offset, u64 val)
70{ 118{
71 struct pci_controller *hose = data; 119 struct pci_controller *hose = data;
@@ -152,6 +200,10 @@ static int ioda_eeh_post_init(struct pci_controller *hose)
152 if (!phb->has_dbgfs && phb->dbgfs) { 200 if (!phb->has_dbgfs && phb->dbgfs) {
153 phb->has_dbgfs = 1; 201 phb->has_dbgfs = 1;
154 202
203 debugfs_create_file("err_injct", 0200,
204 phb->dbgfs, hose,
205 &ioda_eeh_ei_fops);
206
155 debugfs_create_file("err_injct_outbound", 0600, 207 debugfs_create_file("err_injct_outbound", 0600,
156 phb->dbgfs, hose, 208 phb->dbgfs, hose,
157 &ioda_eeh_outb_dbgfs_ops); 209 &ioda_eeh_outb_dbgfs_ops);
@@ -189,6 +241,7 @@ static int ioda_eeh_set_option(struct eeh_pe *pe, int option)
189{ 241{
190 struct pci_controller *hose = pe->phb; 242 struct pci_controller *hose = pe->phb;
191 struct pnv_phb *phb = hose->private_data; 243 struct pnv_phb *phb = hose->private_data;
244 bool freeze_pe = false;
192 int enable, ret = 0; 245 int enable, ret = 0;
193 s64 rc; 246 s64 rc;
194 247
@@ -212,6 +265,10 @@ static int ioda_eeh_set_option(struct eeh_pe *pe, int option)
212 case EEH_OPT_THAW_DMA: 265 case EEH_OPT_THAW_DMA:
213 enable = OPAL_EEH_ACTION_CLEAR_FREEZE_DMA; 266 enable = OPAL_EEH_ACTION_CLEAR_FREEZE_DMA;
214 break; 267 break;
268 case EEH_OPT_FREEZE_PE:
269 freeze_pe = true;
270 enable = OPAL_EEH_ACTION_SET_FREEZE_ALL;
271 break;
215 default: 272 default:
216 pr_warn("%s: Invalid option %d\n", 273 pr_warn("%s: Invalid option %d\n",
217 __func__, option); 274 __func__, option);
@@ -219,17 +276,35 @@ static int ioda_eeh_set_option(struct eeh_pe *pe, int option)
219 } 276 }
220 277
221 /* If PHB supports compound PE, to handle it */ 278 /* If PHB supports compound PE, to handle it */
222 if (phb->unfreeze_pe) { 279 if (freeze_pe) {
223 ret = phb->unfreeze_pe(phb, pe->addr, enable); 280 if (phb->freeze_pe) {
281 phb->freeze_pe(phb, pe->addr);
282 } else {
283 rc = opal_pci_eeh_freeze_set(phb->opal_id,
284 pe->addr,
285 enable);
286 if (rc != OPAL_SUCCESS) {
287 pr_warn("%s: Failure %lld freezing "
288 "PHB#%x-PE#%x\n",
289 __func__, rc,
290 phb->hose->global_number, pe->addr);
291 ret = -EIO;
292 }
293 }
224 } else { 294 } else {
225 rc = opal_pci_eeh_freeze_clear(phb->opal_id, 295 if (phb->unfreeze_pe) {
226 pe->addr, 296 ret = phb->unfreeze_pe(phb, pe->addr, enable);
227 enable); 297 } else {
228 if (rc != OPAL_SUCCESS) { 298 rc = opal_pci_eeh_freeze_clear(phb->opal_id,
229 pr_warn("%s: Failure %lld enable %d for PHB#%x-PE#%x\n", 299 pe->addr,
230 __func__, rc, option, phb->hose->global_number, 300 enable);
231 pe->addr); 301 if (rc != OPAL_SUCCESS) {
232 ret = -EIO; 302 pr_warn("%s: Failure %lld enable %d "
303 "for PHB#%x-PE#%x\n",
304 __func__, rc, option,
305 phb->hose->global_number, pe->addr);
306 ret = -EIO;
307 }
233 } 308 }
234 } 309 }
235 310
@@ -439,11 +514,11 @@ int ioda_eeh_phb_reset(struct pci_controller *hose, int option)
439 if (option == EEH_RESET_FUNDAMENTAL || 514 if (option == EEH_RESET_FUNDAMENTAL ||
440 option == EEH_RESET_HOT) 515 option == EEH_RESET_HOT)
441 rc = opal_pci_reset(phb->opal_id, 516 rc = opal_pci_reset(phb->opal_id,
442 OPAL_PHB_COMPLETE, 517 OPAL_RESET_PHB_COMPLETE,
443 OPAL_ASSERT_RESET); 518 OPAL_ASSERT_RESET);
444 else if (option == EEH_RESET_DEACTIVATE) 519 else if (option == EEH_RESET_DEACTIVATE)
445 rc = opal_pci_reset(phb->opal_id, 520 rc = opal_pci_reset(phb->opal_id,
446 OPAL_PHB_COMPLETE, 521 OPAL_RESET_PHB_COMPLETE,
447 OPAL_DEASSERT_RESET); 522 OPAL_DEASSERT_RESET);
448 if (rc < 0) 523 if (rc < 0)
449 goto out; 524 goto out;
@@ -483,15 +558,15 @@ static int ioda_eeh_root_reset(struct pci_controller *hose, int option)
483 */ 558 */
484 if (option == EEH_RESET_FUNDAMENTAL) 559 if (option == EEH_RESET_FUNDAMENTAL)
485 rc = opal_pci_reset(phb->opal_id, 560 rc = opal_pci_reset(phb->opal_id,
486 OPAL_PCI_FUNDAMENTAL_RESET, 561 OPAL_RESET_PCI_FUNDAMENTAL,
487 OPAL_ASSERT_RESET); 562 OPAL_ASSERT_RESET);
488 else if (option == EEH_RESET_HOT) 563 else if (option == EEH_RESET_HOT)
489 rc = opal_pci_reset(phb->opal_id, 564 rc = opal_pci_reset(phb->opal_id,
490 OPAL_PCI_HOT_RESET, 565 OPAL_RESET_PCI_HOT,
491 OPAL_ASSERT_RESET); 566 OPAL_ASSERT_RESET);
492 else if (option == EEH_RESET_DEACTIVATE) 567 else if (option == EEH_RESET_DEACTIVATE)
493 rc = opal_pci_reset(phb->opal_id, 568 rc = opal_pci_reset(phb->opal_id,
494 OPAL_PCI_HOT_RESET, 569 OPAL_RESET_PCI_HOT,
495 OPAL_DEASSERT_RESET); 570 OPAL_DEASSERT_RESET);
496 if (rc < 0) 571 if (rc < 0)
497 goto out; 572 goto out;
@@ -607,6 +682,31 @@ static int ioda_eeh_reset(struct eeh_pe *pe, int option)
607 if (pe->type & EEH_PE_PHB) { 682 if (pe->type & EEH_PE_PHB) {
608 ret = ioda_eeh_phb_reset(hose, option); 683 ret = ioda_eeh_phb_reset(hose, option);
609 } else { 684 } else {
685 struct pnv_phb *phb;
686 s64 rc;
687
688 /*
689 * The frozen PE might be caused by PAPR error injection
690 * registers, which are expected to be cleared after hitting
691 * frozen PE as stated in the hardware spec. Unfortunately,
692 * that's not true on P7IOC. So we have to clear it manually
693 * to avoid recursive EEH errors during recovery.
694 */
695 phb = hose->private_data;
696 if (phb->model == PNV_PHB_MODEL_P7IOC &&
697 (option == EEH_RESET_HOT ||
698 option == EEH_RESET_FUNDAMENTAL)) {
699 rc = opal_pci_reset(phb->opal_id,
700 OPAL_RESET_PHB_ERROR,
701 OPAL_ASSERT_RESET);
702 if (rc != OPAL_SUCCESS) {
703 pr_warn("%s: Failure %lld clearing "
704 "error injection registers\n",
705 __func__, rc);
706 return -EIO;
707 }
708 }
709
610 bus = eeh_pe_bus_get(pe); 710 bus = eeh_pe_bus_get(pe);
611 if (pci_is_root_bus(bus) || 711 if (pci_is_root_bus(bus) ||
612 pci_is_root_bus(bus->parent)) 712 pci_is_root_bus(bus->parent))
@@ -628,8 +728,8 @@ static int ioda_eeh_reset(struct eeh_pe *pe, int option)
628 * Retrieve error log, which contains log from device driver 728 * Retrieve error log, which contains log from device driver
629 * and firmware. 729 * and firmware.
630 */ 730 */
631int ioda_eeh_get_log(struct eeh_pe *pe, int severity, 731static int ioda_eeh_get_log(struct eeh_pe *pe, int severity,
632 char *drv_log, unsigned long len) 732 char *drv_log, unsigned long len)
633{ 733{
634 pnv_pci_dump_phb_diag_data(pe->phb, pe->data); 734 pnv_pci_dump_phb_diag_data(pe->phb, pe->data);
635 735
@@ -650,6 +750,49 @@ static int ioda_eeh_configure_bridge(struct eeh_pe *pe)
650 return 0; 750 return 0;
651} 751}
652 752
753static int ioda_eeh_err_inject(struct eeh_pe *pe, int type, int func,
754 unsigned long addr, unsigned long mask)
755{
756 struct pci_controller *hose = pe->phb;
757 struct pnv_phb *phb = hose->private_data;
758 s64 ret;
759
760 /* Sanity check on error type */
761 if (type != OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR &&
762 type != OPAL_ERR_INJECT_TYPE_IOA_BUS_ERR64) {
763 pr_warn("%s: Invalid error type %d\n",
764 __func__, type);
765 return -ERANGE;
766 }
767
768 if (func < OPAL_ERR_INJECT_FUNC_IOA_LD_MEM_ADDR ||
769 func > OPAL_ERR_INJECT_FUNC_IOA_DMA_WR_TARGET) {
770 pr_warn("%s: Invalid error function %d\n",
771 __func__, func);
772 return -ERANGE;
773 }
774
775 /* Firmware supports error injection ? */
776 if (!opal_check_token(OPAL_PCI_ERR_INJECT)) {
777 pr_warn("%s: Firmware doesn't support error injection\n",
778 __func__);
779 return -ENXIO;
780 }
781
782 /* Do error injection */
783 ret = opal_pci_err_inject(phb->opal_id, pe->addr,
784 type, func, addr, mask);
785 if (ret != OPAL_SUCCESS) {
786 pr_warn("%s: Failure %lld injecting error "
787 "%d-%d to PHB#%x-PE#%x\n",
788 __func__, ret, type, func,
789 hose->global_number, pe->addr);
790 return -EIO;
791 }
792
793 return 0;
794}
795
653static void ioda_eeh_hub_diag_common(struct OpalIoP7IOCErrorData *data) 796static void ioda_eeh_hub_diag_common(struct OpalIoP7IOCErrorData *data)
654{ 797{
655 /* GEM */ 798 /* GEM */
@@ -743,14 +886,12 @@ static int ioda_eeh_get_pe(struct pci_controller *hose,
743 * the master PE because slave PE is invisible 886 * the master PE because slave PE is invisible
744 * to EEH core. 887 * to EEH core.
745 */ 888 */
746 if (phb->get_pe_state) { 889 pnv_pe = &phb->ioda.pe_array[pe_no];
747 pnv_pe = &phb->ioda.pe_array[pe_no]; 890 if (pnv_pe->flags & PNV_IODA_PE_SLAVE) {
748 if (pnv_pe->flags & PNV_IODA_PE_SLAVE) { 891 pnv_pe = pnv_pe->master;
749 pnv_pe = pnv_pe->master; 892 WARN_ON(!pnv_pe ||
750 WARN_ON(!pnv_pe || 893 !(pnv_pe->flags & PNV_IODA_PE_MASTER));
751 !(pnv_pe->flags & PNV_IODA_PE_MASTER)); 894 pe_no = pnv_pe->pe_number;
752 pe_no = pnv_pe->pe_number;
753 }
754 } 895 }
755 896
756 /* Find the PE according to PE# */ 897 /* Find the PE according to PE# */
@@ -761,15 +902,37 @@ static int ioda_eeh_get_pe(struct pci_controller *hose,
761 if (!dev_pe) 902 if (!dev_pe)
762 return -EEXIST; 903 return -EEXIST;
763 904
764 /* 905 /* Freeze the (compound) PE */
765 * At this point, we're sure the compound PE should
766 * be put into frozen state.
767 */
768 *pe = dev_pe; 906 *pe = dev_pe;
769 if (phb->freeze_pe && 907 if (!(dev_pe->state & EEH_PE_ISOLATED))
770 !(dev_pe->state & EEH_PE_ISOLATED))
771 phb->freeze_pe(phb, pe_no); 908 phb->freeze_pe(phb, pe_no);
772 909
910 /*
911 * At this point, we're sure the (compound) PE should
912 * have been frozen. However, we still need poke until
913 * hitting the frozen PE on top level.
914 */
915 dev_pe = dev_pe->parent;
916 while (dev_pe && !(dev_pe->type & EEH_PE_PHB)) {
917 int ret;
918 int active_flags = (EEH_STATE_MMIO_ACTIVE |
919 EEH_STATE_DMA_ACTIVE);
920
921 ret = eeh_ops->get_state(dev_pe, NULL);
922 if (ret <= 0 || (ret & active_flags) == active_flags) {
923 dev_pe = dev_pe->parent;
924 continue;
925 }
926
927 /* Frozen parent PE */
928 *pe = dev_pe;
929 if (!(dev_pe->state & EEH_PE_ISOLATED))
930 phb->freeze_pe(phb, dev_pe->addr);
931
932 /* Next one */
933 dev_pe = dev_pe->parent;
934 }
935
773 return 0; 936 return 0;
774} 937}
775 938
@@ -971,5 +1134,6 @@ struct pnv_eeh_ops ioda_eeh_ops = {
971 .reset = ioda_eeh_reset, 1134 .reset = ioda_eeh_reset,
972 .get_log = ioda_eeh_get_log, 1135 .get_log = ioda_eeh_get_log,
973 .configure_bridge = ioda_eeh_configure_bridge, 1136 .configure_bridge = ioda_eeh_configure_bridge,
1137 .err_inject = ioda_eeh_err_inject,
974 .next_error = ioda_eeh_next_error 1138 .next_error = ioda_eeh_next_error
975}; 1139};
diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
index fd7a16f855ed..3e89cbf55885 100644
--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -359,6 +359,31 @@ static int powernv_eeh_configure_bridge(struct eeh_pe *pe)
359} 359}
360 360
361/** 361/**
362 * powernv_pe_err_inject - Inject specified error to the indicated PE
363 * @pe: the indicated PE
364 * @type: error type
365 * @func: specific error type
366 * @addr: address
367 * @mask: address mask
368 *
369 * The routine is called to inject specified error, which is
370 * determined by @type and @func, to the indicated PE for
371 * testing purpose.
372 */
373static int powernv_eeh_err_inject(struct eeh_pe *pe, int type, int func,
374 unsigned long addr, unsigned long mask)
375{
376 struct pci_controller *hose = pe->phb;
377 struct pnv_phb *phb = hose->private_data;
378 int ret = -EEXIST;
379
380 if (phb->eeh_ops && phb->eeh_ops->err_inject)
381 ret = phb->eeh_ops->err_inject(pe, type, func, addr, mask);
382
383 return ret;
384}
385
386/**
362 * powernv_eeh_next_error - Retrieve next EEH error to handle 387 * powernv_eeh_next_error - Retrieve next EEH error to handle
363 * @pe: Affected PE 388 * @pe: Affected PE
364 * 389 *
@@ -414,6 +439,7 @@ static struct eeh_ops powernv_eeh_ops = {
414 .wait_state = powernv_eeh_wait_state, 439 .wait_state = powernv_eeh_wait_state,
415 .get_log = powernv_eeh_get_log, 440 .get_log = powernv_eeh_get_log,
416 .configure_bridge = powernv_eeh_configure_bridge, 441 .configure_bridge = powernv_eeh_configure_bridge,
442 .err_inject = powernv_eeh_err_inject,
417 .read_config = pnv_pci_cfg_read, 443 .read_config = pnv_pci_cfg_read,
418 .write_config = pnv_pci_cfg_write, 444 .write_config = pnv_pci_cfg_write,
419 .next_error = powernv_eeh_next_error, 445 .next_error = powernv_eeh_next_error,
diff --git a/arch/powerpc/platforms/powernv/opal-dump.c b/arch/powerpc/platforms/powernv/opal-dump.c
index 85bb8fff7947..23260f7dfa7a 100644
--- a/arch/powerpc/platforms/powernv/opal-dump.c
+++ b/arch/powerpc/platforms/powernv/opal-dump.c
@@ -112,7 +112,7 @@ static ssize_t init_dump_show(struct dump_obj *dump_obj,
112 struct dump_attribute *attr, 112 struct dump_attribute *attr,
113 char *buf) 113 char *buf)
114{ 114{
115 return sprintf(buf, "1 - initiate dump\n"); 115 return sprintf(buf, "1 - initiate Service Processor(FSP) dump\n");
116} 116}
117 117
118static int64_t dump_fips_init(uint8_t type) 118static int64_t dump_fips_init(uint8_t type)
@@ -121,7 +121,7 @@ static int64_t dump_fips_init(uint8_t type)
121 121
122 rc = opal_dump_init(type); 122 rc = opal_dump_init(type);
123 if (rc) 123 if (rc)
124 pr_warn("%s: Failed to initiate FipS dump (%d)\n", 124 pr_warn("%s: Failed to initiate FSP dump (%d)\n",
125 __func__, rc); 125 __func__, rc);
126 return rc; 126 return rc;
127} 127}
@@ -131,8 +131,12 @@ static ssize_t init_dump_store(struct dump_obj *dump_obj,
131 const char *buf, 131 const char *buf,
132 size_t count) 132 size_t count)
133{ 133{
134 dump_fips_init(DUMP_TYPE_FSP); 134 int rc;
135 pr_info("%s: Initiated FSP dump\n", __func__); 135
136 rc = dump_fips_init(DUMP_TYPE_FSP);
137 if (rc == OPAL_SUCCESS)
138 pr_info("%s: Initiated FSP dump\n", __func__);
139
136 return count; 140 return count;
137} 141}
138 142
@@ -297,7 +301,7 @@ static ssize_t dump_attr_read(struct file *filep, struct kobject *kobj,
297 * and rely on userspace to ask us to try 301 * and rely on userspace to ask us to try
298 * again. 302 * again.
299 */ 303 */
300 pr_info("%s: Platform dump partially read.ID = 0x%x\n", 304 pr_info("%s: Platform dump partially read. ID = 0x%x\n",
301 __func__, dump->id); 305 __func__, dump->id);
302 return -EIO; 306 return -EIO;
303 } 307 }
@@ -423,6 +427,10 @@ void __init opal_platform_dump_init(void)
423{ 427{
424 int rc; 428 int rc;
425 429
430 /* ELOG not supported by firmware */
431 if (!opal_check_token(OPAL_DUMP_READ))
432 return;
433
426 dump_kset = kset_create_and_add("dump", NULL, opal_kobj); 434 dump_kset = kset_create_and_add("dump", NULL, opal_kobj);
427 if (!dump_kset) { 435 if (!dump_kset) {
428 pr_warn("%s: Failed to create dump kset\n", __func__); 436 pr_warn("%s: Failed to create dump kset\n", __func__);
diff --git a/arch/powerpc/platforms/powernv/opal-elog.c b/arch/powerpc/platforms/powernv/opal-elog.c
index bbdb3ffaab98..518fe95dbf24 100644
--- a/arch/powerpc/platforms/powernv/opal-elog.c
+++ b/arch/powerpc/platforms/powernv/opal-elog.c
@@ -295,6 +295,10 @@ int __init opal_elog_init(void)
295{ 295{
296 int rc = 0; 296 int rc = 0;
297 297
298 /* ELOG not supported by firmware */
299 if (!opal_check_token(OPAL_ELOG_READ))
300 return -1;
301
298 elog_kset = kset_create_and_add("elog", NULL, opal_kobj); 302 elog_kset = kset_create_and_add("elog", NULL, opal_kobj);
299 if (!elog_kset) { 303 if (!elog_kset) {
300 pr_warn("%s: failed to create elog kset\n", __func__); 304 pr_warn("%s: failed to create elog kset\n", __func__);
diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c
index ad4b31df779a..dd2c285ad170 100644
--- a/arch/powerpc/platforms/powernv/opal-lpc.c
+++ b/arch/powerpc/platforms/powernv/opal-lpc.c
@@ -191,6 +191,7 @@ static ssize_t lpc_debug_read(struct file *filp, char __user *ubuf,
191{ 191{
192 struct lpc_debugfs_entry *lpc = filp->private_data; 192 struct lpc_debugfs_entry *lpc = filp->private_data;
193 u32 data, pos, len, todo; 193 u32 data, pos, len, todo;
194 __be32 bedata;
194 int rc; 195 int rc;
195 196
196 if (!access_ok(VERIFY_WRITE, ubuf, count)) 197 if (!access_ok(VERIFY_WRITE, ubuf, count))
@@ -213,9 +214,10 @@ static ssize_t lpc_debug_read(struct file *filp, char __user *ubuf,
213 len = 2; 214 len = 2;
214 } 215 }
215 rc = opal_lpc_read(opal_lpc_chip_id, lpc->lpc_type, pos, 216 rc = opal_lpc_read(opal_lpc_chip_id, lpc->lpc_type, pos,
216 &data, len); 217 &bedata, len);
217 if (rc) 218 if (rc)
218 return -ENXIO; 219 return -ENXIO;
220 data = be32_to_cpu(bedata);
219 switch(len) { 221 switch(len) {
220 case 4: 222 case 4:
221 rc = __put_user((u32)data, (u32 __user *)ubuf); 223 rc = __put_user((u32)data, (u32 __user *)ubuf);
diff --git a/arch/powerpc/platforms/powernv/opal-nvram.c b/arch/powerpc/platforms/powernv/opal-nvram.c
index acd9f7e96678..f9896fd5d04a 100644
--- a/arch/powerpc/platforms/powernv/opal-nvram.c
+++ b/arch/powerpc/platforms/powernv/opal-nvram.c
@@ -78,7 +78,7 @@ void __init opal_nvram_init(void)
78 } 78 }
79 nvram_size = be32_to_cpup(nbytes_p); 79 nvram_size = be32_to_cpup(nbytes_p);
80 80
81 printk(KERN_INFO "OPAL nvram setup, %u bytes\n", nvram_size); 81 pr_info("OPAL nvram setup, %u bytes\n", nvram_size);
82 of_node_put(np); 82 of_node_put(np);
83 83
84 ppc_md.nvram_read = opal_nvram_read; 84 ppc_md.nvram_read = opal_nvram_read;
diff --git a/arch/powerpc/platforms/powernv/opal-rtc.c b/arch/powerpc/platforms/powernv/opal-rtc.c
index b1885db8fdf3..499707ddaa9c 100644
--- a/arch/powerpc/platforms/powernv/opal-rtc.c
+++ b/arch/powerpc/platforms/powernv/opal-rtc.c
@@ -42,6 +42,9 @@ unsigned long __init opal_get_boot_time(void)
42 __be64 __h_m_s_ms; 42 __be64 __h_m_s_ms;
43 long rc = OPAL_BUSY; 43 long rc = OPAL_BUSY;
44 44
45 if (!opal_check_token(OPAL_RTC_READ))
46 goto out;
47
45 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { 48 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
46 rc = opal_rtc_read(&__y_m_d, &__h_m_s_ms); 49 rc = opal_rtc_read(&__y_m_d, &__h_m_s_ms);
47 if (rc == OPAL_BUSY_EVENT) 50 if (rc == OPAL_BUSY_EVENT)
@@ -49,16 +52,18 @@ unsigned long __init opal_get_boot_time(void)
49 else 52 else
50 mdelay(10); 53 mdelay(10);
51 } 54 }
52 if (rc != OPAL_SUCCESS) { 55 if (rc != OPAL_SUCCESS)
53 ppc_md.get_rtc_time = NULL; 56 goto out;
54 ppc_md.set_rtc_time = NULL; 57
55 return 0;
56 }
57 y_m_d = be32_to_cpu(__y_m_d); 58 y_m_d = be32_to_cpu(__y_m_d);
58 h_m_s_ms = be64_to_cpu(__h_m_s_ms); 59 h_m_s_ms = be64_to_cpu(__h_m_s_ms);
59 opal_to_tm(y_m_d, h_m_s_ms, &tm); 60 opal_to_tm(y_m_d, h_m_s_ms, &tm);
60 return mktime(tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, 61 return mktime(tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
61 tm.tm_hour, tm.tm_min, tm.tm_sec); 62 tm.tm_hour, tm.tm_min, tm.tm_sec);
63out:
64 ppc_md.get_rtc_time = NULL;
65 ppc_md.set_rtc_time = NULL;
66 return 0;
62} 67}
63 68
64void opal_get_rtc_time(struct rtc_time *tm) 69void opal_get_rtc_time(struct rtc_time *tm)
diff --git a/arch/powerpc/platforms/powernv/opal-tracepoints.c b/arch/powerpc/platforms/powernv/opal-tracepoints.c
index d8a000a9988b..ae14c40b4b1c 100644
--- a/arch/powerpc/platforms/powernv/opal-tracepoints.c
+++ b/arch/powerpc/platforms/powernv/opal-tracepoints.c
@@ -2,7 +2,7 @@
2#include <linux/jump_label.h> 2#include <linux/jump_label.h>
3#include <asm/trace.h> 3#include <asm/trace.h>
4 4
5#ifdef CONFIG_JUMP_LABEL 5#ifdef HAVE_JUMP_LABEL
6struct static_key opal_tracepoint_key = STATIC_KEY_INIT; 6struct static_key opal_tracepoint_key = STATIC_KEY_INIT;
7 7
8void opal_tracepoint_regfunc(void) 8void opal_tracepoint_regfunc(void)
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index 2e6ce1b8dc8f..e9e2450c1fdd 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -184,6 +184,7 @@ OPAL_CALL(opal_register_exception_handler, OPAL_REGISTER_OPAL_EXCEPTION_HANDLER)
184OPAL_CALL(opal_pci_eeh_freeze_status, OPAL_PCI_EEH_FREEZE_STATUS); 184OPAL_CALL(opal_pci_eeh_freeze_status, OPAL_PCI_EEH_FREEZE_STATUS);
185OPAL_CALL(opal_pci_eeh_freeze_clear, OPAL_PCI_EEH_FREEZE_CLEAR); 185OPAL_CALL(opal_pci_eeh_freeze_clear, OPAL_PCI_EEH_FREEZE_CLEAR);
186OPAL_CALL(opal_pci_eeh_freeze_set, OPAL_PCI_EEH_FREEZE_SET); 186OPAL_CALL(opal_pci_eeh_freeze_set, OPAL_PCI_EEH_FREEZE_SET);
187OPAL_CALL(opal_pci_err_inject, OPAL_PCI_ERR_INJECT);
187OPAL_CALL(opal_pci_shpc, OPAL_PCI_SHPC); 188OPAL_CALL(opal_pci_shpc, OPAL_PCI_SHPC);
188OPAL_CALL(opal_pci_phb_mmio_enable, OPAL_PCI_PHB_MMIO_ENABLE); 189OPAL_CALL(opal_pci_phb_mmio_enable, OPAL_PCI_PHB_MMIO_ENABLE);
189OPAL_CALL(opal_pci_set_phb_mem_window, OPAL_PCI_SET_PHB_MEM_WINDOW); 190OPAL_CALL(opal_pci_set_phb_mem_window, OPAL_PCI_SET_PHB_MEM_WINDOW);
@@ -232,6 +233,7 @@ OPAL_CALL(opal_validate_flash, OPAL_FLASH_VALIDATE);
232OPAL_CALL(opal_manage_flash, OPAL_FLASH_MANAGE); 233OPAL_CALL(opal_manage_flash, OPAL_FLASH_MANAGE);
233OPAL_CALL(opal_update_flash, OPAL_FLASH_UPDATE); 234OPAL_CALL(opal_update_flash, OPAL_FLASH_UPDATE);
234OPAL_CALL(opal_resync_timebase, OPAL_RESYNC_TIMEBASE); 235OPAL_CALL(opal_resync_timebase, OPAL_RESYNC_TIMEBASE);
236OPAL_CALL(opal_check_token, OPAL_CHECK_TOKEN);
235OPAL_CALL(opal_dump_init, OPAL_DUMP_INIT); 237OPAL_CALL(opal_dump_init, OPAL_DUMP_INIT);
236OPAL_CALL(opal_dump_info, OPAL_DUMP_INFO); 238OPAL_CALL(opal_dump_info, OPAL_DUMP_INFO);
237OPAL_CALL(opal_dump_info2, OPAL_DUMP_INFO2); 239OPAL_CALL(opal_dump_info2, OPAL_DUMP_INFO2);
@@ -247,3 +249,4 @@ OPAL_CALL(opal_set_param, OPAL_SET_PARAM);
247OPAL_CALL(opal_handle_hmi, OPAL_HANDLE_HMI); 249OPAL_CALL(opal_handle_hmi, OPAL_HANDLE_HMI);
248OPAL_CALL(opal_register_dump_region, OPAL_REGISTER_DUMP_REGION); 250OPAL_CALL(opal_register_dump_region, OPAL_REGISTER_DUMP_REGION);
249OPAL_CALL(opal_unregister_dump_region, OPAL_UNREGISTER_DUMP_REGION); 251OPAL_CALL(opal_unregister_dump_region, OPAL_UNREGISTER_DUMP_REGION);
252OPAL_CALL(opal_pci_set_phb_cxl_mode, OPAL_PCI_SET_PHB_CXL_MODE);
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 4b005ae5dc4b..b642b0562f5a 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -105,12 +105,12 @@ int __init early_init_dt_scan_opal(unsigned long node,
105 if (of_flat_dt_is_compatible(node, "ibm,opal-v3")) { 105 if (of_flat_dt_is_compatible(node, "ibm,opal-v3")) {
106 powerpc_firmware_features |= FW_FEATURE_OPALv2; 106 powerpc_firmware_features |= FW_FEATURE_OPALv2;
107 powerpc_firmware_features |= FW_FEATURE_OPALv3; 107 powerpc_firmware_features |= FW_FEATURE_OPALv3;
108 printk("OPAL V3 detected !\n"); 108 pr_info("OPAL V3 detected !\n");
109 } else if (of_flat_dt_is_compatible(node, "ibm,opal-v2")) { 109 } else if (of_flat_dt_is_compatible(node, "ibm,opal-v2")) {
110 powerpc_firmware_features |= FW_FEATURE_OPALv2; 110 powerpc_firmware_features |= FW_FEATURE_OPALv2;
111 printk("OPAL V2 detected !\n"); 111 pr_info("OPAL V2 detected !\n");
112 } else { 112 } else {
113 printk("OPAL V1 detected !\n"); 113 pr_info("OPAL V1 detected !\n");
114 } 114 }
115 115
116 /* Reinit all cores with the right endian */ 116 /* Reinit all cores with the right endian */
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index df241b11d4f7..468a0f23c7f2 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -37,41 +37,43 @@
37#include <asm/xics.h> 37#include <asm/xics.h>
38#include <asm/debug.h> 38#include <asm/debug.h>
39#include <asm/firmware.h> 39#include <asm/firmware.h>
40#include <asm/pnv-pci.h>
41
42#include <misc/cxl.h>
40 43
41#include "powernv.h" 44#include "powernv.h"
42#include "pci.h" 45#include "pci.h"
43 46
44#define define_pe_printk_level(func, kern_level) \ 47static void pe_level_printk(const struct pnv_ioda_pe *pe, const char *level,
45static int func(const struct pnv_ioda_pe *pe, const char *fmt, ...) \ 48 const char *fmt, ...)
46{ \ 49{
47 struct va_format vaf; \ 50 struct va_format vaf;
48 va_list args; \ 51 va_list args;
49 char pfix[32]; \ 52 char pfix[32];
50 int r; \ 53
51 \ 54 va_start(args, fmt);
52 va_start(args, fmt); \ 55
53 \ 56 vaf.fmt = fmt;
54 vaf.fmt = fmt; \ 57 vaf.va = &args;
55 vaf.va = &args; \ 58
56 \ 59 if (pe->pdev)
57 if (pe->pdev) \ 60 strlcpy(pfix, dev_name(&pe->pdev->dev), sizeof(pfix));
58 strlcpy(pfix, dev_name(&pe->pdev->dev), \ 61 else
59 sizeof(pfix)); \ 62 sprintf(pfix, "%04x:%02x ",
60 else \ 63 pci_domain_nr(pe->pbus), pe->pbus->number);
61 sprintf(pfix, "%04x:%02x ", \ 64
62 pci_domain_nr(pe->pbus), \ 65 printk("%spci %s: [PE# %.3d] %pV",
63 pe->pbus->number); \ 66 level, pfix, pe->pe_number, &vaf);
64 r = printk(kern_level "pci %s: [PE# %.3d] %pV", \ 67
65 pfix, pe->pe_number, &vaf); \ 68 va_end(args);
66 \ 69}
67 va_end(args); \ 70
68 \ 71#define pe_err(pe, fmt, ...) \
69 return r; \ 72 pe_level_printk(pe, KERN_ERR, fmt, ##__VA_ARGS__)
70} \ 73#define pe_warn(pe, fmt, ...) \
71 74 pe_level_printk(pe, KERN_WARNING, fmt, ##__VA_ARGS__)
72define_pe_printk_level(pe_err, KERN_ERR); 75#define pe_info(pe, fmt, ...) \
73define_pe_printk_level(pe_warn, KERN_WARNING); 76 pe_level_printk(pe, KERN_INFO, fmt, ##__VA_ARGS__)
74define_pe_printk_level(pe_info, KERN_INFO);
75 77
76/* 78/*
77 * stdcix is only supposed to be used in hypervisor real mode as per 79 * stdcix is only supposed to be used in hypervisor real mode as per
@@ -385,7 +387,7 @@ static void pnv_ioda_freeze_pe(struct pnv_phb *phb, int pe_no)
385 } 387 }
386} 388}
387 389
388int pnv_ioda_unfreeze_pe(struct pnv_phb *phb, int pe_no, int opt) 390static int pnv_ioda_unfreeze_pe(struct pnv_phb *phb, int pe_no, int opt)
389{ 391{
390 struct pnv_ioda_pe *pe, *slave; 392 struct pnv_ioda_pe *pe, *slave;
391 s64 rc; 393 s64 rc;
@@ -890,6 +892,28 @@ static int pnv_pci_ioda_dma_set_mask(struct pnv_phb *phb,
890 return 0; 892 return 0;
891} 893}
892 894
895static u64 pnv_pci_ioda_dma_get_required_mask(struct pnv_phb *phb,
896 struct pci_dev *pdev)
897{
898 struct pci_dn *pdn = pci_get_pdn(pdev);
899 struct pnv_ioda_pe *pe;
900 u64 end, mask;
901
902 if (WARN_ON(!pdn || pdn->pe_number == IODA_INVALID_PE))
903 return 0;
904
905 pe = &phb->ioda.pe_array[pdn->pe_number];
906 if (!pe->tce_bypass_enabled)
907 return __dma_get_required_mask(&pdev->dev);
908
909
910 end = pe->tce_bypass_base + memblock_end_of_DRAM();
911 mask = 1ULL << (fls64(end) - 1);
912 mask += mask - 1;
913
914 return mask;
915}
916
893static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe, 917static void pnv_ioda_setup_bus_dma(struct pnv_ioda_pe *pe,
894 struct pci_bus *bus, 918 struct pci_bus *bus,
895 bool add_to_iommu_group) 919 bool add_to_iommu_group)
@@ -1306,14 +1330,186 @@ static void pnv_ioda2_msi_eoi(struct irq_data *d)
1306 icp_native_eoi(d); 1330 icp_native_eoi(d);
1307} 1331}
1308 1332
1333
1334static void set_msi_irq_chip(struct pnv_phb *phb, unsigned int virq)
1335{
1336 struct irq_data *idata;
1337 struct irq_chip *ichip;
1338
1339 if (phb->type != PNV_PHB_IODA2)
1340 return;
1341
1342 if (!phb->ioda.irq_chip_init) {
1343 /*
1344 * First time we setup an MSI IRQ, we need to setup the
1345 * corresponding IRQ chip to route correctly.
1346 */
1347 idata = irq_get_irq_data(virq);
1348 ichip = irq_data_get_irq_chip(idata);
1349 phb->ioda.irq_chip_init = 1;
1350 phb->ioda.irq_chip = *ichip;
1351 phb->ioda.irq_chip.irq_eoi = pnv_ioda2_msi_eoi;
1352 }
1353 irq_set_chip(virq, &phb->ioda.irq_chip);
1354}
1355
1356#ifdef CONFIG_CXL_BASE
1357
1358struct device_node *pnv_pci_to_phb_node(struct pci_dev *dev)
1359{
1360 struct pci_controller *hose = pci_bus_to_host(dev->bus);
1361
1362 return hose->dn;
1363}
1364EXPORT_SYMBOL(pnv_pci_to_phb_node);
1365
1366int pnv_phb_to_cxl(struct pci_dev *dev)
1367{
1368 struct pci_controller *hose = pci_bus_to_host(dev->bus);
1369 struct pnv_phb *phb = hose->private_data;
1370 struct pnv_ioda_pe *pe;
1371 int rc;
1372
1373 pe = pnv_ioda_get_pe(dev);
1374 if (!pe)
1375 return -ENODEV;
1376
1377 pe_info(pe, "Switching PHB to CXL\n");
1378
1379 rc = opal_pci_set_phb_cxl_mode(phb->opal_id, 1, pe->pe_number);
1380 if (rc)
1381 dev_err(&dev->dev, "opal_pci_set_phb_cxl_mode failed: %i\n", rc);
1382
1383 return rc;
1384}
1385EXPORT_SYMBOL(pnv_phb_to_cxl);
1386
1387/* Find PHB for cxl dev and allocate MSI hwirqs?
1388 * Returns the absolute hardware IRQ number
1389 */
1390int pnv_cxl_alloc_hwirqs(struct pci_dev *dev, int num)
1391{
1392 struct pci_controller *hose = pci_bus_to_host(dev->bus);
1393 struct pnv_phb *phb = hose->private_data;
1394 int hwirq = msi_bitmap_alloc_hwirqs(&phb->msi_bmp, num);
1395
1396 if (hwirq < 0) {
1397 dev_warn(&dev->dev, "Failed to find a free MSI\n");
1398 return -ENOSPC;
1399 }
1400
1401 return phb->msi_base + hwirq;
1402}
1403EXPORT_SYMBOL(pnv_cxl_alloc_hwirqs);
1404
1405void pnv_cxl_release_hwirqs(struct pci_dev *dev, int hwirq, int num)
1406{
1407 struct pci_controller *hose = pci_bus_to_host(dev->bus);
1408 struct pnv_phb *phb = hose->private_data;
1409
1410 msi_bitmap_free_hwirqs(&phb->msi_bmp, hwirq - phb->msi_base, num);
1411}
1412EXPORT_SYMBOL(pnv_cxl_release_hwirqs);
1413
1414void pnv_cxl_release_hwirq_ranges(struct cxl_irq_ranges *irqs,
1415 struct pci_dev *dev)
1416{
1417 struct pci_controller *hose = pci_bus_to_host(dev->bus);
1418 struct pnv_phb *phb = hose->private_data;
1419 int i, hwirq;
1420
1421 for (i = 1; i < CXL_IRQ_RANGES; i++) {
1422 if (!irqs->range[i])
1423 continue;
1424 pr_devel("cxl release irq range 0x%x: offset: 0x%lx limit: %ld\n",
1425 i, irqs->offset[i],
1426 irqs->range[i]);
1427 hwirq = irqs->offset[i] - phb->msi_base;
1428 msi_bitmap_free_hwirqs(&phb->msi_bmp, hwirq,
1429 irqs->range[i]);
1430 }
1431}
1432EXPORT_SYMBOL(pnv_cxl_release_hwirq_ranges);
1433
1434int pnv_cxl_alloc_hwirq_ranges(struct cxl_irq_ranges *irqs,
1435 struct pci_dev *dev, int num)
1436{
1437 struct pci_controller *hose = pci_bus_to_host(dev->bus);
1438 struct pnv_phb *phb = hose->private_data;
1439 int i, hwirq, try;
1440
1441 memset(irqs, 0, sizeof(struct cxl_irq_ranges));
1442
1443 /* 0 is reserved for the multiplexed PSL DSI interrupt */
1444 for (i = 1; i < CXL_IRQ_RANGES && num; i++) {
1445 try = num;
1446 while (try) {
1447 hwirq = msi_bitmap_alloc_hwirqs(&phb->msi_bmp, try);
1448 if (hwirq >= 0)
1449 break;
1450 try /= 2;
1451 }
1452 if (!try)
1453 goto fail;
1454
1455 irqs->offset[i] = phb->msi_base + hwirq;
1456 irqs->range[i] = try;
1457 pr_devel("cxl alloc irq range 0x%x: offset: 0x%lx limit: %li\n",
1458 i, irqs->offset[i], irqs->range[i]);
1459 num -= try;
1460 }
1461 if (num)
1462 goto fail;
1463
1464 return 0;
1465fail:
1466 pnv_cxl_release_hwirq_ranges(irqs, dev);
1467 return -ENOSPC;
1468}
1469EXPORT_SYMBOL(pnv_cxl_alloc_hwirq_ranges);
1470
1471int pnv_cxl_get_irq_count(struct pci_dev *dev)
1472{
1473 struct pci_controller *hose = pci_bus_to_host(dev->bus);
1474 struct pnv_phb *phb = hose->private_data;
1475
1476 return phb->msi_bmp.irq_count;
1477}
1478EXPORT_SYMBOL(pnv_cxl_get_irq_count);
1479
1480int pnv_cxl_ioda_msi_setup(struct pci_dev *dev, unsigned int hwirq,
1481 unsigned int virq)
1482{
1483 struct pci_controller *hose = pci_bus_to_host(dev->bus);
1484 struct pnv_phb *phb = hose->private_data;
1485 unsigned int xive_num = hwirq - phb->msi_base;
1486 struct pnv_ioda_pe *pe;
1487 int rc;
1488
1489 if (!(pe = pnv_ioda_get_pe(dev)))
1490 return -ENODEV;
1491
1492 /* Assign XIVE to PE */
1493 rc = opal_pci_set_xive_pe(phb->opal_id, pe->pe_number, xive_num);
1494 if (rc) {
1495 pe_warn(pe, "%s: OPAL error %d setting msi_base 0x%x "
1496 "hwirq 0x%x XIVE 0x%x PE\n",
1497 pci_name(dev), rc, phb->msi_base, hwirq, xive_num);
1498 return -EIO;
1499 }
1500 set_msi_irq_chip(phb, virq);
1501
1502 return 0;
1503}
1504EXPORT_SYMBOL(pnv_cxl_ioda_msi_setup);
1505#endif
1506
1309static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev, 1507static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
1310 unsigned int hwirq, unsigned int virq, 1508 unsigned int hwirq, unsigned int virq,
1311 unsigned int is_64, struct msi_msg *msg) 1509 unsigned int is_64, struct msi_msg *msg)
1312{ 1510{
1313 struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev); 1511 struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev);
1314 struct pci_dn *pdn = pci_get_pdn(dev); 1512 struct pci_dn *pdn = pci_get_pdn(dev);
1315 struct irq_data *idata;
1316 struct irq_chip *ichip;
1317 unsigned int xive_num = hwirq - phb->msi_base; 1513 unsigned int xive_num = hwirq - phb->msi_base;
1318 __be32 data; 1514 __be32 data;
1319 int rc; 1515 int rc;
@@ -1365,22 +1561,7 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
1365 } 1561 }
1366 msg->data = be32_to_cpu(data); 1562 msg->data = be32_to_cpu(data);
1367 1563
1368 /* 1564 set_msi_irq_chip(phb, virq);
1369 * Change the IRQ chip for the MSI interrupts on PHB3.
1370 * The corresponding IRQ chip should be populated for
1371 * the first time.
1372 */
1373 if (phb->type == PNV_PHB_IODA2) {
1374 if (!phb->ioda.irq_chip_init) {
1375 idata = irq_get_irq_data(virq);
1376 ichip = irq_data_get_irq_chip(idata);
1377 phb->ioda.irq_chip_init = 1;
1378 phb->ioda.irq_chip = *ichip;
1379 phb->ioda.irq_chip.irq_eoi = pnv_ioda2_msi_eoi;
1380 }
1381
1382 irq_set_chip(virq, &phb->ioda.irq_chip);
1383 }
1384 1565
1385 pr_devel("%s: %s-bit MSI on hwirq %x (xive #%d)," 1566 pr_devel("%s: %s-bit MSI on hwirq %x (xive #%d),"
1386 " address=%x_%08x data=%x PE# %d\n", 1567 " address=%x_%08x data=%x PE# %d\n",
@@ -1627,12 +1808,12 @@ static u32 pnv_ioda_bdfn_to_pe(struct pnv_phb *phb, struct pci_bus *bus,
1627 1808
1628static void pnv_pci_ioda_shutdown(struct pnv_phb *phb) 1809static void pnv_pci_ioda_shutdown(struct pnv_phb *phb)
1629{ 1810{
1630 opal_pci_reset(phb->opal_id, OPAL_PCI_IODA_TABLE_RESET, 1811 opal_pci_reset(phb->opal_id, OPAL_RESET_PCI_IODA_TABLE,
1631 OPAL_ASSERT_RESET); 1812 OPAL_ASSERT_RESET);
1632} 1813}
1633 1814
1634void __init pnv_pci_init_ioda_phb(struct device_node *np, 1815static void __init pnv_pci_init_ioda_phb(struct device_node *np,
1635 u64 hub_id, int ioda_type) 1816 u64 hub_id, int ioda_type)
1636{ 1817{
1637 struct pci_controller *hose; 1818 struct pci_controller *hose;
1638 struct pnv_phb *phb; 1819 struct pnv_phb *phb;
@@ -1782,6 +1963,7 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np,
1782 /* Setup TCEs */ 1963 /* Setup TCEs */
1783 phb->dma_dev_setup = pnv_pci_ioda_dma_dev_setup; 1964 phb->dma_dev_setup = pnv_pci_ioda_dma_dev_setup;
1784 phb->dma_set_mask = pnv_pci_ioda_dma_set_mask; 1965 phb->dma_set_mask = pnv_pci_ioda_dma_set_mask;
1966 phb->dma_get_required_mask = pnv_pci_ioda_dma_get_required_mask;
1785 1967
1786 /* Setup shutdown function for kexec */ 1968 /* Setup shutdown function for kexec */
1787 phb->shutdown = pnv_pci_ioda_shutdown; 1969 phb->shutdown = pnv_pci_ioda_shutdown;
@@ -1803,7 +1985,7 @@ void __init pnv_pci_init_ioda_phb(struct device_node *np,
1803 pci_add_flags(PCI_REASSIGN_ALL_RSRC); 1985 pci_add_flags(PCI_REASSIGN_ALL_RSRC);
1804 1986
1805 /* Reset IODA tables to a clean state */ 1987 /* Reset IODA tables to a clean state */
1806 rc = opal_pci_reset(phb_id, OPAL_PCI_IODA_TABLE_RESET, OPAL_ASSERT_RESET); 1988 rc = opal_pci_reset(phb_id, OPAL_RESET_PCI_IODA_TABLE, OPAL_ASSERT_RESET);
1807 if (rc) 1989 if (rc)
1808 pr_warning(" OPAL Error %ld performing IODA table reset !\n", rc); 1990 pr_warning(" OPAL Error %ld performing IODA table reset !\n", rc);
1809 1991
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index b45c49249a5d..b3ca77ddf36d 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -753,6 +753,17 @@ int pnv_pci_dma_set_mask(struct pci_dev *pdev, u64 dma_mask)
753 return __dma_set_mask(&pdev->dev, dma_mask); 753 return __dma_set_mask(&pdev->dev, dma_mask);
754} 754}
755 755
756u64 pnv_pci_dma_get_required_mask(struct pci_dev *pdev)
757{
758 struct pci_controller *hose = pci_bus_to_host(pdev->bus);
759 struct pnv_phb *phb = hose->private_data;
760
761 if (phb && phb->dma_get_required_mask)
762 return phb->dma_get_required_mask(phb, pdev);
763
764 return __dma_get_required_mask(&pdev->dev);
765}
766
756void pnv_pci_shutdown(void) 767void pnv_pci_shutdown(void)
757{ 768{
758 struct pci_controller *hose; 769 struct pci_controller *hose;
diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h
index 48494d4b6058..34d29eb2a4de 100644
--- a/arch/powerpc/platforms/powernv/pci.h
+++ b/arch/powerpc/platforms/powernv/pci.h
@@ -85,6 +85,8 @@ struct pnv_eeh_ops {
85 int (*get_log)(struct eeh_pe *pe, int severity, 85 int (*get_log)(struct eeh_pe *pe, int severity,
86 char *drv_log, unsigned long len); 86 char *drv_log, unsigned long len);
87 int (*configure_bridge)(struct eeh_pe *pe); 87 int (*configure_bridge)(struct eeh_pe *pe);
88 int (*err_inject)(struct eeh_pe *pe, int type, int func,
89 unsigned long addr, unsigned long mask);
88 int (*next_error)(struct eeh_pe **pe); 90 int (*next_error)(struct eeh_pe **pe);
89}; 91};
90#endif /* CONFIG_EEH */ 92#endif /* CONFIG_EEH */
@@ -122,6 +124,8 @@ struct pnv_phb {
122 void (*dma_dev_setup)(struct pnv_phb *phb, struct pci_dev *pdev); 124 void (*dma_dev_setup)(struct pnv_phb *phb, struct pci_dev *pdev);
123 int (*dma_set_mask)(struct pnv_phb *phb, struct pci_dev *pdev, 125 int (*dma_set_mask)(struct pnv_phb *phb, struct pci_dev *pdev,
124 u64 dma_mask); 126 u64 dma_mask);
127 u64 (*dma_get_required_mask)(struct pnv_phb *phb,
128 struct pci_dev *pdev);
125 void (*fixup_phb)(struct pci_controller *hose); 129 void (*fixup_phb)(struct pci_controller *hose);
126 u32 (*bdfn_to_pe)(struct pnv_phb *phb, struct pci_bus *bus, u32 devfn); 130 u32 (*bdfn_to_pe)(struct pnv_phb *phb, struct pci_bus *bus, u32 devfn);
127 void (*shutdown)(struct pnv_phb *phb); 131 void (*shutdown)(struct pnv_phb *phb);
diff --git a/arch/powerpc/platforms/powernv/powernv.h b/arch/powerpc/platforms/powernv/powernv.h
index 75501bfede7f..6c8e2d188cd0 100644
--- a/arch/powerpc/platforms/powernv/powernv.h
+++ b/arch/powerpc/platforms/powernv/powernv.h
@@ -13,6 +13,7 @@ struct pci_dev;
13extern void pnv_pci_init(void); 13extern void pnv_pci_init(void);
14extern void pnv_pci_shutdown(void); 14extern void pnv_pci_shutdown(void);
15extern int pnv_pci_dma_set_mask(struct pci_dev *pdev, u64 dma_mask); 15extern int pnv_pci_dma_set_mask(struct pci_dev *pdev, u64 dma_mask);
16extern u64 pnv_pci_dma_get_required_mask(struct pci_dev *pdev);
16#else 17#else
17static inline void pnv_pci_init(void) { } 18static inline void pnv_pci_init(void) { }
18static inline void pnv_pci_shutdown(void) { } 19static inline void pnv_pci_shutdown(void) { }
@@ -21,6 +22,11 @@ static inline int pnv_pci_dma_set_mask(struct pci_dev *pdev, u64 dma_mask)
21{ 22{
22 return -ENODEV; 23 return -ENODEV;
23} 24}
25
26static inline u64 pnv_pci_dma_get_required_mask(struct pci_dev *pdev)
27{
28 return 0;
29}
24#endif 30#endif
25 31
26extern void pnv_lpc_init(void); 32extern void pnv_lpc_init(void);
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index 5a0e2dc6de5f..3f9546d8a51f 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -173,6 +173,14 @@ static int pnv_dma_set_mask(struct device *dev, u64 dma_mask)
173 return __dma_set_mask(dev, dma_mask); 173 return __dma_set_mask(dev, dma_mask);
174} 174}
175 175
176static u64 pnv_dma_get_required_mask(struct device *dev)
177{
178 if (dev_is_pci(dev))
179 return pnv_pci_dma_get_required_mask(to_pci_dev(dev));
180
181 return __dma_get_required_mask(dev);
182}
183
176static void pnv_shutdown(void) 184static void pnv_shutdown(void)
177{ 185{
178 /* Let the PCI code clear up IODA tables */ 186 /* Let the PCI code clear up IODA tables */
@@ -307,7 +315,7 @@ static int __init pnv_probe(void)
307 * Returns the cpu frequency for 'cpu' in Hz. This is used by 315 * Returns the cpu frequency for 'cpu' in Hz. This is used by
308 * /proc/cpuinfo 316 * /proc/cpuinfo
309 */ 317 */
310unsigned long pnv_get_proc_freq(unsigned int cpu) 318static unsigned long pnv_get_proc_freq(unsigned int cpu)
311{ 319{
312 unsigned long ret_freq; 320 unsigned long ret_freq;
313 321
@@ -335,6 +343,7 @@ define_machine(powernv) {
335 .power_save = power7_idle, 343 .power_save = power7_idle,
336 .calibrate_decr = generic_calibrate_decr, 344 .calibrate_decr = generic_calibrate_decr,
337 .dma_set_mask = pnv_dma_set_mask, 345 .dma_set_mask = pnv_dma_set_mask,
346 .dma_get_required_mask = pnv_dma_get_required_mask,
338#ifdef CONFIG_KEXEC 347#ifdef CONFIG_KEXEC
339 .kexec_cpu_down = pnv_kexec_cpu_down, 348 .kexec_cpu_down = pnv_kexec_cpu_down,
340#endif 349#endif
diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c
index 5fcfcf44e3a9..4753958cd509 100644
--- a/arch/powerpc/platforms/powernv/smp.c
+++ b/arch/powerpc/platforms/powernv/smp.c
@@ -54,7 +54,7 @@ static void pnv_smp_setup_cpu(int cpu)
54#endif 54#endif
55} 55}
56 56
57int pnv_smp_kick_cpu(int nr) 57static int pnv_smp_kick_cpu(int nr)
58{ 58{
59 unsigned int pcpu = get_hard_smp_processor_id(nr); 59 unsigned int pcpu = get_hard_smp_processor_id(nr);
60 unsigned long start_here = 60 unsigned long start_here =
@@ -168,9 +168,9 @@ static void pnv_smp_cpu_kill_self(void)
168 power7_nap(1); 168 power7_nap(1);
169 ppc64_runlatch_on(); 169 ppc64_runlatch_on();
170 170
171 /* Reenable IRQs briefly to clear the IPI that woke us */ 171 /* Clear the IPI that woke us up */
172 local_irq_enable(); 172 icp_native_flush_interrupt();
173 local_irq_disable(); 173 local_paca->irq_happened &= PACA_IRQ_HARD_DIS;
174 mb(); 174 mb();
175 175
176 if (cpu_core_split_required()) 176 if (cpu_core_split_required())
diff --git a/arch/powerpc/platforms/powernv/subcore.c b/arch/powerpc/platforms/powernv/subcore.c
index 894ecb3eb596..c87f96b79d1a 100644
--- a/arch/powerpc/platforms/powernv/subcore.c
+++ b/arch/powerpc/platforms/powernv/subcore.c
@@ -24,6 +24,7 @@
24#include <asm/smp.h> 24#include <asm/smp.h>
25 25
26#include "subcore.h" 26#include "subcore.h"
27#include "powernv.h"
27 28
28 29
29/* 30/*
diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index 2d8bf15879fd..fc44ad0475f8 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -555,7 +555,6 @@ static int cmm_mem_going_offline(void *arg)
555 pa_last = pa_last->next; 555 pa_last = pa_last->next;
556 free_page((unsigned long)cmm_page_list); 556 free_page((unsigned long)cmm_page_list);
557 cmm_page_list = pa_last; 557 cmm_page_list = pa_last;
558 continue;
559 } 558 }
560 } 559 }
561 pa_curr = pa_curr->next; 560 pa_curr = pa_curr->next;
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index a2450b8a50a5..fdf01b660d59 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -17,6 +17,7 @@
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/of.h> 18#include <linux/of.h>
19#include "offline_states.h" 19#include "offline_states.h"
20#include "pseries.h"
20 21
21#include <asm/prom.h> 22#include <asm/prom.h>
22#include <asm/machdep.h> 23#include <asm/machdep.h>
@@ -363,7 +364,8 @@ static int dlpar_online_cpu(struct device_node *dn)
363 int rc = 0; 364 int rc = 0;
364 unsigned int cpu; 365 unsigned int cpu;
365 int len, nthreads, i; 366 int len, nthreads, i;
366 const u32 *intserv; 367 const __be32 *intserv;
368 u32 thread;
367 369
368 intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", &len); 370 intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", &len);
369 if (!intserv) 371 if (!intserv)
@@ -373,8 +375,9 @@ static int dlpar_online_cpu(struct device_node *dn)
373 375
374 cpu_maps_update_begin(); 376 cpu_maps_update_begin();
375 for (i = 0; i < nthreads; i++) { 377 for (i = 0; i < nthreads; i++) {
378 thread = be32_to_cpu(intserv[i]);
376 for_each_present_cpu(cpu) { 379 for_each_present_cpu(cpu) {
377 if (get_hard_smp_processor_id(cpu) != intserv[i]) 380 if (get_hard_smp_processor_id(cpu) != thread)
378 continue; 381 continue;
379 BUG_ON(get_cpu_current_state(cpu) 382 BUG_ON(get_cpu_current_state(cpu)
380 != CPU_STATE_OFFLINE); 383 != CPU_STATE_OFFLINE);
@@ -388,7 +391,7 @@ static int dlpar_online_cpu(struct device_node *dn)
388 } 391 }
389 if (cpu == num_possible_cpus()) 392 if (cpu == num_possible_cpus())
390 printk(KERN_WARNING "Could not find cpu to online " 393 printk(KERN_WARNING "Could not find cpu to online "
391 "with physical id 0x%x\n", intserv[i]); 394 "with physical id 0x%x\n", thread);
392 } 395 }
393 cpu_maps_update_done(); 396 cpu_maps_update_done();
394 397
@@ -442,7 +445,8 @@ static int dlpar_offline_cpu(struct device_node *dn)
442 int rc = 0; 445 int rc = 0;
443 unsigned int cpu; 446 unsigned int cpu;
444 int len, nthreads, i; 447 int len, nthreads, i;
445 const u32 *intserv; 448 const __be32 *intserv;
449 u32 thread;
446 450
447 intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", &len); 451 intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", &len);
448 if (!intserv) 452 if (!intserv)
@@ -452,8 +456,9 @@ static int dlpar_offline_cpu(struct device_node *dn)
452 456
453 cpu_maps_update_begin(); 457 cpu_maps_update_begin();
454 for (i = 0; i < nthreads; i++) { 458 for (i = 0; i < nthreads; i++) {
459 thread = be32_to_cpu(intserv[i]);
455 for_each_present_cpu(cpu) { 460 for_each_present_cpu(cpu) {
456 if (get_hard_smp_processor_id(cpu) != intserv[i]) 461 if (get_hard_smp_processor_id(cpu) != thread)
457 continue; 462 continue;
458 463
459 if (get_cpu_current_state(cpu) == CPU_STATE_OFFLINE) 464 if (get_cpu_current_state(cpu) == CPU_STATE_OFFLINE)
@@ -475,14 +480,14 @@ static int dlpar_offline_cpu(struct device_node *dn)
475 * Upgrade it's state to CPU_STATE_OFFLINE. 480 * Upgrade it's state to CPU_STATE_OFFLINE.
476 */ 481 */
477 set_preferred_offline_state(cpu, CPU_STATE_OFFLINE); 482 set_preferred_offline_state(cpu, CPU_STATE_OFFLINE);
478 BUG_ON(plpar_hcall_norets(H_PROD, intserv[i]) 483 BUG_ON(plpar_hcall_norets(H_PROD, thread)
479 != H_SUCCESS); 484 != H_SUCCESS);
480 __cpu_die(cpu); 485 __cpu_die(cpu);
481 break; 486 break;
482 } 487 }
483 if (cpu == num_possible_cpus()) 488 if (cpu == num_possible_cpus())
484 printk(KERN_WARNING "Could not find cpu to offline " 489 printk(KERN_WARNING "Could not find cpu to offline "
485 "with physical id 0x%x\n", intserv[i]); 490 "with physical id 0x%x\n", thread);
486 } 491 }
487 cpu_maps_update_done(); 492 cpu_maps_update_done();
488 493
@@ -494,15 +499,15 @@ out:
494static ssize_t dlpar_cpu_release(const char *buf, size_t count) 499static ssize_t dlpar_cpu_release(const char *buf, size_t count)
495{ 500{
496 struct device_node *dn; 501 struct device_node *dn;
497 const u32 *drc_index; 502 u32 drc_index;
498 int rc; 503 int rc;
499 504
500 dn = of_find_node_by_path(buf); 505 dn = of_find_node_by_path(buf);
501 if (!dn) 506 if (!dn)
502 return -EINVAL; 507 return -EINVAL;
503 508
504 drc_index = of_get_property(dn, "ibm,my-drc-index", NULL); 509 rc = of_property_read_u32(dn, "ibm,my-drc-index", &drc_index);
505 if (!drc_index) { 510 if (rc) {
506 of_node_put(dn); 511 of_node_put(dn);
507 return -EINVAL; 512 return -EINVAL;
508 } 513 }
@@ -513,7 +518,7 @@ static ssize_t dlpar_cpu_release(const char *buf, size_t count)
513 return -EINVAL; 518 return -EINVAL;
514 } 519 }
515 520
516 rc = dlpar_release_drc(*drc_index); 521 rc = dlpar_release_drc(drc_index);
517 if (rc) { 522 if (rc) {
518 of_node_put(dn); 523 of_node_put(dn);
519 return rc; 524 return rc;
@@ -521,7 +526,7 @@ static ssize_t dlpar_cpu_release(const char *buf, size_t count)
521 526
522 rc = dlpar_detach_node(dn); 527 rc = dlpar_detach_node(dn);
523 if (rc) { 528 if (rc) {
524 dlpar_acquire_drc(*drc_index); 529 dlpar_acquire_drc(drc_index);
525 return rc; 530 return rc;
526 } 531 }
527 532
diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
index b08053819d99..a6c7e19f5eb3 100644
--- a/arch/powerpc/platforms/pseries/eeh_pseries.c
+++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
@@ -88,29 +88,14 @@ static int pseries_eeh_init(void)
88 * and its variant since the old firmware probably support address 88 * and its variant since the old firmware probably support address
89 * of domain/bus/slot/function for EEH RTAS operations. 89 * of domain/bus/slot/function for EEH RTAS operations.
90 */ 90 */
91 if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE) { 91 if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE ||
92 pr_warn("%s: RTAS service <ibm,set-eeh-option> invalid\n", 92 ibm_set_slot_reset == RTAS_UNKNOWN_SERVICE ||
93 __func__); 93 (ibm_read_slot_reset_state2 == RTAS_UNKNOWN_SERVICE &&
94 return -EINVAL; 94 ibm_read_slot_reset_state == RTAS_UNKNOWN_SERVICE) ||
95 } else if (ibm_set_slot_reset == RTAS_UNKNOWN_SERVICE) { 95 ibm_slot_error_detail == RTAS_UNKNOWN_SERVICE ||
96 pr_warn("%s: RTAS service <ibm,set-slot-reset> invalid\n", 96 (ibm_configure_pe == RTAS_UNKNOWN_SERVICE &&
97 __func__); 97 ibm_configure_bridge == RTAS_UNKNOWN_SERVICE)) {
98 return -EINVAL; 98 pr_info("EEH functionality not supported\n");
99 } else if (ibm_read_slot_reset_state2 == RTAS_UNKNOWN_SERVICE &&
100 ibm_read_slot_reset_state == RTAS_UNKNOWN_SERVICE) {
101 pr_warn("%s: RTAS service <ibm,read-slot-reset-state2> and "
102 "<ibm,read-slot-reset-state> invalid\n",
103 __func__);
104 return -EINVAL;
105 } else if (ibm_slot_error_detail == RTAS_UNKNOWN_SERVICE) {
106 pr_warn("%s: RTAS service <ibm,slot-error-detail> invalid\n",
107 __func__);
108 return -EINVAL;
109 } else if (ibm_configure_pe == RTAS_UNKNOWN_SERVICE &&
110 ibm_configure_bridge == RTAS_UNKNOWN_SERVICE) {
111 pr_warn("%s: RTAS service <ibm,configure-pe> and "
112 "<ibm,configure-bridge> invalid\n",
113 __func__);
114 return -EINVAL; 99 return -EINVAL;
115 } 100 }
116 101
@@ -118,11 +103,11 @@ static int pseries_eeh_init(void)
118 spin_lock_init(&slot_errbuf_lock); 103 spin_lock_init(&slot_errbuf_lock);
119 eeh_error_buf_size = rtas_token("rtas-error-log-max"); 104 eeh_error_buf_size = rtas_token("rtas-error-log-max");
120 if (eeh_error_buf_size == RTAS_UNKNOWN_SERVICE) { 105 if (eeh_error_buf_size == RTAS_UNKNOWN_SERVICE) {
121 pr_warn("%s: unknown EEH error log size\n", 106 pr_info("%s: unknown EEH error log size\n",
122 __func__); 107 __func__);
123 eeh_error_buf_size = 1024; 108 eeh_error_buf_size = 1024;
124 } else if (eeh_error_buf_size > RTAS_ERROR_LOG_MAX) { 109 } else if (eeh_error_buf_size > RTAS_ERROR_LOG_MAX) {
125 pr_warn("%s: EEH error log size %d exceeds the maximal %d\n", 110 pr_info("%s: EEH error log size %d exceeds the maximal %d\n",
126 __func__, eeh_error_buf_size, RTAS_ERROR_LOG_MAX); 111 __func__, eeh_error_buf_size, RTAS_ERROR_LOG_MAX);
127 eeh_error_buf_size = RTAS_ERROR_LOG_MAX; 112 eeh_error_buf_size = RTAS_ERROR_LOG_MAX;
128 } 113 }
@@ -349,7 +334,9 @@ static int pseries_eeh_set_option(struct eeh_pe *pe, int option)
349 if (pe->addr) 334 if (pe->addr)
350 config_addr = pe->addr; 335 config_addr = pe->addr;
351 break; 336 break;
352 337 case EEH_OPT_FREEZE_PE:
338 /* Not support */
339 return 0;
353 default: 340 default:
354 pr_err("%s: Invalid option %d\n", 341 pr_err("%s: Invalid option %d\n",
355 __func__, option); 342 __func__, option);
@@ -729,6 +716,7 @@ static struct eeh_ops pseries_eeh_ops = {
729 .wait_state = pseries_eeh_wait_state, 716 .wait_state = pseries_eeh_wait_state,
730 .get_log = pseries_eeh_get_log, 717 .get_log = pseries_eeh_get_log,
731 .configure_bridge = pseries_eeh_configure_bridge, 718 .configure_bridge = pseries_eeh_configure_bridge,
719 .err_inject = NULL,
732 .read_config = pseries_eeh_read_config, 720 .read_config = pseries_eeh_read_config,
733 .write_config = pseries_eeh_write_config, 721 .write_config = pseries_eeh_write_config,
734 .next_error = NULL, 722 .next_error = NULL,
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 20d62975856f..b174fa751d26 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -90,7 +90,7 @@ static void rtas_stop_self(void)
90{ 90{
91 static struct rtas_args args = { 91 static struct rtas_args args = {
92 .nargs = 0, 92 .nargs = 0,
93 .nret = 1, 93 .nret = cpu_to_be32(1),
94 .rets = &args.args[0], 94 .rets = &args.args[0],
95 }; 95 };
96 96
@@ -312,7 +312,8 @@ static void pseries_remove_processor(struct device_node *np)
312{ 312{
313 unsigned int cpu; 313 unsigned int cpu;
314 int len, nthreads, i; 314 int len, nthreads, i;
315 const u32 *intserv; 315 const __be32 *intserv;
316 u32 thread;
316 317
317 intserv = of_get_property(np, "ibm,ppc-interrupt-server#s", &len); 318 intserv = of_get_property(np, "ibm,ppc-interrupt-server#s", &len);
318 if (!intserv) 319 if (!intserv)
@@ -322,8 +323,9 @@ static void pseries_remove_processor(struct device_node *np)
322 323
323 cpu_maps_update_begin(); 324 cpu_maps_update_begin();
324 for (i = 0; i < nthreads; i++) { 325 for (i = 0; i < nthreads; i++) {
326 thread = be32_to_cpu(intserv[i]);
325 for_each_present_cpu(cpu) { 327 for_each_present_cpu(cpu) {
326 if (get_hard_smp_processor_id(cpu) != intserv[i]) 328 if (get_hard_smp_processor_id(cpu) != thread)
327 continue; 329 continue;
328 BUG_ON(cpu_online(cpu)); 330 BUG_ON(cpu_online(cpu));
329 set_cpu_present(cpu, false); 331 set_cpu_present(cpu, false);
@@ -332,7 +334,7 @@ static void pseries_remove_processor(struct device_node *np)
332 } 334 }
333 if (cpu >= nr_cpu_ids) 335 if (cpu >= nr_cpu_ids)
334 printk(KERN_WARNING "Could not find cpu to remove " 336 printk(KERN_WARNING "Could not find cpu to remove "
335 "with physical id 0x%x\n", intserv[i]); 337 "with physical id 0x%x\n", thread);
336 } 338 }
337 cpu_maps_update_done(); 339 cpu_maps_update_done();
338} 340}
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 34064f50945e..3c4c0dcd90d3 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -20,6 +20,7 @@
20#include <asm/machdep.h> 20#include <asm/machdep.h>
21#include <asm/prom.h> 21#include <asm/prom.h>
22#include <asm/sparsemem.h> 22#include <asm/sparsemem.h>
23#include "pseries.h"
23 24
24unsigned long pseries_memory_block_size(void) 25unsigned long pseries_memory_block_size(void)
25{ 26{
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 4642d6a4d356..de1ec54a2a57 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -329,16 +329,16 @@ struct direct_window {
329 329
330/* Dynamic DMA Window support */ 330/* Dynamic DMA Window support */
331struct ddw_query_response { 331struct ddw_query_response {
332 __be32 windows_available; 332 u32 windows_available;
333 __be32 largest_available_block; 333 u32 largest_available_block;
334 __be32 page_size; 334 u32 page_size;
335 __be32 migration_capable; 335 u32 migration_capable;
336}; 336};
337 337
338struct ddw_create_response { 338struct ddw_create_response {
339 __be32 liobn; 339 u32 liobn;
340 __be32 addr_hi; 340 u32 addr_hi;
341 __be32 addr_lo; 341 u32 addr_lo;
342}; 342};
343 343
344static LIST_HEAD(direct_window_list); 344static LIST_HEAD(direct_window_list);
@@ -725,16 +725,18 @@ static void remove_ddw(struct device_node *np, bool remove_prop)
725{ 725{
726 struct dynamic_dma_window_prop *dwp; 726 struct dynamic_dma_window_prop *dwp;
727 struct property *win64; 727 struct property *win64;
728 const u32 *ddw_avail; 728 u32 ddw_avail[3];
729 u64 liobn; 729 u64 liobn;
730 int len, ret = 0; 730 int ret = 0;
731
732 ret = of_property_read_u32_array(np, "ibm,ddw-applicable",
733 &ddw_avail[0], 3);
731 734
732 ddw_avail = of_get_property(np, "ibm,ddw-applicable", &len);
733 win64 = of_find_property(np, DIRECT64_PROPNAME, NULL); 735 win64 = of_find_property(np, DIRECT64_PROPNAME, NULL);
734 if (!win64) 736 if (!win64)
735 return; 737 return;
736 738
737 if (!ddw_avail || len < 3 * sizeof(u32) || win64->length < sizeof(*dwp)) 739 if (ret || win64->length < sizeof(*dwp))
738 goto delprop; 740 goto delprop;
739 741
740 dwp = win64->value; 742 dwp = win64->value;
@@ -872,8 +874,9 @@ static int create_ddw(struct pci_dev *dev, const u32 *ddw_avail,
872 874
873 do { 875 do {
874 /* extra outputs are LIOBN and dma-addr (hi, lo) */ 876 /* extra outputs are LIOBN and dma-addr (hi, lo) */
875 ret = rtas_call(ddw_avail[1], 5, 4, (u32 *)create, cfg_addr, 877 ret = rtas_call(ddw_avail[1], 5, 4, (u32 *)create,
876 BUID_HI(buid), BUID_LO(buid), page_shift, window_shift); 878 cfg_addr, BUID_HI(buid), BUID_LO(buid),
879 page_shift, window_shift);
877 } while (rtas_busy_delay(ret)); 880 } while (rtas_busy_delay(ret));
878 dev_info(&dev->dev, 881 dev_info(&dev->dev,
879 "ibm,create-pe-dma-window(%x) %x %x %x %x %x returned %d " 882 "ibm,create-pe-dma-window(%x) %x %x %x %x %x returned %d "
@@ -910,7 +913,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
910 int page_shift; 913 int page_shift;
911 u64 dma_addr, max_addr; 914 u64 dma_addr, max_addr;
912 struct device_node *dn; 915 struct device_node *dn;
913 const u32 *uninitialized_var(ddw_avail); 916 u32 ddw_avail[3];
914 struct direct_window *window; 917 struct direct_window *window;
915 struct property *win64; 918 struct property *win64;
916 struct dynamic_dma_window_prop *ddwprop; 919 struct dynamic_dma_window_prop *ddwprop;
@@ -942,8 +945,9 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
942 * for the given node in that order. 945 * for the given node in that order.
943 * the property is actually in the parent, not the PE 946 * the property is actually in the parent, not the PE
944 */ 947 */
945 ddw_avail = of_get_property(pdn, "ibm,ddw-applicable", &len); 948 ret = of_property_read_u32_array(pdn, "ibm,ddw-applicable",
946 if (!ddw_avail || len < 3 * sizeof(u32)) 949 &ddw_avail[0], 3);
950 if (ret)
947 goto out_failed; 951 goto out_failed;
948 952
949 /* 953 /*
@@ -966,11 +970,11 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
966 dev_dbg(&dev->dev, "no free dynamic windows"); 970 dev_dbg(&dev->dev, "no free dynamic windows");
967 goto out_failed; 971 goto out_failed;
968 } 972 }
969 if (be32_to_cpu(query.page_size) & 4) { 973 if (query.page_size & 4) {
970 page_shift = 24; /* 16MB */ 974 page_shift = 24; /* 16MB */
971 } else if (be32_to_cpu(query.page_size) & 2) { 975 } else if (query.page_size & 2) {
972 page_shift = 16; /* 64kB */ 976 page_shift = 16; /* 64kB */
973 } else if (be32_to_cpu(query.page_size) & 1) { 977 } else if (query.page_size & 1) {
974 page_shift = 12; /* 4kB */ 978 page_shift = 12; /* 4kB */
975 } else { 979 } else {
976 dev_dbg(&dev->dev, "no supported direct page size in mask %x", 980 dev_dbg(&dev->dev, "no supported direct page size in mask %x",
@@ -980,7 +984,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
980 /* verify the window * number of ptes will map the partition */ 984 /* verify the window * number of ptes will map the partition */
981 /* check largest block * page size > max memory hotplug addr */ 985 /* check largest block * page size > max memory hotplug addr */
982 max_addr = memory_hotplug_max(); 986 max_addr = memory_hotplug_max();
983 if (be32_to_cpu(query.largest_available_block) < (max_addr >> page_shift)) { 987 if (query.largest_available_block < (max_addr >> page_shift)) {
984 dev_dbg(&dev->dev, "can't map partiton max 0x%llx with %u " 988 dev_dbg(&dev->dev, "can't map partiton max 0x%llx with %u "
985 "%llu-sized pages\n", max_addr, query.largest_available_block, 989 "%llu-sized pages\n", max_addr, query.largest_available_block,
986 1ULL << page_shift); 990 1ULL << page_shift);
@@ -1006,8 +1010,9 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
1006 if (ret != 0) 1010 if (ret != 0)
1007 goto out_free_prop; 1011 goto out_free_prop;
1008 1012
1009 ddwprop->liobn = create.liobn; 1013 ddwprop->liobn = cpu_to_be32(create.liobn);
1010 ddwprop->dma_base = cpu_to_be64(of_read_number(&create.addr_hi, 2)); 1014 ddwprop->dma_base = cpu_to_be64(((u64)create.addr_hi << 32) |
1015 create.addr_lo);
1011 ddwprop->tce_shift = cpu_to_be32(page_shift); 1016 ddwprop->tce_shift = cpu_to_be32(page_shift);
1012 ddwprop->window_shift = cpu_to_be32(len); 1017 ddwprop->window_shift = cpu_to_be32(len);
1013 1018
@@ -1039,7 +1044,7 @@ static u64 enable_ddw(struct pci_dev *dev, struct device_node *pdn)
1039 list_add(&window->list, &direct_window_list); 1044 list_add(&window->list, &direct_window_list);
1040 spin_unlock(&direct_window_list_lock); 1045 spin_unlock(&direct_window_list_lock);
1041 1046
1042 dma_addr = of_read_number(&create.addr_hi, 2); 1047 dma_addr = be64_to_cpu(ddwprop->dma_base);
1043 goto out_unlock; 1048 goto out_unlock;
1044 1049
1045out_free_window: 1050out_free_window:
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 34e64237fff9..8c509d5397c6 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -59,8 +59,6 @@ EXPORT_SYMBOL(plpar_hcall);
59EXPORT_SYMBOL(plpar_hcall9); 59EXPORT_SYMBOL(plpar_hcall9);
60EXPORT_SYMBOL(plpar_hcall_norets); 60EXPORT_SYMBOL(plpar_hcall_norets);
61 61
62extern void pSeries_find_serial_port(void);
63
64void vpa_init(int cpu) 62void vpa_init(int cpu)
65{ 63{
66 int hwcpu = get_hard_smp_processor_id(cpu); 64 int hwcpu = get_hard_smp_processor_id(cpu);
@@ -642,7 +640,7 @@ EXPORT_SYMBOL(arch_free_page);
642#endif 640#endif
643 641
644#ifdef CONFIG_TRACEPOINTS 642#ifdef CONFIG_TRACEPOINTS
645#ifdef CONFIG_JUMP_LABEL 643#ifdef HAVE_JUMP_LABEL
646struct static_key hcall_tracepoint_key = STATIC_KEY_INIT; 644struct static_key hcall_tracepoint_key = STATIC_KEY_INIT;
647 645
648void hcall_tracepoint_regfunc(void) 646void hcall_tracepoint_regfunc(void)
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index 0cc240b7f694..11a3b617ef5d 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -276,8 +276,10 @@ static ssize_t pSeries_nvram_get_size(void)
276 * sequence #: The unique sequence # for each event. (until it wraps) 276 * sequence #: The unique sequence # for each event. (until it wraps)
277 * error log: The error log from event_scan 277 * error log: The error log from event_scan
278 */ 278 */
279int nvram_write_os_partition(struct nvram_os_partition *part, char * buff, 279static int nvram_write_os_partition(struct nvram_os_partition *part,
280 int length, unsigned int err_type, unsigned int error_log_cnt) 280 char *buff, int length,
281 unsigned int err_type,
282 unsigned int error_log_cnt)
281{ 283{
282 int rc; 284 int rc;
283 loff_t tmp_index; 285 loff_t tmp_index;
@@ -330,9 +332,9 @@ int nvram_write_error_log(char * buff, int length,
330 * 332 *
331 * Reads nvram partition for at most 'length' 333 * Reads nvram partition for at most 'length'
332 */ 334 */
333int nvram_read_partition(struct nvram_os_partition *part, char *buff, 335static int nvram_read_partition(struct nvram_os_partition *part, char *buff,
334 int length, unsigned int *err_type, 336 int length, unsigned int *err_type,
335 unsigned int *error_log_cnt) 337 unsigned int *error_log_cnt)
336{ 338{
337 int rc; 339 int rc;
338 loff_t tmp_index; 340 loff_t tmp_index;
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index c413ec158ff5..67e48594040c 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -29,6 +29,7 @@
29#include <asm/pci-bridge.h> 29#include <asm/pci-bridge.h>
30#include <asm/prom.h> 30#include <asm/prom.h>
31#include <asm/ppc-pci.h> 31#include <asm/ppc-pci.h>
32#include "pseries.h"
32 33
33#if 0 34#if 0
34void pcibios_name_device(struct pci_dev *dev) 35void pcibios_name_device(struct pci_dev *dev)
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index dff05b9eb946..5a4d0fc03b03 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -126,7 +126,7 @@ struct epow_errorlog {
126#define EPOW_MAIN_ENCLOSURE 5 126#define EPOW_MAIN_ENCLOSURE 5
127#define EPOW_POWER_OFF 7 127#define EPOW_POWER_OFF 7
128 128
129void rtas_parse_epow_errlog(struct rtas_error_log *log) 129static void rtas_parse_epow_errlog(struct rtas_error_log *log)
130{ 130{
131 struct pseries_errorlog *pseries_log; 131 struct pseries_errorlog *pseries_log;
132 struct epow_errorlog *epow_log; 132 struct epow_errorlog *epow_log;
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index e724d3186e73..125c589eeef5 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -561,7 +561,7 @@ void pSeries_coalesce_init(void)
561 * fw_cmo_feature_init - FW_FEATURE_CMO is not stored in ibm,hypertas-functions, 561 * fw_cmo_feature_init - FW_FEATURE_CMO is not stored in ibm,hypertas-functions,
562 * handle that here. (Stolen from parse_system_parameter_string) 562 * handle that here. (Stolen from parse_system_parameter_string)
563 */ 563 */
564void pSeries_cmo_feature_init(void) 564static void pSeries_cmo_feature_init(void)
565{ 565{
566 char *ptr, *key, *value, *end; 566 char *ptr, *key, *value, *end;
567 int call_status; 567 int call_status;