aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2013-09-06 22:53:35 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2013-09-06 22:53:35 -0400
commiteeca9fad52fc4bfdf42c38bfcf383e932eb3e9d6 (patch)
treecc51c880459d41c0e8d7576405bef4c987bc7aa0 /arch
parentff6f83fc9d44db09997937c3475d525a6866fbb4 (diff)
parentb48a97be8e6c2afdba2f3b61fd88c3c7743fbd73 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
Merge upstream tree in order to reinstate crct10dif.
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/Kconfig1
-rw-r--r--arch/alpha/include/asm/atomic.h88
-rw-r--r--arch/alpha/include/asm/param.h8
-rw-r--r--arch/alpha/include/asm/spinlock.h4
-rw-r--r--arch/alpha/include/asm/unistd.h3
-rw-r--r--arch/alpha/include/uapi/asm/fcntl.h2
-rw-r--r--arch/alpha/include/uapi/asm/param.h7
-rw-r--r--arch/alpha/include/uapi/asm/socket.h2
-rw-r--r--arch/alpha/include/uapi/asm/unistd.h2
-rw-r--r--arch/alpha/kernel/entry.S399
-rw-r--r--arch/alpha/kernel/irq_alpha.c2
-rw-r--r--arch/alpha/kernel/smp.c15
-rw-r--r--arch/alpha/kernel/sys_dp264.c8
-rw-r--r--arch/alpha/kernel/sys_marvel.c3
-rw-r--r--arch/alpha/kernel/systbls.S2
-rw-r--r--arch/alpha/kernel/time.c4
-rw-r--r--arch/alpha/kernel/traps.c12
-rw-r--r--arch/arc/boot/dts/abilis_tb100.dtsi32
-rw-r--r--arch/arc/boot/dts/abilis_tb101.dtsi32
-rw-r--r--arch/arc/boot/dts/abilis_tb10x.dtsi32
-rw-r--r--arch/arc/boot/dts/angel4.dts16
-rw-r--r--arch/arc/configs/fpga_defconfig3
-rw-r--r--arch/arc/mm/fault.c6
-rw-r--r--arch/arc/plat-arcfpga/include/plat/irq.h2
-rw-r--r--arch/arc/plat-arcfpga/include/plat/memmap.h2
-rw-r--r--arch/arc/plat-tb10x/Kconfig1
-rw-r--r--arch/arm/Kconfig4
-rw-r--r--arch/arm/Kconfig.debug20
-rw-r--r--arch/arm/boot/compressed/.gitignore1
-rw-r--r--arch/arm/boot/compressed/Makefile3
-rw-r--r--arch/arm/boot/compressed/decompress.c4
-rw-r--r--arch/arm/boot/compressed/piggy.lz4.S6
-rw-r--r--arch/arm/boot/dts/am335x-bone.dts2
-rw-r--r--arch/arm/boot/dts/am335x-evm.dts16
-rw-r--r--arch/arm/boot/dts/am335x-evmsk.dts10
-rw-r--r--arch/arm/boot/dts/am33xx.dtsi17
-rw-r--r--arch/arm/boot/dts/cros5250-common.dtsi4
-rw-r--r--arch/arm/boot/dts/exynos5250-smdk5250.dts4
-rw-r--r--arch/arm/boot/dts/exynos5250.dtsi4
-rw-r--r--arch/arm/boot/dts/imx28-evk.dts12
-rw-r--r--arch/arm/boot/dts/sun4i-a10-cubieboard.dts15
-rw-r--r--arch/arm/boot/dts/sun4i-a10-hackberry.dts41
-rw-r--r--arch/arm/boot/dts/sun4i-a10.dtsi27
-rw-r--r--arch/arm/boot/dts/tegra20-seaboard.dts1
-rw-r--r--arch/arm/boot/dts/tegra20-trimslice.dts1
-rw-r--r--arch/arm/boot/dts/tegra20-whistler.dts2
-rw-r--r--arch/arm/common/mcpm_platsmp.c4
-rw-r--r--arch/arm/common/timer-sp.c2
-rw-r--r--arch/arm/configs/bcm_defconfig7
-rw-r--r--arch/arm/configs/multi_v7_defconfig133
-rw-r--r--arch/arm/configs/omap2plus_defconfig20
-rw-r--r--arch/arm/configs/spear13xx_defconfig1
-rw-r--r--arch/arm/configs/u8500_defconfig44
-rw-r--r--arch/arm/include/asm/arch_timer.h2
-rw-r--r--arch/arm/include/asm/hardware/iop3xx.h3
-rw-r--r--arch/arm/include/asm/mach/arch.h5
-rw-r--r--arch/arm/include/asm/sched_clock.h18
-rw-r--r--arch/arm/include/asm/smp_scu.h13
-rw-r--r--arch/arm/include/asm/system_misc.h3
-rw-r--r--arch/arm/include/asm/xen/hypercall.h1
-rw-r--r--arch/arm/kernel/Makefile2
-rw-r--r--arch/arm/kernel/arch_timer.c2
-rw-r--r--arch/arm/kernel/head-common.S4
-rw-r--r--arch/arm/kernel/head-nommu.S1
-rw-r--r--arch/arm/kernel/head.S1
-rw-r--r--arch/arm/kernel/hw_breakpoint.c4
-rw-r--r--arch/arm/kernel/perf_event_cpu.c6
-rw-r--r--arch/arm/kernel/process.c15
-rw-r--r--arch/arm/kernel/psci_smp.c3
-rw-r--r--arch/arm/kernel/ptrace.c8
-rw-r--r--arch/arm/kernel/sched_clock.c217
-rw-r--r--arch/arm/kernel/setup.c6
-rw-r--r--arch/arm/kernel/smp.c18
-rw-r--r--arch/arm/kernel/smp_twd.c8
-rw-r--r--arch/arm/kernel/time.c4
-rw-r--r--arch/arm/lib/delay.c2
-rw-r--r--arch/arm/mach-at91/at91rm9200.c3
-rw-r--r--arch/arm/mach-at91/generic.h5
-rw-r--r--arch/arm/mach-bcm2835/bcm2835.c4
-rw-r--r--arch/arm/mach-clps711x/common.c2
-rw-r--r--arch/arm/mach-clps711x/common.h4
-rw-r--r--arch/arm/mach-cns3xxx/core.h4
-rw-r--r--arch/arm/mach-cns3xxx/pm.c2
-rw-r--r--arch/arm/mach-davinci/board-dm365-evm.c1
-rw-r--r--arch/arm/mach-davinci/devices-da8xx.c3
-rw-r--r--arch/arm/mach-davinci/devices.c3
-rw-r--r--arch/arm/mach-davinci/include/mach/common.h3
-rw-r--r--arch/arm/mach-davinci/include/mach/da8xx.h3
-rw-r--r--arch/arm/mach-davinci/include/mach/tnetv107x.h3
-rw-r--r--arch/arm/mach-davinci/time.c2
-rw-r--r--arch/arm/mach-davinci/tnetv107x.c3
-rw-r--r--arch/arm/mach-dove/common.c2
-rw-r--r--arch/arm/mach-dove/common.h4
-rw-r--r--arch/arm/mach-dove/include/mach/bridge-regs.h1
-rw-r--r--arch/arm/mach-ebsa110/core.c3
-rw-r--r--arch/arm/mach-ep93xx/core.c3
-rw-r--r--arch/arm/mach-ep93xx/include/mach/platform.h4
-rw-r--r--arch/arm/mach-exynos/Kconfig2
-rw-r--r--arch/arm/mach-exynos/common.c4
-rw-r--r--arch/arm/mach-exynos/common.h5
-rw-r--r--arch/arm/mach-exynos/headsmp.S2
-rw-r--r--arch/arm/mach-exynos/platsmp.c4
-rw-r--r--arch/arm/mach-footbridge/cats-hw.c2
-rw-r--r--arch/arm/mach-footbridge/common.c4
-rw-r--r--arch/arm/mach-footbridge/common.h3
-rw-r--r--arch/arm/mach-footbridge/netwinder-hw.c4
-rw-r--r--arch/arm/mach-highbank/core.h4
-rw-r--r--arch/arm/mach-highbank/platsmp.c2
-rw-r--r--arch/arm/mach-highbank/system.c5
-rw-r--r--arch/arm/mach-imx/Kconfig4
-rw-r--r--arch/arm/mach-imx/common.h4
-rw-r--r--arch/arm/mach-imx/devices-imx25.h8
-rw-r--r--arch/arm/mach-imx/devices-imx35.h8
-rw-r--r--arch/arm/mach-imx/devices/Kconfig1
-rw-r--r--arch/arm/mach-imx/devices/devices-common.h4
-rw-r--r--arch/arm/mach-imx/devices/platform-flexcan.c5
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c2
-rw-r--r--arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c2
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c3
-rw-r--r--arch/arm/mach-imx/mach-mx25_3ds.c2
-rw-r--r--arch/arm/mach-imx/mach-pcm043.c2
-rw-r--r--arch/arm/mach-imx/platsmp.c2
-rw-r--r--arch/arm/mach-imx/system.c2
-rw-r--r--arch/arm/mach-imx/time.c2
-rw-r--r--arch/arm/mach-integrator/common.h3
-rw-r--r--arch/arm/mach-integrator/core.c2
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c2
-rw-r--r--arch/arm/mach-iop13xx/include/mach/iop13xx.h5
-rw-r--r--arch/arm/mach-iop13xx/setup.c2
-rw-r--r--arch/arm/mach-iop32x/n2100.c2
-rw-r--r--arch/arm/mach-ixp4xx/common.c6
-rw-r--r--arch/arm/mach-ixp4xx/dsmg600-setup.c2
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/platform.h4
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/timex.h2
-rw-r--r--arch/arm/mach-ixp4xx/omixp-setup.c2
-rw-r--r--arch/arm/mach-keystone/platsmp.c2
-rw-r--r--arch/arm/mach-kirkwood/common.c3
-rw-r--r--arch/arm/mach-kirkwood/common.h4
-rw-r--r--arch/arm/mach-kirkwood/include/mach/bridge-regs.h2
-rw-r--r--arch/arm/mach-ks8695/generic.h2
-rw-r--r--arch/arm/mach-ks8695/time.c4
-rw-r--r--arch/arm/mach-lpc32xx/common.c6
-rw-r--r--arch/arm/mach-lpc32xx/common.h3
-rw-r--r--arch/arm/mach-lpc32xx/phy3250.c4
-rw-r--r--arch/arm/mach-mmp/common.c2
-rw-r--r--arch/arm/mach-mmp/common.h3
-rw-r--r--arch/arm/mach-mmp/include/mach/pxa168.h4
-rw-r--r--arch/arm/mach-mmp/pxa168.c2
-rw-r--r--arch/arm/mach-mmp/time.c2
-rw-r--r--arch/arm/mach-msm/headsmp.S2
-rw-r--r--arch/arm/mach-msm/platsmp.c6
-rw-r--r--arch/arm/mach-msm/timer.c6
-rw-r--r--arch/arm/mach-mv78xx0/common.c2
-rw-r--r--arch/arm/mach-mv78xx0/common.h4
-rw-r--r--arch/arm/mach-mvebu/coherency.c2
-rw-r--r--arch/arm/mach-mvebu/common.h4
-rw-r--r--arch/arm/mach-mvebu/headsmp.S2
-rw-r--r--arch/arm/mach-mvebu/platsmp.c5
-rw-r--r--arch/arm/mach-mvebu/system-controller.c3
-rw-r--r--arch/arm/mach-mxs/Kconfig1
-rw-r--r--arch/arm/mach-mxs/mach-mxs.c53
-rw-r--r--arch/arm/mach-netx/generic.c3
-rw-r--r--arch/arm/mach-netx/generic.h4
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.c2
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c3
-rw-r--r--arch/arm/mach-omap1/common.h3
-rw-r--r--arch/arm/mach-omap1/reset.c3
-rw-r--r--arch/arm/mach-omap1/time.c2
-rw-r--r--arch/arm/mach-omap2/Kconfig153
-rw-r--r--arch/arm/mach-omap2/Makefile4
-rw-r--r--arch/arm/mach-omap2/am33xx-restart.c3
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c31
-rw-r--r--arch/arm/mach-omap2/board-rx51-video.c2
-rw-r--r--arch/arm/mach-omap2/common.h17
-rw-r--r--arch/arm/mach-omap2/devices.c5
-rw-r--r--arch/arm/mach-omap2/fb.c5
-rw-r--r--arch/arm/mach-omap2/gpmc.c2
-rw-r--r--arch/arm/mach-omap2/io.c2
-rw-r--r--arch/arm/mach-omap2/omap-headsmp.S2
-rw-r--r--arch/arm/mach-omap2/omap-mpuss-lowpower.c2
-rw-r--r--arch/arm/mach-omap2/omap-smp.c4
-rw-r--r--arch/arm/mach-omap2/omap-wakeupgen.c4
-rw-r--r--arch/arm/mach-omap2/omap2-restart.c2
-rw-r--r--arch/arm/mach-omap2/omap3-restart.c3
-rw-r--r--arch/arm/mach-omap2/omap4-common.c1
-rw-r--r--arch/arm/mach-omap2/omap4-restart.c3
-rw-r--r--arch/arm/mach-omap2/pmu.c5
-rw-r--r--arch/arm/mach-omap2/sleep44xx.S6
-rw-r--r--arch/arm/mach-omap2/timer.c4
-rw-r--r--arch/arm/mach-orion5x/common.c2
-rw-r--r--arch/arm/mach-orion5x/common.h4
-rw-r--r--arch/arm/mach-orion5x/include/mach/bridge-regs.h3
-rw-r--r--arch/arm/mach-orion5x/ls-chl-setup.c2
-rw-r--r--arch/arm/mach-orion5x/ls_hgl-setup.c2
-rw-r--r--arch/arm/mach-orion5x/lsmini-setup.c2
-rw-r--r--arch/arm/mach-picoxcell/common.c3
-rw-r--r--arch/arm/mach-prima2/common.h4
-rw-r--r--arch/arm/mach-prima2/headsmp.S2
-rw-r--r--arch/arm/mach-prima2/platsmp.c4
-rw-r--r--arch/arm/mach-prima2/rstc.c3
-rw-r--r--arch/arm/mach-pxa/corgi.c6
-rw-r--r--arch/arm/mach-pxa/generic.h4
-rw-r--r--arch/arm/mach-pxa/mioa701.c8
-rw-r--r--arch/arm/mach-pxa/poodle.c2
-rw-r--r--arch/arm/mach-pxa/reset.c8
-rw-r--r--arch/arm/mach-pxa/spitz.c8
-rw-r--r--arch/arm/mach-pxa/time.c2
-rw-r--r--arch/arm/mach-pxa/tosa.c6
-rw-r--r--arch/arm/mach-realview/realview_eb.c3
-rw-r--r--arch/arm/mach-realview/realview_pb1176.c3
-rw-r--r--arch/arm/mach-realview/realview_pb11mp.c3
-rw-r--r--arch/arm/mach-realview/realview_pba8.c3
-rw-r--r--arch/arm/mach-realview/realview_pbx.c3
-rw-r--r--arch/arm/mach-rpc/riscpc.c3
-rw-r--r--arch/arm/mach-s3c24xx/Kconfig2
-rw-r--r--arch/arm/mach-s3c24xx/common.h12
-rw-r--r--arch/arm/mach-s3c24xx/s3c2410.c5
-rw-r--r--arch/arm/mach-s3c24xx/s3c2412.c5
-rw-r--r--arch/arm/mach-s3c24xx/s3c2416.c5
-rw-r--r--arch/arm/mach-s3c24xx/s3c2443.c5
-rw-r--r--arch/arm/mach-s3c24xx/s3c244x.c5
-rw-r--r--arch/arm/mach-s3c64xx/common.c5
-rw-r--r--arch/arm/mach-s3c64xx/common.h4
-rw-r--r--arch/arm/mach-s5p64x0/common.c5
-rw-r--r--arch/arm/mach-s5p64x0/common.h4
-rw-r--r--arch/arm/mach-s5pc100/common.c5
-rw-r--r--arch/arm/mach-s5pc100/common.h4
-rw-r--r--arch/arm/mach-s5pv210/common.c2
-rw-r--r--arch/arm/mach-s5pv210/common.h4
-rw-r--r--arch/arm/mach-s5pv210/mach-aquila.c8
-rw-r--r--arch/arm/mach-s5pv210/mach-goni.c8
-rw-r--r--arch/arm/mach-sa1100/generic.c5
-rw-r--r--arch/arm/mach-sa1100/generic.h3
-rw-r--r--arch/arm/mach-sa1100/time.c2
-rw-r--r--arch/arm/mach-shark/core.c3
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c5
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c3
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c2
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7778.c2
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7779.c2
-rw-r--r--arch/arm/mach-shmobile/headsmp-scu.S1
-rw-r--r--arch/arm/mach-shmobile/headsmp.S2
-rw-r--r--arch/arm/mach-shmobile/setup-emev2.c8
-rw-r--r--arch/arm/mach-shmobile/setup-r8a73a4.c2
-rw-r--r--arch/arm/mach-shmobile/smp-emev2.c2
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7779.c2
-rw-r--r--arch/arm/mach-shmobile/smp-sh73a0.c2
-rw-r--r--arch/arm/mach-socfpga/headsmp.S1
-rw-r--r--arch/arm/mach-socfpga/platsmp.c2
-rw-r--r--arch/arm/mach-socfpga/socfpga.c5
-rw-r--r--arch/arm/mach-spear/generic.h6
-rw-r--r--arch/arm/mach-spear/platsmp.c4
-rw-r--r--arch/arm/mach-spear/restart.c5
-rw-r--r--arch/arm/mach-spear/spear3xx.c4
-rw-r--r--arch/arm/mach-spear/spear6xx.c4
-rw-r--r--arch/arm/mach-sti/platsmp.c6
-rw-r--r--arch/arm/mach-sunxi/sunxi.c3
-rw-r--r--arch/arm/mach-tegra/board.h3
-rw-r--r--arch/arm/mach-tegra/common.c3
-rw-r--r--arch/arm/mach-tegra/platsmp.c4
-rw-r--r--arch/arm/mach-tegra/pm.c2
-rw-r--r--arch/arm/mach-u300/core.c6
-rw-r--r--arch/arm/mach-u300/timer.c2
-rw-r--r--arch/arm/mach-ux500/platsmp.c4
-rw-r--r--arch/arm/mach-versatile/core.c3
-rw-r--r--arch/arm/mach-versatile/core.h3
-rw-r--r--arch/arm/mach-vt8500/vt8500.c3
-rw-r--r--arch/arm/mach-w90x900/cpu.c4
-rw-r--r--arch/arm/mach-w90x900/nuc9xx.h5
-rw-r--r--arch/arm/mach-zynq/common.c2
-rw-r--r--arch/arm/mach-zynq/common.h2
-rw-r--r--arch/arm/mach-zynq/headsmp.S2
-rw-r--r--arch/arm/mach-zynq/platsmp.c6
-rw-r--r--arch/arm/mm/dma-mapping.c40
-rw-r--r--arch/arm/mm/init.c2
-rw-r--r--arch/arm/mm/mmap.c2
-rw-r--r--arch/arm/mm/mmu.c2
-rw-r--r--arch/arm/mm/proc-arm1020.S2
-rw-r--r--arch/arm/mm/proc-arm1020e.S2
-rw-r--r--arch/arm/mm/proc-arm1022.S2
-rw-r--r--arch/arm/mm/proc-arm1026.S3
-rw-r--r--arch/arm/mm/proc-arm720.S2
-rw-r--r--arch/arm/mm/proc-arm740.S2
-rw-r--r--arch/arm/mm/proc-arm7tdmi.S2
-rw-r--r--arch/arm/mm/proc-arm920.S2
-rw-r--r--arch/arm/mm/proc-arm922.S2
-rw-r--r--arch/arm/mm/proc-arm925.S2
-rw-r--r--arch/arm/mm/proc-arm926.S2
-rw-r--r--arch/arm/mm/proc-arm940.S2
-rw-r--r--arch/arm/mm/proc-arm946.S2
-rw-r--r--arch/arm/mm/proc-arm9tdmi.S2
-rw-r--r--arch/arm/mm/proc-fa526.S2
-rw-r--r--arch/arm/mm/proc-feroceon.S2
-rw-r--r--arch/arm/mm/proc-mohawk.S2
-rw-r--r--arch/arm/mm/proc-sa110.S2
-rw-r--r--arch/arm/mm/proc-sa1100.S2
-rw-r--r--arch/arm/mm/proc-v6.S2
-rw-r--r--arch/arm/mm/proc-v7-2level.S4
-rw-r--r--arch/arm/mm/proc-v7-3level.S4
-rw-r--r--arch/arm/mm/proc-v7.S2
-rw-r--r--arch/arm/mm/proc-xsc3.S2
-rw-r--r--arch/arm/mm/proc-xscale.S2
-rw-r--r--arch/arm/net/bpf_jit_32.c18
-rw-r--r--arch/arm/plat-iop/gpio.c1
-rw-r--r--arch/arm/plat-iop/restart.c2
-rw-r--r--arch/arm/plat-iop/time.c2
-rw-r--r--arch/arm/plat-omap/counter_32k.c2
-rw-r--r--arch/arm/plat-orion/time.c2
-rw-r--r--arch/arm/plat-samsung/samsung-time.c2
-rw-r--r--arch/arm/plat-versatile/platsmp.c6
-rw-r--r--arch/arm/plat-versatile/sched-clock.c2
-rw-r--r--arch/arm/xen/enlighten.c1
-rw-r--r--arch/arm/xen/hypercall.S1
-rw-r--r--arch/arm64/Kconfig2
-rw-r--r--arch/arm64/include/asm/arch_timer.h2
-rw-r--r--arch/arm64/include/asm/debug-monitors.h7
-rw-r--r--arch/arm64/include/asm/system_misc.h3
-rw-r--r--arch/arm64/kernel/asm-offsets.c1
-rw-r--r--arch/arm64/kernel/debug-monitors.c6
-rw-r--r--arch/arm64/kernel/hw_breakpoint.c4
-rw-r--r--arch/arm64/kernel/process.c2
-rw-r--r--arch/arm64/kernel/smp.c23
-rw-r--r--arch/arm64/kvm/Kconfig51
-rw-r--r--arch/arm64/mm/fault.c46
-rw-r--r--arch/arm64/mm/mmap.c2
-rw-r--r--arch/arm64/xen/hypercall.S1
-rw-r--r--arch/avr32/include/uapi/asm/socket.h2
-rw-r--r--arch/blackfin/Kconfig2
-rw-r--r--arch/blackfin/include/asm/bfin_spi3.h (renamed from arch/blackfin/include/asm/bfin6xx_spi.h)4
-rw-r--r--arch/blackfin/kernel/kgdb.c1
-rw-r--r--arch/blackfin/kernel/perf_event.c2
-rw-r--r--arch/blackfin/kernel/setup.c4
-rw-r--r--arch/blackfin/mach-bf561/smp.c13
-rw-r--r--arch/blackfin/mach-bf609/boards/ezkit.c19
-rw-r--r--arch/blackfin/mach-common/cache-c.c4
-rw-r--r--arch/blackfin/mach-common/ints-priority.c2
-rw-r--r--arch/blackfin/mach-common/smp.c36
-rw-r--r--arch/cris/arch-v10/drivers/Kconfig4
-rw-r--r--arch/cris/arch-v32/drivers/Kconfig4
-rw-r--r--arch/cris/arch-v32/kernel/smp.c2
-rw-r--r--arch/cris/include/uapi/asm/socket.h2
-rw-r--r--arch/frv/include/uapi/asm/socket.h2
-rw-r--r--arch/frv/kernel/setup.c2
-rw-r--r--arch/h8300/include/uapi/asm/socket.h2
-rw-r--r--arch/hexagon/kernel/setup.c2
-rw-r--r--arch/hexagon/kernel/smp.c4
-rw-r--r--arch/ia64/hp/sim/boot/fw-emu.c20
-rw-r--r--arch/ia64/hp/sim/simeth.c2
-rw-r--r--arch/ia64/include/uapi/asm/socket.h2
-rw-r--r--arch/m32r/include/uapi/asm/socket.h2
-rw-r--r--arch/m32r/kernel/smpboot.c2
-rw-r--r--arch/metag/Kconfig.soc12
-rw-r--r--arch/metag/Makefile2
-rw-r--r--arch/metag/boot/.gitignore2
-rw-r--r--arch/metag/boot/dts/Makefile2
l---------arch/metag/boot/dts/include/dt-bindings1
-rw-r--r--arch/metag/boot/dts/skeleton.dts2
-rw-r--r--arch/metag/boot/dts/tz1090.dtsi41
-rw-r--r--arch/metag/boot/dts/tz1090_generic.dts10
-rw-r--r--arch/metag/configs/tz1090_defconfig42
-rw-r--r--arch/metag/include/asm/bug.h4
-rw-r--r--arch/metag/include/asm/checksum.h3
-rw-r--r--arch/metag/include/asm/clock.h8
-rw-r--r--arch/metag/include/asm/irq.h1
-rw-r--r--arch/metag/include/asm/processor.h2
-rw-r--r--arch/metag/kernel/cachepart.c13
-rw-r--r--arch/metag/kernel/clock.c59
-rw-r--r--arch/metag/kernel/irq.c7
-rw-r--r--arch/metag/kernel/kick.c9
-rw-r--r--arch/metag/kernel/metag_ksyms.c5
-rw-r--r--arch/metag/kernel/perf/perf_event.c6
-rw-r--r--arch/metag/kernel/setup.c16
-rw-r--r--arch/metag/kernel/smp.c57
-rw-r--r--arch/metag/kernel/time.c14
-rw-r--r--arch/metag/kernel/traps.c7
-rw-r--r--arch/metag/lib/checksum.c1
-rw-r--r--arch/metag/mm/cache.c2
-rw-r--r--arch/metag/mm/fault.c6
-rw-r--r--arch/microblaze/configs/mmu_defconfig4
-rw-r--r--arch/microblaze/include/asm/unistd.h3
-rw-r--r--arch/microblaze/include/uapi/asm/unistd.h2
-rw-r--r--arch/microblaze/kernel/kgdb.c2
-rw-r--r--arch/mips/Kbuild.platforms1
-rw-r--r--arch/mips/Kconfig77
-rw-r--r--arch/mips/Makefile4
-rw-r--r--arch/mips/ath79/mach-ap136.c2
-rw-r--r--arch/mips/ath79/setup.c2
-rw-r--r--arch/mips/bcm63xx/Kconfig9
-rw-r--r--arch/mips/bcm63xx/boards/board_bcm963xx.c57
-rw-r--r--arch/mips/bcm63xx/clk.c30
-rw-r--r--arch/mips/bcm63xx/cpu.c28
-rw-r--r--arch/mips/bcm63xx/dev-enet.c181
-rw-r--r--arch/mips/bcm63xx/dev-flash.c1
-rw-r--r--arch/mips/bcm63xx/dev-spi.c6
-rw-r--r--arch/mips/bcm63xx/dev-uart.c3
-rw-r--r--arch/mips/bcm63xx/irq.c23
-rw-r--r--arch/mips/bcm63xx/nvram.c10
-rw-r--r--arch/mips/bcm63xx/prom.c49
-rw-r--r--arch/mips/bcm63xx/reset.c29
-rw-r--r--arch/mips/bcm63xx/setup.c3
-rw-r--r--arch/mips/boot/compressed/Makefile2
-rw-r--r--arch/mips/boot/compressed/uart-16550.c22
-rw-r--r--arch/mips/cavium-octeon/Kconfig17
-rw-r--r--arch/mips/cavium-octeon/Makefile5
-rw-r--r--arch/mips/cavium-octeon/Platform8
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-helper-board.c13
-rw-r--r--arch/mips/cavium-octeon/octeon-irq.c12
-rw-r--r--arch/mips/cavium-octeon/octeon-platform.c14
-rw-r--r--arch/mips/cavium-octeon/serial.c109
-rw-r--r--arch/mips/cavium-octeon/setup.c32
-rw-r--r--arch/mips/cavium-octeon/smp.c6
-rw-r--r--arch/mips/configs/cavium_octeon_defconfig6
-rw-r--r--arch/mips/configs/wrppmc_defconfig97
-rw-r--r--arch/mips/dec/Makefile1
-rw-r--r--arch/mips/dec/promcon.c54
-rw-r--r--arch/mips/fw/cfe/cfe_api.c4
-rw-r--r--arch/mips/include/asm/cop2.h29
-rw-r--r--arch/mips/include/asm/cpu-features.h49
-rw-r--r--arch/mips/include/asm/cpu.h23
-rw-r--r--arch/mips/include/asm/fw/cfe/cfe_api.h4
-rw-r--r--arch/mips/include/asm/gic.h2
-rw-r--r--arch/mips/include/asm/io.h10
-rw-r--r--arch/mips/include/asm/kspd.h32
-rw-r--r--arch/mips/include/asm/mach-ar7/spaces.h7
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h119
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h122
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h1
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h145
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h8
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/ioremap.h4
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h7
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h7
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/spaces.h24
-rw-r--r--arch/mips/include/asm/mach-generic/dma-coherence.h12
-rw-r--r--arch/mips/include/asm/mach-generic/kernel-entry-init.h4
-rw-r--r--arch/mips/include/asm/mach-ip27/kernel-entry-init.h47
-rw-r--r--arch/mips/include/asm/mach-ip28/spaces.h9
-rw-r--r--arch/mips/include/asm/mach-jz4740/dma.h56
-rw-r--r--arch/mips/include/asm/mach-jz4740/platform.h1
-rw-r--r--arch/mips/include/asm/mach-pmcs-msp71xx/gpio.h46
-rw-r--r--arch/mips/include/asm/mach-wrppmc/mach-gt64120.h83
-rw-r--r--arch/mips/include/asm/mach-wrppmc/war.h24
-rw-r--r--arch/mips/include/asm/mips-boards/generic.h6
-rw-r--r--arch/mips/include/asm/mipsregs.h2
-rw-r--r--arch/mips/include/asm/mmu_context.h6
-rw-r--r--arch/mips/include/asm/netlogic/common.h21
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/pic.h2
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/xlp.h1
-rw-r--r--arch/mips/include/asm/netlogic/xlr/fmn.h12
-rw-r--r--arch/mips/include/asm/octeon/cvmx-bootinfo.h2
-rw-r--r--arch/mips/include/asm/page.h6
-rw-r--r--arch/mips/include/asm/pci.h1
-rw-r--r--arch/mips/include/asm/processor.h35
-rw-r--r--arch/mips/include/asm/stackframe.h29
-rw-r--r--arch/mips/include/asm/stackprotector.h40
-rw-r--r--arch/mips/include/asm/switch_to.h19
-rw-r--r--arch/mips/include/asm/thread_info.h11
-rw-r--r--arch/mips/include/asm/uasm.h37
-rw-r--r--arch/mips/include/asm/xtalk/xtalk.h9
-rw-r--r--arch/mips/include/uapi/asm/fcntl.h16
-rw-r--r--arch/mips/include/uapi/asm/inst.h9
-rw-r--r--arch/mips/include/uapi/asm/msgbuf.h12
-rw-r--r--arch/mips/include/uapi/asm/resource.h2
-rw-r--r--arch/mips/include/uapi/asm/siginfo.h4
-rw-r--r--arch/mips/include/uapi/asm/socket.h2
-rw-r--r--arch/mips/include/uapi/asm/swab.h12
-rw-r--r--arch/mips/jz4740/Makefile2
-rw-r--r--arch/mips/jz4740/board-qi_lb60.c1
-rw-r--r--arch/mips/jz4740/clock.c2
-rw-r--r--arch/mips/jz4740/dma.c287
-rw-r--r--arch/mips/jz4740/platform.c21
-rw-r--r--arch/mips/kernel/asm-offsets.c3
-rw-r--r--arch/mips/kernel/bmips_vec.S4
-rw-r--r--arch/mips/kernel/branch.c1
-rw-r--r--arch/mips/kernel/cevt-bcm1480.c2
-rw-r--r--arch/mips/kernel/cevt-gic.c2
-rw-r--r--arch/mips/kernel/cevt-r4k.c2
-rw-r--r--arch/mips/kernel/cevt-sb1250.c2
-rw-r--r--arch/mips/kernel/cevt-smtc.c2
-rw-r--r--arch/mips/kernel/cpu-bugs64.c7
-rw-r--r--arch/mips/kernel/cpu-probe.c26
-rw-r--r--arch/mips/kernel/head.S43
-rw-r--r--arch/mips/kernel/irq-gic.c15
-rw-r--r--arch/mips/kernel/mcount.S4
-rw-r--r--arch/mips/kernel/octeon_switch.S34
-rw-r--r--arch/mips/kernel/proc.c4
-rw-r--r--arch/mips/kernel/process.c9
-rw-r--r--arch/mips/kernel/prom.c2
-rw-r--r--arch/mips/kernel/ptrace.c12
-rw-r--r--arch/mips/kernel/r2300_switch.S7
-rw-r--r--arch/mips/kernel/r4k_switch.S6
-rw-r--r--arch/mips/kernel/rtlx.c1
-rw-r--r--arch/mips/kernel/scall32-o32.S2
-rw-r--r--arch/mips/kernel/scall64-64.S2
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/scall64-o32.S2
-rw-r--r--arch/mips/kernel/signal.c5
-rw-r--r--arch/mips/kernel/smp-bmips.c35
-rw-r--r--arch/mips/kernel/smp-mt.c6
-rw-r--r--arch/mips/kernel/smp-up.c6
-rw-r--r--arch/mips/kernel/smp.c6
-rw-r--r--arch/mips/kernel/smtc.c2
-rw-r--r--arch/mips/kernel/spram.c14
-rw-r--r--arch/mips/kernel/sync-r4k.c12
-rw-r--r--arch/mips/kernel/traps.c115
-rw-r--r--arch/mips/kernel/unaligned.c8
-rw-r--r--arch/mips/kernel/watch.c10
-rw-r--r--arch/mips/kvm/Kconfig1
-rw-r--r--arch/mips/lantiq/irq.c2
-rw-r--r--arch/mips/lantiq/prom.c2
-rw-r--r--arch/mips/lasat/sysctl.c14
-rw-r--r--arch/mips/lib/uncached.c2
-rw-r--r--arch/mips/loongson/common/cs5536/cs5536_isa.c14
-rw-r--r--arch/mips/math-emu/cp1emu.c3
-rw-r--r--arch/mips/mm/Makefile2
-rw-r--r--arch/mips/mm/c-octeon.c6
-rw-r--r--arch/mips/mm/c-r3k.c8
-rw-r--r--arch/mips/mm/c-r4k.c34
-rw-r--r--arch/mips/mm/c-tx39.c2
-rw-r--r--arch/mips/mm/cache.c2
-rw-r--r--arch/mips/mm/cerr-sb1.c4
-rw-r--r--arch/mips/mm/cex-sb1.S4
-rw-r--r--arch/mips/mm/dma-default.c3
-rw-r--r--arch/mips/mm/fault.c15
-rw-r--r--arch/mips/mm/mmap.c2
-rw-r--r--arch/mips/mm/page.c42
-rw-r--r--arch/mips/mm/sc-ip22.c2
-rw-r--r--arch/mips/mm/sc-mips.c2
-rw-r--r--arch/mips/mm/sc-r5k.c2
-rw-r--r--arch/mips/mm/sc-rm7k.c12
-rw-r--r--arch/mips/mm/tlb-funcs.S37
-rw-r--r--arch/mips/mm/tlb-r3k.c2
-rw-r--r--arch/mips/mm/tlb-r4k.c4
-rw-r--r--arch/mips/mm/tlb-r8k.c4
-rw-r--r--arch/mips/mm/tlbex.c327
-rw-r--r--arch/mips/mm/uasm-micromips.c10
-rw-r--r--arch/mips/mm/uasm-mips.c10
-rw-r--r--arch/mips/mm/uasm.c106
-rw-r--r--arch/mips/mti-malta/Makefile1
-rw-r--r--arch/mips/mti-malta/malta-int.c4
-rw-r--r--arch/mips/mti-malta/malta-reset.c33
-rw-r--r--arch/mips/mti-malta/malta-smtc.c6
-rw-r--r--arch/mips/mti-malta/malta-time.c2
-rw-r--r--arch/mips/mti-sead3/sead3-reset.c5
-rw-r--r--arch/mips/mti-sead3/sead3-time.c2
-rw-r--r--arch/mips/netlogic/Kconfig11
-rw-r--r--arch/mips/netlogic/common/Makefile2
-rw-r--r--arch/mips/netlogic/common/irq.c75
-rw-r--r--arch/mips/netlogic/common/nlm-dma.c107
-rw-r--r--arch/mips/netlogic/common/reset.S230
-rw-r--r--arch/mips/netlogic/common/smp.c22
-rw-r--r--arch/mips/netlogic/common/smpboot.S198
-rw-r--r--arch/mips/netlogic/common/time.c2
-rw-r--r--arch/mips/netlogic/dts/xlp_evp.dts3
-rw-r--r--arch/mips/netlogic/dts/xlp_svp.dts3
-rw-r--r--arch/mips/netlogic/xlp/Makefile2
-rw-r--r--arch/mips/netlogic/xlp/cop2-ex.c118
-rw-r--r--arch/mips/netlogic/xlp/dt.c99
-rw-r--r--arch/mips/netlogic/xlp/setup.c95
-rw-r--r--arch/mips/netlogic/xlp/usb-init.c2
-rw-r--r--arch/mips/netlogic/xlp/wakeup.c26
-rw-r--r--arch/mips/netlogic/xlr/fmn.c18
-rw-r--r--arch/mips/netlogic/xlr/setup.c7
-rw-r--r--arch/mips/netlogic/xlr/wakeup.c5
-rw-r--r--arch/mips/pci/Makefile7
-rw-r--r--arch/mips/pci/fixup-wrppmc.c37
-rw-r--r--arch/mips/pci/pci-bcm63xx.c3
-rw-r--r--arch/mips/pci/pci-ip27.c4
-rw-r--r--arch/mips/pci/pci-malta.c (renamed from arch/mips/mti-malta/malta-pci.c)0
-rw-r--r--arch/mips/pmcs-msp71xx/Makefile1
-rw-r--r--arch/mips/pmcs-msp71xx/gpio.c216
-rw-r--r--arch/mips/pmcs-msp71xx/gpio_extended.c146
-rw-r--r--arch/mips/pmcs-msp71xx/msp_smtc.c7
-rw-r--r--arch/mips/pmcs-msp71xx/msp_time.c2
-rw-r--r--arch/mips/pnx833x/common/interrupts.c2
-rw-r--r--arch/mips/powertv/asic/asic_devices.c13
-rw-r--r--arch/mips/powertv/time.c2
-rw-r--r--arch/mips/ralink/irq.c2
-rw-r--r--arch/mips/ralink/of.c2
-rw-r--r--arch/mips/sgi-ip27/Makefile1
-rw-r--r--arch/mips/sgi-ip27/ip27-init.c4
-rw-r--r--arch/mips/sgi-ip27/ip27-irq-pci.c266
-rw-r--r--arch/mips/sgi-ip27/ip27-irq.c214
-rw-r--r--arch/mips/sgi-ip27/ip27-smp.c6
-rw-r--r--arch/mips/sgi-ip27/ip27-timer.c6
-rw-r--r--arch/mips/sgi-ip27/ip27-xtalk.c6
-rw-r--r--arch/mips/sibyte/Kconfig3
-rw-r--r--arch/mips/sibyte/Platform5
-rw-r--r--arch/mips/sibyte/bcm1480/smp.c8
-rw-r--r--arch/mips/sibyte/common/Makefile1
-rw-r--r--arch/mips/sibyte/common/bus_watcher.c (renamed from arch/mips/sibyte/sb1250/bus_watcher.c)14
-rw-r--r--arch/mips/sibyte/common/sb_tbprof.c1
-rw-r--r--arch/mips/sibyte/sb1250/Makefile1
-rw-r--r--arch/mips/sibyte/sb1250/smp.c8
-rw-r--r--arch/mips/sni/pcimt.c2
-rw-r--r--arch/mips/sni/pcit.c16
-rw-r--r--arch/mips/txx9/generic/setup_tx4939.c3
-rw-r--r--arch/mips/wrppmc/Makefile12
-rw-r--r--arch/mips/wrppmc/Platform7
-rw-r--r--arch/mips/wrppmc/irq.c56
-rw-r--r--arch/mips/wrppmc/pci.c52
-rw-r--r--arch/mips/wrppmc/reset.c41
-rw-r--r--arch/mips/wrppmc/serial.c80
-rw-r--r--arch/mips/wrppmc/setup.c128
-rw-r--r--arch/mips/wrppmc/time.c39
-rw-r--r--arch/mn10300/include/uapi/asm/socket.h2
-rw-r--r--arch/mn10300/mm/fault.c7
-rw-r--r--arch/openrisc/kernel/setup.c2
-rw-r--r--arch/openrisc/mm/fault.c8
-rw-r--r--arch/parisc/Makefile15
-rw-r--r--arch/parisc/defpalo.conf8
-rw-r--r--arch/parisc/include/asm/special_insns.h9
-rw-r--r--arch/parisc/include/asm/tlbflush.h5
-rw-r--r--arch/parisc/include/uapi/asm/fcntl.h2
-rw-r--r--arch/parisc/include/uapi/asm/socket.h2
-rw-r--r--arch/parisc/install.sh6
-rw-r--r--arch/parisc/kernel/cache.c2
-rw-r--r--arch/parisc/kernel/firmware.c14
-rw-r--r--arch/parisc/kernel/hardware.c2
-rw-r--r--arch/parisc/kernel/processor.c25
-rw-r--r--arch/parisc/kernel/smp.c8
-rw-r--r--arch/parisc/lib/memcpy.c79
-rw-r--r--arch/powerpc/Kconfig1
-rw-r--r--arch/powerpc/include/uapi/asm/socket.h2
-rw-r--r--arch/powerpc/kernel/ptrace.c30
-rw-r--r--arch/powerpc/mm/mmap.c2
-rw-r--r--arch/powerpc/net/bpf_jit_comp.c19
-rw-r--r--arch/powerpc/perf/power7-pmu.c12
-rw-r--r--arch/powerpc/platforms/cell/beat_interrupt.c2
-rw-r--r--arch/powerpc/platforms/powermac/smp.c2
-rw-r--r--arch/s390/include/asm/processor.h10
-rw-r--r--arch/s390/include/asm/switch_to.h4
-rw-r--r--arch/s390/include/uapi/asm/ptrace.h1
-rw-r--r--arch/s390/include/uapi/asm/socket.h2
-rw-r--r--arch/s390/kernel/cache.c15
-rw-r--r--arch/s390/kernel/crash_dump.c51
-rw-r--r--arch/s390/kernel/perf_cpum_cf.c4
-rw-r--r--arch/s390/kernel/processor.c2
-rw-r--r--arch/s390/kernel/ptrace.c50
-rw-r--r--arch/s390/kernel/smp.c17
-rw-r--r--arch/s390/kernel/sysinfo.c2
-rw-r--r--arch/s390/kernel/vtime.c6
-rw-r--r--arch/s390/mm/fault.c4
-rw-r--r--arch/s390/mm/mmap.c4
-rw-r--r--arch/s390/net/bpf_jit_comp.c113
-rw-r--r--arch/score/mm/fault.c8
-rw-r--r--arch/score/mm/tlb-score.c2
-rw-r--r--arch/sh/boards/board-espt.c2
-rw-r--r--arch/sh/boards/board-sh7757lcr.c8
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c4
-rw-r--r--arch/sh/boards/mach-se/770x/setup.c8
-rw-r--r--arch/sh/boards/mach-se/7724/setup.c4
-rw-r--r--arch/sh/boards/mach-sh7763rdp/setup.c2
-rw-r--r--arch/sh/kernel/cpu/init.c18
-rw-r--r--arch/sh/kernel/cpu/sh2/probe.c2
-rw-r--r--arch/sh/kernel/cpu/sh2/setup-sh7619.c4
-rw-r--r--arch/sh/kernel/cpu/sh2a/probe.c2
-rw-r--r--arch/sh/kernel/cpu/sh3/probe.c2
-rw-r--r--arch/sh/kernel/cpu/sh4/probe.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7724.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7734.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/smp-shx3.c6
-rw-r--r--arch/sh/kernel/cpu/sh5/probe.c2
-rw-r--r--arch/sh/kernel/perf_event.c4
-rw-r--r--arch/sh/kernel/process.c2
-rw-r--r--arch/sh/kernel/ptrace_32.c4
-rw-r--r--arch/sh/kernel/setup.c2
-rw-r--r--arch/sh/kernel/smp.c8
-rw-r--r--arch/sh/kernel/traps_32.c2
-rw-r--r--arch/sh/kernel/traps_64.c2
-rw-r--r--arch/sh/mm/tlb-sh5.c2
-rw-r--r--arch/sparc/include/asm/leon.h2
-rw-r--r--arch/sparc/include/uapi/asm/fcntl.h2
-rw-r--r--arch/sparc/include/uapi/asm/socket.h2
-rw-r--r--arch/sparc/kernel/asm-offsets.c2
-rw-r--r--arch/sparc/kernel/ds.c21
-rw-r--r--arch/sparc/kernel/entry.h2
-rw-r--r--arch/sparc/kernel/hvtramp.S1
-rw-r--r--arch/sparc/kernel/irq_64.c5
-rw-r--r--arch/sparc/kernel/leon_smp.c10
-rw-r--r--arch/sparc/kernel/mdesc.c34
-rw-r--r--arch/sparc/kernel/smp_32.c20
-rw-r--r--arch/sparc/kernel/smp_64.c9
-rw-r--r--arch/sparc/kernel/sun4d_smp.c6
-rw-r--r--arch/sparc/kernel/sun4m_smp.c6
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c2
-rw-r--r--arch/sparc/kernel/sysfs.c4
-rw-r--r--arch/sparc/kernel/trampoline_32.S3
-rw-r--r--arch/sparc/kernel/trampoline_64.S2
-rw-r--r--arch/sparc/mm/hypersparc.S8
-rw-r--r--arch/sparc/mm/init_64.c2
-rw-r--r--arch/sparc/mm/srmmu.c12
-rw-r--r--arch/sparc/mm/swift.S8
-rw-r--r--arch/sparc/mm/tsunami.S6
-rw-r--r--arch/sparc/mm/viking.S10
-rw-r--r--arch/sparc/net/bpf_jit_comp.c20
-rw-r--r--arch/tile/kernel/irq.c2
-rw-r--r--arch/tile/kernel/messaging.c2
-rw-r--r--arch/tile/kernel/setup.c12
-rw-r--r--arch/tile/kernel/smpboot.c8
-rw-r--r--arch/tile/kernel/time.c2
-rw-r--r--arch/tile/mm/fault.c8
-rw-r--r--arch/tile/mm/mmap.c2
-rw-r--r--arch/um/include/shared/frame_kern.h8
-rw-r--r--arch/um/kernel/signal.c4
-rw-r--r--arch/um/kernel/skas/mmu.c2
-rw-r--r--arch/um/kernel/skas/uaccess.c2
-rw-r--r--arch/um/os-Linux/mem.c230
-rw-r--r--arch/um/os-Linux/signal.c8
-rw-r--r--arch/um/os-Linux/skas/process.c19
-rw-r--r--arch/unicore32/kernel/process.c14
-rw-r--r--arch/unicore32/kernel/setup.h2
-rw-r--r--arch/unicore32/mm/mmu.c2
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/x86/boot/compressed/Makefile6
-rw-r--r--arch/x86/boot/compressed/misc.c4
-rw-r--r--arch/x86/crypto/Makefile2
-rw-r--r--arch/x86/crypto/crct10dif-pcl-asm_64.S643
-rw-r--r--arch/x86/crypto/crct10dif-pclmul_glue.c151
-rw-r--r--arch/x86/ia32/ia32_aout.c2
-rw-r--r--arch/x86/include/asm/cpu.h2
-rw-r--r--arch/x86/include/asm/emergency-restart.h12
-rw-r--r--arch/x86/include/asm/io.h7
-rw-r--r--arch/x86/include/asm/mc146818rtc.h4
-rw-r--r--arch/x86/include/asm/mce.h7
-rw-r--r--arch/x86/include/asm/microcode.h4
-rw-r--r--arch/x86/include/asm/microcode_amd.h4
-rw-r--r--arch/x86/include/asm/microcode_intel.h4
-rw-r--r--arch/x86/include/asm/mmconfig.h4
-rw-r--r--arch/x86/include/asm/mpspec.h2
-rw-r--r--arch/x86/include/asm/mrst-vrtc.h4
-rw-r--r--arch/x86/include/asm/mtrr.h10
-rw-r--r--arch/x86/include/asm/numa.h6
-rw-r--r--arch/x86/include/asm/processor.h2
-rw-r--r--arch/x86/include/asm/prom.h2
-rw-r--r--arch/x86/include/asm/smp.h2
-rw-r--r--arch/x86/include/asm/x86_init.h6
-rw-r--r--arch/x86/kernel/acpi/boot.c6
-rw-r--r--arch/x86/kernel/acpi/sleep.c18
-rw-r--r--arch/x86/kernel/apic/apic.c30
-rw-r--r--arch/x86/kernel/apic/apic_numachip.c2
-rw-r--r--arch/x86/kernel/apic/es7000_32.c2
-rw-r--r--arch/x86/kernel/apic/numaq_32.c2
-rw-r--r--arch/x86/kernel/apic/x2apic_cluster.c2
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c16
-rw-r--r--arch/x86/kernel/cpu/amd.c33
-rw-r--r--arch/x86/kernel/cpu/centaur.c26
-rw-r--r--arch/x86/kernel/cpu/common.c64
-rw-r--r--arch/x86/kernel/cpu/cyrix.c40
-rw-r--r--arch/x86/kernel/cpu/hypervisor.c2
-rw-r--r--arch/x86/kernel/cpu/intel.c30
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c55
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c23
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c14
-rw-r--r--arch/x86/kernel/cpu/mcheck/therm_throt.c72
-rw-r--r--arch/x86/kernel/cpu/mtrr/main.c71
-rw-r--r--arch/x86/kernel/cpu/perf_event.c2
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd_ibs.c2
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd_iommu.c4
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd_uncore.c31
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore.c20
-rw-r--r--arch/x86/kernel/cpu/rdrand.c2
-rw-r--r--arch/x86/kernel/cpu/scattered.c4
-rw-r--r--arch/x86/kernel/cpu/topology.c2
-rw-r--r--arch/x86/kernel/cpu/transmeta.c6
-rw-r--r--arch/x86/kernel/cpu/umc.c2
-rw-r--r--arch/x86/kernel/cpu/vmware.c2
-rw-r--r--arch/x86/kernel/cpuid.c7
-rw-r--r--arch/x86/kernel/devicetree.c6
-rw-r--r--arch/x86/kernel/head_32.S1
-rw-r--r--arch/x86/kernel/head_64.S15
-rw-r--r--arch/x86/kernel/hw_breakpoint.c3
-rw-r--r--arch/x86/kernel/i387.c10
-rw-r--r--arch/x86/kernel/irq_32.c2
-rw-r--r--arch/x86/kernel/kvm.c10
-rw-r--r--arch/x86/kernel/kvmclock.c11
-rw-r--r--arch/x86/kernel/microcode_amd_early.c8
-rw-r--r--arch/x86/kernel/microcode_core.c2
-rw-r--r--arch/x86/kernel/microcode_core_early.c6
-rw-r--r--arch/x86/kernel/microcode_intel_early.c26
-rw-r--r--arch/x86/kernel/mmconf-fam10h_64.c12
-rw-r--r--arch/x86/kernel/msr.c6
-rw-r--r--arch/x86/kernel/nmi.c7
-rw-r--r--arch/x86/kernel/process.c2
-rw-r--r--arch/x86/kernel/ptrace.c204
-rw-r--r--arch/x86/kernel/reboot.c117
-rw-r--r--arch/x86/kernel/rtc.c17
-rw-r--r--arch/x86/kernel/setup.c2
-rw-r--r--arch/x86/kernel/smp.c29
-rw-r--r--arch/x86/kernel/smpboot.c28
-rw-r--r--arch/x86/kernel/tboot.c6
-rw-r--r--arch/x86/kernel/tracepoint.c6
-rw-r--r--arch/x86/kernel/traps.c12
-rw-r--r--arch/x86/kernel/tsc.c4
-rw-r--r--arch/x86/kernel/tsc_sync.c18
-rw-r--r--arch/x86/kernel/vsyscall_64.c6
-rw-r--r--arch/x86/kernel/x86_init.c4
-rw-r--r--arch/x86/kernel/xsave.c4
-rw-r--r--arch/x86/kvm/mmu.c7
-rw-r--r--arch/x86/kvm/vmx.c11
-rw-r--r--arch/x86/lguest/boot.c4
-rw-r--r--arch/x86/mm/mmap.c2
-rw-r--r--arch/x86/mm/mmio-mod.c4
-rw-r--r--arch/x86/mm/numa.c12
-rw-r--r--arch/x86/mm/numa_emulation.c12
-rw-r--r--arch/x86/mm/pgtable.c4
-rw-r--r--arch/x86/mm/setup_nx.c4
-rw-r--r--arch/x86/net/bpf_jit_comp.c61
-rw-r--r--arch/x86/pci/amd_bus.c8
-rw-r--r--arch/x86/platform/ce4100/ce4100.c3
-rw-r--r--arch/x86/platform/efi/efi.c17
-rw-r--r--arch/x86/platform/mrst/mrst.c4
-rw-r--r--arch/x86/platform/mrst/vrtc.c11
-rw-r--r--arch/x86/um/signal.c1
-rw-r--r--arch/x86/xen/enlighten.c6
-rw-r--r--arch/x86/xen/setup.c6
-rw-r--r--arch/x86/xen/smp.c12
-rw-r--r--arch/x86/xen/spinlock.c2
-rw-r--r--arch/x86/xen/time.c58
-rw-r--r--arch/x86/xen/xen-ops.h2
-rw-r--r--arch/xtensa/Kconfig3
-rw-r--r--arch/xtensa/Kconfig.debug10
-rw-r--r--arch/xtensa/boot/.gitignore3
-rw-r--r--arch/xtensa/boot/boot-elf/.gitignore1
-rw-r--r--arch/xtensa/boot/lib/.gitignore3
-rw-r--r--arch/xtensa/boot/lib/Makefile7
-rw-r--r--arch/xtensa/include/asm/bootparam.h2
-rw-r--r--arch/xtensa/include/asm/cmpxchg.h1
-rw-r--r--arch/xtensa/include/asm/delay.h13
-rw-r--r--arch/xtensa/include/asm/ftrace.h17
-rw-r--r--arch/xtensa/include/asm/pgtable.h140
-rw-r--r--arch/xtensa/include/asm/platform.h5
-rw-r--r--arch/xtensa/include/asm/timex.h12
-rw-r--r--arch/xtensa/include/uapi/asm/socket.h2
-rw-r--r--arch/xtensa/kernel/.gitignore1
-rw-r--r--arch/xtensa/kernel/Makefile1
-rw-r--r--arch/xtensa/kernel/entry.S16
-rw-r--r--arch/xtensa/kernel/head.S9
-rw-r--r--arch/xtensa/kernel/mcount.S50
-rw-r--r--arch/xtensa/kernel/pci.c10
-rw-r--r--arch/xtensa/kernel/platform.c3
-rw-r--r--arch/xtensa/kernel/setup.c8
-rw-r--r--arch/xtensa/kernel/time.c125
-rw-r--r--arch/xtensa/kernel/xtensa_ksyms.c4
-rw-r--r--arch/xtensa/mm/tlb.c120
-rw-r--r--arch/xtensa/platforms/iss/network.c2
-rw-r--r--arch/xtensa/platforms/iss/simdisk.c4
-rw-r--r--arch/xtensa/platforms/xtfpga/setup.c5
-rw-r--r--arch/xtensa/variants/s6000/delay.c6
849 files changed, 6734 insertions, 6483 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 837a1f2d8b96..082d9b4b5472 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -15,6 +15,7 @@ config ALPHA
15 select ARCH_WANT_OPTIONAL_GPIOLIB 15 select ARCH_WANT_OPTIONAL_GPIOLIB
16 select ARCH_WANT_IPC_PARSE_VERSION 16 select ARCH_WANT_IPC_PARSE_VERSION
17 select ARCH_HAVE_NMI_SAFE_CMPXCHG 17 select ARCH_HAVE_NMI_SAFE_CMPXCHG
18 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
18 select GENERIC_SMP_IDLE_THREAD 19 select GENERIC_SMP_IDLE_THREAD
19 select GENERIC_CMOS_UPDATE 20 select GENERIC_CMOS_UPDATE
20 select GENERIC_STRNCPY_FROM_USER 21 select GENERIC_STRNCPY_FROM_USER
diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h
index c2cbe4fc391c..78b03ef39f6f 100644
--- a/arch/alpha/include/asm/atomic.h
+++ b/arch/alpha/include/asm/atomic.h
@@ -186,17 +186,24 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
186 */ 186 */
187static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u) 187static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
188{ 188{
189 int c, old; 189 int c, new, old;
190 c = atomic_read(v); 190 smp_mb();
191 for (;;) { 191 __asm__ __volatile__(
192 if (unlikely(c == (u))) 192 "1: ldl_l %[old],%[mem]\n"
193 break; 193 " cmpeq %[old],%[u],%[c]\n"
194 old = atomic_cmpxchg((v), c, c + (a)); 194 " addl %[old],%[a],%[new]\n"
195 if (likely(old == c)) 195 " bne %[c],2f\n"
196 break; 196 " stl_c %[new],%[mem]\n"
197 c = old; 197 " beq %[new],3f\n"
198 } 198 "2:\n"
199 return c; 199 ".subsection 2\n"
200 "3: br 1b\n"
201 ".previous"
202 : [old] "=&r"(old), [new] "=&r"(new), [c] "=&r"(c)
203 : [mem] "m"(*v), [a] "rI"(a), [u] "rI"((long)u)
204 : "memory");
205 smp_mb();
206 return old;
200} 207}
201 208
202 209
@@ -207,21 +214,56 @@ static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u)
207 * @u: ...unless v is equal to u. 214 * @u: ...unless v is equal to u.
208 * 215 *
209 * Atomically adds @a to @v, so long as it was not @u. 216 * Atomically adds @a to @v, so long as it was not @u.
210 * Returns the old value of @v. 217 * Returns true iff @v was not @u.
211 */ 218 */
212static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u) 219static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
213{ 220{
214 long c, old; 221 long c, tmp;
215 c = atomic64_read(v); 222 smp_mb();
216 for (;;) { 223 __asm__ __volatile__(
217 if (unlikely(c == (u))) 224 "1: ldq_l %[tmp],%[mem]\n"
218 break; 225 " cmpeq %[tmp],%[u],%[c]\n"
219 old = atomic64_cmpxchg((v), c, c + (a)); 226 " addq %[tmp],%[a],%[tmp]\n"
220 if (likely(old == c)) 227 " bne %[c],2f\n"
221 break; 228 " stq_c %[tmp],%[mem]\n"
222 c = old; 229 " beq %[tmp],3f\n"
223 } 230 "2:\n"
224 return c != (u); 231 ".subsection 2\n"
232 "3: br 1b\n"
233 ".previous"
234 : [tmp] "=&r"(tmp), [c] "=&r"(c)
235 : [mem] "m"(*v), [a] "rI"(a), [u] "rI"(u)
236 : "memory");
237 smp_mb();
238 return !c;
239}
240
241/*
242 * atomic64_dec_if_positive - decrement by 1 if old value positive
243 * @v: pointer of type atomic_t
244 *
245 * The function returns the old value of *v minus 1, even if
246 * the atomic variable, v, was not decremented.
247 */
248static inline long atomic64_dec_if_positive(atomic64_t *v)
249{
250 long old, tmp;
251 smp_mb();
252 __asm__ __volatile__(
253 "1: ldq_l %[old],%[mem]\n"
254 " subq %[old],1,%[tmp]\n"
255 " ble %[old],2f\n"
256 " stq_c %[tmp],%[mem]\n"
257 " beq %[tmp],3f\n"
258 "2:\n"
259 ".subsection 2\n"
260 "3: br 1b\n"
261 ".previous"
262 : [old] "=&r"(old), [tmp] "=&r"(tmp)
263 : [mem] "m"(*v)
264 : "memory");
265 smp_mb();
266 return old - 1;
225} 267}
226 268
227#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) 269#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
diff --git a/arch/alpha/include/asm/param.h b/arch/alpha/include/asm/param.h
index bf46af51941b..a5b68b268bcf 100644
--- a/arch/alpha/include/asm/param.h
+++ b/arch/alpha/include/asm/param.h
@@ -3,7 +3,9 @@
3 3
4#include <uapi/asm/param.h> 4#include <uapi/asm/param.h>
5 5
6#define HZ CONFIG_HZ 6# undef HZ
7#define USER_HZ HZ 7# define HZ CONFIG_HZ
8# define CLOCKS_PER_SEC HZ /* frequency at which times() counts */ 8# define USER_HZ 1024
9# define CLOCKS_PER_SEC USER_HZ /* frequency at which times() counts */
10
9#endif /* _ASM_ALPHA_PARAM_H */ 11#endif /* _ASM_ALPHA_PARAM_H */
diff --git a/arch/alpha/include/asm/spinlock.h b/arch/alpha/include/asm/spinlock.h
index 3bba21e41b81..37b570d01202 100644
--- a/arch/alpha/include/asm/spinlock.h
+++ b/arch/alpha/include/asm/spinlock.h
@@ -168,8 +168,4 @@ static inline void arch_write_unlock(arch_rwlock_t * lock)
168#define arch_read_lock_flags(lock, flags) arch_read_lock(lock) 168#define arch_read_lock_flags(lock, flags) arch_read_lock(lock)
169#define arch_write_lock_flags(lock, flags) arch_write_lock(lock) 169#define arch_write_lock_flags(lock, flags) arch_write_lock(lock)
170 170
171#define arch_spin_relax(lock) cpu_relax()
172#define arch_read_relax(lock) cpu_relax()
173#define arch_write_relax(lock) cpu_relax()
174
175#endif /* _ALPHA_SPINLOCK_H */ 171#endif /* _ALPHA_SPINLOCK_H */
diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h
index 43baee17acdf..f2c94402e2c8 100644
--- a/arch/alpha/include/asm/unistd.h
+++ b/arch/alpha/include/asm/unistd.h
@@ -3,8 +3,7 @@
3 3
4#include <uapi/asm/unistd.h> 4#include <uapi/asm/unistd.h>
5 5
6 6#define NR_SYSCALLS 508
7#define NR_SYSCALLS 506
8 7
9#define __ARCH_WANT_OLD_READDIR 8#define __ARCH_WANT_OLD_READDIR
10#define __ARCH_WANT_STAT64 9#define __ARCH_WANT_STAT64
diff --git a/arch/alpha/include/uapi/asm/fcntl.h b/arch/alpha/include/uapi/asm/fcntl.h
index dfdadb0b4bef..09f49a6b87d1 100644
--- a/arch/alpha/include/uapi/asm/fcntl.h
+++ b/arch/alpha/include/uapi/asm/fcntl.h
@@ -32,7 +32,7 @@
32#define O_SYNC (__O_SYNC|O_DSYNC) 32#define O_SYNC (__O_SYNC|O_DSYNC)
33 33
34#define O_PATH 040000000 34#define O_PATH 040000000
35#define O_TMPFILE 0100000000 35#define __O_TMPFILE 0100000000
36 36
37#define F_GETLK 7 37#define F_GETLK 7
38#define F_SETLK 8 38#define F_SETLK 8
diff --git a/arch/alpha/include/uapi/asm/param.h b/arch/alpha/include/uapi/asm/param.h
index 29daed819ebd..dbcd9834af6d 100644
--- a/arch/alpha/include/uapi/asm/param.h
+++ b/arch/alpha/include/uapi/asm/param.h
@@ -1,13 +1,7 @@
1#ifndef _UAPI_ASM_ALPHA_PARAM_H 1#ifndef _UAPI_ASM_ALPHA_PARAM_H
2#define _UAPI_ASM_ALPHA_PARAM_H 2#define _UAPI_ASM_ALPHA_PARAM_H
3 3
4/* ??? Gross. I don't want to parameterize this, and supposedly the
5 hardware ignores reprogramming. We also need userland buy-in to the
6 change in HZ, since this is visible in the wait4 resources etc. */
7
8#ifndef __KERNEL__
9#define HZ 1024 4#define HZ 1024
10#endif
11 5
12#define EXEC_PAGESIZE 8192 6#define EXEC_PAGESIZE 8192
13 7
@@ -17,5 +11,4 @@
17 11
18#define MAXHOSTNAMELEN 64 /* max length of hostname */ 12#define MAXHOSTNAMELEN 64 /* max length of hostname */
19 13
20
21#endif /* _UAPI_ASM_ALPHA_PARAM_H */ 14#endif /* _UAPI_ASM_ALPHA_PARAM_H */
diff --git a/arch/alpha/include/uapi/asm/socket.h b/arch/alpha/include/uapi/asm/socket.h
index eee6ea76bdaf..467de010ea7e 100644
--- a/arch/alpha/include/uapi/asm/socket.h
+++ b/arch/alpha/include/uapi/asm/socket.h
@@ -81,4 +81,6 @@
81 81
82#define SO_SELECT_ERR_QUEUE 45 82#define SO_SELECT_ERR_QUEUE 45
83 83
84#define SO_BUSY_POLL 46
85
84#endif /* _UAPI_ASM_SOCKET_H */ 86#endif /* _UAPI_ASM_SOCKET_H */
diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h
index 801d28bcea51..53ae7bb1bfd1 100644
--- a/arch/alpha/include/uapi/asm/unistd.h
+++ b/arch/alpha/include/uapi/asm/unistd.h
@@ -467,5 +467,7 @@
467#define __NR_sendmmsg 503 467#define __NR_sendmmsg 503
468#define __NR_process_vm_readv 504 468#define __NR_process_vm_readv 504
469#define __NR_process_vm_writev 505 469#define __NR_process_vm_writev 505
470#define __NR_kcmp 506
471#define __NR_finit_module 507
470 472
471#endif /* _UAPI_ALPHA_UNISTD_H */ 473#endif /* _UAPI_ALPHA_UNISTD_H */
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S
index f62a994ef126..a969b95ee5ac 100644
--- a/arch/alpha/kernel/entry.S
+++ b/arch/alpha/kernel/entry.S
@@ -12,11 +12,32 @@
12 12
13 .text 13 .text
14 .set noat 14 .set noat
15 .cfi_sections .debug_frame
15 16
16/* Stack offsets. */ 17/* Stack offsets. */
17#define SP_OFF 184 18#define SP_OFF 184
18#define SWITCH_STACK_SIZE 320 19#define SWITCH_STACK_SIZE 320
19 20
21.macro CFI_START_OSF_FRAME func
22 .align 4
23 .globl \func
24 .type \func,@function
25\func:
26 .cfi_startproc simple
27 .cfi_return_column 64
28 .cfi_def_cfa $sp, 48
29 .cfi_rel_offset 64, 8
30 .cfi_rel_offset $gp, 16
31 .cfi_rel_offset $16, 24
32 .cfi_rel_offset $17, 32
33 .cfi_rel_offset $18, 40
34.endm
35
36.macro CFI_END_OSF_FRAME func
37 .cfi_endproc
38 .size \func, . - \func
39.endm
40
20/* 41/*
21 * This defines the normal kernel pt-regs layout. 42 * This defines the normal kernel pt-regs layout.
22 * 43 *
@@ -27,100 +48,158 @@
27 * the palcode-provided values are available to the signal handler. 48 * the palcode-provided values are available to the signal handler.
28 */ 49 */
29 50
30#define SAVE_ALL \ 51.macro SAVE_ALL
31 subq $sp, SP_OFF, $sp; \ 52 subq $sp, SP_OFF, $sp
32 stq $0, 0($sp); \ 53 .cfi_adjust_cfa_offset SP_OFF
33 stq $1, 8($sp); \ 54 stq $0, 0($sp)
34 stq $2, 16($sp); \ 55 stq $1, 8($sp)
35 stq $3, 24($sp); \ 56 stq $2, 16($sp)
36 stq $4, 32($sp); \ 57 stq $3, 24($sp)
37 stq $28, 144($sp); \ 58 stq $4, 32($sp)
38 lda $2, alpha_mv; \ 59 stq $28, 144($sp)
39 stq $5, 40($sp); \ 60 .cfi_rel_offset $0, 0
40 stq $6, 48($sp); \ 61 .cfi_rel_offset $1, 8
41 stq $7, 56($sp); \ 62 .cfi_rel_offset $2, 16
42 stq $8, 64($sp); \ 63 .cfi_rel_offset $3, 24
43 stq $19, 72($sp); \ 64 .cfi_rel_offset $4, 32
44 stq $20, 80($sp); \ 65 .cfi_rel_offset $28, 144
45 stq $21, 88($sp); \ 66 lda $2, alpha_mv
46 ldq $2, HAE_CACHE($2); \ 67 stq $5, 40($sp)
47 stq $22, 96($sp); \ 68 stq $6, 48($sp)
48 stq $23, 104($sp); \ 69 stq $7, 56($sp)
49 stq $24, 112($sp); \ 70 stq $8, 64($sp)
50 stq $25, 120($sp); \ 71 stq $19, 72($sp)
51 stq $26, 128($sp); \ 72 stq $20, 80($sp)
52 stq $27, 136($sp); \ 73 stq $21, 88($sp)
53 stq $2, 152($sp); \ 74 ldq $2, HAE_CACHE($2)
54 stq $16, 160($sp); \ 75 stq $22, 96($sp)
55 stq $17, 168($sp); \ 76 stq $23, 104($sp)
77 stq $24, 112($sp)
78 stq $25, 120($sp)
79 stq $26, 128($sp)
80 stq $27, 136($sp)
81 stq $2, 152($sp)
82 stq $16, 160($sp)
83 stq $17, 168($sp)
56 stq $18, 176($sp) 84 stq $18, 176($sp)
85 .cfi_rel_offset $5, 40
86 .cfi_rel_offset $6, 48
87 .cfi_rel_offset $7, 56
88 .cfi_rel_offset $8, 64
89 .cfi_rel_offset $19, 72
90 .cfi_rel_offset $20, 80
91 .cfi_rel_offset $21, 88
92 .cfi_rel_offset $22, 96
93 .cfi_rel_offset $23, 104
94 .cfi_rel_offset $24, 112
95 .cfi_rel_offset $25, 120
96 .cfi_rel_offset $26, 128
97 .cfi_rel_offset $27, 136
98.endm
57 99
58#define RESTORE_ALL \ 100.macro RESTORE_ALL
59 lda $19, alpha_mv; \ 101 lda $19, alpha_mv
60 ldq $0, 0($sp); \ 102 ldq $0, 0($sp)
61 ldq $1, 8($sp); \ 103 ldq $1, 8($sp)
62 ldq $2, 16($sp); \ 104 ldq $2, 16($sp)
63 ldq $3, 24($sp); \ 105 ldq $3, 24($sp)
64 ldq $21, 152($sp); \ 106 ldq $21, 152($sp)
65 ldq $20, HAE_CACHE($19); \ 107 ldq $20, HAE_CACHE($19)
66 ldq $4, 32($sp); \ 108 ldq $4, 32($sp)
67 ldq $5, 40($sp); \ 109 ldq $5, 40($sp)
68 ldq $6, 48($sp); \ 110 ldq $6, 48($sp)
69 ldq $7, 56($sp); \ 111 ldq $7, 56($sp)
70 subq $20, $21, $20; \ 112 subq $20, $21, $20
71 ldq $8, 64($sp); \ 113 ldq $8, 64($sp)
72 beq $20, 99f; \ 114 beq $20, 99f
73 ldq $20, HAE_REG($19); \ 115 ldq $20, HAE_REG($19)
74 stq $21, HAE_CACHE($19); \ 116 stq $21, HAE_CACHE($19)
75 stq $21, 0($20); \ 117 stq $21, 0($20)
7699:; \ 11899: ldq $19, 72($sp)
77 ldq $19, 72($sp); \ 119 ldq $20, 80($sp)
78 ldq $20, 80($sp); \ 120 ldq $21, 88($sp)
79 ldq $21, 88($sp); \ 121 ldq $22, 96($sp)
80 ldq $22, 96($sp); \ 122 ldq $23, 104($sp)
81 ldq $23, 104($sp); \ 123 ldq $24, 112($sp)
82 ldq $24, 112($sp); \ 124 ldq $25, 120($sp)
83 ldq $25, 120($sp); \ 125 ldq $26, 128($sp)
84 ldq $26, 128($sp); \ 126 ldq $27, 136($sp)
85 ldq $27, 136($sp); \ 127 ldq $28, 144($sp)
86 ldq $28, 144($sp); \
87 addq $sp, SP_OFF, $sp 128 addq $sp, SP_OFF, $sp
129 .cfi_restore $0
130 .cfi_restore $1
131 .cfi_restore $2
132 .cfi_restore $3
133 .cfi_restore $4
134 .cfi_restore $5
135 .cfi_restore $6
136 .cfi_restore $7
137 .cfi_restore $8
138 .cfi_restore $19
139 .cfi_restore $20
140 .cfi_restore $21
141 .cfi_restore $22
142 .cfi_restore $23
143 .cfi_restore $24
144 .cfi_restore $25
145 .cfi_restore $26
146 .cfi_restore $27
147 .cfi_restore $28
148 .cfi_adjust_cfa_offset -SP_OFF
149.endm
150
151.macro DO_SWITCH_STACK
152 bsr $1, do_switch_stack
153 .cfi_adjust_cfa_offset SWITCH_STACK_SIZE
154 .cfi_rel_offset $9, 0
155 .cfi_rel_offset $10, 8
156 .cfi_rel_offset $11, 16
157 .cfi_rel_offset $12, 24
158 .cfi_rel_offset $13, 32
159 .cfi_rel_offset $14, 40
160 .cfi_rel_offset $15, 48
161 /* We don't really care about the FP registers for debugging. */
162.endm
163
164.macro UNDO_SWITCH_STACK
165 bsr $1, undo_switch_stack
166 .cfi_restore $9
167 .cfi_restore $10
168 .cfi_restore $11
169 .cfi_restore $12
170 .cfi_restore $13
171 .cfi_restore $14
172 .cfi_restore $15
173 .cfi_adjust_cfa_offset -SWITCH_STACK_SIZE
174.endm
88 175
89/* 176/*
90 * Non-syscall kernel entry points. 177 * Non-syscall kernel entry points.
91 */ 178 */
92 179
93 .align 4 180CFI_START_OSF_FRAME entInt
94 .globl entInt
95 .ent entInt
96entInt:
97 SAVE_ALL 181 SAVE_ALL
98 lda $8, 0x3fff 182 lda $8, 0x3fff
99 lda $26, ret_from_sys_call 183 lda $26, ret_from_sys_call
100 bic $sp, $8, $8 184 bic $sp, $8, $8
101 mov $sp, $19 185 mov $sp, $19
102 jsr $31, do_entInt 186 jsr $31, do_entInt
103.end entInt 187CFI_END_OSF_FRAME entInt
104 188
105 .align 4 189CFI_START_OSF_FRAME entArith
106 .globl entArith
107 .ent entArith
108entArith:
109 SAVE_ALL 190 SAVE_ALL
110 lda $8, 0x3fff 191 lda $8, 0x3fff
111 lda $26, ret_from_sys_call 192 lda $26, ret_from_sys_call
112 bic $sp, $8, $8 193 bic $sp, $8, $8
113 mov $sp, $18 194 mov $sp, $18
114 jsr $31, do_entArith 195 jsr $31, do_entArith
115.end entArith 196CFI_END_OSF_FRAME entArith
116 197
117 .align 4 198CFI_START_OSF_FRAME entMM
118 .globl entMM
119 .ent entMM
120entMM:
121 SAVE_ALL 199 SAVE_ALL
122/* save $9 - $15 so the inline exception code can manipulate them. */ 200/* save $9 - $15 so the inline exception code can manipulate them. */
123 subq $sp, 56, $sp 201 subq $sp, 56, $sp
202 .cfi_adjust_cfa_offset 56
124 stq $9, 0($sp) 203 stq $9, 0($sp)
125 stq $10, 8($sp) 204 stq $10, 8($sp)
126 stq $11, 16($sp) 205 stq $11, 16($sp)
@@ -128,6 +207,13 @@ entMM:
128 stq $13, 32($sp) 207 stq $13, 32($sp)
129 stq $14, 40($sp) 208 stq $14, 40($sp)
130 stq $15, 48($sp) 209 stq $15, 48($sp)
210 .cfi_rel_offset $9, 0
211 .cfi_rel_offset $10, 8
212 .cfi_rel_offset $11, 16
213 .cfi_rel_offset $12, 24
214 .cfi_rel_offset $13, 32
215 .cfi_rel_offset $14, 40
216 .cfi_rel_offset $15, 48
131 addq $sp, 56, $19 217 addq $sp, 56, $19
132/* handle the fault */ 218/* handle the fault */
133 lda $8, 0x3fff 219 lda $8, 0x3fff
@@ -142,28 +228,33 @@ entMM:
142 ldq $14, 40($sp) 228 ldq $14, 40($sp)
143 ldq $15, 48($sp) 229 ldq $15, 48($sp)
144 addq $sp, 56, $sp 230 addq $sp, 56, $sp
231 .cfi_restore $9
232 .cfi_restore $10
233 .cfi_restore $11
234 .cfi_restore $12
235 .cfi_restore $13
236 .cfi_restore $14
237 .cfi_restore $15
238 .cfi_adjust_cfa_offset -56
145/* finish up the syscall as normal. */ 239/* finish up the syscall as normal. */
146 br ret_from_sys_call 240 br ret_from_sys_call
147.end entMM 241CFI_END_OSF_FRAME entMM
148 242
149 .align 4 243CFI_START_OSF_FRAME entIF
150 .globl entIF
151 .ent entIF
152entIF:
153 SAVE_ALL 244 SAVE_ALL
154 lda $8, 0x3fff 245 lda $8, 0x3fff
155 lda $26, ret_from_sys_call 246 lda $26, ret_from_sys_call
156 bic $sp, $8, $8 247 bic $sp, $8, $8
157 mov $sp, $17 248 mov $sp, $17
158 jsr $31, do_entIF 249 jsr $31, do_entIF
159.end entIF 250CFI_END_OSF_FRAME entIF
160 251
161 .align 4 252CFI_START_OSF_FRAME entUna
162 .globl entUna
163 .ent entUna
164entUna:
165 lda $sp, -256($sp) 253 lda $sp, -256($sp)
254 .cfi_adjust_cfa_offset 256
166 stq $0, 0($sp) 255 stq $0, 0($sp)
256 .cfi_rel_offset $0, 0
257 .cfi_remember_state
167 ldq $0, 256($sp) /* get PS */ 258 ldq $0, 256($sp) /* get PS */
168 stq $1, 8($sp) 259 stq $1, 8($sp)
169 stq $2, 16($sp) 260 stq $2, 16($sp)
@@ -195,6 +286,32 @@ entUna:
195 stq $28, 224($sp) 286 stq $28, 224($sp)
196 mov $sp, $19 287 mov $sp, $19
197 stq $gp, 232($sp) 288 stq $gp, 232($sp)
289 .cfi_rel_offset $1, 1*8
290 .cfi_rel_offset $2, 2*8
291 .cfi_rel_offset $3, 3*8
292 .cfi_rel_offset $4, 4*8
293 .cfi_rel_offset $5, 5*8
294 .cfi_rel_offset $6, 6*8
295 .cfi_rel_offset $7, 7*8
296 .cfi_rel_offset $8, 8*8
297 .cfi_rel_offset $9, 9*8
298 .cfi_rel_offset $10, 10*8
299 .cfi_rel_offset $11, 11*8
300 .cfi_rel_offset $12, 12*8
301 .cfi_rel_offset $13, 13*8
302 .cfi_rel_offset $14, 14*8
303 .cfi_rel_offset $15, 15*8
304 .cfi_rel_offset $19, 19*8
305 .cfi_rel_offset $20, 20*8
306 .cfi_rel_offset $21, 21*8
307 .cfi_rel_offset $22, 22*8
308 .cfi_rel_offset $23, 23*8
309 .cfi_rel_offset $24, 24*8
310 .cfi_rel_offset $25, 25*8
311 .cfi_rel_offset $26, 26*8
312 .cfi_rel_offset $27, 27*8
313 .cfi_rel_offset $28, 28*8
314 .cfi_rel_offset $29, 29*8
198 lda $8, 0x3fff 315 lda $8, 0x3fff
199 stq $31, 248($sp) 316 stq $31, 248($sp)
200 bic $sp, $8, $8 317 bic $sp, $8, $8
@@ -228,16 +345,45 @@ entUna:
228 ldq $28, 224($sp) 345 ldq $28, 224($sp)
229 ldq $gp, 232($sp) 346 ldq $gp, 232($sp)
230 lda $sp, 256($sp) 347 lda $sp, 256($sp)
348 .cfi_restore $1
349 .cfi_restore $2
350 .cfi_restore $3
351 .cfi_restore $4
352 .cfi_restore $5
353 .cfi_restore $6
354 .cfi_restore $7
355 .cfi_restore $8
356 .cfi_restore $9
357 .cfi_restore $10
358 .cfi_restore $11
359 .cfi_restore $12
360 .cfi_restore $13
361 .cfi_restore $14
362 .cfi_restore $15
363 .cfi_restore $19
364 .cfi_restore $20
365 .cfi_restore $21
366 .cfi_restore $22
367 .cfi_restore $23
368 .cfi_restore $24
369 .cfi_restore $25
370 .cfi_restore $26
371 .cfi_restore $27
372 .cfi_restore $28
373 .cfi_restore $29
374 .cfi_adjust_cfa_offset -256
231 call_pal PAL_rti 375 call_pal PAL_rti
232.end entUna
233 376
234 .align 4 377 .align 4
235 .ent entUnaUser
236entUnaUser: 378entUnaUser:
379 .cfi_restore_state
237 ldq $0, 0($sp) /* restore original $0 */ 380 ldq $0, 0($sp) /* restore original $0 */
238 lda $sp, 256($sp) /* pop entUna's stack frame */ 381 lda $sp, 256($sp) /* pop entUna's stack frame */
382 .cfi_restore $0
383 .cfi_adjust_cfa_offset -256
239 SAVE_ALL /* setup normal kernel stack */ 384 SAVE_ALL /* setup normal kernel stack */
240 lda $sp, -56($sp) 385 lda $sp, -56($sp)
386 .cfi_adjust_cfa_offset 56
241 stq $9, 0($sp) 387 stq $9, 0($sp)
242 stq $10, 8($sp) 388 stq $10, 8($sp)
243 stq $11, 16($sp) 389 stq $11, 16($sp)
@@ -245,6 +391,13 @@ entUnaUser:
245 stq $13, 32($sp) 391 stq $13, 32($sp)
246 stq $14, 40($sp) 392 stq $14, 40($sp)
247 stq $15, 48($sp) 393 stq $15, 48($sp)
394 .cfi_rel_offset $9, 0
395 .cfi_rel_offset $10, 8
396 .cfi_rel_offset $11, 16
397 .cfi_rel_offset $12, 24
398 .cfi_rel_offset $13, 32
399 .cfi_rel_offset $14, 40
400 .cfi_rel_offset $15, 48
248 lda $8, 0x3fff 401 lda $8, 0x3fff
249 addq $sp, 56, $19 402 addq $sp, 56, $19
250 bic $sp, $8, $8 403 bic $sp, $8, $8
@@ -257,20 +410,25 @@ entUnaUser:
257 ldq $14, 40($sp) 410 ldq $14, 40($sp)
258 ldq $15, 48($sp) 411 ldq $15, 48($sp)
259 lda $sp, 56($sp) 412 lda $sp, 56($sp)
413 .cfi_restore $9
414 .cfi_restore $10
415 .cfi_restore $11
416 .cfi_restore $12
417 .cfi_restore $13
418 .cfi_restore $14
419 .cfi_restore $15
420 .cfi_adjust_cfa_offset -56
260 br ret_from_sys_call 421 br ret_from_sys_call
261.end entUnaUser 422CFI_END_OSF_FRAME entUna
262 423
263 .align 4 424CFI_START_OSF_FRAME entDbg
264 .globl entDbg
265 .ent entDbg
266entDbg:
267 SAVE_ALL 425 SAVE_ALL
268 lda $8, 0x3fff 426 lda $8, 0x3fff
269 lda $26, ret_from_sys_call 427 lda $26, ret_from_sys_call
270 bic $sp, $8, $8 428 bic $sp, $8, $8
271 mov $sp, $16 429 mov $sp, $16
272 jsr $31, do_entDbg 430 jsr $31, do_entDbg
273.end entDbg 431CFI_END_OSF_FRAME entDbg
274 432
275/* 433/*
276 * The system call entry point is special. Most importantly, it looks 434 * The system call entry point is special. Most importantly, it looks
@@ -285,8 +443,12 @@ entDbg:
285 443
286 .align 4 444 .align 4
287 .globl entSys 445 .globl entSys
288 .globl ret_from_sys_call 446 .type entSys, @function
289 .ent entSys 447 .cfi_startproc simple
448 .cfi_return_column 64
449 .cfi_def_cfa $sp, 48
450 .cfi_rel_offset 64, 8
451 .cfi_rel_offset $gp, 16
290entSys: 452entSys:
291 SAVE_ALL 453 SAVE_ALL
292 lda $8, 0x3fff 454 lda $8, 0x3fff
@@ -300,6 +462,9 @@ entSys:
300 stq $17, SP_OFF+32($sp) 462 stq $17, SP_OFF+32($sp)
301 s8addq $0, $5, $5 463 s8addq $0, $5, $5
302 stq $18, SP_OFF+40($sp) 464 stq $18, SP_OFF+40($sp)
465 .cfi_rel_offset $16, SP_OFF+24
466 .cfi_rel_offset $17, SP_OFF+32
467 .cfi_rel_offset $18, SP_OFF+40
303 blbs $3, strace 468 blbs $3, strace
304 beq $4, 1f 469 beq $4, 1f
305 ldq $27, 0($5) 470 ldq $27, 0($5)
@@ -310,6 +475,7 @@ entSys:
310 stq $31, 72($sp) /* a3=0 => no error */ 475 stq $31, 72($sp) /* a3=0 => no error */
311 476
312 .align 4 477 .align 4
478 .globl ret_from_sys_call
313ret_from_sys_call: 479ret_from_sys_call:
314 cmovne $26, 0, $18 /* $18 = 0 => non-restartable */ 480 cmovne $26, 0, $18 /* $18 = 0 => non-restartable */
315 ldq $0, SP_OFF($sp) 481 ldq $0, SP_OFF($sp)
@@ -324,10 +490,12 @@ ret_to_user:
324 and $17, _TIF_WORK_MASK, $2 490 and $17, _TIF_WORK_MASK, $2
325 bne $2, work_pending 491 bne $2, work_pending
326restore_all: 492restore_all:
493 .cfi_remember_state
327 RESTORE_ALL 494 RESTORE_ALL
328 call_pal PAL_rti 495 call_pal PAL_rti
329 496
330ret_to_kernel: 497ret_to_kernel:
498 .cfi_restore_state
331 lda $16, 7 499 lda $16, 7
332 call_pal PAL_swpipl 500 call_pal PAL_swpipl
333 br restore_all 501 br restore_all
@@ -356,7 +524,6 @@ $ret_success:
356 stq $0, 0($sp) 524 stq $0, 0($sp)
357 stq $31, 72($sp) /* a3=0 => no error */ 525 stq $31, 72($sp) /* a3=0 => no error */
358 br ret_from_sys_call 526 br ret_from_sys_call
359.end entSys
360 527
361/* 528/*
362 * Do all cleanup when returning from all interrupts and system calls. 529 * Do all cleanup when returning from all interrupts and system calls.
@@ -370,7 +537,7 @@ $ret_success:
370 */ 537 */
371 538
372 .align 4 539 .align 4
373 .ent work_pending 540 .type work_pending, @function
374work_pending: 541work_pending:
375 and $17, _TIF_NOTIFY_RESUME | _TIF_SIGPENDING, $2 542 and $17, _TIF_NOTIFY_RESUME | _TIF_SIGPENDING, $2
376 bne $2, $work_notifysig 543 bne $2, $work_notifysig
@@ -387,23 +554,22 @@ $work_resched:
387 554
388$work_notifysig: 555$work_notifysig:
389 mov $sp, $16 556 mov $sp, $16
390 bsr $1, do_switch_stack 557 DO_SWITCH_STACK
391 jsr $26, do_work_pending 558 jsr $26, do_work_pending
392 bsr $1, undo_switch_stack 559 UNDO_SWITCH_STACK
393 br restore_all 560 br restore_all
394.end work_pending
395 561
396/* 562/*
397 * PTRACE syscall handler 563 * PTRACE syscall handler
398 */ 564 */
399 565
400 .align 4 566 .align 4
401 .ent strace 567 .type strace, @function
402strace: 568strace:
403 /* set up signal stack, call syscall_trace */ 569 /* set up signal stack, call syscall_trace */
404 bsr $1, do_switch_stack 570 DO_SWITCH_STACK
405 jsr $26, syscall_trace_enter /* returns the syscall number */ 571 jsr $26, syscall_trace_enter /* returns the syscall number */
406 bsr $1, undo_switch_stack 572 UNDO_SWITCH_STACK
407 573
408 /* get the arguments back.. */ 574 /* get the arguments back.. */
409 ldq $16, SP_OFF+24($sp) 575 ldq $16, SP_OFF+24($sp)
@@ -431,9 +597,9 @@ ret_from_straced:
431$strace_success: 597$strace_success:
432 stq $0, 0($sp) /* save return value */ 598 stq $0, 0($sp) /* save return value */
433 599
434 bsr $1, do_switch_stack 600 DO_SWITCH_STACK
435 jsr $26, syscall_trace_leave 601 jsr $26, syscall_trace_leave
436 bsr $1, undo_switch_stack 602 UNDO_SWITCH_STACK
437 br $31, ret_from_sys_call 603 br $31, ret_from_sys_call
438 604
439 .align 3 605 .align 3
@@ -447,26 +613,31 @@ $strace_error:
447 stq $0, 0($sp) 613 stq $0, 0($sp)
448 stq $1, 72($sp) /* a3 for return */ 614 stq $1, 72($sp) /* a3 for return */
449 615
450 bsr $1, do_switch_stack 616 DO_SWITCH_STACK
451 mov $18, $9 /* save old syscall number */ 617 mov $18, $9 /* save old syscall number */
452 mov $19, $10 /* save old a3 */ 618 mov $19, $10 /* save old a3 */
453 jsr $26, syscall_trace_leave 619 jsr $26, syscall_trace_leave
454 mov $9, $18 620 mov $9, $18
455 mov $10, $19 621 mov $10, $19
456 bsr $1, undo_switch_stack 622 UNDO_SWITCH_STACK
457 623
458 mov $31, $26 /* tell "ret_from_sys_call" we can restart */ 624 mov $31, $26 /* tell "ret_from_sys_call" we can restart */
459 br ret_from_sys_call 625 br ret_from_sys_call
460.end strace 626CFI_END_OSF_FRAME entSys
461 627
462/* 628/*
463 * Save and restore the switch stack -- aka the balance of the user context. 629 * Save and restore the switch stack -- aka the balance of the user context.
464 */ 630 */
465 631
466 .align 4 632 .align 4
467 .ent do_switch_stack 633 .type do_switch_stack, @function
634 .cfi_startproc simple
635 .cfi_return_column 64
636 .cfi_def_cfa $sp, 0
637 .cfi_register 64, $1
468do_switch_stack: 638do_switch_stack:
469 lda $sp, -SWITCH_STACK_SIZE($sp) 639 lda $sp, -SWITCH_STACK_SIZE($sp)
640 .cfi_adjust_cfa_offset SWITCH_STACK_SIZE
470 stq $9, 0($sp) 641 stq $9, 0($sp)
471 stq $10, 8($sp) 642 stq $10, 8($sp)
472 stq $11, 16($sp) 643 stq $11, 16($sp)
@@ -510,10 +681,14 @@ do_switch_stack:
510 stt $f0, 312($sp) # save fpcr in slot of $f31 681 stt $f0, 312($sp) # save fpcr in slot of $f31
511 ldt $f0, 64($sp) # dont let "do_switch_stack" change fp state. 682 ldt $f0, 64($sp) # dont let "do_switch_stack" change fp state.
512 ret $31, ($1), 1 683 ret $31, ($1), 1
513.end do_switch_stack 684 .cfi_endproc
685 .size do_switch_stack, .-do_switch_stack
514 686
515 .align 4 687 .align 4
516 .ent undo_switch_stack 688 .type undo_switch_stack, @function
689 .cfi_startproc simple
690 .cfi_def_cfa $sp, 0
691 .cfi_register 64, $1
517undo_switch_stack: 692undo_switch_stack:
518 ldq $9, 0($sp) 693 ldq $9, 0($sp)
519 ldq $10, 8($sp) 694 ldq $10, 8($sp)
@@ -558,7 +733,8 @@ undo_switch_stack:
558 ldt $f30, 304($sp) 733 ldt $f30, 304($sp)
559 lda $sp, SWITCH_STACK_SIZE($sp) 734 lda $sp, SWITCH_STACK_SIZE($sp)
560 ret $31, ($1), 1 735 ret $31, ($1), 1
561.end undo_switch_stack 736 .cfi_endproc
737 .size undo_switch_stack, .-undo_switch_stack
562 738
563/* 739/*
564 * The meat of the context switch code. 740 * The meat of the context switch code.
@@ -566,17 +742,18 @@ undo_switch_stack:
566 742
567 .align 4 743 .align 4
568 .globl alpha_switch_to 744 .globl alpha_switch_to
569 .ent alpha_switch_to 745 .type alpha_switch_to, @function
746 .cfi_startproc
570alpha_switch_to: 747alpha_switch_to:
571 .prologue 0 748 DO_SWITCH_STACK
572 bsr $1, do_switch_stack
573 call_pal PAL_swpctx 749 call_pal PAL_swpctx
574 lda $8, 0x3fff 750 lda $8, 0x3fff
575 bsr $1, undo_switch_stack 751 UNDO_SWITCH_STACK
576 bic $sp, $8, $8 752 bic $sp, $8, $8
577 mov $17, $0 753 mov $17, $0
578 ret 754 ret
579.end alpha_switch_to 755 .cfi_endproc
756 .size alpha_switch_to, .-alpha_switch_to
580 757
581/* 758/*
582 * New processes begin life here. 759 * New processes begin life here.
diff --git a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c
index f433fc11877a..28e4429596f3 100644
--- a/arch/alpha/kernel/irq_alpha.c
+++ b/arch/alpha/kernel/irq_alpha.c
@@ -236,7 +236,7 @@ void __init
236init_rtc_irq(void) 236init_rtc_irq(void)
237{ 237{
238 irq_set_chip_and_handler_name(RTC_IRQ, &dummy_irq_chip, 238 irq_set_chip_and_handler_name(RTC_IRQ, &dummy_irq_chip,
239 handle_simple_irq, "RTC"); 239 handle_percpu_irq, "RTC");
240 setup_irq(RTC_IRQ, &timer_irqaction); 240 setup_irq(RTC_IRQ, &timer_irqaction);
241} 241}
242 242
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index 7b60834fb4b2..9dbbcb3b9146 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -116,7 +116,7 @@ wait_boot_cpu_to_stop(int cpuid)
116/* 116/*
117 * Where secondaries begin a life of C. 117 * Where secondaries begin a life of C.
118 */ 118 */
119void __cpuinit 119void
120smp_callin(void) 120smp_callin(void)
121{ 121{
122 int cpuid = hard_smp_processor_id(); 122 int cpuid = hard_smp_processor_id();
@@ -194,7 +194,7 @@ wait_for_txrdy (unsigned long cpumask)
194 * Send a message to a secondary's console. "START" is one such 194 * Send a message to a secondary's console. "START" is one such
195 * interesting message. ;-) 195 * interesting message. ;-)
196 */ 196 */
197static void __cpuinit 197static void
198send_secondary_console_msg(char *str, int cpuid) 198send_secondary_console_msg(char *str, int cpuid)
199{ 199{
200 struct percpu_struct *cpu; 200 struct percpu_struct *cpu;
@@ -264,9 +264,10 @@ recv_secondary_console_msg(void)
264 if (cnt <= 0 || cnt >= 80) 264 if (cnt <= 0 || cnt >= 80)
265 strcpy(buf, "<<< BOGUS MSG >>>"); 265 strcpy(buf, "<<< BOGUS MSG >>>");
266 else { 266 else {
267 cp1 = (char *) &cpu->ipc_buffer[11]; 267 cp1 = (char *) &cpu->ipc_buffer[1];
268 cp2 = buf; 268 cp2 = buf;
269 strcpy(cp2, cp1); 269 memcpy(cp2, cp1, cnt);
270 cp2[cnt] = '\0';
270 271
271 while ((cp2 = strchr(cp2, '\r')) != 0) { 272 while ((cp2 = strchr(cp2, '\r')) != 0) {
272 *cp2 = ' '; 273 *cp2 = ' ';
@@ -285,7 +286,7 @@ recv_secondary_console_msg(void)
285/* 286/*
286 * Convince the console to have a secondary cpu begin execution. 287 * Convince the console to have a secondary cpu begin execution.
287 */ 288 */
288static int __cpuinit 289static int
289secondary_cpu_start(int cpuid, struct task_struct *idle) 290secondary_cpu_start(int cpuid, struct task_struct *idle)
290{ 291{
291 struct percpu_struct *cpu; 292 struct percpu_struct *cpu;
@@ -356,7 +357,7 @@ secondary_cpu_start(int cpuid, struct task_struct *idle)
356/* 357/*
357 * Bring one cpu online. 358 * Bring one cpu online.
358 */ 359 */
359static int __cpuinit 360static int
360smp_boot_one_cpu(int cpuid, struct task_struct *idle) 361smp_boot_one_cpu(int cpuid, struct task_struct *idle)
361{ 362{
362 unsigned long timeout; 363 unsigned long timeout;
@@ -472,7 +473,7 @@ smp_prepare_boot_cpu(void)
472{ 473{
473} 474}
474 475
475int __cpuinit 476int
476__cpu_up(unsigned int cpu, struct task_struct *tidle) 477__cpu_up(unsigned int cpu, struct task_struct *tidle)
477{ 478{
478 smp_boot_one_cpu(cpu, tidle); 479 smp_boot_one_cpu(cpu, tidle);
diff --git a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c
index 5bf401f7ea97..6c35159bc00e 100644
--- a/arch/alpha/kernel/sys_dp264.c
+++ b/arch/alpha/kernel/sys_dp264.c
@@ -190,9 +190,6 @@ static struct irq_chip clipper_irq_type = {
190static void 190static void
191dp264_device_interrupt(unsigned long vector) 191dp264_device_interrupt(unsigned long vector)
192{ 192{
193#if 1
194 printk("dp264_device_interrupt: NOT IMPLEMENTED YET!!\n");
195#else
196 unsigned long pld; 193 unsigned long pld;
197 unsigned int i; 194 unsigned int i;
198 195
@@ -210,12 +207,7 @@ dp264_device_interrupt(unsigned long vector)
210 isa_device_interrupt(vector); 207 isa_device_interrupt(vector);
211 else 208 else
212 handle_irq(16 + i); 209 handle_irq(16 + i);
213#if 0
214 TSUNAMI_cchip->dir0.csr = 1UL << i; mb();
215 tmp = TSUNAMI_cchip->dir0.csr;
216#endif
217 } 210 }
218#endif
219} 211}
220 212
221static void 213static void
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c
index 407accc80877..c92e389ff219 100644
--- a/arch/alpha/kernel/sys_marvel.c
+++ b/arch/alpha/kernel/sys_marvel.c
@@ -317,8 +317,9 @@ marvel_init_irq(void)
317} 317}
318 318
319static int 319static int
320marvel_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 320marvel_map_irq(const struct pci_dev *cdev, u8 slot, u8 pin)
321{ 321{
322 struct pci_dev *dev = (struct pci_dev *)cdev;
322 struct pci_controller *hose = dev->sysdata; 323 struct pci_controller *hose = dev->sysdata;
323 struct io7_port *io7_port = hose->sysdata; 324 struct io7_port *io7_port = hose->sysdata;
324 struct io7 *io7 = io7_port->io7; 325 struct io7 *io7 = io7_port->io7;
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index 4284ec798ec9..dca9b3fb0071 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -524,6 +524,8 @@ sys_call_table:
524 .quad sys_sendmmsg 524 .quad sys_sendmmsg
525 .quad sys_process_vm_readv 525 .quad sys_process_vm_readv
526 .quad sys_process_vm_writev /* 505 */ 526 .quad sys_process_vm_writev /* 505 */
527 .quad sys_kcmp
528 .quad sys_finit_module
527 529
528 .size sys_call_table, . - sys_call_table 530 .size sys_call_table, . - sys_call_table
529 .type sys_call_table, @object 531 .type sys_call_table, @object
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index e336694ca042..ea3395036556 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -105,9 +105,7 @@ void arch_irq_work_raise(void)
105 105
106static inline __u32 rpcc(void) 106static inline __u32 rpcc(void)
107{ 107{
108 __u32 result; 108 return __builtin_alpha_rpcc();
109 asm volatile ("rpcc %0" : "=r"(result));
110 return result;
111} 109}
112 110
113int update_persistent_clock(struct timespec now) 111int update_persistent_clock(struct timespec now)
diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c
index affccb959a9e..bd0665cdc840 100644
--- a/arch/alpha/kernel/traps.c
+++ b/arch/alpha/kernel/traps.c
@@ -32,7 +32,7 @@
32 32
33static int opDEC_fix; 33static int opDEC_fix;
34 34
35static void __cpuinit 35static void
36opDEC_check(void) 36opDEC_check(void)
37{ 37{
38 __asm__ __volatile__ ( 38 __asm__ __volatile__ (
@@ -66,8 +66,8 @@ dik_show_regs(struct pt_regs *regs, unsigned long *r9_15)
66{ 66{
67 printk("pc = [<%016lx>] ra = [<%016lx>] ps = %04lx %s\n", 67 printk("pc = [<%016lx>] ra = [<%016lx>] ps = %04lx %s\n",
68 regs->pc, regs->r26, regs->ps, print_tainted()); 68 regs->pc, regs->r26, regs->ps, print_tainted());
69 print_symbol("pc is at %s\n", regs->pc); 69 printk("pc is at %pSR\n", (void *)regs->pc);
70 print_symbol("ra is at %s\n", regs->r26 ); 70 printk("ra is at %pSR\n", (void *)regs->r26);
71 printk("v0 = %016lx t0 = %016lx t1 = %016lx\n", 71 printk("v0 = %016lx t0 = %016lx t1 = %016lx\n",
72 regs->r0, regs->r1, regs->r2); 72 regs->r0, regs->r1, regs->r2);
73 printk("t2 = %016lx t3 = %016lx t4 = %016lx\n", 73 printk("t2 = %016lx t3 = %016lx t4 = %016lx\n",
@@ -132,9 +132,7 @@ dik_show_trace(unsigned long *sp)
132 continue; 132 continue;
133 if (tmp >= (unsigned long) &_etext) 133 if (tmp >= (unsigned long) &_etext)
134 continue; 134 continue;
135 printk("[<%lx>]", tmp); 135 printk("[<%lx>] %pSR\n", tmp, (void *)tmp);
136 print_symbol(" %s", tmp);
137 printk("\n");
138 if (i > 40) { 136 if (i > 40) {
139 printk(" ..."); 137 printk(" ...");
140 break; 138 break;
@@ -1059,7 +1057,7 @@ give_sigbus:
1059 return; 1057 return;
1060} 1058}
1061 1059
1062void __cpuinit 1060void
1063trap_init(void) 1061trap_init(void)
1064{ 1062{
1065 /* Tell PAL-code what global pointer we want in the kernel. */ 1063 /* Tell PAL-code what global pointer we want in the kernel. */
diff --git a/arch/arc/boot/dts/abilis_tb100.dtsi b/arch/arc/boot/dts/abilis_tb100.dtsi
index 941ad118a7e7..d9f8249aa66e 100644
--- a/arch/arc/boot/dts/abilis_tb100.dtsi
+++ b/arch/arc/boot/dts/abilis_tb100.dtsi
@@ -21,10 +21,6 @@
21 21
22/include/ "abilis_tb10x.dtsi" 22/include/ "abilis_tb10x.dtsi"
23 23
24/* interrupt specifiers
25 * --------------------
26 * 0: rising, 1: low, 2: high, 3: falling,
27 */
28 24
29/ { 25/ {
30 clock-frequency = <500000000>; /* 500 MHZ */ 26 clock-frequency = <500000000>; /* 500 MHZ */
@@ -173,7 +169,7 @@
173 interrupt-controller; 169 interrupt-controller;
174 #interrupt-cells = <1>; 170 #interrupt-cells = <1>;
175 interrupt-parent = <&tb10x_ictl>; 171 interrupt-parent = <&tb10x_ictl>;
176 interrupts = <27 1>; 172 interrupts = <27 2>;
177 reg = <0xFF140000 0x1000>; 173 reg = <0xFF140000 0x1000>;
178 gpio-controller; 174 gpio-controller;
179 #gpio-cells = <1>; 175 #gpio-cells = <1>;
@@ -185,7 +181,7 @@
185 interrupt-controller; 181 interrupt-controller;
186 #interrupt-cells = <1>; 182 #interrupt-cells = <1>;
187 interrupt-parent = <&tb10x_ictl>; 183 interrupt-parent = <&tb10x_ictl>;
188 interrupts = <27 1>; 184 interrupts = <27 2>;
189 reg = <0xFF141000 0x1000>; 185 reg = <0xFF141000 0x1000>;
190 gpio-controller; 186 gpio-controller;
191 #gpio-cells = <1>; 187 #gpio-cells = <1>;
@@ -197,7 +193,7 @@
197 interrupt-controller; 193 interrupt-controller;
198 #interrupt-cells = <1>; 194 #interrupt-cells = <1>;
199 interrupt-parent = <&tb10x_ictl>; 195 interrupt-parent = <&tb10x_ictl>;
200 interrupts = <27 1>; 196 interrupts = <27 2>;
201 reg = <0xFF142000 0x1000>; 197 reg = <0xFF142000 0x1000>;
202 gpio-controller; 198 gpio-controller;
203 #gpio-cells = <1>; 199 #gpio-cells = <1>;
@@ -209,7 +205,7 @@
209 interrupt-controller; 205 interrupt-controller;
210 #interrupt-cells = <1>; 206 #interrupt-cells = <1>;
211 interrupt-parent = <&tb10x_ictl>; 207 interrupt-parent = <&tb10x_ictl>;
212 interrupts = <27 1>; 208 interrupts = <27 2>;
213 reg = <0xFF143000 0x1000>; 209 reg = <0xFF143000 0x1000>;
214 gpio-controller; 210 gpio-controller;
215 #gpio-cells = <1>; 211 #gpio-cells = <1>;
@@ -221,7 +217,7 @@
221 interrupt-controller; 217 interrupt-controller;
222 #interrupt-cells = <1>; 218 #interrupt-cells = <1>;
223 interrupt-parent = <&tb10x_ictl>; 219 interrupt-parent = <&tb10x_ictl>;
224 interrupts = <27 1>; 220 interrupts = <27 2>;
225 reg = <0xFF144000 0x1000>; 221 reg = <0xFF144000 0x1000>;
226 gpio-controller; 222 gpio-controller;
227 #gpio-cells = <1>; 223 #gpio-cells = <1>;
@@ -233,7 +229,7 @@
233 interrupt-controller; 229 interrupt-controller;
234 #interrupt-cells = <1>; 230 #interrupt-cells = <1>;
235 interrupt-parent = <&tb10x_ictl>; 231 interrupt-parent = <&tb10x_ictl>;
236 interrupts = <27 1>; 232 interrupts = <27 2>;
237 reg = <0xFF145000 0x1000>; 233 reg = <0xFF145000 0x1000>;
238 gpio-controller; 234 gpio-controller;
239 #gpio-cells = <1>; 235 #gpio-cells = <1>;
@@ -245,7 +241,7 @@
245 interrupt-controller; 241 interrupt-controller;
246 #interrupt-cells = <1>; 242 #interrupt-cells = <1>;
247 interrupt-parent = <&tb10x_ictl>; 243 interrupt-parent = <&tb10x_ictl>;
248 interrupts = <27 1>; 244 interrupts = <27 2>;
249 reg = <0xFF146000 0x1000>; 245 reg = <0xFF146000 0x1000>;
250 gpio-controller; 246 gpio-controller;
251 #gpio-cells = <1>; 247 #gpio-cells = <1>;
@@ -257,7 +253,7 @@
257 interrupt-controller; 253 interrupt-controller;
258 #interrupt-cells = <1>; 254 #interrupt-cells = <1>;
259 interrupt-parent = <&tb10x_ictl>; 255 interrupt-parent = <&tb10x_ictl>;
260 interrupts = <27 1>; 256 interrupts = <27 2>;
261 reg = <0xFF147000 0x1000>; 257 reg = <0xFF147000 0x1000>;
262 gpio-controller; 258 gpio-controller;
263 #gpio-cells = <1>; 259 #gpio-cells = <1>;
@@ -269,7 +265,7 @@
269 interrupt-controller; 265 interrupt-controller;
270 #interrupt-cells = <1>; 266 #interrupt-cells = <1>;
271 interrupt-parent = <&tb10x_ictl>; 267 interrupt-parent = <&tb10x_ictl>;
272 interrupts = <27 1>; 268 interrupts = <27 2>;
273 reg = <0xFF148000 0x1000>; 269 reg = <0xFF148000 0x1000>;
274 gpio-controller; 270 gpio-controller;
275 #gpio-cells = <1>; 271 #gpio-cells = <1>;
@@ -281,7 +277,7 @@
281 interrupt-controller; 277 interrupt-controller;
282 #interrupt-cells = <1>; 278 #interrupt-cells = <1>;
283 interrupt-parent = <&tb10x_ictl>; 279 interrupt-parent = <&tb10x_ictl>;
284 interrupts = <27 1>; 280 interrupts = <27 2>;
285 reg = <0xFF149000 0x1000>; 281 reg = <0xFF149000 0x1000>;
286 gpio-controller; 282 gpio-controller;
287 #gpio-cells = <1>; 283 #gpio-cells = <1>;
@@ -293,7 +289,7 @@
293 interrupt-controller; 289 interrupt-controller;
294 #interrupt-cells = <1>; 290 #interrupt-cells = <1>;
295 interrupt-parent = <&tb10x_ictl>; 291 interrupt-parent = <&tb10x_ictl>;
296 interrupts = <27 1>; 292 interrupts = <27 2>;
297 reg = <0xFF14A000 0x1000>; 293 reg = <0xFF14A000 0x1000>;
298 gpio-controller; 294 gpio-controller;
299 #gpio-cells = <1>; 295 #gpio-cells = <1>;
@@ -305,7 +301,7 @@
305 interrupt-controller; 301 interrupt-controller;
306 #interrupt-cells = <1>; 302 #interrupt-cells = <1>;
307 interrupt-parent = <&tb10x_ictl>; 303 interrupt-parent = <&tb10x_ictl>;
308 interrupts = <27 1>; 304 interrupts = <27 2>;
309 reg = <0xFF14B000 0x1000>; 305 reg = <0xFF14B000 0x1000>;
310 gpio-controller; 306 gpio-controller;
311 #gpio-cells = <1>; 307 #gpio-cells = <1>;
@@ -317,7 +313,7 @@
317 interrupt-controller; 313 interrupt-controller;
318 #interrupt-cells = <1>; 314 #interrupt-cells = <1>;
319 interrupt-parent = <&tb10x_ictl>; 315 interrupt-parent = <&tb10x_ictl>;
320 interrupts = <27 1>; 316 interrupts = <27 2>;
321 reg = <0xFF14C000 0x1000>; 317 reg = <0xFF14C000 0x1000>;
322 gpio-controller; 318 gpio-controller;
323 #gpio-cells = <1>; 319 #gpio-cells = <1>;
@@ -329,7 +325,7 @@
329 interrupt-controller; 325 interrupt-controller;
330 #interrupt-cells = <1>; 326 #interrupt-cells = <1>;
331 interrupt-parent = <&tb10x_ictl>; 327 interrupt-parent = <&tb10x_ictl>;
332 interrupts = <27 1>; 328 interrupts = <27 2>;
333 reg = <0xFF14D000 0x1000>; 329 reg = <0xFF14D000 0x1000>;
334 gpio-controller; 330 gpio-controller;
335 #gpio-cells = <1>; 331 #gpio-cells = <1>;
diff --git a/arch/arc/boot/dts/abilis_tb101.dtsi b/arch/arc/boot/dts/abilis_tb101.dtsi
index fd25c212049f..da8ca7941e67 100644
--- a/arch/arc/boot/dts/abilis_tb101.dtsi
+++ b/arch/arc/boot/dts/abilis_tb101.dtsi
@@ -21,10 +21,6 @@
21 21
22/include/ "abilis_tb10x.dtsi" 22/include/ "abilis_tb10x.dtsi"
23 23
24/* interrupt specifiers
25 * --------------------
26 * 0: rising, 1: low, 2: high, 3: falling,
27 */
28 24
29/ { 25/ {
30 clock-frequency = <500000000>; /* 500 MHZ */ 26 clock-frequency = <500000000>; /* 500 MHZ */
@@ -182,7 +178,7 @@
182 interrupt-controller; 178 interrupt-controller;
183 #interrupt-cells = <1>; 179 #interrupt-cells = <1>;
184 interrupt-parent = <&tb10x_ictl>; 180 interrupt-parent = <&tb10x_ictl>;
185 interrupts = <27 1>; 181 interrupts = <27 2>;
186 reg = <0xFF140000 0x1000>; 182 reg = <0xFF140000 0x1000>;
187 gpio-controller; 183 gpio-controller;
188 #gpio-cells = <1>; 184 #gpio-cells = <1>;
@@ -194,7 +190,7 @@
194 interrupt-controller; 190 interrupt-controller;
195 #interrupt-cells = <1>; 191 #interrupt-cells = <1>;
196 interrupt-parent = <&tb10x_ictl>; 192 interrupt-parent = <&tb10x_ictl>;
197 interrupts = <27 1>; 193 interrupts = <27 2>;
198 reg = <0xFF141000 0x1000>; 194 reg = <0xFF141000 0x1000>;
199 gpio-controller; 195 gpio-controller;
200 #gpio-cells = <1>; 196 #gpio-cells = <1>;
@@ -206,7 +202,7 @@
206 interrupt-controller; 202 interrupt-controller;
207 #interrupt-cells = <1>; 203 #interrupt-cells = <1>;
208 interrupt-parent = <&tb10x_ictl>; 204 interrupt-parent = <&tb10x_ictl>;
209 interrupts = <27 1>; 205 interrupts = <27 2>;
210 reg = <0xFF142000 0x1000>; 206 reg = <0xFF142000 0x1000>;
211 gpio-controller; 207 gpio-controller;
212 #gpio-cells = <1>; 208 #gpio-cells = <1>;
@@ -218,7 +214,7 @@
218 interrupt-controller; 214 interrupt-controller;
219 #interrupt-cells = <1>; 215 #interrupt-cells = <1>;
220 interrupt-parent = <&tb10x_ictl>; 216 interrupt-parent = <&tb10x_ictl>;
221 interrupts = <27 1>; 217 interrupts = <27 2>;
222 reg = <0xFF143000 0x1000>; 218 reg = <0xFF143000 0x1000>;
223 gpio-controller; 219 gpio-controller;
224 #gpio-cells = <1>; 220 #gpio-cells = <1>;
@@ -230,7 +226,7 @@
230 interrupt-controller; 226 interrupt-controller;
231 #interrupt-cells = <1>; 227 #interrupt-cells = <1>;
232 interrupt-parent = <&tb10x_ictl>; 228 interrupt-parent = <&tb10x_ictl>;
233 interrupts = <27 1>; 229 interrupts = <27 2>;
234 reg = <0xFF144000 0x1000>; 230 reg = <0xFF144000 0x1000>;
235 gpio-controller; 231 gpio-controller;
236 #gpio-cells = <1>; 232 #gpio-cells = <1>;
@@ -242,7 +238,7 @@
242 interrupt-controller; 238 interrupt-controller;
243 #interrupt-cells = <1>; 239 #interrupt-cells = <1>;
244 interrupt-parent = <&tb10x_ictl>; 240 interrupt-parent = <&tb10x_ictl>;
245 interrupts = <27 1>; 241 interrupts = <27 2>;
246 reg = <0xFF145000 0x1000>; 242 reg = <0xFF145000 0x1000>;
247 gpio-controller; 243 gpio-controller;
248 #gpio-cells = <1>; 244 #gpio-cells = <1>;
@@ -254,7 +250,7 @@
254 interrupt-controller; 250 interrupt-controller;
255 #interrupt-cells = <1>; 251 #interrupt-cells = <1>;
256 interrupt-parent = <&tb10x_ictl>; 252 interrupt-parent = <&tb10x_ictl>;
257 interrupts = <27 1>; 253 interrupts = <27 2>;
258 reg = <0xFF146000 0x1000>; 254 reg = <0xFF146000 0x1000>;
259 gpio-controller; 255 gpio-controller;
260 #gpio-cells = <1>; 256 #gpio-cells = <1>;
@@ -266,7 +262,7 @@
266 interrupt-controller; 262 interrupt-controller;
267 #interrupt-cells = <1>; 263 #interrupt-cells = <1>;
268 interrupt-parent = <&tb10x_ictl>; 264 interrupt-parent = <&tb10x_ictl>;
269 interrupts = <27 1>; 265 interrupts = <27 2>;
270 reg = <0xFF147000 0x1000>; 266 reg = <0xFF147000 0x1000>;
271 gpio-controller; 267 gpio-controller;
272 #gpio-cells = <1>; 268 #gpio-cells = <1>;
@@ -278,7 +274,7 @@
278 interrupt-controller; 274 interrupt-controller;
279 #interrupt-cells = <1>; 275 #interrupt-cells = <1>;
280 interrupt-parent = <&tb10x_ictl>; 276 interrupt-parent = <&tb10x_ictl>;
281 interrupts = <27 1>; 277 interrupts = <27 2>;
282 reg = <0xFF148000 0x1000>; 278 reg = <0xFF148000 0x1000>;
283 gpio-controller; 279 gpio-controller;
284 #gpio-cells = <1>; 280 #gpio-cells = <1>;
@@ -290,7 +286,7 @@
290 interrupt-controller; 286 interrupt-controller;
291 #interrupt-cells = <1>; 287 #interrupt-cells = <1>;
292 interrupt-parent = <&tb10x_ictl>; 288 interrupt-parent = <&tb10x_ictl>;
293 interrupts = <27 1>; 289 interrupts = <27 2>;
294 reg = <0xFF149000 0x1000>; 290 reg = <0xFF149000 0x1000>;
295 gpio-controller; 291 gpio-controller;
296 #gpio-cells = <1>; 292 #gpio-cells = <1>;
@@ -302,7 +298,7 @@
302 interrupt-controller; 298 interrupt-controller;
303 #interrupt-cells = <1>; 299 #interrupt-cells = <1>;
304 interrupt-parent = <&tb10x_ictl>; 300 interrupt-parent = <&tb10x_ictl>;
305 interrupts = <27 1>; 301 interrupts = <27 2>;
306 reg = <0xFF14A000 0x1000>; 302 reg = <0xFF14A000 0x1000>;
307 gpio-controller; 303 gpio-controller;
308 #gpio-cells = <1>; 304 #gpio-cells = <1>;
@@ -314,7 +310,7 @@
314 interrupt-controller; 310 interrupt-controller;
315 #interrupt-cells = <1>; 311 #interrupt-cells = <1>;
316 interrupt-parent = <&tb10x_ictl>; 312 interrupt-parent = <&tb10x_ictl>;
317 interrupts = <27 1>; 313 interrupts = <27 2>;
318 reg = <0xFF14B000 0x1000>; 314 reg = <0xFF14B000 0x1000>;
319 gpio-controller; 315 gpio-controller;
320 #gpio-cells = <1>; 316 #gpio-cells = <1>;
@@ -326,7 +322,7 @@
326 interrupt-controller; 322 interrupt-controller;
327 #interrupt-cells = <1>; 323 #interrupt-cells = <1>;
328 interrupt-parent = <&tb10x_ictl>; 324 interrupt-parent = <&tb10x_ictl>;
329 interrupts = <27 1>; 325 interrupts = <27 2>;
330 reg = <0xFF14C000 0x1000>; 326 reg = <0xFF14C000 0x1000>;
331 gpio-controller; 327 gpio-controller;
332 #gpio-cells = <1>; 328 #gpio-cells = <1>;
@@ -338,7 +334,7 @@
338 interrupt-controller; 334 interrupt-controller;
339 #interrupt-cells = <1>; 335 #interrupt-cells = <1>;
340 interrupt-parent = <&tb10x_ictl>; 336 interrupt-parent = <&tb10x_ictl>;
341 interrupts = <27 1>; 337 interrupts = <27 2>;
342 reg = <0xFF14D000 0x1000>; 338 reg = <0xFF14D000 0x1000>;
343 gpio-controller; 339 gpio-controller;
344 #gpio-cells = <1>; 340 #gpio-cells = <1>;
diff --git a/arch/arc/boot/dts/abilis_tb10x.dtsi b/arch/arc/boot/dts/abilis_tb10x.dtsi
index b97e3051ba4b..edf56f4749e1 100644
--- a/arch/arc/boot/dts/abilis_tb10x.dtsi
+++ b/arch/arc/boot/dts/abilis_tb10x.dtsi
@@ -19,10 +19,6 @@
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21 21
22/* interrupt specifiers
23 * --------------------
24 * 0: rising, 1: low, 2: high, 3: falling,
25 */
26 22
27/ { 23/ {
28 compatible = "abilis,arc-tb10x"; 24 compatible = "abilis,arc-tb10x";
@@ -78,7 +74,7 @@
78 #interrupt-cells = <1>; 74 #interrupt-cells = <1>;
79 }; 75 };
80 tb10x_ictl: pic@fe002000 { 76 tb10x_ictl: pic@fe002000 {
81 compatible = "abilis,tb10x_ictl"; 77 compatible = "abilis,tb10x-ictl";
82 reg = <0xFE002000 0x20>; 78 reg = <0xFE002000 0x20>;
83 interrupt-controller; 79 interrupt-controller;
84 #interrupt-cells = <2>; 80 #interrupt-cells = <2>;
@@ -91,7 +87,7 @@
91 compatible = "snps,dw-apb-uart"; 87 compatible = "snps,dw-apb-uart";
92 reg = <0xFF100000 0x100>; 88 reg = <0xFF100000 0x100>;
93 clock-frequency = <166666666>; 89 clock-frequency = <166666666>;
94 interrupts = <25 1>; 90 interrupts = <25 8>;
95 reg-shift = <2>; 91 reg-shift = <2>;
96 reg-io-width = <4>; 92 reg-io-width = <4>;
97 interrupt-parent = <&tb10x_ictl>; 93 interrupt-parent = <&tb10x_ictl>;
@@ -100,7 +96,7 @@
100 compatible = "snps,dwmac-3.70a","snps,dwmac"; 96 compatible = "snps,dwmac-3.70a","snps,dwmac";
101 reg = <0xFE100000 0x1058>; 97 reg = <0xFE100000 0x1058>;
102 interrupt-parent = <&tb10x_ictl>; 98 interrupt-parent = <&tb10x_ictl>;
103 interrupts = <6 1>; 99 interrupts = <6 8>;
104 interrupt-names = "macirq"; 100 interrupt-names = "macirq";
105 clocks = <&ahb_clk>; 101 clocks = <&ahb_clk>;
106 clock-names = "stmmaceth"; 102 clock-names = "stmmaceth";
@@ -109,7 +105,7 @@
109 compatible = "snps,dma-spear1340"; 105 compatible = "snps,dma-spear1340";
110 reg = <0xFE000000 0x400>; 106 reg = <0xFE000000 0x400>;
111 interrupt-parent = <&tb10x_ictl>; 107 interrupt-parent = <&tb10x_ictl>;
112 interrupts = <14 1>; 108 interrupts = <14 8>;
113 dma-channels = <6>; 109 dma-channels = <6>;
114 dma-requests = <0>; 110 dma-requests = <0>;
115 dma-masters = <1>; 111 dma-masters = <1>;
@@ -128,7 +124,7 @@
128 compatible = "snps,designware-i2c"; 124 compatible = "snps,designware-i2c";
129 reg = <0xFF120000 0x1000>; 125 reg = <0xFF120000 0x1000>;
130 interrupt-parent = <&tb10x_ictl>; 126 interrupt-parent = <&tb10x_ictl>;
131 interrupts = <12 1>; 127 interrupts = <12 8>;
132 clocks = <&ahb_clk>; 128 clocks = <&ahb_clk>;
133 }; 129 };
134 i2c1: i2c@FF121000 { 130 i2c1: i2c@FF121000 {
@@ -137,7 +133,7 @@
137 compatible = "snps,designware-i2c"; 133 compatible = "snps,designware-i2c";
138 reg = <0xFF121000 0x1000>; 134 reg = <0xFF121000 0x1000>;
139 interrupt-parent = <&tb10x_ictl>; 135 interrupt-parent = <&tb10x_ictl>;
140 interrupts = <12 1>; 136 interrupts = <12 8>;
141 clocks = <&ahb_clk>; 137 clocks = <&ahb_clk>;
142 }; 138 };
143 i2c2: i2c@FF122000 { 139 i2c2: i2c@FF122000 {
@@ -146,7 +142,7 @@
146 compatible = "snps,designware-i2c"; 142 compatible = "snps,designware-i2c";
147 reg = <0xFF122000 0x1000>; 143 reg = <0xFF122000 0x1000>;
148 interrupt-parent = <&tb10x_ictl>; 144 interrupt-parent = <&tb10x_ictl>;
149 interrupts = <12 1>; 145 interrupts = <12 8>;
150 clocks = <&ahb_clk>; 146 clocks = <&ahb_clk>;
151 }; 147 };
152 i2c3: i2c@FF123000 { 148 i2c3: i2c@FF123000 {
@@ -155,7 +151,7 @@
155 compatible = "snps,designware-i2c"; 151 compatible = "snps,designware-i2c";
156 reg = <0xFF123000 0x1000>; 152 reg = <0xFF123000 0x1000>;
157 interrupt-parent = <&tb10x_ictl>; 153 interrupt-parent = <&tb10x_ictl>;
158 interrupts = <12 1>; 154 interrupts = <12 8>;
159 clocks = <&ahb_clk>; 155 clocks = <&ahb_clk>;
160 }; 156 };
161 i2c4: i2c@FF124000 { 157 i2c4: i2c@FF124000 {
@@ -164,7 +160,7 @@
164 compatible = "snps,designware-i2c"; 160 compatible = "snps,designware-i2c";
165 reg = <0xFF124000 0x1000>; 161 reg = <0xFF124000 0x1000>;
166 interrupt-parent = <&tb10x_ictl>; 162 interrupt-parent = <&tb10x_ictl>;
167 interrupts = <12 1>; 163 interrupts = <12 8>;
168 clocks = <&ahb_clk>; 164 clocks = <&ahb_clk>;
169 }; 165 };
170 166
@@ -176,7 +172,7 @@
176 num-cs = <1>; 172 num-cs = <1>;
177 reg = <0xFE010000 0x20>; 173 reg = <0xFE010000 0x20>;
178 interrupt-parent = <&tb10x_ictl>; 174 interrupt-parent = <&tb10x_ictl>;
179 interrupts = <26 1>; 175 interrupts = <26 8>;
180 clocks = <&ahb_clk>; 176 clocks = <&ahb_clk>;
181 }; 177 };
182 spi1: spi@0xFE011000 { 178 spi1: spi@0xFE011000 {
@@ -187,7 +183,7 @@
187 num-cs = <2>; 183 num-cs = <2>;
188 reg = <0xFE011000 0x20>; 184 reg = <0xFE011000 0x20>;
189 interrupt-parent = <&tb10x_ictl>; 185 interrupt-parent = <&tb10x_ictl>;
190 interrupts = <10 1>; 186 interrupts = <10 8>;
191 clocks = <&ahb_clk>; 187 clocks = <&ahb_clk>;
192 }; 188 };
193 189
@@ -195,7 +191,7 @@
195 compatible = "abilis,tb100-tsm"; 191 compatible = "abilis,tb100-tsm";
196 reg = <0xff316000 0x400>; 192 reg = <0xff316000 0x400>;
197 interrupt-parent = <&tb10x_ictl>; 193 interrupt-parent = <&tb10x_ictl>;
198 interrupts = <17 1>; 194 interrupts = <17 8>;
199 output-clkdiv = <4>; 195 output-clkdiv = <4>;
200 global-packet-delay = <0x21>; 196 global-packet-delay = <0x21>;
201 port-packet-delay = <0>; 197 port-packet-delay = <0>;
@@ -213,7 +209,7 @@
213 "cpuctrl", 209 "cpuctrl",
214 "a6it_int_force"; 210 "a6it_int_force";
215 interrupt-parent = <&tb10x_ictl>; 211 interrupt-parent = <&tb10x_ictl>;
216 interrupts = <20 1>, <19 1>; 212 interrupts = <20 2>, <19 2>;
217 interrupt-names = "cmd_irq", "event_irq"; 213 interrupt-names = "cmd_irq", "event_irq";
218 }; 214 };
219 tb10x_mdsc0: tb10x-mdscr@FF300000 { 215 tb10x_mdsc0: tb10x-mdscr@FF300000 {
@@ -239,7 +235,7 @@
239 compatible = "abilis,tb100-wfb"; 235 compatible = "abilis,tb100-wfb";
240 reg = <0xff319000 0x1000>; 236 reg = <0xff319000 0x1000>;
241 interrupt-parent = <&tb10x_ictl>; 237 interrupt-parent = <&tb10x_ictl>;
242 interrupts = <16 1>; 238 interrupts = <16 8>;
243 }; 239 };
244 }; 240 };
245}; 241};
diff --git a/arch/arc/boot/dts/angel4.dts b/arch/arc/boot/dts/angel4.dts
index bae4f936cb03..4fb2d6f655bd 100644
--- a/arch/arc/boot/dts/angel4.dts
+++ b/arch/arc/boot/dts/angel4.dts
@@ -51,5 +51,21 @@
51 current-speed = <115200>; 51 current-speed = <115200>;
52 status = "okay"; 52 status = "okay";
53 }; 53 };
54
55 ethernet@c0fc2000 {
56 compatible = "snps,arc-emac";
57 reg = <0xc0fc2000 0x3c>;
58 interrupts = <6>;
59 mac-address = [ 00 11 22 33 44 55 ];
60 clock-frequency = <80000000>;
61 max-speed = <100>;
62 phy = <&phy0>;
63
64 #address-cells = <1>;
65 #size-cells = <0>;
66 phy0: ethernet-phy@0 {
67 reg = <1>;
68 };
69 };
54 }; 70 };
55}; 71};
diff --git a/arch/arc/configs/fpga_defconfig b/arch/arc/configs/fpga_defconfig
index c109af320274..4ca50f1f8d05 100644
--- a/arch/arc/configs/fpga_defconfig
+++ b/arch/arc/configs/fpga_defconfig
@@ -38,6 +38,9 @@ CONFIG_INET=y
38# CONFIG_PREVENT_FIRMWARE_BUILD is not set 38# CONFIG_PREVENT_FIRMWARE_BUILD is not set
39# CONFIG_FIRMWARE_IN_KERNEL is not set 39# CONFIG_FIRMWARE_IN_KERNEL is not set
40# CONFIG_BLK_DEV is not set 40# CONFIG_BLK_DEV is not set
41CONFIG_NETDEVICES=y
42CONFIG_ARC_EMAC=y
43CONFIG_LXT_PHY=y
41# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 44# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
42# CONFIG_INPUT_KEYBOARD is not set 45# CONFIG_INPUT_KEYBOARD is not set
43# CONFIG_INPUT_MOUSE is not set 46# CONFIG_INPUT_MOUSE is not set
diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c
index 318164cabdfc..0fd1f0d515ff 100644
--- a/arch/arc/mm/fault.c
+++ b/arch/arc/mm/fault.c
@@ -207,8 +207,10 @@ out_of_memory:
207 } 207 }
208 up_read(&mm->mmap_sem); 208 up_read(&mm->mmap_sem);
209 209
210 if (user_mode(regs)) 210 if (user_mode(regs)) {
211 do_group_exit(SIGKILL); /* This will never return */ 211 pagefault_out_of_memory();
212 return;
213 }
212 214
213 goto no_context; 215 goto no_context;
214 216
diff --git a/arch/arc/plat-arcfpga/include/plat/irq.h b/arch/arc/plat-arcfpga/include/plat/irq.h
index 41e335670f60..6adbc53c3a5b 100644
--- a/arch/arc/plat-arcfpga/include/plat/irq.h
+++ b/arch/arc/plat-arcfpga/include/plat/irq.h
@@ -16,8 +16,6 @@
16#define UART1_IRQ 10 16#define UART1_IRQ 10
17#define UART2_IRQ 11 17#define UART2_IRQ 11
18 18
19#define VMAC_IRQ 6
20
21#define IDE_IRQ 13 19#define IDE_IRQ 13
22#define PCI_IRQ 14 20#define PCI_IRQ 14
23#define PS2_IRQ 15 21#define PS2_IRQ 15
diff --git a/arch/arc/plat-arcfpga/include/plat/memmap.h b/arch/arc/plat-arcfpga/include/plat/memmap.h
index 1663f3388085..5c78e6135a1f 100644
--- a/arch/arc/plat-arcfpga/include/plat/memmap.h
+++ b/arch/arc/plat-arcfpga/include/plat/memmap.h
@@ -15,8 +15,6 @@
15#define UART0_BASE 0xC0FC1000 15#define UART0_BASE 0xC0FC1000
16#define UART1_BASE 0xC0FC1100 16#define UART1_BASE 0xC0FC1100
17 17
18#define VMAC_REG_BASEADDR 0xC0FC2000
19
20#define IDE_CONTROLLER_BASE 0xC0FC9000 18#define IDE_CONTROLLER_BASE 0xC0FC9000
21 19
22#define AHB_PCI_HOST_BRG_BASE 0xC0FD0000 20#define AHB_PCI_HOST_BRG_BASE 0xC0FD0000
diff --git a/arch/arc/plat-tb10x/Kconfig b/arch/arc/plat-tb10x/Kconfig
index 1d3452100f1f..1ab386bb5da8 100644
--- a/arch/arc/plat-tb10x/Kconfig
+++ b/arch/arc/plat-tb10x/Kconfig
@@ -22,6 +22,7 @@ menuconfig ARC_PLAT_TB10X
22 select PINCTRL 22 select PINCTRL
23 select PINMUX 23 select PINMUX
24 select ARCH_REQUIRE_GPIOLIB 24 select ARCH_REQUIRE_GPIOLIB
25 select TB10X_IRQC
25 help 26 help
26 Support for platforms based on the TB10x home media gateway SOC by 27 Support for platforms based on the TB10x home media gateway SOC by
27 Abilis Systems. TB10x is based on the ARC700 CPU architecture. 28 Abilis Systems. TB10x is based on the ARC700 CPU architecture.
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 531cdda016f9..ba412e02ec0c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -14,6 +14,7 @@ config ARM
14 select GENERIC_IRQ_PROBE 14 select GENERIC_IRQ_PROBE
15 select GENERIC_IRQ_SHOW 15 select GENERIC_IRQ_SHOW
16 select GENERIC_PCI_IOMAP 16 select GENERIC_PCI_IOMAP
17 select GENERIC_SCHED_CLOCK
17 select GENERIC_SMP_IDLE_THREAD 18 select GENERIC_SMP_IDLE_THREAD
18 select GENERIC_IDLE_POLL_SETUP 19 select GENERIC_IDLE_POLL_SETUP
19 select GENERIC_STRNCPY_FROM_USER 20 select GENERIC_STRNCPY_FROM_USER
@@ -40,6 +41,7 @@ config ARM
40 select HAVE_IDE if PCI || ISA || PCMCIA 41 select HAVE_IDE if PCI || ISA || PCMCIA
41 select HAVE_IRQ_TIME_ACCOUNTING 42 select HAVE_IRQ_TIME_ACCOUNTING
42 select HAVE_KERNEL_GZIP 43 select HAVE_KERNEL_GZIP
44 select HAVE_KERNEL_LZ4
43 select HAVE_KERNEL_LZMA 45 select HAVE_KERNEL_LZMA
44 select HAVE_KERNEL_LZO 46 select HAVE_KERNEL_LZO
45 select HAVE_KERNEL_XZ 47 select HAVE_KERNEL_XZ
@@ -1314,7 +1316,7 @@ config ARM_ERRATA_754327
1314 1316
1315config ARM_ERRATA_364296 1317config ARM_ERRATA_364296
1316 bool "ARM errata: Possible cache data corruption with hit-under-miss enabled" 1318 bool "ARM errata: Possible cache data corruption with hit-under-miss enabled"
1317 depends on CPU_V6 && !SMP 1319 depends on CPU_V6
1318 help 1320 help
1319 This options enables the workaround for the 364296 ARM1136 1321 This options enables the workaround for the 364296 ARM1136
1320 r0p2 erratum (possible cache data corruption with 1322 r0p2 erratum (possible cache data corruption with
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 5b7be8d975b5..e401a766c0bd 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -510,6 +510,16 @@ choice
510 Say Y here if you want the debug print routines to direct 510 Say Y here if you want the debug print routines to direct
511 their output to the uart1 port on SiRFmarco devices. 511 their output to the uart1 port on SiRFmarco devices.
512 512
513 config DEBUG_STI_UART
514 depends on ARCH_STI
515 bool "Use StiH415/416 ASC for low-level debug"
516 help
517 Say Y here if you want kernel low-level debugging support
518 on StiH415/416 based platforms like B2000, B2020.
519 It support UART2 and SBC_UART1.
520
521 If unsure, say N.
522
513 config DEBUG_U300_UART 523 config DEBUG_U300_UART
514 bool "Kernel low-level debugging messages via U300 UART0" 524 bool "Kernel low-level debugging messages via U300 UART0"
515 depends on ARCH_U300 525 depends on ARCH_U300
@@ -564,16 +574,6 @@ choice
564 This option selects UART0 on VIA/Wondermedia System-on-a-chip 574 This option selects UART0 on VIA/Wondermedia System-on-a-chip
565 devices, including VT8500, WM8505, WM8650 and WM8850. 575 devices, including VT8500, WM8505, WM8650 and WM8850.
566 576
567 config DEBUG_STI_UART
568 depends on ARCH_STI
569 bool "Use StiH415/416 ASC for low-level debug"
570 help
571 Say Y here if you want kernel low-level debugging support
572 on StiH415/416 based platforms like B2000, B2020.
573 It support UART2 and SBC_UART1.
574
575 If unsure, say N.
576
577 config DEBUG_LL_UART_NONE 577 config DEBUG_LL_UART_NONE
578 bool "No low-level debugging UART" 578 bool "No low-level debugging UART"
579 depends on !ARCH_MULTIPLATFORM 579 depends on !ARCH_MULTIPLATFORM
diff --git a/arch/arm/boot/compressed/.gitignore b/arch/arm/boot/compressed/.gitignore
index f79a08efe000..47279aa96a6a 100644
--- a/arch/arm/boot/compressed/.gitignore
+++ b/arch/arm/boot/compressed/.gitignore
@@ -6,6 +6,7 @@ piggy.gzip
6piggy.lzo 6piggy.lzo
7piggy.lzma 7piggy.lzma
8piggy.xzkern 8piggy.xzkern
9piggy.lz4
9vmlinux 10vmlinux
10vmlinux.lds 11vmlinux.lds
11 12
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 48d0a44270bd..7ac1610252ba 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -91,6 +91,7 @@ suffix_$(CONFIG_KERNEL_GZIP) = gzip
91suffix_$(CONFIG_KERNEL_LZO) = lzo 91suffix_$(CONFIG_KERNEL_LZO) = lzo
92suffix_$(CONFIG_KERNEL_LZMA) = lzma 92suffix_$(CONFIG_KERNEL_LZMA) = lzma
93suffix_$(CONFIG_KERNEL_XZ) = xzkern 93suffix_$(CONFIG_KERNEL_XZ) = xzkern
94suffix_$(CONFIG_KERNEL_LZ4) = lz4
94 95
95# Borrowed libfdt files for the ATAG compatibility mode 96# Borrowed libfdt files for the ATAG compatibility mode
96 97
@@ -115,7 +116,7 @@ targets := vmlinux vmlinux.lds \
115 font.o font.c head.o misc.o $(OBJS) 116 font.o font.c head.o misc.o $(OBJS)
116 117
117# Make sure files are removed during clean 118# Make sure files are removed during clean
118extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern \ 119extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.lz4 \
119 lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs) \ 120 lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs) \
120 hyp-stub.S 121 hyp-stub.S
121 122
diff --git a/arch/arm/boot/compressed/decompress.c b/arch/arm/boot/compressed/decompress.c
index 24b0475cb8bf..bd245d34952d 100644
--- a/arch/arm/boot/compressed/decompress.c
+++ b/arch/arm/boot/compressed/decompress.c
@@ -51,6 +51,10 @@ extern char * strstr(const char * s1, const char *s2);
51#include "../../../../lib/decompress_unxz.c" 51#include "../../../../lib/decompress_unxz.c"
52#endif 52#endif
53 53
54#ifdef CONFIG_KERNEL_LZ4
55#include "../../../../lib/decompress_unlz4.c"
56#endif
57
54int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)) 58int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
55{ 59{
56 return decompress(input, len, NULL, NULL, output, NULL, error); 60 return decompress(input, len, NULL, NULL, output, NULL, error);
diff --git a/arch/arm/boot/compressed/piggy.lz4.S b/arch/arm/boot/compressed/piggy.lz4.S
new file mode 100644
index 000000000000..3d9a575618a3
--- /dev/null
+++ b/arch/arm/boot/compressed/piggy.lz4.S
@@ -0,0 +1,6 @@
1 .section .piggydata,#alloc
2 .globl input_data
3input_data:
4 .incbin "arch/arm/boot/compressed/piggy.lz4"
5 .globl input_data_end
6input_data_end:
diff --git a/arch/arm/boot/dts/am335x-bone.dts b/arch/arm/boot/dts/am335x-bone.dts
index 04feaf8f1420..444b4ede0d60 100644
--- a/arch/arm/boot/dts/am335x-bone.dts
+++ b/arch/arm/boot/dts/am335x-bone.dts
@@ -214,10 +214,12 @@
214 214
215&cpsw_emac0 { 215&cpsw_emac0 {
216 phy_id = <&davinci_mdio>, <0>; 216 phy_id = <&davinci_mdio>, <0>;
217 phy-mode = "mii";
217}; 218};
218 219
219&cpsw_emac1 { 220&cpsw_emac1 {
220 phy_id = <&davinci_mdio>, <1>; 221 phy_id = <&davinci_mdio>, <1>;
222 phy-mode = "mii";
221}; 223};
222 224
223&mac { 225&mac {
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts
index a16bb9691cc6..3aee1a43782d 100644
--- a/arch/arm/boot/dts/am335x-evm.dts
+++ b/arch/arm/boot/dts/am335x-evm.dts
@@ -467,8 +467,24 @@
467 467
468&cpsw_emac0 { 468&cpsw_emac0 {
469 phy_id = <&davinci_mdio>, <0>; 469 phy_id = <&davinci_mdio>, <0>;
470 phy-mode = "rgmii-txid";
470}; 471};
471 472
472&cpsw_emac1 { 473&cpsw_emac1 {
473 phy_id = <&davinci_mdio>, <1>; 474 phy_id = <&davinci_mdio>, <1>;
475 phy-mode = "rgmii-txid";
476};
477
478&tscadc {
479 status = "okay";
480 tsc {
481 ti,wires = <4>;
482 ti,x-plate-resistance = <200>;
483 ti,coordiante-readouts = <5>;
484 ti,wire-config = <0x00 0x11 0x22 0x33>;
485 };
486
487 adc {
488 ti,adc-channels = <4 5 6 7>;
489 };
474}; 490};
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts
index 9e00eef9b74b..0c8ad173d2b0 100644
--- a/arch/arm/boot/dts/am335x-evmsk.dts
+++ b/arch/arm/boot/dts/am335x-evmsk.dts
@@ -392,3 +392,13 @@
392 pinctrl-0 = <&davinci_mdio_default>; 392 pinctrl-0 = <&davinci_mdio_default>;
393 pinctrl-1 = <&davinci_mdio_sleep>; 393 pinctrl-1 = <&davinci_mdio_sleep>;
394}; 394};
395
396&cpsw_emac0 {
397 phy_id = <&davinci_mdio>, <0>;
398 phy-mode = "rgmii-txid";
399};
400
401&cpsw_emac1 {
402 phy_id = <&davinci_mdio>, <1>;
403 phy-mode = "rgmii-txid";
404};
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 0d4df90477f7..38b446ba1ce1 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -502,6 +502,23 @@
502 status = "disabled"; 502 status = "disabled";
503 }; 503 };
504 504
505 tscadc: tscadc@44e0d000 {
506 compatible = "ti,am3359-tscadc";
507 reg = <0x44e0d000 0x1000>;
508 interrupt-parent = <&intc>;
509 interrupts = <16>;
510 ti,hwmods = "adc_tsc";
511 status = "disabled";
512
513 tsc {
514 compatible = "ti,am3359-tsc";
515 };
516 am335x_adc: adc {
517 #io-channel-cells = <1>;
518 compatible = "ti,am3359-adc";
519 };
520 };
521
505 gpmc: gpmc@50000000 { 522 gpmc: gpmc@50000000 {
506 compatible = "ti,am3352-gpmc"; 523 compatible = "ti,am3352-gpmc";
507 ti,hwmods = "gpmc"; 524 ti,hwmods = "gpmc";
diff --git a/arch/arm/boot/dts/cros5250-common.dtsi b/arch/arm/boot/dts/cros5250-common.dtsi
index 3f0239ec1bc5..dc259e8b8a73 100644
--- a/arch/arm/boot/dts/cros5250-common.dtsi
+++ b/arch/arm/boot/dts/cros5250-common.dtsi
@@ -190,7 +190,7 @@
190 samsung,i2c-max-bus-freq = <66000>; 190 samsung,i2c-max-bus-freq = <66000>;
191 191
192 hdmiddc@50 { 192 hdmiddc@50 {
193 compatible = "samsung,exynos5-hdmiddc"; 193 compatible = "samsung,exynos4210-hdmiddc";
194 reg = <0x50>; 194 reg = <0x50>;
195 }; 195 };
196 }; 196 };
@@ -224,7 +224,7 @@
224 samsung,i2c-max-bus-freq = <378000>; 224 samsung,i2c-max-bus-freq = <378000>;
225 225
226 hdmiphy@38 { 226 hdmiphy@38 {
227 compatible = "samsung,exynos5-hdmiphy"; 227 compatible = "samsung,exynos4212-hdmiphy";
228 reg = <0x38>; 228 reg = <0x38>;
229 }; 229 };
230 }; 230 };
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
index 35a66dee4011..49f18c24a576 100644
--- a/arch/arm/boot/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -105,7 +105,7 @@
105 samsung,i2c-max-bus-freq = <66000>; 105 samsung,i2c-max-bus-freq = <66000>;
106 106
107 hdmiddc@50 { 107 hdmiddc@50 {
108 compatible = "samsung,exynos5-hdmiddc"; 108 compatible = "samsung,exynos4210-hdmiddc";
109 reg = <0x50>; 109 reg = <0x50>;
110 }; 110 };
111 }; 111 };
@@ -135,7 +135,7 @@
135 samsung,i2c-max-bus-freq = <66000>; 135 samsung,i2c-max-bus-freq = <66000>;
136 136
137 hdmiphy@38 { 137 hdmiphy@38 {
138 compatible = "samsung,exynos5-hdmiphy"; 138 compatible = "samsung,exynos4212-hdmiphy";
139 reg = <0x38>; 139 reg = <0x38>;
140 }; 140 };
141 }; 141 };
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index 41cd625b6020..ef57277fc38f 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -599,7 +599,7 @@
599 }; 599 };
600 600
601 hdmi { 601 hdmi {
602 compatible = "samsung,exynos5-hdmi"; 602 compatible = "samsung,exynos4212-hdmi";
603 reg = <0x14530000 0x70000>; 603 reg = <0x14530000 0x70000>;
604 interrupts = <0 95 0>; 604 interrupts = <0 95 0>;
605 clocks = <&clock 333>, <&clock 136>, <&clock 137>, 605 clocks = <&clock 333>, <&clock 136>, <&clock 137>,
@@ -609,7 +609,7 @@
609 }; 609 };
610 610
611 mixer { 611 mixer {
612 compatible = "samsung,exynos5-mixer"; 612 compatible = "samsung,exynos5250-mixer";
613 reg = <0x14450000 0x10000>; 613 reg = <0x14450000 0x10000>;
614 interrupts = <0 94 0>; 614 interrupts = <0 94 0>;
615 }; 615 };
diff --git a/arch/arm/boot/dts/imx28-evk.dts b/arch/arm/boot/dts/imx28-evk.dts
index 3637bf3b1d59..1f0d38d7b16f 100644
--- a/arch/arm/boot/dts/imx28-evk.dts
+++ b/arch/arm/boot/dts/imx28-evk.dts
@@ -155,12 +155,14 @@
155 can0: can@80032000 { 155 can0: can@80032000 {
156 pinctrl-names = "default"; 156 pinctrl-names = "default";
157 pinctrl-0 = <&can0_pins_a>; 157 pinctrl-0 = <&can0_pins_a>;
158 xceiver-supply = <&reg_can_3v3>;
158 status = "okay"; 159 status = "okay";
159 }; 160 };
160 161
161 can1: can@80034000 { 162 can1: can@80034000 {
162 pinctrl-names = "default"; 163 pinctrl-names = "default";
163 pinctrl-0 = <&can1_pins_a>; 164 pinctrl-0 = <&can1_pins_a>;
165 xceiver-supply = <&reg_can_3v3>;
164 status = "okay"; 166 status = "okay";
165 }; 167 };
166 }; 168 };
@@ -319,6 +321,16 @@
319 gpio = <&gpio3 30 0>; 321 gpio = <&gpio3 30 0>;
320 enable-active-high; 322 enable-active-high;
321 }; 323 };
324
325 reg_can_3v3: can-3v3 {
326 compatible = "regulator-fixed";
327 regulator-name = "can-3v3";
328 regulator-min-microvolt = <3300000>;
329 regulator-max-microvolt = <3300000>;
330 gpio = <&gpio2 13 0>;
331 enable-active-high;
332 };
333
322 }; 334 };
323 335
324 sound { 336 sound {
diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
index 0e22a285dfe0..757c4cd900ee 100644
--- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
+++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
@@ -27,6 +27,21 @@
27 }; 27 };
28 28
29 soc@01c20000 { 29 soc@01c20000 {
30 emac: ethernet@01c0b000 {
31 pinctrl-names = "default";
32 pinctrl-0 = <&emac_pins_a>;
33 phy = <&phy1>;
34 status = "okay";
35 };
36
37 mdio@01c0b080 {
38 status = "okay";
39
40 phy1: ethernet-phy@1 {
41 reg = <1>;
42 };
43 };
44
30 pinctrl@01c20800 { 45 pinctrl@01c20800 {
31 led_pins_cubieboard: led_pins@0 { 46 led_pins_cubieboard: led_pins@0 {
32 allwinner,pins = "PH20", "PH21"; 47 allwinner,pins = "PH20", "PH21";
diff --git a/arch/arm/boot/dts/sun4i-a10-hackberry.dts b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
index b9efac100c85..3514b37d66bc 100644
--- a/arch/arm/boot/dts/sun4i-a10-hackberry.dts
+++ b/arch/arm/boot/dts/sun4i-a10-hackberry.dts
@@ -23,10 +23,51 @@
23 }; 23 };
24 24
25 soc@01c20000 { 25 soc@01c20000 {
26 emac: ethernet@01c0b000 {
27 pinctrl-names = "default";
28 pinctrl-0 = <&emac_pins_a>;
29 phy = <&phy0>;
30 status = "okay";
31 };
32
33 mdio@01c0b080 {
34 phy-supply = <&reg_emac_3v3>;
35 status = "okay";
36
37 phy0: ethernet-phy@0 {
38 reg = <0>;
39 };
40 };
41
42 pio: pinctrl@01c20800 {
43 pinctrl-names = "default";
44 pinctrl-0 = <&hackberry_hogs>;
45
46 hackberry_hogs: hogs@0 {
47 allwinner,pins = "PH19";
48 allwinner,function = "gpio_out";
49 allwinner,drive = <0>;
50 allwinner,pull = <0>;
51 };
52 };
53
26 uart0: serial@01c28000 { 54 uart0: serial@01c28000 {
27 pinctrl-names = "default"; 55 pinctrl-names = "default";
28 pinctrl-0 = <&uart0_pins_a>; 56 pinctrl-0 = <&uart0_pins_a>;
29 status = "okay"; 57 status = "okay";
30 }; 58 };
31 }; 59 };
60
61 regulators {
62 compatible = "simple-bus";
63
64 reg_emac_3v3: emac-3v3 {
65 compatible = "regulator-fixed";
66 regulator-name = "emac-3v3";
67 regulator-min-microvolt = <3300000>;
68 regulator-max-microvolt = <3300000>;
69 enable-active-high;
70 gpio = <&pio 7 19 0>;
71 };
72 };
32}; 73};
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index 82e03d22f913..b2bd6e124250 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -167,6 +167,22 @@
167 reg = <0x01c20000 0x300000>; 167 reg = <0x01c20000 0x300000>;
168 ranges; 168 ranges;
169 169
170 emac: ethernet@01c0b000 {
171 compatible = "allwinner,sun4i-emac";
172 reg = <0x01c0b000 0x1000>;
173 interrupts = <55>;
174 clocks = <&ahb_gates 17>;
175 status = "disabled";
176 };
177
178 mdio@01c0b080 {
179 compatible = "allwinner,sun4i-mdio";
180 reg = <0x01c0b080 0x14>;
181 status = "disabled";
182 #address-cells = <1>;
183 #size-cells = <0>;
184 };
185
170 intc: interrupt-controller@01c20400 { 186 intc: interrupt-controller@01c20400 {
171 compatible = "allwinner,sun4i-ic"; 187 compatible = "allwinner,sun4i-ic";
172 reg = <0x01c20400 0x400>; 188 reg = <0x01c20400 0x400>;
@@ -226,6 +242,17 @@
226 allwinner,drive = <0>; 242 allwinner,drive = <0>;
227 allwinner,pull = <0>; 243 allwinner,pull = <0>;
228 }; 244 };
245
246 emac_pins_a: emac0@0 {
247 allwinner,pins = "PA0", "PA1", "PA2",
248 "PA3", "PA4", "PA5", "PA6",
249 "PA7", "PA8", "PA9", "PA10",
250 "PA11", "PA12", "PA13", "PA14",
251 "PA15", "PA16";
252 allwinner,function = "emac";
253 allwinner,drive = <0>;
254 allwinner,pull = <0>;
255 };
229 }; 256 };
230 257
231 timer@01c20c00 { 258 timer@01c20c00 {
diff --git a/arch/arm/boot/dts/tegra20-seaboard.dts b/arch/arm/boot/dts/tegra20-seaboard.dts
index ab177b406b78..365760b33a26 100644
--- a/arch/arm/boot/dts/tegra20-seaboard.dts
+++ b/arch/arm/boot/dts/tegra20-seaboard.dts
@@ -828,6 +828,7 @@
828 regulator-name = "vdd_vbus_wup1"; 828 regulator-name = "vdd_vbus_wup1";
829 regulator-min-microvolt = <5000000>; 829 regulator-min-microvolt = <5000000>;
830 regulator-max-microvolt = <5000000>; 830 regulator-max-microvolt = <5000000>;
831 enable-active-high;
831 gpio = <&gpio 24 0>; /* PD0 */ 832 gpio = <&gpio 24 0>; /* PD0 */
832 }; 833 };
833 }; 834 };
diff --git a/arch/arm/boot/dts/tegra20-trimslice.dts b/arch/arm/boot/dts/tegra20-trimslice.dts
index 170159910455..ed4b901b0227 100644
--- a/arch/arm/boot/dts/tegra20-trimslice.dts
+++ b/arch/arm/boot/dts/tegra20-trimslice.dts
@@ -410,6 +410,7 @@
410 regulator-name = "usb1_vbus"; 410 regulator-name = "usb1_vbus";
411 regulator-min-microvolt = <5000000>; 411 regulator-min-microvolt = <5000000>;
412 regulator-max-microvolt = <5000000>; 412 regulator-max-microvolt = <5000000>;
413 enable-active-high;
413 gpio = <&gpio 170 0>; /* PV2 */ 414 gpio = <&gpio 170 0>; /* PV2 */
414 }; 415 };
415 }; 416 };
diff --git a/arch/arm/boot/dts/tegra20-whistler.dts b/arch/arm/boot/dts/tegra20-whistler.dts
index ea078ab8edeb..ab67c94db280 100644
--- a/arch/arm/boot/dts/tegra20-whistler.dts
+++ b/arch/arm/boot/dts/tegra20-whistler.dts
@@ -586,6 +586,7 @@
586 regulator-name = "vbus1"; 586 regulator-name = "vbus1";
587 regulator-min-microvolt = <5000000>; 587 regulator-min-microvolt = <5000000>;
588 regulator-max-microvolt = <5000000>; 588 regulator-max-microvolt = <5000000>;
589 enable-active-high;
589 gpio = <&tca6416 0 0>; /* GPIO_PMU0 */ 590 gpio = <&tca6416 0 0>; /* GPIO_PMU0 */
590 }; 591 };
591 592
@@ -595,6 +596,7 @@
595 regulator-name = "vbus3"; 596 regulator-name = "vbus3";
596 regulator-min-microvolt = <5000000>; 597 regulator-min-microvolt = <5000000>;
597 regulator-max-microvolt = <5000000>; 598 regulator-max-microvolt = <5000000>;
599 enable-active-high;
598 gpio = <&tca6416 1 0>; /* GPIO_PMU1 */ 600 gpio = <&tca6416 1 0>; /* GPIO_PMU1 */
599 }; 601 };
600 }; 602 };
diff --git a/arch/arm/common/mcpm_platsmp.c b/arch/arm/common/mcpm_platsmp.c
index 510e5b13aa2e..1bc34c7567fd 100644
--- a/arch/arm/common/mcpm_platsmp.c
+++ b/arch/arm/common/mcpm_platsmp.c
@@ -19,7 +19,7 @@
19#include <asm/smp.h> 19#include <asm/smp.h>
20#include <asm/smp_plat.h> 20#include <asm/smp_plat.h>
21 21
22static int __cpuinit mcpm_boot_secondary(unsigned int cpu, struct task_struct *idle) 22static int mcpm_boot_secondary(unsigned int cpu, struct task_struct *idle)
23{ 23{
24 unsigned int mpidr, pcpu, pcluster, ret; 24 unsigned int mpidr, pcpu, pcluster, ret;
25 extern void secondary_startup(void); 25 extern void secondary_startup(void);
@@ -40,7 +40,7 @@ static int __cpuinit mcpm_boot_secondary(unsigned int cpu, struct task_struct *i
40 return 0; 40 return 0;
41} 41}
42 42
43static void __cpuinit mcpm_secondary_init(unsigned int cpu) 43static void mcpm_secondary_init(unsigned int cpu)
44{ 44{
45 mcpm_cpu_powered_up(); 45 mcpm_cpu_powered_up();
46} 46}
diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index ddc740769601..023ee63827a2 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -28,8 +28,8 @@
28#include <linux/of.h> 28#include <linux/of.h>
29#include <linux/of_address.h> 29#include <linux/of_address.h>
30#include <linux/of_irq.h> 30#include <linux/of_irq.h>
31#include <linux/sched_clock.h>
31 32
32#include <asm/sched_clock.h>
33#include <asm/hardware/arm_timer.h> 33#include <asm/hardware/arm_timer.h>
34#include <asm/hardware/timer-sp.h> 34#include <asm/hardware/timer-sp.h>
35 35
diff --git a/arch/arm/configs/bcm_defconfig b/arch/arm/configs/bcm_defconfig
index e3bf2d65618e..65edf6d47215 100644
--- a/arch/arm/configs/bcm_defconfig
+++ b/arch/arm/configs/bcm_defconfig
@@ -78,6 +78,13 @@ CONFIG_BACKLIGHT_LCD_SUPPORT=y
78CONFIG_LCD_CLASS_DEVICE=y 78CONFIG_LCD_CLASS_DEVICE=y
79CONFIG_BACKLIGHT_CLASS_DEVICE=y 79CONFIG_BACKLIGHT_CLASS_DEVICE=y
80# CONFIG_USB_SUPPORT is not set 80# CONFIG_USB_SUPPORT is not set
81CONFIG_MMC=y
82CONFIG_MMC_UNSAFE_RESUME=y
83CONFIG_MMC_BLOCK_MINORS=32
84CONFIG_MMC_TEST=y
85CONFIG_MMC_SDHCI=y
86CONFIG_MMC_SDHCI_PLTFM=y
87CONFIG_MMC_SDHCI_BCM_KONA=y
81CONFIG_NEW_LEDS=y 88CONFIG_NEW_LEDS=y
82CONFIG_LEDS_CLASS=y 89CONFIG_LEDS_CLASS=y
83CONFIG_LEDS_TRIGGERS=y 90CONFIG_LEDS_TRIGGERS=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 340d550c12b0..fe0bdc361d2c 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -1,88 +1,167 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_IRQ_DOMAIN_DEBUG=y
2CONFIG_NO_HZ=y 2CONFIG_NO_HZ=y
3CONFIG_HIGH_RES_TIMERS=y 3CONFIG_HIGH_RES_TIMERS=y
4CONFIG_BLK_DEV_INITRD=y 4CONFIG_BLK_DEV_INITRD=y
5CONFIG_ARCH_MVEBU=y 5CONFIG_ARCH_MVEBU=y
6CONFIG_MACH_ARMADA_370=y 6CONFIG_MACH_ARMADA_370=y
7CONFIG_ARCH_SIRF=y
8CONFIG_MACH_ARMADA_XP=y 7CONFIG_MACH_ARMADA_XP=y
8CONFIG_ARCH_BCM=y
9CONFIG_GPIO_PCA953X=y
9CONFIG_ARCH_HIGHBANK=y 10CONFIG_ARCH_HIGHBANK=y
11CONFIG_ARCH_KEYSTONE=y
12CONFIG_ARCH_MXC=y
13CONFIG_MACH_IMX51_DT=y
14CONFIG_SOC_IMX53=y
15CONFIG_SOC_IMX6Q=y
16CONFIG_SOC_IMX6SL=y
17CONFIG_SOC_VF610=y
18CONFIG_ARCH_OMAP3=y
19CONFIG_ARCH_OMAP4=y
20CONFIG_SOC_OMAP5=y
21CONFIG_SOC_AM33XX=y
22CONFIG_SOC_AM43XX=y
23CONFIG_ARCH_ROCKCHIP=y
10CONFIG_ARCH_SOCFPGA=y 24CONFIG_ARCH_SOCFPGA=y
11CONFIG_ARCH_SUNXI=y
12CONFIG_ARCH_WM8850=y
13# CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA is not set
14CONFIG_ARCH_ZYNQ=y
15CONFIG_ARM_ERRATA_754322=y
16CONFIG_PLAT_SPEAR=y 25CONFIG_PLAT_SPEAR=y
17CONFIG_ARCH_SPEAR13XX=y 26CONFIG_ARCH_SPEAR13XX=y
18CONFIG_MACH_SPEAR1310=y 27CONFIG_MACH_SPEAR1310=y
19CONFIG_MACH_SPEAR1340=y 28CONFIG_MACH_SPEAR1340=y
29CONFIG_ARCH_STI=y
30CONFIG_ARCH_SUNXI=y
31CONFIG_ARCH_SIRF=y
32CONFIG_ARCH_TEGRA=y
33CONFIG_ARCH_TEGRA_2x_SOC=y
34CONFIG_ARCH_TEGRA_3x_SOC=y
35CONFIG_ARCH_TEGRA_114_SOC=y
36CONFIG_TEGRA_PCI=y
37CONFIG_TEGRA_EMC_SCALING_ENABLE=y
38CONFIG_ARCH_U8500=y
39CONFIG_MACH_SNOWBALL=y
40CONFIG_MACH_UX500_DT=y
41CONFIG_ARCH_VEXPRESS=y
42CONFIG_ARCH_VEXPRESS_CA9X4=y
43CONFIG_ARCH_VIRT=y
44CONFIG_ARCH_WM8850=y
45CONFIG_ARCH_ZYNQ=y
20CONFIG_SMP=y 46CONFIG_SMP=y
21CONFIG_ARM_ARCH_TIMER=y
22CONFIG_AEABI=y
23CONFIG_HIGHMEM=y
24CONFIG_HIGHPTE=y 47CONFIG_HIGHPTE=y
25CONFIG_ARM_APPENDED_DTB=y 48CONFIG_ARM_APPENDED_DTB=y
26CONFIG_VFP=y
27CONFIG_NEON=y
28CONFIG_NET=y 49CONFIG_NET=y
50CONFIG_UNIX=y
51CONFIG_INET=y
52CONFIG_IP_PNP=y
53CONFIG_IP_PNP_DHCP=y
54CONFIG_DEVTMPFS=y
55CONFIG_DEVTMPFS_MOUNT=y
29CONFIG_BLK_DEV_SD=y 56CONFIG_BLK_DEV_SD=y
30CONFIG_ATA=y 57CONFIG_ATA=y
58CONFIG_SATA_AHCI_PLATFORM=y
31CONFIG_SATA_HIGHBANK=y 59CONFIG_SATA_HIGHBANK=y
32CONFIG_SATA_MV=y 60CONFIG_SATA_MV=y
33CONFIG_SATA_AHCI_PLATFORM=y
34CONFIG_NETDEVICES=y 61CONFIG_NETDEVICES=y
35CONFIG_SUN4I_EMAC=y 62CONFIG_SUN4I_EMAC=y
36CONFIG_NET_CALXEDA_XGMAC=y 63CONFIG_NET_CALXEDA_XGMAC=y
37CONFIG_SMSC911X=y 64CONFIG_SMSC911X=y
38CONFIG_STMMAC_ETH=y 65CONFIG_STMMAC_ETH=y
39CONFIG_SERIO_AMBAKMI=y
40CONFIG_MDIO_SUN4I=y 66CONFIG_MDIO_SUN4I=y
67CONFIG_KEYBOARD_SPEAR=y
68CONFIG_SERIO_AMBAKMI=y
41CONFIG_SERIAL_8250=y 69CONFIG_SERIAL_8250=y
42CONFIG_SERIAL_8250_CONSOLE=y 70CONFIG_SERIAL_8250_CONSOLE=y
43CONFIG_SERIAL_8250_DW=y 71CONFIG_SERIAL_8250_DW=y
44CONFIG_KEYBOARD_SPEAR=y
45CONFIG_SERIAL_AMBA_PL011=y 72CONFIG_SERIAL_AMBA_PL011=y
46CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 73CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
47CONFIG_SERIAL_OF_PLATFORM=y
48CONFIG_SERIAL_SIRFSOC=y 74CONFIG_SERIAL_SIRFSOC=y
49CONFIG_SERIAL_SIRFSOC_CONSOLE=y 75CONFIG_SERIAL_SIRFSOC_CONSOLE=y
76CONFIG_SERIAL_TEGRA=y
77CONFIG_SERIAL_IMX=y
78CONFIG_SERIAL_IMX_CONSOLE=y
50CONFIG_SERIAL_VT8500=y 79CONFIG_SERIAL_VT8500=y
51CONFIG_SERIAL_VT8500_CONSOLE=y 80CONFIG_SERIAL_VT8500_CONSOLE=y
81CONFIG_SERIAL_OF_PLATFORM=y
82CONFIG_SERIAL_OMAP=y
83CONFIG_SERIAL_OMAP_CONSOLE=y
52CONFIG_SERIAL_XILINX_PS_UART=y 84CONFIG_SERIAL_XILINX_PS_UART=y
53CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y 85CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y
54CONFIG_IPMI_HANDLER=y 86CONFIG_SERIAL_FSL_LPUART=y
55CONFIG_IPMI_SI=y 87CONFIG_SERIAL_FSL_LPUART_CONSOLE=y
56CONFIG_I2C=y
57CONFIG_I2C_DESIGNWARE_PLATFORM=y 88CONFIG_I2C_DESIGNWARE_PLATFORM=y
58CONFIG_I2C_SIRF=y 89CONFIG_I2C_SIRF=y
90CONFIG_I2C_TEGRA=y
59CONFIG_SPI=y 91CONFIG_SPI=y
60CONFIG_SPI_PL022=y 92CONFIG_SPI_PL022=y
61CONFIG_SPI_SIRF=y 93CONFIG_SPI_SIRF=y
62CONFIG_GPIO_PL061=y 94CONFIG_SPI_TEGRA114=y
63CONFIG_FB=y 95CONFIG_SPI_TEGRA20_SLINK=y
96CONFIG_PINCTRL_SINGLE=y
97CONFIG_GPIO_GENERIC_PLATFORM=y
98CONFIG_GPIO_TWL4030=y
99CONFIG_REGULATOR_GPIO=y
100CONFIG_REGULATOR_AB8500=y
101CONFIG_REGULATOR_TPS51632=y
102CONFIG_REGULATOR_TPS62360=y
103CONFIG_REGULATOR_TWL4030=y
104CONFIG_REGULATOR_VEXPRESS=y
105CONFIG_DRM=y
106CONFIG_TEGRA_HOST1X=y
107CONFIG_DRM_TEGRA=y
64CONFIG_FB_ARMCLCD=y 108CONFIG_FB_ARMCLCD=y
65CONFIG_FB_WM8505=y 109CONFIG_FB_WM8505=y
66CONFIG_FRAMEBUFFER_CONSOLE=y 110CONFIG_FB_SIMPLE=y
67CONFIG_USB=y 111CONFIG_USB=y
112CONFIG_USB_XHCI_HCD=y
113CONFIG_USB_EHCI_HCD=y
114CONFIG_USB_EHCI_MXC=y
115CONFIG_USB_EHCI_TEGRA=y
116CONFIG_USB_EHCI_HCD_PLATFORM=y
68CONFIG_USB_ISP1760_HCD=y 117CONFIG_USB_ISP1760_HCD=y
69CONFIG_USB_STORAGE=y 118CONFIG_USB_STORAGE=y
119CONFIG_AB8500_USB=y
120CONFIG_NOP_USB_XCEIV=y
121CONFIG_OMAP_USB2=y
122CONFIG_OMAP_USB3=y
123CONFIG_SAMSUNG_USB2PHY=y
124CONFIG_SAMSUNG_USB3PHY=y
125CONFIG_USB_GPIO_VBUS=y
126CONFIG_USB_ISP1301=y
127CONFIG_USB_MXS_PHY=y
70CONFIG_MMC=y 128CONFIG_MMC=y
71CONFIG_MMC_ARMMMCI=y 129CONFIG_MMC_ARMMMCI=y
72CONFIG_MMC_SDHCI=y 130CONFIG_MMC_SDHCI=y
73CONFIG_MMC_SDHCI_PLTFM=y 131CONFIG_MMC_SDHCI_PLTFM=y
132CONFIG_MMC_SDHCI_TEGRA=y
74CONFIG_MMC_SDHCI_SPEAR=y 133CONFIG_MMC_SDHCI_SPEAR=y
75CONFIG_MMC_WMT=y 134CONFIG_MMC_OMAP=y
135CONFIG_MMC_OMAP_HS=y
76CONFIG_EDAC=y 136CONFIG_EDAC=y
77CONFIG_EDAC_MM_EDAC=y 137CONFIG_EDAC_MM_EDAC=y
78CONFIG_EDAC_HIGHBANK_MC=y 138CONFIG_EDAC_HIGHBANK_MC=y
79CONFIG_EDAC_HIGHBANK_L2=y 139CONFIG_EDAC_HIGHBANK_L2=y
80CONFIG_RTC_CLASS=y 140CONFIG_RTC_CLASS=y
141CONFIG_RTC_DRV_TWL4030=y
81CONFIG_RTC_DRV_PL031=y 142CONFIG_RTC_DRV_PL031=y
82CONFIG_RTC_DRV_VT8500=y 143CONFIG_RTC_DRV_VT8500=y
83CONFIG_PWM=y 144CONFIG_RTC_DRV_TEGRA=y
84CONFIG_PWM_VT8500=y
85CONFIG_DMADEVICES=y 145CONFIG_DMADEVICES=y
86CONFIG_PL330_DMA=y
87CONFIG_SIRF_DMA=y
88CONFIG_DW_DMAC=y 146CONFIG_DW_DMAC=y
147CONFIG_TEGRA20_APB_DMA=y
148CONFIG_STE_DMA40=y
149CONFIG_SIRF_DMA=y
150CONFIG_TI_EDMA=y
151CONFIG_PL330_DMA=y
152CONFIG_IMX_SDMA=y
153CONFIG_IMX_DMA=y
154CONFIG_MXS_DMA=y
155CONFIG_DMA_OMAP=y
156CONFIG_PWM=y
157CONFIG_PWM_VT8500=y
158CONFIG_EXT4_FS=y
159CONFIG_TMPFS=y
160CONFIG_NFS_FS=y
161CONFIG_NFS_V3_ACL=y
162CONFIG_NFS_V4=y
163CONFIG_ROOT_NFS=y
164CONFIG_PRINTK_TIME=y
165CONFIG_DEBUG_FS=y
166CONFIG_DEBUG_KERNEL=y
167CONFIG_LOCKUP_DETECTOR=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index 2ac0ffb12f03..5339e6a4d639 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -22,6 +22,10 @@ CONFIG_MODULE_SRCVERSION_ALL=y
22# CONFIG_BLK_DEV_BSG is not set 22# CONFIG_BLK_DEV_BSG is not set
23CONFIG_ARCH_MULTI_V6=y 23CONFIG_ARCH_MULTI_V6=y
24CONFIG_ARCH_OMAP2PLUS=y 24CONFIG_ARCH_OMAP2PLUS=y
25CONFIG_ARCH_OMAP2=y
26CONFIG_ARCH_OMAP3=y
27CONFIG_ARCH_OMAP4=y
28CONFIG_SOC_AM33XX=y
25CONFIG_OMAP_RESET_CLOCKS=y 29CONFIG_OMAP_RESET_CLOCKS=y
26CONFIG_OMAP_MUX_DEBUG=y 30CONFIG_OMAP_MUX_DEBUG=y
27CONFIG_ARCH_VEXPRESS_CA9X4=y 31CONFIG_ARCH_VEXPRESS_CA9X4=y
@@ -34,6 +38,8 @@ CONFIG_NR_CPUS=2
34CONFIG_LEDS=y 38CONFIG_LEDS=y
35CONFIG_ZBOOT_ROM_TEXT=0x0 39CONFIG_ZBOOT_ROM_TEXT=0x0
36CONFIG_ZBOOT_ROM_BSS=0x0 40CONFIG_ZBOOT_ROM_BSS=0x0
41CONFIG_ARM_APPENDED_DTB=y
42CONFIG_ARM_ATAG_DTB_COMPAT=y
37CONFIG_CMDLINE="root=/dev/mmcblk0p2 rootwait console=ttyO2,115200" 43CONFIG_CMDLINE="root=/dev/mmcblk0p2 rootwait console=ttyO2,115200"
38CONFIG_KEXEC=y 44CONFIG_KEXEC=y
39CONFIG_FPE_NWFPE=y 45CONFIG_FPE_NWFPE=y
@@ -152,6 +158,13 @@ CONFIG_W1=y
152CONFIG_POWER_SUPPLY=y 158CONFIG_POWER_SUPPLY=y
153CONFIG_SENSORS_LM75=m 159CONFIG_SENSORS_LM75=m
154CONFIG_WATCHDOG=y 160CONFIG_WATCHDOG=y
161CONFIG_THERMAL=y
162CONFIG_THERMAL_HWMON=y
163CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
164CONFIG_THERMAL_GOV_FAIR_SHARE=y
165CONFIG_THERMAL_GOV_STEP_WISE=y
166CONFIG_THERMAL_GOV_USER_SPACE=y
167CONFIG_CPU_THERMAL=y
155CONFIG_OMAP_WATCHDOG=y 168CONFIG_OMAP_WATCHDOG=y
156CONFIG_TWL4030_WATCHDOG=y 169CONFIG_TWL4030_WATCHDOG=y
157CONFIG_MFD_TPS65217=y 170CONFIG_MFD_TPS65217=y
@@ -238,7 +251,13 @@ CONFIG_RTC_DRV_TWL92330=y
238CONFIG_RTC_DRV_TWL4030=y 251CONFIG_RTC_DRV_TWL4030=y
239CONFIG_RTC_DRV_OMAP=y 252CONFIG_RTC_DRV_OMAP=y
240CONFIG_DMADEVICES=y 253CONFIG_DMADEVICES=y
254CONFIG_TI_EDMA=y
241CONFIG_DMA_OMAP=y 255CONFIG_DMA_OMAP=y
256CONFIG_TI_SOC_THERMAL=y
257CONFIG_TI_THERMAL=y
258CONFIG_OMAP4_THERMAL=y
259CONFIG_OMAP5_THERMAL=y
260CONFIG_DRA752_THERMAL=y
242CONFIG_EXT2_FS=y 261CONFIG_EXT2_FS=y
243CONFIG_EXT3_FS=y 262CONFIG_EXT3_FS=y
244# CONFIG_EXT3_FS_XATTR is not set 263# CONFIG_EXT3_FS_XATTR is not set
@@ -286,3 +305,4 @@ CONFIG_SOC_OMAP5=y
286CONFIG_TI_DAVINCI_MDIO=y 305CONFIG_TI_DAVINCI_MDIO=y
287CONFIG_TI_DAVINCI_CPDMA=y 306CONFIG_TI_DAVINCI_CPDMA=y
288CONFIG_TI_CPSW=y 307CONFIG_TI_CPSW=y
308CONFIG_AT803X_PHY=y
diff --git a/arch/arm/configs/spear13xx_defconfig b/arch/arm/configs/spear13xx_defconfig
index 1fdb82694ca2..82eaa552ed14 100644
--- a/arch/arm/configs/spear13xx_defconfig
+++ b/arch/arm/configs/spear13xx_defconfig
@@ -61,7 +61,6 @@ CONFIG_GPIO_SYSFS=y
61CONFIG_GPIO_PL061=y 61CONFIG_GPIO_PL061=y
62# CONFIG_HWMON is not set 62# CONFIG_HWMON is not set
63CONFIG_WATCHDOG=y 63CONFIG_WATCHDOG=y
64CONFIG_MPCORE_WATCHDOG=y
65# CONFIG_HID_SUPPORT is not set 64# CONFIG_HID_SUPPORT is not set
66CONFIG_USB=y 65CONFIG_USB=y
67# CONFIG_USB_DEVICE_CLASS is not set 66# CONFIG_USB_DEVICE_CLASS is not set
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index c037aa1065b7..a0025dc13021 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -1,6 +1,8 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_HIGHMEM=y
2# CONFIG_SWAP is not set 2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y 3CONFIG_SYSVIPC=y
4CONFIG_NO_HZ=y
5CONFIG_HIGH_RES_TIMERS=y
4CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
5CONFIG_KALLSYMS_ALL=y 7CONFIG_KALLSYMS_ALL=y
6CONFIG_MODULES=y 8CONFIG_MODULES=y
@@ -9,10 +11,7 @@ CONFIG_MODULE_UNLOAD=y
9CONFIG_ARCH_U8500=y 11CONFIG_ARCH_U8500=y
10CONFIG_MACH_HREFV60=y 12CONFIG_MACH_HREFV60=y
11CONFIG_MACH_SNOWBALL=y 13CONFIG_MACH_SNOWBALL=y
12CONFIG_MACH_U5500=y
13CONFIG_MACH_UX500_DT=y 14CONFIG_MACH_UX500_DT=y
14CONFIG_NO_HZ=y
15CONFIG_HIGH_RES_TIMERS=y
16CONFIG_SMP=y 15CONFIG_SMP=y
17CONFIG_NR_CPUS=2 16CONFIG_NR_CPUS=2
18CONFIG_PREEMPT=y 17CONFIG_PREEMPT=y
@@ -20,6 +19,7 @@ CONFIG_AEABI=y
20CONFIG_CMDLINE="root=/dev/ram0 console=ttyAMA2,115200n8" 19CONFIG_CMDLINE="root=/dev/ram0 console=ttyAMA2,115200n8"
21CONFIG_CPU_FREQ=y 20CONFIG_CPU_FREQ=y
22CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 21CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
22CONFIG_CPU_IDLE=y
23CONFIG_VFP=y 23CONFIG_VFP=y
24CONFIG_NEON=y 24CONFIG_NEON=y
25CONFIG_PM_RUNTIME=y 25CONFIG_PM_RUNTIME=y
@@ -36,7 +36,6 @@ CONFIG_CAIF=y
36CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 36CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
37CONFIG_BLK_DEV_RAM=y 37CONFIG_BLK_DEV_RAM=y
38CONFIG_BLK_DEV_RAM_SIZE=65536 38CONFIG_BLK_DEV_RAM_SIZE=65536
39CONFIG_AB8500_PWM=y
40CONFIG_SENSORS_BH1780=y 39CONFIG_SENSORS_BH1780=y
41CONFIG_NETDEVICES=y 40CONFIG_NETDEVICES=y
42CONFIG_SMSC911X=y 41CONFIG_SMSC911X=y
@@ -60,35 +59,39 @@ CONFIG_VT_HW_CONSOLE_BINDING=y
60CONFIG_SERIAL_AMBA_PL011=y 59CONFIG_SERIAL_AMBA_PL011=y
61CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 60CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
62CONFIG_HW_RANDOM=y 61CONFIG_HW_RANDOM=y
63CONFIG_HW_RANDOM_NOMADIK=y
64CONFIG_SPI=y 62CONFIG_SPI=y
65CONFIG_SPI_PL022=y 63CONFIG_SPI_PL022=y
66CONFIG_GPIO_STMPE=y 64CONFIG_GPIO_STMPE=y
67CONFIG_GPIO_TC3589X=y 65CONFIG_GPIO_TC3589X=y
68# CONFIG_POWER_SUPPLY is not set
69# CONFIG_AB8500_BM is not set
70# CONFIG_AB8500_BATTERY_THERM_ON_BATCTRL is not set
71CONFIG_THERMAL=y 66CONFIG_THERMAL=y
72CONFIG_CPU_THERMAL=y 67CONFIG_CPU_THERMAL=y
68CONFIG_WATCHDOG=y
73CONFIG_MFD_STMPE=y 69CONFIG_MFD_STMPE=y
74CONFIG_MFD_TC3589X=y 70CONFIG_MFD_TC3589X=y
75CONFIG_AB5500_CORE=y
76CONFIG_AB8500_CORE=y
77CONFIG_REGULATOR=y
78CONFIG_REGULATOR_AB8500=y
79CONFIG_REGULATOR_FIXED_VOLTAGE=y
80CONFIG_REGULATOR_GPIO=y 71CONFIG_REGULATOR_GPIO=y
81# CONFIG_HID_SUPPORT is not set 72CONFIG_REGULATOR_AB8500=y
82CONFIG_USB_GADGET=y 73CONFIG_SOUND=y
74CONFIG_SND=y
75CONFIG_SND_SOC=y
76CONFIG_SND_SOC_UX500=y
77CONFIG_SND_SOC_UX500_MACH_MOP500=y
78CONFIG_USB=y
79CONFIG_USB_MUSB_HDRC=y
80CONFIG_USB_MUSB_UX500=y
81CONFIG_USB_PHY=y
83CONFIG_AB8500_USB=y 82CONFIG_AB8500_USB=y
83CONFIG_USB_GADGET=y
84CONFIG_USB_GADGET_MUSB_HDRC=y
85CONFIG_USB_ETH=m
84CONFIG_MMC=y 86CONFIG_MMC=y
85CONFIG_MMC_CLKGATE=y 87CONFIG_MMC_UNSAFE_RESUME=y
88# CONFIG_MMC_BLOCK_BOUNCE is not set
86CONFIG_MMC_ARMMMCI=y 89CONFIG_MMC_ARMMMCI=y
87CONFIG_NEW_LEDS=y 90CONFIG_NEW_LEDS=y
88CONFIG_LEDS_CLASS=y 91CONFIG_LEDS_CLASS=y
89CONFIG_LEDS_LM3530=y 92CONFIG_LEDS_LM3530=y
90CONFIG_LEDS_LP5521=y
91CONFIG_LEDS_GPIO=y 93CONFIG_LEDS_GPIO=y
94CONFIG_LEDS_LP5521=y
92CONFIG_LEDS_TRIGGERS=y 95CONFIG_LEDS_TRIGGERS=y
93CONFIG_LEDS_TRIGGER_HEARTBEAT=y 96CONFIG_LEDS_TRIGGER_HEARTBEAT=y
94CONFIG_RTC_CLASS=y 97CONFIG_RTC_CLASS=y
@@ -108,7 +111,6 @@ CONFIG_EXT4_FS=y
108CONFIG_VFAT_FS=y 111CONFIG_VFAT_FS=y
109CONFIG_TMPFS=y 112CONFIG_TMPFS=y
110CONFIG_TMPFS_POSIX_ACL=y 113CONFIG_TMPFS_POSIX_ACL=y
111CONFIG_CONFIGFS_FS=m
112# CONFIG_MISC_FILESYSTEMS is not set 114# CONFIG_MISC_FILESYSTEMS is not set
113CONFIG_NFS_FS=y 115CONFIG_NFS_FS=y
114CONFIG_ROOT_NFS=y 116CONFIG_ROOT_NFS=y
@@ -122,3 +124,7 @@ CONFIG_DEBUG_KERNEL=y
122CONFIG_DEBUG_INFO=y 124CONFIG_DEBUG_INFO=y
123# CONFIG_FTRACE is not set 125# CONFIG_FTRACE is not set
124CONFIG_DEBUG_USER=y 126CONFIG_DEBUG_USER=y
127CONFIG_CRYPTO_DEV_UX500=y
128CONFIG_CRYPTO_DEV_UX500_CRYP=y
129CONFIG_CRYPTO_DEV_UX500_HASH=y
130CONFIG_CRYPTO_DEV_UX500_DEBUG=y
diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h
index accefe099182..e406d575c94f 100644
--- a/arch/arm/include/asm/arch_timer.h
+++ b/arch/arm/include/asm/arch_timer.h
@@ -89,7 +89,7 @@ static inline u64 arch_counter_get_cntvct(void)
89 return cval; 89 return cval;
90} 90}
91 91
92static inline void __cpuinit arch_counter_set_user_access(void) 92static inline void arch_counter_set_user_access(void)
93{ 93{
94 u32 cntkctl; 94 u32 cntkctl;
95 95
diff --git a/arch/arm/include/asm/hardware/iop3xx.h b/arch/arm/include/asm/hardware/iop3xx.h
index ed94b1a366ae..423744bf18eb 100644
--- a/arch/arm/include/asm/hardware/iop3xx.h
+++ b/arch/arm/include/asm/hardware/iop3xx.h
@@ -223,11 +223,12 @@ extern int iop3xx_get_init_atu(void);
223#ifndef __ASSEMBLY__ 223#ifndef __ASSEMBLY__
224 224
225#include <linux/types.h> 225#include <linux/types.h>
226#include <linux/reboot.h>
226 227
227void iop3xx_map_io(void); 228void iop3xx_map_io(void);
228void iop_init_cp6_handler(void); 229void iop_init_cp6_handler(void);
229void iop_init_time(unsigned long tickrate); 230void iop_init_time(unsigned long tickrate);
230void iop3xx_restart(char, const char *); 231void iop3xx_restart(enum reboot_mode, const char *);
231 232
232static inline u32 read_tmr0(void) 233static inline u32 read_tmr0(void)
233{ 234{
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index 75bf07910b81..441efc491b50 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -11,6 +11,7 @@
11#include <linux/types.h> 11#include <linux/types.h>
12 12
13#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
14#include <linux/reboot.h>
14 15
15struct tag; 16struct tag;
16struct meminfo; 17struct meminfo;
@@ -43,7 +44,7 @@ struct machine_desc {
43 unsigned char reserve_lp0 :1; /* never has lp0 */ 44 unsigned char reserve_lp0 :1; /* never has lp0 */
44 unsigned char reserve_lp1 :1; /* never has lp1 */ 45 unsigned char reserve_lp1 :1; /* never has lp1 */
45 unsigned char reserve_lp2 :1; /* never has lp2 */ 46 unsigned char reserve_lp2 :1; /* never has lp2 */
46 char restart_mode; /* default restart mode */ 47 enum reboot_mode reboot_mode; /* default restart mode */
47 struct smp_operations *smp; /* SMP operations */ 48 struct smp_operations *smp; /* SMP operations */
48 bool (*smp_init)(void); 49 bool (*smp_init)(void);
49 void (*fixup)(struct tag *, char **, 50 void (*fixup)(struct tag *, char **,
@@ -58,7 +59,7 @@ struct machine_desc {
58#ifdef CONFIG_MULTI_IRQ_HANDLER 59#ifdef CONFIG_MULTI_IRQ_HANDLER
59 void (*handle_irq)(struct pt_regs *); 60 void (*handle_irq)(struct pt_regs *);
60#endif 61#endif
61 void (*restart)(char, const char *); 62 void (*restart)(enum reboot_mode, const char *);
62}; 63};
63 64
64/* 65/*
diff --git a/arch/arm/include/asm/sched_clock.h b/arch/arm/include/asm/sched_clock.h
index 3d520ddca61b..2389b71a8e7c 100644
--- a/arch/arm/include/asm/sched_clock.h
+++ b/arch/arm/include/asm/sched_clock.h
@@ -1,16 +1,4 @@
1/* 1/* You shouldn't include this file. Use linux/sched_clock.h instead.
2 * sched_clock.h: support for extending counters to full 64-bit ns counter 2 * Temporary file until all asm/sched_clock.h users are gone
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */ 3 */
8#ifndef ASM_SCHED_CLOCK 4#include <linux/sched_clock.h>
9#define ASM_SCHED_CLOCK
10
11extern void sched_clock_postinit(void);
12extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
13
14extern unsigned long long (*sched_clock_func)(void);
15
16#endif
diff --git a/arch/arm/include/asm/smp_scu.h b/arch/arm/include/asm/smp_scu.h
index 18d169373612..0393fbab8dd5 100644
--- a/arch/arm/include/asm/smp_scu.h
+++ b/arch/arm/include/asm/smp_scu.h
@@ -23,10 +23,21 @@ static inline unsigned long scu_a9_get_base(void)
23 return pa; 23 return pa;
24} 24}
25 25
26#ifdef CONFIG_HAVE_ARM_SCU
26unsigned int scu_get_core_count(void __iomem *); 27unsigned int scu_get_core_count(void __iomem *);
27int scu_power_mode(void __iomem *, unsigned int); 28int scu_power_mode(void __iomem *, unsigned int);
29#else
30static inline unsigned int scu_get_core_count(void __iomem *scu_base)
31{
32 return 0;
33}
34static inline int scu_power_mode(void __iomem *scu_base, unsigned int mode)
35{
36 return -EINVAL;
37}
38#endif
28 39
29#ifdef CONFIG_SMP 40#if defined(CONFIG_SMP) && defined(CONFIG_HAVE_ARM_SCU)
30void scu_enable(void __iomem *scu_base); 41void scu_enable(void __iomem *scu_base);
31#else 42#else
32static inline void scu_enable(void __iomem *scu_base) {} 43static inline void scu_enable(void __iomem *scu_base) {}
diff --git a/arch/arm/include/asm/system_misc.h b/arch/arm/include/asm/system_misc.h
index 21a23e378bbe..a3d61ad984af 100644
--- a/arch/arm/include/asm/system_misc.h
+++ b/arch/arm/include/asm/system_misc.h
@@ -6,11 +6,12 @@
6#include <linux/compiler.h> 6#include <linux/compiler.h>
7#include <linux/linkage.h> 7#include <linux/linkage.h>
8#include <linux/irqflags.h> 8#include <linux/irqflags.h>
9#include <linux/reboot.h>
9 10
10extern void cpu_init(void); 11extern void cpu_init(void);
11 12
12void soft_restart(unsigned long); 13void soft_restart(unsigned long);
13extern void (*arm_pm_restart)(char str, const char *cmd); 14extern void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
14extern void (*arm_pm_idle)(void); 15extern void (*arm_pm_idle)(void);
15 16
16#define UDBG_UNDEFINED (1 << 0) 17#define UDBG_UNDEFINED (1 << 0)
diff --git a/arch/arm/include/asm/xen/hypercall.h b/arch/arm/include/asm/xen/hypercall.h
index 799f42ecca63..7704e28c3483 100644
--- a/arch/arm/include/asm/xen/hypercall.h
+++ b/arch/arm/include/asm/xen/hypercall.h
@@ -47,6 +47,7 @@ unsigned long HYPERVISOR_hvm_op(int op, void *arg);
47int HYPERVISOR_memory_op(unsigned int cmd, void *arg); 47int HYPERVISOR_memory_op(unsigned int cmd, void *arg);
48int HYPERVISOR_physdev_op(int cmd, void *arg); 48int HYPERVISOR_physdev_op(int cmd, void *arg);
49int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args); 49int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args);
50int HYPERVISOR_tmem_op(void *arg);
50 51
51static inline void 52static inline void
52MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va, 53MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va,
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index fccfbdb03df1..86d10dd47dc4 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -16,7 +16,7 @@ CFLAGS_REMOVE_return_address.o = -pg
16# Object file lists. 16# Object file lists.
17 17
18obj-y := elf.o entry-common.o irq.o opcodes.o \ 18obj-y := elf.o entry-common.o irq.o opcodes.o \
19 process.o ptrace.o return_address.o sched_clock.o \ 19 process.o ptrace.o return_address.o \
20 setup.o signal.o stacktrace.o sys_arm.o time.o traps.o 20 setup.o signal.o stacktrace.o sys_arm.o time.o traps.o
21 21
22obj-$(CONFIG_ATAGS) += atags_parse.o 22obj-$(CONFIG_ATAGS) += atags_parse.o
diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
index 59dcdced6e30..221f07b11ccb 100644
--- a/arch/arm/kernel/arch_timer.c
+++ b/arch/arm/kernel/arch_timer.c
@@ -11,9 +11,9 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/sched_clock.h>
14 15
15#include <asm/delay.h> 16#include <asm/delay.h>
16#include <asm/sched_clock.h>
17 17
18#include <clocksource/arm_arch_timer.h> 18#include <clocksource/arm_arch_timer.h>
19 19
diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S
index 5b391a689b47..47cd974e57ea 100644
--- a/arch/arm/kernel/head-common.S
+++ b/arch/arm/kernel/head-common.S
@@ -133,6 +133,9 @@ ENTRY(lookup_processor_type)
133 ldmfd sp!, {r4 - r6, r9, pc} 133 ldmfd sp!, {r4 - r6, r9, pc}
134ENDPROC(lookup_processor_type) 134ENDPROC(lookup_processor_type)
135 135
136 __FINIT
137 .text
138
136/* 139/*
137 * Read processor ID register (CP#15, CR0), and look up in the linker-built 140 * Read processor ID register (CP#15, CR0), and look up in the linker-built
138 * supported processor list. Note that we can't use the absolute addresses 141 * supported processor list. Note that we can't use the absolute addresses
@@ -146,7 +149,6 @@ ENDPROC(lookup_processor_type)
146 * r5 = proc_info pointer in physical address space 149 * r5 = proc_info pointer in physical address space
147 * r9 = cpuid (preserved) 150 * r9 = cpuid (preserved)
148 */ 151 */
149 __CPUINIT
150__lookup_processor_type: 152__lookup_processor_type:
151 adr r3, __lookup_processor_type_data 153 adr r3, __lookup_processor_type_data
152 ldmia r3, {r4 - r6} 154 ldmia r3, {r4 - r6}
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index 75f14cc3e073..b361de143756 100644
--- a/arch/arm/kernel/head-nommu.S
+++ b/arch/arm/kernel/head-nommu.S
@@ -87,7 +87,6 @@ ENTRY(stext)
87ENDPROC(stext) 87ENDPROC(stext)
88 88
89#ifdef CONFIG_SMP 89#ifdef CONFIG_SMP
90 __CPUINIT
91ENTRY(secondary_startup) 90ENTRY(secondary_startup)
92 /* 91 /*
93 * Common entry point for secondary CPUs. 92 * Common entry point for secondary CPUs.
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 45e8935cae4e..9cf6063020ae 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -343,7 +343,6 @@ __turn_mmu_on_loc:
343 .long __turn_mmu_on_end 343 .long __turn_mmu_on_end
344 344
345#if defined(CONFIG_SMP) 345#if defined(CONFIG_SMP)
346 __CPUINIT
347ENTRY(secondary_startup) 346ENTRY(secondary_startup)
348 /* 347 /*
349 * Common entry point for secondary CPUs. 348 * Common entry point for secondary CPUs.
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index 1fd749ee4a1b..7b95de601357 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -1020,7 +1020,7 @@ out_mdbgen:
1020 cpumask_or(&debug_err_mask, &debug_err_mask, cpumask_of(cpu)); 1020 cpumask_or(&debug_err_mask, &debug_err_mask, cpumask_of(cpu));
1021} 1021}
1022 1022
1023static int __cpuinit dbg_reset_notify(struct notifier_block *self, 1023static int dbg_reset_notify(struct notifier_block *self,
1024 unsigned long action, void *cpu) 1024 unsigned long action, void *cpu)
1025{ 1025{
1026 if ((action & ~CPU_TASKS_FROZEN) == CPU_ONLINE) 1026 if ((action & ~CPU_TASKS_FROZEN) == CPU_ONLINE)
@@ -1029,7 +1029,7 @@ static int __cpuinit dbg_reset_notify(struct notifier_block *self,
1029 return NOTIFY_OK; 1029 return NOTIFY_OK;
1030} 1030}
1031 1031
1032static struct notifier_block __cpuinitdata dbg_reset_nb = { 1032static struct notifier_block dbg_reset_nb = {
1033 .notifier_call = dbg_reset_notify, 1033 .notifier_call = dbg_reset_notify,
1034}; 1034};
1035 1035
diff --git a/arch/arm/kernel/perf_event_cpu.c b/arch/arm/kernel/perf_event_cpu.c
index 1f2740e3dbc0..aebe0e99c153 100644
--- a/arch/arm/kernel/perf_event_cpu.c
+++ b/arch/arm/kernel/perf_event_cpu.c
@@ -157,8 +157,8 @@ static void cpu_pmu_init(struct arm_pmu *cpu_pmu)
157 * UNKNOWN at reset, the PMU must be explicitly reset to avoid reading 157 * UNKNOWN at reset, the PMU must be explicitly reset to avoid reading
158 * junk values out of them. 158 * junk values out of them.
159 */ 159 */
160static int __cpuinit cpu_pmu_notify(struct notifier_block *b, 160static int cpu_pmu_notify(struct notifier_block *b, unsigned long action,
161 unsigned long action, void *hcpu) 161 void *hcpu)
162{ 162{
163 if ((action & ~CPU_TASKS_FROZEN) != CPU_STARTING) 163 if ((action & ~CPU_TASKS_FROZEN) != CPU_STARTING)
164 return NOTIFY_DONE; 164 return NOTIFY_DONE;
@@ -171,7 +171,7 @@ static int __cpuinit cpu_pmu_notify(struct notifier_block *b,
171 return NOTIFY_OK; 171 return NOTIFY_OK;
172} 172}
173 173
174static struct notifier_block __cpuinitdata cpu_pmu_hotplug_notifier = { 174static struct notifier_block cpu_pmu_hotplug_notifier = {
175 .notifier_call = cpu_pmu_notify, 175 .notifier_call = cpu_pmu_notify,
176}; 176};
177 177
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 7f1efcd4a6e9..d3ca4f6915af 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -32,6 +32,7 @@
32#include <linux/hw_breakpoint.h> 32#include <linux/hw_breakpoint.h>
33#include <linux/cpuidle.h> 33#include <linux/cpuidle.h>
34#include <linux/leds.h> 34#include <linux/leds.h>
35#include <linux/reboot.h>
35 36
36#include <asm/cacheflush.h> 37#include <asm/cacheflush.h>
37#include <asm/idmap.h> 38#include <asm/idmap.h>
@@ -113,7 +114,7 @@ void soft_restart(unsigned long addr)
113 BUG(); 114 BUG();
114} 115}
115 116
116static void null_restart(char mode, const char *cmd) 117static void null_restart(enum reboot_mode reboot_mode, const char *cmd)
117{ 118{
118} 119}
119 120
@@ -123,7 +124,7 @@ static void null_restart(char mode, const char *cmd)
123void (*pm_power_off)(void); 124void (*pm_power_off)(void);
124EXPORT_SYMBOL(pm_power_off); 125EXPORT_SYMBOL(pm_power_off);
125 126
126void (*arm_pm_restart)(char str, const char *cmd) = null_restart; 127void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd) = null_restart;
127EXPORT_SYMBOL_GPL(arm_pm_restart); 128EXPORT_SYMBOL_GPL(arm_pm_restart);
128 129
129/* 130/*
@@ -175,16 +176,6 @@ void arch_cpu_idle(void)
175 default_idle(); 176 default_idle();
176} 177}
177 178
178static char reboot_mode = 'h';
179
180int __init reboot_setup(char *str)
181{
182 reboot_mode = str[0];
183 return 1;
184}
185
186__setup("reboot=", reboot_setup);
187
188/* 179/*
189 * Called by kexec, immediately prior to machine_kexec(). 180 * Called by kexec, immediately prior to machine_kexec().
190 * 181 *
diff --git a/arch/arm/kernel/psci_smp.c b/arch/arm/kernel/psci_smp.c
index 219f1d73572a..70ded3fb42d9 100644
--- a/arch/arm/kernel/psci_smp.c
+++ b/arch/arm/kernel/psci_smp.c
@@ -46,8 +46,7 @@
46 46
47extern void secondary_startup(void); 47extern void secondary_startup(void);
48 48
49static int __cpuinit psci_boot_secondary(unsigned int cpu, 49static int psci_boot_secondary(unsigned int cpu, struct task_struct *idle)
50 struct task_struct *idle)
51{ 50{
52 if (psci_ops.cpu_on) 51 if (psci_ops.cpu_on)
53 return psci_ops.cpu_on(cpu_logical_map(cpu), 52 return psci_ops.cpu_on(cpu_logical_map(cpu),
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 2bc1514d6dbe..0dd3b79b15c3 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -886,20 +886,12 @@ long arch_ptrace(struct task_struct *child, long request,
886 886
887#ifdef CONFIG_HAVE_HW_BREAKPOINT 887#ifdef CONFIG_HAVE_HW_BREAKPOINT
888 case PTRACE_GETHBPREGS: 888 case PTRACE_GETHBPREGS:
889 if (ptrace_get_breakpoints(child) < 0)
890 return -ESRCH;
891
892 ret = ptrace_gethbpregs(child, addr, 889 ret = ptrace_gethbpregs(child, addr,
893 (unsigned long __user *)data); 890 (unsigned long __user *)data);
894 ptrace_put_breakpoints(child);
895 break; 891 break;
896 case PTRACE_SETHBPREGS: 892 case PTRACE_SETHBPREGS:
897 if (ptrace_get_breakpoints(child) < 0)
898 return -ESRCH;
899
900 ret = ptrace_sethbpregs(child, addr, 893 ret = ptrace_sethbpregs(child, addr,
901 (unsigned long __user *)data); 894 (unsigned long __user *)data);
902 ptrace_put_breakpoints(child);
903 break; 895 break;
904#endif 896#endif
905 897
diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c
deleted file mode 100644
index e8edcaa0e432..000000000000
--- a/arch/arm/kernel/sched_clock.c
+++ /dev/null
@@ -1,217 +0,0 @@
1/*
2 * sched_clock.c: support for extending counters to full 64-bit ns counter
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#include <linux/clocksource.h>
9#include <linux/init.h>
10#include <linux/jiffies.h>
11#include <linux/kernel.h>
12#include <linux/moduleparam.h>
13#include <linux/sched.h>
14#include <linux/syscore_ops.h>
15#include <linux/timer.h>
16
17#include <asm/sched_clock.h>
18
19struct clock_data {
20 u64 epoch_ns;
21 u32 epoch_cyc;
22 u32 epoch_cyc_copy;
23 unsigned long rate;
24 u32 mult;
25 u32 shift;
26 bool suspended;
27 bool needs_suspend;
28};
29
30static void sched_clock_poll(unsigned long wrap_ticks);
31static DEFINE_TIMER(sched_clock_timer, sched_clock_poll, 0, 0);
32static int irqtime = -1;
33
34core_param(irqtime, irqtime, int, 0400);
35
36static struct clock_data cd = {
37 .mult = NSEC_PER_SEC / HZ,
38};
39
40static u32 __read_mostly sched_clock_mask = 0xffffffff;
41
42static u32 notrace jiffy_sched_clock_read(void)
43{
44 return (u32)(jiffies - INITIAL_JIFFIES);
45}
46
47static u32 __read_mostly (*read_sched_clock)(void) = jiffy_sched_clock_read;
48
49static inline u64 notrace cyc_to_ns(u64 cyc, u32 mult, u32 shift)
50{
51 return (cyc * mult) >> shift;
52}
53
54static unsigned long long notrace cyc_to_sched_clock(u32 cyc, u32 mask)
55{
56 u64 epoch_ns;
57 u32 epoch_cyc;
58
59 if (cd.suspended)
60 return cd.epoch_ns;
61
62 /*
63 * Load the epoch_cyc and epoch_ns atomically. We do this by
64 * ensuring that we always write epoch_cyc, epoch_ns and
65 * epoch_cyc_copy in strict order, and read them in strict order.
66 * If epoch_cyc and epoch_cyc_copy are not equal, then we're in
67 * the middle of an update, and we should repeat the load.
68 */
69 do {
70 epoch_cyc = cd.epoch_cyc;
71 smp_rmb();
72 epoch_ns = cd.epoch_ns;
73 smp_rmb();
74 } while (epoch_cyc != cd.epoch_cyc_copy);
75
76 return epoch_ns + cyc_to_ns((cyc - epoch_cyc) & mask, cd.mult, cd.shift);
77}
78
79/*
80 * Atomically update the sched_clock epoch.
81 */
82static void notrace update_sched_clock(void)
83{
84 unsigned long flags;
85 u32 cyc;
86 u64 ns;
87
88 cyc = read_sched_clock();
89 ns = cd.epoch_ns +
90 cyc_to_ns((cyc - cd.epoch_cyc) & sched_clock_mask,
91 cd.mult, cd.shift);
92 /*
93 * Write epoch_cyc and epoch_ns in a way that the update is
94 * detectable in cyc_to_fixed_sched_clock().
95 */
96 raw_local_irq_save(flags);
97 cd.epoch_cyc_copy = cyc;
98 smp_wmb();
99 cd.epoch_ns = ns;
100 smp_wmb();
101 cd.epoch_cyc = cyc;
102 raw_local_irq_restore(flags);
103}
104
105static void sched_clock_poll(unsigned long wrap_ticks)
106{
107 mod_timer(&sched_clock_timer, round_jiffies(jiffies + wrap_ticks));
108 update_sched_clock();
109}
110
111void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate)
112{
113 unsigned long r, w;
114 u64 res, wrap;
115 char r_unit;
116
117 if (cd.rate > rate)
118 return;
119
120 BUG_ON(bits > 32);
121 WARN_ON(!irqs_disabled());
122 read_sched_clock = read;
123 sched_clock_mask = (1 << bits) - 1;
124 cd.rate = rate;
125
126 /* calculate the mult/shift to convert counter ticks to ns. */
127 clocks_calc_mult_shift(&cd.mult, &cd.shift, rate, NSEC_PER_SEC, 0);
128
129 r = rate;
130 if (r >= 4000000) {
131 r /= 1000000;
132 r_unit = 'M';
133 } else if (r >= 1000) {
134 r /= 1000;
135 r_unit = 'k';
136 } else
137 r_unit = ' ';
138
139 /* calculate how many ns until we wrap */
140 wrap = cyc_to_ns((1ULL << bits) - 1, cd.mult, cd.shift);
141 do_div(wrap, NSEC_PER_MSEC);
142 w = wrap;
143
144 /* calculate the ns resolution of this counter */
145 res = cyc_to_ns(1ULL, cd.mult, cd.shift);
146 pr_info("sched_clock: %u bits at %lu%cHz, resolution %lluns, wraps every %lums\n",
147 bits, r, r_unit, res, w);
148
149 /*
150 * Start the timer to keep sched_clock() properly updated and
151 * sets the initial epoch.
152 */
153 sched_clock_timer.data = msecs_to_jiffies(w - (w / 10));
154 update_sched_clock();
155
156 /*
157 * Ensure that sched_clock() starts off at 0ns
158 */
159 cd.epoch_ns = 0;
160
161 /* Enable IRQ time accounting if we have a fast enough sched_clock */
162 if (irqtime > 0 || (irqtime == -1 && rate >= 1000000))
163 enable_sched_clock_irqtime();
164
165 pr_debug("Registered %pF as sched_clock source\n", read);
166}
167
168static unsigned long long notrace sched_clock_32(void)
169{
170 u32 cyc = read_sched_clock();
171 return cyc_to_sched_clock(cyc, sched_clock_mask);
172}
173
174unsigned long long __read_mostly (*sched_clock_func)(void) = sched_clock_32;
175
176unsigned long long notrace sched_clock(void)
177{
178 return sched_clock_func();
179}
180
181void __init sched_clock_postinit(void)
182{
183 /*
184 * If no sched_clock function has been provided at that point,
185 * make it the final one one.
186 */
187 if (read_sched_clock == jiffy_sched_clock_read)
188 setup_sched_clock(jiffy_sched_clock_read, 32, HZ);
189
190 sched_clock_poll(sched_clock_timer.data);
191}
192
193static int sched_clock_suspend(void)
194{
195 sched_clock_poll(sched_clock_timer.data);
196 cd.suspended = true;
197 return 0;
198}
199
200static void sched_clock_resume(void)
201{
202 cd.epoch_cyc = read_sched_clock();
203 cd.epoch_cyc_copy = cd.epoch_cyc;
204 cd.suspended = false;
205}
206
207static struct syscore_ops sched_clock_ops = {
208 .suspend = sched_clock_suspend,
209 .resume = sched_clock_resume,
210};
211
212static int __init sched_clock_syscore_init(void)
213{
214 register_syscore_ops(&sched_clock_ops);
215 return 0;
216}
217device_initcall(sched_clock_syscore_init);
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 9b653278c9e8..63af9a7ae512 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -74,7 +74,7 @@ __setup("fpe=", fpe_setup);
74 74
75extern void paging_init(struct machine_desc *desc); 75extern void paging_init(struct machine_desc *desc);
76extern void sanity_check_meminfo(void); 76extern void sanity_check_meminfo(void);
77extern void reboot_setup(char *str); 77extern enum reboot_mode reboot_mode;
78extern void setup_dma_zone(struct machine_desc *desc); 78extern void setup_dma_zone(struct machine_desc *desc);
79 79
80unsigned int processor_id; 80unsigned int processor_id;
@@ -861,8 +861,8 @@ void __init setup_arch(char **cmdline_p)
861 861
862 setup_dma_zone(mdesc); 862 setup_dma_zone(mdesc);
863 863
864 if (mdesc->restart_mode) 864 if (mdesc->reboot_mode != REBOOT_HARD)
865 reboot_setup(&mdesc->restart_mode); 865 reboot_mode = mdesc->reboot_mode;
866 866
867 init_mm.start_code = (unsigned long) _text; 867 init_mm.start_code = (unsigned long) _text;
868 init_mm.end_code = (unsigned long) _etext; 868 init_mm.end_code = (unsigned long) _etext;
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index c5fb5469054b..c2b4f8f0be9a 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -58,7 +58,7 @@ struct secondary_data secondary_data;
58 * control for which core is the next to come out of the secondary 58 * control for which core is the next to come out of the secondary
59 * boot "holding pen" 59 * boot "holding pen"
60 */ 60 */
61volatile int __cpuinitdata pen_release = -1; 61volatile int pen_release = -1;
62 62
63enum ipi_msg_type { 63enum ipi_msg_type {
64 IPI_WAKEUP, 64 IPI_WAKEUP,
@@ -86,7 +86,7 @@ static unsigned long get_arch_pgd(pgd_t *pgd)
86 return pgdir >> ARCH_PGD_SHIFT; 86 return pgdir >> ARCH_PGD_SHIFT;
87} 87}
88 88
89int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) 89int __cpu_up(unsigned int cpu, struct task_struct *idle)
90{ 90{
91 int ret; 91 int ret;
92 92
@@ -138,7 +138,7 @@ void __init smp_init_cpus(void)
138 smp_ops.smp_init_cpus(); 138 smp_ops.smp_init_cpus();
139} 139}
140 140
141int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) 141int boot_secondary(unsigned int cpu, struct task_struct *idle)
142{ 142{
143 if (smp_ops.smp_boot_secondary) 143 if (smp_ops.smp_boot_secondary)
144 return smp_ops.smp_boot_secondary(cpu, idle); 144 return smp_ops.smp_boot_secondary(cpu, idle);
@@ -170,7 +170,7 @@ static int platform_cpu_disable(unsigned int cpu)
170/* 170/*
171 * __cpu_disable runs on the processor to be shutdown. 171 * __cpu_disable runs on the processor to be shutdown.
172 */ 172 */
173int __cpuinit __cpu_disable(void) 173int __cpu_disable(void)
174{ 174{
175 unsigned int cpu = smp_processor_id(); 175 unsigned int cpu = smp_processor_id();
176 int ret; 176 int ret;
@@ -216,7 +216,7 @@ static DECLARE_COMPLETION(cpu_died);
216 * called on the thread which is asking for a CPU to be shutdown - 216 * called on the thread which is asking for a CPU to be shutdown -
217 * waits until shutdown has completed, or it is timed out. 217 * waits until shutdown has completed, or it is timed out.
218 */ 218 */
219void __cpuinit __cpu_die(unsigned int cpu) 219void __cpu_die(unsigned int cpu)
220{ 220{
221 if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(5000))) { 221 if (!wait_for_completion_timeout(&cpu_died, msecs_to_jiffies(5000))) {
222 pr_err("CPU%u: cpu didn't die\n", cpu); 222 pr_err("CPU%u: cpu didn't die\n", cpu);
@@ -306,7 +306,7 @@ void __ref cpu_die(void)
306 * Called by both boot and secondaries to move global data into 306 * Called by both boot and secondaries to move global data into
307 * per-processor storage. 307 * per-processor storage.
308 */ 308 */
309static void __cpuinit smp_store_cpu_info(unsigned int cpuid) 309static void smp_store_cpu_info(unsigned int cpuid)
310{ 310{
311 struct cpuinfo_arm *cpu_info = &per_cpu(cpu_data, cpuid); 311 struct cpuinfo_arm *cpu_info = &per_cpu(cpu_data, cpuid);
312 312
@@ -322,7 +322,7 @@ static void percpu_timer_setup(void);
322 * This is the secondary CPU boot entry. We're using this CPUs 322 * This is the secondary CPU boot entry. We're using this CPUs
323 * idle thread stack, but a set of temporary page tables. 323 * idle thread stack, but a set of temporary page tables.
324 */ 324 */
325asmlinkage void __cpuinit secondary_start_kernel(void) 325asmlinkage void secondary_start_kernel(void)
326{ 326{
327 struct mm_struct *mm = &init_mm; 327 struct mm_struct *mm = &init_mm;
328 unsigned int cpu; 328 unsigned int cpu;
@@ -521,7 +521,7 @@ static void broadcast_timer_set_mode(enum clock_event_mode mode,
521{ 521{
522} 522}
523 523
524static void __cpuinit broadcast_timer_setup(struct clock_event_device *evt) 524static void broadcast_timer_setup(struct clock_event_device *evt)
525{ 525{
526 evt->name = "dummy_timer"; 526 evt->name = "dummy_timer";
527 evt->features = CLOCK_EVT_FEAT_ONESHOT | 527 evt->features = CLOCK_EVT_FEAT_ONESHOT |
@@ -550,7 +550,7 @@ int local_timer_register(struct local_timer_ops *ops)
550} 550}
551#endif 551#endif
552 552
553static void __cpuinit percpu_timer_setup(void) 553static void percpu_timer_setup(void)
554{ 554{
555 unsigned int cpu = smp_processor_id(); 555 unsigned int cpu = smp_processor_id();
556 struct clock_event_device *evt = &per_cpu(percpu_clockevent, cpu); 556 struct clock_event_device *evt = &per_cpu(percpu_clockevent, cpu);
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index 90525d9d290b..25956204ef23 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -120,7 +120,7 @@ static int twd_rate_change(struct notifier_block *nb,
120 * changing cpu. 120 * changing cpu.
121 */ 121 */
122 if (flags == POST_RATE_CHANGE) 122 if (flags == POST_RATE_CHANGE)
123 smp_call_function(twd_update_frequency, 123 on_each_cpu(twd_update_frequency,
124 (void *)&cnd->new_rate, 1); 124 (void *)&cnd->new_rate, 1);
125 125
126 return NOTIFY_OK; 126 return NOTIFY_OK;
@@ -187,7 +187,7 @@ core_initcall(twd_cpufreq_init);
187 187
188#endif 188#endif
189 189
190static void __cpuinit twd_calibrate_rate(void) 190static void twd_calibrate_rate(void)
191{ 191{
192 unsigned long count; 192 unsigned long count;
193 u64 waitjiffies; 193 u64 waitjiffies;
@@ -265,7 +265,7 @@ static void twd_get_clock(struct device_node *np)
265/* 265/*
266 * Setup the local clock events for a CPU. 266 * Setup the local clock events for a CPU.
267 */ 267 */
268static int __cpuinit twd_timer_setup(struct clock_event_device *clk) 268static int twd_timer_setup(struct clock_event_device *clk)
269{ 269{
270 struct clock_event_device **this_cpu_clk; 270 struct clock_event_device **this_cpu_clk;
271 int cpu = smp_processor_id(); 271 int cpu = smp_processor_id();
@@ -308,7 +308,7 @@ static int __cpuinit twd_timer_setup(struct clock_event_device *clk)
308 return 0; 308 return 0;
309} 309}
310 310
311static struct local_timer_ops twd_lt_ops __cpuinitdata = { 311static struct local_timer_ops twd_lt_ops = {
312 .setup = twd_timer_setup, 312 .setup = twd_timer_setup,
313 .stop = twd_timer_stop, 313 .stop = twd_timer_stop,
314}; 314};
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index abff4e9aaee0..98aee3258398 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -24,9 +24,9 @@
24#include <linux/timer.h> 24#include <linux/timer.h>
25#include <linux/clocksource.h> 25#include <linux/clocksource.h>
26#include <linux/irq.h> 26#include <linux/irq.h>
27#include <linux/sched_clock.h>
27 28
28#include <asm/thread_info.h> 29#include <asm/thread_info.h>
29#include <asm/sched_clock.h>
30#include <asm/stacktrace.h> 30#include <asm/stacktrace.h>
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/mach/time.h> 32#include <asm/mach/time.h>
@@ -120,6 +120,4 @@ void __init time_init(void)
120 machine_desc->init_time(); 120 machine_desc->init_time();
121 else 121 else
122 clocksource_of_init(); 122 clocksource_of_init();
123
124 sched_clock_postinit();
125} 123}
diff --git a/arch/arm/lib/delay.c b/arch/arm/lib/delay.c
index 64dbfa57204a..5306de350133 100644
--- a/arch/arm/lib/delay.c
+++ b/arch/arm/lib/delay.c
@@ -86,7 +86,7 @@ void __init register_current_timer_delay(const struct delay_timer *timer)
86 } 86 }
87} 87}
88 88
89unsigned long __cpuinit calibrate_delay_is_known(void) 89unsigned long calibrate_delay_is_known(void)
90{ 90{
91 delay_calibrated = true; 91 delay_calibrated = true;
92 return lpj_fine; 92 return lpj_fine;
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 9eb574397ee1..4aad93d54d6f 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/reboot.h>
14 15
15#include <asm/irq.h> 16#include <asm/irq.h>
16#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
@@ -304,7 +305,7 @@ static void at91rm9200_idle(void)
304 at91_pmc_write(AT91_PMC_SCDR, AT91_PMC_PCK); 305 at91_pmc_write(AT91_PMC_SCDR, AT91_PMC_PCK);
305} 306}
306 307
307static void at91rm9200_restart(char mode, const char *cmd) 308static void at91rm9200_restart(enum reboot_mode reboot_mode, const char *cmd)
308{ 309{
309 /* 310 /*
310 * Perform a hardware reset with the use of the Watchdog timer. 311 * Perform a hardware reset with the use of the Watchdog timer.
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index f6de36aefe85..dc6e2f5f804d 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -10,6 +10,7 @@
10 10
11#include <linux/clkdev.h> 11#include <linux/clkdev.h>
12#include <linux/of.h> 12#include <linux/of.h>
13#include <linux/reboot.h>
13 14
14 /* Map io */ 15 /* Map io */
15extern void __init at91_map_io(void); 16extern void __init at91_map_io(void);
@@ -60,8 +61,8 @@ extern void at91sam9_idle(void);
60 61
61/* reset */ 62/* reset */
62extern void at91_ioremap_rstc(u32 base_addr); 63extern void at91_ioremap_rstc(u32 base_addr);
63extern void at91sam9_alt_restart(char, const char *); 64extern void at91sam9_alt_restart(enum reboot_mode, const char *);
64extern void at91sam9g45_restart(char, const char *); 65extern void at91sam9g45_restart(enum reboot_mode, const char *);
65 66
66/* shutdown */ 67/* shutdown */
67extern void at91_ioremap_shdwc(u32 base_addr); 68extern void at91_ioremap_shdwc(u32 base_addr);
diff --git a/arch/arm/mach-bcm2835/bcm2835.c b/arch/arm/mach-bcm2835/bcm2835.c
index 740fa9ebe249..40686d7ef500 100644
--- a/arch/arm/mach-bcm2835/bcm2835.c
+++ b/arch/arm/mach-bcm2835/bcm2835.c
@@ -53,7 +53,7 @@ static void bcm2835_setup_restart(void)
53 WARN(!wdt_regs, "failed to remap watchdog regs"); 53 WARN(!wdt_regs, "failed to remap watchdog regs");
54} 54}
55 55
56static void bcm2835_restart(char mode, const char *cmd) 56static void bcm2835_restart(enum reboot_mode mode, const char *cmd)
57{ 57{
58 u32 val; 58 u32 val;
59 59
@@ -91,7 +91,7 @@ static void bcm2835_power_off(void)
91 writel_relaxed(val, wdt_regs + PM_RSTS); 91 writel_relaxed(val, wdt_regs + PM_RSTS);
92 92
93 /* Continue with normal reset mechanism */ 93 /* Continue with normal reset mechanism */
94 bcm2835_restart(0, ""); 94 bcm2835_restart(REBOOT_HARD, "");
95} 95}
96 96
97static struct map_desc io_map __initdata = { 97static struct map_desc io_map __initdata = {
diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c
index f6d1746366d4..4ca2f3ca2de4 100644
--- a/arch/arm/mach-clps711x/common.c
+++ b/arch/arm/mach-clps711x/common.c
@@ -384,7 +384,7 @@ void __init clps711x_timer_init(void)
384 setup_irq(IRQ_TC2OI, &clps711x_timer_irq); 384 setup_irq(IRQ_TC2OI, &clps711x_timer_irq);
385} 385}
386 386
387void clps711x_restart(char mode, const char *cmd) 387void clps711x_restart(enum reboot_mode mode, const char *cmd)
388{ 388{
389 soft_restart(0); 389 soft_restart(0);
390} 390}
diff --git a/arch/arm/mach-clps711x/common.h b/arch/arm/mach-clps711x/common.h
index 2a22f4c6cc75..9a6767bfdc47 100644
--- a/arch/arm/mach-clps711x/common.h
+++ b/arch/arm/mach-clps711x/common.h
@@ -4,6 +4,8 @@
4 * Common bits. 4 * Common bits.
5 */ 5 */
6 6
7#include <linux/reboot.h>
8
7#define CLPS711X_NR_IRQS (33) 9#define CLPS711X_NR_IRQS (33)
8#define CLPS711X_NR_GPIO (4 * 8 + 3) 10#define CLPS711X_NR_GPIO (4 * 8 + 3)
9#define CLPS711X_GPIO(prt, bit) ((prt) * 8 + (bit)) 11#define CLPS711X_GPIO(prt, bit) ((prt) * 8 + (bit))
@@ -12,5 +14,5 @@ extern void clps711x_map_io(void);
12extern void clps711x_init_irq(void); 14extern void clps711x_init_irq(void);
13extern void clps711x_timer_init(void); 15extern void clps711x_timer_init(void);
14extern void clps711x_handle_irq(struct pt_regs *regs); 16extern void clps711x_handle_irq(struct pt_regs *regs);
15extern void clps711x_restart(char mode, const char *cmd); 17extern void clps711x_restart(enum reboot_mode mode, const char *cmd);
16extern void clps711x_init_early(void); 18extern void clps711x_init_early(void);
diff --git a/arch/arm/mach-cns3xxx/core.h b/arch/arm/mach-cns3xxx/core.h
index b23b17b4da10..5218b6198dc2 100644
--- a/arch/arm/mach-cns3xxx/core.h
+++ b/arch/arm/mach-cns3xxx/core.h
@@ -11,6 +11,8 @@
11#ifndef __CNS3XXX_CORE_H 11#ifndef __CNS3XXX_CORE_H
12#define __CNS3XXX_CORE_H 12#define __CNS3XXX_CORE_H
13 13
14#include <linux/reboot.h>
15
14extern void cns3xxx_timer_init(void); 16extern void cns3xxx_timer_init(void);
15 17
16#ifdef CONFIG_CACHE_L2X0 18#ifdef CONFIG_CACHE_L2X0
@@ -22,6 +24,6 @@ static inline void cns3xxx_l2x0_init(void) {}
22void __init cns3xxx_map_io(void); 24void __init cns3xxx_map_io(void);
23void __init cns3xxx_init_irq(void); 25void __init cns3xxx_init_irq(void);
24void cns3xxx_power_off(void); 26void cns3xxx_power_off(void);
25void cns3xxx_restart(char, const char *); 27void cns3xxx_restart(enum reboot_mode, const char *);
26 28
27#endif /* __CNS3XXX_CORE_H */ 29#endif /* __CNS3XXX_CORE_H */
diff --git a/arch/arm/mach-cns3xxx/pm.c b/arch/arm/mach-cns3xxx/pm.c
index 79e3d47aad65..fb38c726e987 100644
--- a/arch/arm/mach-cns3xxx/pm.c
+++ b/arch/arm/mach-cns3xxx/pm.c
@@ -89,7 +89,7 @@ void cns3xxx_pwr_soft_rst(unsigned int block)
89} 89}
90EXPORT_SYMBOL(cns3xxx_pwr_soft_rst); 90EXPORT_SYMBOL(cns3xxx_pwr_soft_rst);
91 91
92void cns3xxx_restart(char mode, const char *cmd) 92void cns3xxx_restart(enum reboot_mode mode, const char *cmd)
93{ 93{
94 /* 94 /*
95 * To reset, we hit the on-board reset register 95 * To reset, we hit the on-board reset register
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index fd38c8d22e3c..afbc439f11d4 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -509,7 +509,6 @@ struct ths7303_platform_data ths7303_pdata = {
509 .ch_1 = 3, 509 .ch_1 = 3,
510 .ch_2 = 3, 510 .ch_2 = 3,
511 .ch_3 = 3, 511 .ch_3 = 3,
512 .init_enable = 1,
513}; 512};
514 513
515static struct amp_config_info vpbe_amp = { 514static struct amp_config_info vpbe_amp = {
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index eb254fe861ac..71a46a348761 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -16,6 +16,7 @@
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/ahci_platform.h> 17#include <linux/ahci_platform.h>
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/reboot.h>
19 20
20#include <mach/cputype.h> 21#include <mach/cputype.h>
21#include <mach/common.h> 22#include <mach/common.h>
@@ -366,7 +367,7 @@ static struct platform_device da8xx_wdt_device = {
366 .resource = da8xx_watchdog_resources, 367 .resource = da8xx_watchdog_resources,
367}; 368};
368 369
369void da8xx_restart(char mode, const char *cmd) 370void da8xx_restart(enum reboot_mode mode, const char *cmd)
370{ 371{
371 struct device *dev; 372 struct device *dev;
372 373
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index 90b83d00fe2b..111573c0aad1 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -13,6 +13,7 @@
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/dma-mapping.h> 14#include <linux/dma-mapping.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/reboot.h>
16 17
17#include <mach/hardware.h> 18#include <mach/hardware.h>
18#include <linux/platform_data/i2c-davinci.h> 19#include <linux/platform_data/i2c-davinci.h>
@@ -307,7 +308,7 @@ struct platform_device davinci_wdt_device = {
307 .resource = wdt_resources, 308 .resource = wdt_resources,
308}; 309};
309 310
310void davinci_restart(char mode, const char *cmd) 311void davinci_restart(enum reboot_mode mode, const char *cmd)
311{ 312{
312 davinci_watchdog_reset(&davinci_wdt_device); 313 davinci_watchdog_reset(&davinci_wdt_device);
313} 314}
diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h
index b124b77c90c5..cce316b92c06 100644
--- a/arch/arm/mach-davinci/include/mach/common.h
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -14,6 +14,7 @@
14 14
15#include <linux/compiler.h> 15#include <linux/compiler.h>
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/reboot.h>
17 18
18extern void davinci_timer_init(void); 19extern void davinci_timer_init(void);
19 20
@@ -81,7 +82,7 @@ extern struct davinci_soc_info davinci_soc_info;
81 82
82extern void davinci_common_init(struct davinci_soc_info *soc_info); 83extern void davinci_common_init(struct davinci_soc_info *soc_info);
83extern void davinci_init_ide(void); 84extern void davinci_init_ide(void);
84void davinci_restart(char mode, const char *cmd); 85void davinci_restart(enum reboot_mode mode, const char *cmd);
85void davinci_init_late(void); 86void davinci_init_late(void);
86 87
87#ifdef CONFIG_DAVINCI_RESET_CLOCKS 88#ifdef CONFIG_DAVINCI_RESET_CLOCKS
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index 3c797e2272f8..7b41a5e9bc31 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -17,6 +17,7 @@
17#include <linux/davinci_emac.h> 17#include <linux/davinci_emac.h>
18#include <linux/spi/spi.h> 18#include <linux/spi/spi.h>
19#include <linux/platform_data/davinci_asp.h> 19#include <linux/platform_data/davinci_asp.h>
20#include <linux/reboot.h>
20#include <linux/videodev2.h> 21#include <linux/videodev2.h>
21 22
22#include <mach/serial.h> 23#include <mach/serial.h>
@@ -106,7 +107,7 @@ int da850_register_vpif_display
106 (struct vpif_display_config *display_config); 107 (struct vpif_display_config *display_config);
107int da850_register_vpif_capture 108int da850_register_vpif_capture
108 (struct vpif_capture_config *capture_config); 109 (struct vpif_capture_config *capture_config);
109void da8xx_restart(char mode, const char *cmd); 110void da8xx_restart(enum reboot_mode mode, const char *cmd);
110void da8xx_rproc_reserve_cma(void); 111void da8xx_rproc_reserve_cma(void);
111int da8xx_register_rproc(void); 112int da8xx_register_rproc(void);
112 113
diff --git a/arch/arm/mach-davinci/include/mach/tnetv107x.h b/arch/arm/mach-davinci/include/mach/tnetv107x.h
index 366e975effa8..16314c64f755 100644
--- a/arch/arm/mach-davinci/include/mach/tnetv107x.h
+++ b/arch/arm/mach-davinci/include/mach/tnetv107x.h
@@ -35,6 +35,7 @@
35#include <linux/serial_8250.h> 35#include <linux/serial_8250.h>
36#include <linux/input/matrix_keypad.h> 36#include <linux/input/matrix_keypad.h>
37#include <linux/mfd/ti_ssp.h> 37#include <linux/mfd/ti_ssp.h>
38#include <linux/reboot.h>
38 39
39#include <linux/platform_data/mmc-davinci.h> 40#include <linux/platform_data/mmc-davinci.h>
40#include <linux/platform_data/mtd-davinci.h> 41#include <linux/platform_data/mtd-davinci.h>
@@ -54,7 +55,7 @@ extern struct platform_device tnetv107x_serial_device;
54extern void tnetv107x_init(void); 55extern void tnetv107x_init(void);
55extern void tnetv107x_devices_init(struct tnetv107x_device_info *); 56extern void tnetv107x_devices_init(struct tnetv107x_device_info *);
56extern void tnetv107x_irq_init(void); 57extern void tnetv107x_irq_init(void);
57void tnetv107x_restart(char mode, const char *cmd); 58void tnetv107x_restart(enum reboot_mode mode, const char *cmd);
58 59
59#endif 60#endif
60 61
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index bad361ec1666..7a55b5c95971 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -18,8 +18,8 @@
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/sched_clock.h>
21 22
22#include <asm/sched_clock.h>
23#include <asm/mach/irq.h> 23#include <asm/mach/irq.h>
24#include <asm/mach/time.h> 24#include <asm/mach/time.h>
25 25
diff --git a/arch/arm/mach-davinci/tnetv107x.c b/arch/arm/mach-davinci/tnetv107x.c
index 3b2a70d43efa..4545667ecd3c 100644
--- a/arch/arm/mach-davinci/tnetv107x.c
+++ b/arch/arm/mach-davinci/tnetv107x.c
@@ -19,6 +19,7 @@
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/err.h> 20#include <linux/err.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/reboot.h>
22 23
23#include <asm/mach/map.h> 24#include <asm/mach/map.h>
24 25
@@ -730,7 +731,7 @@ static void tnetv107x_watchdog_reset(struct platform_device *pdev)
730 __raw_writel(1, &regs->kick); 731 __raw_writel(1, &regs->kick);
731} 732}
732 733
733void tnetv107x_restart(char mode, const char *cmd) 734void tnetv107x_restart(enum reboot_mode mode, const char *cmd)
734{ 735{
735 tnetv107x_watchdog_reset(&tnetv107x_wdt_device); 736 tnetv107x_watchdog_reset(&tnetv107x_wdt_device);
736} 737}
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 2a9443d04d92..00247c771313 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -381,7 +381,7 @@ void __init dove_init(void)
381 dove_xor1_init(); 381 dove_xor1_init();
382} 382}
383 383
384void dove_restart(char mode, const char *cmd) 384void dove_restart(enum reboot_mode mode, const char *cmd)
385{ 385{
386 /* 386 /*
387 * Enable soft reset to assert RSTOUTn. 387 * Enable soft reset to assert RSTOUTn.
diff --git a/arch/arm/mach-dove/common.h b/arch/arm/mach-dove/common.h
index e86347928b67..1d725224d146 100644
--- a/arch/arm/mach-dove/common.h
+++ b/arch/arm/mach-dove/common.h
@@ -11,6 +11,8 @@
11#ifndef __ARCH_DOVE_COMMON_H 11#ifndef __ARCH_DOVE_COMMON_H
12#define __ARCH_DOVE_COMMON_H 12#define __ARCH_DOVE_COMMON_H
13 13
14#include <linux/reboot.h>
15
14struct mv643xx_eth_platform_data; 16struct mv643xx_eth_platform_data;
15struct mv_sata_platform_data; 17struct mv_sata_platform_data;
16 18
@@ -42,6 +44,6 @@ void dove_spi1_init(void);
42void dove_i2c_init(void); 44void dove_i2c_init(void);
43void dove_sdio0_init(void); 45void dove_sdio0_init(void);
44void dove_sdio1_init(void); 46void dove_sdio1_init(void);
45void dove_restart(char, const char *); 47void dove_restart(enum reboot_mode, const char *);
46 48
47#endif 49#endif
diff --git a/arch/arm/mach-dove/include/mach/bridge-regs.h b/arch/arm/mach-dove/include/mach/bridge-regs.h
index 99f259e8cf33..5362df3df89f 100644
--- a/arch/arm/mach-dove/include/mach/bridge-regs.h
+++ b/arch/arm/mach-dove/include/mach/bridge-regs.h
@@ -26,6 +26,7 @@
26#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE + 0x010c) 26#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE + 0x010c)
27#define SOFT_RESET 0x00000001 27#define SOFT_RESET 0x00000001
28 28
29#define BRIDGE_CAUSE (BRIDGE_VIRT_BASE + 0x0110)
29#define BRIDGE_INT_TIMER1_CLR (~0x0004) 30#define BRIDGE_INT_TIMER1_CLR (~0x0004)
30 31
31#define IRQ_VIRT_BASE (BRIDGE_VIRT_BASE + 0x0200) 32#define IRQ_VIRT_BASE (BRIDGE_VIRT_BASE + 0x0200)
diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c
index 8a53f346cdb3..68ac934d4565 100644
--- a/arch/arm/mach-ebsa110/core.c
+++ b/arch/arm/mach-ebsa110/core.c
@@ -311,7 +311,7 @@ static int __init ebsa110_init(void)
311 311
312arch_initcall(ebsa110_init); 312arch_initcall(ebsa110_init);
313 313
314static void ebsa110_restart(char mode, const char *cmd) 314static void ebsa110_restart(enum reboot_mode mode, const char *cmd)
315{ 315{
316 soft_restart(0x80000000); 316 soft_restart(0x80000000);
317} 317}
@@ -321,7 +321,6 @@ MACHINE_START(EBSA110, "EBSA110")
321 .atag_offset = 0x400, 321 .atag_offset = 0x400,
322 .reserve_lp0 = 1, 322 .reserve_lp0 = 1,
323 .reserve_lp2 = 1, 323 .reserve_lp2 = 1,
324 .restart_mode = 's',
325 .map_io = ebsa110_map_io, 324 .map_io = ebsa110_map_io,
326 .init_early = ebsa110_init_early, 325 .init_early = ebsa110_init_early,
327 .init_irq = ebsa110_init_irq, 326 .init_irq = ebsa110_init_irq,
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index c49ed3dc1aea..df8612fbbc9c 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -35,6 +35,7 @@
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/export.h> 36#include <linux/export.h>
37#include <linux/irqchip/arm-vic.h> 37#include <linux/irqchip/arm-vic.h>
38#include <linux/reboot.h>
38 39
39#include <mach/hardware.h> 40#include <mach/hardware.h>
40#include <linux/platform_data/video-ep93xx.h> 41#include <linux/platform_data/video-ep93xx.h>
@@ -921,7 +922,7 @@ void __init ep93xx_init_devices(void)
921 gpio_led_register_device(-1, &ep93xx_led_data); 922 gpio_led_register_device(-1, &ep93xx_led_data);
922} 923}
923 924
924void ep93xx_restart(char mode, const char *cmd) 925void ep93xx_restart(enum reboot_mode mode, const char *cmd)
925{ 926{
926 /* 927 /*
927 * Set then clear the SWRST bit to initiate a software reset 928 * Set then clear the SWRST bit to initiate a software reset
diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h
index a14e1b37beff..e256e0baec2e 100644
--- a/arch/arm/mach-ep93xx/include/mach/platform.h
+++ b/arch/arm/mach-ep93xx/include/mach/platform.h
@@ -4,6 +4,8 @@
4 4
5#ifndef __ASSEMBLY__ 5#ifndef __ASSEMBLY__
6 6
7#include <linux/reboot.h>
8
7struct i2c_gpio_platform_data; 9struct i2c_gpio_platform_data;
8struct i2c_board_info; 10struct i2c_board_info;
9struct spi_board_info; 11struct spi_board_info;
@@ -55,7 +57,7 @@ void ep93xx_ide_release_gpio(struct platform_device *pdev);
55void ep93xx_init_devices(void); 57void ep93xx_init_devices(void);
56extern void ep93xx_timer_init(void); 58extern void ep93xx_timer_init(void);
57 59
58void ep93xx_restart(char, const char *); 60void ep93xx_restart(enum reboot_mode, const char *);
59void ep93xx_init_late(void); 61void ep93xx_init_late(void);
60 62
61#ifdef CONFIG_CRUNCH 63#ifdef CONFIG_CRUNCH
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index f5f65b58181e..855d4a7b462d 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -38,7 +38,7 @@ config CPU_EXYNOS4210
38 depends on ARCH_EXYNOS4 38 depends on ARCH_EXYNOS4
39 select ARM_CPU_SUSPEND if PM 39 select ARM_CPU_SUSPEND if PM
40 select PINCTRL_EXYNOS 40 select PINCTRL_EXYNOS
41 select PM_GENERIC_DOMAINS 41 select PM_GENERIC_DOMAINS if PM
42 select S5P_PM if PM 42 select S5P_PM if PM
43 select S5P_SLEEP if PM 43 select S5P_SLEEP if PM
44 select SAMSUNG_DMADEV 44 select SAMSUNG_DMADEV
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 2c655db4b78e..164685bd25c8 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -285,12 +285,12 @@ static struct map_desc exynos5440_iodesc0[] __initdata = {
285 }, 285 },
286}; 286};
287 287
288void exynos4_restart(char mode, const char *cmd) 288void exynos4_restart(enum reboot_mode mode, const char *cmd)
289{ 289{
290 __raw_writel(0x1, S5P_SWRESET); 290 __raw_writel(0x1, S5P_SWRESET);
291} 291}
292 292
293void exynos5_restart(char mode, const char *cmd) 293void exynos5_restart(enum reboot_mode mode, const char *cmd)
294{ 294{
295 struct device_node *np; 295 struct device_node *np;
296 u32 val; 296 u32 val;
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 38d45fd23be4..3e156bcddcb4 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -12,6 +12,7 @@
12#ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H 12#ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H
13#define __ARCH_ARM_MACH_EXYNOS_COMMON_H 13#define __ARCH_ARM_MACH_EXYNOS_COMMON_H
14 14
15#include <linux/reboot.h>
15#include <linux/of.h> 16#include <linux/of.h>
16 17
17void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1); 18void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1);
@@ -20,8 +21,8 @@ extern unsigned long xxti_f, xusbxti_f;
20 21
21struct map_desc; 22struct map_desc;
22void exynos_init_io(void); 23void exynos_init_io(void);
23void exynos4_restart(char mode, const char *cmd); 24void exynos4_restart(enum reboot_mode mode, const char *cmd);
24void exynos5_restart(char mode, const char *cmd); 25void exynos5_restart(enum reboot_mode mode, const char *cmd);
25void exynos_init_late(void); 26void exynos_init_late(void);
26 27
27/* ToDo: remove these after migrating legacy exynos4 platforms to dt */ 28/* ToDo: remove these after migrating legacy exynos4 platforms to dt */
diff --git a/arch/arm/mach-exynos/headsmp.S b/arch/arm/mach-exynos/headsmp.S
index 5364d4bfa8bc..cdd9d91e9933 100644
--- a/arch/arm/mach-exynos/headsmp.S
+++ b/arch/arm/mach-exynos/headsmp.S
@@ -13,8 +13,6 @@
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <linux/init.h> 14#include <linux/init.h>
15 15
16 __CPUINIT
17
18/* 16/*
19 * exynos4 specific entry point for secondary CPUs. This provides 17 * exynos4 specific entry point for secondary CPUs. This provides
20 * a "holding pen" into which all secondary cores are held until we're 18 * a "holding pen" into which all secondary cores are held until we're
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index deba1308ff16..58b43e6f9262 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -75,7 +75,7 @@ static void __iomem *scu_base_addr(void)
75 75
76static DEFINE_SPINLOCK(boot_lock); 76static DEFINE_SPINLOCK(boot_lock);
77 77
78static void __cpuinit exynos_secondary_init(unsigned int cpu) 78static void exynos_secondary_init(unsigned int cpu)
79{ 79{
80 /* 80 /*
81 * let the primary processor know we're out of the 81 * let the primary processor know we're out of the
@@ -90,7 +90,7 @@ static void __cpuinit exynos_secondary_init(unsigned int cpu)
90 spin_unlock(&boot_lock); 90 spin_unlock(&boot_lock);
91} 91}
92 92
93static int __cpuinit exynos_boot_secondary(unsigned int cpu, struct task_struct *idle) 93static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle)
94{ 94{
95 unsigned long timeout; 95 unsigned long timeout;
96 unsigned long phys_cpu = cpu_logical_map(cpu); 96 unsigned long phys_cpu = cpu_logical_map(cpu);
diff --git a/arch/arm/mach-footbridge/cats-hw.c b/arch/arm/mach-footbridge/cats-hw.c
index 6987a09ec219..9669cc0b6318 100644
--- a/arch/arm/mach-footbridge/cats-hw.c
+++ b/arch/arm/mach-footbridge/cats-hw.c
@@ -86,7 +86,7 @@ fixup_cats(struct tag *tags, char **cmdline, struct meminfo *mi)
86MACHINE_START(CATS, "Chalice-CATS") 86MACHINE_START(CATS, "Chalice-CATS")
87 /* Maintainer: Philip Blundell */ 87 /* Maintainer: Philip Blundell */
88 .atag_offset = 0x100, 88 .atag_offset = 0x100,
89 .restart_mode = 's', 89 .reboot_mode = REBOOT_SOFT,
90 .fixup = fixup_cats, 90 .fixup = fixup_cats,
91 .map_io = footbridge_map_io, 91 .map_io = footbridge_map_io,
92 .init_irq = footbridge_init_irq, 92 .init_irq = footbridge_init_irq,
diff --git a/arch/arm/mach-footbridge/common.c b/arch/arm/mach-footbridge/common.c
index a42b369bc439..2739ca2c1334 100644
--- a/arch/arm/mach-footbridge/common.c
+++ b/arch/arm/mach-footbridge/common.c
@@ -198,9 +198,9 @@ void __init footbridge_map_io(void)
198 } 198 }
199} 199}
200 200
201void footbridge_restart(char mode, const char *cmd) 201void footbridge_restart(enum reboot_mode mode, const char *cmd)
202{ 202{
203 if (mode == 's') { 203 if (mode == REBOOT_SOFT) {
204 /* Jump into the ROM */ 204 /* Jump into the ROM */
205 soft_restart(0x41000000); 205 soft_restart(0x41000000);
206 } else { 206 } else {
diff --git a/arch/arm/mach-footbridge/common.h b/arch/arm/mach-footbridge/common.h
index a846e50a07b8..56607b3a773e 100644
--- a/arch/arm/mach-footbridge/common.h
+++ b/arch/arm/mach-footbridge/common.h
@@ -1,3 +1,4 @@
1#include <linux/reboot.h>
1 2
2extern void footbridge_timer_init(void); 3extern void footbridge_timer_init(void);
3extern void isa_timer_init(void); 4extern void isa_timer_init(void);
@@ -8,4 +9,4 @@ extern void footbridge_map_io(void);
8extern void footbridge_init_irq(void); 9extern void footbridge_init_irq(void);
9 10
10extern void isa_init_irq(unsigned int irq); 11extern void isa_init_irq(unsigned int irq);
11extern void footbridge_restart(char, const char *); 12extern void footbridge_restart(enum reboot_mode, const char *);
diff --git a/arch/arm/mach-footbridge/netwinder-hw.c b/arch/arm/mach-footbridge/netwinder-hw.c
index 90ea23fdce4c..1fd2cf097e30 100644
--- a/arch/arm/mach-footbridge/netwinder-hw.c
+++ b/arch/arm/mach-footbridge/netwinder-hw.c
@@ -634,9 +634,9 @@ fixup_netwinder(struct tag *tags, char **cmdline, struct meminfo *mi)
634#endif 634#endif
635} 635}
636 636
637static void netwinder_restart(char mode, const char *cmd) 637static void netwinder_restart(enum reboot_mode mode, const char *cmd)
638{ 638{
639 if (mode == 's') { 639 if (mode == REBOOT_SOFT) {
640 /* Jump into the ROM */ 640 /* Jump into the ROM */
641 soft_restart(0x41000000); 641 soft_restart(0x41000000);
642 } else { 642 } else {
diff --git a/arch/arm/mach-highbank/core.h b/arch/arm/mach-highbank/core.h
index 3f65206a9b92..aea1ec5ab6f8 100644
--- a/arch/arm/mach-highbank/core.h
+++ b/arch/arm/mach-highbank/core.h
@@ -1,8 +1,10 @@
1#ifndef __HIGHBANK_CORE_H 1#ifndef __HIGHBANK_CORE_H
2#define __HIGHBANK_CORE_H 2#define __HIGHBANK_CORE_H
3 3
4#include <linux/reboot.h>
5
4extern void highbank_set_cpu_jump(int cpu, void *jump_addr); 6extern void highbank_set_cpu_jump(int cpu, void *jump_addr);
5extern void highbank_restart(char, const char *); 7extern void highbank_restart(enum reboot_mode, const char *);
6extern void __iomem *scu_base_addr; 8extern void __iomem *scu_base_addr;
7 9
8#ifdef CONFIG_PM_SLEEP 10#ifdef CONFIG_PM_SLEEP
diff --git a/arch/arm/mach-highbank/platsmp.c b/arch/arm/mach-highbank/platsmp.c
index a984573e0d02..32d75cf55cbc 100644
--- a/arch/arm/mach-highbank/platsmp.c
+++ b/arch/arm/mach-highbank/platsmp.c
@@ -24,7 +24,7 @@
24 24
25extern void secondary_startup(void); 25extern void secondary_startup(void);
26 26
27static int __cpuinit highbank_boot_secondary(unsigned int cpu, struct task_struct *idle) 27static int highbank_boot_secondary(unsigned int cpu, struct task_struct *idle)
28{ 28{
29 highbank_set_cpu_jump(cpu, secondary_startup); 29 highbank_set_cpu_jump(cpu, secondary_startup);
30 arch_send_wakeup_ipi_mask(cpumask_of(cpu)); 30 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
diff --git a/arch/arm/mach-highbank/system.c b/arch/arm/mach-highbank/system.c
index 37d8384dcf19..2df5870b7583 100644
--- a/arch/arm/mach-highbank/system.c
+++ b/arch/arm/mach-highbank/system.c
@@ -15,13 +15,14 @@
15 */ 15 */
16#include <linux/io.h> 16#include <linux/io.h>
17#include <asm/proc-fns.h> 17#include <asm/proc-fns.h>
18#include <linux/reboot.h>
18 19
19#include "core.h" 20#include "core.h"
20#include "sysregs.h" 21#include "sysregs.h"
21 22
22void highbank_restart(char mode, const char *cmd) 23void highbank_restart(enum reboot_mode mode, const char *cmd)
23{ 24{
24 if (mode == 'h') 25 if (mode == REBOOT_HARD)
25 highbank_set_pwr_hard_reset(); 26 highbank_set_pwr_hard_reset();
26 else 27 else
27 highbank_set_pwr_soft_reset(); 28 highbank_set_pwr_soft_reset();
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 60661a4b0e24..f54656091a9d 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -108,7 +108,6 @@ config SOC_IMX25
108 select ARCH_MXC_IOMUX_V3 108 select ARCH_MXC_IOMUX_V3
109 select COMMON_CLK 109 select COMMON_CLK
110 select CPU_ARM926T 110 select CPU_ARM926T
111 select HAVE_CAN_FLEXCAN if CAN
112 select MXC_AVIC 111 select MXC_AVIC
113 112
114config SOC_IMX27 113config SOC_IMX27
@@ -134,7 +133,6 @@ config SOC_IMX35
134 select ARCH_MXC_IOMUX_V3 133 select ARCH_MXC_IOMUX_V3
135 select COMMON_CLK 134 select COMMON_CLK
136 select CPU_V6K 135 select CPU_V6K
137 select HAVE_CAN_FLEXCAN if CAN
138 select HAVE_EPIT 136 select HAVE_EPIT
139 select MXC_AVIC 137 select MXC_AVIC
140 select SMP_ON_UP if SMP 138 select SMP_ON_UP if SMP
@@ -774,7 +772,6 @@ comment "Device tree only"
774 772
775config SOC_IMX53 773config SOC_IMX53
776 bool "i.MX53 support" 774 bool "i.MX53 support"
777 select HAVE_CAN_FLEXCAN if CAN
778 select HAVE_IMX_SRC 775 select HAVE_IMX_SRC
779 select IMX_HAVE_PLATFORM_IMX2_WDT 776 select IMX_HAVE_PLATFORM_IMX2_WDT
780 select PINCTRL 777 select PINCTRL
@@ -797,7 +794,6 @@ config SOC_IMX6Q
797 select CPU_V7 794 select CPU_V7
798 select HAVE_ARM_SCU if SMP 795 select HAVE_ARM_SCU if SMP
799 select HAVE_ARM_TWD if LOCAL_TIMERS 796 select HAVE_ARM_TWD if LOCAL_TIMERS
800 select HAVE_CAN_FLEXCAN if CAN
801 select HAVE_IMX_ANATOP 797 select HAVE_IMX_ANATOP
802 select HAVE_IMX_GPC 798 select HAVE_IMX_GPC
803 select HAVE_IMX_MMDC 799 select HAVE_IMX_MMDC
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
index ee78847abf47..cb6c838b63ed 100644
--- a/arch/arm/mach-imx/common.h
+++ b/arch/arm/mach-imx/common.h
@@ -11,6 +11,8 @@
11#ifndef __ASM_ARCH_MXC_COMMON_H__ 11#ifndef __ASM_ARCH_MXC_COMMON_H__
12#define __ASM_ARCH_MXC_COMMON_H__ 12#define __ASM_ARCH_MXC_COMMON_H__
13 13
14#include <linux/reboot.h>
15
14struct platform_device; 16struct platform_device;
15struct pt_regs; 17struct pt_regs;
16struct clk; 18struct clk;
@@ -71,7 +73,7 @@ extern int mx53_clocks_init_dt(void);
71extern struct platform_device *mxc_register_gpio(char *name, int id, 73extern struct platform_device *mxc_register_gpio(char *name, int id,
72 resource_size_t iobase, resource_size_t iosize, int irq, int irq_high); 74 resource_size_t iobase, resource_size_t iosize, int irq, int irq_high);
73extern void mxc_set_cpu_type(unsigned int type); 75extern void mxc_set_cpu_type(unsigned int type);
74extern void mxc_restart(char, const char *); 76extern void mxc_restart(enum reboot_mode, const char *);
75extern void mxc_arch_reset_init(void __iomem *); 77extern void mxc_arch_reset_init(void __iomem *);
76extern void mxc_arch_reset_init_dt(void); 78extern void mxc_arch_reset_init_dt(void);
77extern int mx53_revision(void); 79extern int mx53_revision(void);
diff --git a/arch/arm/mach-imx/devices-imx25.h b/arch/arm/mach-imx/devices-imx25.h
index 0d2922bc575c..769563fdeaa0 100644
--- a/arch/arm/mach-imx/devices-imx25.h
+++ b/arch/arm/mach-imx/devices-imx25.h
@@ -13,10 +13,10 @@ extern const struct imx_fec_data imx25_fec_data;
13 imx_add_fec(&imx25_fec_data, pdata) 13 imx_add_fec(&imx25_fec_data, pdata)
14 14
15extern const struct imx_flexcan_data imx25_flexcan_data[]; 15extern const struct imx_flexcan_data imx25_flexcan_data[];
16#define imx25_add_flexcan(id, pdata) \ 16#define imx25_add_flexcan(id) \
17 imx_add_flexcan(&imx25_flexcan_data[id], pdata) 17 imx_add_flexcan(&imx25_flexcan_data[id])
18#define imx25_add_flexcan0(pdata) imx25_add_flexcan(0, pdata) 18#define imx25_add_flexcan0() imx25_add_flexcan(0)
19#define imx25_add_flexcan1(pdata) imx25_add_flexcan(1, pdata) 19#define imx25_add_flexcan1() imx25_add_flexcan(1)
20 20
21extern const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data; 21extern const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data;
22#define imx25_add_fsl_usb2_udc(pdata) \ 22#define imx25_add_fsl_usb2_udc(pdata) \
diff --git a/arch/arm/mach-imx/devices-imx35.h b/arch/arm/mach-imx/devices-imx35.h
index e2675f1b141c..780d8240281b 100644
--- a/arch/arm/mach-imx/devices-imx35.h
+++ b/arch/arm/mach-imx/devices-imx35.h
@@ -17,10 +17,10 @@ extern const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data;
17 imx_add_fsl_usb2_udc(&imx35_fsl_usb2_udc_data, pdata) 17 imx_add_fsl_usb2_udc(&imx35_fsl_usb2_udc_data, pdata)
18 18
19extern const struct imx_flexcan_data imx35_flexcan_data[]; 19extern const struct imx_flexcan_data imx35_flexcan_data[];
20#define imx35_add_flexcan(id, pdata) \ 20#define imx35_add_flexcan(id) \
21 imx_add_flexcan(&imx35_flexcan_data[id], pdata) 21 imx_add_flexcan(&imx35_flexcan_data[id])
22#define imx35_add_flexcan0(pdata) imx35_add_flexcan(0, pdata) 22#define imx35_add_flexcan0() imx35_add_flexcan(0)
23#define imx35_add_flexcan1(pdata) imx35_add_flexcan(1, pdata) 23#define imx35_add_flexcan1() imx35_add_flexcan(1)
24 24
25extern const struct imx_imx2_wdt_data imx35_imx2_wdt_data; 25extern const struct imx_imx2_wdt_data imx35_imx2_wdt_data;
26#define imx35_add_imx2_wdt() \ 26#define imx35_add_imx2_wdt() \
diff --git a/arch/arm/mach-imx/devices/Kconfig b/arch/arm/mach-imx/devices/Kconfig
index 3dd2b1b041d1..68c74fb0373c 100644
--- a/arch/arm/mach-imx/devices/Kconfig
+++ b/arch/arm/mach-imx/devices/Kconfig
@@ -4,7 +4,6 @@ config IMX_HAVE_PLATFORM_FEC
4 4
5config IMX_HAVE_PLATFORM_FLEXCAN 5config IMX_HAVE_PLATFORM_FLEXCAN
6 bool 6 bool
7 select HAVE_CAN_FLEXCAN if CAN
8 7
9config IMX_HAVE_PLATFORM_FSL_USB2_UDC 8config IMX_HAVE_PLATFORM_FSL_USB2_UDC
10 bool 9 bool
diff --git a/arch/arm/mach-imx/devices/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h
index 453e20bc2657..c13b76b9f6b3 100644
--- a/arch/arm/mach-imx/devices/devices-common.h
+++ b/arch/arm/mach-imx/devices/devices-common.h
@@ -50,7 +50,6 @@ struct platform_device *__init imx_add_fec(
50 const struct imx_fec_data *data, 50 const struct imx_fec_data *data,
51 const struct fec_platform_data *pdata); 51 const struct fec_platform_data *pdata);
52 52
53#include <linux/can/platform/flexcan.h>
54struct imx_flexcan_data { 53struct imx_flexcan_data {
55 int id; 54 int id;
56 resource_size_t iobase; 55 resource_size_t iobase;
@@ -58,8 +57,7 @@ struct imx_flexcan_data {
58 resource_size_t irq; 57 resource_size_t irq;
59}; 58};
60struct platform_device *__init imx_add_flexcan( 59struct platform_device *__init imx_add_flexcan(
61 const struct imx_flexcan_data *data, 60 const struct imx_flexcan_data *data);
62 const struct flexcan_platform_data *pdata);
63 61
64#include <linux/fsl_devices.h> 62#include <linux/fsl_devices.h>
65struct imx_fsl_usb2_udc_data { 63struct imx_fsl_usb2_udc_data {
diff --git a/arch/arm/mach-imx/devices/platform-flexcan.c b/arch/arm/mach-imx/devices/platform-flexcan.c
index 1078bf0a94ef..55d61eaf63c6 100644
--- a/arch/arm/mach-imx/devices/platform-flexcan.c
+++ b/arch/arm/mach-imx/devices/platform-flexcan.c
@@ -38,8 +38,7 @@ const struct imx_flexcan_data imx35_flexcan_data[] __initconst = {
38#endif /* ifdef CONFIG_SOC_IMX35 */ 38#endif /* ifdef CONFIG_SOC_IMX35 */
39 39
40struct platform_device *__init imx_add_flexcan( 40struct platform_device *__init imx_add_flexcan(
41 const struct imx_flexcan_data *data, 41 const struct imx_flexcan_data *data)
42 const struct flexcan_platform_data *pdata)
43{ 42{
44 struct resource res[] = { 43 struct resource res[] = {
45 { 44 {
@@ -54,5 +53,5 @@ struct platform_device *__init imx_add_flexcan(
54 }; 53 };
55 54
56 return imx_add_platform_device("flexcan", data->id, 55 return imx_add_platform_device("flexcan", data->id,
57 res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); 56 res, ARRAY_SIZE(res), NULL, 0);
58} 57}
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
index e2b70f4c1a2c..e77cc3af6db2 100644
--- a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
@@ -279,7 +279,7 @@ void __init eukrea_mbimxsd25_baseboard_init(void)
279 imx25_add_imx_fb(&eukrea_mximxsd_fb_pdata); 279 imx25_add_imx_fb(&eukrea_mximxsd_fb_pdata);
280 imx25_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata); 280 imx25_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata);
281 281
282 imx25_add_flexcan1(NULL); 282 imx25_add_flexcan1();
283 imx25_add_sdhci_esdhc_imx(0, &sd1_pdata); 283 imx25_add_sdhci_esdhc_imx(0, &sd1_pdata);
284 284
285 gpio_request(GPIO_LED1, "LED1"); 285 gpio_request(GPIO_LED1, "LED1");
diff --git a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
index 5a2d5ef12dd5..14d6c8249b76 100644
--- a/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
@@ -287,7 +287,7 @@ void __init eukrea_mbimxsd35_baseboard_init(void)
287 287
288 imx35_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata); 288 imx35_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata);
289 289
290 imx35_add_flexcan1(NULL); 290 imx35_add_flexcan1();
291 imx35_add_sdhci_esdhc_imx(0, &sd1_pdata); 291 imx35_add_sdhci_esdhc_imx(0, &sd1_pdata);
292 292
293 gpio_request(GPIO_LED1, "LED1"); 293 gpio_request(GPIO_LED1, "LED1");
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index f5965220a4d8..7be13f8e69a0 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -27,6 +27,7 @@
27#include <linux/of_platform.h> 27#include <linux/of_platform.h>
28#include <linux/opp.h> 28#include <linux/opp.h>
29#include <linux/phy.h> 29#include <linux/phy.h>
30#include <linux/reboot.h>
30#include <linux/regmap.h> 31#include <linux/regmap.h>
31#include <linux/micrel_phy.h> 32#include <linux/micrel_phy.h>
32#include <linux/mfd/syscon.h> 33#include <linux/mfd/syscon.h>
@@ -67,7 +68,7 @@ static void __init imx6q_init_revision(void)
67 mxc_set_cpu_type(rev >> 16 & 0xff); 68 mxc_set_cpu_type(rev >> 16 & 0xff);
68} 69}
69 70
70static void imx6q_restart(char mode, const char *cmd) 71static void imx6q_restart(enum reboot_mode mode, const char *cmd)
71{ 72{
72 struct device_node *np; 73 struct device_node *np;
73 void __iomem *wdog_base; 74 void __iomem *wdog_base;
diff --git a/arch/arm/mach-imx/mach-mx25_3ds.c b/arch/arm/mach-imx/mach-mx25_3ds.c
index 8bcda688a006..13490c203050 100644
--- a/arch/arm/mach-imx/mach-mx25_3ds.c
+++ b/arch/arm/mach-imx/mach-mx25_3ds.c
@@ -249,7 +249,7 @@ static void __init mx25pdk_init(void)
249 imx25_add_imx_i2c0(&mx25_3ds_i2c0_data); 249 imx25_add_imx_i2c0(&mx25_3ds_i2c0_data);
250 250
251 gpio_request_one(MX25PDK_CAN_PWDN, GPIOF_OUT_INIT_LOW, "can-pwdn"); 251 gpio_request_one(MX25PDK_CAN_PWDN, GPIOF_OUT_INIT_LOW, "can-pwdn");
252 imx25_add_flexcan0(NULL); 252 imx25_add_flexcan0();
253} 253}
254 254
255static void __init mx25pdk_timer_init(void) 255static void __init mx25pdk_timer_init(void)
diff --git a/arch/arm/mach-imx/mach-pcm043.c b/arch/arm/mach-imx/mach-pcm043.c
index 8ed533f0f8ca..b726cb1c5fdd 100644
--- a/arch/arm/mach-imx/mach-pcm043.c
+++ b/arch/arm/mach-imx/mach-pcm043.c
@@ -385,7 +385,7 @@ static void __init pcm043_init(void)
385 if (!otg_mode_host) 385 if (!otg_mode_host)
386 imx35_add_fsl_usb2_udc(&otg_device_pdata); 386 imx35_add_fsl_usb2_udc(&otg_device_pdata);
387 387
388 imx35_add_flexcan1(NULL); 388 imx35_add_flexcan1();
389 imx35_add_sdhci_esdhc_imx(0, &sd1_pdata); 389 imx35_add_sdhci_esdhc_imx(0, &sd1_pdata);
390} 390}
391 391
diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c
index c6e1ab544882..1f24c1fdfea4 100644
--- a/arch/arm/mach-imx/platsmp.c
+++ b/arch/arm/mach-imx/platsmp.c
@@ -53,7 +53,7 @@ void imx_scu_standby_enable(void)
53 writel_relaxed(val, scu_base); 53 writel_relaxed(val, scu_base);
54} 54}
55 55
56static int __cpuinit imx_boot_secondary(unsigned int cpu, struct task_struct *idle) 56static int imx_boot_secondary(unsigned int cpu, struct task_struct *idle)
57{ 57{
58 imx_set_cpu_jump(cpu, v7_secondary_startup); 58 imx_set_cpu_jump(cpu, v7_secondary_startup);
59 imx_enable_cpu(cpu, true); 59 imx_enable_cpu(cpu, true);
diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c
index 7cdc79a9657c..6fe81bb4d3c9 100644
--- a/arch/arm/mach-imx/system.c
+++ b/arch/arm/mach-imx/system.c
@@ -37,7 +37,7 @@ static struct clk *wdog_clk;
37/* 37/*
38 * Reset the system. It is called by machine_restart(). 38 * Reset the system. It is called by machine_restart().
39 */ 39 */
40void mxc_restart(char mode, const char *cmd) 40void mxc_restart(enum reboot_mode mode, const char *cmd)
41{ 41{
42 unsigned int wcr_enable; 42 unsigned int wcr_enable;
43 43
diff --git a/arch/arm/mach-imx/time.c b/arch/arm/mach-imx/time.c
index fea91313678b..cd46529e9eaa 100644
--- a/arch/arm/mach-imx/time.c
+++ b/arch/arm/mach-imx/time.c
@@ -26,8 +26,8 @@
26#include <linux/clockchips.h> 26#include <linux/clockchips.h>
27#include <linux/clk.h> 27#include <linux/clk.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/sched_clock.h>
29 30
30#include <asm/sched_clock.h>
31#include <asm/mach/time.h> 31#include <asm/mach/time.h>
32 32
33#include "common.h" 33#include "common.h"
diff --git a/arch/arm/mach-integrator/common.h b/arch/arm/mach-integrator/common.h
index 72516658be1e..ad0ac5547b2c 100644
--- a/arch/arm/mach-integrator/common.h
+++ b/arch/arm/mach-integrator/common.h
@@ -1,7 +1,8 @@
1#include <linux/reboot.h>
1#include <linux/amba/serial.h> 2#include <linux/amba/serial.h>
2extern struct amba_pl010_data ap_uart_data; 3extern struct amba_pl010_data ap_uart_data;
3void integrator_init_early(void); 4void integrator_init_early(void);
4int integrator_init(bool is_cp); 5int integrator_init(bool is_cp);
5void integrator_reserve(void); 6void integrator_reserve(void);
6void integrator_restart(char, const char *); 7void integrator_restart(enum reboot_mode, const char *);
7void integrator_init_sysfs(struct device *parent, u32 id); 8void integrator_init_sysfs(struct device *parent, u32 id);
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index 81461d218717..4cdfd7365925 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -124,7 +124,7 @@ void __init integrator_reserve(void)
124/* 124/*
125 * To reset, we hit the on-board reset register in the system FPGA 125 * To reset, we hit the on-board reset register in the system FPGA
126 */ 126 */
127void integrator_restart(char mode, const char *cmd) 127void integrator_restart(enum reboot_mode mode, const char *cmd)
128{ 128{
129 cm_control(CM_CTRL_RESET, CM_CTRL_RESET); 129 cm_control(CM_CTRL_RESET, CM_CTRL_RESET);
130} 130}
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index a5b15c4e8def..d9e95e612fcb 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -41,6 +41,7 @@
41#include <linux/stat.h> 41#include <linux/stat.h>
42#include <linux/sys_soc.h> 42#include <linux/sys_soc.h>
43#include <linux/termios.h> 43#include <linux/termios.h>
44#include <linux/sched_clock.h>
44 45
45#include <mach/hardware.h> 46#include <mach/hardware.h>
46#include <mach/platform.h> 47#include <mach/platform.h>
@@ -48,7 +49,6 @@
48#include <asm/setup.h> 49#include <asm/setup.h>
49#include <asm/param.h> /* HZ */ 50#include <asm/param.h> /* HZ */
50#include <asm/mach-types.h> 51#include <asm/mach-types.h>
51#include <asm/sched_clock.h>
52 52
53#include <mach/lm.h> 53#include <mach/lm.h>
54#include <mach/irqs.h> 54#include <mach/irqs.h>
diff --git a/arch/arm/mach-iop13xx/include/mach/iop13xx.h b/arch/arm/mach-iop13xx/include/mach/iop13xx.h
index 7480f58267aa..17b40279e0a4 100644
--- a/arch/arm/mach-iop13xx/include/mach/iop13xx.h
+++ b/arch/arm/mach-iop13xx/include/mach/iop13xx.h
@@ -2,6 +2,9 @@
2#define _IOP13XX_HW_H_ 2#define _IOP13XX_HW_H_
3 3
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5
6#include <linux/reboot.h>
7
5/* The ATU offsets can change based on the strapping */ 8/* The ATU offsets can change based on the strapping */
6extern u32 iop13xx_atux_pmmr_offset; 9extern u32 iop13xx_atux_pmmr_offset;
7extern u32 iop13xx_atue_pmmr_offset; 10extern u32 iop13xx_atue_pmmr_offset;
@@ -11,7 +14,7 @@ void iop13xx_map_io(void);
11void iop13xx_platform_init(void); 14void iop13xx_platform_init(void);
12void iop13xx_add_tpmi_devices(void); 15void iop13xx_add_tpmi_devices(void);
13void iop13xx_init_irq(void); 16void iop13xx_init_irq(void);
14void iop13xx_restart(char, const char *); 17void iop13xx_restart(enum reboot_mode, const char *);
15 18
16/* CPUID CP6 R0 Page 0 */ 19/* CPUID CP6 R0 Page 0 */
17static inline int iop13xx_cpu_id(void) 20static inline int iop13xx_cpu_id(void)
diff --git a/arch/arm/mach-iop13xx/setup.c b/arch/arm/mach-iop13xx/setup.c
index 1c5bd7637b05..96e6c7a6793b 100644
--- a/arch/arm/mach-iop13xx/setup.c
+++ b/arch/arm/mach-iop13xx/setup.c
@@ -594,7 +594,7 @@ __setup("iop13xx_init_adma", iop13xx_init_adma_setup);
594__setup("iop13xx_init_uart", iop13xx_init_uart_setup); 594__setup("iop13xx_init_uart", iop13xx_init_uart_setup);
595__setup("iop13xx_init_i2c", iop13xx_init_i2c_setup); 595__setup("iop13xx_init_i2c", iop13xx_init_i2c_setup);
596 596
597void iop13xx_restart(char mode, const char *cmd) 597void iop13xx_restart(enum reboot_mode mode, const char *cmd)
598{ 598{
599 /* 599 /*
600 * Reset the internal bus (warning both cores are reset) 600 * Reset the internal bus (warning both cores are reset)
diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c
index ea0984a7449e..069144300b77 100644
--- a/arch/arm/mach-iop32x/n2100.c
+++ b/arch/arm/mach-iop32x/n2100.c
@@ -286,7 +286,7 @@ static void n2100_power_off(void)
286 ; 286 ;
287} 287}
288 288
289static void n2100_restart(char mode, const char *cmd) 289static void n2100_restart(enum reboot_mode mode, const char *cmd)
290{ 290{
291 gpio_line_set(N2100_HARDWARE_RESET, GPIO_LOW); 291 gpio_line_set(N2100_HARDWARE_RESET, GPIO_LOW);
292 gpio_line_config(N2100_HARDWARE_RESET, GPIO_OUT); 292 gpio_line_config(N2100_HARDWARE_RESET, GPIO_OUT);
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index d7223b3b81f3..5327decde5a0 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -30,6 +30,7 @@
30#include <linux/export.h> 30#include <linux/export.h>
31#include <linux/gpio.h> 31#include <linux/gpio.h>
32#include <linux/cpu.h> 32#include <linux/cpu.h>
33#include <linux/sched_clock.h>
33 34
34#include <mach/udc.h> 35#include <mach/udc.h>
35#include <mach/hardware.h> 36#include <mach/hardware.h>
@@ -38,7 +39,6 @@
38#include <asm/pgtable.h> 39#include <asm/pgtable.h>
39#include <asm/page.h> 40#include <asm/page.h>
40#include <asm/irq.h> 41#include <asm/irq.h>
41#include <asm/sched_clock.h>
42#include <asm/system_misc.h> 42#include <asm/system_misc.h>
43 43
44#include <asm/mach/map.h> 44#include <asm/mach/map.h>
@@ -531,9 +531,9 @@ static void __init ixp4xx_clockevent_init(void)
531 0xf, 0xfffffffe); 531 0xf, 0xfffffffe);
532} 532}
533 533
534void ixp4xx_restart(char mode, const char *cmd) 534void ixp4xx_restart(enum reboot_mode mode, const char *cmd)
535{ 535{
536 if ( 1 && mode == 's') { 536 if ( 1 && mode == REBOOT_SOFT) {
537 /* Jump into ROM at address 0 */ 537 /* Jump into ROM at address 0 */
538 soft_restart(0); 538 soft_restart(0);
539 } else { 539 } else {
diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index 5d413f8c5700..63de1b3fd06b 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -27,6 +27,8 @@
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28#include <linux/i2c-gpio.h> 28#include <linux/i2c-gpio.h>
29 29
30#include <mach/hardware.h>
31
30#include <asm/mach-types.h> 32#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
32#include <asm/mach/flash.h> 34#include <asm/mach/flash.h>
diff --git a/arch/arm/mach-ixp4xx/include/mach/platform.h b/arch/arm/mach-ixp4xx/include/mach/platform.h
index db5afb69c123..4c4c6a6f4526 100644
--- a/arch/arm/mach-ixp4xx/include/mach/platform.h
+++ b/arch/arm/mach-ixp4xx/include/mach/platform.h
@@ -13,6 +13,8 @@
13 13
14#ifndef __ASSEMBLY__ 14#ifndef __ASSEMBLY__
15 15
16#include <linux/reboot.h>
17
16#include <asm/types.h> 18#include <asm/types.h>
17 19
18#ifndef __ARMEB__ 20#ifndef __ARMEB__
@@ -123,7 +125,7 @@ extern void ixp4xx_init_early(void);
123extern void ixp4xx_init_irq(void); 125extern void ixp4xx_init_irq(void);
124extern void ixp4xx_sys_init(void); 126extern void ixp4xx_sys_init(void);
125extern void ixp4xx_timer_init(void); 127extern void ixp4xx_timer_init(void);
126extern void ixp4xx_restart(char, const char *); 128extern void ixp4xx_restart(enum reboot_mode, const char *);
127extern void ixp4xx_pci_preinit(void); 129extern void ixp4xx_pci_preinit(void);
128struct pci_sys_data; 130struct pci_sys_data;
129extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); 131extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
diff --git a/arch/arm/mach-ixp4xx/include/mach/timex.h b/arch/arm/mach-ixp4xx/include/mach/timex.h
index c9e930f29339..0396d89f947c 100644
--- a/arch/arm/mach-ixp4xx/include/mach/timex.h
+++ b/arch/arm/mach-ixp4xx/include/mach/timex.h
@@ -3,7 +3,7 @@
3 * 3 *
4 */ 4 */
5 5
6#include <mach/hardware.h> 6#include <mach/ixp4xx-regs.h>
7 7
8/* 8/*
9 * We use IXP425 General purpose timer for our timer needs, it runs at 9 * We use IXP425 General purpose timer for our timer needs, it runs at
diff --git a/arch/arm/mach-ixp4xx/omixp-setup.c b/arch/arm/mach-ixp4xx/omixp-setup.c
index 46a89f5e8269..75ef03dc9964 100644
--- a/arch/arm/mach-ixp4xx/omixp-setup.c
+++ b/arch/arm/mach-ixp4xx/omixp-setup.c
@@ -27,6 +27,8 @@
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/flash.h> 28#include <asm/mach/flash.h>
29 29
30#include <mach/hardware.h>
31
30static struct resource omixp_flash_resources[] = { 32static struct resource omixp_flash_resources[] = {
31 { 33 {
32 .flags = IORESOURCE_MEM, 34 .flags = IORESOURCE_MEM,
diff --git a/arch/arm/mach-keystone/platsmp.c b/arch/arm/mach-keystone/platsmp.c
index 1d4181e1daf2..14378e3fef16 100644
--- a/arch/arm/mach-keystone/platsmp.c
+++ b/arch/arm/mach-keystone/platsmp.c
@@ -21,7 +21,7 @@
21 21
22#include "keystone.h" 22#include "keystone.h"
23 23
24static int __cpuinit keystone_smp_boot_secondary(unsigned int cpu, 24static int keystone_smp_boot_secondary(unsigned int cpu,
25 struct task_struct *idle) 25 struct task_struct *idle)
26{ 26{
27 unsigned long start = virt_to_phys(&secondary_startup); 27 unsigned long start = virt_to_phys(&secondary_startup);
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 7c72c725b711..e9238b5567ee 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -20,6 +20,7 @@
20#include <linux/mv643xx_i2c.h> 20#include <linux/mv643xx_i2c.h>
21#include <linux/timex.h> 21#include <linux/timex.h>
22#include <linux/kexec.h> 22#include <linux/kexec.h>
23#include <linux/reboot.h>
23#include <net/dsa.h> 24#include <net/dsa.h>
24#include <asm/page.h> 25#include <asm/page.h>
25#include <asm/mach/map.h> 26#include <asm/mach/map.h>
@@ -722,7 +723,7 @@ void __init kirkwood_init(void)
722#endif 723#endif
723} 724}
724 725
725void kirkwood_restart(char mode, const char *cmd) 726void kirkwood_restart(enum reboot_mode mode, const char *cmd)
726{ 727{
727 /* 728 /*
728 * Enable soft reset to assert RSTOUTn. 729 * Enable soft reset to assert RSTOUTn.
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 1c09f3f93fbb..fcf3ba682e24 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -11,6 +11,8 @@
11#ifndef __ARCH_KIRKWOOD_COMMON_H 11#ifndef __ARCH_KIRKWOOD_COMMON_H
12#define __ARCH_KIRKWOOD_COMMON_H 12#define __ARCH_KIRKWOOD_COMMON_H
13 13
14#include <linux/reboot.h>
15
14struct dsa_platform_data; 16struct dsa_platform_data;
15struct mv643xx_eth_platform_data; 17struct mv643xx_eth_platform_data;
16struct mv_sata_platform_data; 18struct mv_sata_platform_data;
@@ -53,7 +55,7 @@ void kirkwood_audio_init(void);
53void kirkwood_cpuidle_init(void); 55void kirkwood_cpuidle_init(void);
54void kirkwood_cpufreq_init(void); 56void kirkwood_cpufreq_init(void);
55 57
56void kirkwood_restart(char, const char *); 58void kirkwood_restart(enum reboot_mode, const char *);
57void kirkwood_clk_init(void); 59void kirkwood_clk_init(void);
58 60
59/* board init functions for boards not fully converted to fdt */ 61/* board init functions for boards not fully converted to fdt */
diff --git a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
index d4cbe5e81bb4..91242c944d7a 100644
--- a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
+++ b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
@@ -21,14 +21,12 @@
21#define CPU_RESET 0x00000002 21#define CPU_RESET 0x00000002
22 22
23#define RSTOUTn_MASK (BRIDGE_VIRT_BASE + 0x0108) 23#define RSTOUTn_MASK (BRIDGE_VIRT_BASE + 0x0108)
24#define WDT_RESET_OUT_EN 0x00000002
25#define SOFT_RESET_OUT_EN 0x00000004 24#define SOFT_RESET_OUT_EN 0x00000004
26 25
27#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE + 0x010c) 26#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE + 0x010c)
28#define SOFT_RESET 0x00000001 27#define SOFT_RESET 0x00000001
29 28
30#define BRIDGE_CAUSE (BRIDGE_VIRT_BASE + 0x0110) 29#define BRIDGE_CAUSE (BRIDGE_VIRT_BASE + 0x0110)
31#define WDT_INT_REQ 0x0008
32 30
33#define BRIDGE_INT_TIMER1_CLR (~0x0004) 31#define BRIDGE_INT_TIMER1_CLR (~0x0004)
34 32
diff --git a/arch/arm/mach-ks8695/generic.h b/arch/arm/mach-ks8695/generic.h
index 6e97ce462d73..43253f8e6de4 100644
--- a/arch/arm/mach-ks8695/generic.h
+++ b/arch/arm/mach-ks8695/generic.h
@@ -12,5 +12,5 @@
12 12
13extern __init void ks8695_map_io(void); 13extern __init void ks8695_map_io(void);
14extern __init void ks8695_init_irq(void); 14extern __init void ks8695_init_irq(void);
15extern void ks8695_restart(char, const char *); 15extern void ks8695_restart(enum reboot_mode, const char *);
16extern void ks8695_timer_init(void); 16extern void ks8695_timer_init(void);
diff --git a/arch/arm/mach-ks8695/time.c b/arch/arm/mach-ks8695/time.c
index c272a3863d5f..426c97662f5b 100644
--- a/arch/arm/mach-ks8695/time.c
+++ b/arch/arm/mach-ks8695/time.c
@@ -154,11 +154,11 @@ void __init ks8695_timer_init(void)
154 setup_irq(KS8695_IRQ_TIMER1, &ks8695_timer_irq); 154 setup_irq(KS8695_IRQ_TIMER1, &ks8695_timer_irq);
155} 155}
156 156
157void ks8695_restart(char mode, const char *cmd) 157void ks8695_restart(enum reboot_mode reboot_mode, const char *cmd)
158{ 158{
159 unsigned int reg; 159 unsigned int reg;
160 160
161 if (mode == 's') 161 if (reboot_mode == REBOOT_SOFT)
162 soft_restart(0); 162 soft_restart(0);
163 163
164 /* disable timer0 */ 164 /* disable timer0 */
diff --git a/arch/arm/mach-lpc32xx/common.c b/arch/arm/mach-lpc32xx/common.c
index 0d4db8c544b5..d7aa54c25c59 100644
--- a/arch/arm/mach-lpc32xx/common.c
+++ b/arch/arm/mach-lpc32xx/common.c
@@ -207,11 +207,11 @@ void __init lpc32xx_map_io(void)
207 iotable_init(lpc32xx_io_desc, ARRAY_SIZE(lpc32xx_io_desc)); 207 iotable_init(lpc32xx_io_desc, ARRAY_SIZE(lpc32xx_io_desc));
208} 208}
209 209
210void lpc23xx_restart(char mode, const char *cmd) 210void lpc23xx_restart(enum reboot_mode mode, const char *cmd)
211{ 211{
212 switch (mode) { 212 switch (mode) {
213 case 's': 213 case REBOOT_SOFT:
214 case 'h': 214 case REBOOT_HARD:
215 lpc32xx_watchdog_reset(); 215 lpc32xx_watchdog_reset();
216 break; 216 break;
217 217
diff --git a/arch/arm/mach-lpc32xx/common.h b/arch/arm/mach-lpc32xx/common.h
index e0b26062a272..1cd8853b2f9b 100644
--- a/arch/arm/mach-lpc32xx/common.h
+++ b/arch/arm/mach-lpc32xx/common.h
@@ -21,6 +21,7 @@
21 21
22#include <mach/board.h> 22#include <mach/board.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/reboot.h>
24 25
25/* 26/*
26 * Other arch specific structures and functions 27 * Other arch specific structures and functions
@@ -29,7 +30,7 @@ extern void lpc32xx_timer_init(void);
29extern void __init lpc32xx_init_irq(void); 30extern void __init lpc32xx_init_irq(void);
30extern void __init lpc32xx_map_io(void); 31extern void __init lpc32xx_map_io(void);
31extern void __init lpc32xx_serial_init(void); 32extern void __init lpc32xx_serial_init(void);
32extern void lpc23xx_restart(char, const char *); 33extern void lpc23xx_restart(enum reboot_mode, const char *);
33 34
34 35
35/* 36/*
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
index c1cd5a943ab1..e54f87ec2e4a 100644
--- a/arch/arm/mach-lpc32xx/phy3250.c
+++ b/arch/arm/mach-lpc32xx/phy3250.c
@@ -182,8 +182,8 @@ static void pl08x_put_signal(const struct pl08x_channel_data *cd, int ch)
182static struct pl08x_platform_data pl08x_pd = { 182static struct pl08x_platform_data pl08x_pd = {
183 .slave_channels = &pl08x_slave_channels[0], 183 .slave_channels = &pl08x_slave_channels[0],
184 .num_slave_channels = ARRAY_SIZE(pl08x_slave_channels), 184 .num_slave_channels = ARRAY_SIZE(pl08x_slave_channels),
185 .get_signal = pl08x_get_signal, 185 .get_xfer_signal = pl08x_get_signal,
186 .put_signal = pl08x_put_signal, 186 .put_xfer_signal = pl08x_put_signal,
187 .lli_buses = PL08X_AHB1, 187 .lli_buses = PL08X_AHB1,
188 .mem_buses = PL08X_AHB1, 188 .mem_buses = PL08X_AHB1,
189}; 189};
diff --git a/arch/arm/mach-mmp/common.c b/arch/arm/mach-mmp/common.c
index 9292b7966e3b..c03b4ab582db 100644
--- a/arch/arm/mach-mmp/common.c
+++ b/arch/arm/mach-mmp/common.c
@@ -47,7 +47,7 @@ void __init mmp_map_io(void)
47 mmp_chip_id = __raw_readl(MMP_CHIPID); 47 mmp_chip_id = __raw_readl(MMP_CHIPID);
48} 48}
49 49
50void mmp_restart(char mode, const char *cmd) 50void mmp_restart(enum reboot_mode mode, const char *cmd)
51{ 51{
52 soft_restart(0); 52 soft_restart(0);
53} 53}
diff --git a/arch/arm/mach-mmp/common.h b/arch/arm/mach-mmp/common.h
index 0bdc50b134ce..991d7e9877de 100644
--- a/arch/arm/mach-mmp/common.h
+++ b/arch/arm/mach-mmp/common.h
@@ -1,10 +1,11 @@
1#include <linux/reboot.h>
1#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) 2#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
2 3
3extern void timer_init(int irq); 4extern void timer_init(int irq);
4 5
5extern void __init icu_init_irq(void); 6extern void __init icu_init_irq(void);
6extern void __init mmp_map_io(void); 7extern void __init mmp_map_io(void);
7extern void mmp_restart(char, const char *); 8extern void mmp_restart(enum reboot_mode, const char *);
8extern void __init pxa168_clk_init(void); 9extern void __init pxa168_clk_init(void);
9extern void __init pxa910_clk_init(void); 10extern void __init pxa910_clk_init(void);
10extern void __init mmp2_clk_init(void); 11extern void __init mmp2_clk_init(void);
diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h b/arch/arm/mach-mmp/include/mach/pxa168.h
index 7ed1df21ea1c..459c2d03eb5c 100644
--- a/arch/arm/mach-mmp/include/mach/pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/pxa168.h
@@ -1,9 +1,11 @@
1#ifndef __ASM_MACH_PXA168_H 1#ifndef __ASM_MACH_PXA168_H
2#define __ASM_MACH_PXA168_H 2#define __ASM_MACH_PXA168_H
3 3
4#include <linux/reboot.h>
5
4extern void pxa168_timer_init(void); 6extern void pxa168_timer_init(void);
5extern void __init pxa168_init_irq(void); 7extern void __init pxa168_init_irq(void);
6extern void pxa168_restart(char, const char *); 8extern void pxa168_restart(enum reboot_mode, const char *);
7extern void pxa168_clear_keypad_wakeup(void); 9extern void pxa168_clear_keypad_wakeup(void);
8 10
9#include <linux/i2c.h> 11#include <linux/i2c.h>
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index a30dcf3b7d9e..144e997624c0 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -172,7 +172,7 @@ int __init pxa168_add_usb_host(struct mv_usb_platform_data *pdata)
172 return platform_device_register(&pxa168_device_usb_host); 172 return platform_device_register(&pxa168_device_usb_host);
173} 173}
174 174
175void pxa168_restart(char mode, const char *cmd) 175void pxa168_restart(enum reboot_mode mode, const char *cmd)
176{ 176{
177 soft_restart(0xffff0000); 177 soft_restart(0xffff0000);
178} 178}
diff --git a/arch/arm/mach-mmp/time.c b/arch/arm/mach-mmp/time.c
index 86a18b3d252e..7ac41e83cfef 100644
--- a/arch/arm/mach-mmp/time.c
+++ b/arch/arm/mach-mmp/time.c
@@ -28,8 +28,8 @@
28#include <linux/of.h> 28#include <linux/of.h>
29#include <linux/of_address.h> 29#include <linux/of_address.h>
30#include <linux/of_irq.h> 30#include <linux/of_irq.h>
31#include <linux/sched_clock.h>
31 32
32#include <asm/sched_clock.h>
33#include <mach/addr-map.h> 33#include <mach/addr-map.h>
34#include <mach/regs-timers.h> 34#include <mach/regs-timers.h>
35#include <mach/regs-apbc.h> 35#include <mach/regs-apbc.h>
diff --git a/arch/arm/mach-msm/headsmp.S b/arch/arm/mach-msm/headsmp.S
index bcd5af223dea..6c62c3f82fe6 100644
--- a/arch/arm/mach-msm/headsmp.S
+++ b/arch/arm/mach-msm/headsmp.S
@@ -11,8 +11,6 @@
11#include <linux/linkage.h> 11#include <linux/linkage.h>
12#include <linux/init.h> 12#include <linux/init.h>
13 13
14 __CPUINIT
15
16/* 14/*
17 * MSM specific entry point for secondary CPUs. This provides 15 * MSM specific entry point for secondary CPUs. This provides
18 * a "holding pen" into which all secondary cores are held until we're 16 * a "holding pen" into which all secondary cores are held until we're
diff --git a/arch/arm/mach-msm/platsmp.c b/arch/arm/mach-msm/platsmp.c
index 00cdb0a5dac8..3f06edcdd0ce 100644
--- a/arch/arm/mach-msm/platsmp.c
+++ b/arch/arm/mach-msm/platsmp.c
@@ -38,7 +38,7 @@ static inline int get_core_count(void)
38 return ((read_cpuid_id() >> 4) & 3) + 1; 38 return ((read_cpuid_id() >> 4) & 3) + 1;
39} 39}
40 40
41static void __cpuinit msm_secondary_init(unsigned int cpu) 41static void msm_secondary_init(unsigned int cpu)
42{ 42{
43 /* 43 /*
44 * let the primary processor know we're out of the 44 * let the primary processor know we're out of the
@@ -54,7 +54,7 @@ static void __cpuinit msm_secondary_init(unsigned int cpu)
54 spin_unlock(&boot_lock); 54 spin_unlock(&boot_lock);
55} 55}
56 56
57static __cpuinit void prepare_cold_cpu(unsigned int cpu) 57static void prepare_cold_cpu(unsigned int cpu)
58{ 58{
59 int ret; 59 int ret;
60 ret = scm_set_boot_addr(virt_to_phys(msm_secondary_startup), 60 ret = scm_set_boot_addr(virt_to_phys(msm_secondary_startup),
@@ -73,7 +73,7 @@ static __cpuinit void prepare_cold_cpu(unsigned int cpu)
73 "address\n"); 73 "address\n");
74} 74}
75 75
76static int __cpuinit msm_boot_secondary(unsigned int cpu, struct task_struct *idle) 76static int msm_boot_secondary(unsigned int cpu, struct task_struct *idle)
77{ 77{
78 unsigned long timeout; 78 unsigned long timeout;
79 static int cold_boot_done; 79 static int cold_boot_done;
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index 284313f3e02c..8697cfc0d0b6 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -23,10 +23,10 @@
23#include <linux/of.h> 23#include <linux/of.h>
24#include <linux/of_address.h> 24#include <linux/of_address.h>
25#include <linux/of_irq.h> 25#include <linux/of_irq.h>
26#include <linux/sched_clock.h>
26 27
27#include <asm/mach/time.h> 28#include <asm/mach/time.h>
28#include <asm/localtimer.h> 29#include <asm/localtimer.h>
29#include <asm/sched_clock.h>
30 30
31#include "common.h" 31#include "common.h"
32 32
@@ -139,7 +139,7 @@ static struct clocksource msm_clocksource = {
139}; 139};
140 140
141#ifdef CONFIG_LOCAL_TIMERS 141#ifdef CONFIG_LOCAL_TIMERS
142static int __cpuinit msm_local_timer_setup(struct clock_event_device *evt) 142static int msm_local_timer_setup(struct clock_event_device *evt)
143{ 143{
144 /* Use existing clock_event for cpu 0 */ 144 /* Use existing clock_event for cpu 0 */
145 if (!smp_processor_id()) 145 if (!smp_processor_id())
@@ -164,7 +164,7 @@ static void msm_local_timer_stop(struct clock_event_device *evt)
164 disable_percpu_irq(evt->irq); 164 disable_percpu_irq(evt->irq);
165} 165}
166 166
167static struct local_timer_ops msm_local_timer_ops __cpuinitdata = { 167static struct local_timer_ops msm_local_timer_ops = {
168 .setup = msm_local_timer_setup, 168 .setup = msm_local_timer_setup,
169 .stop = msm_local_timer_stop, 169 .stop = msm_local_timer_stop,
170}; 170};
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
index 749a7f8c4992..75062eff2494 100644
--- a/arch/arm/mach-mv78xx0/common.c
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -413,7 +413,7 @@ void __init mv78xx0_init(void)
413 clk_init(); 413 clk_init();
414} 414}
415 415
416void mv78xx0_restart(char mode, const char *cmd) 416void mv78xx0_restart(enum reboot_mode mode, const char *cmd)
417{ 417{
418 /* 418 /*
419 * Enable soft reset to assert RSTOUTn. 419 * Enable soft reset to assert RSTOUTn.
diff --git a/arch/arm/mach-mv78xx0/common.h b/arch/arm/mach-mv78xx0/common.h
index 5e9485bad0ac..6889af26077d 100644
--- a/arch/arm/mach-mv78xx0/common.h
+++ b/arch/arm/mach-mv78xx0/common.h
@@ -11,6 +11,8 @@
11#ifndef __ARCH_MV78XX0_COMMON_H 11#ifndef __ARCH_MV78XX0_COMMON_H
12#define __ARCH_MV78XX0_COMMON_H 12#define __ARCH_MV78XX0_COMMON_H
13 13
14#include <linux/reboot.h>
15
14struct mv643xx_eth_platform_data; 16struct mv643xx_eth_platform_data;
15struct mv_sata_platform_data; 17struct mv_sata_platform_data;
16 18
@@ -45,7 +47,7 @@ void mv78xx0_uart1_init(void);
45void mv78xx0_uart2_init(void); 47void mv78xx0_uart2_init(void);
46void mv78xx0_uart3_init(void); 48void mv78xx0_uart3_init(void);
47void mv78xx0_i2c_init(void); 49void mv78xx0_i2c_init(void);
48void mv78xx0_restart(char, const char *); 50void mv78xx0_restart(enum reboot_mode, const char *);
49 51
50extern void mv78xx0_timer_init(void); 52extern void mv78xx0_timer_init(void);
51 53
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
index be117591f7f2..4c24303ec481 100644
--- a/arch/arm/mach-mvebu/coherency.c
+++ b/arch/arm/mach-mvebu/coherency.c
@@ -28,7 +28,7 @@
28#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
29#include "armada-370-xp.h" 29#include "armada-370-xp.h"
30 30
31unsigned long __cpuinitdata coherency_phys_base; 31unsigned long coherency_phys_base;
32static void __iomem *coherency_base; 32static void __iomem *coherency_base;
33static void __iomem *coherency_cpu_base; 33static void __iomem *coherency_cpu_base;
34 34
diff --git a/arch/arm/mach-mvebu/common.h b/arch/arm/mach-mvebu/common.h
index 98defd5e92cd..e366010e1d91 100644
--- a/arch/arm/mach-mvebu/common.h
+++ b/arch/arm/mach-mvebu/common.h
@@ -17,7 +17,9 @@
17 17
18#define ARMADA_XP_MAX_CPUS 4 18#define ARMADA_XP_MAX_CPUS 4
19 19
20void mvebu_restart(char mode, const char *cmd); 20#include <linux/reboot.h>
21
22void mvebu_restart(enum reboot_mode mode, const char *cmd);
21 23
22void armada_370_xp_init_irq(void); 24void armada_370_xp_init_irq(void);
23void armada_370_xp_handle_irq(struct pt_regs *regs); 25void armada_370_xp_handle_irq(struct pt_regs *regs);
diff --git a/arch/arm/mach-mvebu/headsmp.S b/arch/arm/mach-mvebu/headsmp.S
index 7147300c8af2..8a1b0c96e9ec 100644
--- a/arch/arm/mach-mvebu/headsmp.S
+++ b/arch/arm/mach-mvebu/headsmp.S
@@ -21,8 +21,6 @@
21#include <linux/linkage.h> 21#include <linux/linkage.h>
22#include <linux/init.h> 22#include <linux/init.h>
23 23
24 __CPUINIT
25
26/* 24/*
27 * Armada XP specific entry point for secondary CPUs. 25 * Armada XP specific entry point for secondary CPUs.
28 * We add the CPU to the coherency fabric and then jump to secondary 26 * We add the CPU to the coherency fabric and then jump to secondary
diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
index 93f2f3ab45f1..ce81d3031405 100644
--- a/arch/arm/mach-mvebu/platsmp.c
+++ b/arch/arm/mach-mvebu/platsmp.c
@@ -71,13 +71,12 @@ void __init set_secondary_cpus_clock(void)
71 } 71 }
72} 72}
73 73
74static void __cpuinit armada_xp_secondary_init(unsigned int cpu) 74static void armada_xp_secondary_init(unsigned int cpu)
75{ 75{
76 armada_xp_mpic_smp_cpu_init(); 76 armada_xp_mpic_smp_cpu_init();
77} 77}
78 78
79static int __cpuinit armada_xp_boot_secondary(unsigned int cpu, 79static int armada_xp_boot_secondary(unsigned int cpu, struct task_struct *idle)
80 struct task_struct *idle)
81{ 80{
82 pr_info("Booting CPU %d\n", cpu); 81 pr_info("Booting CPU %d\n", cpu);
83 82
diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c
index b8079df8c986..f875124ff4f9 100644
--- a/arch/arm/mach-mvebu/system-controller.c
+++ b/arch/arm/mach-mvebu/system-controller.c
@@ -26,6 +26,7 @@
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/of_address.h> 27#include <linux/of_address.h>
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/reboot.h>
29 30
30static void __iomem *system_controller_base; 31static void __iomem *system_controller_base;
31 32
@@ -63,7 +64,7 @@ static struct of_device_id of_system_controller_table[] = {
63 { /* end of list */ }, 64 { /* end of list */ },
64}; 65};
65 66
66void mvebu_restart(char mode, const char *cmd) 67void mvebu_restart(enum reboot_mode mode, const char *cmd)
67{ 68{
68 if (!system_controller_base) { 69 if (!system_controller_base) {
69 pr_err("Cannot restart, system-controller not available: check the device tree\n"); 70 pr_err("Cannot restart, system-controller not available: check the device tree\n");
diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index 616fe0210da1..8cde9e05b5d6 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -10,7 +10,6 @@ config SOC_IMX28
10 select ARM_AMBA 10 select ARM_AMBA
11 select ARM_CPU_SUSPEND if PM 11 select ARM_CPU_SUSPEND if PM
12 select CPU_ARM926T 12 select CPU_ARM926T
13 select HAVE_CAN_FLEXCAN if CAN
14 select PINCTRL_IMX28 13 select PINCTRL_IMX28
15 14
16config ARCH_MXS 15config ARCH_MXS
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index 7fa611c1b287..4ce27b536dc9 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -14,12 +14,12 @@
14#include <linux/clk/mxs.h> 14#include <linux/clk/mxs.h>
15#include <linux/clkdev.h> 15#include <linux/clkdev.h>
16#include <linux/clocksource.h> 16#include <linux/clocksource.h>
17#include <linux/can/platform/flexcan.h>
18#include <linux/delay.h> 17#include <linux/delay.h>
19#include <linux/err.h> 18#include <linux/err.h>
20#include <linux/gpio.h> 19#include <linux/gpio.h>
21#include <linux/init.h> 20#include <linux/init.h>
22#include <linux/irqchip/mxs.h> 21#include <linux/irqchip/mxs.h>
22#include <linux/reboot.h>
23#include <linux/micrel_phy.h> 23#include <linux/micrel_phy.h>
24#include <linux/of_address.h> 24#include <linux/of_address.h>
25#include <linux/of_platform.h> 25#include <linux/of_platform.h>
@@ -76,41 +76,6 @@ static inline void __mxs_togl(u32 mask, void __iomem *reg)
76 __raw_writel(mask, reg + MXS_TOG_ADDR); 76 __raw_writel(mask, reg + MXS_TOG_ADDR);
77} 77}
78 78
79/*
80 * MX28EVK_FLEXCAN_SWITCH is shared between both flexcan controllers
81 */
82#define MX28EVK_FLEXCAN_SWITCH MXS_GPIO_NR(2, 13)
83
84static int flexcan0_en, flexcan1_en;
85
86static void mx28evk_flexcan_switch(void)
87{
88 if (flexcan0_en || flexcan1_en)
89 gpio_set_value(MX28EVK_FLEXCAN_SWITCH, 1);
90 else
91 gpio_set_value(MX28EVK_FLEXCAN_SWITCH, 0);
92}
93
94static void mx28evk_flexcan0_switch(int enable)
95{
96 flexcan0_en = enable;
97 mx28evk_flexcan_switch();
98}
99
100static void mx28evk_flexcan1_switch(int enable)
101{
102 flexcan1_en = enable;
103 mx28evk_flexcan_switch();
104}
105
106static struct flexcan_platform_data flexcan_pdata[2];
107
108static struct of_dev_auxdata mxs_auxdata_lookup[] __initdata = {
109 OF_DEV_AUXDATA("fsl,imx28-flexcan", 0x80032000, NULL, &flexcan_pdata[0]),
110 OF_DEV_AUXDATA("fsl,imx28-flexcan", 0x80034000, NULL, &flexcan_pdata[1]),
111 { /* sentinel */ }
112};
113
114#define OCOTP_WORD_OFFSET 0x20 79#define OCOTP_WORD_OFFSET 0x20
115#define OCOTP_WORD_COUNT 0x20 80#define OCOTP_WORD_COUNT 0x20
116 81
@@ -270,15 +235,6 @@ static void __init imx28_evk_init(void)
270 mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0); 235 mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0);
271} 236}
272 237
273static void __init imx28_evk_post_init(void)
274{
275 if (!gpio_request_one(MX28EVK_FLEXCAN_SWITCH, GPIOF_DIR_OUT,
276 "flexcan-switch")) {
277 flexcan_pdata[0].transceiver_switch = mx28evk_flexcan0_switch;
278 flexcan_pdata[1].transceiver_switch = mx28evk_flexcan1_switch;
279 }
280}
281
282static int apx4devkit_phy_fixup(struct phy_device *phy) 238static int apx4devkit_phy_fixup(struct phy_device *phy)
283{ 239{
284 phy->dev_flags |= MICREL_PHY_50MHZ_CLK; 240 phy->dev_flags |= MICREL_PHY_50MHZ_CLK;
@@ -484,13 +440,10 @@ static void __init mxs_machine_init(void)
484 crystalfontz_init(); 440 crystalfontz_init();
485 441
486 of_platform_populate(NULL, of_default_bus_match_table, 442 of_platform_populate(NULL, of_default_bus_match_table,
487 mxs_auxdata_lookup, parent); 443 NULL, parent);
488 444
489 if (of_machine_is_compatible("karo,tx28")) 445 if (of_machine_is_compatible("karo,tx28"))
490 tx28_post_init(); 446 tx28_post_init();
491
492 if (of_machine_is_compatible("fsl,imx28-evk"))
493 imx28_evk_post_init();
494} 447}
495 448
496#define MX23_CLKCTRL_RESET_OFFSET 0x120 449#define MX23_CLKCTRL_RESET_OFFSET 0x120
@@ -500,7 +453,7 @@ static void __init mxs_machine_init(void)
500/* 453/*
501 * Reset the system. It is called by machine_restart(). 454 * Reset the system. It is called by machine_restart().
502 */ 455 */
503static void mxs_restart(char mode, const char *cmd) 456static void mxs_restart(enum reboot_mode mode, const char *cmd)
504{ 457{
505 struct device_node *np; 458 struct device_node *np;
506 void __iomem *reset_addr; 459 void __iomem *reset_addr;
diff --git a/arch/arm/mach-netx/generic.c b/arch/arm/mach-netx/generic.c
index 1504b68f4c66..db25b0cef3a7 100644
--- a/arch/arm/mach-netx/generic.c
+++ b/arch/arm/mach-netx/generic.c
@@ -24,6 +24,7 @@
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/irqchip/arm-vic.h> 26#include <linux/irqchip/arm-vic.h>
27#include <linux/reboot.h>
27#include <mach/hardware.h> 28#include <mach/hardware.h>
28#include <asm/mach/map.h> 29#include <asm/mach/map.h>
29#include <mach/netx-regs.h> 30#include <mach/netx-regs.h>
@@ -187,7 +188,7 @@ static int __init netx_init(void)
187 188
188subsys_initcall(netx_init); 189subsys_initcall(netx_init);
189 190
190void netx_restart(char mode, const char *cmd) 191void netx_restart(enum reboot_mode mode, const char *cmd)
191{ 192{
192 writel(NETX_SYSTEM_RES_CR_FIRMW_RES_EN | NETX_SYSTEM_RES_CR_FIRMW_RES, 193 writel(NETX_SYSTEM_RES_CR_FIRMW_RES_EN | NETX_SYSTEM_RES_CR_FIRMW_RES,
193 NETX_SYSTEM_RES_CR); 194 NETX_SYSTEM_RES_CR);
diff --git a/arch/arm/mach-netx/generic.h b/arch/arm/mach-netx/generic.h
index 768b26bbb42b..bb2ce471cc28 100644
--- a/arch/arm/mach-netx/generic.h
+++ b/arch/arm/mach-netx/generic.h
@@ -17,8 +17,10 @@
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19 19
20#include <linux/reboot.h>
21
20extern void __init netx_map_io(void); 22extern void __init netx_map_io(void);
21extern void __init netx_init_irq(void); 23extern void __init netx_init_irq(void);
22extern void netx_restart(char, const char *); 24extern void netx_restart(enum reboot_mode, const char *);
23 25
24extern void netx_timer_init(void); 26extern void netx_timer_init(void);
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index 2df209ed1a07..13e0df9c11ce 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -103,7 +103,7 @@ static void __init cpu8815_map_io(void)
103 iotable_init(cpu8815_io_desc, ARRAY_SIZE(cpu8815_io_desc)); 103 iotable_init(cpu8815_io_desc, ARRAY_SIZE(cpu8815_io_desc));
104} 104}
105 105
106static void cpu8815_restart(char mode, const char *cmd) 106static void cpu8815_restart(enum reboot_mode mode, const char *cmd)
107{ 107{
108 void __iomem *srcbase = ioremap(NOMADIK_SRC_BASE, SZ_4K); 108 void __iomem *srcbase = ioremap(NOMADIK_SRC_BASE, SZ_4K);
109 109
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 6c116e1a4b01..4677a9ccb3cb 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -26,6 +26,7 @@
26#include <linux/serial_reg.h> 26#include <linux/serial_reg.h>
27#include <linux/smc91x.h> 27#include <linux/smc91x.h>
28#include <linux/export.h> 28#include <linux/export.h>
29#include <linux/reboot.h>
29 30
30#include <asm/mach-types.h> 31#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
@@ -215,7 +216,7 @@ void voiceblue_wdt_ping(void)
215 gpio_set_value(0, wdt_gpio_state); 216 gpio_set_value(0, wdt_gpio_state);
216} 217}
217 218
218static void voiceblue_restart(char mode, const char *cmd) 219static void voiceblue_restart(enum reboot_mode mode, const char *cmd)
219{ 220{
220 /* 221 /*
221 * Workaround for 5912/1611b bug mentioned in sprz209d.pdf p. 28 222 * Workaround for 5912/1611b bug mentioned in sprz209d.pdf p. 28
diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h
index 14f7e9920479..abec019a5281 100644
--- a/arch/arm/mach-omap1/common.h
+++ b/arch/arm/mach-omap1/common.h
@@ -28,6 +28,7 @@
28 28
29#include <linux/mtd/mtd.h> 29#include <linux/mtd/mtd.h>
30#include <linux/i2c-omap.h> 30#include <linux/i2c-omap.h>
31#include <linux/reboot.h>
31 32
32#include <plat/i2c.h> 33#include <plat/i2c.h>
33 34
@@ -70,7 +71,7 @@ static inline int omap_serial_wakeup_init(void)
70void omap1_init_early(void); 71void omap1_init_early(void);
71void omap1_init_irq(void); 72void omap1_init_irq(void);
72void omap1_init_late(void); 73void omap1_init_late(void);
73void omap1_restart(char, const char *); 74void omap1_restart(enum reboot_mode, const char *);
74 75
75extern void __init omap_check_revision(void); 76extern void __init omap_check_revision(void);
76 77
diff --git a/arch/arm/mach-omap1/reset.c b/arch/arm/mach-omap1/reset.c
index 5eebd7e889d0..72bf4bf4a702 100644
--- a/arch/arm/mach-omap1/reset.c
+++ b/arch/arm/mach-omap1/reset.c
@@ -3,6 +3,7 @@
3 */ 3 */
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/io.h> 5#include <linux/io.h>
6#include <linux/reboot.h>
6 7
7#include <mach/hardware.h> 8#include <mach/hardware.h>
8 9
@@ -22,7 +23,7 @@
22#define OMAP_EXTWARM_RST_SRC_ID_SHIFT 5 23#define OMAP_EXTWARM_RST_SRC_ID_SHIFT 5
23 24
24 25
25void omap1_restart(char mode, const char *cmd) 26void omap1_restart(enum reboot_mode mode, const char *cmd)
26{ 27{
27 /* 28 /*
28 * Workaround for 5912/1611b bug mentioned in sprz209d.pdf p. 28 29 * Workaround for 5912/1611b bug mentioned in sprz209d.pdf p. 28
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index 726ec23d29c7..80603d2fef77 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -43,9 +43,9 @@
43#include <linux/clocksource.h> 43#include <linux/clocksource.h>
44#include <linux/clockchips.h> 44#include <linux/clockchips.h>
45#include <linux/io.h> 45#include <linux/io.h>
46#include <linux/sched_clock.h>
46 47
47#include <asm/irq.h> 48#include <asm/irq.h>
48#include <asm/sched_clock.h>
49 49
50#include <mach/hardware.h> 50#include <mach/hardware.h>
51#include <asm/mach/irq.h> 51#include <asm/mach/irq.h>
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index c7b32a966f67..627fa7e41fba 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -1,63 +1,10 @@
1config ARCH_OMAP 1config ARCH_OMAP
2 bool 2 bool
3 3
4config ARCH_OMAP2PLUS
5 bool "TI OMAP2/3/4/5 SoCs with device tree support" if (ARCH_MULTI_V6 || ARCH_MULTI_V7)
6 select ARCH_HAS_CPUFREQ
7 select ARCH_HAS_BANDGAP
8 select ARCH_HAS_HOLES_MEMORYMODEL
9 select ARCH_OMAP
10 select ARCH_REQUIRE_GPIOLIB
11 select CLKDEV_LOOKUP
12 select CLKSRC_MMIO
13 select GENERIC_CLOCKEVENTS
14 select GENERIC_IRQ_CHIP
15 select HAVE_CLK
16 select OMAP_DM_TIMER
17 select PINCTRL
18 select PROC_DEVICETREE if PROC_FS
19 select SOC_BUS
20 select SPARSE_IRQ
21 select TI_PRIV_EDMA
22 select USE_OF
23 help
24 Systems based on OMAP2, OMAP3, OMAP4 or OMAP5
25
26
27if ARCH_OMAP2PLUS
28
29menu "TI OMAP2/3/4 Specific Features"
30
31config ARCH_OMAP2PLUS_TYPICAL
32 bool "Typical OMAP configuration"
33 default y
34 select AEABI
35 select HIGHMEM
36 select I2C
37 select I2C_OMAP
38 select MENELAUS if ARCH_OMAP2
39 select NEON if ARCH_OMAP3 || ARCH_OMAP4 || SOC_OMAP5
40 select PM_RUNTIME
41 select REGULATOR
42 select TWL4030_CORE if ARCH_OMAP3 || ARCH_OMAP4
43 select TWL4030_POWER if ARCH_OMAP3 || ARCH_OMAP4
44 select VFP
45 help
46 Compile a kernel suitable for booting most boards
47
48config SOC_HAS_OMAP2_SDRC
49 bool "OMAP2 SDRAM Controller support"
50
51config SOC_HAS_REALTIME_COUNTER
52 bool "Real time free running counter"
53 depends on SOC_OMAP5
54 default y
55
56config ARCH_OMAP2 4config ARCH_OMAP2
57 bool "TI OMAP2" 5 bool "TI OMAP2"
58 depends on ARCH_OMAP2PLUS
59 depends on ARCH_MULTI_V6 6 depends on ARCH_MULTI_V6
60 default y 7 select ARCH_OMAP2PLUS
61 select CPU_V6 8 select CPU_V6
62 select MULTI_IRQ_HANDLER 9 select MULTI_IRQ_HANDLER
63 select SOC_HAS_OMAP2_SDRC 10 select SOC_HAS_OMAP2_SDRC
@@ -65,9 +12,8 @@ config ARCH_OMAP2
65 12
66config ARCH_OMAP3 13config ARCH_OMAP3
67 bool "TI OMAP3" 14 bool "TI OMAP3"
68 depends on ARCH_OMAP2PLUS
69 depends on ARCH_MULTI_V7 15 depends on ARCH_MULTI_V7
70 default y 16 select ARCH_OMAP2PLUS
71 select ARCH_HAS_OPP 17 select ARCH_HAS_OPP
72 select ARM_CPU_SUSPEND if PM 18 select ARM_CPU_SUSPEND if PM
73 select CPU_V7 19 select CPU_V7
@@ -81,9 +27,8 @@ config ARCH_OMAP3
81 27
82config ARCH_OMAP4 28config ARCH_OMAP4
83 bool "TI OMAP4" 29 bool "TI OMAP4"
84 default y
85 depends on ARCH_OMAP2PLUS
86 depends on ARCH_MULTI_V7 30 depends on ARCH_MULTI_V7
31 select ARCH_OMAP2PLUS
87 select ARCH_HAS_OPP 32 select ARCH_HAS_OPP
88 select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP 33 select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP
89 select ARM_CPU_SUSPEND if PM 34 select ARM_CPU_SUSPEND if PM
@@ -108,12 +53,87 @@ config ARCH_OMAP4
108config SOC_OMAP5 53config SOC_OMAP5
109 bool "TI OMAP5" 54 bool "TI OMAP5"
110 depends on ARCH_MULTI_V7 55 depends on ARCH_MULTI_V7
56 select ARCH_OMAP2PLUS
111 select ARM_CPU_SUSPEND if PM 57 select ARM_CPU_SUSPEND if PM
112 select ARM_GIC 58 select ARM_GIC
113 select CPU_V7 59 select CPU_V7
60 select HAVE_ARM_SCU if SMP
61 select HAVE_ARM_TWD if LOCAL_TIMERS
114 select HAVE_SMP 62 select HAVE_SMP
115 select COMMON_CLK 63 select COMMON_CLK
116 select HAVE_ARM_ARCH_TIMER 64 select HAVE_ARM_ARCH_TIMER
65 select ARM_ERRATA_798181
66
67config SOC_AM33XX
68 bool "AM33XX support"
69 depends on ARCH_MULTI_V7
70 select ARCH_OMAP2PLUS
71 select ARM_CPU_SUSPEND if PM
72 select CPU_V7
73 select MULTI_IRQ_HANDLER
74 select COMMON_CLK
75
76config SOC_AM43XX
77 bool "TI AM43x"
78 depends on ARCH_MULTI_V7
79 select CPU_V7
80 select ARCH_OMAP2PLUS
81 select MULTI_IRQ_HANDLER
82 select ARM_GIC
83 select COMMON_CLK
84 select MACH_OMAP_GENERIC
85
86config ARCH_OMAP2PLUS
87 bool
88 select ARCH_HAS_BANDGAP
89 select ARCH_HAS_CPUFREQ
90 select ARCH_HAS_HOLES_MEMORYMODEL
91 select ARCH_OMAP
92 select ARCH_REQUIRE_GPIOLIB
93 select CLKDEV_LOOKUP
94 select CLKSRC_MMIO
95 select GENERIC_CLOCKEVENTS
96 select GENERIC_IRQ_CHIP
97 select HAVE_CLK
98 select OMAP_DM_TIMER
99 select PINCTRL
100 select PROC_DEVICETREE if PROC_FS
101 select SOC_BUS
102 select SPARSE_IRQ
103 select TI_PRIV_EDMA
104 select USE_OF
105 help
106 Systems based on OMAP2, OMAP3, OMAP4 or OMAP5
107
108
109if ARCH_OMAP2PLUS
110
111menu "TI OMAP2/3/4 Specific Features"
112
113config ARCH_OMAP2PLUS_TYPICAL
114 bool "Typical OMAP configuration"
115 default y
116 select AEABI
117 select HIGHMEM
118 select I2C
119 select I2C_OMAP
120 select MENELAUS if ARCH_OMAP2
121 select NEON if ARCH_OMAP3 || ARCH_OMAP4 || SOC_OMAP5
122 select PM_RUNTIME
123 select REGULATOR
124 select TWL4030_CORE if ARCH_OMAP3 || ARCH_OMAP4
125 select TWL4030_POWER if ARCH_OMAP3 || ARCH_OMAP4
126 select VFP
127 help
128 Compile a kernel suitable for booting most boards
129
130config SOC_HAS_OMAP2_SDRC
131 bool "OMAP2 SDRAM Controller support"
132
133config SOC_HAS_REALTIME_COUNTER
134 bool "Real time free running counter"
135 depends on SOC_OMAP5
136 default y
117 137
118comment "OMAP Core Type" 138comment "OMAP Core Type"
119 depends on ARCH_OMAP2 139 depends on ARCH_OMAP2
@@ -142,23 +162,6 @@ config SOC_TI81XX
142 depends on ARCH_OMAP3 162 depends on ARCH_OMAP3
143 default y 163 default y
144 164
145config SOC_AM33XX
146 bool "AM33XX support"
147 depends on ARCH_MULTI_V7
148 default y
149 select ARM_CPU_SUSPEND if PM
150 select CPU_V7
151 select MULTI_IRQ_HANDLER
152 select COMMON_CLK
153
154config SOC_AM43XX
155 bool "TI AM43x"
156 select CPU_V7
157 select MULTI_IRQ_HANDLER
158 select ARM_GIC
159 select COMMON_CLK
160 select MACH_OMAP_GENERIC
161
162config OMAP_PACKAGE_ZAF 165config OMAP_PACKAGE_ZAF
163 bool 166 bool
164 167
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index ea5a27ff9941..d4f671547c37 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -95,10 +95,6 @@ obj-$(CONFIG_POWER_AVS_OMAP_CLASS3) += smartreflex-class3.o
95AFLAGS_sleep24xx.o :=-Wa,-march=armv6 95AFLAGS_sleep24xx.o :=-Wa,-march=armv6
96AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a$(plus_sec) 96AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a$(plus_sec)
97 97
98ifeq ($(CONFIG_PM_VERBOSE),y)
99CFLAGS_pm_bus.o += -DDEBUG
100endif
101
102endif 98endif
103 99
104ifeq ($(CONFIG_CPU_IDLE),y) 100ifeq ($(CONFIG_CPU_IDLE),y)
diff --git a/arch/arm/mach-omap2/am33xx-restart.c b/arch/arm/mach-omap2/am33xx-restart.c
index 88e4fa8af031..1eae96212315 100644
--- a/arch/arm/mach-omap2/am33xx-restart.c
+++ b/arch/arm/mach-omap2/am33xx-restart.c
@@ -6,6 +6,7 @@
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/reboot.h>
9 10
10#include "common.h" 11#include "common.h"
11#include "prm-regbits-33xx.h" 12#include "prm-regbits-33xx.h"
@@ -19,7 +20,7 @@
19 * Resets the SoC. For @cmd, see the 'reboot' syscall in 20 * Resets the SoC. For @cmd, see the 'reboot' syscall in
20 * kernel/sys.c. No return value. 21 * kernel/sys.c. No return value.
21 */ 22 */
22void am33xx_restart(char mode, const char *cmd) 23void am33xx_restart(enum reboot_mode mode, const char *cmd)
23{ 24{
24 /* TODO: Handle mode and cmd if necessary */ 25 /* TODO: Handle mode and cmd if necessary */
25 26
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index b54562d1235e..87e65dde8e13 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -553,6 +553,37 @@ static struct usbhs_omap_platform_data igep3_usbhs_bdata __initdata = {
553 553
554#ifdef CONFIG_OMAP_MUX 554#ifdef CONFIG_OMAP_MUX
555static struct omap_board_mux board_mux[] __initdata = { 555static struct omap_board_mux board_mux[] __initdata = {
556 /* Display Sub System */
557 OMAP3_MUX(DSS_PCLK, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
558 OMAP3_MUX(DSS_HSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
559 OMAP3_MUX(DSS_VSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
560 OMAP3_MUX(DSS_ACBIAS, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
561 OMAP3_MUX(DSS_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
562 OMAP3_MUX(DSS_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
563 OMAP3_MUX(DSS_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
564 OMAP3_MUX(DSS_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
565 OMAP3_MUX(DSS_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
566 OMAP3_MUX(DSS_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
567 OMAP3_MUX(DSS_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
568 OMAP3_MUX(DSS_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
569 OMAP3_MUX(DSS_DATA8, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
570 OMAP3_MUX(DSS_DATA9, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
571 OMAP3_MUX(DSS_DATA10, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
572 OMAP3_MUX(DSS_DATA11, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
573 OMAP3_MUX(DSS_DATA12, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
574 OMAP3_MUX(DSS_DATA13, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
575 OMAP3_MUX(DSS_DATA14, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
576 OMAP3_MUX(DSS_DATA15, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
577 OMAP3_MUX(DSS_DATA16, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
578 OMAP3_MUX(DSS_DATA17, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
579 OMAP3_MUX(DSS_DATA18, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
580 OMAP3_MUX(DSS_DATA19, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
581 OMAP3_MUX(DSS_DATA20, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
582 OMAP3_MUX(DSS_DATA21, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
583 OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
584 OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
585 /* TFP410 PanelBus DVI Transmitte (GPIO_170) */
586 OMAP3_MUX(HDQ_SIO, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
556 /* SMSC9221 LAN Controller ETH IRQ (GPIO_176) */ 587 /* SMSC9221 LAN Controller ETH IRQ (GPIO_176) */
557 OMAP3_MUX(MCSPI1_CS2, OMAP_MUX_MODE4 | OMAP_PIN_INPUT), 588 OMAP3_MUX(MCSPI1_CS2, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
558 { .reg_offset = OMAP_MUX_TERMINATOR }, 589 { .reg_offset = OMAP_MUX_TERMINATOR },
diff --git a/arch/arm/mach-omap2/board-rx51-video.c b/arch/arm/mach-omap2/board-rx51-video.c
index bd74f9f6063b..bdd1e3a179e1 100644
--- a/arch/arm/mach-omap2/board-rx51-video.c
+++ b/arch/arm/mach-omap2/board-rx51-video.c
@@ -61,7 +61,7 @@ static struct omap_dss_board_info rx51_dss_board_info = {
61 61
62static int __init rx51_video_init(void) 62static int __init rx51_video_init(void)
63{ 63{
64 if (!machine_is_nokia_rx51()) 64 if (!machine_is_nokia_rx51() && !of_machine_is_compatible("nokia,omap3-n900"))
65 return 0; 65 return 0;
66 66
67 if (omap_mux_init_gpio(RX51_LCD_RESET_GPIO, OMAP_PIN_OUTPUT)) { 67 if (omap_mux_init_gpio(RX51_LCD_RESET_GPIO, OMAP_PIN_OUTPUT)) {
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 72cab3f4f16d..dfcc182ecff9 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -31,6 +31,7 @@
31#include <linux/i2c.h> 31#include <linux/i2c.h>
32#include <linux/i2c/twl.h> 32#include <linux/i2c/twl.h>
33#include <linux/i2c-omap.h> 33#include <linux/i2c-omap.h>
34#include <linux/reboot.h>
34 35
35#include <asm/proc-fns.h> 36#include <asm/proc-fns.h>
36 37
@@ -119,33 +120,33 @@ static inline void omap_soc_device_init(void)
119#endif 120#endif
120 121
121#if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430) 122#if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430)
122void omap2xxx_restart(char mode, const char *cmd); 123void omap2xxx_restart(enum reboot_mode mode, const char *cmd);
123#else 124#else
124static inline void omap2xxx_restart(char mode, const char *cmd) 125static inline void omap2xxx_restart(enum reboot_mode mode, const char *cmd)
125{ 126{
126} 127}
127#endif 128#endif
128 129
129#ifdef CONFIG_SOC_AM33XX 130#ifdef CONFIG_SOC_AM33XX
130void am33xx_restart(char mode, const char *cmd); 131void am33xx_restart(enum reboot_mode mode, const char *cmd);
131#else 132#else
132static inline void am33xx_restart(char mode, const char *cmd) 133static inline void am33xx_restart(enum reboot_mode mode, const char *cmd)
133{ 134{
134} 135}
135#endif 136#endif
136 137
137#ifdef CONFIG_ARCH_OMAP3 138#ifdef CONFIG_ARCH_OMAP3
138void omap3xxx_restart(char mode, const char *cmd); 139void omap3xxx_restart(enum reboot_mode mode, const char *cmd);
139#else 140#else
140static inline void omap3xxx_restart(char mode, const char *cmd) 141static inline void omap3xxx_restart(enum reboot_mode mode, const char *cmd)
141{ 142{
142} 143}
143#endif 144#endif
144 145
145#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) 146#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
146void omap44xx_restart(char mode, const char *cmd); 147void omap44xx_restart(enum reboot_mode mode, const char *cmd);
147#else 148#else
148static inline void omap44xx_restart(char mode, const char *cmd) 149static inline void omap44xx_restart(enum reboot_mode mode, const char *cmd)
149{ 150{
150} 151}
151#endif 152#endif
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index ba8d06598e55..afc201713131 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -15,7 +15,6 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/gpio.h>
19#include <linux/slab.h> 18#include <linux/slab.h>
20#include <linux/of.h> 19#include <linux/of.h>
21#include <linux/pinctrl/machine.h> 20#include <linux/pinctrl/machine.h>
@@ -66,7 +65,7 @@ static int __init omap3_l3_init(void)
66 65
67 WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name); 66 WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
68 67
69 return IS_ERR(pdev) ? PTR_ERR(pdev) : 0; 68 return PTR_RET(pdev);
70} 69}
71omap_postcore_initcall(omap3_l3_init); 70omap_postcore_initcall(omap3_l3_init);
72 71
@@ -100,7 +99,7 @@ static int __init omap4_l3_init(void)
100 99
101 WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name); 100 WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
102 101
103 return IS_ERR(pdev) ? PTR_ERR(pdev) : 0; 102 return PTR_RET(pdev);
104} 103}
105omap_postcore_initcall(omap4_l3_init); 104omap_postcore_initcall(omap4_l3_init);
106 105
diff --git a/arch/arm/mach-omap2/fb.c b/arch/arm/mach-omap2/fb.c
index 190ae493c6ef..2ca33cc0c484 100644
--- a/arch/arm/mach-omap2/fb.c
+++ b/arch/arm/mach-omap2/fb.c
@@ -83,10 +83,7 @@ static int __init omap_init_vrfb(void)
83 pdev = platform_device_register_resndata(NULL, "omapvrfb", -1, 83 pdev = platform_device_register_resndata(NULL, "omapvrfb", -1,
84 res, num_res, NULL, 0); 84 res, num_res, NULL, 0);
85 85
86 if (IS_ERR(pdev)) 86 return PTR_RET(pdev);
87 return PTR_ERR(pdev);
88 else
89 return 0;
90} 87}
91 88
92omap_arch_initcall(omap_init_vrfb); 89omap_arch_initcall(omap_init_vrfb);
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 1c7969e965d7..f3fdd6afa213 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -1734,7 +1734,7 @@ static int __init omap_gpmc_init(void)
1734 pdev = omap_device_build(DEVICE_NAME, -1, oh, NULL, 0); 1734 pdev = omap_device_build(DEVICE_NAME, -1, oh, NULL, 0);
1735 WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name); 1735 WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
1736 1736
1737 return IS_ERR(pdev) ? PTR_ERR(pdev) : 0; 1737 return PTR_RET(pdev);
1738} 1738}
1739omap_postcore_initcall(omap_gpmc_init); 1739omap_postcore_initcall(omap_gpmc_init);
1740 1740
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index fe3253a100e7..4a3f06f02859 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -394,7 +394,7 @@ static void __init omap_hwmod_init_postsetup(void)
394 omap_pm_if_early_init(); 394 omap_pm_if_early_init();
395} 395}
396 396
397static void __init omap_common_late_init(void) 397static void __init __maybe_unused omap_common_late_init(void)
398{ 398{
399 omap_mux_late_init(); 399 omap_mux_late_init();
400 omap2_common_pm_late_init(); 400 omap2_common_pm_late_init();
diff --git a/arch/arm/mach-omap2/omap-headsmp.S b/arch/arm/mach-omap2/omap-headsmp.S
index 4ea308114165..75e92952c18e 100644
--- a/arch/arm/mach-omap2/omap-headsmp.S
+++ b/arch/arm/mach-omap2/omap-headsmp.S
@@ -20,8 +20,6 @@
20 20
21#include "omap44xx.h" 21#include "omap44xx.h"
22 22
23 __CPUINIT
24
25/* Physical address needed since MMU not enabled yet on secondary core */ 23/* Physical address needed since MMU not enabled yet on secondary core */
26#define AUX_CORE_BOOT0_PA 0x48281800 24#define AUX_CORE_BOOT0_PA 0x48281800
27 25
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
index f993a4188701..f991016e2a6a 100644
--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
@@ -291,7 +291,7 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
291 * @cpu : CPU ID 291 * @cpu : CPU ID
292 * @power_state: CPU low power state. 292 * @power_state: CPU low power state.
293 */ 293 */
294int __cpuinit omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state) 294int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state)
295{ 295{
296 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu); 296 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu);
297 unsigned int cpu_state = 0; 297 unsigned int cpu_state = 0;
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 98a11463a843..8708b2a9da45 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -51,7 +51,7 @@ void __iomem *omap4_get_scu_base(void)
51 return scu_base; 51 return scu_base;
52} 52}
53 53
54static void __cpuinit omap4_secondary_init(unsigned int cpu) 54static void omap4_secondary_init(unsigned int cpu)
55{ 55{
56 /* 56 /*
57 * Configure ACTRL and enable NS SMP bit access on CPU1 on HS device. 57 * Configure ACTRL and enable NS SMP bit access on CPU1 on HS device.
@@ -72,7 +72,7 @@ static void __cpuinit omap4_secondary_init(unsigned int cpu)
72 spin_unlock(&boot_lock); 72 spin_unlock(&boot_lock);
73} 73}
74 74
75static int __cpuinit omap4_boot_secondary(unsigned int cpu, struct task_struct *idle) 75static int omap4_boot_secondary(unsigned int cpu, struct task_struct *idle)
76{ 76{
77 static struct clockdomain *cpu1_clkdm; 77 static struct clockdomain *cpu1_clkdm;
78 static bool booted; 78 static bool booted;
diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c
index f8bb3b9b6a76..813c61558a5f 100644
--- a/arch/arm/mach-omap2/omap-wakeupgen.c
+++ b/arch/arm/mach-omap2/omap-wakeupgen.c
@@ -323,8 +323,8 @@ static void irq_save_secure_context(void)
323#endif 323#endif
324 324
325#ifdef CONFIG_HOTPLUG_CPU 325#ifdef CONFIG_HOTPLUG_CPU
326static int __cpuinit irq_cpu_hotplug_notify(struct notifier_block *self, 326static int irq_cpu_hotplug_notify(struct notifier_block *self,
327 unsigned long action, void *hcpu) 327 unsigned long action, void *hcpu)
328{ 328{
329 unsigned int cpu = (unsigned int)hcpu; 329 unsigned int cpu = (unsigned int)hcpu;
330 330
diff --git a/arch/arm/mach-omap2/omap2-restart.c b/arch/arm/mach-omap2/omap2-restart.c
index 719b716a4494..68423e26399d 100644
--- a/arch/arm/mach-omap2/omap2-restart.c
+++ b/arch/arm/mach-omap2/omap2-restart.c
@@ -31,7 +31,7 @@ static struct clk *reset_virt_prcm_set_ck, *reset_sys_ck;
31 * Set the DPLL to bypass so that reboot completes successfully. No 31 * Set the DPLL to bypass so that reboot completes successfully. No
32 * return value. 32 * return value.
33 */ 33 */
34void omap2xxx_restart(char mode, const char *cmd) 34void omap2xxx_restart(enum reboot_mode mode, const char *cmd)
35{ 35{
36 u32 rate; 36 u32 rate;
37 37
diff --git a/arch/arm/mach-omap2/omap3-restart.c b/arch/arm/mach-omap2/omap3-restart.c
index 923c582189e5..5de2a0c2979d 100644
--- a/arch/arm/mach-omap2/omap3-restart.c
+++ b/arch/arm/mach-omap2/omap3-restart.c
@@ -12,6 +12,7 @@
12 */ 12 */
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/reboot.h>
15 16
16#include "iomap.h" 17#include "iomap.h"
17#include "common.h" 18#include "common.h"
@@ -28,7 +29,7 @@
28 * Resets the SoC. For @cmd, see the 'reboot' syscall in 29 * Resets the SoC. For @cmd, see the 'reboot' syscall in
29 * kernel/sys.c. No return value. 30 * kernel/sys.c. No return value.
30 */ 31 */
31void omap3xxx_restart(char mode, const char *cmd) 32void omap3xxx_restart(enum reboot_mode mode, const char *cmd)
32{ 33{
33 omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0)); 34 omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
34 omap3xxx_prm_dpll3_reset(); /* never returns */ 35 omap3xxx_prm_dpll3_reset(); /* never returns */
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index 38cd3a69cff3..57911430324e 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -23,6 +23,7 @@
23#include <linux/export.h> 23#include <linux/export.h>
24#include <linux/irqchip/arm-gic.h> 24#include <linux/irqchip/arm-gic.h>
25#include <linux/of_address.h> 25#include <linux/of_address.h>
26#include <linux/reboot.h>
26 27
27#include <asm/hardware/cache-l2x0.h> 28#include <asm/hardware/cache-l2x0.h>
28#include <asm/mach/map.h> 29#include <asm/mach/map.h>
diff --git a/arch/arm/mach-omap2/omap4-restart.c b/arch/arm/mach-omap2/omap4-restart.c
index f90e02e11898..41dfd7da8170 100644
--- a/arch/arm/mach-omap2/omap4-restart.c
+++ b/arch/arm/mach-omap2/omap4-restart.c
@@ -8,6 +8,7 @@
8 */ 8 */
9 9
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/reboot.h>
11#include "prminst44xx.h" 12#include "prminst44xx.h"
12 13
13/** 14/**
@@ -18,7 +19,7 @@
18 * Resets the SoC. For @cmd, see the 'reboot' syscall in 19 * Resets the SoC. For @cmd, see the 'reboot' syscall in
19 * kernel/sys.c. No return value. 20 * kernel/sys.c. No return value.
20 */ 21 */
21void omap44xx_restart(char mode, const char *cmd) 22void omap44xx_restart(enum reboot_mode mode, const char *cmd)
22{ 23{
23 /* XXX Should save 'cmd' into scratchpad for use after reboot */ 24 /* XXX Should save 'cmd' into scratchpad for use after reboot */
24 omap4_prminst_global_warm_sw_reset(); /* never returns */ 25 omap4_prminst_global_warm_sw_reset(); /* never returns */
diff --git a/arch/arm/mach-omap2/pmu.c b/arch/arm/mach-omap2/pmu.c
index 9ace8eae7ee8..33c8846b4193 100644
--- a/arch/arm/mach-omap2/pmu.c
+++ b/arch/arm/mach-omap2/pmu.c
@@ -54,10 +54,7 @@ static int __init omap2_init_pmu(unsigned oh_num, char *oh_names[])
54 WARN(IS_ERR(omap_pmu_dev), "Can't build omap_device for %s.\n", 54 WARN(IS_ERR(omap_pmu_dev), "Can't build omap_device for %s.\n",
55 dev_name); 55 dev_name);
56 56
57 if (IS_ERR(omap_pmu_dev)) 57 return PTR_RET(omap_pmu_dev);
58 return PTR_ERR(omap_pmu_dev);
59
60 return 0;
61} 58}
62 59
63static int __init omap_init_pmu(void) 60static int __init omap_init_pmu(void)
diff --git a/arch/arm/mach-omap2/sleep44xx.S b/arch/arm/mach-omap2/sleep44xx.S
index 88ff83a0942e..9086ce03ae12 100644
--- a/arch/arm/mach-omap2/sleep44xx.S
+++ b/arch/arm/mach-omap2/sleep44xx.S
@@ -34,6 +34,8 @@ ppa_zero_params:
34ppa_por_params: 34ppa_por_params:
35 .word 1, 0 35 .word 1, 0
36 36
37#ifdef CONFIG_ARCH_OMAP4
38
37/* 39/*
38 * ============================= 40 * =============================
39 * == CPU suspend finisher == 41 * == CPU suspend finisher ==
@@ -326,7 +328,9 @@ skip_l2en:
326 328
327 b cpu_resume @ Jump to generic resume 329 b cpu_resume @ Jump to generic resume
328ENDPROC(omap4_cpu_resume) 330ENDPROC(omap4_cpu_resume)
329#endif 331#endif /* CONFIG_ARCH_OMAP4 */
332
333#endif /* defined(CONFIG_SMP) && defined(CONFIG_PM) */
330 334
331#ifndef CONFIG_OMAP4_ERRATA_I688 335#ifndef CONFIG_OMAP4_ERRATA_I688
332ENTRY(omap_bus_sync) 336ENTRY(omap_bus_sync)
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 3bdb0fb02028..b37e1fcbad56 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -41,10 +41,10 @@
41#include <linux/of_irq.h> 41#include <linux/of_irq.h>
42#include <linux/platform_device.h> 42#include <linux/platform_device.h>
43#include <linux/platform_data/dmtimer-omap.h> 43#include <linux/platform_data/dmtimer-omap.h>
44#include <linux/sched_clock.h>
44 45
45#include <asm/mach/time.h> 46#include <asm/mach/time.h>
46#include <asm/smp_twd.h> 47#include <asm/smp_twd.h>
47#include <asm/sched_clock.h>
48 48
49#include "omap_hwmod.h" 49#include "omap_hwmod.h"
50#include "omap_device.h" 50#include "omap_device.h"
@@ -220,7 +220,7 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
220 int posted) 220 int posted)
221{ 221{
222 char name[10]; /* 10 = sizeof("gptXX_Xck0") */ 222 char name[10]; /* 10 = sizeof("gptXX_Xck0") */
223 const char *oh_name; 223 const char *oh_name = NULL;
224 struct device_node *np; 224 struct device_node *np;
225 struct omap_hwmod *oh; 225 struct omap_hwmod *oh;
226 struct resource irq, mem; 226 struct resource irq, mem;
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index f8a6db9239bf..b41599f98a8e 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -347,7 +347,7 @@ void __init orion5x_init(void)
347 orion5x_wdt_init(); 347 orion5x_wdt_init();
348} 348}
349 349
350void orion5x_restart(char mode, const char *cmd) 350void orion5x_restart(enum reboot_mode mode, const char *cmd)
351{ 351{
352 /* 352 /*
353 * Enable and issue soft reset 353 * Enable and issue soft reset
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h
index cdaa01f3d186..a909afb384fb 100644
--- a/arch/arm/mach-orion5x/common.h
+++ b/arch/arm/mach-orion5x/common.h
@@ -1,6 +1,8 @@
1#ifndef __ARCH_ORION5X_COMMON_H 1#ifndef __ARCH_ORION5X_COMMON_H
2#define __ARCH_ORION5X_COMMON_H 2#define __ARCH_ORION5X_COMMON_H
3 3
4#include <linux/reboot.h>
5
4struct dsa_platform_data; 6struct dsa_platform_data;
5struct mv643xx_eth_platform_data; 7struct mv643xx_eth_platform_data;
6struct mv_sata_platform_data; 8struct mv_sata_platform_data;
@@ -29,7 +31,7 @@ void orion5x_spi_init(void);
29void orion5x_uart0_init(void); 31void orion5x_uart0_init(void);
30void orion5x_uart1_init(void); 32void orion5x_uart1_init(void);
31void orion5x_xor_init(void); 33void orion5x_xor_init(void);
32void orion5x_restart(char, const char *); 34void orion5x_restart(enum reboot_mode, const char *);
33 35
34/* 36/*
35 * PCIe/PCI functions. 37 * PCIe/PCI functions.
diff --git a/arch/arm/mach-orion5x/include/mach/bridge-regs.h b/arch/arm/mach-orion5x/include/mach/bridge-regs.h
index 461fd69a10ae..f727d03f1688 100644
--- a/arch/arm/mach-orion5x/include/mach/bridge-regs.h
+++ b/arch/arm/mach-orion5x/include/mach/bridge-regs.h
@@ -18,7 +18,6 @@
18#define CPU_CTRL (ORION5X_BRIDGE_VIRT_BASE + 0x104) 18#define CPU_CTRL (ORION5X_BRIDGE_VIRT_BASE + 0x104)
19 19
20#define RSTOUTn_MASK (ORION5X_BRIDGE_VIRT_BASE + 0x108) 20#define RSTOUTn_MASK (ORION5X_BRIDGE_VIRT_BASE + 0x108)
21#define WDT_RESET_OUT_EN 0x0002
22 21
23#define CPU_SOFT_RESET (ORION5X_BRIDGE_VIRT_BASE + 0x10c) 22#define CPU_SOFT_RESET (ORION5X_BRIDGE_VIRT_BASE + 0x10c)
24 23
@@ -26,8 +25,6 @@
26 25
27#define POWER_MNG_CTRL_REG (ORION5X_BRIDGE_VIRT_BASE + 0x11C) 26#define POWER_MNG_CTRL_REG (ORION5X_BRIDGE_VIRT_BASE + 0x11C)
28 27
29#define WDT_INT_REQ 0x0008
30
31#define BRIDGE_INT_TIMER1_CLR (~0x0004) 28#define BRIDGE_INT_TIMER1_CLR (~0x0004)
32 29
33#define MAIN_IRQ_CAUSE (ORION5X_BRIDGE_VIRT_BASE + 0x200) 30#define MAIN_IRQ_CAUSE (ORION5X_BRIDGE_VIRT_BASE + 0x200)
diff --git a/arch/arm/mach-orion5x/ls-chl-setup.c b/arch/arm/mach-orion5x/ls-chl-setup.c
index 24f4e14e5893..6234977b5aea 100644
--- a/arch/arm/mach-orion5x/ls-chl-setup.c
+++ b/arch/arm/mach-orion5x/ls-chl-setup.c
@@ -139,7 +139,7 @@ static struct mv_sata_platform_data lschl_sata_data = {
139 139
140static void lschl_power_off(void) 140static void lschl_power_off(void)
141{ 141{
142 orion5x_restart('h', NULL); 142 orion5x_restart(REBOOT_HARD, NULL);
143} 143}
144 144
145/***************************************************************************** 145/*****************************************************************************
diff --git a/arch/arm/mach-orion5x/ls_hgl-setup.c b/arch/arm/mach-orion5x/ls_hgl-setup.c
index fc653bb41e78..fe04c4b64569 100644
--- a/arch/arm/mach-orion5x/ls_hgl-setup.c
+++ b/arch/arm/mach-orion5x/ls_hgl-setup.c
@@ -185,7 +185,7 @@ static struct mv_sata_platform_data ls_hgl_sata_data = {
185 185
186static void ls_hgl_power_off(void) 186static void ls_hgl_power_off(void)
187{ 187{
188 orion5x_restart('h', NULL); 188 orion5x_restart(REBOOT_HARD, NULL);
189} 189}
190 190
191 191
diff --git a/arch/arm/mach-orion5x/lsmini-setup.c b/arch/arm/mach-orion5x/lsmini-setup.c
index 18e66e617dc2..ca4dbe973daf 100644
--- a/arch/arm/mach-orion5x/lsmini-setup.c
+++ b/arch/arm/mach-orion5x/lsmini-setup.c
@@ -185,7 +185,7 @@ static struct mv_sata_platform_data lsmini_sata_data = {
185 185
186static void lsmini_power_off(void) 186static void lsmini_power_off(void)
187{ 187{
188 orion5x_restart('h', NULL); 188 orion5x_restart(REBOOT_HARD, NULL);
189} 189}
190 190
191 191
diff --git a/arch/arm/mach-picoxcell/common.c b/arch/arm/mach-picoxcell/common.c
index b13f51bc35cf..ec79fea82704 100644
--- a/arch/arm/mach-picoxcell/common.c
+++ b/arch/arm/mach-picoxcell/common.c
@@ -11,6 +11,7 @@
11#include <linux/of.h> 11#include <linux/of.h>
12#include <linux/of_address.h> 12#include <linux/of_address.h>
13#include <linux/of_platform.h> 13#include <linux/of_platform.h>
14#include <linux/reboot.h>
14 15
15#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
16#include <asm/mach/map.h> 17#include <asm/mach/map.h>
@@ -63,7 +64,7 @@ static const char *picoxcell_dt_match[] = {
63 NULL 64 NULL
64}; 65};
65 66
66static void picoxcell_wdt_restart(char mode, const char *cmd) 67static void picoxcell_wdt_restart(enum reboot_mode mode, const char *cmd)
67{ 68{
68 /* 69 /*
69 * Configure the watchdog to reset with the shortest possible timeout 70 * Configure the watchdog to reset with the shortest possible timeout
diff --git a/arch/arm/mach-prima2/common.h b/arch/arm/mach-prima2/common.h
index 81135cd88e54..a6304858474a 100644
--- a/arch/arm/mach-prima2/common.h
+++ b/arch/arm/mach-prima2/common.h
@@ -10,6 +10,8 @@
10#define __MACH_PRIMA2_COMMON_H__ 10#define __MACH_PRIMA2_COMMON_H__
11 11
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/reboot.h>
14
13#include <asm/mach/time.h> 15#include <asm/mach/time.h>
14#include <asm/exception.h> 16#include <asm/exception.h>
15 17
@@ -22,7 +24,7 @@ extern void sirfsoc_cpu_die(unsigned int cpu);
22 24
23extern void __init sirfsoc_of_irq_init(void); 25extern void __init sirfsoc_of_irq_init(void);
24extern void __init sirfsoc_of_clk_init(void); 26extern void __init sirfsoc_of_clk_init(void);
25extern void sirfsoc_restart(char, const char *); 27extern void sirfsoc_restart(enum reboot_mode, const char *);
26extern asmlinkage void __exception_irq_entry sirfsoc_handle_irq(struct pt_regs *regs); 28extern asmlinkage void __exception_irq_entry sirfsoc_handle_irq(struct pt_regs *regs);
27 29
28#ifndef CONFIG_DEBUG_LL 30#ifndef CONFIG_DEBUG_LL
diff --git a/arch/arm/mach-prima2/headsmp.S b/arch/arm/mach-prima2/headsmp.S
index 5b8a408d8921..d86fe33c5f53 100644
--- a/arch/arm/mach-prima2/headsmp.S
+++ b/arch/arm/mach-prima2/headsmp.S
@@ -9,8 +9,6 @@
9#include <linux/linkage.h> 9#include <linux/linkage.h>
10#include <linux/init.h> 10#include <linux/init.h>
11 11
12 __CPUINIT
13
14/* 12/*
15 * SIRFSOC specific entry point for secondary CPUs. This provides 13 * SIRFSOC specific entry point for secondary CPUs. This provides
16 * a "holding pen" into which all secondary cores are held until we're 14 * a "holding pen" into which all secondary cores are held until we're
diff --git a/arch/arm/mach-prima2/platsmp.c b/arch/arm/mach-prima2/platsmp.c
index 1c3de7bed841..3dbcb1ab6e37 100644
--- a/arch/arm/mach-prima2/platsmp.c
+++ b/arch/arm/mach-prima2/platsmp.c
@@ -44,7 +44,7 @@ void __init sirfsoc_map_scu(void)
44 scu_base = (void __iomem *)SIRFSOC_VA(base); 44 scu_base = (void __iomem *)SIRFSOC_VA(base);
45} 45}
46 46
47static void __cpuinit sirfsoc_secondary_init(unsigned int cpu) 47static void sirfsoc_secondary_init(unsigned int cpu)
48{ 48{
49 /* 49 /*
50 * let the primary processor know we're out of the 50 * let the primary processor know we're out of the
@@ -65,7 +65,7 @@ static struct of_device_id rsc_ids[] = {
65 {}, 65 {},
66}; 66};
67 67
68static int __cpuinit sirfsoc_boot_secondary(unsigned int cpu, struct task_struct *idle) 68static int sirfsoc_boot_secondary(unsigned int cpu, struct task_struct *idle)
69{ 69{
70 unsigned long timeout; 70 unsigned long timeout;
71 struct device_node *np; 71 struct device_node *np;
diff --git a/arch/arm/mach-prima2/rstc.c b/arch/arm/mach-prima2/rstc.c
index d5e0cbc934c0..ccb53391147a 100644
--- a/arch/arm/mach-prima2/rstc.c
+++ b/arch/arm/mach-prima2/rstc.c
@@ -13,6 +13,7 @@
13#include <linux/device.h> 13#include <linux/device.h>
14#include <linux/of.h> 14#include <linux/of.h>
15#include <linux/of_address.h> 15#include <linux/of_address.h>
16#include <linux/reboot.h>
16 17
17void __iomem *sirfsoc_rstc_base; 18void __iomem *sirfsoc_rstc_base;
18static DEFINE_MUTEX(rstc_lock); 19static DEFINE_MUTEX(rstc_lock);
@@ -84,7 +85,7 @@ int sirfsoc_reset_device(struct device *dev)
84 85
85#define SIRFSOC_SYS_RST_BIT BIT(31) 86#define SIRFSOC_SYS_RST_BIT BIT(31)
86 87
87void sirfsoc_restart(char mode, const char *cmd) 88void sirfsoc_restart(enum reboot_mode mode, const char *cmd)
88{ 89{
89 writel(SIRFSOC_SYS_RST_BIT, sirfsoc_rstc_base); 90 writel(SIRFSOC_SYS_RST_BIT, sirfsoc_rstc_base);
90} 91}
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index a5b8fead7d61..f162f1b77cd2 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -663,16 +663,16 @@ static void corgi_poweroff(void)
663 /* Green LED off tells the bootloader to halt */ 663 /* Green LED off tells the bootloader to halt */
664 gpio_set_value(CORGI_GPIO_LED_GREEN, 0); 664 gpio_set_value(CORGI_GPIO_LED_GREEN, 0);
665 665
666 pxa_restart('h', NULL); 666 pxa_restart(REBOOT_HARD, NULL);
667} 667}
668 668
669static void corgi_restart(char mode, const char *cmd) 669static void corgi_restart(enum reboot_mode mode, const char *cmd)
670{ 670{
671 if (!machine_is_corgi()) 671 if (!machine_is_corgi())
672 /* Green LED on tells the bootloader to reboot */ 672 /* Green LED on tells the bootloader to reboot */
673 gpio_set_value(CORGI_GPIO_LED_GREEN, 1); 673 gpio_set_value(CORGI_GPIO_LED_GREEN, 1);
674 674
675 pxa_restart('h', cmd); 675 pxa_restart(REBOOT_HARD, cmd);
676} 676}
677 677
678static void __init corgi_init(void) 678static void __init corgi_init(void)
diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h
index fd7ea39b78c0..8963984d1f43 100644
--- a/arch/arm/mach-pxa/generic.h
+++ b/arch/arm/mach-pxa/generic.h
@@ -9,6 +9,8 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12#include <linux/reboot.h>
13
12struct irq_data; 14struct irq_data;
13 15
14extern void pxa_timer_init(void); 16extern void pxa_timer_init(void);
@@ -56,4 +58,4 @@ void __init pxa_set_btuart_info(void *info);
56void __init pxa_set_stuart_info(void *info); 58void __init pxa_set_stuart_info(void *info);
57void __init pxa_set_hwuart_info(void *info); 59void __init pxa_set_hwuart_info(void *info);
58 60
59void pxa_restart(char, const char *); 61void pxa_restart(enum reboot_mode, const char *);
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
index 654b0ac84dea..acc9d3cc0762 100644
--- a/arch/arm/mach-pxa/mioa701.c
+++ b/arch/arm/mach-pxa/mioa701.c
@@ -37,6 +37,7 @@
37#include <linux/wm97xx.h> 37#include <linux/wm97xx.h>
38#include <linux/mtd/physmap.h> 38#include <linux/mtd/physmap.h>
39#include <linux/usb/gpio_vbus.h> 39#include <linux/usb/gpio_vbus.h>
40#include <linux/reboot.h>
40#include <linux/regulator/max1586.h> 41#include <linux/regulator/max1586.h>
41#include <linux/slab.h> 42#include <linux/slab.h>
42#include <linux/i2c/pxa-i2c.h> 43#include <linux/i2c/pxa-i2c.h>
@@ -696,13 +697,13 @@ static void mioa701_machine_exit(void);
696static void mioa701_poweroff(void) 697static void mioa701_poweroff(void)
697{ 698{
698 mioa701_machine_exit(); 699 mioa701_machine_exit();
699 pxa_restart('s', NULL); 700 pxa_restart(REBOOT_SOFT, NULL);
700} 701}
701 702
702static void mioa701_restart(char c, const char *cmd) 703static void mioa701_restart(enum reboot_mode c, const char *cmd)
703{ 704{
704 mioa701_machine_exit(); 705 mioa701_machine_exit();
705 pxa_restart('s', cmd); 706 pxa_restart(REBOOT_SOFT, cmd);
706} 707}
707 708
708static struct gpio global_gpios[] = { 709static struct gpio global_gpios[] = {
@@ -761,7 +762,6 @@ static void mioa701_machine_exit(void)
761 762
762MACHINE_START(MIOA701, "MIO A701") 763MACHINE_START(MIOA701, "MIO A701")
763 .atag_offset = 0x100, 764 .atag_offset = 0x100,
764 .restart_mode = 's',
765 .map_io = &pxa27x_map_io, 765 .map_io = &pxa27x_map_io,
766 .nr_irqs = PXA_NR_IRQS, 766 .nr_irqs = PXA_NR_IRQS,
767 .init_irq = &pxa27x_init_irq, 767 .init_irq = &pxa27x_init_irq,
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 50ccd5f1d560..711d37e26bd8 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -422,7 +422,7 @@ static struct i2c_board_info __initdata poodle_i2c_devices[] = {
422 422
423static void poodle_poweroff(void) 423static void poodle_poweroff(void)
424{ 424{
425 pxa_restart('h', NULL); 425 pxa_restart(REBOOT_HARD, NULL);
426} 426}
427 427
428static void __init poodle_init(void) 428static void __init poodle_init(void)
diff --git a/arch/arm/mach-pxa/reset.c b/arch/arm/mach-pxa/reset.c
index 3fab583755d4..0d5dd646f61f 100644
--- a/arch/arm/mach-pxa/reset.c
+++ b/arch/arm/mach-pxa/reset.c
@@ -83,7 +83,7 @@ static void do_hw_reset(void)
83 writel_relaxed(readl_relaxed(OSCR) + 368640, OSMR3); 83 writel_relaxed(readl_relaxed(OSCR) + 368640, OSMR3);
84} 84}
85 85
86void pxa_restart(char mode, const char *cmd) 86void pxa_restart(enum reboot_mode mode, const char *cmd)
87{ 87{
88 local_irq_disable(); 88 local_irq_disable();
89 local_fiq_disable(); 89 local_fiq_disable();
@@ -91,14 +91,14 @@ void pxa_restart(char mode, const char *cmd)
91 clear_reset_status(RESET_STATUS_ALL); 91 clear_reset_status(RESET_STATUS_ALL);
92 92
93 switch (mode) { 93 switch (mode) {
94 case 's': 94 case REBOOT_SOFT:
95 /* Jump into ROM at address 0 */ 95 /* Jump into ROM at address 0 */
96 soft_restart(0); 96 soft_restart(0);
97 break; 97 break;
98 case 'g': 98 case REBOOT_GPIO:
99 do_gpio_reset(); 99 do_gpio_reset();
100 break; 100 break;
101 case 'h': 101 case REBOOT_HARD:
102 default: 102 default:
103 do_hw_reset(); 103 do_hw_reset();
104 break; 104 break;
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 362726c49c70..2125df0444e7 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -31,6 +31,7 @@
31#include <linux/regulator/machine.h> 31#include <linux/regulator/machine.h>
32#include <linux/io.h> 32#include <linux/io.h>
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/reboot.h>
34 35
35#include <asm/setup.h> 36#include <asm/setup.h>
36#include <asm/mach-types.h> 37#include <asm/mach-types.h>
@@ -924,10 +925,10 @@ static inline void spitz_i2c_init(void) {}
924 ******************************************************************************/ 925 ******************************************************************************/
925static void spitz_poweroff(void) 926static void spitz_poweroff(void)
926{ 927{
927 pxa_restart('g', NULL); 928 pxa_restart(REBOOT_GPIO, NULL);
928} 929}
929 930
930static void spitz_restart(char mode, const char *cmd) 931static void spitz_restart(enum reboot_mode mode, const char *cmd)
931{ 932{
932 uint32_t msc0 = __raw_readl(MSC0); 933 uint32_t msc0 = __raw_readl(MSC0);
933 /* Bootloader magic for a reboot */ 934 /* Bootloader magic for a reboot */
@@ -979,7 +980,6 @@ static void __init spitz_fixup(struct tag *tags, char **cmdline,
979 980
980#ifdef CONFIG_MACH_SPITZ 981#ifdef CONFIG_MACH_SPITZ
981MACHINE_START(SPITZ, "SHARP Spitz") 982MACHINE_START(SPITZ, "SHARP Spitz")
982 .restart_mode = 'g',
983 .fixup = spitz_fixup, 983 .fixup = spitz_fixup,
984 .map_io = pxa27x_map_io, 984 .map_io = pxa27x_map_io,
985 .nr_irqs = PXA_NR_IRQS, 985 .nr_irqs = PXA_NR_IRQS,
@@ -993,7 +993,6 @@ MACHINE_END
993 993
994#ifdef CONFIG_MACH_BORZOI 994#ifdef CONFIG_MACH_BORZOI
995MACHINE_START(BORZOI, "SHARP Borzoi") 995MACHINE_START(BORZOI, "SHARP Borzoi")
996 .restart_mode = 'g',
997 .fixup = spitz_fixup, 996 .fixup = spitz_fixup,
998 .map_io = pxa27x_map_io, 997 .map_io = pxa27x_map_io,
999 .nr_irqs = PXA_NR_IRQS, 998 .nr_irqs = PXA_NR_IRQS,
@@ -1007,7 +1006,6 @@ MACHINE_END
1007 1006
1008#ifdef CONFIG_MACH_AKITA 1007#ifdef CONFIG_MACH_AKITA
1009MACHINE_START(AKITA, "SHARP Akita") 1008MACHINE_START(AKITA, "SHARP Akita")
1010 .restart_mode = 'g',
1011 .fixup = spitz_fixup, 1009 .fixup = spitz_fixup,
1012 .map_io = pxa27x_map_io, 1010 .map_io = pxa27x_map_io,
1013 .nr_irqs = PXA_NR_IRQS, 1011 .nr_irqs = PXA_NR_IRQS,
diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c
index 8f1ee92aea30..9aa852a8fab9 100644
--- a/arch/arm/mach-pxa/time.c
+++ b/arch/arm/mach-pxa/time.c
@@ -16,11 +16,11 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/clockchips.h> 18#include <linux/clockchips.h>
19#include <linux/sched_clock.h>
19 20
20#include <asm/div64.h> 21#include <asm/div64.h>
21#include <asm/mach/irq.h> 22#include <asm/mach/irq.h>
22#include <asm/mach/time.h> 23#include <asm/mach/time.h>
23#include <asm/sched_clock.h>
24#include <mach/regs-ost.h> 24#include <mach/regs-ost.h>
25#include <mach/irqs.h> 25#include <mach/irqs.h>
26 26
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 3d91d2e5bf3a..0206b915a6f6 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -36,6 +36,7 @@
36#include <linux/input/matrix_keypad.h> 36#include <linux/input/matrix_keypad.h>
37#include <linux/i2c/pxa-i2c.h> 37#include <linux/i2c/pxa-i2c.h>
38#include <linux/usb/gpio_vbus.h> 38#include <linux/usb/gpio_vbus.h>
39#include <linux/reboot.h>
39 40
40#include <asm/setup.h> 41#include <asm/setup.h>
41#include <asm/mach-types.h> 42#include <asm/mach-types.h>
@@ -911,10 +912,10 @@ static struct platform_device *devices[] __initdata = {
911 912
912static void tosa_poweroff(void) 913static void tosa_poweroff(void)
913{ 914{
914 pxa_restart('g', NULL); 915 pxa_restart(REBOOT_GPIO, NULL);
915} 916}
916 917
917static void tosa_restart(char mode, const char *cmd) 918static void tosa_restart(enum reboot_mode mode, const char *cmd)
918{ 919{
919 uint32_t msc0 = __raw_readl(MSC0); 920 uint32_t msc0 = __raw_readl(MSC0);
920 921
@@ -969,7 +970,6 @@ static void __init fixup_tosa(struct tag *tags, char **cmdline,
969} 970}
970 971
971MACHINE_START(TOSA, "SHARP Tosa") 972MACHINE_START(TOSA, "SHARP Tosa")
972 .restart_mode = 'g',
973 .fixup = fixup_tosa, 973 .fixup = fixup_tosa,
974 .map_io = pxa25x_map_io, 974 .map_io = pxa25x_map_io,
975 .nr_irqs = TOSA_NR_IRQS, 975 .nr_irqs = TOSA_NR_IRQS,
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index 5b1c8bfe6fa9..c85ddb2a0ad0 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -29,6 +29,7 @@
29#include <linux/io.h> 29#include <linux/io.h>
30#include <linux/irqchip/arm-gic.h> 30#include <linux/irqchip/arm-gic.h>
31#include <linux/platform_data/clk-realview.h> 31#include <linux/platform_data/clk-realview.h>
32#include <linux/reboot.h>
32 33
33#include <mach/hardware.h> 34#include <mach/hardware.h>
34#include <asm/irq.h> 35#include <asm/irq.h>
@@ -418,7 +419,7 @@ static void __init realview_eb_timer_init(void)
418 realview_eb_twd_init(); 419 realview_eb_twd_init();
419} 420}
420 421
421static void realview_eb_restart(char mode, const char *cmd) 422static void realview_eb_restart(enum reboot_mode mode, const char *cmd)
422{ 423{
423 void __iomem *reset_ctrl = __io_address(REALVIEW_SYS_RESETCTL); 424 void __iomem *reset_ctrl = __io_address(REALVIEW_SYS_RESETCTL);
424 void __iomem *lock_ctrl = __io_address(REALVIEW_SYS_LOCK); 425 void __iomem *lock_ctrl = __io_address(REALVIEW_SYS_LOCK);
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index d5e83a1f6982..c5eade76461b 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -31,6 +31,7 @@
31#include <linux/io.h> 31#include <linux/io.h>
32#include <linux/irqchip/arm-gic.h> 32#include <linux/irqchip/arm-gic.h>
33#include <linux/platform_data/clk-realview.h> 33#include <linux/platform_data/clk-realview.h>
34#include <linux/reboot.h>
34 35
35#include <mach/hardware.h> 36#include <mach/hardware.h>
36#include <asm/irq.h> 37#include <asm/irq.h>
@@ -329,7 +330,7 @@ static void __init realview_pb1176_timer_init(void)
329 realview_timer_init(IRQ_DC1176_TIMER0); 330 realview_timer_init(IRQ_DC1176_TIMER0);
330} 331}
331 332
332static void realview_pb1176_restart(char mode, const char *cmd) 333static void realview_pb1176_restart(enum reboot_mode mode, const char *cmd)
333{ 334{
334 void __iomem *reset_ctrl = __io_address(REALVIEW_SYS_RESETCTL); 335 void __iomem *reset_ctrl = __io_address(REALVIEW_SYS_RESETCTL);
335 void __iomem *lock_ctrl = __io_address(REALVIEW_SYS_LOCK); 336 void __iomem *lock_ctrl = __io_address(REALVIEW_SYS_LOCK);
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index c3cfe213b5e6..f4b0962578fe 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -29,6 +29,7 @@
29#include <linux/io.h> 29#include <linux/io.h>
30#include <linux/irqchip/arm-gic.h> 30#include <linux/irqchip/arm-gic.h>
31#include <linux/platform_data/clk-realview.h> 31#include <linux/platform_data/clk-realview.h>
32#include <linux/reboot.h>
32 33
33#include <mach/hardware.h> 34#include <mach/hardware.h>
34#include <asm/irq.h> 35#include <asm/irq.h>
@@ -316,7 +317,7 @@ static void __init realview_pb11mp_timer_init(void)
316 realview_pb11mp_twd_init(); 317 realview_pb11mp_twd_init();
317} 318}
318 319
319static void realview_pb11mp_restart(char mode, const char *cmd) 320static void realview_pb11mp_restart(enum reboot_mode mode, const char *cmd)
320{ 321{
321 void __iomem *reset_ctrl = __io_address(REALVIEW_SYS_RESETCTL); 322 void __iomem *reset_ctrl = __io_address(REALVIEW_SYS_RESETCTL);
322 void __iomem *lock_ctrl = __io_address(REALVIEW_SYS_LOCK); 323 void __iomem *lock_ctrl = __io_address(REALVIEW_SYS_LOCK);
diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c
index dde652a59620..10a3e1d76891 100644
--- a/arch/arm/mach-realview/realview_pba8.c
+++ b/arch/arm/mach-realview/realview_pba8.c
@@ -29,6 +29,7 @@
29#include <linux/io.h> 29#include <linux/io.h>
30#include <linux/irqchip/arm-gic.h> 30#include <linux/irqchip/arm-gic.h>
31#include <linux/platform_data/clk-realview.h> 31#include <linux/platform_data/clk-realview.h>
32#include <linux/reboot.h>
32 33
33#include <asm/irq.h> 34#include <asm/irq.h>
34#include <asm/mach-types.h> 35#include <asm/mach-types.h>
@@ -264,7 +265,7 @@ static void __init realview_pba8_timer_init(void)
264 realview_timer_init(IRQ_PBA8_TIMER0_1); 265 realview_timer_init(IRQ_PBA8_TIMER0_1);
265} 266}
266 267
267static void realview_pba8_restart(char mode, const char *cmd) 268static void realview_pba8_restart(enum reboot_mode mode, const char *cmd)
268{ 269{
269 void __iomem *reset_ctrl = __io_address(REALVIEW_SYS_RESETCTL); 270 void __iomem *reset_ctrl = __io_address(REALVIEW_SYS_RESETCTL);
270 void __iomem *lock_ctrl = __io_address(REALVIEW_SYS_LOCK); 271 void __iomem *lock_ctrl = __io_address(REALVIEW_SYS_LOCK);
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index 54f0185b01e3..9d75493e3f0c 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -28,6 +28,7 @@
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/irqchip/arm-gic.h> 29#include <linux/irqchip/arm-gic.h>
30#include <linux/platform_data/clk-realview.h> 30#include <linux/platform_data/clk-realview.h>
31#include <linux/reboot.h>
31 32
32#include <asm/irq.h> 33#include <asm/irq.h>
33#include <asm/mach-types.h> 34#include <asm/mach-types.h>
@@ -344,7 +345,7 @@ static void realview_pbx_fixup(struct tag *tags, char **from,
344#endif 345#endif
345} 346}
346 347
347static void realview_pbx_restart(char mode, const char *cmd) 348static void realview_pbx_restart(enum reboot_mode mode, const char *cmd)
348{ 349{
349 void __iomem *reset_ctrl = __io_address(REALVIEW_SYS_RESETCTL); 350 void __iomem *reset_ctrl = __io_address(REALVIEW_SYS_RESETCTL);
350 void __iomem *lock_ctrl = __io_address(REALVIEW_SYS_LOCK); 351 void __iomem *lock_ctrl = __io_address(REALVIEW_SYS_LOCK);
diff --git a/arch/arm/mach-rpc/riscpc.c b/arch/arm/mach-rpc/riscpc.c
index a302cf5e0fc7..09d602b10d57 100644
--- a/arch/arm/mach-rpc/riscpc.c
+++ b/arch/arm/mach-rpc/riscpc.c
@@ -20,6 +20,7 @@
20#include <linux/ata_platform.h> 20#include <linux/ata_platform.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/i2c.h> 22#include <linux/i2c.h>
23#include <linux/reboot.h>
23 24
24#include <asm/elf.h> 25#include <asm/elf.h>
25#include <asm/mach-types.h> 26#include <asm/mach-types.h>
@@ -201,7 +202,7 @@ static int __init rpc_init(void)
201 202
202arch_initcall(rpc_init); 203arch_initcall(rpc_init);
203 204
204static void rpc_restart(char mode, const char *cmd) 205static void rpc_restart(enum reboot_mode mode, const char *cmd)
205{ 206{
206 iomd_writeb(0, IOMD_ROMCR0); 207 iomd_writeb(0, IOMD_ROMCR0);
207 208
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index 6d9252e081ce..7791ac76f945 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -208,7 +208,7 @@ config S3C24XX_GPIO_EXTRA128
208 208
209config S3C24XX_PLL 209config S3C24XX_PLL
210 bool "Support CPUfreq changing of PLL frequency (EXPERIMENTAL)" 210 bool "Support CPUfreq changing of PLL frequency (EXPERIMENTAL)"
211 depends on ARM_S3C24XX 211 depends on ARM_S3C24XX_CPUFREQ
212 help 212 help
213 Compile in support for changing the PLL frequency from the 213 Compile in support for changing the PLL frequency from the
214 S3C24XX series CPUfreq driver. The PLL takes time to settle 214 S3C24XX series CPUfreq driver. The PLL takes time to settle
diff --git a/arch/arm/mach-s3c24xx/common.h b/arch/arm/mach-s3c24xx/common.h
index 307c3714be55..84b280654f4c 100644
--- a/arch/arm/mach-s3c24xx/common.h
+++ b/arch/arm/mach-s3c24xx/common.h
@@ -12,6 +12,8 @@
12#ifndef __ARCH_ARM_MACH_S3C24XX_COMMON_H 12#ifndef __ARCH_ARM_MACH_S3C24XX_COMMON_H
13#define __ARCH_ARM_MACH_S3C24XX_COMMON_H __FILE__ 13#define __ARCH_ARM_MACH_S3C24XX_COMMON_H __FILE__
14 14
15#include <linux/reboot.h>
16
15struct s3c2410_uartcfg; 17struct s3c2410_uartcfg;
16 18
17#ifdef CONFIG_CPU_S3C2410 19#ifdef CONFIG_CPU_S3C2410
@@ -20,7 +22,7 @@ extern int s3c2410a_init(void);
20extern void s3c2410_map_io(void); 22extern void s3c2410_map_io(void);
21extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no); 23extern void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no);
22extern void s3c2410_init_clocks(int xtal); 24extern void s3c2410_init_clocks(int xtal);
23extern void s3c2410_restart(char mode, const char *cmd); 25extern void s3c2410_restart(enum reboot_mode mode, const char *cmd);
24extern void s3c2410_init_irq(void); 26extern void s3c2410_init_irq(void);
25#else 27#else
26#define s3c2410_init_clocks NULL 28#define s3c2410_init_clocks NULL
@@ -36,7 +38,7 @@ extern void s3c2412_map_io(void);
36extern void s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no); 38extern void s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no);
37extern void s3c2412_init_clocks(int xtal); 39extern void s3c2412_init_clocks(int xtal);
38extern int s3c2412_baseclk_add(void); 40extern int s3c2412_baseclk_add(void);
39extern void s3c2412_restart(char mode, const char *cmd); 41extern void s3c2412_restart(enum reboot_mode mode, const char *cmd);
40extern void s3c2412_init_irq(void); 42extern void s3c2412_init_irq(void);
41#else 43#else
42#define s3c2412_init_clocks NULL 44#define s3c2412_init_clocks NULL
@@ -51,7 +53,7 @@ extern void s3c2416_map_io(void);
51extern void s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no); 53extern void s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no);
52extern void s3c2416_init_clocks(int xtal); 54extern void s3c2416_init_clocks(int xtal);
53extern int s3c2416_baseclk_add(void); 55extern int s3c2416_baseclk_add(void);
54extern void s3c2416_restart(char mode, const char *cmd); 56extern void s3c2416_restart(enum reboot_mode mode, const char *cmd);
55extern void s3c2416_init_irq(void); 57extern void s3c2416_init_irq(void);
56 58
57extern struct syscore_ops s3c2416_irq_syscore_ops; 59extern struct syscore_ops s3c2416_irq_syscore_ops;
@@ -66,7 +68,7 @@ extern struct syscore_ops s3c2416_irq_syscore_ops;
66extern void s3c244x_map_io(void); 68extern void s3c244x_map_io(void);
67extern void s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no); 69extern void s3c244x_init_uarts(struct s3c2410_uartcfg *cfg, int no);
68extern void s3c244x_init_clocks(int xtal); 70extern void s3c244x_init_clocks(int xtal);
69extern void s3c244x_restart(char mode, const char *cmd); 71extern void s3c244x_restart(enum reboot_mode mode, const char *cmd);
70#else 72#else
71#define s3c244x_init_clocks NULL 73#define s3c244x_init_clocks NULL
72#define s3c244x_init_uarts NULL 74#define s3c244x_init_uarts NULL
@@ -96,7 +98,7 @@ extern void s3c2443_map_io(void);
96extern void s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no); 98extern void s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no);
97extern void s3c2443_init_clocks(int xtal); 99extern void s3c2443_init_clocks(int xtal);
98extern int s3c2443_baseclk_add(void); 100extern int s3c2443_baseclk_add(void);
99extern void s3c2443_restart(char mode, const char *cmd); 101extern void s3c2443_restart(enum reboot_mode mode, const char *cmd);
100extern void s3c2443_init_irq(void); 102extern void s3c2443_init_irq(void);
101#else 103#else
102#define s3c2443_init_clocks NULL 104#define s3c2443_init_clocks NULL
diff --git a/arch/arm/mach-s3c24xx/s3c2410.c b/arch/arm/mach-s3c24xx/s3c2410.c
index ff384acc65b2..34676d1d5fec 100644
--- a/arch/arm/mach-s3c24xx/s3c2410.c
+++ b/arch/arm/mach-s3c24xx/s3c2410.c
@@ -22,6 +22,7 @@
22#include <linux/syscore_ops.h> 22#include <linux/syscore_ops.h>
23#include <linux/serial_core.h> 23#include <linux/serial_core.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/reboot.h>
25#include <linux/io.h> 26#include <linux/io.h>
26 27
27#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
@@ -196,9 +197,9 @@ int __init s3c2410a_init(void)
196 return s3c2410_init(); 197 return s3c2410_init();
197} 198}
198 199
199void s3c2410_restart(char mode, const char *cmd) 200void s3c2410_restart(enum reboot_mode mode, const char *cmd)
200{ 201{
201 if (mode == 's') { 202 if (mode == REBOOT_SOFT) {
202 soft_restart(0); 203 soft_restart(0);
203 } 204 }
204 205
diff --git a/arch/arm/mach-s3c24xx/s3c2412.c b/arch/arm/mach-s3c24xx/s3c2412.c
index 0f864d4c97de..0251650cbf80 100644
--- a/arch/arm/mach-s3c24xx/s3c2412.c
+++ b/arch/arm/mach-s3c24xx/s3c2412.c
@@ -22,6 +22,7 @@
22#include <linux/serial_core.h> 22#include <linux/serial_core.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/reboot.h>
25 26
26#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
27#include <asm/mach/map.h> 28#include <asm/mach/map.h>
@@ -129,9 +130,9 @@ static void s3c2412_idle(void)
129 cpu_do_idle(); 130 cpu_do_idle();
130} 131}
131 132
132void s3c2412_restart(char mode, const char *cmd) 133void s3c2412_restart(enum reboot_mode mode, const char *cmd)
133{ 134{
134 if (mode == 's') 135 if (mode == REBOOT_SOFT)
135 soft_restart(0); 136 soft_restart(0);
136 137
137 /* errata "Watch-dog/Software Reset Problem" specifies that 138 /* errata "Watch-dog/Software Reset Problem" specifies that
diff --git a/arch/arm/mach-s3c24xx/s3c2416.c b/arch/arm/mach-s3c24xx/s3c2416.c
index b9c5d382dafb..9ef3ccfbe196 100644
--- a/arch/arm/mach-s3c24xx/s3c2416.c
+++ b/arch/arm/mach-s3c24xx/s3c2416.c
@@ -35,6 +35,7 @@
35#include <linux/syscore_ops.h> 35#include <linux/syscore_ops.h>
36#include <linux/clk.h> 36#include <linux/clk.h>
37#include <linux/io.h> 37#include <linux/io.h>
38#include <linux/reboot.h>
38 39
39#include <asm/mach/arch.h> 40#include <asm/mach/arch.h>
40#include <asm/mach/map.h> 41#include <asm/mach/map.h>
@@ -79,9 +80,9 @@ static struct device s3c2416_dev = {
79 .bus = &s3c2416_subsys, 80 .bus = &s3c2416_subsys,
80}; 81};
81 82
82void s3c2416_restart(char mode, const char *cmd) 83void s3c2416_restart(enum reboot_mode mode, const char *cmd)
83{ 84{
84 if (mode == 's') 85 if (mode == REBOOT_SOFT)
85 soft_restart(0); 86 soft_restart(0);
86 87
87 __raw_writel(S3C2443_SWRST_RESET, S3C2443_SWRST); 88 __raw_writel(S3C2443_SWRST_RESET, S3C2443_SWRST);
diff --git a/arch/arm/mach-s3c24xx/s3c2443.c b/arch/arm/mach-s3c24xx/s3c2443.c
index 8328cd65bf3d..b6c71918b25c 100644
--- a/arch/arm/mach-s3c24xx/s3c2443.c
+++ b/arch/arm/mach-s3c24xx/s3c2443.c
@@ -22,6 +22,7 @@
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/reboot.h>
25 26
26#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
27#include <asm/mach/map.h> 28#include <asm/mach/map.h>
@@ -59,9 +60,9 @@ static struct device s3c2443_dev = {
59 .bus = &s3c2443_subsys, 60 .bus = &s3c2443_subsys,
60}; 61};
61 62
62void s3c2443_restart(char mode, const char *cmd) 63void s3c2443_restart(enum reboot_mode mode, const char *cmd)
63{ 64{
64 if (mode == 's') 65 if (mode == REBOOT_SOFT)
65 soft_restart(0); 66 soft_restart(0);
66 67
67 __raw_writel(S3C2443_SWRST_RESET, S3C2443_SWRST); 68 __raw_writel(S3C2443_SWRST_RESET, S3C2443_SWRST);
diff --git a/arch/arm/mach-s3c24xx/s3c244x.c b/arch/arm/mach-s3c24xx/s3c244x.c
index d0423e2544c1..911b555029fc 100644
--- a/arch/arm/mach-s3c24xx/s3c244x.c
+++ b/arch/arm/mach-s3c24xx/s3c244x.c
@@ -18,6 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/serial_core.h> 19#include <linux/serial_core.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/reboot.h>
21#include <linux/device.h> 22#include <linux/device.h>
22#include <linux/syscore_ops.h> 23#include <linux/syscore_ops.h>
23#include <linux/clk.h> 24#include <linux/clk.h>
@@ -198,9 +199,9 @@ struct syscore_ops s3c244x_pm_syscore_ops = {
198 .resume = s3c244x_resume, 199 .resume = s3c244x_resume,
199}; 200};
200 201
201void s3c244x_restart(char mode, const char *cmd) 202void s3c244x_restart(enum reboot_mode mode, const char *cmd)
202{ 203{
203 if (mode == 's') 204 if (mode == REBOOT_SOFT)
204 soft_restart(0); 205 soft_restart(0);
205 206
206 samsung_wdt_reset(); 207 samsung_wdt_reset();
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index 1aed6f4be1ce..3f62e467b129 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -21,6 +21,7 @@
21#include <linux/ioport.h> 21#include <linux/ioport.h>
22#include <linux/serial_core.h> 22#include <linux/serial_core.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/reboot.h>
24#include <linux/io.h> 25#include <linux/io.h>
25#include <linux/dma-mapping.h> 26#include <linux/dma-mapping.h>
26#include <linux/irq.h> 27#include <linux/irq.h>
@@ -381,9 +382,9 @@ static int __init s3c64xx_init_irq_eint(void)
381} 382}
382arch_initcall(s3c64xx_init_irq_eint); 383arch_initcall(s3c64xx_init_irq_eint);
383 384
384void s3c64xx_restart(char mode, const char *cmd) 385void s3c64xx_restart(enum reboot_mode mode, const char *cmd)
385{ 386{
386 if (mode != 's') 387 if (mode != REBOOT_SOFT)
387 samsung_wdt_reset(); 388 samsung_wdt_reset();
388 389
389 /* if all else fails, or mode was for soft, jump to 0 */ 390 /* if all else fails, or mode was for soft, jump to 0 */
diff --git a/arch/arm/mach-s3c64xx/common.h b/arch/arm/mach-s3c64xx/common.h
index 6cfc99bdfb37..e8f990b37665 100644
--- a/arch/arm/mach-s3c64xx/common.h
+++ b/arch/arm/mach-s3c64xx/common.h
@@ -17,13 +17,15 @@
17#ifndef __ARCH_ARM_MACH_S3C64XX_COMMON_H 17#ifndef __ARCH_ARM_MACH_S3C64XX_COMMON_H
18#define __ARCH_ARM_MACH_S3C64XX_COMMON_H 18#define __ARCH_ARM_MACH_S3C64XX_COMMON_H
19 19
20#include <linux/reboot.h>
21
20void s3c64xx_init_irq(u32 vic0, u32 vic1); 22void s3c64xx_init_irq(u32 vic0, u32 vic1);
21void s3c64xx_init_io(struct map_desc *mach_desc, int size); 23void s3c64xx_init_io(struct map_desc *mach_desc, int size);
22 24
23void s3c64xx_register_clocks(unsigned long xtal, unsigned armclk_limit); 25void s3c64xx_register_clocks(unsigned long xtal, unsigned armclk_limit);
24void s3c64xx_setup_clocks(void); 26void s3c64xx_setup_clocks(void);
25 27
26void s3c64xx_restart(char mode, const char *cmd); 28void s3c64xx_restart(enum reboot_mode mode, const char *cmd);
27void s3c64xx_init_late(void); 29void s3c64xx_init_late(void);
28 30
29#ifdef CONFIG_CPU_S3C6400 31#ifdef CONFIG_CPU_S3C6400
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c
index 76d0053bf564..dfdfdc320ce7 100644
--- a/arch/arm/mach-s5p64x0/common.c
+++ b/arch/arm/mach-s5p64x0/common.c
@@ -24,6 +24,7 @@
24#include <linux/dma-mapping.h> 24#include <linux/dma-mapping.h>
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <linux/irq.h> 26#include <linux/irq.h>
27#include <linux/reboot.h>
27 28
28#include <asm/irq.h> 29#include <asm/irq.h>
29#include <asm/proc-fns.h> 30#include <asm/proc-fns.h>
@@ -439,9 +440,9 @@ static int __init s5p64x0_init_irq_eint(void)
439} 440}
440arch_initcall(s5p64x0_init_irq_eint); 441arch_initcall(s5p64x0_init_irq_eint);
441 442
442void s5p64x0_restart(char mode, const char *cmd) 443void s5p64x0_restart(enum reboot_mode mode, const char *cmd)
443{ 444{
444 if (mode != 's') 445 if (mode != REBOOT_SOFT)
445 samsung_wdt_reset(); 446 samsung_wdt_reset();
446 447
447 soft_restart(0); 448 soft_restart(0);
diff --git a/arch/arm/mach-s5p64x0/common.h b/arch/arm/mach-s5p64x0/common.h
index f8a60fdc5884..f3a9b43cba4a 100644
--- a/arch/arm/mach-s5p64x0/common.h
+++ b/arch/arm/mach-s5p64x0/common.h
@@ -12,6 +12,8 @@
12#ifndef __ARCH_ARM_MACH_S5P64X0_COMMON_H 12#ifndef __ARCH_ARM_MACH_S5P64X0_COMMON_H
13#define __ARCH_ARM_MACH_S5P64X0_COMMON_H 13#define __ARCH_ARM_MACH_S5P64X0_COMMON_H
14 14
15#include <linux/reboot.h>
16
15void s5p6440_init_irq(void); 17void s5p6440_init_irq(void);
16void s5p6450_init_irq(void); 18void s5p6450_init_irq(void);
17void s5p64x0_init_io(struct map_desc *mach_desc, int size); 19void s5p64x0_init_io(struct map_desc *mach_desc, int size);
@@ -22,7 +24,7 @@ void s5p6440_setup_clocks(void);
22void s5p6450_register_clocks(void); 24void s5p6450_register_clocks(void);
23void s5p6450_setup_clocks(void); 25void s5p6450_setup_clocks(void);
24 26
25void s5p64x0_restart(char mode, const char *cmd); 27void s5p64x0_restart(enum reboot_mode mode, const char *cmd);
26 28
27#ifdef CONFIG_CPU_S5P6440 29#ifdef CONFIG_CPU_S5P6440
28 30
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
index 511031564d35..4bdfecf6d024 100644
--- a/arch/arm/mach-s5pc100/common.c
+++ b/arch/arm/mach-s5pc100/common.c
@@ -24,6 +24,7 @@
24#include <linux/serial_core.h> 24#include <linux/serial_core.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/sched.h> 26#include <linux/sched.h>
27#include <linux/reboot.h>
27 28
28#include <asm/irq.h> 29#include <asm/irq.h>
29#include <asm/proc-fns.h> 30#include <asm/proc-fns.h>
@@ -217,9 +218,9 @@ void __init s5pc100_init_uarts(struct s3c2410_uartcfg *cfg, int no)
217 s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no); 218 s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no);
218} 219}
219 220
220void s5pc100_restart(char mode, const char *cmd) 221void s5pc100_restart(enum reboot_mode mode, const char *cmd)
221{ 222{
222 if (mode != 's') 223 if (mode != REBOOT_SOFT)
223 samsung_wdt_reset(); 224 samsung_wdt_reset();
224 225
225 soft_restart(0); 226 soft_restart(0);
diff --git a/arch/arm/mach-s5pc100/common.h b/arch/arm/mach-s5pc100/common.h
index c41f912e9e1f..08d782d65d7b 100644
--- a/arch/arm/mach-s5pc100/common.h
+++ b/arch/arm/mach-s5pc100/common.h
@@ -12,13 +12,15 @@
12#ifndef __ARCH_ARM_MACH_S5PC100_COMMON_H 12#ifndef __ARCH_ARM_MACH_S5PC100_COMMON_H
13#define __ARCH_ARM_MACH_S5PC100_COMMON_H 13#define __ARCH_ARM_MACH_S5PC100_COMMON_H
14 14
15#include <linux/reboot.h>
16
15void s5pc100_init_io(struct map_desc *mach_desc, int size); 17void s5pc100_init_io(struct map_desc *mach_desc, int size);
16void s5pc100_init_irq(void); 18void s5pc100_init_irq(void);
17 19
18void s5pc100_register_clocks(void); 20void s5pc100_register_clocks(void);
19void s5pc100_setup_clocks(void); 21void s5pc100_setup_clocks(void);
20 22
21void s5pc100_restart(char mode, const char *cmd); 23void s5pc100_restart(enum reboot_mode mode, const char *cmd);
22 24
23extern int s5pc100_init(void); 25extern int s5pc100_init(void);
24extern void s5pc100_map_io(void); 26extern void s5pc100_map_io(void);
diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
index 9dfe93e2624d..023f1a796a9c 100644
--- a/arch/arm/mach-s5pv210/common.c
+++ b/arch/arm/mach-s5pv210/common.c
@@ -143,7 +143,7 @@ static struct map_desc s5pv210_iodesc[] __initdata = {
143 } 143 }
144}; 144};
145 145
146void s5pv210_restart(char mode, const char *cmd) 146void s5pv210_restart(enum reboot_mode mode, const char *cmd)
147{ 147{
148 __raw_writel(0x1, S5P_SWRESET); 148 __raw_writel(0x1, S5P_SWRESET);
149} 149}
diff --git a/arch/arm/mach-s5pv210/common.h b/arch/arm/mach-s5pv210/common.h
index 0a1cc0aef720..fe1beb54e548 100644
--- a/arch/arm/mach-s5pv210/common.h
+++ b/arch/arm/mach-s5pv210/common.h
@@ -12,13 +12,15 @@
12#ifndef __ARCH_ARM_MACH_S5PV210_COMMON_H 12#ifndef __ARCH_ARM_MACH_S5PV210_COMMON_H
13#define __ARCH_ARM_MACH_S5PV210_COMMON_H 13#define __ARCH_ARM_MACH_S5PV210_COMMON_H
14 14
15#include <linux/reboot.h>
16
15void s5pv210_init_io(struct map_desc *mach_desc, int size); 17void s5pv210_init_io(struct map_desc *mach_desc, int size);
16void s5pv210_init_irq(void); 18void s5pv210_init_irq(void);
17 19
18void s5pv210_register_clocks(void); 20void s5pv210_register_clocks(void);
19void s5pv210_setup_clocks(void); 21void s5pv210_setup_clocks(void);
20 22
21void s5pv210_restart(char mode, const char *cmd); 23void s5pv210_restart(enum reboot_mode mode, const char *cmd);
22 24
23extern int s5pv210_init(void); 25extern int s5pv210_init(void);
24extern void s5pv210_map_io(void); 26extern void s5pv210_map_io(void);
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
index ed2b85485b9d..ad40ab0f5dbd 100644
--- a/arch/arm/mach-s5pv210/mach-aquila.c
+++ b/arch/arm/mach-s5pv210/mach-aquila.c
@@ -377,12 +377,8 @@ static struct max8998_platform_data aquila_max8998_pdata = {
377 .buck1_set1 = S5PV210_GPH0(3), 377 .buck1_set1 = S5PV210_GPH0(3),
378 .buck1_set2 = S5PV210_GPH0(4), 378 .buck1_set2 = S5PV210_GPH0(4),
379 .buck2_set3 = S5PV210_GPH0(5), 379 .buck2_set3 = S5PV210_GPH0(5),
380 .buck1_voltage1 = 1200000, 380 .buck1_voltage = { 1200000, 1200000, 1200000, 1200000 },
381 .buck1_voltage2 = 1200000, 381 .buck2_voltage = { 1200000, 1200000 },
382 .buck1_voltage3 = 1200000,
383 .buck1_voltage4 = 1200000,
384 .buck2_voltage1 = 1200000,
385 .buck2_voltage2 = 1200000,
386}; 382};
387#endif 383#endif
388 384
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index 30b24ad84f49..e5cd9fbf19e9 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -580,12 +580,8 @@ static struct max8998_platform_data goni_max8998_pdata = {
580 .buck1_set1 = S5PV210_GPH0(3), 580 .buck1_set1 = S5PV210_GPH0(3),
581 .buck1_set2 = S5PV210_GPH0(4), 581 .buck1_set2 = S5PV210_GPH0(4),
582 .buck2_set3 = S5PV210_GPH0(5), 582 .buck2_set3 = S5PV210_GPH0(5),
583 .buck1_voltage1 = 1200000, 583 .buck1_voltage = { 1200000, 1200000, 1200000, 1200000 },
584 .buck1_voltage2 = 1200000, 584 .buck2_voltage = { 1200000, 1200000 },
585 .buck1_voltage3 = 1200000,
586 .buck1_voltage4 = 1200000,
587 .buck2_voltage1 = 1200000,
588 .buck2_voltage2 = 1200000,
589}; 585};
590#endif 586#endif
591 587
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 9db3e98e8b85..f25b6119e028 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -19,6 +19,7 @@
19#include <linux/cpufreq.h> 19#include <linux/cpufreq.h>
20#include <linux/ioport.h> 20#include <linux/ioport.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/reboot.h>
22 23
23#include <video/sa1100fb.h> 24#include <video/sa1100fb.h>
24 25
@@ -131,9 +132,9 @@ static void sa1100_power_off(void)
131 PMCR = PMCR_SF; 132 PMCR = PMCR_SF;
132} 133}
133 134
134void sa11x0_restart(char mode, const char *cmd) 135void sa11x0_restart(enum reboot_mode mode, const char *cmd)
135{ 136{
136 if (mode == 's') { 137 if (mode == REBOOT_SOFT) {
137 /* Jump into ROM at address 0 */ 138 /* Jump into ROM at address 0 */
138 soft_restart(0); 139 soft_restart(0);
139 } else { 140 } else {
diff --git a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h
index 2abc6a1f6e86..9a33695c9492 100644
--- a/arch/arm/mach-sa1100/generic.h
+++ b/arch/arm/mach-sa1100/generic.h
@@ -3,12 +3,13 @@
3 * 3 *
4 * Author: Nicolas Pitre 4 * Author: Nicolas Pitre
5 */ 5 */
6#include <linux/reboot.h>
6 7
7extern void sa1100_timer_init(void); 8extern void sa1100_timer_init(void);
8extern void __init sa1100_map_io(void); 9extern void __init sa1100_map_io(void);
9extern void __init sa1100_init_irq(void); 10extern void __init sa1100_init_irq(void);
10extern void __init sa1100_init_gpio(void); 11extern void __init sa1100_init_gpio(void);
11extern void sa11x0_restart(char, const char *); 12extern void sa11x0_restart(enum reboot_mode, const char *);
12extern void sa11x0_init_late(void); 13extern void sa11x0_init_late(void);
13 14
14#define SET_BANK(__nr,__start,__size) \ 15#define SET_BANK(__nr,__start,__size) \
diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c
index a59a13a665a6..713c86cd3d64 100644
--- a/arch/arm/mach-sa1100/time.c
+++ b/arch/arm/mach-sa1100/time.c
@@ -14,9 +14,9 @@
14#include <linux/irq.h> 14#include <linux/irq.h>
15#include <linux/timex.h> 15#include <linux/timex.h>
16#include <linux/clockchips.h> 16#include <linux/clockchips.h>
17#include <linux/sched_clock.h>
17 18
18#include <asm/mach/time.h> 19#include <asm/mach/time.h>
19#include <asm/sched_clock.h>
20#include <mach/hardware.h> 20#include <mach/hardware.h>
21#include <mach/irqs.h> 21#include <mach/irqs.h>
22 22
diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c
index 153555724988..1d32c5e8eab6 100644
--- a/arch/arm/mach-shark/core.c
+++ b/arch/arm/mach-shark/core.c
@@ -11,6 +11,7 @@
11#include <linux/serial_8250.h> 11#include <linux/serial_8250.h>
12#include <linux/io.h> 12#include <linux/io.h>
13#include <linux/cpu.h> 13#include <linux/cpu.h>
14#include <linux/reboot.h>
14 15
15#include <asm/setup.h> 16#include <asm/setup.h>
16#include <asm/mach-types.h> 17#include <asm/mach-types.h>
@@ -24,7 +25,7 @@
24#define ROMCARD_SIZE 0x08000000 25#define ROMCARD_SIZE 0x08000000
25#define ROMCARD_START 0x10000000 26#define ROMCARD_START 0x10000000
26 27
27static void shark_restart(char mode, const char *cmd) 28static void shark_restart(enum reboot_mode mode, const char *cmd)
28{ 29{
29 short temp; 30 short temp;
30 /* Reset the Machine via pc[3] of the sequoia chipset */ 31 /* Reset the Machine via pc[3] of the sequoia chipset */
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 44a621505eeb..e115f6742107 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -42,6 +42,7 @@
42#include <linux/mmc/sh_mmcif.h> 42#include <linux/mmc/sh_mmcif.h>
43#include <linux/mmc/sh_mobile_sdhi.h> 43#include <linux/mmc/sh_mobile_sdhi.h>
44#include <linux/i2c-gpio.h> 44#include <linux/i2c-gpio.h>
45#include <linux/reboot.h>
45#include <mach/common.h> 46#include <mach/common.h>
46#include <mach/irqs.h> 47#include <mach/irqs.h>
47#include <mach/r8a7740.h> 48#include <mach/r8a7740.h>
@@ -377,7 +378,7 @@ static struct resource sh_eth_resources[] = {
377}; 378};
378 379
379static struct platform_device sh_eth_device = { 380static struct platform_device sh_eth_device = {
380 .name = "sh-eth", 381 .name = "r8a7740-gether",
381 .id = -1, 382 .id = -1,
382 .dev = { 383 .dev = {
383 .platform_data = &sh_eth_platdata, 384 .platform_data = &sh_eth_platdata,
@@ -1259,7 +1260,7 @@ static void __init eva_add_early_devices(void)
1259} 1260}
1260 1261
1261#define RESCNT2 IOMEM(0xe6188020) 1262#define RESCNT2 IOMEM(0xe6188020)
1262static void eva_restart(char mode, const char *cmd) 1263static void eva_restart(enum reboot_mode mode, const char *cmd)
1263{ 1264{
1264 /* Do soft power on reset */ 1265 /* Do soft power on reset */
1265 writel((1 << 31), RESCNT2); 1266 writel((1 << 31), RESCNT2);
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index 165483c9bee2..1068120d339f 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -34,6 +34,7 @@
34#include <linux/pinctrl/machine.h> 34#include <linux/pinctrl/machine.h>
35#include <linux/pinctrl/pinconf-generic.h> 35#include <linux/pinctrl/pinconf-generic.h>
36#include <linux/platform_device.h> 36#include <linux/platform_device.h>
37#include <linux/reboot.h>
37#include <linux/regulator/fixed.h> 38#include <linux/regulator/fixed.h>
38#include <linux/regulator/machine.h> 39#include <linux/regulator/machine.h>
39#include <linux/smsc911x.h> 40#include <linux/smsc911x.h>
@@ -890,7 +891,7 @@ static void __init kzm_init(void)
890 sh73a0_pm_init(); 891 sh73a0_pm_init();
891} 892}
892 893
893static void kzm9g_restart(char mode, const char *cmd) 894static void kzm9g_restart(enum reboot_mode mode, const char *cmd)
894{ 895{
895#define RESCNT2 IOMEM(0xe6188020) 896#define RESCNT2 IOMEM(0xe6188020)
896 /* Do soft power on reset */ 897 /* Do soft power on reset */
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
index 7fd32d604e34..de10fd78bf2b 100644
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ b/arch/arm/mach-shmobile/clock-r8a7740.c
@@ -594,7 +594,7 @@ static struct clk_lookup lookups[] = {
594 CLKDEV_DEV_ID("e6860000.sdhi", &mstp_clks[MSTP313]), 594 CLKDEV_DEV_ID("e6860000.sdhi", &mstp_clks[MSTP313]),
595 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]), 595 CLKDEV_DEV_ID("sh_mmcif", &mstp_clks[MSTP312]),
596 CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]), 596 CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]),
597 CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP309]), 597 CLKDEV_DEV_ID("r8a7740-gether", &mstp_clks[MSTP309]),
598 CLKDEV_DEV_ID("e9a00000.sh-eth", &mstp_clks[MSTP309]), 598 CLKDEV_DEV_ID("e9a00000.sh-eth", &mstp_clks[MSTP309]),
599 CLKDEV_DEV_ID("renesas_tpu_pwm", &mstp_clks[MSTP304]), 599 CLKDEV_DEV_ID("renesas_tpu_pwm", &mstp_clks[MSTP304]),
600 600
diff --git a/arch/arm/mach-shmobile/clock-r8a7778.c b/arch/arm/mach-shmobile/clock-r8a7778.c
index 53798e5037d7..a0e9eb72e46d 100644
--- a/arch/arm/mach-shmobile/clock-r8a7778.c
+++ b/arch/arm/mach-shmobile/clock-r8a7778.c
@@ -145,7 +145,7 @@ static struct clk_lookup lookups[] = {
145 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP323]), /* SDHI0 */ 145 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP323]), /* SDHI0 */
146 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */ 146 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */
147 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */ 147 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */
148 CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP114]), /* Ether */ 148 CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
149 CLKDEV_DEV_ID("ehci-platform", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */ 149 CLKDEV_DEV_ID("ehci-platform", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */
150 CLKDEV_DEV_ID("ohci-platform", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */ 150 CLKDEV_DEV_ID("ohci-platform", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */
151 CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */ 151 CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */
diff --git a/arch/arm/mach-shmobile/clock-r8a7779.c b/arch/arm/mach-shmobile/clock-r8a7779.c
index 9daeb8c37483..10340f5becbb 100644
--- a/arch/arm/mach-shmobile/clock-r8a7779.c
+++ b/arch/arm/mach-shmobile/clock-r8a7779.c
@@ -165,7 +165,7 @@ static struct clk_lookup lookups[] = {
165 CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */ 165 CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */
166 CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */ 166 CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */
167 CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */ 167 CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */
168 CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP114]), /* Ether */ 168 CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */
169 CLKDEV_DEV_ID("ehci-platform.1", &mstp_clks[MSTP101]), /* USB EHCI port2 */ 169 CLKDEV_DEV_ID("ehci-platform.1", &mstp_clks[MSTP101]), /* USB EHCI port2 */
170 CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */ 170 CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */
171 CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */ 171 CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */
diff --git a/arch/arm/mach-shmobile/headsmp-scu.S b/arch/arm/mach-shmobile/headsmp-scu.S
index 6f9865467258..bfd920083a3b 100644
--- a/arch/arm/mach-shmobile/headsmp-scu.S
+++ b/arch/arm/mach-shmobile/headsmp-scu.S
@@ -23,7 +23,6 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <asm/memory.h> 24#include <asm/memory.h>
25 25
26 __CPUINIT
27/* 26/*
28 * Boot code for secondary CPUs. 27 * Boot code for secondary CPUs.
29 * 28 *
diff --git a/arch/arm/mach-shmobile/headsmp.S b/arch/arm/mach-shmobile/headsmp.S
index 559d1ce5f57e..a9d212498987 100644
--- a/arch/arm/mach-shmobile/headsmp.S
+++ b/arch/arm/mach-shmobile/headsmp.S
@@ -14,8 +14,6 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <asm/memory.h> 15#include <asm/memory.h>
16 16
17 __CPUINIT
18
19ENTRY(shmobile_invalidate_start) 17ENTRY(shmobile_invalidate_start)
20 bl v7_invalidate_l1 18 bl v7_invalidate_l1
21 b secondary_startup 19 b secondary_startup
diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c
index 899a86c31ec9..1ccddd228112 100644
--- a/arch/arm/mach-shmobile/setup-emev2.c
+++ b/arch/arm/mach-shmobile/setup-emev2.c
@@ -287,14 +287,14 @@ static struct gpio_em_config gio3_config = {
287static struct resource gio3_resources[] = { 287static struct resource gio3_resources[] = {
288 [0] = { 288 [0] = {
289 .name = "GIO_096", 289 .name = "GIO_096",
290 .start = 0xe0050100, 290 .start = 0xe0050180,
291 .end = 0xe005012b, 291 .end = 0xe00501ab,
292 .flags = IORESOURCE_MEM, 292 .flags = IORESOURCE_MEM,
293 }, 293 },
294 [1] = { 294 [1] = {
295 .name = "GIO_096", 295 .name = "GIO_096",
296 .start = 0xe0050140, 296 .start = 0xe00501c0,
297 .end = 0xe005015f, 297 .end = 0xe00501df,
298 .flags = IORESOURCE_MEM, 298 .flags = IORESOURCE_MEM,
299 }, 299 },
300 [2] = { 300 [2] = {
diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c
index c5a75a7a508f..7f45c2edbca9 100644
--- a/arch/arm/mach-shmobile/setup-r8a73a4.c
+++ b/arch/arm/mach-shmobile/setup-r8a73a4.c
@@ -62,7 +62,7 @@ enum { SCIFA0, SCIFA1, SCIFB0, SCIFB1, SCIFB2, SCIFB3 };
62static const struct plat_sci_port scif[] = { 62static const struct plat_sci_port scif[] = {
63 SCIFA_DATA(SCIFA0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */ 63 SCIFA_DATA(SCIFA0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */
64 SCIFA_DATA(SCIFA1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */ 64 SCIFA_DATA(SCIFA1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */
65 SCIFB_DATA(SCIFB0, 0xe6c50000, gic_spi(145)), /* SCIFB0 */ 65 SCIFB_DATA(SCIFB0, 0xe6c20000, gic_spi(148)), /* SCIFB0 */
66 SCIFB_DATA(SCIFB1, 0xe6c30000, gic_spi(149)), /* SCIFB1 */ 66 SCIFB_DATA(SCIFB1, 0xe6c30000, gic_spi(149)), /* SCIFB1 */
67 SCIFB_DATA(SCIFB2, 0xe6ce0000, gic_spi(150)), /* SCIFB2 */ 67 SCIFB_DATA(SCIFB2, 0xe6ce0000, gic_spi(150)), /* SCIFB2 */
68 SCIFB_DATA(SCIFB3, 0xe6cf0000, gic_spi(151)), /* SCIFB3 */ 68 SCIFB_DATA(SCIFB3, 0xe6cf0000, gic_spi(151)), /* SCIFB3 */
diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
index 80991b35f4ac..22a05a869d25 100644
--- a/arch/arm/mach-shmobile/smp-emev2.c
+++ b/arch/arm/mach-shmobile/smp-emev2.c
@@ -30,7 +30,7 @@
30 30
31#define EMEV2_SCU_BASE 0x1e000000 31#define EMEV2_SCU_BASE 0x1e000000
32 32
33static int __cpuinit emev2_boot_secondary(unsigned int cpu, struct task_struct *idle) 33static int emev2_boot_secondary(unsigned int cpu, struct task_struct *idle)
34{ 34{
35 arch_send_wakeup_ipi_mask(cpumask_of(cpu_logical_map(cpu))); 35 arch_send_wakeup_ipi_mask(cpumask_of(cpu_logical_map(cpu)));
36 return 0; 36 return 0;
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index 526cfaae81c1..9bdf810f2a87 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -81,7 +81,7 @@ static int r8a7779_platform_cpu_kill(unsigned int cpu)
81 return ret ? ret : 1; 81 return ret ? ret : 1;
82} 82}
83 83
84static int __cpuinit r8a7779_boot_secondary(unsigned int cpu, struct task_struct *idle) 84static int r8a7779_boot_secondary(unsigned int cpu, struct task_struct *idle)
85{ 85{
86 struct r8a7779_pm_ch *ch = NULL; 86 struct r8a7779_pm_ch *ch = NULL;
87 int ret = -EIO; 87 int ret = -EIO;
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index d613113a04bd..d5fc3ed4e315 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -48,7 +48,7 @@ void __init sh73a0_register_twd(void)
48} 48}
49#endif 49#endif
50 50
51static int __cpuinit sh73a0_boot_secondary(unsigned int cpu, struct task_struct *idle) 51static int sh73a0_boot_secondary(unsigned int cpu, struct task_struct *idle)
52{ 52{
53 cpu = cpu_logical_map(cpu); 53 cpu = cpu_logical_map(cpu);
54 54
diff --git a/arch/arm/mach-socfpga/headsmp.S b/arch/arm/mach-socfpga/headsmp.S
index 9004bfb1756e..95c115d8b5ee 100644
--- a/arch/arm/mach-socfpga/headsmp.S
+++ b/arch/arm/mach-socfpga/headsmp.S
@@ -10,7 +10,6 @@
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11#include <linux/init.h> 11#include <linux/init.h>
12 12
13 __CPUINIT
14 .arch armv7-a 13 .arch armv7-a
15 14
16ENTRY(secondary_trampoline) 15ENTRY(secondary_trampoline)
diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c
index b51ce8c7929d..5356a72bc8ce 100644
--- a/arch/arm/mach-socfpga/platsmp.c
+++ b/arch/arm/mach-socfpga/platsmp.c
@@ -29,7 +29,7 @@
29 29
30#include "core.h" 30#include "core.h"
31 31
32static int __cpuinit socfpga_boot_secondary(unsigned int cpu, struct task_struct *idle) 32static int socfpga_boot_secondary(unsigned int cpu, struct task_struct *idle)
33{ 33{
34 int trampoline_size = &secondary_trampoline_end - &secondary_trampoline; 34 int trampoline_size = &secondary_trampoline_end - &secondary_trampoline;
35 35
diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
index 8ea11b472b91..bfce9641e32f 100644
--- a/arch/arm/mach-socfpga/socfpga.c
+++ b/arch/arm/mach-socfpga/socfpga.c
@@ -19,6 +19,7 @@
19#include <linux/of_address.h> 19#include <linux/of_address.h>
20#include <linux/of_irq.h> 20#include <linux/of_irq.h>
21#include <linux/of_platform.h> 21#include <linux/of_platform.h>
22#include <linux/reboot.h>
22 23
23#include <asm/hardware/cache-l2x0.h> 24#include <asm/hardware/cache-l2x0.h>
24#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
@@ -89,13 +90,13 @@ static void __init socfpga_init_irq(void)
89 socfpga_sysmgr_init(); 90 socfpga_sysmgr_init();
90} 91}
91 92
92static void socfpga_cyclone5_restart(char mode, const char *cmd) 93static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd)
93{ 94{
94 u32 temp; 95 u32 temp;
95 96
96 temp = readl(rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL); 97 temp = readl(rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL);
97 98
98 if (mode == 'h') 99 if (mode == REBOOT_HARD)
99 temp |= RSTMGR_CTRL_SWCOLDRSTREQ; 100 temp |= RSTMGR_CTRL_SWCOLDRSTREQ;
100 else 101 else
101 temp |= RSTMGR_CTRL_SWWARMRSTREQ; 102 temp |= RSTMGR_CTRL_SWWARMRSTREQ;
diff --git a/arch/arm/mach-spear/generic.h b/arch/arm/mach-spear/generic.h
index a9fd45362fee..a99d90a4d09c 100644
--- a/arch/arm/mach-spear/generic.h
+++ b/arch/arm/mach-spear/generic.h
@@ -16,6 +16,8 @@
16#include <linux/dmaengine.h> 16#include <linux/dmaengine.h>
17#include <linux/amba/pl08x.h> 17#include <linux/amba/pl08x.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/reboot.h>
20
19#include <asm/mach/time.h> 21#include <asm/mach/time.h>
20 22
21extern void spear13xx_timer_init(void); 23extern void spear13xx_timer_init(void);
@@ -32,10 +34,10 @@ void __init spear6xx_clk_init(void __iomem *misc_base);
32void __init spear13xx_map_io(void); 34void __init spear13xx_map_io(void);
33void __init spear13xx_l2x0_init(void); 35void __init spear13xx_l2x0_init(void);
34 36
35void spear_restart(char, const char *); 37void spear_restart(enum reboot_mode, const char *);
36 38
37void spear13xx_secondary_startup(void); 39void spear13xx_secondary_startup(void);
38void __cpuinit spear13xx_cpu_die(unsigned int cpu); 40void spear13xx_cpu_die(unsigned int cpu);
39 41
40extern struct smp_operations spear13xx_smp_ops; 42extern struct smp_operations spear13xx_smp_ops;
41 43
diff --git a/arch/arm/mach-spear/platsmp.c b/arch/arm/mach-spear/platsmp.c
index 9c4c722c954e..5c4a19887b2b 100644
--- a/arch/arm/mach-spear/platsmp.c
+++ b/arch/arm/mach-spear/platsmp.c
@@ -24,7 +24,7 @@ static DEFINE_SPINLOCK(boot_lock);
24 24
25static void __iomem *scu_base = IOMEM(VA_SCU_BASE); 25static void __iomem *scu_base = IOMEM(VA_SCU_BASE);
26 26
27static void __cpuinit spear13xx_secondary_init(unsigned int cpu) 27static void spear13xx_secondary_init(unsigned int cpu)
28{ 28{
29 /* 29 /*
30 * let the primary processor know we're out of the 30 * let the primary processor know we're out of the
@@ -40,7 +40,7 @@ static void __cpuinit spear13xx_secondary_init(unsigned int cpu)
40 spin_unlock(&boot_lock); 40 spin_unlock(&boot_lock);
41} 41}
42 42
43static int __cpuinit spear13xx_boot_secondary(unsigned int cpu, struct task_struct *idle) 43static int spear13xx_boot_secondary(unsigned int cpu, struct task_struct *idle)
44{ 44{
45 unsigned long timeout; 45 unsigned long timeout;
46 46
diff --git a/arch/arm/mach-spear/restart.c b/arch/arm/mach-spear/restart.c
index 2b44500bb718..ce5e098c4888 100644
--- a/arch/arm/mach-spear/restart.c
+++ b/arch/arm/mach-spear/restart.c
@@ -12,14 +12,15 @@
12 */ 12 */
13#include <linux/io.h> 13#include <linux/io.h>
14#include <linux/amba/sp810.h> 14#include <linux/amba/sp810.h>
15#include <linux/reboot.h>
15#include <asm/system_misc.h> 16#include <asm/system_misc.h>
16#include <mach/spear.h> 17#include <mach/spear.h>
17#include "generic.h" 18#include "generic.h"
18 19
19#define SPEAR13XX_SYS_SW_RES (VA_MISC_BASE + 0x204) 20#define SPEAR13XX_SYS_SW_RES (VA_MISC_BASE + 0x204)
20void spear_restart(char mode, const char *cmd) 21void spear_restart(enum reboot_mode mode, const char *cmd)
21{ 22{
22 if (mode == 's') { 23 if (mode == REBOOT_SOFT) {
23 /* software reset, Jump into ROM at address 0 */ 24 /* software reset, Jump into ROM at address 0 */
24 soft_restart(0); 25 soft_restart(0);
25 } else { 26 } else {
diff --git a/arch/arm/mach-spear/spear3xx.c b/arch/arm/mach-spear/spear3xx.c
index 0227c97797cd..bf3b1fd8cb23 100644
--- a/arch/arm/mach-spear/spear3xx.c
+++ b/arch/arm/mach-spear/spear3xx.c
@@ -56,8 +56,8 @@ struct pl08x_platform_data pl080_plat_data = {
56 }, 56 },
57 .lli_buses = PL08X_AHB1, 57 .lli_buses = PL08X_AHB1,
58 .mem_buses = PL08X_AHB1, 58 .mem_buses = PL08X_AHB1,
59 .get_signal = pl080_get_signal, 59 .get_xfer_signal = pl080_get_signal,
60 .put_signal = pl080_put_signal, 60 .put_xfer_signal = pl080_put_signal,
61}; 61};
62 62
63/* 63/*
diff --git a/arch/arm/mach-spear/spear6xx.c b/arch/arm/mach-spear/spear6xx.c
index 8b0295a41226..da26fa5b68d7 100644
--- a/arch/arm/mach-spear/spear6xx.c
+++ b/arch/arm/mach-spear/spear6xx.c
@@ -334,8 +334,8 @@ static struct pl08x_platform_data spear6xx_pl080_plat_data = {
334 }, 334 },
335 .lli_buses = PL08X_AHB1, 335 .lli_buses = PL08X_AHB1,
336 .mem_buses = PL08X_AHB1, 336 .mem_buses = PL08X_AHB1,
337 .get_signal = pl080_get_signal, 337 .get_xfer_signal = pl080_get_signal,
338 .put_signal = pl080_put_signal, 338 .put_xfer_signal = pl080_put_signal,
339 .slave_channels = spear600_dma_info, 339 .slave_channels = spear600_dma_info,
340 .num_slave_channels = ARRAY_SIZE(spear600_dma_info), 340 .num_slave_channels = ARRAY_SIZE(spear600_dma_info),
341}; 341};
diff --git a/arch/arm/mach-sti/platsmp.c b/arch/arm/mach-sti/platsmp.c
index 977a863468fc..dce50d983a8e 100644
--- a/arch/arm/mach-sti/platsmp.c
+++ b/arch/arm/mach-sti/platsmp.c
@@ -27,7 +27,7 @@
27 27
28#include "smp.h" 28#include "smp.h"
29 29
30static void __cpuinit write_pen_release(int val) 30static void write_pen_release(int val)
31{ 31{
32 pen_release = val; 32 pen_release = val;
33 smp_wmb(); 33 smp_wmb();
@@ -37,7 +37,7 @@ static void __cpuinit write_pen_release(int val)
37 37
38static DEFINE_SPINLOCK(boot_lock); 38static DEFINE_SPINLOCK(boot_lock);
39 39
40void __cpuinit sti_secondary_init(unsigned int cpu) 40void sti_secondary_init(unsigned int cpu)
41{ 41{
42 trace_hardirqs_off(); 42 trace_hardirqs_off();
43 43
@@ -54,7 +54,7 @@ void __cpuinit sti_secondary_init(unsigned int cpu)
54 spin_unlock(&boot_lock); 54 spin_unlock(&boot_lock);
55} 55}
56 56
57int __cpuinit sti_boot_secondary(unsigned int cpu, struct task_struct *idle) 57int sti_boot_secondary(unsigned int cpu, struct task_struct *idle)
58{ 58{
59 unsigned long timeout; 59 unsigned long timeout;
60 60
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 84485a10fc3a..38a3c55527c8 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -18,6 +18,7 @@
18#include <linux/of_irq.h> 18#include <linux/of_irq.h>
19#include <linux/of_platform.h> 19#include <linux/of_platform.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/reboot.h>
21 22
22#include <linux/clk/sunxi.h> 23#include <linux/clk/sunxi.h>
23 24
@@ -33,7 +34,7 @@
33 34
34static void __iomem *wdt_base; 35static void __iomem *wdt_base;
35 36
36static void sun4i_restart(char mode, const char *cmd) 37static void sun4i_restart(enum reboot_mode mode, const char *cmd)
37{ 38{
38 if (!wdt_base) 39 if (!wdt_base)
39 return; 40 return;
diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h
index 1787327fae3a..9a6659fe2dc2 100644
--- a/arch/arm/mach-tegra/board.h
+++ b/arch/arm/mach-tegra/board.h
@@ -23,8 +23,9 @@
23#define __MACH_TEGRA_BOARD_H 23#define __MACH_TEGRA_BOARD_H
24 24
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/reboot.h>
26 27
27void tegra_assert_system_reset(char mode, const char *cmd); 28void tegra_assert_system_reset(enum reboot_mode mode, const char *cmd);
28 29
29void __init tegra_init_early(void); 30void __init tegra_init_early(void);
30void __init tegra_map_common_io(void); 31void __init tegra_map_common_io(void);
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index b25153e2ebaa..94a119a35af8 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -22,6 +22,7 @@
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/reboot.h>
25#include <linux/irqchip.h> 26#include <linux/irqchip.h>
26#include <linux/clk-provider.h> 27#include <linux/clk-provider.h>
27 28
@@ -68,7 +69,7 @@ void __init tegra_dt_init_irq(void)
68} 69}
69#endif 70#endif
70 71
71void tegra_assert_system_reset(char mode, const char *cmd) 72void tegra_assert_system_reset(enum reboot_mode mode, const char *cmd)
72{ 73{
73 void __iomem *reset = IO_ADDRESS(TEGRA_PMC_BASE + 0); 74 void __iomem *reset = IO_ADDRESS(TEGRA_PMC_BASE + 0);
74 u32 reg; 75 u32 reg;
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index 24db4ac428ae..97b33a2a2d75 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -35,7 +35,7 @@
35 35
36static cpumask_t tegra_cpu_init_mask; 36static cpumask_t tegra_cpu_init_mask;
37 37
38static void __cpuinit tegra_secondary_init(unsigned int cpu) 38static void tegra_secondary_init(unsigned int cpu)
39{ 39{
40 cpumask_set_cpu(cpu, &tegra_cpu_init_mask); 40 cpumask_set_cpu(cpu, &tegra_cpu_init_mask);
41} 41}
@@ -167,7 +167,7 @@ static int tegra114_boot_secondary(unsigned int cpu, struct task_struct *idle)
167 return ret; 167 return ret;
168} 168}
169 169
170static int __cpuinit tegra_boot_secondary(unsigned int cpu, 170static int tegra_boot_secondary(unsigned int cpu,
171 struct task_struct *idle) 171 struct task_struct *idle)
172{ 172{
173 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_chip_id == TEGRA20) 173 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_chip_id == TEGRA20)
diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c
index 94e69bee3da5..261fec140c06 100644
--- a/arch/arm/mach-tegra/pm.c
+++ b/arch/arm/mach-tegra/pm.c
@@ -191,7 +191,7 @@ static const char *lp_state[TEGRA_MAX_SUSPEND_MODE] = {
191 [TEGRA_SUSPEND_LP0] = "LP0", 191 [TEGRA_SUSPEND_LP0] = "LP0",
192}; 192};
193 193
194static int __cpuinit tegra_suspend_enter(suspend_state_t state) 194static int tegra_suspend_enter(suspend_state_t state)
195{ 195{
196 enum tegra_suspend_mode mode = tegra_pmc_get_suspend_mode(); 196 enum tegra_suspend_mode mode = tegra_pmc_get_suspend_mode();
197 197
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index 4f7ac2a11452..35670b15f281 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -300,11 +300,11 @@ static void __init u300_init_check_chip(void)
300/* Forward declare this function from the watchdog */ 300/* Forward declare this function from the watchdog */
301void coh901327_watchdog_reset(void); 301void coh901327_watchdog_reset(void);
302 302
303static void u300_restart(char mode, const char *cmd) 303static void u300_restart(enum reboot_mode mode, const char *cmd)
304{ 304{
305 switch (mode) { 305 switch (mode) {
306 case 's': 306 case REBOOT_SOFT:
307 case 'h': 307 case REBOOT_HARD:
308#ifdef CONFIG_COH901327_WATCHDOG 308#ifdef CONFIG_COH901327_WATCHDOG
309 coh901327_watchdog_reset(); 309 coh901327_watchdog_reset();
310#endif 310#endif
diff --git a/arch/arm/mach-u300/timer.c b/arch/arm/mach-u300/timer.c
index 390ae5feb1d0..b5db207dfd1e 100644
--- a/arch/arm/mach-u300/timer.c
+++ b/arch/arm/mach-u300/timer.c
@@ -21,9 +21,9 @@
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/of_address.h> 22#include <linux/of_address.h>
23#include <linux/of_irq.h> 23#include <linux/of_irq.h>
24#include <linux/sched_clock.h>
24 25
25/* Generic stuff */ 26/* Generic stuff */
26#include <asm/sched_clock.h>
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28#include <asm/mach/time.h> 28#include <asm/mach/time.h>
29 29
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index 14d90469392f..1f296e796a4f 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -54,7 +54,7 @@ static void __iomem *scu_base_addr(void)
54 54
55static DEFINE_SPINLOCK(boot_lock); 55static DEFINE_SPINLOCK(boot_lock);
56 56
57static void __cpuinit ux500_secondary_init(unsigned int cpu) 57static void ux500_secondary_init(unsigned int cpu)
58{ 58{
59 /* 59 /*
60 * let the primary processor know we're out of the 60 * let the primary processor know we're out of the
@@ -69,7 +69,7 @@ static void __cpuinit ux500_secondary_init(unsigned int cpu)
69 spin_unlock(&boot_lock); 69 spin_unlock(&boot_lock);
70} 70}
71 71
72static int __cpuinit ux500_boot_secondary(unsigned int cpu, struct task_struct *idle) 72static int ux500_boot_secondary(unsigned int cpu, struct task_struct *idle)
73{ 73{
74 unsigned long timeout; 74 unsigned long timeout;
75 75
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 54bb80b012ac..3b0572f30d56 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -38,6 +38,7 @@
38#include <linux/clkdev.h> 38#include <linux/clkdev.h>
39#include <linux/mtd/physmap.h> 39#include <linux/mtd/physmap.h>
40#include <linux/bitops.h> 40#include <linux/bitops.h>
41#include <linux/reboot.h>
41 42
42#include <asm/irq.h> 43#include <asm/irq.h>
43#include <asm/hardware/arm_timer.h> 44#include <asm/hardware/arm_timer.h>
@@ -733,7 +734,7 @@ static void versatile_leds_event(led_event_t ledevt)
733} 734}
734#endif /* CONFIG_LEDS */ 735#endif /* CONFIG_LEDS */
735 736
736void versatile_restart(char mode, const char *cmd) 737void versatile_restart(enum reboot_mode mode, const char *cmd)
737{ 738{
738 void __iomem *sys = __io_address(VERSATILE_SYS_BASE); 739 void __iomem *sys = __io_address(VERSATILE_SYS_BASE);
739 u32 val; 740 u32 val;
diff --git a/arch/arm/mach-versatile/core.h b/arch/arm/mach-versatile/core.h
index 5c1b87d1da6b..f06d5768e428 100644
--- a/arch/arm/mach-versatile/core.h
+++ b/arch/arm/mach-versatile/core.h
@@ -24,13 +24,14 @@
24 24
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26#include <linux/of_platform.h> 26#include <linux/of_platform.h>
27#include <linux/reboot.h>
27 28
28extern void __init versatile_init(void); 29extern void __init versatile_init(void);
29extern void __init versatile_init_early(void); 30extern void __init versatile_init_early(void);
30extern void __init versatile_init_irq(void); 31extern void __init versatile_init_irq(void);
31extern void __init versatile_map_io(void); 32extern void __init versatile_map_io(void);
32extern void versatile_timer_init(void); 33extern void versatile_timer_init(void);
33extern void versatile_restart(char, const char *); 34extern void versatile_restart(enum reboot_mode, const char *);
34extern unsigned int mmc_status(struct device *dev); 35extern unsigned int mmc_status(struct device *dev);
35#ifdef CONFIG_OF 36#ifdef CONFIG_OF
36extern struct of_dev_auxdata versatile_auxdata_lookup[]; 37extern struct of_dev_auxdata versatile_auxdata_lookup[];
diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c
index f8f2f00856e0..eefaa60d6614 100644
--- a/arch/arm/mach-vt8500/vt8500.c
+++ b/arch/arm/mach-vt8500/vt8500.c
@@ -21,6 +21,7 @@
21#include <linux/clocksource.h> 21#include <linux/clocksource.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/pm.h> 23#include <linux/pm.h>
24#include <linux/reboot.h>
24 25
25#include <asm/mach-types.h> 26#include <asm/mach-types.h>
26#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
@@ -46,7 +47,7 @@
46 47
47static void __iomem *pmc_base; 48static void __iomem *pmc_base;
48 49
49void vt8500_restart(char mode, const char *cmd) 50void vt8500_restart(enum reboot_mode mode, const char *cmd)
50{ 51{
51 if (pmc_base) 52 if (pmc_base)
52 writel(1, pmc_base + VT8500_PMSR_REG); 53 writel(1, pmc_base + VT8500_PMSR_REG);
diff --git a/arch/arm/mach-w90x900/cpu.c b/arch/arm/mach-w90x900/cpu.c
index 9e4dd8b63c4a..b1eabaad50a5 100644
--- a/arch/arm/mach-w90x900/cpu.c
+++ b/arch/arm/mach-w90x900/cpu.c
@@ -230,9 +230,9 @@ void __init nuc900_init_clocks(void)
230#define WTE (1 << 7) 230#define WTE (1 << 7)
231#define WTRE (1 << 1) 231#define WTRE (1 << 1)
232 232
233void nuc9xx_restart(char mode, const char *cmd) 233void nuc9xx_restart(enum reboot_mode mode, const char *cmd)
234{ 234{
235 if (mode == 's') { 235 if (mode == REBOOT_SOFT) {
236 /* Jump into ROM at address 0 */ 236 /* Jump into ROM at address 0 */
237 soft_restart(0); 237 soft_restart(0);
238 } else { 238 } else {
diff --git a/arch/arm/mach-w90x900/nuc9xx.h b/arch/arm/mach-w90x900/nuc9xx.h
index 88ef4b267089..e3ab1e1381f1 100644
--- a/arch/arm/mach-w90x900/nuc9xx.h
+++ b/arch/arm/mach-w90x900/nuc9xx.h
@@ -14,10 +14,13 @@
14 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
15 * 15 *
16 */ 16 */
17
18#include <linux/reboot.h>
19
17struct map_desc; 20struct map_desc;
18 21
19/* core initialisation functions */ 22/* core initialisation functions */
20 23
21extern void nuc900_init_irq(void); 24extern void nuc900_init_irq(void);
22extern void nuc900_timer_init(void); 25extern void nuc900_timer_init(void);
23extern void nuc9xx_restart(char, const char *); 26extern void nuc9xx_restart(enum reboot_mode, const char *);
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
index 4130e65a0e3f..5b799c29886e 100644
--- a/arch/arm/mach-zynq/common.c
+++ b/arch/arm/mach-zynq/common.c
@@ -101,7 +101,7 @@ static const char * const zynq_dt_match[] = {
101 NULL 101 NULL
102}; 102};
103 103
104MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform") 104DT_MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform")
105 .smp = smp_ops(zynq_smp_ops), 105 .smp = smp_ops(zynq_smp_ops),
106 .map_io = zynq_map_io, 106 .map_io = zynq_map_io,
107 .init_machine = zynq_init_machine, 107 .init_machine = zynq_init_machine,
diff --git a/arch/arm/mach-zynq/common.h b/arch/arm/mach-zynq/common.h
index fbbd0e21c404..3040d219570f 100644
--- a/arch/arm/mach-zynq/common.h
+++ b/arch/arm/mach-zynq/common.h
@@ -27,7 +27,7 @@ extern void secondary_startup(void);
27extern char zynq_secondary_trampoline; 27extern char zynq_secondary_trampoline;
28extern char zynq_secondary_trampoline_jump; 28extern char zynq_secondary_trampoline_jump;
29extern char zynq_secondary_trampoline_end; 29extern char zynq_secondary_trampoline_end;
30extern int __cpuinit zynq_cpun_start(u32 address, int cpu); 30extern int zynq_cpun_start(u32 address, int cpu);
31extern struct smp_operations zynq_smp_ops __initdata; 31extern struct smp_operations zynq_smp_ops __initdata;
32#endif 32#endif
33 33
diff --git a/arch/arm/mach-zynq/headsmp.S b/arch/arm/mach-zynq/headsmp.S
index d183cd234a9b..d4cd5f34fe5c 100644
--- a/arch/arm/mach-zynq/headsmp.S
+++ b/arch/arm/mach-zynq/headsmp.S
@@ -9,8 +9,6 @@
9#include <linux/linkage.h> 9#include <linux/linkage.h>
10#include <linux/init.h> 10#include <linux/init.h>
11 11
12 __CPUINIT
13
14ENTRY(zynq_secondary_trampoline) 12ENTRY(zynq_secondary_trampoline)
15 ldr r0, [pc] 13 ldr r0, [pc]
16 bx r0 14 bx r0
diff --git a/arch/arm/mach-zynq/platsmp.c b/arch/arm/mach-zynq/platsmp.c
index 023f225493f2..689fbbc3d9c8 100644
--- a/arch/arm/mach-zynq/platsmp.c
+++ b/arch/arm/mach-zynq/platsmp.c
@@ -30,11 +30,11 @@
30/* 30/*
31 * Store number of cores in the system 31 * Store number of cores in the system
32 * Because of scu_get_core_count() must be in __init section and can't 32 * Because of scu_get_core_count() must be in __init section and can't
33 * be called from zynq_cpun_start() because it is in __cpuinit section. 33 * be called from zynq_cpun_start() because it is not in __init section.
34 */ 34 */
35static int ncores; 35static int ncores;
36 36
37int __cpuinit zynq_cpun_start(u32 address, int cpu) 37int zynq_cpun_start(u32 address, int cpu)
38{ 38{
39 u32 trampoline_code_size = &zynq_secondary_trampoline_end - 39 u32 trampoline_code_size = &zynq_secondary_trampoline_end -
40 &zynq_secondary_trampoline; 40 &zynq_secondary_trampoline;
@@ -92,7 +92,7 @@ int __cpuinit zynq_cpun_start(u32 address, int cpu)
92} 92}
93EXPORT_SYMBOL(zynq_cpun_start); 93EXPORT_SYMBOL(zynq_cpun_start);
94 94
95static int __cpuinit zynq_boot_secondary(unsigned int cpu, 95static int zynq_boot_secondary(unsigned int cpu,
96 struct task_struct *idle) 96 struct task_struct *idle)
97{ 97{
98 return zynq_cpun_start(virt_to_phys(secondary_startup), cpu); 98 return zynq_cpun_start(virt_to_phys(secondary_startup), cpu);
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 7ec02961dfa0..7f9b1798c6cf 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1328,6 +1328,15 @@ static void *arm_iommu_alloc_attrs(struct device *dev, size_t size,
1328 if (gfp & GFP_ATOMIC) 1328 if (gfp & GFP_ATOMIC)
1329 return __iommu_alloc_atomic(dev, size, handle); 1329 return __iommu_alloc_atomic(dev, size, handle);
1330 1330
1331 /*
1332 * Following is a work-around (a.k.a. hack) to prevent pages
1333 * with __GFP_COMP being passed to split_page() which cannot
1334 * handle them. The real problem is that this flag probably
1335 * should be 0 on ARM as it is not supported on this
1336 * platform; see CONFIG_HUGETLBFS.
1337 */
1338 gfp &= ~(__GFP_COMP);
1339
1331 pages = __iommu_alloc_buffer(dev, size, gfp, attrs); 1340 pages = __iommu_alloc_buffer(dev, size, gfp, attrs);
1332 if (!pages) 1341 if (!pages)
1333 return NULL; 1342 return NULL;
@@ -1386,16 +1395,17 @@ static int arm_iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma,
1386void arm_iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr, 1395void arm_iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,
1387 dma_addr_t handle, struct dma_attrs *attrs) 1396 dma_addr_t handle, struct dma_attrs *attrs)
1388{ 1397{
1389 struct page **pages = __iommu_get_pages(cpu_addr, attrs); 1398 struct page **pages;
1390 size = PAGE_ALIGN(size); 1399 size = PAGE_ALIGN(size);
1391 1400
1392 if (!pages) { 1401 if (__in_atomic_pool(cpu_addr, size)) {
1393 WARN(1, "trying to free invalid coherent area: %p\n", cpu_addr); 1402 __iommu_free_atomic(dev, cpu_addr, handle, size);
1394 return; 1403 return;
1395 } 1404 }
1396 1405
1397 if (__in_atomic_pool(cpu_addr, size)) { 1406 pages = __iommu_get_pages(cpu_addr, attrs);
1398 __iommu_free_atomic(dev, cpu_addr, handle, size); 1407 if (!pages) {
1408 WARN(1, "trying to free invalid coherent area: %p\n", cpu_addr);
1399 return; 1409 return;
1400 } 1410 }
1401 1411
@@ -1650,13 +1660,27 @@ static dma_addr_t arm_coherent_iommu_map_page(struct device *dev, struct page *p
1650{ 1660{
1651 struct dma_iommu_mapping *mapping = dev->archdata.mapping; 1661 struct dma_iommu_mapping *mapping = dev->archdata.mapping;
1652 dma_addr_t dma_addr; 1662 dma_addr_t dma_addr;
1653 int ret, len = PAGE_ALIGN(size + offset); 1663 int ret, prot, len = PAGE_ALIGN(size + offset);
1654 1664
1655 dma_addr = __alloc_iova(mapping, len); 1665 dma_addr = __alloc_iova(mapping, len);
1656 if (dma_addr == DMA_ERROR_CODE) 1666 if (dma_addr == DMA_ERROR_CODE)
1657 return dma_addr; 1667 return dma_addr;
1658 1668
1659 ret = iommu_map(mapping->domain, dma_addr, page_to_phys(page), len, 0); 1669 switch (dir) {
1670 case DMA_BIDIRECTIONAL:
1671 prot = IOMMU_READ | IOMMU_WRITE;
1672 break;
1673 case DMA_TO_DEVICE:
1674 prot = IOMMU_READ;
1675 break;
1676 case DMA_FROM_DEVICE:
1677 prot = IOMMU_WRITE;
1678 break;
1679 default:
1680 prot = 0;
1681 }
1682
1683 ret = iommu_map(mapping->domain, dma_addr, page_to_phys(page), len, prot);
1660 if (ret < 0) 1684 if (ret < 0)
1661 goto fail; 1685 goto fail;
1662 1686
@@ -1921,7 +1945,7 @@ void arm_iommu_detach_device(struct device *dev)
1921 1945
1922 iommu_detach_device(mapping->domain, dev); 1946 iommu_detach_device(mapping->domain, dev);
1923 kref_put(&mapping->kref, release_iommu_mapping); 1947 kref_put(&mapping->kref, release_iommu_mapping);
1924 mapping = NULL; 1948 dev->archdata.mapping = NULL;
1925 set_dma_ops(dev, NULL); 1949 set_dma_ops(dev, NULL);
1926 1950
1927 pr_debug("Detached IOMMU controller from %s device.\n", dev_name(dev)); 1951 pr_debug("Detached IOMMU controller from %s device.\n", dev_name(dev));
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 6833cbead6cc..15225d829d71 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -597,7 +597,7 @@ void __init mem_init(void)
597 597
598#ifdef CONFIG_SA1111 598#ifdef CONFIG_SA1111
599 /* now that our DMA memory is actually so designated, we can free it */ 599 /* now that our DMA memory is actually so designated, we can free it */
600 free_reserved_area(__va(PHYS_PFN_OFFSET), swapper_pg_dir, -1, NULL); 600 free_reserved_area(__va(PHYS_OFFSET), swapper_pg_dir, -1, NULL);
601#endif 601#endif
602 602
603 free_highpages(); 603 free_highpages();
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index 10062ceadd1c..0c6356255fe3 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -181,11 +181,9 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
181 if (mmap_is_legacy()) { 181 if (mmap_is_legacy()) {
182 mm->mmap_base = TASK_UNMAPPED_BASE + random_factor; 182 mm->mmap_base = TASK_UNMAPPED_BASE + random_factor;
183 mm->get_unmapped_area = arch_get_unmapped_area; 183 mm->get_unmapped_area = arch_get_unmapped_area;
184 mm->unmap_area = arch_unmap_area;
185 } else { 184 } else {
186 mm->mmap_base = mmap_base(random_factor); 185 mm->mmap_base = mmap_base(random_factor);
187 mm->get_unmapped_area = arch_get_unmapped_area_topdown; 186 mm->get_unmapped_area = arch_get_unmapped_area_topdown;
188 mm->unmap_area = arch_unmap_area_topdown;
189 } 187 }
190} 188}
191 189
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index d7229d28c7f8..4f56617a2392 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -950,7 +950,7 @@ void __init debug_ll_io_init(void)
950 map.virtual &= PAGE_MASK; 950 map.virtual &= PAGE_MASK;
951 map.length = PAGE_SIZE; 951 map.length = PAGE_SIZE;
952 map.type = MT_DEVICE; 952 map.type = MT_DEVICE;
953 create_mapping(&map); 953 iotable_init(&map, 1);
954} 954}
955#endif 955#endif
956 956
diff --git a/arch/arm/mm/proc-arm1020.S b/arch/arm/mm/proc-arm1020.S
index 2bb61e703d6c..d1a2d05971e0 100644
--- a/arch/arm/mm/proc-arm1020.S
+++ b/arch/arm/mm/proc-arm1020.S
@@ -443,8 +443,6 @@ ENTRY(cpu_arm1020_set_pte_ext)
443#endif /* CONFIG_MMU */ 443#endif /* CONFIG_MMU */
444 mov pc, lr 444 mov pc, lr
445 445
446 __CPUINIT
447
448 .type __arm1020_setup, #function 446 .type __arm1020_setup, #function
449__arm1020_setup: 447__arm1020_setup:
450 mov r0, #0 448 mov r0, #0
diff --git a/arch/arm/mm/proc-arm1020e.S b/arch/arm/mm/proc-arm1020e.S
index 8f96aa40f510..9d89405c3d03 100644
--- a/arch/arm/mm/proc-arm1020e.S
+++ b/arch/arm/mm/proc-arm1020e.S
@@ -425,8 +425,6 @@ ENTRY(cpu_arm1020e_set_pte_ext)
425#endif /* CONFIG_MMU */ 425#endif /* CONFIG_MMU */
426 mov pc, lr 426 mov pc, lr
427 427
428 __CPUINIT
429
430 .type __arm1020e_setup, #function 428 .type __arm1020e_setup, #function
431__arm1020e_setup: 429__arm1020e_setup:
432 mov r0, #0 430 mov r0, #0
diff --git a/arch/arm/mm/proc-arm1022.S b/arch/arm/mm/proc-arm1022.S
index 8ebe4a469a22..6f01a0ae3b30 100644
--- a/arch/arm/mm/proc-arm1022.S
+++ b/arch/arm/mm/proc-arm1022.S
@@ -407,8 +407,6 @@ ENTRY(cpu_arm1022_set_pte_ext)
407#endif /* CONFIG_MMU */ 407#endif /* CONFIG_MMU */
408 mov pc, lr 408 mov pc, lr
409 409
410 __CPUINIT
411
412 .type __arm1022_setup, #function 410 .type __arm1022_setup, #function
413__arm1022_setup: 411__arm1022_setup:
414 mov r0, #0 412 mov r0, #0
diff --git a/arch/arm/mm/proc-arm1026.S b/arch/arm/mm/proc-arm1026.S
index 093fc7e520c3..4799a24b43e6 100644
--- a/arch/arm/mm/proc-arm1026.S
+++ b/arch/arm/mm/proc-arm1026.S
@@ -396,9 +396,6 @@ ENTRY(cpu_arm1026_set_pte_ext)
396#endif /* CONFIG_MMU */ 396#endif /* CONFIG_MMU */
397 mov pc, lr 397 mov pc, lr
398 398
399
400 __CPUINIT
401
402 .type __arm1026_setup, #function 399 .type __arm1026_setup, #function
403__arm1026_setup: 400__arm1026_setup:
404 mov r0, #0 401 mov r0, #0
diff --git a/arch/arm/mm/proc-arm720.S b/arch/arm/mm/proc-arm720.S
index 0ac908c7ade1..d42c37f9f5bc 100644
--- a/arch/arm/mm/proc-arm720.S
+++ b/arch/arm/mm/proc-arm720.S
@@ -116,8 +116,6 @@ ENTRY(cpu_arm720_reset)
116ENDPROC(cpu_arm720_reset) 116ENDPROC(cpu_arm720_reset)
117 .popsection 117 .popsection
118 118
119 __CPUINIT
120
121 .type __arm710_setup, #function 119 .type __arm710_setup, #function
122__arm710_setup: 120__arm710_setup:
123 mov r0, #0 121 mov r0, #0
diff --git a/arch/arm/mm/proc-arm740.S b/arch/arm/mm/proc-arm740.S
index fde2d2a794cf..9b0ae90cbf17 100644
--- a/arch/arm/mm/proc-arm740.S
+++ b/arch/arm/mm/proc-arm740.S
@@ -60,8 +60,6 @@ ENTRY(cpu_arm740_reset)
60ENDPROC(cpu_arm740_reset) 60ENDPROC(cpu_arm740_reset)
61 .popsection 61 .popsection
62 62
63 __CPUINIT
64
65 .type __arm740_setup, #function 63 .type __arm740_setup, #function
66__arm740_setup: 64__arm740_setup:
67 mov r0, #0 65 mov r0, #0
diff --git a/arch/arm/mm/proc-arm7tdmi.S b/arch/arm/mm/proc-arm7tdmi.S
index 6ddea3e464bd..f6cc3f63ce39 100644
--- a/arch/arm/mm/proc-arm7tdmi.S
+++ b/arch/arm/mm/proc-arm7tdmi.S
@@ -51,8 +51,6 @@ ENTRY(cpu_arm7tdmi_reset)
51ENDPROC(cpu_arm7tdmi_reset) 51ENDPROC(cpu_arm7tdmi_reset)
52 .popsection 52 .popsection
53 53
54 __CPUINIT
55
56 .type __arm7tdmi_setup, #function 54 .type __arm7tdmi_setup, #function
57__arm7tdmi_setup: 55__arm7tdmi_setup:
58 mov pc, lr 56 mov pc, lr
diff --git a/arch/arm/mm/proc-arm920.S b/arch/arm/mm/proc-arm920.S
index 2556cf1c2da1..549557df6d57 100644
--- a/arch/arm/mm/proc-arm920.S
+++ b/arch/arm/mm/proc-arm920.S
@@ -410,8 +410,6 @@ ENTRY(cpu_arm920_do_resume)
410ENDPROC(cpu_arm920_do_resume) 410ENDPROC(cpu_arm920_do_resume)
411#endif 411#endif
412 412
413 __CPUINIT
414
415 .type __arm920_setup, #function 413 .type __arm920_setup, #function
416__arm920_setup: 414__arm920_setup:
417 mov r0, #0 415 mov r0, #0
diff --git a/arch/arm/mm/proc-arm922.S b/arch/arm/mm/proc-arm922.S
index 4464c49d7449..2a758b06c6f6 100644
--- a/arch/arm/mm/proc-arm922.S
+++ b/arch/arm/mm/proc-arm922.S
@@ -388,8 +388,6 @@ ENTRY(cpu_arm922_set_pte_ext)
388#endif /* CONFIG_MMU */ 388#endif /* CONFIG_MMU */
389 mov pc, lr 389 mov pc, lr
390 390
391 __CPUINIT
392
393 .type __arm922_setup, #function 391 .type __arm922_setup, #function
394__arm922_setup: 392__arm922_setup:
395 mov r0, #0 393 mov r0, #0
diff --git a/arch/arm/mm/proc-arm925.S b/arch/arm/mm/proc-arm925.S
index 281eb9b9c1d6..97448c3acf38 100644
--- a/arch/arm/mm/proc-arm925.S
+++ b/arch/arm/mm/proc-arm925.S
@@ -438,8 +438,6 @@ ENTRY(cpu_arm925_set_pte_ext)
438#endif /* CONFIG_MMU */ 438#endif /* CONFIG_MMU */
439 mov pc, lr 439 mov pc, lr
440 440
441 __CPUINIT
442
443 .type __arm925_setup, #function 441 .type __arm925_setup, #function
444__arm925_setup: 442__arm925_setup:
445 mov r0, #0 443 mov r0, #0
diff --git a/arch/arm/mm/proc-arm926.S b/arch/arm/mm/proc-arm926.S
index 344c8a548cc0..0f098f407c9f 100644
--- a/arch/arm/mm/proc-arm926.S
+++ b/arch/arm/mm/proc-arm926.S
@@ -425,8 +425,6 @@ ENTRY(cpu_arm926_do_resume)
425ENDPROC(cpu_arm926_do_resume) 425ENDPROC(cpu_arm926_do_resume)
426#endif 426#endif
427 427
428 __CPUINIT
429
430 .type __arm926_setup, #function 428 .type __arm926_setup, #function
431__arm926_setup: 429__arm926_setup:
432 mov r0, #0 430 mov r0, #0
diff --git a/arch/arm/mm/proc-arm940.S b/arch/arm/mm/proc-arm940.S
index 8da189d4a402..1c39a704ff6e 100644
--- a/arch/arm/mm/proc-arm940.S
+++ b/arch/arm/mm/proc-arm940.S
@@ -273,8 +273,6 @@ ENDPROC(arm940_dma_unmap_area)
273 @ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S) 273 @ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S)
274 define_cache_functions arm940 274 define_cache_functions arm940
275 275
276 __CPUINIT
277
278 .type __arm940_setup, #function 276 .type __arm940_setup, #function
279__arm940_setup: 277__arm940_setup:
280 mov r0, #0 278 mov r0, #0
diff --git a/arch/arm/mm/proc-arm946.S b/arch/arm/mm/proc-arm946.S
index f666cf34075a..0289cd905e73 100644
--- a/arch/arm/mm/proc-arm946.S
+++ b/arch/arm/mm/proc-arm946.S
@@ -326,8 +326,6 @@ ENTRY(cpu_arm946_dcache_clean_area)
326 mcr p15, 0, r0, c7, c10, 4 @ drain WB 326 mcr p15, 0, r0, c7, c10, 4 @ drain WB
327 mov pc, lr 327 mov pc, lr
328 328
329 __CPUINIT
330
331 .type __arm946_setup, #function 329 .type __arm946_setup, #function
332__arm946_setup: 330__arm946_setup:
333 mov r0, #0 331 mov r0, #0
diff --git a/arch/arm/mm/proc-arm9tdmi.S b/arch/arm/mm/proc-arm9tdmi.S
index 8881391dfb9e..f51197ba754a 100644
--- a/arch/arm/mm/proc-arm9tdmi.S
+++ b/arch/arm/mm/proc-arm9tdmi.S
@@ -51,8 +51,6 @@ ENTRY(cpu_arm9tdmi_reset)
51ENDPROC(cpu_arm9tdmi_reset) 51ENDPROC(cpu_arm9tdmi_reset)
52 .popsection 52 .popsection
53 53
54 __CPUINIT
55
56 .type __arm9tdmi_setup, #function 54 .type __arm9tdmi_setup, #function
57__arm9tdmi_setup: 55__arm9tdmi_setup:
58 mov pc, lr 56 mov pc, lr
diff --git a/arch/arm/mm/proc-fa526.S b/arch/arm/mm/proc-fa526.S
index aaeb6c127c7a..2dfc0f1d3bfd 100644
--- a/arch/arm/mm/proc-fa526.S
+++ b/arch/arm/mm/proc-fa526.S
@@ -135,8 +135,6 @@ ENTRY(cpu_fa526_set_pte_ext)
135#endif 135#endif
136 mov pc, lr 136 mov pc, lr
137 137
138 __CPUINIT
139
140 .type __fa526_setup, #function 138 .type __fa526_setup, #function
141__fa526_setup: 139__fa526_setup:
142 /* On return of this routine, r0 must carry correct flags for CFG register */ 140 /* On return of this routine, r0 must carry correct flags for CFG register */
diff --git a/arch/arm/mm/proc-feroceon.S b/arch/arm/mm/proc-feroceon.S
index 4106b09e0c29..d5146b98c8d1 100644
--- a/arch/arm/mm/proc-feroceon.S
+++ b/arch/arm/mm/proc-feroceon.S
@@ -514,8 +514,6 @@ ENTRY(cpu_feroceon_set_pte_ext)
514#endif 514#endif
515 mov pc, lr 515 mov pc, lr
516 516
517 __CPUINIT
518
519 .type __feroceon_setup, #function 517 .type __feroceon_setup, #function
520__feroceon_setup: 518__feroceon_setup:
521 mov r0, #0 519 mov r0, #0
diff --git a/arch/arm/mm/proc-mohawk.S b/arch/arm/mm/proc-mohawk.S
index 0b60dd3d742a..40acba595731 100644
--- a/arch/arm/mm/proc-mohawk.S
+++ b/arch/arm/mm/proc-mohawk.S
@@ -383,8 +383,6 @@ ENTRY(cpu_mohawk_do_resume)
383ENDPROC(cpu_mohawk_do_resume) 383ENDPROC(cpu_mohawk_do_resume)
384#endif 384#endif
385 385
386 __CPUINIT
387
388 .type __mohawk_setup, #function 386 .type __mohawk_setup, #function
389__mohawk_setup: 387__mohawk_setup:
390 mov r0, #0 388 mov r0, #0
diff --git a/arch/arm/mm/proc-sa110.S b/arch/arm/mm/proc-sa110.S
index 775d70fba937..c45319c8f1d9 100644
--- a/arch/arm/mm/proc-sa110.S
+++ b/arch/arm/mm/proc-sa110.S
@@ -159,8 +159,6 @@ ENTRY(cpu_sa110_set_pte_ext)
159#endif 159#endif
160 mov pc, lr 160 mov pc, lr
161 161
162 __CPUINIT
163
164 .type __sa110_setup, #function 162 .type __sa110_setup, #function
165__sa110_setup: 163__sa110_setup:
166 mov r10, #0 164 mov r10, #0
diff --git a/arch/arm/mm/proc-sa1100.S b/arch/arm/mm/proc-sa1100.S
index d92dfd081429..09d241ae2dbe 100644
--- a/arch/arm/mm/proc-sa1100.S
+++ b/arch/arm/mm/proc-sa1100.S
@@ -198,8 +198,6 @@ ENTRY(cpu_sa1100_do_resume)
198ENDPROC(cpu_sa1100_do_resume) 198ENDPROC(cpu_sa1100_do_resume)
199#endif 199#endif
200 200
201 __CPUINIT
202
203 .type __sa1100_setup, #function 201 .type __sa1100_setup, #function
204__sa1100_setup: 202__sa1100_setup:
205 mov r0, #0 203 mov r0, #0
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 2d1ef87328a1..1128064fddcb 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -180,8 +180,6 @@ ENDPROC(cpu_v6_do_resume)
180 180
181 .align 181 .align
182 182
183 __CPUINIT
184
185/* 183/*
186 * __v6_setup 184 * __v6_setup
187 * 185 *
diff --git a/arch/arm/mm/proc-v7-2level.S b/arch/arm/mm/proc-v7-2level.S
index 9704097c450e..f64afb9f1bd5 100644
--- a/arch/arm/mm/proc-v7-2level.S
+++ b/arch/arm/mm/proc-v7-2level.S
@@ -160,8 +160,6 @@ ENDPROC(cpu_v7_set_pte_ext)
160 mcr p15, 0, \ttbr1, c2, c0, 1 @ load TTB1 160 mcr p15, 0, \ttbr1, c2, c0, 1 @ load TTB1
161 .endm 161 .endm
162 162
163 __CPUINIT
164
165 /* AT 163 /* AT
166 * TFR EV X F I D LR S 164 * TFR EV X F I D LR S
167 * .EEE ..EE PUI. .T.T 4RVI ZWRS BLDP WCAM 165 * .EEE ..EE PUI. .T.T 4RVI ZWRS BLDP WCAM
@@ -172,5 +170,3 @@ ENDPROC(cpu_v7_set_pte_ext)
172 .type v7_crval, #object 170 .type v7_crval, #object
173v7_crval: 171v7_crval:
174 crval clear=0x2120c302, mmuset=0x10c03c7d, ucset=0x00c01c7c 172 crval clear=0x2120c302, mmuset=0x10c03c7d, ucset=0x00c01c7c
175
176 .previous
diff --git a/arch/arm/mm/proc-v7-3level.S b/arch/arm/mm/proc-v7-3level.S
index 5ffe1956c6d9..c36ac69488c8 100644
--- a/arch/arm/mm/proc-v7-3level.S
+++ b/arch/arm/mm/proc-v7-3level.S
@@ -140,8 +140,6 @@ ENDPROC(cpu_v7_set_pte_ext)
140 mcrr p15, 0, \ttbr0, \zero, c2 @ load TTBR0 140 mcrr p15, 0, \ttbr0, \zero, c2 @ load TTBR0
141 .endm 141 .endm
142 142
143 __CPUINIT
144
145 /* 143 /*
146 * AT 144 * AT
147 * TFR EV X F IHD LR S 145 * TFR EV X F IHD LR S
@@ -153,5 +151,3 @@ ENDPROC(cpu_v7_set_pte_ext)
153 .type v7_crval, #object 151 .type v7_crval, #object
154v7_crval: 152v7_crval:
155 crval clear=0x0120c302, mmuset=0x30c23c7d, ucset=0x00c01c7c 153 crval clear=0x0120c302, mmuset=0x30c23c7d, ucset=0x00c01c7c
156
157 .previous
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 7ef3ad05df39..5c6d5a3050ea 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -167,8 +167,6 @@ ENDPROC(cpu_pj4b_do_idle)
167 167
168#endif 168#endif
169 169
170 __CPUINIT
171
172/* 170/*
173 * __v7_setup 171 * __v7_setup
174 * 172 *
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S
index e8efd83b6f25..dc1645890042 100644
--- a/arch/arm/mm/proc-xsc3.S
+++ b/arch/arm/mm/proc-xsc3.S
@@ -446,8 +446,6 @@ ENTRY(cpu_xsc3_do_resume)
446ENDPROC(cpu_xsc3_do_resume) 446ENDPROC(cpu_xsc3_do_resume)
447#endif 447#endif
448 448
449 __CPUINIT
450
451 .type __xsc3_setup, #function 449 .type __xsc3_setup, #function
452__xsc3_setup: 450__xsc3_setup:
453 mov r0, #PSR_F_BIT|PSR_I_BIT|SVC_MODE 451 mov r0, #PSR_F_BIT|PSR_I_BIT|SVC_MODE
diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S
index e766f889bfd6..d19b1cfcad91 100644
--- a/arch/arm/mm/proc-xscale.S
+++ b/arch/arm/mm/proc-xscale.S
@@ -558,8 +558,6 @@ ENTRY(cpu_xscale_do_resume)
558ENDPROC(cpu_xscale_do_resume) 558ENDPROC(cpu_xscale_do_resume)
559#endif 559#endif
560 560
561 __CPUINIT
562
563 .type __xscale_setup, #function 561 .type __xscale_setup, #function
564__xscale_setup: 562__xscale_setup:
565 mcr p15, 0, ip, c7, c7, 0 @ invalidate I, D caches & BTB 563 mcr p15, 0, ip, c7, c7, 0 @ invalidate I, D caches & BTB
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
index 1a643ee8e082..f50d223a0bd3 100644
--- a/arch/arm/net/bpf_jit_32.c
+++ b/arch/arm/net/bpf_jit_32.c
@@ -900,8 +900,7 @@ void bpf_jit_compile(struct sk_filter *fp)
900#endif 900#endif
901 901
902 alloc_size = 4 * ctx.idx; 902 alloc_size = 4 * ctx.idx;
903 ctx.target = module_alloc(max(sizeof(struct work_struct), 903 ctx.target = module_alloc(alloc_size);
904 alloc_size));
905 if (unlikely(ctx.target == NULL)) 904 if (unlikely(ctx.target == NULL))
906 goto out; 905 goto out;
907 906
@@ -927,19 +926,8 @@ out:
927 return; 926 return;
928} 927}
929 928
930static void bpf_jit_free_worker(struct work_struct *work)
931{
932 module_free(NULL, work);
933}
934
935void bpf_jit_free(struct sk_filter *fp) 929void bpf_jit_free(struct sk_filter *fp)
936{ 930{
937 struct work_struct *work; 931 if (fp->bpf_func != sk_run_filter)
938 932 module_free(NULL, fp->bpf_func);
939 if (fp->bpf_func != sk_run_filter) {
940 work = (struct work_struct *)fp->bpf_func;
941
942 INIT_WORK(work, bpf_jit_free_worker);
943 schedule_work(work);
944 }
945} 933}
diff --git a/arch/arm/plat-iop/gpio.c b/arch/arm/plat-iop/gpio.c
index e4de9be78feb..697de6dc4936 100644
--- a/arch/arm/plat-iop/gpio.c
+++ b/arch/arm/plat-iop/gpio.c
@@ -17,6 +17,7 @@
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/export.h> 18#include <linux/export.h>
19#include <asm/hardware/iop3xx.h> 19#include <asm/hardware/iop3xx.h>
20#include <mach/gpio.h>
20 21
21void gpio_line_config(int line, int direction) 22void gpio_line_config(int line, int direction)
22{ 23{
diff --git a/arch/arm/plat-iop/restart.c b/arch/arm/plat-iop/restart.c
index 33fa699a4d28..3a4d5e5fde52 100644
--- a/arch/arm/plat-iop/restart.c
+++ b/arch/arm/plat-iop/restart.c
@@ -11,7 +11,7 @@
11#include <asm/system_misc.h> 11#include <asm/system_misc.h>
12#include <mach/hardware.h> 12#include <mach/hardware.h>
13 13
14void iop3xx_restart(char mode, const char *cmd) 14void iop3xx_restart(enum reboot_mode mode, const char *cmd)
15{ 15{
16 *IOP3XX_PCSR = 0x30; 16 *IOP3XX_PCSR = 0x30;
17 17
diff --git a/arch/arm/plat-iop/time.c b/arch/arm/plat-iop/time.c
index 837a2d52e9db..29606bd75f3f 100644
--- a/arch/arm/plat-iop/time.c
+++ b/arch/arm/plat-iop/time.c
@@ -22,9 +22,9 @@
22#include <linux/clocksource.h> 22#include <linux/clocksource.h>
23#include <linux/clockchips.h> 23#include <linux/clockchips.h>
24#include <linux/export.h> 24#include <linux/export.h>
25#include <linux/sched_clock.h>
25#include <mach/hardware.h> 26#include <mach/hardware.h>
26#include <asm/irq.h> 27#include <asm/irq.h>
27#include <asm/sched_clock.h>
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/mach/irq.h> 29#include <asm/mach/irq.h>
30#include <asm/mach/time.h> 30#include <asm/mach/time.h>
diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
index 5b0b86bb34bb..d9bc98eb2a6b 100644
--- a/arch/arm/plat-omap/counter_32k.c
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -18,9 +18,9 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/io.h> 19#include <linux/io.h>
20#include <linux/clocksource.h> 20#include <linux/clocksource.h>
21#include <linux/sched_clock.h>
21 22
22#include <asm/mach/time.h> 23#include <asm/mach/time.h>
23#include <asm/sched_clock.h>
24 24
25#include <plat/counter-32k.h> 25#include <plat/counter-32k.h>
26 26
diff --git a/arch/arm/plat-orion/time.c b/arch/arm/plat-orion/time.c
index 5d5ac0f05422..9d2b2ac74938 100644
--- a/arch/arm/plat-orion/time.c
+++ b/arch/arm/plat-orion/time.c
@@ -16,7 +16,7 @@
16#include <linux/clockchips.h> 16#include <linux/clockchips.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/irq.h> 18#include <linux/irq.h>
19#include <asm/sched_clock.h> 19#include <linux/sched_clock.h>
20 20
21/* 21/*
22 * MBus bridge block registers. 22 * MBus bridge block registers.
diff --git a/arch/arm/plat-samsung/samsung-time.c b/arch/arm/plat-samsung/samsung-time.c
index f899cbc9b288..2957075ca836 100644
--- a/arch/arm/plat-samsung/samsung-time.c
+++ b/arch/arm/plat-samsung/samsung-time.c
@@ -15,12 +15,12 @@
15#include <linux/clk.h> 15#include <linux/clk.h>
16#include <linux/clockchips.h> 16#include <linux/clockchips.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/sched_clock.h>
18 19
19#include <asm/smp_twd.h> 20#include <asm/smp_twd.h>
20#include <asm/mach/time.h> 21#include <asm/mach/time.h>
21#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
22#include <asm/mach/map.h> 23#include <asm/mach/map.h>
23#include <asm/sched_clock.h>
24 24
25#include <mach/map.h> 25#include <mach/map.h>
26#include <plat/devs.h> 26#include <plat/devs.h>
diff --git a/arch/arm/plat-versatile/platsmp.c b/arch/arm/plat-versatile/platsmp.c
index 1e1b2d769748..39895d892c3b 100644
--- a/arch/arm/plat-versatile/platsmp.c
+++ b/arch/arm/plat-versatile/platsmp.c
@@ -23,7 +23,7 @@
23 * observers, irrespective of whether they're taking part in coherency 23 * observers, irrespective of whether they're taking part in coherency
24 * or not. This is necessary for the hotplug code to work reliably. 24 * or not. This is necessary for the hotplug code to work reliably.
25 */ 25 */
26static void __cpuinit write_pen_release(int val) 26static void write_pen_release(int val)
27{ 27{
28 pen_release = val; 28 pen_release = val;
29 smp_wmb(); 29 smp_wmb();
@@ -33,7 +33,7 @@ static void __cpuinit write_pen_release(int val)
33 33
34static DEFINE_SPINLOCK(boot_lock); 34static DEFINE_SPINLOCK(boot_lock);
35 35
36void __cpuinit versatile_secondary_init(unsigned int cpu) 36void versatile_secondary_init(unsigned int cpu)
37{ 37{
38 /* 38 /*
39 * let the primary processor know we're out of the 39 * let the primary processor know we're out of the
@@ -48,7 +48,7 @@ void __cpuinit versatile_secondary_init(unsigned int cpu)
48 spin_unlock(&boot_lock); 48 spin_unlock(&boot_lock);
49} 49}
50 50
51int __cpuinit versatile_boot_secondary(unsigned int cpu, struct task_struct *idle) 51int versatile_boot_secondary(unsigned int cpu, struct task_struct *idle)
52{ 52{
53 unsigned long timeout; 53 unsigned long timeout;
54 54
diff --git a/arch/arm/plat-versatile/sched-clock.c b/arch/arm/plat-versatile/sched-clock.c
index b33b74c87232..51b109e3b6c3 100644
--- a/arch/arm/plat-versatile/sched-clock.c
+++ b/arch/arm/plat-versatile/sched-clock.c
@@ -20,8 +20,8 @@
20 */ 20 */
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/sched_clock.h>
23 24
24#include <asm/sched_clock.h>
25#include <plat/sched_clock.h> 25#include <plat/sched_clock.h>
26 26
27static void __iomem *ctr; 27static void __iomem *ctr;
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 13609e01f4b7..f71c37edca26 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -314,4 +314,5 @@ EXPORT_SYMBOL_GPL(HYPERVISOR_hvm_op);
314EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op); 314EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op);
315EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op); 315EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op);
316EXPORT_SYMBOL_GPL(HYPERVISOR_vcpu_op); 316EXPORT_SYMBOL_GPL(HYPERVISOR_vcpu_op);
317EXPORT_SYMBOL_GPL(HYPERVISOR_tmem_op);
317EXPORT_SYMBOL_GPL(privcmd_call); 318EXPORT_SYMBOL_GPL(privcmd_call);
diff --git a/arch/arm/xen/hypercall.S b/arch/arm/xen/hypercall.S
index 199cb2da7663..d1cf7b7c2200 100644
--- a/arch/arm/xen/hypercall.S
+++ b/arch/arm/xen/hypercall.S
@@ -88,6 +88,7 @@ HYPERCALL2(hvm_op);
88HYPERCALL2(memory_op); 88HYPERCALL2(memory_op);
89HYPERCALL2(physdev_op); 89HYPERCALL2(physdev_op);
90HYPERCALL3(vcpu_op); 90HYPERCALL3(vcpu_op);
91HYPERCALL1(tmem_op);
91 92
92ENTRY(privcmd_call) 93ENTRY(privcmd_call)
93 stmdb sp!, {r4} 94 stmdb sp!, {r4}
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 4143d9b0d87a..9737e97f9f38 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -270,6 +270,8 @@ source "drivers/Kconfig"
270 270
271source "fs/Kconfig" 271source "fs/Kconfig"
272 272
273source "arch/arm64/kvm/Kconfig"
274
273source "arch/arm64/Kconfig.debug" 275source "arch/arm64/Kconfig.debug"
274 276
275source "security/Kconfig" 277source "security/Kconfig"
diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h
index d56ed11ba9a3..98abd476992d 100644
--- a/arch/arm64/include/asm/arch_timer.h
+++ b/arch/arm64/include/asm/arch_timer.h
@@ -97,7 +97,7 @@ static inline u32 arch_timer_get_cntfrq(void)
97 return val; 97 return val;
98} 98}
99 99
100static inline void __cpuinit arch_counter_set_user_access(void) 100static inline void arch_counter_set_user_access(void)
101{ 101{
102 u32 cntkctl; 102 u32 cntkctl;
103 103
diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h
index ef8235c68c09..a2232d07be9d 100644
--- a/arch/arm64/include/asm/debug-monitors.h
+++ b/arch/arm64/include/asm/debug-monitors.h
@@ -83,14 +83,7 @@ static inline int reinstall_suspended_bps(struct pt_regs *regs)
83} 83}
84#endif 84#endif
85 85
86#ifdef CONFIG_COMPAT
87int aarch32_break_handler(struct pt_regs *regs); 86int aarch32_break_handler(struct pt_regs *regs);
88#else
89static int aarch32_break_handler(struct pt_regs *regs)
90{
91 return -EFAULT;
92}
93#endif
94 87
95#endif /* __ASSEMBLY */ 88#endif /* __ASSEMBLY */
96#endif /* __KERNEL__ */ 89#endif /* __KERNEL__ */
diff --git a/arch/arm64/include/asm/system_misc.h b/arch/arm64/include/asm/system_misc.h
index a6e1750369ef..7a18fabbe0f6 100644
--- a/arch/arm64/include/asm/system_misc.h
+++ b/arch/arm64/include/asm/system_misc.h
@@ -23,6 +23,7 @@
23#include <linux/compiler.h> 23#include <linux/compiler.h>
24#include <linux/linkage.h> 24#include <linux/linkage.h>
25#include <linux/irqflags.h> 25#include <linux/irqflags.h>
26#include <linux/reboot.h>
26 27
27struct pt_regs; 28struct pt_regs;
28 29
@@ -41,7 +42,7 @@ extern void show_pte(struct mm_struct *mm, unsigned long addr);
41extern void __show_regs(struct pt_regs *); 42extern void __show_regs(struct pt_regs *);
42 43
43void soft_restart(unsigned long); 44void soft_restart(unsigned long);
44extern void (*arm_pm_restart)(char str, const char *cmd); 45extern void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
45 46
46#define UDBG_UNDEFINED (1 << 0) 47#define UDBG_UNDEFINED (1 << 0)
47#define UDBG_SYSCALL (1 << 1) 48#define UDBG_SYSCALL (1 << 1)
diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c
index 49c162c03b69..666e231d410b 100644
--- a/arch/arm64/kernel/asm-offsets.c
+++ b/arch/arm64/kernel/asm-offsets.c
@@ -21,6 +21,7 @@
21#include <linux/sched.h> 21#include <linux/sched.h>
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/dma-mapping.h> 23#include <linux/dma-mapping.h>
24#include <linux/kvm_host.h>
24#include <asm/thread_info.h> 25#include <asm/thread_info.h>
25#include <asm/memory.h> 26#include <asm/memory.h>
26#include <asm/cputable.h> 27#include <asm/cputable.h>
diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
index 08018e3df580..cbfacf7fb438 100644
--- a/arch/arm64/kernel/debug-monitors.c
+++ b/arch/arm64/kernel/debug-monitors.c
@@ -141,7 +141,7 @@ static void clear_os_lock(void *unused)
141 isb(); 141 isb();
142} 142}
143 143
144static int __cpuinit os_lock_notify(struct notifier_block *self, 144static int os_lock_notify(struct notifier_block *self,
145 unsigned long action, void *data) 145 unsigned long action, void *data)
146{ 146{
147 int cpu = (unsigned long)data; 147 int cpu = (unsigned long)data;
@@ -150,11 +150,11 @@ static int __cpuinit os_lock_notify(struct notifier_block *self,
150 return NOTIFY_OK; 150 return NOTIFY_OK;
151} 151}
152 152
153static struct notifier_block __cpuinitdata os_lock_nb = { 153static struct notifier_block os_lock_nb = {
154 .notifier_call = os_lock_notify, 154 .notifier_call = os_lock_notify,
155}; 155};
156 156
157static int __cpuinit debug_monitors_init(void) 157static int debug_monitors_init(void)
158{ 158{
159 /* Clear the OS lock. */ 159 /* Clear the OS lock. */
160 smp_call_function(clear_os_lock, NULL, 1); 160 smp_call_function(clear_os_lock, NULL, 1);
diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
index 5ab825c59db9..329218ca9ffb 100644
--- a/arch/arm64/kernel/hw_breakpoint.c
+++ b/arch/arm64/kernel/hw_breakpoint.c
@@ -821,7 +821,7 @@ static void reset_ctrl_regs(void *unused)
821 } 821 }
822} 822}
823 823
824static int __cpuinit hw_breakpoint_reset_notify(struct notifier_block *self, 824static int hw_breakpoint_reset_notify(struct notifier_block *self,
825 unsigned long action, 825 unsigned long action,
826 void *hcpu) 826 void *hcpu)
827{ 827{
@@ -831,7 +831,7 @@ static int __cpuinit hw_breakpoint_reset_notify(struct notifier_block *self,
831 return NOTIFY_OK; 831 return NOTIFY_OK;
832} 832}
833 833
834static struct notifier_block __cpuinitdata hw_breakpoint_reset_nb = { 834static struct notifier_block hw_breakpoint_reset_nb = {
835 .notifier_call = hw_breakpoint_reset_notify, 835 .notifier_call = hw_breakpoint_reset_notify,
836}; 836};
837 837
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 46f02c3b5015..1788bf6b471f 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -132,7 +132,7 @@ void machine_restart(char *cmd)
132 132
133 /* Now call the architecture specific reboot code. */ 133 /* Now call the architecture specific reboot code. */
134 if (arm_pm_restart) 134 if (arm_pm_restart)
135 arm_pm_restart('h', cmd); 135 arm_pm_restart(reboot_mode, cmd);
136 136
137 /* 137 /*
138 * Whoops - the architecture was unable to reboot. 138 * Whoops - the architecture was unable to reboot.
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 5d54e3717bf8..fee5cce83450 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -71,7 +71,7 @@ static DEFINE_RAW_SPINLOCK(boot_lock);
71 * in coherency or not. This is necessary for the hotplug code to work 71 * in coherency or not. This is necessary for the hotplug code to work
72 * reliably. 72 * reliably.
73 */ 73 */
74static void __cpuinit write_pen_release(u64 val) 74static void write_pen_release(u64 val)
75{ 75{
76 void *start = (void *)&secondary_holding_pen_release; 76 void *start = (void *)&secondary_holding_pen_release;
77 unsigned long size = sizeof(secondary_holding_pen_release); 77 unsigned long size = sizeof(secondary_holding_pen_release);
@@ -84,7 +84,7 @@ static void __cpuinit write_pen_release(u64 val)
84 * Boot a secondary CPU, and assign it the specified idle task. 84 * Boot a secondary CPU, and assign it the specified idle task.
85 * This also gives us the initial stack to use for this CPU. 85 * This also gives us the initial stack to use for this CPU.
86 */ 86 */
87static int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) 87static int boot_secondary(unsigned int cpu, struct task_struct *idle)
88{ 88{
89 unsigned long timeout; 89 unsigned long timeout;
90 90
@@ -122,7 +122,7 @@ static int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
122 122
123static DECLARE_COMPLETION(cpu_running); 123static DECLARE_COMPLETION(cpu_running);
124 124
125int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) 125int __cpu_up(unsigned int cpu, struct task_struct *idle)
126{ 126{
127 int ret; 127 int ret;
128 128
@@ -162,7 +162,7 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
162 * This is the secondary CPU boot entry. We're using this CPUs 162 * This is the secondary CPU boot entry. We're using this CPUs
163 * idle thread stack, but a set of temporary page tables. 163 * idle thread stack, but a set of temporary page tables.
164 */ 164 */
165asmlinkage void __cpuinit secondary_start_kernel(void) 165asmlinkage void secondary_start_kernel(void)
166{ 166{
167 struct mm_struct *mm = &init_mm; 167 struct mm_struct *mm = &init_mm;
168 unsigned int cpu = smp_processor_id(); 168 unsigned int cpu = smp_processor_id();
@@ -200,13 +200,6 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
200 raw_spin_unlock(&boot_lock); 200 raw_spin_unlock(&boot_lock);
201 201
202 /* 202 /*
203 * Enable local interrupts.
204 */
205 notify_cpu_starting(cpu);
206 local_irq_enable();
207 local_fiq_enable();
208
209 /*
210 * OK, now it's safe to let the boot CPU continue. Wait for 203 * OK, now it's safe to let the boot CPU continue. Wait for
211 * the CPU migration code to notice that the CPU is online 204 * the CPU migration code to notice that the CPU is online
212 * before we continue. 205 * before we continue.
@@ -215,6 +208,14 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
215 complete(&cpu_running); 208 complete(&cpu_running);
216 209
217 /* 210 /*
211 * Enable GIC and timers.
212 */
213 notify_cpu_starting(cpu);
214
215 local_irq_enable();
216 local_fiq_enable();
217
218 /*
218 * OK, it's off to the idle thread for us 219 * OK, it's off to the idle thread for us
219 */ 220 */
220 cpu_startup_entry(CPUHP_ONLINE); 221 cpu_startup_entry(CPUHP_ONLINE);
diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig
new file mode 100644
index 000000000000..21e90820bd23
--- /dev/null
+++ b/arch/arm64/kvm/Kconfig
@@ -0,0 +1,51 @@
1#
2# KVM configuration
3#
4
5source "virt/kvm/Kconfig"
6
7menuconfig VIRTUALIZATION
8 bool "Virtualization"
9 ---help---
10 Say Y here to get to see options for using your Linux host to run
11 other operating systems inside virtual machines (guests).
12 This option alone does not add any kernel code.
13
14 If you say N, all options in this submenu will be skipped and
15 disabled.
16
17if VIRTUALIZATION
18
19config KVM
20 bool "Kernel-based Virtual Machine (KVM) support"
21 select MMU_NOTIFIER
22 select PREEMPT_NOTIFIERS
23 select ANON_INODES
24 select KVM_MMIO
25 select KVM_ARM_HOST
26 select KVM_ARM_VGIC
27 select KVM_ARM_TIMER
28 ---help---
29 Support hosting virtualized guest machines.
30
31 If unsure, say N.
32
33config KVM_ARM_HOST
34 bool
35 ---help---
36 Provides host support for ARM processors.
37
38config KVM_ARM_VGIC
39 bool
40 depends on KVM_ARM_HOST && OF
41 select HAVE_KVM_IRQCHIP
42 ---help---
43 Adds support for a hardware assisted, in-kernel GIC emulation.
44
45config KVM_ARM_TIMER
46 bool
47 depends on KVM_ARM_VGIC
48 ---help---
49 Adds support for the Architected Timers in virtual machines.
50
51endif # VIRTUALIZATION
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 0ecac8980aae..6c8ba25bf6bb 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -152,25 +152,8 @@ void do_bad_area(unsigned long addr, unsigned int esr, struct pt_regs *regs)
152#define ESR_CM (1 << 8) 152#define ESR_CM (1 << 8)
153#define ESR_LNX_EXEC (1 << 24) 153#define ESR_LNX_EXEC (1 << 24)
154 154
155/*
156 * Check that the permissions on the VMA allow for the fault which occurred.
157 * If we encountered a write fault, we must have write permission, otherwise
158 * we allow any permission.
159 */
160static inline bool access_error(unsigned int esr, struct vm_area_struct *vma)
161{
162 unsigned int mask = VM_READ | VM_WRITE | VM_EXEC;
163
164 if (esr & ESR_WRITE)
165 mask = VM_WRITE;
166 if (esr & ESR_LNX_EXEC)
167 mask = VM_EXEC;
168
169 return vma->vm_flags & mask ? false : true;
170}
171
172static int __do_page_fault(struct mm_struct *mm, unsigned long addr, 155static int __do_page_fault(struct mm_struct *mm, unsigned long addr,
173 unsigned int esr, unsigned int flags, 156 unsigned int mm_flags, unsigned long vm_flags,
174 struct task_struct *tsk) 157 struct task_struct *tsk)
175{ 158{
176 struct vm_area_struct *vma; 159 struct vm_area_struct *vma;
@@ -188,12 +171,17 @@ static int __do_page_fault(struct mm_struct *mm, unsigned long addr,
188 * it. 171 * it.
189 */ 172 */
190good_area: 173good_area:
191 if (access_error(esr, vma)) { 174 /*
175 * Check that the permissions on the VMA allow for the fault which
176 * occurred. If we encountered a write or exec fault, we must have
177 * appropriate permissions, otherwise we allow any permission.
178 */
179 if (!(vma->vm_flags & vm_flags)) {
192 fault = VM_FAULT_BADACCESS; 180 fault = VM_FAULT_BADACCESS;
193 goto out; 181 goto out;
194 } 182 }
195 183
196 return handle_mm_fault(mm, vma, addr & PAGE_MASK, flags); 184 return handle_mm_fault(mm, vma, addr & PAGE_MASK, mm_flags);
197 185
198check_stack: 186check_stack:
199 if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr)) 187 if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr))
@@ -208,9 +196,15 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
208 struct task_struct *tsk; 196 struct task_struct *tsk;
209 struct mm_struct *mm; 197 struct mm_struct *mm;
210 int fault, sig, code; 198 int fault, sig, code;
211 bool write = (esr & ESR_WRITE) && !(esr & ESR_CM); 199 unsigned long vm_flags = VM_READ | VM_WRITE | VM_EXEC;
212 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE | 200 unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
213 (write ? FAULT_FLAG_WRITE : 0); 201
202 if (esr & ESR_LNX_EXEC) {
203 vm_flags = VM_EXEC;
204 } else if ((esr & ESR_WRITE) && !(esr & ESR_CM)) {
205 vm_flags = VM_WRITE;
206 mm_flags |= FAULT_FLAG_WRITE;
207 }
214 208
215 tsk = current; 209 tsk = current;
216 mm = tsk->mm; 210 mm = tsk->mm;
@@ -248,7 +242,7 @@ retry:
248#endif 242#endif
249 } 243 }
250 244
251 fault = __do_page_fault(mm, addr, esr, flags, tsk); 245 fault = __do_page_fault(mm, addr, mm_flags, vm_flags, tsk);
252 246
253 /* 247 /*
254 * If we need to retry but a fatal signal is pending, handle the 248 * If we need to retry but a fatal signal is pending, handle the
@@ -265,7 +259,7 @@ retry:
265 */ 259 */
266 260
267 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr); 261 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr);
268 if (flags & FAULT_FLAG_ALLOW_RETRY) { 262 if (mm_flags & FAULT_FLAG_ALLOW_RETRY) {
269 if (fault & VM_FAULT_MAJOR) { 263 if (fault & VM_FAULT_MAJOR) {
270 tsk->maj_flt++; 264 tsk->maj_flt++;
271 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, 265 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs,
@@ -280,7 +274,7 @@ retry:
280 * Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk of 274 * Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk of
281 * starvation. 275 * starvation.
282 */ 276 */
283 flags &= ~FAULT_FLAG_ALLOW_RETRY; 277 mm_flags &= ~FAULT_FLAG_ALLOW_RETRY;
284 goto retry; 278 goto retry;
285 } 279 }
286 } 280 }
diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c
index 7c7be7855638..8ed6cb1a900f 100644
--- a/arch/arm64/mm/mmap.c
+++ b/arch/arm64/mm/mmap.c
@@ -90,11 +90,9 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
90 if (mmap_is_legacy()) { 90 if (mmap_is_legacy()) {
91 mm->mmap_base = TASK_UNMAPPED_BASE; 91 mm->mmap_base = TASK_UNMAPPED_BASE;
92 mm->get_unmapped_area = arch_get_unmapped_area; 92 mm->get_unmapped_area = arch_get_unmapped_area;
93 mm->unmap_area = arch_unmap_area;
94 } else { 93 } else {
95 mm->mmap_base = mmap_base(); 94 mm->mmap_base = mmap_base();
96 mm->get_unmapped_area = arch_get_unmapped_area_topdown; 95 mm->get_unmapped_area = arch_get_unmapped_area_topdown;
97 mm->unmap_area = arch_unmap_area_topdown;
98 } 96 }
99} 97}
100EXPORT_SYMBOL_GPL(arch_pick_mmap_layout); 98EXPORT_SYMBOL_GPL(arch_pick_mmap_layout);
diff --git a/arch/arm64/xen/hypercall.S b/arch/arm64/xen/hypercall.S
index 2816c479cd49..531342ec4bcf 100644
--- a/arch/arm64/xen/hypercall.S
+++ b/arch/arm64/xen/hypercall.S
@@ -79,6 +79,7 @@ HYPERCALL2(hvm_op);
79HYPERCALL2(memory_op); 79HYPERCALL2(memory_op);
80HYPERCALL2(physdev_op); 80HYPERCALL2(physdev_op);
81HYPERCALL3(vcpu_op); 81HYPERCALL3(vcpu_op);
82HYPERCALL1(tmem_op);
82 83
83ENTRY(privcmd_call) 84ENTRY(privcmd_call)
84 mov x16, x0 85 mov x16, x0
diff --git a/arch/avr32/include/uapi/asm/socket.h b/arch/avr32/include/uapi/asm/socket.h
index 37401f535126..11c4259c62fb 100644
--- a/arch/avr32/include/uapi/asm/socket.h
+++ b/arch/avr32/include/uapi/asm/socket.h
@@ -74,4 +74,6 @@
74 74
75#define SO_SELECT_ERR_QUEUE 45 75#define SO_SELECT_ERR_QUEUE 45
76 76
77#define SO_BUSY_POLL 46
78
77#endif /* __ASM_AVR32_SOCKET_H */ 79#endif /* __ASM_AVR32_SOCKET_H */
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 08c7ac650405..3b6abc54b015 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -283,7 +283,7 @@ config BF_REV_0_0
283 283
284config BF_REV_0_1 284config BF_REV_0_1
285 bool "0.1" 285 bool "0.1"
286 depends on (BF51x || BF52x || (BF54x && !BF54xM)) 286 depends on (BF51x || BF52x || (BF54x && !BF54xM) || BF60x)
287 287
288config BF_REV_0_2 288config BF_REV_0_2
289 bool "0.2" 289 bool "0.2"
diff --git a/arch/blackfin/include/asm/bfin6xx_spi.h b/arch/blackfin/include/asm/bfin_spi3.h
index 89370b653dcd..0957e65a54be 100644
--- a/arch/blackfin/include/asm/bfin6xx_spi.h
+++ b/arch/blackfin/include/asm/bfin_spi3.h
@@ -240,7 +240,7 @@ struct bfin_spi_regs {
240#define MAX_CTRL_CS 8 /* cs in spi controller */ 240#define MAX_CTRL_CS 8 /* cs in spi controller */
241 241
242/* device.platform_data for SSP controller devices */ 242/* device.platform_data for SSP controller devices */
243struct bfin6xx_spi_master { 243struct bfin_spi3_master {
244 u16 num_chipselect; 244 u16 num_chipselect;
245 u16 pin_req[7]; 245 u16 pin_req[7];
246}; 246};
@@ -248,7 +248,7 @@ struct bfin6xx_spi_master {
248/* spi_board_info.controller_data for SPI slave devices, 248/* spi_board_info.controller_data for SPI slave devices,
249 * copied to spi_device.platform_data ... mostly for dma tuning 249 * copied to spi_device.platform_data ... mostly for dma tuning
250 */ 250 */
251struct bfin6xx_spi_chip { 251struct bfin_spi3_chip {
252 u32 control; 252 u32 control;
253 u16 cs_chg_udelay; /* Some devices require 16-bit delays */ 253 u16 cs_chg_udelay; /* Some devices require 16-bit delays */
254 u32 tx_dummy_val; /* tx value for rx only transfer */ 254 u32 tx_dummy_val; /* tx value for rx only transfer */
diff --git a/arch/blackfin/kernel/kgdb.c b/arch/blackfin/kernel/kgdb.c
index b882ce22c347..fa53faeeb0e9 100644
--- a/arch/blackfin/kernel/kgdb.c
+++ b/arch/blackfin/kernel/kgdb.c
@@ -9,6 +9,7 @@
9#include <linux/ptrace.h> /* for linux pt_regs struct */ 9#include <linux/ptrace.h> /* for linux pt_regs struct */
10#include <linux/kgdb.h> 10#include <linux/kgdb.h>
11#include <linux/uaccess.h> 11#include <linux/uaccess.h>
12#include <asm/irq_regs.h>
12 13
13void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) 14void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
14{ 15{
diff --git a/arch/blackfin/kernel/perf_event.c b/arch/blackfin/kernel/perf_event.c
index e47d19ae3e06..974e55496db3 100644
--- a/arch/blackfin/kernel/perf_event.c
+++ b/arch/blackfin/kernel/perf_event.c
@@ -468,7 +468,7 @@ static void bfin_pmu_setup(int cpu)
468 memset(cpuhw, 0, sizeof(struct cpu_hw_events)); 468 memset(cpuhw, 0, sizeof(struct cpu_hw_events));
469} 469}
470 470
471static int __cpuinit 471static int
472bfin_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu) 472bfin_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
473{ 473{
474 unsigned int cpu = (long)hcpu; 474 unsigned int cpu = (long)hcpu;
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 107b306b06f1..19ad0637e8ff 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -99,7 +99,7 @@ void __init generate_cplb_tables(void)
99} 99}
100#endif 100#endif
101 101
102void __cpuinit bfin_setup_caches(unsigned int cpu) 102void bfin_setup_caches(unsigned int cpu)
103{ 103{
104#ifdef CONFIG_BFIN_ICACHE 104#ifdef CONFIG_BFIN_ICACHE
105 bfin_icache_init(icplb_tbl[cpu]); 105 bfin_icache_init(icplb_tbl[cpu]);
@@ -165,7 +165,7 @@ void __cpuinit bfin_setup_caches(unsigned int cpu)
165#endif 165#endif
166} 166}
167 167
168void __cpuinit bfin_setup_cpudata(unsigned int cpu) 168void bfin_setup_cpudata(unsigned int cpu)
169{ 169{
170 struct blackfin_cpudata *cpudata = &per_cpu(cpu_data, cpu); 170 struct blackfin_cpudata *cpudata = &per_cpu(cpu_data, cpu);
171 171
diff --git a/arch/blackfin/mach-bf561/smp.c b/arch/blackfin/mach-bf561/smp.c
index ab1c617b9cfc..11789beca75a 100644
--- a/arch/blackfin/mach-bf561/smp.c
+++ b/arch/blackfin/mach-bf561/smp.c
@@ -48,7 +48,7 @@ int __init setup_profiling_timer(unsigned int multiplier) /* not supported */
48 return -EINVAL; 48 return -EINVAL;
49} 49}
50 50
51void __cpuinit platform_secondary_init(unsigned int cpu) 51void platform_secondary_init(unsigned int cpu)
52{ 52{
53 /* Clone setup for peripheral interrupt sources from CoreA. */ 53 /* Clone setup for peripheral interrupt sources from CoreA. */
54 bfin_write_SICB_IMASK0(bfin_read_SIC_IMASK0()); 54 bfin_write_SICB_IMASK0(bfin_read_SIC_IMASK0());
@@ -69,12 +69,11 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
69 SSYNC(); 69 SSYNC();
70 70
71 /* We are done with local CPU inits, unblock the boot CPU. */ 71 /* We are done with local CPU inits, unblock the boot CPU. */
72 set_cpu_online(cpu, true);
73 spin_lock(&boot_lock); 72 spin_lock(&boot_lock);
74 spin_unlock(&boot_lock); 73 spin_unlock(&boot_lock);
75} 74}
76 75
77int __cpuinit platform_boot_secondary(unsigned int cpu, struct task_struct *idle) 76int platform_boot_secondary(unsigned int cpu, struct task_struct *idle)
78{ 77{
79 unsigned long timeout; 78 unsigned long timeout;
80 79
@@ -91,7 +90,9 @@ int __cpuinit platform_boot_secondary(unsigned int cpu, struct task_struct *idle
91 SSYNC(); 90 SSYNC();
92 } 91 }
93 92
94 timeout = jiffies + 1 * HZ; 93 timeout = jiffies + HZ;
94 /* release the lock and let coreb run */
95 spin_unlock(&boot_lock);
95 while (time_before(jiffies, timeout)) { 96 while (time_before(jiffies, timeout)) {
96 if (cpu_online(cpu)) 97 if (cpu_online(cpu))
97 break; 98 break;
@@ -100,8 +101,6 @@ int __cpuinit platform_boot_secondary(unsigned int cpu, struct task_struct *idle
100 } 101 }
101 102
102 if (cpu_online(cpu)) { 103 if (cpu_online(cpu)) {
103 /* release the lock and let coreb run */
104 spin_unlock(&boot_lock);
105 return 0; 104 return 0;
106 } else 105 } else
107 panic("CPU%u: processor failed to boot\n", cpu); 106 panic("CPU%u: processor failed to boot\n", cpu);
@@ -155,7 +154,7 @@ void platform_clear_ipi(unsigned int cpu, int irq)
155 * Setup core B's local core timer. 154 * Setup core B's local core timer.
156 * In SMP, core timer is used for clock event device. 155 * In SMP, core timer is used for clock event device.
157 */ 156 */
158void __cpuinit bfin_local_timer_setup(void) 157void bfin_local_timer_setup(void)
159{ 158{
160#if defined(CONFIG_TICKSOURCE_CORETMR) 159#if defined(CONFIG_TICKSOURCE_CORETMR)
161 struct irq_data *data = irq_get_irq_data(IRQ_CORETMR); 160 struct irq_data *data = irq_get_irq_data(IRQ_CORETMR);
diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c
index bba40aed4273..0bc47231540b 100644
--- a/arch/blackfin/mach-bf609/boards/ezkit.c
+++ b/arch/blackfin/mach-bf609/boards/ezkit.c
@@ -17,7 +17,7 @@
17#include <linux/i2c.h> 17#include <linux/i2c.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/usb/musb.h> 19#include <linux/usb/musb.h>
20#include <asm/bfin6xx_spi.h> 20#include <asm/bfin_spi3.h>
21#include <asm/dma.h> 21#include <asm/dma.h>
22#include <asm/gpio.h> 22#include <asm/gpio.h>
23#include <asm/nand.h> 23#include <asm/nand.h>
@@ -108,7 +108,6 @@ static struct platform_device bfin_rotary_device = {
108static unsigned short pins[] = P_RMII0; 108static unsigned short pins[] = P_RMII0;
109 109
110static struct stmmac_mdio_bus_data phy_private_data = { 110static struct stmmac_mdio_bus_data phy_private_data = {
111 .bus_id = 0,
112 .phy_mask = 1, 111 .phy_mask = 1,
113}; 112};
114 113
@@ -745,13 +744,13 @@ static struct flash_platform_data bfin_spi_flash_data = {
745 .type = "w25q32", 744 .type = "w25q32",
746}; 745};
747 746
748static struct bfin6xx_spi_chip spi_flash_chip_info = { 747static struct bfin_spi3_chip spi_flash_chip_info = {
749 .enable_dma = true, /* use dma transfer with this chip*/ 748 .enable_dma = true, /* use dma transfer with this chip*/
750}; 749};
751#endif 750#endif
752 751
753#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE) 752#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
754static struct bfin6xx_spi_chip spidev_chip_info = { 753static struct bfin_spi3_chip spidev_chip_info = {
755 .enable_dma = true, 754 .enable_dma = true,
756}; 755};
757#endif 756#endif
@@ -1296,7 +1295,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
1296 }, 1295 },
1297#endif 1296#endif
1298}; 1297};
1299#if defined(CONFIG_SPI_BFIN6XX) || defined(CONFIG_SPI_BFIN6XX_MODULE) 1298#if IS_ENABLED(CONFIG_SPI_BFIN_V3)
1300/* SPI (0) */ 1299/* SPI (0) */
1301static struct resource bfin_spi0_resource[] = { 1300static struct resource bfin_spi0_resource[] = {
1302 { 1301 {
@@ -1337,13 +1336,13 @@ static struct resource bfin_spi1_resource[] = {
1337}; 1336};
1338 1337
1339/* SPI controller data */ 1338/* SPI controller data */
1340static struct bfin6xx_spi_master bf60x_spi_master_info0 = { 1339static struct bfin_spi3_master bf60x_spi_master_info0 = {
1341 .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS, 1340 .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
1342 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}, 1341 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
1343}; 1342};
1344 1343
1345static struct platform_device bf60x_spi_master0 = { 1344static struct platform_device bf60x_spi_master0 = {
1346 .name = "bfin-spi", 1345 .name = "bfin-spi3",
1347 .id = 0, /* Bus number */ 1346 .id = 0, /* Bus number */
1348 .num_resources = ARRAY_SIZE(bfin_spi0_resource), 1347 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
1349 .resource = bfin_spi0_resource, 1348 .resource = bfin_spi0_resource,
@@ -1352,13 +1351,13 @@ static struct platform_device bf60x_spi_master0 = {
1352 }, 1351 },
1353}; 1352};
1354 1353
1355static struct bfin6xx_spi_master bf60x_spi_master_info1 = { 1354static struct bfin_spi3_master bf60x_spi_master_info1 = {
1356 .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS, 1355 .num_chipselect = MAX_CTRL_CS + MAX_BLACKFIN_GPIOS,
1357 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0}, 1356 .pin_req = {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
1358}; 1357};
1359 1358
1360static struct platform_device bf60x_spi_master1 = { 1359static struct platform_device bf60x_spi_master1 = {
1361 .name = "bfin-spi", 1360 .name = "bfin-spi3",
1362 .id = 1, /* Bus number */ 1361 .id = 1, /* Bus number */
1363 .num_resources = ARRAY_SIZE(bfin_spi1_resource), 1362 .num_resources = ARRAY_SIZE(bfin_spi1_resource),
1364 .resource = bfin_spi1_resource, 1363 .resource = bfin_spi1_resource,
@@ -1534,7 +1533,7 @@ static struct platform_device *ezkit_devices[] __initdata = {
1534 &bfin_sdh_device, 1533 &bfin_sdh_device,
1535#endif 1534#endif
1536 1535
1537#if defined(CONFIG_SPI_BFIN6XX) || defined(CONFIG_SPI_BFIN6XX_MODULE) 1536#if IS_ENABLED(CONFIG_SPI_BFIN_V3)
1538 &bf60x_spi_master0, 1537 &bf60x_spi_master0,
1539 &bf60x_spi_master1, 1538 &bf60x_spi_master1,
1540#endif 1539#endif
diff --git a/arch/blackfin/mach-common/cache-c.c b/arch/blackfin/mach-common/cache-c.c
index a60a24f5035d..0e1e451fd7d8 100644
--- a/arch/blackfin/mach-common/cache-c.c
+++ b/arch/blackfin/mach-common/cache-c.c
@@ -52,7 +52,7 @@ bfin_cache_init(struct cplb_entry *cplb_tbl, unsigned long cplb_addr,
52} 52}
53 53
54#ifdef CONFIG_BFIN_ICACHE 54#ifdef CONFIG_BFIN_ICACHE
55void __cpuinit bfin_icache_init(struct cplb_entry *icplb_tbl) 55void bfin_icache_init(struct cplb_entry *icplb_tbl)
56{ 56{
57 bfin_cache_init(icplb_tbl, ICPLB_ADDR0, ICPLB_DATA0, IMEM_CONTROL, 57 bfin_cache_init(icplb_tbl, ICPLB_ADDR0, ICPLB_DATA0, IMEM_CONTROL,
58 (IMC | ENICPLB)); 58 (IMC | ENICPLB));
@@ -60,7 +60,7 @@ void __cpuinit bfin_icache_init(struct cplb_entry *icplb_tbl)
60#endif 60#endif
61 61
62#ifdef CONFIG_BFIN_DCACHE 62#ifdef CONFIG_BFIN_DCACHE
63void __cpuinit bfin_dcache_init(struct cplb_entry *dcplb_tbl) 63void bfin_dcache_init(struct cplb_entry *dcplb_tbl)
64{ 64{
65 /* 65 /*
66 * Anomaly notes: 66 * Anomaly notes:
diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c
index 6c0c6816a51a..d143fd8d2bc5 100644
--- a/arch/blackfin/mach-common/ints-priority.c
+++ b/arch/blackfin/mach-common/ints-priority.c
@@ -1281,7 +1281,7 @@ static struct irq_chip bfin_gpio_irqchip = {
1281 .irq_set_wake = bfin_gpio_set_wake, 1281 .irq_set_wake = bfin_gpio_set_wake,
1282}; 1282};
1283 1283
1284void __cpuinit init_exception_vectors(void) 1284void init_exception_vectors(void)
1285{ 1285{
1286 /* cannot program in software: 1286 /* cannot program in software:
1287 * evt0 - emulation (jtag) 1287 * evt0 - emulation (jtag)
diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c
index 1bc2ce6f3c94..82f301c117a5 100644
--- a/arch/blackfin/mach-common/smp.c
+++ b/arch/blackfin/mach-common/smp.c
@@ -46,9 +46,10 @@ struct corelock_slot corelock __attribute__ ((__section__(".l2.bss")));
46unsigned long blackfin_iflush_l1_entry[NR_CPUS]; 46unsigned long blackfin_iflush_l1_entry[NR_CPUS];
47#endif 47#endif
48 48
49struct blackfin_initial_pda __cpuinitdata initial_pda_coreb; 49struct blackfin_initial_pda initial_pda_coreb;
50 50
51enum ipi_message_type { 51enum ipi_message_type {
52 BFIN_IPI_NONE,
52 BFIN_IPI_TIMER, 53 BFIN_IPI_TIMER,
53 BFIN_IPI_RESCHEDULE, 54 BFIN_IPI_RESCHEDULE,
54 BFIN_IPI_CALL_FUNC, 55 BFIN_IPI_CALL_FUNC,
@@ -72,8 +73,8 @@ static DEFINE_SPINLOCK(stop_lock);
72 73
73/* Simple FIFO buffer, overflow leads to panic */ 74/* Simple FIFO buffer, overflow leads to panic */
74struct ipi_data { 75struct ipi_data {
75 unsigned long count; 76 atomic_t count;
76 unsigned long bits; 77 atomic_t bits;
77}; 78};
78 79
79static DEFINE_PER_CPU(struct ipi_data, bfin_ipi); 80static DEFINE_PER_CPU(struct ipi_data, bfin_ipi);
@@ -146,8 +147,7 @@ static irqreturn_t ipi_handler_int1(int irq, void *dev_instance)
146 platform_clear_ipi(cpu, IRQ_SUPPLE_1); 147 platform_clear_ipi(cpu, IRQ_SUPPLE_1);
147 148
148 bfin_ipi_data = &__get_cpu_var(bfin_ipi); 149 bfin_ipi_data = &__get_cpu_var(bfin_ipi);
149 smp_mb(); 150 while ((pending = atomic_xchg(&bfin_ipi_data->bits, 0)) != 0) {
150 while ((pending = xchg(&bfin_ipi_data->bits, 0)) != 0) {
151 msg = 0; 151 msg = 0;
152 do { 152 do {
153 msg = find_next_bit(&pending, BITS_PER_LONG, msg + 1); 153 msg = find_next_bit(&pending, BITS_PER_LONG, msg + 1);
@@ -170,9 +170,8 @@ static irqreturn_t ipi_handler_int1(int irq, void *dev_instance)
170 ipi_cpu_stop(cpu); 170 ipi_cpu_stop(cpu);
171 break; 171 break;
172 } 172 }
173 atomic_dec(&bfin_ipi_data->count);
173 } while (msg < BITS_PER_LONG); 174 } while (msg < BITS_PER_LONG);
174
175 smp_mb();
176 } 175 }
177 return IRQ_HANDLED; 176 return IRQ_HANDLED;
178} 177}
@@ -183,8 +182,8 @@ static void bfin_ipi_init(void)
183 struct ipi_data *bfin_ipi_data; 182 struct ipi_data *bfin_ipi_data;
184 for_each_possible_cpu(cpu) { 183 for_each_possible_cpu(cpu) {
185 bfin_ipi_data = &per_cpu(bfin_ipi, cpu); 184 bfin_ipi_data = &per_cpu(bfin_ipi, cpu);
186 bfin_ipi_data->bits = 0; 185 atomic_set(&bfin_ipi_data->bits, 0);
187 bfin_ipi_data->count = 0; 186 atomic_set(&bfin_ipi_data->count, 0);
188 } 187 }
189} 188}
190 189
@@ -195,12 +194,10 @@ void send_ipi(const struct cpumask *cpumask, enum ipi_message_type msg)
195 unsigned long flags; 194 unsigned long flags;
196 195
197 local_irq_save(flags); 196 local_irq_save(flags);
198 smp_mb();
199 for_each_cpu(cpu, cpumask) { 197 for_each_cpu(cpu, cpumask) {
200 bfin_ipi_data = &per_cpu(bfin_ipi, cpu); 198 bfin_ipi_data = &per_cpu(bfin_ipi, cpu);
201 smp_mb(); 199 atomic_set_mask((1 << msg), &bfin_ipi_data->bits);
202 set_bit(msg, &bfin_ipi_data->bits); 200 atomic_inc(&bfin_ipi_data->count);
203 bfin_ipi_data->count++;
204 platform_send_ipi_cpu(cpu, IRQ_SUPPLE_1); 201 platform_send_ipi_cpu(cpu, IRQ_SUPPLE_1);
205 } 202 }
206 203
@@ -249,7 +246,7 @@ void smp_send_stop(void)
249 return; 246 return;
250} 247}
251 248
252int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) 249int __cpu_up(unsigned int cpu, struct task_struct *idle)
253{ 250{
254 int ret; 251 int ret;
255 252
@@ -262,7 +259,7 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
262 return ret; 259 return ret;
263} 260}
264 261
265static void __cpuinit setup_secondary(unsigned int cpu) 262static void setup_secondary(unsigned int cpu)
266{ 263{
267 unsigned long ilat; 264 unsigned long ilat;
268 265
@@ -280,7 +277,7 @@ static void __cpuinit setup_secondary(unsigned int cpu)
280 IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW; 277 IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW;
281} 278}
282 279
283void __cpuinit secondary_start_kernel(void) 280void secondary_start_kernel(void)
284{ 281{
285 unsigned int cpu = smp_processor_id(); 282 unsigned int cpu = smp_processor_id();
286 struct mm_struct *mm = &init_mm; 283 struct mm_struct *mm = &init_mm;
@@ -319,7 +316,6 @@ void __cpuinit secondary_start_kernel(void)
319 setup_secondary(cpu); 316 setup_secondary(cpu);
320 317
321 platform_secondary_init(cpu); 318 platform_secondary_init(cpu);
322
323 /* setup local core timer */ 319 /* setup local core timer */
324 bfin_local_timer_setup(); 320 bfin_local_timer_setup();
325 321
@@ -335,6 +331,8 @@ void __cpuinit secondary_start_kernel(void)
335 */ 331 */
336 calibrate_delay(); 332 calibrate_delay();
337 333
334 /* We are done with local CPU inits, unblock the boot CPU. */
335 set_cpu_online(cpu, true);
338 cpu_startup_entry(CPUHP_ONLINE); 336 cpu_startup_entry(CPUHP_ONLINE);
339} 337}
340 338
@@ -404,7 +402,7 @@ EXPORT_SYMBOL(resync_core_dcache);
404#endif 402#endif
405 403
406#ifdef CONFIG_HOTPLUG_CPU 404#ifdef CONFIG_HOTPLUG_CPU
407int __cpuexit __cpu_disable(void) 405int __cpu_disable(void)
408{ 406{
409 unsigned int cpu = smp_processor_id(); 407 unsigned int cpu = smp_processor_id();
410 408
@@ -417,7 +415,7 @@ int __cpuexit __cpu_disable(void)
417 415
418static DECLARE_COMPLETION(cpu_killed); 416static DECLARE_COMPLETION(cpu_killed);
419 417
420int __cpuexit __cpu_die(unsigned int cpu) 418int __cpu_die(unsigned int cpu)
421{ 419{
422 return wait_for_completion_timeout(&cpu_killed, 5000); 420 return wait_for_completion_timeout(&cpu_killed, 5000);
423} 421}
diff --git a/arch/cris/arch-v10/drivers/Kconfig b/arch/cris/arch-v10/drivers/Kconfig
index 5f2cdb3e428c..daf5f19b61a1 100644
--- a/arch/cris/arch-v10/drivers/Kconfig
+++ b/arch/cris/arch-v10/drivers/Kconfig
@@ -2,9 +2,7 @@ if ETRAX_ARCH_V10
2 2
3config ETRAX_ETHERNET 3config ETRAX_ETHERNET
4 bool "Ethernet support" 4 bool "Ethernet support"
5 depends on ETRAX_ARCH_V10 5 depends on ETRAX_ARCH_V10 && NETDEVICES
6 select ETHERNET
7 select NET_CORE
8 select MII 6 select MII
9 help 7 help
10 This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet 8 This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet
diff --git a/arch/cris/arch-v32/drivers/Kconfig b/arch/cris/arch-v32/drivers/Kconfig
index acff3df8c43f..1d866d3ee2f8 100644
--- a/arch/cris/arch-v32/drivers/Kconfig
+++ b/arch/cris/arch-v32/drivers/Kconfig
@@ -2,9 +2,7 @@ if ETRAX_ARCH_V32
2 2
3config ETRAX_ETHERNET 3config ETRAX_ETHERNET
4 bool "Ethernet support" 4 bool "Ethernet support"
5 depends on ETRAX_ARCH_V32 5 depends on ETRAX_ARCH_V32 && NETDEVICES
6 select ETHERNET
7 select NET_CORE
8 select MII 6 select MII
9 help 7 help
10 This option enables the ETRAX FS built-in 10/100Mbit Ethernet 8 This option enables the ETRAX FS built-in 10/100Mbit Ethernet
diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c
index cdd12028de0c..fe8e6039db2a 100644
--- a/arch/cris/arch-v32/kernel/smp.c
+++ b/arch/cris/arch-v32/kernel/smp.c
@@ -197,7 +197,7 @@ int setup_profiling_timer(unsigned int multiplier)
197 */ 197 */
198unsigned long cache_decay_ticks = 1; 198unsigned long cache_decay_ticks = 1;
199 199
200int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) 200int __cpu_up(unsigned int cpu, struct task_struct *tidle)
201{ 201{
202 smp_boot_one_cpu(cpu, tidle); 202 smp_boot_one_cpu(cpu, tidle);
203 return cpu_online(cpu) ? 0 : -ENOSYS; 203 return cpu_online(cpu) ? 0 : -ENOSYS;
diff --git a/arch/cris/include/uapi/asm/socket.h b/arch/cris/include/uapi/asm/socket.h
index ba409c9947bc..eb723e51554e 100644
--- a/arch/cris/include/uapi/asm/socket.h
+++ b/arch/cris/include/uapi/asm/socket.h
@@ -76,6 +76,8 @@
76 76
77#define SO_SELECT_ERR_QUEUE 45 77#define SO_SELECT_ERR_QUEUE 45
78 78
79#define SO_BUSY_POLL 46
80
79#endif /* _ASM_SOCKET_H */ 81#endif /* _ASM_SOCKET_H */
80 82
81 83
diff --git a/arch/frv/include/uapi/asm/socket.h b/arch/frv/include/uapi/asm/socket.h
index 31dbb5d8e13d..f0cb1c341163 100644
--- a/arch/frv/include/uapi/asm/socket.h
+++ b/arch/frv/include/uapi/asm/socket.h
@@ -74,5 +74,7 @@
74 74
75#define SO_SELECT_ERR_QUEUE 45 75#define SO_SELECT_ERR_QUEUE 45
76 76
77#define SO_BUSY_POLL 46
78
77#endif /* _ASM_SOCKET_H */ 79#endif /* _ASM_SOCKET_H */
78 80
diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c
index ae3a6706419b..9f3a7a62d787 100644
--- a/arch/frv/kernel/setup.c
+++ b/arch/frv/kernel/setup.c
@@ -709,7 +709,7 @@ static void __init reserve_dma_coherent(void)
709/* 709/*
710 * calibrate the delay loop 710 * calibrate the delay loop
711 */ 711 */
712void __cpuinit calibrate_delay(void) 712void calibrate_delay(void)
713{ 713{
714 loops_per_jiffy = __delay_loops_MHz * (1000000 / HZ); 714 loops_per_jiffy = __delay_loops_MHz * (1000000 / HZ);
715 715
diff --git a/arch/h8300/include/uapi/asm/socket.h b/arch/h8300/include/uapi/asm/socket.h
index 5d1c6d0870e6..9490758c5e2b 100644
--- a/arch/h8300/include/uapi/asm/socket.h
+++ b/arch/h8300/include/uapi/asm/socket.h
@@ -74,4 +74,6 @@
74 74
75#define SO_SELECT_ERR_QUEUE 45 75#define SO_SELECT_ERR_QUEUE 45
76 76
77#define SO_BUSY_POLL 46
78
77#endif /* _ASM_SOCKET_H */ 79#endif /* _ASM_SOCKET_H */
diff --git a/arch/hexagon/kernel/setup.c b/arch/hexagon/kernel/setup.c
index bfe13311d70d..29d1f1b00016 100644
--- a/arch/hexagon/kernel/setup.c
+++ b/arch/hexagon/kernel/setup.c
@@ -41,7 +41,7 @@ static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
41 41
42int on_simulator; 42int on_simulator;
43 43
44void __cpuinit calibrate_delay(void) 44void calibrate_delay(void)
45{ 45{
46 loops_per_jiffy = thread_freq_mhz * 1000000 / HZ; 46 loops_per_jiffy = thread_freq_mhz * 1000000 / HZ;
47} 47}
diff --git a/arch/hexagon/kernel/smp.c b/arch/hexagon/kernel/smp.c
index 0e364ca43198..9faaa940452b 100644
--- a/arch/hexagon/kernel/smp.c
+++ b/arch/hexagon/kernel/smp.c
@@ -146,7 +146,7 @@ void __init smp_prepare_boot_cpu(void)
146 * to point to current thread info 146 * to point to current thread info
147 */ 147 */
148 148
149void __cpuinit start_secondary(void) 149void start_secondary(void)
150{ 150{
151 unsigned int cpu; 151 unsigned int cpu;
152 unsigned long thread_ptr; 152 unsigned long thread_ptr;
@@ -194,7 +194,7 @@ void __cpuinit start_secondary(void)
194 * maintains control until "cpu_online(cpu)" is set. 194 * maintains control until "cpu_online(cpu)" is set.
195 */ 195 */
196 196
197int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) 197int __cpu_up(unsigned int cpu, struct task_struct *idle)
198{ 198{
199 struct thread_info *thread = (struct thread_info *)idle->stack; 199 struct thread_info *thread = (struct thread_info *)idle->stack;
200 void *stack_start; 200 void *stack_start;
diff --git a/arch/ia64/hp/sim/boot/fw-emu.c b/arch/ia64/hp/sim/boot/fw-emu.c
index 271f412bda1a..87bf9ad8cf0f 100644
--- a/arch/ia64/hp/sim/boot/fw-emu.c
+++ b/arch/ia64/hp/sim/boot/fw-emu.c
@@ -290,16 +290,16 @@ sys_fw_init (const char *args, int arglen)
290 efi_runtime->hdr.signature = EFI_RUNTIME_SERVICES_SIGNATURE; 290 efi_runtime->hdr.signature = EFI_RUNTIME_SERVICES_SIGNATURE;
291 efi_runtime->hdr.revision = EFI_RUNTIME_SERVICES_REVISION; 291 efi_runtime->hdr.revision = EFI_RUNTIME_SERVICES_REVISION;
292 efi_runtime->hdr.headersize = sizeof(efi_runtime->hdr); 292 efi_runtime->hdr.headersize = sizeof(efi_runtime->hdr);
293 efi_runtime->get_time = __pa(&fw_efi_get_time); 293 efi_runtime->get_time = (void *)__pa(&fw_efi_get_time);
294 efi_runtime->set_time = __pa(&efi_unimplemented); 294 efi_runtime->set_time = (void *)__pa(&efi_unimplemented);
295 efi_runtime->get_wakeup_time = __pa(&efi_unimplemented); 295 efi_runtime->get_wakeup_time = (void *)__pa(&efi_unimplemented);
296 efi_runtime->set_wakeup_time = __pa(&efi_unimplemented); 296 efi_runtime->set_wakeup_time = (void *)__pa(&efi_unimplemented);
297 efi_runtime->set_virtual_address_map = __pa(&efi_unimplemented); 297 efi_runtime->set_virtual_address_map = (void *)__pa(&efi_unimplemented);
298 efi_runtime->get_variable = __pa(&efi_unimplemented); 298 efi_runtime->get_variable = (void *)__pa(&efi_unimplemented);
299 efi_runtime->get_next_variable = __pa(&efi_unimplemented); 299 efi_runtime->get_next_variable = (void *)__pa(&efi_unimplemented);
300 efi_runtime->set_variable = __pa(&efi_unimplemented); 300 efi_runtime->set_variable = (void *)__pa(&efi_unimplemented);
301 efi_runtime->get_next_high_mono_count = __pa(&efi_unimplemented); 301 efi_runtime->get_next_high_mono_count = (void *)__pa(&efi_unimplemented);
302 efi_runtime->reset_system = __pa(&efi_reset_system); 302 efi_runtime->reset_system = (void *)__pa(&efi_reset_system);
303 303
304 efi_tables->guid = SAL_SYSTEM_TABLE_GUID; 304 efi_tables->guid = SAL_SYSTEM_TABLE_GUID;
305 efi_tables->table = __pa(sal_systab); 305 efi_tables->table = __pa(sal_systab);
diff --git a/arch/ia64/hp/sim/simeth.c b/arch/ia64/hp/sim/simeth.c
index c13064e422df..d1b04c4c95e3 100644
--- a/arch/ia64/hp/sim/simeth.c
+++ b/arch/ia64/hp/sim/simeth.c
@@ -268,7 +268,7 @@ static __inline__ int dev_is_ethdev(struct net_device *dev)
268static int 268static int
269simeth_device_event(struct notifier_block *this,unsigned long event, void *ptr) 269simeth_device_event(struct notifier_block *this,unsigned long event, void *ptr)
270{ 270{
271 struct net_device *dev = ptr; 271 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
272 struct simeth_local *local; 272 struct simeth_local *local;
273 struct in_device *in_dev; 273 struct in_device *in_dev;
274 struct in_ifaddr **ifap = NULL; 274 struct in_ifaddr **ifap = NULL;
diff --git a/arch/ia64/include/uapi/asm/socket.h b/arch/ia64/include/uapi/asm/socket.h
index 6b4329f18b29..556d0701a155 100644
--- a/arch/ia64/include/uapi/asm/socket.h
+++ b/arch/ia64/include/uapi/asm/socket.h
@@ -83,4 +83,6 @@
83 83
84#define SO_SELECT_ERR_QUEUE 45 84#define SO_SELECT_ERR_QUEUE 45
85 85
86#define SO_BUSY_POLL 46
87
86#endif /* _ASM_IA64_SOCKET_H */ 88#endif /* _ASM_IA64_SOCKET_H */
diff --git a/arch/m32r/include/uapi/asm/socket.h b/arch/m32r/include/uapi/asm/socket.h
index 2a3b59e0e171..24be7c8da86a 100644
--- a/arch/m32r/include/uapi/asm/socket.h
+++ b/arch/m32r/include/uapi/asm/socket.h
@@ -74,4 +74,6 @@
74 74
75#define SO_SELECT_ERR_QUEUE 45 75#define SO_SELECT_ERR_QUEUE 45
76 76
77#define SO_BUSY_POLL 46
78
77#endif /* _ASM_M32R_SOCKET_H */ 79#endif /* _ASM_M32R_SOCKET_H */
diff --git a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c
index 0ac558adc605..bb21f4f63170 100644
--- a/arch/m32r/kernel/smpboot.c
+++ b/arch/m32r/kernel/smpboot.c
@@ -343,7 +343,7 @@ static void __init do_boot_cpu(int phys_id)
343 } 343 }
344} 344}
345 345
346int __cpuinit __cpu_up(unsigned int cpu_id, struct task_struct *tidle) 346int __cpu_up(unsigned int cpu_id, struct task_struct *tidle)
347{ 347{
348 int timeout; 348 int timeout;
349 349
diff --git a/arch/metag/Kconfig.soc b/arch/metag/Kconfig.soc
index ec079cfb7c6a..2a3c860c7525 100644
--- a/arch/metag/Kconfig.soc
+++ b/arch/metag/Kconfig.soc
@@ -14,6 +14,18 @@ config META21_FPGA
14 help 14 help
15 This is a Meta 2.1 FPGA bitstream, just a bare CPU. 15 This is a Meta 2.1 FPGA bitstream, just a bare CPU.
16 16
17config SOC_TZ1090
18 bool "Toumaz Xenif TZ1090 SoC (Comet)"
19 select METAG_LNKGET_AROUND_CACHE
20 select METAG_META21
21 select METAG_SMP_WRITE_REORDERING
22 select PINCTRL
23 select PINCTRL_TZ1090
24 select PINCTRL_TZ1090_PDC
25 help
26 This is a Toumaz Technology Xenif TZ1090 (A.K.A. Comet) SoC containing
27 a 2-threaded HTP.
28
17endchoice 29endchoice
18 30
19menu "SoC configuration" 31menu "SoC configuration"
diff --git a/arch/metag/Makefile b/arch/metag/Makefile
index b566116b171b..9739857bdedc 100644
--- a/arch/metag/Makefile
+++ b/arch/metag/Makefile
@@ -20,7 +20,7 @@ checkflags-$(CONFIG_METAG_META12) += -DMETAC_1_2
20checkflags-$(CONFIG_METAG_META21) += -DMETAC_2_1 20checkflags-$(CONFIG_METAG_META21) += -DMETAC_2_1
21CHECKFLAGS += -D__metag__ $(checkflags-y) 21CHECKFLAGS += -D__metag__ $(checkflags-y)
22 22
23KBUILD_DEFCONFIG := meta2_defconfig 23KBUILD_DEFCONFIG := tz1090_defconfig
24 24
25sflags-$(CONFIG_METAG_META12) += -mmetac=1.2 25sflags-$(CONFIG_METAG_META12) += -mmetac=1.2
26ifeq ($(CONFIG_METAG_META12),y) 26ifeq ($(CONFIG_METAG_META12),y)
diff --git a/arch/metag/boot/.gitignore b/arch/metag/boot/.gitignore
index a021da201156..2d6c0c160884 100644
--- a/arch/metag/boot/.gitignore
+++ b/arch/metag/boot/.gitignore
@@ -1,4 +1,4 @@
1vmlinux* 1vmlinux*
2uImage* 2uImage*
3ramdisk.* 3ramdisk.*
4*.dtb 4*.dtb*
diff --git a/arch/metag/boot/dts/Makefile b/arch/metag/boot/dts/Makefile
index dbd95217733a..72c121879426 100644
--- a/arch/metag/boot/dts/Makefile
+++ b/arch/metag/boot/dts/Makefile
@@ -1,7 +1,9 @@
1dtb-y += skeleton.dtb 1dtb-y += skeleton.dtb
2dtb-y += tz1090_generic.dtb
2 3
3# Built-in dtb 4# Built-in dtb
4builtindtb-y := skeleton 5builtindtb-y := skeleton
6builtindtb-$(CONFIG_SOC_TZ1090) := tz1090_generic
5 7
6ifneq ($(CONFIG_METAG_BUILTIN_DTB_NAME),"") 8ifneq ($(CONFIG_METAG_BUILTIN_DTB_NAME),"")
7 builtindtb-y := $(patsubst "%",%,$(CONFIG_METAG_BUILTIN_DTB_NAME)) 9 builtindtb-y := $(patsubst "%",%,$(CONFIG_METAG_BUILTIN_DTB_NAME))
diff --git a/arch/metag/boot/dts/include/dt-bindings b/arch/metag/boot/dts/include/dt-bindings
new file mode 120000
index 000000000000..08c00e4972fa
--- /dev/null
+++ b/arch/metag/boot/dts/include/dt-bindings
@@ -0,0 +1 @@
../../../../../include/dt-bindings \ No newline at end of file
diff --git a/arch/metag/boot/dts/skeleton.dts b/arch/metag/boot/dts/skeleton.dts
index 7244d1f0d555..7a49aeb365d0 100644
--- a/arch/metag/boot/dts/skeleton.dts
+++ b/arch/metag/boot/dts/skeleton.dts
@@ -7,4 +7,4 @@
7 */ 7 */
8/dts-v1/; 8/dts-v1/;
9 9
10/include/ "skeleton.dtsi" 10#include "skeleton.dtsi"
diff --git a/arch/metag/boot/dts/tz1090.dtsi b/arch/metag/boot/dts/tz1090.dtsi
new file mode 100644
index 000000000000..853744652b93
--- /dev/null
+++ b/arch/metag/boot/dts/tz1090.dtsi
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 2012 Imagination Technologies Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#include "skeleton.dtsi"
10
11/ {
12 compatible = "toumaz,tz1090", "img,meta";
13
14 interrupt-parent = <&intc>;
15
16 intc: interrupt-controller {
17 compatible = "img,meta-intc";
18 interrupt-controller;
19 #interrupt-cells = <2>;
20 num-banks = <2>;
21 };
22
23 soc {
24 compatible = "simple-bus";
25 #address-cells = <1>;
26 #size-cells = <1>;
27 ranges;
28
29 pinctrl: pinctrl@02005800 {
30 #gpio-range-cells = <3>;
31 compatible = "img,tz1090-pinctrl";
32 reg = <0x02005800 0xe4>;
33 };
34
35 pdc_pinctrl: pinctrl@02006500 {
36 #gpio-range-cells = <3>;
37 compatible = "img,tz1090-pdc-pinctrl";
38 reg = <0x02006500 0x100>;
39 };
40 };
41};
diff --git a/arch/metag/boot/dts/tz1090_generic.dts b/arch/metag/boot/dts/tz1090_generic.dts
new file mode 100644
index 000000000000..f96090955964
--- /dev/null
+++ b/arch/metag/boot/dts/tz1090_generic.dts
@@ -0,0 +1,10 @@
1/*
2 * Copyright (C) 2012 Imagination Technologies Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8/dts-v1/;
9
10#include "tz1090.dtsi"
diff --git a/arch/metag/configs/tz1090_defconfig b/arch/metag/configs/tz1090_defconfig
new file mode 100644
index 000000000000..9f9316a6df27
--- /dev/null
+++ b/arch/metag/configs/tz1090_defconfig
@@ -0,0 +1,42 @@
1# CONFIG_LOCALVERSION_AUTO is not set
2# CONFIG_SWAP is not set
3CONFIG_SYSVIPC=y
4CONFIG_SYSFS_DEPRECATED=y
5CONFIG_SYSFS_DEPRECATED_V2=y
6CONFIG_KALLSYMS_ALL=y
7# CONFIG_ELF_CORE is not set
8CONFIG_SLAB=y
9# CONFIG_BLK_DEV_BSG is not set
10CONFIG_PARTITION_ADVANCED=y
11# CONFIG_MSDOS_PARTITION is not set
12# CONFIG_IOSCHED_DEADLINE is not set
13# CONFIG_IOSCHED_CFQ is not set
14CONFIG_FLATMEM_MANUAL=y
15CONFIG_SOC_TZ1090=y
16CONFIG_METAG_HALT_ON_PANIC=y
17# CONFIG_METAG_FPU is not set
18CONFIG_METAG_DA=y
19CONFIG_HZ_100=y
20CONFIG_DEVTMPFS=y
21# CONFIG_STANDALONE is not set
22# CONFIG_PREVENT_FIRMWARE_BUILD is not set
23# CONFIG_FW_LOADER is not set
24CONFIG_BLK_DEV_RAM=y
25CONFIG_BLK_DEV_RAM_COUNT=1
26CONFIG_BLK_DEV_RAM_SIZE=16384
27# CONFIG_INPUT is not set
28# CONFIG_SERIO is not set
29# CONFIG_VT is not set
30# CONFIG_LEGACY_PTYS is not set
31CONFIG_DA_TTY=y
32CONFIG_DA_CONSOLE=y
33# CONFIG_DEVKMEM is not set
34# CONFIG_HW_RANDOM is not set
35CONFIG_GPIOLIB=y
36# CONFIG_HWMON is not set
37# CONFIG_USB_SUPPORT is not set
38# CONFIG_DNOTIFY is not set
39CONFIG_TMPFS=y
40# CONFIG_MISC_FILESYSTEMS is not set
41# CONFIG_SCHED_DEBUG is not set
42CONFIG_DEBUG_INFO=y
diff --git a/arch/metag/include/asm/bug.h b/arch/metag/include/asm/bug.h
index d04b48cefecc..9f8967f10f8c 100644
--- a/arch/metag/include/asm/bug.h
+++ b/arch/metag/include/asm/bug.h
@@ -6,7 +6,7 @@
6struct pt_regs; 6struct pt_regs;
7 7
8extern const char *trap_name(int trapno); 8extern const char *trap_name(int trapno);
9extern void die(const char *str, struct pt_regs *regs, long err, 9extern void __noreturn die(const char *str, struct pt_regs *regs, long err,
10 unsigned long addr) __attribute__ ((noreturn)); 10 unsigned long addr);
11 11
12#endif 12#endif
diff --git a/arch/metag/include/asm/checksum.h b/arch/metag/include/asm/checksum.h
index 999bf761a732..08dd1cc65799 100644
--- a/arch/metag/include/asm/checksum.h
+++ b/arch/metag/include/asm/checksum.h
@@ -64,7 +64,8 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
64 __wsum sum) 64 __wsum sum)
65{ 65{
66 unsigned long len_proto = (proto + len) << 8; 66 unsigned long len_proto = (proto + len) << 8;
67 asm ("ADD %0, %0, %1\n" 67 asm ("ADDS %0, %0, %1\n"
68 "ADDCS %0, %0, #1\n"
68 "ADDS %0, %0, %2\n" 69 "ADDS %0, %0, %2\n"
69 "ADDCS %0, %0, #1\n" 70 "ADDCS %0, %0, #1\n"
70 "ADDS %0, %0, %3\n" 71 "ADDS %0, %0, %3\n"
diff --git a/arch/metag/include/asm/clock.h b/arch/metag/include/asm/clock.h
index 3e2915a280c7..ded4ab2e1fd0 100644
--- a/arch/metag/include/asm/clock.h
+++ b/arch/metag/include/asm/clock.h
@@ -19,6 +19,8 @@
19 * core frequency will be determined like this: 19 * core frequency will be determined like this:
20 * Meta 1: based on loops_per_jiffy. 20 * Meta 1: based on loops_per_jiffy.
21 * Meta 2: (EXPAND_TIMER_DIV + 1) MHz. 21 * Meta 2: (EXPAND_TIMER_DIV + 1) MHz.
22 * If a "core" clock is provided by the device tree, it
23 * will override this function.
22 */ 24 */
23struct meta_clock_desc { 25struct meta_clock_desc {
24 unsigned long (*get_core_freq)(void); 26 unsigned long (*get_core_freq)(void);
@@ -27,6 +29,12 @@ struct meta_clock_desc {
27extern struct meta_clock_desc _meta_clock; 29extern struct meta_clock_desc _meta_clock;
28 30
29/* 31/*
32 * Perform platform clock initialisation, reading clocks from device tree etc.
33 * Only accessible during boot.
34 */
35void init_metag_clocks(void);
36
37/*
30 * Set up the default clock, ensuring all callbacks are valid - only accessible 38 * Set up the default clock, ensuring all callbacks are valid - only accessible
31 * during boot. 39 * during boot.
32 */ 40 */
diff --git a/arch/metag/include/asm/irq.h b/arch/metag/include/asm/irq.h
index be0c8f3c5a5d..ad6bd0edbc3b 100644
--- a/arch/metag/include/asm/irq.h
+++ b/arch/metag/include/asm/irq.h
@@ -17,6 +17,7 @@ struct pt_regs;
17 17
18int tbisig_map(unsigned int hw); 18int tbisig_map(unsigned int hw);
19extern void do_IRQ(int irq, struct pt_regs *regs); 19extern void do_IRQ(int irq, struct pt_regs *regs);
20extern void init_IRQ(void);
20 21
21#ifdef CONFIG_METAG_SUSPEND_MEM 22#ifdef CONFIG_METAG_SUSPEND_MEM
22int traps_save_context(void); 23int traps_save_context(void);
diff --git a/arch/metag/include/asm/processor.h b/arch/metag/include/asm/processor.h
index 9b029a7911c3..f16477d1f571 100644
--- a/arch/metag/include/asm/processor.h
+++ b/arch/metag/include/asm/processor.h
@@ -199,4 +199,6 @@ extern void (*soc_halt)(void);
199extern void show_trace(struct task_struct *tsk, unsigned long *sp, 199extern void show_trace(struct task_struct *tsk, unsigned long *sp,
200 struct pt_regs *regs); 200 struct pt_regs *regs);
201 201
202extern const struct seq_operations cpuinfo_op;
203
202#endif 204#endif
diff --git a/arch/metag/kernel/cachepart.c b/arch/metag/kernel/cachepart.c
index 954548b1bea8..0a2385fa2a1d 100644
--- a/arch/metag/kernel/cachepart.c
+++ b/arch/metag/kernel/cachepart.c
@@ -100,22 +100,23 @@ void check_for_cache_aliasing(int thread_id)
100 thread_cache_size = 100 thread_cache_size =
101 get_thread_cache_size(cache_type, thread_id); 101 get_thread_cache_size(cache_type, thread_id);
102 if (thread_cache_size < 0) 102 if (thread_cache_size < 0)
103 pr_emerg("Can't read %s cache size", \ 103 pr_emerg("Can't read %s cache size\n",
104 cache_type ? "DCACHE" : "ICACHE"); 104 cache_type ? "DCACHE" : "ICACHE");
105 else if (thread_cache_size == 0) 105 else if (thread_cache_size == 0)
106 /* Cache is off. No need to check for aliasing */ 106 /* Cache is off. No need to check for aliasing */
107 continue; 107 continue;
108 if (thread_cache_size / CACHE_ASSOCIATIVITY > PAGE_SIZE) { 108 if (thread_cache_size / CACHE_ASSOCIATIVITY > PAGE_SIZE) {
109 pr_emerg("Cache aliasing detected in %s on Thread %d", 109 pr_emerg("Potential cache aliasing detected in %s on Thread %d\n",
110 cache_type ? "DCACHE" : "ICACHE", thread_id); 110 cache_type ? "DCACHE" : "ICACHE", thread_id);
111 pr_warn("Total %s size: %u bytes", 111 pr_warn("Total %s size: %u bytes\n",
112 cache_type ? "DCACHE" : "ICACHE ", 112 cache_type ? "DCACHE" : "ICACHE",
113 cache_type ? get_dcache_size() 113 cache_type ? get_dcache_size()
114 : get_icache_size()); 114 : get_icache_size());
115 pr_warn("Thread %s size: %d bytes", 115 pr_warn("Thread %s size: %d bytes\n",
116 cache_type ? "CACHE" : "ICACHE", 116 cache_type ? "CACHE" : "ICACHE",
117 thread_cache_size); 117 thread_cache_size);
118 pr_warn("Page Size: %lu bytes", PAGE_SIZE); 118 pr_warn("Page Size: %lu bytes\n", PAGE_SIZE);
119 panic("Potential cache aliasing detected");
119 } 120 }
120 } 121 }
121} 122}
diff --git a/arch/metag/kernel/clock.c b/arch/metag/kernel/clock.c
index defc84056f18..6339c9c6d0ab 100644
--- a/arch/metag/kernel/clock.c
+++ b/arch/metag/kernel/clock.c
@@ -8,8 +8,10 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <linux/clk.h>
11#include <linux/delay.h> 12#include <linux/delay.h>
12#include <linux/io.h> 13#include <linux/io.h>
14#include <linux/of.h>
13 15
14#include <asm/param.h> 16#include <asm/param.h>
15#include <asm/clock.h> 17#include <asm/clock.h>
@@ -34,8 +36,63 @@ static unsigned long get_core_freq_default(void)
34#endif 36#endif
35} 37}
36 38
39static struct clk *clk_core;
40
41/* Clk based get_core_freq callback. */
42static unsigned long get_core_freq_clk(void)
43{
44 return clk_get_rate(clk_core);
45}
46
47/**
48 * init_metag_core_clock() - Set up core clock from devicetree.
49 *
50 * Checks to see if a "core" clock is provided in the device tree, and overrides
51 * the get_core_freq callback to use it.
52 */
53static void __init init_metag_core_clock(void)
54{
55 /*
56 * See if a core clock is provided by the devicetree (and
57 * registered by the init callback above).
58 */
59 struct device_node *node;
60 node = of_find_compatible_node(NULL, NULL, "img,meta");
61 if (!node) {
62 pr_warn("%s: no compatible img,meta DT node found\n",
63 __func__);
64 return;
65 }
66
67 clk_core = of_clk_get_by_name(node, "core");
68 if (IS_ERR(clk_core)) {
69 pr_warn("%s: no core clock found in DT\n",
70 __func__);
71 return;
72 }
73
74 /*
75 * Override the core frequency callback to use
76 * this clk.
77 */
78 _meta_clock.get_core_freq = get_core_freq_clk;
79}
80
81/**
82 * init_metag_clocks() - Set up clocks from devicetree.
83 *
84 * Set up important clocks from device tree. In particular any needed for clock
85 * sources.
86 */
87void __init init_metag_clocks(void)
88{
89 init_metag_core_clock();
90
91 pr_info("Core clock frequency: %lu Hz\n", get_coreclock());
92}
93
37/** 94/**
38 * setup_meta_clocks() - Set up the Meta clock. 95 * setup_meta_clocks() - Early set up of the Meta clock.
39 * @desc: Clock descriptor usually provided by machine description 96 * @desc: Clock descriptor usually provided by machine description
40 * 97 *
41 * Ensures all callbacks are valid. 98 * Ensures all callbacks are valid.
diff --git a/arch/metag/kernel/irq.c b/arch/metag/kernel/irq.c
index 87707efeb0a3..2a2c9d55187e 100644
--- a/arch/metag/kernel/irq.c
+++ b/arch/metag/kernel/irq.c
@@ -25,7 +25,7 @@ static union irq_ctx *hardirq_ctx[NR_CPUS] __read_mostly;
25static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly; 25static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly;
26#endif 26#endif
27 27
28struct irq_domain *root_domain; 28static struct irq_domain *root_domain;
29 29
30static unsigned int startup_meta_irq(struct irq_data *data) 30static unsigned int startup_meta_irq(struct irq_data *data)
31{ 31{
@@ -279,11 +279,12 @@ static void route_irq(struct irq_data *data, unsigned int irq, unsigned int cpu)
279{ 279{
280 struct irq_desc *desc = irq_to_desc(irq); 280 struct irq_desc *desc = irq_to_desc(irq);
281 struct irq_chip *chip = irq_data_get_irq_chip(data); 281 struct irq_chip *chip = irq_data_get_irq_chip(data);
282 unsigned long flags;
282 283
283 raw_spin_lock_irq(&desc->lock); 284 raw_spin_lock_irqsave(&desc->lock, flags);
284 if (chip->irq_set_affinity) 285 if (chip->irq_set_affinity)
285 chip->irq_set_affinity(data, cpumask_of(cpu), false); 286 chip->irq_set_affinity(data, cpumask_of(cpu), false);
286 raw_spin_unlock_irq(&desc->lock); 287 raw_spin_unlock_irqrestore(&desc->lock, flags);
287} 288}
288 289
289/* 290/*
diff --git a/arch/metag/kernel/kick.c b/arch/metag/kernel/kick.c
index 50fcbec98cd2..beb377621322 100644
--- a/arch/metag/kernel/kick.c
+++ b/arch/metag/kernel/kick.c
@@ -26,6 +26,8 @@
26 * pass it as an argument. 26 * pass it as an argument.
27 */ 27 */
28#include <linux/export.h> 28#include <linux/export.h>
29#include <linux/hardirq.h>
30#include <linux/irq.h>
29#include <linux/kernel.h> 31#include <linux/kernel.h>
30#include <linux/mm.h> 32#include <linux/mm.h>
31#include <linux/types.h> 33#include <linux/types.h>
@@ -66,6 +68,7 @@ EXPORT_SYMBOL(kick_unregister_func);
66TBIRES 68TBIRES
67kick_handler(TBIRES State, int SigNum, int Triggers, int Inst, PTBI pTBI) 69kick_handler(TBIRES State, int SigNum, int Triggers, int Inst, PTBI pTBI)
68{ 70{
71 struct pt_regs *old_regs;
69 struct kick_irq_handler *kh; 72 struct kick_irq_handler *kh;
70 struct list_head *lh; 73 struct list_head *lh;
71 int handled = 0; 74 int handled = 0;
@@ -79,6 +82,9 @@ kick_handler(TBIRES State, int SigNum, int Triggers, int Inst, PTBI pTBI)
79 82
80 trace_hardirqs_off(); 83 trace_hardirqs_off();
81 84
85 old_regs = set_irq_regs((struct pt_regs *)State.Sig.pCtx);
86 irq_enter();
87
82 /* 88 /*
83 * There is no need to disable interrupts here because we 89 * There is no need to disable interrupts here because we
84 * can't nest KICK interrupts in a KICK interrupt handler. 90 * can't nest KICK interrupts in a KICK interrupt handler.
@@ -97,5 +103,8 @@ kick_handler(TBIRES State, int SigNum, int Triggers, int Inst, PTBI pTBI)
97 103
98 WARN_ON(!handled); 104 WARN_ON(!handled);
99 105
106 irq_exit();
107 set_irq_regs(old_regs);
108
100 return tail_end(ret); 109 return tail_end(ret);
101} 110}
diff --git a/arch/metag/kernel/metag_ksyms.c b/arch/metag/kernel/metag_ksyms.c
index ec872ef14eb1..215c94ad63ac 100644
--- a/arch/metag/kernel/metag_ksyms.c
+++ b/arch/metag/kernel/metag_ksyms.c
@@ -1,5 +1,7 @@
1#include <linux/export.h> 1#include <linux/export.h>
2#include <linux/types.h>
2 3
4#include <asm/checksum.h>
3#include <asm/div64.h> 5#include <asm/div64.h>
4#include <asm/ftrace.h> 6#include <asm/ftrace.h>
5#include <asm/page.h> 7#include <asm/page.h>
@@ -15,6 +17,9 @@ EXPORT_SYMBOL(max_pfn);
15EXPORT_SYMBOL(min_low_pfn); 17EXPORT_SYMBOL(min_low_pfn);
16#endif 18#endif
17 19
20/* Network checksum functions */
21EXPORT_SYMBOL(csum_partial);
22
18/* TBI symbols */ 23/* TBI symbols */
19EXPORT_SYMBOL(__TBI); 24EXPORT_SYMBOL(__TBI);
20EXPORT_SYMBOL(__TBIFindSeg); 25EXPORT_SYMBOL(__TBIFindSeg);
diff --git a/arch/metag/kernel/perf/perf_event.c b/arch/metag/kernel/perf/perf_event.c
index 5b18888ee364..5cc4d4dcf3cf 100644
--- a/arch/metag/kernel/perf/perf_event.c
+++ b/arch/metag/kernel/perf/perf_event.c
@@ -813,8 +813,8 @@ static struct metag_pmu _metag_pmu = {
813}; 813};
814 814
815/* PMU CPU hotplug notifier */ 815/* PMU CPU hotplug notifier */
816static int __cpuinit metag_pmu_cpu_notify(struct notifier_block *b, 816static int metag_pmu_cpu_notify(struct notifier_block *b, unsigned long action,
817 unsigned long action, void *hcpu) 817 void *hcpu)
818{ 818{
819 unsigned int cpu = (unsigned int)hcpu; 819 unsigned int cpu = (unsigned int)hcpu;
820 struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); 820 struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu);
@@ -828,7 +828,7 @@ static int __cpuinit metag_pmu_cpu_notify(struct notifier_block *b,
828 return NOTIFY_OK; 828 return NOTIFY_OK;
829} 829}
830 830
831static struct notifier_block __cpuinitdata metag_pmu_notifier = { 831static struct notifier_block metag_pmu_notifier = {
832 .notifier_call = metag_pmu_cpu_notify, 832 .notifier_call = metag_pmu_cpu_notify,
833}; 833};
834 834
diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c
index 4f5726f1a55b..c396cd0b425f 100644
--- a/arch/metag/kernel/setup.c
+++ b/arch/metag/kernel/setup.c
@@ -20,6 +20,7 @@
20#include <linux/memblock.h> 20#include <linux/memblock.h>
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/of_fdt.h> 22#include <linux/of_fdt.h>
23#include <linux/of_platform.h>
23#include <linux/pfn.h> 24#include <linux/pfn.h>
24#include <linux/root_dev.h> 25#include <linux/root_dev.h>
25#include <linux/sched.h> 26#include <linux/sched.h>
@@ -424,6 +425,9 @@ static int __init customize_machine(void)
424 /* customizes platform devices, or adds new ones */ 425 /* customizes platform devices, or adds new ones */
425 if (machine_desc->init_machine) 426 if (machine_desc->init_machine)
426 machine_desc->init_machine(); 427 machine_desc->init_machine();
428 else
429 of_platform_populate(NULL, of_default_bus_match_table, NULL,
430 NULL);
427 return 0; 431 return 0;
428} 432}
429arch_initcall(customize_machine); 433arch_initcall(customize_machine);
@@ -587,20 +591,20 @@ PTBI pTBI_get(unsigned int cpu)
587EXPORT_SYMBOL(pTBI_get); 591EXPORT_SYMBOL(pTBI_get);
588 592
589#if defined(CONFIG_METAG_DSP) && defined(CONFIG_METAG_FPU) 593#if defined(CONFIG_METAG_DSP) && defined(CONFIG_METAG_FPU)
590char capabilites[] = "dsp fpu"; 594static char capabilities[] = "dsp fpu";
591#elif defined(CONFIG_METAG_DSP) 595#elif defined(CONFIG_METAG_DSP)
592char capabilites[] = "dsp"; 596static char capabilities[] = "dsp";
593#elif defined(CONFIG_METAG_FPU) 597#elif defined(CONFIG_METAG_FPU)
594char capabilites[] = "fpu"; 598static char capabilities[] = "fpu";
595#else 599#else
596char capabilites[] = ""; 600static char capabilities[] = "";
597#endif 601#endif
598 602
599static struct ctl_table caps_kern_table[] = { 603static struct ctl_table caps_kern_table[] = {
600 { 604 {
601 .procname = "capabilities", 605 .procname = "capabilities",
602 .data = capabilites, 606 .data = capabilities,
603 .maxlen = sizeof(capabilites), 607 .maxlen = sizeof(capabilities),
604 .mode = 0444, 608 .mode = 0444,
605 .proc_handler = proc_dostring, 609 .proc_handler = proc_dostring,
606 }, 610 },
diff --git a/arch/metag/kernel/smp.c b/arch/metag/kernel/smp.c
index f443ec9a7cbe..7c0113142981 100644
--- a/arch/metag/kernel/smp.c
+++ b/arch/metag/kernel/smp.c
@@ -8,6 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#include <linux/atomic.h> 10#include <linux/atomic.h>
11#include <linux/completion.h>
11#include <linux/delay.h> 12#include <linux/delay.h>
12#include <linux/init.h> 13#include <linux/init.h>
13#include <linux/spinlock.h> 14#include <linux/spinlock.h>
@@ -62,10 +63,12 @@ static DEFINE_PER_CPU(struct ipi_data, ipi_data) = {
62 63
63static DEFINE_SPINLOCK(boot_lock); 64static DEFINE_SPINLOCK(boot_lock);
64 65
66static DECLARE_COMPLETION(cpu_running);
67
65/* 68/*
66 * "thread" is assumed to be a valid Meta hardware thread ID. 69 * "thread" is assumed to be a valid Meta hardware thread ID.
67 */ 70 */
68int __cpuinit boot_secondary(unsigned int thread, struct task_struct *idle) 71int boot_secondary(unsigned int thread, struct task_struct *idle)
69{ 72{
70 u32 val; 73 u32 val;
71 74
@@ -115,11 +118,9 @@ int __cpuinit boot_secondary(unsigned int thread, struct task_struct *idle)
115 * If the cache partition has changed, prints a message to the log describing 118 * If the cache partition has changed, prints a message to the log describing
116 * those changes. 119 * those changes.
117 */ 120 */
118static __cpuinit void describe_cachepart_change(unsigned int thread, 121static void describe_cachepart_change(unsigned int thread, const char *label,
119 const char *label, 122 unsigned int sz, unsigned int old,
120 unsigned int sz, 123 unsigned int new)
121 unsigned int old,
122 unsigned int new)
123{ 124{
124 unsigned int lor1, land1, gor1, gand1; 125 unsigned int lor1, land1, gor1, gand1;
125 unsigned int lor2, land2, gor2, gand2; 126 unsigned int lor2, land2, gor2, gand2;
@@ -167,7 +168,7 @@ static __cpuinit void describe_cachepart_change(unsigned int thread,
167 * Ensures that coherency is enabled and that the threads share the same cache 168 * Ensures that coherency is enabled and that the threads share the same cache
168 * partitions. 169 * partitions.
169 */ 170 */
170static __cpuinit void setup_smp_cache(unsigned int thread) 171static void setup_smp_cache(unsigned int thread)
171{ 172{
172 unsigned int this_thread, lflags; 173 unsigned int this_thread, lflags;
173 unsigned int dcsz, dcpart_this, dcpart_old, dcpart_new; 174 unsigned int dcsz, dcpart_this, dcpart_old, dcpart_new;
@@ -212,7 +213,7 @@ static __cpuinit void setup_smp_cache(unsigned int thread)
212 icpart_old, icpart_new); 213 icpart_old, icpart_new);
213} 214}
214 215
215int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) 216int __cpu_up(unsigned int cpu, struct task_struct *idle)
216{ 217{
217 unsigned int thread = cpu_2_hwthread_id[cpu]; 218 unsigned int thread = cpu_2_hwthread_id[cpu];
218 int ret; 219 int ret;
@@ -235,20 +236,12 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
235 */ 236 */
236 ret = boot_secondary(thread, idle); 237 ret = boot_secondary(thread, idle);
237 if (ret == 0) { 238 if (ret == 0) {
238 unsigned long timeout;
239
240 /* 239 /*
241 * CPU was successfully started, wait for it 240 * CPU was successfully started, wait for it
242 * to come online or time out. 241 * to come online or time out.
243 */ 242 */
244 timeout = jiffies + HZ; 243 wait_for_completion_timeout(&cpu_running,
245 while (time_before(jiffies, timeout)) { 244 msecs_to_jiffies(1000));
246 if (cpu_online(cpu))
247 break;
248
249 udelay(10);
250 barrier();
251 }
252 245
253 if (!cpu_online(cpu)) 246 if (!cpu_online(cpu))
254 ret = -EIO; 247 ret = -EIO;
@@ -273,10 +266,9 @@ static DECLARE_COMPLETION(cpu_killed);
273/* 266/*
274 * __cpu_disable runs on the processor to be shutdown. 267 * __cpu_disable runs on the processor to be shutdown.
275 */ 268 */
276int __cpuexit __cpu_disable(void) 269int __cpu_disable(void)
277{ 270{
278 unsigned int cpu = smp_processor_id(); 271 unsigned int cpu = smp_processor_id();
279 struct task_struct *p;
280 272
281 /* 273 /*
282 * Take this CPU offline. Once we clear this, we can't return, 274 * Take this CPU offline. Once we clear this, we can't return,
@@ -296,12 +288,7 @@ int __cpuexit __cpu_disable(void)
296 flush_cache_all(); 288 flush_cache_all();
297 local_flush_tlb_all(); 289 local_flush_tlb_all();
298 290
299 read_lock(&tasklist_lock); 291 clear_tasks_mm_cpumask(cpu);
300 for_each_process(p) {
301 if (p->mm)
302 cpumask_clear_cpu(cpu, mm_cpumask(p->mm));
303 }
304 read_unlock(&tasklist_lock);
305 292
306 return 0; 293 return 0;
307} 294}
@@ -310,7 +297,7 @@ int __cpuexit __cpu_disable(void)
310 * called on the thread which is asking for a CPU to be shutdown - 297 * called on the thread which is asking for a CPU to be shutdown -
311 * waits until shutdown has completed, or it is timed out. 298 * waits until shutdown has completed, or it is timed out.
312 */ 299 */
313void __cpuexit __cpu_die(unsigned int cpu) 300void __cpu_die(unsigned int cpu)
314{ 301{
315 if (!wait_for_completion_timeout(&cpu_killed, msecs_to_jiffies(1))) 302 if (!wait_for_completion_timeout(&cpu_killed, msecs_to_jiffies(1)))
316 pr_err("CPU%u: unable to kill\n", cpu); 303 pr_err("CPU%u: unable to kill\n", cpu);
@@ -322,7 +309,7 @@ void __cpuexit __cpu_die(unsigned int cpu)
322 * Note that we do not return from this function. If this cpu is 309 * Note that we do not return from this function. If this cpu is
323 * brought online again it will need to run secondary_startup(). 310 * brought online again it will need to run secondary_startup().
324 */ 311 */
325void __cpuexit cpu_die(void) 312void cpu_die(void)
326{ 313{
327 local_irq_disable(); 314 local_irq_disable();
328 idle_task_exit(); 315 idle_task_exit();
@@ -337,7 +324,7 @@ void __cpuexit cpu_die(void)
337 * Called by both boot and secondaries to move global data into 324 * Called by both boot and secondaries to move global data into
338 * per-processor storage. 325 * per-processor storage.
339 */ 326 */
340void __cpuinit smp_store_cpu_info(unsigned int cpuid) 327void smp_store_cpu_info(unsigned int cpuid)
341{ 328{
342 struct cpuinfo_metag *cpu_info = &per_cpu(cpu_data, cpuid); 329 struct cpuinfo_metag *cpu_info = &per_cpu(cpu_data, cpuid);
343 330
@@ -385,12 +372,7 @@ asmlinkage void secondary_start_kernel(void)
385 372
386 setup_priv(); 373 setup_priv();
387 374
388 /*
389 * Enable local interrupts.
390 */
391 tbi_startup_interrupt(TBID_SIGNUM_TRT);
392 notify_cpu_starting(cpu); 375 notify_cpu_starting(cpu);
393 local_irq_enable();
394 376
395 pr_info("CPU%u (thread %u): Booted secondary processor\n", 377 pr_info("CPU%u (thread %u): Booted secondary processor\n",
396 cpu, cpu_2_hwthread_id[cpu]); 378 cpu, cpu_2_hwthread_id[cpu]);
@@ -402,12 +384,13 @@ asmlinkage void secondary_start_kernel(void)
402 * OK, now it's safe to let the boot CPU continue 384 * OK, now it's safe to let the boot CPU continue
403 */ 385 */
404 set_cpu_online(cpu, true); 386 set_cpu_online(cpu, true);
387 complete(&cpu_running);
405 388
406 /* 389 /*
407 * Check for cache aliasing. 390 * Enable local interrupts.
408 * Preemption is disabled
409 */ 391 */
410 check_for_cache_aliasing(cpu); 392 tbi_startup_interrupt(TBID_SIGNUM_TRT);
393 local_irq_enable();
411 394
412 /* 395 /*
413 * OK, it's off to the idle thread for us 396 * OK, it's off to the idle thread for us
diff --git a/arch/metag/kernel/time.c b/arch/metag/kernel/time.c
index 17dc10733b2f..f1c8c53dace7 100644
--- a/arch/metag/kernel/time.c
+++ b/arch/metag/kernel/time.c
@@ -5,11 +5,21 @@
5 * 5 *
6 */ 6 */
7 7
8#include <linux/init.h>
9
10#include <clocksource/metag_generic.h> 8#include <clocksource/metag_generic.h>
9#include <linux/clk-provider.h>
10#include <linux/init.h>
11#include <asm/clock.h>
11 12
12void __init time_init(void) 13void __init time_init(void)
13{ 14{
15#ifdef CONFIG_COMMON_CLK
16 /* Init clocks from device tree */
17 of_clk_init(NULL);
18#endif
19
20 /* Init meta clocks, particularly the core clock */
21 init_metag_clocks();
22
23 /* Set up the timer clock sources */
14 metag_generic_timer_init(); 24 metag_generic_timer_init();
15} 25}
diff --git a/arch/metag/kernel/traps.c b/arch/metag/kernel/traps.c
index 2ceeaae5b199..25f9d1c2ffec 100644
--- a/arch/metag/kernel/traps.c
+++ b/arch/metag/kernel/traps.c
@@ -33,6 +33,7 @@
33#include <asm/siginfo.h> 33#include <asm/siginfo.h>
34#include <asm/traps.h> 34#include <asm/traps.h>
35#include <asm/hwthread.h> 35#include <asm/hwthread.h>
36#include <asm/setup.h>
36#include <asm/switch.h> 37#include <asm/switch.h>
37#include <asm/user_gateway.h> 38#include <asm/user_gateway.h>
38#include <asm/syscall.h> 39#include <asm/syscall.h>
@@ -87,8 +88,8 @@ const char *trap_name(int trapno)
87 88
88static DEFINE_SPINLOCK(die_lock); 89static DEFINE_SPINLOCK(die_lock);
89 90
90void die(const char *str, struct pt_regs *regs, long err, 91void __noreturn die(const char *str, struct pt_regs *regs,
91 unsigned long addr) 92 long err, unsigned long addr)
92{ 93{
93 static int die_counter; 94 static int die_counter;
94 95
@@ -811,7 +812,7 @@ static void set_trigger_mask(unsigned int mask)
811} 812}
812#endif 813#endif
813 814
814void __cpuinit per_cpu_trap_init(unsigned long cpu) 815void per_cpu_trap_init(unsigned long cpu)
815{ 816{
816 TBIRES int_context; 817 TBIRES int_context;
817 unsigned int thread = cpu_2_hwthread_id[cpu]; 818 unsigned int thread = cpu_2_hwthread_id[cpu];
diff --git a/arch/metag/lib/checksum.c b/arch/metag/lib/checksum.c
index 44d2e1913560..5d6a98a05e9d 100644
--- a/arch/metag/lib/checksum.c
+++ b/arch/metag/lib/checksum.c
@@ -124,7 +124,6 @@ __wsum csum_partial(const void *buff, int len, __wsum wsum)
124 result += 1; 124 result += 1;
125 return (__force __wsum)result; 125 return (__force __wsum)result;
126} 126}
127EXPORT_SYMBOL(csum_partial);
128 127
129/* 128/*
130 * this routine is used for miscellaneous IP-like checksums, mainly 129 * this routine is used for miscellaneous IP-like checksums, mainly
diff --git a/arch/metag/mm/cache.c b/arch/metag/mm/cache.c
index b5d3b2e7c160..a62285284ab8 100644
--- a/arch/metag/mm/cache.c
+++ b/arch/metag/mm/cache.c
@@ -45,7 +45,7 @@ static volatile u32 lnkget_testdata[16] __initdata __aligned(64);
45 45
46#define LNKGET_CONSTANT 0xdeadbeef 46#define LNKGET_CONSTANT 0xdeadbeef
47 47
48void __init metag_lnkget_probe(void) 48static void __init metag_lnkget_probe(void)
49{ 49{
50 int temp; 50 int temp;
51 long flags; 51 long flags;
diff --git a/arch/metag/mm/fault.c b/arch/metag/mm/fault.c
index 2c75bf7357c5..8fddf46e6c62 100644
--- a/arch/metag/mm/fault.c
+++ b/arch/metag/mm/fault.c
@@ -224,8 +224,10 @@ do_sigbus:
224 */ 224 */
225out_of_memory: 225out_of_memory:
226 up_read(&mm->mmap_sem); 226 up_read(&mm->mmap_sem);
227 if (user_mode(regs)) 227 if (user_mode(regs)) {
228 do_group_exit(SIGKILL); 228 pagefault_out_of_memory();
229 return 1;
230 }
229 231
230no_context: 232no_context:
231 /* Are we prepared to handle this kernel fault? */ 233 /* Are we prepared to handle this kernel fault? */
diff --git a/arch/microblaze/configs/mmu_defconfig b/arch/microblaze/configs/mmu_defconfig
index 3649a8b150c0..deaf45ab6429 100644
--- a/arch/microblaze/configs/mmu_defconfig
+++ b/arch/microblaze/configs/mmu_defconfig
@@ -1,4 +1,3 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
3CONFIG_POSIX_MQUEUE=y 2CONFIG_POSIX_MQUEUE=y
4CONFIG_FHANDLE=y 3CONFIG_FHANDLE=y
@@ -81,6 +80,9 @@ CONFIG_DETECT_HUNG_TASK=y
81CONFIG_DEBUG_SLAB=y 80CONFIG_DEBUG_SLAB=y
82CONFIG_DEBUG_SPINLOCK=y 81CONFIG_DEBUG_SPINLOCK=y
83CONFIG_DEBUG_INFO=y 82CONFIG_DEBUG_INFO=y
83CONFIG_KGDB=y
84CONFIG_KGDB_TESTS=y
85CONFIG_KGDB_KDB=y
84CONFIG_EARLY_PRINTK=y 86CONFIG_EARLY_PRINTK=y
85CONFIG_KEYS=y 87CONFIG_KEYS=y
86CONFIG_ENCRYPTED_KEYS=y 88CONFIG_ENCRYPTED_KEYS=y
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h
index 6dece2d002dc..b14232b6878f 100644
--- a/arch/microblaze/include/asm/unistd.h
+++ b/arch/microblaze/include/asm/unistd.h
@@ -38,4 +38,7 @@
38#define __ARCH_WANT_SYS_FORK 38#define __ARCH_WANT_SYS_FORK
39 39
40#endif /* __ASSEMBLY__ */ 40#endif /* __ASSEMBLY__ */
41
42#define __NR_syscalls 381
43
41#endif /* _ASM_MICROBLAZE_UNISTD_H */ 44#endif /* _ASM_MICROBLAZE_UNISTD_H */
diff --git a/arch/microblaze/include/uapi/asm/unistd.h b/arch/microblaze/include/uapi/asm/unistd.h
index 5f7fe7582f3a..20043b67d158 100644
--- a/arch/microblaze/include/uapi/asm/unistd.h
+++ b/arch/microblaze/include/uapi/asm/unistd.h
@@ -397,6 +397,4 @@
397#define __NR_kcmp 379 397#define __NR_kcmp 379
398#define __NR_finit_module 380 398#define __NR_finit_module 380
399 399
400#define __NR_syscalls 381
401
402#endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */ 400#endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */
diff --git a/arch/microblaze/kernel/kgdb.c b/arch/microblaze/kernel/kgdb.c
index 8adc92443100..09a5e8286137 100644
--- a/arch/microblaze/kernel/kgdb.c
+++ b/arch/microblaze/kernel/kgdb.c
@@ -141,7 +141,7 @@ void kgdb_arch_exit(void)
141/* 141/*
142 * Global data 142 * Global data
143 */ 143 */
144const struct kgdb_arch arch_kgdb_ops = { 144struct kgdb_arch arch_kgdb_ops = {
145#ifdef __MICROBLAZEEL__ 145#ifdef __MICROBLAZEEL__
146 .gdb_bpt_instr = {0x18, 0x00, 0x0c, 0xba}, /* brki r16, 0x18 */ 146 .gdb_bpt_instr = {0x18, 0x00, 0x0c, 0xba}, /* brki r16, 0x18 */
147#else 147#else
diff --git a/arch/mips/Kbuild.platforms b/arch/mips/Kbuild.platforms
index 4b597d91a8d5..d9d81c219253 100644
--- a/arch/mips/Kbuild.platforms
+++ b/arch/mips/Kbuild.platforms
@@ -30,7 +30,6 @@ platforms += sibyte
30platforms += sni 30platforms += sni
31platforms += txx9 31platforms += txx9
32platforms += vr41xx 32platforms += vr41xx
33platforms += wrppmc
34 33
35# include the platform specific files 34# include the platform specific files
36include $(patsubst %, $(srctree)/arch/mips/%/Platform, $(platforms)) 35include $(patsubst %, $(srctree)/arch/mips/%/Platform, $(platforms))
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index beeff436b22f..c3abed332301 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1,6 +1,7 @@
1config MIPS 1config MIPS
2 bool 2 bool
3 default y 3 default y
4 select HAVE_CONTEXT_TRACKING
4 select HAVE_GENERIC_DMA_COHERENT 5 select HAVE_GENERIC_DMA_COHERENT
5 select HAVE_IDE 6 select HAVE_IDE
6 select HAVE_OPROFILE 7 select HAVE_OPROFILE
@@ -27,6 +28,7 @@ config MIPS
27 select HAVE_GENERIC_HARDIRQS 28 select HAVE_GENERIC_HARDIRQS
28 select GENERIC_IRQ_PROBE 29 select GENERIC_IRQ_PROBE
29 select GENERIC_IRQ_SHOW 30 select GENERIC_IRQ_SHOW
31 select GENERIC_PCI_IOMAP
30 select HAVE_ARCH_JUMP_LABEL 32 select HAVE_ARCH_JUMP_LABEL
31 select ARCH_WANT_IPC_PARSE_VERSION 33 select ARCH_WANT_IPC_PARSE_VERSION
32 select IRQ_FORCED_THREADING 34 select IRQ_FORCED_THREADING
@@ -46,9 +48,6 @@ config MIPS
46 48
47menu "Machine selection" 49menu "Machine selection"
48 50
49config ZONE_DMA
50 bool
51
52choice 51choice
53 prompt "System type" 52 prompt "System type"
54 default SGI_IP22 53 default SGI_IP22
@@ -124,11 +123,14 @@ config BCM47XX
124 123
125config BCM63XX 124config BCM63XX
126 bool "Broadcom BCM63XX based boards" 125 bool "Broadcom BCM63XX based boards"
126 select BOOT_RAW
127 select CEVT_R4K 127 select CEVT_R4K
128 select CSRC_R4K 128 select CSRC_R4K
129 select DMA_NONCOHERENT 129 select DMA_NONCOHERENT
130 select IRQ_CPU 130 select IRQ_CPU
131 select SYS_HAS_CPU_MIPS32_R1 131 select SYS_HAS_CPU_MIPS32_R1
132 select SYS_HAS_CPU_BMIPS4350 if !BCM63XX_CPU_6338 && !BCM63XX_CPU_6345 && !BCM63XX_CPU_6348
133 select NR_CPUS_DEFAULT_2
132 select SYS_SUPPORTS_32BIT_KERNEL 134 select SYS_SUPPORTS_32BIT_KERNEL
133 select SYS_SUPPORTS_BIG_ENDIAN 135 select SYS_SUPPORTS_BIG_ENDIAN
134 select SYS_HAS_EARLY_PRINTK 136 select SYS_HAS_EARLY_PRINTK
@@ -341,7 +343,6 @@ config MIPS_SEAD3
341 select DMA_NONCOHERENT 343 select DMA_NONCOHERENT
342 select IRQ_CPU 344 select IRQ_CPU
343 select IRQ_GIC 345 select IRQ_GIC
344 select MIPS_CPU_SCACHE
345 select MIPS_MSC 346 select MIPS_MSC
346 select SYS_HAS_CPU_MIPS32_R1 347 select SYS_HAS_CPU_MIPS32_R1
347 select SYS_HAS_CPU_MIPS32_R2 348 select SYS_HAS_CPU_MIPS32_R2
@@ -420,7 +421,6 @@ config POWERTV
420 select CSRC_POWERTV 421 select CSRC_POWERTV
421 select DMA_NONCOHERENT 422 select DMA_NONCOHERENT
422 select HW_HAS_PCI 423 select HW_HAS_PCI
423 select SYS_HAS_EARLY_PRINTK
424 select SYS_HAS_CPU_MIPS32_R2 424 select SYS_HAS_CPU_MIPS32_R2
425 select SYS_SUPPORTS_32BIT_KERNEL 425 select SYS_SUPPORTS_32BIT_KERNEL
426 select SYS_SUPPORTS_BIG_ENDIAN 426 select SYS_SUPPORTS_BIG_ENDIAN
@@ -713,46 +713,8 @@ config MIKROTIK_RB532
713 Support the Mikrotik(tm) RouterBoard 532 series, 713 Support the Mikrotik(tm) RouterBoard 532 series,
714 based on the IDT RC32434 SoC. 714 based on the IDT RC32434 SoC.
715 715
716config WR_PPMC 716config CAVIUM_OCTEON_SOC
717 bool "Wind River PPMC board" 717 bool "Cavium Networks Octeon SoC based boards"
718 select CEVT_R4K
719 select CSRC_R4K
720 select IRQ_CPU
721 select BOOT_ELF32
722 select DMA_NONCOHERENT
723 select HW_HAS_PCI
724 select PCI_GT64XXX_PCI0
725 select SWAP_IO_SPACE
726 select SYS_HAS_CPU_MIPS32_R1
727 select SYS_HAS_CPU_MIPS32_R2
728 select SYS_HAS_CPU_MIPS64_R1
729 select SYS_HAS_CPU_NEVADA
730 select SYS_HAS_CPU_RM7000
731 select SYS_SUPPORTS_32BIT_KERNEL
732 select SYS_SUPPORTS_64BIT_KERNEL
733 select SYS_SUPPORTS_BIG_ENDIAN
734 select SYS_SUPPORTS_LITTLE_ENDIAN
735 help
736 This enables support for the Wind River MIPS32 4KC PPMC evaluation
737 board, which is based on GT64120 bridge chip.
738
739config CAVIUM_OCTEON_SIMULATOR
740 bool "Cavium Networks Octeon Simulator"
741 select CEVT_R4K
742 select 64BIT_PHYS_ADDR
743 select DMA_COHERENT
744 select SYS_SUPPORTS_64BIT_KERNEL
745 select SYS_SUPPORTS_BIG_ENDIAN
746 select SYS_SUPPORTS_HOTPLUG_CPU
747 select SYS_HAS_CPU_CAVIUM_OCTEON
748 select HOLES_IN_ZONE
749 help
750 The Octeon simulator is software performance model of the Cavium
751 Octeon Processor. It supports simulating Octeon processors on x86
752 hardware.
753
754config CAVIUM_OCTEON_REFERENCE_BOARD
755 bool "Cavium Networks Octeon reference board"
756 select CEVT_R4K 718 select CEVT_R4K
757 select 64BIT_PHYS_ADDR 719 select 64BIT_PHYS_ADDR
758 select DMA_COHERENT 720 select DMA_COHERENT
@@ -806,6 +768,8 @@ config NLM_XLR_BOARD
806 select SYS_HAS_EARLY_PRINTK 768 select SYS_HAS_EARLY_PRINTK
807 select USB_ARCH_HAS_OHCI if USB_SUPPORT 769 select USB_ARCH_HAS_OHCI if USB_SUPPORT
808 select USB_ARCH_HAS_EHCI if USB_SUPPORT 770 select USB_ARCH_HAS_EHCI if USB_SUPPORT
771 select SYS_SUPPORTS_ZBOOT
772 select SYS_SUPPORTS_ZBOOT_UART16550
809 help 773 help
810 Support for systems based on Netlogic XLR and XLS processors. 774 Support for systems based on Netlogic XLR and XLS processors.
811 Say Y here if you have a XLR or XLS based board. 775 Say Y here if you have a XLR or XLS based board.
@@ -832,6 +796,8 @@ config NLM_XLP_BOARD
832 select SYNC_R4K 796 select SYNC_R4K
833 select SYS_HAS_EARLY_PRINTK 797 select SYS_HAS_EARLY_PRINTK
834 select USE_OF 798 select USE_OF
799 select SYS_SUPPORTS_ZBOOT
800 select SYS_SUPPORTS_ZBOOT_UART16550
835 help 801 help
836 This board is based on Netlogic XLP Processor. 802 This board is based on Netlogic XLP Processor.
837 Say Y here if you have a XLP based board. 803 Say Y here if you have a XLP based board.
@@ -1031,7 +997,6 @@ config CPU_BIG_ENDIAN
1031config CPU_LITTLE_ENDIAN 997config CPU_LITTLE_ENDIAN
1032 bool "Little endian" 998 bool "Little endian"
1033 depends on SYS_SUPPORTS_LITTLE_ENDIAN 999 depends on SYS_SUPPORTS_LITTLE_ENDIAN
1034 help
1035 1000
1036endchoice 1001endchoice
1037 1002
@@ -1737,6 +1702,7 @@ endchoice
1737 1702
1738config KVM_GUEST 1703config KVM_GUEST
1739 bool "KVM Guest Kernel" 1704 bool "KVM Guest Kernel"
1705 depends on BROKEN_ON_SMP
1740 help 1706 help
1741 Select this option if building a guest kernel for KVM (Trap & Emulate) mode 1707 Select this option if building a guest kernel for KVM (Trap & Emulate) mode
1742 1708
@@ -1964,7 +1930,7 @@ config MIPS_MT_FPAFF
1964 1930
1965config MIPS_VPE_LOADER 1931config MIPS_VPE_LOADER
1966 bool "VPE loader support." 1932 bool "VPE loader support."
1967 depends on SYS_SUPPORTS_MULTITHREADING 1933 depends on SYS_SUPPORTS_MULTITHREADING && MODULES
1968 select CPU_MIPSR2_IRQ_VI 1934 select CPU_MIPSR2_IRQ_VI
1969 select CPU_MIPSR2_IRQ_EI 1935 select CPU_MIPSR2_IRQ_EI
1970 select MIPS_MT 1936 select MIPS_MT
@@ -2382,6 +2348,19 @@ config SECCOMP
2382 2348
2383 If unsure, say Y. Only embedded should say N here. 2349 If unsure, say Y. Only embedded should say N here.
2384 2350
2351config CC_STACKPROTECTOR
2352 bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)"
2353 help
2354 This option turns on the -fstack-protector GCC feature. This
2355 feature puts, at the beginning of functions, a canary value on
2356 the stack just before the return address, and validates
2357 the value just before actually returning. Stack based buffer
2358 overflows (that need to overwrite this return address) now also
2359 overwrite the canary, which gets detected and the attack is then
2360 neutralized via a kernel panic.
2361
2362 This feature requires gcc version 4.2 or above.
2363
2385config USE_OF 2364config USE_OF
2386 bool 2365 bool
2387 select OF 2366 select OF
@@ -2413,7 +2392,6 @@ config PCI
2413 bool "Support for PCI controller" 2392 bool "Support for PCI controller"
2414 depends on HW_HAS_PCI 2393 depends on HW_HAS_PCI
2415 select PCI_DOMAINS 2394 select PCI_DOMAINS
2416 select GENERIC_PCI_IOMAP
2417 select NO_GENERIC_PCI_IOPORT_MAP 2395 select NO_GENERIC_PCI_IOPORT_MAP
2418 help 2396 help
2419 Find out whether you have a PCI motherboard. PCI is the name of a 2397 Find out whether you have a PCI motherboard. PCI is the name of a
@@ -2479,6 +2457,9 @@ config I8253
2479 select CLKEVT_I8253 2457 select CLKEVT_I8253
2480 select MIPS_EXTERNAL_TIMER 2458 select MIPS_EXTERNAL_TIMER
2481 2459
2460config ZONE_DMA
2461 bool
2462
2482config ZONE_DMA32 2463config ZONE_DMA32
2483 bool 2464 bool
2484 2465
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index dd58a04ef4bc..37f9ef324f2f 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -227,6 +227,10 @@ KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)
227 227
228LDFLAGS += -m $(ld-emul) 228LDFLAGS += -m $(ld-emul)
229 229
230ifdef CONFIG_CC_STACKPROTECTOR
231 KBUILD_CFLAGS += -fstack-protector
232endif
233
230ifdef CONFIG_MIPS 234ifdef CONFIG_MIPS
231CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ 235CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
232 egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \ 236 egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \
diff --git a/arch/mips/ath79/mach-ap136.c b/arch/mips/ath79/mach-ap136.c
index 479dd4b1d0d2..07eac58c3641 100644
--- a/arch/mips/ath79/mach-ap136.c
+++ b/arch/mips/ath79/mach-ap136.c
@@ -132,7 +132,7 @@ static void __init ap136_pci_init(u8 *eeprom)
132 ath79_register_pci(); 132 ath79_register_pci();
133} 133}
134#else 134#else
135static inline void ap136_pci_init(void) {} 135static inline void ap136_pci_init(u8 *eeprom) {}
136#endif /* CONFIG_PCI */ 136#endif /* CONFIG_PCI */
137 137
138static void __init ap136_setup(void) 138static void __init ap136_setup(void)
diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c
index 8be4e856b8b8..80f4ecd42b0d 100644
--- a/arch/mips/ath79/setup.c
+++ b/arch/mips/ath79/setup.c
@@ -182,7 +182,7 @@ const char *get_system_type(void)
182 return ath79_sys_type; 182 return ath79_sys_type;
183} 183}
184 184
185unsigned int __cpuinit get_c0_compare_int(void) 185unsigned int get_c0_compare_int(void)
186{ 186{
187 return CP0_LEGACY_COMPARE_IRQ; 187 return CP0_LEGACY_COMPARE_IRQ;
188} 188}
diff --git a/arch/mips/bcm63xx/Kconfig b/arch/mips/bcm63xx/Kconfig
index 5639662fd503..b78306ce56c7 100644
--- a/arch/mips/bcm63xx/Kconfig
+++ b/arch/mips/bcm63xx/Kconfig
@@ -1,6 +1,10 @@
1menu "CPU support" 1menu "CPU support"
2 depends on BCM63XX 2 depends on BCM63XX
3 3
4config BCM63XX_CPU_3368
5 bool "support 3368 CPU"
6 select HW_HAS_PCI
7
4config BCM63XX_CPU_6328 8config BCM63XX_CPU_6328
5 bool "support 6328 CPU" 9 bool "support 6328 CPU"
6 select HW_HAS_PCI 10 select HW_HAS_PCI
@@ -8,14 +12,9 @@ config BCM63XX_CPU_6328
8config BCM63XX_CPU_6338 12config BCM63XX_CPU_6338
9 bool "support 6338 CPU" 13 bool "support 6338 CPU"
10 select HW_HAS_PCI 14 select HW_HAS_PCI
11 select USB_ARCH_HAS_OHCI
12 select USB_OHCI_BIG_ENDIAN_DESC
13 select USB_OHCI_BIG_ENDIAN_MMIO
14 15
15config BCM63XX_CPU_6345 16config BCM63XX_CPU_6345
16 bool "support 6345 CPU" 17 bool "support 6345 CPU"
17 select USB_OHCI_BIG_ENDIAN_DESC
18 select USB_OHCI_BIG_ENDIAN_MMIO
19 18
20config BCM63XX_CPU_6348 19config BCM63XX_CPU_6348
21 bool "support 6348 CPU" 20 bool "support 6348 CPU"
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index a9505c4867e8..5b974eb125fc 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -28,11 +28,47 @@
28#include <bcm63xx_dev_usb_usbd.h> 28#include <bcm63xx_dev_usb_usbd.h>
29#include <board_bcm963xx.h> 29#include <board_bcm963xx.h>
30 30
31#include <uapi/linux/bcm933xx_hcs.h>
32
31#define PFX "board_bcm963xx: " 33#define PFX "board_bcm963xx: "
32 34
35#define HCS_OFFSET_128K 0x20000
36
33static struct board_info board; 37static struct board_info board;
34 38
35/* 39/*
40 * known 3368 boards
41 */
42#ifdef CONFIG_BCM63XX_CPU_3368
43static struct board_info __initdata board_cvg834g = {
44 .name = "CVG834G_E15R3921",
45 .expected_cpu_id = 0x3368,
46
47 .has_uart0 = 1,
48 .has_uart1 = 1,
49
50 .has_enet0 = 1,
51 .has_pci = 1,
52
53 .enet0 = {
54 .has_phy = 1,
55 .use_internal_phy = 1,
56 },
57
58 .leds = {
59 {
60 .name = "CVG834G:green:power",
61 .gpio = 37,
62 .default_trigger= "default-on",
63 },
64 },
65
66 .ephy_reset_gpio = 36,
67 .ephy_reset_gpio_flags = GPIOF_INIT_HIGH,
68};
69#endif
70
71/*
36 * known 6328 boards 72 * known 6328 boards
37 */ 73 */
38#ifdef CONFIG_BCM63XX_CPU_6328 74#ifdef CONFIG_BCM63XX_CPU_6328
@@ -639,6 +675,9 @@ static struct board_info __initdata board_DWVS0 = {
639 * all boards 675 * all boards
640 */ 676 */
641static const struct board_info __initconst *bcm963xx_boards[] = { 677static const struct board_info __initconst *bcm963xx_boards[] = {
678#ifdef CONFIG_BCM63XX_CPU_3368
679 &board_cvg834g,
680#endif
642#ifdef CONFIG_BCM63XX_CPU_6328 681#ifdef CONFIG_BCM63XX_CPU_6328
643 &board_96328avng, 682 &board_96328avng,
644#endif 683#endif
@@ -722,8 +761,9 @@ void __init board_prom_init(void)
722 unsigned int i; 761 unsigned int i;
723 u8 *boot_addr, *cfe; 762 u8 *boot_addr, *cfe;
724 char cfe_version[32]; 763 char cfe_version[32];
725 char *board_name; 764 char *board_name = NULL;
726 u32 val; 765 u32 val;
766 struct bcm_hcs *hcs;
727 767
728 /* read base address of boot chip select (0) 768 /* read base address of boot chip select (0)
729 * 6328/6362 do not have MPI but boot from a fixed address 769 * 6328/6362 do not have MPI but boot from a fixed address
@@ -747,7 +787,12 @@ void __init board_prom_init(void)
747 787
748 bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET); 788 bcm63xx_nvram_init(boot_addr + BCM963XX_NVRAM_OFFSET);
749 789
750 board_name = bcm63xx_nvram_get_name(); 790 if (BCMCPU_IS_3368()) {
791 hcs = (struct bcm_hcs *)boot_addr;
792 board_name = hcs->filename;
793 } else {
794 board_name = bcm63xx_nvram_get_name();
795 }
751 /* find board by name */ 796 /* find board by name */
752 for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) { 797 for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) {
753 if (strncmp(board_name, bcm963xx_boards[i]->name, 16)) 798 if (strncmp(board_name, bcm963xx_boards[i]->name, 16))
@@ -845,6 +890,10 @@ int __init board_register_devices(void)
845 !bcm63xx_nvram_get_mac_address(board.enet1.mac_addr)) 890 !bcm63xx_nvram_get_mac_address(board.enet1.mac_addr))
846 bcm63xx_enet_register(1, &board.enet1); 891 bcm63xx_enet_register(1, &board.enet1);
847 892
893 if (board.has_enetsw &&
894 !bcm63xx_nvram_get_mac_address(board.enetsw.mac_addr))
895 bcm63xx_enetsw_register(&board.enetsw);
896
848 if (board.has_usbd) 897 if (board.has_usbd)
849 bcm63xx_usbd_register(&board.usbd); 898 bcm63xx_usbd_register(&board.usbd);
850 899
@@ -873,5 +922,9 @@ int __init board_register_devices(void)
873 922
874 platform_device_register(&bcm63xx_gpio_leds); 923 platform_device_register(&bcm63xx_gpio_leds);
875 924
925 if (board.ephy_reset_gpio && board.ephy_reset_gpio_flags)
926 gpio_request_one(board.ephy_reset_gpio,
927 board.ephy_reset_gpio_flags, "ephy-reset");
928
876 return 0; 929 return 0;
877} 930}
diff --git a/arch/mips/bcm63xx/clk.c b/arch/mips/bcm63xx/clk.c
index c726a97fc798..43da4ae04cc2 100644
--- a/arch/mips/bcm63xx/clk.c
+++ b/arch/mips/bcm63xx/clk.c
@@ -84,7 +84,7 @@ static void enetx_set(struct clk *clk, int enable)
84 else 84 else
85 clk_disable_unlocked(&clk_enet_misc); 85 clk_disable_unlocked(&clk_enet_misc);
86 86
87 if (BCMCPU_IS_6358()) { 87 if (BCMCPU_IS_3368() || BCMCPU_IS_6358()) {
88 u32 mask; 88 u32 mask;
89 89
90 if (clk->id == 0) 90 if (clk->id == 0)
@@ -110,9 +110,8 @@ static struct clk clk_enet1 = {
110 */ 110 */
111static void ephy_set(struct clk *clk, int enable) 111static void ephy_set(struct clk *clk, int enable)
112{ 112{
113 if (!BCMCPU_IS_6358()) 113 if (BCMCPU_IS_3368() || BCMCPU_IS_6358())
114 return; 114 bcm_hwclock_set(CKCTL_6358_EPHY_EN, enable);
115 bcm_hwclock_set(CKCTL_6358_EPHY_EN, enable);
116} 115}
117 116
118 117
@@ -155,9 +154,10 @@ static struct clk clk_enetsw = {
155 */ 154 */
156static void pcm_set(struct clk *clk, int enable) 155static void pcm_set(struct clk *clk, int enable)
157{ 156{
158 if (!BCMCPU_IS_6358()) 157 if (BCMCPU_IS_3368())
159 return; 158 bcm_hwclock_set(CKCTL_3368_PCM_EN, enable);
160 bcm_hwclock_set(CKCTL_6358_PCM_EN, enable); 159 if (BCMCPU_IS_6358())
160 bcm_hwclock_set(CKCTL_6358_PCM_EN, enable);
161} 161}
162 162
163static struct clk clk_pcm = { 163static struct clk clk_pcm = {
@@ -211,7 +211,7 @@ static void spi_set(struct clk *clk, int enable)
211 mask = CKCTL_6338_SPI_EN; 211 mask = CKCTL_6338_SPI_EN;
212 else if (BCMCPU_IS_6348()) 212 else if (BCMCPU_IS_6348())
213 mask = CKCTL_6348_SPI_EN; 213 mask = CKCTL_6348_SPI_EN;
214 else if (BCMCPU_IS_6358()) 214 else if (BCMCPU_IS_3368() || BCMCPU_IS_6358())
215 mask = CKCTL_6358_SPI_EN; 215 mask = CKCTL_6358_SPI_EN;
216 else if (BCMCPU_IS_6362()) 216 else if (BCMCPU_IS_6362())
217 mask = CKCTL_6362_SPI_EN; 217 mask = CKCTL_6362_SPI_EN;
@@ -318,6 +318,18 @@ unsigned long clk_get_rate(struct clk *clk)
318 318
319EXPORT_SYMBOL(clk_get_rate); 319EXPORT_SYMBOL(clk_get_rate);
320 320
321int clk_set_rate(struct clk *clk, unsigned long rate)
322{
323 return 0;
324}
325EXPORT_SYMBOL_GPL(clk_set_rate);
326
327long clk_round_rate(struct clk *clk, unsigned long rate)
328{
329 return 0;
330}
331EXPORT_SYMBOL_GPL(clk_round_rate);
332
321struct clk *clk_get(struct device *dev, const char *id) 333struct clk *clk_get(struct device *dev, const char *id)
322{ 334{
323 if (!strcmp(id, "enet0")) 335 if (!strcmp(id, "enet0"))
@@ -338,7 +350,7 @@ struct clk *clk_get(struct device *dev, const char *id)
338 return &clk_xtm; 350 return &clk_xtm;
339 if (!strcmp(id, "periph")) 351 if (!strcmp(id, "periph"))
340 return &clk_periph; 352 return &clk_periph;
341 if (BCMCPU_IS_6358() && !strcmp(id, "pcm")) 353 if ((BCMCPU_IS_3368() || BCMCPU_IS_6358()) && !strcmp(id, "pcm"))
342 return &clk_pcm; 354 return &clk_pcm;
343 if ((BCMCPU_IS_6362() || BCMCPU_IS_6368()) && !strcmp(id, "ipsec")) 355 if ((BCMCPU_IS_6362() || BCMCPU_IS_6368()) && !strcmp(id, "ipsec"))
344 return &clk_ipsec; 356 return &clk_ipsec;
diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c
index 79fe32df5e96..7e17374a9ae8 100644
--- a/arch/mips/bcm63xx/cpu.c
+++ b/arch/mips/bcm63xx/cpu.c
@@ -29,6 +29,14 @@ static u8 bcm63xx_cpu_rev;
29static unsigned int bcm63xx_cpu_freq; 29static unsigned int bcm63xx_cpu_freq;
30static unsigned int bcm63xx_memory_size; 30static unsigned int bcm63xx_memory_size;
31 31
32static const unsigned long bcm3368_regs_base[] = {
33 __GEN_CPU_REGS_TABLE(3368)
34};
35
36static const int bcm3368_irqs[] = {
37 __GEN_CPU_IRQ_TABLE(3368)
38};
39
32static const unsigned long bcm6328_regs_base[] = { 40static const unsigned long bcm6328_regs_base[] = {
33 __GEN_CPU_REGS_TABLE(6328) 41 __GEN_CPU_REGS_TABLE(6328)
34}; 42};
@@ -116,6 +124,9 @@ unsigned int bcm63xx_get_memory_size(void)
116static unsigned int detect_cpu_clock(void) 124static unsigned int detect_cpu_clock(void)
117{ 125{
118 switch (bcm63xx_get_cpu_id()) { 126 switch (bcm63xx_get_cpu_id()) {
127 case BCM3368_CPU_ID:
128 return 300000000;
129
119 case BCM6328_CPU_ID: 130 case BCM6328_CPU_ID:
120 { 131 {
121 unsigned int tmp, mips_pll_fcvo; 132 unsigned int tmp, mips_pll_fcvo;
@@ -266,7 +277,7 @@ static unsigned int detect_memory_size(void)
266 banks = (val & SDRAM_CFG_BANK_MASK) ? 2 : 1; 277 banks = (val & SDRAM_CFG_BANK_MASK) ? 2 : 1;
267 } 278 }
268 279
269 if (BCMCPU_IS_6358() || BCMCPU_IS_6368()) { 280 if (BCMCPU_IS_3368() || BCMCPU_IS_6358() || BCMCPU_IS_6368()) {
270 val = bcm_memc_readl(MEMC_CFG_REG); 281 val = bcm_memc_readl(MEMC_CFG_REG);
271 rows = (val & MEMC_CFG_ROW_MASK) >> MEMC_CFG_ROW_SHIFT; 282 rows = (val & MEMC_CFG_ROW_MASK) >> MEMC_CFG_ROW_SHIFT;
272 cols = (val & MEMC_CFG_COL_MASK) >> MEMC_CFG_COL_SHIFT; 283 cols = (val & MEMC_CFG_COL_MASK) >> MEMC_CFG_COL_SHIFT;
@@ -302,10 +313,17 @@ void __init bcm63xx_cpu_init(void)
302 chipid_reg = BCM_6345_PERF_BASE; 313 chipid_reg = BCM_6345_PERF_BASE;
303 break; 314 break;
304 case CPU_BMIPS4350: 315 case CPU_BMIPS4350:
305 if ((read_c0_prid() & 0xf0) == 0x10) 316 switch ((read_c0_prid() & 0xff)) {
317 case 0x04:
318 chipid_reg = BCM_3368_PERF_BASE;
319 break;
320 case 0x10:
306 chipid_reg = BCM_6345_PERF_BASE; 321 chipid_reg = BCM_6345_PERF_BASE;
307 else 322 break;
323 default:
308 chipid_reg = BCM_6368_PERF_BASE; 324 chipid_reg = BCM_6368_PERF_BASE;
325 break;
326 }
309 break; 327 break;
310 } 328 }
311 329
@@ -322,6 +340,10 @@ void __init bcm63xx_cpu_init(void)
322 bcm63xx_cpu_rev = (tmp & REV_REVID_MASK) >> REV_REVID_SHIFT; 340 bcm63xx_cpu_rev = (tmp & REV_REVID_MASK) >> REV_REVID_SHIFT;
323 341
324 switch (bcm63xx_cpu_id) { 342 switch (bcm63xx_cpu_id) {
343 case BCM3368_CPU_ID:
344 bcm63xx_regs_base = bcm3368_regs_base;
345 bcm63xx_irqs = bcm3368_irqs;
346 break;
325 case BCM6328_CPU_ID: 347 case BCM6328_CPU_ID:
326 bcm63xx_regs_base = bcm6328_regs_base; 348 bcm63xx_regs_base = bcm6328_regs_base;
327 bcm63xx_irqs = bcm6328_irqs; 349 bcm63xx_irqs = bcm6328_irqs;
diff --git a/arch/mips/bcm63xx/dev-enet.c b/arch/mips/bcm63xx/dev-enet.c
index 39c23366c5c7..52bc01df9bfe 100644
--- a/arch/mips/bcm63xx/dev-enet.c
+++ b/arch/mips/bcm63xx/dev-enet.c
@@ -9,16 +9,60 @@
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/platform_device.h> 11#include <linux/platform_device.h>
12#include <linux/export.h>
12#include <bcm63xx_dev_enet.h> 13#include <bcm63xx_dev_enet.h>
13#include <bcm63xx_io.h> 14#include <bcm63xx_io.h>
14#include <bcm63xx_regs.h> 15#include <bcm63xx_regs.h>
15 16
17#ifdef BCMCPU_RUNTIME_DETECT
18static const unsigned long bcm6348_regs_enetdmac[] = {
19 [ENETDMAC_CHANCFG] = ENETDMAC_CHANCFG_REG,
20 [ENETDMAC_IR] = ENETDMAC_IR_REG,
21 [ENETDMAC_IRMASK] = ENETDMAC_IRMASK_REG,
22 [ENETDMAC_MAXBURST] = ENETDMAC_MAXBURST_REG,
23};
24
25static const unsigned long bcm6345_regs_enetdmac[] = {
26 [ENETDMAC_CHANCFG] = ENETDMA_6345_CHANCFG_REG,
27 [ENETDMAC_IR] = ENETDMA_6345_IR_REG,
28 [ENETDMAC_IRMASK] = ENETDMA_6345_IRMASK_REG,
29 [ENETDMAC_MAXBURST] = ENETDMA_6345_MAXBURST_REG,
30 [ENETDMAC_BUFALLOC] = ENETDMA_6345_BUFALLOC_REG,
31 [ENETDMAC_RSTART] = ENETDMA_6345_RSTART_REG,
32 [ENETDMAC_FC] = ENETDMA_6345_FC_REG,
33 [ENETDMAC_LEN] = ENETDMA_6345_LEN_REG,
34};
35
36const unsigned long *bcm63xx_regs_enetdmac;
37EXPORT_SYMBOL(bcm63xx_regs_enetdmac);
38
39static __init void bcm63xx_enetdmac_regs_init(void)
40{
41 if (BCMCPU_IS_6345())
42 bcm63xx_regs_enetdmac = bcm6345_regs_enetdmac;
43 else
44 bcm63xx_regs_enetdmac = bcm6348_regs_enetdmac;
45}
46#else
47static __init void bcm63xx_enetdmac_regs_init(void) { }
48#endif
49
16static struct resource shared_res[] = { 50static struct resource shared_res[] = {
17 { 51 {
18 .start = -1, /* filled at runtime */ 52 .start = -1, /* filled at runtime */
19 .end = -1, /* filled at runtime */ 53 .end = -1, /* filled at runtime */
20 .flags = IORESOURCE_MEM, 54 .flags = IORESOURCE_MEM,
21 }, 55 },
56 {
57 .start = -1, /* filled at runtime */
58 .end = -1, /* filled at runtime */
59 .flags = IORESOURCE_MEM,
60 },
61 {
62 .start = -1, /* filled at runtime */
63 .end = -1, /* filled at runtime */
64 .flags = IORESOURCE_MEM,
65 },
22}; 66};
23 67
24static struct platform_device bcm63xx_enet_shared_device = { 68static struct platform_device bcm63xx_enet_shared_device = {
@@ -94,6 +138,71 @@ static struct platform_device bcm63xx_enet1_device = {
94 }, 138 },
95}; 139};
96 140
141static struct resource enetsw_res[] = {
142 {
143 /* start & end filled at runtime */
144 .flags = IORESOURCE_MEM,
145 },
146 {
147 /* start filled at runtime */
148 .flags = IORESOURCE_IRQ,
149 },
150 {
151 /* start filled at runtime */
152 .flags = IORESOURCE_IRQ,
153 },
154};
155
156static struct bcm63xx_enetsw_platform_data enetsw_pd;
157
158static struct platform_device bcm63xx_enetsw_device = {
159 .name = "bcm63xx_enetsw",
160 .num_resources = ARRAY_SIZE(enetsw_res),
161 .resource = enetsw_res,
162 .dev = {
163 .platform_data = &enetsw_pd,
164 },
165};
166
167static int __init register_shared(void)
168{
169 int ret, chan_count;
170
171 if (shared_device_registered)
172 return 0;
173
174 bcm63xx_enetdmac_regs_init();
175
176 shared_res[0].start = bcm63xx_regset_address(RSET_ENETDMA);
177 shared_res[0].end = shared_res[0].start;
178 if (BCMCPU_IS_6345())
179 shared_res[0].end += (RSET_6345_ENETDMA_SIZE) - 1;
180 else
181 shared_res[0].end += (RSET_ENETDMA_SIZE) - 1;
182
183 if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368())
184 chan_count = 32;
185 else if (BCMCPU_IS_6345())
186 chan_count = 8;
187 else
188 chan_count = 16;
189
190 shared_res[1].start = bcm63xx_regset_address(RSET_ENETDMAC);
191 shared_res[1].end = shared_res[1].start;
192 shared_res[1].end += RSET_ENETDMAC_SIZE(chan_count) - 1;
193
194 shared_res[2].start = bcm63xx_regset_address(RSET_ENETDMAS);
195 shared_res[2].end = shared_res[2].start;
196 shared_res[2].end += RSET_ENETDMAS_SIZE(chan_count) - 1;
197
198 ret = platform_device_register(&bcm63xx_enet_shared_device);
199 if (ret)
200 return ret;
201 shared_device_registered = 1;
202
203 return 0;
204}
205
97int __init bcm63xx_enet_register(int unit, 206int __init bcm63xx_enet_register(int unit,
98 const struct bcm63xx_enet_platform_data *pd) 207 const struct bcm63xx_enet_platform_data *pd)
99{ 208{
@@ -104,22 +213,12 @@ int __init bcm63xx_enet_register(int unit,
104 if (unit > 1) 213 if (unit > 1)
105 return -ENODEV; 214 return -ENODEV;
106 215
107 if (unit == 1 && BCMCPU_IS_6338()) 216 if (unit == 1 && (BCMCPU_IS_6338() || BCMCPU_IS_6345()))
108 return -ENODEV; 217 return -ENODEV;
109 218
110 if (!shared_device_registered) { 219 ret = register_shared();
111 shared_res[0].start = bcm63xx_regset_address(RSET_ENETDMA); 220 if (ret)
112 shared_res[0].end = shared_res[0].start; 221 return ret;
113 if (BCMCPU_IS_6338())
114 shared_res[0].end += (RSET_ENETDMA_SIZE / 2) - 1;
115 else
116 shared_res[0].end += (RSET_ENETDMA_SIZE) - 1;
117
118 ret = platform_device_register(&bcm63xx_enet_shared_device);
119 if (ret)
120 return ret;
121 shared_device_registered = 1;
122 }
123 222
124 if (unit == 0) { 223 if (unit == 0) {
125 enet0_res[0].start = bcm63xx_regset_address(RSET_ENET0); 224 enet0_res[0].start = bcm63xx_regset_address(RSET_ENET0);
@@ -155,8 +254,62 @@ int __init bcm63xx_enet_register(int unit,
155 dpd->phy_interrupt = bcm63xx_get_irq_number(IRQ_ENET_PHY); 254 dpd->phy_interrupt = bcm63xx_get_irq_number(IRQ_ENET_PHY);
156 } 255 }
157 256
257 dpd->dma_chan_en_mask = ENETDMAC_CHANCFG_EN_MASK;
258 dpd->dma_chan_int_mask = ENETDMAC_IR_PKTDONE_MASK;
259 if (BCMCPU_IS_6345()) {
260 dpd->dma_chan_en_mask |= ENETDMAC_CHANCFG_CHAINING_MASK;
261 dpd->dma_chan_en_mask |= ENETDMAC_CHANCFG_WRAP_EN_MASK;
262 dpd->dma_chan_en_mask |= ENETDMAC_CHANCFG_FLOWC_EN_MASK;
263 dpd->dma_chan_int_mask |= ENETDMA_IR_BUFDONE_MASK;
264 dpd->dma_chan_int_mask |= ENETDMA_IR_NOTOWNER_MASK;
265 dpd->dma_chan_width = ENETDMA_6345_CHAN_WIDTH;
266 dpd->dma_desc_shift = ENETDMA_6345_DESC_SHIFT;
267 } else {
268 dpd->dma_has_sram = true;
269 dpd->dma_chan_width = ENETDMA_CHAN_WIDTH;
270 }
271
158 ret = platform_device_register(pdev); 272 ret = platform_device_register(pdev);
159 if (ret) 273 if (ret)
160 return ret; 274 return ret;
161 return 0; 275 return 0;
162} 276}
277
278int __init
279bcm63xx_enetsw_register(const struct bcm63xx_enetsw_platform_data *pd)
280{
281 int ret;
282
283 if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368())
284 return -ENODEV;
285
286 ret = register_shared();
287 if (ret)
288 return ret;
289
290 enetsw_res[0].start = bcm63xx_regset_address(RSET_ENETSW);
291 enetsw_res[0].end = enetsw_res[0].start;
292 enetsw_res[0].end += RSET_ENETSW_SIZE - 1;
293 enetsw_res[1].start = bcm63xx_get_irq_number(IRQ_ENETSW_RXDMA0);
294 enetsw_res[2].start = bcm63xx_get_irq_number(IRQ_ENETSW_TXDMA0);
295 if (!enetsw_res[2].start)
296 enetsw_res[2].start = -1;
297
298 memcpy(bcm63xx_enetsw_device.dev.platform_data, pd, sizeof(*pd));
299
300 if (BCMCPU_IS_6328())
301 enetsw_pd.num_ports = ENETSW_PORTS_6328;
302 else if (BCMCPU_IS_6362() || BCMCPU_IS_6368())
303 enetsw_pd.num_ports = ENETSW_PORTS_6368;
304
305 enetsw_pd.dma_has_sram = true;
306 enetsw_pd.dma_chan_width = ENETDMA_CHAN_WIDTH;
307 enetsw_pd.dma_chan_en_mask = ENETDMAC_CHANCFG_EN_MASK;
308 enetsw_pd.dma_chan_int_mask = ENETDMAC_IR_PKTDONE_MASK;
309
310 ret = platform_device_register(&bcm63xx_enetsw_device);
311 if (ret)
312 return ret;
313
314 return 0;
315}
diff --git a/arch/mips/bcm63xx/dev-flash.c b/arch/mips/bcm63xx/dev-flash.c
index 588d1ec622e4..172dd8397178 100644
--- a/arch/mips/bcm63xx/dev-flash.c
+++ b/arch/mips/bcm63xx/dev-flash.c
@@ -71,6 +71,7 @@ static int __init bcm63xx_detect_flash_type(void)
71 case BCM6348_CPU_ID: 71 case BCM6348_CPU_ID:
72 /* no way to auto detect so assume parallel */ 72 /* no way to auto detect so assume parallel */
73 return BCM63XX_FLASH_TYPE_PARALLEL; 73 return BCM63XX_FLASH_TYPE_PARALLEL;
74 case BCM3368_CPU_ID:
74 case BCM6358_CPU_ID: 75 case BCM6358_CPU_ID:
75 val = bcm_gpio_readl(GPIO_STRAPBUS_REG); 76 val = bcm_gpio_readl(GPIO_STRAPBUS_REG);
76 if (val & STRAPBUS_6358_BOOT_SEL_PARALLEL) 77 if (val & STRAPBUS_6358_BOOT_SEL_PARALLEL)
diff --git a/arch/mips/bcm63xx/dev-spi.c b/arch/mips/bcm63xx/dev-spi.c
index 3065bb61820d..d12daed749bc 100644
--- a/arch/mips/bcm63xx/dev-spi.c
+++ b/arch/mips/bcm63xx/dev-spi.c
@@ -37,7 +37,8 @@ static __init void bcm63xx_spi_regs_init(void)
37{ 37{
38 if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) 38 if (BCMCPU_IS_6338() || BCMCPU_IS_6348())
39 bcm63xx_regs_spi = bcm6348_regs_spi; 39 bcm63xx_regs_spi = bcm6348_regs_spi;
40 if (BCMCPU_IS_6358() || BCMCPU_IS_6362() || BCMCPU_IS_6368()) 40 if (BCMCPU_IS_3368() || BCMCPU_IS_6358() ||
41 BCMCPU_IS_6362() || BCMCPU_IS_6368())
41 bcm63xx_regs_spi = bcm6358_regs_spi; 42 bcm63xx_regs_spi = bcm6358_regs_spi;
42} 43}
43#else 44#else
@@ -87,7 +88,8 @@ int __init bcm63xx_spi_register(void)
87 spi_pdata.msg_ctl_width = SPI_6348_MSG_CTL_WIDTH; 88 spi_pdata.msg_ctl_width = SPI_6348_MSG_CTL_WIDTH;
88 } 89 }
89 90
90 if (BCMCPU_IS_6358() || BCMCPU_IS_6362() || BCMCPU_IS_6368()) { 91 if (BCMCPU_IS_3368() || BCMCPU_IS_6358() || BCMCPU_IS_6362() ||
92 BCMCPU_IS_6368()) {
91 spi_resources[0].end += BCM_6358_RSET_SPI_SIZE - 1; 93 spi_resources[0].end += BCM_6358_RSET_SPI_SIZE - 1;
92 spi_pdata.fifo_size = SPI_6358_MSG_DATA_SIZE; 94 spi_pdata.fifo_size = SPI_6358_MSG_DATA_SIZE;
93 spi_pdata.msg_type_shift = SPI_6358_MSG_TYPE_SHIFT; 95 spi_pdata.msg_type_shift = SPI_6358_MSG_TYPE_SHIFT;
diff --git a/arch/mips/bcm63xx/dev-uart.c b/arch/mips/bcm63xx/dev-uart.c
index d6e42c608325..3bc7f3bfc9ad 100644
--- a/arch/mips/bcm63xx/dev-uart.c
+++ b/arch/mips/bcm63xx/dev-uart.c
@@ -54,7 +54,8 @@ int __init bcm63xx_uart_register(unsigned int id)
54 if (id >= ARRAY_SIZE(bcm63xx_uart_devices)) 54 if (id >= ARRAY_SIZE(bcm63xx_uart_devices))
55 return -ENODEV; 55 return -ENODEV;
56 56
57 if (id == 1 && (!BCMCPU_IS_6358() && !BCMCPU_IS_6368())) 57 if (id == 1 && (!BCMCPU_IS_3368() && !BCMCPU_IS_6358() &&
58 !BCMCPU_IS_6368()))
58 return -ENODEV; 59 return -ENODEV;
59 60
60 if (id == 0) { 61 if (id == 0) {
diff --git a/arch/mips/bcm63xx/irq.c b/arch/mips/bcm63xx/irq.c
index c0ab3887f42e..1525f8a3841b 100644
--- a/arch/mips/bcm63xx/irq.c
+++ b/arch/mips/bcm63xx/irq.c
@@ -27,6 +27,17 @@ static void __internal_irq_unmask_32(unsigned int irq) __maybe_unused;
27static void __internal_irq_unmask_64(unsigned int irq) __maybe_unused; 27static void __internal_irq_unmask_64(unsigned int irq) __maybe_unused;
28 28
29#ifndef BCMCPU_RUNTIME_DETECT 29#ifndef BCMCPU_RUNTIME_DETECT
30#ifdef CONFIG_BCM63XX_CPU_3368
31#define irq_stat_reg PERF_IRQSTAT_3368_REG
32#define irq_mask_reg PERF_IRQMASK_3368_REG
33#define irq_bits 32
34#define is_ext_irq_cascaded 0
35#define ext_irq_start 0
36#define ext_irq_end 0
37#define ext_irq_count 4
38#define ext_irq_cfg_reg1 PERF_EXTIRQ_CFG_REG_3368
39#define ext_irq_cfg_reg2 0
40#endif
30#ifdef CONFIG_BCM63XX_CPU_6328 41#ifdef CONFIG_BCM63XX_CPU_6328
31#define irq_stat_reg PERF_IRQSTAT_6328_REG 42#define irq_stat_reg PERF_IRQSTAT_6328_REG
32#define irq_mask_reg PERF_IRQMASK_6328_REG 43#define irq_mask_reg PERF_IRQMASK_6328_REG
@@ -140,6 +151,13 @@ static void bcm63xx_init_irq(void)
140 irq_mask_addr = bcm63xx_regset_address(RSET_PERF); 151 irq_mask_addr = bcm63xx_regset_address(RSET_PERF);
141 152
142 switch (bcm63xx_get_cpu_id()) { 153 switch (bcm63xx_get_cpu_id()) {
154 case BCM3368_CPU_ID:
155 irq_stat_addr += PERF_IRQSTAT_3368_REG;
156 irq_mask_addr += PERF_IRQMASK_3368_REG;
157 irq_bits = 32;
158 ext_irq_count = 4;
159 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_3368;
160 break;
143 case BCM6328_CPU_ID: 161 case BCM6328_CPU_ID:
144 irq_stat_addr += PERF_IRQSTAT_6328_REG; 162 irq_stat_addr += PERF_IRQSTAT_6328_REG;
145 irq_mask_addr += PERF_IRQMASK_6328_REG; 163 irq_mask_addr += PERF_IRQMASK_6328_REG;
@@ -294,6 +312,10 @@ asmlinkage void plat_irq_dispatch(void)
294 312
295 if (cause & CAUSEF_IP7) 313 if (cause & CAUSEF_IP7)
296 do_IRQ(7); 314 do_IRQ(7);
315 if (cause & CAUSEF_IP0)
316 do_IRQ(0);
317 if (cause & CAUSEF_IP1)
318 do_IRQ(1);
297 if (cause & CAUSEF_IP2) 319 if (cause & CAUSEF_IP2)
298 dispatch_internal(); 320 dispatch_internal();
299 if (!is_ext_irq_cascaded) { 321 if (!is_ext_irq_cascaded) {
@@ -475,6 +497,7 @@ static int bcm63xx_external_irq_set_type(struct irq_data *d,
475 reg &= ~EXTIRQ_CFG_BOTHEDGE_6348(irq); 497 reg &= ~EXTIRQ_CFG_BOTHEDGE_6348(irq);
476 break; 498 break;
477 499
500 case BCM3368_CPU_ID:
478 case BCM6328_CPU_ID: 501 case BCM6328_CPU_ID:
479 case BCM6338_CPU_ID: 502 case BCM6338_CPU_ID:
480 case BCM6345_CPU_ID: 503 case BCM6345_CPU_ID:
diff --git a/arch/mips/bcm63xx/nvram.c b/arch/mips/bcm63xx/nvram.c
index a4b8864f9307..e652e578a679 100644
--- a/arch/mips/bcm63xx/nvram.c
+++ b/arch/mips/bcm63xx/nvram.c
@@ -42,6 +42,7 @@ void __init bcm63xx_nvram_init(void *addr)
42{ 42{
43 unsigned int check_len; 43 unsigned int check_len;
44 u32 crc, expected_crc; 44 u32 crc, expected_crc;
45 u8 hcs_mac_addr[ETH_ALEN] = { 0x00, 0x10, 0x18, 0xff, 0xff, 0xff };
45 46
46 /* extract nvram data */ 47 /* extract nvram data */
47 memcpy(&nvram, addr, sizeof(nvram)); 48 memcpy(&nvram, addr, sizeof(nvram));
@@ -62,6 +63,15 @@ void __init bcm63xx_nvram_init(void *addr)
62 if (crc != expected_crc) 63 if (crc != expected_crc)
63 pr_warn("nvram checksum failed, contents may be invalid (expected %08x, got %08x)\n", 64 pr_warn("nvram checksum failed, contents may be invalid (expected %08x, got %08x)\n",
64 expected_crc, crc); 65 expected_crc, crc);
66
67 /* Cable modems have a different NVRAM which is embedded in the eCos
68 * firmware and not easily extractible, give at least a MAC address
69 * pool.
70 */
71 if (BCMCPU_IS_3368()) {
72 memcpy(nvram.mac_addr_base, hcs_mac_addr, ETH_ALEN);
73 nvram.mac_addr_count = 2;
74 }
65} 75}
66 76
67u8 *bcm63xx_nvram_get_name(void) 77u8 *bcm63xx_nvram_get_name(void)
diff --git a/arch/mips/bcm63xx/prom.c b/arch/mips/bcm63xx/prom.c
index fd698087fbfd..8ac4e095e68e 100644
--- a/arch/mips/bcm63xx/prom.c
+++ b/arch/mips/bcm63xx/prom.c
@@ -8,7 +8,11 @@
8 8
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/bootmem.h> 10#include <linux/bootmem.h>
11#include <linux/smp.h>
11#include <asm/bootinfo.h> 12#include <asm/bootinfo.h>
13#include <asm/bmips.h>
14#include <asm/smp-ops.h>
15#include <asm/mipsregs.h>
12#include <bcm63xx_board.h> 16#include <bcm63xx_board.h>
13#include <bcm63xx_cpu.h> 17#include <bcm63xx_cpu.h>
14#include <bcm63xx_io.h> 18#include <bcm63xx_io.h>
@@ -26,7 +30,9 @@ void __init prom_init(void)
26 bcm_wdt_writel(WDT_STOP_2, WDT_CTL_REG); 30 bcm_wdt_writel(WDT_STOP_2, WDT_CTL_REG);
27 31
28 /* disable all hardware blocks clock for now */ 32 /* disable all hardware blocks clock for now */
29 if (BCMCPU_IS_6328()) 33 if (BCMCPU_IS_3368())
34 mask = CKCTL_3368_ALL_SAFE_EN;
35 else if (BCMCPU_IS_6328())
30 mask = CKCTL_6328_ALL_SAFE_EN; 36 mask = CKCTL_6328_ALL_SAFE_EN;
31 else if (BCMCPU_IS_6338()) 37 else if (BCMCPU_IS_6338())
32 mask = CKCTL_6338_ALL_SAFE_EN; 38 mask = CKCTL_6338_ALL_SAFE_EN;
@@ -52,6 +58,47 @@ void __init prom_init(void)
52 58
53 /* do low level board init */ 59 /* do low level board init */
54 board_prom_init(); 60 board_prom_init();
61
62 if (IS_ENABLED(CONFIG_CPU_BMIPS4350) && IS_ENABLED(CONFIG_SMP)) {
63 /* set up SMP */
64 register_smp_ops(&bmips_smp_ops);
65
66 /*
67 * BCM6328 might not have its second CPU enabled, while BCM6358
68 * needs special handling for its shared TLB, so disable SMP
69 * for now.
70 */
71 if (BCMCPU_IS_6328()) {
72 reg = bcm_readl(BCM_6328_OTP_BASE +
73 OTP_USER_BITS_6328_REG(3));
74
75 if (reg & OTP_6328_REG3_TP1_DISABLED)
76 bmips_smp_enabled = 0;
77 } else if (BCMCPU_IS_6358()) {
78 bmips_smp_enabled = 0;
79 }
80
81 if (!bmips_smp_enabled)
82 return;
83
84 /*
85 * The bootloader has set up the CPU1 reset vector at
86 * 0xa000_0200.
87 * This conflicts with the special interrupt vector (IV).
88 * The bootloader has also set up CPU1 to respond to the wrong
89 * IPI interrupt.
90 * Here we will start up CPU1 in the background and ask it to
91 * reconfigure itself then go back to sleep.
92 */
93 memcpy((void *)0xa0000200, &bmips_smp_movevec, 0x20);
94 __sync();
95 set_c0_cause(C_SW0);
96 cpumask_set_cpu(1, &bmips_booted_mask);
97
98 /*
99 * FIXME: we really should have some sort of hazard barrier here
100 */
101 }
55} 102}
56 103
57void __init prom_free_prom_memory(void) 104void __init prom_free_prom_memory(void)
diff --git a/arch/mips/bcm63xx/reset.c b/arch/mips/bcm63xx/reset.c
index 317931c6cf58..acbeb1fe7c57 100644
--- a/arch/mips/bcm63xx/reset.c
+++ b/arch/mips/bcm63xx/reset.c
@@ -30,6 +30,19 @@
30 [BCM63XX_RESET_PCIE] = BCM## __cpu ##_RESET_PCIE, \ 30 [BCM63XX_RESET_PCIE] = BCM## __cpu ##_RESET_PCIE, \
31 [BCM63XX_RESET_PCIE_EXT] = BCM## __cpu ##_RESET_PCIE_EXT, 31 [BCM63XX_RESET_PCIE_EXT] = BCM## __cpu ##_RESET_PCIE_EXT,
32 32
33#define BCM3368_RESET_SPI SOFTRESET_3368_SPI_MASK
34#define BCM3368_RESET_ENET SOFTRESET_3368_ENET_MASK
35#define BCM3368_RESET_USBH 0
36#define BCM3368_RESET_USBD SOFTRESET_3368_USBS_MASK
37#define BCM3368_RESET_DSL 0
38#define BCM3368_RESET_SAR 0
39#define BCM3368_RESET_EPHY SOFTRESET_3368_EPHY_MASK
40#define BCM3368_RESET_ENETSW 0
41#define BCM3368_RESET_PCM SOFTRESET_3368_PCM_MASK
42#define BCM3368_RESET_MPI SOFTRESET_3368_MPI_MASK
43#define BCM3368_RESET_PCIE 0
44#define BCM3368_RESET_PCIE_EXT 0
45
33#define BCM6328_RESET_SPI SOFTRESET_6328_SPI_MASK 46#define BCM6328_RESET_SPI SOFTRESET_6328_SPI_MASK
34#define BCM6328_RESET_ENET 0 47#define BCM6328_RESET_ENET 0
35#define BCM6328_RESET_USBH SOFTRESET_6328_USBH_MASK 48#define BCM6328_RESET_USBH SOFTRESET_6328_USBH_MASK
@@ -117,6 +130,10 @@
117/* 130/*
118 * core reset bits 131 * core reset bits
119 */ 132 */
133static const u32 bcm3368_reset_bits[] = {
134 __GEN_RESET_BITS_TABLE(3368)
135};
136
120static const u32 bcm6328_reset_bits[] = { 137static const u32 bcm6328_reset_bits[] = {
121 __GEN_RESET_BITS_TABLE(6328) 138 __GEN_RESET_BITS_TABLE(6328)
122}; 139};
@@ -146,7 +163,10 @@ static int reset_reg;
146 163
147static int __init bcm63xx_reset_bits_init(void) 164static int __init bcm63xx_reset_bits_init(void)
148{ 165{
149 if (BCMCPU_IS_6328()) { 166 if (BCMCPU_IS_3368()) {
167 reset_reg = PERF_SOFTRESET_6358_REG;
168 bcm63xx_reset_bits = bcm3368_reset_bits;
169 } else if (BCMCPU_IS_6328()) {
150 reset_reg = PERF_SOFTRESET_6328_REG; 170 reset_reg = PERF_SOFTRESET_6328_REG;
151 bcm63xx_reset_bits = bcm6328_reset_bits; 171 bcm63xx_reset_bits = bcm6328_reset_bits;
152 } else if (BCMCPU_IS_6338()) { 172 } else if (BCMCPU_IS_6338()) {
@@ -170,6 +190,13 @@ static int __init bcm63xx_reset_bits_init(void)
170} 190}
171#else 191#else
172 192
193#ifdef CONFIG_BCM63XX_CPU_3368
194static const u32 bcm63xx_reset_bits[] = {
195 __GEN_RESET_BITS_TABLE(3368)
196};
197#define reset_reg PERF_SOFTRESET_6358_REG
198#endif
199
173#ifdef CONFIG_BCM63XX_CPU_6328 200#ifdef CONFIG_BCM63XX_CPU_6328
174static const u32 bcm63xx_reset_bits[] = { 201static const u32 bcm63xx_reset_bits[] = {
175 __GEN_RESET_BITS_TABLE(6328) 202 __GEN_RESET_BITS_TABLE(6328)
diff --git a/arch/mips/bcm63xx/setup.c b/arch/mips/bcm63xx/setup.c
index 24a24445db64..6660c7ddf87b 100644
--- a/arch/mips/bcm63xx/setup.c
+++ b/arch/mips/bcm63xx/setup.c
@@ -68,6 +68,9 @@ void bcm63xx_machine_reboot(void)
68 68
69 /* mask and clear all external irq */ 69 /* mask and clear all external irq */
70 switch (bcm63xx_get_cpu_id()) { 70 switch (bcm63xx_get_cpu_id()) {
71 case BCM3368_CPU_ID:
72 perf_regs[0] = PERF_EXTIRQ_CFG_REG_3368;
73 break;
71 case BCM6328_CPU_ID: 74 case BCM6328_CPU_ID:
72 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6328; 75 perf_regs[0] = PERF_EXTIRQ_CFG_REG_6328;
73 break; 76 break;
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index bbaa1d4beb6d..bb1dbf4abb9d 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -18,6 +18,8 @@ BOOT_HEAP_SIZE := 0x400000
18# Disable Function Tracer 18# Disable Function Tracer
19KBUILD_CFLAGS := $(shell echo $(KBUILD_CFLAGS) | sed -e "s/-pg//") 19KBUILD_CFLAGS := $(shell echo $(KBUILD_CFLAGS) | sed -e "s/-pg//")
20 20
21KBUILD_CFLAGS := $(filter-out -fstack-protector, $(KBUILD_CFLAGS))
22
21KBUILD_CFLAGS := $(LINUXINCLUDE) $(KBUILD_CFLAGS) -D__KERNEL__ \ 23KBUILD_CFLAGS := $(LINUXINCLUDE) $(KBUILD_CFLAGS) -D__KERNEL__ \
22 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull" 24 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull"
23 25
diff --git a/arch/mips/boot/compressed/uart-16550.c b/arch/mips/boot/compressed/uart-16550.c
index 1c7b739b6a1d..c01d343ce6ad 100644
--- a/arch/mips/boot/compressed/uart-16550.c
+++ b/arch/mips/boot/compressed/uart-16550.c
@@ -23,23 +23,39 @@
23#define PORT(offset) (UART0_BASE + (4 * offset)) 23#define PORT(offset) (UART0_BASE + (4 * offset))
24#endif 24#endif
25 25
26#ifdef CONFIG_CPU_XLR
27#define UART0_BASE 0x1EF14000
28#define PORT(offset) (CKSEG1ADDR(UART0_BASE) + (4 * offset))
29#define IOTYPE unsigned int
30#endif
31
32#ifdef CONFIG_CPU_XLP
33#define UART0_BASE 0x18030100
34#define PORT(offset) (CKSEG1ADDR(UART0_BASE) + (4 * offset))
35#define IOTYPE unsigned int
36#endif
37
38#ifndef IOTYPE
39#define IOTYPE char
40#endif
41
26#ifndef PORT 42#ifndef PORT
27#error please define the serial port address for your own machine 43#error please define the serial port address for your own machine
28#endif 44#endif
29 45
30static inline unsigned int serial_in(int offset) 46static inline unsigned int serial_in(int offset)
31{ 47{
32 return *((char *)PORT(offset)); 48 return *((volatile IOTYPE *)PORT(offset)) & 0xFF;
33} 49}
34 50
35static inline void serial_out(int offset, int value) 51static inline void serial_out(int offset, int value)
36{ 52{
37 *((char *)PORT(offset)) = value; 53 *((volatile IOTYPE *)PORT(offset)) = value & 0xFF;
38} 54}
39 55
40void putc(char c) 56void putc(char c)
41{ 57{
42 int timeout = 1024; 58 int timeout = 1000000;
43 59
44 while (((serial_in(UART_LSR) & UART_LSR_THRE) == 0) && (timeout-- > 0)) 60 while (((serial_in(UART_LSR) & UART_LSR_THRE) == 0) && (timeout-- > 0))
45 ; 61 ;
diff --git a/arch/mips/cavium-octeon/Kconfig b/arch/mips/cavium-octeon/Kconfig
index 75a6df7fd265..227705d9d5ae 100644
--- a/arch/mips/cavium-octeon/Kconfig
+++ b/arch/mips/cavium-octeon/Kconfig
@@ -10,6 +10,10 @@ config CAVIUM_CN63XXP1
10 non-CN63XXP1 hardware, so it is recommended to select "n" 10 non-CN63XXP1 hardware, so it is recommended to select "n"
11 unless it is known the workarounds are needed. 11 unless it is known the workarounds are needed.
12 12
13endif # CPU_CAVIUM_OCTEON
14
15if CAVIUM_OCTEON_SOC
16
13config CAVIUM_OCTEON_2ND_KERNEL 17config CAVIUM_OCTEON_2ND_KERNEL
14 bool "Build the kernel to be used as a 2nd kernel on the same chip" 18 bool "Build the kernel to be used as a 2nd kernel on the same chip"
15 default "n" 19 default "n"
@@ -19,17 +23,6 @@ config CAVIUM_OCTEON_2ND_KERNEL
19 with this option to be run at the same time as one built without this 23 with this option to be run at the same time as one built without this
20 option. 24 option.
21 25
22config CAVIUM_OCTEON_HW_FIX_UNALIGNED
23 bool "Enable hardware fixups of unaligned loads and stores"
24 default "y"
25 help
26 Configure the Octeon hardware to automatically fix unaligned loads
27 and stores. Normally unaligned accesses are fixed using a kernel
28 exception handler. This option enables the hardware automatic fixups,
29 which requires only an extra 3 cycles. Disable this option if you
30 are running code that relies on address exceptions on unaligned
31 accesses.
32
33config CAVIUM_OCTEON_CVMSEG_SIZE 26config CAVIUM_OCTEON_CVMSEG_SIZE
34 int "Number of L1 cache lines reserved for CVMSEG memory" 27 int "Number of L1 cache lines reserved for CVMSEG memory"
35 range 0 54 28 range 0 54
@@ -103,4 +96,4 @@ config OCTEON_ILM
103 To compile this driver as a module, choose M here. The module 96 To compile this driver as a module, choose M here. The module
104 will be called octeon-ilm 97 will be called octeon-ilm
105 98
106endif # CPU_CAVIUM_OCTEON 99endif # CAVIUM_OCTEON_SOC
diff --git a/arch/mips/cavium-octeon/Makefile b/arch/mips/cavium-octeon/Makefile
index 3595affb9772..4e952043c922 100644
--- a/arch/mips/cavium-octeon/Makefile
+++ b/arch/mips/cavium-octeon/Makefile
@@ -12,11 +12,12 @@
12CFLAGS_octeon-platform.o = -I$(src)/../../../scripts/dtc/libfdt 12CFLAGS_octeon-platform.o = -I$(src)/../../../scripts/dtc/libfdt
13CFLAGS_setup.o = -I$(src)/../../../scripts/dtc/libfdt 13CFLAGS_setup.o = -I$(src)/../../../scripts/dtc/libfdt
14 14
15obj-y := cpu.o setup.o serial.o octeon-platform.o octeon-irq.o csrc-octeon.o 15obj-y := cpu.o setup.o octeon-platform.o octeon-irq.o csrc-octeon.o
16obj-y += dma-octeon.o flash_setup.o 16obj-y += dma-octeon.o
17obj-y += octeon-memcpy.o 17obj-y += octeon-memcpy.o
18obj-y += executive/ 18obj-y += executive/
19 19
20obj-$(CONFIG_MTD) += flash_setup.o
20obj-$(CONFIG_SMP) += smp.o 21obj-$(CONFIG_SMP) += smp.o
21obj-$(CONFIG_OCTEON_ILM) += oct_ilm.o 22obj-$(CONFIG_OCTEON_ILM) += oct_ilm.o
22 23
diff --git a/arch/mips/cavium-octeon/Platform b/arch/mips/cavium-octeon/Platform
index 1e43ccf1a792..8a301cb12d68 100644
--- a/arch/mips/cavium-octeon/Platform
+++ b/arch/mips/cavium-octeon/Platform
@@ -1,11 +1,11 @@
1# 1#
2# Cavium Octeon 2# Cavium Octeon
3# 3#
4platform-$(CONFIG_CPU_CAVIUM_OCTEON) += cavium-octeon/ 4platform-$(CONFIG_CAVIUM_OCTEON_SOC) += cavium-octeon/
5cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += \ 5cflags-$(CONFIG_CAVIUM_OCTEON_SOC) += \
6 -I$(srctree)/arch/mips/include/asm/mach-cavium-octeon 6 -I$(srctree)/arch/mips/include/asm/mach-cavium-octeon
7ifdef CONFIG_CAVIUM_OCTEON_2ND_KERNEL 7ifdef CONFIG_CAVIUM_OCTEON_2ND_KERNEL
8load-$(CONFIG_CPU_CAVIUM_OCTEON) += 0xffffffff84100000 8load-$(CONFIG_CAVIUM_OCTEON_SOC) += 0xffffffff84100000
9else 9else
10load-$(CONFIG_CPU_CAVIUM_OCTEON) += 0xffffffff81100000 10load-$(CONFIG_CAVIUM_OCTEON_SOC) += 0xffffffff81100000
11endif 11endif
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
index 7c6497781895..0a1283ce47f5 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper-board.c
@@ -181,6 +181,11 @@ int cvmx_helper_board_get_mii_address(int ipd_port)
181 return ipd_port - 16 + 4; 181 return ipd_port - 16 + 4;
182 else 182 else
183 return -1; 183 return -1;
184 case CVMX_BOARD_TYPE_UBNT_E100:
185 if (ipd_port >= 0 && ipd_port <= 2)
186 return 7 - ipd_port;
187 else
188 return -1;
184 } 189 }
185 190
186 /* Some unknown board. Somebody forgot to update this function... */ 191 /* Some unknown board. Somebody forgot to update this function... */
@@ -706,6 +711,14 @@ int __cvmx_helper_board_hardware_enable(int interface)
706 } 711 }
707 } 712 }
708 } 713 }
714 } else if (cvmx_sysinfo_get()->board_type ==
715 CVMX_BOARD_TYPE_UBNT_E100) {
716 cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(0, interface), 0);
717 cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(0, interface), 0x10);
718 cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(1, interface), 0);
719 cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(1, interface), 0x10);
720 cvmx_write_csr(CVMX_ASXX_RX_CLK_SETX(2, interface), 0);
721 cvmx_write_csr(CVMX_ASXX_TX_CLK_SETX(2, interface), 0x10);
709 } 722 }
710 return 0; 723 return 0;
711} 724}
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index 7181def6037a..9d36774bded1 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -1095,7 +1095,7 @@ static void octeon_irq_ip3_ciu(void)
1095 1095
1096static bool octeon_irq_use_ip4; 1096static bool octeon_irq_use_ip4;
1097 1097
1098static void __cpuinit octeon_irq_local_enable_ip4(void *arg) 1098static void octeon_irq_local_enable_ip4(void *arg)
1099{ 1099{
1100 set_c0_status(STATUSF_IP4); 1100 set_c0_status(STATUSF_IP4);
1101} 1101}
@@ -1110,21 +1110,21 @@ static void (*octeon_irq_ip2)(void);
1110static void (*octeon_irq_ip3)(void); 1110static void (*octeon_irq_ip3)(void);
1111static void (*octeon_irq_ip4)(void); 1111static void (*octeon_irq_ip4)(void);
1112 1112
1113void __cpuinitdata (*octeon_irq_setup_secondary)(void); 1113void (*octeon_irq_setup_secondary)(void);
1114 1114
1115void __cpuinit octeon_irq_set_ip4_handler(octeon_irq_ip4_handler_t h) 1115void octeon_irq_set_ip4_handler(octeon_irq_ip4_handler_t h)
1116{ 1116{
1117 octeon_irq_ip4 = h; 1117 octeon_irq_ip4 = h;
1118 octeon_irq_use_ip4 = true; 1118 octeon_irq_use_ip4 = true;
1119 on_each_cpu(octeon_irq_local_enable_ip4, NULL, 1); 1119 on_each_cpu(octeon_irq_local_enable_ip4, NULL, 1);
1120} 1120}
1121 1121
1122static void __cpuinit octeon_irq_percpu_enable(void) 1122static void octeon_irq_percpu_enable(void)
1123{ 1123{
1124 irq_cpu_online(); 1124 irq_cpu_online();
1125} 1125}
1126 1126
1127static void __cpuinit octeon_irq_init_ciu_percpu(void) 1127static void octeon_irq_init_ciu_percpu(void)
1128{ 1128{
1129 int coreid = cvmx_get_core_num(); 1129 int coreid = cvmx_get_core_num();
1130 1130
@@ -1167,7 +1167,7 @@ static void octeon_irq_init_ciu2_percpu(void)
1167 cvmx_read_csr(CVMX_CIU2_SUM_PPX_IP2(coreid)); 1167 cvmx_read_csr(CVMX_CIU2_SUM_PPX_IP2(coreid));
1168} 1168}
1169 1169
1170static void __cpuinit octeon_irq_setup_secondary_ciu(void) 1170static void octeon_irq_setup_secondary_ciu(void)
1171{ 1171{
1172 octeon_irq_init_ciu_percpu(); 1172 octeon_irq_init_ciu_percpu();
1173 octeon_irq_percpu_enable(); 1173 octeon_irq_percpu_enable();
diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
index 389512e2abd6..1830874ff1e2 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -334,9 +334,10 @@ static void __init octeon_fdt_pip_iface(int pip, int idx, u64 *pmac)
334 char name_buffer[20]; 334 char name_buffer[20];
335 int iface; 335 int iface;
336 int p; 336 int p;
337 int count; 337 int count = 0;
338 338
339 count = cvmx_helper_interface_enumerate(idx); 339 if (cvmx_helper_interface_enumerate(idx) == 0)
340 count = cvmx_helper_ports_on_interface(idx);
340 341
341 snprintf(name_buffer, sizeof(name_buffer), "interface@%d", idx); 342 snprintf(name_buffer, sizeof(name_buffer), "interface@%d", idx);
342 iface = fdt_subnode_offset(initial_boot_params, pip, name_buffer); 343 iface = fdt_subnode_offset(initial_boot_params, pip, name_buffer);
@@ -490,8 +491,15 @@ int __init octeon_prune_device_tree(void)
490 491
491 if (alias_prop) { 492 if (alias_prop) {
492 uart = fdt_path_offset(initial_boot_params, alias_prop); 493 uart = fdt_path_offset(initial_boot_params, alias_prop);
493 if (uart_mask & (1 << i)) 494 if (uart_mask & (1 << i)) {
495 __be32 f;
496
497 f = cpu_to_be32(octeon_get_io_clock_rate());
498 fdt_setprop_inplace(initial_boot_params,
499 uart, "clock-frequency",
500 &f, sizeof(f));
494 continue; 501 continue;
502 }
495 pr_debug("Deleting uart%d\n", i); 503 pr_debug("Deleting uart%d\n", i);
496 fdt_nop_node(initial_boot_params, uart); 504 fdt_nop_node(initial_boot_params, uart);
497 fdt_nop_property(initial_boot_params, aliases, 505 fdt_nop_property(initial_boot_params, aliases,
diff --git a/arch/mips/cavium-octeon/serial.c b/arch/mips/cavium-octeon/serial.c
deleted file mode 100644
index f393f65f3923..000000000000
--- a/arch/mips/cavium-octeon/serial.c
+++ /dev/null
@@ -1,109 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2004-2007 Cavium Networks
7 */
8#include <linux/console.h>
9#include <linux/module.h>
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/serial.h>
13#include <linux/serial_8250.h>
14#include <linux/serial_reg.h>
15#include <linux/tty.h>
16#include <linux/irq.h>
17
18#include <asm/time.h>
19
20#include <asm/octeon/octeon.h>
21
22#define DEBUG_UART 1
23
24unsigned int octeon_serial_in(struct uart_port *up, int offset)
25{
26 int rv = cvmx_read_csr((uint64_t)(up->membase + (offset << 3)));
27 if (offset == UART_IIR && (rv & 0xf) == 7) {
28 /* Busy interrupt, read the USR (39) and try again. */
29 cvmx_read_csr((uint64_t)(up->membase + (39 << 3)));
30 rv = cvmx_read_csr((uint64_t)(up->membase + (offset << 3)));
31 }
32 return rv;
33}
34
35void octeon_serial_out(struct uart_port *up, int offset, int value)
36{
37 /*
38 * If bits 6 or 7 of the OCTEON UART's LCR are set, it quits
39 * working.
40 */
41 if (offset == UART_LCR)
42 value &= 0x9f;
43 cvmx_write_csr((uint64_t)(up->membase + (offset << 3)), (u8)value);
44}
45
46static int octeon_serial_probe(struct platform_device *pdev)
47{
48 int irq, res;
49 struct resource *res_mem;
50 struct uart_8250_port up;
51
52 /* All adaptors have an irq. */
53 irq = platform_get_irq(pdev, 0);
54 if (irq < 0)
55 return irq;
56
57 memset(&up, 0, sizeof(up));
58
59 up.port.flags = ASYNC_SKIP_TEST | UPF_SHARE_IRQ | UPF_FIXED_TYPE;
60 up.port.type = PORT_OCTEON;
61 up.port.iotype = UPIO_MEM;
62 up.port.regshift = 3;
63 up.port.dev = &pdev->dev;
64
65 if (octeon_is_simulation())
66 /* Make simulator output fast*/
67 up.port.uartclk = 115200 * 16;
68 else
69 up.port.uartclk = octeon_get_io_clock_rate();
70
71 up.port.serial_in = octeon_serial_in;
72 up.port.serial_out = octeon_serial_out;
73 up.port.irq = irq;
74
75 res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
76 if (res_mem == NULL) {
77 dev_err(&pdev->dev, "found no memory resource\n");
78 return -ENXIO;
79 }
80 up.port.mapbase = res_mem->start;
81 up.port.membase = ioremap(res_mem->start, resource_size(res_mem));
82
83 res = serial8250_register_8250_port(&up);
84
85 return res >= 0 ? 0 : res;
86}
87
88static struct of_device_id octeon_serial_match[] = {
89 {
90 .compatible = "cavium,octeon-3860-uart",
91 },
92 {},
93};
94MODULE_DEVICE_TABLE(of, octeon_serial_match);
95
96static struct platform_driver octeon_serial_driver = {
97 .probe = octeon_serial_probe,
98 .driver = {
99 .owner = THIS_MODULE,
100 .name = "octeon_serial",
101 .of_match_table = octeon_serial_match,
102 },
103};
104
105static int __init octeon_serial_init(void)
106{
107 return platform_driver_register(&octeon_serial_driver);
108}
109late_initcall(octeon_serial_init);
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 01b1b3f94feb..48b08eb9d9e4 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -7,6 +7,7 @@
7 * Copyright (C) 2008, 2009 Wind River Systems 7 * Copyright (C) 2008, 2009 Wind River Systems
8 * written by Ralf Baechle <ralf@linux-mips.org> 8 * written by Ralf Baechle <ralf@linux-mips.org>
9 */ 9 */
10#include <linux/compiler.h>
10#include <linux/init.h> 11#include <linux/init.h>
11#include <linux/kernel.h> 12#include <linux/kernel.h>
12#include <linux/console.h> 13#include <linux/console.h>
@@ -40,12 +41,6 @@
40#include <asm/octeon/pci-octeon.h> 41#include <asm/octeon/pci-octeon.h>
41#include <asm/octeon/cvmx-mio-defs.h> 42#include <asm/octeon/cvmx-mio-defs.h>
42 43
43#ifdef CONFIG_CAVIUM_DECODE_RSL
44extern void cvmx_interrupt_rsl_decode(void);
45extern int __cvmx_interrupt_ecc_report_single_bit_errors;
46extern void cvmx_interrupt_rsl_enable(void);
47#endif
48
49extern struct plat_smp_ops octeon_smp_ops; 44extern struct plat_smp_ops octeon_smp_ops;
50 45
51#ifdef CONFIG_PCI 46#ifdef CONFIG_PCI
@@ -463,18 +458,6 @@ static void octeon_halt(void)
463} 458}
464 459
465/** 460/**
466 * Handle all the error condition interrupts that might occur.
467 *
468 */
469#ifdef CONFIG_CAVIUM_DECODE_RSL
470static irqreturn_t octeon_rlm_interrupt(int cpl, void *dev_id)
471{
472 cvmx_interrupt_rsl_decode();
473 return IRQ_HANDLED;
474}
475#endif
476
477/**
478 * Return a string representing the system type 461 * Return a string representing the system type
479 * 462 *
480 * Returns 463 * Returns
@@ -712,7 +695,7 @@ void __init prom_init(void)
712 if (cvmx_read_csr(CVMX_L2D_FUS3) & (3ull << 34)) { 695 if (cvmx_read_csr(CVMX_L2D_FUS3) & (3ull << 34)) {
713 pr_info("Skipping L2 locking due to reduced L2 cache size\n"); 696 pr_info("Skipping L2 locking due to reduced L2 cache size\n");
714 } else { 697 } else {
715 uint32_t ebase = read_c0_ebase() & 0x3ffff000; 698 uint32_t __maybe_unused ebase = read_c0_ebase() & 0x3ffff000;
716#ifdef CONFIG_CAVIUM_OCTEON_LOCK_L2_TLB 699#ifdef CONFIG_CAVIUM_OCTEON_LOCK_L2_TLB
717 /* TLB refill */ 700 /* TLB refill */
718 cvmx_l2c_lock_mem_region(ebase, 0x100); 701 cvmx_l2c_lock_mem_region(ebase, 0x100);
@@ -996,7 +979,7 @@ void __init plat_mem_setup(void)
996 cvmx_bootmem_unlock(); 979 cvmx_bootmem_unlock();
997 /* Add the memory region for the kernel. */ 980 /* Add the memory region for the kernel. */
998 kernel_start = (unsigned long) _text; 981 kernel_start = (unsigned long) _text;
999 kernel_size = ALIGN(_end - _text, 0x100000); 982 kernel_size = _end - _text;
1000 983
1001 /* Adjust for physical offset. */ 984 /* Adjust for physical offset. */
1002 kernel_start &= ~0xffffffff80000000ULL; 985 kernel_start &= ~0xffffffff80000000ULL;
@@ -1064,15 +1047,6 @@ void prom_free_prom_memory(void)
1064 panic("Core-14449 WAR not in place (%04x).\n" 1047 panic("Core-14449 WAR not in place (%04x).\n"
1065 "Please build kernel with proper options (CONFIG_CAVIUM_CN63XXP1).", insn); 1048 "Please build kernel with proper options (CONFIG_CAVIUM_CN63XXP1).", insn);
1066 } 1049 }
1067#ifdef CONFIG_CAVIUM_DECODE_RSL
1068 cvmx_interrupt_rsl_enable();
1069
1070 /* Add an interrupt handler for general failures. */
1071 if (request_irq(OCTEON_IRQ_RML, octeon_rlm_interrupt, IRQF_SHARED,
1072 "RML/RSL", octeon_rlm_interrupt)) {
1073 panic("Unable to request_irq(OCTEON_IRQ_RML)");
1074 }
1075#endif
1076} 1050}
1077 1051
1078int octeon_prune_device_tree(void); 1052int octeon_prune_device_tree(void);
diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c
index 295137dfdc37..138cc80c5928 100644
--- a/arch/mips/cavium-octeon/smp.c
+++ b/arch/mips/cavium-octeon/smp.c
@@ -173,7 +173,7 @@ static void octeon_boot_secondary(int cpu, struct task_struct *idle)
173 * After we've done initial boot, this function is called to allow the 173 * After we've done initial boot, this function is called to allow the
174 * board code to clean up state, if needed 174 * board code to clean up state, if needed
175 */ 175 */
176static void __cpuinit octeon_init_secondary(void) 176static void octeon_init_secondary(void)
177{ 177{
178 unsigned int sr; 178 unsigned int sr;
179 179
@@ -375,7 +375,7 @@ static int octeon_update_boot_vector(unsigned int cpu)
375 return 0; 375 return 0;
376} 376}
377 377
378static int __cpuinit octeon_cpu_callback(struct notifier_block *nfb, 378static int octeon_cpu_callback(struct notifier_block *nfb,
379 unsigned long action, void *hcpu) 379 unsigned long action, void *hcpu)
380{ 380{
381 unsigned int cpu = (unsigned long)hcpu; 381 unsigned int cpu = (unsigned long)hcpu;
@@ -394,7 +394,7 @@ static int __cpuinit octeon_cpu_callback(struct notifier_block *nfb,
394 return NOTIFY_OK; 394 return NOTIFY_OK;
395} 395}
396 396
397static int __cpuinit register_cavium_notifier(void) 397static int register_cavium_notifier(void)
398{ 398{
399 hotcpu_notifier(octeon_cpu_callback, 0); 399 hotcpu_notifier(octeon_cpu_callback, 0);
400 return 0; 400 return 0;
diff --git a/arch/mips/configs/cavium_octeon_defconfig b/arch/mips/configs/cavium_octeon_defconfig
index 014ba4bbba7d..dace58268ce1 100644
--- a/arch/mips/configs/cavium_octeon_defconfig
+++ b/arch/mips/configs/cavium_octeon_defconfig
@@ -1,13 +1,11 @@
1CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD=y 1CONFIG_CAVIUM_OCTEON_SOC=y
2CONFIG_CAVIUM_CN63XXP1=y 2CONFIG_CAVIUM_CN63XXP1=y
3CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE=2 3CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE=2
4CONFIG_SPARSEMEM_MANUAL=y
5CONFIG_TRANSPARENT_HUGEPAGE=y 4CONFIG_TRANSPARENT_HUGEPAGE=y
6CONFIG_SMP=y 5CONFIG_SMP=y
7CONFIG_NR_CPUS=32 6CONFIG_NR_CPUS=32
8CONFIG_HZ_100=y 7CONFIG_HZ_100=y
9CONFIG_PREEMPT=y 8CONFIG_PREEMPT=y
10CONFIG_EXPERIMENTAL=y
11CONFIG_SYSVIPC=y 9CONFIG_SYSVIPC=y
12CONFIG_POSIX_MQUEUE=y 10CONFIG_POSIX_MQUEUE=y
13CONFIG_BSD_PROCESS_ACCT=y 11CONFIG_BSD_PROCESS_ACCT=y
@@ -50,7 +48,6 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
50# CONFIG_FW_LOADER is not set 48# CONFIG_FW_LOADER is not set
51CONFIG_MTD=y 49CONFIG_MTD=y
52# CONFIG_MTD_OF_PARTS is not set 50# CONFIG_MTD_OF_PARTS is not set
53CONFIG_MTD_CHAR=y
54CONFIG_MTD_BLOCK=y 51CONFIG_MTD_BLOCK=y
55CONFIG_MTD_CFI=y 52CONFIG_MTD_CFI=y
56CONFIG_MTD_CFI_AMDSTD=y 53CONFIG_MTD_CFI_AMDSTD=y
@@ -114,6 +111,7 @@ CONFIG_SERIAL_8250=y
114CONFIG_SERIAL_8250_CONSOLE=y 111CONFIG_SERIAL_8250_CONSOLE=y
115CONFIG_SERIAL_8250_NR_UARTS=2 112CONFIG_SERIAL_8250_NR_UARTS=2
116CONFIG_SERIAL_8250_RUNTIME_UARTS=2 113CONFIG_SERIAL_8250_RUNTIME_UARTS=2
114CONFIG_SERIAL_8250_DW=y
117# CONFIG_HW_RANDOM is not set 115# CONFIG_HW_RANDOM is not set
118CONFIG_I2C=y 116CONFIG_I2C=y
119CONFIG_I2C_OCTEON=y 117CONFIG_I2C_OCTEON=y
diff --git a/arch/mips/configs/wrppmc_defconfig b/arch/mips/configs/wrppmc_defconfig
deleted file mode 100644
index 44a451be359e..000000000000
--- a/arch/mips/configs/wrppmc_defconfig
+++ /dev/null
@@ -1,97 +0,0 @@
1CONFIG_WR_PPMC=y
2CONFIG_HZ_1000=y
3CONFIG_EXPERIMENTAL=y
4# CONFIG_SWAP is not set
5CONFIG_SYSVIPC=y
6CONFIG_BSD_PROCESS_ACCT=y
7CONFIG_LOG_BUF_SHIFT=14
8CONFIG_BLK_DEV_INITRD=y
9# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
10CONFIG_EXPERT=y
11CONFIG_KALLSYMS_EXTRA_PASS=y
12# CONFIG_EPOLL is not set
13CONFIG_SLAB=y
14CONFIG_MODULES=y
15CONFIG_MODULE_UNLOAD=y
16CONFIG_MODVERSIONS=y
17CONFIG_MODULE_SRCVERSION_ALL=y
18CONFIG_PCI=y
19CONFIG_HOTPLUG_PCI=y
20CONFIG_BINFMT_MISC=y
21CONFIG_PM=y
22CONFIG_NET=y
23CONFIG_PACKET=y
24CONFIG_UNIX=y
25CONFIG_XFRM_MIGRATE=y
26CONFIG_INET=y
27CONFIG_IP_MULTICAST=y
28CONFIG_IP_PNP=y
29CONFIG_IP_PNP_DHCP=y
30CONFIG_IP_PNP_BOOTP=y
31CONFIG_IP_PNP_RARP=y
32CONFIG_IP_MROUTE=y
33CONFIG_ARPD=y
34CONFIG_INET_XFRM_MODE_TRANSPORT=m
35CONFIG_INET_XFRM_MODE_TUNNEL=m
36CONFIG_INET_XFRM_MODE_BEET=m
37CONFIG_TCP_MD5SIG=y
38# CONFIG_IPV6 is not set
39CONFIG_NETWORK_SECMARK=y
40CONFIG_FW_LOADER=m
41CONFIG_BLK_DEV_RAM=y
42CONFIG_SGI_IOC4=m
43CONFIG_NETDEVICES=y
44CONFIG_PHYLIB=y
45CONFIG_VITESSE_PHY=m
46CONFIG_SMSC_PHY=m
47CONFIG_NET_ETHERNET=y
48CONFIG_NET_PCI=y
49CONFIG_E100=y
50CONFIG_QLA3XXX=m
51CONFIG_CHELSIO_T3=m
52CONFIG_NETXEN_NIC=m
53# CONFIG_INPUT is not set
54# CONFIG_SERIO is not set
55# CONFIG_VT is not set
56CONFIG_SERIAL_8250=y
57CONFIG_SERIAL_8250_CONSOLE=y
58CONFIG_SERIAL_8250_NR_UARTS=1
59CONFIG_SERIAL_8250_RUNTIME_UARTS=1
60# CONFIG_HW_RANDOM is not set
61CONFIG_PROC_KCORE=y
62CONFIG_TMPFS=y
63CONFIG_TMPFS_POSIX_ACL=y
64CONFIG_NFS_FS=y
65CONFIG_NFS_V3=y
66CONFIG_ROOT_NFS=y
67CONFIG_DLM=m
68CONFIG_CMDLINE_BOOL=y
69CONFIG_CMDLINE="console=ttyS0,115200n8"
70CONFIG_CRYPTO_NULL=m
71CONFIG_CRYPTO_CBC=m
72CONFIG_CRYPTO_ECB=m
73CONFIG_CRYPTO_LRW=m
74CONFIG_CRYPTO_PCBC=m
75CONFIG_CRYPTO_XCBC=m
76CONFIG_CRYPTO_MD4=m
77CONFIG_CRYPTO_MICHAEL_MIC=m
78CONFIG_CRYPTO_SHA256=m
79CONFIG_CRYPTO_SHA512=m
80CONFIG_CRYPTO_TGR192=m
81CONFIG_CRYPTO_WP512=m
82CONFIG_CRYPTO_ANUBIS=m
83CONFIG_CRYPTO_ARC4=m
84CONFIG_CRYPTO_BLOWFISH=m
85CONFIG_CRYPTO_CAMELLIA=m
86CONFIG_CRYPTO_CAST5=m
87CONFIG_CRYPTO_CAST6=m
88CONFIG_CRYPTO_DES=m
89CONFIG_CRYPTO_FCRYPT=m
90CONFIG_CRYPTO_KHAZAD=m
91CONFIG_CRYPTO_SERPENT=m
92CONFIG_CRYPTO_TEA=m
93CONFIG_CRYPTO_TWOFISH=m
94CONFIG_CRYPTO_DEFLATE=m
95CONFIG_CRC_CCITT=y
96CONFIG_CRC16=y
97CONFIG_LIBCRC32C=y
diff --git a/arch/mips/dec/Makefile b/arch/mips/dec/Makefile
index 9eb2f9c036aa..3d5d2c56de8d 100644
--- a/arch/mips/dec/Makefile
+++ b/arch/mips/dec/Makefile
@@ -5,6 +5,5 @@
5obj-y := ecc-berr.o int-handler.o ioasic-irq.o kn01-berr.o \ 5obj-y := ecc-berr.o int-handler.o ioasic-irq.o kn01-berr.o \
6 kn02-irq.o kn02xa-berr.o reset.o setup.o time.o 6 kn02-irq.o kn02xa-berr.o reset.o setup.o time.o
7 7
8obj-$(CONFIG_PROM_CONSOLE) += promcon.o
9obj-$(CONFIG_TC) += tc.o 8obj-$(CONFIG_TC) += tc.o
10obj-$(CONFIG_CPU_HAS_WB) += wbflush.o 9obj-$(CONFIG_CPU_HAS_WB) += wbflush.o
diff --git a/arch/mips/dec/promcon.c b/arch/mips/dec/promcon.c
deleted file mode 100644
index c239c25b79ff..000000000000
--- a/arch/mips/dec/promcon.c
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * Wrap-around code for a console using the
3 * DECstation PROM io-routines.
4 *
5 * Copyright (c) 1998 Harald Koerfgen
6 */
7
8#include <linux/tty.h>
9#include <linux/ptrace.h>
10#include <linux/init.h>
11#include <linux/console.h>
12#include <linux/fs.h>
13
14#include <asm/dec/prom.h>
15
16static void prom_console_write(struct console *co, const char *s,
17 unsigned count)
18{
19 unsigned i;
20
21 /*
22 * Now, do each character
23 */
24 for (i = 0; i < count; i++) {
25 if (*s == 10)
26 prom_printf("%c", 13);
27 prom_printf("%c", *s++);
28 }
29}
30
31static int __init prom_console_setup(struct console *co, char *options)
32{
33 return 0;
34}
35
36static struct console sercons = {
37 .name = "ttyS",
38 .write = prom_console_write,
39 .setup = prom_console_setup,
40 .flags = CON_PRINTBUFFER,
41 .index = -1,
42};
43
44/*
45 * Register console.
46 */
47
48static int __init prom_console_init(void)
49{
50 register_console(&sercons);
51
52 return 0;
53}
54console_initcall(prom_console_init);
diff --git a/arch/mips/fw/cfe/cfe_api.c b/arch/mips/fw/cfe/cfe_api.c
index d06dc5a6b8d3..cf84f01931c5 100644
--- a/arch/mips/fw/cfe/cfe_api.c
+++ b/arch/mips/fw/cfe/cfe_api.c
@@ -406,12 +406,12 @@ int cfe_setenv(char *name, char *val)
406 return xiocb.xiocb_status; 406 return xiocb.xiocb_status;
407} 407}
408 408
409int cfe_write(int handle, unsigned char *buffer, int length) 409int cfe_write(int handle, const char *buffer, int length)
410{ 410{
411 return cfe_writeblk(handle, 0, buffer, length); 411 return cfe_writeblk(handle, 0, buffer, length);
412} 412}
413 413
414int cfe_writeblk(int handle, s64 offset, unsigned char *buffer, int length) 414int cfe_writeblk(int handle, s64 offset, const char *buffer, int length)
415{ 415{
416 struct cfe_xiocb xiocb; 416 struct cfe_xiocb xiocb;
417 417
diff --git a/arch/mips/include/asm/cop2.h b/arch/mips/include/asm/cop2.h
index 3532e2c5f098..c1516cc0285f 100644
--- a/arch/mips/include/asm/cop2.h
+++ b/arch/mips/include/asm/cop2.h
@@ -11,6 +11,35 @@
11 11
12#include <linux/notifier.h> 12#include <linux/notifier.h>
13 13
14#if defined(CONFIG_CPU_CAVIUM_OCTEON)
15
16extern void octeon_cop2_save(struct octeon_cop2_state *);
17extern void octeon_cop2_restore(struct octeon_cop2_state *);
18
19#define cop2_save(r) octeon_cop2_save(r)
20#define cop2_restore(r) octeon_cop2_restore(r)
21
22#define cop2_present 1
23#define cop2_lazy_restore 1
24
25#elif defined(CONFIG_CPU_XLP)
26
27extern void nlm_cop2_save(struct nlm_cop2_state *);
28extern void nlm_cop2_restore(struct nlm_cop2_state *);
29#define cop2_save(r) nlm_cop2_save(r)
30#define cop2_restore(r) nlm_cop2_restore(r)
31
32#define cop2_present 1
33#define cop2_lazy_restore 0
34
35#else
36
37#define cop2_present 0
38#define cop2_lazy_restore 0
39#define cop2_save(r)
40#define cop2_restore(r)
41#endif
42
14enum cu2_ops { 43enum cu2_ops {
15 CU2_EXCEPTION, 44 CU2_EXCEPTION,
16 CU2_LWC2_OP, 45 CU2_LWC2_OP,
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
index e5ec8fcd8afa..1dc086087a72 100644
--- a/arch/mips/include/asm/cpu-features.h
+++ b/arch/mips/include/asm/cpu-features.h
@@ -24,6 +24,16 @@
24#ifndef cpu_has_tlb 24#ifndef cpu_has_tlb
25#define cpu_has_tlb (cpu_data[0].options & MIPS_CPU_TLB) 25#define cpu_has_tlb (cpu_data[0].options & MIPS_CPU_TLB)
26#endif 26#endif
27
28/*
29 * For the moment we don't consider R6000 and R8000 so we can assume that
30 * anything that doesn't support R4000-style exceptions and interrupts is
31 * R3000-like. Users should still treat these two macro definitions as
32 * opaque.
33 */
34#ifndef cpu_has_3kex
35#define cpu_has_3kex (!cpu_has_4kex)
36#endif
27#ifndef cpu_has_4kex 37#ifndef cpu_has_4kex
28#define cpu_has_4kex (cpu_data[0].options & MIPS_CPU_4KEX) 38#define cpu_has_4kex (cpu_data[0].options & MIPS_CPU_4KEX)
29#endif 39#endif
@@ -87,19 +97,23 @@
87#define cpu_has_mips16 (cpu_data[0].ases & MIPS_ASE_MIPS16) 97#define cpu_has_mips16 (cpu_data[0].ases & MIPS_ASE_MIPS16)
88#endif 98#endif
89#ifndef cpu_has_mdmx 99#ifndef cpu_has_mdmx
90#define cpu_has_mdmx (cpu_data[0].ases & MIPS_ASE_MDMX) 100#define cpu_has_mdmx (cpu_data[0].ases & MIPS_ASE_MDMX)
91#endif 101#endif
92#ifndef cpu_has_mips3d 102#ifndef cpu_has_mips3d
93#define cpu_has_mips3d (cpu_data[0].ases & MIPS_ASE_MIPS3D) 103#define cpu_has_mips3d (cpu_data[0].ases & MIPS_ASE_MIPS3D)
94#endif 104#endif
95#ifndef cpu_has_smartmips 105#ifndef cpu_has_smartmips
96#define cpu_has_smartmips (cpu_data[0].ases & MIPS_ASE_SMARTMIPS) 106#define cpu_has_smartmips (cpu_data[0].ases & MIPS_ASE_SMARTMIPS)
97#endif 107#endif
98#ifndef cpu_has_rixi 108#ifndef cpu_has_rixi
99#define cpu_has_rixi (cpu_data[0].options & MIPS_CPU_RIXI) 109#define cpu_has_rixi (cpu_data[0].options & MIPS_CPU_RIXI)
100#endif 110#endif
101#ifndef cpu_has_mmips 111#ifndef cpu_has_mmips
102#define cpu_has_mmips (cpu_data[0].options & MIPS_CPU_MICROMIPS) 112# ifdef CONFIG_SYS_SUPPORTS_MICROMIPS
113# define cpu_has_mmips (cpu_data[0].options & MIPS_CPU_MICROMIPS)
114# else
115# define cpu_has_mmips 0
116# endif
103#endif 117#endif
104#ifndef cpu_has_vtag_icache 118#ifndef cpu_has_vtag_icache
105#define cpu_has_vtag_icache (cpu_data[0].icache.flags & MIPS_CACHE_VTAG) 119#define cpu_has_vtag_icache (cpu_data[0].icache.flags & MIPS_CACHE_VTAG)
@@ -111,7 +125,7 @@
111#define cpu_has_ic_fills_f_dc (cpu_data[0].icache.flags & MIPS_CACHE_IC_F_DC) 125#define cpu_has_ic_fills_f_dc (cpu_data[0].icache.flags & MIPS_CACHE_IC_F_DC)
112#endif 126#endif
113#ifndef cpu_has_pindexed_dcache 127#ifndef cpu_has_pindexed_dcache
114#define cpu_has_pindexed_dcache (cpu_data[0].dcache.flags & MIPS_CACHE_PINDEX) 128#define cpu_has_pindexed_dcache (cpu_data[0].dcache.flags & MIPS_CACHE_PINDEX)
115#endif 129#endif
116#ifndef cpu_has_local_ebase 130#ifndef cpu_has_local_ebase
117#define cpu_has_local_ebase 1 131#define cpu_has_local_ebase 1
@@ -136,7 +150,6 @@
136#endif 150#endif
137#endif 151#endif
138 152
139# define cpu_has_mips_1 (cpu_data[0].isa_level & MIPS_CPU_ISA_I)
140#ifndef cpu_has_mips_2 153#ifndef cpu_has_mips_2
141# define cpu_has_mips_2 (cpu_data[0].isa_level & MIPS_CPU_ISA_II) 154# define cpu_has_mips_2 (cpu_data[0].isa_level & MIPS_CPU_ISA_II)
142#endif 155#endif
@@ -149,18 +162,18 @@
149#ifndef cpu_has_mips_5 162#ifndef cpu_has_mips_5
150# define cpu_has_mips_5 (cpu_data[0].isa_level & MIPS_CPU_ISA_V) 163# define cpu_has_mips_5 (cpu_data[0].isa_level & MIPS_CPU_ISA_V)
151#endif 164#endif
152# ifndef cpu_has_mips32r1 165#ifndef cpu_has_mips32r1
153# define cpu_has_mips32r1 (cpu_data[0].isa_level & MIPS_CPU_ISA_M32R1) 166# define cpu_has_mips32r1 (cpu_data[0].isa_level & MIPS_CPU_ISA_M32R1)
154# endif 167#endif
155# ifndef cpu_has_mips32r2 168#ifndef cpu_has_mips32r2
156# define cpu_has_mips32r2 (cpu_data[0].isa_level & MIPS_CPU_ISA_M32R2) 169# define cpu_has_mips32r2 (cpu_data[0].isa_level & MIPS_CPU_ISA_M32R2)
157# endif 170#endif
158# ifndef cpu_has_mips64r1 171#ifndef cpu_has_mips64r1
159# define cpu_has_mips64r1 (cpu_data[0].isa_level & MIPS_CPU_ISA_M64R1) 172# define cpu_has_mips64r1 (cpu_data[0].isa_level & MIPS_CPU_ISA_M64R1)
160# endif 173#endif
161# ifndef cpu_has_mips64r2 174#ifndef cpu_has_mips64r2
162# define cpu_has_mips64r2 (cpu_data[0].isa_level & MIPS_CPU_ISA_M64R2) 175# define cpu_has_mips64r2 (cpu_data[0].isa_level & MIPS_CPU_ISA_M64R2)
163# endif 176#endif
164 177
165/* 178/*
166 * Shortcuts ... 179 * Shortcuts ...
@@ -182,9 +195,9 @@
182 * has CLO and CLZ but not DCLO nor DCLZ. For 64-bit kernels 195 * has CLO and CLZ but not DCLO nor DCLZ. For 64-bit kernels
183 * cpu_has_clo_clz also indicates the availability of DCLO and DCLZ. 196 * cpu_has_clo_clz also indicates the availability of DCLO and DCLZ.
184 */ 197 */
185# ifndef cpu_has_clo_clz 198#ifndef cpu_has_clo_clz
186# define cpu_has_clo_clz cpu_has_mips_r 199#define cpu_has_clo_clz cpu_has_mips_r
187# endif 200#endif
188 201
189#ifndef cpu_has_dsp 202#ifndef cpu_has_dsp
190#define cpu_has_dsp (cpu_data[0].ases & MIPS_ASE_DSP) 203#define cpu_has_dsp (cpu_data[0].ases & MIPS_ASE_DSP)
@@ -210,7 +223,7 @@
210# define cpu_has_64bits (cpu_data[0].isa_level & MIPS_CPU_ISA_64BIT) 223# define cpu_has_64bits (cpu_data[0].isa_level & MIPS_CPU_ISA_64BIT)
211# endif 224# endif
212# ifndef cpu_has_64bit_zero_reg 225# ifndef cpu_has_64bit_zero_reg
213# define cpu_has_64bit_zero_reg (cpu_data[0].isa_level & MIPS_CPU_ISA_64BIT) 226# define cpu_has_64bit_zero_reg (cpu_data[0].isa_level & MIPS_CPU_ISA_64BIT)
214# endif 227# endif
215# ifndef cpu_has_64bit_gp_regs 228# ifndef cpu_has_64bit_gp_regs
216# define cpu_has_64bit_gp_regs 0 229# define cpu_has_64bit_gp_regs 0
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h
index dd86ab205483..632bbe5a79ea 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -282,18 +282,17 @@ enum cpu_type_enum {
282 * ISA Level encodings 282 * ISA Level encodings
283 * 283 *
284 */ 284 */
285#define MIPS_CPU_ISA_I 0x00000001 285#define MIPS_CPU_ISA_II 0x00000001
286#define MIPS_CPU_ISA_II 0x00000002 286#define MIPS_CPU_ISA_III 0x00000002
287#define MIPS_CPU_ISA_III 0x00000004 287#define MIPS_CPU_ISA_IV 0x00000004
288#define MIPS_CPU_ISA_IV 0x00000008 288#define MIPS_CPU_ISA_V 0x00000008
289#define MIPS_CPU_ISA_V 0x00000010 289#define MIPS_CPU_ISA_M32R1 0x00000010
290#define MIPS_CPU_ISA_M32R1 0x00000020 290#define MIPS_CPU_ISA_M32R2 0x00000020
291#define MIPS_CPU_ISA_M32R2 0x00000040 291#define MIPS_CPU_ISA_M64R1 0x00000040
292#define MIPS_CPU_ISA_M64R1 0x00000080 292#define MIPS_CPU_ISA_M64R2 0x00000080
293#define MIPS_CPU_ISA_M64R2 0x00000100 293
294 294#define MIPS_CPU_ISA_32BIT (MIPS_CPU_ISA_II | MIPS_CPU_ISA_M32R1 | \
295#define MIPS_CPU_ISA_32BIT (MIPS_CPU_ISA_I | MIPS_CPU_ISA_II | \ 295 MIPS_CPU_ISA_M32R2)
296 MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2)
297#define MIPS_CPU_ISA_64BIT (MIPS_CPU_ISA_III | MIPS_CPU_ISA_IV | \ 296#define MIPS_CPU_ISA_64BIT (MIPS_CPU_ISA_III | MIPS_CPU_ISA_IV | \
298 MIPS_CPU_ISA_V | MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2) 297 MIPS_CPU_ISA_V | MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)
299 298
diff --git a/arch/mips/include/asm/fw/cfe/cfe_api.h b/arch/mips/include/asm/fw/cfe/cfe_api.h
index 17347551a1b2..a0ea69e91e2e 100644
--- a/arch/mips/include/asm/fw/cfe/cfe_api.h
+++ b/arch/mips/include/asm/fw/cfe/cfe_api.h
@@ -115,8 +115,8 @@ int cfe_read(int handle, unsigned char *buffer, int length);
115int cfe_readblk(int handle, int64_t offset, unsigned char *buffer, 115int cfe_readblk(int handle, int64_t offset, unsigned char *buffer,
116 int length); 116 int length);
117int cfe_setenv(char *name, char *val); 117int cfe_setenv(char *name, char *val);
118int cfe_write(int handle, unsigned char *buffer, int length); 118int cfe_write(int handle, const char *buffer, int length);
119int cfe_writeblk(int handle, int64_t offset, unsigned char *buffer, 119int cfe_writeblk(int handle, int64_t offset, const char *buffer,
120 int length); 120 int length);
121 121
122#endif /* CFE_API_H */ 122#endif /* CFE_API_H */
diff --git a/arch/mips/include/asm/gic.h b/arch/mips/include/asm/gic.h
index 7153b32de18e..b2e3e93dd7d8 100644
--- a/arch/mips/include/asm/gic.h
+++ b/arch/mips/include/asm/gic.h
@@ -347,7 +347,7 @@ struct gic_shared_intr_map {
347#define GIC_CPU_INT2 2 /* . */ 347#define GIC_CPU_INT2 2 /* . */
348#define GIC_CPU_INT3 3 /* . */ 348#define GIC_CPU_INT3 3 /* . */
349#define GIC_CPU_INT4 4 /* . */ 349#define GIC_CPU_INT4 4 /* . */
350#define GIC_CPU_INT5 5 /* Core Interrupt 5 */ 350#define GIC_CPU_INT5 5 /* Core Interrupt 7 */
351 351
352/* Local GIC interrupts. */ 352/* Local GIC interrupts. */
353#define GIC_INT_TMR (GIC_CPU_INT5) 353#define GIC_INT_TMR (GIC_CPU_INT5)
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index b7e59853fd33..3321dd5a8872 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -170,6 +170,11 @@ static inline void * isa_bus_to_virt(unsigned long address)
170extern void __iomem * __ioremap(phys_t offset, phys_t size, unsigned long flags); 170extern void __iomem * __ioremap(phys_t offset, phys_t size, unsigned long flags);
171extern void __iounmap(const volatile void __iomem *addr); 171extern void __iounmap(const volatile void __iomem *addr);
172 172
173#ifndef CONFIG_PCI
174struct pci_dev;
175static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) {}
176#endif
177
173static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size, 178static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size,
174 unsigned long flags) 179 unsigned long flags)
175{ 180{
@@ -449,6 +454,11 @@ __BUILDIO(q, u64)
449#define readl_relaxed readl 454#define readl_relaxed readl
450#define readq_relaxed readq 455#define readq_relaxed readq
451 456
457#define writeb_relaxed writeb
458#define writew_relaxed writew
459#define writel_relaxed writel
460#define writeq_relaxed writeq
461
452#define readb_be(addr) \ 462#define readb_be(addr) \
453 __raw_readb((__force unsigned *)(addr)) 463 __raw_readb((__force unsigned *)(addr))
454#define readw_be(addr) \ 464#define readw_be(addr) \
diff --git a/arch/mips/include/asm/kspd.h b/arch/mips/include/asm/kspd.h
deleted file mode 100644
index ec6832950ace..000000000000
--- a/arch/mips/include/asm/kspd.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
3 *
4 * This program is free software; you can distribute it and/or modify it
5 * under the terms of the GNU General Public License (Version 2) as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
16 *
17 */
18
19#ifndef _ASM_KSPD_H
20#define _ASM_KSPD_H
21
22struct kspd_notifications {
23 void (*kspd_sp_exit)(int sp_id);
24
25 struct list_head list;
26};
27
28static inline void kspd_notify(struct kspd_notifications *notify)
29{
30}
31
32#endif
diff --git a/arch/mips/include/asm/mach-ar7/spaces.h b/arch/mips/include/asm/mach-ar7/spaces.h
index ac28f273449c..660ab64c0fc9 100644
--- a/arch/mips/include/asm/mach-ar7/spaces.h
+++ b/arch/mips/include/asm/mach-ar7/spaces.h
@@ -14,8 +14,11 @@
14 * This handles the memory map. 14 * This handles the memory map.
15 * We handle pages at KSEG0 for kernels with 32 bit address space. 15 * We handle pages at KSEG0 for kernels with 32 bit address space.
16 */ 16 */
17#define PAGE_OFFSET 0x94000000UL 17#define PAGE_OFFSET _AC(0x94000000, UL)
18#define PHYS_OFFSET 0x14000000UL 18#define PHYS_OFFSET _AC(0x14000000, UL)
19
20#define UNCAC_BASE _AC(0xb4000000, UL) /* 0xa0000000 + PHYS_OFFSET */
21#define IO_BASE UNCAC_BASE
19 22
20#include <asm/mach-generic/spaces.h> 23#include <asm/mach-generic/spaces.h>
21 24
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
index 336228990808..19f9134bfe2f 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
@@ -9,6 +9,7 @@
9 * compile time if only one CPU support is enabled (idea stolen from 9 * compile time if only one CPU support is enabled (idea stolen from
10 * arm mach-types) 10 * arm mach-types)
11 */ 11 */
12#define BCM3368_CPU_ID 0x3368
12#define BCM6328_CPU_ID 0x6328 13#define BCM6328_CPU_ID 0x6328
13#define BCM6338_CPU_ID 0x6338 14#define BCM6338_CPU_ID 0x6338
14#define BCM6345_CPU_ID 0x6345 15#define BCM6345_CPU_ID 0x6345
@@ -22,6 +23,19 @@ u16 __bcm63xx_get_cpu_id(void);
22u8 bcm63xx_get_cpu_rev(void); 23u8 bcm63xx_get_cpu_rev(void);
23unsigned int bcm63xx_get_cpu_freq(void); 24unsigned int bcm63xx_get_cpu_freq(void);
24 25
26#ifdef CONFIG_BCM63XX_CPU_3368
27# ifdef bcm63xx_get_cpu_id
28# undef bcm63xx_get_cpu_id
29# define bcm63xx_get_cpu_id() __bcm63xx_get_cpu_id()
30# define BCMCPU_RUNTIME_DETECT
31# else
32# define bcm63xx_get_cpu_id() BCM3368_CPU_ID
33# endif
34# define BCMCPU_IS_3368() (bcm63xx_get_cpu_id() == BCM3368_CPU_ID)
35#else
36# define BCMCPU_IS_3368() (0)
37#endif
38
25#ifdef CONFIG_BCM63XX_CPU_6328 39#ifdef CONFIG_BCM63XX_CPU_6328
26# ifdef bcm63xx_get_cpu_id 40# ifdef bcm63xx_get_cpu_id
27# undef bcm63xx_get_cpu_id 41# undef bcm63xx_get_cpu_id
@@ -173,7 +187,10 @@ enum bcm63xx_regs_set {
173#define BCM_6358_RSET_SPI_SIZE 1804 187#define BCM_6358_RSET_SPI_SIZE 1804
174#define BCM_6368_RSET_SPI_SIZE 1804 188#define BCM_6368_RSET_SPI_SIZE 1804
175#define RSET_ENET_SIZE 2048 189#define RSET_ENET_SIZE 2048
176#define RSET_ENETDMA_SIZE 2048 190#define RSET_ENETDMA_SIZE 256
191#define RSET_6345_ENETDMA_SIZE 64
192#define RSET_ENETDMAC_SIZE(chans) (16 * (chans))
193#define RSET_ENETDMAS_SIZE(chans) (16 * (chans))
177#define RSET_ENETSW_SIZE 65536 194#define RSET_ENETSW_SIZE 65536
178#define RSET_UART_SIZE 24 195#define RSET_UART_SIZE 24
179#define RSET_UDC_SIZE 256 196#define RSET_UDC_SIZE 256
@@ -191,6 +208,53 @@ enum bcm63xx_regs_set {
191#define RSET_RNG_SIZE 20 208#define RSET_RNG_SIZE 20
192 209
193/* 210/*
211 * 3368 register sets base address
212 */
213#define BCM_3368_DSL_LMEM_BASE (0xdeadbeef)
214#define BCM_3368_PERF_BASE (0xfff8c000)
215#define BCM_3368_TIMER_BASE (0xfff8c040)
216#define BCM_3368_WDT_BASE (0xfff8c080)
217#define BCM_3368_UART0_BASE (0xfff8c100)
218#define BCM_3368_UART1_BASE (0xfff8c120)
219#define BCM_3368_GPIO_BASE (0xfff8c080)
220#define BCM_3368_SPI_BASE (0xfff8c800)
221#define BCM_3368_HSSPI_BASE (0xdeadbeef)
222#define BCM_3368_UDC0_BASE (0xdeadbeef)
223#define BCM_3368_USBDMA_BASE (0xdeadbeef)
224#define BCM_3368_OHCI0_BASE (0xdeadbeef)
225#define BCM_3368_OHCI_PRIV_BASE (0xdeadbeef)
226#define BCM_3368_USBH_PRIV_BASE (0xdeadbeef)
227#define BCM_3368_USBD_BASE (0xdeadbeef)
228#define BCM_3368_MPI_BASE (0xfff80000)
229#define BCM_3368_PCMCIA_BASE (0xfff80054)
230#define BCM_3368_PCIE_BASE (0xdeadbeef)
231#define BCM_3368_SDRAM_REGS_BASE (0xdeadbeef)
232#define BCM_3368_DSL_BASE (0xdeadbeef)
233#define BCM_3368_UBUS_BASE (0xdeadbeef)
234#define BCM_3368_ENET0_BASE (0xfff98000)
235#define BCM_3368_ENET1_BASE (0xfff98800)
236#define BCM_3368_ENETDMA_BASE (0xfff99800)
237#define BCM_3368_ENETDMAC_BASE (0xfff99900)
238#define BCM_3368_ENETDMAS_BASE (0xfff99a00)
239#define BCM_3368_ENETSW_BASE (0xdeadbeef)
240#define BCM_3368_EHCI0_BASE (0xdeadbeef)
241#define BCM_3368_SDRAM_BASE (0xdeadbeef)
242#define BCM_3368_MEMC_BASE (0xfff84000)
243#define BCM_3368_DDR_BASE (0xdeadbeef)
244#define BCM_3368_M2M_BASE (0xdeadbeef)
245#define BCM_3368_ATM_BASE (0xdeadbeef)
246#define BCM_3368_XTM_BASE (0xdeadbeef)
247#define BCM_3368_XTMDMA_BASE (0xdeadbeef)
248#define BCM_3368_XTMDMAC_BASE (0xdeadbeef)
249#define BCM_3368_XTMDMAS_BASE (0xdeadbeef)
250#define BCM_3368_PCM_BASE (0xfff9c200)
251#define BCM_3368_PCMDMA_BASE (0xdeadbeef)
252#define BCM_3368_PCMDMAC_BASE (0xdeadbeef)
253#define BCM_3368_PCMDMAS_BASE (0xdeadbeef)
254#define BCM_3368_RNG_BASE (0xdeadbeef)
255#define BCM_3368_MISC_BASE (0xdeadbeef)
256
257/*
194 * 6328 register sets base address 258 * 6328 register sets base address
195 */ 259 */
196#define BCM_6328_DSL_LMEM_BASE (0xdeadbeef) 260#define BCM_6328_DSL_LMEM_BASE (0xdeadbeef)
@@ -235,6 +299,8 @@ enum bcm63xx_regs_set {
235#define BCM_6328_PCMDMAS_BASE (0xdeadbeef) 299#define BCM_6328_PCMDMAS_BASE (0xdeadbeef)
236#define BCM_6328_RNG_BASE (0xdeadbeef) 300#define BCM_6328_RNG_BASE (0xdeadbeef)
237#define BCM_6328_MISC_BASE (0xb0001800) 301#define BCM_6328_MISC_BASE (0xb0001800)
302#define BCM_6328_OTP_BASE (0xb0000600)
303
238/* 304/*
239 * 6338 register sets base address 305 * 6338 register sets base address
240 */ 306 */
@@ -298,7 +364,7 @@ enum bcm63xx_regs_set {
298#define BCM_6345_USBDMA_BASE (0xfffe2800) 364#define BCM_6345_USBDMA_BASE (0xfffe2800)
299#define BCM_6345_ENET0_BASE (0xfffe1800) 365#define BCM_6345_ENET0_BASE (0xfffe1800)
300#define BCM_6345_ENETDMA_BASE (0xfffe2800) 366#define BCM_6345_ENETDMA_BASE (0xfffe2800)
301#define BCM_6345_ENETDMAC_BASE (0xfffe2900) 367#define BCM_6345_ENETDMAC_BASE (0xfffe2840)
302#define BCM_6345_ENETDMAS_BASE (0xfffe2a00) 368#define BCM_6345_ENETDMAS_BASE (0xfffe2a00)
303#define BCM_6345_ENETSW_BASE (0xdeadbeef) 369#define BCM_6345_ENETSW_BASE (0xdeadbeef)
304#define BCM_6345_PCMCIA_BASE (0xfffe2028) 370#define BCM_6345_PCMCIA_BASE (0xfffe2028)
@@ -620,6 +686,9 @@ static inline unsigned long bcm63xx_regset_address(enum bcm63xx_regs_set set)
620#ifdef BCMCPU_RUNTIME_DETECT 686#ifdef BCMCPU_RUNTIME_DETECT
621 return bcm63xx_regs_base[set]; 687 return bcm63xx_regs_base[set];
622#else 688#else
689#ifdef CONFIG_BCM63XX_CPU_3368
690 __GEN_RSET(3368)
691#endif
623#ifdef CONFIG_BCM63XX_CPU_6328 692#ifdef CONFIG_BCM63XX_CPU_6328
624 __GEN_RSET(6328) 693 __GEN_RSET(6328)
625#endif 694#endif
@@ -687,6 +756,52 @@ enum bcm63xx_irq {
687}; 756};
688 757
689/* 758/*
759 * 3368 irqs
760 */
761#define BCM_3368_TIMER_IRQ (IRQ_INTERNAL_BASE + 0)
762#define BCM_3368_SPI_IRQ (IRQ_INTERNAL_BASE + 1)
763#define BCM_3368_UART0_IRQ (IRQ_INTERNAL_BASE + 2)
764#define BCM_3368_UART1_IRQ (IRQ_INTERNAL_BASE + 3)
765#define BCM_3368_DSL_IRQ 0
766#define BCM_3368_UDC0_IRQ 0
767#define BCM_3368_OHCI0_IRQ 0
768#define BCM_3368_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)
769#define BCM_3368_ENET1_IRQ (IRQ_INTERNAL_BASE + 6)
770#define BCM_3368_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9)
771#define BCM_3368_ENET0_RXDMA_IRQ (IRQ_INTERNAL_BASE + 15)
772#define BCM_3368_ENET0_TXDMA_IRQ (IRQ_INTERNAL_BASE + 16)
773#define BCM_3368_HSSPI_IRQ 0
774#define BCM_3368_EHCI0_IRQ 0
775#define BCM_3368_USBD_IRQ 0
776#define BCM_3368_USBD_RXDMA0_IRQ 0
777#define BCM_3368_USBD_TXDMA0_IRQ 0
778#define BCM_3368_USBD_RXDMA1_IRQ 0
779#define BCM_3368_USBD_TXDMA1_IRQ 0
780#define BCM_3368_USBD_RXDMA2_IRQ 0
781#define BCM_3368_USBD_TXDMA2_IRQ 0
782#define BCM_3368_ENET1_RXDMA_IRQ (IRQ_INTERNAL_BASE + 17)
783#define BCM_3368_ENET1_TXDMA_IRQ (IRQ_INTERNAL_BASE + 18)
784#define BCM_3368_PCI_IRQ (IRQ_INTERNAL_BASE + 31)
785#define BCM_3368_PCMCIA_IRQ 0
786#define BCM_3368_ATM_IRQ 0
787#define BCM_3368_ENETSW_RXDMA0_IRQ 0
788#define BCM_3368_ENETSW_RXDMA1_IRQ 0
789#define BCM_3368_ENETSW_RXDMA2_IRQ 0
790#define BCM_3368_ENETSW_RXDMA3_IRQ 0
791#define BCM_3368_ENETSW_TXDMA0_IRQ 0
792#define BCM_3368_ENETSW_TXDMA1_IRQ 0
793#define BCM_3368_ENETSW_TXDMA2_IRQ 0
794#define BCM_3368_ENETSW_TXDMA3_IRQ 0
795#define BCM_3368_XTM_IRQ 0
796#define BCM_3368_XTM_DMA0_IRQ 0
797
798#define BCM_3368_EXT_IRQ0 (IRQ_INTERNAL_BASE + 25)
799#define BCM_3368_EXT_IRQ1 (IRQ_INTERNAL_BASE + 26)
800#define BCM_3368_EXT_IRQ2 (IRQ_INTERNAL_BASE + 27)
801#define BCM_3368_EXT_IRQ3 (IRQ_INTERNAL_BASE + 28)
802
803
804/*
690 * 6328 irqs 805 * 6328 irqs
691 */ 806 */
692#define BCM_6328_HIGH_IRQ_BASE (IRQ_INTERNAL_BASE + 32) 807#define BCM_6328_HIGH_IRQ_BASE (IRQ_INTERNAL_BASE + 32)
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
index d53f611184b9..753953e86242 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
@@ -4,6 +4,8 @@
4#include <linux/if_ether.h> 4#include <linux/if_ether.h>
5#include <linux/init.h> 5#include <linux/init.h>
6 6
7#include <bcm63xx_regs.h>
8
7/* 9/*
8 * on board ethernet platform data 10 * on board ethernet platform data
9 */ 11 */
@@ -37,9 +39,129 @@ struct bcm63xx_enet_platform_data {
37 int phy_id, int reg), 39 int phy_id, int reg),
38 void (*mii_write)(struct net_device *dev, 40 void (*mii_write)(struct net_device *dev,
39 int phy_id, int reg, int val)); 41 int phy_id, int reg, int val));
42
43 /* DMA channel enable mask */
44 u32 dma_chan_en_mask;
45
46 /* DMA channel interrupt mask */
47 u32 dma_chan_int_mask;
48
49 /* DMA engine has internal SRAM */
50 bool dma_has_sram;
51
52 /* DMA channel register width */
53 unsigned int dma_chan_width;
54
55 /* DMA descriptor shift */
56 unsigned int dma_desc_shift;
57};
58
59/*
60 * on board ethernet switch platform data
61 */
62#define ENETSW_MAX_PORT 8
63#define ENETSW_PORTS_6328 5 /* 4 FE PHY + 1 RGMII */
64#define ENETSW_PORTS_6368 6 /* 4 FE PHY + 2 RGMII */
65
66#define ENETSW_RGMII_PORT0 4
67
68struct bcm63xx_enetsw_port {
69 int used;
70 int phy_id;
71
72 int bypass_link;
73 int force_speed;
74 int force_duplex_full;
75
76 const char *name;
77};
78
79struct bcm63xx_enetsw_platform_data {
80 char mac_addr[ETH_ALEN];
81 int num_ports;
82 struct bcm63xx_enetsw_port used_ports[ENETSW_MAX_PORT];
83
84 /* DMA channel enable mask */
85 u32 dma_chan_en_mask;
86
87 /* DMA channel interrupt mask */
88 u32 dma_chan_int_mask;
89
90 /* DMA channel register width */
91 unsigned int dma_chan_width;
92
93 /* DMA engine has internal SRAM */
94 bool dma_has_sram;
40}; 95};
41 96
42int __init bcm63xx_enet_register(int unit, 97int __init bcm63xx_enet_register(int unit,
43 const struct bcm63xx_enet_platform_data *pd); 98 const struct bcm63xx_enet_platform_data *pd);
44 99
100int bcm63xx_enetsw_register(const struct bcm63xx_enetsw_platform_data *pd);
101
102enum bcm63xx_regs_enetdmac {
103 ENETDMAC_CHANCFG,
104 ENETDMAC_IR,
105 ENETDMAC_IRMASK,
106 ENETDMAC_MAXBURST,
107 ENETDMAC_BUFALLOC,
108 ENETDMAC_RSTART,
109 ENETDMAC_FC,
110 ENETDMAC_LEN,
111};
112
113static inline unsigned long bcm63xx_enetdmacreg(enum bcm63xx_regs_enetdmac reg)
114{
115#ifdef BCMCPU_RUNTIME_DETECT
116 extern const unsigned long *bcm63xx_regs_enetdmac;
117
118 return bcm63xx_regs_enetdmac[reg];
119#else
120#ifdef CONFIG_BCM63XX_CPU_6345
121 switch (reg) {
122 case ENETDMAC_CHANCFG:
123 return ENETDMA_6345_CHANCFG_REG;
124 case ENETDMAC_IR:
125 return ENETDMA_6345_IR_REG;
126 case ENETDMAC_IRMASK:
127 return ENETDMA_6345_IRMASK_REG;
128 case ENETDMAC_MAXBURST:
129 return ENETDMA_6345_MAXBURST_REG;
130 case ENETDMAC_BUFALLOC:
131 return ENETDMA_6345_BUFALLOC_REG;
132 case ENETDMAC_RSTART:
133 return ENETDMA_6345_RSTART_REG;
134 case ENETDMAC_FC:
135 return ENETDMA_6345_FC_REG;
136 case ENETDMAC_LEN:
137 return ENETDMA_6345_LEN_REG;
138 }
139#endif
140#if defined(CONFIG_BCM63XX_CPU_6328) || \
141 defined(CONFIG_BCM63XX_CPU_6338) || \
142 defined(CONFIG_BCM63XX_CPU_6348) || \
143 defined(CONFIG_BCM63XX_CPU_6358) || \
144 defined(CONFIG_BCM63XX_CPU_6362) || \
145 defined(CONFIG_BCM63XX_CPU_6368)
146 switch (reg) {
147 case ENETDMAC_CHANCFG:
148 return ENETDMAC_CHANCFG_REG;
149 case ENETDMAC_IR:
150 return ENETDMAC_IR_REG;
151 case ENETDMAC_IRMASK:
152 return ENETDMAC_IRMASK_REG;
153 case ENETDMAC_MAXBURST:
154 return ENETDMAC_MAXBURST_REG;
155 case ENETDMAC_BUFALLOC:
156 case ENETDMAC_RSTART:
157 case ENETDMAC_FC:
158 case ENETDMAC_LEN:
159 return 0;
160 }
161#endif
162#endif
163 return 0;
164}
165
166
45#endif /* ! BCM63XX_DEV_ENET_H_ */ 167#endif /* ! BCM63XX_DEV_ENET_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h
index 35baa1a60a64..565ff36a1119 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h
@@ -11,6 +11,7 @@ static inline unsigned long bcm63xx_gpio_count(void)
11 switch (bcm63xx_get_cpu_id()) { 11 switch (bcm63xx_get_cpu_id()) {
12 case BCM6328_CPU_ID: 12 case BCM6328_CPU_ID:
13 return 32; 13 return 32;
14 case BCM3368_CPU_ID:
14 case BCM6358_CPU_ID: 15 case BCM6358_CPU_ID:
15 return 40; 16 return 40;
16 case BCM6338_CPU_ID: 17 case BCM6338_CPU_ID:
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
index 3203fe49b34d..9875db31d883 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
@@ -15,6 +15,39 @@
15/* Clock Control register */ 15/* Clock Control register */
16#define PERF_CKCTL_REG 0x4 16#define PERF_CKCTL_REG 0x4
17 17
18#define CKCTL_3368_MAC_EN (1 << 3)
19#define CKCTL_3368_TC_EN (1 << 5)
20#define CKCTL_3368_US_TOP_EN (1 << 6)
21#define CKCTL_3368_DS_TOP_EN (1 << 7)
22#define CKCTL_3368_APM_EN (1 << 8)
23#define CKCTL_3368_SPI_EN (1 << 9)
24#define CKCTL_3368_USBS_EN (1 << 10)
25#define CKCTL_3368_BMU_EN (1 << 11)
26#define CKCTL_3368_PCM_EN (1 << 12)
27#define CKCTL_3368_NTP_EN (1 << 13)
28#define CKCTL_3368_ACP_B_EN (1 << 14)
29#define CKCTL_3368_ACP_A_EN (1 << 15)
30#define CKCTL_3368_EMUSB_EN (1 << 17)
31#define CKCTL_3368_ENET0_EN (1 << 18)
32#define CKCTL_3368_ENET1_EN (1 << 19)
33#define CKCTL_3368_USBU_EN (1 << 20)
34#define CKCTL_3368_EPHY_EN (1 << 21)
35
36#define CKCTL_3368_ALL_SAFE_EN (CKCTL_3368_MAC_EN | \
37 CKCTL_3368_TC_EN | \
38 CKCTL_3368_US_TOP_EN | \
39 CKCTL_3368_DS_TOP_EN | \
40 CKCTL_3368_APM_EN | \
41 CKCTL_3368_SPI_EN | \
42 CKCTL_3368_USBS_EN | \
43 CKCTL_3368_BMU_EN | \
44 CKCTL_3368_PCM_EN | \
45 CKCTL_3368_NTP_EN | \
46 CKCTL_3368_ACP_B_EN | \
47 CKCTL_3368_ACP_A_EN | \
48 CKCTL_3368_EMUSB_EN | \
49 CKCTL_3368_USBU_EN)
50
18#define CKCTL_6328_PHYMIPS_EN (1 << 0) 51#define CKCTL_6328_PHYMIPS_EN (1 << 0)
19#define CKCTL_6328_ADSL_QPROC_EN (1 << 1) 52#define CKCTL_6328_ADSL_QPROC_EN (1 << 1)
20#define CKCTL_6328_ADSL_AFE_EN (1 << 2) 53#define CKCTL_6328_ADSL_AFE_EN (1 << 2)
@@ -181,6 +214,7 @@
181#define SYS_PLL_SOFT_RESET 0x1 214#define SYS_PLL_SOFT_RESET 0x1
182 215
183/* Interrupt Mask register */ 216/* Interrupt Mask register */
217#define PERF_IRQMASK_3368_REG 0xc
184#define PERF_IRQMASK_6328_REG 0x20 218#define PERF_IRQMASK_6328_REG 0x20
185#define PERF_IRQMASK_6338_REG 0xc 219#define PERF_IRQMASK_6338_REG 0xc
186#define PERF_IRQMASK_6345_REG 0xc 220#define PERF_IRQMASK_6345_REG 0xc
@@ -190,6 +224,7 @@
190#define PERF_IRQMASK_6368_REG 0x20 224#define PERF_IRQMASK_6368_REG 0x20
191 225
192/* Interrupt Status register */ 226/* Interrupt Status register */
227#define PERF_IRQSTAT_3368_REG 0x10
193#define PERF_IRQSTAT_6328_REG 0x28 228#define PERF_IRQSTAT_6328_REG 0x28
194#define PERF_IRQSTAT_6338_REG 0x10 229#define PERF_IRQSTAT_6338_REG 0x10
195#define PERF_IRQSTAT_6345_REG 0x10 230#define PERF_IRQSTAT_6345_REG 0x10
@@ -199,6 +234,7 @@
199#define PERF_IRQSTAT_6368_REG 0x28 234#define PERF_IRQSTAT_6368_REG 0x28
200 235
201/* External Interrupt Configuration register */ 236/* External Interrupt Configuration register */
237#define PERF_EXTIRQ_CFG_REG_3368 0x14
202#define PERF_EXTIRQ_CFG_REG_6328 0x18 238#define PERF_EXTIRQ_CFG_REG_6328 0x18
203#define PERF_EXTIRQ_CFG_REG_6338 0x14 239#define PERF_EXTIRQ_CFG_REG_6338 0x14
204#define PERF_EXTIRQ_CFG_REG_6345 0x14 240#define PERF_EXTIRQ_CFG_REG_6345 0x14
@@ -236,6 +272,13 @@
236#define PERF_SOFTRESET_6362_REG 0x10 272#define PERF_SOFTRESET_6362_REG 0x10
237#define PERF_SOFTRESET_6368_REG 0x10 273#define PERF_SOFTRESET_6368_REG 0x10
238 274
275#define SOFTRESET_3368_SPI_MASK (1 << 0)
276#define SOFTRESET_3368_ENET_MASK (1 << 2)
277#define SOFTRESET_3368_MPI_MASK (1 << 3)
278#define SOFTRESET_3368_EPHY_MASK (1 << 6)
279#define SOFTRESET_3368_USBS_MASK (1 << 11)
280#define SOFTRESET_3368_PCM_MASK (1 << 13)
281
239#define SOFTRESET_6328_SPI_MASK (1 << 0) 282#define SOFTRESET_6328_SPI_MASK (1 << 0)
240#define SOFTRESET_6328_EPHY_MASK (1 << 1) 283#define SOFTRESET_6328_EPHY_MASK (1 << 1)
241#define SOFTRESET_6328_SAR_MASK (1 << 2) 284#define SOFTRESET_6328_SAR_MASK (1 << 2)
@@ -727,6 +770,8 @@
727/************************************************************************* 770/*************************************************************************
728 * _REG relative to RSET_ENETDMA 771 * _REG relative to RSET_ENETDMA
729 *************************************************************************/ 772 *************************************************************************/
773#define ENETDMA_CHAN_WIDTH 0x10
774#define ENETDMA_6345_CHAN_WIDTH 0x40
730 775
731/* Controller Configuration Register */ 776/* Controller Configuration Register */
732#define ENETDMA_CFG_REG (0x0) 777#define ENETDMA_CFG_REG (0x0)
@@ -782,31 +827,56 @@
782/* State Ram Word 4 */ 827/* State Ram Word 4 */
783#define ENETDMA_SRAM4_REG(x) (0x20c + (x) * 0x10) 828#define ENETDMA_SRAM4_REG(x) (0x20c + (x) * 0x10)
784 829
830/* Broadcom 6345 ENET DMA definitions */
831#define ENETDMA_6345_CHANCFG_REG (0x00)
832
833#define ENETDMA_6345_MAXBURST_REG (0x40)
834
835#define ENETDMA_6345_RSTART_REG (0x08)
836
837#define ENETDMA_6345_LEN_REG (0x0C)
838
839#define ENETDMA_6345_IR_REG (0x14)
840
841#define ENETDMA_6345_IRMASK_REG (0x18)
842
843#define ENETDMA_6345_FC_REG (0x1C)
844
845#define ENETDMA_6345_BUFALLOC_REG (0x20)
846
847/* Shift down for EOP, SOP and WRAP bits */
848#define ENETDMA_6345_DESC_SHIFT (3)
785 849
786/************************************************************************* 850/*************************************************************************
787 * _REG relative to RSET_ENETDMAC 851 * _REG relative to RSET_ENETDMAC
788 *************************************************************************/ 852 *************************************************************************/
789 853
790/* Channel Configuration register */ 854/* Channel Configuration register */
791#define ENETDMAC_CHANCFG_REG(x) ((x) * 0x10) 855#define ENETDMAC_CHANCFG_REG (0x0)
792#define ENETDMAC_CHANCFG_EN_SHIFT 0 856#define ENETDMAC_CHANCFG_EN_SHIFT 0
793#define ENETDMAC_CHANCFG_EN_MASK (1 << ENETDMAC_CHANCFG_EN_SHIFT) 857#define ENETDMAC_CHANCFG_EN_MASK (1 << ENETDMAC_CHANCFG_EN_SHIFT)
794#define ENETDMAC_CHANCFG_PKTHALT_SHIFT 1 858#define ENETDMAC_CHANCFG_PKTHALT_SHIFT 1
795#define ENETDMAC_CHANCFG_PKTHALT_MASK (1 << ENETDMAC_CHANCFG_PKTHALT_SHIFT) 859#define ENETDMAC_CHANCFG_PKTHALT_MASK (1 << ENETDMAC_CHANCFG_PKTHALT_SHIFT)
796#define ENETDMAC_CHANCFG_BUFHALT_SHIFT 2 860#define ENETDMAC_CHANCFG_BUFHALT_SHIFT 2
797#define ENETDMAC_CHANCFG_BUFHALT_MASK (1 << ENETDMAC_CHANCFG_BUFHALT_SHIFT) 861#define ENETDMAC_CHANCFG_BUFHALT_MASK (1 << ENETDMAC_CHANCFG_BUFHALT_SHIFT)
862#define ENETDMAC_CHANCFG_CHAINING_SHIFT 2
863#define ENETDMAC_CHANCFG_CHAINING_MASK (1 << ENETDMAC_CHANCFG_CHAINING_SHIFT)
864#define ENETDMAC_CHANCFG_WRAP_EN_SHIFT 3
865#define ENETDMAC_CHANCFG_WRAP_EN_MASK (1 << ENETDMAC_CHANCFG_WRAP_EN_SHIFT)
866#define ENETDMAC_CHANCFG_FLOWC_EN_SHIFT 4
867#define ENETDMAC_CHANCFG_FLOWC_EN_MASK (1 << ENETDMAC_CHANCFG_FLOWC_EN_SHIFT)
798 868
799/* Interrupt Control/Status register */ 869/* Interrupt Control/Status register */
800#define ENETDMAC_IR_REG(x) (0x4 + (x) * 0x10) 870#define ENETDMAC_IR_REG (0x4)
801#define ENETDMAC_IR_BUFDONE_MASK (1 << 0) 871#define ENETDMAC_IR_BUFDONE_MASK (1 << 0)
802#define ENETDMAC_IR_PKTDONE_MASK (1 << 1) 872#define ENETDMAC_IR_PKTDONE_MASK (1 << 1)
803#define ENETDMAC_IR_NOTOWNER_MASK (1 << 2) 873#define ENETDMAC_IR_NOTOWNER_MASK (1 << 2)
804 874
805/* Interrupt Mask register */ 875/* Interrupt Mask register */
806#define ENETDMAC_IRMASK_REG(x) (0x8 + (x) * 0x10) 876#define ENETDMAC_IRMASK_REG (0x8)
807 877
808/* Maximum Burst Length */ 878/* Maximum Burst Length */
809#define ENETDMAC_MAXBURST_REG(x) (0xc + (x) * 0x10) 879#define ENETDMAC_MAXBURST_REG (0xc)
810 880
811 881
812/************************************************************************* 882/*************************************************************************
@@ -814,26 +884,76 @@
814 *************************************************************************/ 884 *************************************************************************/
815 885
816/* Ring Start Address register */ 886/* Ring Start Address register */
817#define ENETDMAS_RSTART_REG(x) ((x) * 0x10) 887#define ENETDMAS_RSTART_REG (0x0)
818 888
819/* State Ram Word 2 */ 889/* State Ram Word 2 */
820#define ENETDMAS_SRAM2_REG(x) (0x4 + (x) * 0x10) 890#define ENETDMAS_SRAM2_REG (0x4)
821 891
822/* State Ram Word 3 */ 892/* State Ram Word 3 */
823#define ENETDMAS_SRAM3_REG(x) (0x8 + (x) * 0x10) 893#define ENETDMAS_SRAM3_REG (0x8)
824 894
825/* State Ram Word 4 */ 895/* State Ram Word 4 */
826#define ENETDMAS_SRAM4_REG(x) (0xc + (x) * 0x10) 896#define ENETDMAS_SRAM4_REG (0xc)
827 897
828 898
829/************************************************************************* 899/*************************************************************************
830 * _REG relative to RSET_ENETSW 900 * _REG relative to RSET_ENETSW
831 *************************************************************************/ 901 *************************************************************************/
832 902
903/* Port traffic control */
904#define ENETSW_PTCTRL_REG(x) (0x0 + (x))
905#define ENETSW_PTCTRL_RXDIS_MASK (1 << 0)
906#define ENETSW_PTCTRL_TXDIS_MASK (1 << 1)
907
908/* Switch mode register */
909#define ENETSW_SWMODE_REG (0xb)
910#define ENETSW_SWMODE_FWD_EN_MASK (1 << 1)
911
912/* IMP override Register */
913#define ENETSW_IMPOV_REG (0xe)
914#define ENETSW_IMPOV_FORCE_MASK (1 << 7)
915#define ENETSW_IMPOV_TXFLOW_MASK (1 << 5)
916#define ENETSW_IMPOV_RXFLOW_MASK (1 << 4)
917#define ENETSW_IMPOV_1000_MASK (1 << 3)
918#define ENETSW_IMPOV_100_MASK (1 << 2)
919#define ENETSW_IMPOV_FDX_MASK (1 << 1)
920#define ENETSW_IMPOV_LINKUP_MASK (1 << 0)
921
922/* Port override Register */
923#define ENETSW_PORTOV_REG(x) (0x58 + (x))
924#define ENETSW_PORTOV_ENABLE_MASK (1 << 6)
925#define ENETSW_PORTOV_TXFLOW_MASK (1 << 5)
926#define ENETSW_PORTOV_RXFLOW_MASK (1 << 4)
927#define ENETSW_PORTOV_1000_MASK (1 << 3)
928#define ENETSW_PORTOV_100_MASK (1 << 2)
929#define ENETSW_PORTOV_FDX_MASK (1 << 1)
930#define ENETSW_PORTOV_LINKUP_MASK (1 << 0)
931
932/* MDIO control register */
933#define ENETSW_MDIOC_REG (0xb0)
934#define ENETSW_MDIOC_EXT_MASK (1 << 16)
935#define ENETSW_MDIOC_REG_SHIFT 20
936#define ENETSW_MDIOC_PHYID_SHIFT 25
937#define ENETSW_MDIOC_RD_MASK (1 << 30)
938#define ENETSW_MDIOC_WR_MASK (1 << 31)
939
940/* MDIO data register */
941#define ENETSW_MDIOD_REG (0xb4)
942
943/* Global Management Configuration Register */
944#define ENETSW_GMCR_REG (0x200)
945#define ENETSW_GMCR_RST_MIB_MASK (1 << 0)
946
833/* MIB register */ 947/* MIB register */
834#define ENETSW_MIB_REG(x) (0x2800 + (x) * 4) 948#define ENETSW_MIB_REG(x) (0x2800 + (x) * 4)
835#define ENETSW_MIB_REG_COUNT 47 949#define ENETSW_MIB_REG_COUNT 47
836 950
951/* Jumbo control register port mask register */
952#define ENETSW_JMBCTL_PORT_REG (0x4004)
953
954/* Jumbo control mib good frame register */
955#define ENETSW_JMBCTL_MAXSIZE_REG (0x4008)
956
837 957
838/************************************************************************* 958/*************************************************************************
839 * _REG relative to RSET_OHCI_PRIV 959 * _REG relative to RSET_OHCI_PRIV
@@ -1293,7 +1413,7 @@
1293#define SPI_6348_RX_DATA 0x80 1413#define SPI_6348_RX_DATA 0x80
1294#define SPI_6348_RX_DATA_SIZE 0x3f 1414#define SPI_6348_RX_DATA_SIZE 0x3f
1295 1415
1296/* BCM 6358/6262/6368 SPI core */ 1416/* BCM 3368/6358/6262/6368 SPI core */
1297#define SPI_6358_MSG_CTL 0x00 /* 16-bits register */ 1417#define SPI_6358_MSG_CTL 0x00 /* 16-bits register */
1298#define SPI_6358_MSG_CTL_WIDTH 16 1418#define SPI_6358_MSG_CTL_WIDTH 16
1299#define SPI_6358_MSG_DATA 0x02 1419#define SPI_6358_MSG_DATA 0x02
@@ -1434,4 +1554,11 @@
1434 1554
1435#define PCIE_DEVICE_OFFSET 0x8000 1555#define PCIE_DEVICE_OFFSET 0x8000
1436 1556
1557/*************************************************************************
1558 * _REG relative to RSET_OTP
1559 *************************************************************************/
1560
1561#define OTP_USER_BITS_6328_REG(i) (0x20 + (i) * 4)
1562#define OTP_6328_REG3_TP1_DISABLED BIT(9)
1563
1437#endif /* BCM63XX_REGS_H_ */ 1564#endif /* BCM63XX_REGS_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
index 682bcf3b492a..b86a0efba665 100644
--- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
@@ -24,6 +24,7 @@ struct board_info {
24 /* enabled feature/device */ 24 /* enabled feature/device */
25 unsigned int has_enet0:1; 25 unsigned int has_enet0:1;
26 unsigned int has_enet1:1; 26 unsigned int has_enet1:1;
27 unsigned int has_enetsw:1;
27 unsigned int has_pci:1; 28 unsigned int has_pci:1;
28 unsigned int has_pccard:1; 29 unsigned int has_pccard:1;
29 unsigned int has_ohci0:1; 30 unsigned int has_ohci0:1;
@@ -36,6 +37,7 @@ struct board_info {
36 /* ethernet config */ 37 /* ethernet config */
37 struct bcm63xx_enet_platform_data enet0; 38 struct bcm63xx_enet_platform_data enet0;
38 struct bcm63xx_enet_platform_data enet1; 39 struct bcm63xx_enet_platform_data enet1;
40 struct bcm63xx_enetsw_platform_data enetsw;
39 41
40 /* USB config */ 42 /* USB config */
41 struct bcm63xx_usbd_platform_data usbd; 43 struct bcm63xx_usbd_platform_data usbd;
@@ -45,6 +47,12 @@ struct board_info {
45 47
46 /* GPIO LEDs */ 48 /* GPIO LEDs */
47 struct gpio_led leds[5]; 49 struct gpio_led leds[5];
50
51 /* External PHY reset GPIO */
52 unsigned int ephy_reset_gpio;
53
54 /* External PHY reset GPIO flags from gpio.h */
55 unsigned long ephy_reset_gpio_flags;
48}; 56};
49 57
50#endif /* ! BOARD_BCM963XX_H_ */ 58#endif /* ! BOARD_BCM963XX_H_ */
diff --git a/arch/mips/include/asm/mach-bcm63xx/ioremap.h b/arch/mips/include/asm/mach-bcm63xx/ioremap.h
index 94e3011ba7df..ff15e3b14e7a 100644
--- a/arch/mips/include/asm/mach-bcm63xx/ioremap.h
+++ b/arch/mips/include/asm/mach-bcm63xx/ioremap.h
@@ -11,6 +11,10 @@ static inline phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size)
11static inline int is_bcm63xx_internal_registers(phys_t offset) 11static inline int is_bcm63xx_internal_registers(phys_t offset)
12{ 12{
13 switch (bcm63xx_get_cpu_id()) { 13 switch (bcm63xx_get_cpu_id()) {
14 case BCM3368_CPU_ID:
15 if (offset >= 0xfff80000)
16 return 1;
17 break;
14 case BCM6338_CPU_ID: 18 case BCM6338_CPU_ID:
15 case BCM6345_CPU_ID: 19 case BCM6345_CPU_ID:
16 case BCM6348_CPU_ID: 20 case BCM6348_CPU_ID:
diff --git a/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h b/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
index be8fb4240cec..47fb247f9663 100644
--- a/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
+++ b/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
@@ -13,6 +13,8 @@
13#ifndef __ASM_MACH_CAVIUM_OCTEON_DMA_COHERENCE_H 13#ifndef __ASM_MACH_CAVIUM_OCTEON_DMA_COHERENCE_H
14#define __ASM_MACH_CAVIUM_OCTEON_DMA_COHERENCE_H 14#define __ASM_MACH_CAVIUM_OCTEON_DMA_COHERENCE_H
15 15
16#include <linux/bug.h>
17
16struct device; 18struct device;
17 19
18extern void octeon_pci_dma_init(void); 20extern void octeon_pci_dma_init(void);
@@ -21,18 +23,21 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
21 size_t size) 23 size_t size)
22{ 24{
23 BUG(); 25 BUG();
26 return 0;
24} 27}
25 28
26static inline dma_addr_t plat_map_dma_mem_page(struct device *dev, 29static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
27 struct page *page) 30 struct page *page)
28{ 31{
29 BUG(); 32 BUG();
33 return 0;
30} 34}
31 35
32static inline unsigned long plat_dma_addr_to_phys(struct device *dev, 36static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
33 dma_addr_t dma_addr) 37 dma_addr_t dma_addr)
34{ 38{
35 BUG(); 39 BUG();
40 return 0;
36} 41}
37 42
38static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr, 43static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr,
@@ -44,6 +49,7 @@ static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr,
44static inline int plat_dma_supported(struct device *dev, u64 mask) 49static inline int plat_dma_supported(struct device *dev, u64 mask)
45{ 50{
46 BUG(); 51 BUG();
52 return 0;
47} 53}
48 54
49static inline void plat_extra_sync_for_device(struct device *dev) 55static inline void plat_extra_sync_for_device(struct device *dev)
@@ -60,6 +66,7 @@ static inline int plat_dma_mapping_error(struct device *dev,
60 dma_addr_t dma_addr) 66 dma_addr_t dma_addr)
61{ 67{
62 BUG(); 68 BUG();
69 return 0;
63} 70}
64 71
65dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr); 72dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr);
diff --git a/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h b/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h
index 1e7dbb192657..1668ee57acb9 100644
--- a/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h
+++ b/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h
@@ -34,15 +34,10 @@
34 ori v0, CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE 34 ori v0, CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE
35 dmtc0 v0, CP0_CVMMEMCTL_REG # Write the cavium mem control register 35 dmtc0 v0, CP0_CVMMEMCTL_REG # Write the cavium mem control register
36 dmfc0 v0, CP0_CVMCTL_REG # Read the cavium control register 36 dmfc0 v0, CP0_CVMCTL_REG # Read the cavium control register
37#ifdef CONFIG_CAVIUM_OCTEON_HW_FIX_UNALIGNED
38 # Disable unaligned load/store support but leave HW fixup enabled 37 # Disable unaligned load/store support but leave HW fixup enabled
38 # Needed for octeon specific memcpy
39 or v0, v0, 0x5001 39 or v0, v0, 0x5001
40 xor v0, v0, 0x1001 40 xor v0, v0, 0x1001
41#else
42 # Disable unaligned load/store and HW fixup support
43 or v0, v0, 0x5001
44 xor v0, v0, 0x5001
45#endif
46 # Read the processor ID register 41 # Read the processor ID register
47 mfc0 v1, CP0_PRID_REG 42 mfc0 v1, CP0_PRID_REG
48 # Disable instruction prefetching (Octeon Pass1 errata) 43 # Disable instruction prefetching (Octeon Pass1 errata)
diff --git a/arch/mips/include/asm/mach-cavium-octeon/spaces.h b/arch/mips/include/asm/mach-cavium-octeon/spaces.h
new file mode 100644
index 000000000000..daa91accf5ab
--- /dev/null
+++ b/arch/mips/include/asm/mach-cavium-octeon/spaces.h
@@ -0,0 +1,24 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2012 Cavium, Inc.
7 */
8#ifndef _ASM_MACH_CAVIUM_OCTEON_SPACES_H
9#define _ASM_MACH_CAVIUM_OCTEON_SPACES_H
10
11#include <linux/const.h>
12
13#ifdef CONFIG_64BIT
14/* They are all the same and some OCTEON II cores cannot handle 0xa8.. */
15#define CAC_BASE _AC(0x8000000000000000, UL)
16#define UNCAC_BASE _AC(0x8000000000000000, UL)
17#define IO_BASE _AC(0x8000000000000000, UL)
18
19
20#endif /* CONFIG_64BIT */
21
22#include <asm/mach-generic/spaces.h>
23
24#endif /* _ASM_MACH_CAVIUM_OCTEON_SPACES_H */
diff --git a/arch/mips/include/asm/mach-generic/dma-coherence.h b/arch/mips/include/asm/mach-generic/dma-coherence.h
index fe23034aaf72..74cb99257d5b 100644
--- a/arch/mips/include/asm/mach-generic/dma-coherence.h
+++ b/arch/mips/include/asm/mach-generic/dma-coherence.h
@@ -66,4 +66,16 @@ static inline int plat_device_is_coherent(struct device *dev)
66#endif 66#endif
67} 67}
68 68
69#ifdef CONFIG_SWIOTLB
70static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
71{
72 return paddr;
73}
74
75static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)
76{
77 return daddr;
78}
79#endif
80
69#endif /* __ASM_MACH_GENERIC_DMA_COHERENCE_H */ 81#endif /* __ASM_MACH_GENERIC_DMA_COHERENCE_H */
diff --git a/arch/mips/include/asm/mach-generic/kernel-entry-init.h b/arch/mips/include/asm/mach-generic/kernel-entry-init.h
index 7e66505fa574..13b0751b010a 100644
--- a/arch/mips/include/asm/mach-generic/kernel-entry-init.h
+++ b/arch/mips/include/asm/mach-generic/kernel-entry-init.h
@@ -12,8 +12,8 @@
12/* Intentionally empty macro, used in head.S. Override in 12/* Intentionally empty macro, used in head.S. Override in
13 * arch/mips/mach-xxx/kernel-entry-init.h when necessary. 13 * arch/mips/mach-xxx/kernel-entry-init.h when necessary.
14 */ 14 */
15.macro kernel_entry_setup 15 .macro kernel_entry_setup
16.endm 16 .endm
17 17
18/* 18/*
19 * Do SMP slave processor setup necessary before we can savely execute C code. 19 * Do SMP slave processor setup necessary before we can savely execute C code.
diff --git a/arch/mips/include/asm/mach-ip27/kernel-entry-init.h b/arch/mips/include/asm/mach-ip27/kernel-entry-init.h
index a323efb720dc..b087cb83da3a 100644
--- a/arch/mips/include/asm/mach-ip27/kernel-entry-init.h
+++ b/arch/mips/include/asm/mach-ip27/kernel-entry-init.h
@@ -24,6 +24,53 @@
24 .endm 24 .endm
25 25
26/* 26/*
27 * TLB bits
28 */
29#define PAGE_GLOBAL (1 << 6)
30#define PAGE_VALID (1 << 7)
31#define PAGE_DIRTY (1 << 8)
32#define CACHE_CACHABLE_COW (5 << 9)
33
34 /*
35 * inputs are the text nasid in t1, data nasid in t2.
36 */
37 .macro MAPPED_KERNEL_SETUP_TLB
38#ifdef CONFIG_MAPPED_KERNEL
39 /*
40 * This needs to read the nasid - assume 0 for now.
41 * Drop in 0xffffffffc0000000 in tlbhi, 0+VG in tlblo_0,
42 * 0+DVG in tlblo_1.
43 */
44 dli t0, 0xffffffffc0000000
45 dmtc0 t0, CP0_ENTRYHI
46 li t0, 0x1c000 # Offset of text into node memory
47 dsll t1, NASID_SHFT # Shift text nasid into place
48 dsll t2, NASID_SHFT # Same for data nasid
49 or t1, t1, t0 # Physical load address of kernel text
50 or t2, t2, t0 # Physical load address of kernel data
51 dsrl t1, 12 # 4K pfn
52 dsrl t2, 12 # 4K pfn
53 dsll t1, 6 # Get pfn into place
54 dsll t2, 6 # Get pfn into place
55 li t0, ((PAGE_GLOBAL | PAGE_VALID | CACHE_CACHABLE_COW) >> 6)
56 or t0, t0, t1
57 mtc0 t0, CP0_ENTRYLO0 # physaddr, VG, cach exlwr
58 li t0, ((PAGE_GLOBAL | PAGE_VALID | PAGE_DIRTY | CACHE_CACHABLE_COW) >> 6)
59 or t0, t0, t2
60 mtc0 t0, CP0_ENTRYLO1 # physaddr, DVG, cach exlwr
61 li t0, 0x1ffe000 # MAPPED_KERN_TLBMASK, TLBPGMASK_16M
62 mtc0 t0, CP0_PAGEMASK
63 li t0, 0 # KMAP_INX
64 mtc0 t0, CP0_INDEX
65 li t0, 1
66 mtc0 t0, CP0_WIRED
67 tlbwi
68#else
69 mtc0 zero, CP0_WIRED
70#endif
71 .endm
72
73/*
27 * Intentionally empty macro, used in head.S. Override in 74 * Intentionally empty macro, used in head.S. Override in
28 * arch/mips/mach-xxx/kernel-entry-init.h when necessary. 75 * arch/mips/mach-xxx/kernel-entry-init.h when necessary.
29 */ 76 */
diff --git a/arch/mips/include/asm/mach-ip28/spaces.h b/arch/mips/include/asm/mach-ip28/spaces.h
index 5edf05d9dad8..5d6a76434d00 100644
--- a/arch/mips/include/asm/mach-ip28/spaces.h
+++ b/arch/mips/include/asm/mach-ip28/spaces.h
@@ -11,11 +11,14 @@
11#ifndef _ASM_MACH_IP28_SPACES_H 11#ifndef _ASM_MACH_IP28_SPACES_H
12#define _ASM_MACH_IP28_SPACES_H 12#define _ASM_MACH_IP28_SPACES_H
13 13
14#define CAC_BASE 0xa800000000000000 14#define CAC_BASE _AC(0xa800000000000000, UL)
15 15
16#define HIGHMEM_START (~0UL) 16#define HIGHMEM_START (~0UL)
17 17
18#define PHYS_OFFSET _AC(0x20000000, UL) 18#define PHYS_OFFSET _AC(0x20000000, UL)
19
20#define UNCAC_BASE _AC(0xc0000000, UL) /* 0xa0000000 + PHYS_OFFSET */
21#define IO_BASE UNCAC_BASE
19 22
20#include <asm/mach-generic/spaces.h> 23#include <asm/mach-generic/spaces.h>
21 24
diff --git a/arch/mips/include/asm/mach-jz4740/dma.h b/arch/mips/include/asm/mach-jz4740/dma.h
index 98b4e7c0dbae..509cd5828044 100644
--- a/arch/mips/include/asm/mach-jz4740/dma.h
+++ b/arch/mips/include/asm/mach-jz4740/dma.h
@@ -16,8 +16,6 @@
16#ifndef __ASM_MACH_JZ4740_DMA_H__ 16#ifndef __ASM_MACH_JZ4740_DMA_H__
17#define __ASM_MACH_JZ4740_DMA_H__ 17#define __ASM_MACH_JZ4740_DMA_H__
18 18
19struct jz4740_dma_chan;
20
21enum jz4740_dma_request_type { 19enum jz4740_dma_request_type {
22 JZ4740_DMA_TYPE_AUTO_REQUEST = 8, 20 JZ4740_DMA_TYPE_AUTO_REQUEST = 8,
23 JZ4740_DMA_TYPE_UART_TRANSMIT = 20, 21 JZ4740_DMA_TYPE_UART_TRANSMIT = 20,
@@ -33,58 +31,4 @@ enum jz4740_dma_request_type {
33 JZ4740_DMA_TYPE_SLCD = 30, 31 JZ4740_DMA_TYPE_SLCD = 30,
34}; 32};
35 33
36enum jz4740_dma_width {
37 JZ4740_DMA_WIDTH_32BIT = 0,
38 JZ4740_DMA_WIDTH_8BIT = 1,
39 JZ4740_DMA_WIDTH_16BIT = 2,
40};
41
42enum jz4740_dma_transfer_size {
43 JZ4740_DMA_TRANSFER_SIZE_4BYTE = 0,
44 JZ4740_DMA_TRANSFER_SIZE_1BYTE = 1,
45 JZ4740_DMA_TRANSFER_SIZE_2BYTE = 2,
46 JZ4740_DMA_TRANSFER_SIZE_16BYTE = 3,
47 JZ4740_DMA_TRANSFER_SIZE_32BYTE = 4,
48};
49
50enum jz4740_dma_flags {
51 JZ4740_DMA_SRC_AUTOINC = 0x2,
52 JZ4740_DMA_DST_AUTOINC = 0x1,
53};
54
55enum jz4740_dma_mode {
56 JZ4740_DMA_MODE_SINGLE = 0,
57 JZ4740_DMA_MODE_BLOCK = 1,
58};
59
60struct jz4740_dma_config {
61 enum jz4740_dma_width src_width;
62 enum jz4740_dma_width dst_width;
63 enum jz4740_dma_transfer_size transfer_size;
64 enum jz4740_dma_request_type request_type;
65 enum jz4740_dma_flags flags;
66 enum jz4740_dma_mode mode;
67};
68
69typedef void (*jz4740_dma_complete_callback_t)(struct jz4740_dma_chan *, int, void *);
70
71struct jz4740_dma_chan *jz4740_dma_request(void *dev, const char *name);
72void jz4740_dma_free(struct jz4740_dma_chan *dma);
73
74void jz4740_dma_configure(struct jz4740_dma_chan *dma,
75 const struct jz4740_dma_config *config);
76
77
78void jz4740_dma_enable(struct jz4740_dma_chan *dma);
79void jz4740_dma_disable(struct jz4740_dma_chan *dma);
80
81void jz4740_dma_set_src_addr(struct jz4740_dma_chan *dma, dma_addr_t src);
82void jz4740_dma_set_dst_addr(struct jz4740_dma_chan *dma, dma_addr_t dst);
83void jz4740_dma_set_transfer_count(struct jz4740_dma_chan *dma, uint32_t count);
84
85uint32_t jz4740_dma_get_residue(const struct jz4740_dma_chan *dma);
86
87void jz4740_dma_set_complete_cb(struct jz4740_dma_chan *dma,
88 jz4740_dma_complete_callback_t cb);
89
90#endif /* __ASM_JZ4740_DMA_H__ */ 34#endif /* __ASM_JZ4740_DMA_H__ */
diff --git a/arch/mips/include/asm/mach-jz4740/platform.h b/arch/mips/include/asm/mach-jz4740/platform.h
index 72cfebdb5a47..05988c2d6565 100644
--- a/arch/mips/include/asm/mach-jz4740/platform.h
+++ b/arch/mips/include/asm/mach-jz4740/platform.h
@@ -32,6 +32,7 @@ extern struct platform_device jz4740_codec_device;
32extern struct platform_device jz4740_adc_device; 32extern struct platform_device jz4740_adc_device;
33extern struct platform_device jz4740_wdt_device; 33extern struct platform_device jz4740_wdt_device;
34extern struct platform_device jz4740_pwm_device; 34extern struct platform_device jz4740_pwm_device;
35extern struct platform_device jz4740_dma_device;
35 36
36void jz4740_serial_device_register(void); 37void jz4740_serial_device_register(void);
37 38
diff --git a/arch/mips/include/asm/mach-pmcs-msp71xx/gpio.h b/arch/mips/include/asm/mach-pmcs-msp71xx/gpio.h
deleted file mode 100644
index ebdbab973e41..000000000000
--- a/arch/mips/include/asm/mach-pmcs-msp71xx/gpio.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * include/asm-mips/pmc-sierra/msp71xx/gpio.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * @author Patrick Glass <patrickglass@gmail.com>
9 */
10
11#ifndef __PMC_MSP71XX_GPIO_H
12#define __PMC_MSP71XX_GPIO_H
13
14/* Max number of gpio's is 28 on chip plus 3 banks of I2C IO Expanders */
15#define ARCH_NR_GPIOS (28 + (3 * 8))
16
17/* new generic GPIO API - see Documentation/gpio.txt */
18#include <asm-generic/gpio.h>
19
20#define gpio_get_value __gpio_get_value
21#define gpio_set_value __gpio_set_value
22#define gpio_cansleep __gpio_cansleep
23
24/* Setup calls for the gpio and gpio extended */
25extern void msp71xx_init_gpio(void);
26extern void msp71xx_init_gpio_extended(void);
27extern int msp71xx_set_output_drive(unsigned gpio, int value);
28
29/* Custom output drive functionss */
30static inline int gpio_set_output_drive(unsigned gpio, int value)
31{
32 return msp71xx_set_output_drive(gpio, value);
33}
34
35/* IRQ's are not supported for gpio lines */
36static inline int gpio_to_irq(unsigned gpio)
37{
38 return -EINVAL;
39}
40
41static inline int irq_to_gpio(unsigned irq)
42{
43 return -EINVAL;
44}
45
46#endif /* __PMC_MSP71XX_GPIO_H */
diff --git a/arch/mips/include/asm/mach-wrppmc/mach-gt64120.h b/arch/mips/include/asm/mach-wrppmc/mach-gt64120.h
deleted file mode 100644
index 00fa3684ac98..000000000000
--- a/arch/mips/include/asm/mach-wrppmc/mach-gt64120.h
+++ /dev/null
@@ -1,83 +0,0 @@
1/*
2 * This is a direct copy of the ev96100.h file, with a global
3 * search and replace. The numbers are the same.
4 *
5 * The reason I'm duplicating this is so that the 64120/96100
6 * defines won't be confusing in the source code.
7 */
8#ifndef __ASM_MIPS_GT64120_H
9#define __ASM_MIPS_GT64120_H
10
11/*
12 * This is the CPU physical memory map of PPMC Board:
13 *
14 * 0x00000000-0x03FFFFFF - 64MB SDRAM (SCS[0]#)
15 * 0x1C000000-0x1C000000 - LED (CS0)
16 * 0x1C800000-0x1C800007 - UART 16550 port (CS1)
17 * 0x1F000000-0x1F000000 - MailBox (CS3)
18 * 0x1FC00000-0x20000000 - 4MB Flash (BOOT CS)
19 */
20
21#define WRPPMC_SDRAM_SCS0_BASE 0x00000000
22#define WRPPMC_SDRAM_SCS0_SIZE 0x04000000
23
24#define WRPPMC_UART16550_BASE 0x1C800000
25#define WRPPMC_UART16550_CLOCK 3686400 /* 3.68MHZ */
26
27#define WRPPMC_LED_BASE 0x1C000000
28#define WRPPMC_MBOX_BASE 0x1F000000
29
30#define WRPPMC_BOOTROM_BASE 0x1FC00000
31#define WRPPMC_BOOTROM_SIZE 0x00400000 /* 4M Flash */
32
33#define WRPPMC_MIPS_TIMER_IRQ 7 /* MIPS compare/count timer interrupt */
34#define WRPPMC_UART16550_IRQ 6
35#define WRPPMC_PCI_INTA_IRQ 3
36
37/*
38 * PCI Bus I/O and Memory resources allocation
39 *
40 * NOTE: We only have PCI_0 hose interface
41 */
42#define GT_PCI_MEM_BASE 0x13000000UL
43#define GT_PCI_MEM_SIZE 0x02000000UL
44#define GT_PCI_IO_BASE 0x11000000UL
45#define GT_PCI_IO_SIZE 0x02000000UL
46
47/*
48 * PCI interrupts will come in on either the INTA or INTD interrupt lines,
49 * which are mapped to the #2 and #5 interrupt pins of the MIPS. On our
50 * boards, they all either come in on IntD or they all come in on IntA, they
51 * aren't mixed. There can be numerous PCI interrupts, so we keep a list of the
52 * "requested" interrupt numbers and go through the list whenever we get an
53 * IntA/D.
54 *
55 * Interrupts < 8 are directly wired to the processor; PCI INTA is 8 and
56 * INTD is 11.
57 */
58#define GT_TIMER 4
59#define GT_INTA 2
60#define GT_INTD 5
61
62#ifndef __ASSEMBLY__
63
64/*
65 * GT64120 internal register space base address
66 */
67extern unsigned long gt64120_base;
68
69#define GT64120_BASE (gt64120_base)
70
71/* define WRPPMC_EARLY_DEBUG to enable early output something to UART */
72#undef WRPPMC_EARLY_DEBUG
73
74#ifdef WRPPMC_EARLY_DEBUG
75extern void wrppmc_led_on(int mask);
76extern void wrppmc_led_off(int mask);
77extern void wrppmc_early_printk(const char *fmt, ...);
78#else
79#define wrppmc_early_printk(fmt, ...) do {} while (0)
80#endif /* WRPPMC_EARLY_DEBUG */
81
82#endif /* __ASSEMBLY__ */
83#endif /* __ASM_MIPS_GT64120_H */
diff --git a/arch/mips/include/asm/mach-wrppmc/war.h b/arch/mips/include/asm/mach-wrppmc/war.h
deleted file mode 100644
index e86084c0bd6b..000000000000
--- a/arch/mips/include/asm/mach-wrppmc/war.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_WRPPMC_WAR_H
9#define __ASM_MIPS_MACH_WRPPMC_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define ICACHE_REFILLS_WORKAROUND_WAR 1
21#define R10000_LLSC_WAR 0
22#define MIPS34K_MISSED_ITLB_WAR 0
23
24#endif /* __ASM_MIPS_MACH_WRPPMC_WAR_H */
diff --git a/arch/mips/include/asm/mips-boards/generic.h b/arch/mips/include/asm/mips-boards/generic.h
index bd9746fbe4af..48616816bcbc 100644
--- a/arch/mips/include/asm/mips-boards/generic.h
+++ b/arch/mips/include/asm/mips-boards/generic.h
@@ -24,12 +24,6 @@
24#define ASCII_DISPLAY_POS_BASE 0x1f000418 24#define ASCII_DISPLAY_POS_BASE 0x1f000418
25 25
26/* 26/*
27 * Reset register.
28 */
29#define SOFTRES_REG 0x1f000500
30#define GORESET 0x42
31
32/*
33 * Revision register. 27 * Revision register.
34 */ 28 */
35#define MIPS_REVISION_REG 0x1fc00010 29#define MIPS_REVISION_REG 0x1fc00010
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index 87e6207b05e4..fed1c3e9b486 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -596,7 +596,7 @@
596#define MIPS_CONF3_RXI (_ULCAST_(1) << 12) 596#define MIPS_CONF3_RXI (_ULCAST_(1) << 12)
597#define MIPS_CONF3_ULRI (_ULCAST_(1) << 13) 597#define MIPS_CONF3_ULRI (_ULCAST_(1) << 13)
598#define MIPS_CONF3_ISA (_ULCAST_(3) << 14) 598#define MIPS_CONF3_ISA (_ULCAST_(3) << 14)
599#define MIPS_CONF3_ISA_OE (_ULCAST_(3) << 16) 599#define MIPS_CONF3_ISA_OE (_ULCAST_(1) << 16)
600#define MIPS_CONF3_VZ (_ULCAST_(1) << 23) 600#define MIPS_CONF3_VZ (_ULCAST_(1) << 23)
601 601
602#define MIPS_CONF4_MMUSIZEEXT (_ULCAST_(255) << 0) 602#define MIPS_CONF4_MMUSIZEEXT (_ULCAST_(255) << 0)
diff --git a/arch/mips/include/asm/mmu_context.h b/arch/mips/include/asm/mmu_context.h
index 516e6e9a5594..3b29079b5424 100644
--- a/arch/mips/include/asm/mmu_context.h
+++ b/arch/mips/include/asm/mmu_context.h
@@ -28,11 +28,7 @@
28 28
29#define TLBMISS_HANDLER_SETUP_PGD(pgd) \ 29#define TLBMISS_HANDLER_SETUP_PGD(pgd) \
30do { \ 30do { \
31 void (*tlbmiss_handler_setup_pgd)(unsigned long); \ 31 extern void tlbmiss_handler_setup_pgd(unsigned long); \
32 extern u32 tlbmiss_handler_setup_pgd_array[16]; \
33 \
34 tlbmiss_handler_setup_pgd = \
35 (__typeof__(tlbmiss_handler_setup_pgd)) tlbmiss_handler_setup_pgd_array; \
36 tlbmiss_handler_setup_pgd((unsigned long)(pgd)); \ 32 tlbmiss_handler_setup_pgd((unsigned long)(pgd)); \
37} while (0) 33} while (0)
38 34
diff --git a/arch/mips/include/asm/netlogic/common.h b/arch/mips/include/asm/netlogic/common.h
index aef560a51a7e..bb68c3398c80 100644
--- a/arch/mips/include/asm/netlogic/common.h
+++ b/arch/mips/include/asm/netlogic/common.h
@@ -39,11 +39,17 @@
39 * Common SMP definitions 39 * Common SMP definitions
40 */ 40 */
41#define RESET_VEC_PHYS 0x1fc00000 41#define RESET_VEC_PHYS 0x1fc00000
42#define RESET_VEC_SIZE 8192 /* 8KB reset code and data */
42#define RESET_DATA_PHYS (RESET_VEC_PHYS + (1<<10)) 43#define RESET_DATA_PHYS (RESET_VEC_PHYS + (1<<10))
44
45/* Offsets of parameters in the RESET_DATA_PHYS area */
43#define BOOT_THREAD_MODE 0 46#define BOOT_THREAD_MODE 0
44#define BOOT_NMI_LOCK 4 47#define BOOT_NMI_LOCK 4
45#define BOOT_NMI_HANDLER 8 48#define BOOT_NMI_HANDLER 8
46 49
50/* CPU ready flags for each CPU */
51#define BOOT_CPU_READY 2048
52
47#ifndef __ASSEMBLY__ 53#ifndef __ASSEMBLY__
48#include <linux/cpumask.h> 54#include <linux/cpumask.h>
49#include <linux/spinlock.h> 55#include <linux/spinlock.h>
@@ -59,23 +65,32 @@ int nlm_wakeup_secondary_cpus(void);
59void nlm_rmiboot_preboot(void); 65void nlm_rmiboot_preboot(void);
60void nlm_percpu_init(int hwcpuid); 66void nlm_percpu_init(int hwcpuid);
61 67
68static inline void *
69nlm_get_boot_data(int offset)
70{
71 return (void *)(CKSEG1ADDR(RESET_DATA_PHYS) + offset);
72}
73
62static inline void 74static inline void
63nlm_set_nmi_handler(void *handler) 75nlm_set_nmi_handler(void *handler)
64{ 76{
65 char *reset_data; 77 void *nmih = nlm_get_boot_data(BOOT_NMI_HANDLER);
66 78
67 reset_data = (char *)CKSEG1ADDR(RESET_DATA_PHYS); 79 *(int64_t *)nmih = (long)handler;
68 *(int64_t *)(reset_data + BOOT_NMI_HANDLER) = (long)handler;
69} 80}
70 81
71/* 82/*
72 * Misc. 83 * Misc.
73 */ 84 */
85void nlm_init_boot_cpu(void);
74unsigned int nlm_get_cpu_frequency(void); 86unsigned int nlm_get_cpu_frequency(void);
75void nlm_node_init(int node); 87void nlm_node_init(int node);
76extern struct plat_smp_ops nlm_smp_ops; 88extern struct plat_smp_ops nlm_smp_ops;
77extern char nlm_reset_entry[], nlm_reset_entry_end[]; 89extern char nlm_reset_entry[], nlm_reset_entry_end[];
78 90
91/* SWIOTLB */
92extern struct dma_map_ops nlm_swiotlb_dma_ops;
93
79extern unsigned int nlm_threads_per_core; 94extern unsigned int nlm_threads_per_core;
80extern cpumask_t nlm_cpumask; 95extern cpumask_t nlm_cpumask;
81 96
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/pic.h b/arch/mips/include/asm/netlogic/xlp-hal/pic.h
index a981f4681a15..4b5108dfaa16 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/pic.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/pic.h
@@ -315,7 +315,7 @@ nlm_pic_send_ipi(uint64_t base, int hwt, int irq, int nmi)
315{ 315{
316 uint64_t ipi; 316 uint64_t ipi;
317 317
318 ipi = (nmi << 31) | (irq << 20); 318 ipi = ((uint64_t)nmi << 31) | (irq << 20);
319 ipi |= ((hwt >> 4) << 16) | (1 << (hwt & 0xf)); /* cpuset and mask */ 319 ipi |= ((hwt >> 4) << 16) | (1 << (hwt & 0xf)); /* cpuset and mask */
320 nlm_write_pic_reg(base, PIC_IPI_CTL, ipi); 320 nlm_write_pic_reg(base, PIC_IPI_CTL, ipi);
321} 321}
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
index 7e47209327a5..f4ea0f7f3965 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
@@ -59,6 +59,7 @@ void xlp_wakeup_secondary_cpus(void);
59 59
60void xlp_mmu_init(void); 60void xlp_mmu_init(void);
61void nlm_hal_init(void); 61void nlm_hal_init(void);
62void *xlp_dt_init(void *fdtp);
62 63
63#endif /* !__ASSEMBLY__ */ 64#endif /* !__ASSEMBLY__ */
64#endif /* _ASM_NLM_XLP_H */ 65#endif /* _ASM_NLM_XLP_H */
diff --git a/arch/mips/include/asm/netlogic/xlr/fmn.h b/arch/mips/include/asm/netlogic/xlr/fmn.h
index 2a78929cef73..5604db3d1836 100644
--- a/arch/mips/include/asm/netlogic/xlr/fmn.h
+++ b/arch/mips/include/asm/netlogic/xlr/fmn.h
@@ -175,6 +175,10 @@
175#define nlm_write_c2_cc14(s, v) __write_32bit_c2_register($30, s, v) 175#define nlm_write_c2_cc14(s, v) __write_32bit_c2_register($30, s, v)
176#define nlm_write_c2_cc15(s, v) __write_32bit_c2_register($31, s, v) 176#define nlm_write_c2_cc15(s, v) __write_32bit_c2_register($31, s, v)
177 177
178#define nlm_read_c2_status0() __read_32bit_c2_register($2, 0)
179#define nlm_write_c2_status0(v) __write_32bit_c2_register($2, 0, v)
180#define nlm_read_c2_status1() __read_32bit_c2_register($2, 1)
181#define nlm_write_c2_status1(v) __write_32bit_c2_register($2, 1, v)
178#define nlm_read_c2_status(sel) __read_32bit_c2_register($2, 0) 182#define nlm_read_c2_status(sel) __read_32bit_c2_register($2, 0)
179#define nlm_read_c2_config() __read_32bit_c2_register($3, 0) 183#define nlm_read_c2_config() __read_32bit_c2_register($3, 0)
180#define nlm_write_c2_config(v) __write_32bit_c2_register($3, 0, v) 184#define nlm_write_c2_config(v) __write_32bit_c2_register($3, 0, v)
@@ -237,7 +241,7 @@ static inline void nlm_msgwait(unsigned int mask)
237/* 241/*
238 * Disable interrupts and enable COP2 access 242 * Disable interrupts and enable COP2 access
239 */ 243 */
240static inline uint32_t nlm_cop2_enable(void) 244static inline uint32_t nlm_cop2_enable_irqsave(void)
241{ 245{
242 uint32_t sr = read_c0_status(); 246 uint32_t sr = read_c0_status();
243 247
@@ -245,7 +249,7 @@ static inline uint32_t nlm_cop2_enable(void)
245 return sr; 249 return sr;
246} 250}
247 251
248static inline void nlm_cop2_restore(uint32_t sr) 252static inline void nlm_cop2_disable_irqrestore(uint32_t sr)
249{ 253{
250 write_c0_status(sr); 254 write_c0_status(sr);
251} 255}
@@ -296,7 +300,7 @@ static inline int nlm_fmn_send(unsigned int size, unsigned int code,
296 */ 300 */
297 for (i = 0; i < 8; i++) { 301 for (i = 0; i < 8; i++) {
298 nlm_msgsnd(dest); 302 nlm_msgsnd(dest);
299 status = nlm_read_c2_status(0); 303 status = nlm_read_c2_status0();
300 if ((status & 0x2) == 1) 304 if ((status & 0x2) == 1)
301 pr_info("Send pending fail!\n"); 305 pr_info("Send pending fail!\n");
302 if ((status & 0x4) == 0) 306 if ((status & 0x4) == 0)
@@ -316,7 +320,7 @@ static inline int nlm_fmn_receive(int bucket, int *size, int *code, int *stid,
316 320
317 /* wait for load pending to clear */ 321 /* wait for load pending to clear */
318 do { 322 do {
319 status = nlm_read_c2_status(1); 323 status = nlm_read_c2_status0();
320 } while ((status & 0x08) != 0); 324 } while ((status & 0x08) != 0);
321 325
322 /* receive error bits */ 326 /* receive error bits */
diff --git a/arch/mips/include/asm/octeon/cvmx-bootinfo.h b/arch/mips/include/asm/octeon/cvmx-bootinfo.h
index 284fa8d773ba..7b7818d1e4d5 100644
--- a/arch/mips/include/asm/octeon/cvmx-bootinfo.h
+++ b/arch/mips/include/asm/octeon/cvmx-bootinfo.h
@@ -227,6 +227,7 @@ enum cvmx_board_types_enum {
227 * use any numbers in this range. 227 * use any numbers in this range.
228 */ 228 */
229 CVMX_BOARD_TYPE_CUST_PRIVATE_MIN = 20001, 229 CVMX_BOARD_TYPE_CUST_PRIVATE_MIN = 20001,
230 CVMX_BOARD_TYPE_UBNT_E100 = 20002,
230 CVMX_BOARD_TYPE_CUST_PRIVATE_MAX = 30000, 231 CVMX_BOARD_TYPE_CUST_PRIVATE_MAX = 30000,
231 232
232 /* The remaining range is reserved for future use. */ 233 /* The remaining range is reserved for future use. */
@@ -325,6 +326,7 @@ static inline const char *cvmx_board_type_to_string(enum
325 326
326 /* Customer private range */ 327 /* Customer private range */
327 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MIN) 328 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MIN)
329 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_UBNT_E100)
328 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MAX) 330 ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_PRIVATE_MAX)
329 } 331 }
330 return "Unsupported Board"; 332 return "Unsupported Board";
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index f59552fae917..f6be4741f7e8 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -205,10 +205,8 @@ extern int __virt_addr_valid(const volatile void *kaddr);
205#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 205#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
206 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 206 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
207 207
208#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + UNCAC_BASE + \ 208#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + UNCAC_BASE)
209 PHYS_OFFSET) 209#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET)
210#define CAC_ADDR(addr) ((addr) - UNCAC_BASE + PAGE_OFFSET - \
211 PHYS_OFFSET)
212 210
213#include <asm-generic/memory_model.h> 211#include <asm-generic/memory_model.h>
214#include <asm-generic/getorder.h> 212#include <asm-generic/getorder.h>
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index b8e24fd4cbc5..fa8e0aa250ca 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -52,7 +52,6 @@ struct pci_controller {
52/* 52/*
53 * Used by boards to register their PCI busses before the actual scanning. 53 * Used by boards to register their PCI busses before the actual scanning.
54 */ 54 */
55extern struct pci_controller * alloc_pci_controller(void);
56extern void register_pci_controller(struct pci_controller *hose); 55extern void register_pci_controller(struct pci_controller *hose);
57 56
58/* 57/*
diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h
index 1470b7b68b0e..3605b844ad87 100644
--- a/arch/mips/include/asm/processor.h
+++ b/arch/mips/include/asm/processor.h
@@ -137,7 +137,7 @@ union mips_watch_reg_state {
137 struct mips3264_watch_reg_state mips3264; 137 struct mips3264_watch_reg_state mips3264;
138}; 138};
139 139
140#ifdef CONFIG_CPU_CAVIUM_OCTEON 140#if defined(CONFIG_CPU_CAVIUM_OCTEON)
141 141
142struct octeon_cop2_state { 142struct octeon_cop2_state {
143 /* DMFC2 rt, 0x0201 */ 143 /* DMFC2 rt, 0x0201 */
@@ -182,13 +182,26 @@ struct octeon_cop2_state {
182 /* DMFC2 rt, 0x025A; DMFC2 rt, 0x025B - Pass2 */ 182 /* DMFC2 rt, 0x025A; DMFC2 rt, 0x025B - Pass2 */
183 unsigned long cop2_gfm_result[2]; 183 unsigned long cop2_gfm_result[2];
184}; 184};
185#define INIT_OCTEON_COP2 {0,} 185#define COP2_INIT \
186 .cp2 = {0,},
186 187
187struct octeon_cvmseg_state { 188struct octeon_cvmseg_state {
188 unsigned long cvmseg[CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE] 189 unsigned long cvmseg[CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE]
189 [cpu_dcache_line_size() / sizeof(unsigned long)]; 190 [cpu_dcache_line_size() / sizeof(unsigned long)];
190}; 191};
191 192
193#elif defined(CONFIG_CPU_XLP)
194struct nlm_cop2_state {
195 u64 rx[4];
196 u64 tx[4];
197 u32 tx_msg_status;
198 u32 rx_msg_status;
199};
200
201#define COP2_INIT \
202 .cp2 = {{0}, {0}, 0, 0},
203#else
204#define COP2_INIT
192#endif 205#endif
193 206
194typedef struct { 207typedef struct {
@@ -231,8 +244,11 @@ struct thread_struct {
231 unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */ 244 unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */
232 unsigned long error_code; 245 unsigned long error_code;
233#ifdef CONFIG_CPU_CAVIUM_OCTEON 246#ifdef CONFIG_CPU_CAVIUM_OCTEON
234 struct octeon_cop2_state cp2 __attribute__ ((__aligned__(128))); 247 struct octeon_cop2_state cp2 __attribute__ ((__aligned__(128)));
235 struct octeon_cvmseg_state cvmseg __attribute__ ((__aligned__(128))); 248 struct octeon_cvmseg_state cvmseg __attribute__ ((__aligned__(128)));
249#endif
250#ifdef CONFIG_CPU_XLP
251 struct nlm_cop2_state cp2;
236#endif 252#endif
237 struct mips_abi *abi; 253 struct mips_abi *abi;
238}; 254};
@@ -245,13 +261,6 @@ struct thread_struct {
245#define FPAFF_INIT 261#define FPAFF_INIT
246#endif /* CONFIG_MIPS_MT_FPAFF */ 262#endif /* CONFIG_MIPS_MT_FPAFF */
247 263
248#ifdef CONFIG_CPU_CAVIUM_OCTEON
249#define OCTEON_INIT \
250 .cp2 = INIT_OCTEON_COP2,
251#else
252#define OCTEON_INIT
253#endif /* CONFIG_CPU_CAVIUM_OCTEON */
254
255#define INIT_THREAD { \ 264#define INIT_THREAD { \
256 /* \ 265 /* \
257 * Saved main processor registers \ 266 * Saved main processor registers \
@@ -300,9 +309,9 @@ struct thread_struct {
300 .cp0_baduaddr = 0, \ 309 .cp0_baduaddr = 0, \
301 .error_code = 0, \ 310 .error_code = 0, \
302 /* \ 311 /* \
303 * Cavium Octeon specifics (null if not Octeon) \ 312 * Platform specific cop2 registers(null if no COP2) \
304 */ \ 313 */ \
305 OCTEON_INIT \ 314 COP2_INIT \
306} 315}
307 316
308struct task_struct; 317struct task_struct;
diff --git a/arch/mips/include/asm/stackframe.h b/arch/mips/include/asm/stackframe.h
index a89d1b10d027..23fc95e65673 100644
--- a/arch/mips/include/asm/stackframe.h
+++ b/arch/mips/include/asm/stackframe.h
@@ -70,6 +70,14 @@
70#ifndef CONFIG_CPU_HAS_SMARTMIPS 70#ifndef CONFIG_CPU_HAS_SMARTMIPS
71 LONG_S v1, PT_LO(sp) 71 LONG_S v1, PT_LO(sp)
72#endif 72#endif
73#ifdef CONFIG_CPU_CAVIUM_OCTEON
74 /*
75 * The Octeon multiplier state is affected by general
76 * multiply instructions. It must be saved before and
77 * kernel code might corrupt it
78 */
79 jal octeon_mult_save
80#endif
73 .endm 81 .endm
74 82
75 .macro SAVE_STATIC 83 .macro SAVE_STATIC
@@ -218,17 +226,8 @@
218 ori $28, sp, _THREAD_MASK 226 ori $28, sp, _THREAD_MASK
219 xori $28, _THREAD_MASK 227 xori $28, _THREAD_MASK
220#ifdef CONFIG_CPU_CAVIUM_OCTEON 228#ifdef CONFIG_CPU_CAVIUM_OCTEON
221 .set mips64 229 .set mips64
222 pref 0, 0($28) /* Prefetch the current pointer */ 230 pref 0, 0($28) /* Prefetch the current pointer */
223 pref 0, PT_R31(sp) /* Prefetch the $31(ra) */
224 /* The Octeon multiplier state is affected by general multiply
225 instructions. It must be saved before and kernel code might
226 corrupt it */
227 jal octeon_mult_save
228 LONG_L v1, 0($28) /* Load the current pointer */
229 /* Restore $31(ra) that was changed by the jal */
230 LONG_L ra, PT_R31(sp)
231 pref 0, 0(v1) /* Prefetch the current thread */
232#endif 231#endif
233 .set pop 232 .set pop
234 .endm 233 .endm
@@ -248,6 +247,10 @@
248 .endm 247 .endm
249 248
250 .macro RESTORE_TEMP 249 .macro RESTORE_TEMP
250#ifdef CONFIG_CPU_CAVIUM_OCTEON
251 /* Restore the Octeon multiplier state */
252 jal octeon_mult_restore
253#endif
251#ifdef CONFIG_CPU_HAS_SMARTMIPS 254#ifdef CONFIG_CPU_HAS_SMARTMIPS
252 LONG_L $24, PT_ACX(sp) 255 LONG_L $24, PT_ACX(sp)
253 mtlhx $24 256 mtlhx $24
@@ -360,10 +363,6 @@
360 DVPE 5 # dvpe a1 363 DVPE 5 # dvpe a1
361 jal mips_ihb 364 jal mips_ihb
362#endif /* CONFIG_MIPS_MT_SMTC */ 365#endif /* CONFIG_MIPS_MT_SMTC */
363#ifdef CONFIG_CPU_CAVIUM_OCTEON
364 /* Restore the Octeon multiplier state */
365 jal octeon_mult_restore
366#endif
367 mfc0 a0, CP0_STATUS 366 mfc0 a0, CP0_STATUS
368 ori a0, STATMASK 367 ori a0, STATMASK
369 xori a0, STATMASK 368 xori a0, STATMASK
diff --git a/arch/mips/include/asm/stackprotector.h b/arch/mips/include/asm/stackprotector.h
new file mode 100644
index 000000000000..eb9b1035e926
--- /dev/null
+++ b/arch/mips/include/asm/stackprotector.h
@@ -0,0 +1,40 @@
1/*
2 * GCC stack protector support.
3 *
4 * (This is directly adopted from the ARM implementation)
5 *
6 * Stack protector works by putting predefined pattern at the start of
7 * the stack frame and verifying that it hasn't been overwritten when
8 * returning from the function. The pattern is called stack canary
9 * and gcc expects it to be defined by a global variable called
10 * "__stack_chk_guard" on MIPS. This unfortunately means that on SMP
11 * we cannot have a different canary value per task.
12 */
13
14#ifndef _ASM_STACKPROTECTOR_H
15#define _ASM_STACKPROTECTOR_H 1
16
17#include <linux/random.h>
18#include <linux/version.h>
19
20extern unsigned long __stack_chk_guard;
21
22/*
23 * Initialize the stackprotector canary value.
24 *
25 * NOTE: this must only be called from functions that never return,
26 * and it must always be inlined.
27 */
28static __always_inline void boot_init_stack_canary(void)
29{
30 unsigned long canary;
31
32 /* Try to get a semi random initial value. */
33 get_random_bytes(&canary, sizeof(canary));
34 canary ^= LINUX_VERSION_CODE;
35
36 current->stack_canary = canary;
37 __stack_chk_guard = current->stack_canary;
38}
39
40#endif /* _ASM_STACKPROTECTOR_H */
diff --git a/arch/mips/include/asm/switch_to.h b/arch/mips/include/asm/switch_to.h
index fd16bcb6c311..eb0af15ac656 100644
--- a/arch/mips/include/asm/switch_to.h
+++ b/arch/mips/include/asm/switch_to.h
@@ -15,6 +15,7 @@
15#include <asm/cpu-features.h> 15#include <asm/cpu-features.h>
16#include <asm/watch.h> 16#include <asm/watch.h>
17#include <asm/dsp.h> 17#include <asm/dsp.h>
18#include <asm/cop2.h>
18 19
19struct task_struct; 20struct task_struct;
20 21
@@ -66,10 +67,18 @@ do { \
66 67
67#define switch_to(prev, next, last) \ 68#define switch_to(prev, next, last) \
68do { \ 69do { \
69 u32 __usedfpu; \ 70 u32 __usedfpu, __c0_stat; \
70 __mips_mt_fpaff_switch_to(prev); \ 71 __mips_mt_fpaff_switch_to(prev); \
71 if (cpu_has_dsp) \ 72 if (cpu_has_dsp) \
72 __save_dsp(prev); \ 73 __save_dsp(prev); \
74 if (cop2_present && (KSTK_STATUS(prev) & ST0_CU2)) { \
75 if (cop2_lazy_restore) \
76 KSTK_STATUS(prev) &= ~ST0_CU2; \
77 __c0_stat = read_c0_status(); \
78 write_c0_status(__c0_stat | ST0_CU2); \
79 cop2_save(&prev->thread.cp2); \
80 write_c0_status(__c0_stat & ~ST0_CU2); \
81 } \
73 __clear_software_ll_bit(); \ 82 __clear_software_ll_bit(); \
74 __usedfpu = test_and_clear_tsk_thread_flag(prev, TIF_USEDFPU); \ 83 __usedfpu = test_and_clear_tsk_thread_flag(prev, TIF_USEDFPU); \
75 (last) = resume(prev, next, task_thread_info(next), __usedfpu); \ 84 (last) = resume(prev, next, task_thread_info(next), __usedfpu); \
@@ -77,6 +86,14 @@ do { \
77 86
78#define finish_arch_switch(prev) \ 87#define finish_arch_switch(prev) \
79do { \ 88do { \
89 u32 __c0_stat; \
90 if (cop2_present && !cop2_lazy_restore && \
91 (KSTK_STATUS(current) & ST0_CU2)) { \
92 __c0_stat = read_c0_status(); \
93 write_c0_status(__c0_stat | ST0_CU2); \
94 cop2_restore(&current->thread.cp2); \
95 write_c0_status(__c0_stat & ~ST0_CU2); \
96 } \
80 if (cpu_has_dsp) \ 97 if (cpu_has_dsp) \
81 __restore_dsp(current); \ 98 __restore_dsp(current); \
82 if (cpu_has_userlocal) \ 99 if (cpu_has_userlocal) \
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
index 895320e25662..61215a34acc6 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
@@ -109,6 +109,7 @@ static inline struct thread_info *current_thread_info(void)
109#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ 109#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
110#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ 110#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
111#define TIF_MEMDIE 18 /* is terminating due to OOM killer */ 111#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
112#define TIF_NOHZ 19 /* in adaptive nohz mode */
112#define TIF_FIXADE 20 /* Fix address errors in software */ 113#define TIF_FIXADE 20 /* Fix address errors in software */
113#define TIF_LOGADE 21 /* Log address errors to syslog */ 114#define TIF_LOGADE 21 /* Log address errors to syslog */
114#define TIF_32BIT_REGS 22 /* also implies 16/32 fprs */ 115#define TIF_32BIT_REGS 22 /* also implies 16/32 fprs */
@@ -124,6 +125,7 @@ static inline struct thread_info *current_thread_info(void)
124#define _TIF_SECCOMP (1<<TIF_SECCOMP) 125#define _TIF_SECCOMP (1<<TIF_SECCOMP)
125#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 126#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
126#define _TIF_USEDFPU (1<<TIF_USEDFPU) 127#define _TIF_USEDFPU (1<<TIF_USEDFPU)
128#define _TIF_NOHZ (1<<TIF_NOHZ)
127#define _TIF_FIXADE (1<<TIF_FIXADE) 129#define _TIF_FIXADE (1<<TIF_FIXADE)
128#define _TIF_LOGADE (1<<TIF_LOGADE) 130#define _TIF_LOGADE (1<<TIF_LOGADE)
129#define _TIF_32BIT_REGS (1<<TIF_32BIT_REGS) 131#define _TIF_32BIT_REGS (1<<TIF_32BIT_REGS)
@@ -131,14 +133,19 @@ static inline struct thread_info *current_thread_info(void)
131#define _TIF_FPUBOUND (1<<TIF_FPUBOUND) 133#define _TIF_FPUBOUND (1<<TIF_FPUBOUND)
132#define _TIF_LOAD_WATCH (1<<TIF_LOAD_WATCH) 134#define _TIF_LOAD_WATCH (1<<TIF_LOAD_WATCH)
133 135
136#define _TIF_WORK_SYSCALL_ENTRY (_TIF_NOHZ | _TIF_SYSCALL_TRACE | \
137 _TIF_SYSCALL_AUDIT)
138
134/* work to do in syscall_trace_leave() */ 139/* work to do in syscall_trace_leave() */
135#define _TIF_WORK_SYSCALL_EXIT (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT) 140#define _TIF_WORK_SYSCALL_EXIT (_TIF_NOHZ | _TIF_SYSCALL_TRACE | \
141 _TIF_SYSCALL_AUDIT)
136 142
137/* work to do on interrupt/exception return */ 143/* work to do on interrupt/exception return */
138#define _TIF_WORK_MASK \ 144#define _TIF_WORK_MASK \
139 (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_NOTIFY_RESUME) 145 (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_NOTIFY_RESUME)
140/* work to do on any return to u-space */ 146/* work to do on any return to u-space */
141#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | _TIF_WORK_SYSCALL_EXIT) 147#define _TIF_ALLWORK_MASK (_TIF_NOHZ | _TIF_WORK_MASK | \
148 _TIF_WORK_SYSCALL_EXIT)
142 149
143#endif /* __KERNEL__ */ 150#endif /* __KERNEL__ */
144 151
diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h
index 370d967725c2..c33a9564fb41 100644
--- a/arch/mips/include/asm/uasm.h
+++ b/arch/mips/include/asm/uasm.h
@@ -13,12 +13,8 @@
13 13
14#ifdef CONFIG_EXPORT_UASM 14#ifdef CONFIG_EXPORT_UASM
15#include <linux/export.h> 15#include <linux/export.h>
16#define __uasminit
17#define __uasminitdata
18#define UASM_EXPORT_SYMBOL(sym) EXPORT_SYMBOL(sym) 16#define UASM_EXPORT_SYMBOL(sym) EXPORT_SYMBOL(sym)
19#else 17#else
20#define __uasminit __cpuinit
21#define __uasminitdata __cpuinitdata
22#define UASM_EXPORT_SYMBOL(sym) 18#define UASM_EXPORT_SYMBOL(sym)
23#endif 19#endif
24 20
@@ -54,43 +50,36 @@
54#endif 50#endif
55 51
56#define Ip_u1u2u3(op) \ 52#define Ip_u1u2u3(op) \
57void __uasminit \ 53void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
58ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
59 54
60#define Ip_u2u1u3(op) \ 55#define Ip_u2u1u3(op) \
61void __uasminit \ 56void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
62ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
63 57
64#define Ip_u3u1u2(op) \ 58#define Ip_u3u1u2(op) \
65void __uasminit \ 59void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
66ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
67 60
68#define Ip_u1u2s3(op) \ 61#define Ip_u1u2s3(op) \
69void __uasminit \ 62void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c)
70ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c)
71 63
72#define Ip_u2s3u1(op) \ 64#define Ip_u2s3u1(op) \
73void __uasminit \ 65void ISAOPC(op)(u32 **buf, unsigned int a, signed int b, unsigned int c)
74ISAOPC(op)(u32 **buf, unsigned int a, signed int b, unsigned int c)
75 66
76#define Ip_u2u1s3(op) \ 67#define Ip_u2u1s3(op) \
77void __uasminit \ 68void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c)
78ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c)
79 69
80#define Ip_u2u1msbu3(op) \ 70#define Ip_u2u1msbu3(op) \
81void __uasminit \ 71void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \
82ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \
83 unsigned int d) 72 unsigned int d)
84 73
85#define Ip_u1u2(op) \ 74#define Ip_u1u2(op) \
86void __uasminit ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b) 75void ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b)
87 76
88#define Ip_u1s2(op) \ 77#define Ip_u1s2(op) \
89void __uasminit ISAOPC(op)(u32 **buf, unsigned int a, signed int b) 78void ISAOPC(op)(u32 **buf, unsigned int a, signed int b)
90 79
91#define Ip_u1(op) void __uasminit ISAOPC(op)(u32 **buf, unsigned int a) 80#define Ip_u1(op) void ISAOPC(op)(u32 **buf, unsigned int a)
92 81
93#define Ip_0(op) void __uasminit ISAOPC(op)(u32 **buf) 82#define Ip_0(op) void ISAOPC(op)(u32 **buf)
94 83
95Ip_u2u1s3(_addiu); 84Ip_u2u1s3(_addiu);
96Ip_u3u1u2(_addu); 85Ip_u3u1u2(_addu);
@@ -163,7 +152,7 @@ struct uasm_label {
163 int lab; 152 int lab;
164}; 153};
165 154
166void __uasminit ISAFUNC(uasm_build_label)(struct uasm_label **lab, u32 *addr, 155void ISAFUNC(uasm_build_label)(struct uasm_label **lab, u32 *addr,
167 int lid); 156 int lid);
168#ifdef CONFIG_64BIT 157#ifdef CONFIG_64BIT
169int ISAFUNC(uasm_in_compat_space_p)(long addr); 158int ISAFUNC(uasm_in_compat_space_p)(long addr);
@@ -174,7 +163,7 @@ void ISAFUNC(UASM_i_LA_mostly)(u32 **buf, unsigned int rs, long addr);
174void ISAFUNC(UASM_i_LA)(u32 **buf, unsigned int rs, long addr); 163void ISAFUNC(UASM_i_LA)(u32 **buf, unsigned int rs, long addr);
175 164
176#define UASM_L_LA(lb) \ 165#define UASM_L_LA(lb) \
177static inline void __uasminit ISAFUNC(uasm_l##lb)(struct uasm_label **lab, u32 *addr) \ 166static inline void ISAFUNC(uasm_l##lb)(struct uasm_label **lab, u32 *addr) \
178{ \ 167{ \
179 ISAFUNC(uasm_build_label)(lab, addr, label##lb); \ 168 ISAFUNC(uasm_build_label)(lab, addr, label##lb); \
180} 169}
diff --git a/arch/mips/include/asm/xtalk/xtalk.h b/arch/mips/include/asm/xtalk/xtalk.h
index 680e7efebbaf..26d2ed1fa917 100644
--- a/arch/mips/include/asm/xtalk/xtalk.h
+++ b/arch/mips/include/asm/xtalk/xtalk.h
@@ -47,6 +47,15 @@ typedef struct xtalk_piomap_s *xtalk_piomap_t;
47#define XIO_PORT(x) ((xwidgetnum_t)(((x)&XIO_PORT_BITS) >> XIO_PORT_SHIFT)) 47#define XIO_PORT(x) ((xwidgetnum_t)(((x)&XIO_PORT_BITS) >> XIO_PORT_SHIFT))
48#define XIO_PACK(p, o) ((((uint64_t)(p))<<XIO_PORT_SHIFT) | ((o)&XIO_ADDR_BITS)) 48#define XIO_PACK(p, o) ((((uint64_t)(p))<<XIO_PORT_SHIFT) | ((o)&XIO_ADDR_BITS))
49 49
50#ifdef CONFIG_PCI
51extern int bridge_probe(nasid_t nasid, int widget, int masterwid);
52#else
53static inline int bridge_probe(nasid_t nasid, int widget, int masterwid)
54{
55 return 0;
56}
57#endif
58
50#endif /* !__ASSEMBLY__ */ 59#endif /* !__ASSEMBLY__ */
51 60
52#endif /* _ASM_XTALK_XTALK_H */ 61#endif /* _ASM_XTALK_XTALK_H */
diff --git a/arch/mips/include/uapi/asm/fcntl.h b/arch/mips/include/uapi/asm/fcntl.h
index 0bda78f70e1e..6ca432f00860 100644
--- a/arch/mips/include/uapi/asm/fcntl.h
+++ b/arch/mips/include/uapi/asm/fcntl.h
@@ -5,9 +5,10 @@
5 * 5 *
6 * Copyright (C) 1995, 96, 97, 98, 99, 2003, 05 Ralf Baechle 6 * Copyright (C) 1995, 96, 97, 98, 99, 2003, 05 Ralf Baechle
7 */ 7 */
8#ifndef _ASM_FCNTL_H 8#ifndef _UAPI_ASM_FCNTL_H
9#define _ASM_FCNTL_H 9#define _UAPI_ASM_FCNTL_H
10 10
11#include <asm/sgidefs.h>
11 12
12#define O_APPEND 0x0008 13#define O_APPEND 0x0008
13#define O_DSYNC 0x0010 /* used to be O_SYNC, see below */ 14#define O_DSYNC 0x0010 /* used to be O_SYNC, see below */
@@ -55,14 +56,15 @@
55 * contain all the same fields as struct flock. 56 * contain all the same fields as struct flock.
56 */ 57 */
57 58
58#ifdef CONFIG_32BIT 59#if _MIPS_SIM != _MIPS_SIM_ABI64
60
59#include <linux/types.h> 61#include <linux/types.h>
60 62
61struct flock { 63struct flock {
62 short l_type; 64 short l_type;
63 short l_whence; 65 short l_whence;
64 off_t l_start; 66 __kernel_off_t l_start;
65 off_t l_len; 67 __kernel_off_t l_len;
66 long l_sysid; 68 long l_sysid;
67 __kernel_pid_t l_pid; 69 __kernel_pid_t l_pid;
68 long pad[4]; 70 long pad[4];
@@ -70,8 +72,8 @@ struct flock {
70 72
71#define HAVE_ARCH_STRUCT_FLOCK 73#define HAVE_ARCH_STRUCT_FLOCK
72 74
73#endif /* CONFIG_32BIT */ 75#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
74 76
75#include <asm-generic/fcntl.h> 77#include <asm-generic/fcntl.h>
76 78
77#endif /* _ASM_FCNTL_H */ 79#endif /* _UAPI_ASM_FCNTL_H */
diff --git a/arch/mips/include/uapi/asm/inst.h b/arch/mips/include/uapi/asm/inst.h
index 0f4aec2ad1e6..e5a676e3d3c0 100644
--- a/arch/mips/include/uapi/asm/inst.h
+++ b/arch/mips/include/uapi/asm/inst.h
@@ -409,10 +409,11 @@ enum mm_32f_73_minor_op {
409enum mm_16c_minor_op { 409enum mm_16c_minor_op {
410 mm_lwm16_op = 0x04, 410 mm_lwm16_op = 0x04,
411 mm_swm16_op = 0x05, 411 mm_swm16_op = 0x05,
412 mm_jr16_op = 0x18, 412 mm_jr16_op = 0x0c,
413 mm_jrc_op = 0x1a, 413 mm_jrc_op = 0x0d,
414 mm_jalr16_op = 0x1c, 414 mm_jalr16_op = 0x0e,
415 mm_jalrs16_op = 0x1e, 415 mm_jalrs16_op = 0x0f,
416 mm_jraddiusp_op = 0x18,
416}; 417};
417 418
418/* 419/*
diff --git a/arch/mips/include/uapi/asm/msgbuf.h b/arch/mips/include/uapi/asm/msgbuf.h
index 0d6c7f14de31..df849e87d9ae 100644
--- a/arch/mips/include/uapi/asm/msgbuf.h
+++ b/arch/mips/include/uapi/asm/msgbuf.h
@@ -14,25 +14,25 @@
14 14
15struct msqid64_ds { 15struct msqid64_ds {
16 struct ipc64_perm msg_perm; 16 struct ipc64_perm msg_perm;
17#if defined(CONFIG_32BIT) && !defined(CONFIG_CPU_LITTLE_ENDIAN) 17#if !defined(__mips64) && defined(__MIPSEB__)
18 unsigned long __unused1; 18 unsigned long __unused1;
19#endif 19#endif
20 __kernel_time_t msg_stime; /* last msgsnd time */ 20 __kernel_time_t msg_stime; /* last msgsnd time */
21#if defined(CONFIG_32BIT) && defined(CONFIG_CPU_LITTLE_ENDIAN) 21#if !defined(__mips64) && defined(__MIPSEL__)
22 unsigned long __unused1; 22 unsigned long __unused1;
23#endif 23#endif
24#if defined(CONFIG_32BIT) && !defined(CONFIG_CPU_LITTLE_ENDIAN) 24#if !defined(__mips64) && defined(__MIPSEB__)
25 unsigned long __unused2; 25 unsigned long __unused2;
26#endif 26#endif
27 __kernel_time_t msg_rtime; /* last msgrcv time */ 27 __kernel_time_t msg_rtime; /* last msgrcv time */
28#if defined(CONFIG_32BIT) && defined(CONFIG_CPU_LITTLE_ENDIAN) 28#if !defined(__mips64) && defined(__MIPSEL__)
29 unsigned long __unused2; 29 unsigned long __unused2;
30#endif 30#endif
31#if defined(CONFIG_32BIT) && !defined(CONFIG_CPU_LITTLE_ENDIAN) 31#if !defined(__mips64) && defined(__MIPSEB__)
32 unsigned long __unused3; 32 unsigned long __unused3;
33#endif 33#endif
34 __kernel_time_t msg_ctime; /* last change time */ 34 __kernel_time_t msg_ctime; /* last change time */
35#if defined(CONFIG_32BIT) && defined(CONFIG_CPU_LITTLE_ENDIAN) 35#if !defined(__mips64) && defined(__MIPSEL__)
36 unsigned long __unused3; 36 unsigned long __unused3;
37#endif 37#endif
38 unsigned long msg_cbytes; /* current number of bytes on queue */ 38 unsigned long msg_cbytes; /* current number of bytes on queue */
diff --git a/arch/mips/include/uapi/asm/resource.h b/arch/mips/include/uapi/asm/resource.h
index 87cb3085269c..b26439d4ab0b 100644
--- a/arch/mips/include/uapi/asm/resource.h
+++ b/arch/mips/include/uapi/asm/resource.h
@@ -26,7 +26,7 @@
26 * but we keep the old value on MIPS32, 26 * but we keep the old value on MIPS32,
27 * for compatibility: 27 * for compatibility:
28 */ 28 */
29#ifdef CONFIG_32BIT 29#ifndef __mips64
30# define RLIM_INFINITY 0x7fffffffUL 30# define RLIM_INFINITY 0x7fffffffUL
31#endif 31#endif
32 32
diff --git a/arch/mips/include/uapi/asm/siginfo.h b/arch/mips/include/uapi/asm/siginfo.h
index 6a8714193fb9..b7a23064841f 100644
--- a/arch/mips/include/uapi/asm/siginfo.h
+++ b/arch/mips/include/uapi/asm/siginfo.h
@@ -25,10 +25,10 @@ struct siginfo;
25/* 25/*
26 * Careful to keep union _sifields from shifting ... 26 * Careful to keep union _sifields from shifting ...
27 */ 27 */
28#ifdef CONFIG_32BIT 28#if __SIZEOF_LONG__ == 4
29#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int)) 29#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
30#endif 30#endif
31#ifdef CONFIG_64BIT 31#if __SIZEOF_LONG__ == 8
32#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) 32#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
33#endif 33#endif
34 34
diff --git a/arch/mips/include/uapi/asm/socket.h b/arch/mips/include/uapi/asm/socket.h
index 3b211507be7f..61c01f054d1b 100644
--- a/arch/mips/include/uapi/asm/socket.h
+++ b/arch/mips/include/uapi/asm/socket.h
@@ -92,4 +92,6 @@
92 92
93#define SO_SELECT_ERR_QUEUE 45 93#define SO_SELECT_ERR_QUEUE 45
94 94
95#define SO_BUSY_POLL 46
96
95#endif /* _UAPI_ASM_SOCKET_H */ 97#endif /* _UAPI_ASM_SOCKET_H */
diff --git a/arch/mips/include/uapi/asm/swab.h b/arch/mips/include/uapi/asm/swab.h
index 97c2f81b4b43..ac9a8f9cd1fb 100644
--- a/arch/mips/include/uapi/asm/swab.h
+++ b/arch/mips/include/uapi/asm/swab.h
@@ -13,7 +13,7 @@
13 13
14#define __SWAB_64_THRU_32__ 14#define __SWAB_64_THRU_32__
15 15
16#ifdef CONFIG_CPU_MIPSR2 16#if defined(__mips_isa_rev) && (__mips_isa_rev >= 2)
17 17
18static inline __attribute_const__ __u16 __arch_swab16(__u16 x) 18static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
19{ 19{
@@ -39,10 +39,10 @@ static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
39#define __arch_swab32 __arch_swab32 39#define __arch_swab32 __arch_swab32
40 40
41/* 41/*
42 * Having already checked for CONFIG_CPU_MIPSR2, enable the 42 * Having already checked for MIPS R2, enable the optimized version for
43 * optimized version for 64-bit kernel on r2 CPUs. 43 * 64-bit kernel on r2 CPUs.
44 */ 44 */
45#ifdef CONFIG_64BIT 45#ifdef __mips64
46static inline __attribute_const__ __u64 __arch_swab64(__u64 x) 46static inline __attribute_const__ __u64 __arch_swab64(__u64 x)
47{ 47{
48 __asm__( 48 __asm__(
@@ -54,6 +54,6 @@ static inline __attribute_const__ __u64 __arch_swab64(__u64 x)
54 return x; 54 return x;
55} 55}
56#define __arch_swab64 __arch_swab64 56#define __arch_swab64 __arch_swab64
57#endif /* CONFIG_64BIT */ 57#endif /* __mips64 */
58#endif /* CONFIG_CPU_MIPSR2 */ 58#endif /* MIPS R2 or newer */
59#endif /* _ASM_SWAB_H */ 59#endif /* _ASM_SWAB_H */
diff --git a/arch/mips/jz4740/Makefile b/arch/mips/jz4740/Makefile
index 63bad0e491d0..28e5535dfa9e 100644
--- a/arch/mips/jz4740/Makefile
+++ b/arch/mips/jz4740/Makefile
@@ -4,7 +4,7 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y += prom.o irq.o time.o reset.o setup.o dma.o \ 7obj-y += prom.o irq.o time.o reset.o setup.o \
8 gpio.o clock.o platform.o timer.o serial.o 8 gpio.o clock.o platform.o timer.o serial.o
9 9
10obj-$(CONFIG_DEBUG_FS) += clock-debugfs.o 10obj-$(CONFIG_DEBUG_FS) += clock-debugfs.o
diff --git a/arch/mips/jz4740/board-qi_lb60.c b/arch/mips/jz4740/board-qi_lb60.c
index be2b3deeef1d..8a5ec0eedeb0 100644
--- a/arch/mips/jz4740/board-qi_lb60.c
+++ b/arch/mips/jz4740/board-qi_lb60.c
@@ -438,6 +438,7 @@ static struct platform_device *jz_platform_devices[] __initdata = {
438 &jz4740_rtc_device, 438 &jz4740_rtc_device,
439 &jz4740_adc_device, 439 &jz4740_adc_device,
440 &jz4740_pwm_device, 440 &jz4740_pwm_device,
441 &jz4740_dma_device,
441 &qi_lb60_gpio_keys, 442 &qi_lb60_gpio_keys,
442 &qi_lb60_pwm_beeper, 443 &qi_lb60_pwm_beeper,
443 &qi_lb60_charger_device, 444 &qi_lb60_charger_device,
diff --git a/arch/mips/jz4740/clock.c b/arch/mips/jz4740/clock.c
index 484d38a0864f..1b5f55426cad 100644
--- a/arch/mips/jz4740/clock.c
+++ b/arch/mips/jz4740/clock.c
@@ -687,7 +687,7 @@ static struct clk jz4740_clock_simple_clks[] = {
687 [3] = { 687 [3] = {
688 .name = "dma", 688 .name = "dma",
689 .parent = &jz_clk_high_speed_peripheral.clk, 689 .parent = &jz_clk_high_speed_peripheral.clk,
690 .gate_bit = JZ_CLOCK_GATE_UART0, 690 .gate_bit = JZ_CLOCK_GATE_DMAC,
691 .ops = &jz_clk_simple_ops, 691 .ops = &jz_clk_simple_ops,
692 }, 692 },
693 [4] = { 693 [4] = {
diff --git a/arch/mips/jz4740/dma.c b/arch/mips/jz4740/dma.c
deleted file mode 100644
index 317ec6fffb12..000000000000
--- a/arch/mips/jz4740/dma.c
+++ /dev/null
@@ -1,287 +0,0 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 SoC DMA support
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#include <linux/kernel.h>
17#include <linux/module.h>
18#include <linux/spinlock.h>
19#include <linux/interrupt.h>
20
21#include <linux/dma-mapping.h>
22#include <asm/mach-jz4740/dma.h>
23#include <asm/mach-jz4740/base.h>
24
25#define JZ_REG_DMA_SRC_ADDR(x) (0x00 + (x) * 0x20)
26#define JZ_REG_DMA_DST_ADDR(x) (0x04 + (x) * 0x20)
27#define JZ_REG_DMA_TRANSFER_COUNT(x) (0x08 + (x) * 0x20)
28#define JZ_REG_DMA_REQ_TYPE(x) (0x0C + (x) * 0x20)
29#define JZ_REG_DMA_STATUS_CTRL(x) (0x10 + (x) * 0x20)
30#define JZ_REG_DMA_CMD(x) (0x14 + (x) * 0x20)
31#define JZ_REG_DMA_DESC_ADDR(x) (0x18 + (x) * 0x20)
32
33#define JZ_REG_DMA_CTRL 0x300
34#define JZ_REG_DMA_IRQ 0x304
35#define JZ_REG_DMA_DOORBELL 0x308
36#define JZ_REG_DMA_DOORBELL_SET 0x30C
37
38#define JZ_DMA_STATUS_CTRL_NO_DESC BIT(31)
39#define JZ_DMA_STATUS_CTRL_DESC_INV BIT(6)
40#define JZ_DMA_STATUS_CTRL_ADDR_ERR BIT(4)
41#define JZ_DMA_STATUS_CTRL_TRANSFER_DONE BIT(3)
42#define JZ_DMA_STATUS_CTRL_HALT BIT(2)
43#define JZ_DMA_STATUS_CTRL_COUNT_TERMINATE BIT(1)
44#define JZ_DMA_STATUS_CTRL_ENABLE BIT(0)
45
46#define JZ_DMA_CMD_SRC_INC BIT(23)
47#define JZ_DMA_CMD_DST_INC BIT(22)
48#define JZ_DMA_CMD_RDIL_MASK (0xf << 16)
49#define JZ_DMA_CMD_SRC_WIDTH_MASK (0x3 << 14)
50#define JZ_DMA_CMD_DST_WIDTH_MASK (0x3 << 12)
51#define JZ_DMA_CMD_INTERVAL_LENGTH_MASK (0x7 << 8)
52#define JZ_DMA_CMD_BLOCK_MODE BIT(7)
53#define JZ_DMA_CMD_DESC_VALID BIT(4)
54#define JZ_DMA_CMD_DESC_VALID_MODE BIT(3)
55#define JZ_DMA_CMD_VALID_IRQ_ENABLE BIT(2)
56#define JZ_DMA_CMD_TRANSFER_IRQ_ENABLE BIT(1)
57#define JZ_DMA_CMD_LINK_ENABLE BIT(0)
58
59#define JZ_DMA_CMD_FLAGS_OFFSET 22
60#define JZ_DMA_CMD_RDIL_OFFSET 16
61#define JZ_DMA_CMD_SRC_WIDTH_OFFSET 14
62#define JZ_DMA_CMD_DST_WIDTH_OFFSET 12
63#define JZ_DMA_CMD_TRANSFER_SIZE_OFFSET 8
64#define JZ_DMA_CMD_MODE_OFFSET 7
65
66#define JZ_DMA_CTRL_PRIORITY_MASK (0x3 << 8)
67#define JZ_DMA_CTRL_HALT BIT(3)
68#define JZ_DMA_CTRL_ADDRESS_ERROR BIT(2)
69#define JZ_DMA_CTRL_ENABLE BIT(0)
70
71
72static void __iomem *jz4740_dma_base;
73static spinlock_t jz4740_dma_lock;
74
75static inline uint32_t jz4740_dma_read(size_t reg)
76{
77 return readl(jz4740_dma_base + reg);
78}
79
80static inline void jz4740_dma_write(size_t reg, uint32_t val)
81{
82 writel(val, jz4740_dma_base + reg);
83}
84
85static inline void jz4740_dma_write_mask(size_t reg, uint32_t val, uint32_t mask)
86{
87 uint32_t val2;
88 val2 = jz4740_dma_read(reg);
89 val2 &= ~mask;
90 val2 |= val;
91 jz4740_dma_write(reg, val2);
92}
93
94struct jz4740_dma_chan {
95 unsigned int id;
96 void *dev;
97 const char *name;
98
99 enum jz4740_dma_flags flags;
100 uint32_t transfer_shift;
101
102 jz4740_dma_complete_callback_t complete_cb;
103
104 unsigned used:1;
105};
106
107#define JZ4740_DMA_CHANNEL(_id) { .id = _id }
108
109struct jz4740_dma_chan jz4740_dma_channels[] = {
110 JZ4740_DMA_CHANNEL(0),
111 JZ4740_DMA_CHANNEL(1),
112 JZ4740_DMA_CHANNEL(2),
113 JZ4740_DMA_CHANNEL(3),
114 JZ4740_DMA_CHANNEL(4),
115 JZ4740_DMA_CHANNEL(5),
116};
117
118struct jz4740_dma_chan *jz4740_dma_request(void *dev, const char *name)
119{
120 unsigned int i;
121 struct jz4740_dma_chan *dma = NULL;
122
123 spin_lock(&jz4740_dma_lock);
124
125 for (i = 0; i < ARRAY_SIZE(jz4740_dma_channels); ++i) {
126 if (!jz4740_dma_channels[i].used) {
127 dma = &jz4740_dma_channels[i];
128 dma->used = 1;
129 break;
130 }
131 }
132
133 spin_unlock(&jz4740_dma_lock);
134
135 if (!dma)
136 return NULL;
137
138 dma->dev = dev;
139 dma->name = name;
140
141 return dma;
142}
143EXPORT_SYMBOL_GPL(jz4740_dma_request);
144
145void jz4740_dma_configure(struct jz4740_dma_chan *dma,
146 const struct jz4740_dma_config *config)
147{
148 uint32_t cmd;
149
150 switch (config->transfer_size) {
151 case JZ4740_DMA_TRANSFER_SIZE_2BYTE:
152 dma->transfer_shift = 1;
153 break;
154 case JZ4740_DMA_TRANSFER_SIZE_4BYTE:
155 dma->transfer_shift = 2;
156 break;
157 case JZ4740_DMA_TRANSFER_SIZE_16BYTE:
158 dma->transfer_shift = 4;
159 break;
160 case JZ4740_DMA_TRANSFER_SIZE_32BYTE:
161 dma->transfer_shift = 5;
162 break;
163 default:
164 dma->transfer_shift = 0;
165 break;
166 }
167
168 cmd = config->flags << JZ_DMA_CMD_FLAGS_OFFSET;
169 cmd |= config->src_width << JZ_DMA_CMD_SRC_WIDTH_OFFSET;
170 cmd |= config->dst_width << JZ_DMA_CMD_DST_WIDTH_OFFSET;
171 cmd |= config->transfer_size << JZ_DMA_CMD_TRANSFER_SIZE_OFFSET;
172 cmd |= config->mode << JZ_DMA_CMD_MODE_OFFSET;
173 cmd |= JZ_DMA_CMD_TRANSFER_IRQ_ENABLE;
174
175 jz4740_dma_write(JZ_REG_DMA_CMD(dma->id), cmd);
176 jz4740_dma_write(JZ_REG_DMA_STATUS_CTRL(dma->id), 0);
177 jz4740_dma_write(JZ_REG_DMA_REQ_TYPE(dma->id), config->request_type);
178}
179EXPORT_SYMBOL_GPL(jz4740_dma_configure);
180
181void jz4740_dma_set_src_addr(struct jz4740_dma_chan *dma, dma_addr_t src)
182{
183 jz4740_dma_write(JZ_REG_DMA_SRC_ADDR(dma->id), src);
184}
185EXPORT_SYMBOL_GPL(jz4740_dma_set_src_addr);
186
187void jz4740_dma_set_dst_addr(struct jz4740_dma_chan *dma, dma_addr_t dst)
188{
189 jz4740_dma_write(JZ_REG_DMA_DST_ADDR(dma->id), dst);
190}
191EXPORT_SYMBOL_GPL(jz4740_dma_set_dst_addr);
192
193void jz4740_dma_set_transfer_count(struct jz4740_dma_chan *dma, uint32_t count)
194{
195 count >>= dma->transfer_shift;
196 jz4740_dma_write(JZ_REG_DMA_TRANSFER_COUNT(dma->id), count);
197}
198EXPORT_SYMBOL_GPL(jz4740_dma_set_transfer_count);
199
200void jz4740_dma_set_complete_cb(struct jz4740_dma_chan *dma,
201 jz4740_dma_complete_callback_t cb)
202{
203 dma->complete_cb = cb;
204}
205EXPORT_SYMBOL_GPL(jz4740_dma_set_complete_cb);
206
207void jz4740_dma_free(struct jz4740_dma_chan *dma)
208{
209 dma->dev = NULL;
210 dma->complete_cb = NULL;
211 dma->used = 0;
212}
213EXPORT_SYMBOL_GPL(jz4740_dma_free);
214
215void jz4740_dma_enable(struct jz4740_dma_chan *dma)
216{
217 jz4740_dma_write_mask(JZ_REG_DMA_STATUS_CTRL(dma->id),
218 JZ_DMA_STATUS_CTRL_NO_DESC | JZ_DMA_STATUS_CTRL_ENABLE,
219 JZ_DMA_STATUS_CTRL_HALT | JZ_DMA_STATUS_CTRL_NO_DESC |
220 JZ_DMA_STATUS_CTRL_ENABLE);
221
222 jz4740_dma_write_mask(JZ_REG_DMA_CTRL,
223 JZ_DMA_CTRL_ENABLE,
224 JZ_DMA_CTRL_HALT | JZ_DMA_CTRL_ENABLE);
225}
226EXPORT_SYMBOL_GPL(jz4740_dma_enable);
227
228void jz4740_dma_disable(struct jz4740_dma_chan *dma)
229{
230 jz4740_dma_write_mask(JZ_REG_DMA_STATUS_CTRL(dma->id), 0,
231 JZ_DMA_STATUS_CTRL_ENABLE);
232}
233EXPORT_SYMBOL_GPL(jz4740_dma_disable);
234
235uint32_t jz4740_dma_get_residue(const struct jz4740_dma_chan *dma)
236{
237 uint32_t residue;
238 residue = jz4740_dma_read(JZ_REG_DMA_TRANSFER_COUNT(dma->id));
239 return residue << dma->transfer_shift;
240}
241EXPORT_SYMBOL_GPL(jz4740_dma_get_residue);
242
243static void jz4740_dma_chan_irq(struct jz4740_dma_chan *dma)
244{
245 (void) jz4740_dma_read(JZ_REG_DMA_STATUS_CTRL(dma->id));
246
247 jz4740_dma_write_mask(JZ_REG_DMA_STATUS_CTRL(dma->id), 0,
248 JZ_DMA_STATUS_CTRL_ENABLE | JZ_DMA_STATUS_CTRL_TRANSFER_DONE);
249
250 if (dma->complete_cb)
251 dma->complete_cb(dma, 0, dma->dev);
252}
253
254static irqreturn_t jz4740_dma_irq(int irq, void *dev_id)
255{
256 uint32_t irq_status;
257 unsigned int i;
258
259 irq_status = readl(jz4740_dma_base + JZ_REG_DMA_IRQ);
260
261 for (i = 0; i < 6; ++i) {
262 if (irq_status & (1 << i))
263 jz4740_dma_chan_irq(&jz4740_dma_channels[i]);
264 }
265
266 return IRQ_HANDLED;
267}
268
269static int jz4740_dma_init(void)
270{
271 unsigned int ret;
272
273 jz4740_dma_base = ioremap(JZ4740_DMAC_BASE_ADDR, 0x400);
274
275 if (!jz4740_dma_base)
276 return -EBUSY;
277
278 spin_lock_init(&jz4740_dma_lock);
279
280 ret = request_irq(JZ4740_IRQ_DMAC, jz4740_dma_irq, 0, "DMA", NULL);
281
282 if (ret)
283 printk(KERN_ERR "JZ4740 DMA: Failed to request irq: %d\n", ret);
284
285 return ret;
286}
287arch_initcall(jz4740_dma_init);
diff --git a/arch/mips/jz4740/platform.c b/arch/mips/jz4740/platform.c
index e9348fd26a35..df65677f3d0b 100644
--- a/arch/mips/jz4740/platform.c
+++ b/arch/mips/jz4740/platform.c
@@ -329,3 +329,24 @@ struct platform_device jz4740_pwm_device = {
329 .name = "jz4740-pwm", 329 .name = "jz4740-pwm",
330 .id = -1, 330 .id = -1,
331}; 331};
332
333/* DMA */
334static struct resource jz4740_dma_resources[] = {
335 {
336 .start = JZ4740_DMAC_BASE_ADDR,
337 .end = JZ4740_DMAC_BASE_ADDR + 0x400 - 1,
338 .flags = IORESOURCE_MEM,
339 },
340 {
341 .start = JZ4740_IRQ_DMAC,
342 .end = JZ4740_IRQ_DMAC,
343 .flags = IORESOURCE_IRQ,
344 },
345};
346
347struct platform_device jz4740_dma_device = {
348 .name = "jz4740-dma",
349 .id = -1,
350 .num_resources = ARRAY_SIZE(jz4740_dma_resources),
351 .resource = jz4740_dma_resources,
352};
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index 0845091ba480..0c2e853c3db4 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -82,6 +82,9 @@ void output_task_defines(void)
82 OFFSET(TASK_FLAGS, task_struct, flags); 82 OFFSET(TASK_FLAGS, task_struct, flags);
83 OFFSET(TASK_MM, task_struct, mm); 83 OFFSET(TASK_MM, task_struct, mm);
84 OFFSET(TASK_PID, task_struct, pid); 84 OFFSET(TASK_PID, task_struct, pid);
85#if defined(CONFIG_CC_STACKPROTECTOR)
86 OFFSET(TASK_STACK_CANARY, task_struct, stack_canary);
87#endif
85 DEFINE(TASK_STRUCT_SIZE, sizeof(struct task_struct)); 88 DEFINE(TASK_STRUCT_SIZE, sizeof(struct task_struct));
86 BLANK(); 89 BLANK();
87} 90}
diff --git a/arch/mips/kernel/bmips_vec.S b/arch/mips/kernel/bmips_vec.S
index 64c4fd62cf08..f739aedcb509 100644
--- a/arch/mips/kernel/bmips_vec.S
+++ b/arch/mips/kernel/bmips_vec.S
@@ -28,8 +28,6 @@
28 .set mips0 28 .set mips0
29 .endm 29 .endm
30 30
31 __CPUINIT
32
33/*********************************************************************** 31/***********************************************************************
34 * Alternate CPU1 startup vector for BMIPS4350 32 * Alternate CPU1 startup vector for BMIPS4350
35 * 33 *
@@ -216,8 +214,6 @@ END(bmips_smp_int_vec)
216 * Certain CPUs support extending kseg0 to 1024MB. 214 * Certain CPUs support extending kseg0 to 1024MB.
217 ***********************************************************************/ 215 ***********************************************************************/
218 216
219 __CPUINIT
220
221LEAF(bmips_enable_xks01) 217LEAF(bmips_enable_xks01)
222 218
223#if defined(CONFIG_XKS01) 219#if defined(CONFIG_XKS01)
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c
index 46c2ad0703a0..4d78bf445a9c 100644
--- a/arch/mips/kernel/branch.c
+++ b/arch/mips/kernel/branch.c
@@ -467,5 +467,4 @@ unaligned:
467 printk("%s: unaligned epc - sending SIGBUS.\n", current->comm); 467 printk("%s: unaligned epc - sending SIGBUS.\n", current->comm);
468 force_sig(SIGBUS, current); 468 force_sig(SIGBUS, current);
469 return -EFAULT; 469 return -EFAULT;
470
471} 470}
diff --git a/arch/mips/kernel/cevt-bcm1480.c b/arch/mips/kernel/cevt-bcm1480.c
index 15f618b40cf6..7976457184b1 100644
--- a/arch/mips/kernel/cevt-bcm1480.c
+++ b/arch/mips/kernel/cevt-bcm1480.c
@@ -109,7 +109,7 @@ static DEFINE_PER_CPU(struct clock_event_device, sibyte_hpt_clockevent);
109static DEFINE_PER_CPU(struct irqaction, sibyte_hpt_irqaction); 109static DEFINE_PER_CPU(struct irqaction, sibyte_hpt_irqaction);
110static DEFINE_PER_CPU(char [18], sibyte_hpt_name); 110static DEFINE_PER_CPU(char [18], sibyte_hpt_name);
111 111
112void __cpuinit sb1480_clockevent_init(void) 112void sb1480_clockevent_init(void)
113{ 113{
114 unsigned int cpu = smp_processor_id(); 114 unsigned int cpu = smp_processor_id();
115 unsigned int irq = K_BCM1480_INT_TIMER_0 + cpu; 115 unsigned int irq = K_BCM1480_INT_TIMER_0 + cpu;
diff --git a/arch/mips/kernel/cevt-gic.c b/arch/mips/kernel/cevt-gic.c
index 730eaf92c018..594cbbf16d62 100644
--- a/arch/mips/kernel/cevt-gic.c
+++ b/arch/mips/kernel/cevt-gic.c
@@ -59,7 +59,7 @@ void gic_event_handler(struct clock_event_device *dev)
59{ 59{
60} 60}
61 61
62int __cpuinit gic_clockevent_init(void) 62int gic_clockevent_init(void)
63{ 63{
64 unsigned int cpu = smp_processor_id(); 64 unsigned int cpu = smp_processor_id();
65 struct clock_event_device *cd; 65 struct clock_event_device *cd;
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c
index 02033eaf8825..50d3f5a8d6bb 100644
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -171,7 +171,7 @@ int c0_compare_int_usable(void)
171} 171}
172 172
173#ifndef CONFIG_MIPS_MT_SMTC 173#ifndef CONFIG_MIPS_MT_SMTC
174int __cpuinit r4k_clockevent_init(void) 174int r4k_clockevent_init(void)
175{ 175{
176 unsigned int cpu = smp_processor_id(); 176 unsigned int cpu = smp_processor_id();
177 struct clock_event_device *cd; 177 struct clock_event_device *cd;
diff --git a/arch/mips/kernel/cevt-sb1250.c b/arch/mips/kernel/cevt-sb1250.c
index 200f2778bf36..5ea6d6b1de15 100644
--- a/arch/mips/kernel/cevt-sb1250.c
+++ b/arch/mips/kernel/cevt-sb1250.c
@@ -107,7 +107,7 @@ static DEFINE_PER_CPU(struct clock_event_device, sibyte_hpt_clockevent);
107static DEFINE_PER_CPU(struct irqaction, sibyte_hpt_irqaction); 107static DEFINE_PER_CPU(struct irqaction, sibyte_hpt_irqaction);
108static DEFINE_PER_CPU(char [18], sibyte_hpt_name); 108static DEFINE_PER_CPU(char [18], sibyte_hpt_name);
109 109
110void __cpuinit sb1250_clockevent_init(void) 110void sb1250_clockevent_init(void)
111{ 111{
112 unsigned int cpu = smp_processor_id(); 112 unsigned int cpu = smp_processor_id();
113 unsigned int irq = K_INT_TIMER_0 + cpu; 113 unsigned int irq = K_INT_TIMER_0 + cpu;
diff --git a/arch/mips/kernel/cevt-smtc.c b/arch/mips/kernel/cevt-smtc.c
index 9de5ed7ef1a3..b6cf0a60d896 100644
--- a/arch/mips/kernel/cevt-smtc.c
+++ b/arch/mips/kernel/cevt-smtc.c
@@ -248,7 +248,7 @@ irqreturn_t c0_compare_interrupt(int irq, void *dev_id)
248} 248}
249 249
250 250
251int __cpuinit smtc_clockevent_init(void) 251int smtc_clockevent_init(void)
252{ 252{
253 uint64_t mips_freq = mips_hpt_frequency; 253 uint64_t mips_freq = mips_hpt_frequency;
254 unsigned int cpu = smp_processor_id(); 254 unsigned int cpu = smp_processor_id();
diff --git a/arch/mips/kernel/cpu-bugs64.c b/arch/mips/kernel/cpu-bugs64.c
index de3c25ffd9f9..2d80b5f1aeae 100644
--- a/arch/mips/kernel/cpu-bugs64.c
+++ b/arch/mips/kernel/cpu-bugs64.c
@@ -6,6 +6,7 @@
6 * as published by the Free Software Foundation; either version 6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version. 7 * 2 of the License, or (at your option) any later version.
8 */ 8 */
9#include <linux/context_tracking.h>
9#include <linux/init.h> 10#include <linux/init.h>
10#include <linux/kernel.h> 11#include <linux/kernel.h>
11#include <linux/ptrace.h> 12#include <linux/ptrace.h>
@@ -167,12 +168,16 @@ static inline void check_mult_sh(void)
167 panic(bug64hit, !R4000_WAR ? r4kwar : nowar); 168 panic(bug64hit, !R4000_WAR ? r4kwar : nowar);
168} 169}
169 170
170static volatile int daddi_ov __cpuinitdata; 171static volatile int daddi_ov;
171 172
172asmlinkage void __init do_daddi_ov(struct pt_regs *regs) 173asmlinkage void __init do_daddi_ov(struct pt_regs *regs)
173{ 174{
175 enum ctx_state prev_state;
176
177 prev_state = exception_enter();
174 daddi_ov = 1; 178 daddi_ov = 1;
175 regs->cp0_epc += 4; 179 regs->cp0_epc += 4;
180 exception_exit(prev_state);
176} 181}
177 182
178static inline void check_daddi(void) 183static inline void check_daddi(void)
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index c6568bf4b1b0..4c6167a17875 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -27,7 +27,7 @@
27#include <asm/spram.h> 27#include <asm/spram.h>
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29 29
30static int __cpuinitdata mips_fpu_disabled; 30static int mips_fpu_disabled;
31 31
32static int __init fpu_disable(char *s) 32static int __init fpu_disable(char *s)
33{ 33{
@@ -39,7 +39,7 @@ static int __init fpu_disable(char *s)
39 39
40__setup("nofpu", fpu_disable); 40__setup("nofpu", fpu_disable);
41 41
42int __cpuinitdata mips_dsp_disabled; 42int mips_dsp_disabled;
43 43
44static int __init dsp_disable(char *s) 44static int __init dsp_disable(char *s)
45{ 45{
@@ -134,7 +134,7 @@ static inline void cpu_probe_vmbits(struct cpuinfo_mips *c)
134#endif 134#endif
135} 135}
136 136
137static void __cpuinit set_isa(struct cpuinfo_mips *c, unsigned int isa) 137static void set_isa(struct cpuinfo_mips *c, unsigned int isa)
138{ 138{
139 switch (isa) { 139 switch (isa) {
140 case MIPS_CPU_ISA_M64R2: 140 case MIPS_CPU_ISA_M64R2:
@@ -146,8 +146,7 @@ static void __cpuinit set_isa(struct cpuinfo_mips *c, unsigned int isa)
146 case MIPS_CPU_ISA_IV: 146 case MIPS_CPU_ISA_IV:
147 c->isa_level |= MIPS_CPU_ISA_IV; 147 c->isa_level |= MIPS_CPU_ISA_IV;
148 case MIPS_CPU_ISA_III: 148 case MIPS_CPU_ISA_III:
149 c->isa_level |= MIPS_CPU_ISA_I | MIPS_CPU_ISA_II | 149 c->isa_level |= MIPS_CPU_ISA_II | MIPS_CPU_ISA_III;
150 MIPS_CPU_ISA_III;
151 break; 150 break;
152 151
153 case MIPS_CPU_ISA_M32R2: 152 case MIPS_CPU_ISA_M32R2:
@@ -156,13 +155,11 @@ static void __cpuinit set_isa(struct cpuinfo_mips *c, unsigned int isa)
156 c->isa_level |= MIPS_CPU_ISA_M32R1; 155 c->isa_level |= MIPS_CPU_ISA_M32R1;
157 case MIPS_CPU_ISA_II: 156 case MIPS_CPU_ISA_II:
158 c->isa_level |= MIPS_CPU_ISA_II; 157 c->isa_level |= MIPS_CPU_ISA_II;
159 case MIPS_CPU_ISA_I:
160 c->isa_level |= MIPS_CPU_ISA_I;
161 break; 158 break;
162 } 159 }
163} 160}
164 161
165static char unknown_isa[] __cpuinitdata = KERN_ERR \ 162static char unknown_isa[] = KERN_ERR \
166 "Unsupported ISA type, c0.config0: %d."; 163 "Unsupported ISA type, c0.config0: %d.";
167 164
168static inline unsigned int decode_config0(struct cpuinfo_mips *c) 165static inline unsigned int decode_config0(struct cpuinfo_mips *c)
@@ -272,9 +269,6 @@ static inline unsigned int decode_config3(struct cpuinfo_mips *c)
272 c->options |= MIPS_CPU_ULRI; 269 c->options |= MIPS_CPU_ULRI;
273 if (config3 & MIPS_CONF3_ISA) 270 if (config3 & MIPS_CONF3_ISA)
274 c->options |= MIPS_CPU_MICROMIPS; 271 c->options |= MIPS_CPU_MICROMIPS;
275#ifdef CONFIG_CPU_MICROMIPS
276 write_c0_config3(read_c0_config3() | MIPS_CONF3_ISA_OE);
277#endif
278 if (config3 & MIPS_CONF3_VZ) 272 if (config3 & MIPS_CONF3_VZ)
279 c->ases |= MIPS_ASE_VZ; 273 c->ases |= MIPS_ASE_VZ;
280 274
@@ -296,7 +290,7 @@ static inline unsigned int decode_config4(struct cpuinfo_mips *c)
296 return config4 & MIPS_CONF_M; 290 return config4 & MIPS_CONF_M;
297} 291}
298 292
299static void __cpuinit decode_configs(struct cpuinfo_mips *c) 293static void decode_configs(struct cpuinfo_mips *c)
300{ 294{
301 int ok; 295 int ok;
302 296
@@ -332,7 +326,6 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
332 case PRID_IMP_R2000: 326 case PRID_IMP_R2000:
333 c->cputype = CPU_R2000; 327 c->cputype = CPU_R2000;
334 __cpu_name[cpu] = "R2000"; 328 __cpu_name[cpu] = "R2000";
335 set_isa(c, MIPS_CPU_ISA_I);
336 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE | 329 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
337 MIPS_CPU_NOFPUEX; 330 MIPS_CPU_NOFPUEX;
338 if (__cpu_has_fpu()) 331 if (__cpu_has_fpu())
@@ -352,7 +345,6 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
352 c->cputype = CPU_R3000; 345 c->cputype = CPU_R3000;
353 __cpu_name[cpu] = "R3000"; 346 __cpu_name[cpu] = "R3000";
354 } 347 }
355 set_isa(c, MIPS_CPU_ISA_I);
356 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE | 348 c->options = MIPS_CPU_TLB | MIPS_CPU_3K_CACHE |
357 MIPS_CPU_NOFPUEX; 349 MIPS_CPU_NOFPUEX;
358 if (__cpu_has_fpu()) 350 if (__cpu_has_fpu())
@@ -455,7 +447,6 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
455 break; 447 break;
456 #endif 448 #endif
457 case PRID_IMP_TX39: 449 case PRID_IMP_TX39:
458 set_isa(c, MIPS_CPU_ISA_I);
459 c->options = MIPS_CPU_TLB | MIPS_CPU_TX39_CACHE; 450 c->options = MIPS_CPU_TLB | MIPS_CPU_TX39_CACHE;
460 451
461 if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) { 452 if ((c->processor_id & 0xf0) == (PRID_REV_TX3927 & 0xf0)) {
@@ -959,6 +950,7 @@ static inline void cpu_probe_netlogic(struct cpuinfo_mips *c, int cpu)
959 set_isa(c, MIPS_CPU_ISA_M64R1); 950 set_isa(c, MIPS_CPU_ISA_M64R1);
960 c->tlbsize = ((read_c0_config1() >> 25) & 0x3f) + 1; 951 c->tlbsize = ((read_c0_config1() >> 25) & 0x3f) + 1;
961 } 952 }
953 c->kscratch_mask = 0xf;
962} 954}
963 955
964#ifdef CONFIG_64BIT 956#ifdef CONFIG_64BIT
@@ -970,7 +962,7 @@ EXPORT_SYMBOL(__ua_limit);
970const char *__cpu_name[NR_CPUS]; 962const char *__cpu_name[NR_CPUS];
971const char *__elf_platform; 963const char *__elf_platform;
972 964
973__cpuinit void cpu_probe(void) 965void cpu_probe(void)
974{ 966{
975 struct cpuinfo_mips *c = &current_cpu_data; 967 struct cpuinfo_mips *c = &current_cpu_data;
976 unsigned int cpu = smp_processor_id(); 968 unsigned int cpu = smp_processor_id();
@@ -1055,7 +1047,7 @@ __cpuinit void cpu_probe(void)
1055#endif 1047#endif
1056} 1048}
1057 1049
1058__cpuinit void cpu_report(void) 1050void cpu_report(void)
1059{ 1051{
1060 struct cpuinfo_mips *c = &current_cpu_data; 1052 struct cpuinfo_mips *c = &current_cpu_data;
1061 1053
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index c61cdaed2b1d..7b6a5b3e3acf 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -28,45 +28,6 @@
28#include <kernel-entry-init.h> 28#include <kernel-entry-init.h>
29 29
30 /* 30 /*
31 * inputs are the text nasid in t1, data nasid in t2.
32 */
33 .macro MAPPED_KERNEL_SETUP_TLB
34#ifdef CONFIG_MAPPED_KERNEL
35 /*
36 * This needs to read the nasid - assume 0 for now.
37 * Drop in 0xffffffffc0000000 in tlbhi, 0+VG in tlblo_0,
38 * 0+DVG in tlblo_1.
39 */
40 dli t0, 0xffffffffc0000000
41 dmtc0 t0, CP0_ENTRYHI
42 li t0, 0x1c000 # Offset of text into node memory
43 dsll t1, NASID_SHFT # Shift text nasid into place
44 dsll t2, NASID_SHFT # Same for data nasid
45 or t1, t1, t0 # Physical load address of kernel text
46 or t2, t2, t0 # Physical load address of kernel data
47 dsrl t1, 12 # 4K pfn
48 dsrl t2, 12 # 4K pfn
49 dsll t1, 6 # Get pfn into place
50 dsll t2, 6 # Get pfn into place
51 li t0, ((_PAGE_GLOBAL|_PAGE_VALID| _CACHE_CACHABLE_COW) >> 6)
52 or t0, t0, t1
53 mtc0 t0, CP0_ENTRYLO0 # physaddr, VG, cach exlwr
54 li t0, ((_PAGE_GLOBAL|_PAGE_VALID| _PAGE_DIRTY|_CACHE_CACHABLE_COW) >> 6)
55 or t0, t0, t2
56 mtc0 t0, CP0_ENTRYLO1 # physaddr, DVG, cach exlwr
57 li t0, 0x1ffe000 # MAPPED_KERN_TLBMASK, TLBPGMASK_16M
58 mtc0 t0, CP0_PAGEMASK
59 li t0, 0 # KMAP_INX
60 mtc0 t0, CP0_INDEX
61 li t0, 1
62 mtc0 t0, CP0_WIRED
63 tlbwi
64#else
65 mtc0 zero, CP0_WIRED
66#endif
67 .endm
68
69 /*
70 * For the moment disable interrupts, mark the kernel mode and 31 * For the moment disable interrupts, mark the kernel mode and
71 * set ST0_KX so that the CPU does not spit fire when using 32 * set ST0_KX so that the CPU does not spit fire when using
72 * 64-bit addresses. A full initialization of the CPU's status 33 * 64-bit addresses. A full initialization of the CPU's status
@@ -197,8 +158,6 @@ NESTED(kernel_entry, 16, sp) # kernel entry point
197 j start_kernel 158 j start_kernel
198 END(kernel_entry) 159 END(kernel_entry)
199 160
200 __CPUINIT
201
202#ifdef CONFIG_SMP 161#ifdef CONFIG_SMP
203/* 162/*
204 * SMP slave cpus entry point. Board specific code for bootstrap calls this 163 * SMP slave cpus entry point. Board specific code for bootstrap calls this
@@ -227,5 +186,3 @@ NESTED(smp_bootstrap, 16, sp)
227 j start_secondary 186 j start_secondary
228 END(smp_bootstrap) 187 END(smp_bootstrap)
229#endif /* CONFIG_SMP */ 188#endif /* CONFIG_SMP */
230
231 __FINIT
diff --git a/arch/mips/kernel/irq-gic.c b/arch/mips/kernel/irq-gic.c
index c01b307317a9..5b5ddb231f26 100644
--- a/arch/mips/kernel/irq-gic.c
+++ b/arch/mips/kernel/irq-gic.c
@@ -219,16 +219,15 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *cpumask,
219 219
220 /* Assumption : cpumask refers to a single CPU */ 220 /* Assumption : cpumask refers to a single CPU */
221 spin_lock_irqsave(&gic_lock, flags); 221 spin_lock_irqsave(&gic_lock, flags);
222 for (;;) {
223 /* Re-route this IRQ */
224 GIC_SH_MAP_TO_VPE_SMASK(irq, first_cpu(tmp));
225 222
226 /* Update the pcpu_masks */ 223 /* Re-route this IRQ */
227 for (i = 0; i < NR_CPUS; i++) 224 GIC_SH_MAP_TO_VPE_SMASK(irq, first_cpu(tmp));
228 clear_bit(irq, pcpu_masks[i].pcpu_mask); 225
229 set_bit(irq, pcpu_masks[first_cpu(tmp)].pcpu_mask); 226 /* Update the pcpu_masks */
227 for (i = 0; i < NR_CPUS; i++)
228 clear_bit(irq, pcpu_masks[i].pcpu_mask);
229 set_bit(irq, pcpu_masks[first_cpu(tmp)].pcpu_mask);
230 230
231 }
232 cpumask_copy(d->affinity, cpumask); 231 cpumask_copy(d->affinity, cpumask);
233 spin_unlock_irqrestore(&gic_lock, flags); 232 spin_unlock_irqrestore(&gic_lock, flags);
234 233
diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
index 33d067148e61..a03e93c4a946 100644
--- a/arch/mips/kernel/mcount.S
+++ b/arch/mips/kernel/mcount.S
@@ -168,15 +168,11 @@ NESTED(ftrace_graph_caller, PT_SIZE, ra)
168#endif 168#endif
169 169
170 /* arg3: Get frame pointer of current stack */ 170 /* arg3: Get frame pointer of current stack */
171#ifdef CONFIG_FRAME_POINTER
172 move a2, fp
173#else /* ! CONFIG_FRAME_POINTER */
174#ifdef CONFIG_64BIT 171#ifdef CONFIG_64BIT
175 PTR_LA a2, PT_SIZE(sp) 172 PTR_LA a2, PT_SIZE(sp)
176#else 173#else
177 PTR_LA a2, (PT_SIZE+8)(sp) 174 PTR_LA a2, (PT_SIZE+8)(sp)
178#endif 175#endif
179#endif
180 176
181 jal prepare_ftrace_return 177 jal prepare_ftrace_return
182 nop 178 nop
diff --git a/arch/mips/kernel/octeon_switch.S b/arch/mips/kernel/octeon_switch.S
index 0e23343eb0a9..4204d76af854 100644
--- a/arch/mips/kernel/octeon_switch.S
+++ b/arch/mips/kernel/octeon_switch.S
@@ -40,33 +40,6 @@
40 cpu_save_nonscratch a0 40 cpu_save_nonscratch a0
41 LONG_S ra, THREAD_REG31(a0) 41 LONG_S ra, THREAD_REG31(a0)
42 42
43 /* check if we need to save COP2 registers */
44 PTR_L t2, TASK_THREAD_INFO(a0)
45 LONG_L t0, ST_OFF(t2)
46 bbit0 t0, 30, 1f
47
48 /* Disable COP2 in the stored process state */
49 li t1, ST0_CU2
50 xor t0, t1
51 LONG_S t0, ST_OFF(t2)
52
53 /* Enable COP2 so we can save it */
54 mfc0 t0, CP0_STATUS
55 or t0, t1
56 mtc0 t0, CP0_STATUS
57
58 /* Save COP2 */
59 daddu a0, THREAD_CP2
60 jal octeon_cop2_save
61 dsubu a0, THREAD_CP2
62
63 /* Disable COP2 now that we are done */
64 mfc0 t0, CP0_STATUS
65 li t1, ST0_CU2
66 xor t0, t1
67 mtc0 t0, CP0_STATUS
68
691:
70#if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0 43#if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0
71 /* Check if we need to store CVMSEG state */ 44 /* Check if we need to store CVMSEG state */
72 mfc0 t0, $11,7 /* CvmMemCtl */ 45 mfc0 t0, $11,7 /* CvmMemCtl */
@@ -98,6 +71,13 @@
98 mtc0 t0, $11,7 /* CvmMemCtl */ 71 mtc0 t0, $11,7 /* CvmMemCtl */
99#endif 72#endif
1003: 733:
74
75#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
76 PTR_L t8, __stack_chk_guard
77 LONG_L t9, TASK_STACK_CANARY(a1)
78 LONG_S t9, 0(t8)
79#endif
80
101 /* 81 /*
102 * The order of restoring the registers takes care of the race 82 * The order of restoring the registers takes care of the race
103 * updating $28, $29 and kernelsp without disabling ints. 83 * updating $28, $29 and kernelsp without disabling ints.
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index acb34373679e..8c58d8a84bf3 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -66,9 +66,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
66 seq_printf(m, "]\n"); 66 seq_printf(m, "]\n");
67 } 67 }
68 if (cpu_has_mips_r) { 68 if (cpu_has_mips_r) {
69 seq_printf(m, "isa\t\t\t:"); 69 seq_printf(m, "isa\t\t\t: mips1");
70 if (cpu_has_mips_1)
71 seq_printf(m, "%s", " mips1");
72 if (cpu_has_mips_2) 70 if (cpu_has_mips_2)
73 seq_printf(m, "%s", " mips2"); 71 seq_printf(m, "%s", " mips2");
74 if (cpu_has_mips_3) 72 if (cpu_has_mips_3)
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index c6a041d9d05d..ddc76103e78c 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -201,9 +201,12 @@ int dump_task_fpu(struct task_struct *t, elf_fpregset_t *fpr)
201 return 1; 201 return 1;
202} 202}
203 203
204/* 204#ifdef CONFIG_CC_STACKPROTECTOR
205 * 205#include <linux/stackprotector.h>
206 */ 206unsigned long __stack_chk_guard __read_mostly;
207EXPORT_SYMBOL(__stack_chk_guard);
208#endif
209
207struct mips_frame_info { 210struct mips_frame_info {
208 void *func; 211 void *func;
209 unsigned long func_size; 212 unsigned long func_size;
diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
index 5712bb532245..7e954042f252 100644
--- a/arch/mips/kernel/prom.c
+++ b/arch/mips/kernel/prom.c
@@ -30,7 +30,7 @@ __init void mips_set_machine_name(const char *name)
30 if (name == NULL) 30 if (name == NULL)
31 return; 31 return;
32 32
33 strncpy(mips_machine_name, name, sizeof(mips_machine_name)); 33 strlcpy(mips_machine_name, name, sizeof(mips_machine_name));
34 pr_info("MIPS: machine is %s\n", mips_get_machine_name()); 34 pr_info("MIPS: machine is %s\n", mips_get_machine_name());
35} 35}
36 36
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 9c6299c733a3..8ae1ebef8b71 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -15,6 +15,7 @@
15 * binaries. 15 * binaries.
16 */ 16 */
17#include <linux/compiler.h> 17#include <linux/compiler.h>
18#include <linux/context_tracking.h>
18#include <linux/kernel.h> 19#include <linux/kernel.h>
19#include <linux/sched.h> 20#include <linux/sched.h>
20#include <linux/mm.h> 21#include <linux/mm.h>
@@ -534,6 +535,8 @@ static inline int audit_arch(void)
534 */ 535 */
535asmlinkage void syscall_trace_enter(struct pt_regs *regs) 536asmlinkage void syscall_trace_enter(struct pt_regs *regs)
536{ 537{
538 user_exit();
539
537 /* do the secure computing check first */ 540 /* do the secure computing check first */
538 secure_computing_strict(regs->regs[2]); 541 secure_computing_strict(regs->regs[2]);
539 542
@@ -570,6 +573,13 @@ out:
570 */ 573 */
571asmlinkage void syscall_trace_leave(struct pt_regs *regs) 574asmlinkage void syscall_trace_leave(struct pt_regs *regs)
572{ 575{
576 /*
577 * We may come here right after calling schedule_user()
578 * or do_notify_resume(), in which case we can be in RCU
579 * user mode.
580 */
581 user_exit();
582
573 audit_syscall_exit(regs); 583 audit_syscall_exit(regs);
574 584
575 if (!(current->ptrace & PT_PTRACED)) 585 if (!(current->ptrace & PT_PTRACED))
@@ -592,4 +602,6 @@ asmlinkage void syscall_trace_leave(struct pt_regs *regs)
592 send_sig(current->exit_code, current, 1); 602 send_sig(current->exit_code, current, 1);
593 current->exit_code = 0; 603 current->exit_code = 0;
594 } 604 }
605
606 user_enter();
595} 607}
diff --git a/arch/mips/kernel/r2300_switch.S b/arch/mips/kernel/r2300_switch.S
index 5266c6ee2b35..38af83f84c4a 100644
--- a/arch/mips/kernel/r2300_switch.S
+++ b/arch/mips/kernel/r2300_switch.S
@@ -65,6 +65,13 @@ LEAF(resume)
65 fpu_save_single a0, t0 # clobbers t0 65 fpu_save_single a0, t0 # clobbers t0
66 66
671: 671:
68
69#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
70 PTR_L t8, __stack_chk_guard
71 LONG_L t9, TASK_STACK_CANARY(a1)
72 LONG_S t9, 0(t8)
73#endif
74
68 /* 75 /*
69 * The order of restoring the registers takes care of the race 76 * The order of restoring the registers takes care of the race
70 * updating $28, $29 and kernelsp without disabling ints. 77 * updating $28, $29 and kernelsp without disabling ints.
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index 5e51219990aa..921238a6bd26 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -68,6 +68,12 @@
68 # clobbers t1 68 # clobbers t1
691: 691:
70 70
71#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
72 PTR_L t8, __stack_chk_guard
73 LONG_L t9, TASK_STACK_CANARY(a1)
74 LONG_S t9, 0(t8)
75#endif
76
71 /* 77 /*
72 * The order of restoring the registers takes care of the race 78 * The order of restoring the registers takes care of the race
73 * updating $28, $29 and kernelsp without disabling ints. 79 * updating $28, $29 and kernelsp without disabling ints.
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index 6fa198db8999..d763f11e35e2 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -437,7 +437,6 @@ static ssize_t file_write(struct file *file, const char __user * buffer,
437 size_t count, loff_t * ppos) 437 size_t count, loff_t * ppos)
438{ 438{
439 int minor = iminor(file_inode(file)); 439 int minor = iminor(file_inode(file));
440 struct rtlx_channel *rt = &rtlx->channel[minor];
441 440
442 /* any space left... */ 441 /* any space left... */
443 if (!rtlx_write_poll(minor)) { 442 if (!rtlx_write_poll(minor)) {
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index e9127ec612ef..e774bb1088b5 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -52,7 +52,7 @@ NESTED(handle_sys, PT_SIZE, sp)
52 52
53stack_done: 53stack_done:
54 lw t0, TI_FLAGS($28) # syscall tracing enabled? 54 lw t0, TI_FLAGS($28) # syscall tracing enabled?
55 li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT 55 li t1, _TIF_WORK_SYSCALL_ENTRY
56 and t0, t1 56 and t0, t1
57 bnez t0, syscall_trace_entry # -> yes 57 bnez t0, syscall_trace_entry # -> yes
58 58
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 97a5909a61cf..be6627ead619 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -54,7 +54,7 @@ NESTED(handle_sys64, PT_SIZE, sp)
54 54
55 sd a3, PT_R26(sp) # save a3 for syscall restarting 55 sd a3, PT_R26(sp) # save a3 for syscall restarting
56 56
57 li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT 57 li t1, _TIF_WORK_SYSCALL_ENTRY
58 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled? 58 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled?
59 and t0, t1, t0 59 and t0, t1, t0
60 bnez t0, syscall_trace_entry 60 bnez t0, syscall_trace_entry
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index edcb6594e7b5..cab150789c8d 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -47,7 +47,7 @@ NESTED(handle_sysn32, PT_SIZE, sp)
47 47
48 sd a3, PT_R26(sp) # save a3 for syscall restarting 48 sd a3, PT_R26(sp) # save a3 for syscall restarting
49 49
50 li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT 50 li t1, _TIF_WORK_SYSCALL_ENTRY
51 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled? 51 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled?
52 and t0, t1, t0 52 and t0, t1, t0
53 bnez t0, n32_syscall_trace_entry 53 bnez t0, n32_syscall_trace_entry
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 74f485d3c0ef..37605dc8eef7 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -81,7 +81,7 @@ NESTED(handle_sys, PT_SIZE, sp)
81 PTR 4b, bad_stack 81 PTR 4b, bad_stack
82 .previous 82 .previous
83 83
84 li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT 84 li t1, _TIF_WORK_SYSCALL_ENTRY
85 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled? 85 LONG_L t0, TI_FLAGS($28) # syscall tracing enabled?
86 and t0, t1, t0 86 and t0, t1, t0
87 bnez t0, trace_a_syscall 87 bnez t0, trace_a_syscall
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index fd3ef2c2afbc..2f285abc76d5 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -8,6 +8,7 @@
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 */ 9 */
10#include <linux/cache.h> 10#include <linux/cache.h>
11#include <linux/context_tracking.h>
11#include <linux/irqflags.h> 12#include <linux/irqflags.h>
12#include <linux/sched.h> 13#include <linux/sched.h>
13#include <linux/mm.h> 14#include <linux/mm.h>
@@ -573,6 +574,8 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused,
573{ 574{
574 local_irq_enable(); 575 local_irq_enable();
575 576
577 user_exit();
578
576 /* deal with pending signal delivery */ 579 /* deal with pending signal delivery */
577 if (thread_info_flags & _TIF_SIGPENDING) 580 if (thread_info_flags & _TIF_SIGPENDING)
578 do_signal(regs); 581 do_signal(regs);
@@ -581,6 +584,8 @@ asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused,
581 clear_thread_flag(TIF_NOTIFY_RESUME); 584 clear_thread_flag(TIF_NOTIFY_RESUME);
582 tracehook_notify_resume(regs); 585 tracehook_notify_resume(regs);
583 } 586 }
587
588 user_enter();
584} 589}
585 590
586#ifdef CONFIG_SMP 591#ifdef CONFIG_SMP
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index 8e393b8443f7..c0bb4d59076a 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -63,7 +63,7 @@ static irqreturn_t bmips_ipi_interrupt(int irq, void *dev_id);
63 63
64static void __init bmips_smp_setup(void) 64static void __init bmips_smp_setup(void)
65{ 65{
66 int i; 66 int i, cpu = 1, boot_cpu = 0;
67 67
68#if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380) 68#if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380)
69 /* arbitration priority */ 69 /* arbitration priority */
@@ -72,13 +72,22 @@ static void __init bmips_smp_setup(void)
72 /* NBK and weak order flags */ 72 /* NBK and weak order flags */
73 set_c0_brcm_config_0(0x30000); 73 set_c0_brcm_config_0(0x30000);
74 74
75 /* Find out if we are running on TP0 or TP1 */
76 boot_cpu = !!(read_c0_brcm_cmt_local() & (1 << 31));
77
75 /* 78 /*
76 * MIPS interrupts 0,1 (SW INT 0,1) cross over to the other thread 79 * MIPS interrupts 0,1 (SW INT 0,1) cross over to the other thread
77 * MIPS interrupt 2 (HW INT 0) is the CPU0 L1 controller output 80 * MIPS interrupt 2 (HW INT 0) is the CPU0 L1 controller output
78 * MIPS interrupt 3 (HW INT 1) is the CPU1 L1 controller output 81 * MIPS interrupt 3 (HW INT 1) is the CPU1 L1 controller output
82 *
83 * If booting from TP1, leave the existing CMT interrupt routing
84 * such that TP0 responds to SW1 and TP1 responds to SW0.
79 */ 85 */
80 change_c0_brcm_cmt_intr(0xf8018000, 86 if (boot_cpu == 0)
81 (0x02 << 27) | (0x03 << 15)); 87 change_c0_brcm_cmt_intr(0xf8018000,
88 (0x02 << 27) | (0x03 << 15));
89 else
90 change_c0_brcm_cmt_intr(0xf8018000, (0x1d << 27));
82 91
83 /* single core, 2 threads (2 pipelines) */ 92 /* single core, 2 threads (2 pipelines) */
84 max_cpus = 2; 93 max_cpus = 2;
@@ -106,9 +115,15 @@ static void __init bmips_smp_setup(void)
106 if (!board_ebase_setup) 115 if (!board_ebase_setup)
107 board_ebase_setup = &bmips_ebase_setup; 116 board_ebase_setup = &bmips_ebase_setup;
108 117
118 __cpu_number_map[boot_cpu] = 0;
119 __cpu_logical_map[0] = boot_cpu;
120
109 for (i = 0; i < max_cpus; i++) { 121 for (i = 0; i < max_cpus; i++) {
110 __cpu_number_map[i] = 1; 122 if (i != boot_cpu) {
111 __cpu_logical_map[i] = 1; 123 __cpu_number_map[i] = cpu;
124 __cpu_logical_map[cpu] = i;
125 cpu++;
126 }
112 set_cpu_possible(i, 1); 127 set_cpu_possible(i, 1);
113 set_cpu_present(i, 1); 128 set_cpu_present(i, 1);
114 } 129 }
@@ -157,7 +172,9 @@ static void bmips_boot_secondary(int cpu, struct task_struct *idle)
157 bmips_send_ipi_single(cpu, 0); 172 bmips_send_ipi_single(cpu, 0);
158 else { 173 else {
159#if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380) 174#if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380)
160 set_c0_brcm_cmt_ctrl(0x01); 175 /* Reset slave TP1 if booting from TP0 */
176 if (cpu_logical_map(cpu) == 1)
177 set_c0_brcm_cmt_ctrl(0x01);
161#elif defined(CONFIG_CPU_BMIPS5000) 178#elif defined(CONFIG_CPU_BMIPS5000)
162 if (cpu & 0x01) 179 if (cpu & 0x01)
163 write_c0_brcm_action(ACTION_BOOT_THREAD(cpu)); 180 write_c0_brcm_action(ACTION_BOOT_THREAD(cpu));
@@ -381,7 +398,7 @@ struct plat_smp_ops bmips_smp_ops = {
381 * UP BMIPS systems as well. 398 * UP BMIPS systems as well.
382 ***********************************************************************/ 399 ***********************************************************************/
383 400
384static void __cpuinit bmips_wr_vec(unsigned long dst, char *start, char *end) 401static void bmips_wr_vec(unsigned long dst, char *start, char *end)
385{ 402{
386 memcpy((void *)dst, start, end - start); 403 memcpy((void *)dst, start, end - start);
387 dma_cache_wback((unsigned long)start, end - start); 404 dma_cache_wback((unsigned long)start, end - start);
@@ -389,7 +406,7 @@ static void __cpuinit bmips_wr_vec(unsigned long dst, char *start, char *end)
389 instruction_hazard(); 406 instruction_hazard();
390} 407}
391 408
392static inline void __cpuinit bmips_nmi_handler_setup(void) 409static inline void bmips_nmi_handler_setup(void)
393{ 410{
394 bmips_wr_vec(BMIPS_NMI_RESET_VEC, &bmips_reset_nmi_vec, 411 bmips_wr_vec(BMIPS_NMI_RESET_VEC, &bmips_reset_nmi_vec,
395 &bmips_reset_nmi_vec_end); 412 &bmips_reset_nmi_vec_end);
@@ -397,7 +414,7 @@ static inline void __cpuinit bmips_nmi_handler_setup(void)
397 &bmips_smp_int_vec_end); 414 &bmips_smp_int_vec_end);
398} 415}
399 416
400void __cpuinit bmips_ebase_setup(void) 417void bmips_ebase_setup(void)
401{ 418{
402 unsigned long new_ebase = ebase; 419 unsigned long new_ebase = ebase;
403 void __iomem __maybe_unused *cbr; 420 void __iomem __maybe_unused *cbr;
diff --git a/arch/mips/kernel/smp-mt.c b/arch/mips/kernel/smp-mt.c
index 3e5164c11cac..57a3f7a2b370 100644
--- a/arch/mips/kernel/smp-mt.c
+++ b/arch/mips/kernel/smp-mt.c
@@ -149,7 +149,7 @@ static void vsmp_send_ipi_mask(const struct cpumask *mask, unsigned int action)
149 vsmp_send_ipi_single(i, action); 149 vsmp_send_ipi_single(i, action);
150} 150}
151 151
152static void __cpuinit vsmp_init_secondary(void) 152static void vsmp_init_secondary(void)
153{ 153{
154#ifdef CONFIG_IRQ_GIC 154#ifdef CONFIG_IRQ_GIC
155 /* This is Malta specific: IPI,performance and timer interrupts */ 155 /* This is Malta specific: IPI,performance and timer interrupts */
@@ -162,7 +162,7 @@ static void __cpuinit vsmp_init_secondary(void)
162 STATUSF_IP6 | STATUSF_IP7); 162 STATUSF_IP6 | STATUSF_IP7);
163} 163}
164 164
165static void __cpuinit vsmp_smp_finish(void) 165static void vsmp_smp_finish(void)
166{ 166{
167 /* CDFIXME: remove this? */ 167 /* CDFIXME: remove this? */
168 write_c0_compare(read_c0_count() + (8* mips_hpt_frequency/HZ)); 168 write_c0_compare(read_c0_count() + (8* mips_hpt_frequency/HZ));
@@ -188,7 +188,7 @@ static void vsmp_cpus_done(void)
188 * (unsigned long)idle->thread_info the gp 188 * (unsigned long)idle->thread_info the gp
189 * assumes a 1:1 mapping of TC => VPE 189 * assumes a 1:1 mapping of TC => VPE
190 */ 190 */
191static void __cpuinit vsmp_boot_secondary(int cpu, struct task_struct *idle) 191static void vsmp_boot_secondary(int cpu, struct task_struct *idle)
192{ 192{
193 struct thread_info *gp = task_thread_info(idle); 193 struct thread_info *gp = task_thread_info(idle);
194 dvpe(); 194 dvpe();
diff --git a/arch/mips/kernel/smp-up.c b/arch/mips/kernel/smp-up.c
index 00500fea2750..7fde3e4d978f 100644
--- a/arch/mips/kernel/smp-up.c
+++ b/arch/mips/kernel/smp-up.c
@@ -28,11 +28,11 @@ static inline void up_send_ipi_mask(const struct cpumask *mask,
28 * After we've done initial boot, this function is called to allow the 28 * After we've done initial boot, this function is called to allow the
29 * board code to clean up state, if needed 29 * board code to clean up state, if needed
30 */ 30 */
31static void __cpuinit up_init_secondary(void) 31static void up_init_secondary(void)
32{ 32{
33} 33}
34 34
35static void __cpuinit up_smp_finish(void) 35static void up_smp_finish(void)
36{ 36{
37} 37}
38 38
@@ -44,7 +44,7 @@ static void up_cpus_done(void)
44/* 44/*
45 * Firmware CPU startup hook 45 * Firmware CPU startup hook
46 */ 46 */
47static void __cpuinit up_boot_secondary(int cpu, struct task_struct *idle) 47static void up_boot_secondary(int cpu, struct task_struct *idle)
48{ 48{
49} 49}
50 50
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 6e7862ab46cc..5c208ed8f856 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -86,7 +86,7 @@ static inline void set_cpu_sibling_map(int cpu)
86struct plat_smp_ops *mp_ops; 86struct plat_smp_ops *mp_ops;
87EXPORT_SYMBOL(mp_ops); 87EXPORT_SYMBOL(mp_ops);
88 88
89__cpuinit void register_smp_ops(struct plat_smp_ops *ops) 89void register_smp_ops(struct plat_smp_ops *ops)
90{ 90{
91 if (mp_ops) 91 if (mp_ops)
92 printk(KERN_WARNING "Overriding previously set SMP ops\n"); 92 printk(KERN_WARNING "Overriding previously set SMP ops\n");
@@ -98,7 +98,7 @@ __cpuinit void register_smp_ops(struct plat_smp_ops *ops)
98 * First C code run on the secondary CPUs after being started up by 98 * First C code run on the secondary CPUs after being started up by
99 * the master. 99 * the master.
100 */ 100 */
101asmlinkage __cpuinit void start_secondary(void) 101asmlinkage void start_secondary(void)
102{ 102{
103 unsigned int cpu; 103 unsigned int cpu;
104 104
@@ -197,7 +197,7 @@ void smp_prepare_boot_cpu(void)
197 cpu_set(0, cpu_callin_map); 197 cpu_set(0, cpu_callin_map);
198} 198}
199 199
200int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) 200int __cpu_up(unsigned int cpu, struct task_struct *tidle)
201{ 201{
202 mp_ops->boot_secondary(cpu, tidle); 202 mp_ops->boot_secondary(cpu, tidle);
203 203
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index 75a4fd709841..dfc1b911be04 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -645,7 +645,7 @@ void smtc_prepare_cpus(int cpus)
645 * (unsigned long)idle->thread_info the gp 645 * (unsigned long)idle->thread_info the gp
646 * 646 *
647 */ 647 */
648void __cpuinit smtc_boot_secondary(int cpu, struct task_struct *idle) 648void smtc_boot_secondary(int cpu, struct task_struct *idle)
649{ 649{
650 extern u32 kernelsp[NR_CPUS]; 650 extern u32 kernelsp[NR_CPUS];
651 unsigned long flags; 651 unsigned long flags;
diff --git a/arch/mips/kernel/spram.c b/arch/mips/kernel/spram.c
index 6af08d896e20..93f86817f20a 100644
--- a/arch/mips/kernel/spram.c
+++ b/arch/mips/kernel/spram.c
@@ -37,7 +37,7 @@
37/* 37/*
38 * Different semantics to the set_c0_* function built by __BUILD_SET_C0 38 * Different semantics to the set_c0_* function built by __BUILD_SET_C0
39 */ 39 */
40static __cpuinit unsigned int bis_c0_errctl(unsigned int set) 40static unsigned int bis_c0_errctl(unsigned int set)
41{ 41{
42 unsigned int res; 42 unsigned int res;
43 res = read_c0_errctl(); 43 res = read_c0_errctl();
@@ -45,7 +45,7 @@ static __cpuinit unsigned int bis_c0_errctl(unsigned int set)
45 return res; 45 return res;
46} 46}
47 47
48static __cpuinit void ispram_store_tag(unsigned int offset, unsigned int data) 48static void ispram_store_tag(unsigned int offset, unsigned int data)
49{ 49{
50 unsigned int errctl; 50 unsigned int errctl;
51 51
@@ -64,7 +64,7 @@ static __cpuinit void ispram_store_tag(unsigned int offset, unsigned int data)
64} 64}
65 65
66 66
67static __cpuinit unsigned int ispram_load_tag(unsigned int offset) 67static unsigned int ispram_load_tag(unsigned int offset)
68{ 68{
69 unsigned int data; 69 unsigned int data;
70 unsigned int errctl; 70 unsigned int errctl;
@@ -82,7 +82,7 @@ static __cpuinit unsigned int ispram_load_tag(unsigned int offset)
82 return data; 82 return data;
83} 83}
84 84
85static __cpuinit void dspram_store_tag(unsigned int offset, unsigned int data) 85static void dspram_store_tag(unsigned int offset, unsigned int data)
86{ 86{
87 unsigned int errctl; 87 unsigned int errctl;
88 88
@@ -98,7 +98,7 @@ static __cpuinit void dspram_store_tag(unsigned int offset, unsigned int data)
98} 98}
99 99
100 100
101static __cpuinit unsigned int dspram_load_tag(unsigned int offset) 101static unsigned int dspram_load_tag(unsigned int offset)
102{ 102{
103 unsigned int data; 103 unsigned int data;
104 unsigned int errctl; 104 unsigned int errctl;
@@ -115,7 +115,7 @@ static __cpuinit unsigned int dspram_load_tag(unsigned int offset)
115 return data; 115 return data;
116} 116}
117 117
118static __cpuinit void probe_spram(char *type, 118static void probe_spram(char *type,
119 unsigned int base, 119 unsigned int base,
120 unsigned int (*read)(unsigned int), 120 unsigned int (*read)(unsigned int),
121 void (*write)(unsigned int, unsigned int)) 121 void (*write)(unsigned int, unsigned int))
@@ -196,7 +196,7 @@ static __cpuinit void probe_spram(char *type,
196 offset += 2 * SPRAM_TAG_STRIDE; 196 offset += 2 * SPRAM_TAG_STRIDE;
197 } 197 }
198} 198}
199void __cpuinit spram_config(void) 199void spram_config(void)
200{ 200{
201 struct cpuinfo_mips *c = &current_cpu_data; 201 struct cpuinfo_mips *c = &current_cpu_data;
202 unsigned int config0; 202 unsigned int config0;
diff --git a/arch/mips/kernel/sync-r4k.c b/arch/mips/kernel/sync-r4k.c
index 1ff43d5ac2c4..84536bf4a154 100644
--- a/arch/mips/kernel/sync-r4k.c
+++ b/arch/mips/kernel/sync-r4k.c
@@ -20,15 +20,15 @@
20#include <asm/barrier.h> 20#include <asm/barrier.h>
21#include <asm/mipsregs.h> 21#include <asm/mipsregs.h>
22 22
23static atomic_t __cpuinitdata count_start_flag = ATOMIC_INIT(0); 23static atomic_t count_start_flag = ATOMIC_INIT(0);
24static atomic_t __cpuinitdata count_count_start = ATOMIC_INIT(0); 24static atomic_t count_count_start = ATOMIC_INIT(0);
25static atomic_t __cpuinitdata count_count_stop = ATOMIC_INIT(0); 25static atomic_t count_count_stop = ATOMIC_INIT(0);
26static atomic_t __cpuinitdata count_reference = ATOMIC_INIT(0); 26static atomic_t count_reference = ATOMIC_INIT(0);
27 27
28#define COUNTON 100 28#define COUNTON 100
29#define NR_LOOPS 5 29#define NR_LOOPS 5
30 30
31void __cpuinit synchronise_count_master(int cpu) 31void synchronise_count_master(int cpu)
32{ 32{
33 int i; 33 int i;
34 unsigned long flags; 34 unsigned long flags;
@@ -106,7 +106,7 @@ void __cpuinit synchronise_count_master(int cpu)
106 printk("done.\n"); 106 printk("done.\n");
107} 107}
108 108
109void __cpuinit synchronise_count_slave(int cpu) 109void synchronise_count_slave(int cpu)
110{ 110{
111 int i; 111 int i;
112 unsigned int initcount; 112 unsigned int initcount;
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index a75ae40184aa..aec3408edd4b 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -13,6 +13,7 @@
13 */ 13 */
14#include <linux/bug.h> 14#include <linux/bug.h>
15#include <linux/compiler.h> 15#include <linux/compiler.h>
16#include <linux/context_tracking.h>
16#include <linux/kexec.h> 17#include <linux/kexec.h>
17#include <linux/init.h> 18#include <linux/init.h>
18#include <linux/kernel.h> 19#include <linux/kernel.h>
@@ -89,7 +90,7 @@ void (*board_nmi_handler_setup)(void);
89void (*board_ejtag_handler_setup)(void); 90void (*board_ejtag_handler_setup)(void);
90void (*board_bind_eic_interrupt)(int irq, int regset); 91void (*board_bind_eic_interrupt)(int irq, int regset);
91void (*board_ebase_setup)(void); 92void (*board_ebase_setup)(void);
92void __cpuinitdata(*board_cache_error_setup)(void); 93void(*board_cache_error_setup)(void);
93 94
94static void show_raw_backtrace(unsigned long reg29) 95static void show_raw_backtrace(unsigned long reg29)
95{ 96{
@@ -264,7 +265,7 @@ static void __show_regs(const struct pt_regs *regs)
264 265
265 printk("Status: %08x ", (uint32_t) regs->cp0_status); 266 printk("Status: %08x ", (uint32_t) regs->cp0_status);
266 267
267 if (current_cpu_data.isa_level == MIPS_CPU_ISA_I) { 268 if (cpu_has_3kex) {
268 if (regs->cp0_status & ST0_KUO) 269 if (regs->cp0_status & ST0_KUO)
269 printk("KUo "); 270 printk("KUo ");
270 if (regs->cp0_status & ST0_IEO) 271 if (regs->cp0_status & ST0_IEO)
@@ -277,7 +278,7 @@ static void __show_regs(const struct pt_regs *regs)
277 printk("KUc "); 278 printk("KUc ");
278 if (regs->cp0_status & ST0_IEC) 279 if (regs->cp0_status & ST0_IEC)
279 printk("IEc "); 280 printk("IEc ");
280 } else { 281 } else if (cpu_has_4kex) {
281 if (regs->cp0_status & ST0_KX) 282 if (regs->cp0_status & ST0_KX)
282 printk("KX "); 283 printk("KX ");
283 if (regs->cp0_status & ST0_SX) 284 if (regs->cp0_status & ST0_SX)
@@ -423,7 +424,9 @@ asmlinkage void do_be(struct pt_regs *regs)
423 const struct exception_table_entry *fixup = NULL; 424 const struct exception_table_entry *fixup = NULL;
424 int data = regs->cp0_cause & 4; 425 int data = regs->cp0_cause & 4;
425 int action = MIPS_BE_FATAL; 426 int action = MIPS_BE_FATAL;
427 enum ctx_state prev_state;
426 428
429 prev_state = exception_enter();
427 /* XXX For now. Fixme, this searches the wrong table ... */ 430 /* XXX For now. Fixme, this searches the wrong table ... */
428 if (data && !user_mode(regs)) 431 if (data && !user_mode(regs))
429 fixup = search_dbe_tables(exception_epc(regs)); 432 fixup = search_dbe_tables(exception_epc(regs));
@@ -436,11 +439,11 @@ asmlinkage void do_be(struct pt_regs *regs)
436 439
437 switch (action) { 440 switch (action) {
438 case MIPS_BE_DISCARD: 441 case MIPS_BE_DISCARD:
439 return; 442 goto out;
440 case MIPS_BE_FIXUP: 443 case MIPS_BE_FIXUP:
441 if (fixup) { 444 if (fixup) {
442 regs->cp0_epc = fixup->nextinsn; 445 regs->cp0_epc = fixup->nextinsn;
443 return; 446 goto out;
444 } 447 }
445 break; 448 break;
446 default: 449 default:
@@ -455,10 +458,13 @@ asmlinkage void do_be(struct pt_regs *regs)
455 field, regs->cp0_epc, field, regs->regs[31]); 458 field, regs->cp0_epc, field, regs->regs[31]);
456 if (notify_die(DIE_OOPS, "bus error", regs, 0, regs_to_trapnr(regs), SIGBUS) 459 if (notify_die(DIE_OOPS, "bus error", regs, 0, regs_to_trapnr(regs), SIGBUS)
457 == NOTIFY_STOP) 460 == NOTIFY_STOP)
458 return; 461 goto out;
459 462
460 die_if_kernel("Oops", regs); 463 die_if_kernel("Oops", regs);
461 force_sig(SIGBUS, current); 464 force_sig(SIGBUS, current);
465
466out:
467 exception_exit(prev_state);
462} 468}
463 469
464/* 470/*
@@ -673,8 +679,10 @@ static int simulate_sync(struct pt_regs *regs, unsigned int opcode)
673 679
674asmlinkage void do_ov(struct pt_regs *regs) 680asmlinkage void do_ov(struct pt_regs *regs)
675{ 681{
682 enum ctx_state prev_state;
676 siginfo_t info; 683 siginfo_t info;
677 684
685 prev_state = exception_enter();
678 die_if_kernel("Integer overflow", regs); 686 die_if_kernel("Integer overflow", regs);
679 687
680 info.si_code = FPE_INTOVF; 688 info.si_code = FPE_INTOVF;
@@ -682,6 +690,7 @@ asmlinkage void do_ov(struct pt_regs *regs)
682 info.si_errno = 0; 690 info.si_errno = 0;
683 info.si_addr = (void __user *) regs->cp0_epc; 691 info.si_addr = (void __user *) regs->cp0_epc;
684 force_sig_info(SIGFPE, &info, current); 692 force_sig_info(SIGFPE, &info, current);
693 exception_exit(prev_state);
685} 694}
686 695
687int process_fpemu_return(int sig, void __user *fault_addr) 696int process_fpemu_return(int sig, void __user *fault_addr)
@@ -713,11 +722,13 @@ int process_fpemu_return(int sig, void __user *fault_addr)
713 */ 722 */
714asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31) 723asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
715{ 724{
725 enum ctx_state prev_state;
716 siginfo_t info = {0}; 726 siginfo_t info = {0};
717 727
728 prev_state = exception_enter();
718 if (notify_die(DIE_FP, "FP exception", regs, 0, regs_to_trapnr(regs), SIGFPE) 729 if (notify_die(DIE_FP, "FP exception", regs, 0, regs_to_trapnr(regs), SIGFPE)
719 == NOTIFY_STOP) 730 == NOTIFY_STOP)
720 return; 731 goto out;
721 die_if_kernel("FP exception in kernel code", regs); 732 die_if_kernel("FP exception in kernel code", regs);
722 733
723 if (fcr31 & FPU_CSR_UNI_X) { 734 if (fcr31 & FPU_CSR_UNI_X) {
@@ -753,7 +764,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
753 /* If something went wrong, signal */ 764 /* If something went wrong, signal */
754 process_fpemu_return(sig, fault_addr); 765 process_fpemu_return(sig, fault_addr);
755 766
756 return; 767 goto out;
757 } else if (fcr31 & FPU_CSR_INV_X) 768 } else if (fcr31 & FPU_CSR_INV_X)
758 info.si_code = FPE_FLTINV; 769 info.si_code = FPE_FLTINV;
759 else if (fcr31 & FPU_CSR_DIV_X) 770 else if (fcr31 & FPU_CSR_DIV_X)
@@ -770,6 +781,9 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
770 info.si_errno = 0; 781 info.si_errno = 0;
771 info.si_addr = (void __user *) regs->cp0_epc; 782 info.si_addr = (void __user *) regs->cp0_epc;
772 force_sig_info(SIGFPE, &info, current); 783 force_sig_info(SIGFPE, &info, current);
784
785out:
786 exception_exit(prev_state);
773} 787}
774 788
775static void do_trap_or_bp(struct pt_regs *regs, unsigned int code, 789static void do_trap_or_bp(struct pt_regs *regs, unsigned int code,
@@ -835,9 +849,11 @@ static void do_trap_or_bp(struct pt_regs *regs, unsigned int code,
835asmlinkage void do_bp(struct pt_regs *regs) 849asmlinkage void do_bp(struct pt_regs *regs)
836{ 850{
837 unsigned int opcode, bcode; 851 unsigned int opcode, bcode;
852 enum ctx_state prev_state;
838 unsigned long epc; 853 unsigned long epc;
839 u16 instr[2]; 854 u16 instr[2];
840 855
856 prev_state = exception_enter();
841 if (get_isa16_mode(regs->cp0_epc)) { 857 if (get_isa16_mode(regs->cp0_epc)) {
842 /* Calculate EPC. */ 858 /* Calculate EPC. */
843 epc = exception_epc(regs); 859 epc = exception_epc(regs);
@@ -852,7 +868,7 @@ asmlinkage void do_bp(struct pt_regs *regs)
852 goto out_sigsegv; 868 goto out_sigsegv;
853 bcode = (instr[0] >> 6) & 0x3f; 869 bcode = (instr[0] >> 6) & 0x3f;
854 do_trap_or_bp(regs, bcode, "Break"); 870 do_trap_or_bp(regs, bcode, "Break");
855 return; 871 goto out;
856 } 872 }
857 } else { 873 } else {
858 if (__get_user(opcode, (unsigned int __user *) exception_epc(regs))) 874 if (__get_user(opcode, (unsigned int __user *) exception_epc(regs)))
@@ -876,12 +892,12 @@ asmlinkage void do_bp(struct pt_regs *regs)
876 switch (bcode) { 892 switch (bcode) {
877 case BRK_KPROBE_BP: 893 case BRK_KPROBE_BP:
878 if (notify_die(DIE_BREAK, "debug", regs, bcode, regs_to_trapnr(regs), SIGTRAP) == NOTIFY_STOP) 894 if (notify_die(DIE_BREAK, "debug", regs, bcode, regs_to_trapnr(regs), SIGTRAP) == NOTIFY_STOP)
879 return; 895 goto out;
880 else 896 else
881 break; 897 break;
882 case BRK_KPROBE_SSTEPBP: 898 case BRK_KPROBE_SSTEPBP:
883 if (notify_die(DIE_SSTEPBP, "single_step", regs, bcode, regs_to_trapnr(regs), SIGTRAP) == NOTIFY_STOP) 899 if (notify_die(DIE_SSTEPBP, "single_step", regs, bcode, regs_to_trapnr(regs), SIGTRAP) == NOTIFY_STOP)
884 return; 900 goto out;
885 else 901 else
886 break; 902 break;
887 default: 903 default:
@@ -889,18 +905,24 @@ asmlinkage void do_bp(struct pt_regs *regs)
889 } 905 }
890 906
891 do_trap_or_bp(regs, bcode, "Break"); 907 do_trap_or_bp(regs, bcode, "Break");
908
909out:
910 exception_exit(prev_state);
892 return; 911 return;
893 912
894out_sigsegv: 913out_sigsegv:
895 force_sig(SIGSEGV, current); 914 force_sig(SIGSEGV, current);
915 goto out;
896} 916}
897 917
898asmlinkage void do_tr(struct pt_regs *regs) 918asmlinkage void do_tr(struct pt_regs *regs)
899{ 919{
900 u32 opcode, tcode = 0; 920 u32 opcode, tcode = 0;
921 enum ctx_state prev_state;
901 u16 instr[2]; 922 u16 instr[2];
902 unsigned long epc = msk_isa16_mode(exception_epc(regs)); 923 unsigned long epc = msk_isa16_mode(exception_epc(regs));
903 924
925 prev_state = exception_enter();
904 if (get_isa16_mode(regs->cp0_epc)) { 926 if (get_isa16_mode(regs->cp0_epc)) {
905 if (__get_user(instr[0], (u16 __user *)(epc + 0)) || 927 if (__get_user(instr[0], (u16 __user *)(epc + 0)) ||
906 __get_user(instr[1], (u16 __user *)(epc + 2))) 928 __get_user(instr[1], (u16 __user *)(epc + 2)))
@@ -918,10 +940,14 @@ asmlinkage void do_tr(struct pt_regs *regs)
918 } 940 }
919 941
920 do_trap_or_bp(regs, tcode, "Trap"); 942 do_trap_or_bp(regs, tcode, "Trap");
943
944out:
945 exception_exit(prev_state);
921 return; 946 return;
922 947
923out_sigsegv: 948out_sigsegv:
924 force_sig(SIGSEGV, current); 949 force_sig(SIGSEGV, current);
950 goto out;
925} 951}
926 952
927asmlinkage void do_ri(struct pt_regs *regs) 953asmlinkage void do_ri(struct pt_regs *regs)
@@ -929,17 +955,19 @@ asmlinkage void do_ri(struct pt_regs *regs)
929 unsigned int __user *epc = (unsigned int __user *)exception_epc(regs); 955 unsigned int __user *epc = (unsigned int __user *)exception_epc(regs);
930 unsigned long old_epc = regs->cp0_epc; 956 unsigned long old_epc = regs->cp0_epc;
931 unsigned long old31 = regs->regs[31]; 957 unsigned long old31 = regs->regs[31];
958 enum ctx_state prev_state;
932 unsigned int opcode = 0; 959 unsigned int opcode = 0;
933 int status = -1; 960 int status = -1;
934 961
962 prev_state = exception_enter();
935 if (notify_die(DIE_RI, "RI Fault", regs, 0, regs_to_trapnr(regs), SIGILL) 963 if (notify_die(DIE_RI, "RI Fault", regs, 0, regs_to_trapnr(regs), SIGILL)
936 == NOTIFY_STOP) 964 == NOTIFY_STOP)
937 return; 965 goto out;
938 966
939 die_if_kernel("Reserved instruction in kernel code", regs); 967 die_if_kernel("Reserved instruction in kernel code", regs);
940 968
941 if (unlikely(compute_return_epc(regs) < 0)) 969 if (unlikely(compute_return_epc(regs) < 0))
942 return; 970 goto out;
943 971
944 if (get_isa16_mode(regs->cp0_epc)) { 972 if (get_isa16_mode(regs->cp0_epc)) {
945 unsigned short mmop[2] = { 0 }; 973 unsigned short mmop[2] = { 0 };
@@ -974,6 +1002,9 @@ asmlinkage void do_ri(struct pt_regs *regs)
974 regs->regs[31] = old31; 1002 regs->regs[31] = old31;
975 force_sig(status, current); 1003 force_sig(status, current);
976 } 1004 }
1005
1006out:
1007 exception_exit(prev_state);
977} 1008}
978 1009
979/* 1010/*
@@ -1025,21 +1056,16 @@ static int default_cu2_call(struct notifier_block *nfb, unsigned long action,
1025{ 1056{
1026 struct pt_regs *regs = data; 1057 struct pt_regs *regs = data;
1027 1058
1028 switch (action) { 1059 die_if_kernel("COP2: Unhandled kernel unaligned access or invalid "
1029 default:
1030 die_if_kernel("Unhandled kernel unaligned access or invalid "
1031 "instruction", regs); 1060 "instruction", regs);
1032 /* Fall through */ 1061 force_sig(SIGILL, current);
1033
1034 case CU2_EXCEPTION:
1035 force_sig(SIGILL, current);
1036 }
1037 1062
1038 return NOTIFY_OK; 1063 return NOTIFY_OK;
1039} 1064}
1040 1065
1041asmlinkage void do_cpu(struct pt_regs *regs) 1066asmlinkage void do_cpu(struct pt_regs *regs)
1042{ 1067{
1068 enum ctx_state prev_state;
1043 unsigned int __user *epc; 1069 unsigned int __user *epc;
1044 unsigned long old_epc, old31; 1070 unsigned long old_epc, old31;
1045 unsigned int opcode; 1071 unsigned int opcode;
@@ -1047,10 +1073,12 @@ asmlinkage void do_cpu(struct pt_regs *regs)
1047 int status; 1073 int status;
1048 unsigned long __maybe_unused flags; 1074 unsigned long __maybe_unused flags;
1049 1075
1050 die_if_kernel("do_cpu invoked from kernel context!", regs); 1076 prev_state = exception_enter();
1051
1052 cpid = (regs->cp0_cause >> CAUSEB_CE) & 3; 1077 cpid = (regs->cp0_cause >> CAUSEB_CE) & 3;
1053 1078
1079 if (cpid != 2)
1080 die_if_kernel("do_cpu invoked from kernel context!", regs);
1081
1054 switch (cpid) { 1082 switch (cpid) {
1055 case 0: 1083 case 0:
1056 epc = (unsigned int __user *)exception_epc(regs); 1084 epc = (unsigned int __user *)exception_epc(regs);
@@ -1060,7 +1088,7 @@ asmlinkage void do_cpu(struct pt_regs *regs)
1060 status = -1; 1088 status = -1;
1061 1089
1062 if (unlikely(compute_return_epc(regs) < 0)) 1090 if (unlikely(compute_return_epc(regs) < 0))
1063 return; 1091 goto out;
1064 1092
1065 if (get_isa16_mode(regs->cp0_epc)) { 1093 if (get_isa16_mode(regs->cp0_epc)) {
1066 unsigned short mmop[2] = { 0 }; 1094 unsigned short mmop[2] = { 0 };
@@ -1093,7 +1121,7 @@ asmlinkage void do_cpu(struct pt_regs *regs)
1093 force_sig(status, current); 1121 force_sig(status, current);
1094 } 1122 }
1095 1123
1096 return; 1124 goto out;
1097 1125
1098 case 3: 1126 case 3:
1099 /* 1127 /*
@@ -1131,19 +1159,26 @@ asmlinkage void do_cpu(struct pt_regs *regs)
1131 mt_ase_fp_affinity(); 1159 mt_ase_fp_affinity();
1132 } 1160 }
1133 1161
1134 return; 1162 goto out;
1135 1163
1136 case 2: 1164 case 2:
1137 raw_notifier_call_chain(&cu2_chain, CU2_EXCEPTION, regs); 1165 raw_notifier_call_chain(&cu2_chain, CU2_EXCEPTION, regs);
1138 return; 1166 goto out;
1139 } 1167 }
1140 1168
1141 force_sig(SIGILL, current); 1169 force_sig(SIGILL, current);
1170
1171out:
1172 exception_exit(prev_state);
1142} 1173}
1143 1174
1144asmlinkage void do_mdmx(struct pt_regs *regs) 1175asmlinkage void do_mdmx(struct pt_regs *regs)
1145{ 1176{
1177 enum ctx_state prev_state;
1178
1179 prev_state = exception_enter();
1146 force_sig(SIGILL, current); 1180 force_sig(SIGILL, current);
1181 exception_exit(prev_state);
1147} 1182}
1148 1183
1149/* 1184/*
@@ -1151,8 +1186,10 @@ asmlinkage void do_mdmx(struct pt_regs *regs)
1151 */ 1186 */
1152asmlinkage void do_watch(struct pt_regs *regs) 1187asmlinkage void do_watch(struct pt_regs *regs)
1153{ 1188{
1189 enum ctx_state prev_state;
1154 u32 cause; 1190 u32 cause;
1155 1191
1192 prev_state = exception_enter();
1156 /* 1193 /*
1157 * Clear WP (bit 22) bit of cause register so we don't loop 1194 * Clear WP (bit 22) bit of cause register so we don't loop
1158 * forever. 1195 * forever.
@@ -1174,13 +1211,16 @@ asmlinkage void do_watch(struct pt_regs *regs)
1174 mips_clear_watch_registers(); 1211 mips_clear_watch_registers();
1175 local_irq_enable(); 1212 local_irq_enable();
1176 } 1213 }
1214 exception_exit(prev_state);
1177} 1215}
1178 1216
1179asmlinkage void do_mcheck(struct pt_regs *regs) 1217asmlinkage void do_mcheck(struct pt_regs *regs)
1180{ 1218{
1181 const int field = 2 * sizeof(unsigned long); 1219 const int field = 2 * sizeof(unsigned long);
1182 int multi_match = regs->cp0_status & ST0_TS; 1220 int multi_match = regs->cp0_status & ST0_TS;
1221 enum ctx_state prev_state;
1183 1222
1223 prev_state = exception_enter();
1184 show_regs(regs); 1224 show_regs(regs);
1185 1225
1186 if (multi_match) { 1226 if (multi_match) {
@@ -1627,7 +1667,6 @@ void *set_vi_handler(int n, vi_handler_t addr)
1627} 1667}
1628 1668
1629extern void tlb_init(void); 1669extern void tlb_init(void);
1630extern void flush_tlb_handlers(void);
1631 1670
1632/* 1671/*
1633 * Timer interrupt 1672 * Timer interrupt
@@ -1642,7 +1681,7 @@ int cp0_compare_irq_shift;
1642int cp0_perfcount_irq; 1681int cp0_perfcount_irq;
1643EXPORT_SYMBOL_GPL(cp0_perfcount_irq); 1682EXPORT_SYMBOL_GPL(cp0_perfcount_irq);
1644 1683
1645static int __cpuinitdata noulri; 1684static int noulri;
1646 1685
1647static int __init ulri_disable(char *s) 1686static int __init ulri_disable(char *s)
1648{ 1687{
@@ -1653,7 +1692,7 @@ static int __init ulri_disable(char *s)
1653} 1692}
1654__setup("noulri", ulri_disable); 1693__setup("noulri", ulri_disable);
1655 1694
1656void __cpuinit per_cpu_trap_init(bool is_boot_cpu) 1695void per_cpu_trap_init(bool is_boot_cpu)
1657{ 1696{
1658 unsigned int cpu = smp_processor_id(); 1697 unsigned int cpu = smp_processor_id();
1659 unsigned int status_set = ST0_CU0; 1698 unsigned int status_set = ST0_CU0;
@@ -1770,7 +1809,7 @@ void __cpuinit per_cpu_trap_init(bool is_boot_cpu)
1770} 1809}
1771 1810
1772/* Install CPU exception handler */ 1811/* Install CPU exception handler */
1773void __cpuinit set_handler(unsigned long offset, void *addr, unsigned long size) 1812void set_handler(unsigned long offset, void *addr, unsigned long size)
1774{ 1813{
1775#ifdef CONFIG_CPU_MICROMIPS 1814#ifdef CONFIG_CPU_MICROMIPS
1776 memcpy((void *)(ebase + offset), ((unsigned char *)addr - 1), size); 1815 memcpy((void *)(ebase + offset), ((unsigned char *)addr - 1), size);
@@ -1780,7 +1819,7 @@ void __cpuinit set_handler(unsigned long offset, void *addr, unsigned long size)
1780 local_flush_icache_range(ebase + offset, ebase + offset + size); 1819 local_flush_icache_range(ebase + offset, ebase + offset + size);
1781} 1820}
1782 1821
1783static char panic_null_cerr[] __cpuinitdata = 1822static char panic_null_cerr[] =
1784 "Trying to set NULL cache error exception handler"; 1823 "Trying to set NULL cache error exception handler";
1785 1824
1786/* 1825/*
@@ -1788,7 +1827,7 @@ static char panic_null_cerr[] __cpuinitdata =
1788 * This is suitable only for the cache error exception which is the only 1827 * This is suitable only for the cache error exception which is the only
1789 * exception handler that is being run uncached. 1828 * exception handler that is being run uncached.
1790 */ 1829 */
1791void __cpuinit set_uncached_handler(unsigned long offset, void *addr, 1830void set_uncached_handler(unsigned long offset, void *addr,
1792 unsigned long size) 1831 unsigned long size)
1793{ 1832{
1794 unsigned long uncached_ebase = CKSEG1ADDR(ebase); 1833 unsigned long uncached_ebase = CKSEG1ADDR(ebase);
@@ -1837,6 +1876,15 @@ void __init trap_init(void)
1837 ebase += (read_c0_ebase() & 0x3ffff000); 1876 ebase += (read_c0_ebase() & 0x3ffff000);
1838 } 1877 }
1839 1878
1879 if (cpu_has_mmips) {
1880 unsigned int config3 = read_c0_config3();
1881
1882 if (IS_ENABLED(CONFIG_CPU_MICROMIPS))
1883 write_c0_config3(config3 | MIPS_CONF3_ISA_OE);
1884 else
1885 write_c0_config3(config3 & ~MIPS_CONF3_ISA_OE);
1886 }
1887
1840 if (board_ebase_setup) 1888 if (board_ebase_setup)
1841 board_ebase_setup(); 1889 board_ebase_setup();
1842 per_cpu_trap_init(true); 1890 per_cpu_trap_init(true);
@@ -1956,7 +2004,6 @@ void __init trap_init(void)
1956 set_handler(0x080, &except_vec3_generic, 0x80); 2004 set_handler(0x080, &except_vec3_generic, 0x80);
1957 2005
1958 local_flush_icache_range(ebase, ebase + 0x400); 2006 local_flush_icache_range(ebase, ebase + 0x400);
1959 flush_tlb_handlers();
1960 2007
1961 sort_extable(__start___dbe_table, __stop___dbe_table); 2008 sort_extable(__start___dbe_table, __stop___dbe_table);
1962 2009
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
index 203d8857070d..c369a5d35527 100644
--- a/arch/mips/kernel/unaligned.c
+++ b/arch/mips/kernel/unaligned.c
@@ -72,6 +72,7 @@
72 * A store crossing a page boundary might be executed only partially. 72 * A store crossing a page boundary might be executed only partially.
73 * Undo the partial store in this case. 73 * Undo the partial store in this case.
74 */ 74 */
75#include <linux/context_tracking.h>
75#include <linux/mm.h> 76#include <linux/mm.h>
76#include <linux/signal.h> 77#include <linux/signal.h>
77#include <linux/smp.h> 78#include <linux/smp.h>
@@ -684,7 +685,8 @@ const int reg16to32[] = { 16, 17, 2, 3, 4, 5, 6, 7 };
684/* Recode table from 16-bit STORE register notation to 32-bit GPR. */ 685/* Recode table from 16-bit STORE register notation to 32-bit GPR. */
685const int reg16to32st[] = { 0, 17, 2, 3, 4, 5, 6, 7 }; 686const int reg16to32st[] = { 0, 17, 2, 3, 4, 5, 6, 7 };
686 687
687void emulate_load_store_microMIPS(struct pt_regs *regs, void __user * addr) 688static void emulate_load_store_microMIPS(struct pt_regs *regs,
689 void __user *addr)
688{ 690{
689 unsigned long value; 691 unsigned long value;
690 unsigned int res; 692 unsigned int res;
@@ -1548,11 +1550,14 @@ sigill:
1548 ("Unhandled kernel unaligned access or invalid instruction", regs); 1550 ("Unhandled kernel unaligned access or invalid instruction", regs);
1549 force_sig(SIGILL, current); 1551 force_sig(SIGILL, current);
1550} 1552}
1553
1551asmlinkage void do_ade(struct pt_regs *regs) 1554asmlinkage void do_ade(struct pt_regs *regs)
1552{ 1555{
1556 enum ctx_state prev_state;
1553 unsigned int __user *pc; 1557 unsigned int __user *pc;
1554 mm_segment_t seg; 1558 mm_segment_t seg;
1555 1559
1560 prev_state = exception_enter();
1556 perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1561 perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS,
1557 1, regs, regs->cp0_badvaddr); 1562 1, regs, regs->cp0_badvaddr);
1558 /* 1563 /*
@@ -1628,6 +1633,7 @@ sigbus:
1628 /* 1633 /*
1629 * XXX On return from the signal handler we should advance the epc 1634 * XXX On return from the signal handler we should advance the epc
1630 */ 1635 */
1636 exception_exit(prev_state);
1631} 1637}
1632 1638
1633#ifdef CONFIG_DEBUG_FS 1639#ifdef CONFIG_DEBUG_FS
diff --git a/arch/mips/kernel/watch.c b/arch/mips/kernel/watch.c
index 7726f6157d9e..2a03abb5bd2c 100644
--- a/arch/mips/kernel/watch.c
+++ b/arch/mips/kernel/watch.c
@@ -100,7 +100,7 @@ void mips_clear_watch_registers(void)
100 } 100 }
101} 101}
102 102
103__cpuinit void mips_probe_watch_registers(struct cpuinfo_mips *c) 103void mips_probe_watch_registers(struct cpuinfo_mips *c)
104{ 104{
105 unsigned int t; 105 unsigned int t;
106 106
@@ -111,6 +111,7 @@ __cpuinit void mips_probe_watch_registers(struct cpuinfo_mips *c)
111 * disable the register. 111 * disable the register.
112 */ 112 */
113 write_c0_watchlo0(7); 113 write_c0_watchlo0(7);
114 back_to_back_c0_hazard();
114 t = read_c0_watchlo0(); 115 t = read_c0_watchlo0();
115 write_c0_watchlo0(0); 116 write_c0_watchlo0(0);
116 c->watch_reg_masks[0] = t & 7; 117 c->watch_reg_masks[0] = t & 7;
@@ -121,12 +122,14 @@ __cpuinit void mips_probe_watch_registers(struct cpuinfo_mips *c)
121 c->watch_reg_use_cnt = 1; 122 c->watch_reg_use_cnt = 1;
122 t = read_c0_watchhi0(); 123 t = read_c0_watchhi0();
123 write_c0_watchhi0(t | 0xff8); 124 write_c0_watchhi0(t | 0xff8);
125 back_to_back_c0_hazard();
124 t = read_c0_watchhi0(); 126 t = read_c0_watchhi0();
125 c->watch_reg_masks[0] |= (t & 0xff8); 127 c->watch_reg_masks[0] |= (t & 0xff8);
126 if ((t & 0x80000000) == 0) 128 if ((t & 0x80000000) == 0)
127 return; 129 return;
128 130
129 write_c0_watchlo1(7); 131 write_c0_watchlo1(7);
132 back_to_back_c0_hazard();
130 t = read_c0_watchlo1(); 133 t = read_c0_watchlo1();
131 write_c0_watchlo1(0); 134 write_c0_watchlo1(0);
132 c->watch_reg_masks[1] = t & 7; 135 c->watch_reg_masks[1] = t & 7;
@@ -135,12 +138,14 @@ __cpuinit void mips_probe_watch_registers(struct cpuinfo_mips *c)
135 c->watch_reg_use_cnt = 2; 138 c->watch_reg_use_cnt = 2;
136 t = read_c0_watchhi1(); 139 t = read_c0_watchhi1();
137 write_c0_watchhi1(t | 0xff8); 140 write_c0_watchhi1(t | 0xff8);
141 back_to_back_c0_hazard();
138 t = read_c0_watchhi1(); 142 t = read_c0_watchhi1();
139 c->watch_reg_masks[1] |= (t & 0xff8); 143 c->watch_reg_masks[1] |= (t & 0xff8);
140 if ((t & 0x80000000) == 0) 144 if ((t & 0x80000000) == 0)
141 return; 145 return;
142 146
143 write_c0_watchlo2(7); 147 write_c0_watchlo2(7);
148 back_to_back_c0_hazard();
144 t = read_c0_watchlo2(); 149 t = read_c0_watchlo2();
145 write_c0_watchlo2(0); 150 write_c0_watchlo2(0);
146 c->watch_reg_masks[2] = t & 7; 151 c->watch_reg_masks[2] = t & 7;
@@ -149,12 +154,14 @@ __cpuinit void mips_probe_watch_registers(struct cpuinfo_mips *c)
149 c->watch_reg_use_cnt = 3; 154 c->watch_reg_use_cnt = 3;
150 t = read_c0_watchhi2(); 155 t = read_c0_watchhi2();
151 write_c0_watchhi2(t | 0xff8); 156 write_c0_watchhi2(t | 0xff8);
157 back_to_back_c0_hazard();
152 t = read_c0_watchhi2(); 158 t = read_c0_watchhi2();
153 c->watch_reg_masks[2] |= (t & 0xff8); 159 c->watch_reg_masks[2] |= (t & 0xff8);
154 if ((t & 0x80000000) == 0) 160 if ((t & 0x80000000) == 0)
155 return; 161 return;
156 162
157 write_c0_watchlo3(7); 163 write_c0_watchlo3(7);
164 back_to_back_c0_hazard();
158 t = read_c0_watchlo3(); 165 t = read_c0_watchlo3();
159 write_c0_watchlo3(0); 166 write_c0_watchlo3(0);
160 c->watch_reg_masks[3] = t & 7; 167 c->watch_reg_masks[3] = t & 7;
@@ -163,6 +170,7 @@ __cpuinit void mips_probe_watch_registers(struct cpuinfo_mips *c)
163 c->watch_reg_use_cnt = 4; 170 c->watch_reg_use_cnt = 4;
164 t = read_c0_watchhi3(); 171 t = read_c0_watchhi3();
165 write_c0_watchhi3(t | 0xff8); 172 write_c0_watchhi3(t | 0xff8);
173 back_to_back_c0_hazard();
166 t = read_c0_watchhi3(); 174 t = read_c0_watchhi3();
167 c->watch_reg_masks[3] |= (t & 0xff8); 175 c->watch_reg_masks[3] |= (t & 0xff8);
168 if ((t & 0x80000000) == 0) 176 if ((t & 0x80000000) == 0)
diff --git a/arch/mips/kvm/Kconfig b/arch/mips/kvm/Kconfig
index 2c15590e55f7..30e334e823bd 100644
--- a/arch/mips/kvm/Kconfig
+++ b/arch/mips/kvm/Kconfig
@@ -5,7 +5,6 @@ source "virt/kvm/Kconfig"
5 5
6menuconfig VIRTUALIZATION 6menuconfig VIRTUALIZATION
7 bool "Virtualization" 7 bool "Virtualization"
8 depends on HAVE_KVM
9 ---help--- 8 ---help---
10 Say Y here to get to see options for using your Linux host to run 9 Say Y here to get to see options for using your Linux host to run
11 other operating systems inside virtual machines (guests). 10 other operating systems inside virtual machines (guests).
diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c
index 51194875f158..eb3e18659630 100644
--- a/arch/mips/lantiq/irq.c
+++ b/arch/mips/lantiq/irq.c
@@ -461,7 +461,7 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent)
461 return 0; 461 return 0;
462} 462}
463 463
464unsigned int __cpuinit get_c0_compare_int(void) 464unsigned int get_c0_compare_int(void)
465{ 465{
466 return MIPS_CPU_TIMER_IRQ; 466 return MIPS_CPU_TIMER_IRQ;
467} 467}
diff --git a/arch/mips/lantiq/prom.c b/arch/mips/lantiq/prom.c
index 9f9e875967aa..49c460370285 100644
--- a/arch/mips/lantiq/prom.c
+++ b/arch/mips/lantiq/prom.c
@@ -112,7 +112,7 @@ int __init plat_of_setup(void)
112 if (!of_have_populated_dt()) 112 if (!of_have_populated_dt())
113 panic("device tree not present"); 113 panic("device tree not present");
114 114
115 strncpy(of_ids[0].compatible, soc_info.compatible, 115 strlcpy(of_ids[0].compatible, soc_info.compatible,
116 sizeof(of_ids[0].compatible)); 116 sizeof(of_ids[0].compatible));
117 strncpy(of_ids[1].compatible, "simple-bus", 117 strncpy(of_ids[1].compatible, "simple-bus",
118 sizeof(of_ids[1].compatible)); 118 sizeof(of_ids[1].compatible));
diff --git a/arch/mips/lasat/sysctl.c b/arch/mips/lasat/sysctl.c
index f27694fb2ad1..3b7f65cc4218 100644
--- a/arch/mips/lasat/sysctl.c
+++ b/arch/mips/lasat/sysctl.c
@@ -39,7 +39,7 @@
39 39
40 40
41/* And the same for proc */ 41/* And the same for proc */
42int proc_dolasatstring(ctl_table *table, int write, 42int proc_dolasatstring(struct ctl_table *table, int write,
43 void *buffer, size_t *lenp, loff_t *ppos) 43 void *buffer, size_t *lenp, loff_t *ppos)
44{ 44{
45 int r; 45 int r;
@@ -54,7 +54,7 @@ int proc_dolasatstring(ctl_table *table, int write,
54} 54}
55 55
56/* proc function to write EEPROM after changing int entry */ 56/* proc function to write EEPROM after changing int entry */
57int proc_dolasatint(ctl_table *table, int write, 57int proc_dolasatint(struct ctl_table *table, int write,
58 void *buffer, size_t *lenp, loff_t *ppos) 58 void *buffer, size_t *lenp, loff_t *ppos)
59{ 59{
60 int r; 60 int r;
@@ -72,7 +72,7 @@ int proc_dolasatint(ctl_table *table, int write,
72static int rtctmp; 72static int rtctmp;
73 73
74/* proc function to read/write RealTime Clock */ 74/* proc function to read/write RealTime Clock */
75int proc_dolasatrtc(ctl_table *table, int write, 75int proc_dolasatrtc(struct ctl_table *table, int write,
76 void *buffer, size_t *lenp, loff_t *ppos) 76 void *buffer, size_t *lenp, loff_t *ppos)
77{ 77{
78 struct timespec ts; 78 struct timespec ts;
@@ -97,7 +97,7 @@ int proc_dolasatrtc(ctl_table *table, int write,
97#endif 97#endif
98 98
99#ifdef CONFIG_INET 99#ifdef CONFIG_INET
100int proc_lasat_ip(ctl_table *table, int write, 100int proc_lasat_ip(struct ctl_table *table, int write,
101 void *buffer, size_t *lenp, loff_t *ppos) 101 void *buffer, size_t *lenp, loff_t *ppos)
102{ 102{
103 unsigned int ip; 103 unsigned int ip;
@@ -157,7 +157,7 @@ int proc_lasat_ip(ctl_table *table, int write,
157} 157}
158#endif 158#endif
159 159
160int proc_lasat_prid(ctl_table *table, int write, 160int proc_lasat_prid(struct ctl_table *table, int write,
161 void *buffer, size_t *lenp, loff_t *ppos) 161 void *buffer, size_t *lenp, loff_t *ppos)
162{ 162{
163 int r; 163 int r;
@@ -176,7 +176,7 @@ int proc_lasat_prid(ctl_table *table, int write,
176 176
177extern int lasat_boot_to_service; 177extern int lasat_boot_to_service;
178 178
179static ctl_table lasat_table[] = { 179static struct ctl_table lasat_table[] = {
180 { 180 {
181 .procname = "cpu-hz", 181 .procname = "cpu-hz",
182 .data = &lasat_board_info.li_cpu_hz, 182 .data = &lasat_board_info.li_cpu_hz,
@@ -262,7 +262,7 @@ static ctl_table lasat_table[] = {
262 {} 262 {}
263}; 263};
264 264
265static ctl_table lasat_root_table[] = { 265static struct ctl_table lasat_root_table[] = {
266 { 266 {
267 .procname = "lasat", 267 .procname = "lasat",
268 .mode = 0555, 268 .mode = 0555,
diff --git a/arch/mips/lib/uncached.c b/arch/mips/lib/uncached.c
index 65e3dfc4e585..d8522f8e842a 100644
--- a/arch/mips/lib/uncached.c
+++ b/arch/mips/lib/uncached.c
@@ -36,7 +36,7 @@
36 * values, so we can avoid sharing the same stack area between a cached 36 * values, so we can avoid sharing the same stack area between a cached
37 * and the uncached mode. 37 * and the uncached mode.
38 */ 38 */
39unsigned long __cpuinit run_uncached(void *func) 39unsigned long run_uncached(void *func)
40{ 40{
41 register long sp __asm__("$sp"); 41 register long sp __asm__("$sp");
42 register long ret __asm__("$2"); 42 register long ret __asm__("$2");
diff --git a/arch/mips/loongson/common/cs5536/cs5536_isa.c b/arch/mips/loongson/common/cs5536/cs5536_isa.c
index a6eb2e853d94..924be39e7733 100644
--- a/arch/mips/loongson/common/cs5536/cs5536_isa.c
+++ b/arch/mips/loongson/common/cs5536/cs5536_isa.c
@@ -13,6 +13,7 @@
13 * option) any later version. 13 * option) any later version.
14 */ 14 */
15 15
16#include <linux/pci.h>
16#include <cs5536/cs5536.h> 17#include <cs5536/cs5536.h>
17#include <cs5536/cs5536_pci.h> 18#include <cs5536/cs5536_pci.h>
18 19
@@ -314,3 +315,16 @@ u32 pci_isa_read_reg(int reg)
314 315
315 return conf_data; 316 return conf_data;
316} 317}
318
319/*
320 * The mfgpt timer interrupt is running early, so we must keep the south bridge
321 * mmio always enabled. Otherwise we may race with the PCI configuration which
322 * may temporarily disable it. When that happens and the timer interrupt fires,
323 * we are not able to clear it and the system will hang.
324 */
325static void cs5536_isa_mmio_always_on(struct pci_dev *dev)
326{
327 dev->mmio_always_on = 1;
328}
329DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA,
330 PCI_CLASS_BRIDGE_ISA, 8, cs5536_isa_mmio_always_on);
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index f03771900813..e773659ccf9f 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -471,6 +471,9 @@ int mm_isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
471 unsigned int fcr31; 471 unsigned int fcr31;
472 unsigned int bit; 472 unsigned int bit;
473 473
474 if (!cpu_has_mmips)
475 return 0;
476
474 switch (insn.mm_i_format.opcode) { 477 switch (insn.mm_i_format.opcode) {
475 case mm_pool32a_op: 478 case mm_pool32a_op:
476 if ((insn.mm_i_format.simmediate & MM_POOL32A_MINOR_MASK) == 479 if ((insn.mm_i_format.simmediate & MM_POOL32A_MINOR_MASK) ==
diff --git a/arch/mips/mm/Makefile b/arch/mips/mm/Makefile
index e87aae1f2e80..7f4f93ab22b7 100644
--- a/arch/mips/mm/Makefile
+++ b/arch/mips/mm/Makefile
@@ -4,7 +4,7 @@
4 4
5obj-y += cache.o dma-default.o extable.o fault.o \ 5obj-y += cache.o dma-default.o extable.o fault.o \
6 gup.o init.o mmap.o page.o page-funcs.o \ 6 gup.o init.o mmap.o page.o page-funcs.o \
7 tlbex.o tlbex-fault.o uasm-mips.o 7 tlbex.o tlbex-fault.o tlb-funcs.o uasm-mips.o
8 8
9obj-$(CONFIG_32BIT) += ioremap.o pgtable-32.o 9obj-$(CONFIG_32BIT) += ioremap.o pgtable-32.o
10obj-$(CONFIG_64BIT) += pgtable-64.o 10obj-$(CONFIG_64BIT) += pgtable-64.o
diff --git a/arch/mips/mm/c-octeon.c b/arch/mips/mm/c-octeon.c
index 8557fb552863..a0bcdbb81d41 100644
--- a/arch/mips/mm/c-octeon.c
+++ b/arch/mips/mm/c-octeon.c
@@ -180,7 +180,7 @@ static void octeon_flush_kernel_vmap_range(unsigned long vaddr, int size)
180 * Probe Octeon's caches 180 * Probe Octeon's caches
181 * 181 *
182 */ 182 */
183static void __cpuinit probe_octeon(void) 183static void probe_octeon(void)
184{ 184{
185 unsigned long icache_size; 185 unsigned long icache_size;
186 unsigned long dcache_size; 186 unsigned long dcache_size;
@@ -251,7 +251,7 @@ static void __cpuinit probe_octeon(void)
251 } 251 }
252} 252}
253 253
254static void __cpuinit octeon_cache_error_setup(void) 254static void octeon_cache_error_setup(void)
255{ 255{
256 extern char except_vec2_octeon; 256 extern char except_vec2_octeon;
257 set_handler(0x100, &except_vec2_octeon, 0x80); 257 set_handler(0x100, &except_vec2_octeon, 0x80);
@@ -261,7 +261,7 @@ static void __cpuinit octeon_cache_error_setup(void)
261 * Setup the Octeon cache flush routines 261 * Setup the Octeon cache flush routines
262 * 262 *
263 */ 263 */
264void __cpuinit octeon_cache_init(void) 264void octeon_cache_init(void)
265{ 265{
266 probe_octeon(); 266 probe_octeon();
267 267
diff --git a/arch/mips/mm/c-r3k.c b/arch/mips/mm/c-r3k.c
index 704dc735a59d..2fcde0c8ea02 100644
--- a/arch/mips/mm/c-r3k.c
+++ b/arch/mips/mm/c-r3k.c
@@ -26,7 +26,7 @@
26static unsigned long icache_size, dcache_size; /* Size in bytes */ 26static unsigned long icache_size, dcache_size; /* Size in bytes */
27static unsigned long icache_lsize, dcache_lsize; /* Size in bytes */ 27static unsigned long icache_lsize, dcache_lsize; /* Size in bytes */
28 28
29unsigned long __cpuinit r3k_cache_size(unsigned long ca_flags) 29unsigned long r3k_cache_size(unsigned long ca_flags)
30{ 30{
31 unsigned long flags, status, dummy, size; 31 unsigned long flags, status, dummy, size;
32 volatile unsigned long *p; 32 volatile unsigned long *p;
@@ -61,7 +61,7 @@ unsigned long __cpuinit r3k_cache_size(unsigned long ca_flags)
61 return size * sizeof(*p); 61 return size * sizeof(*p);
62} 62}
63 63
64unsigned long __cpuinit r3k_cache_lsize(unsigned long ca_flags) 64unsigned long r3k_cache_lsize(unsigned long ca_flags)
65{ 65{
66 unsigned long flags, status, lsize, i; 66 unsigned long flags, status, lsize, i;
67 volatile unsigned long *p; 67 volatile unsigned long *p;
@@ -90,7 +90,7 @@ unsigned long __cpuinit r3k_cache_lsize(unsigned long ca_flags)
90 return lsize * sizeof(*p); 90 return lsize * sizeof(*p);
91} 91}
92 92
93static void __cpuinit r3k_probe_cache(void) 93static void r3k_probe_cache(void)
94{ 94{
95 dcache_size = r3k_cache_size(ST0_ISC); 95 dcache_size = r3k_cache_size(ST0_ISC);
96 if (dcache_size) 96 if (dcache_size)
@@ -312,7 +312,7 @@ static void r3k_dma_cache_wback_inv(unsigned long start, unsigned long size)
312 r3k_flush_dcache_range(start, start + size); 312 r3k_flush_dcache_range(start, start + size);
313} 313}
314 314
315void __cpuinit r3k_cache_init(void) 315void r3k_cache_init(void)
316{ 316{
317 extern void build_clear_page(void); 317 extern void build_clear_page(void);
318 extern void build_copy_page(void); 318 extern void build_copy_page(void);
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 21813beec7a5..f749f687ee87 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -107,7 +107,7 @@ static inline void r4k_blast_dcache_page_dc64(unsigned long addr)
107 blast_dcache64_page(addr); 107 blast_dcache64_page(addr);
108} 108}
109 109
110static void __cpuinit r4k_blast_dcache_page_setup(void) 110static void r4k_blast_dcache_page_setup(void)
111{ 111{
112 unsigned long dc_lsize = cpu_dcache_line_size(); 112 unsigned long dc_lsize = cpu_dcache_line_size();
113 113
@@ -123,7 +123,7 @@ static void __cpuinit r4k_blast_dcache_page_setup(void)
123 123
124static void (* r4k_blast_dcache_page_indexed)(unsigned long addr); 124static void (* r4k_blast_dcache_page_indexed)(unsigned long addr);
125 125
126static void __cpuinit r4k_blast_dcache_page_indexed_setup(void) 126static void r4k_blast_dcache_page_indexed_setup(void)
127{ 127{
128 unsigned long dc_lsize = cpu_dcache_line_size(); 128 unsigned long dc_lsize = cpu_dcache_line_size();
129 129
@@ -140,7 +140,7 @@ static void __cpuinit r4k_blast_dcache_page_indexed_setup(void)
140void (* r4k_blast_dcache)(void); 140void (* r4k_blast_dcache)(void);
141EXPORT_SYMBOL(r4k_blast_dcache); 141EXPORT_SYMBOL(r4k_blast_dcache);
142 142
143static void __cpuinit r4k_blast_dcache_setup(void) 143static void r4k_blast_dcache_setup(void)
144{ 144{
145 unsigned long dc_lsize = cpu_dcache_line_size(); 145 unsigned long dc_lsize = cpu_dcache_line_size();
146 146
@@ -227,7 +227,7 @@ static inline void tx49_blast_icache32_page_indexed(unsigned long page)
227 227
228static void (* r4k_blast_icache_page)(unsigned long addr); 228static void (* r4k_blast_icache_page)(unsigned long addr);
229 229
230static void __cpuinit r4k_blast_icache_page_setup(void) 230static void r4k_blast_icache_page_setup(void)
231{ 231{
232 unsigned long ic_lsize = cpu_icache_line_size(); 232 unsigned long ic_lsize = cpu_icache_line_size();
233 233
@@ -244,7 +244,7 @@ static void __cpuinit r4k_blast_icache_page_setup(void)
244 244
245static void (* r4k_blast_icache_page_indexed)(unsigned long addr); 245static void (* r4k_blast_icache_page_indexed)(unsigned long addr);
246 246
247static void __cpuinit r4k_blast_icache_page_indexed_setup(void) 247static void r4k_blast_icache_page_indexed_setup(void)
248{ 248{
249 unsigned long ic_lsize = cpu_icache_line_size(); 249 unsigned long ic_lsize = cpu_icache_line_size();
250 250
@@ -269,7 +269,7 @@ static void __cpuinit r4k_blast_icache_page_indexed_setup(void)
269void (* r4k_blast_icache)(void); 269void (* r4k_blast_icache)(void);
270EXPORT_SYMBOL(r4k_blast_icache); 270EXPORT_SYMBOL(r4k_blast_icache);
271 271
272static void __cpuinit r4k_blast_icache_setup(void) 272static void r4k_blast_icache_setup(void)
273{ 273{
274 unsigned long ic_lsize = cpu_icache_line_size(); 274 unsigned long ic_lsize = cpu_icache_line_size();
275 275
@@ -290,7 +290,7 @@ static void __cpuinit r4k_blast_icache_setup(void)
290 290
291static void (* r4k_blast_scache_page)(unsigned long addr); 291static void (* r4k_blast_scache_page)(unsigned long addr);
292 292
293static void __cpuinit r4k_blast_scache_page_setup(void) 293static void r4k_blast_scache_page_setup(void)
294{ 294{
295 unsigned long sc_lsize = cpu_scache_line_size(); 295 unsigned long sc_lsize = cpu_scache_line_size();
296 296
@@ -308,7 +308,7 @@ static void __cpuinit r4k_blast_scache_page_setup(void)
308 308
309static void (* r4k_blast_scache_page_indexed)(unsigned long addr); 309static void (* r4k_blast_scache_page_indexed)(unsigned long addr);
310 310
311static void __cpuinit r4k_blast_scache_page_indexed_setup(void) 311static void r4k_blast_scache_page_indexed_setup(void)
312{ 312{
313 unsigned long sc_lsize = cpu_scache_line_size(); 313 unsigned long sc_lsize = cpu_scache_line_size();
314 314
@@ -326,7 +326,7 @@ static void __cpuinit r4k_blast_scache_page_indexed_setup(void)
326 326
327static void (* r4k_blast_scache)(void); 327static void (* r4k_blast_scache)(void);
328 328
329static void __cpuinit r4k_blast_scache_setup(void) 329static void r4k_blast_scache_setup(void)
330{ 330{
331 unsigned long sc_lsize = cpu_scache_line_size(); 331 unsigned long sc_lsize = cpu_scache_line_size();
332 332
@@ -797,11 +797,11 @@ static inline void alias_74k_erratum(struct cpuinfo_mips *c)
797 } 797 }
798} 798}
799 799
800static char *way_string[] __cpuinitdata = { NULL, "direct mapped", "2-way", 800static char *way_string[] = { NULL, "direct mapped", "2-way",
801 "3-way", "4-way", "5-way", "6-way", "7-way", "8-way" 801 "3-way", "4-way", "5-way", "6-way", "7-way", "8-way"
802}; 802};
803 803
804static void __cpuinit probe_pcache(void) 804static void probe_pcache(void)
805{ 805{
806 struct cpuinfo_mips *c = &current_cpu_data; 806 struct cpuinfo_mips *c = &current_cpu_data;
807 unsigned int config = read_c0_config(); 807 unsigned int config = read_c0_config();
@@ -1119,7 +1119,7 @@ static void __cpuinit probe_pcache(void)
1119 * executes in KSEG1 space or else you will crash and burn badly. You have 1119 * executes in KSEG1 space or else you will crash and burn badly. You have
1120 * been warned. 1120 * been warned.
1121 */ 1121 */
1122static int __cpuinit probe_scache(void) 1122static int probe_scache(void)
1123{ 1123{
1124 unsigned long flags, addr, begin, end, pow2; 1124 unsigned long flags, addr, begin, end, pow2;
1125 unsigned int config = read_c0_config(); 1125 unsigned int config = read_c0_config();
@@ -1196,7 +1196,7 @@ extern int r5k_sc_init(void);
1196extern int rm7k_sc_init(void); 1196extern int rm7k_sc_init(void);
1197extern int mips_sc_init(void); 1197extern int mips_sc_init(void);
1198 1198
1199static void __cpuinit setup_scache(void) 1199static void setup_scache(void)
1200{ 1200{
1201 struct cpuinfo_mips *c = &current_cpu_data; 1201 struct cpuinfo_mips *c = &current_cpu_data;
1202 unsigned int config = read_c0_config(); 1202 unsigned int config = read_c0_config();
@@ -1329,7 +1329,7 @@ static void nxp_pr4450_fixup_config(void)
1329 NXP_BARRIER(); 1329 NXP_BARRIER();
1330} 1330}
1331 1331
1332static int __cpuinitdata cca = -1; 1332static int cca = -1;
1333 1333
1334static int __init cca_setup(char *str) 1334static int __init cca_setup(char *str)
1335{ 1335{
@@ -1340,7 +1340,7 @@ static int __init cca_setup(char *str)
1340 1340
1341early_param("cca", cca_setup); 1341early_param("cca", cca_setup);
1342 1342
1343static void __cpuinit coherency_setup(void) 1343static void coherency_setup(void)
1344{ 1344{
1345 if (cca < 0 || cca > 7) 1345 if (cca < 0 || cca > 7)
1346 cca = read_c0_config() & CONF_CM_CMASK; 1346 cca = read_c0_config() & CONF_CM_CMASK;
@@ -1380,7 +1380,7 @@ static void __cpuinit coherency_setup(void)
1380 } 1380 }
1381} 1381}
1382 1382
1383static void __cpuinit r4k_cache_error_setup(void) 1383static void r4k_cache_error_setup(void)
1384{ 1384{
1385 extern char __weak except_vec2_generic; 1385 extern char __weak except_vec2_generic;
1386 extern char __weak except_vec2_sb1; 1386 extern char __weak except_vec2_sb1;
@@ -1398,7 +1398,7 @@ static void __cpuinit r4k_cache_error_setup(void)
1398 } 1398 }
1399} 1399}
1400 1400
1401void __cpuinit r4k_cache_init(void) 1401void r4k_cache_init(void)
1402{ 1402{
1403 extern void build_clear_page(void); 1403 extern void build_clear_page(void);
1404 extern void build_copy_page(void); 1404 extern void build_copy_page(void);
diff --git a/arch/mips/mm/c-tx39.c b/arch/mips/mm/c-tx39.c
index ba9da270289f..8d909dbbf37f 100644
--- a/arch/mips/mm/c-tx39.c
+++ b/arch/mips/mm/c-tx39.c
@@ -344,7 +344,7 @@ static __init void tx39_probe_cache(void)
344 } 344 }
345} 345}
346 346
347void __cpuinit tx39_cache_init(void) 347void tx39_cache_init(void)
348{ 348{
349 extern void build_clear_page(void); 349 extern void build_clear_page(void);
350 extern void build_copy_page(void); 350 extern void build_copy_page(void);
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 5aeb3eb0b72f..15f813c303b4 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -182,7 +182,7 @@ static inline void setup_protection_map(void)
182 } 182 }
183} 183}
184 184
185void __cpuinit cpu_cache_init(void) 185void cpu_cache_init(void)
186{ 186{
187 if (cpu_has_3k_cache) { 187 if (cpu_has_3k_cache) {
188 extern void __weak r3k_cache_init(void); 188 extern void __weak r3k_cache_init(void);
diff --git a/arch/mips/mm/cerr-sb1.c b/arch/mips/mm/cerr-sb1.c
index 576add33bf5b..ee5c1ff861ae 100644
--- a/arch/mips/mm/cerr-sb1.c
+++ b/arch/mips/mm/cerr-sb1.c
@@ -182,11 +182,7 @@ asmlinkage void sb1_cache_error(void)
182 182
183#ifdef CONFIG_SIBYTE_BW_TRACE 183#ifdef CONFIG_SIBYTE_BW_TRACE
184 /* Freeze the trace buffer now */ 184 /* Freeze the trace buffer now */
185#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
186 csr_out32(M_BCM1480_SCD_TRACE_CFG_FREEZE, IOADDR(A_SCD_TRACE_CFG));
187#else
188 csr_out32(M_SCD_TRACE_CFG_FREEZE, IOADDR(A_SCD_TRACE_CFG)); 185 csr_out32(M_SCD_TRACE_CFG_FREEZE, IOADDR(A_SCD_TRACE_CFG));
189#endif
190 printk("Trace buffer frozen\n"); 186 printk("Trace buffer frozen\n");
191#endif 187#endif
192 188
diff --git a/arch/mips/mm/cex-sb1.S b/arch/mips/mm/cex-sb1.S
index fe1d887e8d70..191cf6e0c725 100644
--- a/arch/mips/mm/cex-sb1.S
+++ b/arch/mips/mm/cex-sb1.S
@@ -49,8 +49,6 @@
49 * (0x170-0x17f) are used to preserve k0, k1, and ra. 49 * (0x170-0x17f) are used to preserve k0, k1, and ra.
50 */ 50 */
51 51
52 __CPUINIT
53
54LEAF(except_vec2_sb1) 52LEAF(except_vec2_sb1)
55 /* 53 /*
56 * If this error is recoverable, we need to exit the handler 54 * If this error is recoverable, we need to exit the handler
@@ -142,8 +140,6 @@ unrecoverable:
142 140
143END(except_vec2_sb1) 141END(except_vec2_sb1)
144 142
145 __FINIT
146
147 LEAF(handle_vec2_sb1) 143 LEAF(handle_vec2_sb1)
148 mfc0 k0,CP0_CONFIG 144 mfc0 k0,CP0_CONFIG
149 li k1,~CONF_CM_CMASK 145 li k1,~CONF_CM_CMASK
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index caf92ecb37d6..aaccf1c10699 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -246,6 +246,9 @@ static int mips_dma_map_sg(struct device *dev, struct scatterlist *sg,
246 if (!plat_device_is_coherent(dev)) 246 if (!plat_device_is_coherent(dev))
247 __dma_sync(sg_page(sg), sg->offset, sg->length, 247 __dma_sync(sg_page(sg), sg->offset, sg->length,
248 direction); 248 direction);
249#ifdef CONFIG_NEED_SG_DMA_LENGTH
250 sg->dma_length = sg->length;
251#endif
249 sg->dma_address = plat_map_dma_mem_page(dev, sg_page(sg)) + 252 sg->dma_address = plat_map_dma_mem_page(dev, sg_page(sg)) +
250 sg->offset; 253 sg->offset;
251 } 254 }
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index 0fead53d1c26..85df1cd8d446 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -5,6 +5,7 @@
5 * 5 *
6 * Copyright (C) 1995 - 2000 by Ralf Baechle 6 * Copyright (C) 1995 - 2000 by Ralf Baechle
7 */ 7 */
8#include <linux/context_tracking.h>
8#include <linux/signal.h> 9#include <linux/signal.h>
9#include <linux/sched.h> 10#include <linux/sched.h>
10#include <linux/interrupt.h> 11#include <linux/interrupt.h>
@@ -32,8 +33,8 @@
32 * and the problem, and then passes it off to one of the appropriate 33 * and the problem, and then passes it off to one of the appropriate
33 * routines. 34 * routines.
34 */ 35 */
35asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, unsigned long write, 36static void __kprobes __do_page_fault(struct pt_regs *regs, unsigned long write,
36 unsigned long address) 37 unsigned long address)
37{ 38{
38 struct vm_area_struct * vma = NULL; 39 struct vm_area_struct * vma = NULL;
39 struct task_struct *tsk = current; 40 struct task_struct *tsk = current;
@@ -312,3 +313,13 @@ vmalloc_fault:
312 } 313 }
313#endif 314#endif
314} 315}
316
317asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
318 unsigned long write, unsigned long address)
319{
320 enum ctx_state prev_state;
321
322 prev_state = exception_enter();
323 __do_page_fault(regs, write, address);
324 exception_exit(prev_state);
325}
diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c
index 7e5fe2790d8a..f1baadd56e82 100644
--- a/arch/mips/mm/mmap.c
+++ b/arch/mips/mm/mmap.c
@@ -158,11 +158,9 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
158 if (mmap_is_legacy()) { 158 if (mmap_is_legacy()) {
159 mm->mmap_base = TASK_UNMAPPED_BASE + random_factor; 159 mm->mmap_base = TASK_UNMAPPED_BASE + random_factor;
160 mm->get_unmapped_area = arch_get_unmapped_area; 160 mm->get_unmapped_area = arch_get_unmapped_area;
161 mm->unmap_area = arch_unmap_area;
162 } else { 161 } else {
163 mm->mmap_base = mmap_base(random_factor); 162 mm->mmap_base = mmap_base(random_factor);
164 mm->get_unmapped_area = arch_get_unmapped_area_topdown; 163 mm->get_unmapped_area = arch_get_unmapped_area_topdown;
165 mm->unmap_area = arch_unmap_area_topdown;
166 } 164 }
167} 165}
168 166
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
index 4eb8dcfaf1ce..218c2109a55d 100644
--- a/arch/mips/mm/page.c
+++ b/arch/mips/mm/page.c
@@ -66,29 +66,29 @@ UASM_L_LA(_copy_pref_both)
66UASM_L_LA(_copy_pref_store) 66UASM_L_LA(_copy_pref_store)
67 67
68/* We need one branch and therefore one relocation per target label. */ 68/* We need one branch and therefore one relocation per target label. */
69static struct uasm_label __cpuinitdata labels[5]; 69static struct uasm_label labels[5];
70static struct uasm_reloc __cpuinitdata relocs[5]; 70static struct uasm_reloc relocs[5];
71 71
72#define cpu_is_r4600_v1_x() ((read_c0_prid() & 0xfffffff0) == 0x00002010) 72#define cpu_is_r4600_v1_x() ((read_c0_prid() & 0xfffffff0) == 0x00002010)
73#define cpu_is_r4600_v2_x() ((read_c0_prid() & 0xfffffff0) == 0x00002020) 73#define cpu_is_r4600_v2_x() ((read_c0_prid() & 0xfffffff0) == 0x00002020)
74 74
75static int pref_bias_clear_store __cpuinitdata; 75static int pref_bias_clear_store;
76static int pref_bias_copy_load __cpuinitdata; 76static int pref_bias_copy_load;
77static int pref_bias_copy_store __cpuinitdata; 77static int pref_bias_copy_store;
78 78
79static u32 pref_src_mode __cpuinitdata; 79static u32 pref_src_mode;
80static u32 pref_dst_mode __cpuinitdata; 80static u32 pref_dst_mode;
81 81
82static int clear_word_size __cpuinitdata; 82static int clear_word_size;
83static int copy_word_size __cpuinitdata; 83static int copy_word_size;
84 84
85static int half_clear_loop_size __cpuinitdata; 85static int half_clear_loop_size;
86static int half_copy_loop_size __cpuinitdata; 86static int half_copy_loop_size;
87 87
88static int cache_line_size __cpuinitdata; 88static int cache_line_size;
89#define cache_line_mask() (cache_line_size - 1) 89#define cache_line_mask() (cache_line_size - 1)
90 90
91static inline void __cpuinit 91static inline void
92pg_addiu(u32 **buf, unsigned int reg1, unsigned int reg2, unsigned int off) 92pg_addiu(u32 **buf, unsigned int reg1, unsigned int reg2, unsigned int off)
93{ 93{
94 if (cpu_has_64bit_gp_regs && DADDI_WAR && r4k_daddiu_bug()) { 94 if (cpu_has_64bit_gp_regs && DADDI_WAR && r4k_daddiu_bug()) {
@@ -108,7 +108,7 @@ pg_addiu(u32 **buf, unsigned int reg1, unsigned int reg2, unsigned int off)
108 } 108 }
109} 109}
110 110
111static void __cpuinit set_prefetch_parameters(void) 111static void set_prefetch_parameters(void)
112{ 112{
113 if (cpu_has_64bit_gp_regs || cpu_has_64bit_zero_reg) 113 if (cpu_has_64bit_gp_regs || cpu_has_64bit_zero_reg)
114 clear_word_size = 8; 114 clear_word_size = 8;
@@ -199,7 +199,7 @@ static void __cpuinit set_prefetch_parameters(void)
199 4 * copy_word_size)); 199 4 * copy_word_size));
200} 200}
201 201
202static void __cpuinit build_clear_store(u32 **buf, int off) 202static void build_clear_store(u32 **buf, int off)
203{ 203{
204 if (cpu_has_64bit_gp_regs || cpu_has_64bit_zero_reg) { 204 if (cpu_has_64bit_gp_regs || cpu_has_64bit_zero_reg) {
205 uasm_i_sd(buf, ZERO, off, A0); 205 uasm_i_sd(buf, ZERO, off, A0);
@@ -208,7 +208,7 @@ static void __cpuinit build_clear_store(u32 **buf, int off)
208 } 208 }
209} 209}
210 210
211static inline void __cpuinit build_clear_pref(u32 **buf, int off) 211static inline void build_clear_pref(u32 **buf, int off)
212{ 212{
213 if (off & cache_line_mask()) 213 if (off & cache_line_mask())
214 return; 214 return;
@@ -232,7 +232,7 @@ static inline void __cpuinit build_clear_pref(u32 **buf, int off)
232 232
233 uasm_i_cache(buf, Create_Dirty_Excl_D, off, A0); 233 uasm_i_cache(buf, Create_Dirty_Excl_D, off, A0);
234 } 234 }
235 } 235 }
236} 236}
237 237
238extern u32 __clear_page_start; 238extern u32 __clear_page_start;
@@ -240,7 +240,7 @@ extern u32 __clear_page_end;
240extern u32 __copy_page_start; 240extern u32 __copy_page_start;
241extern u32 __copy_page_end; 241extern u32 __copy_page_end;
242 242
243void __cpuinit build_clear_page(void) 243void build_clear_page(void)
244{ 244{
245 int off; 245 int off;
246 u32 *buf = &__clear_page_start; 246 u32 *buf = &__clear_page_start;
@@ -333,7 +333,7 @@ void __cpuinit build_clear_page(void)
333 pr_debug("\t.set pop\n"); 333 pr_debug("\t.set pop\n");
334} 334}
335 335
336static void __cpuinit build_copy_load(u32 **buf, int reg, int off) 336static void build_copy_load(u32 **buf, int reg, int off)
337{ 337{
338 if (cpu_has_64bit_gp_regs) { 338 if (cpu_has_64bit_gp_regs) {
339 uasm_i_ld(buf, reg, off, A1); 339 uasm_i_ld(buf, reg, off, A1);
@@ -342,7 +342,7 @@ static void __cpuinit build_copy_load(u32 **buf, int reg, int off)
342 } 342 }
343} 343}
344 344
345static void __cpuinit build_copy_store(u32 **buf, int reg, int off) 345static void build_copy_store(u32 **buf, int reg, int off)
346{ 346{
347 if (cpu_has_64bit_gp_regs) { 347 if (cpu_has_64bit_gp_regs) {
348 uasm_i_sd(buf, reg, off, A0); 348 uasm_i_sd(buf, reg, off, A0);
@@ -387,7 +387,7 @@ static inline void build_copy_store_pref(u32 **buf, int off)
387 } 387 }
388} 388}
389 389
390void __cpuinit build_copy_page(void) 390void build_copy_page(void)
391{ 391{
392 int off; 392 int off;
393 u32 *buf = &__copy_page_start; 393 u32 *buf = &__copy_page_start;
diff --git a/arch/mips/mm/sc-ip22.c b/arch/mips/mm/sc-ip22.c
index c6aaed934d53..dc7c5a5214a9 100644
--- a/arch/mips/mm/sc-ip22.c
+++ b/arch/mips/mm/sc-ip22.c
@@ -167,7 +167,7 @@ static struct bcache_ops indy_sc_ops = {
167 .bc_inv = indy_sc_wback_invalidate 167 .bc_inv = indy_sc_wback_invalidate
168}; 168};
169 169
170void __cpuinit indy_sc_init(void) 170void indy_sc_init(void)
171{ 171{
172 if (indy_sc_probe()) { 172 if (indy_sc_probe()) {
173 indy_sc_enable(); 173 indy_sc_enable();
diff --git a/arch/mips/mm/sc-mips.c b/arch/mips/mm/sc-mips.c
index df96da7e939b..5d01392e3518 100644
--- a/arch/mips/mm/sc-mips.c
+++ b/arch/mips/mm/sc-mips.c
@@ -132,7 +132,7 @@ static inline int __init mips_sc_probe(void)
132 return 1; 132 return 1;
133} 133}
134 134
135int __cpuinit mips_sc_init(void) 135int mips_sc_init(void)
136{ 136{
137 int found = mips_sc_probe(); 137 int found = mips_sc_probe();
138 if (found) { 138 if (found) {
diff --git a/arch/mips/mm/sc-r5k.c b/arch/mips/mm/sc-r5k.c
index 8bc67720e145..0216ed6eaa2a 100644
--- a/arch/mips/mm/sc-r5k.c
+++ b/arch/mips/mm/sc-r5k.c
@@ -98,7 +98,7 @@ static struct bcache_ops r5k_sc_ops = {
98 .bc_inv = r5k_dma_cache_inv_sc 98 .bc_inv = r5k_dma_cache_inv_sc
99}; 99};
100 100
101void __cpuinit r5k_sc_init(void) 101void r5k_sc_init(void)
102{ 102{
103 if (r5k_sc_probe()) { 103 if (r5k_sc_probe()) {
104 r5k_sc_enable(); 104 r5k_sc_enable();
diff --git a/arch/mips/mm/sc-rm7k.c b/arch/mips/mm/sc-rm7k.c
index 274af3be1442..aaffbba33706 100644
--- a/arch/mips/mm/sc-rm7k.c
+++ b/arch/mips/mm/sc-rm7k.c
@@ -104,7 +104,7 @@ static void blast_rm7k_tcache(void)
104/* 104/*
105 * This function is executed in uncached address space. 105 * This function is executed in uncached address space.
106 */ 106 */
107static __cpuinit void __rm7k_tc_enable(void) 107static void __rm7k_tc_enable(void)
108{ 108{
109 int i; 109 int i;
110 110
@@ -117,7 +117,7 @@ static __cpuinit void __rm7k_tc_enable(void)
117 cache_op(Index_Store_Tag_T, CKSEG0ADDR(i)); 117 cache_op(Index_Store_Tag_T, CKSEG0ADDR(i));
118} 118}
119 119
120static __cpuinit void rm7k_tc_enable(void) 120static void rm7k_tc_enable(void)
121{ 121{
122 if (read_c0_config() & RM7K_CONF_TE) 122 if (read_c0_config() & RM7K_CONF_TE)
123 return; 123 return;
@@ -130,7 +130,7 @@ static __cpuinit void rm7k_tc_enable(void)
130/* 130/*
131 * This function is executed in uncached address space. 131 * This function is executed in uncached address space.
132 */ 132 */
133static __cpuinit void __rm7k_sc_enable(void) 133static void __rm7k_sc_enable(void)
134{ 134{
135 int i; 135 int i;
136 136
@@ -143,7 +143,7 @@ static __cpuinit void __rm7k_sc_enable(void)
143 cache_op(Index_Store_Tag_SD, CKSEG0ADDR(i)); 143 cache_op(Index_Store_Tag_SD, CKSEG0ADDR(i));
144} 144}
145 145
146static __cpuinit void rm7k_sc_enable(void) 146static void rm7k_sc_enable(void)
147{ 147{
148 if (read_c0_config() & RM7K_CONF_SE) 148 if (read_c0_config() & RM7K_CONF_SE)
149 return; 149 return;
@@ -184,7 +184,7 @@ static struct bcache_ops rm7k_sc_ops = {
184 * This is a probing function like the one found in c-r4k.c, we look for the 184 * This is a probing function like the one found in c-r4k.c, we look for the
185 * wrap around point with different addresses. 185 * wrap around point with different addresses.
186 */ 186 */
187static __cpuinit void __probe_tcache(void) 187static void __probe_tcache(void)
188{ 188{
189 unsigned long flags, addr, begin, end, pow2; 189 unsigned long flags, addr, begin, end, pow2;
190 190
@@ -226,7 +226,7 @@ static __cpuinit void __probe_tcache(void)
226 local_irq_restore(flags); 226 local_irq_restore(flags);
227} 227}
228 228
229void __cpuinit rm7k_sc_init(void) 229void rm7k_sc_init(void)
230{ 230{
231 struct cpuinfo_mips *c = &current_cpu_data; 231 struct cpuinfo_mips *c = &current_cpu_data;
232 unsigned int config = read_c0_config(); 232 unsigned int config = read_c0_config();
diff --git a/arch/mips/mm/tlb-funcs.S b/arch/mips/mm/tlb-funcs.S
new file mode 100644
index 000000000000..30a494db99c2
--- /dev/null
+++ b/arch/mips/mm/tlb-funcs.S
@@ -0,0 +1,37 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Micro-assembler generated tlb handler functions.
7 *
8 * Copyright (C) 2013 Broadcom Corporation.
9 *
10 * Based on mm/page-funcs.c
11 * Copyright (C) 2012 MIPS Technologies, Inc.
12 * Copyright (C) 2012 Ralf Baechle <ralf@linux-mips.org>
13 */
14#include <asm/asm.h>
15#include <asm/regdef.h>
16
17#define FASTPATH_SIZE 128
18
19LEAF(tlbmiss_handler_setup_pgd)
20 .space 16 * 4
21END(tlbmiss_handler_setup_pgd)
22EXPORT(tlbmiss_handler_setup_pgd_end)
23
24LEAF(handle_tlbm)
25 .space FASTPATH_SIZE * 4
26END(handle_tlbm)
27EXPORT(handle_tlbm_end)
28
29LEAF(handle_tlbs)
30 .space FASTPATH_SIZE * 4
31END(handle_tlbs)
32EXPORT(handle_tlbs_end)
33
34LEAF(handle_tlbl)
35 .space FASTPATH_SIZE * 4
36END(handle_tlbl)
37EXPORT(handle_tlbl_end)
diff --git a/arch/mips/mm/tlb-r3k.c b/arch/mips/mm/tlb-r3k.c
index a63d1ed0827f..9aca10994cd2 100644
--- a/arch/mips/mm/tlb-r3k.c
+++ b/arch/mips/mm/tlb-r3k.c
@@ -276,7 +276,7 @@ void add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
276 } 276 }
277} 277}
278 278
279void __cpuinit tlb_init(void) 279void tlb_init(void)
280{ 280{
281 local_flush_tlb_all(); 281 local_flush_tlb_all();
282 282
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index c643de4c473a..00b26a67a06d 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -389,7 +389,7 @@ int __init has_transparent_hugepage(void)
389 389
390#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 390#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
391 391
392static int __cpuinitdata ntlb; 392static int ntlb;
393static int __init set_ntlb(char *str) 393static int __init set_ntlb(char *str)
394{ 394{
395 get_option(&str, &ntlb); 395 get_option(&str, &ntlb);
@@ -398,7 +398,7 @@ static int __init set_ntlb(char *str)
398 398
399__setup("ntlb=", set_ntlb); 399__setup("ntlb=", set_ntlb);
400 400
401void __cpuinit tlb_init(void) 401void tlb_init(void)
402{ 402{
403 /* 403 /*
404 * You should never change this register: 404 * You should never change this register:
diff --git a/arch/mips/mm/tlb-r8k.c b/arch/mips/mm/tlb-r8k.c
index 91c2499f806a..6a99733a4440 100644
--- a/arch/mips/mm/tlb-r8k.c
+++ b/arch/mips/mm/tlb-r8k.c
@@ -213,14 +213,14 @@ void __update_tlb(struct vm_area_struct * vma, unsigned long address, pte_t pte)
213 local_irq_restore(flags); 213 local_irq_restore(flags);
214} 214}
215 215
216static void __cpuinit probe_tlb(unsigned long config) 216static void probe_tlb(unsigned long config)
217{ 217{
218 struct cpuinfo_mips *c = &current_cpu_data; 218 struct cpuinfo_mips *c = &current_cpu_data;
219 219
220 c->tlbsize = 3 * 128; /* 3 sets each 128 entries */ 220 c->tlbsize = 3 * 128; /* 3 sets each 128 entries */
221} 221}
222 222
223void __cpuinit tlb_init(void) 223void tlb_init(void)
224{ 224{
225 unsigned int config = read_c0_config(); 225 unsigned int config = read_c0_config();
226 unsigned long status; 226 unsigned long status;
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index afeef93f81a7..556cb4815770 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -136,7 +136,7 @@ static int scratchpad_offset(int i)
136 * why; it's not an issue caused by the core RTL. 136 * why; it's not an issue caused by the core RTL.
137 * 137 *
138 */ 138 */
139static int __cpuinit m4kc_tlbp_war(void) 139static int m4kc_tlbp_war(void)
140{ 140{
141 return (current_cpu_data.processor_id & 0xffff00) == 141 return (current_cpu_data.processor_id & 0xffff00) ==
142 (PRID_COMP_MIPS | PRID_IMP_4KC); 142 (PRID_COMP_MIPS | PRID_IMP_4KC);
@@ -181,11 +181,9 @@ UASM_L_LA(_large_segbits_fault)
181UASM_L_LA(_tlb_huge_update) 181UASM_L_LA(_tlb_huge_update)
182#endif 182#endif
183 183
184static int __cpuinitdata hazard_instance; 184static int hazard_instance;
185 185
186static void __cpuinit uasm_bgezl_hazard(u32 **p, 186static void uasm_bgezl_hazard(u32 **p, struct uasm_reloc **r, int instance)
187 struct uasm_reloc **r,
188 int instance)
189{ 187{
190 switch (instance) { 188 switch (instance) {
191 case 0 ... 7: 189 case 0 ... 7:
@@ -196,9 +194,7 @@ static void __cpuinit uasm_bgezl_hazard(u32 **p,
196 } 194 }
197} 195}
198 196
199static void __cpuinit uasm_bgezl_label(struct uasm_label **l, 197static void uasm_bgezl_label(struct uasm_label **l, u32 **p, int instance)
200 u32 **p,
201 int instance)
202{ 198{
203 switch (instance) { 199 switch (instance) {
204 case 0 ... 7: 200 case 0 ... 7:
@@ -295,17 +291,28 @@ static inline void dump_handler(const char *symbol, const u32 *handler, int coun
295 * We deliberately chose a buffer size of 128, so we won't scribble 291 * We deliberately chose a buffer size of 128, so we won't scribble
296 * over anything important on overflow before we panic. 292 * over anything important on overflow before we panic.
297 */ 293 */
298static u32 tlb_handler[128] __cpuinitdata; 294static u32 tlb_handler[128];
299 295
300/* simply assume worst case size for labels and relocs */ 296/* simply assume worst case size for labels and relocs */
301static struct uasm_label labels[128] __cpuinitdata; 297static struct uasm_label labels[128];
302static struct uasm_reloc relocs[128] __cpuinitdata; 298static struct uasm_reloc relocs[128];
303 299
304static int check_for_high_segbits __cpuinitdata; 300static int check_for_high_segbits;
305 301
306static unsigned int kscratch_used_mask __cpuinitdata; 302static unsigned int kscratch_used_mask;
307 303
308static int __cpuinit allocate_kscratch(void) 304static inline int __maybe_unused c0_kscratch(void)
305{
306 switch (current_cpu_type()) {
307 case CPU_XLP:
308 case CPU_XLR:
309 return 22;
310 default:
311 return 31;
312 }
313}
314
315static int allocate_kscratch(void)
309{ 316{
310 int r; 317 int r;
311 unsigned int a = cpu_data[0].kscratch_mask & ~kscratch_used_mask; 318 unsigned int a = cpu_data[0].kscratch_mask & ~kscratch_used_mask;
@@ -322,11 +329,11 @@ static int __cpuinit allocate_kscratch(void)
322 return r; 329 return r;
323} 330}
324 331
325static int scratch_reg __cpuinitdata; 332static int scratch_reg;
326static int pgd_reg __cpuinitdata; 333static int pgd_reg;
327enum vmalloc64_mode {not_refill, refill_scratch, refill_noscratch}; 334enum vmalloc64_mode {not_refill, refill_scratch, refill_noscratch};
328 335
329static struct work_registers __cpuinit build_get_work_registers(u32 **p) 336static struct work_registers build_get_work_registers(u32 **p)
330{ 337{
331 struct work_registers r; 338 struct work_registers r;
332 339
@@ -334,9 +341,9 @@ static struct work_registers __cpuinit build_get_work_registers(u32 **p)
334 int smp_processor_id_sel; 341 int smp_processor_id_sel;
335 int smp_processor_id_shift; 342 int smp_processor_id_shift;
336 343
337 if (scratch_reg > 0) { 344 if (scratch_reg >= 0) {
338 /* Save in CPU local C0_KScratch? */ 345 /* Save in CPU local C0_KScratch? */
339 UASM_i_MTC0(p, 1, 31, scratch_reg); 346 UASM_i_MTC0(p, 1, c0_kscratch(), scratch_reg);
340 r.r1 = K0; 347 r.r1 = K0;
341 r.r2 = K1; 348 r.r2 = K1;
342 r.r3 = 1; 349 r.r3 = 1;
@@ -382,10 +389,10 @@ static struct work_registers __cpuinit build_get_work_registers(u32 **p)
382 return r; 389 return r;
383} 390}
384 391
385static void __cpuinit build_restore_work_registers(u32 **p) 392static void build_restore_work_registers(u32 **p)
386{ 393{
387 if (scratch_reg > 0) { 394 if (scratch_reg >= 0) {
388 UASM_i_MFC0(p, 1, 31, scratch_reg); 395 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
389 return; 396 return;
390 } 397 }
391 /* K0 already points to save area, restore $1 and $2 */ 398 /* K0 already points to save area, restore $1 and $2 */
@@ -407,7 +414,7 @@ extern unsigned long pgd_current[];
407/* 414/*
408 * The R3000 TLB handler is simple. 415 * The R3000 TLB handler is simple.
409 */ 416 */
410static void __cpuinit build_r3000_tlb_refill_handler(void) 417static void build_r3000_tlb_refill_handler(void)
411{ 418{
412 long pgdc = (long)pgd_current; 419 long pgdc = (long)pgd_current;
413 u32 *p; 420 u32 *p;
@@ -452,7 +459,7 @@ static void __cpuinit build_r3000_tlb_refill_handler(void)
452 * other one.To keep things simple, we first assume linear space, 459 * other one.To keep things simple, we first assume linear space,
453 * then we relocate it to the final handler layout as needed. 460 * then we relocate it to the final handler layout as needed.
454 */ 461 */
455static u32 final_handler[64] __cpuinitdata; 462static u32 final_handler[64];
456 463
457/* 464/*
458 * Hazards 465 * Hazards
@@ -476,7 +483,7 @@ static u32 final_handler[64] __cpuinitdata;
476 * 483 *
477 * As if we MIPS hackers wouldn't know how to nop pipelines happy ... 484 * As if we MIPS hackers wouldn't know how to nop pipelines happy ...
478 */ 485 */
479static void __cpuinit __maybe_unused build_tlb_probe_entry(u32 **p) 486static void __maybe_unused build_tlb_probe_entry(u32 **p)
480{ 487{
481 switch (current_cpu_type()) { 488 switch (current_cpu_type()) {
482 /* Found by experiment: R4600 v2.0/R4700 needs this, too. */ 489 /* Found by experiment: R4600 v2.0/R4700 needs this, too. */
@@ -500,9 +507,9 @@ static void __cpuinit __maybe_unused build_tlb_probe_entry(u32 **p)
500 */ 507 */
501enum tlb_write_entry { tlb_random, tlb_indexed }; 508enum tlb_write_entry { tlb_random, tlb_indexed };
502 509
503static void __cpuinit build_tlb_write_entry(u32 **p, struct uasm_label **l, 510static void build_tlb_write_entry(u32 **p, struct uasm_label **l,
504 struct uasm_reloc **r, 511 struct uasm_reloc **r,
505 enum tlb_write_entry wmode) 512 enum tlb_write_entry wmode)
506{ 513{
507 void(*tlbw)(u32 **) = NULL; 514 void(*tlbw)(u32 **) = NULL;
508 515
@@ -636,8 +643,8 @@ static void __cpuinit build_tlb_write_entry(u32 **p, struct uasm_label **l,
636 } 643 }
637} 644}
638 645
639static __cpuinit __maybe_unused void build_convert_pte_to_entrylo(u32 **p, 646static __maybe_unused void build_convert_pte_to_entrylo(u32 **p,
640 unsigned int reg) 647 unsigned int reg)
641{ 648{
642 if (cpu_has_rixi) { 649 if (cpu_has_rixi) {
643 UASM_i_ROTR(p, reg, reg, ilog2(_PAGE_GLOBAL)); 650 UASM_i_ROTR(p, reg, reg, ilog2(_PAGE_GLOBAL));
@@ -652,11 +659,9 @@ static __cpuinit __maybe_unused void build_convert_pte_to_entrylo(u32 **p,
652 659
653#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT 660#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
654 661
655static __cpuinit void build_restore_pagemask(u32 **p, 662static void build_restore_pagemask(u32 **p, struct uasm_reloc **r,
656 struct uasm_reloc **r, 663 unsigned int tmp, enum label_id lid,
657 unsigned int tmp, 664 int restore_scratch)
658 enum label_id lid,
659 int restore_scratch)
660{ 665{
661 if (restore_scratch) { 666 if (restore_scratch) {
662 /* Reset default page size */ 667 /* Reset default page size */
@@ -673,8 +678,8 @@ static __cpuinit void build_restore_pagemask(u32 **p,
673 uasm_i_mtc0(p, 0, C0_PAGEMASK); 678 uasm_i_mtc0(p, 0, C0_PAGEMASK);
674 uasm_il_b(p, r, lid); 679 uasm_il_b(p, r, lid);
675 } 680 }
676 if (scratch_reg > 0) 681 if (scratch_reg >= 0)
677 UASM_i_MFC0(p, 1, 31, scratch_reg); 682 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
678 else 683 else
679 UASM_i_LW(p, 1, scratchpad_offset(0), 0); 684 UASM_i_LW(p, 1, scratchpad_offset(0), 0);
680 } else { 685 } else {
@@ -695,12 +700,11 @@ static __cpuinit void build_restore_pagemask(u32 **p,
695 } 700 }
696} 701}
697 702
698static __cpuinit void build_huge_tlb_write_entry(u32 **p, 703static void build_huge_tlb_write_entry(u32 **p, struct uasm_label **l,
699 struct uasm_label **l, 704 struct uasm_reloc **r,
700 struct uasm_reloc **r, 705 unsigned int tmp,
701 unsigned int tmp, 706 enum tlb_write_entry wmode,
702 enum tlb_write_entry wmode, 707 int restore_scratch)
703 int restore_scratch)
704{ 708{
705 /* Set huge page tlb entry size */ 709 /* Set huge page tlb entry size */
706 uasm_i_lui(p, tmp, PM_HUGE_MASK >> 16); 710 uasm_i_lui(p, tmp, PM_HUGE_MASK >> 16);
@@ -715,9 +719,9 @@ static __cpuinit void build_huge_tlb_write_entry(u32 **p,
715/* 719/*
716 * Check if Huge PTE is present, if so then jump to LABEL. 720 * Check if Huge PTE is present, if so then jump to LABEL.
717 */ 721 */
718static void __cpuinit 722static void
719build_is_huge_pte(u32 **p, struct uasm_reloc **r, unsigned int tmp, 723build_is_huge_pte(u32 **p, struct uasm_reloc **r, unsigned int tmp,
720 unsigned int pmd, int lid) 724 unsigned int pmd, int lid)
721{ 725{
722 UASM_i_LW(p, tmp, 0, pmd); 726 UASM_i_LW(p, tmp, 0, pmd);
723 if (use_bbit_insns()) { 727 if (use_bbit_insns()) {
@@ -728,9 +732,8 @@ build_is_huge_pte(u32 **p, struct uasm_reloc **r, unsigned int tmp,
728 } 732 }
729} 733}
730 734
731static __cpuinit void build_huge_update_entries(u32 **p, 735static void build_huge_update_entries(u32 **p, unsigned int pte,
732 unsigned int pte, 736 unsigned int tmp)
733 unsigned int tmp)
734{ 737{
735 int small_sequence; 738 int small_sequence;
736 739
@@ -760,11 +763,10 @@ static __cpuinit void build_huge_update_entries(u32 **p,
760 UASM_i_MTC0(p, pte, C0_ENTRYLO1); /* load it */ 763 UASM_i_MTC0(p, pte, C0_ENTRYLO1); /* load it */
761} 764}
762 765
763static __cpuinit void build_huge_handler_tail(u32 **p, 766static void build_huge_handler_tail(u32 **p, struct uasm_reloc **r,
764 struct uasm_reloc **r, 767 struct uasm_label **l,
765 struct uasm_label **l, 768 unsigned int pte,
766 unsigned int pte, 769 unsigned int ptr)
767 unsigned int ptr)
768{ 770{
769#ifdef CONFIG_SMP 771#ifdef CONFIG_SMP
770 UASM_i_SC(p, pte, 0, ptr); 772 UASM_i_SC(p, pte, 0, ptr);
@@ -783,7 +785,7 @@ static __cpuinit void build_huge_handler_tail(u32 **p,
783 * TMP and PTR are scratch. 785 * TMP and PTR are scratch.
784 * TMP will be clobbered, PTR will hold the pmd entry. 786 * TMP will be clobbered, PTR will hold the pmd entry.
785 */ 787 */
786static void __cpuinit 788static void
787build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, 789build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
788 unsigned int tmp, unsigned int ptr) 790 unsigned int tmp, unsigned int ptr)
789{ 791{
@@ -817,7 +819,7 @@ build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
817#ifdef CONFIG_MIPS_PGD_C0_CONTEXT 819#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
818 if (pgd_reg != -1) { 820 if (pgd_reg != -1) {
819 /* pgd is in pgd_reg */ 821 /* pgd is in pgd_reg */
820 UASM_i_MFC0(p, ptr, 31, pgd_reg); 822 UASM_i_MFC0(p, ptr, c0_kscratch(), pgd_reg);
821 } else { 823 } else {
822 /* 824 /*
823 * &pgd << 11 stored in CONTEXT [23..63]. 825 * &pgd << 11 stored in CONTEXT [23..63].
@@ -875,7 +877,7 @@ build_get_pmde64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
875 * BVADDR is the faulting address, PTR is scratch. 877 * BVADDR is the faulting address, PTR is scratch.
876 * PTR will hold the pgd for vmalloc. 878 * PTR will hold the pgd for vmalloc.
877 */ 879 */
878static void __cpuinit 880static void
879build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, 881build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
880 unsigned int bvaddr, unsigned int ptr, 882 unsigned int bvaddr, unsigned int ptr,
881 enum vmalloc64_mode mode) 883 enum vmalloc64_mode mode)
@@ -929,8 +931,8 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
929 uasm_i_jr(p, ptr); 931 uasm_i_jr(p, ptr);
930 932
931 if (mode == refill_scratch) { 933 if (mode == refill_scratch) {
932 if (scratch_reg > 0) 934 if (scratch_reg >= 0)
933 UASM_i_MFC0(p, 1, 31, scratch_reg); 935 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
934 else 936 else
935 UASM_i_LW(p, 1, scratchpad_offset(0), 0); 937 UASM_i_LW(p, 1, scratchpad_offset(0), 0);
936 } else { 938 } else {
@@ -945,7 +947,7 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
945 * TMP and PTR are scratch. 947 * TMP and PTR are scratch.
946 * TMP will be clobbered, PTR will hold the pgd entry. 948 * TMP will be clobbered, PTR will hold the pgd entry.
947 */ 949 */
948static void __cpuinit __maybe_unused 950static void __maybe_unused
949build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr) 951build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr)
950{ 952{
951 long pgdc = (long)pgd_current; 953 long pgdc = (long)pgd_current;
@@ -961,7 +963,7 @@ build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr)
961 uasm_i_srl(p, ptr, ptr, 19); 963 uasm_i_srl(p, ptr, ptr, 19);
962#else 964#else
963 /* 965 /*
964 * smp_processor_id() << 3 is stored in CONTEXT. 966 * smp_processor_id() << 2 is stored in CONTEXT.
965 */ 967 */
966 uasm_i_mfc0(p, ptr, C0_CONTEXT); 968 uasm_i_mfc0(p, ptr, C0_CONTEXT);
967 UASM_i_LA_mostly(p, tmp, pgdc); 969 UASM_i_LA_mostly(p, tmp, pgdc);
@@ -980,7 +982,7 @@ build_get_pgde32(u32 **p, unsigned int tmp, unsigned int ptr)
980 982
981#endif /* !CONFIG_64BIT */ 983#endif /* !CONFIG_64BIT */
982 984
983static void __cpuinit build_adjust_context(u32 **p, unsigned int ctx) 985static void build_adjust_context(u32 **p, unsigned int ctx)
984{ 986{
985 unsigned int shift = 4 - (PTE_T_LOG2 + 1) + PAGE_SHIFT - 12; 987 unsigned int shift = 4 - (PTE_T_LOG2 + 1) + PAGE_SHIFT - 12;
986 unsigned int mask = (PTRS_PER_PTE / 2 - 1) << (PTE_T_LOG2 + 1); 988 unsigned int mask = (PTRS_PER_PTE / 2 - 1) << (PTE_T_LOG2 + 1);
@@ -1006,7 +1008,7 @@ static void __cpuinit build_adjust_context(u32 **p, unsigned int ctx)
1006 uasm_i_andi(p, ctx, ctx, mask); 1008 uasm_i_andi(p, ctx, ctx, mask);
1007} 1009}
1008 1010
1009static void __cpuinit build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr) 1011static void build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr)
1010{ 1012{
1011 /* 1013 /*
1012 * Bug workaround for the Nevada. It seems as if under certain 1014 * Bug workaround for the Nevada. It seems as if under certain
@@ -1031,8 +1033,7 @@ static void __cpuinit build_get_ptep(u32 **p, unsigned int tmp, unsigned int ptr
1031 UASM_i_ADDU(p, ptr, ptr, tmp); /* add in offset */ 1033 UASM_i_ADDU(p, ptr, ptr, tmp); /* add in offset */
1032} 1034}
1033 1035
1034static void __cpuinit build_update_entries(u32 **p, unsigned int tmp, 1036static void build_update_entries(u32 **p, unsigned int tmp, unsigned int ptep)
1035 unsigned int ptep)
1036{ 1037{
1037 /* 1038 /*
1038 * 64bit address support (36bit on a 32bit CPU) in a 32bit 1039 * 64bit address support (36bit on a 32bit CPU) in a 32bit
@@ -1093,10 +1094,10 @@ struct mips_huge_tlb_info {
1093 int restore_scratch; 1094 int restore_scratch;
1094}; 1095};
1095 1096
1096static struct mips_huge_tlb_info __cpuinit 1097static struct mips_huge_tlb_info
1097build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l, 1098build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l,
1098 struct uasm_reloc **r, unsigned int tmp, 1099 struct uasm_reloc **r, unsigned int tmp,
1099 unsigned int ptr, int c0_scratch) 1100 unsigned int ptr, int c0_scratch_reg)
1100{ 1101{
1101 struct mips_huge_tlb_info rv; 1102 struct mips_huge_tlb_info rv;
1102 unsigned int even, odd; 1103 unsigned int even, odd;
@@ -1110,12 +1111,12 @@ build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l,
1110 UASM_i_MFC0(p, tmp, C0_BADVADDR); 1111 UASM_i_MFC0(p, tmp, C0_BADVADDR);
1111 1112
1112 if (pgd_reg != -1) 1113 if (pgd_reg != -1)
1113 UASM_i_MFC0(p, ptr, 31, pgd_reg); 1114 UASM_i_MFC0(p, ptr, c0_kscratch(), pgd_reg);
1114 else 1115 else
1115 UASM_i_MFC0(p, ptr, C0_CONTEXT); 1116 UASM_i_MFC0(p, ptr, C0_CONTEXT);
1116 1117
1117 if (c0_scratch >= 0) 1118 if (c0_scratch_reg >= 0)
1118 UASM_i_MTC0(p, scratch, 31, c0_scratch); 1119 UASM_i_MTC0(p, scratch, c0_kscratch(), c0_scratch_reg);
1119 else 1120 else
1120 UASM_i_SW(p, scratch, scratchpad_offset(0), 0); 1121 UASM_i_SW(p, scratch, scratchpad_offset(0), 0);
1121 1122
@@ -1130,14 +1131,14 @@ build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l,
1130 } 1131 }
1131 } else { 1132 } else {
1132 if (pgd_reg != -1) 1133 if (pgd_reg != -1)
1133 UASM_i_MFC0(p, ptr, 31, pgd_reg); 1134 UASM_i_MFC0(p, ptr, c0_kscratch(), pgd_reg);
1134 else 1135 else
1135 UASM_i_MFC0(p, ptr, C0_CONTEXT); 1136 UASM_i_MFC0(p, ptr, C0_CONTEXT);
1136 1137
1137 UASM_i_MFC0(p, tmp, C0_BADVADDR); 1138 UASM_i_MFC0(p, tmp, C0_BADVADDR);
1138 1139
1139 if (c0_scratch >= 0) 1140 if (c0_scratch_reg >= 0)
1140 UASM_i_MTC0(p, scratch, 31, c0_scratch); 1141 UASM_i_MTC0(p, scratch, c0_kscratch(), c0_scratch_reg);
1141 else 1142 else
1142 UASM_i_SW(p, scratch, scratchpad_offset(0), 0); 1143 UASM_i_SW(p, scratch, scratchpad_offset(0), 0);
1143 1144
@@ -1242,8 +1243,8 @@ build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l,
1242 } 1243 }
1243 UASM_i_MTC0(p, odd, C0_ENTRYLO1); /* load it */ 1244 UASM_i_MTC0(p, odd, C0_ENTRYLO1); /* load it */
1244 1245
1245 if (c0_scratch >= 0) { 1246 if (c0_scratch_reg >= 0) {
1246 UASM_i_MFC0(p, scratch, 31, c0_scratch); 1247 UASM_i_MFC0(p, scratch, c0_kscratch(), c0_scratch_reg);
1247 build_tlb_write_entry(p, l, r, tlb_random); 1248 build_tlb_write_entry(p, l, r, tlb_random);
1248 uasm_l_leave(l, *p); 1249 uasm_l_leave(l, *p);
1249 rv.restore_scratch = 1; 1250 rv.restore_scratch = 1;
@@ -1271,7 +1272,7 @@ build_fast_tlb_refill_handler (u32 **p, struct uasm_label **l,
1271 */ 1272 */
1272#define MIPS64_REFILL_INSNS 32 1273#define MIPS64_REFILL_INSNS 32
1273 1274
1274static void __cpuinit build_r4000_tlb_refill_handler(void) 1275static void build_r4000_tlb_refill_handler(void)
1275{ 1276{
1276 u32 *p = tlb_handler; 1277 u32 *p = tlb_handler;
1277 struct uasm_label *l = labels; 1278 struct uasm_label *l = labels;
@@ -1286,7 +1287,7 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
1286 memset(relocs, 0, sizeof(relocs)); 1287 memset(relocs, 0, sizeof(relocs));
1287 memset(final_handler, 0, sizeof(final_handler)); 1288 memset(final_handler, 0, sizeof(final_handler));
1288 1289
1289 if ((scratch_reg > 0 || scratchpad_available()) && use_bbit_insns()) { 1290 if ((scratch_reg >= 0 || scratchpad_available()) && use_bbit_insns()) {
1290 htlb_info = build_fast_tlb_refill_handler(&p, &l, &r, K0, K1, 1291 htlb_info = build_fast_tlb_refill_handler(&p, &l, &r, K0, K1,
1291 scratch_reg); 1292 scratch_reg);
1292 vmalloc_mode = refill_scratch; 1293 vmalloc_mode = refill_scratch;
@@ -1444,27 +1445,25 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
1444 dump_handler("r4000_tlb_refill", (u32 *)ebase, 64); 1445 dump_handler("r4000_tlb_refill", (u32 *)ebase, 64);
1445} 1446}
1446 1447
1447/* 1448extern u32 handle_tlbl[], handle_tlbl_end[];
1448 * 128 instructions for the fastpath handler is generous and should 1449extern u32 handle_tlbs[], handle_tlbs_end[];
1449 * never be exceeded. 1450extern u32 handle_tlbm[], handle_tlbm_end[];
1450 */
1451#define FASTPATH_SIZE 128
1452 1451
1453u32 handle_tlbl[FASTPATH_SIZE] __cacheline_aligned;
1454u32 handle_tlbs[FASTPATH_SIZE] __cacheline_aligned;
1455u32 handle_tlbm[FASTPATH_SIZE] __cacheline_aligned;
1456#ifdef CONFIG_MIPS_PGD_C0_CONTEXT 1452#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
1457u32 tlbmiss_handler_setup_pgd_array[16] __cacheline_aligned; 1453extern u32 tlbmiss_handler_setup_pgd[], tlbmiss_handler_setup_pgd_end[];
1458 1454
1459static void __cpuinit build_r4000_setup_pgd(void) 1455static void build_r4000_setup_pgd(void)
1460{ 1456{
1461 const int a0 = 4; 1457 const int a0 = 4;
1462 const int a1 = 5; 1458 const int a1 = 5;
1463 u32 *p = tlbmiss_handler_setup_pgd_array; 1459 u32 *p = tlbmiss_handler_setup_pgd;
1460 const int tlbmiss_handler_setup_pgd_size =
1461 tlbmiss_handler_setup_pgd_end - tlbmiss_handler_setup_pgd;
1464 struct uasm_label *l = labels; 1462 struct uasm_label *l = labels;
1465 struct uasm_reloc *r = relocs; 1463 struct uasm_reloc *r = relocs;
1466 1464
1467 memset(tlbmiss_handler_setup_pgd_array, 0, sizeof(tlbmiss_handler_setup_pgd_array)); 1465 memset(tlbmiss_handler_setup_pgd, 0, tlbmiss_handler_setup_pgd_size *
1466 sizeof(tlbmiss_handler_setup_pgd[0]));
1468 memset(labels, 0, sizeof(labels)); 1467 memset(labels, 0, sizeof(labels));
1469 memset(relocs, 0, sizeof(relocs)); 1468 memset(relocs, 0, sizeof(relocs));
1470 1469
@@ -1490,21 +1489,21 @@ static void __cpuinit build_r4000_setup_pgd(void)
1490 } else { 1489 } else {
1491 /* PGD in c0_KScratch */ 1490 /* PGD in c0_KScratch */
1492 uasm_i_jr(&p, 31); 1491 uasm_i_jr(&p, 31);
1493 UASM_i_MTC0(&p, a0, 31, pgd_reg); 1492 UASM_i_MTC0(&p, a0, c0_kscratch(), pgd_reg);
1494 } 1493 }
1495 if (p - tlbmiss_handler_setup_pgd_array > ARRAY_SIZE(tlbmiss_handler_setup_pgd_array)) 1494 if (p >= tlbmiss_handler_setup_pgd_end)
1496 panic("tlbmiss_handler_setup_pgd_array space exceeded"); 1495 panic("tlbmiss_handler_setup_pgd space exceeded");
1496
1497 uasm_resolve_relocs(relocs, labels); 1497 uasm_resolve_relocs(relocs, labels);
1498 pr_debug("Wrote tlbmiss_handler_setup_pgd_array (%u instructions).\n", 1498 pr_debug("Wrote tlbmiss_handler_setup_pgd (%u instructions).\n",
1499 (unsigned int)(p - tlbmiss_handler_setup_pgd_array)); 1499 (unsigned int)(p - tlbmiss_handler_setup_pgd));
1500 1500
1501 dump_handler("tlbmiss_handler", 1501 dump_handler("tlbmiss_handler", tlbmiss_handler_setup_pgd,
1502 tlbmiss_handler_setup_pgd_array, 1502 tlbmiss_handler_setup_pgd_size);
1503 ARRAY_SIZE(tlbmiss_handler_setup_pgd_array));
1504} 1503}
1505#endif 1504#endif
1506 1505
1507static void __cpuinit 1506static void
1508iPTE_LW(u32 **p, unsigned int pte, unsigned int ptr) 1507iPTE_LW(u32 **p, unsigned int pte, unsigned int ptr)
1509{ 1508{
1510#ifdef CONFIG_SMP 1509#ifdef CONFIG_SMP
@@ -1524,7 +1523,7 @@ iPTE_LW(u32 **p, unsigned int pte, unsigned int ptr)
1524#endif 1523#endif
1525} 1524}
1526 1525
1527static void __cpuinit 1526static void
1528iPTE_SW(u32 **p, struct uasm_reloc **r, unsigned int pte, unsigned int ptr, 1527iPTE_SW(u32 **p, struct uasm_reloc **r, unsigned int pte, unsigned int ptr,
1529 unsigned int mode) 1528 unsigned int mode)
1530{ 1529{
@@ -1584,7 +1583,7 @@ iPTE_SW(u32 **p, struct uasm_reloc **r, unsigned int pte, unsigned int ptr,
1584 * the page table where this PTE is located, PTE will be re-loaded 1583 * the page table where this PTE is located, PTE will be re-loaded
1585 * with it's original value. 1584 * with it's original value.
1586 */ 1585 */
1587static void __cpuinit 1586static void
1588build_pte_present(u32 **p, struct uasm_reloc **r, 1587build_pte_present(u32 **p, struct uasm_reloc **r,
1589 int pte, int ptr, int scratch, enum label_id lid) 1588 int pte, int ptr, int scratch, enum label_id lid)
1590{ 1589{
@@ -1612,7 +1611,7 @@ build_pte_present(u32 **p, struct uasm_reloc **r,
1612} 1611}
1613 1612
1614/* Make PTE valid, store result in PTR. */ 1613/* Make PTE valid, store result in PTR. */
1615static void __cpuinit 1614static void
1616build_make_valid(u32 **p, struct uasm_reloc **r, unsigned int pte, 1615build_make_valid(u32 **p, struct uasm_reloc **r, unsigned int pte,
1617 unsigned int ptr) 1616 unsigned int ptr)
1618{ 1617{
@@ -1625,7 +1624,7 @@ build_make_valid(u32 **p, struct uasm_reloc **r, unsigned int pte,
1625 * Check if PTE can be written to, if not branch to LABEL. Regardless 1624 * Check if PTE can be written to, if not branch to LABEL. Regardless
1626 * restore PTE with value from PTR when done. 1625 * restore PTE with value from PTR when done.
1627 */ 1626 */
1628static void __cpuinit 1627static void
1629build_pte_writable(u32 **p, struct uasm_reloc **r, 1628build_pte_writable(u32 **p, struct uasm_reloc **r,
1630 unsigned int pte, unsigned int ptr, int scratch, 1629 unsigned int pte, unsigned int ptr, int scratch,
1631 enum label_id lid) 1630 enum label_id lid)
@@ -1645,7 +1644,7 @@ build_pte_writable(u32 **p, struct uasm_reloc **r,
1645/* Make PTE writable, update software status bits as well, then store 1644/* Make PTE writable, update software status bits as well, then store
1646 * at PTR. 1645 * at PTR.
1647 */ 1646 */
1648static void __cpuinit 1647static void
1649build_make_write(u32 **p, struct uasm_reloc **r, unsigned int pte, 1648build_make_write(u32 **p, struct uasm_reloc **r, unsigned int pte,
1650 unsigned int ptr) 1649 unsigned int ptr)
1651{ 1650{
@@ -1659,7 +1658,7 @@ build_make_write(u32 **p, struct uasm_reloc **r, unsigned int pte,
1659 * Check if PTE can be modified, if not branch to LABEL. Regardless 1658 * Check if PTE can be modified, if not branch to LABEL. Regardless
1660 * restore PTE with value from PTR when done. 1659 * restore PTE with value from PTR when done.
1661 */ 1660 */
1662static void __cpuinit 1661static void
1663build_pte_modifiable(u32 **p, struct uasm_reloc **r, 1662build_pte_modifiable(u32 **p, struct uasm_reloc **r,
1664 unsigned int pte, unsigned int ptr, int scratch, 1663 unsigned int pte, unsigned int ptr, int scratch,
1665 enum label_id lid) 1664 enum label_id lid)
@@ -1688,7 +1687,7 @@ build_pte_modifiable(u32 **p, struct uasm_reloc **r,
1688 * This places the pte into ENTRYLO0 and writes it with tlbwi. 1687 * This places the pte into ENTRYLO0 and writes it with tlbwi.
1689 * Then it returns. 1688 * Then it returns.
1690 */ 1689 */
1691static void __cpuinit 1690static void
1692build_r3000_pte_reload_tlbwi(u32 **p, unsigned int pte, unsigned int tmp) 1691build_r3000_pte_reload_tlbwi(u32 **p, unsigned int pte, unsigned int tmp)
1693{ 1692{
1694 uasm_i_mtc0(p, pte, C0_ENTRYLO0); /* cp0 delay */ 1693 uasm_i_mtc0(p, pte, C0_ENTRYLO0); /* cp0 delay */
@@ -1704,7 +1703,7 @@ build_r3000_pte_reload_tlbwi(u32 **p, unsigned int pte, unsigned int tmp)
1704 * may have the probe fail bit set as a result of a trap on a 1703 * may have the probe fail bit set as a result of a trap on a
1705 * kseg2 access, i.e. without refill. Then it returns. 1704 * kseg2 access, i.e. without refill. Then it returns.
1706 */ 1705 */
1707static void __cpuinit 1706static void
1708build_r3000_tlb_reload_write(u32 **p, struct uasm_label **l, 1707build_r3000_tlb_reload_write(u32 **p, struct uasm_label **l,
1709 struct uasm_reloc **r, unsigned int pte, 1708 struct uasm_reloc **r, unsigned int pte,
1710 unsigned int tmp) 1709 unsigned int tmp)
@@ -1722,7 +1721,7 @@ build_r3000_tlb_reload_write(u32 **p, struct uasm_label **l,
1722 uasm_i_rfe(p); /* branch delay */ 1721 uasm_i_rfe(p); /* branch delay */
1723} 1722}
1724 1723
1725static void __cpuinit 1724static void
1726build_r3000_tlbchange_handler_head(u32 **p, unsigned int pte, 1725build_r3000_tlbchange_handler_head(u32 **p, unsigned int pte,
1727 unsigned int ptr) 1726 unsigned int ptr)
1728{ 1727{
@@ -1742,13 +1741,14 @@ build_r3000_tlbchange_handler_head(u32 **p, unsigned int pte,
1742 uasm_i_tlbp(p); /* load delay */ 1741 uasm_i_tlbp(p); /* load delay */
1743} 1742}
1744 1743
1745static void __cpuinit build_r3000_tlb_load_handler(void) 1744static void build_r3000_tlb_load_handler(void)
1746{ 1745{
1747 u32 *p = handle_tlbl; 1746 u32 *p = handle_tlbl;
1747 const int handle_tlbl_size = handle_tlbl_end - handle_tlbl;
1748 struct uasm_label *l = labels; 1748 struct uasm_label *l = labels;
1749 struct uasm_reloc *r = relocs; 1749 struct uasm_reloc *r = relocs;
1750 1750
1751 memset(handle_tlbl, 0, sizeof(handle_tlbl)); 1751 memset(handle_tlbl, 0, handle_tlbl_size * sizeof(handle_tlbl[0]));
1752 memset(labels, 0, sizeof(labels)); 1752 memset(labels, 0, sizeof(labels));
1753 memset(relocs, 0, sizeof(relocs)); 1753 memset(relocs, 0, sizeof(relocs));
1754 1754
@@ -1762,23 +1762,24 @@ static void __cpuinit build_r3000_tlb_load_handler(void)
1762 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_0 & 0x0fffffff); 1762 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_0 & 0x0fffffff);
1763 uasm_i_nop(&p); 1763 uasm_i_nop(&p);
1764 1764
1765 if ((p - handle_tlbl) > FASTPATH_SIZE) 1765 if (p >= handle_tlbl_end)
1766 panic("TLB load handler fastpath space exceeded"); 1766 panic("TLB load handler fastpath space exceeded");
1767 1767
1768 uasm_resolve_relocs(relocs, labels); 1768 uasm_resolve_relocs(relocs, labels);
1769 pr_debug("Wrote TLB load handler fastpath (%u instructions).\n", 1769 pr_debug("Wrote TLB load handler fastpath (%u instructions).\n",
1770 (unsigned int)(p - handle_tlbl)); 1770 (unsigned int)(p - handle_tlbl));
1771 1771
1772 dump_handler("r3000_tlb_load", handle_tlbl, ARRAY_SIZE(handle_tlbl)); 1772 dump_handler("r3000_tlb_load", handle_tlbl, handle_tlbl_size);
1773} 1773}
1774 1774
1775static void __cpuinit build_r3000_tlb_store_handler(void) 1775static void build_r3000_tlb_store_handler(void)
1776{ 1776{
1777 u32 *p = handle_tlbs; 1777 u32 *p = handle_tlbs;
1778 const int handle_tlbs_size = handle_tlbs_end - handle_tlbs;
1778 struct uasm_label *l = labels; 1779 struct uasm_label *l = labels;
1779 struct uasm_reloc *r = relocs; 1780 struct uasm_reloc *r = relocs;
1780 1781
1781 memset(handle_tlbs, 0, sizeof(handle_tlbs)); 1782 memset(handle_tlbs, 0, handle_tlbs_size * sizeof(handle_tlbs[0]));
1782 memset(labels, 0, sizeof(labels)); 1783 memset(labels, 0, sizeof(labels));
1783 memset(relocs, 0, sizeof(relocs)); 1784 memset(relocs, 0, sizeof(relocs));
1784 1785
@@ -1792,23 +1793,24 @@ static void __cpuinit build_r3000_tlb_store_handler(void)
1792 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff); 1793 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff);
1793 uasm_i_nop(&p); 1794 uasm_i_nop(&p);
1794 1795
1795 if ((p - handle_tlbs) > FASTPATH_SIZE) 1796 if (p >= handle_tlbs_end)
1796 panic("TLB store handler fastpath space exceeded"); 1797 panic("TLB store handler fastpath space exceeded");
1797 1798
1798 uasm_resolve_relocs(relocs, labels); 1799 uasm_resolve_relocs(relocs, labels);
1799 pr_debug("Wrote TLB store handler fastpath (%u instructions).\n", 1800 pr_debug("Wrote TLB store handler fastpath (%u instructions).\n",
1800 (unsigned int)(p - handle_tlbs)); 1801 (unsigned int)(p - handle_tlbs));
1801 1802
1802 dump_handler("r3000_tlb_store", handle_tlbs, ARRAY_SIZE(handle_tlbs)); 1803 dump_handler("r3000_tlb_store", handle_tlbs, handle_tlbs_size);
1803} 1804}
1804 1805
1805static void __cpuinit build_r3000_tlb_modify_handler(void) 1806static void build_r3000_tlb_modify_handler(void)
1806{ 1807{
1807 u32 *p = handle_tlbm; 1808 u32 *p = handle_tlbm;
1809 const int handle_tlbm_size = handle_tlbm_end - handle_tlbm;
1808 struct uasm_label *l = labels; 1810 struct uasm_label *l = labels;
1809 struct uasm_reloc *r = relocs; 1811 struct uasm_reloc *r = relocs;
1810 1812
1811 memset(handle_tlbm, 0, sizeof(handle_tlbm)); 1813 memset(handle_tlbm, 0, handle_tlbm_size * sizeof(handle_tlbm[0]));
1812 memset(labels, 0, sizeof(labels)); 1814 memset(labels, 0, sizeof(labels));
1813 memset(relocs, 0, sizeof(relocs)); 1815 memset(relocs, 0, sizeof(relocs));
1814 1816
@@ -1822,21 +1824,21 @@ static void __cpuinit build_r3000_tlb_modify_handler(void)
1822 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff); 1824 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff);
1823 uasm_i_nop(&p); 1825 uasm_i_nop(&p);
1824 1826
1825 if ((p - handle_tlbm) > FASTPATH_SIZE) 1827 if (p >= handle_tlbm_end)
1826 panic("TLB modify handler fastpath space exceeded"); 1828 panic("TLB modify handler fastpath space exceeded");
1827 1829
1828 uasm_resolve_relocs(relocs, labels); 1830 uasm_resolve_relocs(relocs, labels);
1829 pr_debug("Wrote TLB modify handler fastpath (%u instructions).\n", 1831 pr_debug("Wrote TLB modify handler fastpath (%u instructions).\n",
1830 (unsigned int)(p - handle_tlbm)); 1832 (unsigned int)(p - handle_tlbm));
1831 1833
1832 dump_handler("r3000_tlb_modify", handle_tlbm, ARRAY_SIZE(handle_tlbm)); 1834 dump_handler("r3000_tlb_modify", handle_tlbm, handle_tlbm_size);
1833} 1835}
1834#endif /* CONFIG_MIPS_PGD_C0_CONTEXT */ 1836#endif /* CONFIG_MIPS_PGD_C0_CONTEXT */
1835 1837
1836/* 1838/*
1837 * R4000 style TLB load/store/modify handlers. 1839 * R4000 style TLB load/store/modify handlers.
1838 */ 1840 */
1839static struct work_registers __cpuinit 1841static struct work_registers
1840build_r4000_tlbchange_handler_head(u32 **p, struct uasm_label **l, 1842build_r4000_tlbchange_handler_head(u32 **p, struct uasm_label **l,
1841 struct uasm_reloc **r) 1843 struct uasm_reloc **r)
1842{ 1844{
@@ -1872,7 +1874,7 @@ build_r4000_tlbchange_handler_head(u32 **p, struct uasm_label **l,
1872 return wr; 1874 return wr;
1873} 1875}
1874 1876
1875static void __cpuinit 1877static void
1876build_r4000_tlbchange_handler_tail(u32 **p, struct uasm_label **l, 1878build_r4000_tlbchange_handler_tail(u32 **p, struct uasm_label **l,
1877 struct uasm_reloc **r, unsigned int tmp, 1879 struct uasm_reloc **r, unsigned int tmp,
1878 unsigned int ptr) 1880 unsigned int ptr)
@@ -1890,14 +1892,15 @@ build_r4000_tlbchange_handler_tail(u32 **p, struct uasm_label **l,
1890#endif 1892#endif
1891} 1893}
1892 1894
1893static void __cpuinit build_r4000_tlb_load_handler(void) 1895static void build_r4000_tlb_load_handler(void)
1894{ 1896{
1895 u32 *p = handle_tlbl; 1897 u32 *p = handle_tlbl;
1898 const int handle_tlbl_size = handle_tlbl_end - handle_tlbl;
1896 struct uasm_label *l = labels; 1899 struct uasm_label *l = labels;
1897 struct uasm_reloc *r = relocs; 1900 struct uasm_reloc *r = relocs;
1898 struct work_registers wr; 1901 struct work_registers wr;
1899 1902
1900 memset(handle_tlbl, 0, sizeof(handle_tlbl)); 1903 memset(handle_tlbl, 0, handle_tlbl_size * sizeof(handle_tlbl[0]));
1901 memset(labels, 0, sizeof(labels)); 1904 memset(labels, 0, sizeof(labels));
1902 memset(relocs, 0, sizeof(relocs)); 1905 memset(relocs, 0, sizeof(relocs));
1903 1906
@@ -1935,6 +1938,19 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
1935 uasm_i_nop(&p); 1938 uasm_i_nop(&p);
1936 1939
1937 uasm_i_tlbr(&p); 1940 uasm_i_tlbr(&p);
1941
1942 switch (current_cpu_type()) {
1943 default:
1944 if (cpu_has_mips_r2) {
1945 uasm_i_ehb(&p);
1946
1947 case CPU_CAVIUM_OCTEON:
1948 case CPU_CAVIUM_OCTEON_PLUS:
1949 case CPU_CAVIUM_OCTEON2:
1950 break;
1951 }
1952 }
1953
1938 /* Examine entrylo 0 or 1 based on ptr. */ 1954 /* Examine entrylo 0 or 1 based on ptr. */
1939 if (use_bbit_insns()) { 1955 if (use_bbit_insns()) {
1940 uasm_i_bbit0(&p, wr.r2, ilog2(sizeof(pte_t)), 8); 1956 uasm_i_bbit0(&p, wr.r2, ilog2(sizeof(pte_t)), 8);
@@ -1989,6 +2005,19 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
1989 uasm_i_nop(&p); 2005 uasm_i_nop(&p);
1990 2006
1991 uasm_i_tlbr(&p); 2007 uasm_i_tlbr(&p);
2008
2009 switch (current_cpu_type()) {
2010 default:
2011 if (cpu_has_mips_r2) {
2012 uasm_i_ehb(&p);
2013
2014 case CPU_CAVIUM_OCTEON:
2015 case CPU_CAVIUM_OCTEON_PLUS:
2016 case CPU_CAVIUM_OCTEON2:
2017 break;
2018 }
2019 }
2020
1992 /* Examine entrylo 0 or 1 based on ptr. */ 2021 /* Examine entrylo 0 or 1 based on ptr. */
1993 if (use_bbit_insns()) { 2022 if (use_bbit_insns()) {
1994 uasm_i_bbit0(&p, wr.r2, ilog2(sizeof(pte_t)), 8); 2023 uasm_i_bbit0(&p, wr.r2, ilog2(sizeof(pte_t)), 8);
@@ -2036,24 +2065,25 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
2036 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_0 & 0x0fffffff); 2065 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_0 & 0x0fffffff);
2037 uasm_i_nop(&p); 2066 uasm_i_nop(&p);
2038 2067
2039 if ((p - handle_tlbl) > FASTPATH_SIZE) 2068 if (p >= handle_tlbl_end)
2040 panic("TLB load handler fastpath space exceeded"); 2069 panic("TLB load handler fastpath space exceeded");
2041 2070
2042 uasm_resolve_relocs(relocs, labels); 2071 uasm_resolve_relocs(relocs, labels);
2043 pr_debug("Wrote TLB load handler fastpath (%u instructions).\n", 2072 pr_debug("Wrote TLB load handler fastpath (%u instructions).\n",
2044 (unsigned int)(p - handle_tlbl)); 2073 (unsigned int)(p - handle_tlbl));
2045 2074
2046 dump_handler("r4000_tlb_load", handle_tlbl, ARRAY_SIZE(handle_tlbl)); 2075 dump_handler("r4000_tlb_load", handle_tlbl, handle_tlbl_size);
2047} 2076}
2048 2077
2049static void __cpuinit build_r4000_tlb_store_handler(void) 2078static void build_r4000_tlb_store_handler(void)
2050{ 2079{
2051 u32 *p = handle_tlbs; 2080 u32 *p = handle_tlbs;
2081 const int handle_tlbs_size = handle_tlbs_end - handle_tlbs;
2052 struct uasm_label *l = labels; 2082 struct uasm_label *l = labels;
2053 struct uasm_reloc *r = relocs; 2083 struct uasm_reloc *r = relocs;
2054 struct work_registers wr; 2084 struct work_registers wr;
2055 2085
2056 memset(handle_tlbs, 0, sizeof(handle_tlbs)); 2086 memset(handle_tlbs, 0, handle_tlbs_size * sizeof(handle_tlbs[0]));
2057 memset(labels, 0, sizeof(labels)); 2087 memset(labels, 0, sizeof(labels));
2058 memset(relocs, 0, sizeof(relocs)); 2088 memset(relocs, 0, sizeof(relocs));
2059 2089
@@ -2090,24 +2120,25 @@ static void __cpuinit build_r4000_tlb_store_handler(void)
2090 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff); 2120 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff);
2091 uasm_i_nop(&p); 2121 uasm_i_nop(&p);
2092 2122
2093 if ((p - handle_tlbs) > FASTPATH_SIZE) 2123 if (p >= handle_tlbs_end)
2094 panic("TLB store handler fastpath space exceeded"); 2124 panic("TLB store handler fastpath space exceeded");
2095 2125
2096 uasm_resolve_relocs(relocs, labels); 2126 uasm_resolve_relocs(relocs, labels);
2097 pr_debug("Wrote TLB store handler fastpath (%u instructions).\n", 2127 pr_debug("Wrote TLB store handler fastpath (%u instructions).\n",
2098 (unsigned int)(p - handle_tlbs)); 2128 (unsigned int)(p - handle_tlbs));
2099 2129
2100 dump_handler("r4000_tlb_store", handle_tlbs, ARRAY_SIZE(handle_tlbs)); 2130 dump_handler("r4000_tlb_store", handle_tlbs, handle_tlbs_size);
2101} 2131}
2102 2132
2103static void __cpuinit build_r4000_tlb_modify_handler(void) 2133static void build_r4000_tlb_modify_handler(void)
2104{ 2134{
2105 u32 *p = handle_tlbm; 2135 u32 *p = handle_tlbm;
2136 const int handle_tlbm_size = handle_tlbm_end - handle_tlbm;
2106 struct uasm_label *l = labels; 2137 struct uasm_label *l = labels;
2107 struct uasm_reloc *r = relocs; 2138 struct uasm_reloc *r = relocs;
2108 struct work_registers wr; 2139 struct work_registers wr;
2109 2140
2110 memset(handle_tlbm, 0, sizeof(handle_tlbm)); 2141 memset(handle_tlbm, 0, handle_tlbm_size * sizeof(handle_tlbm[0]));
2111 memset(labels, 0, sizeof(labels)); 2142 memset(labels, 0, sizeof(labels));
2112 memset(relocs, 0, sizeof(relocs)); 2143 memset(relocs, 0, sizeof(relocs));
2113 2144
@@ -2145,17 +2176,31 @@ static void __cpuinit build_r4000_tlb_modify_handler(void)
2145 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff); 2176 uasm_i_j(&p, (unsigned long)tlb_do_page_fault_1 & 0x0fffffff);
2146 uasm_i_nop(&p); 2177 uasm_i_nop(&p);
2147 2178
2148 if ((p - handle_tlbm) > FASTPATH_SIZE) 2179 if (p >= handle_tlbm_end)
2149 panic("TLB modify handler fastpath space exceeded"); 2180 panic("TLB modify handler fastpath space exceeded");
2150 2181
2151 uasm_resolve_relocs(relocs, labels); 2182 uasm_resolve_relocs(relocs, labels);
2152 pr_debug("Wrote TLB modify handler fastpath (%u instructions).\n", 2183 pr_debug("Wrote TLB modify handler fastpath (%u instructions).\n",
2153 (unsigned int)(p - handle_tlbm)); 2184 (unsigned int)(p - handle_tlbm));
2154 2185
2155 dump_handler("r4000_tlb_modify", handle_tlbm, ARRAY_SIZE(handle_tlbm)); 2186 dump_handler("r4000_tlb_modify", handle_tlbm, handle_tlbm_size);
2187}
2188
2189static void flush_tlb_handlers(void)
2190{
2191 local_flush_icache_range((unsigned long)handle_tlbl,
2192 (unsigned long)handle_tlbl_end);
2193 local_flush_icache_range((unsigned long)handle_tlbs,
2194 (unsigned long)handle_tlbs_end);
2195 local_flush_icache_range((unsigned long)handle_tlbm,
2196 (unsigned long)handle_tlbm_end);
2197#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
2198 local_flush_icache_range((unsigned long)tlbmiss_handler_setup_pgd,
2199 (unsigned long)tlbmiss_handler_setup_pgd_end);
2200#endif
2156} 2201}
2157 2202
2158void __cpuinit build_tlb_refill_handler(void) 2203void build_tlb_refill_handler(void)
2159{ 2204{
2160 /* 2205 /*
2161 * The refill handler is generated per-CPU, multi-node systems 2206 * The refill handler is generated per-CPU, multi-node systems
@@ -2187,6 +2232,7 @@ void __cpuinit build_tlb_refill_handler(void)
2187 build_r3000_tlb_load_handler(); 2232 build_r3000_tlb_load_handler();
2188 build_r3000_tlb_store_handler(); 2233 build_r3000_tlb_store_handler();
2189 build_r3000_tlb_modify_handler(); 2234 build_r3000_tlb_modify_handler();
2235 flush_tlb_handlers();
2190 run_once++; 2236 run_once++;
2191 } 2237 }
2192#else 2238#else
@@ -2214,23 +2260,10 @@ void __cpuinit build_tlb_refill_handler(void)
2214 build_r4000_tlb_modify_handler(); 2260 build_r4000_tlb_modify_handler();
2215 if (!cpu_has_local_ebase) 2261 if (!cpu_has_local_ebase)
2216 build_r4000_tlb_refill_handler(); 2262 build_r4000_tlb_refill_handler();
2263 flush_tlb_handlers();
2217 run_once++; 2264 run_once++;
2218 } 2265 }
2219 if (cpu_has_local_ebase) 2266 if (cpu_has_local_ebase)
2220 build_r4000_tlb_refill_handler(); 2267 build_r4000_tlb_refill_handler();
2221 } 2268 }
2222} 2269}
2223
2224void __cpuinit flush_tlb_handlers(void)
2225{
2226 local_flush_icache_range((unsigned long)handle_tlbl,
2227 (unsigned long)handle_tlbl + sizeof(handle_tlbl));
2228 local_flush_icache_range((unsigned long)handle_tlbs,
2229 (unsigned long)handle_tlbs + sizeof(handle_tlbs));
2230 local_flush_icache_range((unsigned long)handle_tlbm,
2231 (unsigned long)handle_tlbm + sizeof(handle_tlbm));
2232#ifdef CONFIG_MIPS_PGD_C0_CONTEXT
2233 local_flush_icache_range((unsigned long)tlbmiss_handler_setup_pgd_array,
2234 (unsigned long)tlbmiss_handler_setup_pgd_array + sizeof(handle_tlbm));
2235#endif
2236}
diff --git a/arch/mips/mm/uasm-micromips.c b/arch/mips/mm/uasm-micromips.c
index 162ee6d62788..060000fa653c 100644
--- a/arch/mips/mm/uasm-micromips.c
+++ b/arch/mips/mm/uasm-micromips.c
@@ -49,7 +49,7 @@
49 49
50#include "uasm.c" 50#include "uasm.c"
51 51
52static struct insn insn_table_MM[] __uasminitdata = { 52static struct insn insn_table_MM[] = {
53 { insn_addu, M(mm_pool32a_op, 0, 0, 0, 0, mm_addu32_op), RT | RS | RD }, 53 { insn_addu, M(mm_pool32a_op, 0, 0, 0, 0, mm_addu32_op), RT | RS | RD },
54 { insn_addiu, M(mm_addiu32_op, 0, 0, 0, 0, 0), RT | RS | SIMM }, 54 { insn_addiu, M(mm_addiu32_op, 0, 0, 0, 0, 0), RT | RS | SIMM },
55 { insn_and, M(mm_pool32a_op, 0, 0, 0, 0, mm_and_op), RT | RS | RD }, 55 { insn_and, M(mm_pool32a_op, 0, 0, 0, 0, mm_and_op), RT | RS | RD },
@@ -118,7 +118,7 @@ static struct insn insn_table_MM[] __uasminitdata = {
118 118
119#undef M 119#undef M
120 120
121static inline __uasminit u32 build_bimm(s32 arg) 121static inline u32 build_bimm(s32 arg)
122{ 122{
123 WARN(arg > 0xffff || arg < -0x10000, 123 WARN(arg > 0xffff || arg < -0x10000,
124 KERN_WARNING "Micro-assembler field overflow\n"); 124 KERN_WARNING "Micro-assembler field overflow\n");
@@ -128,7 +128,7 @@ static inline __uasminit u32 build_bimm(s32 arg)
128 return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 1) & 0x7fff); 128 return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 1) & 0x7fff);
129} 129}
130 130
131static inline __uasminit u32 build_jimm(u32 arg) 131static inline u32 build_jimm(u32 arg)
132{ 132{
133 133
134 WARN(arg & ~((JIMM_MASK << 2) | 1), 134 WARN(arg & ~((JIMM_MASK << 2) | 1),
@@ -141,7 +141,7 @@ static inline __uasminit u32 build_jimm(u32 arg)
141 * The order of opcode arguments is implicitly left to right, 141 * The order of opcode arguments is implicitly left to right,
142 * starting with RS and ending with FUNC or IMM. 142 * starting with RS and ending with FUNC or IMM.
143 */ 143 */
144static void __uasminit build_insn(u32 **buf, enum opcode opc, ...) 144static void build_insn(u32 **buf, enum opcode opc, ...)
145{ 145{
146 struct insn *ip = NULL; 146 struct insn *ip = NULL;
147 unsigned int i; 147 unsigned int i;
@@ -199,7 +199,7 @@ static void __uasminit build_insn(u32 **buf, enum opcode opc, ...)
199 (*buf)++; 199 (*buf)++;
200} 200}
201 201
202static inline void __uasminit 202static inline void
203__resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab) 203__resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab)
204{ 204{
205 long laddr = (long)lab->addr; 205 long laddr = (long)lab->addr;
diff --git a/arch/mips/mm/uasm-mips.c b/arch/mips/mm/uasm-mips.c
index 5fcdd8fe3e83..0c724589854e 100644
--- a/arch/mips/mm/uasm-mips.c
+++ b/arch/mips/mm/uasm-mips.c
@@ -49,7 +49,7 @@
49 49
50#include "uasm.c" 50#include "uasm.c"
51 51
52static struct insn insn_table[] __uasminitdata = { 52static struct insn insn_table[] = {
53 { insn_addiu, M(addiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 53 { insn_addiu, M(addiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
54 { insn_addu, M(spec_op, 0, 0, 0, 0, addu_op), RS | RT | RD }, 54 { insn_addu, M(spec_op, 0, 0, 0, 0, addu_op), RS | RT | RD },
55 { insn_andi, M(andi_op, 0, 0, 0, 0, 0), RS | RT | UIMM }, 55 { insn_andi, M(andi_op, 0, 0, 0, 0, 0), RS | RT | UIMM },
@@ -119,7 +119,7 @@ static struct insn insn_table[] __uasminitdata = {
119 119
120#undef M 120#undef M
121 121
122static inline __uasminit u32 build_bimm(s32 arg) 122static inline u32 build_bimm(s32 arg)
123{ 123{
124 WARN(arg > 0x1ffff || arg < -0x20000, 124 WARN(arg > 0x1ffff || arg < -0x20000,
125 KERN_WARNING "Micro-assembler field overflow\n"); 125 KERN_WARNING "Micro-assembler field overflow\n");
@@ -129,7 +129,7 @@ static inline __uasminit u32 build_bimm(s32 arg)
129 return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 2) & 0x7fff); 129 return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 2) & 0x7fff);
130} 130}
131 131
132static inline __uasminit u32 build_jimm(u32 arg) 132static inline u32 build_jimm(u32 arg)
133{ 133{
134 WARN(arg & ~(JIMM_MASK << 2), 134 WARN(arg & ~(JIMM_MASK << 2),
135 KERN_WARNING "Micro-assembler field overflow\n"); 135 KERN_WARNING "Micro-assembler field overflow\n");
@@ -141,7 +141,7 @@ static inline __uasminit u32 build_jimm(u32 arg)
141 * The order of opcode arguments is implicitly left to right, 141 * The order of opcode arguments is implicitly left to right,
142 * starting with RS and ending with FUNC or IMM. 142 * starting with RS and ending with FUNC or IMM.
143 */ 143 */
144static void __uasminit build_insn(u32 **buf, enum opcode opc, ...) 144static void build_insn(u32 **buf, enum opcode opc, ...)
145{ 145{
146 struct insn *ip = NULL; 146 struct insn *ip = NULL;
147 unsigned int i; 147 unsigned int i;
@@ -187,7 +187,7 @@ static void __uasminit build_insn(u32 **buf, enum opcode opc, ...)
187 (*buf)++; 187 (*buf)++;
188} 188}
189 189
190static inline void __uasminit 190static inline void
191__resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab) 191__resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab)
192{ 192{
193 long laddr = (long)lab->addr; 193 long laddr = (long)lab->addr;
diff --git a/arch/mips/mm/uasm.c b/arch/mips/mm/uasm.c
index 7eb5e4355d25..b9d14b6c7f58 100644
--- a/arch/mips/mm/uasm.c
+++ b/arch/mips/mm/uasm.c
@@ -63,35 +63,35 @@ struct insn {
63 enum fields fields; 63 enum fields fields;
64}; 64};
65 65
66static inline __uasminit u32 build_rs(u32 arg) 66static inline u32 build_rs(u32 arg)
67{ 67{
68 WARN(arg & ~RS_MASK, KERN_WARNING "Micro-assembler field overflow\n"); 68 WARN(arg & ~RS_MASK, KERN_WARNING "Micro-assembler field overflow\n");
69 69
70 return (arg & RS_MASK) << RS_SH; 70 return (arg & RS_MASK) << RS_SH;
71} 71}
72 72
73static inline __uasminit u32 build_rt(u32 arg) 73static inline u32 build_rt(u32 arg)
74{ 74{
75 WARN(arg & ~RT_MASK, KERN_WARNING "Micro-assembler field overflow\n"); 75 WARN(arg & ~RT_MASK, KERN_WARNING "Micro-assembler field overflow\n");
76 76
77 return (arg & RT_MASK) << RT_SH; 77 return (arg & RT_MASK) << RT_SH;
78} 78}
79 79
80static inline __uasminit u32 build_rd(u32 arg) 80static inline u32 build_rd(u32 arg)
81{ 81{
82 WARN(arg & ~RD_MASK, KERN_WARNING "Micro-assembler field overflow\n"); 82 WARN(arg & ~RD_MASK, KERN_WARNING "Micro-assembler field overflow\n");
83 83
84 return (arg & RD_MASK) << RD_SH; 84 return (arg & RD_MASK) << RD_SH;
85} 85}
86 86
87static inline __uasminit u32 build_re(u32 arg) 87static inline u32 build_re(u32 arg)
88{ 88{
89 WARN(arg & ~RE_MASK, KERN_WARNING "Micro-assembler field overflow\n"); 89 WARN(arg & ~RE_MASK, KERN_WARNING "Micro-assembler field overflow\n");
90 90
91 return (arg & RE_MASK) << RE_SH; 91 return (arg & RE_MASK) << RE_SH;
92} 92}
93 93
94static inline __uasminit u32 build_simm(s32 arg) 94static inline u32 build_simm(s32 arg)
95{ 95{
96 WARN(arg > 0x7fff || arg < -0x8000, 96 WARN(arg > 0x7fff || arg < -0x8000,
97 KERN_WARNING "Micro-assembler field overflow\n"); 97 KERN_WARNING "Micro-assembler field overflow\n");
@@ -99,14 +99,14 @@ static inline __uasminit u32 build_simm(s32 arg)
99 return arg & 0xffff; 99 return arg & 0xffff;
100} 100}
101 101
102static inline __uasminit u32 build_uimm(u32 arg) 102static inline u32 build_uimm(u32 arg)
103{ 103{
104 WARN(arg & ~IMM_MASK, KERN_WARNING "Micro-assembler field overflow\n"); 104 WARN(arg & ~IMM_MASK, KERN_WARNING "Micro-assembler field overflow\n");
105 105
106 return arg & IMM_MASK; 106 return arg & IMM_MASK;
107} 107}
108 108
109static inline __uasminit u32 build_scimm(u32 arg) 109static inline u32 build_scimm(u32 arg)
110{ 110{
111 WARN(arg & ~SCIMM_MASK, 111 WARN(arg & ~SCIMM_MASK,
112 KERN_WARNING "Micro-assembler field overflow\n"); 112 KERN_WARNING "Micro-assembler field overflow\n");
@@ -114,21 +114,21 @@ static inline __uasminit u32 build_scimm(u32 arg)
114 return (arg & SCIMM_MASK) << SCIMM_SH; 114 return (arg & SCIMM_MASK) << SCIMM_SH;
115} 115}
116 116
117static inline __uasminit u32 build_func(u32 arg) 117static inline u32 build_func(u32 arg)
118{ 118{
119 WARN(arg & ~FUNC_MASK, KERN_WARNING "Micro-assembler field overflow\n"); 119 WARN(arg & ~FUNC_MASK, KERN_WARNING "Micro-assembler field overflow\n");
120 120
121 return arg & FUNC_MASK; 121 return arg & FUNC_MASK;
122} 122}
123 123
124static inline __uasminit u32 build_set(u32 arg) 124static inline u32 build_set(u32 arg)
125{ 125{
126 WARN(arg & ~SET_MASK, KERN_WARNING "Micro-assembler field overflow\n"); 126 WARN(arg & ~SET_MASK, KERN_WARNING "Micro-assembler field overflow\n");
127 127
128 return arg & SET_MASK; 128 return arg & SET_MASK;
129} 129}
130 130
131static void __uasminit build_insn(u32 **buf, enum opcode opc, ...); 131static void build_insn(u32 **buf, enum opcode opc, ...);
132 132
133#define I_u1u2u3(op) \ 133#define I_u1u2u3(op) \
134Ip_u1u2u3(op) \ 134Ip_u1u2u3(op) \
@@ -286,7 +286,7 @@ I_u3u1u2(_ldx)
286 286
287#ifdef CONFIG_CPU_CAVIUM_OCTEON 287#ifdef CONFIG_CPU_CAVIUM_OCTEON
288#include <asm/octeon/octeon.h> 288#include <asm/octeon/octeon.h>
289void __uasminit ISAFUNC(uasm_i_pref)(u32 **buf, unsigned int a, signed int b, 289void ISAFUNC(uasm_i_pref)(u32 **buf, unsigned int a, signed int b,
290 unsigned int c) 290 unsigned int c)
291{ 291{
292 if (OCTEON_IS_MODEL(OCTEON_CN63XX_PASS1_X) && a <= 24 && a != 5) 292 if (OCTEON_IS_MODEL(OCTEON_CN63XX_PASS1_X) && a <= 24 && a != 5)
@@ -304,7 +304,7 @@ I_u2s3u1(_pref)
304#endif 304#endif
305 305
306/* Handle labels. */ 306/* Handle labels. */
307void __uasminit ISAFUNC(uasm_build_label)(struct uasm_label **lab, u32 *addr, int lid) 307void ISAFUNC(uasm_build_label)(struct uasm_label **lab, u32 *addr, int lid)
308{ 308{
309 (*lab)->addr = addr; 309 (*lab)->addr = addr;
310 (*lab)->lab = lid; 310 (*lab)->lab = lid;
@@ -312,7 +312,7 @@ void __uasminit ISAFUNC(uasm_build_label)(struct uasm_label **lab, u32 *addr, in
312} 312}
313UASM_EXPORT_SYMBOL(ISAFUNC(uasm_build_label)); 313UASM_EXPORT_SYMBOL(ISAFUNC(uasm_build_label));
314 314
315int __uasminit ISAFUNC(uasm_in_compat_space_p)(long addr) 315int ISAFUNC(uasm_in_compat_space_p)(long addr)
316{ 316{
317 /* Is this address in 32bit compat space? */ 317 /* Is this address in 32bit compat space? */
318#ifdef CONFIG_64BIT 318#ifdef CONFIG_64BIT
@@ -323,7 +323,7 @@ int __uasminit ISAFUNC(uasm_in_compat_space_p)(long addr)
323} 323}
324UASM_EXPORT_SYMBOL(ISAFUNC(uasm_in_compat_space_p)); 324UASM_EXPORT_SYMBOL(ISAFUNC(uasm_in_compat_space_p));
325 325
326static int __uasminit uasm_rel_highest(long val) 326static int uasm_rel_highest(long val)
327{ 327{
328#ifdef CONFIG_64BIT 328#ifdef CONFIG_64BIT
329 return ((((val + 0x800080008000L) >> 48) & 0xffff) ^ 0x8000) - 0x8000; 329 return ((((val + 0x800080008000L) >> 48) & 0xffff) ^ 0x8000) - 0x8000;
@@ -332,7 +332,7 @@ static int __uasminit uasm_rel_highest(long val)
332#endif 332#endif
333} 333}
334 334
335static int __uasminit uasm_rel_higher(long val) 335static int uasm_rel_higher(long val)
336{ 336{
337#ifdef CONFIG_64BIT 337#ifdef CONFIG_64BIT
338 return ((((val + 0x80008000L) >> 32) & 0xffff) ^ 0x8000) - 0x8000; 338 return ((((val + 0x80008000L) >> 32) & 0xffff) ^ 0x8000) - 0x8000;
@@ -341,19 +341,19 @@ static int __uasminit uasm_rel_higher(long val)
341#endif 341#endif
342} 342}
343 343
344int __uasminit ISAFUNC(uasm_rel_hi)(long val) 344int ISAFUNC(uasm_rel_hi)(long val)
345{ 345{
346 return ((((val + 0x8000L) >> 16) & 0xffff) ^ 0x8000) - 0x8000; 346 return ((((val + 0x8000L) >> 16) & 0xffff) ^ 0x8000) - 0x8000;
347} 347}
348UASM_EXPORT_SYMBOL(ISAFUNC(uasm_rel_hi)); 348UASM_EXPORT_SYMBOL(ISAFUNC(uasm_rel_hi));
349 349
350int __uasminit ISAFUNC(uasm_rel_lo)(long val) 350int ISAFUNC(uasm_rel_lo)(long val)
351{ 351{
352 return ((val & 0xffff) ^ 0x8000) - 0x8000; 352 return ((val & 0xffff) ^ 0x8000) - 0x8000;
353} 353}
354UASM_EXPORT_SYMBOL(ISAFUNC(uasm_rel_lo)); 354UASM_EXPORT_SYMBOL(ISAFUNC(uasm_rel_lo));
355 355
356void __uasminit ISAFUNC(UASM_i_LA_mostly)(u32 **buf, unsigned int rs, long addr) 356void ISAFUNC(UASM_i_LA_mostly)(u32 **buf, unsigned int rs, long addr)
357{ 357{
358 if (!ISAFUNC(uasm_in_compat_space_p)(addr)) { 358 if (!ISAFUNC(uasm_in_compat_space_p)(addr)) {
359 ISAFUNC(uasm_i_lui)(buf, rs, uasm_rel_highest(addr)); 359 ISAFUNC(uasm_i_lui)(buf, rs, uasm_rel_highest(addr));
@@ -371,7 +371,7 @@ void __uasminit ISAFUNC(UASM_i_LA_mostly)(u32 **buf, unsigned int rs, long addr)
371} 371}
372UASM_EXPORT_SYMBOL(ISAFUNC(UASM_i_LA_mostly)); 372UASM_EXPORT_SYMBOL(ISAFUNC(UASM_i_LA_mostly));
373 373
374void __uasminit ISAFUNC(UASM_i_LA)(u32 **buf, unsigned int rs, long addr) 374void ISAFUNC(UASM_i_LA)(u32 **buf, unsigned int rs, long addr)
375{ 375{
376 ISAFUNC(UASM_i_LA_mostly)(buf, rs, addr); 376 ISAFUNC(UASM_i_LA_mostly)(buf, rs, addr);
377 if (ISAFUNC(uasm_rel_lo(addr))) { 377 if (ISAFUNC(uasm_rel_lo(addr))) {
@@ -386,8 +386,7 @@ void __uasminit ISAFUNC(UASM_i_LA)(u32 **buf, unsigned int rs, long addr)
386UASM_EXPORT_SYMBOL(ISAFUNC(UASM_i_LA)); 386UASM_EXPORT_SYMBOL(ISAFUNC(UASM_i_LA));
387 387
388/* Handle relocations. */ 388/* Handle relocations. */
389void __uasminit 389void ISAFUNC(uasm_r_mips_pc16)(struct uasm_reloc **rel, u32 *addr, int lid)
390ISAFUNC(uasm_r_mips_pc16)(struct uasm_reloc **rel, u32 *addr, int lid)
391{ 390{
392 (*rel)->addr = addr; 391 (*rel)->addr = addr;
393 (*rel)->type = R_MIPS_PC16; 392 (*rel)->type = R_MIPS_PC16;
@@ -396,11 +395,11 @@ ISAFUNC(uasm_r_mips_pc16)(struct uasm_reloc **rel, u32 *addr, int lid)
396} 395}
397UASM_EXPORT_SYMBOL(ISAFUNC(uasm_r_mips_pc16)); 396UASM_EXPORT_SYMBOL(ISAFUNC(uasm_r_mips_pc16));
398 397
399static inline void __uasminit 398static inline void __resolve_relocs(struct uasm_reloc *rel,
400__resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab); 399 struct uasm_label *lab);
401 400
402void __uasminit 401void ISAFUNC(uasm_resolve_relocs)(struct uasm_reloc *rel,
403ISAFUNC(uasm_resolve_relocs)(struct uasm_reloc *rel, struct uasm_label *lab) 402 struct uasm_label *lab)
404{ 403{
405 struct uasm_label *l; 404 struct uasm_label *l;
406 405
@@ -411,8 +410,8 @@ ISAFUNC(uasm_resolve_relocs)(struct uasm_reloc *rel, struct uasm_label *lab)
411} 410}
412UASM_EXPORT_SYMBOL(ISAFUNC(uasm_resolve_relocs)); 411UASM_EXPORT_SYMBOL(ISAFUNC(uasm_resolve_relocs));
413 412
414void __uasminit 413void ISAFUNC(uasm_move_relocs)(struct uasm_reloc *rel, u32 *first, u32 *end,
415ISAFUNC(uasm_move_relocs)(struct uasm_reloc *rel, u32 *first, u32 *end, long off) 414 long off)
416{ 415{
417 for (; rel->lab != UASM_LABEL_INVALID; rel++) 416 for (; rel->lab != UASM_LABEL_INVALID; rel++)
418 if (rel->addr >= first && rel->addr < end) 417 if (rel->addr >= first && rel->addr < end)
@@ -420,8 +419,8 @@ ISAFUNC(uasm_move_relocs)(struct uasm_reloc *rel, u32 *first, u32 *end, long off
420} 419}
421UASM_EXPORT_SYMBOL(ISAFUNC(uasm_move_relocs)); 420UASM_EXPORT_SYMBOL(ISAFUNC(uasm_move_relocs));
422 421
423void __uasminit 422void ISAFUNC(uasm_move_labels)(struct uasm_label *lab, u32 *first, u32 *end,
424ISAFUNC(uasm_move_labels)(struct uasm_label *lab, u32 *first, u32 *end, long off) 423 long off)
425{ 424{
426 for (; lab->lab != UASM_LABEL_INVALID; lab++) 425 for (; lab->lab != UASM_LABEL_INVALID; lab++)
427 if (lab->addr >= first && lab->addr < end) 426 if (lab->addr >= first && lab->addr < end)
@@ -429,9 +428,8 @@ ISAFUNC(uasm_move_labels)(struct uasm_label *lab, u32 *first, u32 *end, long off
429} 428}
430UASM_EXPORT_SYMBOL(ISAFUNC(uasm_move_labels)); 429UASM_EXPORT_SYMBOL(ISAFUNC(uasm_move_labels));
431 430
432void __uasminit 431void ISAFUNC(uasm_copy_handler)(struct uasm_reloc *rel, struct uasm_label *lab,
433ISAFUNC(uasm_copy_handler)(struct uasm_reloc *rel, struct uasm_label *lab, u32 *first, 432 u32 *first, u32 *end, u32 *target)
434 u32 *end, u32 *target)
435{ 433{
436 long off = (long)(target - first); 434 long off = (long)(target - first);
437 435
@@ -442,7 +440,7 @@ ISAFUNC(uasm_copy_handler)(struct uasm_reloc *rel, struct uasm_label *lab, u32 *
442} 440}
443UASM_EXPORT_SYMBOL(ISAFUNC(uasm_copy_handler)); 441UASM_EXPORT_SYMBOL(ISAFUNC(uasm_copy_handler));
444 442
445int __uasminit ISAFUNC(uasm_insn_has_bdelay)(struct uasm_reloc *rel, u32 *addr) 443int ISAFUNC(uasm_insn_has_bdelay)(struct uasm_reloc *rel, u32 *addr)
446{ 444{
447 for (; rel->lab != UASM_LABEL_INVALID; rel++) { 445 for (; rel->lab != UASM_LABEL_INVALID; rel++) {
448 if (rel->addr == addr 446 if (rel->addr == addr
@@ -456,83 +454,79 @@ int __uasminit ISAFUNC(uasm_insn_has_bdelay)(struct uasm_reloc *rel, u32 *addr)
456UASM_EXPORT_SYMBOL(ISAFUNC(uasm_insn_has_bdelay)); 454UASM_EXPORT_SYMBOL(ISAFUNC(uasm_insn_has_bdelay));
457 455
458/* Convenience functions for labeled branches. */ 456/* Convenience functions for labeled branches. */
459void __uasminit 457void ISAFUNC(uasm_il_bltz)(u32 **p, struct uasm_reloc **r, unsigned int reg,
460ISAFUNC(uasm_il_bltz)(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) 458 int lid)
461{ 459{
462 uasm_r_mips_pc16(r, *p, lid); 460 uasm_r_mips_pc16(r, *p, lid);
463 ISAFUNC(uasm_i_bltz)(p, reg, 0); 461 ISAFUNC(uasm_i_bltz)(p, reg, 0);
464} 462}
465UASM_EXPORT_SYMBOL(ISAFUNC(uasm_il_bltz)); 463UASM_EXPORT_SYMBOL(ISAFUNC(uasm_il_bltz));
466 464
467void __uasminit 465void ISAFUNC(uasm_il_b)(u32 **p, struct uasm_reloc **r, int lid)
468ISAFUNC(uasm_il_b)(u32 **p, struct uasm_reloc **r, int lid)
469{ 466{
470 uasm_r_mips_pc16(r, *p, lid); 467 uasm_r_mips_pc16(r, *p, lid);
471 ISAFUNC(uasm_i_b)(p, 0); 468 ISAFUNC(uasm_i_b)(p, 0);
472} 469}
473UASM_EXPORT_SYMBOL(ISAFUNC(uasm_il_b)); 470UASM_EXPORT_SYMBOL(ISAFUNC(uasm_il_b));
474 471
475void __uasminit 472void ISAFUNC(uasm_il_beqz)(u32 **p, struct uasm_reloc **r, unsigned int reg,
476ISAFUNC(uasm_il_beqz)(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) 473 int lid)
477{ 474{
478 uasm_r_mips_pc16(r, *p, lid); 475 uasm_r_mips_pc16(r, *p, lid);
479 ISAFUNC(uasm_i_beqz)(p, reg, 0); 476 ISAFUNC(uasm_i_beqz)(p, reg, 0);
480} 477}
481UASM_EXPORT_SYMBOL(ISAFUNC(uasm_il_beqz)); 478UASM_EXPORT_SYMBOL(ISAFUNC(uasm_il_beqz));
482 479
483void __uasminit 480void ISAFUNC(uasm_il_beqzl)(u32 **p, struct uasm_reloc **r, unsigned int reg,
484ISAFUNC(uasm_il_beqzl)(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) 481 int lid)
485{ 482{
486 uasm_r_mips_pc16(r, *p, lid); 483 uasm_r_mips_pc16(r, *p, lid);
487 ISAFUNC(uasm_i_beqzl)(p, reg, 0); 484 ISAFUNC(uasm_i_beqzl)(p, reg, 0);
488} 485}
489UASM_EXPORT_SYMBOL(ISAFUNC(uasm_il_beqzl)); 486UASM_EXPORT_SYMBOL(ISAFUNC(uasm_il_beqzl));
490 487
491void __uasminit 488void ISAFUNC(uasm_il_bne)(u32 **p, struct uasm_reloc **r, unsigned int reg1,
492ISAFUNC(uasm_il_bne)(u32 **p, struct uasm_reloc **r, unsigned int reg1, 489 unsigned int reg2, int lid)
493 unsigned int reg2, int lid)
494{ 490{
495 uasm_r_mips_pc16(r, *p, lid); 491 uasm_r_mips_pc16(r, *p, lid);
496 ISAFUNC(uasm_i_bne)(p, reg1, reg2, 0); 492 ISAFUNC(uasm_i_bne)(p, reg1, reg2, 0);
497} 493}
498UASM_EXPORT_SYMBOL(ISAFUNC(uasm_il_bne)); 494UASM_EXPORT_SYMBOL(ISAFUNC(uasm_il_bne));
499 495
500void __uasminit 496void ISAFUNC(uasm_il_bnez)(u32 **p, struct uasm_reloc **r, unsigned int reg,
501ISAFUNC(uasm_il_bnez)(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) 497 int lid)
502{ 498{
503 uasm_r_mips_pc16(r, *p, lid); 499 uasm_r_mips_pc16(r, *p, lid);
504 ISAFUNC(uasm_i_bnez)(p, reg, 0); 500 ISAFUNC(uasm_i_bnez)(p, reg, 0);
505} 501}
506UASM_EXPORT_SYMBOL(ISAFUNC(uasm_il_bnez)); 502UASM_EXPORT_SYMBOL(ISAFUNC(uasm_il_bnez));
507 503
508void __uasminit 504void ISAFUNC(uasm_il_bgezl)(u32 **p, struct uasm_reloc **r, unsigned int reg,
509ISAFUNC(uasm_il_bgezl)(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) 505 int lid)
510{ 506{
511 uasm_r_mips_pc16(r, *p, lid); 507 uasm_r_mips_pc16(r, *p, lid);
512 ISAFUNC(uasm_i_bgezl)(p, reg, 0); 508 ISAFUNC(uasm_i_bgezl)(p, reg, 0);
513} 509}
514UASM_EXPORT_SYMBOL(ISAFUNC(uasm_il_bgezl)); 510UASM_EXPORT_SYMBOL(ISAFUNC(uasm_il_bgezl));
515 511
516void __uasminit 512void ISAFUNC(uasm_il_bgez)(u32 **p, struct uasm_reloc **r, unsigned int reg,
517ISAFUNC(uasm_il_bgez)(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) 513 int lid)
518{ 514{
519 uasm_r_mips_pc16(r, *p, lid); 515 uasm_r_mips_pc16(r, *p, lid);
520 ISAFUNC(uasm_i_bgez)(p, reg, 0); 516 ISAFUNC(uasm_i_bgez)(p, reg, 0);
521} 517}
522UASM_EXPORT_SYMBOL(ISAFUNC(uasm_il_bgez)); 518UASM_EXPORT_SYMBOL(ISAFUNC(uasm_il_bgez));
523 519
524void __uasminit 520void ISAFUNC(uasm_il_bbit0)(u32 **p, struct uasm_reloc **r, unsigned int reg,
525ISAFUNC(uasm_il_bbit0)(u32 **p, struct uasm_reloc **r, unsigned int reg, 521 unsigned int bit, int lid)
526 unsigned int bit, int lid)
527{ 522{
528 uasm_r_mips_pc16(r, *p, lid); 523 uasm_r_mips_pc16(r, *p, lid);
529 ISAFUNC(uasm_i_bbit0)(p, reg, bit, 0); 524 ISAFUNC(uasm_i_bbit0)(p, reg, bit, 0);
530} 525}
531UASM_EXPORT_SYMBOL(ISAFUNC(uasm_il_bbit0)); 526UASM_EXPORT_SYMBOL(ISAFUNC(uasm_il_bbit0));
532 527
533void __uasminit 528void ISAFUNC(uasm_il_bbit1)(u32 **p, struct uasm_reloc **r, unsigned int reg,
534ISAFUNC(uasm_il_bbit1)(u32 **p, struct uasm_reloc **r, unsigned int reg, 529 unsigned int bit, int lid)
535 unsigned int bit, int lid)
536{ 530{
537 uasm_r_mips_pc16(r, *p, lid); 531 uasm_r_mips_pc16(r, *p, lid);
538 ISAFUNC(uasm_i_bbit1)(p, reg, bit, 0); 532 ISAFUNC(uasm_i_bbit1)(p, reg, bit, 0);
diff --git a/arch/mips/mti-malta/Makefile b/arch/mips/mti-malta/Makefile
index 0388fc8b5613..72fdedbf76db 100644
--- a/arch/mips/mti-malta/Makefile
+++ b/arch/mips/mti-malta/Makefile
@@ -10,7 +10,6 @@ obj-y := malta-amon.o malta-display.o malta-init.o \
10 malta-reset.o malta-setup.o malta-time.o 10 malta-reset.o malta-setup.o malta-time.o
11 11
12obj-$(CONFIG_EARLY_PRINTK) += malta-console.o 12obj-$(CONFIG_EARLY_PRINTK) += malta-console.o
13obj-$(CONFIG_PCI) += malta-pci.o
14 13
15# FIXME FIXME FIXME 14# FIXME FIXME FIXME
16obj-$(CONFIG_MIPS_MT_SMTC) += malta-smtc.o 15obj-$(CONFIG_MIPS_MT_SMTC) += malta-smtc.o
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index 0a1339ac3ec8..c69da3734699 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -422,8 +422,10 @@ static struct gic_intr_map gic_intr_map[GIC_NUM_INTRS] = {
422 */ 422 */
423int __init gcmp_probe(unsigned long addr, unsigned long size) 423int __init gcmp_probe(unsigned long addr, unsigned long size)
424{ 424{
425 if (mips_revision_sconid != MIPS_REVISION_SCON_ROCIT) { 425 if ((mips_revision_sconid != MIPS_REVISION_SCON_ROCIT) &&
426 (mips_revision_sconid != MIPS_REVISION_SCON_GT64120)) {
426 gcmp_present = 0; 427 gcmp_present = 0;
428 pr_debug("GCMP NOT present\n");
427 return gcmp_present; 429 return gcmp_present;
428 } 430 }
429 431
diff --git a/arch/mips/mti-malta/malta-reset.c b/arch/mips/mti-malta/malta-reset.c
index 329420536241..d627d4b2b47f 100644
--- a/arch/mips/mti-malta/malta-reset.c
+++ b/arch/mips/mti-malta/malta-reset.c
@@ -1,33 +1,18 @@
1/* 1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
2 * Carsten Langgaard, carstenl@mips.com 6 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. 7 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * ########################################################################
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * ########################################################################
21 *
22 * Reset the MIPS boards.
23 *
24 */ 8 */
25#include <linux/init.h> 9#include <linux/io.h>
26#include <linux/pm.h> 10#include <linux/pm.h>
27 11
28#include <asm/io.h>
29#include <asm/reboot.h> 12#include <asm/reboot.h>
30#include <asm/mips-boards/generic.h> 13
14#define SOFTRES_REG 0x1f000500
15#define GORESET 0x42
31 16
32static void mips_machine_restart(char *command) 17static void mips_machine_restart(char *command)
33{ 18{
@@ -45,7 +30,6 @@ static void mips_machine_halt(void)
45 __raw_writel(GORESET, softres_reg); 30 __raw_writel(GORESET, softres_reg);
46} 31}
47 32
48
49static int __init mips_reboot_setup(void) 33static int __init mips_reboot_setup(void)
50{ 34{
51 _machine_restart = mips_machine_restart; 35 _machine_restart = mips_machine_restart;
@@ -54,5 +38,4 @@ static int __init mips_reboot_setup(void)
54 38
55 return 0; 39 return 0;
56} 40}
57
58arch_initcall(mips_reboot_setup); 41arch_initcall(mips_reboot_setup);
diff --git a/arch/mips/mti-malta/malta-smtc.c b/arch/mips/mti-malta/malta-smtc.c
index becbf47506a5..c4849904f013 100644
--- a/arch/mips/mti-malta/malta-smtc.c
+++ b/arch/mips/mti-malta/malta-smtc.c
@@ -32,7 +32,7 @@ static void msmtc_send_ipi_mask(const struct cpumask *mask, unsigned int action)
32/* 32/*
33 * Post-config but pre-boot cleanup entry point 33 * Post-config but pre-boot cleanup entry point
34 */ 34 */
35static void __cpuinit msmtc_init_secondary(void) 35static void msmtc_init_secondary(void)
36{ 36{
37 int myvpe; 37 int myvpe;
38 38
@@ -53,7 +53,7 @@ static void __cpuinit msmtc_init_secondary(void)
53/* 53/*
54 * Platform "CPU" startup hook 54 * Platform "CPU" startup hook
55 */ 55 */
56static void __cpuinit msmtc_boot_secondary(int cpu, struct task_struct *idle) 56static void msmtc_boot_secondary(int cpu, struct task_struct *idle)
57{ 57{
58 smtc_boot_secondary(cpu, idle); 58 smtc_boot_secondary(cpu, idle);
59} 59}
@@ -61,7 +61,7 @@ static void __cpuinit msmtc_boot_secondary(int cpu, struct task_struct *idle)
61/* 61/*
62 * SMP initialization finalization entry point 62 * SMP initialization finalization entry point
63 */ 63 */
64static void __cpuinit msmtc_smp_finish(void) 64static void msmtc_smp_finish(void)
65{ 65{
66 smtc_smp_finish(); 66 smtc_smp_finish();
67} 67}
diff --git a/arch/mips/mti-malta/malta-time.c b/arch/mips/mti-malta/malta-time.c
index 0ad305f75802..53aad4a35375 100644
--- a/arch/mips/mti-malta/malta-time.c
+++ b/arch/mips/mti-malta/malta-time.c
@@ -150,7 +150,7 @@ static void __init plat_perf_setup(void)
150 } 150 }
151} 151}
152 152
153unsigned int __cpuinit get_c0_compare_int(void) 153unsigned int get_c0_compare_int(void)
154{ 154{
155#ifdef MSC01E_INT_BASE 155#ifdef MSC01E_INT_BASE
156 if (cpu_has_veic) { 156 if (cpu_has_veic) {
diff --git a/arch/mips/mti-sead3/sead3-reset.c b/arch/mips/mti-sead3/sead3-reset.c
index 20475c5e7b9c..e6fb24414a70 100644
--- a/arch/mips/mti-sead3/sead3-reset.c
+++ b/arch/mips/mti-sead3/sead3-reset.c
@@ -9,7 +9,9 @@
9#include <linux/pm.h> 9#include <linux/pm.h>
10 10
11#include <asm/reboot.h> 11#include <asm/reboot.h>
12#include <asm/mips-boards/generic.h> 12
13#define SOFTRES_REG 0x1f000050
14#define GORESET 0x4d
13 15
14static void mips_machine_restart(char *command) 16static void mips_machine_restart(char *command)
15{ 17{
@@ -35,5 +37,4 @@ static int __init mips_reboot_setup(void)
35 37
36 return 0; 38 return 0;
37} 39}
38
39arch_initcall(mips_reboot_setup); 40arch_initcall(mips_reboot_setup);
diff --git a/arch/mips/mti-sead3/sead3-time.c b/arch/mips/mti-sead3/sead3-time.c
index 96b42eb9b5e2..a43ea3cc0a3b 100644
--- a/arch/mips/mti-sead3/sead3-time.c
+++ b/arch/mips/mti-sead3/sead3-time.c
@@ -91,7 +91,7 @@ static void __init plat_perf_setup(void)
91 } 91 }
92} 92}
93 93
94unsigned int __cpuinit get_c0_compare_int(void) 94unsigned int get_c0_compare_int(void)
95{ 95{
96 if (cpu_has_vint) 96 if (cpu_has_vint)
97 set_vi_handler(cp0_compare_irq, mips_timer_dispatch); 97 set_vi_handler(cp0_compare_irq, mips_timer_dispatch);
diff --git a/arch/mips/netlogic/Kconfig b/arch/mips/netlogic/Kconfig
index e0873a31ebaa..2447bf97d35a 100644
--- a/arch/mips/netlogic/Kconfig
+++ b/arch/mips/netlogic/Kconfig
@@ -51,4 +51,15 @@ endif
51config NLM_COMMON 51config NLM_COMMON
52 bool 52 bool
53 53
54config IOMMU_HELPER
55 bool
56
57config NEED_SG_DMA_LENGTH
58 bool
59
60config SWIOTLB
61 def_bool y
62 select NEED_SG_DMA_LENGTH
63 select IOMMU_HELPER
64
54endif 65endif
diff --git a/arch/mips/netlogic/common/Makefile b/arch/mips/netlogic/common/Makefile
index 291372a086f5..362739d62b1d 100644
--- a/arch/mips/netlogic/common/Makefile
+++ b/arch/mips/netlogic/common/Makefile
@@ -1,3 +1,5 @@
1obj-y += irq.o time.o 1obj-y += irq.o time.o
2obj-y += nlm-dma.o
3obj-y += reset.o
2obj-$(CONFIG_SMP) += smp.o smpboot.o 4obj-$(CONFIG_SMP) += smp.o smpboot.o
3obj-$(CONFIG_EARLY_PRINTK) += earlycons.o 5obj-$(CONFIG_EARLY_PRINTK) += earlycons.o
diff --git a/arch/mips/netlogic/common/irq.c b/arch/mips/netlogic/common/irq.c
index 9f84c60bf535..1c7e3a1b81ab 100644
--- a/arch/mips/netlogic/common/irq.c
+++ b/arch/mips/netlogic/common/irq.c
@@ -40,6 +40,10 @@
40#include <linux/slab.h> 40#include <linux/slab.h>
41#include <linux/irq.h> 41#include <linux/irq.h>
42 42
43#include <linux/irqdomain.h>
44#include <linux/of_address.h>
45#include <linux/of_irq.h>
46
43#include <asm/errno.h> 47#include <asm/errno.h>
44#include <asm/signal.h> 48#include <asm/signal.h>
45#include <asm/ptrace.h> 49#include <asm/ptrace.h>
@@ -223,17 +227,6 @@ static void nlm_init_node_irqs(int node)
223 nodep->irqmask = irqmask; 227 nodep->irqmask = irqmask;
224} 228}
225 229
226void __init arch_init_irq(void)
227{
228 /* Initialize the irq descriptors */
229 nlm_init_percpu_irqs();
230 nlm_init_node_irqs(0);
231 write_c0_eimr(nlm_current_node()->irqmask);
232#if defined(CONFIG_CPU_XLR)
233 nlm_setup_fmn_irq();
234#endif
235}
236
237void nlm_smp_irq_init(int hwcpuid) 230void nlm_smp_irq_init(int hwcpuid)
238{ 231{
239 int node, cpu; 232 int node, cpu;
@@ -253,13 +246,12 @@ asmlinkage void plat_irq_dispatch(void)
253 246
254 node = nlm_nodeid(); 247 node = nlm_nodeid();
255 eirr = read_c0_eirr_and_eimr(); 248 eirr = read_c0_eirr_and_eimr();
256 249 if (eirr == 0)
257 i = __ilog2_u64(eirr);
258 if (i == -1)
259 return; 250 return;
260 251
252 i = __ffs64(eirr);
261 /* per-CPU IRQs don't need translation */ 253 /* per-CPU IRQs don't need translation */
262 if (eirr & PERCPU_IRQ_MASK) { 254 if (i < PIC_IRQ_BASE) {
263 do_IRQ(i); 255 do_IRQ(i);
264 return; 256 return;
265 } 257 }
@@ -267,3 +259,56 @@ asmlinkage void plat_irq_dispatch(void)
267 /* top level irq handling */ 259 /* top level irq handling */
268 do_IRQ(nlm_irq_to_xirq(node, i)); 260 do_IRQ(nlm_irq_to_xirq(node, i));
269} 261}
262
263#ifdef CONFIG_OF
264static struct irq_domain *xlp_pic_domain;
265
266static const struct irq_domain_ops xlp_pic_irq_domain_ops = {
267 .xlate = irq_domain_xlate_onetwocell,
268};
269
270static int __init xlp_of_pic_init(struct device_node *node,
271 struct device_node *parent)
272{
273 const int n_picirqs = PIC_IRT_LAST_IRQ - PIC_IRQ_BASE + 1;
274 struct resource res;
275 int socid, ret;
276
277 /* we need a hack to get the PIC's SoC chip id */
278 ret = of_address_to_resource(node, 0, &res);
279 if (ret < 0) {
280 pr_err("PIC %s: reg property not found!\n", node->name);
281 return -EINVAL;
282 }
283 socid = (res.start >> 18) & 0x3;
284 xlp_pic_domain = irq_domain_add_legacy(node, n_picirqs,
285 nlm_irq_to_xirq(socid, PIC_IRQ_BASE), PIC_IRQ_BASE,
286 &xlp_pic_irq_domain_ops, NULL);
287 if (xlp_pic_domain == NULL) {
288 pr_err("PIC %s: Creating legacy domain failed!\n", node->name);
289 return -EINVAL;
290 }
291 pr_info("Node %d: IRQ domain created for PIC@%pa\n", socid,
292 &res.start);
293 return 0;
294}
295
296static struct of_device_id __initdata xlp_pic_irq_ids[] = {
297 { .compatible = "netlogic,xlp-pic", .data = xlp_of_pic_init },
298 {},
299};
300#endif
301
302void __init arch_init_irq(void)
303{
304 /* Initialize the irq descriptors */
305 nlm_init_percpu_irqs();
306 nlm_init_node_irqs(0);
307 write_c0_eimr(nlm_current_node()->irqmask);
308#if defined(CONFIG_CPU_XLR)
309 nlm_setup_fmn_irq();
310#endif
311#if defined(CONFIG_OF)
312 of_irq_init(xlp_pic_irq_ids);
313#endif
314}
diff --git a/arch/mips/netlogic/common/nlm-dma.c b/arch/mips/netlogic/common/nlm-dma.c
new file mode 100644
index 000000000000..f3d4ae87abc7
--- /dev/null
+++ b/arch/mips/netlogic/common/nlm-dma.c
@@ -0,0 +1,107 @@
1/*
2* Copyright (C) 2003-2013 Broadcom Corporation
3* All Rights Reserved
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the Broadcom
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34#include <linux/dma-mapping.h>
35#include <linux/scatterlist.h>
36#include <linux/bootmem.h>
37#include <linux/export.h>
38#include <linux/swiotlb.h>
39#include <linux/types.h>
40#include <linux/init.h>
41#include <linux/mm.h>
42
43#include <asm/bootinfo.h>
44
45static char *nlm_swiotlb;
46
47static void *nlm_dma_alloc_coherent(struct device *dev, size_t size,
48 dma_addr_t *dma_handle, gfp_t gfp, struct dma_attrs *attrs)
49{
50 void *ret;
51
52 if (dma_alloc_from_coherent(dev, size, dma_handle, &ret))
53 return ret;
54
55 /* ignore region specifiers */
56 gfp &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
57
58#ifdef CONFIG_ZONE_DMA32
59 if (dev->coherent_dma_mask <= DMA_BIT_MASK(32))
60 gfp |= __GFP_DMA32;
61#endif
62
63 /* Don't invoke OOM killer */
64 gfp |= __GFP_NORETRY;
65
66 return swiotlb_alloc_coherent(dev, size, dma_handle, gfp);
67}
68
69static void nlm_dma_free_coherent(struct device *dev, size_t size,
70 void *vaddr, dma_addr_t dma_handle, struct dma_attrs *attrs)
71{
72 int order = get_order(size);
73
74 if (dma_release_from_coherent(dev, order, vaddr))
75 return;
76
77 swiotlb_free_coherent(dev, size, vaddr, dma_handle);
78}
79
80struct dma_map_ops nlm_swiotlb_dma_ops = {
81 .alloc = nlm_dma_alloc_coherent,
82 .free = nlm_dma_free_coherent,
83 .map_page = swiotlb_map_page,
84 .unmap_page = swiotlb_unmap_page,
85 .map_sg = swiotlb_map_sg_attrs,
86 .unmap_sg = swiotlb_unmap_sg_attrs,
87 .sync_single_for_cpu = swiotlb_sync_single_for_cpu,
88 .sync_single_for_device = swiotlb_sync_single_for_device,
89 .sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
90 .sync_sg_for_device = swiotlb_sync_sg_for_device,
91 .mapping_error = swiotlb_dma_mapping_error,
92 .dma_supported = swiotlb_dma_supported
93};
94
95void __init plat_swiotlb_setup(void)
96{
97 size_t swiotlbsize;
98 unsigned long swiotlb_nslabs;
99
100 swiotlbsize = 1 << 20; /* 1 MB for now */
101 swiotlb_nslabs = swiotlbsize >> IO_TLB_SHIFT;
102 swiotlb_nslabs = ALIGN(swiotlb_nslabs, IO_TLB_SEGSIZE);
103 swiotlbsize = swiotlb_nslabs << IO_TLB_SHIFT;
104
105 nlm_swiotlb = alloc_bootmem_low_pages(swiotlbsize);
106 swiotlb_init_with_tbl(nlm_swiotlb, swiotlb_nslabs, 1);
107}
diff --git a/arch/mips/netlogic/common/reset.S b/arch/mips/netlogic/common/reset.S
new file mode 100644
index 000000000000..adb18288a6c0
--- /dev/null
+++ b/arch/mips/netlogic/common/reset.S
@@ -0,0 +1,230 @@
1/*
2 * Copyright 2003-2013 Broadcom Corporation.
3 * All Rights Reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the Broadcom
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#include <linux/init.h>
36
37#include <asm/asm.h>
38#include <asm/asm-offsets.h>
39#include <asm/regdef.h>
40#include <asm/mipsregs.h>
41#include <asm/stackframe.h>
42#include <asm/asmmacro.h>
43#include <asm/addrspace.h>
44
45#include <asm/netlogic/common.h>
46
47#include <asm/netlogic/xlp-hal/iomap.h>
48#include <asm/netlogic/xlp-hal/xlp.h>
49#include <asm/netlogic/xlp-hal/sys.h>
50#include <asm/netlogic/xlp-hal/cpucontrol.h>
51
52#define CP0_EBASE $15
53#define SYS_CPU_COHERENT_BASE(node) CKSEG1ADDR(XLP_DEFAULT_IO_BASE) + \
54 XLP_IO_SYS_OFFSET(node) + XLP_IO_PCI_HDRSZ + \
55 SYS_CPU_NONCOHERENT_MODE * 4
56
57/* Enable XLP features and workarounds in the LSU */
58.macro xlp_config_lsu
59 li t0, LSU_DEFEATURE
60 mfcr t1, t0
61
62 lui t2, 0xc080 /* SUE, Enable Unaligned Access, L2HPE */
63 or t1, t1, t2
64 mtcr t1, t0
65
66 li t0, ICU_DEFEATURE
67 mfcr t1, t0
68 ori t1, 0x1000 /* Enable Icache partitioning */
69 mtcr t1, t0
70
71 li t0, SCHED_DEFEATURE
72 lui t1, 0x0100 /* Disable BRU accepting ALU ops */
73 mtcr t1, t0
74.endm
75
76/*
77 * Low level flush for L1D cache on XLP, the normal cache ops does
78 * not do the complete and correct cache flush.
79 */
80.macro xlp_flush_l1_dcache
81 li t0, LSU_DEBUG_DATA0
82 li t1, LSU_DEBUG_ADDR
83 li t2, 0 /* index */
84 li t3, 0x1000 /* loop count */
851:
86 sll v0, t2, 5
87 mtcr zero, t0
88 ori v1, v0, 0x3 /* way0 | write_enable | write_active */
89 mtcr v1, t1
902:
91 mfcr v1, t1
92 andi v1, 0x1 /* wait for write_active == 0 */
93 bnez v1, 2b
94 nop
95 mtcr zero, t0
96 ori v1, v0, 0x7 /* way1 | write_enable | write_active */
97 mtcr v1, t1
983:
99 mfcr v1, t1
100 andi v1, 0x1 /* wait for write_active == 0 */
101 bnez v1, 3b
102 nop
103 addi t2, 1
104 bne t3, t2, 1b
105 nop
106.endm
107
108/*
109 * nlm_reset_entry will be copied to the reset entry point for
110 * XLR and XLP. The XLP cores start here when they are woken up. This
111 * is also the NMI entry point.
112 *
113 * We use scratch reg 6/7 to save k0/k1 and check for NMI first.
114 *
115 * The data corresponding to reset/NMI is stored at RESET_DATA_PHYS
116 * location, this will have the thread mask (used when core is woken up)
117 * and the current NMI handler in case we reached here for an NMI.
118 *
119 * When a core or thread is newly woken up, it marks itself ready and
120 * loops in a 'wait'. When the CPU really needs waking up, we send an NMI
121 * IPI to it, with the NMI handler set to prom_boot_secondary_cpus
122 */
123 .set noreorder
124 .set noat
125 .set arch=xlr /* for mfcr/mtcr, XLR is sufficient */
126
127FEXPORT(nlm_reset_entry)
128 dmtc0 k0, $22, 6
129 dmtc0 k1, $22, 7
130 mfc0 k0, CP0_STATUS
131 li k1, 0x80000
132 and k1, k0, k1
133 beqz k1, 1f /* go to real reset entry */
134 nop
135 li k1, CKSEG1ADDR(RESET_DATA_PHYS) /* NMI */
136 ld k0, BOOT_NMI_HANDLER(k1)
137 jr k0
138 nop
139
1401: /* Entry point on core wakeup */
141 mfc0 t0, CP0_EBASE, 1
142 mfc0 t1, CP0_EBASE, 1
143 srl t1, 5
144 andi t1, 0x3 /* t1 <- node */
145 li t2, 0x40000
146 mul t3, t2, t1 /* t3 = node * 0x40000 */
147 srl t0, t0, 2
148 and t0, t0, 0x7 /* t0 <- core */
149 li t1, 0x1
150 sll t0, t1, t0
151 nor t0, t0, zero /* t0 <- ~(1 << core) */
152 li t2, SYS_CPU_COHERENT_BASE(0)
153 add t2, t2, t3 /* t2 <- SYS offset for node */
154 lw t1, 0(t2)
155 and t1, t1, t0
156 sw t1, 0(t2)
157
158 /* read back to ensure complete */
159 lw t1, 0(t2)
160 sync
161
162 /* Configure LSU on Non-0 Cores. */
163 xlp_config_lsu
164 /* FALL THROUGH */
165
166/*
167 * Wake up sibling threads from the initial thread in
168 * a core.
169 */
170EXPORT(nlm_boot_siblings)
171 /* core L1D flush before enable threads */
172 xlp_flush_l1_dcache
173 /* Enable hw threads by writing to MAP_THREADMODE of the core */
174 li t0, CKSEG1ADDR(RESET_DATA_PHYS)
175 lw t1, BOOT_THREAD_MODE(t0) /* t1 <- thread mode */
176 li t0, ((CPU_BLOCKID_MAP << 8) | MAP_THREADMODE)
177 mfcr t2, t0
178 or t2, t2, t1
179 mtcr t2, t0
180
181 /*
182 * The new hardware thread starts at the next instruction
183 * For all the cases other than core 0 thread 0, we will
184 * jump to the secondary wait function.
185 */
186 mfc0 v0, CP0_EBASE, 1
187 andi v0, 0x3ff /* v0 <- node/core */
188
189 beqz v0, 4f /* boot cpu (cpuid == 0)? */
190 nop
191
192 /* setup status reg */
193 move t1, zero
194#ifdef CONFIG_64BIT
195 ori t1, ST0_KX
196#endif
197 mtc0 t1, CP0_STATUS
198
199 /* mark CPU ready, careful here, previous mtcr trashed registers */
200 li t3, CKSEG1ADDR(RESET_DATA_PHYS)
201 ADDIU t1, t3, BOOT_CPU_READY
202 sll v1, v0, 2
203 PTR_ADDU t1, v1
204 li t2, 1
205 sw t2, 0(t1)
206 /* Wait until NMI hits */
2073: wait
208 b 3b
209 nop
210
211 /*
212 * For the boot CPU, we have to restore registers and
213 * return
214 */
2154: dmfc0 t0, $4, 2 /* restore SP from UserLocal */
216 li t1, 0xfadebeef
217 dmtc0 t1, $4, 2 /* restore SP from UserLocal */
218 PTR_SUBU sp, t0, PT_SIZE
219 RESTORE_ALL
220 jr ra
221 nop
222EXPORT(nlm_reset_entry_end)
223
224LEAF(nlm_init_boot_cpu)
225#ifdef CONFIG_CPU_XLP
226 xlp_config_lsu
227#endif
228 jr ra
229 nop
230END(nlm_init_boot_cpu)
diff --git a/arch/mips/netlogic/common/smp.c b/arch/mips/netlogic/common/smp.c
index ffba52489bef..4e35d9c453e2 100644
--- a/arch/mips/netlogic/common/smp.c
+++ b/arch/mips/netlogic/common/smp.c
@@ -116,7 +116,7 @@ void nlm_early_init_secondary(int cpu)
116/* 116/*
117 * Code to run on secondary just after probing the CPU 117 * Code to run on secondary just after probing the CPU
118 */ 118 */
119static void __cpuinit nlm_init_secondary(void) 119static void nlm_init_secondary(void)
120{ 120{
121 int hwtid; 121 int hwtid;
122 122
@@ -145,7 +145,6 @@ void nlm_cpus_done(void)
145 * Boot all other cpus in the system, initialize them, and bring them into 145 * Boot all other cpus in the system, initialize them, and bring them into
146 * the boot function 146 * the boot function
147 */ 147 */
148int nlm_cpu_ready[NR_CPUS];
149unsigned long nlm_next_gp; 148unsigned long nlm_next_gp;
150unsigned long nlm_next_sp; 149unsigned long nlm_next_sp;
151static cpumask_t phys_cpu_present_mask; 150static cpumask_t phys_cpu_present_mask;
@@ -168,6 +167,7 @@ void __init nlm_smp_setup(void)
168{ 167{
169 unsigned int boot_cpu; 168 unsigned int boot_cpu;
170 int num_cpus, i, ncore; 169 int num_cpus, i, ncore;
170 volatile u32 *cpu_ready = nlm_get_boot_data(BOOT_CPU_READY);
171 char buf[64]; 171 char buf[64];
172 172
173 boot_cpu = hard_smp_processor_id(); 173 boot_cpu = hard_smp_processor_id();
@@ -181,10 +181,10 @@ void __init nlm_smp_setup(void)
181 num_cpus = 1; 181 num_cpus = 1;
182 for (i = 0; i < NR_CPUS; i++) { 182 for (i = 0; i < NR_CPUS; i++) {
183 /* 183 /*
184 * nlm_cpu_ready array is not set for the boot_cpu, 184 * cpu_ready array is not set for the boot_cpu,
185 * it is only set for ASPs (see smpboot.S) 185 * it is only set for ASPs (see smpboot.S)
186 */ 186 */
187 if (nlm_cpu_ready[i]) { 187 if (cpu_ready[i]) {
188 cpumask_set_cpu(i, &phys_cpu_present_mask); 188 cpumask_set_cpu(i, &phys_cpu_present_mask);
189 __cpu_number_map[i] = num_cpus; 189 __cpu_number_map[i] = num_cpus;
190 __cpu_logical_map[num_cpus] = i; 190 __cpu_logical_map[num_cpus] = i;
@@ -252,23 +252,17 @@ unsupp:
252 return 0; 252 return 0;
253} 253}
254 254
255int __cpuinit nlm_wakeup_secondary_cpus(void) 255int nlm_wakeup_secondary_cpus(void)
256{ 256{
257 unsigned long reset_vec; 257 u32 *reset_data;
258 char *reset_data;
259 int threadmode; 258 int threadmode;
260 259
261 /* Update reset entry point with CPU init code */
262 reset_vec = CKSEG1ADDR(RESET_VEC_PHYS);
263 memcpy((void *)reset_vec, (void *)nlm_reset_entry,
264 (nlm_reset_entry_end - nlm_reset_entry));
265
266 /* verify the mask and setup core config variables */ 260 /* verify the mask and setup core config variables */
267 threadmode = nlm_parse_cpumask(&nlm_cpumask); 261 threadmode = nlm_parse_cpumask(&nlm_cpumask);
268 262
269 /* Setup CPU init parameters */ 263 /* Setup CPU init parameters */
270 reset_data = (char *)CKSEG1ADDR(RESET_DATA_PHYS); 264 reset_data = nlm_get_boot_data(BOOT_THREAD_MODE);
271 *(int *)(reset_data + BOOT_THREAD_MODE) = threadmode; 265 *reset_data = threadmode;
272 266
273#ifdef CONFIG_CPU_XLP 267#ifdef CONFIG_CPU_XLP
274 xlp_wakeup_secondary_cpus(); 268 xlp_wakeup_secondary_cpus();
diff --git a/arch/mips/netlogic/common/smpboot.S b/arch/mips/netlogic/common/smpboot.S
index 026517488584..aa6cff0a229b 100644
--- a/arch/mips/netlogic/common/smpboot.S
+++ b/arch/mips/netlogic/common/smpboot.S
@@ -50,197 +50,12 @@
50#include <asm/netlogic/xlp-hal/cpucontrol.h> 50#include <asm/netlogic/xlp-hal/cpucontrol.h>
51 51
52#define CP0_EBASE $15 52#define CP0_EBASE $15
53#define SYS_CPU_COHERENT_BASE(node) CKSEG1ADDR(XLP_DEFAULT_IO_BASE) + \
54 XLP_IO_SYS_OFFSET(node) + XLP_IO_PCI_HDRSZ + \
55 SYS_CPU_NONCOHERENT_MODE * 4
56
57#define XLP_AX_WORKAROUND /* enable Ax silicon workarounds */
58
59/* Enable XLP features and workarounds in the LSU */
60.macro xlp_config_lsu
61 li t0, LSU_DEFEATURE
62 mfcr t1, t0
63
64 lui t2, 0xc080 /* SUE, Enable Unaligned Access, L2HPE */
65 or t1, t1, t2
66#ifdef XLP_AX_WORKAROUND
67 li t2, ~0xe /* S1RCM */
68 and t1, t1, t2
69#endif
70 mtcr t1, t0
71
72 li t0, ICU_DEFEATURE
73 mfcr t1, t0
74 ori t1, 0x1000 /* Enable Icache partitioning */
75 mtcr t1, t0
76
77
78#ifdef XLP_AX_WORKAROUND
79 li t0, SCHED_DEFEATURE
80 lui t1, 0x0100 /* Disable BRU accepting ALU ops */
81 mtcr t1, t0
82#endif
83.endm
84
85/*
86 * This is the code that will be copied to the reset entry point for
87 * XLR and XLP. The XLP cores start here when they are woken up. This
88 * is also the NMI entry point.
89 */
90.macro xlp_flush_l1_dcache
91 li t0, LSU_DEBUG_DATA0
92 li t1, LSU_DEBUG_ADDR
93 li t2, 0 /* index */
94 li t3, 0x1000 /* loop count */
951:
96 sll v0, t2, 5
97 mtcr zero, t0
98 ori v1, v0, 0x3 /* way0 | write_enable | write_active */
99 mtcr v1, t1
1002:
101 mfcr v1, t1
102 andi v1, 0x1 /* wait for write_active == 0 */
103 bnez v1, 2b
104 nop
105 mtcr zero, t0
106 ori v1, v0, 0x7 /* way1 | write_enable | write_active */
107 mtcr v1, t1
1083:
109 mfcr v1, t1
110 andi v1, 0x1 /* wait for write_active == 0 */
111 bnez v1, 3b
112 nop
113 addi t2, 1
114 bne t3, t2, 1b
115 nop
116.endm
117
118/*
119 * The cores can come start when they are woken up. This is also the NMI
120 * entry, so check that first.
121 *
122 * The data corresponding to reset/NMI is stored at RESET_DATA_PHYS
123 * location, this will have the thread mask (used when core is woken up)
124 * and the current NMI handler in case we reached here for an NMI.
125 *
126 * When a core or thread is newly woken up, it loops in a 'wait'. When
127 * the CPU really needs waking up, we send an NMI to it, with the NMI
128 * handler set to prom_boot_secondary_cpus
129 */
130 53
131 .set noreorder 54 .set noreorder
132 .set noat 55 .set noat
133 .set arch=xlr /* for mfcr/mtcr, XLR is sufficient */ 56 .set arch=xlr /* for mfcr/mtcr, XLR is sufficient */
134
135FEXPORT(nlm_reset_entry)
136 dmtc0 k0, $22, 6
137 dmtc0 k1, $22, 7
138 mfc0 k0, CP0_STATUS
139 li k1, 0x80000
140 and k1, k0, k1
141 beqz k1, 1f /* go to real reset entry */
142 nop
143 li k1, CKSEG1ADDR(RESET_DATA_PHYS) /* NMI */
144 ld k0, BOOT_NMI_HANDLER(k1)
145 jr k0
146 nop
147
1481: /* Entry point on core wakeup */
149 mfc0 t0, CP0_EBASE, 1
150 mfc0 t1, CP0_EBASE, 1
151 srl t1, 5
152 andi t1, 0x3 /* t1 <- node */
153 li t2, 0x40000
154 mul t3, t2, t1 /* t3 = node * 0x40000 */
155 srl t0, t0, 2
156 and t0, t0, 0x7 /* t0 <- core */
157 li t1, 0x1
158 sll t0, t1, t0
159 nor t0, t0, zero /* t0 <- ~(1 << core) */
160 li t2, SYS_CPU_COHERENT_BASE(0)
161 add t2, t2, t3 /* t2 <- SYS offset for node */
162 lw t1, 0(t2)
163 and t1, t1, t0
164 sw t1, 0(t2)
165
166 /* read back to ensure complete */
167 lw t1, 0(t2)
168 sync
169
170 /* Configure LSU on Non-0 Cores. */
171 xlp_config_lsu
172 /* FALL THROUGH */
173
174/*
175 * Wake up sibling threads from the initial thread in
176 * a core.
177 */
178EXPORT(nlm_boot_siblings)
179 /* core L1D flush before enable threads */
180 xlp_flush_l1_dcache
181 /* Enable hw threads by writing to MAP_THREADMODE of the core */
182 li t0, CKSEG1ADDR(RESET_DATA_PHYS)
183 lw t1, BOOT_THREAD_MODE(t0) /* t1 <- thread mode */
184 li t0, ((CPU_BLOCKID_MAP << 8) | MAP_THREADMODE)
185 mfcr t2, t0
186 or t2, t2, t1
187 mtcr t2, t0
188
189 /*
190 * The new hardware thread starts at the next instruction
191 * For all the cases other than core 0 thread 0, we will
192 * jump to the secondary wait function.
193 */
194 mfc0 v0, CP0_EBASE, 1
195 andi v0, 0x3ff /* v0 <- node/core */
196
197 /* Init MMU in the first thread after changing THREAD_MODE
198 * register (Ax Errata?)
199 */
200 andi v1, v0, 0x3 /* v1 <- thread id */
201 bnez v1, 2f
202 nop
203
204 li t0, MMU_SETUP
205 li t1, 0
206 mtcr t1, t0
207 _ehb
208
2092: beqz v0, 4f /* boot cpu (cpuid == 0)? */
210 nop
211
212 /* setup status reg */
213 move t1, zero
214#ifdef CONFIG_64BIT
215 ori t1, ST0_KX
216#endif
217 mtc0 t1, CP0_STATUS
218 /* mark CPU ready */
219 PTR_LA t1, nlm_cpu_ready
220 sll v1, v0, 2
221 PTR_ADDU t1, v1
222 li t2, 1
223 sw t2, 0(t1)
224 /* Wait until NMI hits */
2253: wait
226 j 3b
227 nop
228
229 /*
230 * For the boot CPU, we have to restore registers and
231 * return
232 */
2334: dmfc0 t0, $4, 2 /* restore SP from UserLocal */
234 li t1, 0xfadebeef
235 dmtc0 t1, $4, 2 /* restore SP from UserLocal */
236 PTR_SUBU sp, t0, PT_SIZE
237 RESTORE_ALL
238 jr ra
239 nop
240EXPORT(nlm_reset_entry_end)
241 57
242FEXPORT(xlp_boot_core0_siblings) /* "Master" cpu starts from here */ 58FEXPORT(xlp_boot_core0_siblings) /* "Master" cpu starts from here */
243 xlp_config_lsu
244 dmtc0 sp, $4, 2 /* SP saved in UserLocal */ 59 dmtc0 sp, $4, 2 /* SP saved in UserLocal */
245 SAVE_ALL 60 SAVE_ALL
246 sync 61 sync
@@ -255,7 +70,6 @@ FEXPORT(xlp_boot_core0_siblings) /* "Master" cpu starts from here */
255 nop 70 nop
256 /* not reached */ 71 /* not reached */
257 72
258 __CPUINIT
259NESTED(nlm_boot_secondary_cpus, 16, sp) 73NESTED(nlm_boot_secondary_cpus, 16, sp)
260 /* Initialize CP0 Status */ 74 /* Initialize CP0 Status */
261 move t1, zero 75 move t1, zero
@@ -279,7 +93,6 @@ NESTED(nlm_boot_secondary_cpus, 16, sp)
279 jr t0 93 jr t0
280 nop 94 nop
281END(nlm_boot_secondary_cpus) 95END(nlm_boot_secondary_cpus)
282 __FINIT
283 96
284/* 97/*
285 * In case of RMIboot bootloader which is used on XLR boards, the CPUs 98 * In case of RMIboot bootloader which is used on XLR boards, the CPUs
@@ -287,15 +100,15 @@ END(nlm_boot_secondary_cpus)
287 * This will get them out of the bootloader code and into linux. Needed 100 * This will get them out of the bootloader code and into linux. Needed
288 * because the bootloader area will be taken and initialized by linux. 101 * because the bootloader area will be taken and initialized by linux.
289 */ 102 */
290 __CPUINIT
291NESTED(nlm_rmiboot_preboot, 16, sp) 103NESTED(nlm_rmiboot_preboot, 16, sp)
292 mfc0 t0, $15, 1 /* read ebase */ 104 mfc0 t0, $15, 1 /* read ebase */
293 andi t0, 0x1f /* t0 has the processor_id() */ 105 andi t0, 0x1f /* t0 has the processor_id() */
294 andi t2, t0, 0x3 /* thread num */ 106 andi t2, t0, 0x3 /* thread num */
295 sll t0, 2 /* offset in cpu array */ 107 sll t0, 2 /* offset in cpu array */
296 108
297 PTR_LA t1, nlm_cpu_ready /* mark CPU ready */ 109 li t3, CKSEG1ADDR(RESET_DATA_PHYS)
298 PTR_ADDU t1, t0 110 ADDIU t1, t3, BOOT_CPU_READY
111 ADDU t1, t0
299 li t3, 1 112 li t3, 1
300 sw t3, 0(t1) 113 sw t3, 0(t1)
301 114
@@ -321,7 +134,6 @@ NESTED(nlm_rmiboot_preboot, 16, sp)
321 mtcr t1, t0 /* update core control */ 134 mtcr t1, t0 /* update core control */
322 135
3231: wait 1361: wait
324 j 1b 137 b 1b
325 nop 138 nop
326END(nlm_rmiboot_preboot) 139END(nlm_rmiboot_preboot)
327 __FINIT
diff --git a/arch/mips/netlogic/common/time.c b/arch/mips/netlogic/common/time.c
index 5c56555380bb..045a396c57ce 100644
--- a/arch/mips/netlogic/common/time.c
+++ b/arch/mips/netlogic/common/time.c
@@ -54,7 +54,7 @@
54#error "Unknown CPU" 54#error "Unknown CPU"
55#endif 55#endif
56 56
57unsigned int __cpuinit get_c0_compare_int(void) 57unsigned int get_c0_compare_int(void)
58{ 58{
59 return IRQ_TIMER; 59 return IRQ_TIMER;
60} 60}
diff --git a/arch/mips/netlogic/dts/xlp_evp.dts b/arch/mips/netlogic/dts/xlp_evp.dts
index e14f42308064..06407033678e 100644
--- a/arch/mips/netlogic/dts/xlp_evp.dts
+++ b/arch/mips/netlogic/dts/xlp_evp.dts
@@ -76,10 +76,11 @@
76 }; 76 };
77 }; 77 };
78 pic: pic@4000 { 78 pic: pic@4000 {
79 interrupt-controller; 79 compatible = "netlogic,xlp-pic";
80 #address-cells = <0>; 80 #address-cells = <0>;
81 #interrupt-cells = <1>; 81 #interrupt-cells = <1>;
82 reg = <0 0x4000 0x200>; 82 reg = <0 0x4000 0x200>;
83 interrupt-controller;
83 }; 84 };
84 85
85 nor_flash@1,0 { 86 nor_flash@1,0 {
diff --git a/arch/mips/netlogic/dts/xlp_svp.dts b/arch/mips/netlogic/dts/xlp_svp.dts
index 8af4bdbe5d99..9c5db102df53 100644
--- a/arch/mips/netlogic/dts/xlp_svp.dts
+++ b/arch/mips/netlogic/dts/xlp_svp.dts
@@ -76,10 +76,11 @@
76 }; 76 };
77 }; 77 };
78 pic: pic@4000 { 78 pic: pic@4000 {
79 interrupt-controller; 79 compatible = "netlogic,xlp-pic";
80 #address-cells = <0>; 80 #address-cells = <0>;
81 #interrupt-cells = <1>; 81 #interrupt-cells = <1>;
82 reg = <0 0x4000 0x200>; 82 reg = <0 0x4000 0x200>;
83 interrupt-controller;
83 }; 84 };
84 85
85 nor_flash@1,0 { 86 nor_flash@1,0 {
diff --git a/arch/mips/netlogic/xlp/Makefile b/arch/mips/netlogic/xlp/Makefile
index a84d6ed3746c..85ac4a892ced 100644
--- a/arch/mips/netlogic/xlp/Makefile
+++ b/arch/mips/netlogic/xlp/Makefile
@@ -1,3 +1,3 @@
1obj-y += setup.o nlm_hal.o 1obj-y += setup.o nlm_hal.o cop2-ex.o dt.o
2obj-$(CONFIG_SMP) += wakeup.o 2obj-$(CONFIG_SMP) += wakeup.o
3obj-$(CONFIG_USB) += usb-init.o 3obj-$(CONFIG_USB) += usb-init.o
diff --git a/arch/mips/netlogic/xlp/cop2-ex.c b/arch/mips/netlogic/xlp/cop2-ex.c
new file mode 100644
index 000000000000..52bc5de42005
--- /dev/null
+++ b/arch/mips/netlogic/xlp/cop2-ex.c
@@ -0,0 +1,118 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2013 Broadcom Corporation.
7 *
8 * based on arch/mips/cavium-octeon/cpu.c
9 * Copyright (C) 2009 Wind River Systems,
10 * written by Ralf Baechle <ralf@linux-mips.org>
11 */
12#include <linux/init.h>
13#include <linux/irqflags.h>
14#include <linux/notifier.h>
15#include <linux/prefetch.h>
16#include <linux/sched.h>
17
18#include <asm/cop2.h>
19#include <asm/current.h>
20#include <asm/mipsregs.h>
21#include <asm/page.h>
22
23#include <asm/netlogic/mips-extns.h>
24
25/*
26 * 64 bit ops are done in inline assembly to support 32 bit
27 * compilation
28 */
29void nlm_cop2_save(struct nlm_cop2_state *r)
30{
31 asm volatile(
32 ".set push\n"
33 ".set noat\n"
34 "dmfc2 $1, $0, 0\n"
35 "sd $1, 0(%1)\n"
36 "dmfc2 $1, $0, 1\n"
37 "sd $1, 8(%1)\n"
38 "dmfc2 $1, $0, 2\n"
39 "sd $1, 16(%1)\n"
40 "dmfc2 $1, $0, 3\n"
41 "sd $1, 24(%1)\n"
42 "dmfc2 $1, $1, 0\n"
43 "sd $1, 0(%2)\n"
44 "dmfc2 $1, $1, 1\n"
45 "sd $1, 8(%2)\n"
46 "dmfc2 $1, $1, 2\n"
47 "sd $1, 16(%2)\n"
48 "dmfc2 $1, $1, 3\n"
49 "sd $1, 24(%2)\n"
50 ".set pop\n"
51 : "=m"(*r)
52 : "r"(r->tx), "r"(r->rx));
53
54 r->tx_msg_status = __read_32bit_c2_register($2, 0);
55 r->rx_msg_status = __read_32bit_c2_register($3, 0) & 0x0fffffff;
56}
57
58void nlm_cop2_restore(struct nlm_cop2_state *r)
59{
60 u32 rstat;
61
62 asm volatile(
63 ".set push\n"
64 ".set noat\n"
65 "ld $1, 0(%1)\n"
66 "dmtc2 $1, $0, 0\n"
67 "ld $1, 8(%1)\n"
68 "dmtc2 $1, $0, 1\n"
69 "ld $1, 16(%1)\n"
70 "dmtc2 $1, $0, 2\n"
71 "ld $1, 24(%1)\n"
72 "dmtc2 $1, $0, 3\n"
73 "ld $1, 0(%2)\n"
74 "dmtc2 $1, $1, 0\n"
75 "ld $1, 8(%2)\n"
76 "dmtc2 $1, $1, 1\n"
77 "ld $1, 16(%2)\n"
78 "dmtc2 $1, $1, 2\n"
79 "ld $1, 24(%2)\n"
80 "dmtc2 $1, $1, 3\n"
81 ".set pop\n"
82 : : "m"(*r), "r"(r->tx), "r"(r->rx));
83
84 __write_32bit_c2_register($2, 0, r->tx_msg_status);
85 rstat = __read_32bit_c2_register($3, 0) & 0xf0000000u;
86 __write_32bit_c2_register($3, 0, r->rx_msg_status | rstat);
87}
88
89static int nlm_cu2_call(struct notifier_block *nfb, unsigned long action,
90 void *data)
91{
92 unsigned long flags;
93 unsigned int status;
94
95 switch (action) {
96 case CU2_EXCEPTION:
97 if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
98 break;
99 local_irq_save(flags);
100 KSTK_STATUS(current) |= ST0_CU2;
101 status = read_c0_status();
102 write_c0_status(status | ST0_CU2);
103 nlm_cop2_restore(&(current->thread.cp2));
104 write_c0_status(status & ~ST0_CU2);
105 local_irq_restore(flags);
106 pr_info("COP2 access enabled for pid %d (%s)\n",
107 current->pid, current->comm);
108 return NOTIFY_BAD; /* Don't call default notifier */
109 }
110
111 return NOTIFY_OK; /* Let default notifier send signals */
112}
113
114static int __init nlm_cu2_setup(void)
115{
116 return cu2_notifier(nlm_cu2_call, 0);
117}
118early_initcall(nlm_cu2_setup);
diff --git a/arch/mips/netlogic/xlp/dt.c b/arch/mips/netlogic/xlp/dt.c
new file mode 100644
index 000000000000..a15cdbb8d0bd
--- /dev/null
+++ b/arch/mips/netlogic/xlp/dt.c
@@ -0,0 +1,99 @@
1/*
2 * Copyright 2003-2013 Broadcom Corporation.
3 * All Rights Reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the Broadcom
9 * license below:
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * THIS SOFTWARE IS PROVIDED BY BROADCOM ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35#include <linux/kernel.h>
36#include <linux/bootmem.h>
37
38#include <linux/of_fdt.h>
39#include <linux/of_platform.h>
40#include <linux/of_device.h>
41
42extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[], __dtb_start[];
43
44void __init *xlp_dt_init(void *fdtp)
45{
46 if (!fdtp) {
47 switch (current_cpu_data.processor_id & 0xff00) {
48#ifdef CONFIG_DT_XLP_SVP
49 case PRID_IMP_NETLOGIC_XLP3XX:
50 fdtp = __dtb_xlp_svp_begin;
51 break;
52#endif
53#ifdef CONFIG_DT_XLP_EVP
54 case PRID_IMP_NETLOGIC_XLP8XX:
55 fdtp = __dtb_xlp_evp_begin;
56 break;
57#endif
58 default:
59 /* Pick a built-in if any, and hope for the best */
60 fdtp = __dtb_start;
61 break;
62 }
63 }
64 initial_boot_params = fdtp;
65 return fdtp;
66}
67
68void __init device_tree_init(void)
69{
70 unsigned long base, size;
71
72 if (!initial_boot_params)
73 return;
74
75 base = virt_to_phys((void *)initial_boot_params);
76 size = be32_to_cpu(initial_boot_params->totalsize);
77
78 /* Before we do anything, lets reserve the dt blob */
79 reserve_bootmem(base, size, BOOTMEM_DEFAULT);
80
81 unflatten_device_tree();
82
83 /* free the space reserved for the dt blob */
84 free_bootmem(base, size);
85}
86
87static struct of_device_id __initdata xlp_ids[] = {
88 { .compatible = "simple-bus", },
89 {},
90};
91
92int __init xlp8xx_ds_publish_devices(void)
93{
94 if (!of_have_populated_dt())
95 return 0;
96 return of_platform_bus_probe(NULL, xlp_ids, NULL);
97}
98
99device_initcall(xlp8xx_ds_publish_devices);
diff --git a/arch/mips/netlogic/xlp/setup.c b/arch/mips/netlogic/xlp/setup.c
index eaa99d28cb8e..7b638f7be491 100644
--- a/arch/mips/netlogic/xlp/setup.c
+++ b/arch/mips/netlogic/xlp/setup.c
@@ -33,19 +33,13 @@
33 */ 33 */
34 34
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/serial_8250.h> 36#include <linux/of_fdt.h>
37#include <linux/pm.h>
38#include <linux/bootmem.h>
39 37
40#include <asm/idle.h> 38#include <asm/idle.h>
41#include <asm/reboot.h> 39#include <asm/reboot.h>
42#include <asm/time.h> 40#include <asm/time.h>
43#include <asm/bootinfo.h> 41#include <asm/bootinfo.h>
44 42
45#include <linux/of_fdt.h>
46#include <linux/of_platform.h>
47#include <linux/of_device.h>
48
49#include <asm/netlogic/haldefs.h> 43#include <asm/netlogic/haldefs.h>
50#include <asm/netlogic/common.h> 44#include <asm/netlogic/common.h>
51 45
@@ -57,7 +51,6 @@ uint64_t nlm_io_base;
57struct nlm_soc_info nlm_nodes[NLM_NR_NODES]; 51struct nlm_soc_info nlm_nodes[NLM_NR_NODES];
58cpumask_t nlm_cpumask = CPU_MASK_CPU0; 52cpumask_t nlm_cpumask = CPU_MASK_CPU0;
59unsigned int nlm_threads_per_core; 53unsigned int nlm_threads_per_core;
60extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[], __dtb_start[];
61 54
62static void nlm_linux_exit(void) 55static void nlm_linux_exit(void)
63{ 56{
@@ -68,41 +61,28 @@ static void nlm_linux_exit(void)
68 cpu_wait(); 61 cpu_wait();
69} 62}
70 63
71void __init plat_mem_setup(void) 64static void nlm_fixup_mem(void)
72{ 65{
73 void *fdtp; 66 const int pref_backup = 512;
67 int i;
68
69 for (i = 0; i < boot_mem_map.nr_map; i++) {
70 if (boot_mem_map.map[i].type != BOOT_MEM_RAM)
71 continue;
72 boot_mem_map.map[i].size -= pref_backup;
73 }
74}
74 75
76void __init plat_mem_setup(void)
77{
75 panic_timeout = 5; 78 panic_timeout = 5;
76 _machine_restart = (void (*)(char *))nlm_linux_exit; 79 _machine_restart = (void (*)(char *))nlm_linux_exit;
77 _machine_halt = nlm_linux_exit; 80 _machine_halt = nlm_linux_exit;
78 pm_power_off = nlm_linux_exit; 81 pm_power_off = nlm_linux_exit;
79 82
80 /* 83 /* memory and bootargs from DT */
81 * If no FDT pointer is passed in, use the built-in FDT. 84 early_init_devtree(initial_boot_params);
82 * device_tree_init() does not handle CKSEG0 pointers in 85 nlm_fixup_mem();
83 * 64-bit, so convert pointer.
84 */
85 fdtp = (void *)(long)fw_arg0;
86 if (!fdtp) {
87 switch (current_cpu_data.processor_id & 0xff00) {
88#ifdef CONFIG_DT_XLP_SVP
89 case PRID_IMP_NETLOGIC_XLP3XX:
90 fdtp = __dtb_xlp_svp_begin;
91 break;
92#endif
93#ifdef CONFIG_DT_XLP_EVP
94 case PRID_IMP_NETLOGIC_XLP8XX:
95 fdtp = __dtb_xlp_evp_begin;
96 break;
97#endif
98 default:
99 /* Pick a built-in if any, and hope for the best */
100 fdtp = __dtb_start;
101 break;
102 }
103 }
104 fdtp = phys_to_virt(__pa(fdtp));
105 early_init_devtree(fdtp);
106} 86}
107 87
108const char *get_system_type(void) 88const char *get_system_type(void)
@@ -131,9 +111,19 @@ void nlm_percpu_init(int hwcpuid)
131 111
132void __init prom_init(void) 112void __init prom_init(void)
133{ 113{
114 void *reset_vec;
115
134 nlm_io_base = CKSEG1ADDR(XLP_DEFAULT_IO_BASE); 116 nlm_io_base = CKSEG1ADDR(XLP_DEFAULT_IO_BASE);
117 nlm_init_boot_cpu();
135 xlp_mmu_init(); 118 xlp_mmu_init();
136 nlm_node_init(0); 119 nlm_node_init(0);
120 xlp_dt_init((void *)(long)fw_arg0);
121
122 /* Update reset entry point with CPU init code */
123 reset_vec = (void *)CKSEG1ADDR(RESET_VEC_PHYS);
124 memset(reset_vec, 0, RESET_VEC_SIZE);
125 memcpy(reset_vec, (void *)nlm_reset_entry,
126 (nlm_reset_entry_end - nlm_reset_entry));
137 127
138#ifdef CONFIG_SMP 128#ifdef CONFIG_SMP
139 cpumask_setall(&nlm_cpumask); 129 cpumask_setall(&nlm_cpumask);
@@ -145,36 +135,3 @@ void __init prom_init(void)
145 register_smp_ops(&nlm_smp_ops); 135 register_smp_ops(&nlm_smp_ops);
146#endif 136#endif
147} 137}
148
149void __init device_tree_init(void)
150{
151 unsigned long base, size;
152
153 if (!initial_boot_params)
154 return;
155
156 base = virt_to_phys((void *)initial_boot_params);
157 size = be32_to_cpu(initial_boot_params->totalsize);
158
159 /* Before we do anything, lets reserve the dt blob */
160 reserve_bootmem(base, size, BOOTMEM_DEFAULT);
161
162 unflatten_device_tree();
163
164 /* free the space reserved for the dt blob */
165 free_bootmem(base, size);
166}
167
168static struct of_device_id __initdata xlp_ids[] = {
169 { .compatible = "simple-bus", },
170 {},
171};
172
173int __init xlp8xx_ds_publish_devices(void)
174{
175 if (!of_have_populated_dt())
176 return 0;
177 return of_platform_bus_probe(NULL, xlp_ids, NULL);
178}
179
180device_initcall(xlp8xx_ds_publish_devices);
diff --git a/arch/mips/netlogic/xlp/usb-init.c b/arch/mips/netlogic/xlp/usb-init.c
index 9c401dd78337..ef3897ef0dc7 100644
--- a/arch/mips/netlogic/xlp/usb-init.c
+++ b/arch/mips/netlogic/xlp/usb-init.c
@@ -119,7 +119,7 @@ static u64 xlp_usb_dmamask = ~(u32)0;
119static void nlm_usb_fixup_final(struct pci_dev *dev) 119static void nlm_usb_fixup_final(struct pci_dev *dev)
120{ 120{
121 dev->dev.dma_mask = &xlp_usb_dmamask; 121 dev->dev.dma_mask = &xlp_usb_dmamask;
122 dev->dev.coherent_dma_mask = DMA_BIT_MASK(64); 122 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
123 switch (dev->devfn) { 123 switch (dev->devfn) {
124 case 0x10: 124 case 0x10:
125 dev->irq = PIC_EHCI_0_IRQ; 125 dev->irq = PIC_EHCI_0_IRQ;
diff --git a/arch/mips/netlogic/xlp/wakeup.c b/arch/mips/netlogic/xlp/wakeup.c
index abb3e08cc052..0cce37cbffef 100644
--- a/arch/mips/netlogic/xlp/wakeup.c
+++ b/arch/mips/netlogic/xlp/wakeup.c
@@ -77,12 +77,28 @@ static int xlp_wakeup_core(uint64_t sysbase, int node, int core)
77 return count != 0; 77 return count != 0;
78} 78}
79 79
80static int wait_for_cpus(int cpu, int bootcpu)
81{
82 volatile uint32_t *cpu_ready = nlm_get_boot_data(BOOT_CPU_READY);
83 int i, count, notready;
84
85 count = 0x20000000;
86 do {
87 notready = nlm_threads_per_core;
88 for (i = 0; i < nlm_threads_per_core; i++)
89 if (cpu_ready[cpu + i] || cpu == bootcpu)
90 --notready;
91 } while (notready != 0 && --count > 0);
92
93 return count != 0;
94}
95
80static void xlp_enable_secondary_cores(const cpumask_t *wakeup_mask) 96static void xlp_enable_secondary_cores(const cpumask_t *wakeup_mask)
81{ 97{
82 struct nlm_soc_info *nodep; 98 struct nlm_soc_info *nodep;
83 uint64_t syspcibase; 99 uint64_t syspcibase;
84 uint32_t syscoremask; 100 uint32_t syscoremask;
85 int core, n, cpu, count, val; 101 int core, n, cpu;
86 102
87 for (n = 0; n < NLM_NR_NODES; n++) { 103 for (n = 0; n < NLM_NR_NODES; n++) {
88 syspcibase = nlm_get_sys_pcibase(n); 104 syspcibase = nlm_get_sys_pcibase(n);
@@ -122,11 +138,8 @@ static void xlp_enable_secondary_cores(const cpumask_t *wakeup_mask)
122 /* core is up */ 138 /* core is up */
123 nodep->coremask |= 1u << core; 139 nodep->coremask |= 1u << core;
124 140
125 /* spin until the first hw thread sets its ready */ 141 /* spin until the hw threads sets their ready */
126 count = 0x20000000; 142 wait_for_cpus(cpu, 0);
127 do {
128 val = *(volatile int *)&nlm_cpu_ready[cpu];
129 } while (val == 0 && --count > 0);
130 } 143 }
131 } 144 }
132} 145}
@@ -138,6 +151,7 @@ void xlp_wakeup_secondary_cpus()
138 * first wakeup core 0 threads 151 * first wakeup core 0 threads
139 */ 152 */
140 xlp_boot_core0_siblings(); 153 xlp_boot_core0_siblings();
154 wait_for_cpus(0, 0);
141 155
142 /* now get other cores out of reset */ 156 /* now get other cores out of reset */
143 xlp_enable_secondary_cores(&nlm_cpumask); 157 xlp_enable_secondary_cores(&nlm_cpumask);
diff --git a/arch/mips/netlogic/xlr/fmn.c b/arch/mips/netlogic/xlr/fmn.c
index 4d74f03de506..d428e8471eec 100644
--- a/arch/mips/netlogic/xlr/fmn.c
+++ b/arch/mips/netlogic/xlr/fmn.c
@@ -74,13 +74,13 @@ static irqreturn_t fmn_message_handler(int irq, void *data)
74 struct nlm_fmn_msg msg; 74 struct nlm_fmn_msg msg;
75 uint32_t mflags, bkt_status; 75 uint32_t mflags, bkt_status;
76 76
77 mflags = nlm_cop2_enable(); 77 mflags = nlm_cop2_enable_irqsave();
78 /* Disable message ring interrupt */ 78 /* Disable message ring interrupt */
79 nlm_fmn_setup_intr(irq, 0); 79 nlm_fmn_setup_intr(irq, 0);
80 while (1) { 80 while (1) {
81 /* 8 bkts per core, [24:31] each bit represents one bucket 81 /* 8 bkts per core, [24:31] each bit represents one bucket
82 * Bit is Zero if bucket is not empty */ 82 * Bit is Zero if bucket is not empty */
83 bkt_status = (nlm_read_c2_status() >> 24) & 0xff; 83 bkt_status = (nlm_read_c2_status0() >> 24) & 0xff;
84 if (bkt_status == 0xff) 84 if (bkt_status == 0xff)
85 break; 85 break;
86 for (bucket = 0; bucket < 8; bucket++) { 86 for (bucket = 0; bucket < 8; bucket++) {
@@ -97,16 +97,16 @@ static irqreturn_t fmn_message_handler(int irq, void *data)
97 pr_warn("No msgring handler for stnid %d\n", 97 pr_warn("No msgring handler for stnid %d\n",
98 src_stnid); 98 src_stnid);
99 else { 99 else {
100 nlm_cop2_restore(mflags); 100 nlm_cop2_disable_irqrestore(mflags);
101 hndlr->action(bucket, src_stnid, size, code, 101 hndlr->action(bucket, src_stnid, size, code,
102 &msg, hndlr->arg); 102 &msg, hndlr->arg);
103 mflags = nlm_cop2_enable(); 103 mflags = nlm_cop2_enable_irqsave();
104 } 104 }
105 } 105 }
106 }; 106 };
107 /* Enable message ring intr, to any thread in core */ 107 /* Enable message ring intr, to any thread in core */
108 nlm_fmn_setup_intr(irq, (1 << nlm_threads_per_core) - 1); 108 nlm_fmn_setup_intr(irq, (1 << nlm_threads_per_core) - 1);
109 nlm_cop2_restore(mflags); 109 nlm_cop2_disable_irqrestore(mflags);
110 return IRQ_HANDLED; 110 return IRQ_HANDLED;
111} 111}
112 112
@@ -128,7 +128,7 @@ void xlr_percpu_fmn_init(void)
128 128
129 bucket_sizes = xlr_board_fmn_config.bucket_size; 129 bucket_sizes = xlr_board_fmn_config.bucket_size;
130 cpu_fmn_info = &xlr_board_fmn_config.cpu[id]; 130 cpu_fmn_info = &xlr_board_fmn_config.cpu[id];
131 flags = nlm_cop2_enable(); 131 flags = nlm_cop2_enable_irqsave();
132 132
133 /* Setup bucket sizes for the core. */ 133 /* Setup bucket sizes for the core. */
134 nlm_write_c2_bucksize(0, bucket_sizes[id * 8 + 0]); 134 nlm_write_c2_bucksize(0, bucket_sizes[id * 8 + 0]);
@@ -166,7 +166,7 @@ void xlr_percpu_fmn_init(void)
166 166
167 /* enable FMN interrupts on this CPU */ 167 /* enable FMN interrupts on this CPU */
168 nlm_fmn_setup_intr(IRQ_FMN, (1 << nlm_threads_per_core) - 1); 168 nlm_fmn_setup_intr(IRQ_FMN, (1 << nlm_threads_per_core) - 1);
169 nlm_cop2_restore(flags); 169 nlm_cop2_disable_irqrestore(flags);
170} 170}
171 171
172 172
@@ -198,7 +198,7 @@ void nlm_setup_fmn_irq(void)
198 /* setup irq only once */ 198 /* setup irq only once */
199 setup_irq(IRQ_FMN, &fmn_irqaction); 199 setup_irq(IRQ_FMN, &fmn_irqaction);
200 200
201 flags = nlm_cop2_enable(); 201 flags = nlm_cop2_enable_irqsave();
202 nlm_fmn_setup_intr(IRQ_FMN, (1 << nlm_threads_per_core) - 1); 202 nlm_fmn_setup_intr(IRQ_FMN, (1 << nlm_threads_per_core) - 1);
203 nlm_cop2_restore(flags); 203 nlm_cop2_disable_irqrestore(flags);
204} 204}
diff --git a/arch/mips/netlogic/xlr/setup.c b/arch/mips/netlogic/xlr/setup.c
index 89c8c1066632..214d123b79fa 100644
--- a/arch/mips/netlogic/xlr/setup.c
+++ b/arch/mips/netlogic/xlr/setup.c
@@ -196,6 +196,7 @@ void __init prom_init(void)
196{ 196{
197 int *argv, *envp; /* passed as 32 bit ptrs */ 197 int *argv, *envp; /* passed as 32 bit ptrs */
198 struct psb_info *prom_infop; 198 struct psb_info *prom_infop;
199 void *reset_vec;
199#ifdef CONFIG_SMP 200#ifdef CONFIG_SMP
200 int i; 201 int i;
201#endif 202#endif
@@ -208,6 +209,12 @@ void __init prom_init(void)
208 nlm_prom_info = *prom_infop; 209 nlm_prom_info = *prom_infop;
209 nlm_init_node(); 210 nlm_init_node();
210 211
212 /* Update reset entry point with CPU init code */
213 reset_vec = (void *)CKSEG1ADDR(RESET_VEC_PHYS);
214 memset(reset_vec, 0, RESET_VEC_SIZE);
215 memcpy(reset_vec, (void *)nlm_reset_entry,
216 (nlm_reset_entry_end - nlm_reset_entry));
217
211 nlm_early_serial_setup(); 218 nlm_early_serial_setup();
212 build_arcs_cmdline(argv); 219 build_arcs_cmdline(argv);
213 prom_add_memory(); 220 prom_add_memory();
diff --git a/arch/mips/netlogic/xlr/wakeup.c b/arch/mips/netlogic/xlr/wakeup.c
index 3ebf7411d67b..9fb81fa6272a 100644
--- a/arch/mips/netlogic/xlr/wakeup.c
+++ b/arch/mips/netlogic/xlr/wakeup.c
@@ -49,10 +49,11 @@
49#include <asm/netlogic/xlr/iomap.h> 49#include <asm/netlogic/xlr/iomap.h>
50#include <asm/netlogic/xlr/pic.h> 50#include <asm/netlogic/xlr/pic.h>
51 51
52int __cpuinit xlr_wakeup_secondary_cpus(void) 52int xlr_wakeup_secondary_cpus(void)
53{ 53{
54 struct nlm_soc_info *nodep; 54 struct nlm_soc_info *nodep;
55 unsigned int i, j, boot_cpu; 55 unsigned int i, j, boot_cpu;
56 volatile u32 *cpu_ready = nlm_get_boot_data(BOOT_CPU_READY);
56 57
57 /* 58 /*
58 * In case of RMI boot, hit with NMI to get the cores 59 * In case of RMI boot, hit with NMI to get the cores
@@ -71,7 +72,7 @@ int __cpuinit xlr_wakeup_secondary_cpus(void)
71 nodep->coremask = 1; 72 nodep->coremask = 1;
72 for (i = 1; i < NLM_CORES_PER_NODE; i++) { 73 for (i = 1; i < NLM_CORES_PER_NODE; i++) {
73 for (j = 1000000; j > 0; j--) { 74 for (j = 1000000; j > 0; j--) {
74 if (nlm_cpu_ready[i * NLM_THREADS_PER_CORE]) 75 if (cpu_ready[i * NLM_THREADS_PER_CORE])
75 break; 76 break;
76 udelay(10); 77 udelay(10);
77 } 78 }
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index 2cb1d315d225..c382042911dd 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -29,7 +29,7 @@ obj-$(CONFIG_LASAT) += pci-lasat.o
29obj-$(CONFIG_MIPS_COBALT) += fixup-cobalt.o 29obj-$(CONFIG_MIPS_COBALT) += fixup-cobalt.o
30obj-$(CONFIG_LEMOTE_FULOONG2E) += fixup-fuloong2e.o ops-loongson2.o 30obj-$(CONFIG_LEMOTE_FULOONG2E) += fixup-fuloong2e.o ops-loongson2.o
31obj-$(CONFIG_LEMOTE_MACH2F) += fixup-lemote2f.o ops-loongson2.o 31obj-$(CONFIG_LEMOTE_MACH2F) += fixup-lemote2f.o ops-loongson2.o
32obj-$(CONFIG_MIPS_MALTA) += fixup-malta.o 32obj-$(CONFIG_MIPS_MALTA) += fixup-malta.o pci-malta.o
33obj-$(CONFIG_PMC_MSP7120_GW) += fixup-pmcmsp.o ops-pmcmsp.o 33obj-$(CONFIG_PMC_MSP7120_GW) += fixup-pmcmsp.o ops-pmcmsp.o
34obj-$(CONFIG_PMC_MSP7120_EVAL) += fixup-pmcmsp.o ops-pmcmsp.o 34obj-$(CONFIG_PMC_MSP7120_EVAL) += fixup-pmcmsp.o ops-pmcmsp.o
35obj-$(CONFIG_PMC_MSP7120_FPGA) += fixup-pmcmsp.o ops-pmcmsp.o 35obj-$(CONFIG_PMC_MSP7120_FPGA) += fixup-pmcmsp.o ops-pmcmsp.o
@@ -52,12 +52,11 @@ obj-$(CONFIG_TOSHIBA_RBTX4927) += fixup-rbtx4927.o
52obj-$(CONFIG_TOSHIBA_RBTX4938) += fixup-rbtx4938.o 52obj-$(CONFIG_TOSHIBA_RBTX4938) += fixup-rbtx4938.o
53obj-$(CONFIG_VICTOR_MPC30X) += fixup-mpc30x.o 53obj-$(CONFIG_VICTOR_MPC30X) += fixup-mpc30x.o
54obj-$(CONFIG_ZAO_CAPCELLA) += fixup-capcella.o 54obj-$(CONFIG_ZAO_CAPCELLA) += fixup-capcella.o
55obj-$(CONFIG_WR_PPMC) += fixup-wrppmc.o
56obj-$(CONFIG_MIKROTIK_RB532) += pci-rc32434.o ops-rc32434.o fixup-rc32434.o 55obj-$(CONFIG_MIKROTIK_RB532) += pci-rc32434.o ops-rc32434.o fixup-rc32434.o
57obj-$(CONFIG_CPU_CAVIUM_OCTEON) += pci-octeon.o pcie-octeon.o 56obj-$(CONFIG_CAVIUM_OCTEON_SOC) += pci-octeon.o pcie-octeon.o
58obj-$(CONFIG_CPU_XLR) += pci-xlr.o 57obj-$(CONFIG_CPU_XLR) += pci-xlr.o
59obj-$(CONFIG_CPU_XLP) += pci-xlp.o 58obj-$(CONFIG_CPU_XLP) += pci-xlp.o
60 59
61ifdef CONFIG_PCI_MSI 60ifdef CONFIG_PCI_MSI
62obj-$(CONFIG_CPU_CAVIUM_OCTEON) += msi-octeon.o 61obj-$(CONFIG_CAVIUM_OCTEON_SOC) += msi-octeon.o
63endif 62endif
diff --git a/arch/mips/pci/fixup-wrppmc.c b/arch/mips/pci/fixup-wrppmc.c
deleted file mode 100644
index 29737edd121f..000000000000
--- a/arch/mips/pci/fixup-wrppmc.c
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * fixup-wrppmc.c: PPMC board specific PCI fixup
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2006, Wind River Inc. Rongkai.zhan (rongkai.zhan@windriver.com)
9 */
10#include <linux/init.h>
11#include <linux/pci.h>
12#include <asm/gt64120.h>
13
14/* PCI interrupt pins */
15#define PCI_INTA 1
16#define PCI_INTB 2
17#define PCI_INTC 3
18#define PCI_INTD 4
19
20#define PCI_SLOT_MAXNR 32 /* Each PCI bus has 32 physical slots */
21
22static char pci_irq_tab[PCI_SLOT_MAXNR][5] __initdata = {
23 /* 0 INTA INTB INTC INTD */
24 [0] = {0, 0, 0, 0, 0}, /* Slot 0: GT64120 PCI bridge */
25 [6] = {0, WRPPMC_PCI_INTA_IRQ, 0, 0, 0},
26};
27
28int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
29{
30 return pci_irq_tab[slot][pin];
31}
32
33/* Do platform specific device initialization at pci_enable_device() time */
34int pcibios_plat_dev_init(struct pci_dev *dev)
35{
36 return 0;
37}
diff --git a/arch/mips/pci/pci-bcm63xx.c b/arch/mips/pci/pci-bcm63xx.c
index 2eb954239bc5..151d9b5870bb 100644
--- a/arch/mips/pci/pci-bcm63xx.c
+++ b/arch/mips/pci/pci-bcm63xx.c
@@ -266,7 +266,7 @@ static int __init bcm63xx_register_pci(void)
266 /* setup PCI to local bus access, used by PCI device to target 266 /* setup PCI to local bus access, used by PCI device to target
267 * local RAM while bus mastering */ 267 * local RAM while bus mastering */
268 bcm63xx_int_cfg_writel(0, PCI_BASE_ADDRESS_3); 268 bcm63xx_int_cfg_writel(0, PCI_BASE_ADDRESS_3);
269 if (BCMCPU_IS_6358() || BCMCPU_IS_6368()) 269 if (BCMCPU_IS_3368() || BCMCPU_IS_6358() || BCMCPU_IS_6368())
270 val = MPI_SP0_REMAP_ENABLE_MASK; 270 val = MPI_SP0_REMAP_ENABLE_MASK;
271 else 271 else
272 val = 0; 272 val = 0;
@@ -338,6 +338,7 @@ static int __init bcm63xx_pci_init(void)
338 case BCM6328_CPU_ID: 338 case BCM6328_CPU_ID:
339 case BCM6362_CPU_ID: 339 case BCM6362_CPU_ID:
340 return bcm63xx_register_pcie(); 340 return bcm63xx_register_pcie();
341 case BCM3368_CPU_ID:
341 case BCM6348_CPU_ID: 342 case BCM6348_CPU_ID:
342 case BCM6358_CPU_ID: 343 case BCM6358_CPU_ID:
343 case BCM6368_CPU_ID: 344 case BCM6368_CPU_ID:
diff --git a/arch/mips/pci/pci-ip27.c b/arch/mips/pci/pci-ip27.c
index 6eb65e44d9e4..162b4cb29dba 100644
--- a/arch/mips/pci/pci-ip27.c
+++ b/arch/mips/pci/pci-ip27.c
@@ -42,7 +42,7 @@ int irq_to_slot[MAX_PCI_BUSSES * MAX_DEVICES_PER_PCIBUS];
42 42
43extern struct pci_ops bridge_pci_ops; 43extern struct pci_ops bridge_pci_ops;
44 44
45int __cpuinit bridge_probe(nasid_t nasid, int widget_id, int masterwid) 45int bridge_probe(nasid_t nasid, int widget_id, int masterwid)
46{ 46{
47 unsigned long offset = NODE_OFFSET(nasid); 47 unsigned long offset = NODE_OFFSET(nasid);
48 struct bridge_controller *bc; 48 struct bridge_controller *bc;
@@ -217,6 +217,7 @@ static void pci_fixup_ioc3(struct pci_dev *d)
217 pci_disable_swapping(d); 217 pci_disable_swapping(d);
218} 218}
219 219
220#ifdef CONFIG_NUMA
220int pcibus_to_node(struct pci_bus *bus) 221int pcibus_to_node(struct pci_bus *bus)
221{ 222{
222 struct bridge_controller *bc = BRIDGE_CONTROLLER(bus); 223 struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
@@ -224,6 +225,7 @@ int pcibus_to_node(struct pci_bus *bus)
224 return bc->nasid; 225 return bc->nasid;
225} 226}
226EXPORT_SYMBOL(pcibus_to_node); 227EXPORT_SYMBOL(pcibus_to_node);
228#endif /* CONFIG_NUMA */
227 229
228DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC3, 230DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC3,
229 pci_fixup_ioc3); 231 pci_fixup_ioc3);
diff --git a/arch/mips/mti-malta/malta-pci.c b/arch/mips/pci/pci-malta.c
index 37134ddfeaa5..37134ddfeaa5 100644
--- a/arch/mips/mti-malta/malta-pci.c
+++ b/arch/mips/pci/pci-malta.c
diff --git a/arch/mips/pmcs-msp71xx/Makefile b/arch/mips/pmcs-msp71xx/Makefile
index cefba7733b73..9201c8b3858d 100644
--- a/arch/mips/pmcs-msp71xx/Makefile
+++ b/arch/mips/pmcs-msp71xx/Makefile
@@ -3,7 +3,6 @@
3# 3#
4obj-y += msp_prom.o msp_setup.o msp_irq.o \ 4obj-y += msp_prom.o msp_setup.o msp_irq.o \
5 msp_time.o msp_serial.o msp_elb.o 5 msp_time.o msp_serial.o msp_elb.o
6obj-$(CONFIG_HAVE_GPIO_LIB) += gpio.o gpio_extended.o
7obj-$(CONFIG_PMC_MSP7120_GW) += msp_hwbutton.o 6obj-$(CONFIG_PMC_MSP7120_GW) += msp_hwbutton.o
8obj-$(CONFIG_IRQ_MSP_SLP) += msp_irq_slp.o 7obj-$(CONFIG_IRQ_MSP_SLP) += msp_irq_slp.o
9obj-$(CONFIG_IRQ_MSP_CIC) += msp_irq_cic.o msp_irq_per.o 8obj-$(CONFIG_IRQ_MSP_CIC) += msp_irq_cic.o msp_irq_per.o
diff --git a/arch/mips/pmcs-msp71xx/gpio.c b/arch/mips/pmcs-msp71xx/gpio.c
deleted file mode 100644
index aaccbe524386..000000000000
--- a/arch/mips/pmcs-msp71xx/gpio.c
+++ /dev/null
@@ -1,216 +0,0 @@
1/*
2 * Generic PMC MSP71xx GPIO handling. These base gpio are controlled by two
3 * types of registers. The data register sets the output level when in output
4 * mode and when in input mode will contain the value at the input. The config
5 * register sets the various modes for each gpio.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * @author Patrick Glass <patrickglass@gmail.com>
12 */
13
14#include <linux/kernel.h>
15#include <linux/module.h>
16#include <linux/init.h>
17#include <linux/gpio.h>
18#include <linux/spinlock.h>
19#include <linux/io.h>
20
21#define MSP71XX_CFG_OFFSET(gpio) (4 * (gpio))
22#define CONF_MASK 0x0F
23#define MSP71XX_GPIO_INPUT 0x01
24#define MSP71XX_GPIO_OUTPUT 0x08
25
26#define MSP71XX_GPIO_BASE 0x0B8400000L
27
28#define to_msp71xx_gpio_chip(c) container_of(c, struct msp71xx_gpio_chip, chip)
29
30static spinlock_t gpio_lock;
31
32/*
33 * struct msp71xx_gpio_chip - container for gpio chip and registers
34 * @chip: chip structure for the specified gpio bank
35 * @data_reg: register for reading and writing the gpio pin value
36 * @config_reg: register to set the mode for the gpio pin bank
37 * @out_drive_reg: register to set the output drive mode for the gpio pin bank
38 */
39struct msp71xx_gpio_chip {
40 struct gpio_chip chip;
41 void __iomem *data_reg;
42 void __iomem *config_reg;
43 void __iomem *out_drive_reg;
44};
45
46/*
47 * msp71xx_gpio_get() - return the chip's gpio value
48 * @chip: chip structure which controls the specified gpio
49 * @offset: gpio whose value will be returned
50 *
51 * It will return 0 if gpio value is low and other if high.
52 */
53static int msp71xx_gpio_get(struct gpio_chip *chip, unsigned offset)
54{
55 struct msp71xx_gpio_chip *msp_chip = to_msp71xx_gpio_chip(chip);
56
57 return __raw_readl(msp_chip->data_reg) & (1 << offset);
58}
59
60/*
61 * msp71xx_gpio_set() - set the output value for the gpio
62 * @chip: chip structure who controls the specified gpio
63 * @offset: gpio whose value will be assigned
64 * @value: logic level to assign to the gpio initially
65 *
66 * This will set the gpio bit specified to the desired value. It will set the
67 * gpio pin low if value is 0 otherwise it will be high.
68 */
69static void msp71xx_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
70{
71 struct msp71xx_gpio_chip *msp_chip = to_msp71xx_gpio_chip(chip);
72 unsigned long flags;
73 u32 data;
74
75 spin_lock_irqsave(&gpio_lock, flags);
76
77 data = __raw_readl(msp_chip->data_reg);
78 if (value)
79 data |= (1 << offset);
80 else
81 data &= ~(1 << offset);
82 __raw_writel(data, msp_chip->data_reg);
83
84 spin_unlock_irqrestore(&gpio_lock, flags);
85}
86
87/*
88 * msp71xx_set_gpio_mode() - declare the mode for a gpio
89 * @chip: chip structure which controls the specified gpio
90 * @offset: gpio whose value will be assigned
91 * @mode: desired configuration for the gpio (see datasheet)
92 *
93 * It will set the gpio pin config to the @mode value passed in.
94 */
95static int msp71xx_set_gpio_mode(struct gpio_chip *chip,
96 unsigned offset, int mode)
97{
98 struct msp71xx_gpio_chip *msp_chip = to_msp71xx_gpio_chip(chip);
99 const unsigned bit_offset = MSP71XX_CFG_OFFSET(offset);
100 unsigned long flags;
101 u32 cfg;
102
103 spin_lock_irqsave(&gpio_lock, flags);
104
105 cfg = __raw_readl(msp_chip->config_reg);
106 cfg &= ~(CONF_MASK << bit_offset);
107 cfg |= (mode << bit_offset);
108 __raw_writel(cfg, msp_chip->config_reg);
109
110 spin_unlock_irqrestore(&gpio_lock, flags);
111
112 return 0;
113}
114
115/*
116 * msp71xx_direction_output() - declare the direction mode for a gpio
117 * @chip: chip structure which controls the specified gpio
118 * @offset: gpio whose value will be assigned
119 * @value: logic level to assign to the gpio initially
120 *
121 * This call will set the mode for the @gpio to output. It will set the
122 * gpio pin low if value is 0 otherwise it will be high.
123 */
124static int msp71xx_direction_output(struct gpio_chip *chip,
125 unsigned offset, int value)
126{
127 msp71xx_gpio_set(chip, offset, value);
128
129 return msp71xx_set_gpio_mode(chip, offset, MSP71XX_GPIO_OUTPUT);
130}
131
132/*
133 * msp71xx_direction_input() - declare the direction mode for a gpio
134 * @chip: chip structure which controls the specified gpio
135 * @offset: gpio whose to which the value will be assigned
136 *
137 * This call will set the mode for the @gpio to input.
138 */
139static int msp71xx_direction_input(struct gpio_chip *chip, unsigned offset)
140{
141 return msp71xx_set_gpio_mode(chip, offset, MSP71XX_GPIO_INPUT);
142}
143
144/*
145 * msp71xx_set_output_drive() - declare the output drive for the gpio line
146 * @gpio: gpio pin whose output drive you wish to modify
147 * @value: zero for active drain 1 for open drain drive
148 *
149 * This call will set the output drive mode for the @gpio to output.
150 */
151int msp71xx_set_output_drive(unsigned gpio, int value)
152{
153 unsigned long flags;
154 u32 data;
155
156 if (gpio > 15 || gpio < 0)
157 return -EINVAL;
158
159 spin_lock_irqsave(&gpio_lock, flags);
160
161 data = __raw_readl((void __iomem *)(MSP71XX_GPIO_BASE + 0x190));
162 if (value)
163 data |= (1 << gpio);
164 else
165 data &= ~(1 << gpio);
166 __raw_writel(data, (void __iomem *)(MSP71XX_GPIO_BASE + 0x190));
167
168 spin_unlock_irqrestore(&gpio_lock, flags);
169
170 return 0;
171}
172EXPORT_SYMBOL(msp71xx_set_output_drive);
173
174#define MSP71XX_GPIO_BANK(name, dr, cr, base_gpio, num_gpio) \
175{ \
176 .chip = { \
177 .label = name, \
178 .direction_input = msp71xx_direction_input, \
179 .direction_output = msp71xx_direction_output, \
180 .get = msp71xx_gpio_get, \
181 .set = msp71xx_gpio_set, \
182 .base = base_gpio, \
183 .ngpio = num_gpio \
184 }, \
185 .data_reg = (void __iomem *)(MSP71XX_GPIO_BASE + dr), \
186 .config_reg = (void __iomem *)(MSP71XX_GPIO_BASE + cr), \
187 .out_drive_reg = (void __iomem *)(MSP71XX_GPIO_BASE + 0x190), \
188}
189
190/*
191 * struct msp71xx_gpio_banks[] - container array of gpio banks
192 * @chip: chip structure for the specified gpio bank
193 * @data_reg: register for reading and writing the gpio pin value
194 * @config_reg: register to set the mode for the gpio pin bank
195 *
196 * This array structure defines the gpio banks for the PMC MIPS Processor.
197 * We specify the bank name, the data register, the config register, base
198 * starting gpio number, and the number of gpios exposed by the bank.
199 */
200static struct msp71xx_gpio_chip msp71xx_gpio_banks[] = {
201
202 MSP71XX_GPIO_BANK("GPIO_1_0", 0x170, 0x180, 0, 2),
203 MSP71XX_GPIO_BANK("GPIO_5_2", 0x174, 0x184, 2, 4),
204 MSP71XX_GPIO_BANK("GPIO_9_6", 0x178, 0x188, 6, 4),
205 MSP71XX_GPIO_BANK("GPIO_15_10", 0x17C, 0x18C, 10, 6),
206};
207
208void __init msp71xx_init_gpio(void)
209{
210 int i;
211
212 spin_lock_init(&gpio_lock);
213
214 for (i = 0; i < ARRAY_SIZE(msp71xx_gpio_banks); i++)
215 gpiochip_add(&msp71xx_gpio_banks[i].chip);
216}
diff --git a/arch/mips/pmcs-msp71xx/gpio_extended.c b/arch/mips/pmcs-msp71xx/gpio_extended.c
deleted file mode 100644
index 2a99f360fae4..000000000000
--- a/arch/mips/pmcs-msp71xx/gpio_extended.c
+++ /dev/null
@@ -1,146 +0,0 @@
1/*
2 * Generic PMC MSP71xx EXTENDED (EXD) GPIO handling. The extended gpio is
3 * a set of hardware registers that have no need for explicit locking as
4 * it is handled by unique method of writing individual set/clr bits.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * @author Patrick Glass <patrickglass@gmail.com>
11 */
12
13#include <linux/kernel.h>
14#include <linux/module.h>
15#include <linux/init.h>
16#include <linux/gpio.h>
17#include <linux/io.h>
18
19#define MSP71XX_DATA_OFFSET(gpio) (2 * (gpio))
20#define MSP71XX_READ_OFFSET(gpio) (MSP71XX_DATA_OFFSET(gpio) + 1)
21#define MSP71XX_CFG_OUT_OFFSET(gpio) (MSP71XX_DATA_OFFSET(gpio) + 16)
22#define MSP71XX_CFG_IN_OFFSET(gpio) (MSP71XX_CFG_OUT_OFFSET(gpio) + 1)
23
24#define MSP71XX_EXD_GPIO_BASE 0x0BC000000L
25
26#define to_msp71xx_exd_gpio_chip(c) \
27 container_of(c, struct msp71xx_exd_gpio_chip, chip)
28
29/*
30 * struct msp71xx_exd_gpio_chip - container for gpio chip and registers
31 * @chip: chip structure for the specified gpio bank
32 * @reg: register for control and data of gpio pin
33 */
34struct msp71xx_exd_gpio_chip {
35 struct gpio_chip chip;
36 void __iomem *reg;
37};
38
39/*
40 * msp71xx_exd_gpio_get() - return the chip's gpio value
41 * @chip: chip structure which controls the specified gpio
42 * @offset: gpio whose value will be returned
43 *
44 * It will return 0 if gpio value is low and other if high.
45 */
46static int msp71xx_exd_gpio_get(struct gpio_chip *chip, unsigned offset)
47{
48 struct msp71xx_exd_gpio_chip *msp71xx_chip =
49 to_msp71xx_exd_gpio_chip(chip);
50 const unsigned bit = MSP71XX_READ_OFFSET(offset);
51
52 return __raw_readl(msp71xx_chip->reg) & (1 << bit);
53}
54
55/*
56 * msp71xx_exd_gpio_set() - set the output value for the gpio
57 * @chip: chip structure who controls the specified gpio
58 * @offset: gpio whose value will be assigned
59 * @value: logic level to assign to the gpio initially
60 *
61 * This will set the gpio bit specified to the desired value. It will set the
62 * gpio pin low if value is 0 otherwise it will be high.
63 */
64static void msp71xx_exd_gpio_set(struct gpio_chip *chip,
65 unsigned offset, int value)
66{
67 struct msp71xx_exd_gpio_chip *msp71xx_chip =
68 to_msp71xx_exd_gpio_chip(chip);
69 const unsigned bit = MSP71XX_DATA_OFFSET(offset);
70
71 __raw_writel(1 << (bit + (value ? 1 : 0)), msp71xx_chip->reg);
72}
73
74/*
75 * msp71xx_exd_direction_output() - declare the direction mode for a gpio
76 * @chip: chip structure which controls the specified gpio
77 * @offset: gpio whose value will be assigned
78 * @value: logic level to assign to the gpio initially
79 *
80 * This call will set the mode for the @gpio to output. It will set the
81 * gpio pin low if value is 0 otherwise it will be high.
82 */
83static int msp71xx_exd_direction_output(struct gpio_chip *chip,
84 unsigned offset, int value)
85{
86 struct msp71xx_exd_gpio_chip *msp71xx_chip =
87 to_msp71xx_exd_gpio_chip(chip);
88
89 msp71xx_exd_gpio_set(chip, offset, value);
90 __raw_writel(1 << MSP71XX_CFG_OUT_OFFSET(offset), msp71xx_chip->reg);
91 return 0;
92}
93
94/*
95 * msp71xx_exd_direction_input() - declare the direction mode for a gpio
96 * @chip: chip structure which controls the specified gpio
97 * @offset: gpio whose to which the value will be assigned
98 *
99 * This call will set the mode for the @gpio to input.
100 */
101static int msp71xx_exd_direction_input(struct gpio_chip *chip, unsigned offset)
102{
103 struct msp71xx_exd_gpio_chip *msp71xx_chip =
104 to_msp71xx_exd_gpio_chip(chip);
105
106 __raw_writel(1 << MSP71XX_CFG_IN_OFFSET(offset), msp71xx_chip->reg);
107 return 0;
108}
109
110#define MSP71XX_EXD_GPIO_BANK(name, exd_reg, base_gpio, num_gpio) \
111{ \
112 .chip = { \
113 .label = name, \
114 .direction_input = msp71xx_exd_direction_input, \
115 .direction_output = msp71xx_exd_direction_output, \
116 .get = msp71xx_exd_gpio_get, \
117 .set = msp71xx_exd_gpio_set, \
118 .base = base_gpio, \
119 .ngpio = num_gpio, \
120 }, \
121 .reg = (void __iomem *)(MSP71XX_EXD_GPIO_BASE + exd_reg), \
122}
123
124/*
125 * struct msp71xx_exd_gpio_banks[] - container array of gpio banks
126 * @chip: chip structure for the specified gpio bank
127 * @reg: register for reading and writing the gpio pin value
128 *
129 * This array structure defines the extended gpio banks for the
130 * PMC MIPS Processor. We specify the bank name, the data/config
131 * register,the base starting gpio number, and the number of
132 * gpios exposed by the bank of gpios.
133 */
134static struct msp71xx_exd_gpio_chip msp71xx_exd_gpio_banks[] = {
135
136 MSP71XX_EXD_GPIO_BANK("GPIO_23_16", 0x188, 16, 8),
137 MSP71XX_EXD_GPIO_BANK("GPIO_27_24", 0x18C, 24, 4),
138};
139
140void __init msp71xx_init_gpio_extended(void)
141{
142 int i;
143
144 for (i = 0; i < ARRAY_SIZE(msp71xx_exd_gpio_banks); i++)
145 gpiochip_add(&msp71xx_exd_gpio_banks[i].chip);
146}
diff --git a/arch/mips/pmcs-msp71xx/msp_smtc.c b/arch/mips/pmcs-msp71xx/msp_smtc.c
index c8dcc1c01e18..6b5607fce279 100644
--- a/arch/mips/pmcs-msp71xx/msp_smtc.c
+++ b/arch/mips/pmcs-msp71xx/msp_smtc.c
@@ -33,7 +33,7 @@ static void msp_smtc_send_ipi_mask(const struct cpumask *mask,
33/* 33/*
34 * Post-config but pre-boot cleanup entry point 34 * Post-config but pre-boot cleanup entry point
35 */ 35 */
36static void __cpuinit msp_smtc_init_secondary(void) 36static void msp_smtc_init_secondary(void)
37{ 37{
38 int myvpe; 38 int myvpe;
39 39
@@ -48,8 +48,7 @@ static void __cpuinit msp_smtc_init_secondary(void)
48/* 48/*
49 * Platform "CPU" startup hook 49 * Platform "CPU" startup hook
50 */ 50 */
51static void __cpuinit msp_smtc_boot_secondary(int cpu, 51static void msp_smtc_boot_secondary(int cpu, struct task_struct *idle)
52 struct task_struct *idle)
53{ 52{
54 smtc_boot_secondary(cpu, idle); 53 smtc_boot_secondary(cpu, idle);
55} 54}
@@ -57,7 +56,7 @@ static void __cpuinit msp_smtc_boot_secondary(int cpu,
57/* 56/*
58 * SMP initialization finalization entry point 57 * SMP initialization finalization entry point
59 */ 58 */
60static void __cpuinit msp_smtc_smp_finish(void) 59static void msp_smtc_smp_finish(void)
61{ 60{
62 smtc_smp_finish(); 61 smtc_smp_finish();
63} 62}
diff --git a/arch/mips/pmcs-msp71xx/msp_time.c b/arch/mips/pmcs-msp71xx/msp_time.c
index 8f12ecc55ace..fea917be0ff1 100644
--- a/arch/mips/pmcs-msp71xx/msp_time.c
+++ b/arch/mips/pmcs-msp71xx/msp_time.c
@@ -88,7 +88,7 @@ void __init plat_time_init(void)
88 mips_hpt_frequency = cpu_rate/2; 88 mips_hpt_frequency = cpu_rate/2;
89} 89}
90 90
91unsigned int __cpuinit get_c0_compare_int(void) 91unsigned int get_c0_compare_int(void)
92{ 92{
93 /* MIPS_MT modes may want timer for second VPE */ 93 /* MIPS_MT modes may want timer for second VPE */
94 if ((get_current_vpe()) && !tim_installed) { 94 if ((get_current_vpe()) && !tim_installed) {
diff --git a/arch/mips/pnx833x/common/interrupts.c b/arch/mips/pnx833x/common/interrupts.c
index a4a90596c0ad..e460865873c1 100644
--- a/arch/mips/pnx833x/common/interrupts.c
+++ b/arch/mips/pnx833x/common/interrupts.c
@@ -281,7 +281,7 @@ void __init arch_init_irq(void)
281 write_c0_status(read_c0_status() | IE_IRQ2); 281 write_c0_status(read_c0_status() | IE_IRQ2);
282} 282}
283 283
284unsigned int __cpuinit get_c0_compare_int(void) 284unsigned int get_c0_compare_int(void)
285{ 285{
286 if (cpu_has_vint) 286 if (cpu_has_vint)
287 set_vi_handler(cp0_compare_irq, pnx833x_timer_dispatch); 287 set_vi_handler(cp0_compare_irq, pnx833x_timer_dispatch);
diff --git a/arch/mips/powertv/asic/asic_devices.c b/arch/mips/powertv/asic/asic_devices.c
index d38b095fd0d0..9f64c2387808 100644
--- a/arch/mips/powertv/asic/asic_devices.c
+++ b/arch/mips/powertv/asic/asic_devices.c
@@ -529,17 +529,8 @@ EXPORT_SYMBOL(asic_resource_get);
529 */ 529 */
530void platform_release_memory(void *ptr, int size) 530void platform_release_memory(void *ptr, int size)
531{ 531{
532 unsigned long addr; 532 free_reserved_area((unsigned long)ptr, (unsigned long)(ptr + size),
533 unsigned long end; 533 -1, NULL);
534
535 addr = ((unsigned long)ptr + (PAGE_SIZE - 1)) & PAGE_MASK;
536 end = ((unsigned long)ptr + size) & PAGE_MASK;
537
538 for (; addr < end; addr += PAGE_SIZE) {
539 ClearPageReserved(virt_to_page(__va(addr)));
540 init_page_count(virt_to_page(__va(addr)));
541 free_page((unsigned long)__va(addr));
542 }
543} 534}
544EXPORT_SYMBOL(platform_release_memory); 535EXPORT_SYMBOL(platform_release_memory);
545 536
diff --git a/arch/mips/powertv/time.c b/arch/mips/powertv/time.c
index 9fd7b67f2af7..f38b0d45eca9 100644
--- a/arch/mips/powertv/time.c
+++ b/arch/mips/powertv/time.c
@@ -25,7 +25,7 @@
25 25
26#include "powertv-clock.h" 26#include "powertv-clock.h"
27 27
28unsigned int __cpuinit get_c0_compare_int(void) 28unsigned int get_c0_compare_int(void)
29{ 29{
30 return irq_mips_timer; 30 return irq_mips_timer;
31} 31}
diff --git a/arch/mips/ralink/irq.c b/arch/mips/ralink/irq.c
index 320b1f1043ff..781b3d14a489 100644
--- a/arch/mips/ralink/irq.c
+++ b/arch/mips/ralink/irq.c
@@ -73,7 +73,7 @@ static struct irq_chip ralink_intc_irq_chip = {
73 .irq_mask_ack = ralink_intc_irq_mask, 73 .irq_mask_ack = ralink_intc_irq_mask,
74}; 74};
75 75
76unsigned int __cpuinit get_c0_compare_int(void) 76unsigned int get_c0_compare_int(void)
77{ 77{
78 return CP0_LEGACY_COMPARE_IRQ; 78 return CP0_LEGACY_COMPARE_IRQ;
79} 79}
diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index 6b5f3406f414..f25ea5b45051 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -104,7 +104,7 @@ static int __init plat_of_setup(void)
104 if (!of_have_populated_dt()) 104 if (!of_have_populated_dt())
105 panic("device tree not present"); 105 panic("device tree not present");
106 106
107 strncpy(of_ids[0].compatible, soc_info.compatible, len); 107 strlcpy(of_ids[0].compatible, soc_info.compatible, len);
108 strncpy(of_ids[1].compatible, "palmbus", len); 108 strncpy(of_ids[1].compatible, "palmbus", len);
109 109
110 if (of_platform_populate(NULL, of_ids, NULL, NULL)) 110 if (of_platform_populate(NULL, of_ids, NULL, NULL))
diff --git a/arch/mips/sgi-ip27/Makefile b/arch/mips/sgi-ip27/Makefile
index 1f29e761d691..da8f6816d346 100644
--- a/arch/mips/sgi-ip27/Makefile
+++ b/arch/mips/sgi-ip27/Makefile
@@ -7,4 +7,5 @@ obj-y := ip27-berr.o ip27-irq.o ip27-init.o ip27-klconfig.o ip27-klnuma.o \
7 ip27-xtalk.o 7 ip27-xtalk.o
8 8
9obj-$(CONFIG_EARLY_PRINTK) += ip27-console.o 9obj-$(CONFIG_EARLY_PRINTK) += ip27-console.o
10obj-$(CONFIG_PCI) += ip27-irq-pci.o
10obj-$(CONFIG_SMP) += ip27-smp.o 11obj-$(CONFIG_SMP) += ip27-smp.o
diff --git a/arch/mips/sgi-ip27/ip27-init.c b/arch/mips/sgi-ip27/ip27-init.c
index d41b1c6fb032..ee736bd103f8 100644
--- a/arch/mips/sgi-ip27/ip27-init.c
+++ b/arch/mips/sgi-ip27/ip27-init.c
@@ -54,7 +54,7 @@ extern void pcibr_setup(cnodeid_t);
54 54
55extern void xtalk_probe_node(cnodeid_t nid); 55extern void xtalk_probe_node(cnodeid_t nid);
56 56
57static void __cpuinit per_hub_init(cnodeid_t cnode) 57static void per_hub_init(cnodeid_t cnode)
58{ 58{
59 struct hub_data *hub = hub_data(cnode); 59 struct hub_data *hub = hub_data(cnode);
60 nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode); 60 nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
@@ -110,7 +110,7 @@ static void __cpuinit per_hub_init(cnodeid_t cnode)
110 } 110 }
111} 111}
112 112
113void __cpuinit per_cpu_init(void) 113void per_cpu_init(void)
114{ 114{
115 int cpu = smp_processor_id(); 115 int cpu = smp_processor_id();
116 int slice = LOCAL_HUB_L(PI_CPU_NUM); 116 int slice = LOCAL_HUB_L(PI_CPU_NUM);
diff --git a/arch/mips/sgi-ip27/ip27-irq-pci.c b/arch/mips/sgi-ip27/ip27-irq-pci.c
new file mode 100644
index 000000000000..ec22ec5600f3
--- /dev/null
+++ b/arch/mips/sgi-ip27/ip27-irq-pci.c
@@ -0,0 +1,266 @@
1/*
2 * ip27-irq.c: Highlevel interrupt handling for IP27 architecture.
3 *
4 * Copyright (C) 1999, 2000 Ralf Baechle (ralf@gnu.org)
5 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
6 * Copyright (C) 1999 - 2001 Kanoj Sarcar
7 */
8
9#undef DEBUG
10
11#include <linux/init.h>
12#include <linux/irq.h>
13#include <linux/errno.h>
14#include <linux/signal.h>
15#include <linux/sched.h>
16#include <linux/types.h>
17#include <linux/interrupt.h>
18#include <linux/ioport.h>
19#include <linux/timex.h>
20#include <linux/smp.h>
21#include <linux/random.h>
22#include <linux/kernel.h>
23#include <linux/kernel_stat.h>
24#include <linux/delay.h>
25#include <linux/bitops.h>
26
27#include <asm/bootinfo.h>
28#include <asm/io.h>
29#include <asm/mipsregs.h>
30
31#include <asm/processor.h>
32#include <asm/pci/bridge.h>
33#include <asm/sn/addrs.h>
34#include <asm/sn/agent.h>
35#include <asm/sn/arch.h>
36#include <asm/sn/hub.h>
37#include <asm/sn/intr.h>
38
39/*
40 * Linux has a controller-independent x86 interrupt architecture.
41 * every controller has a 'controller-template', that is used
42 * by the main code to do the right thing. Each driver-visible
43 * interrupt source is transparently wired to the appropriate
44 * controller. Thus drivers need not be aware of the
45 * interrupt-controller.
46 *
47 * Various interrupt controllers we handle: 8259 PIC, SMP IO-APIC,
48 * PIIX4's internal 8259 PIC and SGI's Visual Workstation Cobalt (IO-)APIC.
49 * (IO-APICs assumed to be messaging to Pentium local-APICs)
50 *
51 * the code is designed to be easily extended with new/different
52 * interrupt controllers, without having to do assembly magic.
53 */
54
55extern struct bridge_controller *irq_to_bridge[];
56extern int irq_to_slot[];
57
58/*
59 * use these macros to get the encoded nasid and widget id
60 * from the irq value
61 */
62#define IRQ_TO_BRIDGE(i) irq_to_bridge[(i)]
63#define SLOT_FROM_PCI_IRQ(i) irq_to_slot[i]
64
65static inline int alloc_level(int cpu, int irq)
66{
67 struct hub_data *hub = hub_data(cpu_to_node(cpu));
68 struct slice_data *si = cpu_data[cpu].data;
69 int level;
70
71 level = find_first_zero_bit(hub->irq_alloc_mask, LEVELS_PER_SLICE);
72 if (level >= LEVELS_PER_SLICE)
73 panic("Cpu %d flooded with devices", cpu);
74
75 __set_bit(level, hub->irq_alloc_mask);
76 si->level_to_irq[level] = irq;
77
78 return level;
79}
80
81static inline int find_level(cpuid_t *cpunum, int irq)
82{
83 int cpu, i;
84
85 for_each_online_cpu(cpu) {
86 struct slice_data *si = cpu_data[cpu].data;
87
88 for (i = BASE_PCI_IRQ; i < LEVELS_PER_SLICE; i++)
89 if (si->level_to_irq[i] == irq) {
90 *cpunum = cpu;
91
92 return i;
93 }
94 }
95
96 panic("Could not identify cpu/level for irq %d", irq);
97}
98
99static int intr_connect_level(int cpu, int bit)
100{
101 nasid_t nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
102 struct slice_data *si = cpu_data[cpu].data;
103
104 set_bit(bit, si->irq_enable_mask);
105
106 if (!cputoslice(cpu)) {
107 REMOTE_HUB_S(nasid, PI_INT_MASK0_A, si->irq_enable_mask[0]);
108 REMOTE_HUB_S(nasid, PI_INT_MASK1_A, si->irq_enable_mask[1]);
109 } else {
110 REMOTE_HUB_S(nasid, PI_INT_MASK0_B, si->irq_enable_mask[0]);
111 REMOTE_HUB_S(nasid, PI_INT_MASK1_B, si->irq_enable_mask[1]);
112 }
113
114 return 0;
115}
116
117static int intr_disconnect_level(int cpu, int bit)
118{
119 nasid_t nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
120 struct slice_data *si = cpu_data[cpu].data;
121
122 clear_bit(bit, si->irq_enable_mask);
123
124 if (!cputoslice(cpu)) {
125 REMOTE_HUB_S(nasid, PI_INT_MASK0_A, si->irq_enable_mask[0]);
126 REMOTE_HUB_S(nasid, PI_INT_MASK1_A, si->irq_enable_mask[1]);
127 } else {
128 REMOTE_HUB_S(nasid, PI_INT_MASK0_B, si->irq_enable_mask[0]);
129 REMOTE_HUB_S(nasid, PI_INT_MASK1_B, si->irq_enable_mask[1]);
130 }
131
132 return 0;
133}
134
135/* Startup one of the (PCI ...) IRQs routes over a bridge. */
136static unsigned int startup_bridge_irq(struct irq_data *d)
137{
138 struct bridge_controller *bc;
139 bridgereg_t device;
140 bridge_t *bridge;
141 int pin, swlevel;
142 cpuid_t cpu;
143
144 pin = SLOT_FROM_PCI_IRQ(d->irq);
145 bc = IRQ_TO_BRIDGE(d->irq);
146 bridge = bc->base;
147
148 pr_debug("bridge_startup(): irq= 0x%x pin=%d\n", d->irq, pin);
149 /*
150 * "map" irq to a swlevel greater than 6 since the first 6 bits
151 * of INT_PEND0 are taken
152 */
153 swlevel = find_level(&cpu, d->irq);
154 bridge->b_int_addr[pin].addr = (0x20000 | swlevel | (bc->nasid << 8));
155 bridge->b_int_enable |= (1 << pin);
156 bridge->b_int_enable |= 0x7ffffe00; /* more stuff in int_enable */
157
158 /*
159 * Enable sending of an interrupt clear packt to the hub on a high to
160 * low transition of the interrupt pin.
161 *
162 * IRIX sets additional bits in the address which are documented as
163 * reserved in the bridge docs.
164 */
165 bridge->b_int_mode |= (1UL << pin);
166
167 /*
168 * We assume the bridge to have a 1:1 mapping between devices
169 * (slots) and intr pins.
170 */
171 device = bridge->b_int_device;
172 device &= ~(7 << (pin*3));
173 device |= (pin << (pin*3));
174 bridge->b_int_device = device;
175
176 bridge->b_wid_tflush;
177
178 intr_connect_level(cpu, swlevel);
179
180 return 0; /* Never anything pending. */
181}
182
183/* Shutdown one of the (PCI ...) IRQs routes over a bridge. */
184static void shutdown_bridge_irq(struct irq_data *d)
185{
186 struct bridge_controller *bc = IRQ_TO_BRIDGE(d->irq);
187 bridge_t *bridge = bc->base;
188 int pin, swlevel;
189 cpuid_t cpu;
190
191 pr_debug("bridge_shutdown: irq 0x%x\n", d->irq);
192 pin = SLOT_FROM_PCI_IRQ(d->irq);
193
194 /*
195 * map irq to a swlevel greater than 6 since the first 6 bits
196 * of INT_PEND0 are taken
197 */
198 swlevel = find_level(&cpu, d->irq);
199 intr_disconnect_level(cpu, swlevel);
200
201 bridge->b_int_enable &= ~(1 << pin);
202 bridge->b_wid_tflush;
203}
204
205static inline void enable_bridge_irq(struct irq_data *d)
206{
207 cpuid_t cpu;
208 int swlevel;
209
210 swlevel = find_level(&cpu, d->irq); /* Criminal offence */
211 intr_connect_level(cpu, swlevel);
212}
213
214static inline void disable_bridge_irq(struct irq_data *d)
215{
216 cpuid_t cpu;
217 int swlevel;
218
219 swlevel = find_level(&cpu, d->irq); /* Criminal offence */
220 intr_disconnect_level(cpu, swlevel);
221}
222
223static struct irq_chip bridge_irq_type = {
224 .name = "bridge",
225 .irq_startup = startup_bridge_irq,
226 .irq_shutdown = shutdown_bridge_irq,
227 .irq_mask = disable_bridge_irq,
228 .irq_unmask = enable_bridge_irq,
229};
230
231void register_bridge_irq(unsigned int irq)
232{
233 irq_set_chip_and_handler(irq, &bridge_irq_type, handle_level_irq);
234}
235
236int request_bridge_irq(struct bridge_controller *bc)
237{
238 int irq = allocate_irqno();
239 int swlevel, cpu;
240 nasid_t nasid;
241
242 if (irq < 0)
243 return irq;
244
245 /*
246 * "map" irq to a swlevel greater than 6 since the first 6 bits
247 * of INT_PEND0 are taken
248 */
249 cpu = bc->irq_cpu;
250 swlevel = alloc_level(cpu, irq);
251 if (unlikely(swlevel < 0)) {
252 free_irqno(irq);
253
254 return -EAGAIN;
255 }
256
257 /* Make sure it's not already pending when we connect it. */
258 nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
259 REMOTE_HUB_CLR_INTR(nasid, swlevel);
260
261 intr_connect_level(cpu, swlevel);
262
263 register_bridge_irq(irq);
264
265 return irq;
266}
diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c
index 2315cfeb2687..3fbaef97a1b8 100644
--- a/arch/mips/sgi-ip27/ip27-irq.c
+++ b/arch/mips/sgi-ip27/ip27-irq.c
@@ -29,7 +29,6 @@
29#include <asm/mipsregs.h> 29#include <asm/mipsregs.h>
30 30
31#include <asm/processor.h> 31#include <asm/processor.h>
32#include <asm/pci/bridge.h>
33#include <asm/sn/addrs.h> 32#include <asm/sn/addrs.h>
34#include <asm/sn/agent.h> 33#include <asm/sn/agent.h>
35#include <asm/sn/arch.h> 34#include <asm/sn/arch.h>
@@ -54,50 +53,6 @@
54 53
55extern asmlinkage void ip27_irq(void); 54extern asmlinkage void ip27_irq(void);
56 55
57extern struct bridge_controller *irq_to_bridge[];
58extern int irq_to_slot[];
59
60/*
61 * use these macros to get the encoded nasid and widget id
62 * from the irq value
63 */
64#define IRQ_TO_BRIDGE(i) irq_to_bridge[(i)]
65#define SLOT_FROM_PCI_IRQ(i) irq_to_slot[i]
66
67static inline int alloc_level(int cpu, int irq)
68{
69 struct hub_data *hub = hub_data(cpu_to_node(cpu));
70 struct slice_data *si = cpu_data[cpu].data;
71 int level;
72
73 level = find_first_zero_bit(hub->irq_alloc_mask, LEVELS_PER_SLICE);
74 if (level >= LEVELS_PER_SLICE)
75 panic("Cpu %d flooded with devices", cpu);
76
77 __set_bit(level, hub->irq_alloc_mask);
78 si->level_to_irq[level] = irq;
79
80 return level;
81}
82
83static inline int find_level(cpuid_t *cpunum, int irq)
84{
85 int cpu, i;
86
87 for_each_online_cpu(cpu) {
88 struct slice_data *si = cpu_data[cpu].data;
89
90 for (i = BASE_PCI_IRQ; i < LEVELS_PER_SLICE; i++)
91 if (si->level_to_irq[i] == irq) {
92 *cpunum = cpu;
93
94 return i;
95 }
96 }
97
98 panic("Could not identify cpu/level for irq %d", irq);
99}
100
101/* 56/*
102 * Find first bit set 57 * Find first bit set
103 */ 58 */
@@ -204,175 +159,6 @@ static void ip27_hub_error(void)
204 panic("CPU %d got a hub error interrupt", smp_processor_id()); 159 panic("CPU %d got a hub error interrupt", smp_processor_id());
205} 160}
206 161
207static int intr_connect_level(int cpu, int bit)
208{
209 nasid_t nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
210 struct slice_data *si = cpu_data[cpu].data;
211
212 set_bit(bit, si->irq_enable_mask);
213
214 if (!cputoslice(cpu)) {
215 REMOTE_HUB_S(nasid, PI_INT_MASK0_A, si->irq_enable_mask[0]);
216 REMOTE_HUB_S(nasid, PI_INT_MASK1_A, si->irq_enable_mask[1]);
217 } else {
218 REMOTE_HUB_S(nasid, PI_INT_MASK0_B, si->irq_enable_mask[0]);
219 REMOTE_HUB_S(nasid, PI_INT_MASK1_B, si->irq_enable_mask[1]);
220 }
221
222 return 0;
223}
224
225static int intr_disconnect_level(int cpu, int bit)
226{
227 nasid_t nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
228 struct slice_data *si = cpu_data[cpu].data;
229
230 clear_bit(bit, si->irq_enable_mask);
231
232 if (!cputoslice(cpu)) {
233 REMOTE_HUB_S(nasid, PI_INT_MASK0_A, si->irq_enable_mask[0]);
234 REMOTE_HUB_S(nasid, PI_INT_MASK1_A, si->irq_enable_mask[1]);
235 } else {
236 REMOTE_HUB_S(nasid, PI_INT_MASK0_B, si->irq_enable_mask[0]);
237 REMOTE_HUB_S(nasid, PI_INT_MASK1_B, si->irq_enable_mask[1]);
238 }
239
240 return 0;
241}
242
243/* Startup one of the (PCI ...) IRQs routes over a bridge. */
244static unsigned int startup_bridge_irq(struct irq_data *d)
245{
246 struct bridge_controller *bc;
247 bridgereg_t device;
248 bridge_t *bridge;
249 int pin, swlevel;
250 cpuid_t cpu;
251
252 pin = SLOT_FROM_PCI_IRQ(d->irq);
253 bc = IRQ_TO_BRIDGE(d->irq);
254 bridge = bc->base;
255
256 pr_debug("bridge_startup(): irq= 0x%x pin=%d\n", d->irq, pin);
257 /*
258 * "map" irq to a swlevel greater than 6 since the first 6 bits
259 * of INT_PEND0 are taken
260 */
261 swlevel = find_level(&cpu, d->irq);
262 bridge->b_int_addr[pin].addr = (0x20000 | swlevel | (bc->nasid << 8));
263 bridge->b_int_enable |= (1 << pin);
264 bridge->b_int_enable |= 0x7ffffe00; /* more stuff in int_enable */
265
266 /*
267 * Enable sending of an interrupt clear packt to the hub on a high to
268 * low transition of the interrupt pin.
269 *
270 * IRIX sets additional bits in the address which are documented as
271 * reserved in the bridge docs.
272 */
273 bridge->b_int_mode |= (1UL << pin);
274
275 /*
276 * We assume the bridge to have a 1:1 mapping between devices
277 * (slots) and intr pins.
278 */
279 device = bridge->b_int_device;
280 device &= ~(7 << (pin*3));
281 device |= (pin << (pin*3));
282 bridge->b_int_device = device;
283
284 bridge->b_wid_tflush;
285
286 intr_connect_level(cpu, swlevel);
287
288 return 0; /* Never anything pending. */
289}
290
291/* Shutdown one of the (PCI ...) IRQs routes over a bridge. */
292static void shutdown_bridge_irq(struct irq_data *d)
293{
294 struct bridge_controller *bc = IRQ_TO_BRIDGE(d->irq);
295 bridge_t *bridge = bc->base;
296 int pin, swlevel;
297 cpuid_t cpu;
298
299 pr_debug("bridge_shutdown: irq 0x%x\n", d->irq);
300 pin = SLOT_FROM_PCI_IRQ(d->irq);
301
302 /*
303 * map irq to a swlevel greater than 6 since the first 6 bits
304 * of INT_PEND0 are taken
305 */
306 swlevel = find_level(&cpu, d->irq);
307 intr_disconnect_level(cpu, swlevel);
308
309 bridge->b_int_enable &= ~(1 << pin);
310 bridge->b_wid_tflush;
311}
312
313static inline void enable_bridge_irq(struct irq_data *d)
314{
315 cpuid_t cpu;
316 int swlevel;
317
318 swlevel = find_level(&cpu, d->irq); /* Criminal offence */
319 intr_connect_level(cpu, swlevel);
320}
321
322static inline void disable_bridge_irq(struct irq_data *d)
323{
324 cpuid_t cpu;
325 int swlevel;
326
327 swlevel = find_level(&cpu, d->irq); /* Criminal offence */
328 intr_disconnect_level(cpu, swlevel);
329}
330
331static struct irq_chip bridge_irq_type = {
332 .name = "bridge",
333 .irq_startup = startup_bridge_irq,
334 .irq_shutdown = shutdown_bridge_irq,
335 .irq_mask = disable_bridge_irq,
336 .irq_unmask = enable_bridge_irq,
337};
338
339void register_bridge_irq(unsigned int irq)
340{
341 irq_set_chip_and_handler(irq, &bridge_irq_type, handle_level_irq);
342}
343
344int request_bridge_irq(struct bridge_controller *bc)
345{
346 int irq = allocate_irqno();
347 int swlevel, cpu;
348 nasid_t nasid;
349
350 if (irq < 0)
351 return irq;
352
353 /*
354 * "map" irq to a swlevel greater than 6 since the first 6 bits
355 * of INT_PEND0 are taken
356 */
357 cpu = bc->irq_cpu;
358 swlevel = alloc_level(cpu, irq);
359 if (unlikely(swlevel < 0)) {
360 free_irqno(irq);
361
362 return -EAGAIN;
363 }
364
365 /* Make sure it's not already pending when we connect it. */
366 nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu));
367 REMOTE_HUB_CLR_INTR(nasid, swlevel);
368
369 intr_connect_level(cpu, swlevel);
370
371 register_bridge_irq(irq);
372
373 return irq;
374}
375
376asmlinkage void plat_irq_dispatch(void) 162asmlinkage void plat_irq_dispatch(void)
377{ 163{
378 unsigned long pending = read_c0_cause() & read_c0_status(); 164 unsigned long pending = read_c0_cause() & read_c0_status();
diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c
index f94638141b20..f4ea8aa79ba2 100644
--- a/arch/mips/sgi-ip27/ip27-smp.c
+++ b/arch/mips/sgi-ip27/ip27-smp.c
@@ -173,12 +173,12 @@ static void ip27_send_ipi_mask(const struct cpumask *mask, unsigned int action)
173 ip27_send_ipi_single(i, action); 173 ip27_send_ipi_single(i, action);
174} 174}
175 175
176static void __cpuinit ip27_init_secondary(void) 176static void ip27_init_secondary(void)
177{ 177{
178 per_cpu_init(); 178 per_cpu_init();
179} 179}
180 180
181static void __cpuinit ip27_smp_finish(void) 181static void ip27_smp_finish(void)
182{ 182{
183 extern void hub_rt_clock_event_init(void); 183 extern void hub_rt_clock_event_init(void);
184 184
@@ -195,7 +195,7 @@ static void __init ip27_cpus_done(void)
195 * set sp to the kernel stack of the newly created idle process, gp to the proc 195 * set sp to the kernel stack of the newly created idle process, gp to the proc
196 * struct so that current_thread_info() will work. 196 * struct so that current_thread_info() will work.
197 */ 197 */
198static void __cpuinit ip27_boot_secondary(int cpu, struct task_struct *idle) 198static void ip27_boot_secondary(int cpu, struct task_struct *idle)
199{ 199{
200 unsigned long gp = (unsigned long)task_thread_info(idle); 200 unsigned long gp = (unsigned long)task_thread_info(idle);
201 unsigned long sp = __KSTK_TOS(idle); 201 unsigned long sp = __KSTK_TOS(idle);
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index 2e21b761cb9c..1d97eaba0c5f 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -106,7 +106,7 @@ struct irqaction hub_rt_irqaction = {
106#define NSEC_PER_CYCLE 800 106#define NSEC_PER_CYCLE 800
107#define CYCLES_PER_SEC (NSEC_PER_SEC / NSEC_PER_CYCLE) 107#define CYCLES_PER_SEC (NSEC_PER_SEC / NSEC_PER_CYCLE)
108 108
109void __cpuinit hub_rt_clock_event_init(void) 109void hub_rt_clock_event_init(void)
110{ 110{
111 unsigned int cpu = smp_processor_id(); 111 unsigned int cpu = smp_processor_id();
112 struct clock_event_device *cd = &per_cpu(hub_rt_clockevent, cpu); 112 struct clock_event_device *cd = &per_cpu(hub_rt_clockevent, cpu);
@@ -173,7 +173,7 @@ void __init plat_time_init(void)
173 hub_rt_clock_event_init(); 173 hub_rt_clock_event_init();
174} 174}
175 175
176void __cpuinit cpu_time_init(void) 176void cpu_time_init(void)
177{ 177{
178 lboard_t *board; 178 lboard_t *board;
179 klcpu_t *cpu; 179 klcpu_t *cpu;
@@ -194,7 +194,7 @@ void __cpuinit cpu_time_init(void)
194 set_c0_status(SRB_TIMOCLK); 194 set_c0_status(SRB_TIMOCLK);
195} 195}
196 196
197void __cpuinit hub_rtc_init(cnodeid_t cnode) 197void hub_rtc_init(cnodeid_t cnode)
198{ 198{
199 199
200 /* 200 /*
diff --git a/arch/mips/sgi-ip27/ip27-xtalk.c b/arch/mips/sgi-ip27/ip27-xtalk.c
index a4df7d0f6f12..d59b820f528d 100644
--- a/arch/mips/sgi-ip27/ip27-xtalk.c
+++ b/arch/mips/sgi-ip27/ip27-xtalk.c
@@ -23,7 +23,7 @@
23 23
24extern int bridge_probe(nasid_t nasid, int widget, int masterwid); 24extern int bridge_probe(nasid_t nasid, int widget, int masterwid);
25 25
26static int __cpuinit probe_one_port(nasid_t nasid, int widget, int masterwid) 26static int probe_one_port(nasid_t nasid, int widget, int masterwid)
27{ 27{
28 widgetreg_t widget_id; 28 widgetreg_t widget_id;
29 xwidget_part_num_t partnum; 29 xwidget_part_num_t partnum;
@@ -47,7 +47,7 @@ static int __cpuinit probe_one_port(nasid_t nasid, int widget, int masterwid)
47 return 0; 47 return 0;
48} 48}
49 49
50static int __cpuinit xbow_probe(nasid_t nasid) 50static int xbow_probe(nasid_t nasid)
51{ 51{
52 lboard_t *brd; 52 lboard_t *brd;
53 klxbow_t *xbow_p; 53 klxbow_t *xbow_p;
@@ -100,7 +100,7 @@ static int __cpuinit xbow_probe(nasid_t nasid)
100 return 0; 100 return 0;
101} 101}
102 102
103void __cpuinit xtalk_probe_node(cnodeid_t nid) 103void xtalk_probe_node(cnodeid_t nid)
104{ 104{
105 volatile u64 hubreg; 105 volatile u64 hubreg;
106 nasid_t nasid; 106 nasid_t nasid;
diff --git a/arch/mips/sibyte/Kconfig b/arch/mips/sibyte/Kconfig
index 01cc1a749c73..5fbd3605d24f 100644
--- a/arch/mips/sibyte/Kconfig
+++ b/arch/mips/sibyte/Kconfig
@@ -147,7 +147,8 @@ config SIBYTE_CFE_CONSOLE
147 147
148config SIBYTE_BUS_WATCHER 148config SIBYTE_BUS_WATCHER
149 bool "Support for Bus Watcher statistics" 149 bool "Support for Bus Watcher statistics"
150 depends on SIBYTE_SB1xxx_SOC 150 depends on SIBYTE_SB1xxx_SOC && \
151 (SIBYTE_BCM112X || SIBYTE_SB1250)
151 help 152 help
152 Handle and keep statistics on the bus error interrupts (COR_ECC, 153 Handle and keep statistics on the bus error interrupts (COR_ECC,
153 BAD_ECC, IO_BUS). 154 BAD_ECC, IO_BUS).
diff --git a/arch/mips/sibyte/Platform b/arch/mips/sibyte/Platform
index d03a07516f83..af117330ce14 100644
--- a/arch/mips/sibyte/Platform
+++ b/arch/mips/sibyte/Platform
@@ -13,7 +13,6 @@ cflags-$(CONFIG_SIBYTE_BCM112X) += \
13 -I$(srctree)/arch/mips/include/asm/mach-sibyte \ 13 -I$(srctree)/arch/mips/include/asm/mach-sibyte \
14 -DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1250_112x_ALL 14 -DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1250_112x_ALL
15 15
16platform-$(CONFIG_SIBYTE_SB1250) += sibyte/
17cflags-$(CONFIG_SIBYTE_SB1250) += \ 16cflags-$(CONFIG_SIBYTE_SB1250) += \
18 -I$(srctree)/arch/mips/include/asm/mach-sibyte \ 17 -I$(srctree)/arch/mips/include/asm/mach-sibyte \
19 -DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1250_112x_ALL 18 -DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1250_112x_ALL
@@ -31,7 +30,8 @@ cflags-$(CONFIG_SIBYTE_BCM1x80) += \
31# Sibyte BCM91120C (CRhine) board 30# Sibyte BCM91120C (CRhine) board
32# Sibyte BCM91125C (CRhone) board 31# Sibyte BCM91125C (CRhone) board
33# Sibyte BCM91125E (Rhone) board 32# Sibyte BCM91125E (Rhone) board
34# Sibyte SWARM board 33# Sibyte BCM91250A (SWARM) board
34# Sibyte BCM91250C2 (LittleSur) board
35# Sibyte BCM91x80 (BigSur) board 35# Sibyte BCM91x80 (BigSur) board
36# 36#
37load-$(CONFIG_SIBYTE_CARMEL) := 0xffffffff80100000 37load-$(CONFIG_SIBYTE_CARMEL) := 0xffffffff80100000
@@ -41,3 +41,4 @@ load-$(CONFIG_SIBYTE_RHONE) := 0xffffffff80100000
41load-$(CONFIG_SIBYTE_SENTOSA) := 0xffffffff80100000 41load-$(CONFIG_SIBYTE_SENTOSA) := 0xffffffff80100000
42load-$(CONFIG_SIBYTE_SWARM) := 0xffffffff80100000 42load-$(CONFIG_SIBYTE_SWARM) := 0xffffffff80100000
43load-$(CONFIG_SIBYTE_BIGSUR) := 0xffffffff80100000 43load-$(CONFIG_SIBYTE_BIGSUR) := 0xffffffff80100000
44load-$(CONFIG_SIBYTE_LITTLESUR) := 0xffffffff80100000
diff --git a/arch/mips/sibyte/bcm1480/smp.c b/arch/mips/sibyte/bcm1480/smp.c
index de88e22694a0..54e2c4de15c1 100644
--- a/arch/mips/sibyte/bcm1480/smp.c
+++ b/arch/mips/sibyte/bcm1480/smp.c
@@ -60,7 +60,7 @@ static void *mailbox_0_regs[] = {
60/* 60/*
61 * SMP init and finish on secondary CPUs 61 * SMP init and finish on secondary CPUs
62 */ 62 */
63void __cpuinit bcm1480_smp_init(void) 63void bcm1480_smp_init(void)
64{ 64{
65 unsigned int imask = STATUSF_IP4 | STATUSF_IP3 | STATUSF_IP2 | 65 unsigned int imask = STATUSF_IP4 | STATUSF_IP3 | STATUSF_IP2 |
66 STATUSF_IP1 | STATUSF_IP0; 66 STATUSF_IP1 | STATUSF_IP0;
@@ -95,7 +95,7 @@ static void bcm1480_send_ipi_mask(const struct cpumask *mask,
95/* 95/*
96 * Code to run on secondary just after probing the CPU 96 * Code to run on secondary just after probing the CPU
97 */ 97 */
98static void __cpuinit bcm1480_init_secondary(void) 98static void bcm1480_init_secondary(void)
99{ 99{
100 extern void bcm1480_smp_init(void); 100 extern void bcm1480_smp_init(void);
101 101
@@ -106,7 +106,7 @@ static void __cpuinit bcm1480_init_secondary(void)
106 * Do any tidying up before marking online and running the idle 106 * Do any tidying up before marking online and running the idle
107 * loop 107 * loop
108 */ 108 */
109static void __cpuinit bcm1480_smp_finish(void) 109static void bcm1480_smp_finish(void)
110{ 110{
111 extern void sb1480_clockevent_init(void); 111 extern void sb1480_clockevent_init(void);
112 112
@@ -125,7 +125,7 @@ static void bcm1480_cpus_done(void)
125 * Setup the PC, SP, and GP of a secondary processor and start it 125 * Setup the PC, SP, and GP of a secondary processor and start it
126 * running! 126 * running!
127 */ 127 */
128static void __cpuinit bcm1480_boot_secondary(int cpu, struct task_struct *idle) 128static void bcm1480_boot_secondary(int cpu, struct task_struct *idle)
129{ 129{
130 int retval; 130 int retval;
131 131
diff --git a/arch/mips/sibyte/common/Makefile b/arch/mips/sibyte/common/Makefile
index 36aa700cc40c..b3d6bf23a662 100644
--- a/arch/mips/sibyte/common/Makefile
+++ b/arch/mips/sibyte/common/Makefile
@@ -1,3 +1,4 @@
1obj-y := cfe.o 1obj-y := cfe.o
2obj-$(CONFIG_SIBYTE_BUS_WATCHER) += bus_watcher.o
2obj-$(CONFIG_SIBYTE_CFE_CONSOLE) += cfe_console.o 3obj-$(CONFIG_SIBYTE_CFE_CONSOLE) += cfe_console.o
3obj-$(CONFIG_SIBYTE_TBPROF) += sb_tbprof.o 4obj-$(CONFIG_SIBYTE_TBPROF) += sb_tbprof.o
diff --git a/arch/mips/sibyte/sb1250/bus_watcher.c b/arch/mips/sibyte/common/bus_watcher.c
index 8871e3345bff..5581844c9194 100644
--- a/arch/mips/sibyte/sb1250/bus_watcher.c
+++ b/arch/mips/sibyte/common/bus_watcher.c
@@ -37,6 +37,9 @@
37#include <asm/sibyte/sb1250_regs.h> 37#include <asm/sibyte/sb1250_regs.h>
38#include <asm/sibyte/sb1250_int.h> 38#include <asm/sibyte/sb1250_int.h>
39#include <asm/sibyte/sb1250_scd.h> 39#include <asm/sibyte/sb1250_scd.h>
40#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
41#include <asm/sibyte/bcm1480_regs.h>
42#endif
40 43
41 44
42struct bw_stats_struct { 45struct bw_stats_struct {
@@ -81,9 +84,15 @@ void check_bus_watcher(void)
81#ifdef CONFIG_SB1_PASS_1_WORKAROUNDS 84#ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
82 /* Destructive read, clears register and interrupt */ 85 /* Destructive read, clears register and interrupt */
83 status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS)); 86 status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS));
84#else 87#elif defined(CONFIG_SIBYTE_BCM112X) || defined(CONFIG_SIBYTE_SB1250)
85 /* Use non-destructive register */ 88 /* Use non-destructive register */
86 status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS_DEBUG)); 89 status = csr_in32(IOADDR(A_SCD_BUS_ERR_STATUS_DEBUG));
90#elif defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
91 /* Use non-destructive register */
92 /* Same as 1250 except BUS_ERR_STATUS_DEBUG is in a different place. */
93 status = csr_in32(IOADDR(A_BCM1480_BUS_ERR_STATUS_DEBUG));
94#else
95#error bus watcher being built for unknown Sibyte SOC!
87#endif 96#endif
88 if (!(status & 0x7fffffff)) { 97 if (!(status & 0x7fffffff)) {
89 printk("Using last values reaped by bus watcher driver\n"); 98 printk("Using last values reaped by bus watcher driver\n");
@@ -175,9 +184,6 @@ static irqreturn_t sibyte_bw_int(int irq, void *data)
175#ifdef CONFIG_SIBYTE_BW_TRACE 184#ifdef CONFIG_SIBYTE_BW_TRACE
176 int i; 185 int i;
177#endif 186#endif
178#ifndef CONFIG_PROC_FS
179 char bw_buf[1024];
180#endif
181 187
182#ifdef CONFIG_SIBYTE_BW_TRACE 188#ifdef CONFIG_SIBYTE_BW_TRACE
183 csr_out32(M_SCD_TRACE_CFG_FREEZE, IOADDR(A_SCD_TRACE_CFG)); 189 csr_out32(M_SCD_TRACE_CFG_FREEZE, IOADDR(A_SCD_TRACE_CFG));
diff --git a/arch/mips/sibyte/common/sb_tbprof.c b/arch/mips/sibyte/common/sb_tbprof.c
index 2188b39a1251..059e28c8fd97 100644
--- a/arch/mips/sibyte/common/sb_tbprof.c
+++ b/arch/mips/sibyte/common/sb_tbprof.c
@@ -27,6 +27,7 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/sched.h>
30#include <linux/vmalloc.h> 31#include <linux/vmalloc.h>
31#include <linux/fs.h> 32#include <linux/fs.h>
32#include <linux/errno.h> 33#include <linux/errno.h>
diff --git a/arch/mips/sibyte/sb1250/Makefile b/arch/mips/sibyte/sb1250/Makefile
index d3d969de407b..cdc4c56c3e29 100644
--- a/arch/mips/sibyte/sb1250/Makefile
+++ b/arch/mips/sibyte/sb1250/Makefile
@@ -1,4 +1,3 @@
1obj-y := setup.o irq.o time.o 1obj-y := setup.o irq.o time.o
2 2
3obj-$(CONFIG_SMP) += smp.o 3obj-$(CONFIG_SMP) += smp.o
4obj-$(CONFIG_SIBYTE_BUS_WATCHER) += bus_watcher.o
diff --git a/arch/mips/sibyte/sb1250/smp.c b/arch/mips/sibyte/sb1250/smp.c
index 285cfef4ebc0..d7b942db0ea5 100644
--- a/arch/mips/sibyte/sb1250/smp.c
+++ b/arch/mips/sibyte/sb1250/smp.c
@@ -48,7 +48,7 @@ static void *mailbox_regs[] = {
48/* 48/*
49 * SMP init and finish on secondary CPUs 49 * SMP init and finish on secondary CPUs
50 */ 50 */
51void __cpuinit sb1250_smp_init(void) 51void sb1250_smp_init(void)
52{ 52{
53 unsigned int imask = STATUSF_IP4 | STATUSF_IP3 | STATUSF_IP2 | 53 unsigned int imask = STATUSF_IP4 | STATUSF_IP3 | STATUSF_IP2 |
54 STATUSF_IP1 | STATUSF_IP0; 54 STATUSF_IP1 | STATUSF_IP0;
@@ -83,7 +83,7 @@ static inline void sb1250_send_ipi_mask(const struct cpumask *mask,
83/* 83/*
84 * Code to run on secondary just after probing the CPU 84 * Code to run on secondary just after probing the CPU
85 */ 85 */
86static void __cpuinit sb1250_init_secondary(void) 86static void sb1250_init_secondary(void)
87{ 87{
88 extern void sb1250_smp_init(void); 88 extern void sb1250_smp_init(void);
89 89
@@ -94,7 +94,7 @@ static void __cpuinit sb1250_init_secondary(void)
94 * Do any tidying up before marking online and running the idle 94 * Do any tidying up before marking online and running the idle
95 * loop 95 * loop
96 */ 96 */
97static void __cpuinit sb1250_smp_finish(void) 97static void sb1250_smp_finish(void)
98{ 98{
99 extern void sb1250_clockevent_init(void); 99 extern void sb1250_clockevent_init(void);
100 100
@@ -113,7 +113,7 @@ static void sb1250_cpus_done(void)
113 * Setup the PC, SP, and GP of a secondary processor and start it 113 * Setup the PC, SP, and GP of a secondary processor and start it
114 * running! 114 * running!
115 */ 115 */
116static void __cpuinit sb1250_boot_secondary(int cpu, struct task_struct *idle) 116static void sb1250_boot_secondary(int cpu, struct task_struct *idle)
117{ 117{
118 int retval; 118 int retval;
119 119
diff --git a/arch/mips/sni/pcimt.c b/arch/mips/sni/pcimt.c
index cec4b8ca1438..12336c2a649c 100644
--- a/arch/mips/sni/pcimt.c
+++ b/arch/mips/sni/pcimt.c
@@ -185,6 +185,7 @@ static void __init sni_pcimt_resource_init(void)
185 185
186extern struct pci_ops sni_pcimt_ops; 186extern struct pci_ops sni_pcimt_ops;
187 187
188#ifdef CONFIG_PCI
188static struct pci_controller sni_controller = { 189static struct pci_controller sni_controller = {
189 .pci_ops = &sni_pcimt_ops, 190 .pci_ops = &sni_pcimt_ops,
190 .mem_resource = &sni_mem_resource, 191 .mem_resource = &sni_mem_resource,
@@ -193,6 +194,7 @@ static struct pci_controller sni_controller = {
193 .io_offset = 0x00000000UL, 194 .io_offset = 0x00000000UL,
194 .io_map_base = SNI_PORT_BASE 195 .io_map_base = SNI_PORT_BASE
195}; 196};
197#endif
196 198
197static void enable_pcimt_irq(struct irq_data *d) 199static void enable_pcimt_irq(struct irq_data *d)
198{ 200{
diff --git a/arch/mips/sni/pcit.c b/arch/mips/sni/pcit.c
index 7cddd03d1fea..05bb51676e82 100644
--- a/arch/mips/sni/pcit.c
+++ b/arch/mips/sni/pcit.c
@@ -128,13 +128,6 @@ static struct resource pcit_io_resources[] = {
128 } 128 }
129}; 129};
130 130
131static struct resource sni_mem_resource = {
132 .start = 0x18000000UL,
133 .end = 0x1fbfffffUL,
134 .name = "PCIT PCI MEM",
135 .flags = IORESOURCE_MEM
136};
137
138static void __init sni_pcit_resource_init(void) 131static void __init sni_pcit_resource_init(void)
139{ 132{
140 int i; 133 int i;
@@ -147,6 +140,14 @@ static void __init sni_pcit_resource_init(void)
147 140
148extern struct pci_ops sni_pcit_ops; 141extern struct pci_ops sni_pcit_ops;
149 142
143#ifdef CONFIG_PCI
144static struct resource sni_mem_resource = {
145 .start = 0x18000000UL,
146 .end = 0x1fbfffffUL,
147 .name = "PCIT PCI MEM",
148 .flags = IORESOURCE_MEM
149};
150
150static struct pci_controller sni_pcit_controller = { 151static struct pci_controller sni_pcit_controller = {
151 .pci_ops = &sni_pcit_ops, 152 .pci_ops = &sni_pcit_ops,
152 .mem_resource = &sni_mem_resource, 153 .mem_resource = &sni_mem_resource,
@@ -155,6 +156,7 @@ static struct pci_controller sni_pcit_controller = {
155 .io_offset = 0x00000000UL, 156 .io_offset = 0x00000000UL,
156 .io_map_base = SNI_PORT_BASE 157 .io_map_base = SNI_PORT_BASE
157}; 158};
159#endif /* CONFIG_PCI */
158 160
159static void enable_pcit_irq(struct irq_data *d) 161static void enable_pcit_irq(struct irq_data *d)
160{ 162{
diff --git a/arch/mips/txx9/generic/setup_tx4939.c b/arch/mips/txx9/generic/setup_tx4939.c
index 729a50991780..b7eccbd17bf7 100644
--- a/arch/mips/txx9/generic/setup_tx4939.c
+++ b/arch/mips/txx9/generic/setup_tx4939.c
@@ -331,7 +331,8 @@ static int tx4939_netdev_event(struct notifier_block *this,
331 unsigned long event, 331 unsigned long event,
332 void *ptr) 332 void *ptr)
333{ 333{
334 struct net_device *dev = ptr; 334 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
335
335 if (event == NETDEV_CHANGE && netif_carrier_ok(dev)) { 336 if (event == NETDEV_CHANGE && netif_carrier_ok(dev)) {
336 __u64 bit = 0; 337 __u64 bit = 0;
337 if (dev->irq == TXX9_IRQ_BASE + TX4939_IR_ETH(0)) 338 if (dev->irq == TXX9_IRQ_BASE + TX4939_IR_ETH(0))
diff --git a/arch/mips/wrppmc/Makefile b/arch/mips/wrppmc/Makefile
deleted file mode 100644
index 307cc6920ce6..000000000000
--- a/arch/mips/wrppmc/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
1#
2# This file is subject to the terms and conditions of the GNU General Public
3# License. See the file "COPYING" in the main directory of this archive
4# for more details.
5#
6# Copyright 2006 Wind River System, Inc.
7# Author: Rongkai.Zhan <rongkai.zhan@windriver.com>
8#
9# Makefile for the Wind River MIPS 4Kc PPMC Eval Board
10#
11
12obj-y += irq.o pci.o reset.o serial.o setup.o time.o
diff --git a/arch/mips/wrppmc/Platform b/arch/mips/wrppmc/Platform
deleted file mode 100644
index dc78b25b95fe..000000000000
--- a/arch/mips/wrppmc/Platform
+++ /dev/null
@@ -1,7 +0,0 @@
1#
2# Wind River PPMC Board (4KC + GT64120)
3#
4platform-$(CONFIG_WR_PPMC) += wrppmc/
5cflags-$(CONFIG_WR_PPMC) += \
6 -I$(srctree)/arch/mips/include/asm/mach-wrppmc
7load-$(CONFIG_WR_PPMC) += 0xffffffff80100000
diff --git a/arch/mips/wrppmc/irq.c b/arch/mips/wrppmc/irq.c
deleted file mode 100644
index f237bf4d5c3a..000000000000
--- a/arch/mips/wrppmc/irq.c
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * irq.c: GT64120 Interrupt Controller
3 *
4 * Copyright (C) 2006, Wind River System Inc.
5 * Author: Rongkai.Zhan, <rongkai.zhan@windriver.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12#include <linux/hardirq.h>
13#include <linux/init.h>
14#include <linux/irq.h>
15
16#include <asm/gt64120.h>
17#include <asm/irq_cpu.h>
18#include <asm/mipsregs.h>
19
20asmlinkage void plat_irq_dispatch(void)
21{
22 unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
23
24 if (pending & STATUSF_IP7)
25 do_IRQ(WRPPMC_MIPS_TIMER_IRQ); /* CPU Compare/Count internal timer */
26 else if (pending & STATUSF_IP6)
27 do_IRQ(WRPPMC_UART16550_IRQ); /* UART 16550 port */
28 else if (pending & STATUSF_IP3)
29 do_IRQ(WRPPMC_PCI_INTA_IRQ); /* PCI INT_A */
30 else
31 spurious_interrupt();
32}
33
34/**
35 * Initialize GT64120 Interrupt Controller
36 */
37void gt64120_init_pic(void)
38{
39 /* clear CPU Interrupt Cause Registers */
40 GT_WRITE(GT_INTRCAUSE_OFS, (0x1F << 21));
41 GT_WRITE(GT_HINTRCAUSE_OFS, 0x00);
42
43 /* Disable all interrupts from GT64120 bridge chip */
44 GT_WRITE(GT_INTRMASK_OFS, 0x00);
45 GT_WRITE(GT_HINTRMASK_OFS, 0x00);
46 GT_WRITE(GT_PCI0_ICMASK_OFS, 0x00);
47 GT_WRITE(GT_PCI0_HICMASK_OFS, 0x00);
48}
49
50void __init arch_init_irq(void)
51{
52 /* IRQ 0 - 7 are for MIPS common irq_cpu controller */
53 mips_cpu_irq_init();
54
55 gt64120_init_pic();
56}
diff --git a/arch/mips/wrppmc/pci.c b/arch/mips/wrppmc/pci.c
deleted file mode 100644
index 8b8a0e1a40ca..000000000000
--- a/arch/mips/wrppmc/pci.c
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2 * pci.c: GT64120 PCI support.
3 *
4 * Copyright (C) 2006, Wind River System Inc. Rongkai.Zhan <rongkai.zhan@windriver.com>
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/init.h>
11#include <linux/ioport.h>
12#include <linux/types.h>
13#include <linux/pci.h>
14
15#include <asm/gt64120.h>
16
17extern struct pci_ops gt64xxx_pci0_ops;
18
19static struct resource pci0_io_resource = {
20 .name = "pci_0 io",
21 .start = GT_PCI_IO_BASE,
22 .end = GT_PCI_IO_BASE + GT_PCI_IO_SIZE - 1,
23 .flags = IORESOURCE_IO,
24};
25
26static struct resource pci0_mem_resource = {
27 .name = "pci_0 memory",
28 .start = GT_PCI_MEM_BASE,
29 .end = GT_PCI_MEM_BASE + GT_PCI_MEM_SIZE - 1,
30 .flags = IORESOURCE_MEM,
31};
32
33static struct pci_controller hose_0 = {
34 .pci_ops = &gt64xxx_pci0_ops,
35 .io_resource = &pci0_io_resource,
36 .mem_resource = &pci0_mem_resource,
37};
38
39static int __init gt64120_pci_init(void)
40{
41 (void) GT_READ(GT_PCI0_CMD_OFS); /* Huh??? -- Ralf */
42 (void) GT_READ(GT_PCI0_BARE_OFS);
43
44 /* reset the whole PCI I/O space range */
45 ioport_resource.start = GT_PCI_IO_BASE;
46 ioport_resource.end = GT_PCI_IO_BASE + GT_PCI_IO_SIZE - 1;
47
48 register_pci_controller(&hose_0);
49 return 0;
50}
51
52arch_initcall(gt64120_pci_init);
diff --git a/arch/mips/wrppmc/reset.c b/arch/mips/wrppmc/reset.c
deleted file mode 100644
index 80beb188ed47..000000000000
--- a/arch/mips/wrppmc/reset.c
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1997 Ralf Baechle
7 */
8#include <linux/irqflags.h>
9#include <linux/kernel.h>
10
11#include <asm/cacheflush.h>
12#include <asm/idle.h>
13#include <asm/mipsregs.h>
14#include <asm/processor.h>
15
16void wrppmc_machine_restart(char *command)
17{
18 /*
19 * Ouch, we're still alive ... This time we take the silver bullet ...
20 * ... and find that we leave the hardware in a state in which the
21 * kernel in the flush locks up somewhen during of after the PCI
22 * detection stuff.
23 */
24 local_irq_disable();
25 set_c0_status(ST0_BEV | ST0_ERL);
26 change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
27 flush_cache_all();
28 write_c0_wired(0);
29 __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000));
30}
31
32void wrppmc_machine_halt(void)
33{
34 local_irq_disable();
35
36 printk(KERN_NOTICE "You can safely turn off the power\n");
37 while (1) {
38 if (cpu_wait)
39 cpu_wait();
40 }
41}
diff --git a/arch/mips/wrppmc/serial.c b/arch/mips/wrppmc/serial.c
deleted file mode 100644
index 83f0f7d05187..000000000000
--- a/arch/mips/wrppmc/serial.c
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2 * Registration of WRPPMC UART platform device.
3 *
4 * Copyright (C) 2007 Yoichi Yuasa <yuasa@linux-mips.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/errno.h>
21#include <linux/init.h>
22#include <linux/ioport.h>
23#include <linux/platform_device.h>
24#include <linux/serial_8250.h>
25
26#include <asm/gt64120.h>
27
28static struct resource wrppmc_uart_resource[] __initdata = {
29 {
30 .start = WRPPMC_UART16550_BASE,
31 .end = WRPPMC_UART16550_BASE + 7,
32 .flags = IORESOURCE_MEM,
33 },
34 {
35 .start = WRPPMC_UART16550_IRQ,
36 .end = WRPPMC_UART16550_IRQ,
37 .flags = IORESOURCE_IRQ,
38 },
39};
40
41static struct plat_serial8250_port wrppmc_serial8250_port[] = {
42 {
43 .irq = WRPPMC_UART16550_IRQ,
44 .uartclk = WRPPMC_UART16550_CLOCK,
45 .iotype = UPIO_MEM,
46 .flags = UPF_IOREMAP | UPF_SKIP_TEST,
47 .mapbase = WRPPMC_UART16550_BASE,
48 },
49 {},
50};
51
52static __init int wrppmc_uart_add(void)
53{
54 struct platform_device *pdev;
55 int retval;
56
57 pdev = platform_device_alloc("serial8250", -1);
58 if (!pdev)
59 return -ENOMEM;
60
61 pdev->id = PLAT8250_DEV_PLATFORM;
62 pdev->dev.platform_data = wrppmc_serial8250_port;
63
64 retval = platform_device_add_resources(pdev, wrppmc_uart_resource,
65 ARRAY_SIZE(wrppmc_uart_resource));
66 if (retval)
67 goto err_free_device;
68
69 retval = platform_device_add(pdev);
70 if (retval)
71 goto err_free_device;
72
73 return 0;
74
75err_free_device:
76 platform_device_put(pdev);
77
78 return retval;
79}
80device_initcall(wrppmc_uart_add);
diff --git a/arch/mips/wrppmc/setup.c b/arch/mips/wrppmc/setup.c
deleted file mode 100644
index ca65c84031a7..000000000000
--- a/arch/mips/wrppmc/setup.c
+++ /dev/null
@@ -1,128 +0,0 @@
1/*
2 * setup.c: Setup pointers to hardware dependent routines.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1996, 1997, 2004 by Ralf Baechle (ralf@linux-mips.org)
9 * Copyright (C) 2006, Wind River System Inc. Rongkai.zhan <rongkai.zhan@windriver.com>
10 */
11#include <linux/init.h>
12#include <linux/string.h>
13#include <linux/kernel.h>
14#include <linux/pm.h>
15
16#include <asm/io.h>
17#include <asm/bootinfo.h>
18#include <asm/reboot.h>
19#include <asm/time.h>
20#include <asm/gt64120.h>
21
22unsigned long gt64120_base = KSEG1ADDR(0x14000000);
23
24#ifdef WRPPMC_EARLY_DEBUG
25
26static volatile unsigned char * wrppmc_led = \
27 (volatile unsigned char *)KSEG1ADDR(WRPPMC_LED_BASE);
28
29/*
30 * PPMC LED control register:
31 * -) bit[0] controls DS1 LED (1 - OFF, 0 - ON)
32 * -) bit[1] controls DS2 LED (1 - OFF, 0 - ON)
33 * -) bit[2] controls DS4 LED (1 - OFF, 0 - ON)
34 */
35void wrppmc_led_on(int mask)
36{
37 unsigned char value = *wrppmc_led;
38
39 value &= (0xF8 | mask);
40 *wrppmc_led = value;
41}
42
43/* If mask = 0, turn off all LEDs */
44void wrppmc_led_off(int mask)
45{
46 unsigned char value = *wrppmc_led;
47
48 value |= (0x7 & mask);
49 *wrppmc_led = value;
50}
51
52/*
53 * We assume that bootloader has initialized UART16550 correctly
54 */
55void __init wrppmc_early_putc(char ch)
56{
57 static volatile unsigned char *wrppmc_uart = \
58 (volatile unsigned char *)KSEG1ADDR(WRPPMC_UART16550_BASE);
59 unsigned char value;
60
61 /* Wait until Transmit-Holding-Register is empty */
62 while (1) {
63 value = *(wrppmc_uart + 5);
64 if (value & 0x20)
65 break;
66 }
67
68 *wrppmc_uart = ch;
69}
70
71void __init wrppmc_early_printk(const char *fmt, ...)
72{
73 static char pbuf[256] = {'\0', };
74 char *ch = pbuf;
75 va_list args;
76 unsigned int i;
77
78 memset(pbuf, 0, 256);
79 va_start(args, fmt);
80 i = vsprintf(pbuf, fmt, args);
81 va_end(args);
82
83 /* Print the string */
84 while (*ch != '\0') {
85 wrppmc_early_putc(*ch);
86 /* if print '\n', also print '\r' */
87 if (*ch++ == '\n')
88 wrppmc_early_putc('\r');
89 }
90}
91#endif /* WRPPMC_EARLY_DEBUG */
92
93void __init prom_free_prom_memory(void)
94{
95}
96
97void __init plat_mem_setup(void)
98{
99 extern void wrppmc_machine_restart(char *command);
100 extern void wrppmc_machine_halt(void);
101
102 _machine_restart = wrppmc_machine_restart;
103 _machine_halt = wrppmc_machine_halt;
104 pm_power_off = wrppmc_machine_halt;
105
106 /* This makes the operations of 'in/out[bwl]' to the
107 * physical address ( < KSEG0) can work via KSEG1
108 */
109 set_io_port_base(KSEG1);
110}
111
112const char *get_system_type(void)
113{
114 return "Wind River PPMC (GT64120)";
115}
116
117/*
118 * Initializes basic routines and structures pointers, memory size (as
119 * given by the bios and saves the command line.
120 */
121void __init prom_init(void)
122{
123 add_memory_region(WRPPMC_SDRAM_SCS0_BASE, WRPPMC_SDRAM_SCS0_SIZE, BOOT_MEM_RAM);
124 add_memory_region(WRPPMC_BOOTROM_BASE, WRPPMC_BOOTROM_SIZE, BOOT_MEM_ROM_DATA);
125
126 wrppmc_early_printk("prom_init: GT64120 SDRAM Bank 0: 0x%x - 0x%08lx\n",
127 WRPPMC_SDRAM_SCS0_BASE, (WRPPMC_SDRAM_SCS0_BASE + WRPPMC_SDRAM_SCS0_SIZE));
128}
diff --git a/arch/mips/wrppmc/time.c b/arch/mips/wrppmc/time.c
deleted file mode 100644
index 668dbd5f12c5..000000000000
--- a/arch/mips/wrppmc/time.c
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * time.c: MIPS CPU Count/Compare timer hookup
3 *
4 * Author: Mark.Zhan, <rongkai.zhan@windriver.com>
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 1996, 1997, 2004 by Ralf Baechle (ralf@linux-mips.org)
11 * Copyright (C) 2006, Wind River System Inc.
12 */
13#include <linux/init.h>
14#include <linux/interrupt.h>
15#include <linux/irq.h>
16
17#include <asm/gt64120.h>
18#include <asm/time.h>
19
20#define WRPPMC_CPU_CLK_FREQ 40000000 /* 40MHZ */
21
22/*
23 * Estimate CPU frequency. Sets mips_hpt_frequency as a side-effect
24 *
25 * NOTE: We disable all GT64120 timers, and use MIPS processor internal
26 * timer as the source of kernel clock tick.
27 */
28void __init plat_time_init(void)
29{
30 /* Disable GT64120 timers */
31 GT_WRITE(GT_TC_CONTROL_OFS, 0x00);
32 GT_WRITE(GT_TC0_OFS, 0x00);
33 GT_WRITE(GT_TC1_OFS, 0x00);
34 GT_WRITE(GT_TC2_OFS, 0x00);
35 GT_WRITE(GT_TC3_OFS, 0x00);
36
37 /* Use MIPS compare/count internal timer */
38 mips_hpt_frequency = WRPPMC_CPU_CLK_FREQ;
39}
diff --git a/arch/mn10300/include/uapi/asm/socket.h b/arch/mn10300/include/uapi/asm/socket.h
index b4ce844c9391..e2a2b203eb00 100644
--- a/arch/mn10300/include/uapi/asm/socket.h
+++ b/arch/mn10300/include/uapi/asm/socket.h
@@ -74,4 +74,6 @@
74 74
75#define SO_SELECT_ERR_QUEUE 45 75#define SO_SELECT_ERR_QUEUE 45
76 76
77#define SO_BUSY_POLL 46
78
77#endif /* _ASM_SOCKET_H */ 79#endif /* _ASM_SOCKET_H */
diff --git a/arch/mn10300/mm/fault.c b/arch/mn10300/mm/fault.c
index d48a84fd7fae..8a2e6ded9a44 100644
--- a/arch/mn10300/mm/fault.c
+++ b/arch/mn10300/mm/fault.c
@@ -345,9 +345,10 @@ no_context:
345 */ 345 */
346out_of_memory: 346out_of_memory:
347 up_read(&mm->mmap_sem); 347 up_read(&mm->mmap_sem);
348 printk(KERN_ALERT "VM: killing process %s\n", tsk->comm); 348 if ((fault_code & MMUFCR_xFC_ACCESS) == MMUFCR_xFC_ACCESS_USR) {
349 if ((fault_code & MMUFCR_xFC_ACCESS) == MMUFCR_xFC_ACCESS_USR) 349 pagefault_out_of_memory();
350 do_exit(SIGKILL); 350 return;
351 }
351 goto no_context; 352 goto no_context;
352 353
353do_sigbus: 354do_sigbus:
diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index f4d5bedc3b4f..d7359ffbcbdd 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -267,7 +267,7 @@ void __init detect_unit_config(unsigned long upr, unsigned long mask,
267 * 267 *
268 */ 268 */
269 269
270void __cpuinit calibrate_delay(void) 270void calibrate_delay(void)
271{ 271{
272 const int *val; 272 const int *val;
273 struct device_node *cpu = NULL; 273 struct device_node *cpu = NULL;
diff --git a/arch/openrisc/mm/fault.c b/arch/openrisc/mm/fault.c
index e2bfafce66c5..4a41f8493ab0 100644
--- a/arch/openrisc/mm/fault.c
+++ b/arch/openrisc/mm/fault.c
@@ -267,10 +267,10 @@ out_of_memory:
267 __asm__ __volatile__("l.nop 1"); 267 __asm__ __volatile__("l.nop 1");
268 268
269 up_read(&mm->mmap_sem); 269 up_read(&mm->mmap_sem);
270 printk("VM: killing process %s\n", tsk->comm); 270 if (!user_mode(regs))
271 if (user_mode(regs)) 271 goto no_context;
272 do_exit(SIGKILL); 272 pagefault_out_of_memory();
273 goto no_context; 273 return;
274 274
275do_sigbus: 275do_sigbus:
276 up_read(&mm->mmap_sem); 276 up_read(&mm->mmap_sem);
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 96ec3982be8d..e02f665f804a 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -17,6 +17,8 @@
17# Mike Shaver, Helge Deller and Martin K. Petersen 17# Mike Shaver, Helge Deller and Martin K. Petersen
18# 18#
19 19
20KBUILD_IMAGE := vmlinuz
21
20KBUILD_DEFCONFIG := default_defconfig 22KBUILD_DEFCONFIG := default_defconfig
21 23
22NM = sh $(srctree)/arch/parisc/nm 24NM = sh $(srctree)/arch/parisc/nm
@@ -92,7 +94,7 @@ PALOCONF := $(shell if [ -f $(src)/palo.conf ]; then echo $(src)/palo.conf; \
92 else echo $(obj)/palo.conf; \ 94 else echo $(obj)/palo.conf; \
93 fi) 95 fi)
94 96
95palo: vmlinux 97palo: vmlinuz
96 @if test ! -x "$(PALO)"; then \ 98 @if test ! -x "$(PALO)"; then \
97 echo 'ERROR: Please install palo first (apt-get install palo)';\ 99 echo 'ERROR: Please install palo first (apt-get install palo)';\
98 echo 'or build it from source and install it somewhere in your $$PATH';\ 100 echo 'or build it from source and install it somewhere in your $$PATH';\
@@ -107,10 +109,14 @@ palo: vmlinux
107 fi 109 fi
108 $(PALO) -f $(PALOCONF) 110 $(PALO) -f $(PALOCONF)
109 111
110# Shorthands for known targets not supported by parisc, use vmlinux as default 112# Shorthands for known targets not supported by parisc, use vmlinux/vmlinuz as default
111Image zImage bzImage: vmlinux 113Image: vmlinux
114zImage bzImage: vmlinuz
115
116vmlinuz: vmlinux
117 @gzip -cf -9 $< > $@
112 118
113install: vmlinux 119install: vmlinuz
114 sh $(src)/arch/parisc/install.sh \ 120 sh $(src)/arch/parisc/install.sh \
115 $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)" 121 $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)"
116 122
@@ -119,6 +125,7 @@ MRPROPER_FILES += palo.conf
119 125
120define archhelp 126define archhelp
121 @echo '* vmlinux - Uncompressed kernel image (./vmlinux)' 127 @echo '* vmlinux - Uncompressed kernel image (./vmlinux)'
128 @echo ' vmlinuz - Compressed kernel image (./vmlinuz)'
122 @echo ' palo - Bootable image (./lifimage)' 129 @echo ' palo - Bootable image (./lifimage)'
123 @echo ' install - Install kernel using' 130 @echo ' install - Install kernel using'
124 @echo ' (your) ~/bin/$(INSTALLKERNEL) or' 131 @echo ' (your) ~/bin/$(INSTALLKERNEL) or'
diff --git a/arch/parisc/defpalo.conf b/arch/parisc/defpalo.conf
index 4e1ae25b08d1..208ff3b41487 100644
--- a/arch/parisc/defpalo.conf
+++ b/arch/parisc/defpalo.conf
@@ -4,7 +4,7 @@
4# Most people using 'make palo' want a bootable file, usable for 4# Most people using 'make palo' want a bootable file, usable for
5# network or tape booting for example. 5# network or tape booting for example.
6--init-tape=lifimage 6--init-tape=lifimage
7--recoverykernel=vmlinux 7--recoverykernel=vmlinuz
8 8
9########## Pick your ROOT here! ########## 9########## Pick your ROOT here! ##########
10# You need at least one 'root='! 10# You need at least one 'root='!
@@ -12,10 +12,10 @@
12# If you want a root ramdisk, use the next 2 lines 12# If you want a root ramdisk, use the next 2 lines
13# (Edit the ramdisk image name!!!!) 13# (Edit the ramdisk image name!!!!)
14--ramdisk=ram-disk-image-file 14--ramdisk=ram-disk-image-file
15--commandline=0/vmlinux HOME=/ root=/dev/ram initrd=0/ramdisk 15--commandline=0/vmlinuz HOME=/ root=/dev/ram initrd=0/ramdisk panic_timeout=60 panic=-1
16 16
17# If you want NFS root, use the following command line (Edit the HOSTNAME!!!) 17# If you want NFS root, use the following command line (Edit the HOSTNAME!!!)
18#--commandline=0/vmlinux HOME=/ root=/dev/nfs nfsroot=HOSTNAME ip=bootp 18#--commandline=0/vmlinuz HOME=/ root=/dev/nfs nfsroot=HOSTNAME ip=bootp
19 19
20# If you have root on a disk partition, use this (Edit the partition name!!!) 20# If you have root on a disk partition, use this (Edit the partition name!!!)
21#--commandline=0/vmlinux HOME=/ root=/dev/sda1 21#--commandline=0/vmlinuz HOME=/ root=/dev/sda1
diff --git a/arch/parisc/include/asm/special_insns.h b/arch/parisc/include/asm/special_insns.h
index d306b75bc77f..e1509308899f 100644
--- a/arch/parisc/include/asm/special_insns.h
+++ b/arch/parisc/include/asm/special_insns.h
@@ -32,9 +32,12 @@ static inline void set_eiem(unsigned long val)
32 cr; \ 32 cr; \
33}) 33})
34 34
35#define mtsp(gr, cr) \ 35#define mtsp(val, cr) \
36 __asm__ __volatile__("mtsp %0,%1" \ 36 { if (__builtin_constant_p(val) && ((val) == 0)) \
37 __asm__ __volatile__("mtsp %%r0,%0" : : "i" (cr) : "memory"); \
38 else \
39 __asm__ __volatile__("mtsp %0,%1" \
37 : /* no outputs */ \ 40 : /* no outputs */ \
38 : "r" (gr), "i" (cr) : "memory") 41 : "r" (val), "i" (cr) : "memory"); }
39 42
40#endif /* __PARISC_SPECIAL_INSNS_H */ 43#endif /* __PARISC_SPECIAL_INSNS_H */
diff --git a/arch/parisc/include/asm/tlbflush.h b/arch/parisc/include/asm/tlbflush.h
index 5273da991e06..9d086a599fa0 100644
--- a/arch/parisc/include/asm/tlbflush.h
+++ b/arch/parisc/include/asm/tlbflush.h
@@ -63,13 +63,14 @@ static inline void flush_tlb_mm(struct mm_struct *mm)
63static inline void flush_tlb_page(struct vm_area_struct *vma, 63static inline void flush_tlb_page(struct vm_area_struct *vma,
64 unsigned long addr) 64 unsigned long addr)
65{ 65{
66 unsigned long flags; 66 unsigned long flags, sid;
67 67
68 /* For one page, it's not worth testing the split_tlb variable */ 68 /* For one page, it's not worth testing the split_tlb variable */
69 69
70 mb(); 70 mb();
71 mtsp(vma->vm_mm->context,1); 71 sid = vma->vm_mm->context;
72 purge_tlb_start(flags); 72 purge_tlb_start(flags);
73 mtsp(sid, 1);
73 pdtlb(addr); 74 pdtlb(addr);
74 pitlb(addr); 75 pitlb(addr);
75 purge_tlb_end(flags); 76 purge_tlb_end(flags);
diff --git a/arch/parisc/include/uapi/asm/fcntl.h b/arch/parisc/include/uapi/asm/fcntl.h
index cc61c475f277..34a46cbc76ed 100644
--- a/arch/parisc/include/uapi/asm/fcntl.h
+++ b/arch/parisc/include/uapi/asm/fcntl.h
@@ -20,7 +20,7 @@
20#define O_INVISIBLE 004000000 /* invisible I/O, for DMAPI/XDSM */ 20#define O_INVISIBLE 004000000 /* invisible I/O, for DMAPI/XDSM */
21 21
22#define O_PATH 020000000 22#define O_PATH 020000000
23#define O_TMPFILE 040000000 23#define __O_TMPFILE 040000000
24 24
25#define F_GETLK64 8 25#define F_GETLK64 8
26#define F_SETLK64 9 26#define F_SETLK64 9
diff --git a/arch/parisc/include/uapi/asm/socket.h b/arch/parisc/include/uapi/asm/socket.h
index 70c512a386f7..71700e636a8e 100644
--- a/arch/parisc/include/uapi/asm/socket.h
+++ b/arch/parisc/include/uapi/asm/socket.h
@@ -73,6 +73,8 @@
73 73
74#define SO_SELECT_ERR_QUEUE 0x4026 74#define SO_SELECT_ERR_QUEUE 0x4026
75 75
76#define SO_BUSY_POLL 0x4027
77
76/* O_NONBLOCK clashes with the bits used for socket types. Therefore we 78/* O_NONBLOCK clashes with the bits used for socket types. Therefore we
77 * have to define SOCK_NONBLOCK to a different value here. 79 * have to define SOCK_NONBLOCK to a different value here.
78 */ 80 */
diff --git a/arch/parisc/install.sh b/arch/parisc/install.sh
index e593fc8d58bc..4da682b466d0 100644
--- a/arch/parisc/install.sh
+++ b/arch/parisc/install.sh
@@ -26,13 +26,13 @@ if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
26 26
27# Default install 27# Default install
28 28
29if [ -f $4/vmlinux ]; then 29if [ -f $4/vmlinuz ]; then
30 mv $4/vmlinux $4/vmlinux.old 30 mv $4/vmlinuz $4/vmlinuz.old
31fi 31fi
32 32
33if [ -f $4/System.map ]; then 33if [ -f $4/System.map ]; then
34 mv $4/System.map $4/System.old 34 mv $4/System.map $4/System.old
35fi 35fi
36 36
37cat $2 > $4/vmlinux 37cat $2 > $4/vmlinuz
38cp $3 $4/System.map 38cp $3 $4/System.map
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
index 65fb4cbc3a0f..2e65aa54bd10 100644
--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -440,8 +440,8 @@ void __flush_tlb_range(unsigned long sid, unsigned long start,
440 else { 440 else {
441 unsigned long flags; 441 unsigned long flags;
442 442
443 mtsp(sid, 1);
444 purge_tlb_start(flags); 443 purge_tlb_start(flags);
444 mtsp(sid, 1);
445 if (split_tlb) { 445 if (split_tlb) {
446 while (npages--) { 446 while (npages--) {
447 pdtlb(start); 447 pdtlb(start);
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
index f65fa480c905..22395901d47b 100644
--- a/arch/parisc/kernel/firmware.c
+++ b/arch/parisc/kernel/firmware.c
@@ -150,7 +150,7 @@ static void convert_to_wide(unsigned long *addr)
150} 150}
151 151
152#ifdef CONFIG_64BIT 152#ifdef CONFIG_64BIT
153void __cpuinit set_firmware_width_unlocked(void) 153void set_firmware_width_unlocked(void)
154{ 154{
155 int ret; 155 int ret;
156 156
@@ -167,7 +167,7 @@ void __cpuinit set_firmware_width_unlocked(void)
167 * This function must be called before any pdc_* function that uses the 167 * This function must be called before any pdc_* function that uses the
168 * convert_to_wide function. 168 * convert_to_wide function.
169 */ 169 */
170void __cpuinit set_firmware_width(void) 170void set_firmware_width(void)
171{ 171{
172 unsigned long flags; 172 unsigned long flags;
173 spin_lock_irqsave(&pdc_lock, flags); 173 spin_lock_irqsave(&pdc_lock, flags);
@@ -175,11 +175,13 @@ void __cpuinit set_firmware_width(void)
175 spin_unlock_irqrestore(&pdc_lock, flags); 175 spin_unlock_irqrestore(&pdc_lock, flags);
176} 176}
177#else 177#else
178void __cpuinit set_firmware_width_unlocked(void) { 178void set_firmware_width_unlocked(void)
179{
179 return; 180 return;
180} 181}
181 182
182void __cpuinit set_firmware_width(void) { 183void set_firmware_width(void)
184{
183 return; 185 return;
184} 186}
185#endif /*CONFIG_64BIT*/ 187#endif /*CONFIG_64BIT*/
@@ -301,7 +303,7 @@ int pdc_chassis_warn(unsigned long *warn)
301 return retval; 303 return retval;
302} 304}
303 305
304int __cpuinit pdc_coproc_cfg_unlocked(struct pdc_coproc_cfg *pdc_coproc_info) 306int pdc_coproc_cfg_unlocked(struct pdc_coproc_cfg *pdc_coproc_info)
305{ 307{
306 int ret; 308 int ret;
307 309
@@ -322,7 +324,7 @@ int __cpuinit pdc_coproc_cfg_unlocked(struct pdc_coproc_cfg *pdc_coproc_info)
322 * This PDC call returns the presence and status of all the coprocessors 324 * This PDC call returns the presence and status of all the coprocessors
323 * attached to the processor. 325 * attached to the processor.
324 */ 326 */
325int __cpuinit pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info) 327int pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info)
326{ 328{
327 int ret; 329 int ret;
328 unsigned long flags; 330 unsigned long flags;
diff --git a/arch/parisc/kernel/hardware.c b/arch/parisc/kernel/hardware.c
index 872275659d98..06cb3992907e 100644
--- a/arch/parisc/kernel/hardware.c
+++ b/arch/parisc/kernel/hardware.c
@@ -1367,7 +1367,7 @@ const char *parisc_hardware_description(struct parisc_device_id *id)
1367 1367
1368 1368
1369/* Interpret hversion (ret[0]) from PDC_MODEL(4)/PDC_MODEL_INFO(0) */ 1369/* Interpret hversion (ret[0]) from PDC_MODEL(4)/PDC_MODEL_INFO(0) */
1370enum cpu_type __cpuinit 1370enum cpu_type
1371parisc_get_cpu_type(unsigned long hversion) 1371parisc_get_cpu_type(unsigned long hversion)
1372{ 1372{
1373 struct hp_cpu_type_mask *ptr; 1373 struct hp_cpu_type_mask *ptr;
diff --git a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c
index c8fb61ed32f4..b68d977ce30f 100644
--- a/arch/parisc/kernel/processor.c
+++ b/arch/parisc/kernel/processor.c
@@ -73,7 +73,7 @@ extern int update_cr16_clocksource(void); /* from time.c */
73 * 73 *
74 * FIXME: doesn't do much yet... 74 * FIXME: doesn't do much yet...
75 */ 75 */
76static void __cpuinit 76static void
77init_percpu_prof(unsigned long cpunum) 77init_percpu_prof(unsigned long cpunum)
78{ 78{
79 struct cpuinfo_parisc *p; 79 struct cpuinfo_parisc *p;
@@ -92,7 +92,7 @@ init_percpu_prof(unsigned long cpunum)
92 * (return 1). If so, initialize the chip and tell other partners in crime 92 * (return 1). If so, initialize the chip and tell other partners in crime
93 * they have work to do. 93 * they have work to do.
94 */ 94 */
95static int __cpuinit processor_probe(struct parisc_device *dev) 95static int processor_probe(struct parisc_device *dev)
96{ 96{
97 unsigned long txn_addr; 97 unsigned long txn_addr;
98 unsigned long cpuid; 98 unsigned long cpuid;
@@ -299,7 +299,7 @@ void __init collect_boot_cpu_data(void)
299 * 299 *
300 * o Enable CPU profiling hooks. 300 * o Enable CPU profiling hooks.
301 */ 301 */
302int __cpuinit init_per_cpu(int cpunum) 302int init_per_cpu(int cpunum)
303{ 303{
304 int ret; 304 int ret;
305 struct pdc_coproc_cfg coproc_cfg; 305 struct pdc_coproc_cfg coproc_cfg;
@@ -371,10 +371,23 @@ show_cpuinfo (struct seq_file *m, void *v)
371 371
372 seq_printf(m, "capabilities\t:"); 372 seq_printf(m, "capabilities\t:");
373 if (boot_cpu_data.pdc.capabilities & PDC_MODEL_OS32) 373 if (boot_cpu_data.pdc.capabilities & PDC_MODEL_OS32)
374 seq_printf(m, " os32"); 374 seq_puts(m, " os32");
375 if (boot_cpu_data.pdc.capabilities & PDC_MODEL_OS64) 375 if (boot_cpu_data.pdc.capabilities & PDC_MODEL_OS64)
376 seq_printf(m, " os64"); 376 seq_puts(m, " os64");
377 seq_printf(m, "\n"); 377 if (boot_cpu_data.pdc.capabilities & PDC_MODEL_IOPDIR_FDC)
378 seq_puts(m, " iopdir_fdc");
379 switch (boot_cpu_data.pdc.capabilities & PDC_MODEL_NVA_MASK) {
380 case PDC_MODEL_NVA_SUPPORTED:
381 seq_puts(m, " nva_supported");
382 break;
383 case PDC_MODEL_NVA_SLOW:
384 seq_puts(m, " nva_slow");
385 break;
386 case PDC_MODEL_NVA_UNSUPPORTED:
387 seq_puts(m, " needs_equivalent_aliasing");
388 break;
389 }
390 seq_printf(m, " (0x%02lx)\n", boot_cpu_data.pdc.capabilities);
378 391
379 seq_printf(m, "model\t\t: %s\n" 392 seq_printf(m, "model\t\t: %s\n"
380 "model name\t: %s\n", 393 "model name\t: %s\n",
diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
index e3614fb343e5..8a252f2d6c08 100644
--- a/arch/parisc/kernel/smp.c
+++ b/arch/parisc/kernel/smp.c
@@ -62,9 +62,9 @@ static int smp_debug_lvl = 0;
62volatile struct task_struct *smp_init_current_idle_task; 62volatile struct task_struct *smp_init_current_idle_task;
63 63
64/* track which CPU is booting */ 64/* track which CPU is booting */
65static volatile int cpu_now_booting __cpuinitdata; 65static volatile int cpu_now_booting;
66 66
67static int parisc_max_cpus __cpuinitdata = 1; 67static int parisc_max_cpus = 1;
68 68
69static DEFINE_PER_CPU(spinlock_t, ipi_lock); 69static DEFINE_PER_CPU(spinlock_t, ipi_lock);
70 70
@@ -328,7 +328,7 @@ void __init smp_callin(void)
328/* 328/*
329 * Bring one cpu online. 329 * Bring one cpu online.
330 */ 330 */
331int __cpuinit smp_boot_one_cpu(int cpuid, struct task_struct *idle) 331int smp_boot_one_cpu(int cpuid, struct task_struct *idle)
332{ 332{
333 const struct cpuinfo_parisc *p = &per_cpu(cpu_data, cpuid); 333 const struct cpuinfo_parisc *p = &per_cpu(cpu_data, cpuid);
334 long timeout; 334 long timeout;
@@ -424,7 +424,7 @@ void smp_cpus_done(unsigned int cpu_max)
424} 424}
425 425
426 426
427int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) 427int __cpu_up(unsigned int cpu, struct task_struct *tidle)
428{ 428{
429 if (cpu != 0 && cpu < parisc_max_cpus) 429 if (cpu != 0 && cpu < parisc_max_cpus)
430 smp_boot_one_cpu(cpu, tidle); 430 smp_boot_one_cpu(cpu, tidle);
diff --git a/arch/parisc/lib/memcpy.c b/arch/parisc/lib/memcpy.c
index a49cc812df8a..ac4370b1ca40 100644
--- a/arch/parisc/lib/memcpy.c
+++ b/arch/parisc/lib/memcpy.c
@@ -2,6 +2,7 @@
2 * Optimized memory copy routines. 2 * Optimized memory copy routines.
3 * 3 *
4 * Copyright (C) 2004 Randolph Chung <tausq@debian.org> 4 * Copyright (C) 2004 Randolph Chung <tausq@debian.org>
5 * Copyright (C) 2013 Helge Deller <deller@gmx.de>
5 * 6 *
6 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -153,17 +154,21 @@ static inline void prefetch_dst(const void *addr)
153#define prefetch_dst(addr) do { } while(0) 154#define prefetch_dst(addr) do { } while(0)
154#endif 155#endif
155 156
157#define PA_MEMCPY_OK 0
158#define PA_MEMCPY_LOAD_ERROR 1
159#define PA_MEMCPY_STORE_ERROR 2
160
156/* Copy from a not-aligned src to an aligned dst, using shifts. Handles 4 words 161/* Copy from a not-aligned src to an aligned dst, using shifts. Handles 4 words
157 * per loop. This code is derived from glibc. 162 * per loop. This code is derived from glibc.
158 */ 163 */
159static inline unsigned long copy_dstaligned(unsigned long dst, unsigned long src, unsigned long len, unsigned long o_dst, unsigned long o_src, unsigned long o_len) 164static inline unsigned long copy_dstaligned(unsigned long dst,
165 unsigned long src, unsigned long len)
160{ 166{
161 /* gcc complains that a2 and a3 may be uninitialized, but actually 167 /* gcc complains that a2 and a3 may be uninitialized, but actually
162 * they cannot be. Initialize a2/a3 to shut gcc up. 168 * they cannot be. Initialize a2/a3 to shut gcc up.
163 */ 169 */
164 register unsigned int a0, a1, a2 = 0, a3 = 0; 170 register unsigned int a0, a1, a2 = 0, a3 = 0;
165 int sh_1, sh_2; 171 int sh_1, sh_2;
166 struct exception_data *d;
167 172
168 /* prefetch_src((const void *)src); */ 173 /* prefetch_src((const void *)src); */
169 174
@@ -197,7 +202,7 @@ static inline unsigned long copy_dstaligned(unsigned long dst, unsigned long src
197 goto do2; 202 goto do2;
198 case 0: 203 case 0:
199 if (len == 0) 204 if (len == 0)
200 return 0; 205 return PA_MEMCPY_OK;
201 /* a3 = ((unsigned int *) src)[0]; 206 /* a3 = ((unsigned int *) src)[0];
202 a0 = ((unsigned int *) src)[1]; */ 207 a0 = ((unsigned int *) src)[1]; */
203 ldw(s_space, 0, src, a3, cda_ldw_exc); 208 ldw(s_space, 0, src, a3, cda_ldw_exc);
@@ -256,42 +261,35 @@ do0:
256 preserve_branch(handle_load_error); 261 preserve_branch(handle_load_error);
257 preserve_branch(handle_store_error); 262 preserve_branch(handle_store_error);
258 263
259 return 0; 264 return PA_MEMCPY_OK;
260 265
261handle_load_error: 266handle_load_error:
262 __asm__ __volatile__ ("cda_ldw_exc:\n"); 267 __asm__ __volatile__ ("cda_ldw_exc:\n");
263 d = &__get_cpu_var(exception_data); 268 return PA_MEMCPY_LOAD_ERROR;
264 DPRINTF("cda_ldw_exc: o_len=%lu fault_addr=%lu o_src=%lu ret=%lu\n",
265 o_len, d->fault_addr, o_src, o_len - d->fault_addr + o_src);
266 return o_len * 4 - d->fault_addr + o_src;
267 269
268handle_store_error: 270handle_store_error:
269 __asm__ __volatile__ ("cda_stw_exc:\n"); 271 __asm__ __volatile__ ("cda_stw_exc:\n");
270 d = &__get_cpu_var(exception_data); 272 return PA_MEMCPY_STORE_ERROR;
271 DPRINTF("cda_stw_exc: o_len=%lu fault_addr=%lu o_dst=%lu ret=%lu\n",
272 o_len, d->fault_addr, o_dst, o_len - d->fault_addr + o_dst);
273 return o_len * 4 - d->fault_addr + o_dst;
274} 273}
275 274
276 275
277/* Returns 0 for success, otherwise, returns number of bytes not transferred. */ 276/* Returns PA_MEMCPY_OK, PA_MEMCPY_LOAD_ERROR or PA_MEMCPY_STORE_ERROR.
278static unsigned long pa_memcpy(void *dstp, const void *srcp, unsigned long len) 277 * In case of an access fault the faulty address can be read from the per_cpu
278 * exception data struct. */
279static unsigned long pa_memcpy_internal(void *dstp, const void *srcp,
280 unsigned long len)
279{ 281{
280 register unsigned long src, dst, t1, t2, t3; 282 register unsigned long src, dst, t1, t2, t3;
281 register unsigned char *pcs, *pcd; 283 register unsigned char *pcs, *pcd;
282 register unsigned int *pws, *pwd; 284 register unsigned int *pws, *pwd;
283 register double *pds, *pdd; 285 register double *pds, *pdd;
284 unsigned long ret = 0; 286 unsigned long ret;
285 unsigned long o_dst, o_src, o_len;
286 struct exception_data *d;
287 287
288 src = (unsigned long)srcp; 288 src = (unsigned long)srcp;
289 dst = (unsigned long)dstp; 289 dst = (unsigned long)dstp;
290 pcs = (unsigned char *)srcp; 290 pcs = (unsigned char *)srcp;
291 pcd = (unsigned char *)dstp; 291 pcd = (unsigned char *)dstp;
292 292
293 o_dst = dst; o_src = src; o_len = len;
294
295 /* prefetch_src((const void *)srcp); */ 293 /* prefetch_src((const void *)srcp); */
296 294
297 if (len < THRESHOLD) 295 if (len < THRESHOLD)
@@ -401,7 +399,7 @@ byte_copy:
401 len--; 399 len--;
402 } 400 }
403 401
404 return 0; 402 return PA_MEMCPY_OK;
405 403
406unaligned_copy: 404unaligned_copy:
407 /* possibly we are aligned on a word, but not on a double... */ 405 /* possibly we are aligned on a word, but not on a double... */
@@ -438,8 +436,7 @@ unaligned_copy:
438 src = (unsigned long)pcs; 436 src = (unsigned long)pcs;
439 } 437 }
440 438
441 ret = copy_dstaligned(dst, src, len / sizeof(unsigned int), 439 ret = copy_dstaligned(dst, src, len / sizeof(unsigned int));
442 o_dst, o_src, o_len);
443 if (ret) 440 if (ret)
444 return ret; 441 return ret;
445 442
@@ -454,17 +451,41 @@ unaligned_copy:
454 451
455handle_load_error: 452handle_load_error:
456 __asm__ __volatile__ ("pmc_load_exc:\n"); 453 __asm__ __volatile__ ("pmc_load_exc:\n");
457 d = &__get_cpu_var(exception_data); 454 return PA_MEMCPY_LOAD_ERROR;
458 DPRINTF("pmc_load_exc: o_len=%lu fault_addr=%lu o_src=%lu ret=%lu\n",
459 o_len, d->fault_addr, o_src, o_len - d->fault_addr + o_src);
460 return o_len - d->fault_addr + o_src;
461 455
462handle_store_error: 456handle_store_error:
463 __asm__ __volatile__ ("pmc_store_exc:\n"); 457 __asm__ __volatile__ ("pmc_store_exc:\n");
458 return PA_MEMCPY_STORE_ERROR;
459}
460
461
462/* Returns 0 for success, otherwise, returns number of bytes not transferred. */
463static unsigned long pa_memcpy(void *dstp, const void *srcp, unsigned long len)
464{
465 unsigned long ret, fault_addr, reference;
466 struct exception_data *d;
467
468 ret = pa_memcpy_internal(dstp, srcp, len);
469 if (likely(ret == PA_MEMCPY_OK))
470 return 0;
471
472 /* if a load or store fault occured we can get the faulty addr */
464 d = &__get_cpu_var(exception_data); 473 d = &__get_cpu_var(exception_data);
465 DPRINTF("pmc_store_exc: o_len=%lu fault_addr=%lu o_dst=%lu ret=%lu\n", 474 fault_addr = d->fault_addr;
466 o_len, d->fault_addr, o_dst, o_len - d->fault_addr + o_dst); 475
467 return o_len - d->fault_addr + o_dst; 476 /* error in load or store? */
477 if (ret == PA_MEMCPY_LOAD_ERROR)
478 reference = (unsigned long) srcp;
479 else
480 reference = (unsigned long) dstp;
481
482 DPRINTF("pa_memcpy: fault type = %lu, len=%lu fault_addr=%lu ref=%lu\n",
483 ret, len, fault_addr, reference);
484
485 if (fault_addr >= reference)
486 return len - (fault_addr - reference);
487 else
488 return len;
468} 489}
469 490
470#ifdef __KERNEL__ 491#ifdef __KERNEL__
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index bc3a0ebf16a7..3bf72cd2c8fc 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -668,7 +668,6 @@ config SBUS
668 668
669config FSL_SOC 669config FSL_SOC
670 bool 670 bool
671 select HAVE_CAN_FLEXCAN if NET && CAN
672 671
673config FSL_PCI 672config FSL_PCI
674 bool 673 bool
diff --git a/arch/powerpc/include/uapi/asm/socket.h b/arch/powerpc/include/uapi/asm/socket.h
index a36daf3c6f9a..a6d74467c9ed 100644
--- a/arch/powerpc/include/uapi/asm/socket.h
+++ b/arch/powerpc/include/uapi/asm/socket.h
@@ -81,4 +81,6 @@
81 81
82#define SO_SELECT_ERR_QUEUE 45 82#define SO_SELECT_ERR_QUEUE 45
83 83
84#define SO_BUSY_POLL 46
85
84#endif /* _ASM_POWERPC_SOCKET_H */ 86#endif /* _ASM_POWERPC_SOCKET_H */
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 64f7bd5b1b0f..9a0d24c390a3 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -975,16 +975,12 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
975 hw_brk.type = (data & HW_BRK_TYPE_DABR) | HW_BRK_TYPE_PRIV_ALL; 975 hw_brk.type = (data & HW_BRK_TYPE_DABR) | HW_BRK_TYPE_PRIV_ALL;
976 hw_brk.len = 8; 976 hw_brk.len = 8;
977#ifdef CONFIG_HAVE_HW_BREAKPOINT 977#ifdef CONFIG_HAVE_HW_BREAKPOINT
978 if (ptrace_get_breakpoints(task) < 0)
979 return -ESRCH;
980
981 bp = thread->ptrace_bps[0]; 978 bp = thread->ptrace_bps[0];
982 if ((!data) || !(hw_brk.type & HW_BRK_TYPE_RDWR)) { 979 if ((!data) || !(hw_brk.type & HW_BRK_TYPE_RDWR)) {
983 if (bp) { 980 if (bp) {
984 unregister_hw_breakpoint(bp); 981 unregister_hw_breakpoint(bp);
985 thread->ptrace_bps[0] = NULL; 982 thread->ptrace_bps[0] = NULL;
986 } 983 }
987 ptrace_put_breakpoints(task);
988 return 0; 984 return 0;
989 } 985 }
990 if (bp) { 986 if (bp) {
@@ -997,11 +993,9 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
997 993
998 ret = modify_user_hw_breakpoint(bp, &attr); 994 ret = modify_user_hw_breakpoint(bp, &attr);
999 if (ret) { 995 if (ret) {
1000 ptrace_put_breakpoints(task);
1001 return ret; 996 return ret;
1002 } 997 }
1003 thread->ptrace_bps[0] = bp; 998 thread->ptrace_bps[0] = bp;
1004 ptrace_put_breakpoints(task);
1005 thread->hw_brk = hw_brk; 999 thread->hw_brk = hw_brk;
1006 return 0; 1000 return 0;
1007 } 1001 }
@@ -1016,12 +1010,9 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
1016 ptrace_triggered, NULL, task); 1010 ptrace_triggered, NULL, task);
1017 if (IS_ERR(bp)) { 1011 if (IS_ERR(bp)) {
1018 thread->ptrace_bps[0] = NULL; 1012 thread->ptrace_bps[0] = NULL;
1019 ptrace_put_breakpoints(task);
1020 return PTR_ERR(bp); 1013 return PTR_ERR(bp);
1021 } 1014 }
1022 1015
1023 ptrace_put_breakpoints(task);
1024
1025#endif /* CONFIG_HAVE_HW_BREAKPOINT */ 1016#endif /* CONFIG_HAVE_HW_BREAKPOINT */
1026 task->thread.hw_brk = hw_brk; 1017 task->thread.hw_brk = hw_brk;
1027#else /* CONFIG_PPC_ADV_DEBUG_REGS */ 1018#else /* CONFIG_PPC_ADV_DEBUG_REGS */
@@ -1440,26 +1431,19 @@ static long ppc_set_hwdebug(struct task_struct *child,
1440 if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE) 1431 if (bp_info->trigger_type & PPC_BREAKPOINT_TRIGGER_WRITE)
1441 brk.type |= HW_BRK_TYPE_WRITE; 1432 brk.type |= HW_BRK_TYPE_WRITE;
1442#ifdef CONFIG_HAVE_HW_BREAKPOINT 1433#ifdef CONFIG_HAVE_HW_BREAKPOINT
1443 if (ptrace_get_breakpoints(child) < 0)
1444 return -ESRCH;
1445
1446 /* 1434 /*
1447 * Check if the request is for 'range' breakpoints. We can 1435 * Check if the request is for 'range' breakpoints. We can
1448 * support it if range < 8 bytes. 1436 * support it if range < 8 bytes.
1449 */ 1437 */
1450 if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE) { 1438 if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE)
1451 len = bp_info->addr2 - bp_info->addr; 1439 len = bp_info->addr2 - bp_info->addr;
1452 } else if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_EXACT) 1440 else if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_EXACT)
1453 len = 1; 1441 len = 1;
1454 else { 1442 else
1455 ptrace_put_breakpoints(child);
1456 return -EINVAL; 1443 return -EINVAL;
1457 }
1458 bp = thread->ptrace_bps[0]; 1444 bp = thread->ptrace_bps[0];
1459 if (bp) { 1445 if (bp)
1460 ptrace_put_breakpoints(child);
1461 return -ENOSPC; 1446 return -ENOSPC;
1462 }
1463 1447
1464 /* Create a new breakpoint request if one doesn't exist already */ 1448 /* Create a new breakpoint request if one doesn't exist already */
1465 hw_breakpoint_init(&attr); 1449 hw_breakpoint_init(&attr);
@@ -1471,11 +1455,9 @@ static long ppc_set_hwdebug(struct task_struct *child,
1471 ptrace_triggered, NULL, child); 1455 ptrace_triggered, NULL, child);
1472 if (IS_ERR(bp)) { 1456 if (IS_ERR(bp)) {
1473 thread->ptrace_bps[0] = NULL; 1457 thread->ptrace_bps[0] = NULL;
1474 ptrace_put_breakpoints(child);
1475 return PTR_ERR(bp); 1458 return PTR_ERR(bp);
1476 } 1459 }
1477 1460
1478 ptrace_put_breakpoints(child);
1479 return 1; 1461 return 1;
1480#endif /* CONFIG_HAVE_HW_BREAKPOINT */ 1462#endif /* CONFIG_HAVE_HW_BREAKPOINT */
1481 1463
@@ -1519,16 +1501,12 @@ static long ppc_del_hwdebug(struct task_struct *child, long data)
1519 return -EINVAL; 1501 return -EINVAL;
1520 1502
1521#ifdef CONFIG_HAVE_HW_BREAKPOINT 1503#ifdef CONFIG_HAVE_HW_BREAKPOINT
1522 if (ptrace_get_breakpoints(child) < 0)
1523 return -ESRCH;
1524
1525 bp = thread->ptrace_bps[0]; 1504 bp = thread->ptrace_bps[0];
1526 if (bp) { 1505 if (bp) {
1527 unregister_hw_breakpoint(bp); 1506 unregister_hw_breakpoint(bp);
1528 thread->ptrace_bps[0] = NULL; 1507 thread->ptrace_bps[0] = NULL;
1529 } else 1508 } else
1530 ret = -ENOENT; 1509 ret = -ENOENT;
1531 ptrace_put_breakpoints(child);
1532 return ret; 1510 return ret;
1533#else /* CONFIG_HAVE_HW_BREAKPOINT */ 1511#else /* CONFIG_HAVE_HW_BREAKPOINT */
1534 if (child->thread.hw_brk.address == 0) 1512 if (child->thread.hw_brk.address == 0)
diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c
index 67a42ed0d2fc..cb8bdbe4972f 100644
--- a/arch/powerpc/mm/mmap.c
+++ b/arch/powerpc/mm/mmap.c
@@ -92,10 +92,8 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
92 if (mmap_is_legacy()) { 92 if (mmap_is_legacy()) {
93 mm->mmap_base = TASK_UNMAPPED_BASE; 93 mm->mmap_base = TASK_UNMAPPED_BASE;
94 mm->get_unmapped_area = arch_get_unmapped_area; 94 mm->get_unmapped_area = arch_get_unmapped_area;
95 mm->unmap_area = arch_unmap_area;
96 } else { 95 } else {
97 mm->mmap_base = mmap_base(); 96 mm->mmap_base = mmap_base();
98 mm->get_unmapped_area = arch_get_unmapped_area_topdown; 97 mm->get_unmapped_area = arch_get_unmapped_area_topdown;
99 mm->unmap_area = arch_unmap_area_topdown;
100 } 98 }
101} 99}
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index c427ae36374a..bf56e33f8257 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -650,8 +650,7 @@ void bpf_jit_compile(struct sk_filter *fp)
650 650
651 proglen = cgctx.idx * 4; 651 proglen = cgctx.idx * 4;
652 alloclen = proglen + FUNCTION_DESCR_SIZE; 652 alloclen = proglen + FUNCTION_DESCR_SIZE;
653 image = module_alloc(max_t(unsigned int, alloclen, 653 image = module_alloc(alloclen);
654 sizeof(struct work_struct)));
655 if (!image) 654 if (!image)
656 goto out; 655 goto out;
657 656
@@ -688,20 +687,8 @@ out:
688 return; 687 return;
689} 688}
690 689
691static void jit_free_defer(struct work_struct *arg)
692{
693 module_free(NULL, arg);
694}
695
696/* run from softirq, we must use a work_struct to call
697 * module_free() from process context
698 */
699void bpf_jit_free(struct sk_filter *fp) 690void bpf_jit_free(struct sk_filter *fp)
700{ 691{
701 if (fp->bpf_func != sk_run_filter) { 692 if (fp->bpf_func != sk_run_filter)
702 struct work_struct *work = (struct work_struct *)fp->bpf_func; 693 module_free(NULL, fp->bpf_func);
703
704 INIT_WORK(work, jit_free_defer);
705 schedule_work(work);
706 }
707} 694}
diff --git a/arch/powerpc/perf/power7-pmu.c b/arch/powerpc/perf/power7-pmu.c
index 13c3f0e547a2..d1821b8bbc4c 100644
--- a/arch/powerpc/perf/power7-pmu.c
+++ b/arch/powerpc/perf/power7-pmu.c
@@ -60,7 +60,7 @@
60#define PME_PM_LD_REF_L1 0xc880 60#define PME_PM_LD_REF_L1 0xc880
61#define PME_PM_LD_MISS_L1 0x400f0 61#define PME_PM_LD_MISS_L1 0x400f0
62#define PME_PM_BRU_FIN 0x10068 62#define PME_PM_BRU_FIN 0x10068
63#define PME_PM_BRU_MPRED 0x400f6 63#define PME_PM_BR_MPRED 0x400f6
64 64
65#define PME_PM_CMPLU_STALL_FXU 0x20014 65#define PME_PM_CMPLU_STALL_FXU 0x20014
66#define PME_PM_CMPLU_STALL_DIV 0x40014 66#define PME_PM_CMPLU_STALL_DIV 0x40014
@@ -349,7 +349,7 @@ static int power7_generic_events[] = {
349 [PERF_COUNT_HW_CACHE_REFERENCES] = PME_PM_LD_REF_L1, 349 [PERF_COUNT_HW_CACHE_REFERENCES] = PME_PM_LD_REF_L1,
350 [PERF_COUNT_HW_CACHE_MISSES] = PME_PM_LD_MISS_L1, 350 [PERF_COUNT_HW_CACHE_MISSES] = PME_PM_LD_MISS_L1,
351 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = PME_PM_BRU_FIN, 351 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = PME_PM_BRU_FIN,
352 [PERF_COUNT_HW_BRANCH_MISSES] = PME_PM_BRU_MPRED, 352 [PERF_COUNT_HW_BRANCH_MISSES] = PME_PM_BR_MPRED,
353}; 353};
354 354
355#define C(x) PERF_COUNT_HW_CACHE_##x 355#define C(x) PERF_COUNT_HW_CACHE_##x
@@ -405,7 +405,7 @@ GENERIC_EVENT_ATTR(instructions, INST_CMPL);
405GENERIC_EVENT_ATTR(cache-references, LD_REF_L1); 405GENERIC_EVENT_ATTR(cache-references, LD_REF_L1);
406GENERIC_EVENT_ATTR(cache-misses, LD_MISS_L1); 406GENERIC_EVENT_ATTR(cache-misses, LD_MISS_L1);
407GENERIC_EVENT_ATTR(branch-instructions, BRU_FIN); 407GENERIC_EVENT_ATTR(branch-instructions, BRU_FIN);
408GENERIC_EVENT_ATTR(branch-misses, BRU_MPRED); 408GENERIC_EVENT_ATTR(branch-misses, BR_MPRED);
409 409
410POWER_EVENT_ATTR(CYC, CYC); 410POWER_EVENT_ATTR(CYC, CYC);
411POWER_EVENT_ATTR(GCT_NOSLOT_CYC, GCT_NOSLOT_CYC); 411POWER_EVENT_ATTR(GCT_NOSLOT_CYC, GCT_NOSLOT_CYC);
@@ -414,7 +414,7 @@ POWER_EVENT_ATTR(INST_CMPL, INST_CMPL);
414POWER_EVENT_ATTR(LD_REF_L1, LD_REF_L1); 414POWER_EVENT_ATTR(LD_REF_L1, LD_REF_L1);
415POWER_EVENT_ATTR(LD_MISS_L1, LD_MISS_L1); 415POWER_EVENT_ATTR(LD_MISS_L1, LD_MISS_L1);
416POWER_EVENT_ATTR(BRU_FIN, BRU_FIN) 416POWER_EVENT_ATTR(BRU_FIN, BRU_FIN)
417POWER_EVENT_ATTR(BRU_MPRED, BRU_MPRED); 417POWER_EVENT_ATTR(BR_MPRED, BR_MPRED);
418 418
419POWER_EVENT_ATTR(CMPLU_STALL_FXU, CMPLU_STALL_FXU); 419POWER_EVENT_ATTR(CMPLU_STALL_FXU, CMPLU_STALL_FXU);
420POWER_EVENT_ATTR(CMPLU_STALL_DIV, CMPLU_STALL_DIV); 420POWER_EVENT_ATTR(CMPLU_STALL_DIV, CMPLU_STALL_DIV);
@@ -449,7 +449,7 @@ static struct attribute *power7_events_attr[] = {
449 GENERIC_EVENT_PTR(LD_REF_L1), 449 GENERIC_EVENT_PTR(LD_REF_L1),
450 GENERIC_EVENT_PTR(LD_MISS_L1), 450 GENERIC_EVENT_PTR(LD_MISS_L1),
451 GENERIC_EVENT_PTR(BRU_FIN), 451 GENERIC_EVENT_PTR(BRU_FIN),
452 GENERIC_EVENT_PTR(BRU_MPRED), 452 GENERIC_EVENT_PTR(BR_MPRED),
453 453
454 POWER_EVENT_PTR(CYC), 454 POWER_EVENT_PTR(CYC),
455 POWER_EVENT_PTR(GCT_NOSLOT_CYC), 455 POWER_EVENT_PTR(GCT_NOSLOT_CYC),
@@ -458,7 +458,7 @@ static struct attribute *power7_events_attr[] = {
458 POWER_EVENT_PTR(LD_REF_L1), 458 POWER_EVENT_PTR(LD_REF_L1),
459 POWER_EVENT_PTR(LD_MISS_L1), 459 POWER_EVENT_PTR(LD_MISS_L1),
460 POWER_EVENT_PTR(BRU_FIN), 460 POWER_EVENT_PTR(BRU_FIN),
461 POWER_EVENT_PTR(BRU_MPRED), 461 POWER_EVENT_PTR(BR_MPRED),
462 462
463 POWER_EVENT_PTR(CMPLU_STALL_FXU), 463 POWER_EVENT_PTR(CMPLU_STALL_FXU),
464 POWER_EVENT_PTR(CMPLU_STALL_DIV), 464 POWER_EVENT_PTR(CMPLU_STALL_DIV),
diff --git a/arch/powerpc/platforms/cell/beat_interrupt.c b/arch/powerpc/platforms/cell/beat_interrupt.c
index 8c6dc42ecf65..9e5dfbcc00af 100644
--- a/arch/powerpc/platforms/cell/beat_interrupt.c
+++ b/arch/powerpc/platforms/cell/beat_interrupt.c
@@ -239,7 +239,7 @@ void __init beatic_init_IRQ(void)
239 ppc_md.get_irq = beatic_get_irq; 239 ppc_md.get_irq = beatic_get_irq;
240 240
241 /* Allocate an irq host */ 241 /* Allocate an irq host */
242 beatic_host = irq_domain_add_nomap(NULL, 0, &beatic_pic_host_ops, NULL); 242 beatic_host = irq_domain_add_nomap(NULL, ~0, &beatic_pic_host_ops, NULL);
243 BUG_ON(beatic_host == NULL); 243 BUG_ON(beatic_host == NULL);
244 irq_set_default_host(beatic_host); 244 irq_set_default_host(beatic_host);
245} 245}
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index 49c9f9501c21..5cbd4d67d5c4 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -192,7 +192,7 @@ static int psurge_secondary_ipi_init(void)
192{ 192{
193 int rc = -ENOMEM; 193 int rc = -ENOMEM;
194 194
195 psurge_host = irq_domain_add_nomap(NULL, 0, &psurge_host_ops, NULL); 195 psurge_host = irq_domain_add_nomap(NULL, ~0, &psurge_host_ops, NULL);
196 196
197 if (psurge_host) 197 if (psurge_host)
198 psurge_secondary_virq = irq_create_direct_mapping(psurge_host); 198 psurge_secondary_virq = irq_create_direct_mapping(psurge_host);
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index 6b499870662f..b0e6435b2f02 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -91,7 +91,15 @@ struct thread_struct {
91#endif 91#endif
92}; 92};
93 93
94#define PER_FLAG_NO_TE 1UL /* Flag to disable transactions. */ 94/* Flag to disable transactions. */
95#define PER_FLAG_NO_TE 1UL
96/* Flag to enable random transaction aborts. */
97#define PER_FLAG_TE_ABORT_RAND 2UL
98/* Flag to specify random transaction abort mode:
99 * - abort each transaction at a random instruction before TEND if set.
100 * - abort random transactions at a random instruction if cleared.
101 */
102#define PER_FLAG_TE_ABORT_RAND_TEND 4UL
95 103
96typedef struct thread_struct thread_struct; 104typedef struct thread_struct thread_struct;
97 105
diff --git a/arch/s390/include/asm/switch_to.h b/arch/s390/include/asm/switch_to.h
index f3a9e0f92704..80b6f11263c4 100644
--- a/arch/s390/include/asm/switch_to.h
+++ b/arch/s390/include/asm/switch_to.h
@@ -10,7 +10,7 @@
10#include <linux/thread_info.h> 10#include <linux/thread_info.h>
11 11
12extern struct task_struct *__switch_to(void *, void *); 12extern struct task_struct *__switch_to(void *, void *);
13extern void update_per_regs(struct task_struct *task); 13extern void update_cr_regs(struct task_struct *task);
14 14
15static inline void save_fp_regs(s390_fp_regs *fpregs) 15static inline void save_fp_regs(s390_fp_regs *fpregs)
16{ 16{
@@ -86,7 +86,7 @@ static inline void restore_access_regs(unsigned int *acrs)
86 restore_fp_regs(&next->thread.fp_regs); \ 86 restore_fp_regs(&next->thread.fp_regs); \
87 restore_access_regs(&next->thread.acrs[0]); \ 87 restore_access_regs(&next->thread.acrs[0]); \
88 restore_ri_cb(next->thread.ri_cb, prev->thread.ri_cb); \ 88 restore_ri_cb(next->thread.ri_cb, prev->thread.ri_cb); \
89 update_per_regs(next); \ 89 update_cr_regs(next); \
90 } \ 90 } \
91 prev = __switch_to(prev,next); \ 91 prev = __switch_to(prev,next); \
92} while (0) 92} while (0)
diff --git a/arch/s390/include/uapi/asm/ptrace.h b/arch/s390/include/uapi/asm/ptrace.h
index 3aa9f1ec5b29..7a84619e315e 100644
--- a/arch/s390/include/uapi/asm/ptrace.h
+++ b/arch/s390/include/uapi/asm/ptrace.h
@@ -400,6 +400,7 @@ typedef struct
400#define PTRACE_POKE_SYSTEM_CALL 0x5008 400#define PTRACE_POKE_SYSTEM_CALL 0x5008
401#define PTRACE_ENABLE_TE 0x5009 401#define PTRACE_ENABLE_TE 0x5009
402#define PTRACE_DISABLE_TE 0x5010 402#define PTRACE_DISABLE_TE 0x5010
403#define PTRACE_TE_ABORT_RAND 0x5011
403 404
404/* 405/*
405 * PT_PROT definition is loosely based on hppa bsd definition in 406 * PT_PROT definition is loosely based on hppa bsd definition in
diff --git a/arch/s390/include/uapi/asm/socket.h b/arch/s390/include/uapi/asm/socket.h
index 2dacb306835c..92494494692e 100644
--- a/arch/s390/include/uapi/asm/socket.h
+++ b/arch/s390/include/uapi/asm/socket.h
@@ -80,4 +80,6 @@
80 80
81#define SO_SELECT_ERR_QUEUE 45 81#define SO_SELECT_ERR_QUEUE 45
82 82
83#define SO_BUSY_POLL 46
84
83#endif /* _ASM_SOCKET_H */ 85#endif /* _ASM_SOCKET_H */
diff --git a/arch/s390/kernel/cache.c b/arch/s390/kernel/cache.c
index 64b24650e4f8..dd62071624be 100644
--- a/arch/s390/kernel/cache.c
+++ b/arch/s390/kernel/cache.c
@@ -173,7 +173,7 @@ error:
173 } 173 }
174} 174}
175 175
176static struct cache_dir *__cpuinit cache_create_cache_dir(int cpu) 176static struct cache_dir *cache_create_cache_dir(int cpu)
177{ 177{
178 struct cache_dir *cache_dir; 178 struct cache_dir *cache_dir;
179 struct kobject *kobj = NULL; 179 struct kobject *kobj = NULL;
@@ -289,9 +289,8 @@ static struct kobj_type cache_index_type = {
289 .default_attrs = cache_index_default_attrs, 289 .default_attrs = cache_index_default_attrs,
290}; 290};
291 291
292static int __cpuinit cache_create_index_dir(struct cache_dir *cache_dir, 292static int cache_create_index_dir(struct cache_dir *cache_dir,
293 struct cache *cache, int index, 293 struct cache *cache, int index, int cpu)
294 int cpu)
295{ 294{
296 struct cache_index_dir *index_dir; 295 struct cache_index_dir *index_dir;
297 int rc; 296 int rc;
@@ -313,7 +312,7 @@ out:
313 return rc; 312 return rc;
314} 313}
315 314
316static int __cpuinit cache_add_cpu(int cpu) 315static int cache_add_cpu(int cpu)
317{ 316{
318 struct cache_dir *cache_dir; 317 struct cache_dir *cache_dir;
319 struct cache *cache; 318 struct cache *cache;
@@ -335,7 +334,7 @@ static int __cpuinit cache_add_cpu(int cpu)
335 return 0; 334 return 0;
336} 335}
337 336
338static void __cpuinit cache_remove_cpu(int cpu) 337static void cache_remove_cpu(int cpu)
339{ 338{
340 struct cache_index_dir *index, *next; 339 struct cache_index_dir *index, *next;
341 struct cache_dir *cache_dir; 340 struct cache_dir *cache_dir;
@@ -354,8 +353,8 @@ static void __cpuinit cache_remove_cpu(int cpu)
354 cache_dir_cpu[cpu] = NULL; 353 cache_dir_cpu[cpu] = NULL;
355} 354}
356 355
357static int __cpuinit cache_hotplug(struct notifier_block *nfb, 356static int cache_hotplug(struct notifier_block *nfb, unsigned long action,
358 unsigned long action, void *hcpu) 357 void *hcpu)
359{ 358{
360 int cpu = (long)hcpu; 359 int cpu = (long)hcpu;
361 int rc = 0; 360 int rc = 0;
diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
index f703d91bf720..d8f355657171 100644
--- a/arch/s390/kernel/crash_dump.c
+++ b/arch/s390/kernel/crash_dump.c
@@ -21,6 +21,48 @@
21#define PTR_SUB(x, y) (((char *) (x)) - ((unsigned long) (y))) 21#define PTR_SUB(x, y) (((char *) (x)) - ((unsigned long) (y)))
22#define PTR_DIFF(x, y) ((unsigned long)(((char *) (x)) - ((unsigned long) (y)))) 22#define PTR_DIFF(x, y) ((unsigned long)(((char *) (x)) - ((unsigned long) (y))))
23 23
24
25/*
26 * Return physical address for virtual address
27 */
28static inline void *load_real_addr(void *addr)
29{
30 unsigned long real_addr;
31
32 asm volatile(
33 " lra %0,0(%1)\n"
34 " jz 0f\n"
35 " la %0,0\n"
36 "0:"
37 : "=a" (real_addr) : "a" (addr) : "cc");
38 return (void *)real_addr;
39}
40
41/*
42 * Copy up to one page to vmalloc or real memory
43 */
44static ssize_t copy_page_real(void *buf, void *src, size_t csize)
45{
46 size_t size;
47
48 if (is_vmalloc_addr(buf)) {
49 BUG_ON(csize >= PAGE_SIZE);
50 /* If buf is not page aligned, copy first part */
51 size = min(roundup(__pa(buf), PAGE_SIZE) - __pa(buf), csize);
52 if (size) {
53 if (memcpy_real(load_real_addr(buf), src, size))
54 return -EFAULT;
55 buf += size;
56 src += size;
57 }
58 /* Copy second part */
59 size = csize - size;
60 return (size) ? memcpy_real(load_real_addr(buf), src, size) : 0;
61 } else {
62 return memcpy_real(buf, src, csize);
63 }
64}
65
24/* 66/*
25 * Copy one page from "oldmem" 67 * Copy one page from "oldmem"
26 * 68 *
@@ -32,6 +74,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
32 size_t csize, unsigned long offset, int userbuf) 74 size_t csize, unsigned long offset, int userbuf)
33{ 75{
34 unsigned long src; 76 unsigned long src;
77 int rc;
35 78
36 if (!csize) 79 if (!csize)
37 return 0; 80 return 0;
@@ -43,11 +86,11 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
43 src < OLDMEM_BASE + OLDMEM_SIZE) 86 src < OLDMEM_BASE + OLDMEM_SIZE)
44 src -= OLDMEM_BASE; 87 src -= OLDMEM_BASE;
45 if (userbuf) 88 if (userbuf)
46 copy_to_user_real((void __force __user *) buf, (void *) src, 89 rc = copy_to_user_real((void __force __user *) buf,
47 csize); 90 (void *) src, csize);
48 else 91 else
49 memcpy_real(buf, (void *) src, csize); 92 rc = copy_page_real(buf, (void *) src, csize);
50 return csize; 93 return (rc == 0) ? csize : rc;
51} 94}
52 95
53/* 96/*
diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c
index 390d9ae57bb2..fb99c2057b85 100644
--- a/arch/s390/kernel/perf_cpum_cf.c
+++ b/arch/s390/kernel/perf_cpum_cf.c
@@ -639,8 +639,8 @@ static struct pmu cpumf_pmu = {
639 .cancel_txn = cpumf_pmu_cancel_txn, 639 .cancel_txn = cpumf_pmu_cancel_txn,
640}; 640};
641 641
642static int __cpuinit cpumf_pmu_notifier(struct notifier_block *self, 642static int cpumf_pmu_notifier(struct notifier_block *self, unsigned long action,
643 unsigned long action, void *hcpu) 643 void *hcpu)
644{ 644{
645 unsigned int cpu = (long) hcpu; 645 unsigned int cpu = (long) hcpu;
646 int flags; 646 int flags;
diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c
index 753c41d0ffd3..24612029f450 100644
--- a/arch/s390/kernel/processor.c
+++ b/arch/s390/kernel/processor.c
@@ -21,7 +21,7 @@ static DEFINE_PER_CPU(struct cpuid, cpu_id);
21/* 21/*
22 * cpu_init - initializes state that is per-CPU. 22 * cpu_init - initializes state that is per-CPU.
23 */ 23 */
24void __cpuinit cpu_init(void) 24void cpu_init(void)
25{ 25{
26 struct s390_idle_data *idle = &__get_cpu_var(s390_idle); 26 struct s390_idle_data *idle = &__get_cpu_var(s390_idle);
27 struct cpuid *id = &__get_cpu_var(cpu_id); 27 struct cpuid *id = &__get_cpu_var(cpu_id);
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index a314c57f4e94..e9fadb04e3c6 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -47,7 +47,7 @@ enum s390_regset {
47 REGSET_GENERAL_EXTENDED, 47 REGSET_GENERAL_EXTENDED,
48}; 48};
49 49
50void update_per_regs(struct task_struct *task) 50void update_cr_regs(struct task_struct *task)
51{ 51{
52 struct pt_regs *regs = task_pt_regs(task); 52 struct pt_regs *regs = task_pt_regs(task);
53 struct thread_struct *thread = &task->thread; 53 struct thread_struct *thread = &task->thread;
@@ -56,17 +56,25 @@ void update_per_regs(struct task_struct *task)
56#ifdef CONFIG_64BIT 56#ifdef CONFIG_64BIT
57 /* Take care of the enable/disable of transactional execution. */ 57 /* Take care of the enable/disable of transactional execution. */
58 if (MACHINE_HAS_TE) { 58 if (MACHINE_HAS_TE) {
59 unsigned long cr0, cr0_new; 59 unsigned long cr[3], cr_new[3];
60 60
61 __ctl_store(cr0, 0, 0); 61 __ctl_store(cr, 0, 2);
62 /* set or clear transaction execution bits 8 and 9. */ 62 cr_new[1] = cr[1];
63 /* Set or clear transaction execution TXC/PIFO bits 8 and 9. */
63 if (task->thread.per_flags & PER_FLAG_NO_TE) 64 if (task->thread.per_flags & PER_FLAG_NO_TE)
64 cr0_new = cr0 & ~(3UL << 54); 65 cr_new[0] = cr[0] & ~(3UL << 54);
65 else 66 else
66 cr0_new = cr0 | (3UL << 54); 67 cr_new[0] = cr[0] | (3UL << 54);
67 /* Only load control register 0 if necessary. */ 68 /* Set or clear transaction execution TDC bits 62 and 63. */
68 if (cr0 != cr0_new) 69 cr_new[2] = cr[2] & ~3UL;
69 __ctl_load(cr0_new, 0, 0); 70 if (task->thread.per_flags & PER_FLAG_TE_ABORT_RAND) {
71 if (task->thread.per_flags & PER_FLAG_TE_ABORT_RAND_TEND)
72 cr_new[2] |= 1UL;
73 else
74 cr_new[2] |= 2UL;
75 }
76 if (memcmp(&cr_new, &cr, sizeof(cr)))
77 __ctl_load(cr_new, 0, 2);
70 } 78 }
71#endif 79#endif
72 /* Copy user specified PER registers */ 80 /* Copy user specified PER registers */
@@ -100,14 +108,14 @@ void user_enable_single_step(struct task_struct *task)
100{ 108{
101 set_tsk_thread_flag(task, TIF_SINGLE_STEP); 109 set_tsk_thread_flag(task, TIF_SINGLE_STEP);
102 if (task == current) 110 if (task == current)
103 update_per_regs(task); 111 update_cr_regs(task);
104} 112}
105 113
106void user_disable_single_step(struct task_struct *task) 114void user_disable_single_step(struct task_struct *task)
107{ 115{
108 clear_tsk_thread_flag(task, TIF_SINGLE_STEP); 116 clear_tsk_thread_flag(task, TIF_SINGLE_STEP);
109 if (task == current) 117 if (task == current)
110 update_per_regs(task); 118 update_cr_regs(task);
111} 119}
112 120
113/* 121/*
@@ -447,6 +455,26 @@ long arch_ptrace(struct task_struct *child, long request,
447 if (!MACHINE_HAS_TE) 455 if (!MACHINE_HAS_TE)
448 return -EIO; 456 return -EIO;
449 child->thread.per_flags |= PER_FLAG_NO_TE; 457 child->thread.per_flags |= PER_FLAG_NO_TE;
458 child->thread.per_flags &= ~PER_FLAG_TE_ABORT_RAND;
459 return 0;
460 case PTRACE_TE_ABORT_RAND:
461 if (!MACHINE_HAS_TE || (child->thread.per_flags & PER_FLAG_NO_TE))
462 return -EIO;
463 switch (data) {
464 case 0UL:
465 child->thread.per_flags &= ~PER_FLAG_TE_ABORT_RAND;
466 break;
467 case 1UL:
468 child->thread.per_flags |= PER_FLAG_TE_ABORT_RAND;
469 child->thread.per_flags |= PER_FLAG_TE_ABORT_RAND_TEND;
470 break;
471 case 2UL:
472 child->thread.per_flags |= PER_FLAG_TE_ABORT_RAND;
473 child->thread.per_flags &= ~PER_FLAG_TE_ABORT_RAND_TEND;
474 break;
475 default:
476 return -EINVAL;
477 }
450 return 0; 478 return 0;
451 default: 479 default:
452 /* Removing high order bit from addr (only for 31 bit). */ 480 /* Removing high order bit from addr (only for 31 bit). */
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 15a016c10563..d386c4e9d2e5 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -165,7 +165,7 @@ static void pcpu_ec_call(struct pcpu *pcpu, int ec_bit)
165 pcpu_sigp_retry(pcpu, order, 0); 165 pcpu_sigp_retry(pcpu, order, 0);
166} 166}
167 167
168static int __cpuinit pcpu_alloc_lowcore(struct pcpu *pcpu, int cpu) 168static int pcpu_alloc_lowcore(struct pcpu *pcpu, int cpu)
169{ 169{
170 struct _lowcore *lc; 170 struct _lowcore *lc;
171 171
@@ -616,10 +616,9 @@ static struct sclp_cpu_info *smp_get_cpu_info(void)
616 return info; 616 return info;
617} 617}
618 618
619static int __cpuinit smp_add_present_cpu(int cpu); 619static int smp_add_present_cpu(int cpu);
620 620
621static int __cpuinit __smp_rescan_cpus(struct sclp_cpu_info *info, 621static int __smp_rescan_cpus(struct sclp_cpu_info *info, int sysfs_add)
622 int sysfs_add)
623{ 622{
624 struct pcpu *pcpu; 623 struct pcpu *pcpu;
625 cpumask_t avail; 624 cpumask_t avail;
@@ -685,7 +684,7 @@ static void __init smp_detect_cpus(void)
685/* 684/*
686 * Activate a secondary processor. 685 * Activate a secondary processor.
687 */ 686 */
688static void __cpuinit smp_start_secondary(void *cpuvoid) 687static void smp_start_secondary(void *cpuvoid)
689{ 688{
690 S390_lowcore.last_update_clock = get_tod_clock(); 689 S390_lowcore.last_update_clock = get_tod_clock();
691 S390_lowcore.restart_stack = (unsigned long) restart_stack; 690 S390_lowcore.restart_stack = (unsigned long) restart_stack;
@@ -708,7 +707,7 @@ static void __cpuinit smp_start_secondary(void *cpuvoid)
708} 707}
709 708
710/* Upping and downing of CPUs */ 709/* Upping and downing of CPUs */
711int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) 710int __cpu_up(unsigned int cpu, struct task_struct *tidle)
712{ 711{
713 struct pcpu *pcpu; 712 struct pcpu *pcpu;
714 int rc; 713 int rc;
@@ -964,8 +963,8 @@ static struct attribute_group cpu_online_attr_group = {
964 .attrs = cpu_online_attrs, 963 .attrs = cpu_online_attrs,
965}; 964};
966 965
967static int __cpuinit smp_cpu_notify(struct notifier_block *self, 966static int smp_cpu_notify(struct notifier_block *self, unsigned long action,
968 unsigned long action, void *hcpu) 967 void *hcpu)
969{ 968{
970 unsigned int cpu = (unsigned int)(long)hcpu; 969 unsigned int cpu = (unsigned int)(long)hcpu;
971 struct cpu *c = &pcpu_devices[cpu].cpu; 970 struct cpu *c = &pcpu_devices[cpu].cpu;
@@ -983,7 +982,7 @@ static int __cpuinit smp_cpu_notify(struct notifier_block *self,
983 return notifier_from_errno(err); 982 return notifier_from_errno(err);
984} 983}
985 984
986static int __cpuinit smp_add_present_cpu(int cpu) 985static int smp_add_present_cpu(int cpu)
987{ 986{
988 struct cpu *c = &pcpu_devices[cpu].cpu; 987 struct cpu *c = &pcpu_devices[cpu].cpu;
989 struct device *s = &c->dev; 988 struct device *s = &c->dev;
diff --git a/arch/s390/kernel/sysinfo.c b/arch/s390/kernel/sysinfo.c
index 62f89d98e880..811f542b8ed4 100644
--- a/arch/s390/kernel/sysinfo.c
+++ b/arch/s390/kernel/sysinfo.c
@@ -418,7 +418,7 @@ void s390_adjust_jiffies(void)
418/* 418/*
419 * calibrate the delay loop 419 * calibrate the delay loop
420 */ 420 */
421void __cpuinit calibrate_delay(void) 421void calibrate_delay(void)
422{ 422{
423 s390_adjust_jiffies(); 423 s390_adjust_jiffies();
424 /* Print the good old Bogomips line .. */ 424 /* Print the good old Bogomips line .. */
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index 3fb09359eda6..9b9c1b78ec67 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -371,14 +371,14 @@ EXPORT_SYMBOL(del_virt_timer);
371/* 371/*
372 * Start the virtual CPU timer on the current CPU. 372 * Start the virtual CPU timer on the current CPU.
373 */ 373 */
374void __cpuinit init_cpu_vtimer(void) 374void init_cpu_vtimer(void)
375{ 375{
376 /* set initial cpu timer */ 376 /* set initial cpu timer */
377 set_vtimer(VTIMER_MAX_SLICE); 377 set_vtimer(VTIMER_MAX_SLICE);
378} 378}
379 379
380static int __cpuinit s390_nohz_notify(struct notifier_block *self, 380static int s390_nohz_notify(struct notifier_block *self, unsigned long action,
381 unsigned long action, void *hcpu) 381 void *hcpu)
382{ 382{
383 struct s390_idle_data *idle; 383 struct s390_idle_data *idle;
384 long cpu = (long) hcpu; 384 long cpu = (long) hcpu;
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 047c3e4c59a2..f00aefb66a4e 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -639,8 +639,8 @@ out:
639 put_task_struct(tsk); 639 put_task_struct(tsk);
640} 640}
641 641
642static int __cpuinit pfault_cpu_notify(struct notifier_block *self, 642static int pfault_cpu_notify(struct notifier_block *self, unsigned long action,
643 unsigned long action, void *hcpu) 643 void *hcpu)
644{ 644{
645 struct thread_struct *thread, *next; 645 struct thread_struct *thread, *next;
646 struct task_struct *tsk; 646 struct task_struct *tsk;
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c
index 06bafec00278..40023290ee5b 100644
--- a/arch/s390/mm/mmap.c
+++ b/arch/s390/mm/mmap.c
@@ -91,11 +91,9 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
91 if (mmap_is_legacy()) { 91 if (mmap_is_legacy()) {
92 mm->mmap_base = TASK_UNMAPPED_BASE; 92 mm->mmap_base = TASK_UNMAPPED_BASE;
93 mm->get_unmapped_area = arch_get_unmapped_area; 93 mm->get_unmapped_area = arch_get_unmapped_area;
94 mm->unmap_area = arch_unmap_area;
95 } else { 94 } else {
96 mm->mmap_base = mmap_base(); 95 mm->mmap_base = mmap_base();
97 mm->get_unmapped_area = arch_get_unmapped_area_topdown; 96 mm->get_unmapped_area = arch_get_unmapped_area_topdown;
98 mm->unmap_area = arch_unmap_area_topdown;
99 } 97 }
100} 98}
101 99
@@ -176,11 +174,9 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
176 if (mmap_is_legacy()) { 174 if (mmap_is_legacy()) {
177 mm->mmap_base = TASK_UNMAPPED_BASE; 175 mm->mmap_base = TASK_UNMAPPED_BASE;
178 mm->get_unmapped_area = s390_get_unmapped_area; 176 mm->get_unmapped_area = s390_get_unmapped_area;
179 mm->unmap_area = arch_unmap_area;
180 } else { 177 } else {
181 mm->mmap_base = mmap_base(); 178 mm->mmap_base = mmap_base();
182 mm->get_unmapped_area = s390_get_unmapped_area_topdown; 179 mm->get_unmapped_area = s390_get_unmapped_area_topdown;
183 mm->unmap_area = arch_unmap_area_topdown;
184 } 180 }
185} 181}
186 182
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index 82f165f8078c..d5f10a43a58f 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -9,6 +9,8 @@
9#include <linux/netdevice.h> 9#include <linux/netdevice.h>
10#include <linux/if_vlan.h> 10#include <linux/if_vlan.h>
11#include <linux/filter.h> 11#include <linux/filter.h>
12#include <linux/random.h>
13#include <linux/init.h>
12#include <asm/cacheflush.h> 14#include <asm/cacheflush.h>
13#include <asm/processor.h> 15#include <asm/processor.h>
14#include <asm/facility.h> 16#include <asm/facility.h>
@@ -221,6 +223,37 @@ static void bpf_jit_epilogue(struct bpf_jit *jit)
221 EMIT2(0x07fe); 223 EMIT2(0x07fe);
222} 224}
223 225
226/* Helper to find the offset of pkt_type in sk_buff
227 * Make sure its still a 3bit field starting at the MSBs within a byte.
228 */
229#define PKT_TYPE_MAX 0xe0
230static int pkt_type_offset;
231
232static int __init bpf_pkt_type_offset_init(void)
233{
234 struct sk_buff skb_probe = {
235 .pkt_type = ~0,
236 };
237 char *ct = (char *)&skb_probe;
238 int off;
239
240 pkt_type_offset = -1;
241 for (off = 0; off < sizeof(struct sk_buff); off++) {
242 if (!ct[off])
243 continue;
244 if (ct[off] == PKT_TYPE_MAX)
245 pkt_type_offset = off;
246 else {
247 /* Found non matching bit pattern, fix needed. */
248 WARN_ON_ONCE(1);
249 pkt_type_offset = -1;
250 return -1;
251 }
252 }
253 return 0;
254}
255device_initcall(bpf_pkt_type_offset_init);
256
224/* 257/*
225 * make sure we dont leak kernel information to user 258 * make sure we dont leak kernel information to user
226 */ 259 */
@@ -720,6 +753,16 @@ call_fn: /* lg %r1,<d(function)>(%r13) */
720 EMIT4_DISP(0x88500000, 12); 753 EMIT4_DISP(0x88500000, 12);
721 } 754 }
722 break; 755 break;
756 case BPF_S_ANC_PKTTYPE:
757 if (pkt_type_offset < 0)
758 goto out;
759 /* lhi %r5,0 */
760 EMIT4(0xa7580000);
761 /* ic %r5,<d(pkt_type_offset)>(%r2) */
762 EMIT4_DISP(0x43502000, pkt_type_offset);
763 /* srl %r5,5 */
764 EMIT4_DISP(0x88500000, 5);
765 break;
723 case BPF_S_ANC_CPU: /* A = smp_processor_id() */ 766 case BPF_S_ANC_CPU: /* A = smp_processor_id() */
724#ifdef CONFIG_SMP 767#ifdef CONFIG_SMP
725 /* l %r5,<d(cpu_nr)> */ 768 /* l %r5,<d(cpu_nr)> */
@@ -738,8 +781,41 @@ out:
738 return -1; 781 return -1;
739} 782}
740 783
784/*
785 * Note: for security reasons, bpf code will follow a randomly
786 * sized amount of illegal instructions.
787 */
788struct bpf_binary_header {
789 unsigned int pages;
790 u8 image[];
791};
792
793static struct bpf_binary_header *bpf_alloc_binary(unsigned int bpfsize,
794 u8 **image_ptr)
795{
796 struct bpf_binary_header *header;
797 unsigned int sz, hole;
798
799 /* Most BPF filters are really small, but if some of them fill a page,
800 * allow at least 128 extra bytes for illegal instructions.
801 */
802 sz = round_up(bpfsize + sizeof(*header) + 128, PAGE_SIZE);
803 header = module_alloc(sz);
804 if (!header)
805 return NULL;
806 memset(header, 0, sz);
807 header->pages = sz / PAGE_SIZE;
808 hole = sz - bpfsize + sizeof(*header);
809 /* Insert random number of illegal instructions before BPF code
810 * and make sure the first instruction starts at an even address.
811 */
812 *image_ptr = &header->image[(prandom_u32() % hole) & -2];
813 return header;
814}
815
741void bpf_jit_compile(struct sk_filter *fp) 816void bpf_jit_compile(struct sk_filter *fp)
742{ 817{
818 struct bpf_binary_header *header = NULL;
743 unsigned long size, prg_len, lit_len; 819 unsigned long size, prg_len, lit_len;
744 struct bpf_jit jit, cjit; 820 struct bpf_jit jit, cjit;
745 unsigned int *addrs; 821 unsigned int *addrs;
@@ -772,12 +848,11 @@ void bpf_jit_compile(struct sk_filter *fp)
772 } else if (jit.prg == cjit.prg && jit.lit == cjit.lit) { 848 } else if (jit.prg == cjit.prg && jit.lit == cjit.lit) {
773 prg_len = jit.prg - jit.start; 849 prg_len = jit.prg - jit.start;
774 lit_len = jit.lit - jit.mid; 850 lit_len = jit.lit - jit.mid;
775 size = max_t(unsigned long, prg_len + lit_len, 851 size = prg_len + lit_len;
776 sizeof(struct work_struct));
777 if (size >= BPF_SIZE_MAX) 852 if (size >= BPF_SIZE_MAX)
778 goto out; 853 goto out;
779 jit.start = module_alloc(size); 854 header = bpf_alloc_binary(size, &jit.start);
780 if (!jit.start) 855 if (!header)
781 goto out; 856 goto out;
782 jit.prg = jit.mid = jit.start + prg_len; 857 jit.prg = jit.mid = jit.start + prg_len;
783 jit.lit = jit.end = jit.start + prg_len + lit_len; 858 jit.lit = jit.end = jit.start + prg_len + lit_len;
@@ -788,37 +863,25 @@ void bpf_jit_compile(struct sk_filter *fp)
788 cjit = jit; 863 cjit = jit;
789 } 864 }
790 if (bpf_jit_enable > 1) { 865 if (bpf_jit_enable > 1) {
791 pr_err("flen=%d proglen=%lu pass=%d image=%p\n", 866 bpf_jit_dump(fp->len, jit.end - jit.start, pass, jit.start);
792 fp->len, jit.end - jit.start, pass, jit.start); 867 if (jit.start)
793 if (jit.start) {
794 printk(KERN_ERR "JIT code:\n");
795 print_fn_code(jit.start, jit.mid - jit.start); 868 print_fn_code(jit.start, jit.mid - jit.start);
796 print_hex_dump(KERN_ERR, "JIT literals:\n",
797 DUMP_PREFIX_ADDRESS, 16, 1,
798 jit.mid, jit.end - jit.mid, false);
799 }
800 } 869 }
801 if (jit.start) 870 if (jit.start) {
871 set_memory_ro((unsigned long)header, header->pages);
802 fp->bpf_func = (void *) jit.start; 872 fp->bpf_func = (void *) jit.start;
873 }
803out: 874out:
804 kfree(addrs); 875 kfree(addrs);
805} 876}
806 877
807static void jit_free_defer(struct work_struct *arg)
808{
809 module_free(NULL, arg);
810}
811
812/* run from softirq, we must use a work_struct to call
813 * module_free() from process context
814 */
815void bpf_jit_free(struct sk_filter *fp) 878void bpf_jit_free(struct sk_filter *fp)
816{ 879{
817 struct work_struct *work; 880 unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK;
881 struct bpf_binary_header *header = (void *)addr;
818 882
819 if (fp->bpf_func == sk_run_filter) 883 if (fp->bpf_func == sk_run_filter)
820 return; 884 return;
821 work = (struct work_struct *)fp->bpf_func; 885 set_memory_rw(addr, header->pages);
822 INIT_WORK(work, jit_free_defer); 886 module_free(NULL, header);
823 schedule_work(work);
824} 887}
diff --git a/arch/score/mm/fault.c b/arch/score/mm/fault.c
index 47b600e4b2c5..6b18fb0189ae 100644
--- a/arch/score/mm/fault.c
+++ b/arch/score/mm/fault.c
@@ -172,10 +172,10 @@ out_of_memory:
172 down_read(&mm->mmap_sem); 172 down_read(&mm->mmap_sem);
173 goto survive; 173 goto survive;
174 } 174 }
175 printk("VM: killing process %s\n", tsk->comm); 175 if (!user_mode(regs))
176 if (user_mode(regs)) 176 goto no_context;
177 do_group_exit(SIGKILL); 177 pagefault_out_of_memory();
178 goto no_context; 178 return;
179 179
180do_sigbus: 180do_sigbus:
181 up_read(&mm->mmap_sem); 181 up_read(&mm->mmap_sem);
diff --git a/arch/score/mm/tlb-score.c b/arch/score/mm/tlb-score.c
index 6fdb100244c8..004073717de0 100644
--- a/arch/score/mm/tlb-score.c
+++ b/arch/score/mm/tlb-score.c
@@ -240,7 +240,7 @@ void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
240 local_irq_restore(flags); 240 local_irq_restore(flags);
241} 241}
242 242
243void __cpuinit tlb_init(void) 243void tlb_init(void)
244{ 244{
245 tlblock_set(0); 245 tlblock_set(0);
246 local_flush_tlb_all(); 246 local_flush_tlb_all();
diff --git a/arch/sh/boards/board-espt.c b/arch/sh/boards/board-espt.c
index d71a0bcf8145..4d94dff9015c 100644
--- a/arch/sh/boards/board-espt.c
+++ b/arch/sh/boards/board-espt.c
@@ -85,7 +85,7 @@ static struct sh_eth_plat_data sh7763_eth_pdata = {
85}; 85};
86 86
87static struct platform_device espt_eth_device = { 87static struct platform_device espt_eth_device = {
88 .name = "sh-eth", 88 .name = "sh7763-gether",
89 .resource = sh_eth_resources, 89 .resource = sh_eth_resources,
90 .num_resources = ARRAY_SIZE(sh_eth_resources), 90 .num_resources = ARRAY_SIZE(sh_eth_resources),
91 .dev = { 91 .dev = {
diff --git a/arch/sh/boards/board-sh7757lcr.c b/arch/sh/boards/board-sh7757lcr.c
index 41f86702eb9f..4f114d1cd019 100644
--- a/arch/sh/boards/board-sh7757lcr.c
+++ b/arch/sh/boards/board-sh7757lcr.c
@@ -82,7 +82,7 @@ static struct sh_eth_plat_data sh7757_eth0_pdata = {
82}; 82};
83 83
84static struct platform_device sh7757_eth0_device = { 84static struct platform_device sh7757_eth0_device = {
85 .name = "sh-eth", 85 .name = "sh7757-ether",
86 .resource = sh_eth0_resources, 86 .resource = sh_eth0_resources,
87 .id = 0, 87 .id = 0,
88 .num_resources = ARRAY_SIZE(sh_eth0_resources), 88 .num_resources = ARRAY_SIZE(sh_eth0_resources),
@@ -111,7 +111,7 @@ static struct sh_eth_plat_data sh7757_eth1_pdata = {
111}; 111};
112 112
113static struct platform_device sh7757_eth1_device = { 113static struct platform_device sh7757_eth1_device = {
114 .name = "sh-eth", 114 .name = "sh7757-ether",
115 .resource = sh_eth1_resources, 115 .resource = sh_eth1_resources,
116 .id = 1, 116 .id = 1,
117 .num_resources = ARRAY_SIZE(sh_eth1_resources), 117 .num_resources = ARRAY_SIZE(sh_eth1_resources),
@@ -157,7 +157,7 @@ static struct sh_eth_plat_data sh7757_eth_giga0_pdata = {
157}; 157};
158 158
159static struct platform_device sh7757_eth_giga0_device = { 159static struct platform_device sh7757_eth_giga0_device = {
160 .name = "sh-eth", 160 .name = "sh7757-gether",
161 .resource = sh_eth_giga0_resources, 161 .resource = sh_eth_giga0_resources,
162 .id = 2, 162 .id = 2,
163 .num_resources = ARRAY_SIZE(sh_eth_giga0_resources), 163 .num_resources = ARRAY_SIZE(sh_eth_giga0_resources),
@@ -192,7 +192,7 @@ static struct sh_eth_plat_data sh7757_eth_giga1_pdata = {
192}; 192};
193 193
194static struct platform_device sh7757_eth_giga1_device = { 194static struct platform_device sh7757_eth_giga1_device = {
195 .name = "sh-eth", 195 .name = "sh7757-gether",
196 .resource = sh_eth_giga1_resources, 196 .resource = sh_eth_giga1_resources,
197 .id = 3, 197 .id = 3,
198 .num_resources = ARRAY_SIZE(sh_eth_giga1_resources), 198 .num_resources = ARRAY_SIZE(sh_eth_giga1_resources),
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 764530c85aa9..61fade0ffa96 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -165,8 +165,8 @@ static struct sh_eth_plat_data sh_eth_plat = {
165}; 165};
166 166
167static struct platform_device sh_eth_device = { 167static struct platform_device sh_eth_device = {
168 .name = "sh-eth", 168 .name = "sh7724-ether",
169 .id = 0, 169 .id = 0,
170 .dev = { 170 .dev = {
171 .platform_data = &sh_eth_plat, 171 .platform_data = &sh_eth_plat,
172 }, 172 },
diff --git a/arch/sh/boards/mach-se/770x/setup.c b/arch/sh/boards/mach-se/770x/setup.c
index 9759d6ba7ffb..658326f44df8 100644
--- a/arch/sh/boards/mach-se/770x/setup.c
+++ b/arch/sh/boards/mach-se/770x/setup.c
@@ -128,8 +128,8 @@ static struct resource sh_eth0_resources[] = {
128}; 128};
129 129
130static struct platform_device sh_eth0_device = { 130static struct platform_device sh_eth0_device = {
131 .name = "sh-eth", 131 .name = "sh771x-ether",
132 .id = 0, 132 .id = 0,
133 .dev = { 133 .dev = {
134 .platform_data = PHY_ID, 134 .platform_data = PHY_ID,
135 }, 135 },
@@ -151,8 +151,8 @@ static struct resource sh_eth1_resources[] = {
151}; 151};
152 152
153static struct platform_device sh_eth1_device = { 153static struct platform_device sh_eth1_device = {
154 .name = "sh-eth", 154 .name = "sh771x-ether",
155 .id = 1, 155 .id = 1,
156 .dev = { 156 .dev = {
157 .platform_data = PHY_ID, 157 .platform_data = PHY_ID,
158 }, 158 },
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index 4010e63e82d8..b70180ef3e29 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -380,8 +380,8 @@ static struct sh_eth_plat_data sh_eth_plat = {
380}; 380};
381 381
382static struct platform_device sh_eth_device = { 382static struct platform_device sh_eth_device = {
383 .name = "sh-eth", 383 .name = "sh7724-ether",
384 .id = 0, 384 .id = 0,
385 .dev = { 385 .dev = {
386 .platform_data = &sh_eth_plat, 386 .platform_data = &sh_eth_plat,
387 }, 387 },
diff --git a/arch/sh/boards/mach-sh7763rdp/setup.c b/arch/sh/boards/mach-sh7763rdp/setup.c
index b7c75298dfb5..50ba481fa240 100644
--- a/arch/sh/boards/mach-sh7763rdp/setup.c
+++ b/arch/sh/boards/mach-sh7763rdp/setup.c
@@ -93,7 +93,7 @@ static struct sh_eth_plat_data sh7763_eth_pdata = {
93}; 93};
94 94
95static struct platform_device sh7763rdp_eth_device = { 95static struct platform_device sh7763rdp_eth_device = {
96 .name = "sh-eth", 96 .name = "sh7763-gether",
97 .resource = sh_eth_resources, 97 .resource = sh_eth_resources,
98 .num_resources = ARRAY_SIZE(sh_eth_resources), 98 .num_resources = ARRAY_SIZE(sh_eth_resources),
99 .dev = { 99 .dev = {
diff --git a/arch/sh/kernel/cpu/init.c b/arch/sh/kernel/cpu/init.c
index 61a07dafcd46..ecf83cd158dc 100644
--- a/arch/sh/kernel/cpu/init.c
+++ b/arch/sh/kernel/cpu/init.c
@@ -43,9 +43,9 @@
43 * peripherals (nofpu, nodsp, and so forth). 43 * peripherals (nofpu, nodsp, and so forth).
44 */ 44 */
45#define onchip_setup(x) \ 45#define onchip_setup(x) \
46static int x##_disabled __cpuinitdata = !cpu_has_##x; \ 46static int x##_disabled = !cpu_has_##x; \
47 \ 47 \
48static int __cpuinit x##_setup(char *opts) \ 48static int x##_setup(char *opts) \
49{ \ 49{ \
50 x##_disabled = 1; \ 50 x##_disabled = 1; \
51 return 1; \ 51 return 1; \
@@ -59,7 +59,7 @@ onchip_setup(dsp);
59#define CPUOPM 0xff2f0000 59#define CPUOPM 0xff2f0000
60#define CPUOPM_RABD (1 << 5) 60#define CPUOPM_RABD (1 << 5)
61 61
62static void __cpuinit speculative_execution_init(void) 62static void speculative_execution_init(void)
63{ 63{
64 /* Clear RABD */ 64 /* Clear RABD */
65 __raw_writel(__raw_readl(CPUOPM) & ~CPUOPM_RABD, CPUOPM); 65 __raw_writel(__raw_readl(CPUOPM) & ~CPUOPM_RABD, CPUOPM);
@@ -78,7 +78,7 @@ static void __cpuinit speculative_execution_init(void)
78#define EXPMASK_BRDSSLP (1 << 1) 78#define EXPMASK_BRDSSLP (1 << 1)
79#define EXPMASK_MMCAW (1 << 4) 79#define EXPMASK_MMCAW (1 << 4)
80 80
81static void __cpuinit expmask_init(void) 81static void expmask_init(void)
82{ 82{
83 unsigned long expmask = __raw_readl(EXPMASK); 83 unsigned long expmask = __raw_readl(EXPMASK);
84 84
@@ -217,7 +217,7 @@ static void detect_cache_shape(void)
217 l2_cache_shape = -1; /* No S-cache */ 217 l2_cache_shape = -1; /* No S-cache */
218} 218}
219 219
220static void __cpuinit fpu_init(void) 220static void fpu_init(void)
221{ 221{
222 /* Disable the FPU */ 222 /* Disable the FPU */
223 if (fpu_disabled && (current_cpu_data.flags & CPU_HAS_FPU)) { 223 if (fpu_disabled && (current_cpu_data.flags & CPU_HAS_FPU)) {
@@ -230,7 +230,7 @@ static void __cpuinit fpu_init(void)
230} 230}
231 231
232#ifdef CONFIG_SH_DSP 232#ifdef CONFIG_SH_DSP
233static void __cpuinit release_dsp(void) 233static void release_dsp(void)
234{ 234{
235 unsigned long sr; 235 unsigned long sr;
236 236
@@ -244,7 +244,7 @@ static void __cpuinit release_dsp(void)
244 ); 244 );
245} 245}
246 246
247static void __cpuinit dsp_init(void) 247static void dsp_init(void)
248{ 248{
249 unsigned long sr; 249 unsigned long sr;
250 250
@@ -276,7 +276,7 @@ static void __cpuinit dsp_init(void)
276 release_dsp(); 276 release_dsp();
277} 277}
278#else 278#else
279static inline void __cpuinit dsp_init(void) { } 279static inline void dsp_init(void) { }
280#endif /* CONFIG_SH_DSP */ 280#endif /* CONFIG_SH_DSP */
281 281
282/** 282/**
@@ -295,7 +295,7 @@ static inline void __cpuinit dsp_init(void) { }
295 * Each processor family is still responsible for doing its own probing 295 * Each processor family is still responsible for doing its own probing
296 * and cache configuration in cpu_probe(). 296 * and cache configuration in cpu_probe().
297 */ 297 */
298asmlinkage void __cpuinit cpu_init(void) 298asmlinkage void cpu_init(void)
299{ 299{
300 current_thread_info()->cpu = hard_smp_processor_id(); 300 current_thread_info()->cpu = hard_smp_processor_id();
301 301
diff --git a/arch/sh/kernel/cpu/sh2/probe.c b/arch/sh/kernel/cpu/sh2/probe.c
index bab8e75958ae..6c687ae812ef 100644
--- a/arch/sh/kernel/cpu/sh2/probe.c
+++ b/arch/sh/kernel/cpu/sh2/probe.c
@@ -13,7 +13,7 @@
13#include <asm/processor.h> 13#include <asm/processor.h>
14#include <asm/cache.h> 14#include <asm/cache.h>
15 15
16void __cpuinit cpu_probe(void) 16void cpu_probe(void)
17{ 17{
18#if defined(CONFIG_CPU_SUBTYPE_SH7619) 18#if defined(CONFIG_CPU_SUBTYPE_SH7619)
19 boot_cpu_data.type = CPU_SH7619; 19 boot_cpu_data.type = CPU_SH7619;
diff --git a/arch/sh/kernel/cpu/sh2/setup-sh7619.c b/arch/sh/kernel/cpu/sh2/setup-sh7619.c
index e0b740c831c7..bb11e1925178 100644
--- a/arch/sh/kernel/cpu/sh2/setup-sh7619.c
+++ b/arch/sh/kernel/cpu/sh2/setup-sh7619.c
@@ -124,8 +124,8 @@ static struct resource eth_resources[] = {
124}; 124};
125 125
126static struct platform_device eth_device = { 126static struct platform_device eth_device = {
127 .name = "sh-eth", 127 .name = "sh7619-ether",
128 .id = -1, 128 .id = -1,
129 .dev = { 129 .dev = {
130 .platform_data = (void *)1, 130 .platform_data = (void *)1,
131 }, 131 },
diff --git a/arch/sh/kernel/cpu/sh2a/probe.c b/arch/sh/kernel/cpu/sh2a/probe.c
index 5170b6aa4129..3f87971082f1 100644
--- a/arch/sh/kernel/cpu/sh2a/probe.c
+++ b/arch/sh/kernel/cpu/sh2a/probe.c
@@ -13,7 +13,7 @@
13#include <asm/processor.h> 13#include <asm/processor.h>
14#include <asm/cache.h> 14#include <asm/cache.h>
15 15
16void __cpuinit cpu_probe(void) 16void cpu_probe(void)
17{ 17{
18 boot_cpu_data.family = CPU_FAMILY_SH2A; 18 boot_cpu_data.family = CPU_FAMILY_SH2A;
19 19
diff --git a/arch/sh/kernel/cpu/sh3/probe.c b/arch/sh/kernel/cpu/sh3/probe.c
index bf23c322e164..426e1e1dcedc 100644
--- a/arch/sh/kernel/cpu/sh3/probe.c
+++ b/arch/sh/kernel/cpu/sh3/probe.c
@@ -16,7 +16,7 @@
16#include <asm/cache.h> 16#include <asm/cache.h>
17#include <asm/io.h> 17#include <asm/io.h>
18 18
19void __cpuinit cpu_probe(void) 19void cpu_probe(void)
20{ 20{
21 unsigned long addr0, addr1, data0, data1, data2, data3; 21 unsigned long addr0, addr1, data0, data1, data2, data3;
22 22
diff --git a/arch/sh/kernel/cpu/sh4/probe.c b/arch/sh/kernel/cpu/sh4/probe.c
index 0fbbd50bc8ad..a521bcf50695 100644
--- a/arch/sh/kernel/cpu/sh4/probe.c
+++ b/arch/sh/kernel/cpu/sh4/probe.c
@@ -15,7 +15,7 @@
15#include <asm/processor.h> 15#include <asm/processor.h>
16#include <asm/cache.h> 16#include <asm/cache.h>
17 17
18void __cpuinit cpu_probe(void) 18void cpu_probe(void)
19{ 19{
20 unsigned long pvr, prr, cvr; 20 unsigned long pvr, prr, cvr;
21 unsigned long size; 21 unsigned long size;
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
index 5f30f805d2f2..0128af3399b7 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
@@ -329,7 +329,7 @@ static struct clk_lookup lookups[] = {
329 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[HWBLK_IIC0]), 329 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[HWBLK_IIC0]),
330 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[HWBLK_IIC1]), 330 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[HWBLK_IIC1]),
331 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[HWBLK_MMC]), 331 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[HWBLK_MMC]),
332 CLKDEV_DEV_ID("sh-eth.0", &mstp_clks[HWBLK_ETHER]), 332 CLKDEV_DEV_ID("sh7724-ether.0", &mstp_clks[HWBLK_ETHER]),
333 CLKDEV_CON_ID("atapi0", &mstp_clks[HWBLK_ATAPI]), 333 CLKDEV_CON_ID("atapi0", &mstp_clks[HWBLK_ATAPI]),
334 CLKDEV_CON_ID("tpu0", &mstp_clks[HWBLK_TPU]), 334 CLKDEV_CON_ID("tpu0", &mstp_clks[HWBLK_TPU]),
335 CLKDEV_CON_ID("irda0", &mstp_clks[HWBLK_IRDA]), 335 CLKDEV_CON_ID("irda0", &mstp_clks[HWBLK_IRDA]),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7734.c b/arch/sh/kernel/cpu/sh4a/clock-sh7734.c
index deb683abacf0..ed9501519ab3 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7734.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7734.c
@@ -238,7 +238,7 @@ static struct clk_lookup lookups[] = {
238 CLKDEV_CON_ID("adc0", &mstp_clks[MSTP313]), 238 CLKDEV_CON_ID("adc0", &mstp_clks[MSTP313]),
239 CLKDEV_CON_ID("mtu0", &mstp_clks[MSTP312]), 239 CLKDEV_CON_ID("mtu0", &mstp_clks[MSTP312]),
240 CLKDEV_CON_ID("iebus0", &mstp_clks[MSTP304]), 240 CLKDEV_CON_ID("iebus0", &mstp_clks[MSTP304]),
241 CLKDEV_DEV_ID("sh-eth.0", &mstp_clks[MSTP114]), 241 CLKDEV_DEV_ID("sh7734-gether.0", &mstp_clks[MSTP114]),
242 CLKDEV_CON_ID("rtc0", &mstp_clks[MSTP303]), 242 CLKDEV_CON_ID("rtc0", &mstp_clks[MSTP303]),
243 CLKDEV_CON_ID("hif0", &mstp_clks[MSTP302]), 243 CLKDEV_CON_ID("hif0", &mstp_clks[MSTP302]),
244 CLKDEV_CON_ID("stif0", &mstp_clks[MSTP301]), 244 CLKDEV_CON_ID("stif0", &mstp_clks[MSTP301]),
diff --git a/arch/sh/kernel/cpu/sh4a/smp-shx3.c b/arch/sh/kernel/cpu/sh4a/smp-shx3.c
index 03f2b55757cf..4a298808789c 100644
--- a/arch/sh/kernel/cpu/sh4a/smp-shx3.c
+++ b/arch/sh/kernel/cpu/sh4a/smp-shx3.c
@@ -124,7 +124,7 @@ static void shx3_update_boot_vector(unsigned int cpu)
124 __raw_writel(STBCR_RESET, STBCR_REG(cpu)); 124 __raw_writel(STBCR_RESET, STBCR_REG(cpu));
125} 125}
126 126
127static int __cpuinit 127static int
128shx3_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) 128shx3_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
129{ 129{
130 unsigned int cpu = (unsigned int)hcpu; 130 unsigned int cpu = (unsigned int)hcpu;
@@ -143,11 +143,11 @@ shx3_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
143 return NOTIFY_OK; 143 return NOTIFY_OK;
144} 144}
145 145
146static struct notifier_block __cpuinitdata shx3_cpu_notifier = { 146static struct notifier_block shx3_cpu_notifier = {
147 .notifier_call = shx3_cpu_callback, 147 .notifier_call = shx3_cpu_callback,
148}; 148};
149 149
150static int __cpuinit register_shx3_cpu_notifier(void) 150static int register_shx3_cpu_notifier(void)
151{ 151{
152 register_hotcpu_notifier(&shx3_cpu_notifier); 152 register_hotcpu_notifier(&shx3_cpu_notifier);
153 return 0; 153 return 0;
diff --git a/arch/sh/kernel/cpu/sh5/probe.c b/arch/sh/kernel/cpu/sh5/probe.c
index 9e882409e4e9..eca427c2f2f3 100644
--- a/arch/sh/kernel/cpu/sh5/probe.c
+++ b/arch/sh/kernel/cpu/sh5/probe.c
@@ -17,7 +17,7 @@
17#include <asm/cache.h> 17#include <asm/cache.h>
18#include <asm/tlb.h> 18#include <asm/tlb.h>
19 19
20void __cpuinit cpu_probe(void) 20void cpu_probe(void)
21{ 21{
22 unsigned long long cir; 22 unsigned long long cir;
23 23
diff --git a/arch/sh/kernel/perf_event.c b/arch/sh/kernel/perf_event.c
index 068b8a2759b5..b9cefebda55c 100644
--- a/arch/sh/kernel/perf_event.c
+++ b/arch/sh/kernel/perf_event.c
@@ -367,7 +367,7 @@ static void sh_pmu_setup(int cpu)
367 memset(cpuhw, 0, sizeof(struct cpu_hw_events)); 367 memset(cpuhw, 0, sizeof(struct cpu_hw_events));
368} 368}
369 369
370static int __cpuinit 370static int
371sh_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu) 371sh_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
372{ 372{
373 unsigned int cpu = (long)hcpu; 373 unsigned int cpu = (long)hcpu;
@@ -384,7 +384,7 @@ sh_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
384 return NOTIFY_OK; 384 return NOTIFY_OK;
385} 385}
386 386
387int __cpuinit register_sh_pmu(struct sh_pmu *_pmu) 387int register_sh_pmu(struct sh_pmu *_pmu)
388{ 388{
389 if (sh_pmu) 389 if (sh_pmu)
390 return -EBUSY; 390 return -EBUSY;
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index 055d91b70305..53bc6c4c84ec 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -65,7 +65,7 @@ void arch_task_cache_init(void)
65# define HAVE_SOFTFP 0 65# define HAVE_SOFTFP 0
66#endif 66#endif
67 67
68void __cpuinit init_thread_xstate(void) 68void init_thread_xstate(void)
69{ 69{
70 if (boot_cpu_data.flags & CPU_HAS_FPU) 70 if (boot_cpu_data.flags & CPU_HAS_FPU)
71 xstate_size = sizeof(struct sh_fpu_hard_struct); 71 xstate_size = sizeof(struct sh_fpu_hard_struct);
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index 81f999a672f6..668c81631c08 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -117,11 +117,7 @@ void user_enable_single_step(struct task_struct *child)
117 117
118 set_tsk_thread_flag(child, TIF_SINGLESTEP); 118 set_tsk_thread_flag(child, TIF_SINGLESTEP);
119 119
120 if (ptrace_get_breakpoints(child) < 0)
121 return;
122
123 set_single_step(child, pc); 120 set_single_step(child, pc);
124 ptrace_put_breakpoints(child);
125} 121}
126 122
127void user_disable_single_step(struct task_struct *child) 123void user_disable_single_step(struct task_struct *child)
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index ebe7a7d97215..1cf90e947dbf 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -172,7 +172,7 @@ disable:
172#endif 172#endif
173} 173}
174 174
175void __cpuinit calibrate_delay(void) 175void calibrate_delay(void)
176{ 176{
177 struct clk *clk = clk_get(NULL, "cpu_clk"); 177 struct clk *clk = clk_get(NULL, "cpu_clk");
178 178
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c
index 45696451f0ea..86a7936a980b 100644
--- a/arch/sh/kernel/smp.c
+++ b/arch/sh/kernel/smp.c
@@ -37,7 +37,7 @@ struct plat_smp_ops *mp_ops = NULL;
37/* State of each CPU */ 37/* State of each CPU */
38DEFINE_PER_CPU(int, cpu_state) = { 0 }; 38DEFINE_PER_CPU(int, cpu_state) = { 0 };
39 39
40void __cpuinit register_smp_ops(struct plat_smp_ops *ops) 40void register_smp_ops(struct plat_smp_ops *ops)
41{ 41{
42 if (mp_ops) 42 if (mp_ops)
43 printk(KERN_WARNING "Overriding previously set SMP ops\n"); 43 printk(KERN_WARNING "Overriding previously set SMP ops\n");
@@ -45,7 +45,7 @@ void __cpuinit register_smp_ops(struct plat_smp_ops *ops)
45 mp_ops = ops; 45 mp_ops = ops;
46} 46}
47 47
48static inline void __cpuinit smp_store_cpu_info(unsigned int cpu) 48static inline void smp_store_cpu_info(unsigned int cpu)
49{ 49{
50 struct sh_cpuinfo *c = cpu_data + cpu; 50 struct sh_cpuinfo *c = cpu_data + cpu;
51 51
@@ -174,7 +174,7 @@ void native_play_dead(void)
174} 174}
175#endif 175#endif
176 176
177asmlinkage void __cpuinit start_secondary(void) 177asmlinkage void start_secondary(void)
178{ 178{
179 unsigned int cpu = smp_processor_id(); 179 unsigned int cpu = smp_processor_id();
180 struct mm_struct *mm = &init_mm; 180 struct mm_struct *mm = &init_mm;
@@ -215,7 +215,7 @@ extern struct {
215 void *thread_info; 215 void *thread_info;
216} stack_start; 216} stack_start;
217 217
218int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tsk) 218int __cpu_up(unsigned int cpu, struct task_struct *tsk)
219{ 219{
220 unsigned long timeout; 220 unsigned long timeout;
221 221
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c
index 5f513a64dedf..68e99f09171d 100644
--- a/arch/sh/kernel/traps_32.c
+++ b/arch/sh/kernel/traps_32.c
@@ -741,7 +741,7 @@ asmlinkage void do_exception_error(unsigned long r4, unsigned long r5,
741 die_if_kernel("exception", regs, ex); 741 die_if_kernel("exception", regs, ex);
742} 742}
743 743
744void __cpuinit per_cpu_trap_init(void) 744void per_cpu_trap_init(void)
745{ 745{
746 extern void *vbr_base; 746 extern void *vbr_base;
747 747
diff --git a/arch/sh/kernel/traps_64.c b/arch/sh/kernel/traps_64.c
index f87d20da1791..112ea11c030d 100644
--- a/arch/sh/kernel/traps_64.c
+++ b/arch/sh/kernel/traps_64.c
@@ -810,7 +810,7 @@ asmlinkage void do_debug_interrupt(unsigned long code, struct pt_regs *regs)
810 poke_real_address_q(DM_EXP_CAUSE_PHY, 0x0); 810 poke_real_address_q(DM_EXP_CAUSE_PHY, 0x0);
811} 811}
812 812
813void __cpuinit per_cpu_trap_init(void) 813void per_cpu_trap_init(void)
814{ 814{
815 /* Nothing to do for now, VBR initialization later. */ 815 /* Nothing to do for now, VBR initialization later. */
816} 816}
diff --git a/arch/sh/mm/tlb-sh5.c b/arch/sh/mm/tlb-sh5.c
index ff1c40a31cbc..e4bb2a8e0a69 100644
--- a/arch/sh/mm/tlb-sh5.c
+++ b/arch/sh/mm/tlb-sh5.c
@@ -17,7 +17,7 @@
17/** 17/**
18 * sh64_tlb_init - Perform initial setup for the DTLB and ITLB. 18 * sh64_tlb_init - Perform initial setup for the DTLB and ITLB.
19 */ 19 */
20int __cpuinit sh64_tlb_init(void) 20int sh64_tlb_init(void)
21{ 21{
22 /* Assign some sane DTLB defaults */ 22 /* Assign some sane DTLB defaults */
23 cpu_data->dtlb.entries = 64; 23 cpu_data->dtlb.entries = 64;
diff --git a/arch/sparc/include/asm/leon.h b/arch/sparc/include/asm/leon.h
index b836e9297f2a..c2f6ff6d7a35 100644
--- a/arch/sparc/include/asm/leon.h
+++ b/arch/sparc/include/asm/leon.h
@@ -108,7 +108,7 @@ static inline int sparc_leon3_snooping_enabled(void)
108{ 108{
109 u32 cctrl; 109 u32 cctrl;
110 __asm__ __volatile__("lda [%%g0] 2, %0\n\t" : "=r"(cctrl)); 110 __asm__ __volatile__("lda [%%g0] 2, %0\n\t" : "=r"(cctrl));
111 return (cctrl >> 23) & 1; 111 return ((cctrl >> 23) & 1) && ((cctrl >> 17) & 1);
112}; 112};
113 113
114static inline void sparc_leon3_disable_cache(void) 114static inline void sparc_leon3_disable_cache(void)
diff --git a/arch/sparc/include/uapi/asm/fcntl.h b/arch/sparc/include/uapi/asm/fcntl.h
index d73e5e008b0d..7e8ace5bf760 100644
--- a/arch/sparc/include/uapi/asm/fcntl.h
+++ b/arch/sparc/include/uapi/asm/fcntl.h
@@ -35,7 +35,7 @@
35#define O_SYNC (__O_SYNC|O_DSYNC) 35#define O_SYNC (__O_SYNC|O_DSYNC)
36 36
37#define O_PATH 0x1000000 37#define O_PATH 0x1000000
38#define O_TMPFILE 0x2000000 38#define __O_TMPFILE 0x2000000
39 39
40#define F_GETOWN 5 /* for sockets. */ 40#define F_GETOWN 5 /* for sockets. */
41#define F_SETOWN 6 /* for sockets. */ 41#define F_SETOWN 6 /* for sockets. */
diff --git a/arch/sparc/include/uapi/asm/socket.h b/arch/sparc/include/uapi/asm/socket.h
index 89f49b68a21c..4e1d66c3ce71 100644
--- a/arch/sparc/include/uapi/asm/socket.h
+++ b/arch/sparc/include/uapi/asm/socket.h
@@ -70,6 +70,8 @@
70 70
71#define SO_SELECT_ERR_QUEUE 0x0029 71#define SO_SELECT_ERR_QUEUE 0x0029
72 72
73#define SO_BUSY_POLL 0x0030
74
73/* Security levels - as per NRL IPv6 - don't actually do anything */ 75/* Security levels - as per NRL IPv6 - don't actually do anything */
74#define SO_SECURITY_AUTHENTICATION 0x5001 76#define SO_SECURITY_AUTHENTICATION 0x5001
75#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002 77#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
diff --git a/arch/sparc/kernel/asm-offsets.c b/arch/sparc/kernel/asm-offsets.c
index 961b87f99e69..f76389a32342 100644
--- a/arch/sparc/kernel/asm-offsets.c
+++ b/arch/sparc/kernel/asm-offsets.c
@@ -49,6 +49,8 @@ int foo(void)
49 DEFINE(AOFF_task_thread, offsetof(struct task_struct, thread)); 49 DEFINE(AOFF_task_thread, offsetof(struct task_struct, thread));
50 BLANK(); 50 BLANK();
51 DEFINE(AOFF_mm_context, offsetof(struct mm_struct, context)); 51 DEFINE(AOFF_mm_context, offsetof(struct mm_struct, context));
52 BLANK();
53 DEFINE(VMA_VM_MM, offsetof(struct vm_area_struct, vm_mm));
52 54
53 /* DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28); */ 55 /* DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28); */
54 return 0; 56 return 0;
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c
index 5ef48dab5636..62d6b153ffa2 100644
--- a/arch/sparc/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
@@ -528,10 +528,8 @@ static void dr_cpu_mark(struct ds_data *resp, int cpu, int ncpus,
528 } 528 }
529} 529}
530 530
531static int __cpuinit dr_cpu_configure(struct ds_info *dp, 531static int dr_cpu_configure(struct ds_info *dp, struct ds_cap_state *cp,
532 struct ds_cap_state *cp, 532 u64 req_num, cpumask_t *mask)
533 u64 req_num,
534 cpumask_t *mask)
535{ 533{
536 struct ds_data *resp; 534 struct ds_data *resp;
537 int resp_len, ncpus, cpu; 535 int resp_len, ncpus, cpu;
@@ -627,9 +625,8 @@ static int dr_cpu_unconfigure(struct ds_info *dp,
627 return 0; 625 return 0;
628} 626}
629 627
630static void __cpuinit dr_cpu_data(struct ds_info *dp, 628static void dr_cpu_data(struct ds_info *dp, struct ds_cap_state *cp, void *buf,
631 struct ds_cap_state *cp, 629 int len)
632 void *buf, int len)
633{ 630{
634 struct ds_data *data = buf; 631 struct ds_data *data = buf;
635 struct dr_cpu_tag *tag = (struct dr_cpu_tag *) (data + 1); 632 struct dr_cpu_tag *tag = (struct dr_cpu_tag *) (data + 1);
@@ -783,6 +780,16 @@ void ldom_set_var(const char *var, const char *value)
783 char *base, *p; 780 char *base, *p;
784 int msg_len, loops; 781 int msg_len, loops;
785 782
783 if (strlen(var) + strlen(value) + 2 >
784 sizeof(pkt) - sizeof(pkt.header)) {
785 printk(KERN_ERR PFX
786 "contents length: %zu, which more than max: %lu,"
787 "so could not set (%s) variable to (%s).\n",
788 strlen(var) + strlen(value) + 2,
789 sizeof(pkt) - sizeof(pkt.header), var, value);
790 return;
791 }
792
786 memset(&pkt, 0, sizeof(pkt)); 793 memset(&pkt, 0, sizeof(pkt));
787 pkt.header.data.tag.type = DS_DATA; 794 pkt.header.data.tag.type = DS_DATA;
788 pkt.header.data.handle = cp->handle; 795 pkt.header.data.handle = cp->handle;
diff --git a/arch/sparc/kernel/entry.h b/arch/sparc/kernel/entry.h
index cc3c5cb47cda..9c179fbfb219 100644
--- a/arch/sparc/kernel/entry.h
+++ b/arch/sparc/kernel/entry.h
@@ -250,7 +250,7 @@ extern struct ino_bucket *ivector_table;
250extern unsigned long ivector_table_pa; 250extern unsigned long ivector_table_pa;
251 251
252extern void init_irqwork_curcpu(void); 252extern void init_irqwork_curcpu(void);
253extern void __cpuinit sun4v_register_mondo_queues(int this_cpu); 253extern void sun4v_register_mondo_queues(int this_cpu);
254 254
255#endif /* CONFIG_SPARC32 */ 255#endif /* CONFIG_SPARC32 */
256#endif /* _ENTRY_H */ 256#endif /* _ENTRY_H */
diff --git a/arch/sparc/kernel/hvtramp.S b/arch/sparc/kernel/hvtramp.S
index 605c960b2fa6..4eb1a5a1d544 100644
--- a/arch/sparc/kernel/hvtramp.S
+++ b/arch/sparc/kernel/hvtramp.S
@@ -16,7 +16,6 @@
16#include <asm/asi.h> 16#include <asm/asi.h>
17#include <asm/pil.h> 17#include <asm/pil.h>
18 18
19 __CPUINIT
20 .align 8 19 .align 8
21 .globl hv_cpu_startup, hv_cpu_startup_end 20 .globl hv_cpu_startup, hv_cpu_startup_end
22 21
diff --git a/arch/sparc/kernel/irq_64.c b/arch/sparc/kernel/irq_64.c
index 9bcbbe2c4e7e..d4840cec2c55 100644
--- a/arch/sparc/kernel/irq_64.c
+++ b/arch/sparc/kernel/irq_64.c
@@ -835,7 +835,8 @@ void notrace init_irqwork_curcpu(void)
835 * Therefore you cannot make any OBP calls, not even prom_printf, 835 * Therefore you cannot make any OBP calls, not even prom_printf,
836 * from these two routines. 836 * from these two routines.
837 */ 837 */
838static void __cpuinit notrace register_one_mondo(unsigned long paddr, unsigned long type, unsigned long qmask) 838static void notrace register_one_mondo(unsigned long paddr, unsigned long type,
839 unsigned long qmask)
839{ 840{
840 unsigned long num_entries = (qmask + 1) / 64; 841 unsigned long num_entries = (qmask + 1) / 64;
841 unsigned long status; 842 unsigned long status;
@@ -848,7 +849,7 @@ static void __cpuinit notrace register_one_mondo(unsigned long paddr, unsigned l
848 } 849 }
849} 850}
850 851
851void __cpuinit notrace sun4v_register_mondo_queues(int this_cpu) 852void notrace sun4v_register_mondo_queues(int this_cpu)
852{ 853{
853 struct trap_per_cpu *tb = &trap_block[this_cpu]; 854 struct trap_per_cpu *tb = &trap_block[this_cpu];
854 855
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index d7aa524b7283..6edf955f987c 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -54,7 +54,7 @@ extern ctxd_t *srmmu_ctx_table_phys;
54static int smp_processors_ready; 54static int smp_processors_ready;
55extern volatile unsigned long cpu_callin_map[NR_CPUS]; 55extern volatile unsigned long cpu_callin_map[NR_CPUS];
56extern cpumask_t smp_commenced_mask; 56extern cpumask_t smp_commenced_mask;
57void __cpuinit leon_configure_cache_smp(void); 57void leon_configure_cache_smp(void);
58static void leon_ipi_init(void); 58static void leon_ipi_init(void);
59 59
60/* IRQ number of LEON IPIs */ 60/* IRQ number of LEON IPIs */
@@ -69,12 +69,12 @@ static inline unsigned long do_swap(volatile unsigned long *ptr,
69 return val; 69 return val;
70} 70}
71 71
72void __cpuinit leon_cpu_pre_starting(void *arg) 72void leon_cpu_pre_starting(void *arg)
73{ 73{
74 leon_configure_cache_smp(); 74 leon_configure_cache_smp();
75} 75}
76 76
77void __cpuinit leon_cpu_pre_online(void *arg) 77void leon_cpu_pre_online(void *arg)
78{ 78{
79 int cpuid = hard_smp_processor_id(); 79 int cpuid = hard_smp_processor_id();
80 80
@@ -106,7 +106,7 @@ void __cpuinit leon_cpu_pre_online(void *arg)
106 106
107extern struct linux_prom_registers smp_penguin_ctable; 107extern struct linux_prom_registers smp_penguin_ctable;
108 108
109void __cpuinit leon_configure_cache_smp(void) 109void leon_configure_cache_smp(void)
110{ 110{
111 unsigned long cfg = sparc_leon3_get_dcachecfg(); 111 unsigned long cfg = sparc_leon3_get_dcachecfg();
112 int me = smp_processor_id(); 112 int me = smp_processor_id();
@@ -186,7 +186,7 @@ void __init leon_boot_cpus(void)
186 186
187} 187}
188 188
189int __cpuinit leon_boot_one_cpu(int i, struct task_struct *idle) 189int leon_boot_one_cpu(int i, struct task_struct *idle)
190{ 190{
191 int timeout; 191 int timeout;
192 192
diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
index 831c001604e8..b90bf23e3aab 100644
--- a/arch/sparc/kernel/mdesc.c
+++ b/arch/sparc/kernel/mdesc.c
@@ -571,9 +571,7 @@ static void __init report_platform_properties(void)
571 mdesc_release(hp); 571 mdesc_release(hp);
572} 572}
573 573
574static void __cpuinit fill_in_one_cache(cpuinfo_sparc *c, 574static void fill_in_one_cache(cpuinfo_sparc *c, struct mdesc_handle *hp, u64 mp)
575 struct mdesc_handle *hp,
576 u64 mp)
577{ 575{
578 const u64 *level = mdesc_get_property(hp, mp, "level", NULL); 576 const u64 *level = mdesc_get_property(hp, mp, "level", NULL);
579 const u64 *size = mdesc_get_property(hp, mp, "size", NULL); 577 const u64 *size = mdesc_get_property(hp, mp, "size", NULL);
@@ -616,7 +614,7 @@ static void __cpuinit fill_in_one_cache(cpuinfo_sparc *c,
616 } 614 }
617} 615}
618 616
619static void __cpuinit mark_core_ids(struct mdesc_handle *hp, u64 mp, int core_id) 617static void mark_core_ids(struct mdesc_handle *hp, u64 mp, int core_id)
620{ 618{
621 u64 a; 619 u64 a;
622 620
@@ -649,7 +647,7 @@ static void __cpuinit mark_core_ids(struct mdesc_handle *hp, u64 mp, int core_id
649 } 647 }
650} 648}
651 649
652static void __cpuinit set_core_ids(struct mdesc_handle *hp) 650static void set_core_ids(struct mdesc_handle *hp)
653{ 651{
654 int idx; 652 int idx;
655 u64 mp; 653 u64 mp;
@@ -674,7 +672,7 @@ static void __cpuinit set_core_ids(struct mdesc_handle *hp)
674 } 672 }
675} 673}
676 674
677static void __cpuinit mark_proc_ids(struct mdesc_handle *hp, u64 mp, int proc_id) 675static void mark_proc_ids(struct mdesc_handle *hp, u64 mp, int proc_id)
678{ 676{
679 u64 a; 677 u64 a;
680 678
@@ -693,7 +691,7 @@ static void __cpuinit mark_proc_ids(struct mdesc_handle *hp, u64 mp, int proc_id
693 } 691 }
694} 692}
695 693
696static void __cpuinit __set_proc_ids(struct mdesc_handle *hp, const char *exec_unit_name) 694static void __set_proc_ids(struct mdesc_handle *hp, const char *exec_unit_name)
697{ 695{
698 int idx; 696 int idx;
699 u64 mp; 697 u64 mp;
@@ -714,14 +712,14 @@ static void __cpuinit __set_proc_ids(struct mdesc_handle *hp, const char *exec_u
714 } 712 }
715} 713}
716 714
717static void __cpuinit set_proc_ids(struct mdesc_handle *hp) 715static void set_proc_ids(struct mdesc_handle *hp)
718{ 716{
719 __set_proc_ids(hp, "exec_unit"); 717 __set_proc_ids(hp, "exec_unit");
720 __set_proc_ids(hp, "exec-unit"); 718 __set_proc_ids(hp, "exec-unit");
721} 719}
722 720
723static void __cpuinit get_one_mondo_bits(const u64 *p, unsigned int *mask, 721static void get_one_mondo_bits(const u64 *p, unsigned int *mask,
724 unsigned long def, unsigned long max) 722 unsigned long def, unsigned long max)
725{ 723{
726 u64 val; 724 u64 val;
727 725
@@ -742,8 +740,8 @@ use_default:
742 *mask = ((1U << def) * 64U) - 1U; 740 *mask = ((1U << def) * 64U) - 1U;
743} 741}
744 742
745static void __cpuinit get_mondo_data(struct mdesc_handle *hp, u64 mp, 743static void get_mondo_data(struct mdesc_handle *hp, u64 mp,
746 struct trap_per_cpu *tb) 744 struct trap_per_cpu *tb)
747{ 745{
748 static int printed; 746 static int printed;
749 const u64 *val; 747 const u64 *val;
@@ -769,7 +767,7 @@ static void __cpuinit get_mondo_data(struct mdesc_handle *hp, u64 mp,
769 } 767 }
770} 768}
771 769
772static void * __cpuinit mdesc_iterate_over_cpus(void *(*func)(struct mdesc_handle *, u64, int, void *), void *arg, cpumask_t *mask) 770static void *mdesc_iterate_over_cpus(void *(*func)(struct mdesc_handle *, u64, int, void *), void *arg, cpumask_t *mask)
773{ 771{
774 struct mdesc_handle *hp = mdesc_grab(); 772 struct mdesc_handle *hp = mdesc_grab();
775 void *ret = NULL; 773 void *ret = NULL;
@@ -799,7 +797,8 @@ out:
799 return ret; 797 return ret;
800} 798}
801 799
802static void * __cpuinit record_one_cpu(struct mdesc_handle *hp, u64 mp, int cpuid, void *arg) 800static void *record_one_cpu(struct mdesc_handle *hp, u64 mp, int cpuid,
801 void *arg)
803{ 802{
804 ncpus_probed++; 803 ncpus_probed++;
805#ifdef CONFIG_SMP 804#ifdef CONFIG_SMP
@@ -808,7 +807,7 @@ static void * __cpuinit record_one_cpu(struct mdesc_handle *hp, u64 mp, int cpui
808 return NULL; 807 return NULL;
809} 808}
810 809
811void __cpuinit mdesc_populate_present_mask(cpumask_t *mask) 810void mdesc_populate_present_mask(cpumask_t *mask)
812{ 811{
813 if (tlb_type != hypervisor) 812 if (tlb_type != hypervisor)
814 return; 813 return;
@@ -841,7 +840,8 @@ void __init mdesc_get_page_sizes(cpumask_t *mask, unsigned long *pgsz_mask)
841 mdesc_iterate_over_cpus(check_one_pgsz, pgsz_mask, mask); 840 mdesc_iterate_over_cpus(check_one_pgsz, pgsz_mask, mask);
842} 841}
843 842
844static void * __cpuinit fill_in_one_cpu(struct mdesc_handle *hp, u64 mp, int cpuid, void *arg) 843static void *fill_in_one_cpu(struct mdesc_handle *hp, u64 mp, int cpuid,
844 void *arg)
845{ 845{
846 const u64 *cfreq = mdesc_get_property(hp, mp, "clock-frequency", NULL); 846 const u64 *cfreq = mdesc_get_property(hp, mp, "clock-frequency", NULL);
847 struct trap_per_cpu *tb; 847 struct trap_per_cpu *tb;
@@ -890,7 +890,7 @@ static void * __cpuinit fill_in_one_cpu(struct mdesc_handle *hp, u64 mp, int cpu
890 return NULL; 890 return NULL;
891} 891}
892 892
893void __cpuinit mdesc_fill_in_cpu_data(cpumask_t *mask) 893void mdesc_fill_in_cpu_data(cpumask_t *mask)
894{ 894{
895 struct mdesc_handle *hp; 895 struct mdesc_handle *hp;
896 896
diff --git a/arch/sparc/kernel/smp_32.c b/arch/sparc/kernel/smp_32.c
index e3f2b81c23f1..a102bfba6ea8 100644
--- a/arch/sparc/kernel/smp_32.c
+++ b/arch/sparc/kernel/smp_32.c
@@ -39,7 +39,7 @@
39#include "kernel.h" 39#include "kernel.h"
40#include "irq.h" 40#include "irq.h"
41 41
42volatile unsigned long cpu_callin_map[NR_CPUS] __cpuinitdata = {0,}; 42volatile unsigned long cpu_callin_map[NR_CPUS] = {0,};
43 43
44cpumask_t smp_commenced_mask = CPU_MASK_NONE; 44cpumask_t smp_commenced_mask = CPU_MASK_NONE;
45 45
@@ -53,7 +53,7 @@ const struct sparc32_ipi_ops *sparc32_ipi_ops;
53 * instruction which is much better... 53 * instruction which is much better...
54 */ 54 */
55 55
56void __cpuinit smp_store_cpu_info(int id) 56void smp_store_cpu_info(int id)
57{ 57{
58 int cpu_node; 58 int cpu_node;
59 int mid; 59 int mid;
@@ -120,7 +120,7 @@ void cpu_panic(void)
120 panic("SMP bolixed\n"); 120 panic("SMP bolixed\n");
121} 121}
122 122
123struct linux_prom_registers smp_penguin_ctable __cpuinitdata = { 0 }; 123struct linux_prom_registers smp_penguin_ctable = { 0 };
124 124
125void smp_send_reschedule(int cpu) 125void smp_send_reschedule(int cpu)
126{ 126{
@@ -259,10 +259,10 @@ void __init smp_prepare_boot_cpu(void)
259 set_cpu_possible(cpuid, true); 259 set_cpu_possible(cpuid, true);
260} 260}
261 261
262int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) 262int __cpu_up(unsigned int cpu, struct task_struct *tidle)
263{ 263{
264 extern int __cpuinit smp4m_boot_one_cpu(int, struct task_struct *); 264 extern int smp4m_boot_one_cpu(int, struct task_struct *);
265 extern int __cpuinit smp4d_boot_one_cpu(int, struct task_struct *); 265 extern int smp4d_boot_one_cpu(int, struct task_struct *);
266 int ret=0; 266 int ret=0;
267 267
268 switch(sparc_cpu_model) { 268 switch(sparc_cpu_model) {
@@ -297,7 +297,7 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle)
297 return ret; 297 return ret;
298} 298}
299 299
300void __cpuinit arch_cpu_pre_starting(void *arg) 300void arch_cpu_pre_starting(void *arg)
301{ 301{
302 local_ops->cache_all(); 302 local_ops->cache_all();
303 local_ops->tlb_all(); 303 local_ops->tlb_all();
@@ -317,7 +317,7 @@ void __cpuinit arch_cpu_pre_starting(void *arg)
317 } 317 }
318} 318}
319 319
320void __cpuinit arch_cpu_pre_online(void *arg) 320void arch_cpu_pre_online(void *arg)
321{ 321{
322 unsigned int cpuid = hard_smp_processor_id(); 322 unsigned int cpuid = hard_smp_processor_id();
323 323
@@ -344,7 +344,7 @@ void __cpuinit arch_cpu_pre_online(void *arg)
344 } 344 }
345} 345}
346 346
347void __cpuinit sparc_start_secondary(void *arg) 347void sparc_start_secondary(void *arg)
348{ 348{
349 unsigned int cpu; 349 unsigned int cpu;
350 350
@@ -375,7 +375,7 @@ void __cpuinit sparc_start_secondary(void *arg)
375 BUG(); 375 BUG();
376} 376}
377 377
378void __cpuinit smp_callin(void) 378void smp_callin(void)
379{ 379{
380 sparc_start_secondary(NULL); 380 sparc_start_secondary(NULL);
381} 381}
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index 77539eda928c..e142545244f2 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -87,7 +87,7 @@ extern void setup_sparc64_timer(void);
87 87
88static volatile unsigned long callin_flag = 0; 88static volatile unsigned long callin_flag = 0;
89 89
90void __cpuinit smp_callin(void) 90void smp_callin(void)
91{ 91{
92 int cpuid = hard_smp_processor_id(); 92 int cpuid = hard_smp_processor_id();
93 93
@@ -281,7 +281,8 @@ static unsigned long kimage_addr_to_ra(void *p)
281 return kern_base + (val - KERNBASE); 281 return kern_base + (val - KERNBASE);
282} 282}
283 283
284static void __cpuinit ldom_startcpu_cpuid(unsigned int cpu, unsigned long thread_reg, void **descrp) 284static void ldom_startcpu_cpuid(unsigned int cpu, unsigned long thread_reg,
285 void **descrp)
285{ 286{
286 extern unsigned long sparc64_ttable_tl0; 287 extern unsigned long sparc64_ttable_tl0;
287 extern unsigned long kern_locked_tte_data; 288 extern unsigned long kern_locked_tte_data;
@@ -342,7 +343,7 @@ extern unsigned long sparc64_cpu_startup;
342 */ 343 */
343static struct thread_info *cpu_new_thread = NULL; 344static struct thread_info *cpu_new_thread = NULL;
344 345
345static int __cpuinit smp_boot_one_cpu(unsigned int cpu, struct task_struct *idle) 346static int smp_boot_one_cpu(unsigned int cpu, struct task_struct *idle)
346{ 347{
347 unsigned long entry = 348 unsigned long entry =
348 (unsigned long)(&sparc64_cpu_startup); 349 (unsigned long)(&sparc64_cpu_startup);
@@ -1266,7 +1267,7 @@ void smp_fill_in_sib_core_maps(void)
1266 } 1267 }
1267} 1268}
1268 1269
1269int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) 1270int __cpu_up(unsigned int cpu, struct task_struct *tidle)
1270{ 1271{
1271 int ret = smp_boot_one_cpu(cpu, tidle); 1272 int ret = smp_boot_one_cpu(cpu, tidle);
1272 1273
diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c
index c9eb82f23d92..d5c319553fd0 100644
--- a/arch/sparc/kernel/sun4d_smp.c
+++ b/arch/sparc/kernel/sun4d_smp.c
@@ -50,7 +50,7 @@ static inline void show_leds(int cpuid)
50 "i" (ASI_M_CTL)); 50 "i" (ASI_M_CTL));
51} 51}
52 52
53void __cpuinit sun4d_cpu_pre_starting(void *arg) 53void sun4d_cpu_pre_starting(void *arg)
54{ 54{
55 int cpuid = hard_smp_processor_id(); 55 int cpuid = hard_smp_processor_id();
56 56
@@ -62,7 +62,7 @@ void __cpuinit sun4d_cpu_pre_starting(void *arg)
62 cc_set_imsk((cc_get_imsk() & ~0x8000) | 0x4000); 62 cc_set_imsk((cc_get_imsk() & ~0x8000) | 0x4000);
63} 63}
64 64
65void __cpuinit sun4d_cpu_pre_online(void *arg) 65void sun4d_cpu_pre_online(void *arg)
66{ 66{
67 unsigned long flags; 67 unsigned long flags;
68 int cpuid; 68 int cpuid;
@@ -118,7 +118,7 @@ void __init smp4d_boot_cpus(void)
118 local_ops->cache_all(); 118 local_ops->cache_all();
119} 119}
120 120
121int __cpuinit smp4d_boot_one_cpu(int i, struct task_struct *idle) 121int smp4d_boot_one_cpu(int i, struct task_struct *idle)
122{ 122{
123 unsigned long *entry = &sun4d_cpu_startup; 123 unsigned long *entry = &sun4d_cpu_startup;
124 int timeout; 124 int timeout;
diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c
index 8a65f158153d..d3408e72d20c 100644
--- a/arch/sparc/kernel/sun4m_smp.c
+++ b/arch/sparc/kernel/sun4m_smp.c
@@ -34,11 +34,11 @@ swap_ulong(volatile unsigned long *ptr, unsigned long val)
34 return val; 34 return val;
35} 35}
36 36
37void __cpuinit sun4m_cpu_pre_starting(void *arg) 37void sun4m_cpu_pre_starting(void *arg)
38{ 38{
39} 39}
40 40
41void __cpuinit sun4m_cpu_pre_online(void *arg) 41void sun4m_cpu_pre_online(void *arg)
42{ 42{
43 int cpuid = hard_smp_processor_id(); 43 int cpuid = hard_smp_processor_id();
44 44
@@ -75,7 +75,7 @@ void __init smp4m_boot_cpus(void)
75 local_ops->cache_all(); 75 local_ops->cache_all();
76} 76}
77 77
78int __cpuinit smp4m_boot_one_cpu(int i, struct task_struct *idle) 78int smp4m_boot_one_cpu(int i, struct task_struct *idle)
79{ 79{
80 unsigned long *entry = &sun4m_cpu_startup; 80 unsigned long *entry = &sun4m_cpu_startup;
81 int timeout; 81 int timeout;
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index 2daaaa6eda23..51561b8b15ba 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -290,7 +290,6 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
290 sysctl_legacy_va_layout) { 290 sysctl_legacy_va_layout) {
291 mm->mmap_base = TASK_UNMAPPED_BASE + random_factor; 291 mm->mmap_base = TASK_UNMAPPED_BASE + random_factor;
292 mm->get_unmapped_area = arch_get_unmapped_area; 292 mm->get_unmapped_area = arch_get_unmapped_area;
293 mm->unmap_area = arch_unmap_area;
294 } else { 293 } else {
295 /* We know it's 32-bit */ 294 /* We know it's 32-bit */
296 unsigned long task_size = STACK_TOP32; 295 unsigned long task_size = STACK_TOP32;
@@ -302,7 +301,6 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
302 301
303 mm->mmap_base = PAGE_ALIGN(task_size - gap - random_factor); 302 mm->mmap_base = PAGE_ALIGN(task_size - gap - random_factor);
304 mm->get_unmapped_area = arch_get_unmapped_area_topdown; 303 mm->get_unmapped_area = arch_get_unmapped_area_topdown;
305 mm->unmap_area = arch_unmap_area_topdown;
306 } 304 }
307} 305}
308 306
diff --git a/arch/sparc/kernel/sysfs.c b/arch/sparc/kernel/sysfs.c
index 654e8aad3bbe..c21c673e5f7c 100644
--- a/arch/sparc/kernel/sysfs.c
+++ b/arch/sparc/kernel/sysfs.c
@@ -246,7 +246,7 @@ static void unregister_cpu_online(unsigned int cpu)
246} 246}
247#endif 247#endif
248 248
249static int __cpuinit sysfs_cpu_notify(struct notifier_block *self, 249static int sysfs_cpu_notify(struct notifier_block *self,
250 unsigned long action, void *hcpu) 250 unsigned long action, void *hcpu)
251{ 251{
252 unsigned int cpu = (unsigned int)(long)hcpu; 252 unsigned int cpu = (unsigned int)(long)hcpu;
@@ -266,7 +266,7 @@ static int __cpuinit sysfs_cpu_notify(struct notifier_block *self,
266 return NOTIFY_OK; 266 return NOTIFY_OK;
267} 267}
268 268
269static struct notifier_block __cpuinitdata sysfs_cpu_nb = { 269static struct notifier_block sysfs_cpu_nb = {
270 .notifier_call = sysfs_cpu_notify, 270 .notifier_call = sysfs_cpu_notify,
271}; 271};
272 272
diff --git a/arch/sparc/kernel/trampoline_32.S b/arch/sparc/kernel/trampoline_32.S
index 6cdb08cdabf0..76dcbd3c988a 100644
--- a/arch/sparc/kernel/trampoline_32.S
+++ b/arch/sparc/kernel/trampoline_32.S
@@ -18,7 +18,6 @@
18 .globl sun4m_cpu_startup 18 .globl sun4m_cpu_startup
19 .globl sun4d_cpu_startup 19 .globl sun4d_cpu_startup
20 20
21 __CPUINIT
22 .align 4 21 .align 4
23 22
24/* When we start up a cpu for the first time it enters this routine. 23/* When we start up a cpu for the first time it enters this routine.
@@ -94,7 +93,6 @@ smp_panic:
94/* CPUID in bootbus can be found at PA 0xff0140000 */ 93/* CPUID in bootbus can be found at PA 0xff0140000 */
95#define SUN4D_BOOTBUS_CPUID 0xf0140000 94#define SUN4D_BOOTBUS_CPUID 0xf0140000
96 95
97 __CPUINIT
98 .align 4 96 .align 4
99 97
100sun4d_cpu_startup: 98sun4d_cpu_startup:
@@ -146,7 +144,6 @@ sun4d_cpu_startup:
146 144
147 b,a smp_panic 145 b,a smp_panic
148 146
149 __CPUINIT
150 .align 4 147 .align 4
151 .global leon_smp_cpu_startup, smp_penguin_ctable 148 .global leon_smp_cpu_startup, smp_penguin_ctable
152 149
diff --git a/arch/sparc/kernel/trampoline_64.S b/arch/sparc/kernel/trampoline_64.S
index 2e973a26fbda..e0b1e13a0736 100644
--- a/arch/sparc/kernel/trampoline_64.S
+++ b/arch/sparc/kernel/trampoline_64.S
@@ -32,13 +32,11 @@ itlb_load:
32dtlb_load: 32dtlb_load:
33 .asciz "SUNW,dtlb-load" 33 .asciz "SUNW,dtlb-load"
34 34
35 /* XXX __cpuinit this thing XXX */
36#define TRAMP_STACK_SIZE 1024 35#define TRAMP_STACK_SIZE 1024
37 .align 16 36 .align 16
38tramp_stack: 37tramp_stack:
39 .skip TRAMP_STACK_SIZE 38 .skip TRAMP_STACK_SIZE
40 39
41 __CPUINIT
42 .align 8 40 .align 8
43 .globl sparc64_cpu_startup, sparc64_cpu_startup_end 41 .globl sparc64_cpu_startup, sparc64_cpu_startup_end
44sparc64_cpu_startup: 42sparc64_cpu_startup:
diff --git a/arch/sparc/mm/hypersparc.S b/arch/sparc/mm/hypersparc.S
index 44aad32eeb4e..969f96450f69 100644
--- a/arch/sparc/mm/hypersparc.S
+++ b/arch/sparc/mm/hypersparc.S
@@ -74,7 +74,7 @@ hypersparc_flush_cache_mm_out:
74 74
75 /* The things we do for performance... */ 75 /* The things we do for performance... */
76hypersparc_flush_cache_range: 76hypersparc_flush_cache_range:
77 ld [%o0 + 0x0], %o0 /* XXX vma->vm_mm, GROSS XXX */ 77 ld [%o0 + VMA_VM_MM], %o0
78#ifndef CONFIG_SMP 78#ifndef CONFIG_SMP
79 ld [%o0 + AOFF_mm_context], %g1 79 ld [%o0 + AOFF_mm_context], %g1
80 cmp %g1, -1 80 cmp %g1, -1
@@ -163,7 +163,7 @@ hypersparc_flush_cache_range_out:
163 */ 163 */
164 /* Verified, my ass... */ 164 /* Verified, my ass... */
165hypersparc_flush_cache_page: 165hypersparc_flush_cache_page:
166 ld [%o0 + 0x0], %o0 /* XXX vma->vm_mm, GROSS XXX */ 166 ld [%o0 + VMA_VM_MM], %o0
167 ld [%o0 + AOFF_mm_context], %g2 167 ld [%o0 + AOFF_mm_context], %g2
168#ifndef CONFIG_SMP 168#ifndef CONFIG_SMP
169 cmp %g2, -1 169 cmp %g2, -1
@@ -284,7 +284,7 @@ hypersparc_flush_tlb_mm_out:
284 sta %g5, [%g1] ASI_M_MMUREGS 284 sta %g5, [%g1] ASI_M_MMUREGS
285 285
286hypersparc_flush_tlb_range: 286hypersparc_flush_tlb_range:
287 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 287 ld [%o0 + VMA_VM_MM], %o0
288 mov SRMMU_CTX_REG, %g1 288 mov SRMMU_CTX_REG, %g1
289 ld [%o0 + AOFF_mm_context], %o3 289 ld [%o0 + AOFF_mm_context], %o3
290 lda [%g1] ASI_M_MMUREGS, %g5 290 lda [%g1] ASI_M_MMUREGS, %g5
@@ -307,7 +307,7 @@ hypersparc_flush_tlb_range_out:
307 sta %g5, [%g1] ASI_M_MMUREGS 307 sta %g5, [%g1] ASI_M_MMUREGS
308 308
309hypersparc_flush_tlb_page: 309hypersparc_flush_tlb_page:
310 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 310 ld [%o0 + VMA_VM_MM], %o0
311 mov SRMMU_CTX_REG, %g1 311 mov SRMMU_CTX_REG, %g1
312 ld [%o0 + AOFF_mm_context], %o3 312 ld [%o0 + AOFF_mm_context], %o3
313 andn %o1, (PAGE_SIZE - 1), %o1 313 andn %o1, (PAGE_SIZE - 1), %o1
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index a9c42a7ffb6a..ed82edad1a39 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -1694,7 +1694,7 @@ static void __init sun4v_ktsb_init(void)
1694#endif 1694#endif
1695} 1695}
1696 1696
1697void __cpuinit sun4v_ktsb_register(void) 1697void sun4v_ktsb_register(void)
1698{ 1698{
1699 unsigned long pa, ret; 1699 unsigned long pa, ret;
1700 1700
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index 036c2797dece..5d721df48a72 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -858,7 +858,7 @@ static void __init map_kernel(void)
858 } 858 }
859} 859}
860 860
861void (*poke_srmmu)(void) __cpuinitdata = NULL; 861void (*poke_srmmu)(void) = NULL;
862 862
863extern unsigned long bootmem_init(unsigned long *pages_avail); 863extern unsigned long bootmem_init(unsigned long *pages_avail);
864 864
@@ -1055,7 +1055,7 @@ static void __init init_vac_layout(void)
1055 (int)vac_cache_size, (int)vac_line_size); 1055 (int)vac_cache_size, (int)vac_line_size);
1056} 1056}
1057 1057
1058static void __cpuinit poke_hypersparc(void) 1058static void poke_hypersparc(void)
1059{ 1059{
1060 volatile unsigned long clear; 1060 volatile unsigned long clear;
1061 unsigned long mreg = srmmu_get_mmureg(); 1061 unsigned long mreg = srmmu_get_mmureg();
@@ -1107,7 +1107,7 @@ static void __init init_hypersparc(void)
1107 hypersparc_setup_blockops(); 1107 hypersparc_setup_blockops();
1108} 1108}
1109 1109
1110static void __cpuinit poke_swift(void) 1110static void poke_swift(void)
1111{ 1111{
1112 unsigned long mreg; 1112 unsigned long mreg;
1113 1113
@@ -1287,7 +1287,7 @@ static void turbosparc_flush_tlb_page(struct vm_area_struct *vma, unsigned long
1287} 1287}
1288 1288
1289 1289
1290static void __cpuinit poke_turbosparc(void) 1290static void poke_turbosparc(void)
1291{ 1291{
1292 unsigned long mreg = srmmu_get_mmureg(); 1292 unsigned long mreg = srmmu_get_mmureg();
1293 unsigned long ccreg; 1293 unsigned long ccreg;
@@ -1350,7 +1350,7 @@ static void __init init_turbosparc(void)
1350 poke_srmmu = poke_turbosparc; 1350 poke_srmmu = poke_turbosparc;
1351} 1351}
1352 1352
1353static void __cpuinit poke_tsunami(void) 1353static void poke_tsunami(void)
1354{ 1354{
1355 unsigned long mreg = srmmu_get_mmureg(); 1355 unsigned long mreg = srmmu_get_mmureg();
1356 1356
@@ -1391,7 +1391,7 @@ static void __init init_tsunami(void)
1391 tsunami_setup_blockops(); 1391 tsunami_setup_blockops();
1392} 1392}
1393 1393
1394static void __cpuinit poke_viking(void) 1394static void poke_viking(void)
1395{ 1395{
1396 unsigned long mreg = srmmu_get_mmureg(); 1396 unsigned long mreg = srmmu_get_mmureg();
1397 static int smp_catch; 1397 static int smp_catch;
diff --git a/arch/sparc/mm/swift.S b/arch/sparc/mm/swift.S
index c801c3953a00..5d2b88d39424 100644
--- a/arch/sparc/mm/swift.S
+++ b/arch/sparc/mm/swift.S
@@ -105,7 +105,7 @@ swift_flush_cache_mm_out:
105 105
106 .globl swift_flush_cache_range 106 .globl swift_flush_cache_range
107swift_flush_cache_range: 107swift_flush_cache_range:
108 ld [%o0 + 0x0], %o0 /* XXX vma->vm_mm, GROSS XXX */ 108 ld [%o0 + VMA_VM_MM], %o0
109 sub %o2, %o1, %o2 109 sub %o2, %o1, %o2
110 sethi %hi(4096), %o3 110 sethi %hi(4096), %o3
111 cmp %o2, %o3 111 cmp %o2, %o3
@@ -116,7 +116,7 @@ swift_flush_cache_range:
116 116
117 .globl swift_flush_cache_page 117 .globl swift_flush_cache_page
118swift_flush_cache_page: 118swift_flush_cache_page:
119 ld [%o0 + 0x0], %o0 /* XXX vma->vm_mm, GROSS XXX */ 119 ld [%o0 + VMA_VM_MM], %o0
12070: 12070:
121 ld [%o0 + AOFF_mm_context], %g2 121 ld [%o0 + AOFF_mm_context], %g2
122 cmp %g2, -1 122 cmp %g2, -1
@@ -219,7 +219,7 @@ swift_flush_sig_insns:
219 .globl swift_flush_tlb_range 219 .globl swift_flush_tlb_range
220 .globl swift_flush_tlb_all 220 .globl swift_flush_tlb_all
221swift_flush_tlb_range: 221swift_flush_tlb_range:
222 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 222 ld [%o0 + VMA_VM_MM], %o0
223swift_flush_tlb_mm: 223swift_flush_tlb_mm:
224 ld [%o0 + AOFF_mm_context], %g2 224 ld [%o0 + AOFF_mm_context], %g2
225 cmp %g2, -1 225 cmp %g2, -1
@@ -233,7 +233,7 @@ swift_flush_tlb_all_out:
233 233
234 .globl swift_flush_tlb_page 234 .globl swift_flush_tlb_page
235swift_flush_tlb_page: 235swift_flush_tlb_page:
236 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 236 ld [%o0 + VMA_VM_MM], %o0
237 mov SRMMU_CTX_REG, %g1 237 mov SRMMU_CTX_REG, %g1
238 ld [%o0 + AOFF_mm_context], %o3 238 ld [%o0 + AOFF_mm_context], %o3
239 andn %o1, (PAGE_SIZE - 1), %o1 239 andn %o1, (PAGE_SIZE - 1), %o1
diff --git a/arch/sparc/mm/tsunami.S b/arch/sparc/mm/tsunami.S
index 4e55e8f76648..bf10a345fa8b 100644
--- a/arch/sparc/mm/tsunami.S
+++ b/arch/sparc/mm/tsunami.S
@@ -24,7 +24,7 @@
24 /* Sliiick... */ 24 /* Sliiick... */
25tsunami_flush_cache_page: 25tsunami_flush_cache_page:
26tsunami_flush_cache_range: 26tsunami_flush_cache_range:
27 ld [%o0 + 0x0], %o0 /* XXX vma->vm_mm, GROSS XXX */ 27 ld [%o0 + VMA_VM_MM], %o0
28tsunami_flush_cache_mm: 28tsunami_flush_cache_mm:
29 ld [%o0 + AOFF_mm_context], %g2 29 ld [%o0 + AOFF_mm_context], %g2
30 cmp %g2, -1 30 cmp %g2, -1
@@ -46,7 +46,7 @@ tsunami_flush_sig_insns:
46 46
47 /* More slick stuff... */ 47 /* More slick stuff... */
48tsunami_flush_tlb_range: 48tsunami_flush_tlb_range:
49 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 49 ld [%o0 + VMA_VM_MM], %o0
50tsunami_flush_tlb_mm: 50tsunami_flush_tlb_mm:
51 ld [%o0 + AOFF_mm_context], %g2 51 ld [%o0 + AOFF_mm_context], %g2
52 cmp %g2, -1 52 cmp %g2, -1
@@ -65,7 +65,7 @@ tsunami_flush_tlb_out:
65 65
66 /* This one can be done in a fine grained manner... */ 66 /* This one can be done in a fine grained manner... */
67tsunami_flush_tlb_page: 67tsunami_flush_tlb_page:
68 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 68 ld [%o0 + VMA_VM_MM], %o0
69 mov SRMMU_CTX_REG, %g1 69 mov SRMMU_CTX_REG, %g1
70 ld [%o0 + AOFF_mm_context], %o3 70 ld [%o0 + AOFF_mm_context], %o3
71 andn %o1, (PAGE_SIZE - 1), %o1 71 andn %o1, (PAGE_SIZE - 1), %o1
diff --git a/arch/sparc/mm/viking.S b/arch/sparc/mm/viking.S
index bf8ee0613ae7..852257fcc82b 100644
--- a/arch/sparc/mm/viking.S
+++ b/arch/sparc/mm/viking.S
@@ -108,7 +108,7 @@ viking_mxcc_flush_page:
108viking_flush_cache_page: 108viking_flush_cache_page:
109viking_flush_cache_range: 109viking_flush_cache_range:
110#ifndef CONFIG_SMP 110#ifndef CONFIG_SMP
111 ld [%o0 + 0x0], %o0 /* XXX vma->vm_mm, GROSS XXX */ 111 ld [%o0 + VMA_VM_MM], %o0
112#endif 112#endif
113viking_flush_cache_mm: 113viking_flush_cache_mm:
114#ifndef CONFIG_SMP 114#ifndef CONFIG_SMP
@@ -148,7 +148,7 @@ viking_flush_tlb_mm:
148#endif 148#endif
149 149
150viking_flush_tlb_range: 150viking_flush_tlb_range:
151 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 151 ld [%o0 + VMA_VM_MM], %o0
152 mov SRMMU_CTX_REG, %g1 152 mov SRMMU_CTX_REG, %g1
153 ld [%o0 + AOFF_mm_context], %o3 153 ld [%o0 + AOFF_mm_context], %o3
154 lda [%g1] ASI_M_MMUREGS, %g5 154 lda [%g1] ASI_M_MMUREGS, %g5
@@ -173,7 +173,7 @@ viking_flush_tlb_range:
173#endif 173#endif
174 174
175viking_flush_tlb_page: 175viking_flush_tlb_page:
176 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 176 ld [%o0 + VMA_VM_MM], %o0
177 mov SRMMU_CTX_REG, %g1 177 mov SRMMU_CTX_REG, %g1
178 ld [%o0 + AOFF_mm_context], %o3 178 ld [%o0 + AOFF_mm_context], %o3
179 lda [%g1] ASI_M_MMUREGS, %g5 179 lda [%g1] ASI_M_MMUREGS, %g5
@@ -239,7 +239,7 @@ sun4dsmp_flush_tlb_range:
239 tst %g5 239 tst %g5
240 bne 3f 240 bne 3f
241 mov SRMMU_CTX_REG, %g1 241 mov SRMMU_CTX_REG, %g1
242 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 242 ld [%o0 + VMA_VM_MM], %o0
243 ld [%o0 + AOFF_mm_context], %o3 243 ld [%o0 + AOFF_mm_context], %o3
244 lda [%g1] ASI_M_MMUREGS, %g5 244 lda [%g1] ASI_M_MMUREGS, %g5
245 sethi %hi(~((1 << SRMMU_PGDIR_SHIFT) - 1)), %o4 245 sethi %hi(~((1 << SRMMU_PGDIR_SHIFT) - 1)), %o4
@@ -265,7 +265,7 @@ sun4dsmp_flush_tlb_page:
265 tst %g5 265 tst %g5
266 bne 2f 266 bne 2f
267 mov SRMMU_CTX_REG, %g1 267 mov SRMMU_CTX_REG, %g1
268 ld [%o0 + 0x00], %o0 /* XXX vma->vm_mm GROSS XXX */ 268 ld [%o0 + VMA_VM_MM], %o0
269 ld [%o0 + AOFF_mm_context], %o3 269 ld [%o0 + AOFF_mm_context], %o3
270 lda [%g1] ASI_M_MMUREGS, %g5 270 lda [%g1] ASI_M_MMUREGS, %g5
271 and %o1, PAGE_MASK, %o1 271 and %o1, PAGE_MASK, %o1
diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c
index d36a85ebb5e0..9c7be59e6f5a 100644
--- a/arch/sparc/net/bpf_jit_comp.c
+++ b/arch/sparc/net/bpf_jit_comp.c
@@ -785,9 +785,7 @@ cond_branch: f_offset = addrs[i + filter[i].jf];
785 break; 785 break;
786 } 786 }
787 if (proglen == oldproglen) { 787 if (proglen == oldproglen) {
788 image = module_alloc(max_t(unsigned int, 788 image = module_alloc(proglen);
789 proglen,
790 sizeof(struct work_struct)));
791 if (!image) 789 if (!image)
792 goto out; 790 goto out;
793 } 791 }
@@ -806,20 +804,8 @@ out:
806 return; 804 return;
807} 805}
808 806
809static void jit_free_defer(struct work_struct *arg)
810{
811 module_free(NULL, arg);
812}
813
814/* run from softirq, we must use a work_struct to call
815 * module_free() from process context
816 */
817void bpf_jit_free(struct sk_filter *fp) 807void bpf_jit_free(struct sk_filter *fp)
818{ 808{
819 if (fp->bpf_func != sk_run_filter) { 809 if (fp->bpf_func != sk_run_filter)
820 struct work_struct *work = (struct work_struct *)fp->bpf_func; 810 module_free(NULL, fp->bpf_func);
821
822 INIT_WORK(work, jit_free_defer);
823 schedule_work(work);
824 }
825} 811}
diff --git a/arch/tile/kernel/irq.c b/arch/tile/kernel/irq.c
index 02e628065012..3ccf2cd7182e 100644
--- a/arch/tile/kernel/irq.c
+++ b/arch/tile/kernel/irq.c
@@ -220,7 +220,7 @@ void __init init_IRQ(void)
220 ipi_init(); 220 ipi_init();
221} 221}
222 222
223void __cpuinit setup_irq_regs(void) 223void setup_irq_regs(void)
224{ 224{
225 /* Enable interrupt delivery. */ 225 /* Enable interrupt delivery. */
226 unmask_irqs(~0UL); 226 unmask_irqs(~0UL);
diff --git a/arch/tile/kernel/messaging.c b/arch/tile/kernel/messaging.c
index 0858ee6b520f..00331af9525d 100644
--- a/arch/tile/kernel/messaging.c
+++ b/arch/tile/kernel/messaging.c
@@ -25,7 +25,7 @@
25/* All messages are stored here */ 25/* All messages are stored here */
26static DEFINE_PER_CPU(HV_MsgState, msg_state); 26static DEFINE_PER_CPU(HV_MsgState, msg_state);
27 27
28void __cpuinit init_messaging(void) 28void init_messaging(void)
29{ 29{
30 /* Allocate storage for messages in kernel space */ 30 /* Allocate storage for messages in kernel space */
31 HV_MsgState *state = &__get_cpu_var(msg_state); 31 HV_MsgState *state = &__get_cpu_var(msg_state);
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c
index 68b542677f6a..eceb8344280f 100644
--- a/arch/tile/kernel/setup.c
+++ b/arch/tile/kernel/setup.c
@@ -58,8 +58,8 @@ struct pglist_data node_data[MAX_NUMNODES] __read_mostly;
58EXPORT_SYMBOL(node_data); 58EXPORT_SYMBOL(node_data);
59 59
60/* Information on the NUMA nodes that we compute early */ 60/* Information on the NUMA nodes that we compute early */
61unsigned long __cpuinitdata node_start_pfn[MAX_NUMNODES]; 61unsigned long node_start_pfn[MAX_NUMNODES];
62unsigned long __cpuinitdata node_end_pfn[MAX_NUMNODES]; 62unsigned long node_end_pfn[MAX_NUMNODES];
63unsigned long __initdata node_memmap_pfn[MAX_NUMNODES]; 63unsigned long __initdata node_memmap_pfn[MAX_NUMNODES];
64unsigned long __initdata node_percpu_pfn[MAX_NUMNODES]; 64unsigned long __initdata node_percpu_pfn[MAX_NUMNODES];
65unsigned long __initdata node_free_pfn[MAX_NUMNODES]; 65unsigned long __initdata node_free_pfn[MAX_NUMNODES];
@@ -84,7 +84,7 @@ unsigned long __initdata boot_pc = (unsigned long)start_kernel;
84 84
85#ifdef CONFIG_HIGHMEM 85#ifdef CONFIG_HIGHMEM
86/* Page frame index of end of lowmem on each controller. */ 86/* Page frame index of end of lowmem on each controller. */
87unsigned long __cpuinitdata node_lowmem_end_pfn[MAX_NUMNODES]; 87unsigned long node_lowmem_end_pfn[MAX_NUMNODES];
88 88
89/* Number of pages that can be mapped into lowmem. */ 89/* Number of pages that can be mapped into lowmem. */
90static unsigned long __initdata mappable_physpages; 90static unsigned long __initdata mappable_physpages;
@@ -290,7 +290,7 @@ static void *__init setup_pa_va_mapping(void)
290 * This is up to 4 mappings for lowmem, one mapping per memory 290 * This is up to 4 mappings for lowmem, one mapping per memory
291 * controller, plus one for our text segment. 291 * controller, plus one for our text segment.
292 */ 292 */
293static void __cpuinit store_permanent_mappings(void) 293static void store_permanent_mappings(void)
294{ 294{
295 int i; 295 int i;
296 296
@@ -935,7 +935,7 @@ subsys_initcall(topology_init);
935 * So the values we set up here in the hypervisor may be overridden on 935 * So the values we set up here in the hypervisor may be overridden on
936 * the boot cpu as arguments are parsed. 936 * the boot cpu as arguments are parsed.
937 */ 937 */
938static __cpuinit void init_super_pages(void) 938static void init_super_pages(void)
939{ 939{
940#ifdef CONFIG_HUGETLB_SUPER_PAGES 940#ifdef CONFIG_HUGETLB_SUPER_PAGES
941 int i; 941 int i;
@@ -950,7 +950,7 @@ static __cpuinit void init_super_pages(void)
950 * 950 *
951 * Called from setup_arch() on the boot cpu, or online_secondary(). 951 * Called from setup_arch() on the boot cpu, or online_secondary().
952 */ 952 */
953void __cpuinit setup_cpu(int boot) 953void setup_cpu(int boot)
954{ 954{
955 /* The boot cpu sets up its permanent mappings much earlier. */ 955 /* The boot cpu sets up its permanent mappings much earlier. */
956 if (!boot) 956 if (!boot)
diff --git a/arch/tile/kernel/smpboot.c b/arch/tile/kernel/smpboot.c
index 44bab29bf2f3..a535655b7089 100644
--- a/arch/tile/kernel/smpboot.c
+++ b/arch/tile/kernel/smpboot.c
@@ -133,14 +133,14 @@ static __init int reset_init_affinity(void)
133} 133}
134late_initcall(reset_init_affinity); 134late_initcall(reset_init_affinity);
135 135
136static struct cpumask cpu_started __cpuinitdata; 136static struct cpumask cpu_started;
137 137
138/* 138/*
139 * Activate a secondary processor. Very minimal; don't add anything 139 * Activate a secondary processor. Very minimal; don't add anything
140 * to this path without knowing what you're doing, since SMP booting 140 * to this path without knowing what you're doing, since SMP booting
141 * is pretty fragile. 141 * is pretty fragile.
142 */ 142 */
143static void __cpuinit start_secondary(void) 143static void start_secondary(void)
144{ 144{
145 int cpuid = smp_processor_id(); 145 int cpuid = smp_processor_id();
146 146
@@ -183,7 +183,7 @@ static void __cpuinit start_secondary(void)
183/* 183/*
184 * Bring a secondary processor online. 184 * Bring a secondary processor online.
185 */ 185 */
186void __cpuinit online_secondary(void) 186void online_secondary(void)
187{ 187{
188 /* 188 /*
189 * low-memory mappings have been cleared, flush them from 189 * low-memory mappings have been cleared, flush them from
@@ -210,7 +210,7 @@ void __cpuinit online_secondary(void)
210 cpu_startup_entry(CPUHP_ONLINE); 210 cpu_startup_entry(CPUHP_ONLINE);
211} 211}
212 212
213int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) 213int __cpu_up(unsigned int cpu, struct task_struct *tidle)
214{ 214{
215 /* Wait 5s total for all CPUs for them to come online */ 215 /* Wait 5s total for all CPUs for them to come online */
216 static int timeout; 216 static int timeout;
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c
index 5ac397ec6986..7c353d8c2da9 100644
--- a/arch/tile/kernel/time.c
+++ b/arch/tile/kernel/time.c
@@ -159,7 +159,7 @@ static DEFINE_PER_CPU(struct clock_event_device, tile_timer) = {
159 .set_mode = tile_timer_set_mode, 159 .set_mode = tile_timer_set_mode,
160}; 160};
161 161
162void __cpuinit setup_tile_timer(void) 162void setup_tile_timer(void)
163{ 163{
164 struct clock_event_device *evt = &__get_cpu_var(tile_timer); 164 struct clock_event_device *evt = &__get_cpu_var(tile_timer);
165 165
diff --git a/arch/tile/mm/fault.c b/arch/tile/mm/fault.c
index 3d2b81c163a6..f7f99f90cbe0 100644
--- a/arch/tile/mm/fault.c
+++ b/arch/tile/mm/fault.c
@@ -573,10 +573,10 @@ out_of_memory:
573 down_read(&mm->mmap_sem); 573 down_read(&mm->mmap_sem);
574 goto survive; 574 goto survive;
575 } 575 }
576 pr_alert("VM: killing process %s\n", tsk->comm); 576 if (is_kernel_mode)
577 if (!is_kernel_mode) 577 goto no_context;
578 do_group_exit(SIGKILL); 578 pagefault_out_of_memory();
579 goto no_context; 579 return 0;
580 580
581do_sigbus: 581do_sigbus:
582 up_read(&mm->mmap_sem); 582 up_read(&mm->mmap_sem);
diff --git a/arch/tile/mm/mmap.c b/arch/tile/mm/mmap.c
index f96f4cec602a..d67d91ebf63e 100644
--- a/arch/tile/mm/mmap.c
+++ b/arch/tile/mm/mmap.c
@@ -66,10 +66,8 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
66 if (!is_32bit || rlimit(RLIMIT_STACK) == RLIM_INFINITY) { 66 if (!is_32bit || rlimit(RLIMIT_STACK) == RLIM_INFINITY) {
67 mm->mmap_base = TASK_UNMAPPED_BASE; 67 mm->mmap_base = TASK_UNMAPPED_BASE;
68 mm->get_unmapped_area = arch_get_unmapped_area; 68 mm->get_unmapped_area = arch_get_unmapped_area;
69 mm->unmap_area = arch_unmap_area;
70 } else { 69 } else {
71 mm->mmap_base = mmap_base(mm); 70 mm->mmap_base = mmap_base(mm);
72 mm->get_unmapped_area = arch_get_unmapped_area_topdown; 71 mm->get_unmapped_area = arch_get_unmapped_area_topdown;
73 mm->unmap_area = arch_unmap_area_topdown;
74 } 72 }
75} 73}
diff --git a/arch/um/include/shared/frame_kern.h b/arch/um/include/shared/frame_kern.h
index e584e40ee832..f2ca5702a4e2 100644
--- a/arch/um/include/shared/frame_kern.h
+++ b/arch/um/include/shared/frame_kern.h
@@ -6,13 +6,13 @@
6#ifndef __FRAME_KERN_H_ 6#ifndef __FRAME_KERN_H_
7#define __FRAME_KERN_H_ 7#define __FRAME_KERN_H_
8 8
9extern int setup_signal_stack_sc(unsigned long stack_top, int sig, 9extern int setup_signal_stack_sc(unsigned long stack_top, int sig,
10 struct k_sigaction *ka, 10 struct k_sigaction *ka,
11 struct pt_regs *regs, 11 struct pt_regs *regs,
12 sigset_t *mask); 12 sigset_t *mask);
13extern int setup_signal_stack_si(unsigned long stack_top, int sig, 13extern int setup_signal_stack_si(unsigned long stack_top, int sig,
14 struct k_sigaction *ka, 14 struct k_sigaction *ka,
15 struct pt_regs *regs, siginfo_t *info, 15 struct pt_regs *regs, struct siginfo *info,
16 sigset_t *mask); 16 sigset_t *mask);
17 17
18#endif 18#endif
diff --git a/arch/um/kernel/signal.c b/arch/um/kernel/signal.c
index 3e831b3fd07b..f57e02e7910f 100644
--- a/arch/um/kernel/signal.c
+++ b/arch/um/kernel/signal.c
@@ -19,7 +19,7 @@ EXPORT_SYMBOL(unblock_signals);
19 * OK, we're invoking a handler 19 * OK, we're invoking a handler
20 */ 20 */
21static void handle_signal(struct pt_regs *regs, unsigned long signr, 21static void handle_signal(struct pt_regs *regs, unsigned long signr,
22 struct k_sigaction *ka, siginfo_t *info) 22 struct k_sigaction *ka, struct siginfo *info)
23{ 23{
24 sigset_t *oldset = sigmask_to_save(); 24 sigset_t *oldset = sigmask_to_save();
25 int singlestep = 0; 25 int singlestep = 0;
@@ -71,7 +71,7 @@ static void handle_signal(struct pt_regs *regs, unsigned long signr,
71static int kern_do_signal(struct pt_regs *regs) 71static int kern_do_signal(struct pt_regs *regs)
72{ 72{
73 struct k_sigaction ka_copy; 73 struct k_sigaction ka_copy;
74 siginfo_t info; 74 struct siginfo info;
75 int sig, handled_sig = 0; 75 int sig, handled_sig = 0;
76 76
77 while ((sig = get_signal_to_deliver(&info, &ka_copy, regs, NULL)) > 0) { 77 while ((sig = get_signal_to_deliver(&info, &ka_copy, regs, NULL)) > 0) {
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c
index ff03067a3b14..007d5503f49b 100644
--- a/arch/um/kernel/skas/mmu.c
+++ b/arch/um/kernel/skas/mmu.c
@@ -123,7 +123,7 @@ void uml_setup_stubs(struct mm_struct *mm)
123 /* dup_mmap already holds mmap_sem */ 123 /* dup_mmap already holds mmap_sem */
124 err = install_special_mapping(mm, STUB_START, STUB_END - STUB_START, 124 err = install_special_mapping(mm, STUB_START, STUB_END - STUB_START,
125 VM_READ | VM_MAYREAD | VM_EXEC | 125 VM_READ | VM_MAYREAD | VM_EXEC |
126 VM_MAYEXEC | VM_DONTCOPY, 126 VM_MAYEXEC | VM_DONTCOPY | VM_PFNMAP,
127 mm->context.stub_pages); 127 mm->context.stub_pages);
128 if (err) { 128 if (err) {
129 printk(KERN_ERR "install_special_mapping returned %d\n", err); 129 printk(KERN_ERR "install_special_mapping returned %d\n", err);
diff --git a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c
index 1d3e0c17340b..4ffb644d6c07 100644
--- a/arch/um/kernel/skas/uaccess.c
+++ b/arch/um/kernel/skas/uaccess.c
@@ -254,6 +254,6 @@ int strnlen_user(const void __user *str, int len)
254 n = buffer_op((unsigned long) str, len, 0, strnlen_chunk, &count); 254 n = buffer_op((unsigned long) str, len, 0, strnlen_chunk, &count);
255 if (n == 0) 255 if (n == 0)
256 return count + 1; 256 return count + 1;
257 return -EFAULT; 257 return 0;
258} 258}
259EXPORT_SYMBOL(strnlen_user); 259EXPORT_SYMBOL(strnlen_user);
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
index ba4398056fe9..3c4af77e51a2 100644
--- a/arch/um/os-Linux/mem.c
+++ b/arch/um/os-Linux/mem.c
@@ -53,6 +53,25 @@ static void __init find_tempdir(void)
53} 53}
54 54
55/* 55/*
56 * Remove bytes from the front of the buffer and refill it so that if there's a
57 * partial string that we care about, it will be completed, and we can recognize
58 * it.
59 */
60static int pop(int fd, char *buf, size_t size, size_t npop)
61{
62 ssize_t n;
63 size_t len = strlen(&buf[npop]);
64
65 memmove(buf, &buf[npop], len + 1);
66 n = read(fd, &buf[len], size - len - 1);
67 if (n < 0)
68 return -errno;
69
70 buf[len + n] = '\0';
71 return 1;
72}
73
74/*
56 * This will return 1, with the first character in buf being the 75 * This will return 1, with the first character in buf being the
57 * character following the next instance of c in the file. This will 76 * character following the next instance of c in the file. This will
58 * read the file as needed. If there's an error, -errno is returned; 77 * read the file as needed. If there's an error, -errno is returned;
@@ -61,7 +80,6 @@ static void __init find_tempdir(void)
61static int next(int fd, char *buf, size_t size, char c) 80static int next(int fd, char *buf, size_t size, char c)
62{ 81{
63 ssize_t n; 82 ssize_t n;
64 size_t len;
65 char *ptr; 83 char *ptr;
66 84
67 while ((ptr = strchr(buf, c)) == NULL) { 85 while ((ptr = strchr(buf, c)) == NULL) {
@@ -74,20 +92,129 @@ static int next(int fd, char *buf, size_t size, char c)
74 buf[n] = '\0'; 92 buf[n] = '\0';
75 } 93 }
76 94
77 ptr++; 95 return pop(fd, buf, size, ptr - buf + 1);
78 len = strlen(ptr); 96}
79 memmove(buf, ptr, len + 1); 97
98/*
99 * Decode an octal-escaped and space-terminated path of the form used by
100 * /proc/mounts. May be used to decode a path in-place. "out" must be at least
101 * as large as the input. The output is always null-terminated. "len" gets the
102 * length of the output, excluding the trailing null. Returns 0 if a full path
103 * was successfully decoded, otherwise an error.
104 */
105static int decode_path(const char *in, char *out, size_t *len)
106{
107 char *first = out;
108 int c;
109 int i;
110 int ret = -EINVAL;
111 while (1) {
112 switch (*in) {
113 case '\0':
114 goto out;
115
116 case ' ':
117 ret = 0;
118 goto out;
119
120 case '\\':
121 in++;
122 c = 0;
123 for (i = 0; i < 3; i++) {
124 if (*in < '0' || *in > '7')
125 goto out;
126 c = (c << 3) | (*in++ - '0');
127 }
128 *(unsigned char *)out++ = (unsigned char) c;
129 break;
130
131 default:
132 *out++ = *in++;
133 break;
134 }
135 }
136
137out:
138 *out = '\0';
139 *len = out - first;
140 return ret;
141}
142
143/*
144 * Computes the length of s when encoded with three-digit octal escape sequences
145 * for the characters in chars.
146 */
147static size_t octal_encoded_length(const char *s, const char *chars)
148{
149 size_t len = strlen(s);
150 while ((s = strpbrk(s, chars)) != NULL) {
151 len += 3;
152 s++;
153 }
154
155 return len;
156}
157
158enum {
159 OUTCOME_NOTHING_MOUNTED,
160 OUTCOME_TMPFS_MOUNT,
161 OUTCOME_NON_TMPFS_MOUNT,
162};
163
164/* Read a line of /proc/mounts data looking for a tmpfs mount at "path". */
165static int read_mount(int fd, char *buf, size_t bufsize, const char *path,
166 int *outcome)
167{
168 int found;
169 int match;
170 char *space;
171 size_t len;
172
173 enum {
174 MATCH_NONE,
175 MATCH_EXACT,
176 MATCH_PARENT,
177 };
178
179 found = next(fd, buf, bufsize, ' ');
180 if (found != 1)
181 return found;
80 182
81 /* 183 /*
82 * Refill the buffer so that if there's a partial string that we care 184 * If there's no following space in the buffer, then this path is
83 * about, it will be completed, and we can recognize it. 185 * truncated, so it can't be the one we're looking for.
84 */ 186 */
85 n = read(fd, &buf[len], size - len - 1); 187 space = strchr(buf, ' ');
86 if (n < 0) 188 if (space) {
87 return -errno; 189 match = MATCH_NONE;
190 if (!decode_path(buf, buf, &len)) {
191 if (!strcmp(buf, path))
192 match = MATCH_EXACT;
193 else if (!strncmp(buf, path, len)
194 && (path[len] == '/' || !strcmp(buf, "/")))
195 match = MATCH_PARENT;
196 }
197
198 found = pop(fd, buf, bufsize, space - buf + 1);
199 if (found != 1)
200 return found;
201
202 switch (match) {
203 case MATCH_EXACT:
204 if (!strncmp(buf, "tmpfs", strlen("tmpfs")))
205 *outcome = OUTCOME_TMPFS_MOUNT;
206 else
207 *outcome = OUTCOME_NON_TMPFS_MOUNT;
208 break;
88 209
89 buf[len + n] = '\0'; 210 case MATCH_PARENT:
90 return 1; 211 /* This mount obscures any previous ones. */
212 *outcome = OUTCOME_NOTHING_MOUNTED;
213 break;
214 }
215 }
216
217 return next(fd, buf, bufsize, '\n');
91} 218}
92 219
93/* which_tmpdir is called only during early boot */ 220/* which_tmpdir is called only during early boot */
@@ -106,8 +233,12 @@ static int checked_tmpdir = 0;
106 */ 233 */
107static void which_tmpdir(void) 234static void which_tmpdir(void)
108{ 235{
109 int fd, found; 236 int fd;
110 char buf[128] = { '\0' }; 237 int found;
238 int outcome;
239 char *path;
240 char *buf;
241 size_t bufsize;
111 242
112 if (checked_tmpdir) 243 if (checked_tmpdir)
113 return; 244 return;
@@ -116,49 +247,66 @@ static void which_tmpdir(void)
116 247
117 printf("Checking for tmpfs mount on /dev/shm..."); 248 printf("Checking for tmpfs mount on /dev/shm...");
118 249
250 path = realpath("/dev/shm", NULL);
251 if (!path) {
252 printf("failed to check real path, errno = %d\n", errno);
253 return;
254 }
255 printf("%s...", path);
256
257 /*
258 * The buffer needs to be able to fit the full octal-escaped path, a
259 * space, and a trailing null in order to successfully decode it.
260 */
261 bufsize = octal_encoded_length(path, " \t\n\\") + 2;
262
263 if (bufsize < 128)
264 bufsize = 128;
265
266 buf = malloc(bufsize);
267 if (!buf) {
268 printf("malloc failed, errno = %d\n", errno);
269 goto out;
270 }
271 buf[0] = '\0';
272
119 fd = open("/proc/mounts", O_RDONLY); 273 fd = open("/proc/mounts", O_RDONLY);
120 if (fd < 0) { 274 if (fd < 0) {
121 printf("failed to open /proc/mounts, errno = %d\n", errno); 275 printf("failed to open /proc/mounts, errno = %d\n", errno);
122 return; 276 goto out1;
123 } 277 }
124 278
279 outcome = OUTCOME_NOTHING_MOUNTED;
125 while (1) { 280 while (1) {
126 found = next(fd, buf, ARRAY_SIZE(buf), ' '); 281 found = read_mount(fd, buf, bufsize, path, &outcome);
127 if (found != 1)
128 break;
129
130 if (!strncmp(buf, "/dev/shm", strlen("/dev/shm")))
131 goto found;
132
133 found = next(fd, buf, ARRAY_SIZE(buf), '\n');
134 if (found != 1) 282 if (found != 1)
135 break; 283 break;
136 } 284 }
137 285
138err: 286 if (found < 0) {
139 if (found == 0)
140 printf("nothing mounted on /dev/shm\n");
141 else if (found < 0)
142 printf("read returned errno %d\n", -found); 287 printf("read returned errno %d\n", -found);
288 } else {
289 switch (outcome) {
290 case OUTCOME_TMPFS_MOUNT:
291 printf("OK\n");
292 default_tmpdir = "/dev/shm";
293 break;
143 294
144out: 295 case OUTCOME_NON_TMPFS_MOUNT:
145 close(fd); 296 printf("not tmpfs\n");
146 297 break;
147 return;
148
149found:
150 found = next(fd, buf, ARRAY_SIZE(buf), ' ');
151 if (found != 1)
152 goto err;
153 298
154 if (strncmp(buf, "tmpfs", strlen("tmpfs"))) { 299 default:
155 printf("not tmpfs\n"); 300 printf("nothing mounted on /dev/shm\n");
156 goto out; 301 break;
302 }
157 } 303 }
158 304
159 printf("OK\n"); 305 close(fd);
160 default_tmpdir = "/dev/shm"; 306out1:
161 goto out; 307 free(buf);
308out:
309 free(path);
162} 310}
163 311
164static int __init make_tempfile(const char *template, char **out_tempname, 312static int __init make_tempfile(const char *template, char **out_tempname,
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index 9d9f1b4bf826..905924b773d3 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -25,7 +25,7 @@ void (*sig_info[NSIG])(int, struct siginfo *, struct uml_pt_regs *) = {
25 [SIGIO] = sigio_handler, 25 [SIGIO] = sigio_handler,
26 [SIGVTALRM] = timer_handler }; 26 [SIGVTALRM] = timer_handler };
27 27
28static void sig_handler_common(int sig, siginfo_t *si, mcontext_t *mc) 28static void sig_handler_common(int sig, struct siginfo *si, mcontext_t *mc)
29{ 29{
30 struct uml_pt_regs r; 30 struct uml_pt_regs r;
31 int save_errno = errno; 31 int save_errno = errno;
@@ -61,7 +61,7 @@ static void sig_handler_common(int sig, siginfo_t *si, mcontext_t *mc)
61static int signals_enabled; 61static int signals_enabled;
62static unsigned int signals_pending; 62static unsigned int signals_pending;
63 63
64void sig_handler(int sig, siginfo_t *si, mcontext_t *mc) 64void sig_handler(int sig, struct siginfo *si, mcontext_t *mc)
65{ 65{
66 int enabled; 66 int enabled;
67 67
@@ -120,7 +120,7 @@ void set_sigstack(void *sig_stack, int size)
120 panic("enabling signal stack failed, errno = %d\n", errno); 120 panic("enabling signal stack failed, errno = %d\n", errno);
121} 121}
122 122
123static void (*handlers[_NSIG])(int sig, siginfo_t *si, mcontext_t *mc) = { 123static void (*handlers[_NSIG])(int sig, struct siginfo *si, mcontext_t *mc) = {
124 [SIGSEGV] = sig_handler, 124 [SIGSEGV] = sig_handler,
125 [SIGBUS] = sig_handler, 125 [SIGBUS] = sig_handler,
126 [SIGILL] = sig_handler, 126 [SIGILL] = sig_handler,
@@ -162,7 +162,7 @@ static void hard_handler(int sig, siginfo_t *si, void *p)
162 while ((sig = ffs(pending)) != 0){ 162 while ((sig = ffs(pending)) != 0){
163 sig--; 163 sig--;
164 pending &= ~(1 << sig); 164 pending &= ~(1 << sig);
165 (*handlers[sig])(sig, si, mc); 165 (*handlers[sig])(sig, (struct siginfo *)si, mc);
166 } 166 }
167 167
168 /* 168 /*
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 4625949bf1e4..d531879a4617 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -54,7 +54,7 @@ static int ptrace_dump_regs(int pid)
54 54
55void wait_stub_done(int pid) 55void wait_stub_done(int pid)
56{ 56{
57 int n, status, err; 57 int n, status, err, bad_stop = 0;
58 58
59 while (1) { 59 while (1) {
60 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL)); 60 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL));
@@ -74,6 +74,8 @@ void wait_stub_done(int pid)
74 74
75 if (((1 << WSTOPSIG(status)) & STUB_DONE_MASK) != 0) 75 if (((1 << WSTOPSIG(status)) & STUB_DONE_MASK) != 0)
76 return; 76 return;
77 else
78 bad_stop = 1;
77 79
78bad_wait: 80bad_wait:
79 err = ptrace_dump_regs(pid); 81 err = ptrace_dump_regs(pid);
@@ -83,7 +85,10 @@ bad_wait:
83 printk(UM_KERN_ERR "wait_stub_done : failed to wait for SIGTRAP, " 85 printk(UM_KERN_ERR "wait_stub_done : failed to wait for SIGTRAP, "
84 "pid = %d, n = %d, errno = %d, status = 0x%x\n", pid, n, errno, 86 "pid = %d, n = %d, errno = %d, status = 0x%x\n", pid, n, errno,
85 status); 87 status);
86 fatal_sigsegv(); 88 if (bad_stop)
89 kill(pid, SIGKILL);
90 else
91 fatal_sigsegv();
87} 92}
88 93
89extern unsigned long current_stub_stack(void); 94extern unsigned long current_stub_stack(void);
@@ -409,7 +414,7 @@ void userspace(struct uml_pt_regs *regs)
409 if (WIFSTOPPED(status)) { 414 if (WIFSTOPPED(status)) {
410 int sig = WSTOPSIG(status); 415 int sig = WSTOPSIG(status);
411 416
412 ptrace(PTRACE_GETSIGINFO, pid, 0, &si); 417 ptrace(PTRACE_GETSIGINFO, pid, 0, (struct siginfo *)&si);
413 418
414 switch (sig) { 419 switch (sig) {
415 case SIGSEGV: 420 case SIGSEGV:
@@ -417,7 +422,7 @@ void userspace(struct uml_pt_regs *regs)
417 !ptrace_faultinfo) { 422 !ptrace_faultinfo) {
418 get_skas_faultinfo(pid, 423 get_skas_faultinfo(pid,
419 &regs->faultinfo); 424 &regs->faultinfo);
420 (*sig_info[SIGSEGV])(SIGSEGV, &si, 425 (*sig_info[SIGSEGV])(SIGSEGV, (struct siginfo *)&si,
421 regs); 426 regs);
422 } 427 }
423 else handle_segv(pid, regs); 428 else handle_segv(pid, regs);
@@ -426,14 +431,14 @@ void userspace(struct uml_pt_regs *regs)
426 handle_trap(pid, regs, local_using_sysemu); 431 handle_trap(pid, regs, local_using_sysemu);
427 break; 432 break;
428 case SIGTRAP: 433 case SIGTRAP:
429 relay_signal(SIGTRAP, &si, regs); 434 relay_signal(SIGTRAP, (struct siginfo *)&si, regs);
430 break; 435 break;
431 case SIGVTALRM: 436 case SIGVTALRM:
432 now = os_nsecs(); 437 now = os_nsecs();
433 if (now < nsecs) 438 if (now < nsecs)
434 break; 439 break;
435 block_signals(); 440 block_signals();
436 (*sig_info[sig])(sig, &si, regs); 441 (*sig_info[sig])(sig, (struct siginfo *)&si, regs);
437 unblock_signals(); 442 unblock_signals();
438 nsecs = timer.it_value.tv_sec * 443 nsecs = timer.it_value.tv_sec *
439 UM_NSEC_PER_SEC + 444 UM_NSEC_PER_SEC +
@@ -447,7 +452,7 @@ void userspace(struct uml_pt_regs *regs)
447 case SIGFPE: 452 case SIGFPE:
448 case SIGWINCH: 453 case SIGWINCH:
449 block_signals(); 454 block_signals();
450 (*sig_info[sig])(sig, &si, regs); 455 (*sig_info[sig])(sig, (struct siginfo *)&si, regs);
451 unblock_signals(); 456 unblock_signals();
452 break; 457 break;
453 default: 458 default:
diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c
index c9447691bdac..778ebba80827 100644
--- a/arch/unicore32/kernel/process.c
+++ b/arch/unicore32/kernel/process.c
@@ -51,16 +51,6 @@ void arch_cpu_idle(void)
51 local_irq_enable(); 51 local_irq_enable();
52} 52}
53 53
54static char reboot_mode = 'h';
55
56int __init reboot_setup(char *str)
57{
58 reboot_mode = str[0];
59 return 1;
60}
61
62__setup("reboot=", reboot_setup);
63
64void machine_halt(void) 54void machine_halt(void)
65{ 55{
66 gpio_set_value(GPO_SOFT_OFF, 0); 56 gpio_set_value(GPO_SOFT_OFF, 0);
@@ -88,7 +78,7 @@ void machine_restart(char *cmd)
88 * we may need it to insert some 1:1 mappings so that 78 * we may need it to insert some 1:1 mappings so that
89 * soft boot works. 79 * soft boot works.
90 */ 80 */
91 setup_mm_for_reboot(reboot_mode); 81 setup_mm_for_reboot();
92 82
93 /* Clean and invalidate caches */ 83 /* Clean and invalidate caches */
94 flush_cache_all(); 84 flush_cache_all();
@@ -102,7 +92,7 @@ void machine_restart(char *cmd)
102 /* 92 /*
103 * Now handle reboot code. 93 * Now handle reboot code.
104 */ 94 */
105 if (reboot_mode == 's') { 95 if (reboot_mode == REBOOT_SOFT) {
106 /* Jump into ROM at address 0xffff0000 */ 96 /* Jump into ROM at address 0xffff0000 */
107 cpu_reset(VECTORS_BASE); 97 cpu_reset(VECTORS_BASE);
108 } else { 98 } else {
diff --git a/arch/unicore32/kernel/setup.h b/arch/unicore32/kernel/setup.h
index 30f749da8f73..f5c51b85ad24 100644
--- a/arch/unicore32/kernel/setup.h
+++ b/arch/unicore32/kernel/setup.h
@@ -22,7 +22,7 @@ extern void puv3_ps2_init(void);
22extern void pci_puv3_preinit(void); 22extern void pci_puv3_preinit(void);
23extern void __init puv3_init_gpio(void); 23extern void __init puv3_init_gpio(void);
24 24
25extern void setup_mm_for_reboot(char mode); 25extern void setup_mm_for_reboot(void);
26 26
27extern char __stubs_start[], __stubs_end[]; 27extern char __stubs_start[], __stubs_end[];
28extern char __vectors_start[], __vectors_end[]; 28extern char __vectors_start[], __vectors_end[];
diff --git a/arch/unicore32/mm/mmu.c b/arch/unicore32/mm/mmu.c
index 43c20b40e444..4f5a532bee13 100644
--- a/arch/unicore32/mm/mmu.c
+++ b/arch/unicore32/mm/mmu.c
@@ -445,7 +445,7 @@ void __init paging_init(void)
445 * the user-mode pages. This will then ensure that we have predictable 445 * the user-mode pages. This will then ensure that we have predictable
446 * results when turning the mmu off 446 * results when turning the mmu off
447 */ 447 */
448void setup_mm_for_reboot(char mode) 448void setup_mm_for_reboot(void)
449{ 449{
450 unsigned long base_pmdval; 450 unsigned long base_pmdval;
451 pgd_t *pgd; 451 pgd_t *pgd;
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 265c672a2f40..b32ebf92b0ce 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -65,6 +65,7 @@ config X86
65 select HAVE_KERNEL_LZMA 65 select HAVE_KERNEL_LZMA
66 select HAVE_KERNEL_XZ 66 select HAVE_KERNEL_XZ
67 select HAVE_KERNEL_LZO 67 select HAVE_KERNEL_LZO
68 select HAVE_KERNEL_LZ4
68 select HAVE_HW_BREAKPOINT 69 select HAVE_HW_BREAKPOINT
69 select HAVE_MIXED_BREAKPOINTS_REGS 70 select HAVE_MIXED_BREAKPOINTS_REGS
70 select PERF_EVENTS 71 select PERF_EVENTS
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 5ef205c5f37b..dcd90df10ab4 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -4,7 +4,8 @@
4# create a compressed vmlinux image from the original vmlinux 4# create a compressed vmlinux image from the original vmlinux
5# 5#
6 6
7targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo 7targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \
8 vmlinux.bin.xz vmlinux.bin.lzo vmlinux.bin.lz4
8 9
9KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 10KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
10KBUILD_CFLAGS += -fno-strict-aliasing -fPIC 11KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
@@ -63,12 +64,15 @@ $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
63 $(call if_changed,xzkern) 64 $(call if_changed,xzkern)
64$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE 65$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
65 $(call if_changed,lzo) 66 $(call if_changed,lzo)
67$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE
68 $(call if_changed,lz4)
66 69
67suffix-$(CONFIG_KERNEL_GZIP) := gz 70suffix-$(CONFIG_KERNEL_GZIP) := gz
68suffix-$(CONFIG_KERNEL_BZIP2) := bz2 71suffix-$(CONFIG_KERNEL_BZIP2) := bz2
69suffix-$(CONFIG_KERNEL_LZMA) := lzma 72suffix-$(CONFIG_KERNEL_LZMA) := lzma
70suffix-$(CONFIG_KERNEL_XZ) := xz 73suffix-$(CONFIG_KERNEL_XZ) := xz
71suffix-$(CONFIG_KERNEL_LZO) := lzo 74suffix-$(CONFIG_KERNEL_LZO) := lzo
75suffix-$(CONFIG_KERNEL_LZ4) := lz4
72 76
73quiet_cmd_mkpiggy = MKPIGGY $@ 77quiet_cmd_mkpiggy = MKPIGGY $@
74 cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false ) 78 cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false )
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 7cb56c6ca351..0319c88290a5 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -145,6 +145,10 @@ static int lines, cols;
145#include "../../../../lib/decompress_unlzo.c" 145#include "../../../../lib/decompress_unlzo.c"
146#endif 146#endif
147 147
148#ifdef CONFIG_KERNEL_LZ4
149#include "../../../../lib/decompress_unlz4.c"
150#endif
151
148static void scroll(void) 152static void scroll(void)
149{ 153{
150 int i; 154 int i;
diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile
index 7d6ba9db1be9..6c63c358a7e6 100644
--- a/arch/x86/crypto/Makefile
+++ b/arch/x86/crypto/Makefile
@@ -27,7 +27,6 @@ obj-$(CONFIG_CRYPTO_SHA1_SSSE3) += sha1-ssse3.o
27obj-$(CONFIG_CRYPTO_CRC32_PCLMUL) += crc32-pclmul.o 27obj-$(CONFIG_CRYPTO_CRC32_PCLMUL) += crc32-pclmul.o
28obj-$(CONFIG_CRYPTO_SHA256_SSSE3) += sha256-ssse3.o 28obj-$(CONFIG_CRYPTO_SHA256_SSSE3) += sha256-ssse3.o
29obj-$(CONFIG_CRYPTO_SHA512_SSSE3) += sha512-ssse3.o 29obj-$(CONFIG_CRYPTO_SHA512_SSSE3) += sha512-ssse3.o
30obj-$(CONFIG_CRYPTO_CRCT10DIF_PCLMUL) += crct10dif-pclmul.o
31 30
32# These modules require assembler to support AVX. 31# These modules require assembler to support AVX.
33ifeq ($(avx_supported),yes) 32ifeq ($(avx_supported),yes)
@@ -82,4 +81,3 @@ crc32c-intel-$(CONFIG_64BIT) += crc32c-pcl-intel-asm_64.o
82crc32-pclmul-y := crc32-pclmul_asm.o crc32-pclmul_glue.o 81crc32-pclmul-y := crc32-pclmul_asm.o crc32-pclmul_glue.o
83sha256-ssse3-y := sha256-ssse3-asm.o sha256-avx-asm.o sha256-avx2-asm.o sha256_ssse3_glue.o 82sha256-ssse3-y := sha256-ssse3-asm.o sha256-avx-asm.o sha256-avx2-asm.o sha256_ssse3_glue.o
84sha512-ssse3-y := sha512-ssse3-asm.o sha512-avx-asm.o sha512-avx2-asm.o sha512_ssse3_glue.o 83sha512-ssse3-y := sha512-ssse3-asm.o sha512-avx-asm.o sha512-avx2-asm.o sha512_ssse3_glue.o
85crct10dif-pclmul-y := crct10dif-pcl-asm_64.o crct10dif-pclmul_glue.o
diff --git a/arch/x86/crypto/crct10dif-pcl-asm_64.S b/arch/x86/crypto/crct10dif-pcl-asm_64.S
deleted file mode 100644
index 35e97569d05f..000000000000
--- a/arch/x86/crypto/crct10dif-pcl-asm_64.S
+++ /dev/null
@@ -1,643 +0,0 @@
1########################################################################
2# Implement fast CRC-T10DIF computation with SSE and PCLMULQDQ instructions
3#
4# Copyright (c) 2013, Intel Corporation
5#
6# Authors:
7# Erdinc Ozturk <erdinc.ozturk@intel.com>
8# Vinodh Gopal <vinodh.gopal@intel.com>
9# James Guilford <james.guilford@intel.com>
10# Tim Chen <tim.c.chen@linux.intel.com>
11#
12# This software is available to you under a choice of one of two
13# licenses. You may choose to be licensed under the terms of the GNU
14# General Public License (GPL) Version 2, available from the file
15# COPYING in the main directory of this source tree, or the
16# OpenIB.org BSD license below:
17#
18# Redistribution and use in source and binary forms, with or without
19# modification, are permitted provided that the following conditions are
20# met:
21#
22# * Redistributions of source code must retain the above copyright
23# notice, this list of conditions and the following disclaimer.
24#
25# * Redistributions in binary form must reproduce the above copyright
26# notice, this list of conditions and the following disclaimer in the
27# documentation and/or other materials provided with the
28# distribution.
29#
30# * Neither the name of the Intel Corporation nor the names of its
31# contributors may be used to endorse or promote products derived from
32# this software without specific prior written permission.
33#
34#
35# THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION ""AS IS"" AND ANY
36# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
38# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION OR
39# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
40# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
41# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
42# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
43# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
44# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
45# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46########################################################################
47# Function API:
48# UINT16 crc_t10dif_pcl(
49# UINT16 init_crc, //initial CRC value, 16 bits
50# const unsigned char *buf, //buffer pointer to calculate CRC on
51# UINT64 len //buffer length in bytes (64-bit data)
52# );
53#
54# Reference paper titled "Fast CRC Computation for Generic
55# Polynomials Using PCLMULQDQ Instruction"
56# URL: http://www.intel.com/content/dam/www/public/us/en/documents
57# /white-papers/fast-crc-computation-generic-polynomials-pclmulqdq-paper.pdf
58#
59#
60
61#include <linux/linkage.h>
62
63.text
64
65#define arg1 %rdi
66#define arg2 %rsi
67#define arg3 %rdx
68
69#define arg1_low32 %edi
70
71ENTRY(crc_t10dif_pcl)
72.align 16
73
74 # adjust the 16-bit initial_crc value, scale it to 32 bits
75 shl $16, arg1_low32
76
77 # Allocate Stack Space
78 mov %rsp, %rcx
79 sub $16*2, %rsp
80 # align stack to 16 byte boundary
81 and $~(0x10 - 1), %rsp
82
83 # check if smaller than 256
84 cmp $256, arg3
85
86 # for sizes less than 128, we can't fold 64B at a time...
87 jl _less_than_128
88
89
90 # load the initial crc value
91 movd arg1_low32, %xmm10 # initial crc
92
93 # crc value does not need to be byte-reflected, but it needs
94 # to be moved to the high part of the register.
95 # because data will be byte-reflected and will align with
96 # initial crc at correct place.
97 pslldq $12, %xmm10
98
99 movdqa SHUF_MASK(%rip), %xmm11
100 # receive the initial 64B data, xor the initial crc value
101 movdqu 16*0(arg2), %xmm0
102 movdqu 16*1(arg2), %xmm1
103 movdqu 16*2(arg2), %xmm2
104 movdqu 16*3(arg2), %xmm3
105 movdqu 16*4(arg2), %xmm4
106 movdqu 16*5(arg2), %xmm5
107 movdqu 16*6(arg2), %xmm6
108 movdqu 16*7(arg2), %xmm7
109
110 pshufb %xmm11, %xmm0
111 # XOR the initial_crc value
112 pxor %xmm10, %xmm0
113 pshufb %xmm11, %xmm1
114 pshufb %xmm11, %xmm2
115 pshufb %xmm11, %xmm3
116 pshufb %xmm11, %xmm4
117 pshufb %xmm11, %xmm5
118 pshufb %xmm11, %xmm6
119 pshufb %xmm11, %xmm7
120
121 movdqa rk3(%rip), %xmm10 #xmm10 has rk3 and rk4
122 #imm value of pclmulqdq instruction
123 #will determine which constant to use
124
125 #################################################################
126 # we subtract 256 instead of 128 to save one instruction from the loop
127 sub $256, arg3
128
129 # at this section of the code, there is 64*x+y (0<=y<64) bytes of
130 # buffer. The _fold_64_B_loop will fold 64B at a time
131 # until we have 64+y Bytes of buffer
132
133
134 # fold 64B at a time. This section of the code folds 4 xmm
135 # registers in parallel
136_fold_64_B_loop:
137
138 # update the buffer pointer
139 add $128, arg2 # buf += 64#
140
141 movdqu 16*0(arg2), %xmm9
142 movdqu 16*1(arg2), %xmm12
143 pshufb %xmm11, %xmm9
144 pshufb %xmm11, %xmm12
145 movdqa %xmm0, %xmm8
146 movdqa %xmm1, %xmm13
147 pclmulqdq $0x0 , %xmm10, %xmm0
148 pclmulqdq $0x11, %xmm10, %xmm8
149 pclmulqdq $0x0 , %xmm10, %xmm1
150 pclmulqdq $0x11, %xmm10, %xmm13
151 pxor %xmm9 , %xmm0
152 xorps %xmm8 , %xmm0
153 pxor %xmm12, %xmm1
154 xorps %xmm13, %xmm1
155
156 movdqu 16*2(arg2), %xmm9
157 movdqu 16*3(arg2), %xmm12
158 pshufb %xmm11, %xmm9
159 pshufb %xmm11, %xmm12
160 movdqa %xmm2, %xmm8
161 movdqa %xmm3, %xmm13
162 pclmulqdq $0x0, %xmm10, %xmm2
163 pclmulqdq $0x11, %xmm10, %xmm8
164 pclmulqdq $0x0, %xmm10, %xmm3
165 pclmulqdq $0x11, %xmm10, %xmm13
166 pxor %xmm9 , %xmm2
167 xorps %xmm8 , %xmm2
168 pxor %xmm12, %xmm3
169 xorps %xmm13, %xmm3
170
171 movdqu 16*4(arg2), %xmm9
172 movdqu 16*5(arg2), %xmm12
173 pshufb %xmm11, %xmm9
174 pshufb %xmm11, %xmm12
175 movdqa %xmm4, %xmm8
176 movdqa %xmm5, %xmm13
177 pclmulqdq $0x0, %xmm10, %xmm4
178 pclmulqdq $0x11, %xmm10, %xmm8
179 pclmulqdq $0x0, %xmm10, %xmm5
180 pclmulqdq $0x11, %xmm10, %xmm13
181 pxor %xmm9 , %xmm4
182 xorps %xmm8 , %xmm4
183 pxor %xmm12, %xmm5
184 xorps %xmm13, %xmm5
185
186 movdqu 16*6(arg2), %xmm9
187 movdqu 16*7(arg2), %xmm12
188 pshufb %xmm11, %xmm9
189 pshufb %xmm11, %xmm12
190 movdqa %xmm6 , %xmm8
191 movdqa %xmm7 , %xmm13
192 pclmulqdq $0x0 , %xmm10, %xmm6
193 pclmulqdq $0x11, %xmm10, %xmm8
194 pclmulqdq $0x0 , %xmm10, %xmm7
195 pclmulqdq $0x11, %xmm10, %xmm13
196 pxor %xmm9 , %xmm6
197 xorps %xmm8 , %xmm6
198 pxor %xmm12, %xmm7
199 xorps %xmm13, %xmm7
200
201 sub $128, arg3
202
203 # check if there is another 64B in the buffer to be able to fold
204 jge _fold_64_B_loop
205 ##################################################################
206
207
208 add $128, arg2
209 # at this point, the buffer pointer is pointing at the last y Bytes
210 # of the buffer the 64B of folded data is in 4 of the xmm
211 # registers: xmm0, xmm1, xmm2, xmm3
212
213
214 # fold the 8 xmm registers to 1 xmm register with different constants
215
216 movdqa rk9(%rip), %xmm10
217 movdqa %xmm0, %xmm8
218 pclmulqdq $0x11, %xmm10, %xmm0
219 pclmulqdq $0x0 , %xmm10, %xmm8
220 pxor %xmm8, %xmm7
221 xorps %xmm0, %xmm7
222
223 movdqa rk11(%rip), %xmm10
224 movdqa %xmm1, %xmm8
225 pclmulqdq $0x11, %xmm10, %xmm1
226 pclmulqdq $0x0 , %xmm10, %xmm8
227 pxor %xmm8, %xmm7
228 xorps %xmm1, %xmm7
229
230 movdqa rk13(%rip), %xmm10
231 movdqa %xmm2, %xmm8
232 pclmulqdq $0x11, %xmm10, %xmm2
233 pclmulqdq $0x0 , %xmm10, %xmm8
234 pxor %xmm8, %xmm7
235 pxor %xmm2, %xmm7
236
237 movdqa rk15(%rip), %xmm10
238 movdqa %xmm3, %xmm8
239 pclmulqdq $0x11, %xmm10, %xmm3
240 pclmulqdq $0x0 , %xmm10, %xmm8
241 pxor %xmm8, %xmm7
242 xorps %xmm3, %xmm7
243
244 movdqa rk17(%rip), %xmm10
245 movdqa %xmm4, %xmm8
246 pclmulqdq $0x11, %xmm10, %xmm4
247 pclmulqdq $0x0 , %xmm10, %xmm8
248 pxor %xmm8, %xmm7
249 pxor %xmm4, %xmm7
250
251 movdqa rk19(%rip), %xmm10
252 movdqa %xmm5, %xmm8
253 pclmulqdq $0x11, %xmm10, %xmm5
254 pclmulqdq $0x0 , %xmm10, %xmm8
255 pxor %xmm8, %xmm7
256 xorps %xmm5, %xmm7
257
258 movdqa rk1(%rip), %xmm10 #xmm10 has rk1 and rk2
259 #imm value of pclmulqdq instruction
260 #will determine which constant to use
261 movdqa %xmm6, %xmm8
262 pclmulqdq $0x11, %xmm10, %xmm6
263 pclmulqdq $0x0 , %xmm10, %xmm8
264 pxor %xmm8, %xmm7
265 pxor %xmm6, %xmm7
266
267
268 # instead of 64, we add 48 to the loop counter to save 1 instruction
269 # from the loop instead of a cmp instruction, we use the negative
270 # flag with the jl instruction
271 add $128-16, arg3
272 jl _final_reduction_for_128
273
274 # now we have 16+y bytes left to reduce. 16 Bytes is in register xmm7
275 # and the rest is in memory. We can fold 16 bytes at a time if y>=16
276 # continue folding 16B at a time
277
278_16B_reduction_loop:
279 movdqa %xmm7, %xmm8
280 pclmulqdq $0x11, %xmm10, %xmm7
281 pclmulqdq $0x0 , %xmm10, %xmm8
282 pxor %xmm8, %xmm7
283 movdqu (arg2), %xmm0
284 pshufb %xmm11, %xmm0
285 pxor %xmm0 , %xmm7
286 add $16, arg2
287 sub $16, arg3
288 # instead of a cmp instruction, we utilize the flags with the
289 # jge instruction equivalent of: cmp arg3, 16-16
290 # check if there is any more 16B in the buffer to be able to fold
291 jge _16B_reduction_loop
292
293 #now we have 16+z bytes left to reduce, where 0<= z < 16.
294 #first, we reduce the data in the xmm7 register
295
296
297_final_reduction_for_128:
298 # check if any more data to fold. If not, compute the CRC of
299 # the final 128 bits
300 add $16, arg3
301 je _128_done
302
303 # here we are getting data that is less than 16 bytes.
304 # since we know that there was data before the pointer, we can
305 # offset the input pointer before the actual point, to receive
306 # exactly 16 bytes. after that the registers need to be adjusted.
307_get_last_two_xmms:
308 movdqa %xmm7, %xmm2
309
310 movdqu -16(arg2, arg3), %xmm1
311 pshufb %xmm11, %xmm1
312
313 # get rid of the extra data that was loaded before
314 # load the shift constant
315 lea pshufb_shf_table+16(%rip), %rax
316 sub arg3, %rax
317 movdqu (%rax), %xmm0
318
319 # shift xmm2 to the left by arg3 bytes
320 pshufb %xmm0, %xmm2
321
322 # shift xmm7 to the right by 16-arg3 bytes
323 pxor mask1(%rip), %xmm0
324 pshufb %xmm0, %xmm7
325 pblendvb %xmm2, %xmm1 #xmm0 is implicit
326
327 # fold 16 Bytes
328 movdqa %xmm1, %xmm2
329 movdqa %xmm7, %xmm8
330 pclmulqdq $0x11, %xmm10, %xmm7
331 pclmulqdq $0x0 , %xmm10, %xmm8
332 pxor %xmm8, %xmm7
333 pxor %xmm2, %xmm7
334
335_128_done:
336 # compute crc of a 128-bit value
337 movdqa rk5(%rip), %xmm10 # rk5 and rk6 in xmm10
338 movdqa %xmm7, %xmm0
339
340 #64b fold
341 pclmulqdq $0x1, %xmm10, %xmm7
342 pslldq $8 , %xmm0
343 pxor %xmm0, %xmm7
344
345 #32b fold
346 movdqa %xmm7, %xmm0
347
348 pand mask2(%rip), %xmm0
349
350 psrldq $12, %xmm7
351 pclmulqdq $0x10, %xmm10, %xmm7
352 pxor %xmm0, %xmm7
353
354 #barrett reduction
355_barrett:
356 movdqa rk7(%rip), %xmm10 # rk7 and rk8 in xmm10
357 movdqa %xmm7, %xmm0
358 pclmulqdq $0x01, %xmm10, %xmm7
359 pslldq $4, %xmm7
360 pclmulqdq $0x11, %xmm10, %xmm7
361
362 pslldq $4, %xmm7
363 pxor %xmm0, %xmm7
364 pextrd $1, %xmm7, %eax
365
366_cleanup:
367 # scale the result back to 16 bits
368 shr $16, %eax
369 mov %rcx, %rsp
370 ret
371
372########################################################################
373
374.align 16
375_less_than_128:
376
377 # check if there is enough buffer to be able to fold 16B at a time
378 cmp $32, arg3
379 jl _less_than_32
380 movdqa SHUF_MASK(%rip), %xmm11
381
382 # now if there is, load the constants
383 movdqa rk1(%rip), %xmm10 # rk1 and rk2 in xmm10
384
385 movd arg1_low32, %xmm0 # get the initial crc value
386 pslldq $12, %xmm0 # align it to its correct place
387 movdqu (arg2), %xmm7 # load the plaintext
388 pshufb %xmm11, %xmm7 # byte-reflect the plaintext
389 pxor %xmm0, %xmm7
390
391
392 # update the buffer pointer
393 add $16, arg2
394
395 # update the counter. subtract 32 instead of 16 to save one
396 # instruction from the loop
397 sub $32, arg3
398
399 jmp _16B_reduction_loop
400
401
402.align 16
403_less_than_32:
404 # mov initial crc to the return value. this is necessary for
405 # zero-length buffers.
406 mov arg1_low32, %eax
407 test arg3, arg3
408 je _cleanup
409
410 movdqa SHUF_MASK(%rip), %xmm11
411
412 movd arg1_low32, %xmm0 # get the initial crc value
413 pslldq $12, %xmm0 # align it to its correct place
414
415 cmp $16, arg3
416 je _exact_16_left
417 jl _less_than_16_left
418
419 movdqu (arg2), %xmm7 # load the plaintext
420 pshufb %xmm11, %xmm7 # byte-reflect the plaintext
421 pxor %xmm0 , %xmm7 # xor the initial crc value
422 add $16, arg2
423 sub $16, arg3
424 movdqa rk1(%rip), %xmm10 # rk1 and rk2 in xmm10
425 jmp _get_last_two_xmms
426
427
428.align 16
429_less_than_16_left:
430 # use stack space to load data less than 16 bytes, zero-out
431 # the 16B in memory first.
432
433 pxor %xmm1, %xmm1
434 mov %rsp, %r11
435 movdqa %xmm1, (%r11)
436
437 cmp $4, arg3
438 jl _only_less_than_4
439
440 # backup the counter value
441 mov arg3, %r9
442 cmp $8, arg3
443 jl _less_than_8_left
444
445 # load 8 Bytes
446 mov (arg2), %rax
447 mov %rax, (%r11)
448 add $8, %r11
449 sub $8, arg3
450 add $8, arg2
451_less_than_8_left:
452
453 cmp $4, arg3
454 jl _less_than_4_left
455
456 # load 4 Bytes
457 mov (arg2), %eax
458 mov %eax, (%r11)
459 add $4, %r11
460 sub $4, arg3
461 add $4, arg2
462_less_than_4_left:
463
464 cmp $2, arg3
465 jl _less_than_2_left
466
467 # load 2 Bytes
468 mov (arg2), %ax
469 mov %ax, (%r11)
470 add $2, %r11
471 sub $2, arg3
472 add $2, arg2
473_less_than_2_left:
474 cmp $1, arg3
475 jl _zero_left
476
477 # load 1 Byte
478 mov (arg2), %al
479 mov %al, (%r11)
480_zero_left:
481 movdqa (%rsp), %xmm7
482 pshufb %xmm11, %xmm7
483 pxor %xmm0 , %xmm7 # xor the initial crc value
484
485 # shl r9, 4
486 lea pshufb_shf_table+16(%rip), %rax
487 sub %r9, %rax
488 movdqu (%rax), %xmm0
489 pxor mask1(%rip), %xmm0
490
491 pshufb %xmm0, %xmm7
492 jmp _128_done
493
494.align 16
495_exact_16_left:
496 movdqu (arg2), %xmm7
497 pshufb %xmm11, %xmm7
498 pxor %xmm0 , %xmm7 # xor the initial crc value
499
500 jmp _128_done
501
502_only_less_than_4:
503 cmp $3, arg3
504 jl _only_less_than_3
505
506 # load 3 Bytes
507 mov (arg2), %al
508 mov %al, (%r11)
509
510 mov 1(arg2), %al
511 mov %al, 1(%r11)
512
513 mov 2(arg2), %al
514 mov %al, 2(%r11)
515
516 movdqa (%rsp), %xmm7
517 pshufb %xmm11, %xmm7
518 pxor %xmm0 , %xmm7 # xor the initial crc value
519
520 psrldq $5, %xmm7
521
522 jmp _barrett
523_only_less_than_3:
524 cmp $2, arg3
525 jl _only_less_than_2
526
527 # load 2 Bytes
528 mov (arg2), %al
529 mov %al, (%r11)
530
531 mov 1(arg2), %al
532 mov %al, 1(%r11)
533
534 movdqa (%rsp), %xmm7
535 pshufb %xmm11, %xmm7
536 pxor %xmm0 , %xmm7 # xor the initial crc value
537
538 psrldq $6, %xmm7
539
540 jmp _barrett
541_only_less_than_2:
542
543 # load 1 Byte
544 mov (arg2), %al
545 mov %al, (%r11)
546
547 movdqa (%rsp), %xmm7
548 pshufb %xmm11, %xmm7
549 pxor %xmm0 , %xmm7 # xor the initial crc value
550
551 psrldq $7, %xmm7
552
553 jmp _barrett
554
555ENDPROC(crc_t10dif_pcl)
556
557.data
558
559# precomputed constants
560# these constants are precomputed from the poly:
561# 0x8bb70000 (0x8bb7 scaled to 32 bits)
562.align 16
563# Q = 0x18BB70000
564# rk1 = 2^(32*3) mod Q << 32
565# rk2 = 2^(32*5) mod Q << 32
566# rk3 = 2^(32*15) mod Q << 32
567# rk4 = 2^(32*17) mod Q << 32
568# rk5 = 2^(32*3) mod Q << 32
569# rk6 = 2^(32*2) mod Q << 32
570# rk7 = floor(2^64/Q)
571# rk8 = Q
572rk1:
573.quad 0x2d56000000000000
574rk2:
575.quad 0x06df000000000000
576rk3:
577.quad 0x9d9d000000000000
578rk4:
579.quad 0x7cf5000000000000
580rk5:
581.quad 0x2d56000000000000
582rk6:
583.quad 0x1368000000000000
584rk7:
585.quad 0x00000001f65a57f8
586rk8:
587.quad 0x000000018bb70000
588
589rk9:
590.quad 0xceae000000000000
591rk10:
592.quad 0xbfd6000000000000
593rk11:
594.quad 0x1e16000000000000
595rk12:
596.quad 0x713c000000000000
597rk13:
598.quad 0xf7f9000000000000
599rk14:
600.quad 0x80a6000000000000
601rk15:
602.quad 0x044c000000000000
603rk16:
604.quad 0xe658000000000000
605rk17:
606.quad 0xad18000000000000
607rk18:
608.quad 0xa497000000000000
609rk19:
610.quad 0x6ee3000000000000
611rk20:
612.quad 0xe7b5000000000000
613
614
615
616mask1:
617.octa 0x80808080808080808080808080808080
618mask2:
619.octa 0x00000000FFFFFFFFFFFFFFFFFFFFFFFF
620
621SHUF_MASK:
622.octa 0x000102030405060708090A0B0C0D0E0F
623
624pshufb_shf_table:
625# use these values for shift constants for the pshufb instruction
626# different alignments result in values as shown:
627# DDQ 0x008f8e8d8c8b8a898887868584838281 # shl 15 (16-1) / shr1
628# DDQ 0x01008f8e8d8c8b8a8988878685848382 # shl 14 (16-3) / shr2
629# DDQ 0x0201008f8e8d8c8b8a89888786858483 # shl 13 (16-4) / shr3
630# DDQ 0x030201008f8e8d8c8b8a898887868584 # shl 12 (16-4) / shr4
631# DDQ 0x04030201008f8e8d8c8b8a8988878685 # shl 11 (16-5) / shr5
632# DDQ 0x0504030201008f8e8d8c8b8a89888786 # shl 10 (16-6) / shr6
633# DDQ 0x060504030201008f8e8d8c8b8a898887 # shl 9 (16-7) / shr7
634# DDQ 0x07060504030201008f8e8d8c8b8a8988 # shl 8 (16-8) / shr8
635# DDQ 0x0807060504030201008f8e8d8c8b8a89 # shl 7 (16-9) / shr9
636# DDQ 0x090807060504030201008f8e8d8c8b8a # shl 6 (16-10) / shr10
637# DDQ 0x0a090807060504030201008f8e8d8c8b # shl 5 (16-11) / shr11
638# DDQ 0x0b0a090807060504030201008f8e8d8c # shl 4 (16-12) / shr12
639# DDQ 0x0c0b0a090807060504030201008f8e8d # shl 3 (16-13) / shr13
640# DDQ 0x0d0c0b0a090807060504030201008f8e # shl 2 (16-14) / shr14
641# DDQ 0x0e0d0c0b0a090807060504030201008f # shl 1 (16-15) / shr15
642.octa 0x8f8e8d8c8b8a89888786858483828100
643.octa 0x000e0d0c0b0a09080706050403020100
diff --git a/arch/x86/crypto/crct10dif-pclmul_glue.c b/arch/x86/crypto/crct10dif-pclmul_glue.c
deleted file mode 100644
index 7845d7fd54c0..000000000000
--- a/arch/x86/crypto/crct10dif-pclmul_glue.c
+++ /dev/null
@@ -1,151 +0,0 @@
1/*
2 * Cryptographic API.
3 *
4 * T10 Data Integrity Field CRC16 Crypto Transform using PCLMULQDQ Instructions
5 *
6 * Copyright (C) 2013 Intel Corporation
7 * Author: Tim Chen <tim.c.chen@linux.intel.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
12 * any later version.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
18 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 *
23 */
24
25#include <linux/types.h>
26#include <linux/module.h>
27#include <linux/crc-t10dif.h>
28#include <crypto/internal/hash.h>
29#include <linux/init.h>
30#include <linux/string.h>
31#include <linux/kernel.h>
32#include <asm/i387.h>
33#include <asm/cpufeature.h>
34#include <asm/cpu_device_id.h>
35
36asmlinkage __u16 crc_t10dif_pcl(__u16 crc, const unsigned char *buf,
37 size_t len);
38
39struct chksum_desc_ctx {
40 __u16 crc;
41};
42
43/*
44 * Steps through buffer one byte at at time, calculates reflected
45 * crc using table.
46 */
47
48static int chksum_init(struct shash_desc *desc)
49{
50 struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
51
52 ctx->crc = 0;
53
54 return 0;
55}
56
57static int chksum_update(struct shash_desc *desc, const u8 *data,
58 unsigned int length)
59{
60 struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
61
62 if (irq_fpu_usable()) {
63 kernel_fpu_begin();
64 ctx->crc = crc_t10dif_pcl(ctx->crc, data, length);
65 kernel_fpu_end();
66 } else
67 ctx->crc = crc_t10dif_generic(ctx->crc, data, length);
68 return 0;
69}
70
71static int chksum_final(struct shash_desc *desc, u8 *out)
72{
73 struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
74
75 *(__u16 *)out = ctx->crc;
76 return 0;
77}
78
79static int __chksum_finup(__u16 *crcp, const u8 *data, unsigned int len,
80 u8 *out)
81{
82 if (irq_fpu_usable()) {
83 kernel_fpu_begin();
84 *(__u16 *)out = crc_t10dif_pcl(*crcp, data, len);
85 kernel_fpu_end();
86 } else
87 *(__u16 *)out = crc_t10dif_generic(*crcp, data, len);
88 return 0;
89}
90
91static int chksum_finup(struct shash_desc *desc, const u8 *data,
92 unsigned int len, u8 *out)
93{
94 struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
95
96 return __chksum_finup(&ctx->crc, data, len, out);
97}
98
99static int chksum_digest(struct shash_desc *desc, const u8 *data,
100 unsigned int length, u8 *out)
101{
102 struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
103
104 return __chksum_finup(&ctx->crc, data, length, out);
105}
106
107static struct shash_alg alg = {
108 .digestsize = CRC_T10DIF_DIGEST_SIZE,
109 .init = chksum_init,
110 .update = chksum_update,
111 .final = chksum_final,
112 .finup = chksum_finup,
113 .digest = chksum_digest,
114 .descsize = sizeof(struct chksum_desc_ctx),
115 .base = {
116 .cra_name = "crct10dif",
117 .cra_driver_name = "crct10dif-pclmul",
118 .cra_priority = 200,
119 .cra_blocksize = CRC_T10DIF_BLOCK_SIZE,
120 .cra_module = THIS_MODULE,
121 }
122};
123
124static const struct x86_cpu_id crct10dif_cpu_id[] = {
125 X86_FEATURE_MATCH(X86_FEATURE_PCLMULQDQ),
126 {}
127};
128MODULE_DEVICE_TABLE(x86cpu, crct10dif_cpu_id);
129
130static int __init crct10dif_intel_mod_init(void)
131{
132 if (!x86_match_cpu(crct10dif_cpu_id))
133 return -ENODEV;
134
135 return crypto_register_shash(&alg);
136}
137
138static void __exit crct10dif_intel_mod_fini(void)
139{
140 crypto_unregister_shash(&alg);
141}
142
143module_init(crct10dif_intel_mod_init);
144module_exit(crct10dif_intel_mod_fini);
145
146MODULE_AUTHOR("Tim Chen <tim.c.chen@linux.intel.com>");
147MODULE_DESCRIPTION("T10 DIF CRC calculation accelerated with PCLMULQDQ.");
148MODULE_LICENSE("GPL");
149
150MODULE_ALIAS("crct10dif");
151MODULE_ALIAS("crct10dif-pclmul");
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
index 52ff81cce008..bae3aba95b15 100644
--- a/arch/x86/ia32/ia32_aout.c
+++ b/arch/x86/ia32/ia32_aout.c
@@ -308,8 +308,6 @@ static int load_aout_binary(struct linux_binprm *bprm)
308 (current->mm->start_data = N_DATADDR(ex)); 308 (current->mm->start_data = N_DATADDR(ex));
309 current->mm->brk = ex.a_bss + 309 current->mm->brk = ex.a_bss +
310 (current->mm->start_brk = N_BSSADDR(ex)); 310 (current->mm->start_brk = N_BSSADDR(ex));
311 current->mm->free_area_cache = TASK_UNMAPPED_BASE;
312 current->mm->cached_hole_size = 0;
313 311
314 retval = setup_arg_pages(bprm, IA32_STACK_TOP, EXSTACK_DEFAULT); 312 retval = setup_arg_pages(bprm, IA32_STACK_TOP, EXSTACK_DEFAULT);
315 if (retval < 0) { 313 if (retval < 0) {
diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h
index 5f9a1243190e..d2b12988d2ed 100644
--- a/arch/x86/include/asm/cpu.h
+++ b/arch/x86/include/asm/cpu.h
@@ -28,7 +28,7 @@ struct x86_cpu {
28#ifdef CONFIG_HOTPLUG_CPU 28#ifdef CONFIG_HOTPLUG_CPU
29extern int arch_register_cpu(int num); 29extern int arch_register_cpu(int num);
30extern void arch_unregister_cpu(int); 30extern void arch_unregister_cpu(int);
31extern void __cpuinit start_cpu0(void); 31extern void start_cpu0(void);
32#ifdef CONFIG_DEBUG_HOTPLUG_CPU0 32#ifdef CONFIG_DEBUG_HOTPLUG_CPU0
33extern int _debug_hotplug_cpu(int cpu, int action); 33extern int _debug_hotplug_cpu(int cpu, int action);
34#endif 34#endif
diff --git a/arch/x86/include/asm/emergency-restart.h b/arch/x86/include/asm/emergency-restart.h
index 75ce3f47d204..77a99ac06d00 100644
--- a/arch/x86/include/asm/emergency-restart.h
+++ b/arch/x86/include/asm/emergency-restart.h
@@ -1,18 +1,6 @@
1#ifndef _ASM_X86_EMERGENCY_RESTART_H 1#ifndef _ASM_X86_EMERGENCY_RESTART_H
2#define _ASM_X86_EMERGENCY_RESTART_H 2#define _ASM_X86_EMERGENCY_RESTART_H
3 3
4enum reboot_type {
5 BOOT_TRIPLE = 't',
6 BOOT_KBD = 'k',
7 BOOT_BIOS = 'b',
8 BOOT_ACPI = 'a',
9 BOOT_EFI = 'e',
10 BOOT_CF9 = 'p',
11 BOOT_CF9_COND = 'q',
12};
13
14extern enum reboot_type reboot_type;
15
16extern void machine_emergency_restart(void); 4extern void machine_emergency_restart(void);
17 5
18#endif /* _ASM_X86_EMERGENCY_RESTART_H */ 6#endif /* _ASM_X86_EMERGENCY_RESTART_H */
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index d8e8eefbe24c..34f69cb9350a 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -345,4 +345,11 @@ extern bool xen_biovec_phys_mergeable(const struct bio_vec *vec1,
345 345
346#define IO_SPACE_LIMIT 0xffff 346#define IO_SPACE_LIMIT 0xffff
347 347
348#ifdef CONFIG_MTRR
349extern int __must_check arch_phys_wc_add(unsigned long base,
350 unsigned long size);
351extern void arch_phys_wc_del(int handle);
352#define arch_phys_wc_add arch_phys_wc_add
353#endif
354
348#endif /* _ASM_X86_IO_H */ 355#endif /* _ASM_X86_IO_H */
diff --git a/arch/x86/include/asm/mc146818rtc.h b/arch/x86/include/asm/mc146818rtc.h
index d354fb781c57..a55c7efcc4ed 100644
--- a/arch/x86/include/asm/mc146818rtc.h
+++ b/arch/x86/include/asm/mc146818rtc.h
@@ -95,8 +95,8 @@ static inline unsigned char current_lock_cmos_reg(void)
95unsigned char rtc_cmos_read(unsigned char addr); 95unsigned char rtc_cmos_read(unsigned char addr);
96void rtc_cmos_write(unsigned char val, unsigned char addr); 96void rtc_cmos_write(unsigned char val, unsigned char addr);
97 97
98extern int mach_set_rtc_mmss(unsigned long nowtime); 98extern int mach_set_rtc_mmss(const struct timespec *now);
99extern unsigned long mach_get_cmos_time(void); 99extern void mach_get_cmos_time(struct timespec *now);
100 100
101#define RTC_IRQ 8 101#define RTC_IRQ 8
102 102
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index 6b52980c29c1..29e3093bbd21 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -214,6 +214,13 @@ void mce_log_therm_throt_event(__u64 status);
214/* Interrupt Handler for core thermal thresholds */ 214/* Interrupt Handler for core thermal thresholds */
215extern int (*platform_thermal_notify)(__u64 msr_val); 215extern int (*platform_thermal_notify)(__u64 msr_val);
216 216
217/* Interrupt Handler for package thermal thresholds */
218extern int (*platform_thermal_package_notify)(__u64 msr_val);
219
220/* Callback support of rate control, return true, if
221 * callback has rate control */
222extern bool (*platform_thermal_package_rate_control)(void);
223
217#ifdef CONFIG_X86_THERMAL_VECTOR 224#ifdef CONFIG_X86_THERMAL_VECTOR
218extern void mcheck_intel_therm_init(void); 225extern void mcheck_intel_therm_init(void);
219#else 226#else
diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h
index 6bc3985ee473..f98bd6625318 100644
--- a/arch/x86/include/asm/microcode.h
+++ b/arch/x86/include/asm/microcode.h
@@ -60,11 +60,11 @@ static inline void __exit exit_amd_microcode(void) {}
60#ifdef CONFIG_MICROCODE_EARLY 60#ifdef CONFIG_MICROCODE_EARLY
61#define MAX_UCODE_COUNT 128 61#define MAX_UCODE_COUNT 128
62extern void __init load_ucode_bsp(void); 62extern void __init load_ucode_bsp(void);
63extern void __cpuinit load_ucode_ap(void); 63extern void load_ucode_ap(void);
64extern int __init save_microcode_in_initrd(void); 64extern int __init save_microcode_in_initrd(void);
65#else 65#else
66static inline void __init load_ucode_bsp(void) {} 66static inline void __init load_ucode_bsp(void) {}
67static inline void __cpuinit load_ucode_ap(void) {} 67static inline void load_ucode_ap(void) {}
68static inline int __init save_microcode_in_initrd(void) 68static inline int __init save_microcode_in_initrd(void)
69{ 69{
70 return 0; 70 return 0;
diff --git a/arch/x86/include/asm/microcode_amd.h b/arch/x86/include/asm/microcode_amd.h
index c6b043f40271..50e5c58ced23 100644
--- a/arch/x86/include/asm/microcode_amd.h
+++ b/arch/x86/include/asm/microcode_amd.h
@@ -67,11 +67,11 @@ extern enum ucode_state load_microcode_amd(int cpu, const u8 *data, size_t size)
67extern u8 amd_bsp_mpb[MPB_MAX_SIZE]; 67extern u8 amd_bsp_mpb[MPB_MAX_SIZE];
68#endif 68#endif
69extern void __init load_ucode_amd_bsp(void); 69extern void __init load_ucode_amd_bsp(void);
70extern void __cpuinit load_ucode_amd_ap(void); 70extern void load_ucode_amd_ap(void);
71extern int __init save_microcode_in_initrd_amd(void); 71extern int __init save_microcode_in_initrd_amd(void);
72#else 72#else
73static inline void __init load_ucode_amd_bsp(void) {} 73static inline void __init load_ucode_amd_bsp(void) {}
74static inline void __cpuinit load_ucode_amd_ap(void) {} 74static inline void load_ucode_amd_ap(void) {}
75static inline int __init save_microcode_in_initrd_amd(void) { return -EINVAL; } 75static inline int __init save_microcode_in_initrd_amd(void) { return -EINVAL; }
76#endif 76#endif
77 77
diff --git a/arch/x86/include/asm/microcode_intel.h b/arch/x86/include/asm/microcode_intel.h
index 87a085333cbf..9067166409bf 100644
--- a/arch/x86/include/asm/microcode_intel.h
+++ b/arch/x86/include/asm/microcode_intel.h
@@ -65,12 +65,12 @@ update_match_revision(struct microcode_header_intel *mc_header, int rev);
65 65
66#ifdef CONFIG_MICROCODE_INTEL_EARLY 66#ifdef CONFIG_MICROCODE_INTEL_EARLY
67extern void __init load_ucode_intel_bsp(void); 67extern void __init load_ucode_intel_bsp(void);
68extern void __cpuinit load_ucode_intel_ap(void); 68extern void load_ucode_intel_ap(void);
69extern void show_ucode_info_early(void); 69extern void show_ucode_info_early(void);
70extern int __init save_microcode_in_initrd_intel(void); 70extern int __init save_microcode_in_initrd_intel(void);
71#else 71#else
72static inline __init void load_ucode_intel_bsp(void) {} 72static inline __init void load_ucode_intel_bsp(void) {}
73static inline __cpuinit void load_ucode_intel_ap(void) {} 73static inline void load_ucode_intel_ap(void) {}
74static inline void show_ucode_info_early(void) {} 74static inline void show_ucode_info_early(void) {}
75static inline int __init save_microcode_in_initrd_intel(void) { return -EINVAL; } 75static inline int __init save_microcode_in_initrd_intel(void) { return -EINVAL; }
76#endif 76#endif
diff --git a/arch/x86/include/asm/mmconfig.h b/arch/x86/include/asm/mmconfig.h
index 9b119da1d105..04a3fed22cfe 100644
--- a/arch/x86/include/asm/mmconfig.h
+++ b/arch/x86/include/asm/mmconfig.h
@@ -2,8 +2,8 @@
2#define _ASM_X86_MMCONFIG_H 2#define _ASM_X86_MMCONFIG_H
3 3
4#ifdef CONFIG_PCI_MMCONFIG 4#ifdef CONFIG_PCI_MMCONFIG
5extern void __cpuinit fam10h_check_enable_mmcfg(void); 5extern void fam10h_check_enable_mmcfg(void);
6extern void __cpuinit check_enable_amd_mmconf_dmi(void); 6extern void check_enable_amd_mmconf_dmi(void);
7#else 7#else
8static inline void fam10h_check_enable_mmcfg(void) { } 8static inline void fam10h_check_enable_mmcfg(void) { }
9static inline void check_enable_amd_mmconf_dmi(void) { } 9static inline void check_enable_amd_mmconf_dmi(void) { }
diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h
index 3e2f42a4b872..626cf70082d7 100644
--- a/arch/x86/include/asm/mpspec.h
+++ b/arch/x86/include/asm/mpspec.h
@@ -94,7 +94,7 @@ static inline void early_reserve_e820_mpc_new(void) { }
94#define default_get_smp_config x86_init_uint_noop 94#define default_get_smp_config x86_init_uint_noop
95#endif 95#endif
96 96
97void __cpuinit generic_processor_info(int apicid, int version); 97void generic_processor_info(int apicid, int version);
98#ifdef CONFIG_ACPI 98#ifdef CONFIG_ACPI
99extern void mp_register_ioapic(int id, u32 address, u32 gsi_base); 99extern void mp_register_ioapic(int id, u32 address, u32 gsi_base);
100extern void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, 100extern void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
diff --git a/arch/x86/include/asm/mrst-vrtc.h b/arch/x86/include/asm/mrst-vrtc.h
index 73668abdbedf..1e69a75412a4 100644
--- a/arch/x86/include/asm/mrst-vrtc.h
+++ b/arch/x86/include/asm/mrst-vrtc.h
@@ -3,7 +3,7 @@
3 3
4extern unsigned char vrtc_cmos_read(unsigned char reg); 4extern unsigned char vrtc_cmos_read(unsigned char reg);
5extern void vrtc_cmos_write(unsigned char val, unsigned char reg); 5extern void vrtc_cmos_write(unsigned char val, unsigned char reg);
6extern unsigned long vrtc_get_time(void); 6extern void vrtc_get_time(struct timespec *now);
7extern int vrtc_set_mmss(unsigned long nowtime); 7extern int vrtc_set_mmss(const struct timespec *now);
8 8
9#endif 9#endif
diff --git a/arch/x86/include/asm/mtrr.h b/arch/x86/include/asm/mtrr.h
index e235582f9930..f768f6298419 100644
--- a/arch/x86/include/asm/mtrr.h
+++ b/arch/x86/include/asm/mtrr.h
@@ -26,7 +26,10 @@
26#include <uapi/asm/mtrr.h> 26#include <uapi/asm/mtrr.h>
27 27
28 28
29/* The following functions are for use by other drivers */ 29/*
30 * The following functions are for use by other drivers that cannot use
31 * arch_phys_wc_add and arch_phys_wc_del.
32 */
30# ifdef CONFIG_MTRR 33# ifdef CONFIG_MTRR
31extern u8 mtrr_type_lookup(u64 addr, u64 end); 34extern u8 mtrr_type_lookup(u64 addr, u64 end);
32extern void mtrr_save_fixed_ranges(void *); 35extern void mtrr_save_fixed_ranges(void *);
@@ -45,6 +48,7 @@ extern void mtrr_aps_init(void);
45extern void mtrr_bp_restore(void); 48extern void mtrr_bp_restore(void);
46extern int mtrr_trim_uncached_memory(unsigned long end_pfn); 49extern int mtrr_trim_uncached_memory(unsigned long end_pfn);
47extern int amd_special_default_mtrr(void); 50extern int amd_special_default_mtrr(void);
51extern int phys_wc_to_mtrr_index(int handle);
48# else 52# else
49static inline u8 mtrr_type_lookup(u64 addr, u64 end) 53static inline u8 mtrr_type_lookup(u64 addr, u64 end)
50{ 54{
@@ -80,6 +84,10 @@ static inline int mtrr_trim_uncached_memory(unsigned long end_pfn)
80static inline void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi) 84static inline void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi)
81{ 85{
82} 86}
87static inline int phys_wc_to_mtrr_index(int handle)
88{
89 return -1;
90}
83 91
84#define mtrr_ap_init() do {} while (0) 92#define mtrr_ap_init() do {} while (0)
85#define mtrr_bp_init() do {} while (0) 93#define mtrr_bp_init() do {} while (0)
diff --git a/arch/x86/include/asm/numa.h b/arch/x86/include/asm/numa.h
index 1b99ee5c9f00..4064acae625d 100644
--- a/arch/x86/include/asm/numa.h
+++ b/arch/x86/include/asm/numa.h
@@ -39,7 +39,7 @@ static inline void set_apicid_to_node(int apicid, s16 node)
39 __apicid_to_node[apicid] = node; 39 __apicid_to_node[apicid] = node;
40} 40}
41 41
42extern int __cpuinit numa_cpu_node(int cpu); 42extern int numa_cpu_node(int cpu);
43 43
44#else /* CONFIG_NUMA */ 44#else /* CONFIG_NUMA */
45static inline void set_apicid_to_node(int apicid, s16 node) 45static inline void set_apicid_to_node(int apicid, s16 node)
@@ -60,8 +60,8 @@ static inline int numa_cpu_node(int cpu)
60extern void numa_set_node(int cpu, int node); 60extern void numa_set_node(int cpu, int node);
61extern void numa_clear_node(int cpu); 61extern void numa_clear_node(int cpu);
62extern void __init init_cpu_to_node(void); 62extern void __init init_cpu_to_node(void);
63extern void __cpuinit numa_add_cpu(int cpu); 63extern void numa_add_cpu(int cpu);
64extern void __cpuinit numa_remove_cpu(int cpu); 64extern void numa_remove_cpu(int cpu);
65#else /* CONFIG_NUMA */ 65#else /* CONFIG_NUMA */
66static inline void numa_set_node(int cpu, int node) { } 66static inline void numa_set_node(int cpu, int node) { }
67static inline void numa_clear_node(int cpu) { } 67static inline void numa_clear_node(int cpu) { }
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 29937c4f6ff8..24cf5aefb704 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -164,7 +164,7 @@ extern const struct seq_operations cpuinfo_op;
164#define cache_line_size() (boot_cpu_data.x86_cache_alignment) 164#define cache_line_size() (boot_cpu_data.x86_cache_alignment)
165 165
166extern void cpu_detect(struct cpuinfo_x86 *c); 166extern void cpu_detect(struct cpuinfo_x86 *c);
167extern void __cpuinit fpu_detect(struct cpuinfo_x86 *c); 167extern void fpu_detect(struct cpuinfo_x86 *c);
168 168
169extern void early_cpu_init(void); 169extern void early_cpu_init(void);
170extern void identify_boot_cpu(void); 170extern void identify_boot_cpu(void);
diff --git a/arch/x86/include/asm/prom.h b/arch/x86/include/asm/prom.h
index 60bef663609a..bade6ac3b14f 100644
--- a/arch/x86/include/asm/prom.h
+++ b/arch/x86/include/asm/prom.h
@@ -27,7 +27,7 @@ extern int of_ioapic;
27extern u64 initial_dtb; 27extern u64 initial_dtb;
28extern void add_dtb(u64 data); 28extern void add_dtb(u64 data);
29extern void x86_add_irq_domains(void); 29extern void x86_add_irq_domains(void);
30void __cpuinit x86_of_pci_init(void); 30void x86_of_pci_init(void);
31void x86_dtb_init(void); 31void x86_dtb_init(void);
32#else 32#else
33static inline void add_dtb(u64 data) { } 33static inline void add_dtb(u64 data) { }
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index b073aaea747c..4137890e88e3 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -179,7 +179,7 @@ static inline int wbinvd_on_all_cpus(void)
179} 179}
180#endif /* CONFIG_SMP */ 180#endif /* CONFIG_SMP */
181 181
182extern unsigned disabled_cpus __cpuinitdata; 182extern unsigned disabled_cpus;
183 183
184#ifdef CONFIG_X86_32_SMP 184#ifdef CONFIG_X86_32_SMP
185/* 185/*
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
index d8d99222b36a..828a1565ba57 100644
--- a/arch/x86/include/asm/x86_init.h
+++ b/arch/x86/include/asm/x86_init.h
@@ -142,6 +142,8 @@ struct x86_cpuinit_ops {
142 void (*fixup_cpu_id)(struct cpuinfo_x86 *c, int node); 142 void (*fixup_cpu_id)(struct cpuinfo_x86 *c, int node);
143}; 143};
144 144
145struct timespec;
146
145/** 147/**
146 * struct x86_platform_ops - platform specific runtime functions 148 * struct x86_platform_ops - platform specific runtime functions
147 * @calibrate_tsc: calibrate TSC 149 * @calibrate_tsc: calibrate TSC
@@ -156,8 +158,8 @@ struct x86_cpuinit_ops {
156 */ 158 */
157struct x86_platform_ops { 159struct x86_platform_ops {
158 unsigned long (*calibrate_tsc)(void); 160 unsigned long (*calibrate_tsc)(void);
159 unsigned long (*get_wallclock)(void); 161 void (*get_wallclock)(struct timespec *ts);
160 int (*set_wallclock)(unsigned long nowtime); 162 int (*set_wallclock)(const struct timespec *ts);
161 void (*iommu_shutdown)(void); 163 void (*iommu_shutdown)(void);
162 bool (*is_untracked_pat_range)(u64 start, u64 end); 164 bool (*is_untracked_pat_range)(u64 start, u64 end);
163 void (*nmi_init)(void); 165 void (*nmi_init)(void);
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index d81a972dd506..2627a81253ee 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -195,7 +195,7 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)
195 return 0; 195 return 0;
196} 196}
197 197
198static void __cpuinit acpi_register_lapic(int id, u8 enabled) 198static void acpi_register_lapic(int id, u8 enabled)
199{ 199{
200 unsigned int ver = 0; 200 unsigned int ver = 0;
201 201
@@ -607,7 +607,7 @@ void __init acpi_set_irq_model_ioapic(void)
607#ifdef CONFIG_ACPI_HOTPLUG_CPU 607#ifdef CONFIG_ACPI_HOTPLUG_CPU
608#include <acpi/processor.h> 608#include <acpi/processor.h>
609 609
610static void __cpuinit acpi_map_cpu2node(acpi_handle handle, int cpu, int physid) 610static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
611{ 611{
612#ifdef CONFIG_ACPI_NUMA 612#ifdef CONFIG_ACPI_NUMA
613 int nid; 613 int nid;
@@ -620,7 +620,7 @@ static void __cpuinit acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
620#endif 620#endif
621} 621}
622 622
623static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu) 623static int _acpi_map_lsapic(acpi_handle handle, int *pcpu)
624{ 624{
625 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 625 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
626 union acpi_object *obj; 626 union acpi_object *obj;
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 2a34aaf3c8f1..33120100ff5e 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -48,9 +48,20 @@ int x86_acpi_suspend_lowlevel(void)
48#ifndef CONFIG_64BIT 48#ifndef CONFIG_64BIT
49 native_store_gdt((struct desc_ptr *)&header->pmode_gdt); 49 native_store_gdt((struct desc_ptr *)&header->pmode_gdt);
50 50
51 /*
52 * We have to check that we can write back the value, and not
53 * just read it. At least on 90 nm Pentium M (Family 6, Model
54 * 13), reading an invalid MSR is not guaranteed to trap, see
55 * Erratum X4 in "Intel Pentium M Processor on 90 nm Process
56 * with 2-MB L2 Cache and Intel® Processor A100 and A110 on 90
57 * nm process with 512-KB L2 Cache Specification Update".
58 */
51 if (!rdmsr_safe(MSR_EFER, 59 if (!rdmsr_safe(MSR_EFER,
52 &header->pmode_efer_low, 60 &header->pmode_efer_low,
53 &header->pmode_efer_high)) 61 &header->pmode_efer_high) &&
62 !wrmsr_safe(MSR_EFER,
63 header->pmode_efer_low,
64 header->pmode_efer_high))
54 header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_EFER); 65 header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_EFER);
55#endif /* !CONFIG_64BIT */ 66#endif /* !CONFIG_64BIT */
56 67
@@ -61,7 +72,10 @@ int x86_acpi_suspend_lowlevel(void)
61 } 72 }
62 if (!rdmsr_safe(MSR_IA32_MISC_ENABLE, 73 if (!rdmsr_safe(MSR_IA32_MISC_ENABLE,
63 &header->pmode_misc_en_low, 74 &header->pmode_misc_en_low,
64 &header->pmode_misc_en_high)) 75 &header->pmode_misc_en_high) &&
76 !wrmsr_safe(MSR_IA32_MISC_ENABLE,
77 header->pmode_misc_en_low,
78 header->pmode_misc_en_high))
65 header->pmode_behavior |= 79 header->pmode_behavior |=
66 (1 << WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE); 80 (1 << WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE);
67 header->realmode_flags = acpi_realmode_flags; 81 header->realmode_flags = acpi_realmode_flags;
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 99663b59123a..eca89c53a7f5 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -58,7 +58,7 @@
58 58
59unsigned int num_processors; 59unsigned int num_processors;
60 60
61unsigned disabled_cpus __cpuinitdata; 61unsigned disabled_cpus;
62 62
63/* Processor that is doing the boot up */ 63/* Processor that is doing the boot up */
64unsigned int boot_cpu_physical_apicid = -1U; 64unsigned int boot_cpu_physical_apicid = -1U;
@@ -544,7 +544,7 @@ static DEFINE_PER_CPU(struct clock_event_device, lapic_events);
544 * Setup the local APIC timer for this CPU. Copy the initialized values 544 * Setup the local APIC timer for this CPU. Copy the initialized values
545 * of the boot CPU and register the clock event in the framework. 545 * of the boot CPU and register the clock event in the framework.
546 */ 546 */
547static void __cpuinit setup_APIC_timer(void) 547static void setup_APIC_timer(void)
548{ 548{
549 struct clock_event_device *levt = &__get_cpu_var(lapic_events); 549 struct clock_event_device *levt = &__get_cpu_var(lapic_events);
550 550
@@ -866,7 +866,7 @@ void __init setup_boot_APIC_clock(void)
866 setup_APIC_timer(); 866 setup_APIC_timer();
867} 867}
868 868
869void __cpuinit setup_secondary_APIC_clock(void) 869void setup_secondary_APIC_clock(void)
870{ 870{
871 setup_APIC_timer(); 871 setup_APIC_timer();
872} 872}
@@ -1229,7 +1229,7 @@ void __init init_bsp_APIC(void)
1229 apic_write(APIC_LVT1, value); 1229 apic_write(APIC_LVT1, value);
1230} 1230}
1231 1231
1232static void __cpuinit lapic_setup_esr(void) 1232static void lapic_setup_esr(void)
1233{ 1233{
1234 unsigned int oldvalue, value, maxlvt; 1234 unsigned int oldvalue, value, maxlvt;
1235 1235
@@ -1276,7 +1276,7 @@ static void __cpuinit lapic_setup_esr(void)
1276 * Used to setup local APIC while initializing BSP or bringin up APs. 1276 * Used to setup local APIC while initializing BSP or bringin up APs.
1277 * Always called with preemption disabled. 1277 * Always called with preemption disabled.
1278 */ 1278 */
1279void __cpuinit setup_local_APIC(void) 1279void setup_local_APIC(void)
1280{ 1280{
1281 int cpu = smp_processor_id(); 1281 int cpu = smp_processor_id();
1282 unsigned int value, queued; 1282 unsigned int value, queued;
@@ -1471,7 +1471,7 @@ void __cpuinit setup_local_APIC(void)
1471#endif 1471#endif
1472} 1472}
1473 1473
1474void __cpuinit end_local_APIC_setup(void) 1474void end_local_APIC_setup(void)
1475{ 1475{
1476 lapic_setup_esr(); 1476 lapic_setup_esr();
1477 1477
@@ -2107,7 +2107,7 @@ void disconnect_bsp_APIC(int virt_wire_setup)
2107 apic_write(APIC_LVT1, value); 2107 apic_write(APIC_LVT1, value);
2108} 2108}
2109 2109
2110void __cpuinit generic_processor_info(int apicid, int version) 2110void generic_processor_info(int apicid, int version)
2111{ 2111{
2112 int cpu, max = nr_cpu_ids; 2112 int cpu, max = nr_cpu_ids;
2113 bool boot_cpu_detected = physid_isset(boot_cpu_physical_apicid, 2113 bool boot_cpu_detected = physid_isset(boot_cpu_physical_apicid,
@@ -2377,7 +2377,7 @@ static struct syscore_ops lapic_syscore_ops = {
2377 .suspend = lapic_suspend, 2377 .suspend = lapic_suspend,
2378}; 2378};
2379 2379
2380static void __cpuinit apic_pm_activate(void) 2380static void apic_pm_activate(void)
2381{ 2381{
2382 apic_pm_state.active = 1; 2382 apic_pm_state.active = 1;
2383} 2383}
@@ -2402,7 +2402,7 @@ static void apic_pm_activate(void) { }
2402 2402
2403#ifdef CONFIG_X86_64 2403#ifdef CONFIG_X86_64
2404 2404
2405static int __cpuinit apic_cluster_num(void) 2405static int apic_cluster_num(void)
2406{ 2406{
2407 int i, clusters, zeros; 2407 int i, clusters, zeros;
2408 unsigned id; 2408 unsigned id;
@@ -2447,10 +2447,10 @@ static int __cpuinit apic_cluster_num(void)
2447 return clusters; 2447 return clusters;
2448} 2448}
2449 2449
2450static int __cpuinitdata multi_checked; 2450static int multi_checked;
2451static int __cpuinitdata multi; 2451static int multi;
2452 2452
2453static int __cpuinit set_multi(const struct dmi_system_id *d) 2453static int set_multi(const struct dmi_system_id *d)
2454{ 2454{
2455 if (multi) 2455 if (multi)
2456 return 0; 2456 return 0;
@@ -2459,7 +2459,7 @@ static int __cpuinit set_multi(const struct dmi_system_id *d)
2459 return 0; 2459 return 0;
2460} 2460}
2461 2461
2462static const __cpuinitconst struct dmi_system_id multi_dmi_table[] = { 2462static const struct dmi_system_id multi_dmi_table[] = {
2463 { 2463 {
2464 .callback = set_multi, 2464 .callback = set_multi,
2465 .ident = "IBM System Summit2", 2465 .ident = "IBM System Summit2",
@@ -2471,7 +2471,7 @@ static const __cpuinitconst struct dmi_system_id multi_dmi_table[] = {
2471 {} 2471 {}
2472}; 2472};
2473 2473
2474static void __cpuinit dmi_check_multi(void) 2474static void dmi_check_multi(void)
2475{ 2475{
2476 if (multi_checked) 2476 if (multi_checked)
2477 return; 2477 return;
@@ -2488,7 +2488,7 @@ static void __cpuinit dmi_check_multi(void)
2488 * multi-chassis. 2488 * multi-chassis.
2489 * Use DMI to check them 2489 * Use DMI to check them
2490 */ 2490 */
2491__cpuinit int apic_is_clustered_box(void) 2491int apic_is_clustered_box(void)
2492{ 2492{
2493 dmi_check_multi(); 2493 dmi_check_multi();
2494 if (multi) 2494 if (multi)
diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c
index 9a9110918ca7..3e67f9e3d7ef 100644
--- a/arch/x86/kernel/apic/apic_numachip.c
+++ b/arch/x86/kernel/apic/apic_numachip.c
@@ -74,7 +74,7 @@ static int numachip_phys_pkg_id(int initial_apic_id, int index_msb)
74 return initial_apic_id >> index_msb; 74 return initial_apic_id >> index_msb;
75} 75}
76 76
77static int __cpuinit numachip_wakeup_secondary(int phys_apicid, unsigned long start_rip) 77static int numachip_wakeup_secondary(int phys_apicid, unsigned long start_rip)
78{ 78{
79 union numachip_csr_g3_ext_irq_gen int_gen; 79 union numachip_csr_g3_ext_irq_gen int_gen;
80 80
diff --git a/arch/x86/kernel/apic/es7000_32.c b/arch/x86/kernel/apic/es7000_32.c
index 0874799a98c6..c55224731b2d 100644
--- a/arch/x86/kernel/apic/es7000_32.c
+++ b/arch/x86/kernel/apic/es7000_32.c
@@ -130,7 +130,7 @@ int es7000_plat;
130 */ 130 */
131 131
132 132
133static int __cpuinit wakeup_secondary_cpu_via_mip(int cpu, unsigned long eip) 133static int wakeup_secondary_cpu_via_mip(int cpu, unsigned long eip)
134{ 134{
135 unsigned long vect = 0, psaival = 0; 135 unsigned long vect = 0, psaival = 0;
136 136
diff --git a/arch/x86/kernel/apic/numaq_32.c b/arch/x86/kernel/apic/numaq_32.c
index d661ee95cabf..1e42e8f305ee 100644
--- a/arch/x86/kernel/apic/numaq_32.c
+++ b/arch/x86/kernel/apic/numaq_32.c
@@ -105,7 +105,7 @@ static void __init smp_dump_qct(void)
105 } 105 }
106} 106}
107 107
108void __cpuinit numaq_tsc_disable(void) 108void numaq_tsc_disable(void)
109{ 109{
110 if (!found_numaq) 110 if (!found_numaq)
111 return; 111 return;
diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
index c88baa4ff0e5..140e29db478d 100644
--- a/arch/x86/kernel/apic/x2apic_cluster.c
+++ b/arch/x86/kernel/apic/x2apic_cluster.c
@@ -148,7 +148,7 @@ static void init_x2apic_ldr(void)
148 /* 148 /*
149 * At CPU state changes, update the x2apic cluster sibling info. 149 * At CPU state changes, update the x2apic cluster sibling info.
150 */ 150 */
151static int __cpuinit 151static int
152update_clusterinfo(struct notifier_block *nfb, unsigned long action, void *hcpu) 152update_clusterinfo(struct notifier_block *nfb, unsigned long action, void *hcpu)
153{ 153{
154 unsigned int this_cpu = (unsigned long)hcpu; 154 unsigned int this_cpu = (unsigned long)hcpu;
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 39cc7f7acab3..1191ac1c9d25 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -25,6 +25,7 @@
25#include <linux/kdebug.h> 25#include <linux/kdebug.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/crash_dump.h> 27#include <linux/crash_dump.h>
28#include <linux/reboot.h>
28 29
29#include <asm/uv/uv_mmrs.h> 30#include <asm/uv/uv_mmrs.h>
30#include <asm/uv/uv_hub.h> 31#include <asm/uv/uv_hub.h>
@@ -36,7 +37,6 @@
36#include <asm/ipi.h> 37#include <asm/ipi.h>
37#include <asm/smp.h> 38#include <asm/smp.h>
38#include <asm/x86_init.h> 39#include <asm/x86_init.h>
39#include <asm/emergency-restart.h>
40#include <asm/nmi.h> 40#include <asm/nmi.h>
41 41
42/* BMC sets a bit this MMR non-zero before sending an NMI */ 42/* BMC sets a bit this MMR non-zero before sending an NMI */
@@ -209,7 +209,7 @@ EXPORT_SYMBOL_GPL(uv_possible_blades);
209unsigned long sn_rtc_cycles_per_second; 209unsigned long sn_rtc_cycles_per_second;
210EXPORT_SYMBOL(sn_rtc_cycles_per_second); 210EXPORT_SYMBOL(sn_rtc_cycles_per_second);
211 211
212static int __cpuinit uv_wakeup_secondary(int phys_apicid, unsigned long start_rip) 212static int uv_wakeup_secondary(int phys_apicid, unsigned long start_rip)
213{ 213{
214#ifdef CONFIG_SMP 214#ifdef CONFIG_SMP
215 unsigned long val; 215 unsigned long val;
@@ -416,7 +416,7 @@ static struct apic __refdata apic_x2apic_uv_x = {
416 .safe_wait_icr_idle = native_safe_x2apic_wait_icr_idle, 416 .safe_wait_icr_idle = native_safe_x2apic_wait_icr_idle,
417}; 417};
418 418
419static __cpuinit void set_x2apic_extra_bits(int pnode) 419static void set_x2apic_extra_bits(int pnode)
420{ 420{
421 __this_cpu_write(x2apic_extra_bits, pnode << uvh_apicid.s.pnode_shift); 421 __this_cpu_write(x2apic_extra_bits, pnode << uvh_apicid.s.pnode_shift);
422} 422}
@@ -735,7 +735,7 @@ static void uv_heartbeat(unsigned long ignored)
735 mod_timer_pinned(timer, jiffies + SCIR_CPU_HB_INTERVAL); 735 mod_timer_pinned(timer, jiffies + SCIR_CPU_HB_INTERVAL);
736} 736}
737 737
738static void __cpuinit uv_heartbeat_enable(int cpu) 738static void uv_heartbeat_enable(int cpu)
739{ 739{
740 while (!uv_cpu_hub_info(cpu)->scir.enabled) { 740 while (!uv_cpu_hub_info(cpu)->scir.enabled) {
741 struct timer_list *timer = &uv_cpu_hub_info(cpu)->scir.timer; 741 struct timer_list *timer = &uv_cpu_hub_info(cpu)->scir.timer;
@@ -752,7 +752,7 @@ static void __cpuinit uv_heartbeat_enable(int cpu)
752} 752}
753 753
754#ifdef CONFIG_HOTPLUG_CPU 754#ifdef CONFIG_HOTPLUG_CPU
755static void __cpuinit uv_heartbeat_disable(int cpu) 755static void uv_heartbeat_disable(int cpu)
756{ 756{
757 if (uv_cpu_hub_info(cpu)->scir.enabled) { 757 if (uv_cpu_hub_info(cpu)->scir.enabled) {
758 uv_cpu_hub_info(cpu)->scir.enabled = 0; 758 uv_cpu_hub_info(cpu)->scir.enabled = 0;
@@ -764,8 +764,8 @@ static void __cpuinit uv_heartbeat_disable(int cpu)
764/* 764/*
765 * cpu hotplug notifier 765 * cpu hotplug notifier
766 */ 766 */
767static __cpuinit int uv_scir_cpu_notify(struct notifier_block *self, 767static int uv_scir_cpu_notify(struct notifier_block *self, unsigned long action,
768 unsigned long action, void *hcpu) 768 void *hcpu)
769{ 769{
770 long cpu = (long)hcpu; 770 long cpu = (long)hcpu;
771 771
@@ -835,7 +835,7 @@ int uv_set_vga_state(struct pci_dev *pdev, bool decode,
835 * Called on each cpu to initialize the per_cpu UV data area. 835 * Called on each cpu to initialize the per_cpu UV data area.
836 * FIXME: hotplug not supported yet 836 * FIXME: hotplug not supported yet
837 */ 837 */
838void __cpuinit uv_cpu_init(void) 838void uv_cpu_init(void)
839{ 839{
840 /* CPU 0 initilization will be done via uv_system_init. */ 840 /* CPU 0 initilization will be done via uv_system_init. */
841 if (!uv_blade_info) 841 if (!uv_blade_info)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index c587a8757227..f654ecefea5b 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -69,7 +69,7 @@ static inline int wrmsrl_amd_safe(unsigned msr, unsigned long long val)
69extern void vide(void); 69extern void vide(void);
70__asm__(".align 4\nvide: ret"); 70__asm__(".align 4\nvide: ret");
71 71
72static void __cpuinit init_amd_k5(struct cpuinfo_x86 *c) 72static void init_amd_k5(struct cpuinfo_x86 *c)
73{ 73{
74/* 74/*
75 * General Systems BIOSen alias the cpu frequency registers 75 * General Systems BIOSen alias the cpu frequency registers
@@ -87,7 +87,7 @@ static void __cpuinit init_amd_k5(struct cpuinfo_x86 *c)
87} 87}
88 88
89 89
90static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c) 90static void init_amd_k6(struct cpuinfo_x86 *c)
91{ 91{
92 u32 l, h; 92 u32 l, h;
93 int mbytes = get_num_physpages() >> (20-PAGE_SHIFT); 93 int mbytes = get_num_physpages() >> (20-PAGE_SHIFT);
@@ -179,7 +179,7 @@ static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c)
179 } 179 }
180} 180}
181 181
182static void __cpuinit amd_k7_smp_check(struct cpuinfo_x86 *c) 182static void amd_k7_smp_check(struct cpuinfo_x86 *c)
183{ 183{
184 /* calling is from identify_secondary_cpu() ? */ 184 /* calling is from identify_secondary_cpu() ? */
185 if (!c->cpu_index) 185 if (!c->cpu_index)
@@ -222,7 +222,7 @@ static void __cpuinit amd_k7_smp_check(struct cpuinfo_x86 *c)
222 add_taint(TAINT_UNSAFE_SMP, LOCKDEP_NOW_UNRELIABLE); 222 add_taint(TAINT_UNSAFE_SMP, LOCKDEP_NOW_UNRELIABLE);
223} 223}
224 224
225static void __cpuinit init_amd_k7(struct cpuinfo_x86 *c) 225static void init_amd_k7(struct cpuinfo_x86 *c)
226{ 226{
227 u32 l, h; 227 u32 l, h;
228 228
@@ -267,7 +267,7 @@ static void __cpuinit init_amd_k7(struct cpuinfo_x86 *c)
267 * To workaround broken NUMA config. Read the comment in 267 * To workaround broken NUMA config. Read the comment in
268 * srat_detect_node(). 268 * srat_detect_node().
269 */ 269 */
270static int __cpuinit nearby_node(int apicid) 270static int nearby_node(int apicid)
271{ 271{
272 int i, node; 272 int i, node;
273 273
@@ -292,7 +292,7 @@ static int __cpuinit nearby_node(int apicid)
292 * (2) AMD processors supporting compute units 292 * (2) AMD processors supporting compute units
293 */ 293 */
294#ifdef CONFIG_X86_HT 294#ifdef CONFIG_X86_HT
295static void __cpuinit amd_get_topology(struct cpuinfo_x86 *c) 295static void amd_get_topology(struct cpuinfo_x86 *c)
296{ 296{
297 u32 nodes, cores_per_cu = 1; 297 u32 nodes, cores_per_cu = 1;
298 u8 node_id; 298 u8 node_id;
@@ -342,7 +342,7 @@ static void __cpuinit amd_get_topology(struct cpuinfo_x86 *c)
342 * On a AMD dual core setup the lower bits of the APIC id distingush the cores. 342 * On a AMD dual core setup the lower bits of the APIC id distingush the cores.
343 * Assumes number of cores is a power of two. 343 * Assumes number of cores is a power of two.
344 */ 344 */
345static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c) 345static void amd_detect_cmp(struct cpuinfo_x86 *c)
346{ 346{
347#ifdef CONFIG_X86_HT 347#ifdef CONFIG_X86_HT
348 unsigned bits; 348 unsigned bits;
@@ -369,7 +369,7 @@ u16 amd_get_nb_id(int cpu)
369} 369}
370EXPORT_SYMBOL_GPL(amd_get_nb_id); 370EXPORT_SYMBOL_GPL(amd_get_nb_id);
371 371
372static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c) 372static void srat_detect_node(struct cpuinfo_x86 *c)
373{ 373{
374#ifdef CONFIG_NUMA 374#ifdef CONFIG_NUMA
375 int cpu = smp_processor_id(); 375 int cpu = smp_processor_id();
@@ -421,7 +421,7 @@ static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c)
421#endif 421#endif
422} 422}
423 423
424static void __cpuinit early_init_amd_mc(struct cpuinfo_x86 *c) 424static void early_init_amd_mc(struct cpuinfo_x86 *c)
425{ 425{
426#ifdef CONFIG_X86_HT 426#ifdef CONFIG_X86_HT
427 unsigned bits, ecx; 427 unsigned bits, ecx;
@@ -447,7 +447,7 @@ static void __cpuinit early_init_amd_mc(struct cpuinfo_x86 *c)
447#endif 447#endif
448} 448}
449 449
450static void __cpuinit bsp_init_amd(struct cpuinfo_x86 *c) 450static void bsp_init_amd(struct cpuinfo_x86 *c)
451{ 451{
452 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { 452 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) {
453 453
@@ -475,7 +475,7 @@ static void __cpuinit bsp_init_amd(struct cpuinfo_x86 *c)
475 } 475 }
476} 476}
477 477
478static void __cpuinit early_init_amd(struct cpuinfo_x86 *c) 478static void early_init_amd(struct cpuinfo_x86 *c)
479{ 479{
480 early_init_amd_mc(c); 480 early_init_amd_mc(c);
481 481
@@ -514,7 +514,7 @@ static const int amd_erratum_383[];
514static const int amd_erratum_400[]; 514static const int amd_erratum_400[];
515static bool cpu_has_amd_erratum(const int *erratum); 515static bool cpu_has_amd_erratum(const int *erratum);
516 516
517static void __cpuinit init_amd(struct cpuinfo_x86 *c) 517static void init_amd(struct cpuinfo_x86 *c)
518{ 518{
519 u32 dummy; 519 u32 dummy;
520 unsigned long long value; 520 unsigned long long value;
@@ -740,8 +740,7 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
740} 740}
741 741
742#ifdef CONFIG_X86_32 742#ifdef CONFIG_X86_32
743static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c, 743static unsigned int amd_size_cache(struct cpuinfo_x86 *c, unsigned int size)
744 unsigned int size)
745{ 744{
746 /* AMD errata T13 (order #21922) */ 745 /* AMD errata T13 (order #21922) */
747 if ((c->x86 == 6)) { 746 if ((c->x86 == 6)) {
@@ -757,7 +756,7 @@ static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c,
757} 756}
758#endif 757#endif
759 758
760static void __cpuinit cpu_set_tlb_flushall_shift(struct cpuinfo_x86 *c) 759static void cpu_set_tlb_flushall_shift(struct cpuinfo_x86 *c)
761{ 760{
762 tlb_flushall_shift = 5; 761 tlb_flushall_shift = 5;
763 762
@@ -765,7 +764,7 @@ static void __cpuinit cpu_set_tlb_flushall_shift(struct cpuinfo_x86 *c)
765 tlb_flushall_shift = 4; 764 tlb_flushall_shift = 4;
766} 765}
767 766
768static void __cpuinit cpu_detect_tlb_amd(struct cpuinfo_x86 *c) 767static void cpu_detect_tlb_amd(struct cpuinfo_x86 *c)
769{ 768{
770 u32 ebx, eax, ecx, edx; 769 u32 ebx, eax, ecx, edx;
771 u16 mask = 0xfff; 770 u16 mask = 0xfff;
@@ -820,7 +819,7 @@ static void __cpuinit cpu_detect_tlb_amd(struct cpuinfo_x86 *c)
820 cpu_set_tlb_flushall_shift(c); 819 cpu_set_tlb_flushall_shift(c);
821} 820}
822 821
823static const struct cpu_dev __cpuinitconst amd_cpu_dev = { 822static const struct cpu_dev amd_cpu_dev = {
824 .c_vendor = "AMD", 823 .c_vendor = "AMD",
825 .c_ident = { "AuthenticAMD" }, 824 .c_ident = { "AuthenticAMD" },
826#ifdef CONFIG_X86_32 825#ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c
index 159103c0b1f4..fbf6c3bc2400 100644
--- a/arch/x86/kernel/cpu/centaur.c
+++ b/arch/x86/kernel/cpu/centaur.c
@@ -11,7 +11,7 @@
11 11
12#ifdef CONFIG_X86_OOSTORE 12#ifdef CONFIG_X86_OOSTORE
13 13
14static u32 __cpuinit power2(u32 x) 14static u32 power2(u32 x)
15{ 15{
16 u32 s = 1; 16 u32 s = 1;
17 17
@@ -25,7 +25,7 @@ static u32 __cpuinit power2(u32 x)
25/* 25/*
26 * Set up an actual MCR 26 * Set up an actual MCR
27 */ 27 */
28static void __cpuinit centaur_mcr_insert(int reg, u32 base, u32 size, int key) 28static void centaur_mcr_insert(int reg, u32 base, u32 size, int key)
29{ 29{
30 u32 lo, hi; 30 u32 lo, hi;
31 31
@@ -42,7 +42,7 @@ static void __cpuinit centaur_mcr_insert(int reg, u32 base, u32 size, int key)
42 * 42 *
43 * Shortcut: We know you can't put 4Gig of RAM on a winchip 43 * Shortcut: We know you can't put 4Gig of RAM on a winchip
44 */ 44 */
45static u32 __cpuinit ramtop(void) 45static u32 ramtop(void)
46{ 46{
47 u32 clip = 0xFFFFFFFFUL; 47 u32 clip = 0xFFFFFFFFUL;
48 u32 top = 0; 48 u32 top = 0;
@@ -91,7 +91,7 @@ static u32 __cpuinit ramtop(void)
91/* 91/*
92 * Compute a set of MCR's to give maximum coverage 92 * Compute a set of MCR's to give maximum coverage
93 */ 93 */
94static int __cpuinit centaur_mcr_compute(int nr, int key) 94static int centaur_mcr_compute(int nr, int key)
95{ 95{
96 u32 mem = ramtop(); 96 u32 mem = ramtop();
97 u32 root = power2(mem); 97 u32 root = power2(mem);
@@ -157,7 +157,7 @@ static int __cpuinit centaur_mcr_compute(int nr, int key)
157 return ct; 157 return ct;
158} 158}
159 159
160static void __cpuinit centaur_create_optimal_mcr(void) 160static void centaur_create_optimal_mcr(void)
161{ 161{
162 int used; 162 int used;
163 int i; 163 int i;
@@ -181,7 +181,7 @@ static void __cpuinit centaur_create_optimal_mcr(void)
181 wrmsr(MSR_IDT_MCR0+i, 0, 0); 181 wrmsr(MSR_IDT_MCR0+i, 0, 0);
182} 182}
183 183
184static void __cpuinit winchip2_create_optimal_mcr(void) 184static void winchip2_create_optimal_mcr(void)
185{ 185{
186 u32 lo, hi; 186 u32 lo, hi;
187 int used; 187 int used;
@@ -217,7 +217,7 @@ static void __cpuinit winchip2_create_optimal_mcr(void)
217/* 217/*
218 * Handle the MCR key on the Winchip 2. 218 * Handle the MCR key on the Winchip 2.
219 */ 219 */
220static void __cpuinit winchip2_unprotect_mcr(void) 220static void winchip2_unprotect_mcr(void)
221{ 221{
222 u32 lo, hi; 222 u32 lo, hi;
223 u32 key; 223 u32 key;
@@ -229,7 +229,7 @@ static void __cpuinit winchip2_unprotect_mcr(void)
229 wrmsr(MSR_IDT_MCR_CTRL, lo, hi); 229 wrmsr(MSR_IDT_MCR_CTRL, lo, hi);
230} 230}
231 231
232static void __cpuinit winchip2_protect_mcr(void) 232static void winchip2_protect_mcr(void)
233{ 233{
234 u32 lo, hi; 234 u32 lo, hi;
235 235
@@ -247,7 +247,7 @@ static void __cpuinit winchip2_protect_mcr(void)
247#define RNG_ENABLED (1 << 3) 247#define RNG_ENABLED (1 << 3)
248#define RNG_ENABLE (1 << 6) /* MSR_VIA_RNG */ 248#define RNG_ENABLE (1 << 6) /* MSR_VIA_RNG */
249 249
250static void __cpuinit init_c3(struct cpuinfo_x86 *c) 250static void init_c3(struct cpuinfo_x86 *c)
251{ 251{
252 u32 lo, hi; 252 u32 lo, hi;
253 253
@@ -318,7 +318,7 @@ enum {
318 EAMD3D = 1<<20, 318 EAMD3D = 1<<20,
319}; 319};
320 320
321static void __cpuinit early_init_centaur(struct cpuinfo_x86 *c) 321static void early_init_centaur(struct cpuinfo_x86 *c)
322{ 322{
323 switch (c->x86) { 323 switch (c->x86) {
324#ifdef CONFIG_X86_32 324#ifdef CONFIG_X86_32
@@ -337,7 +337,7 @@ static void __cpuinit early_init_centaur(struct cpuinfo_x86 *c)
337#endif 337#endif
338} 338}
339 339
340static void __cpuinit init_centaur(struct cpuinfo_x86 *c) 340static void init_centaur(struct cpuinfo_x86 *c)
341{ 341{
342#ifdef CONFIG_X86_32 342#ifdef CONFIG_X86_32
343 char *name; 343 char *name;
@@ -468,7 +468,7 @@ static void __cpuinit init_centaur(struct cpuinfo_x86 *c)
468#endif 468#endif
469} 469}
470 470
471static unsigned int __cpuinit 471static unsigned int
472centaur_size_cache(struct cpuinfo_x86 *c, unsigned int size) 472centaur_size_cache(struct cpuinfo_x86 *c, unsigned int size)
473{ 473{
474#ifdef CONFIG_X86_32 474#ifdef CONFIG_X86_32
@@ -488,7 +488,7 @@ centaur_size_cache(struct cpuinfo_x86 *c, unsigned int size)
488 return size; 488 return size;
489} 489}
490 490
491static const struct cpu_dev __cpuinitconst centaur_cpu_dev = { 491static const struct cpu_dev centaur_cpu_dev = {
492 .c_vendor = "Centaur", 492 .c_vendor = "Centaur",
493 .c_ident = { "CentaurHauls" }, 493 .c_ident = { "CentaurHauls" },
494 .c_early_init = early_init_centaur, 494 .c_early_init = early_init_centaur,
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 548bd039784e..25eb2747b063 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -63,7 +63,7 @@ void __init setup_cpu_local_masks(void)
63 alloc_bootmem_cpumask_var(&cpu_sibling_setup_mask); 63 alloc_bootmem_cpumask_var(&cpu_sibling_setup_mask);
64} 64}
65 65
66static void __cpuinit default_init(struct cpuinfo_x86 *c) 66static void default_init(struct cpuinfo_x86 *c)
67{ 67{
68#ifdef CONFIG_X86_64 68#ifdef CONFIG_X86_64
69 cpu_detect_cache_sizes(c); 69 cpu_detect_cache_sizes(c);
@@ -80,13 +80,13 @@ static void __cpuinit default_init(struct cpuinfo_x86 *c)
80#endif 80#endif
81} 81}
82 82
83static const struct cpu_dev __cpuinitconst default_cpu = { 83static const struct cpu_dev default_cpu = {
84 .c_init = default_init, 84 .c_init = default_init,
85 .c_vendor = "Unknown", 85 .c_vendor = "Unknown",
86 .c_x86_vendor = X86_VENDOR_UNKNOWN, 86 .c_x86_vendor = X86_VENDOR_UNKNOWN,
87}; 87};
88 88
89static const struct cpu_dev *this_cpu __cpuinitdata = &default_cpu; 89static const struct cpu_dev *this_cpu = &default_cpu;
90 90
91DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = { 91DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = {
92#ifdef CONFIG_X86_64 92#ifdef CONFIG_X86_64
@@ -160,8 +160,8 @@ static int __init x86_xsaveopt_setup(char *s)
160__setup("noxsaveopt", x86_xsaveopt_setup); 160__setup("noxsaveopt", x86_xsaveopt_setup);
161 161
162#ifdef CONFIG_X86_32 162#ifdef CONFIG_X86_32
163static int cachesize_override __cpuinitdata = -1; 163static int cachesize_override = -1;
164static int disable_x86_serial_nr __cpuinitdata = 1; 164static int disable_x86_serial_nr = 1;
165 165
166static int __init cachesize_setup(char *str) 166static int __init cachesize_setup(char *str)
167{ 167{
@@ -215,12 +215,12 @@ static inline int flag_is_changeable_p(u32 flag)
215} 215}
216 216
217/* Probe for the CPUID instruction */ 217/* Probe for the CPUID instruction */
218int __cpuinit have_cpuid_p(void) 218int have_cpuid_p(void)
219{ 219{
220 return flag_is_changeable_p(X86_EFLAGS_ID); 220 return flag_is_changeable_p(X86_EFLAGS_ID);
221} 221}
222 222
223static void __cpuinit squash_the_stupid_serial_number(struct cpuinfo_x86 *c) 223static void squash_the_stupid_serial_number(struct cpuinfo_x86 *c)
224{ 224{
225 unsigned long lo, hi; 225 unsigned long lo, hi;
226 226
@@ -298,7 +298,7 @@ struct cpuid_dependent_feature {
298 u32 level; 298 u32 level;
299}; 299};
300 300
301static const struct cpuid_dependent_feature __cpuinitconst 301static const struct cpuid_dependent_feature
302cpuid_dependent_features[] = { 302cpuid_dependent_features[] = {
303 { X86_FEATURE_MWAIT, 0x00000005 }, 303 { X86_FEATURE_MWAIT, 0x00000005 },
304 { X86_FEATURE_DCA, 0x00000009 }, 304 { X86_FEATURE_DCA, 0x00000009 },
@@ -306,7 +306,7 @@ cpuid_dependent_features[] = {
306 { 0, 0 } 306 { 0, 0 }
307}; 307};
308 308
309static void __cpuinit filter_cpuid_features(struct cpuinfo_x86 *c, bool warn) 309static void filter_cpuid_features(struct cpuinfo_x86 *c, bool warn)
310{ 310{
311 const struct cpuid_dependent_feature *df; 311 const struct cpuid_dependent_feature *df;
312 312
@@ -344,7 +344,7 @@ static void __cpuinit filter_cpuid_features(struct cpuinfo_x86 *c, bool warn)
344 */ 344 */
345 345
346/* Look up CPU names by table lookup. */ 346/* Look up CPU names by table lookup. */
347static const char *__cpuinit table_lookup_model(struct cpuinfo_x86 *c) 347static const char *table_lookup_model(struct cpuinfo_x86 *c)
348{ 348{
349 const struct cpu_model_info *info; 349 const struct cpu_model_info *info;
350 350
@@ -364,8 +364,8 @@ static const char *__cpuinit table_lookup_model(struct cpuinfo_x86 *c)
364 return NULL; /* Not found */ 364 return NULL; /* Not found */
365} 365}
366 366
367__u32 cpu_caps_cleared[NCAPINTS] __cpuinitdata; 367__u32 cpu_caps_cleared[NCAPINTS];
368__u32 cpu_caps_set[NCAPINTS] __cpuinitdata; 368__u32 cpu_caps_set[NCAPINTS];
369 369
370void load_percpu_segment(int cpu) 370void load_percpu_segment(int cpu)
371{ 371{
@@ -394,9 +394,9 @@ void switch_to_new_gdt(int cpu)
394 load_percpu_segment(cpu); 394 load_percpu_segment(cpu);
395} 395}
396 396
397static const struct cpu_dev *__cpuinitdata cpu_devs[X86_VENDOR_NUM] = {}; 397static const struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {};
398 398
399static void __cpuinit get_model_name(struct cpuinfo_x86 *c) 399static void get_model_name(struct cpuinfo_x86 *c)
400{ 400{
401 unsigned int *v; 401 unsigned int *v;
402 char *p, *q; 402 char *p, *q;
@@ -425,7 +425,7 @@ static void __cpuinit get_model_name(struct cpuinfo_x86 *c)
425 } 425 }
426} 426}
427 427
428void __cpuinit cpu_detect_cache_sizes(struct cpuinfo_x86 *c) 428void cpu_detect_cache_sizes(struct cpuinfo_x86 *c)
429{ 429{
430 unsigned int n, dummy, ebx, ecx, edx, l2size; 430 unsigned int n, dummy, ebx, ecx, edx, l2size;
431 431
@@ -479,7 +479,7 @@ u16 __read_mostly tlb_lld_4m[NR_INFO];
479 */ 479 */
480s8 __read_mostly tlb_flushall_shift = -1; 480s8 __read_mostly tlb_flushall_shift = -1;
481 481
482void __cpuinit cpu_detect_tlb(struct cpuinfo_x86 *c) 482void cpu_detect_tlb(struct cpuinfo_x86 *c)
483{ 483{
484 if (this_cpu->c_detect_tlb) 484 if (this_cpu->c_detect_tlb)
485 this_cpu->c_detect_tlb(c); 485 this_cpu->c_detect_tlb(c);
@@ -493,7 +493,7 @@ void __cpuinit cpu_detect_tlb(struct cpuinfo_x86 *c)
493 tlb_flushall_shift); 493 tlb_flushall_shift);
494} 494}
495 495
496void __cpuinit detect_ht(struct cpuinfo_x86 *c) 496void detect_ht(struct cpuinfo_x86 *c)
497{ 497{
498#ifdef CONFIG_X86_HT 498#ifdef CONFIG_X86_HT
499 u32 eax, ebx, ecx, edx; 499 u32 eax, ebx, ecx, edx;
@@ -544,7 +544,7 @@ out:
544#endif 544#endif
545} 545}
546 546
547static void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c) 547static void get_cpu_vendor(struct cpuinfo_x86 *c)
548{ 548{
549 char *v = c->x86_vendor_id; 549 char *v = c->x86_vendor_id;
550 int i; 550 int i;
@@ -571,7 +571,7 @@ static void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c)
571 this_cpu = &default_cpu; 571 this_cpu = &default_cpu;
572} 572}
573 573
574void __cpuinit cpu_detect(struct cpuinfo_x86 *c) 574void cpu_detect(struct cpuinfo_x86 *c)
575{ 575{
576 /* Get vendor name */ 576 /* Get vendor name */
577 cpuid(0x00000000, (unsigned int *)&c->cpuid_level, 577 cpuid(0x00000000, (unsigned int *)&c->cpuid_level,
@@ -601,7 +601,7 @@ void __cpuinit cpu_detect(struct cpuinfo_x86 *c)
601 } 601 }
602} 602}
603 603
604void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c) 604void get_cpu_cap(struct cpuinfo_x86 *c)
605{ 605{
606 u32 tfms, xlvl; 606 u32 tfms, xlvl;
607 u32 ebx; 607 u32 ebx;
@@ -652,7 +652,7 @@ void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)
652 init_scattered_cpuid_features(c); 652 init_scattered_cpuid_features(c);
653} 653}
654 654
655static void __cpuinit identify_cpu_without_cpuid(struct cpuinfo_x86 *c) 655static void identify_cpu_without_cpuid(struct cpuinfo_x86 *c)
656{ 656{
657#ifdef CONFIG_X86_32 657#ifdef CONFIG_X86_32
658 int i; 658 int i;
@@ -769,7 +769,7 @@ void __init early_cpu_init(void)
769 * unless we can find a reliable way to detect all the broken cases. 769 * unless we can find a reliable way to detect all the broken cases.
770 * Enable it explicitly on 64-bit for non-constant inputs of cpu_has(). 770 * Enable it explicitly on 64-bit for non-constant inputs of cpu_has().
771 */ 771 */
772static void __cpuinit detect_nopl(struct cpuinfo_x86 *c) 772static void detect_nopl(struct cpuinfo_x86 *c)
773{ 773{
774#ifdef CONFIG_X86_32 774#ifdef CONFIG_X86_32
775 clear_cpu_cap(c, X86_FEATURE_NOPL); 775 clear_cpu_cap(c, X86_FEATURE_NOPL);
@@ -778,7 +778,7 @@ static void __cpuinit detect_nopl(struct cpuinfo_x86 *c)
778#endif 778#endif
779} 779}
780 780
781static void __cpuinit generic_identify(struct cpuinfo_x86 *c) 781static void generic_identify(struct cpuinfo_x86 *c)
782{ 782{
783 c->extended_cpuid_level = 0; 783 c->extended_cpuid_level = 0;
784 784
@@ -815,7 +815,7 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 *c)
815/* 815/*
816 * This does the hard work of actually picking apart the CPU stuff... 816 * This does the hard work of actually picking apart the CPU stuff...
817 */ 817 */
818static void __cpuinit identify_cpu(struct cpuinfo_x86 *c) 818static void identify_cpu(struct cpuinfo_x86 *c)
819{ 819{
820 int i; 820 int i;
821 821
@@ -960,7 +960,7 @@ void __init identify_boot_cpu(void)
960 cpu_detect_tlb(&boot_cpu_data); 960 cpu_detect_tlb(&boot_cpu_data);
961} 961}
962 962
963void __cpuinit identify_secondary_cpu(struct cpuinfo_x86 *c) 963void identify_secondary_cpu(struct cpuinfo_x86 *c)
964{ 964{
965 BUG_ON(c == &boot_cpu_data); 965 BUG_ON(c == &boot_cpu_data);
966 identify_cpu(c); 966 identify_cpu(c);
@@ -975,14 +975,14 @@ struct msr_range {
975 unsigned max; 975 unsigned max;
976}; 976};
977 977
978static const struct msr_range msr_range_array[] __cpuinitconst = { 978static const struct msr_range msr_range_array[] = {
979 { 0x00000000, 0x00000418}, 979 { 0x00000000, 0x00000418},
980 { 0xc0000000, 0xc000040b}, 980 { 0xc0000000, 0xc000040b},
981 { 0xc0010000, 0xc0010142}, 981 { 0xc0010000, 0xc0010142},
982 { 0xc0011000, 0xc001103b}, 982 { 0xc0011000, 0xc001103b},
983}; 983};
984 984
985static void __cpuinit __print_cpu_msr(void) 985static void __print_cpu_msr(void)
986{ 986{
987 unsigned index_min, index_max; 987 unsigned index_min, index_max;
988 unsigned index; 988 unsigned index;
@@ -1001,7 +1001,7 @@ static void __cpuinit __print_cpu_msr(void)
1001 } 1001 }
1002} 1002}
1003 1003
1004static int show_msr __cpuinitdata; 1004static int show_msr;
1005 1005
1006static __init int setup_show_msr(char *arg) 1006static __init int setup_show_msr(char *arg)
1007{ 1007{
@@ -1022,7 +1022,7 @@ static __init int setup_noclflush(char *arg)
1022} 1022}
1023__setup("noclflush", setup_noclflush); 1023__setup("noclflush", setup_noclflush);
1024 1024
1025void __cpuinit print_cpu_info(struct cpuinfo_x86 *c) 1025void print_cpu_info(struct cpuinfo_x86 *c)
1026{ 1026{
1027 const char *vendor = NULL; 1027 const char *vendor = NULL;
1028 1028
@@ -1051,7 +1051,7 @@ void __cpuinit print_cpu_info(struct cpuinfo_x86 *c)
1051 print_cpu_msr(c); 1051 print_cpu_msr(c);
1052} 1052}
1053 1053
1054void __cpuinit print_cpu_msr(struct cpuinfo_x86 *c) 1054void print_cpu_msr(struct cpuinfo_x86 *c)
1055{ 1055{
1056 if (c->cpu_index < show_msr) 1056 if (c->cpu_index < show_msr)
1057 __print_cpu_msr(); 1057 __print_cpu_msr();
@@ -1216,7 +1216,7 @@ static void dbg_restore_debug_regs(void)
1216 */ 1216 */
1217#ifdef CONFIG_X86_64 1217#ifdef CONFIG_X86_64
1218 1218
1219void __cpuinit cpu_init(void) 1219void cpu_init(void)
1220{ 1220{
1221 struct orig_ist *oist; 1221 struct orig_ist *oist;
1222 struct task_struct *me; 1222 struct task_struct *me;
@@ -1315,7 +1315,7 @@ void __cpuinit cpu_init(void)
1315 1315
1316#else 1316#else
1317 1317
1318void __cpuinit cpu_init(void) 1318void cpu_init(void)
1319{ 1319{
1320 int cpu = smp_processor_id(); 1320 int cpu = smp_processor_id();
1321 struct task_struct *curr = current; 1321 struct task_struct *curr = current;
diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c
index 7582f475b163..d0969c75ab54 100644
--- a/arch/x86/kernel/cpu/cyrix.c
+++ b/arch/x86/kernel/cpu/cyrix.c
@@ -15,7 +15,7 @@
15/* 15/*
16 * Read NSC/Cyrix DEVID registers (DIR) to get more detailed info. about the CPU 16 * Read NSC/Cyrix DEVID registers (DIR) to get more detailed info. about the CPU
17 */ 17 */
18static void __cpuinit __do_cyrix_devid(unsigned char *dir0, unsigned char *dir1) 18static void __do_cyrix_devid(unsigned char *dir0, unsigned char *dir1)
19{ 19{
20 unsigned char ccr2, ccr3; 20 unsigned char ccr2, ccr3;
21 21
@@ -44,7 +44,7 @@ static void __cpuinit __do_cyrix_devid(unsigned char *dir0, unsigned char *dir1)
44 } 44 }
45} 45}
46 46
47static void __cpuinit do_cyrix_devid(unsigned char *dir0, unsigned char *dir1) 47static void do_cyrix_devid(unsigned char *dir0, unsigned char *dir1)
48{ 48{
49 unsigned long flags; 49 unsigned long flags;
50 50
@@ -59,25 +59,25 @@ static void __cpuinit do_cyrix_devid(unsigned char *dir0, unsigned char *dir1)
59 * Actually since bugs.h doesn't even reference this perhaps someone should 59 * Actually since bugs.h doesn't even reference this perhaps someone should
60 * fix the documentation ??? 60 * fix the documentation ???
61 */ 61 */
62static unsigned char Cx86_dir0_msb __cpuinitdata = 0; 62static unsigned char Cx86_dir0_msb = 0;
63 63
64static const char __cpuinitconst Cx86_model[][9] = { 64static const char Cx86_model[][9] = {
65 "Cx486", "Cx486", "5x86 ", "6x86", "MediaGX ", "6x86MX ", 65 "Cx486", "Cx486", "5x86 ", "6x86", "MediaGX ", "6x86MX ",
66 "M II ", "Unknown" 66 "M II ", "Unknown"
67}; 67};
68static const char __cpuinitconst Cx486_name[][5] = { 68static const char Cx486_name[][5] = {
69 "SLC", "DLC", "SLC2", "DLC2", "SRx", "DRx", 69 "SLC", "DLC", "SLC2", "DLC2", "SRx", "DRx",
70 "SRx2", "DRx2" 70 "SRx2", "DRx2"
71}; 71};
72static const char __cpuinitconst Cx486S_name[][4] = { 72static const char Cx486S_name[][4] = {
73 "S", "S2", "Se", "S2e" 73 "S", "S2", "Se", "S2e"
74}; 74};
75static const char __cpuinitconst Cx486D_name[][4] = { 75static const char Cx486D_name[][4] = {
76 "DX", "DX2", "?", "?", "?", "DX4" 76 "DX", "DX2", "?", "?", "?", "DX4"
77}; 77};
78static char Cx86_cb[] __cpuinitdata = "?.5x Core/Bus Clock"; 78static char Cx86_cb[] = "?.5x Core/Bus Clock";
79static const char __cpuinitconst cyrix_model_mult1[] = "12??43"; 79static const char cyrix_model_mult1[] = "12??43";
80static const char __cpuinitconst cyrix_model_mult2[] = "12233445"; 80static const char cyrix_model_mult2[] = "12233445";
81 81
82/* 82/*
83 * Reset the slow-loop (SLOP) bit on the 686(L) which is set by some old 83 * Reset the slow-loop (SLOP) bit on the 686(L) which is set by some old
@@ -87,7 +87,7 @@ static const char __cpuinitconst cyrix_model_mult2[] = "12233445";
87 * FIXME: our newer udelay uses the tsc. We don't need to frob with SLOP 87 * FIXME: our newer udelay uses the tsc. We don't need to frob with SLOP
88 */ 88 */
89 89
90static void __cpuinit check_cx686_slop(struct cpuinfo_x86 *c) 90static void check_cx686_slop(struct cpuinfo_x86 *c)
91{ 91{
92 unsigned long flags; 92 unsigned long flags;
93 93
@@ -112,7 +112,7 @@ static void __cpuinit check_cx686_slop(struct cpuinfo_x86 *c)
112} 112}
113 113
114 114
115static void __cpuinit set_cx86_reorder(void) 115static void set_cx86_reorder(void)
116{ 116{
117 u8 ccr3; 117 u8 ccr3;
118 118
@@ -127,7 +127,7 @@ static void __cpuinit set_cx86_reorder(void)
127 setCx86(CX86_CCR3, ccr3); 127 setCx86(CX86_CCR3, ccr3);
128} 128}
129 129
130static void __cpuinit set_cx86_memwb(void) 130static void set_cx86_memwb(void)
131{ 131{
132 printk(KERN_INFO "Enable Memory-Write-back mode on Cyrix/NSC processor.\n"); 132 printk(KERN_INFO "Enable Memory-Write-back mode on Cyrix/NSC processor.\n");
133 133
@@ -143,7 +143,7 @@ static void __cpuinit set_cx86_memwb(void)
143 * Configure later MediaGX and/or Geode processor. 143 * Configure later MediaGX and/or Geode processor.
144 */ 144 */
145 145
146static void __cpuinit geode_configure(void) 146static void geode_configure(void)
147{ 147{
148 unsigned long flags; 148 unsigned long flags;
149 u8 ccr3; 149 u8 ccr3;
@@ -166,7 +166,7 @@ static void __cpuinit geode_configure(void)
166 local_irq_restore(flags); 166 local_irq_restore(flags);
167} 167}
168 168
169static void __cpuinit early_init_cyrix(struct cpuinfo_x86 *c) 169static void early_init_cyrix(struct cpuinfo_x86 *c)
170{ 170{
171 unsigned char dir0, dir0_msn, dir1 = 0; 171 unsigned char dir0, dir0_msn, dir1 = 0;
172 172
@@ -185,7 +185,7 @@ static void __cpuinit early_init_cyrix(struct cpuinfo_x86 *c)
185 } 185 }
186} 186}
187 187
188static void __cpuinit init_cyrix(struct cpuinfo_x86 *c) 188static void init_cyrix(struct cpuinfo_x86 *c)
189{ 189{
190 unsigned char dir0, dir0_msn, dir0_lsn, dir1 = 0; 190 unsigned char dir0, dir0_msn, dir0_lsn, dir1 = 0;
191 char *buf = c->x86_model_id; 191 char *buf = c->x86_model_id;
@@ -356,7 +356,7 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c)
356/* 356/*
357 * Handle National Semiconductor branded processors 357 * Handle National Semiconductor branded processors
358 */ 358 */
359static void __cpuinit init_nsc(struct cpuinfo_x86 *c) 359static void init_nsc(struct cpuinfo_x86 *c)
360{ 360{
361 /* 361 /*
362 * There may be GX1 processors in the wild that are branded 362 * There may be GX1 processors in the wild that are branded
@@ -405,7 +405,7 @@ static inline int test_cyrix_52div(void)
405 return (unsigned char) (test >> 8) == 0x02; 405 return (unsigned char) (test >> 8) == 0x02;
406} 406}
407 407
408static void __cpuinit cyrix_identify(struct cpuinfo_x86 *c) 408static void cyrix_identify(struct cpuinfo_x86 *c)
409{ 409{
410 /* Detect Cyrix with disabled CPUID */ 410 /* Detect Cyrix with disabled CPUID */
411 if (c->x86 == 4 && test_cyrix_52div()) { 411 if (c->x86 == 4 && test_cyrix_52div()) {
@@ -441,7 +441,7 @@ static void __cpuinit cyrix_identify(struct cpuinfo_x86 *c)
441 } 441 }
442} 442}
443 443
444static const struct cpu_dev __cpuinitconst cyrix_cpu_dev = { 444static const struct cpu_dev cyrix_cpu_dev = {
445 .c_vendor = "Cyrix", 445 .c_vendor = "Cyrix",
446 .c_ident = { "CyrixInstead" }, 446 .c_ident = { "CyrixInstead" },
447 .c_early_init = early_init_cyrix, 447 .c_early_init = early_init_cyrix,
@@ -452,7 +452,7 @@ static const struct cpu_dev __cpuinitconst cyrix_cpu_dev = {
452 452
453cpu_dev_register(cyrix_cpu_dev); 453cpu_dev_register(cyrix_cpu_dev);
454 454
455static const struct cpu_dev __cpuinitconst nsc_cpu_dev = { 455static const struct cpu_dev nsc_cpu_dev = {
456 .c_vendor = "NSC", 456 .c_vendor = "NSC",
457 .c_ident = { "Geode by NSC" }, 457 .c_ident = { "Geode by NSC" },
458 .c_init = init_nsc, 458 .c_init = init_nsc,
diff --git a/arch/x86/kernel/cpu/hypervisor.c b/arch/x86/kernel/cpu/hypervisor.c
index 1e7e84a02eba..87279212d318 100644
--- a/arch/x86/kernel/cpu/hypervisor.c
+++ b/arch/x86/kernel/cpu/hypervisor.c
@@ -60,7 +60,7 @@ detect_hypervisor_vendor(void)
60 } 60 }
61} 61}
62 62
63void __cpuinit init_hypervisor(struct cpuinfo_x86 *c) 63void init_hypervisor(struct cpuinfo_x86 *c)
64{ 64{
65 if (x86_hyper && x86_hyper->set_cpu_features) 65 if (x86_hyper && x86_hyper->set_cpu_features)
66 x86_hyper->set_cpu_features(c); 66 x86_hyper->set_cpu_features(c);
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 9b0c441c03f5..ec7299566f79 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -26,7 +26,7 @@
26#include <asm/apic.h> 26#include <asm/apic.h>
27#endif 27#endif
28 28
29static void __cpuinit early_init_intel(struct cpuinfo_x86 *c) 29static void early_init_intel(struct cpuinfo_x86 *c)
30{ 30{
31 u64 misc_enable; 31 u64 misc_enable;
32 32
@@ -163,7 +163,7 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
163 * This is called before we do cpu ident work 163 * This is called before we do cpu ident work
164 */ 164 */
165 165
166int __cpuinit ppro_with_ram_bug(void) 166int ppro_with_ram_bug(void)
167{ 167{
168 /* Uses data from early_cpu_detect now */ 168 /* Uses data from early_cpu_detect now */
169 if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL && 169 if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
@@ -176,7 +176,7 @@ int __cpuinit ppro_with_ram_bug(void)
176 return 0; 176 return 0;
177} 177}
178 178
179static void __cpuinit intel_smp_check(struct cpuinfo_x86 *c) 179static void intel_smp_check(struct cpuinfo_x86 *c)
180{ 180{
181 /* calling is from identify_secondary_cpu() ? */ 181 /* calling is from identify_secondary_cpu() ? */
182 if (!c->cpu_index) 182 if (!c->cpu_index)
@@ -196,7 +196,7 @@ static void __cpuinit intel_smp_check(struct cpuinfo_x86 *c)
196 } 196 }
197} 197}
198 198
199static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c) 199static void intel_workarounds(struct cpuinfo_x86 *c)
200{ 200{
201 unsigned long lo, hi; 201 unsigned long lo, hi;
202 202
@@ -275,12 +275,12 @@ static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
275 intel_smp_check(c); 275 intel_smp_check(c);
276} 276}
277#else 277#else
278static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c) 278static void intel_workarounds(struct cpuinfo_x86 *c)
279{ 279{
280} 280}
281#endif 281#endif
282 282
283static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c) 283static void srat_detect_node(struct cpuinfo_x86 *c)
284{ 284{
285#ifdef CONFIG_NUMA 285#ifdef CONFIG_NUMA
286 unsigned node; 286 unsigned node;
@@ -300,7 +300,7 @@ static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c)
300/* 300/*
301 * find out the number of processor cores on the die 301 * find out the number of processor cores on the die
302 */ 302 */
303static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c) 303static int intel_num_cpu_cores(struct cpuinfo_x86 *c)
304{ 304{
305 unsigned int eax, ebx, ecx, edx; 305 unsigned int eax, ebx, ecx, edx;
306 306
@@ -315,7 +315,7 @@ static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
315 return 1; 315 return 1;
316} 316}
317 317
318static void __cpuinit detect_vmx_virtcap(struct cpuinfo_x86 *c) 318static void detect_vmx_virtcap(struct cpuinfo_x86 *c)
319{ 319{
320 /* Intel VMX MSR indicated features */ 320 /* Intel VMX MSR indicated features */
321#define X86_VMX_FEATURE_PROC_CTLS_TPR_SHADOW 0x00200000 321#define X86_VMX_FEATURE_PROC_CTLS_TPR_SHADOW 0x00200000
@@ -353,7 +353,7 @@ static void __cpuinit detect_vmx_virtcap(struct cpuinfo_x86 *c)
353 } 353 }
354} 354}
355 355
356static void __cpuinit init_intel(struct cpuinfo_x86 *c) 356static void init_intel(struct cpuinfo_x86 *c)
357{ 357{
358 unsigned int l2 = 0; 358 unsigned int l2 = 0;
359 359
@@ -472,7 +472,7 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
472} 472}
473 473
474#ifdef CONFIG_X86_32 474#ifdef CONFIG_X86_32
475static unsigned int __cpuinit intel_size_cache(struct cpuinfo_x86 *c, unsigned int size) 475static unsigned int intel_size_cache(struct cpuinfo_x86 *c, unsigned int size)
476{ 476{
477 /* 477 /*
478 * Intel PIII Tualatin. This comes in two flavours. 478 * Intel PIII Tualatin. This comes in two flavours.
@@ -506,7 +506,7 @@ static unsigned int __cpuinit intel_size_cache(struct cpuinfo_x86 *c, unsigned i
506 506
507#define STLB_4K 0x41 507#define STLB_4K 0x41
508 508
509static const struct _tlb_table intel_tlb_table[] __cpuinitconst = { 509static const struct _tlb_table intel_tlb_table[] = {
510 { 0x01, TLB_INST_4K, 32, " TLB_INST 4 KByte pages, 4-way set associative" }, 510 { 0x01, TLB_INST_4K, 32, " TLB_INST 4 KByte pages, 4-way set associative" },
511 { 0x02, TLB_INST_4M, 2, " TLB_INST 4 MByte pages, full associative" }, 511 { 0x02, TLB_INST_4M, 2, " TLB_INST 4 MByte pages, full associative" },
512 { 0x03, TLB_DATA_4K, 64, " TLB_DATA 4 KByte pages, 4-way set associative" }, 512 { 0x03, TLB_DATA_4K, 64, " TLB_DATA 4 KByte pages, 4-way set associative" },
@@ -536,7 +536,7 @@ static const struct _tlb_table intel_tlb_table[] __cpuinitconst = {
536 { 0x00, 0, 0 } 536 { 0x00, 0, 0 }
537}; 537};
538 538
539static void __cpuinit intel_tlb_lookup(const unsigned char desc) 539static void intel_tlb_lookup(const unsigned char desc)
540{ 540{
541 unsigned char k; 541 unsigned char k;
542 if (desc == 0) 542 if (desc == 0)
@@ -605,7 +605,7 @@ static void __cpuinit intel_tlb_lookup(const unsigned char desc)
605 } 605 }
606} 606}
607 607
608static void __cpuinit intel_tlb_flushall_shift_set(struct cpuinfo_x86 *c) 608static void intel_tlb_flushall_shift_set(struct cpuinfo_x86 *c)
609{ 609{
610 switch ((c->x86 << 8) + c->x86_model) { 610 switch ((c->x86 << 8) + c->x86_model) {
611 case 0x60f: /* original 65 nm celeron/pentium/core2/xeon, "Merom"/"Conroe" */ 611 case 0x60f: /* original 65 nm celeron/pentium/core2/xeon, "Merom"/"Conroe" */
@@ -634,7 +634,7 @@ static void __cpuinit intel_tlb_flushall_shift_set(struct cpuinfo_x86 *c)
634 } 634 }
635} 635}
636 636
637static void __cpuinit intel_detect_tlb(struct cpuinfo_x86 *c) 637static void intel_detect_tlb(struct cpuinfo_x86 *c)
638{ 638{
639 int i, j, n; 639 int i, j, n;
640 unsigned int regs[4]; 640 unsigned int regs[4];
@@ -661,7 +661,7 @@ static void __cpuinit intel_detect_tlb(struct cpuinfo_x86 *c)
661 intel_tlb_flushall_shift_set(c); 661 intel_tlb_flushall_shift_set(c);
662} 662}
663 663
664static const struct cpu_dev __cpuinitconst intel_cpu_dev = { 664static const struct cpu_dev intel_cpu_dev = {
665 .c_vendor = "Intel", 665 .c_vendor = "Intel",
666 .c_ident = { "GenuineIntel" }, 666 .c_ident = { "GenuineIntel" },
667#ifdef CONFIG_X86_32 667#ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 8dc72dda66fe..1414c90feaba 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -37,7 +37,7 @@ struct _cache_table {
37/* All the cache descriptor types we care about (no TLB or 37/* All the cache descriptor types we care about (no TLB or
38 trace cache entries) */ 38 trace cache entries) */
39 39
40static const struct _cache_table __cpuinitconst cache_table[] = 40static const struct _cache_table cache_table[] =
41{ 41{
42 { 0x06, LVL_1_INST, 8 }, /* 4-way set assoc, 32 byte line size */ 42 { 0x06, LVL_1_INST, 8 }, /* 4-way set assoc, 32 byte line size */
43 { 0x08, LVL_1_INST, 16 }, /* 4-way set assoc, 32 byte line size */ 43 { 0x08, LVL_1_INST, 16 }, /* 4-way set assoc, 32 byte line size */
@@ -203,7 +203,7 @@ union l3_cache {
203 unsigned val; 203 unsigned val;
204}; 204};
205 205
206static const unsigned short __cpuinitconst assocs[] = { 206static const unsigned short assocs[] = {
207 [1] = 1, 207 [1] = 1,
208 [2] = 2, 208 [2] = 2,
209 [4] = 4, 209 [4] = 4,
@@ -217,10 +217,10 @@ static const unsigned short __cpuinitconst assocs[] = {
217 [0xf] = 0xffff /* fully associative - no way to show this currently */ 217 [0xf] = 0xffff /* fully associative - no way to show this currently */
218}; 218};
219 219
220static const unsigned char __cpuinitconst levels[] = { 1, 1, 2, 3 }; 220static const unsigned char levels[] = { 1, 1, 2, 3 };
221static const unsigned char __cpuinitconst types[] = { 1, 2, 3, 3 }; 221static const unsigned char types[] = { 1, 2, 3, 3 };
222 222
223static void __cpuinit 223static void
224amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax, 224amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax,
225 union _cpuid4_leaf_ebx *ebx, 225 union _cpuid4_leaf_ebx *ebx,
226 union _cpuid4_leaf_ecx *ecx) 226 union _cpuid4_leaf_ecx *ecx)
@@ -302,7 +302,7 @@ struct _cache_attr {
302/* 302/*
303 * L3 cache descriptors 303 * L3 cache descriptors
304 */ 304 */
305static void __cpuinit amd_calc_l3_indices(struct amd_northbridge *nb) 305static void amd_calc_l3_indices(struct amd_northbridge *nb)
306{ 306{
307 struct amd_l3_cache *l3 = &nb->l3_cache; 307 struct amd_l3_cache *l3 = &nb->l3_cache;
308 unsigned int sc0, sc1, sc2, sc3; 308 unsigned int sc0, sc1, sc2, sc3;
@@ -325,7 +325,7 @@ static void __cpuinit amd_calc_l3_indices(struct amd_northbridge *nb)
325 l3->indices = (max(max3(sc0, sc1, sc2), sc3) << 10) - 1; 325 l3->indices = (max(max3(sc0, sc1, sc2), sc3) << 10) - 1;
326} 326}
327 327
328static void __cpuinit amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf, int index) 328static void amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf, int index)
329{ 329{
330 int node; 330 int node;
331 331
@@ -528,8 +528,7 @@ static struct _cache_attr subcaches =
528#endif /* CONFIG_AMD_NB && CONFIG_SYSFS */ 528#endif /* CONFIG_AMD_NB && CONFIG_SYSFS */
529 529
530static int 530static int
531__cpuinit cpuid4_cache_lookup_regs(int index, 531cpuid4_cache_lookup_regs(int index, struct _cpuid4_info_regs *this_leaf)
532 struct _cpuid4_info_regs *this_leaf)
533{ 532{
534 union _cpuid4_leaf_eax eax; 533 union _cpuid4_leaf_eax eax;
535 union _cpuid4_leaf_ebx ebx; 534 union _cpuid4_leaf_ebx ebx;
@@ -560,7 +559,7 @@ __cpuinit cpuid4_cache_lookup_regs(int index,
560 return 0; 559 return 0;
561} 560}
562 561
563static int __cpuinit find_num_cache_leaves(struct cpuinfo_x86 *c) 562static int find_num_cache_leaves(struct cpuinfo_x86 *c)
564{ 563{
565 unsigned int eax, ebx, ecx, edx, op; 564 unsigned int eax, ebx, ecx, edx, op;
566 union _cpuid4_leaf_eax cache_eax; 565 union _cpuid4_leaf_eax cache_eax;
@@ -580,7 +579,7 @@ static int __cpuinit find_num_cache_leaves(struct cpuinfo_x86 *c)
580 return i; 579 return i;
581} 580}
582 581
583void __cpuinit init_amd_cacheinfo(struct cpuinfo_x86 *c) 582void init_amd_cacheinfo(struct cpuinfo_x86 *c)
584{ 583{
585 584
586 if (cpu_has_topoext) { 585 if (cpu_has_topoext) {
@@ -593,7 +592,7 @@ void __cpuinit init_amd_cacheinfo(struct cpuinfo_x86 *c)
593 } 592 }
594} 593}
595 594
596unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c) 595unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c)
597{ 596{
598 /* Cache sizes */ 597 /* Cache sizes */
599 unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0; 598 unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0;
@@ -744,7 +743,7 @@ static DEFINE_PER_CPU(struct _cpuid4_info *, ici_cpuid4_info);
744 743
745#ifdef CONFIG_SMP 744#ifdef CONFIG_SMP
746 745
747static int __cpuinit cache_shared_amd_cpu_map_setup(unsigned int cpu, int index) 746static int cache_shared_amd_cpu_map_setup(unsigned int cpu, int index)
748{ 747{
749 struct _cpuid4_info *this_leaf; 748 struct _cpuid4_info *this_leaf;
750 int i, sibling; 749 int i, sibling;
@@ -793,7 +792,7 @@ static int __cpuinit cache_shared_amd_cpu_map_setup(unsigned int cpu, int index)
793 return 1; 792 return 1;
794} 793}
795 794
796static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) 795static void cache_shared_cpu_map_setup(unsigned int cpu, int index)
797{ 796{
798 struct _cpuid4_info *this_leaf, *sibling_leaf; 797 struct _cpuid4_info *this_leaf, *sibling_leaf;
799 unsigned long num_threads_sharing; 798 unsigned long num_threads_sharing;
@@ -828,7 +827,7 @@ static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
828 } 827 }
829 } 828 }
830} 829}
831static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index) 830static void cache_remove_shared_cpu_map(unsigned int cpu, int index)
832{ 831{
833 struct _cpuid4_info *this_leaf, *sibling_leaf; 832 struct _cpuid4_info *this_leaf, *sibling_leaf;
834 int sibling; 833 int sibling;
@@ -841,16 +840,16 @@ static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index)
841 } 840 }
842} 841}
843#else 842#else
844static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) 843static void cache_shared_cpu_map_setup(unsigned int cpu, int index)
845{ 844{
846} 845}
847 846
848static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index) 847static void cache_remove_shared_cpu_map(unsigned int cpu, int index)
849{ 848{
850} 849}
851#endif 850#endif
852 851
853static void __cpuinit free_cache_attributes(unsigned int cpu) 852static void free_cache_attributes(unsigned int cpu)
854{ 853{
855 int i; 854 int i;
856 855
@@ -861,7 +860,7 @@ static void __cpuinit free_cache_attributes(unsigned int cpu)
861 per_cpu(ici_cpuid4_info, cpu) = NULL; 860 per_cpu(ici_cpuid4_info, cpu) = NULL;
862} 861}
863 862
864static void __cpuinit get_cpu_leaves(void *_retval) 863static void get_cpu_leaves(void *_retval)
865{ 864{
866 int j, *retval = _retval, cpu = smp_processor_id(); 865 int j, *retval = _retval, cpu = smp_processor_id();
867 866
@@ -881,7 +880,7 @@ static void __cpuinit get_cpu_leaves(void *_retval)
881 } 880 }
882} 881}
883 882
884static int __cpuinit detect_cache_attributes(unsigned int cpu) 883static int detect_cache_attributes(unsigned int cpu)
885{ 884{
886 int retval; 885 int retval;
887 886
@@ -1015,7 +1014,7 @@ static struct attribute *default_attrs[] = {
1015}; 1014};
1016 1015
1017#ifdef CONFIG_AMD_NB 1016#ifdef CONFIG_AMD_NB
1018static struct attribute ** __cpuinit amd_l3_attrs(void) 1017static struct attribute **amd_l3_attrs(void)
1019{ 1018{
1020 static struct attribute **attrs; 1019 static struct attribute **attrs;
1021 int n; 1020 int n;
@@ -1091,7 +1090,7 @@ static struct kobj_type ktype_percpu_entry = {
1091 .sysfs_ops = &sysfs_ops, 1090 .sysfs_ops = &sysfs_ops,
1092}; 1091};
1093 1092
1094static void __cpuinit cpuid4_cache_sysfs_exit(unsigned int cpu) 1093static void cpuid4_cache_sysfs_exit(unsigned int cpu)
1095{ 1094{
1096 kfree(per_cpu(ici_cache_kobject, cpu)); 1095 kfree(per_cpu(ici_cache_kobject, cpu));
1097 kfree(per_cpu(ici_index_kobject, cpu)); 1096 kfree(per_cpu(ici_index_kobject, cpu));
@@ -1100,7 +1099,7 @@ static void __cpuinit cpuid4_cache_sysfs_exit(unsigned int cpu)
1100 free_cache_attributes(cpu); 1099 free_cache_attributes(cpu);
1101} 1100}
1102 1101
1103static int __cpuinit cpuid4_cache_sysfs_init(unsigned int cpu) 1102static int cpuid4_cache_sysfs_init(unsigned int cpu)
1104{ 1103{
1105 int err; 1104 int err;
1106 1105
@@ -1132,7 +1131,7 @@ err_out:
1132static DECLARE_BITMAP(cache_dev_map, NR_CPUS); 1131static DECLARE_BITMAP(cache_dev_map, NR_CPUS);
1133 1132
1134/* Add/Remove cache interface for CPU device */ 1133/* Add/Remove cache interface for CPU device */
1135static int __cpuinit cache_add_dev(struct device *dev) 1134static int cache_add_dev(struct device *dev)
1136{ 1135{
1137 unsigned int cpu = dev->id; 1136 unsigned int cpu = dev->id;
1138 unsigned long i, j; 1137 unsigned long i, j;
@@ -1183,7 +1182,7 @@ static int __cpuinit cache_add_dev(struct device *dev)
1183 return 0; 1182 return 0;
1184} 1183}
1185 1184
1186static void __cpuinit cache_remove_dev(struct device *dev) 1185static void cache_remove_dev(struct device *dev)
1187{ 1186{
1188 unsigned int cpu = dev->id; 1187 unsigned int cpu = dev->id;
1189 unsigned long i; 1188 unsigned long i;
@@ -1200,8 +1199,8 @@ static void __cpuinit cache_remove_dev(struct device *dev)
1200 cpuid4_cache_sysfs_exit(cpu); 1199 cpuid4_cache_sysfs_exit(cpu);
1201} 1200}
1202 1201
1203static int __cpuinit cacheinfo_cpu_callback(struct notifier_block *nfb, 1202static int cacheinfo_cpu_callback(struct notifier_block *nfb,
1204 unsigned long action, void *hcpu) 1203 unsigned long action, void *hcpu)
1205{ 1204{
1206 unsigned int cpu = (unsigned long)hcpu; 1205 unsigned int cpu = (unsigned long)hcpu;
1207 struct device *dev; 1206 struct device *dev;
@@ -1220,7 +1219,7 @@ static int __cpuinit cacheinfo_cpu_callback(struct notifier_block *nfb,
1220 return NOTIFY_OK; 1219 return NOTIFY_OK;
1221} 1220}
1222 1221
1223static struct notifier_block __cpuinitdata cacheinfo_cpu_notifier = { 1222static struct notifier_block cacheinfo_cpu_notifier = {
1224 .notifier_call = cacheinfo_cpu_callback, 1223 .notifier_call = cacheinfo_cpu_callback,
1225}; 1224};
1226 1225
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index bf49cdbb010f..87a65c939bcd 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1363,7 +1363,7 @@ int mce_notify_irq(void)
1363} 1363}
1364EXPORT_SYMBOL_GPL(mce_notify_irq); 1364EXPORT_SYMBOL_GPL(mce_notify_irq);
1365 1365
1366static int __cpuinit __mcheck_cpu_mce_banks_init(void) 1366static int __mcheck_cpu_mce_banks_init(void)
1367{ 1367{
1368 int i; 1368 int i;
1369 u8 num_banks = mca_cfg.banks; 1369 u8 num_banks = mca_cfg.banks;
@@ -1384,7 +1384,7 @@ static int __cpuinit __mcheck_cpu_mce_banks_init(void)
1384/* 1384/*
1385 * Initialize Machine Checks for a CPU. 1385 * Initialize Machine Checks for a CPU.
1386 */ 1386 */
1387static int __cpuinit __mcheck_cpu_cap_init(void) 1387static int __mcheck_cpu_cap_init(void)
1388{ 1388{
1389 unsigned b; 1389 unsigned b;
1390 u64 cap; 1390 u64 cap;
@@ -1483,7 +1483,7 @@ static void quirk_sandybridge_ifu(int bank, struct mce *m, struct pt_regs *regs)
1483} 1483}
1484 1484
1485/* Add per CPU specific workarounds here */ 1485/* Add per CPU specific workarounds here */
1486static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c) 1486static int __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
1487{ 1487{
1488 struct mca_config *cfg = &mca_cfg; 1488 struct mca_config *cfg = &mca_cfg;
1489 1489
@@ -1593,7 +1593,7 @@ static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
1593 return 0; 1593 return 0;
1594} 1594}
1595 1595
1596static int __cpuinit __mcheck_cpu_ancient_init(struct cpuinfo_x86 *c) 1596static int __mcheck_cpu_ancient_init(struct cpuinfo_x86 *c)
1597{ 1597{
1598 if (c->x86 != 5) 1598 if (c->x86 != 5)
1599 return 0; 1599 return 0;
@@ -1664,7 +1664,7 @@ void (*machine_check_vector)(struct pt_regs *, long error_code) =
1664 * Called for each booted CPU to set up machine checks. 1664 * Called for each booted CPU to set up machine checks.
1665 * Must be called with preempt off: 1665 * Must be called with preempt off:
1666 */ 1666 */
1667void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c) 1667void mcheck_cpu_init(struct cpuinfo_x86 *c)
1668{ 1668{
1669 if (mca_cfg.disabled) 1669 if (mca_cfg.disabled)
1670 return; 1670 return;
@@ -2082,7 +2082,6 @@ static struct bus_type mce_subsys = {
2082 2082
2083DEFINE_PER_CPU(struct device *, mce_device); 2083DEFINE_PER_CPU(struct device *, mce_device);
2084 2084
2085__cpuinitdata
2086void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu); 2085void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu);
2087 2086
2088static inline struct mce_bank *attr_to_bank(struct device_attribute *attr) 2087static inline struct mce_bank *attr_to_bank(struct device_attribute *attr)
@@ -2228,7 +2227,7 @@ static void mce_device_release(struct device *dev)
2228} 2227}
2229 2228
2230/* Per cpu device init. All of the cpus still share the same ctrl bank: */ 2229/* Per cpu device init. All of the cpus still share the same ctrl bank: */
2231static __cpuinit int mce_device_create(unsigned int cpu) 2230static int mce_device_create(unsigned int cpu)
2232{ 2231{
2233 struct device *dev; 2232 struct device *dev;
2234 int err; 2233 int err;
@@ -2274,7 +2273,7 @@ error:
2274 return err; 2273 return err;
2275} 2274}
2276 2275
2277static __cpuinit void mce_device_remove(unsigned int cpu) 2276static void mce_device_remove(unsigned int cpu)
2278{ 2277{
2279 struct device *dev = per_cpu(mce_device, cpu); 2278 struct device *dev = per_cpu(mce_device, cpu);
2280 int i; 2279 int i;
@@ -2294,7 +2293,7 @@ static __cpuinit void mce_device_remove(unsigned int cpu)
2294} 2293}
2295 2294
2296/* Make sure there are no machine checks on offlined CPUs. */ 2295/* Make sure there are no machine checks on offlined CPUs. */
2297static void __cpuinit mce_disable_cpu(void *h) 2296static void mce_disable_cpu(void *h)
2298{ 2297{
2299 unsigned long action = *(unsigned long *)h; 2298 unsigned long action = *(unsigned long *)h;
2300 int i; 2299 int i;
@@ -2312,7 +2311,7 @@ static void __cpuinit mce_disable_cpu(void *h)
2312 } 2311 }
2313} 2312}
2314 2313
2315static void __cpuinit mce_reenable_cpu(void *h) 2314static void mce_reenable_cpu(void *h)
2316{ 2315{
2317 unsigned long action = *(unsigned long *)h; 2316 unsigned long action = *(unsigned long *)h;
2318 int i; 2317 int i;
@@ -2331,7 +2330,7 @@ static void __cpuinit mce_reenable_cpu(void *h)
2331} 2330}
2332 2331
2333/* Get notified when a cpu comes on/off. Be hotplug friendly. */ 2332/* Get notified when a cpu comes on/off. Be hotplug friendly. */
2334static int __cpuinit 2333static int
2335mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) 2334mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
2336{ 2335{
2337 unsigned int cpu = (unsigned long)hcpu; 2336 unsigned int cpu = (unsigned long)hcpu;
@@ -2367,7 +2366,7 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
2367 return NOTIFY_OK; 2366 return NOTIFY_OK;
2368} 2367}
2369 2368
2370static struct notifier_block mce_cpu_notifier __cpuinitdata = { 2369static struct notifier_block mce_cpu_notifier = {
2371 .notifier_call = mce_cpu_callback, 2370 .notifier_call = mce_cpu_callback,
2372}; 2371};
2373 2372
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 9cb52767999a..603df4f74640 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -458,10 +458,8 @@ static struct kobj_type threshold_ktype = {
458 .default_attrs = default_attrs, 458 .default_attrs = default_attrs,
459}; 459};
460 460
461static __cpuinit int allocate_threshold_blocks(unsigned int cpu, 461static int allocate_threshold_blocks(unsigned int cpu, unsigned int bank,
462 unsigned int bank, 462 unsigned int block, u32 address)
463 unsigned int block,
464 u32 address)
465{ 463{
466 struct threshold_block *b = NULL; 464 struct threshold_block *b = NULL;
467 u32 low, high; 465 u32 low, high;
@@ -543,7 +541,7 @@ out_free:
543 return err; 541 return err;
544} 542}
545 543
546static __cpuinit int __threshold_add_blocks(struct threshold_bank *b) 544static int __threshold_add_blocks(struct threshold_bank *b)
547{ 545{
548 struct list_head *head = &b->blocks->miscj; 546 struct list_head *head = &b->blocks->miscj;
549 struct threshold_block *pos = NULL; 547 struct threshold_block *pos = NULL;
@@ -567,7 +565,7 @@ static __cpuinit int __threshold_add_blocks(struct threshold_bank *b)
567 return err; 565 return err;
568} 566}
569 567
570static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) 568static int threshold_create_bank(unsigned int cpu, unsigned int bank)
571{ 569{
572 struct device *dev = per_cpu(mce_device, cpu); 570 struct device *dev = per_cpu(mce_device, cpu);
573 struct amd_northbridge *nb = NULL; 571 struct amd_northbridge *nb = NULL;
@@ -632,7 +630,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
632} 630}
633 631
634/* create dir/files for all valid threshold banks */ 632/* create dir/files for all valid threshold banks */
635static __cpuinit int threshold_create_device(unsigned int cpu) 633static int threshold_create_device(unsigned int cpu)
636{ 634{
637 unsigned int bank; 635 unsigned int bank;
638 struct threshold_bank **bp; 636 struct threshold_bank **bp;
@@ -736,7 +734,7 @@ static void threshold_remove_device(unsigned int cpu)
736} 734}
737 735
738/* get notified when a cpu comes on/off */ 736/* get notified when a cpu comes on/off */
739static void __cpuinit 737static void
740amd_64_threshold_cpu_callback(unsigned long action, unsigned int cpu) 738amd_64_threshold_cpu_callback(unsigned long action, unsigned int cpu)
741{ 739{
742 switch (action) { 740 switch (action) {
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index 98f2083832eb..3eec7de76efb 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -55,12 +55,24 @@ struct thermal_state {
55 struct _thermal_state package_power_limit; 55 struct _thermal_state package_power_limit;
56 struct _thermal_state core_thresh0; 56 struct _thermal_state core_thresh0;
57 struct _thermal_state core_thresh1; 57 struct _thermal_state core_thresh1;
58 struct _thermal_state pkg_thresh0;
59 struct _thermal_state pkg_thresh1;
58}; 60};
59 61
60/* Callback to handle core threshold interrupts */ 62/* Callback to handle core threshold interrupts */
61int (*platform_thermal_notify)(__u64 msr_val); 63int (*platform_thermal_notify)(__u64 msr_val);
62EXPORT_SYMBOL(platform_thermal_notify); 64EXPORT_SYMBOL(platform_thermal_notify);
63 65
66/* Callback to handle core package threshold_interrupts */
67int (*platform_thermal_package_notify)(__u64 msr_val);
68EXPORT_SYMBOL_GPL(platform_thermal_package_notify);
69
70/* Callback support of rate control, return true, if
71 * callback has rate control */
72bool (*platform_thermal_package_rate_control)(void);
73EXPORT_SYMBOL_GPL(platform_thermal_package_rate_control);
74
75
64static DEFINE_PER_CPU(struct thermal_state, thermal_state); 76static DEFINE_PER_CPU(struct thermal_state, thermal_state);
65 77
66static atomic_t therm_throt_en = ATOMIC_INIT(0); 78static atomic_t therm_throt_en = ATOMIC_INIT(0);
@@ -195,19 +207,25 @@ static int therm_throt_process(bool new_event, int event, int level)
195 return 0; 207 return 0;
196} 208}
197 209
198static int thresh_event_valid(int event) 210static int thresh_event_valid(int level, int event)
199{ 211{
200 struct _thermal_state *state; 212 struct _thermal_state *state;
201 unsigned int this_cpu = smp_processor_id(); 213 unsigned int this_cpu = smp_processor_id();
202 struct thermal_state *pstate = &per_cpu(thermal_state, this_cpu); 214 struct thermal_state *pstate = &per_cpu(thermal_state, this_cpu);
203 u64 now = get_jiffies_64(); 215 u64 now = get_jiffies_64();
204 216
205 state = (event == 0) ? &pstate->core_thresh0 : &pstate->core_thresh1; 217 if (level == PACKAGE_LEVEL)
218 state = (event == 0) ? &pstate->pkg_thresh0 :
219 &pstate->pkg_thresh1;
220 else
221 state = (event == 0) ? &pstate->core_thresh0 :
222 &pstate->core_thresh1;
206 223
207 if (time_before64(now, state->next_check)) 224 if (time_before64(now, state->next_check))
208 return 0; 225 return 0;
209 226
210 state->next_check = now + CHECK_INTERVAL; 227 state->next_check = now + CHECK_INTERVAL;
228
211 return 1; 229 return 1;
212} 230}
213 231
@@ -222,8 +240,7 @@ __setup("int_pln_enable", int_pln_enable_setup);
222 240
223#ifdef CONFIG_SYSFS 241#ifdef CONFIG_SYSFS
224/* Add/Remove thermal_throttle interface for CPU device: */ 242/* Add/Remove thermal_throttle interface for CPU device: */
225static __cpuinit int thermal_throttle_add_dev(struct device *dev, 243static int thermal_throttle_add_dev(struct device *dev, unsigned int cpu)
226 unsigned int cpu)
227{ 244{
228 int err; 245 int err;
229 struct cpuinfo_x86 *c = &cpu_data(cpu); 246 struct cpuinfo_x86 *c = &cpu_data(cpu);
@@ -249,7 +266,7 @@ static __cpuinit int thermal_throttle_add_dev(struct device *dev,
249 return err; 266 return err;
250} 267}
251 268
252static __cpuinit void thermal_throttle_remove_dev(struct device *dev) 269static void thermal_throttle_remove_dev(struct device *dev)
253{ 270{
254 sysfs_remove_group(&dev->kobj, &thermal_attr_group); 271 sysfs_remove_group(&dev->kobj, &thermal_attr_group);
255} 272}
@@ -258,7 +275,7 @@ static __cpuinit void thermal_throttle_remove_dev(struct device *dev)
258static DEFINE_MUTEX(therm_cpu_lock); 275static DEFINE_MUTEX(therm_cpu_lock);
259 276
260/* Get notified when a cpu comes on/off. Be hotplug friendly. */ 277/* Get notified when a cpu comes on/off. Be hotplug friendly. */
261static __cpuinit int 278static int
262thermal_throttle_cpu_callback(struct notifier_block *nfb, 279thermal_throttle_cpu_callback(struct notifier_block *nfb,
263 unsigned long action, 280 unsigned long action,
264 void *hcpu) 281 void *hcpu)
@@ -289,7 +306,7 @@ thermal_throttle_cpu_callback(struct notifier_block *nfb,
289 return notifier_from_errno(err); 306 return notifier_from_errno(err);
290} 307}
291 308
292static struct notifier_block thermal_throttle_cpu_notifier __cpuinitdata = 309static struct notifier_block thermal_throttle_cpu_notifier =
293{ 310{
294 .notifier_call = thermal_throttle_cpu_callback, 311 .notifier_call = thermal_throttle_cpu_callback,
295}; 312};
@@ -322,6 +339,39 @@ device_initcall(thermal_throttle_init_device);
322 339
323#endif /* CONFIG_SYSFS */ 340#endif /* CONFIG_SYSFS */
324 341
342static void notify_package_thresholds(__u64 msr_val)
343{
344 bool notify_thres_0 = false;
345 bool notify_thres_1 = false;
346
347 if (!platform_thermal_package_notify)
348 return;
349
350 /* lower threshold check */
351 if (msr_val & THERM_LOG_THRESHOLD0)
352 notify_thres_0 = true;
353 /* higher threshold check */
354 if (msr_val & THERM_LOG_THRESHOLD1)
355 notify_thres_1 = true;
356
357 if (!notify_thres_0 && !notify_thres_1)
358 return;
359
360 if (platform_thermal_package_rate_control &&
361 platform_thermal_package_rate_control()) {
362 /* Rate control is implemented in callback */
363 platform_thermal_package_notify(msr_val);
364 return;
365 }
366
367 /* lower threshold reached */
368 if (notify_thres_0 && thresh_event_valid(PACKAGE_LEVEL, 0))
369 platform_thermal_package_notify(msr_val);
370 /* higher threshold reached */
371 if (notify_thres_1 && thresh_event_valid(PACKAGE_LEVEL, 1))
372 platform_thermal_package_notify(msr_val);
373}
374
325static void notify_thresholds(__u64 msr_val) 375static void notify_thresholds(__u64 msr_val)
326{ 376{
327 /* check whether the interrupt handler is defined; 377 /* check whether the interrupt handler is defined;
@@ -331,10 +381,12 @@ static void notify_thresholds(__u64 msr_val)
331 return; 381 return;
332 382
333 /* lower threshold reached */ 383 /* lower threshold reached */
334 if ((msr_val & THERM_LOG_THRESHOLD0) && thresh_event_valid(0)) 384 if ((msr_val & THERM_LOG_THRESHOLD0) &&
385 thresh_event_valid(CORE_LEVEL, 0))
335 platform_thermal_notify(msr_val); 386 platform_thermal_notify(msr_val);
336 /* higher threshold reached */ 387 /* higher threshold reached */
337 if ((msr_val & THERM_LOG_THRESHOLD1) && thresh_event_valid(1)) 388 if ((msr_val & THERM_LOG_THRESHOLD1) &&
389 thresh_event_valid(CORE_LEVEL, 1))
338 platform_thermal_notify(msr_val); 390 platform_thermal_notify(msr_val);
339} 391}
340 392
@@ -360,6 +412,8 @@ static void intel_thermal_interrupt(void)
360 412
361 if (this_cpu_has(X86_FEATURE_PTS)) { 413 if (this_cpu_has(X86_FEATURE_PTS)) {
362 rdmsrl(MSR_IA32_PACKAGE_THERM_STATUS, msr_val); 414 rdmsrl(MSR_IA32_PACKAGE_THERM_STATUS, msr_val);
415 /* check violations of package thermal thresholds */
416 notify_package_thresholds(msr_val);
363 therm_throt_process(msr_val & PACKAGE_THERM_STATUS_PROCHOT, 417 therm_throt_process(msr_val & PACKAGE_THERM_STATUS_PROCHOT,
364 THERMAL_THROTTLING_EVENT, 418 THERMAL_THROTTLING_EVENT,
365 PACKAGE_LEVEL); 419 PACKAGE_LEVEL);
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index ca22b73aaa25..f961de9964c7 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -51,9 +51,13 @@
51#include <asm/e820.h> 51#include <asm/e820.h>
52#include <asm/mtrr.h> 52#include <asm/mtrr.h>
53#include <asm/msr.h> 53#include <asm/msr.h>
54#include <asm/pat.h>
54 55
55#include "mtrr.h" 56#include "mtrr.h"
56 57
58/* arch_phys_wc_add returns an MTRR register index plus this offset. */
59#define MTRR_TO_PHYS_WC_OFFSET 1000
60
57u32 num_var_ranges; 61u32 num_var_ranges;
58 62
59unsigned int mtrr_usage_table[MTRR_MAX_VAR_RANGES]; 63unsigned int mtrr_usage_table[MTRR_MAX_VAR_RANGES];
@@ -525,6 +529,73 @@ int mtrr_del(int reg, unsigned long base, unsigned long size)
525} 529}
526EXPORT_SYMBOL(mtrr_del); 530EXPORT_SYMBOL(mtrr_del);
527 531
532/**
533 * arch_phys_wc_add - add a WC MTRR and handle errors if PAT is unavailable
534 * @base: Physical base address
535 * @size: Size of region
536 *
537 * If PAT is available, this does nothing. If PAT is unavailable, it
538 * attempts to add a WC MTRR covering size bytes starting at base and
539 * logs an error if this fails.
540 *
541 * Drivers must store the return value to pass to mtrr_del_wc_if_needed,
542 * but drivers should not try to interpret that return value.
543 */
544int arch_phys_wc_add(unsigned long base, unsigned long size)
545{
546 int ret;
547
548 if (pat_enabled)
549 return 0; /* Success! (We don't need to do anything.) */
550
551 ret = mtrr_add(base, size, MTRR_TYPE_WRCOMB, true);
552 if (ret < 0) {
553 pr_warn("Failed to add WC MTRR for [%p-%p]; performance may suffer.",
554 (void *)base, (void *)(base + size - 1));
555 return ret;
556 }
557 return ret + MTRR_TO_PHYS_WC_OFFSET;
558}
559EXPORT_SYMBOL(arch_phys_wc_add);
560
561/*
562 * arch_phys_wc_del - undoes arch_phys_wc_add
563 * @handle: Return value from arch_phys_wc_add
564 *
565 * This cleans up after mtrr_add_wc_if_needed.
566 *
567 * The API guarantees that mtrr_del_wc_if_needed(error code) and
568 * mtrr_del_wc_if_needed(0) do nothing.
569 */
570void arch_phys_wc_del(int handle)
571{
572 if (handle >= 1) {
573 WARN_ON(handle < MTRR_TO_PHYS_WC_OFFSET);
574 mtrr_del(handle - MTRR_TO_PHYS_WC_OFFSET, 0, 0);
575 }
576}
577EXPORT_SYMBOL(arch_phys_wc_del);
578
579/*
580 * phys_wc_to_mtrr_index - translates arch_phys_wc_add's return value
581 * @handle: Return value from arch_phys_wc_add
582 *
583 * This will turn the return value from arch_phys_wc_add into an mtrr
584 * index suitable for debugging.
585 *
586 * Note: There is no legitimate use for this function, except possibly
587 * in printk line. Alas there is an illegitimate use in some ancient
588 * drm ioctls.
589 */
590int phys_wc_to_mtrr_index(int handle)
591{
592 if (handle < MTRR_TO_PHYS_WC_OFFSET)
593 return -1;
594 else
595 return handle - MTRR_TO_PHYS_WC_OFFSET;
596}
597EXPORT_SYMBOL_GPL(phys_wc_to_mtrr_index);
598
528/* 599/*
529 * HACK ALERT! 600 * HACK ALERT!
530 * These should be called implicitly, but we can't yet until all the initcall 601 * These should be called implicitly, but we can't yet until all the initcall
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 9e581c5cf6d0..a7c7305030cc 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1295,7 +1295,7 @@ perf_event_nmi_handler(unsigned int cmd, struct pt_regs *regs)
1295struct event_constraint emptyconstraint; 1295struct event_constraint emptyconstraint;
1296struct event_constraint unconstrained; 1296struct event_constraint unconstrained;
1297 1297
1298static int __cpuinit 1298static int
1299x86_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu) 1299x86_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
1300{ 1300{
1301 unsigned int cpu = (long)hcpu; 1301 unsigned int cpu = (long)hcpu;
diff --git a/arch/x86/kernel/cpu/perf_event_amd_ibs.c b/arch/x86/kernel/cpu/perf_event_amd_ibs.c
index 5f0581e713c2..e09f0bfb7b8f 100644
--- a/arch/x86/kernel/cpu/perf_event_amd_ibs.c
+++ b/arch/x86/kernel/cpu/perf_event_amd_ibs.c
@@ -851,7 +851,7 @@ static void clear_APIC_ibs(void *dummy)
851 setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_FIX, 1); 851 setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_FIX, 1);
852} 852}
853 853
854static int __cpuinit 854static int
855perf_ibs_cpu_notifier(struct notifier_block *self, unsigned long action, void *hcpu) 855perf_ibs_cpu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
856{ 856{
857 switch (action & ~CPU_TASKS_FROZEN) { 857 switch (action & ~CPU_TASKS_FROZEN) {
diff --git a/arch/x86/kernel/cpu/perf_event_amd_iommu.c b/arch/x86/kernel/cpu/perf_event_amd_iommu.c
index 0db655ef3918..639d1289b1ba 100644
--- a/arch/x86/kernel/cpu/perf_event_amd_iommu.c
+++ b/arch/x86/kernel/cpu/perf_event_amd_iommu.c
@@ -491,10 +491,8 @@ static struct perf_amd_iommu __perf_iommu = {
491static __init int amd_iommu_pc_init(void) 491static __init int amd_iommu_pc_init(void)
492{ 492{
493 /* Make sure the IOMMU PC resource is available */ 493 /* Make sure the IOMMU PC resource is available */
494 if (!amd_iommu_pc_supported()) { 494 if (!amd_iommu_pc_supported())
495 pr_err("perf: amd_iommu PMU not installed. No support!\n");
496 return -ENODEV; 495 return -ENODEV;
497 }
498 496
499 _init_perf_amd_iommu(&__perf_iommu, "amd_iommu"); 497 _init_perf_amd_iommu(&__perf_iommu, "amd_iommu");
500 498
diff --git a/arch/x86/kernel/cpu/perf_event_amd_uncore.c b/arch/x86/kernel/cpu/perf_event_amd_uncore.c
index c0c661adf03e..754291adec33 100644
--- a/arch/x86/kernel/cpu/perf_event_amd_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_amd_uncore.c
@@ -288,13 +288,13 @@ static struct pmu amd_l2_pmu = {
288 .read = amd_uncore_read, 288 .read = amd_uncore_read,
289}; 289};
290 290
291static struct amd_uncore * __cpuinit amd_uncore_alloc(unsigned int cpu) 291static struct amd_uncore *amd_uncore_alloc(unsigned int cpu)
292{ 292{
293 return kzalloc_node(sizeof(struct amd_uncore), GFP_KERNEL, 293 return kzalloc_node(sizeof(struct amd_uncore), GFP_KERNEL,
294 cpu_to_node(cpu)); 294 cpu_to_node(cpu));
295} 295}
296 296
297static void __cpuinit amd_uncore_cpu_up_prepare(unsigned int cpu) 297static void amd_uncore_cpu_up_prepare(unsigned int cpu)
298{ 298{
299 struct amd_uncore *uncore; 299 struct amd_uncore *uncore;
300 300
@@ -322,8 +322,8 @@ static void __cpuinit amd_uncore_cpu_up_prepare(unsigned int cpu)
322} 322}
323 323
324static struct amd_uncore * 324static struct amd_uncore *
325__cpuinit amd_uncore_find_online_sibling(struct amd_uncore *this, 325amd_uncore_find_online_sibling(struct amd_uncore *this,
326 struct amd_uncore * __percpu *uncores) 326 struct amd_uncore * __percpu *uncores)
327{ 327{
328 unsigned int cpu; 328 unsigned int cpu;
329 struct amd_uncore *that; 329 struct amd_uncore *that;
@@ -348,7 +348,7 @@ __cpuinit amd_uncore_find_online_sibling(struct amd_uncore *this,
348 return this; 348 return this;
349} 349}
350 350
351static void __cpuinit amd_uncore_cpu_starting(unsigned int cpu) 351static void amd_uncore_cpu_starting(unsigned int cpu)
352{ 352{
353 unsigned int eax, ebx, ecx, edx; 353 unsigned int eax, ebx, ecx, edx;
354 struct amd_uncore *uncore; 354 struct amd_uncore *uncore;
@@ -376,8 +376,8 @@ static void __cpuinit amd_uncore_cpu_starting(unsigned int cpu)
376 } 376 }
377} 377}
378 378
379static void __cpuinit uncore_online(unsigned int cpu, 379static void uncore_online(unsigned int cpu,
380 struct amd_uncore * __percpu *uncores) 380 struct amd_uncore * __percpu *uncores)
381{ 381{
382 struct amd_uncore *uncore = *per_cpu_ptr(uncores, cpu); 382 struct amd_uncore *uncore = *per_cpu_ptr(uncores, cpu);
383 383
@@ -388,7 +388,7 @@ static void __cpuinit uncore_online(unsigned int cpu,
388 cpumask_set_cpu(cpu, uncore->active_mask); 388 cpumask_set_cpu(cpu, uncore->active_mask);
389} 389}
390 390
391static void __cpuinit amd_uncore_cpu_online(unsigned int cpu) 391static void amd_uncore_cpu_online(unsigned int cpu)
392{ 392{
393 if (amd_uncore_nb) 393 if (amd_uncore_nb)
394 uncore_online(cpu, amd_uncore_nb); 394 uncore_online(cpu, amd_uncore_nb);
@@ -397,8 +397,8 @@ static void __cpuinit amd_uncore_cpu_online(unsigned int cpu)
397 uncore_online(cpu, amd_uncore_l2); 397 uncore_online(cpu, amd_uncore_l2);
398} 398}
399 399
400static void __cpuinit uncore_down_prepare(unsigned int cpu, 400static void uncore_down_prepare(unsigned int cpu,
401 struct amd_uncore * __percpu *uncores) 401 struct amd_uncore * __percpu *uncores)
402{ 402{
403 unsigned int i; 403 unsigned int i;
404 struct amd_uncore *this = *per_cpu_ptr(uncores, cpu); 404 struct amd_uncore *this = *per_cpu_ptr(uncores, cpu);
@@ -423,7 +423,7 @@ static void __cpuinit uncore_down_prepare(unsigned int cpu,
423 } 423 }
424} 424}
425 425
426static void __cpuinit amd_uncore_cpu_down_prepare(unsigned int cpu) 426static void amd_uncore_cpu_down_prepare(unsigned int cpu)
427{ 427{
428 if (amd_uncore_nb) 428 if (amd_uncore_nb)
429 uncore_down_prepare(cpu, amd_uncore_nb); 429 uncore_down_prepare(cpu, amd_uncore_nb);
@@ -432,8 +432,7 @@ static void __cpuinit amd_uncore_cpu_down_prepare(unsigned int cpu)
432 uncore_down_prepare(cpu, amd_uncore_l2); 432 uncore_down_prepare(cpu, amd_uncore_l2);
433} 433}
434 434
435static void __cpuinit uncore_dead(unsigned int cpu, 435static void uncore_dead(unsigned int cpu, struct amd_uncore * __percpu *uncores)
436 struct amd_uncore * __percpu *uncores)
437{ 436{
438 struct amd_uncore *uncore = *per_cpu_ptr(uncores, cpu); 437 struct amd_uncore *uncore = *per_cpu_ptr(uncores, cpu);
439 438
@@ -445,7 +444,7 @@ static void __cpuinit uncore_dead(unsigned int cpu,
445 *per_cpu_ptr(amd_uncore_nb, cpu) = NULL; 444 *per_cpu_ptr(amd_uncore_nb, cpu) = NULL;
446} 445}
447 446
448static void __cpuinit amd_uncore_cpu_dead(unsigned int cpu) 447static void amd_uncore_cpu_dead(unsigned int cpu)
449{ 448{
450 if (amd_uncore_nb) 449 if (amd_uncore_nb)
451 uncore_dead(cpu, amd_uncore_nb); 450 uncore_dead(cpu, amd_uncore_nb);
@@ -454,7 +453,7 @@ static void __cpuinit amd_uncore_cpu_dead(unsigned int cpu)
454 uncore_dead(cpu, amd_uncore_l2); 453 uncore_dead(cpu, amd_uncore_l2);
455} 454}
456 455
457static int __cpuinit 456static int
458amd_uncore_cpu_notifier(struct notifier_block *self, unsigned long action, 457amd_uncore_cpu_notifier(struct notifier_block *self, unsigned long action,
459 void *hcpu) 458 void *hcpu)
460{ 459{
@@ -489,7 +488,7 @@ amd_uncore_cpu_notifier(struct notifier_block *self, unsigned long action,
489 return NOTIFY_OK; 488 return NOTIFY_OK;
490} 489}
491 490
492static struct notifier_block amd_uncore_cpu_notifier_block __cpuinitdata = { 491static struct notifier_block amd_uncore_cpu_notifier_block = {
493 .notifier_call = amd_uncore_cpu_notifier, 492 .notifier_call = amd_uncore_cpu_notifier,
494 .priority = CPU_PRI_PERF + 1, 493 .priority = CPU_PRI_PERF + 1,
495}; 494};
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index 9dd99751ccf9..cad791dbde95 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -3297,7 +3297,7 @@ static void __init uncore_pci_exit(void)
3297/* CPU hot plug/unplug are serialized by cpu_add_remove_lock mutex */ 3297/* CPU hot plug/unplug are serialized by cpu_add_remove_lock mutex */
3298static LIST_HEAD(boxes_to_free); 3298static LIST_HEAD(boxes_to_free);
3299 3299
3300static void __cpuinit uncore_kfree_boxes(void) 3300static void uncore_kfree_boxes(void)
3301{ 3301{
3302 struct intel_uncore_box *box; 3302 struct intel_uncore_box *box;
3303 3303
@@ -3309,7 +3309,7 @@ static void __cpuinit uncore_kfree_boxes(void)
3309 } 3309 }
3310} 3310}
3311 3311
3312static void __cpuinit uncore_cpu_dying(int cpu) 3312static void uncore_cpu_dying(int cpu)
3313{ 3313{
3314 struct intel_uncore_type *type; 3314 struct intel_uncore_type *type;
3315 struct intel_uncore_pmu *pmu; 3315 struct intel_uncore_pmu *pmu;
@@ -3328,7 +3328,7 @@ static void __cpuinit uncore_cpu_dying(int cpu)
3328 } 3328 }
3329} 3329}
3330 3330
3331static int __cpuinit uncore_cpu_starting(int cpu) 3331static int uncore_cpu_starting(int cpu)
3332{ 3332{
3333 struct intel_uncore_type *type; 3333 struct intel_uncore_type *type;
3334 struct intel_uncore_pmu *pmu; 3334 struct intel_uncore_pmu *pmu;
@@ -3371,7 +3371,7 @@ static int __cpuinit uncore_cpu_starting(int cpu)
3371 return 0; 3371 return 0;
3372} 3372}
3373 3373
3374static int __cpuinit uncore_cpu_prepare(int cpu, int phys_id) 3374static int uncore_cpu_prepare(int cpu, int phys_id)
3375{ 3375{
3376 struct intel_uncore_type *type; 3376 struct intel_uncore_type *type;
3377 struct intel_uncore_pmu *pmu; 3377 struct intel_uncore_pmu *pmu;
@@ -3397,7 +3397,7 @@ static int __cpuinit uncore_cpu_prepare(int cpu, int phys_id)
3397 return 0; 3397 return 0;
3398} 3398}
3399 3399
3400static void __cpuinit 3400static void
3401uncore_change_context(struct intel_uncore_type **uncores, int old_cpu, int new_cpu) 3401uncore_change_context(struct intel_uncore_type **uncores, int old_cpu, int new_cpu)
3402{ 3402{
3403 struct intel_uncore_type *type; 3403 struct intel_uncore_type *type;
@@ -3435,7 +3435,7 @@ uncore_change_context(struct intel_uncore_type **uncores, int old_cpu, int new_c
3435 } 3435 }
3436} 3436}
3437 3437
3438static void __cpuinit uncore_event_exit_cpu(int cpu) 3438static void uncore_event_exit_cpu(int cpu)
3439{ 3439{
3440 int i, phys_id, target; 3440 int i, phys_id, target;
3441 3441
@@ -3463,7 +3463,7 @@ static void __cpuinit uncore_event_exit_cpu(int cpu)
3463 uncore_change_context(pci_uncores, cpu, target); 3463 uncore_change_context(pci_uncores, cpu, target);
3464} 3464}
3465 3465
3466static void __cpuinit uncore_event_init_cpu(int cpu) 3466static void uncore_event_init_cpu(int cpu)
3467{ 3467{
3468 int i, phys_id; 3468 int i, phys_id;
3469 3469
@@ -3479,8 +3479,8 @@ static void __cpuinit uncore_event_init_cpu(int cpu)
3479 uncore_change_context(pci_uncores, -1, cpu); 3479 uncore_change_context(pci_uncores, -1, cpu);
3480} 3480}
3481 3481
3482static int 3482static int uncore_cpu_notifier(struct notifier_block *self,
3483 __cpuinit uncore_cpu_notifier(struct notifier_block *self, unsigned long action, void *hcpu) 3483 unsigned long action, void *hcpu)
3484{ 3484{
3485 unsigned int cpu = (long)hcpu; 3485 unsigned int cpu = (long)hcpu;
3486 3486
@@ -3520,7 +3520,7 @@ static int
3520 return NOTIFY_OK; 3520 return NOTIFY_OK;
3521} 3521}
3522 3522
3523static struct notifier_block uncore_cpu_nb __cpuinitdata = { 3523static struct notifier_block uncore_cpu_nb = {
3524 .notifier_call = uncore_cpu_notifier, 3524 .notifier_call = uncore_cpu_notifier,
3525 /* 3525 /*
3526 * to migrate uncore events, our notifier should be executed 3526 * to migrate uncore events, our notifier should be executed
diff --git a/arch/x86/kernel/cpu/rdrand.c b/arch/x86/kernel/cpu/rdrand.c
index feca286c2bb4..88db010845cb 100644
--- a/arch/x86/kernel/cpu/rdrand.c
+++ b/arch/x86/kernel/cpu/rdrand.c
@@ -52,7 +52,7 @@ static inline int rdrand_long(unsigned long *v)
52 */ 52 */
53#define RESEED_LOOP ((512*128)/sizeof(unsigned long)) 53#define RESEED_LOOP ((512*128)/sizeof(unsigned long))
54 54
55void __cpuinit x86_init_rdrand(struct cpuinfo_x86 *c) 55void x86_init_rdrand(struct cpuinfo_x86 *c)
56{ 56{
57#ifdef CONFIG_ARCH_RANDOM 57#ifdef CONFIG_ARCH_RANDOM
58 unsigned long tmp; 58 unsigned long tmp;
diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c
index d92b5dad15dd..f2cc63e9cf08 100644
--- a/arch/x86/kernel/cpu/scattered.c
+++ b/arch/x86/kernel/cpu/scattered.c
@@ -24,13 +24,13 @@ enum cpuid_regs {
24 CR_EBX 24 CR_EBX
25}; 25};
26 26
27void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c) 27void init_scattered_cpuid_features(struct cpuinfo_x86 *c)
28{ 28{
29 u32 max_level; 29 u32 max_level;
30 u32 regs[4]; 30 u32 regs[4];
31 const struct cpuid_bit *cb; 31 const struct cpuid_bit *cb;
32 32
33 static const struct cpuid_bit __cpuinitconst cpuid_bits[] = { 33 static const struct cpuid_bit cpuid_bits[] = {
34 { X86_FEATURE_DTHERM, CR_EAX, 0, 0x00000006, 0 }, 34 { X86_FEATURE_DTHERM, CR_EAX, 0, 0x00000006, 0 },
35 { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006, 0 }, 35 { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006, 0 },
36 { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006, 0 }, 36 { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006, 0 },
diff --git a/arch/x86/kernel/cpu/topology.c b/arch/x86/kernel/cpu/topology.c
index 4397e987a1cf..4c60eaf0571c 100644
--- a/arch/x86/kernel/cpu/topology.c
+++ b/arch/x86/kernel/cpu/topology.c
@@ -26,7 +26,7 @@
26 * exists, use it for populating initial_apicid and cpu topology 26 * exists, use it for populating initial_apicid and cpu topology
27 * detection. 27 * detection.
28 */ 28 */
29void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c) 29void detect_extended_topology(struct cpuinfo_x86 *c)
30{ 30{
31#ifdef CONFIG_SMP 31#ifdef CONFIG_SMP
32 unsigned int eax, ebx, ecx, edx, sub_index; 32 unsigned int eax, ebx, ecx, edx, sub_index;
diff --git a/arch/x86/kernel/cpu/transmeta.c b/arch/x86/kernel/cpu/transmeta.c
index 28000743bbb0..aa0430d69b90 100644
--- a/arch/x86/kernel/cpu/transmeta.c
+++ b/arch/x86/kernel/cpu/transmeta.c
@@ -5,7 +5,7 @@
5#include <asm/msr.h> 5#include <asm/msr.h>
6#include "cpu.h" 6#include "cpu.h"
7 7
8static void __cpuinit early_init_transmeta(struct cpuinfo_x86 *c) 8static void early_init_transmeta(struct cpuinfo_x86 *c)
9{ 9{
10 u32 xlvl; 10 u32 xlvl;
11 11
@@ -17,7 +17,7 @@ static void __cpuinit early_init_transmeta(struct cpuinfo_x86 *c)
17 } 17 }
18} 18}
19 19
20static void __cpuinit init_transmeta(struct cpuinfo_x86 *c) 20static void init_transmeta(struct cpuinfo_x86 *c)
21{ 21{
22 unsigned int cap_mask, uk, max, dummy; 22 unsigned int cap_mask, uk, max, dummy;
23 unsigned int cms_rev1, cms_rev2; 23 unsigned int cms_rev1, cms_rev2;
@@ -98,7 +98,7 @@ static void __cpuinit init_transmeta(struct cpuinfo_x86 *c)
98#endif 98#endif
99} 99}
100 100
101static const struct cpu_dev __cpuinitconst transmeta_cpu_dev = { 101static const struct cpu_dev transmeta_cpu_dev = {
102 .c_vendor = "Transmeta", 102 .c_vendor = "Transmeta",
103 .c_ident = { "GenuineTMx86", "TransmetaCPU" }, 103 .c_ident = { "GenuineTMx86", "TransmetaCPU" },
104 .c_early_init = early_init_transmeta, 104 .c_early_init = early_init_transmeta,
diff --git a/arch/x86/kernel/cpu/umc.c b/arch/x86/kernel/cpu/umc.c
index fd2c37bf7acb..202759a14121 100644
--- a/arch/x86/kernel/cpu/umc.c
+++ b/arch/x86/kernel/cpu/umc.c
@@ -8,7 +8,7 @@
8 * so no special init takes place. 8 * so no special init takes place.
9 */ 9 */
10 10
11static const struct cpu_dev __cpuinitconst umc_cpu_dev = { 11static const struct cpu_dev umc_cpu_dev = {
12 .c_vendor = "UMC", 12 .c_vendor = "UMC",
13 .c_ident = { "UMC UMC UMC" }, 13 .c_ident = { "UMC UMC UMC" },
14 .c_models = { 14 .c_models = {
diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
index 03a36321ec54..7076878404ec 100644
--- a/arch/x86/kernel/cpu/vmware.c
+++ b/arch/x86/kernel/cpu/vmware.c
@@ -122,7 +122,7 @@ static bool __init vmware_platform(void)
122 * so that the kernel could just trust the hypervisor with providing a 122 * so that the kernel could just trust the hypervisor with providing a
123 * reliable virtual TSC that is suitable for timekeeping. 123 * reliable virtual TSC that is suitable for timekeeping.
124 */ 124 */
125static void __cpuinit vmware_set_cpu_features(struct cpuinfo_x86 *c) 125static void vmware_set_cpu_features(struct cpuinfo_x86 *c)
126{ 126{
127 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); 127 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
128 set_cpu_cap(c, X86_FEATURE_TSC_RELIABLE); 128 set_cpu_cap(c, X86_FEATURE_TSC_RELIABLE);
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index 1e4dbcfe6d31..7d9481c743f8 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -137,7 +137,7 @@ static const struct file_operations cpuid_fops = {
137 .open = cpuid_open, 137 .open = cpuid_open,
138}; 138};
139 139
140static __cpuinit int cpuid_device_create(int cpu) 140static int cpuid_device_create(int cpu)
141{ 141{
142 struct device *dev; 142 struct device *dev;
143 143
@@ -151,9 +151,8 @@ static void cpuid_device_destroy(int cpu)
151 device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); 151 device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu));
152} 152}
153 153
154static int __cpuinit cpuid_class_cpu_callback(struct notifier_block *nfb, 154static int cpuid_class_cpu_callback(struct notifier_block *nfb,
155 unsigned long action, 155 unsigned long action, void *hcpu)
156 void *hcpu)
157{ 156{
158 unsigned int cpu = (unsigned long)hcpu; 157 unsigned int cpu = (unsigned long)hcpu;
159 int err = 0; 158 int err = 0;
diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
index b1581527a236..69eb2fa25494 100644
--- a/arch/x86/kernel/devicetree.c
+++ b/arch/x86/kernel/devicetree.c
@@ -133,7 +133,7 @@ static void x86_of_pci_irq_disable(struct pci_dev *dev)
133{ 133{
134} 134}
135 135
136void __cpuinit x86_of_pci_init(void) 136void x86_of_pci_init(void)
137{ 137{
138 pcibios_enable_irq = x86_of_pci_irq_enable; 138 pcibios_enable_irq = x86_of_pci_irq_enable;
139 pcibios_disable_irq = x86_of_pci_irq_disable; 139 pcibios_disable_irq = x86_of_pci_irq_disable;
@@ -364,9 +364,7 @@ static void dt_add_ioapic_domain(unsigned int ioapic_num,
364 * and assigned so we can keep the 1:1 mapping which the ioapic 364 * and assigned so we can keep the 1:1 mapping which the ioapic
365 * is having. 365 * is having.
366 */ 366 */
367 ret = irq_domain_associate_many(id, 0, 0, NR_IRQS_LEGACY); 367 irq_domain_associate_many(id, 0, 0, NR_IRQS_LEGACY);
368 if (ret)
369 pr_err("Error mapping legacy IRQs: %d\n", ret);
370 368
371 if (num > NR_IRQS_LEGACY) { 369 if (num > NR_IRQS_LEGACY) {
372 ret = irq_create_strict_mappings(id, NR_IRQS_LEGACY, 370 ret = irq_create_strict_mappings(id, NR_IRQS_LEGACY,
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index e65ddc62e113..5dd87a89f011 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -292,7 +292,6 @@ ENDPROC(start_cpu0)
292 * If cpu hotplug is not supported then this code can go in init section 292 * If cpu hotplug is not supported then this code can go in init section
293 * which will be freed later 293 * which will be freed later
294 */ 294 */
295__CPUINIT
296ENTRY(startup_32_smp) 295ENTRY(startup_32_smp)
297 cld 296 cld
298 movl $(__BOOT_DS),%eax 297 movl $(__BOOT_DS),%eax
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 5e4d8a8a5c40..e1aabdb314c8 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -512,21 +512,6 @@ ENTRY(phys_base)
512 512
513#include "../../x86/xen/xen-head.S" 513#include "../../x86/xen/xen-head.S"
514 514
515 .section .bss, "aw", @nobits
516 .align L1_CACHE_BYTES
517ENTRY(idt_table)
518 .skip IDT_ENTRIES * 16
519
520 .align L1_CACHE_BYTES
521ENTRY(debug_idt_table)
522 .skip IDT_ENTRIES * 16
523
524#ifdef CONFIG_TRACING
525 .align L1_CACHE_BYTES
526ENTRY(trace_idt_table)
527 .skip IDT_ENTRIES * 16
528#endif
529
530 __PAGE_ALIGNED_BSS 515 __PAGE_ALIGNED_BSS
531NEXT_PAGE(empty_zero_page) 516NEXT_PAGE(empty_zero_page)
532 .skip PAGE_SIZE 517 .skip PAGE_SIZE
diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c
index 02f07634d265..f66ff162dce8 100644
--- a/arch/x86/kernel/hw_breakpoint.c
+++ b/arch/x86/kernel/hw_breakpoint.c
@@ -393,6 +393,9 @@ void flush_ptrace_hw_breakpoint(struct task_struct *tsk)
393 unregister_hw_breakpoint(t->ptrace_bps[i]); 393 unregister_hw_breakpoint(t->ptrace_bps[i]);
394 t->ptrace_bps[i] = NULL; 394 t->ptrace_bps[i] = NULL;
395 } 395 }
396
397 t->debugreg6 = 0;
398 t->ptrace_dr7 = 0;
396} 399}
397 400
398void hw_breakpoint_restore(void) 401void hw_breakpoint_restore(void)
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index b627746f6b1a..202d24f0f7e7 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -108,9 +108,9 @@ EXPORT_SYMBOL(unlazy_fpu);
108unsigned int mxcsr_feature_mask __read_mostly = 0xffffffffu; 108unsigned int mxcsr_feature_mask __read_mostly = 0xffffffffu;
109unsigned int xstate_size; 109unsigned int xstate_size;
110EXPORT_SYMBOL_GPL(xstate_size); 110EXPORT_SYMBOL_GPL(xstate_size);
111static struct i387_fxsave_struct fx_scratch __cpuinitdata; 111static struct i387_fxsave_struct fx_scratch;
112 112
113static void __cpuinit mxcsr_feature_mask_init(void) 113static void mxcsr_feature_mask_init(void)
114{ 114{
115 unsigned long mask = 0; 115 unsigned long mask = 0;
116 116
@@ -124,7 +124,7 @@ static void __cpuinit mxcsr_feature_mask_init(void)
124 mxcsr_feature_mask &= mask; 124 mxcsr_feature_mask &= mask;
125} 125}
126 126
127static void __cpuinit init_thread_xstate(void) 127static void init_thread_xstate(void)
128{ 128{
129 /* 129 /*
130 * Note that xstate_size might be overwriten later during 130 * Note that xstate_size might be overwriten later during
@@ -153,7 +153,7 @@ static void __cpuinit init_thread_xstate(void)
153 * into all processes. 153 * into all processes.
154 */ 154 */
155 155
156void __cpuinit fpu_init(void) 156void fpu_init(void)
157{ 157{
158 unsigned long cr0; 158 unsigned long cr0;
159 unsigned long cr4_mask = 0; 159 unsigned long cr4_mask = 0;
@@ -608,7 +608,7 @@ static int __init no_387(char *s)
608 608
609__setup("no387", no_387); 609__setup("no387", no_387);
610 610
611void __cpuinit fpu_detect(struct cpuinfo_x86 *c) 611void fpu_detect(struct cpuinfo_x86 *c)
612{ 612{
613 unsigned long cr0; 613 unsigned long cr0;
614 u16 fsw, fcw; 614 u16 fsw, fcw;
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 344faf8d0d62..4186755f1d7c 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -119,7 +119,7 @@ execute_on_irq_stack(int overflow, struct irq_desc *desc, int irq)
119/* 119/*
120 * allocate per-cpu stacks for hardirq and for softirq processing 120 * allocate per-cpu stacks for hardirq and for softirq processing
121 */ 121 */
122void __cpuinit irq_ctx_init(int cpu) 122void irq_ctx_init(int cpu)
123{ 123{
124 union irq_ctx *irqctx; 124 union irq_ctx *irqctx;
125 125
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index cd6d9a5a42f6..a96d32cc55b8 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -320,7 +320,7 @@ static void kvm_guest_apic_eoi_write(u32 reg, u32 val)
320 apic_write(APIC_EOI, APIC_EOI_ACK); 320 apic_write(APIC_EOI, APIC_EOI_ACK);
321} 321}
322 322
323void __cpuinit kvm_guest_cpu_init(void) 323void kvm_guest_cpu_init(void)
324{ 324{
325 if (!kvm_para_available()) 325 if (!kvm_para_available())
326 return; 326 return;
@@ -421,7 +421,7 @@ static void __init kvm_smp_prepare_boot_cpu(void)
421 native_smp_prepare_boot_cpu(); 421 native_smp_prepare_boot_cpu();
422} 422}
423 423
424static void __cpuinit kvm_guest_cpu_online(void *dummy) 424static void kvm_guest_cpu_online(void *dummy)
425{ 425{
426 kvm_guest_cpu_init(); 426 kvm_guest_cpu_init();
427} 427}
@@ -435,8 +435,8 @@ static void kvm_guest_cpu_offline(void *dummy)
435 apf_task_wake_all(); 435 apf_task_wake_all();
436} 436}
437 437
438static int __cpuinit kvm_cpu_notify(struct notifier_block *self, 438static int kvm_cpu_notify(struct notifier_block *self, unsigned long action,
439 unsigned long action, void *hcpu) 439 void *hcpu)
440{ 440{
441 int cpu = (unsigned long)hcpu; 441 int cpu = (unsigned long)hcpu;
442 switch (action) { 442 switch (action) {
@@ -455,7 +455,7 @@ static int __cpuinit kvm_cpu_notify(struct notifier_block *self,
455 return NOTIFY_OK; 455 return NOTIFY_OK;
456} 456}
457 457
458static struct notifier_block __cpuinitdata kvm_cpu_notifier = { 458static struct notifier_block kvm_cpu_notifier = {
459 .notifier_call = kvm_cpu_notify, 459 .notifier_call = kvm_cpu_notify,
460}; 460};
461#endif 461#endif
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index 3dd37ebd591b..1570e0741344 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -48,10 +48,9 @@ static struct pvclock_wall_clock wall_clock;
48 * have elapsed since the hypervisor wrote the data. So we try to account for 48 * have elapsed since the hypervisor wrote the data. So we try to account for
49 * that with system time 49 * that with system time
50 */ 50 */
51static unsigned long kvm_get_wallclock(void) 51static void kvm_get_wallclock(struct timespec *now)
52{ 52{
53 struct pvclock_vcpu_time_info *vcpu_time; 53 struct pvclock_vcpu_time_info *vcpu_time;
54 struct timespec ts;
55 int low, high; 54 int low, high;
56 int cpu; 55 int cpu;
57 56
@@ -64,14 +63,12 @@ static unsigned long kvm_get_wallclock(void)
64 cpu = smp_processor_id(); 63 cpu = smp_processor_id();
65 64
66 vcpu_time = &hv_clock[cpu].pvti; 65 vcpu_time = &hv_clock[cpu].pvti;
67 pvclock_read_wallclock(&wall_clock, vcpu_time, &ts); 66 pvclock_read_wallclock(&wall_clock, vcpu_time, now);
68 67
69 preempt_enable(); 68 preempt_enable();
70
71 return ts.tv_sec;
72} 69}
73 70
74static int kvm_set_wallclock(unsigned long now) 71static int kvm_set_wallclock(const struct timespec *now)
75{ 72{
76 return -1; 73 return -1;
77} 74}
@@ -185,7 +182,7 @@ static void kvm_restore_sched_clock_state(void)
185} 182}
186 183
187#ifdef CONFIG_X86_LOCAL_APIC 184#ifdef CONFIG_X86_LOCAL_APIC
188static void __cpuinit kvm_setup_secondary_clock(void) 185static void kvm_setup_secondary_clock(void)
189{ 186{
190 /* 187 /*
191 * Now that the first cpu already had this clocksource initialized, 188 * Now that the first cpu already had this clocksource initialized,
diff --git a/arch/x86/kernel/microcode_amd_early.c b/arch/x86/kernel/microcode_amd_early.c
index 1ac6e9aee766..1d14ffee5749 100644
--- a/arch/x86/kernel/microcode_amd_early.c
+++ b/arch/x86/kernel/microcode_amd_early.c
@@ -82,7 +82,7 @@ static struct cpio_data __init find_ucode_in_initrd(void)
82 * load_microcode_amd() to save equivalent cpu table and microcode patches in 82 * load_microcode_amd() to save equivalent cpu table and microcode patches in
83 * kernel heap memory. 83 * kernel heap memory.
84 */ 84 */
85static void __cpuinit apply_ucode_in_initrd(void *ucode, size_t size) 85static void apply_ucode_in_initrd(void *ucode, size_t size)
86{ 86{
87 struct equiv_cpu_entry *eq; 87 struct equiv_cpu_entry *eq;
88 u32 *header; 88 u32 *header;
@@ -206,7 +206,7 @@ u8 amd_bsp_mpb[MPB_MAX_SIZE];
206 * save_microcode_in_initrd_amd() BSP's patch is copied to amd_bsp_mpb, which 206 * save_microcode_in_initrd_amd() BSP's patch is copied to amd_bsp_mpb, which
207 * is used upon resume from suspend. 207 * is used upon resume from suspend.
208 */ 208 */
209void __cpuinit load_ucode_amd_ap(void) 209void load_ucode_amd_ap(void)
210{ 210{
211 struct microcode_amd *mc; 211 struct microcode_amd *mc;
212 unsigned long *initrd; 212 unsigned long *initrd;
@@ -238,7 +238,7 @@ static void __init collect_cpu_sig_on_bsp(void *arg)
238 uci->cpu_sig.sig = cpuid_eax(0x00000001); 238 uci->cpu_sig.sig = cpuid_eax(0x00000001);
239} 239}
240#else 240#else
241static void __cpuinit collect_cpu_info_amd_early(struct cpuinfo_x86 *c, 241static void collect_cpu_info_amd_early(struct cpuinfo_x86 *c,
242 struct ucode_cpu_info *uci) 242 struct ucode_cpu_info *uci)
243{ 243{
244 u32 rev, eax; 244 u32 rev, eax;
@@ -252,7 +252,7 @@ static void __cpuinit collect_cpu_info_amd_early(struct cpuinfo_x86 *c,
252 c->x86 = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff); 252 c->x86 = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff);
253} 253}
254 254
255void __cpuinit load_ucode_amd_ap(void) 255void load_ucode_amd_ap(void)
256{ 256{
257 unsigned int cpu = smp_processor_id(); 257 unsigned int cpu = smp_processor_id();
258 258
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index 22db92bbdf1a..15c987698b0f 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -468,7 +468,7 @@ static struct syscore_ops mc_syscore_ops = {
468 .resume = mc_bp_resume, 468 .resume = mc_bp_resume,
469}; 469};
470 470
471static __cpuinit int 471static int
472mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu) 472mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
473{ 473{
474 unsigned int cpu = (unsigned long)hcpu; 474 unsigned int cpu = (unsigned long)hcpu;
diff --git a/arch/x86/kernel/microcode_core_early.c b/arch/x86/kernel/microcode_core_early.c
index 86119f63db0c..be7f8514f577 100644
--- a/arch/x86/kernel/microcode_core_early.c
+++ b/arch/x86/kernel/microcode_core_early.c
@@ -41,7 +41,7 @@
41 * 41 *
42 * x86_vendor() gets vendor information directly through cpuid. 42 * x86_vendor() gets vendor information directly through cpuid.
43 */ 43 */
44static int __cpuinit x86_vendor(void) 44static int x86_vendor(void)
45{ 45{
46 u32 eax = 0x00000000; 46 u32 eax = 0x00000000;
47 u32 ebx, ecx = 0, edx; 47 u32 ebx, ecx = 0, edx;
@@ -57,7 +57,7 @@ static int __cpuinit x86_vendor(void)
57 return X86_VENDOR_UNKNOWN; 57 return X86_VENDOR_UNKNOWN;
58} 58}
59 59
60static int __cpuinit x86_family(void) 60static int x86_family(void)
61{ 61{
62 u32 eax = 0x00000001; 62 u32 eax = 0x00000001;
63 u32 ebx, ecx = 0, edx; 63 u32 ebx, ecx = 0, edx;
@@ -96,7 +96,7 @@ void __init load_ucode_bsp(void)
96 } 96 }
97} 97}
98 98
99void __cpuinit load_ucode_ap(void) 99void load_ucode_ap(void)
100{ 100{
101 int vendor, x86; 101 int vendor, x86;
102 102
diff --git a/arch/x86/kernel/microcode_intel_early.c b/arch/x86/kernel/microcode_intel_early.c
index dabef95506f3..1575deb2e636 100644
--- a/arch/x86/kernel/microcode_intel_early.c
+++ b/arch/x86/kernel/microcode_intel_early.c
@@ -34,7 +34,7 @@ struct mc_saved_data {
34 struct microcode_intel **mc_saved; 34 struct microcode_intel **mc_saved;
35} mc_saved_data; 35} mc_saved_data;
36 36
37static enum ucode_state __cpuinit 37static enum ucode_state
38generic_load_microcode_early(struct microcode_intel **mc_saved_p, 38generic_load_microcode_early(struct microcode_intel **mc_saved_p,
39 unsigned int mc_saved_count, 39 unsigned int mc_saved_count,
40 struct ucode_cpu_info *uci) 40 struct ucode_cpu_info *uci)
@@ -69,7 +69,7 @@ out:
69 return state; 69 return state;
70} 70}
71 71
72static void __cpuinit 72static void
73microcode_pointer(struct microcode_intel **mc_saved, 73microcode_pointer(struct microcode_intel **mc_saved,
74 unsigned long *mc_saved_in_initrd, 74 unsigned long *mc_saved_in_initrd,
75 unsigned long initrd_start, int mc_saved_count) 75 unsigned long initrd_start, int mc_saved_count)
@@ -82,7 +82,7 @@ microcode_pointer(struct microcode_intel **mc_saved,
82} 82}
83 83
84#ifdef CONFIG_X86_32 84#ifdef CONFIG_X86_32
85static void __cpuinit 85static void
86microcode_phys(struct microcode_intel **mc_saved_tmp, 86microcode_phys(struct microcode_intel **mc_saved_tmp,
87 struct mc_saved_data *mc_saved_data) 87 struct mc_saved_data *mc_saved_data)
88{ 88{
@@ -101,7 +101,7 @@ microcode_phys(struct microcode_intel **mc_saved_tmp,
101} 101}
102#endif 102#endif
103 103
104static enum ucode_state __cpuinit 104static enum ucode_state
105load_microcode(struct mc_saved_data *mc_saved_data, 105load_microcode(struct mc_saved_data *mc_saved_data,
106 unsigned long *mc_saved_in_initrd, 106 unsigned long *mc_saved_in_initrd,
107 unsigned long initrd_start, 107 unsigned long initrd_start,
@@ -375,7 +375,7 @@ do { \
375#define native_wrmsr(msr, low, high) \ 375#define native_wrmsr(msr, low, high) \
376 native_write_msr(msr, low, high); 376 native_write_msr(msr, low, high);
377 377
378static int __cpuinit collect_cpu_info_early(struct ucode_cpu_info *uci) 378static int collect_cpu_info_early(struct ucode_cpu_info *uci)
379{ 379{
380 unsigned int val[2]; 380 unsigned int val[2];
381 u8 x86, x86_model; 381 u8 x86, x86_model;
@@ -584,7 +584,7 @@ scan_microcode(unsigned long start, unsigned long end,
584/* 584/*
585 * Print ucode update info. 585 * Print ucode update info.
586 */ 586 */
587static void __cpuinit 587static void
588print_ucode_info(struct ucode_cpu_info *uci, unsigned int date) 588print_ucode_info(struct ucode_cpu_info *uci, unsigned int date)
589{ 589{
590 int cpu = smp_processor_id(); 590 int cpu = smp_processor_id();
@@ -605,7 +605,7 @@ static int current_mc_date;
605/* 605/*
606 * Print early updated ucode info after printk works. This is delayed info dump. 606 * Print early updated ucode info after printk works. This is delayed info dump.
607 */ 607 */
608void __cpuinit show_ucode_info_early(void) 608void show_ucode_info_early(void)
609{ 609{
610 struct ucode_cpu_info uci; 610 struct ucode_cpu_info uci;
611 611
@@ -621,7 +621,7 @@ void __cpuinit show_ucode_info_early(void)
621 * mc_saved_data.mc_saved and delay printing microcode info in 621 * mc_saved_data.mc_saved and delay printing microcode info in
622 * show_ucode_info_early() until printk() works. 622 * show_ucode_info_early() until printk() works.
623 */ 623 */
624static void __cpuinit print_ucode(struct ucode_cpu_info *uci) 624static void print_ucode(struct ucode_cpu_info *uci)
625{ 625{
626 struct microcode_intel *mc_intel; 626 struct microcode_intel *mc_intel;
627 int *delay_ucode_info_p; 627 int *delay_ucode_info_p;
@@ -643,12 +643,12 @@ static void __cpuinit print_ucode(struct ucode_cpu_info *uci)
643 * Flush global tlb. We only do this in x86_64 where paging has been enabled 643 * Flush global tlb. We only do this in x86_64 where paging has been enabled
644 * already and PGE should be enabled as well. 644 * already and PGE should be enabled as well.
645 */ 645 */
646static inline void __cpuinit flush_tlb_early(void) 646static inline void flush_tlb_early(void)
647{ 647{
648 __native_flush_tlb_global_irq_disabled(); 648 __native_flush_tlb_global_irq_disabled();
649} 649}
650 650
651static inline void __cpuinit print_ucode(struct ucode_cpu_info *uci) 651static inline void print_ucode(struct ucode_cpu_info *uci)
652{ 652{
653 struct microcode_intel *mc_intel; 653 struct microcode_intel *mc_intel;
654 654
@@ -660,8 +660,8 @@ static inline void __cpuinit print_ucode(struct ucode_cpu_info *uci)
660} 660}
661#endif 661#endif
662 662
663static int __cpuinit apply_microcode_early(struct mc_saved_data *mc_saved_data, 663static int apply_microcode_early(struct mc_saved_data *mc_saved_data,
664 struct ucode_cpu_info *uci) 664 struct ucode_cpu_info *uci)
665{ 665{
666 struct microcode_intel *mc_intel; 666 struct microcode_intel *mc_intel;
667 unsigned int val[2]; 667 unsigned int val[2];
@@ -763,7 +763,7 @@ load_ucode_intel_bsp(void)
763#endif 763#endif
764} 764}
765 765
766void __cpuinit load_ucode_intel_ap(void) 766void load_ucode_intel_ap(void)
767{ 767{
768 struct mc_saved_data *mc_saved_data_p; 768 struct mc_saved_data *mc_saved_data_p;
769 struct ucode_cpu_info uci; 769 struct ucode_cpu_info uci;
diff --git a/arch/x86/kernel/mmconf-fam10h_64.c b/arch/x86/kernel/mmconf-fam10h_64.c
index ac861b8348e2..f4c886d9165c 100644
--- a/arch/x86/kernel/mmconf-fam10h_64.c
+++ b/arch/x86/kernel/mmconf-fam10h_64.c
@@ -24,14 +24,14 @@ struct pci_hostbridge_probe {
24 u32 device; 24 u32 device;
25}; 25};
26 26
27static u64 __cpuinitdata fam10h_pci_mmconf_base; 27static u64 fam10h_pci_mmconf_base;
28 28
29static struct pci_hostbridge_probe pci_probes[] __cpuinitdata = { 29static struct pci_hostbridge_probe pci_probes[] = {
30 { 0, 0x18, PCI_VENDOR_ID_AMD, 0x1200 }, 30 { 0, 0x18, PCI_VENDOR_ID_AMD, 0x1200 },
31 { 0xff, 0, PCI_VENDOR_ID_AMD, 0x1200 }, 31 { 0xff, 0, PCI_VENDOR_ID_AMD, 0x1200 },
32}; 32};
33 33
34static int __cpuinit cmp_range(const void *x1, const void *x2) 34static int cmp_range(const void *x1, const void *x2)
35{ 35{
36 const struct range *r1 = x1; 36 const struct range *r1 = x1;
37 const struct range *r2 = x2; 37 const struct range *r2 = x2;
@@ -49,7 +49,7 @@ static int __cpuinit cmp_range(const void *x1, const void *x2)
49/* need to avoid (0xfd<<32), (0xfe<<32), and (0xff<<32), ht used space */ 49/* need to avoid (0xfd<<32), (0xfe<<32), and (0xff<<32), ht used space */
50#define FAM10H_PCI_MMCONF_BASE (0xfcULL<<32) 50#define FAM10H_PCI_MMCONF_BASE (0xfcULL<<32)
51#define BASE_VALID(b) ((b) + MMCONF_SIZE <= (0xfdULL<<32) || (b) >= (1ULL<<40)) 51#define BASE_VALID(b) ((b) + MMCONF_SIZE <= (0xfdULL<<32) || (b) >= (1ULL<<40))
52static void __cpuinit get_fam10h_pci_mmconf_base(void) 52static void get_fam10h_pci_mmconf_base(void)
53{ 53{
54 int i; 54 int i;
55 unsigned bus; 55 unsigned bus;
@@ -166,7 +166,7 @@ out:
166 fam10h_pci_mmconf_base = base; 166 fam10h_pci_mmconf_base = base;
167} 167}
168 168
169void __cpuinit fam10h_check_enable_mmcfg(void) 169void fam10h_check_enable_mmcfg(void)
170{ 170{
171 u64 val; 171 u64 val;
172 u32 address; 172 u32 address;
@@ -230,7 +230,7 @@ static const struct dmi_system_id __initconst mmconf_dmi_table[] = {
230 {} 230 {}
231}; 231};
232 232
233/* Called from a __cpuinit function, but only on the BSP. */ 233/* Called from a non __init function, but only on the BSP. */
234void __ref check_enable_amd_mmconf_dmi(void) 234void __ref check_enable_amd_mmconf_dmi(void)
235{ 235{
236 dmi_check_system(mmconf_dmi_table); 236 dmi_check_system(mmconf_dmi_table);
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index ce130493b802..88458faea2f8 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -200,7 +200,7 @@ static const struct file_operations msr_fops = {
200 .compat_ioctl = msr_ioctl, 200 .compat_ioctl = msr_ioctl,
201}; 201};
202 202
203static int __cpuinit msr_device_create(int cpu) 203static int msr_device_create(int cpu)
204{ 204{
205 struct device *dev; 205 struct device *dev;
206 206
@@ -214,8 +214,8 @@ static void msr_device_destroy(int cpu)
214 device_destroy(msr_class, MKDEV(MSR_MAJOR, cpu)); 214 device_destroy(msr_class, MKDEV(MSR_MAJOR, cpu));
215} 215}
216 216
217static int __cpuinit msr_class_cpu_callback(struct notifier_block *nfb, 217static int msr_class_cpu_callback(struct notifier_block *nfb,
218 unsigned long action, void *hcpu) 218 unsigned long action, void *hcpu)
219{ 219{
220 unsigned int cpu = (unsigned long)hcpu; 220 unsigned int cpu = (unsigned long)hcpu;
221 int err = 0; 221 int err = 0;
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index 0920212e6159..ba77ebc2c353 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -111,7 +111,7 @@ static int __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2
111 */ 111 */
112 list_for_each_entry_rcu(a, &desc->head, list) { 112 list_for_each_entry_rcu(a, &desc->head, list) {
113 u64 before, delta, whole_msecs; 113 u64 before, delta, whole_msecs;
114 int decimal_msecs, thishandled; 114 int remainder_ns, decimal_msecs, thishandled;
115 115
116 before = local_clock(); 116 before = local_clock();
117 thishandled = a->handler(type, regs); 117 thishandled = a->handler(type, regs);
@@ -123,8 +123,9 @@ static int __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2
123 continue; 123 continue;
124 124
125 nmi_longest_ns = delta; 125 nmi_longest_ns = delta;
126 whole_msecs = do_div(delta, (1000 * 1000)); 126 whole_msecs = delta;
127 decimal_msecs = do_div(delta, 1000) % 1000; 127 remainder_ns = do_div(whole_msecs, (1000 * 1000));
128 decimal_msecs = remainder_ns / 1000;
128 printk_ratelimited(KERN_INFO 129 printk_ratelimited(KERN_INFO
129 "INFO: NMI handler (%ps) took too long to run: " 130 "INFO: NMI handler (%ps) took too long to run: "
130 "%lld.%03d msecs\n", a->handler, whole_msecs, 131 "%lld.%03d msecs\n", a->handler, whole_msecs,
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 81a5f5e8f142..83369e5a1d27 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -398,7 +398,7 @@ static void amd_e400_idle(void)
398 default_idle(); 398 default_idle();
399} 399}
400 400
401void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c) 401void select_idle_routine(const struct cpuinfo_x86 *c)
402{ 402{
403#ifdef CONFIG_SMP 403#ifdef CONFIG_SMP
404 if (boot_option_idle_override == IDLE_POLL && smp_num_siblings > 1) 404 if (boot_option_idle_override == IDLE_POLL && smp_num_siblings > 1)
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 29a8120e6fe8..7461f50d5bb1 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -601,30 +601,48 @@ static unsigned long ptrace_get_dr7(struct perf_event *bp[])
601 return dr7; 601 return dr7;
602} 602}
603 603
604static int 604static int ptrace_fill_bp_fields(struct perf_event_attr *attr,
605ptrace_modify_breakpoint(struct perf_event *bp, int len, int type, 605 int len, int type, bool disabled)
606 struct task_struct *tsk, int disabled) 606{
607 int err, bp_len, bp_type;
608
609 err = arch_bp_generic_fields(len, type, &bp_len, &bp_type);
610 if (!err) {
611 attr->bp_len = bp_len;
612 attr->bp_type = bp_type;
613 attr->disabled = disabled;
614 }
615
616 return err;
617}
618
619static struct perf_event *
620ptrace_register_breakpoint(struct task_struct *tsk, int len, int type,
621 unsigned long addr, bool disabled)
607{ 622{
608 int err;
609 int gen_len, gen_type;
610 struct perf_event_attr attr; 623 struct perf_event_attr attr;
624 int err;
611 625
612 /* 626 ptrace_breakpoint_init(&attr);
613 * We should have at least an inactive breakpoint at this 627 attr.bp_addr = addr;
614 * slot. It means the user is writing dr7 without having
615 * written the address register first
616 */
617 if (!bp)
618 return -EINVAL;
619 628
620 err = arch_bp_generic_fields(len, type, &gen_len, &gen_type); 629 err = ptrace_fill_bp_fields(&attr, len, type, disabled);
621 if (err) 630 if (err)
622 return err; 631 return ERR_PTR(err);
632
633 return register_user_hw_breakpoint(&attr, ptrace_triggered,
634 NULL, tsk);
635}
623 636
624 attr = bp->attr; 637static int ptrace_modify_breakpoint(struct perf_event *bp, int len, int type,
625 attr.bp_len = gen_len; 638 int disabled)
626 attr.bp_type = gen_type; 639{
627 attr.disabled = disabled; 640 struct perf_event_attr attr = bp->attr;
641 int err;
642
643 err = ptrace_fill_bp_fields(&attr, len, type, disabled);
644 if (err)
645 return err;
628 646
629 return modify_user_hw_breakpoint(bp, &attr); 647 return modify_user_hw_breakpoint(bp, &attr);
630} 648}
@@ -634,67 +652,50 @@ ptrace_modify_breakpoint(struct perf_event *bp, int len, int type,
634 */ 652 */
635static int ptrace_write_dr7(struct task_struct *tsk, unsigned long data) 653static int ptrace_write_dr7(struct task_struct *tsk, unsigned long data)
636{ 654{
637 struct thread_struct *thread = &(tsk->thread); 655 struct thread_struct *thread = &tsk->thread;
638 unsigned long old_dr7; 656 unsigned long old_dr7;
639 int i, orig_ret = 0, rc = 0; 657 bool second_pass = false;
640 int enabled, second_pass = 0; 658 int i, rc, ret = 0;
641 unsigned len, type;
642 struct perf_event *bp;
643
644 if (ptrace_get_breakpoints(tsk) < 0)
645 return -ESRCH;
646 659
647 data &= ~DR_CONTROL_RESERVED; 660 data &= ~DR_CONTROL_RESERVED;
648 old_dr7 = ptrace_get_dr7(thread->ptrace_bps); 661 old_dr7 = ptrace_get_dr7(thread->ptrace_bps);
662
649restore: 663restore:
650 /* 664 rc = 0;
651 * Loop through all the hardware breakpoints, making the
652 * appropriate changes to each.
653 */
654 for (i = 0; i < HBP_NUM; i++) { 665 for (i = 0; i < HBP_NUM; i++) {
655 enabled = decode_dr7(data, i, &len, &type); 666 unsigned len, type;
656 bp = thread->ptrace_bps[i]; 667 bool disabled = !decode_dr7(data, i, &len, &type);
657 668 struct perf_event *bp = thread->ptrace_bps[i];
658 if (!enabled) { 669
659 if (bp) { 670 if (!bp) {
660 /* 671 if (disabled)
661 * Don't unregister the breakpoints right-away, 672 continue;
662 * unless all register_user_hw_breakpoint() 673
663 * requests have succeeded. This prevents 674 bp = ptrace_register_breakpoint(tsk,
664 * any window of opportunity for debug 675 len, type, 0, disabled);
665 * register grabbing by other users. 676 if (IS_ERR(bp)) {
666 */ 677 rc = PTR_ERR(bp);
667 if (!second_pass) 678 break;
668 continue;
669
670 rc = ptrace_modify_breakpoint(bp, len, type,
671 tsk, 1);
672 if (rc)
673 break;
674 } 679 }
680
681 thread->ptrace_bps[i] = bp;
675 continue; 682 continue;
676 } 683 }
677 684
678 rc = ptrace_modify_breakpoint(bp, len, type, tsk, 0); 685 rc = ptrace_modify_breakpoint(bp, len, type, disabled);
679 if (rc) 686 if (rc)
680 break; 687 break;
681 } 688 }
682 /* 689
683 * Make a second pass to free the remaining unused breakpoints 690 /* Restore if the first pass failed, second_pass shouldn't fail. */
684 * or to restore the original breakpoints if an error occurred. 691 if (rc && !WARN_ON(second_pass)) {
685 */ 692 ret = rc;
686 if (!second_pass) { 693 data = old_dr7;
687 second_pass = 1; 694 second_pass = true;
688 if (rc < 0) {
689 orig_ret = rc;
690 data = old_dr7;
691 }
692 goto restore; 695 goto restore;
693 } 696 }
694 697
695 ptrace_put_breakpoints(tsk); 698 return ret;
696
697 return ((orig_ret < 0) ? orig_ret : rc);
698} 699}
699 700
700/* 701/*
@@ -702,25 +703,17 @@ restore:
702 */ 703 */
703static unsigned long ptrace_get_debugreg(struct task_struct *tsk, int n) 704static unsigned long ptrace_get_debugreg(struct task_struct *tsk, int n)
704{ 705{
705 struct thread_struct *thread = &(tsk->thread); 706 struct thread_struct *thread = &tsk->thread;
706 unsigned long val = 0; 707 unsigned long val = 0;
707 708
708 if (n < HBP_NUM) { 709 if (n < HBP_NUM) {
709 struct perf_event *bp; 710 struct perf_event *bp = thread->ptrace_bps[n];
710 711
711 if (ptrace_get_breakpoints(tsk) < 0) 712 if (bp)
712 return -ESRCH;
713
714 bp = thread->ptrace_bps[n];
715 if (!bp)
716 val = 0;
717 else
718 val = bp->hw.info.address; 713 val = bp->hw.info.address;
719
720 ptrace_put_breakpoints(tsk);
721 } else if (n == 6) { 714 } else if (n == 6) {
722 val = thread->debugreg6; 715 val = thread->debugreg6;
723 } else if (n == 7) { 716 } else if (n == 7) {
724 val = thread->ptrace_dr7; 717 val = thread->ptrace_dr7;
725 } 718 }
726 return val; 719 return val;
@@ -729,29 +722,14 @@ static unsigned long ptrace_get_debugreg(struct task_struct *tsk, int n)
729static int ptrace_set_breakpoint_addr(struct task_struct *tsk, int nr, 722static int ptrace_set_breakpoint_addr(struct task_struct *tsk, int nr,
730 unsigned long addr) 723 unsigned long addr)
731{ 724{
732 struct perf_event *bp;
733 struct thread_struct *t = &tsk->thread; 725 struct thread_struct *t = &tsk->thread;
734 struct perf_event_attr attr; 726 struct perf_event *bp = t->ptrace_bps[nr];
735 int err = 0; 727 int err = 0;
736 728
737 if (ptrace_get_breakpoints(tsk) < 0) 729 if (!bp) {
738 return -ESRCH;
739
740 if (!t->ptrace_bps[nr]) {
741 ptrace_breakpoint_init(&attr);
742 /*
743 * Put stub len and type to register (reserve) an inactive but
744 * correct bp
745 */
746 attr.bp_addr = addr;
747 attr.bp_len = HW_BREAKPOINT_LEN_1;
748 attr.bp_type = HW_BREAKPOINT_W;
749 attr.disabled = 1;
750
751 bp = register_user_hw_breakpoint(&attr, ptrace_triggered,
752 NULL, tsk);
753
754 /* 730 /*
731 * Put stub len and type to create an inactive but correct bp.
732 *
755 * CHECKME: the previous code returned -EIO if the addr wasn't 733 * CHECKME: the previous code returned -EIO if the addr wasn't
756 * a valid task virtual addr. The new one will return -EINVAL in 734 * a valid task virtual addr. The new one will return -EINVAL in
757 * this case. 735 * this case.
@@ -760,22 +738,20 @@ static int ptrace_set_breakpoint_addr(struct task_struct *tsk, int nr,
760 * writing for the user. And anyway this is the previous 738 * writing for the user. And anyway this is the previous
761 * behaviour. 739 * behaviour.
762 */ 740 */
763 if (IS_ERR(bp)) { 741 bp = ptrace_register_breakpoint(tsk,
742 X86_BREAKPOINT_LEN_1, X86_BREAKPOINT_WRITE,
743 addr, true);
744 if (IS_ERR(bp))
764 err = PTR_ERR(bp); 745 err = PTR_ERR(bp);
765 goto put; 746 else
766 } 747 t->ptrace_bps[nr] = bp;
767
768 t->ptrace_bps[nr] = bp;
769 } else { 748 } else {
770 bp = t->ptrace_bps[nr]; 749 struct perf_event_attr attr = bp->attr;
771 750
772 attr = bp->attr;
773 attr.bp_addr = addr; 751 attr.bp_addr = addr;
774 err = modify_user_hw_breakpoint(bp, &attr); 752 err = modify_user_hw_breakpoint(bp, &attr);
775 } 753 }
776 754
777put:
778 ptrace_put_breakpoints(tsk);
779 return err; 755 return err;
780} 756}
781 757
@@ -785,30 +761,20 @@ put:
785static int ptrace_set_debugreg(struct task_struct *tsk, int n, 761static int ptrace_set_debugreg(struct task_struct *tsk, int n,
786 unsigned long val) 762 unsigned long val)
787{ 763{
788 struct thread_struct *thread = &(tsk->thread); 764 struct thread_struct *thread = &tsk->thread;
789 int rc = 0;
790
791 /* There are no DR4 or DR5 registers */ 765 /* There are no DR4 or DR5 registers */
792 if (n == 4 || n == 5) 766 int rc = -EIO;
793 return -EIO;
794 767
795 if (n == 6) {
796 thread->debugreg6 = val;
797 goto ret_path;
798 }
799 if (n < HBP_NUM) { 768 if (n < HBP_NUM) {
800 rc = ptrace_set_breakpoint_addr(tsk, n, val); 769 rc = ptrace_set_breakpoint_addr(tsk, n, val);
801 if (rc) 770 } else if (n == 6) {
802 return rc; 771 thread->debugreg6 = val;
803 } 772 rc = 0;
804 /* All that's left is DR7 */ 773 } else if (n == 7) {
805 if (n == 7) {
806 rc = ptrace_write_dr7(tsk, val); 774 rc = ptrace_write_dr7(tsk, val);
807 if (!rc) 775 if (!rc)
808 thread->ptrace_dr7 = val; 776 thread->ptrace_dr7 = val;
809 } 777 }
810
811ret_path:
812 return rc; 778 return rc;
813} 779}
814 780
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 76fa1e9a2b39..563ed91e6faa 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -36,22 +36,6 @@ void (*pm_power_off)(void);
36EXPORT_SYMBOL(pm_power_off); 36EXPORT_SYMBOL(pm_power_off);
37 37
38static const struct desc_ptr no_idt = {}; 38static const struct desc_ptr no_idt = {};
39static int reboot_mode;
40enum reboot_type reboot_type = BOOT_ACPI;
41int reboot_force;
42
43/*
44 * This variable is used privately to keep track of whether or not
45 * reboot_type is still set to its default value (i.e., reboot= hasn't
46 * been set on the command line). This is needed so that we can
47 * suppress DMI scanning for reboot quirks. Without it, it's
48 * impossible to override a faulty reboot quirk without recompiling.
49 */
50static int reboot_default = 1;
51
52#ifdef CONFIG_SMP
53static int reboot_cpu = -1;
54#endif
55 39
56/* 40/*
57 * This is set if we need to go through the 'emergency' path. 41 * This is set if we need to go through the 'emergency' path.
@@ -64,79 +48,6 @@ static int reboot_emergency;
64bool port_cf9_safe = false; 48bool port_cf9_safe = false;
65 49
66/* 50/*
67 * reboot=b[ios] | s[mp] | t[riple] | k[bd] | e[fi] [, [w]arm | [c]old] | p[ci]
68 * warm Don't set the cold reboot flag
69 * cold Set the cold reboot flag
70 * bios Reboot by jumping through the BIOS
71 * smp Reboot by executing reset on BSP or other CPU
72 * triple Force a triple fault (init)
73 * kbd Use the keyboard controller. cold reset (default)
74 * acpi Use the RESET_REG in the FADT
75 * efi Use efi reset_system runtime service
76 * pci Use the so-called "PCI reset register", CF9
77 * force Avoid anything that could hang.
78 */
79static int __init reboot_setup(char *str)
80{
81 for (;;) {
82 /*
83 * Having anything passed on the command line via
84 * reboot= will cause us to disable DMI checking
85 * below.
86 */
87 reboot_default = 0;
88
89 switch (*str) {
90 case 'w':
91 reboot_mode = 0x1234;
92 break;
93
94 case 'c':
95 reboot_mode = 0;
96 break;
97
98#ifdef CONFIG_SMP
99 case 's':
100 if (isdigit(*(str+1))) {
101 reboot_cpu = (int) (*(str+1) - '0');
102 if (isdigit(*(str+2)))
103 reboot_cpu = reboot_cpu*10 + (int)(*(str+2) - '0');
104 }
105 /*
106 * We will leave sorting out the final value
107 * when we are ready to reboot, since we might not
108 * have detected BSP APIC ID or smp_num_cpu
109 */
110 break;
111#endif /* CONFIG_SMP */
112
113 case 'b':
114 case 'a':
115 case 'k':
116 case 't':
117 case 'e':
118 case 'p':
119 reboot_type = *str;
120 break;
121
122 case 'f':
123 reboot_force = 1;
124 break;
125 }
126
127 str = strchr(str, ',');
128 if (str)
129 str++;
130 else
131 break;
132 }
133 return 1;
134}
135
136__setup("reboot=", reboot_setup);
137
138
139/*
140 * Reboot options and system auto-detection code provided by 51 * Reboot options and system auto-detection code provided by
141 * Dell Inc. so their systems "just work". :-) 52 * Dell Inc. so their systems "just work". :-)
142 */ 53 */
@@ -536,6 +447,7 @@ static void native_machine_emergency_restart(void)
536 int i; 447 int i;
537 int attempt = 0; 448 int attempt = 0;
538 int orig_reboot_type = reboot_type; 449 int orig_reboot_type = reboot_type;
450 unsigned short mode;
539 451
540 if (reboot_emergency) 452 if (reboot_emergency)
541 emergency_vmx_disable_all(); 453 emergency_vmx_disable_all();
@@ -543,7 +455,8 @@ static void native_machine_emergency_restart(void)
543 tboot_shutdown(TB_SHUTDOWN_REBOOT); 455 tboot_shutdown(TB_SHUTDOWN_REBOOT);
544 456
545 /* Tell the BIOS if we want cold or warm reboot */ 457 /* Tell the BIOS if we want cold or warm reboot */
546 *((unsigned short *)__va(0x472)) = reboot_mode; 458 mode = reboot_mode == REBOOT_WARM ? 0x1234 : 0;
459 *((unsigned short *)__va(0x472)) = mode;
547 460
548 for (;;) { 461 for (;;) {
549 /* Could also try the reset bit in the Hammer NB */ 462 /* Could also try the reset bit in the Hammer NB */
@@ -585,7 +498,7 @@ static void native_machine_emergency_restart(void)
585 498
586 case BOOT_EFI: 499 case BOOT_EFI:
587 if (efi_enabled(EFI_RUNTIME_SERVICES)) 500 if (efi_enabled(EFI_RUNTIME_SERVICES))
588 efi.reset_system(reboot_mode ? 501 efi.reset_system(reboot_mode == REBOOT_WARM ?
589 EFI_RESET_WARM : 502 EFI_RESET_WARM :
590 EFI_RESET_COLD, 503 EFI_RESET_COLD,
591 EFI_SUCCESS, 0, NULL); 504 EFI_SUCCESS, 0, NULL);
@@ -614,26 +527,10 @@ void native_machine_shutdown(void)
614{ 527{
615 /* Stop the cpus and apics */ 528 /* Stop the cpus and apics */
616#ifdef CONFIG_SMP 529#ifdef CONFIG_SMP
617
618 /* The boot cpu is always logical cpu 0 */
619 int reboot_cpu_id = 0;
620
621 /* See if there has been given a command line override */
622 if ((reboot_cpu != -1) && (reboot_cpu < nr_cpu_ids) &&
623 cpu_online(reboot_cpu))
624 reboot_cpu_id = reboot_cpu;
625
626 /* Make certain the cpu I'm about to reboot on is online */
627 if (!cpu_online(reboot_cpu_id))
628 reboot_cpu_id = smp_processor_id();
629
630 /* Make certain I only run on the appropriate processor */
631 set_cpus_allowed_ptr(current, cpumask_of(reboot_cpu_id));
632
633 /* 530 /*
634 * O.K Now that I'm on the appropriate processor, stop all of the 531 * Stop all of the others. Also disable the local irq to
635 * others. Also disable the local irq to not receive the per-cpu 532 * not receive the per-cpu timer interrupt which may trigger
636 * timer interrupt which may trigger scheduler's load balance. 533 * scheduler's load balance.
637 */ 534 */
638 local_irq_disable(); 535 local_irq_disable();
639 stop_other_cpus(); 536 stop_other_cpus();
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
index 198eb201ed3b..0aa29394ed6f 100644
--- a/arch/x86/kernel/rtc.c
+++ b/arch/x86/kernel/rtc.c
@@ -38,8 +38,9 @@ EXPORT_SYMBOL(rtc_lock);
38 * jump to the next second precisely 500 ms later. Check the Motorola 38 * jump to the next second precisely 500 ms later. Check the Motorola
39 * MC146818A or Dallas DS12887 data sheet for details. 39 * MC146818A or Dallas DS12887 data sheet for details.
40 */ 40 */
41int mach_set_rtc_mmss(unsigned long nowtime) 41int mach_set_rtc_mmss(const struct timespec *now)
42{ 42{
43 unsigned long nowtime = now->tv_sec;
43 struct rtc_time tm; 44 struct rtc_time tm;
44 int retval = 0; 45 int retval = 0;
45 46
@@ -58,7 +59,7 @@ int mach_set_rtc_mmss(unsigned long nowtime)
58 return retval; 59 return retval;
59} 60}
60 61
61unsigned long mach_get_cmos_time(void) 62void mach_get_cmos_time(struct timespec *now)
62{ 63{
63 unsigned int status, year, mon, day, hour, min, sec, century = 0; 64 unsigned int status, year, mon, day, hour, min, sec, century = 0;
64 unsigned long flags; 65 unsigned long flags;
@@ -107,7 +108,8 @@ unsigned long mach_get_cmos_time(void)
107 } else 108 } else
108 year += CMOS_YEARS_OFFS; 109 year += CMOS_YEARS_OFFS;
109 110
110 return mktime(year, mon, day, hour, min, sec); 111 now->tv_sec = mktime(year, mon, day, hour, min, sec);
112 now->tv_nsec = 0;
111} 113}
112 114
113/* Routines for accessing the CMOS RAM/RTC. */ 115/* Routines for accessing the CMOS RAM/RTC. */
@@ -135,18 +137,13 @@ EXPORT_SYMBOL(rtc_cmos_write);
135 137
136int update_persistent_clock(struct timespec now) 138int update_persistent_clock(struct timespec now)
137{ 139{
138 return x86_platform.set_wallclock(now.tv_sec); 140 return x86_platform.set_wallclock(&now);
139} 141}
140 142
141/* not static: needed by APM */ 143/* not static: needed by APM */
142void read_persistent_clock(struct timespec *ts) 144void read_persistent_clock(struct timespec *ts)
143{ 145{
144 unsigned long retval; 146 x86_platform.get_wallclock(ts);
145
146 retval = x86_platform.get_wallclock();
147
148 ts->tv_sec = retval;
149 ts->tv_nsec = 0;
150} 147}
151 148
152 149
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index e68709da8251..f8ec57815c05 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -170,7 +170,7 @@ static struct resource bss_resource = {
170 170
171#ifdef CONFIG_X86_32 171#ifdef CONFIG_X86_32
172/* cpu data as detected by the assembly code in head.S */ 172/* cpu data as detected by the assembly code in head.S */
173struct cpuinfo_x86 new_cpu_data __cpuinitdata = { 173struct cpuinfo_x86 new_cpu_data = {
174 .wp_works_ok = -1, 174 .wp_works_ok = -1,
175}; 175};
176/* common cpu data for all cpus */ 176/* common cpu data for all cpus */
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index f4fe0b8879e0..cdaa347dfcad 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -265,23 +265,30 @@ void smp_reschedule_interrupt(struct pt_regs *regs)
265 */ 265 */
266} 266}
267 267
268void smp_trace_reschedule_interrupt(struct pt_regs *regs) 268static inline void smp_entering_irq(void)
269{ 269{
270 ack_APIC_irq(); 270 ack_APIC_irq();
271 irq_enter();
272}
273
274void smp_trace_reschedule_interrupt(struct pt_regs *regs)
275{
276 /*
277 * Need to call irq_enter() before calling the trace point.
278 * __smp_reschedule_interrupt() calls irq_enter/exit() too (in
279 * scheduler_ipi(). This is OK, since those functions are allowed
280 * to nest.
281 */
282 smp_entering_irq();
271 trace_reschedule_entry(RESCHEDULE_VECTOR); 283 trace_reschedule_entry(RESCHEDULE_VECTOR);
272 __smp_reschedule_interrupt(); 284 __smp_reschedule_interrupt();
273 trace_reschedule_exit(RESCHEDULE_VECTOR); 285 trace_reschedule_exit(RESCHEDULE_VECTOR);
286 exiting_irq();
274 /* 287 /*
275 * KVM uses this interrupt to force a cpu out of guest mode 288 * KVM uses this interrupt to force a cpu out of guest mode
276 */ 289 */
277} 290}
278 291
279static inline void call_function_entering_irq(void)
280{
281 ack_APIC_irq();
282 irq_enter();
283}
284
285static inline void __smp_call_function_interrupt(void) 292static inline void __smp_call_function_interrupt(void)
286{ 293{
287 generic_smp_call_function_interrupt(); 294 generic_smp_call_function_interrupt();
@@ -290,14 +297,14 @@ static inline void __smp_call_function_interrupt(void)
290 297
291void smp_call_function_interrupt(struct pt_regs *regs) 298void smp_call_function_interrupt(struct pt_regs *regs)
292{ 299{
293 call_function_entering_irq(); 300 smp_entering_irq();
294 __smp_call_function_interrupt(); 301 __smp_call_function_interrupt();
295 exiting_irq(); 302 exiting_irq();
296} 303}
297 304
298void smp_trace_call_function_interrupt(struct pt_regs *regs) 305void smp_trace_call_function_interrupt(struct pt_regs *regs)
299{ 306{
300 call_function_entering_irq(); 307 smp_entering_irq();
301 trace_call_function_entry(CALL_FUNCTION_VECTOR); 308 trace_call_function_entry(CALL_FUNCTION_VECTOR);
302 __smp_call_function_interrupt(); 309 __smp_call_function_interrupt();
303 trace_call_function_exit(CALL_FUNCTION_VECTOR); 310 trace_call_function_exit(CALL_FUNCTION_VECTOR);
@@ -312,14 +319,14 @@ static inline void __smp_call_function_single_interrupt(void)
312 319
313void smp_call_function_single_interrupt(struct pt_regs *regs) 320void smp_call_function_single_interrupt(struct pt_regs *regs)
314{ 321{
315 call_function_entering_irq(); 322 smp_entering_irq();
316 __smp_call_function_single_interrupt(); 323 __smp_call_function_single_interrupt();
317 exiting_irq(); 324 exiting_irq();
318} 325}
319 326
320void smp_trace_call_function_single_interrupt(struct pt_regs *regs) 327void smp_trace_call_function_single_interrupt(struct pt_regs *regs)
321{ 328{
322 call_function_entering_irq(); 329 smp_entering_irq();
323 trace_call_function_single_entry(CALL_FUNCTION_SINGLE_VECTOR); 330 trace_call_function_single_entry(CALL_FUNCTION_SINGLE_VECTOR);
324 __smp_call_function_single_interrupt(); 331 __smp_call_function_single_interrupt();
325 trace_call_function_single_exit(CALL_FUNCTION_SINGLE_VECTOR); 332 trace_call_function_single_exit(CALL_FUNCTION_SINGLE_VECTOR);
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index bfd348e99369..aecc98a93d1b 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -130,7 +130,7 @@ atomic_t init_deasserted;
130 * Report back to the Boot Processor during boot time or to the caller processor 130 * Report back to the Boot Processor during boot time or to the caller processor
131 * during CPU online. 131 * during CPU online.
132 */ 132 */
133static void __cpuinit smp_callin(void) 133static void smp_callin(void)
134{ 134{
135 int cpuid, phys_id; 135 int cpuid, phys_id;
136 unsigned long timeout; 136 unsigned long timeout;
@@ -237,7 +237,7 @@ static int enable_start_cpu0;
237/* 237/*
238 * Activate a secondary processor. 238 * Activate a secondary processor.
239 */ 239 */
240notrace static void __cpuinit start_secondary(void *unused) 240static void notrace start_secondary(void *unused)
241{ 241{
242 /* 242 /*
243 * Don't put *anything* before cpu_init(), SMP booting is too 243 * Don't put *anything* before cpu_init(), SMP booting is too
@@ -300,7 +300,7 @@ void __init smp_store_boot_cpu_info(void)
300 * The bootstrap kernel entry code has set these up. Save them for 300 * The bootstrap kernel entry code has set these up. Save them for
301 * a given CPU 301 * a given CPU
302 */ 302 */
303void __cpuinit smp_store_cpu_info(int id) 303void smp_store_cpu_info(int id)
304{ 304{
305 struct cpuinfo_x86 *c = &cpu_data(id); 305 struct cpuinfo_x86 *c = &cpu_data(id);
306 306
@@ -313,7 +313,7 @@ void __cpuinit smp_store_cpu_info(int id)
313 identify_secondary_cpu(c); 313 identify_secondary_cpu(c);
314} 314}
315 315
316static bool __cpuinit 316static bool
317topology_sane(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o, const char *name) 317topology_sane(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o, const char *name)
318{ 318{
319 int cpu1 = c->cpu_index, cpu2 = o->cpu_index; 319 int cpu1 = c->cpu_index, cpu2 = o->cpu_index;
@@ -330,7 +330,7 @@ do { \
330 cpumask_set_cpu((c2), cpu_##_m##_mask(c1)); \ 330 cpumask_set_cpu((c2), cpu_##_m##_mask(c1)); \
331} while (0) 331} while (0)
332 332
333static bool __cpuinit match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) 333static bool match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
334{ 334{
335 if (cpu_has_topoext) { 335 if (cpu_has_topoext) {
336 int cpu1 = c->cpu_index, cpu2 = o->cpu_index; 336 int cpu1 = c->cpu_index, cpu2 = o->cpu_index;
@@ -348,7 +348,7 @@ static bool __cpuinit match_smt(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
348 return false; 348 return false;
349} 349}
350 350
351static bool __cpuinit match_llc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) 351static bool match_llc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
352{ 352{
353 int cpu1 = c->cpu_index, cpu2 = o->cpu_index; 353 int cpu1 = c->cpu_index, cpu2 = o->cpu_index;
354 354
@@ -359,7 +359,7 @@ static bool __cpuinit match_llc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
359 return false; 359 return false;
360} 360}
361 361
362static bool __cpuinit match_mc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) 362static bool match_mc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
363{ 363{
364 if (c->phys_proc_id == o->phys_proc_id) { 364 if (c->phys_proc_id == o->phys_proc_id) {
365 if (cpu_has(c, X86_FEATURE_AMD_DCM)) 365 if (cpu_has(c, X86_FEATURE_AMD_DCM))
@@ -370,7 +370,7 @@ static bool __cpuinit match_mc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
370 return false; 370 return false;
371} 371}
372 372
373void __cpuinit set_cpu_sibling_map(int cpu) 373void set_cpu_sibling_map(int cpu)
374{ 374{
375 bool has_smt = smp_num_siblings > 1; 375 bool has_smt = smp_num_siblings > 1;
376 bool has_mp = has_smt || boot_cpu_data.x86_max_cores > 1; 376 bool has_mp = has_smt || boot_cpu_data.x86_max_cores > 1;
@@ -499,7 +499,7 @@ void __inquire_remote_apic(int apicid)
499 * INIT, INIT, STARTUP sequence will reset the chip hard for us, and this 499 * INIT, INIT, STARTUP sequence will reset the chip hard for us, and this
500 * won't ... remember to clear down the APIC, etc later. 500 * won't ... remember to clear down the APIC, etc later.
501 */ 501 */
502int __cpuinit 502int
503wakeup_secondary_cpu_via_nmi(int apicid, unsigned long start_eip) 503wakeup_secondary_cpu_via_nmi(int apicid, unsigned long start_eip)
504{ 504{
505 unsigned long send_status, accept_status = 0; 505 unsigned long send_status, accept_status = 0;
@@ -533,7 +533,7 @@ wakeup_secondary_cpu_via_nmi(int apicid, unsigned long start_eip)
533 return (send_status | accept_status); 533 return (send_status | accept_status);
534} 534}
535 535
536static int __cpuinit 536static int
537wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip) 537wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
538{ 538{
539 unsigned long send_status, accept_status = 0; 539 unsigned long send_status, accept_status = 0;
@@ -649,7 +649,7 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
649} 649}
650 650
651/* reduce the number of lines printed when booting a large cpu count system */ 651/* reduce the number of lines printed when booting a large cpu count system */
652static void __cpuinit announce_cpu(int cpu, int apicid) 652static void announce_cpu(int cpu, int apicid)
653{ 653{
654 static int current_node = -1; 654 static int current_node = -1;
655 int node = early_cpu_to_node(cpu); 655 int node = early_cpu_to_node(cpu);
@@ -691,7 +691,7 @@ static int wakeup_cpu0_nmi(unsigned int cmd, struct pt_regs *regs)
691 * We'll change this code in the future to wake up hard offlined CPU0 if 691 * We'll change this code in the future to wake up hard offlined CPU0 if
692 * real platform and request are available. 692 * real platform and request are available.
693 */ 693 */
694static int __cpuinit 694static int
695wakeup_cpu_via_init_nmi(int cpu, unsigned long start_ip, int apicid, 695wakeup_cpu_via_init_nmi(int cpu, unsigned long start_ip, int apicid,
696 int *cpu0_nmi_registered) 696 int *cpu0_nmi_registered)
697{ 697{
@@ -731,7 +731,7 @@ wakeup_cpu_via_init_nmi(int cpu, unsigned long start_ip, int apicid,
731 * Returns zero if CPU booted OK, else error code from 731 * Returns zero if CPU booted OK, else error code from
732 * ->wakeup_secondary_cpu. 732 * ->wakeup_secondary_cpu.
733 */ 733 */
734static int __cpuinit do_boot_cpu(int apicid, int cpu, struct task_struct *idle) 734static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
735{ 735{
736 volatile u32 *trampoline_status = 736 volatile u32 *trampoline_status =
737 (volatile u32 *) __va(real_mode_header->trampoline_status); 737 (volatile u32 *) __va(real_mode_header->trampoline_status);
@@ -872,7 +872,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
872 return boot_error; 872 return boot_error;
873} 873}
874 874
875int __cpuinit native_cpu_up(unsigned int cpu, struct task_struct *tidle) 875int native_cpu_up(unsigned int cpu, struct task_struct *tidle)
876{ 876{
877 int apicid = apic->cpu_present_to_apicid(cpu); 877 int apicid = apic->cpu_present_to_apicid(cpu);
878 unsigned long flags; 878 unsigned long flags;
diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index 3ff42d2f046d..addf7b58f4e8 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -320,8 +320,8 @@ static int tboot_wait_for_aps(int num_aps)
320 return !(atomic_read((atomic_t *)&tboot->num_in_wfs) == num_aps); 320 return !(atomic_read((atomic_t *)&tboot->num_in_wfs) == num_aps);
321} 321}
322 322
323static int __cpuinit tboot_cpu_callback(struct notifier_block *nfb, 323static int tboot_cpu_callback(struct notifier_block *nfb, unsigned long action,
324 unsigned long action, void *hcpu) 324 void *hcpu)
325{ 325{
326 switch (action) { 326 switch (action) {
327 case CPU_DYING: 327 case CPU_DYING:
@@ -334,7 +334,7 @@ static int __cpuinit tboot_cpu_callback(struct notifier_block *nfb,
334 return NOTIFY_OK; 334 return NOTIFY_OK;
335} 335}
336 336
337static struct notifier_block tboot_cpu_notifier __cpuinitdata = 337static struct notifier_block tboot_cpu_notifier =
338{ 338{
339 .notifier_call = tboot_cpu_callback, 339 .notifier_call = tboot_cpu_callback,
340}; 340};
diff --git a/arch/x86/kernel/tracepoint.c b/arch/x86/kernel/tracepoint.c
index 4e584a8d6edd..1c113db9ed57 100644
--- a/arch/x86/kernel/tracepoint.c
+++ b/arch/x86/kernel/tracepoint.c
@@ -12,10 +12,8 @@ atomic_t trace_idt_ctr = ATOMIC_INIT(0);
12struct desc_ptr trace_idt_descr = { NR_VECTORS * 16 - 1, 12struct desc_ptr trace_idt_descr = { NR_VECTORS * 16 - 1,
13 (unsigned long) trace_idt_table }; 13 (unsigned long) trace_idt_table };
14 14
15#ifndef CONFIG_X86_64 15/* No need to be aligned, but done to keep all IDTs defined the same way. */
16gate_desc trace_idt_table[NR_VECTORS] __page_aligned_data 16gate_desc trace_idt_table[NR_VECTORS] __page_aligned_bss;
17 = { { { { 0, 0 } } }, };
18#endif
19 17
20static int trace_irq_vector_refcount; 18static int trace_irq_vector_refcount;
21static DEFINE_MUTEX(irq_vector_mutex); 19static DEFINE_MUTEX(irq_vector_mutex);
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index b0865e88d3cc..1b23a1c92746 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -63,19 +63,19 @@
63#include <asm/x86_init.h> 63#include <asm/x86_init.h>
64#include <asm/pgalloc.h> 64#include <asm/pgalloc.h>
65#include <asm/proto.h> 65#include <asm/proto.h>
66
67/* No need to be aligned, but done to keep all IDTs defined the same way. */
68gate_desc debug_idt_table[NR_VECTORS] __page_aligned_bss;
66#else 69#else
67#include <asm/processor-flags.h> 70#include <asm/processor-flags.h>
68#include <asm/setup.h> 71#include <asm/setup.h>
69 72
70asmlinkage int system_call(void); 73asmlinkage int system_call(void);
71
72/*
73 * The IDT has to be page-aligned to simplify the Pentium
74 * F0 0F bug workaround.
75 */
76gate_desc idt_table[NR_VECTORS] __page_aligned_data = { { { { 0, 0 } } }, };
77#endif 74#endif
78 75
76/* Must be page-aligned because the real IDT is used in a fixmap. */
77gate_desc idt_table[NR_VECTORS] __page_aligned_bss;
78
79DECLARE_BITMAP(used_vectors, NR_VECTORS); 79DECLARE_BITMAP(used_vectors, NR_VECTORS);
80EXPORT_SYMBOL_GPL(used_vectors); 80EXPORT_SYMBOL_GPL(used_vectors);
81 81
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 098b3cfda72e..6ff49247edf8 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -824,7 +824,7 @@ static void __init check_system_tsc_reliable(void)
824 * Make an educated guess if the TSC is trustworthy and synchronized 824 * Make an educated guess if the TSC is trustworthy and synchronized
825 * over all CPUs. 825 * over all CPUs.
826 */ 826 */
827__cpuinit int unsynchronized_tsc(void) 827int unsynchronized_tsc(void)
828{ 828{
829 if (!cpu_has_tsc || tsc_unstable) 829 if (!cpu_has_tsc || tsc_unstable)
830 return 1; 830 return 1;
@@ -1020,7 +1020,7 @@ void __init tsc_init(void)
1020 * been calibrated. This assumes that CONSTANT_TSC applies to all 1020 * been calibrated. This assumes that CONSTANT_TSC applies to all
1021 * cpus in the socket - this should be a safe assumption. 1021 * cpus in the socket - this should be a safe assumption.
1022 */ 1022 */
1023unsigned long __cpuinit calibrate_delay_is_known(void) 1023unsigned long calibrate_delay_is_known(void)
1024{ 1024{
1025 int i, cpu = smp_processor_id(); 1025 int i, cpu = smp_processor_id();
1026 1026
diff --git a/arch/x86/kernel/tsc_sync.c b/arch/x86/kernel/tsc_sync.c
index fc25e60a5884..adfdf56a3714 100644
--- a/arch/x86/kernel/tsc_sync.c
+++ b/arch/x86/kernel/tsc_sync.c
@@ -25,24 +25,24 @@
25 * Entry/exit counters that make sure that both CPUs 25 * Entry/exit counters that make sure that both CPUs
26 * run the measurement code at once: 26 * run the measurement code at once:
27 */ 27 */
28static __cpuinitdata atomic_t start_count; 28static atomic_t start_count;
29static __cpuinitdata atomic_t stop_count; 29static atomic_t stop_count;
30 30
31/* 31/*
32 * We use a raw spinlock in this exceptional case, because 32 * We use a raw spinlock in this exceptional case, because
33 * we want to have the fastest, inlined, non-debug version 33 * we want to have the fastest, inlined, non-debug version
34 * of a critical section, to be able to prove TSC time-warps: 34 * of a critical section, to be able to prove TSC time-warps:
35 */ 35 */
36static __cpuinitdata arch_spinlock_t sync_lock = __ARCH_SPIN_LOCK_UNLOCKED; 36static arch_spinlock_t sync_lock = __ARCH_SPIN_LOCK_UNLOCKED;
37 37
38static __cpuinitdata cycles_t last_tsc; 38static cycles_t last_tsc;
39static __cpuinitdata cycles_t max_warp; 39static cycles_t max_warp;
40static __cpuinitdata int nr_warps; 40static int nr_warps;
41 41
42/* 42/*
43 * TSC-warp measurement loop running on both CPUs: 43 * TSC-warp measurement loop running on both CPUs:
44 */ 44 */
45static __cpuinit void check_tsc_warp(unsigned int timeout) 45static void check_tsc_warp(unsigned int timeout)
46{ 46{
47 cycles_t start, now, prev, end; 47 cycles_t start, now, prev, end;
48 int i; 48 int i;
@@ -121,7 +121,7 @@ static inline unsigned int loop_timeout(int cpu)
121 * Source CPU calls into this - it waits for the freshly booted 121 * Source CPU calls into this - it waits for the freshly booted
122 * target CPU to arrive and then starts the measurement: 122 * target CPU to arrive and then starts the measurement:
123 */ 123 */
124void __cpuinit check_tsc_sync_source(int cpu) 124void check_tsc_sync_source(int cpu)
125{ 125{
126 int cpus = 2; 126 int cpus = 2;
127 127
@@ -187,7 +187,7 @@ void __cpuinit check_tsc_sync_source(int cpu)
187/* 187/*
188 * Freshly booted CPUs call into this: 188 * Freshly booted CPUs call into this:
189 */ 189 */
190void __cpuinit check_tsc_sync_target(void) 190void check_tsc_sync_target(void)
191{ 191{
192 int cpus = 2; 192 int cpus = 2;
193 193
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 9a907a67be8f..1f96f9347ed9 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -331,7 +331,7 @@ sigsegv:
331 * Assume __initcall executes before all user space. Hopefully kmod 331 * Assume __initcall executes before all user space. Hopefully kmod
332 * doesn't violate that. We'll find out if it does. 332 * doesn't violate that. We'll find out if it does.
333 */ 333 */
334static void __cpuinit vsyscall_set_cpu(int cpu) 334static void vsyscall_set_cpu(int cpu)
335{ 335{
336 unsigned long d; 336 unsigned long d;
337 unsigned long node = 0; 337 unsigned long node = 0;
@@ -353,13 +353,13 @@ static void __cpuinit vsyscall_set_cpu(int cpu)
353 write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_PER_CPU, &d, DESCTYPE_S); 353 write_gdt_entry(get_cpu_gdt_table(cpu), GDT_ENTRY_PER_CPU, &d, DESCTYPE_S);
354} 354}
355 355
356static void __cpuinit cpu_vsyscall_init(void *arg) 356static void cpu_vsyscall_init(void *arg)
357{ 357{
358 /* preemption should be already off */ 358 /* preemption should be already off */
359 vsyscall_set_cpu(raw_smp_processor_id()); 359 vsyscall_set_cpu(raw_smp_processor_id());
360} 360}
361 361
362static int __cpuinit 362static int
363cpu_vsyscall_notifier(struct notifier_block *n, unsigned long action, void *arg) 363cpu_vsyscall_notifier(struct notifier_block *n, unsigned long action, void *arg)
364{ 364{
365 long cpu = (long)arg; 365 long cpu = (long)arg;
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index 45a14dbbddaf..5f24c71accaa 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -25,7 +25,7 @@
25#include <asm/iommu.h> 25#include <asm/iommu.h>
26#include <asm/mach_traps.h> 26#include <asm/mach_traps.h>
27 27
28void __cpuinit x86_init_noop(void) { } 28void x86_init_noop(void) { }
29void __init x86_init_uint_noop(unsigned int unused) { } 29void __init x86_init_uint_noop(unsigned int unused) { }
30int __init iommu_init_noop(void) { return 0; } 30int __init iommu_init_noop(void) { return 0; }
31void iommu_shutdown_noop(void) { } 31void iommu_shutdown_noop(void) { }
@@ -85,7 +85,7 @@ struct x86_init_ops x86_init __initdata = {
85 }, 85 },
86}; 86};
87 87
88struct x86_cpuinit_ops x86_cpuinit __cpuinitdata = { 88struct x86_cpuinit_ops x86_cpuinit = {
89 .early_percpu_clock_init = x86_init_noop, 89 .early_percpu_clock_init = x86_init_noop,
90 .setup_percpu_clockev = setup_secondary_APIC_clock, 90 .setup_percpu_clockev = setup_secondary_APIC_clock,
91}; 91};
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
index d6c28acdf99c..422fd8223470 100644
--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -573,7 +573,7 @@ static void __init xstate_enable_boot_cpu(void)
573 * This is somewhat obfuscated due to the lack of powerful enough 573 * This is somewhat obfuscated due to the lack of powerful enough
574 * overrides for the section checks. 574 * overrides for the section checks.
575 */ 575 */
576void __cpuinit xsave_init(void) 576void xsave_init(void)
577{ 577{
578 static __refdata void (*next_func)(void) = xstate_enable_boot_cpu; 578 static __refdata void (*next_func)(void) = xstate_enable_boot_cpu;
579 void (*this_func)(void); 579 void (*this_func)(void);
@@ -594,7 +594,7 @@ static inline void __init eager_fpu_init_bp(void)
594 setup_init_fpu_buf(); 594 setup_init_fpu_buf();
595} 595}
596 596
597void __cpuinit eager_fpu_init(void) 597void eager_fpu_init(void)
598{ 598{
599 static __refdata void (*boot_func)(void) = eager_fpu_init_bp; 599 static __refdata void (*boot_func)(void) = eager_fpu_init_bp;
600 600
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 0d094da49541..9e9285ae9b94 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2811,6 +2811,13 @@ exit:
2811static bool page_fault_can_be_fast(struct kvm_vcpu *vcpu, u32 error_code) 2811static bool page_fault_can_be_fast(struct kvm_vcpu *vcpu, u32 error_code)
2812{ 2812{
2813 /* 2813 /*
2814 * Do not fix the mmio spte with invalid generation number which
2815 * need to be updated by slow page fault path.
2816 */
2817 if (unlikely(error_code & PFERR_RSVD_MASK))
2818 return false;
2819
2820 /*
2814 * #PF can be fast only if the shadow page table is present and it 2821 * #PF can be fast only if the shadow page table is present and it
2815 * is caused by write-protect, that means we just need change the 2822 * is caused by write-protect, that means we just need change the
2816 * W bit of the spte which can be done out of mmu-lock. 2823 * W bit of the spte which can be done out of mmu-lock.
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index a7e18551c968..064d0be67ecc 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3404,15 +3404,22 @@ static void vmx_get_segment(struct kvm_vcpu *vcpu,
3404 var->limit = vmx_read_guest_seg_limit(vmx, seg); 3404 var->limit = vmx_read_guest_seg_limit(vmx, seg);
3405 var->selector = vmx_read_guest_seg_selector(vmx, seg); 3405 var->selector = vmx_read_guest_seg_selector(vmx, seg);
3406 ar = vmx_read_guest_seg_ar(vmx, seg); 3406 ar = vmx_read_guest_seg_ar(vmx, seg);
3407 var->unusable = (ar >> 16) & 1;
3407 var->type = ar & 15; 3408 var->type = ar & 15;
3408 var->s = (ar >> 4) & 1; 3409 var->s = (ar >> 4) & 1;
3409 var->dpl = (ar >> 5) & 3; 3410 var->dpl = (ar >> 5) & 3;
3410 var->present = (ar >> 7) & 1; 3411 /*
3412 * Some userspaces do not preserve unusable property. Since usable
3413 * segment has to be present according to VMX spec we can use present
3414 * property to amend userspace bug by making unusable segment always
3415 * nonpresent. vmx_segment_access_rights() already marks nonpresent
3416 * segment as unusable.
3417 */
3418 var->present = !var->unusable;
3411 var->avl = (ar >> 12) & 1; 3419 var->avl = (ar >> 12) & 1;
3412 var->l = (ar >> 13) & 1; 3420 var->l = (ar >> 13) & 1;
3413 var->db = (ar >> 14) & 1; 3421 var->db = (ar >> 14) & 1;
3414 var->g = (ar >> 15) & 1; 3422 var->g = (ar >> 15) & 1;
3415 var->unusable = (ar >> 16) & 1;
3416} 3423}
3417 3424
3418static u64 vmx_get_segment_base(struct kvm_vcpu *vcpu, int seg) 3425static u64 vmx_get_segment_base(struct kvm_vcpu *vcpu, int seg)
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index d482bcaf61c1..6a22c19da663 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -882,9 +882,9 @@ int lguest_setup_irq(unsigned int irq)
882 * It would be far better for everyone if the Guest had its own clock, but 882 * It would be far better for everyone if the Guest had its own clock, but
883 * until then the Host gives us the time on every interrupt. 883 * until then the Host gives us the time on every interrupt.
884 */ 884 */
885static unsigned long lguest_get_wallclock(void) 885static void lguest_get_wallclock(struct timespec *now)
886{ 886{
887 return lguest_data.time.tv_sec; 887 *now = lguest_data.time;
888} 888}
889 889
890/* 890/*
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
index 845df6835f9f..62c29a5bfe26 100644
--- a/arch/x86/mm/mmap.c
+++ b/arch/x86/mm/mmap.c
@@ -115,10 +115,8 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
115 if (mmap_is_legacy()) { 115 if (mmap_is_legacy()) {
116 mm->mmap_base = mmap_legacy_base(); 116 mm->mmap_base = mmap_legacy_base();
117 mm->get_unmapped_area = arch_get_unmapped_area; 117 mm->get_unmapped_area = arch_get_unmapped_area;
118 mm->unmap_area = arch_unmap_area;
119 } else { 118 } else {
120 mm->mmap_base = mmap_base(); 119 mm->mmap_base = mmap_base();
121 mm->get_unmapped_area = arch_get_unmapped_area_topdown; 120 mm->get_unmapped_area = arch_get_unmapped_area_topdown;
122 mm->unmap_area = arch_unmap_area_topdown;
123 } 121 }
124} 122}
diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
index dc0b727742f4..0057a7accfb1 100644
--- a/arch/x86/mm/mmio-mod.c
+++ b/arch/x86/mm/mmio-mod.c
@@ -410,9 +410,7 @@ out:
410 pr_warning("multiple CPUs still online, may miss events.\n"); 410 pr_warning("multiple CPUs still online, may miss events.\n");
411} 411}
412 412
413/* __ref because leave_uniprocessor calls cpu_up which is __cpuinit, 413static void leave_uniprocessor(void)
414 but this whole function is ifdefed CONFIG_HOTPLUG_CPU */
415static void __ref leave_uniprocessor(void)
416{ 414{
417 int cpu; 415 int cpu;
418 int err; 416 int err;
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index a71c4e207679..8bf93bae1f13 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -60,7 +60,7 @@ s16 __apicid_to_node[MAX_LOCAL_APIC] = {
60 [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE 60 [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE
61}; 61};
62 62
63int __cpuinit numa_cpu_node(int cpu) 63int numa_cpu_node(int cpu)
64{ 64{
65 int apicid = early_per_cpu(x86_cpu_to_apicid, cpu); 65 int apicid = early_per_cpu(x86_cpu_to_apicid, cpu);
66 66
@@ -691,12 +691,12 @@ void __init init_cpu_to_node(void)
691#ifndef CONFIG_DEBUG_PER_CPU_MAPS 691#ifndef CONFIG_DEBUG_PER_CPU_MAPS
692 692
693# ifndef CONFIG_NUMA_EMU 693# ifndef CONFIG_NUMA_EMU
694void __cpuinit numa_add_cpu(int cpu) 694void numa_add_cpu(int cpu)
695{ 695{
696 cpumask_set_cpu(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]); 696 cpumask_set_cpu(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]);
697} 697}
698 698
699void __cpuinit numa_remove_cpu(int cpu) 699void numa_remove_cpu(int cpu)
700{ 700{
701 cpumask_clear_cpu(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]); 701 cpumask_clear_cpu(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]);
702} 702}
@@ -763,17 +763,17 @@ void debug_cpumask_set_cpu(int cpu, int node, bool enable)
763} 763}
764 764
765# ifndef CONFIG_NUMA_EMU 765# ifndef CONFIG_NUMA_EMU
766static void __cpuinit numa_set_cpumask(int cpu, bool enable) 766static void numa_set_cpumask(int cpu, bool enable)
767{ 767{
768 debug_cpumask_set_cpu(cpu, early_cpu_to_node(cpu), enable); 768 debug_cpumask_set_cpu(cpu, early_cpu_to_node(cpu), enable);
769} 769}
770 770
771void __cpuinit numa_add_cpu(int cpu) 771void numa_add_cpu(int cpu)
772{ 772{
773 numa_set_cpumask(cpu, true); 773 numa_set_cpumask(cpu, true);
774} 774}
775 775
776void __cpuinit numa_remove_cpu(int cpu) 776void numa_remove_cpu(int cpu)
777{ 777{
778 numa_set_cpumask(cpu, false); 778 numa_set_cpumask(cpu, false);
779} 779}
diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c
index dbbbb47260cc..a8f90ce3dedf 100644
--- a/arch/x86/mm/numa_emulation.c
+++ b/arch/x86/mm/numa_emulation.c
@@ -10,7 +10,7 @@
10 10
11#include "numa_internal.h" 11#include "numa_internal.h"
12 12
13static int emu_nid_to_phys[MAX_NUMNODES] __cpuinitdata; 13static int emu_nid_to_phys[MAX_NUMNODES];
14static char *emu_cmdline __initdata; 14static char *emu_cmdline __initdata;
15 15
16void __init numa_emu_cmdline(char *str) 16void __init numa_emu_cmdline(char *str)
@@ -444,7 +444,7 @@ no_emu:
444} 444}
445 445
446#ifndef CONFIG_DEBUG_PER_CPU_MAPS 446#ifndef CONFIG_DEBUG_PER_CPU_MAPS
447void __cpuinit numa_add_cpu(int cpu) 447void numa_add_cpu(int cpu)
448{ 448{
449 int physnid, nid; 449 int physnid, nid;
450 450
@@ -462,7 +462,7 @@ void __cpuinit numa_add_cpu(int cpu)
462 cpumask_set_cpu(cpu, node_to_cpumask_map[nid]); 462 cpumask_set_cpu(cpu, node_to_cpumask_map[nid]);
463} 463}
464 464
465void __cpuinit numa_remove_cpu(int cpu) 465void numa_remove_cpu(int cpu)
466{ 466{
467 int i; 467 int i;
468 468
@@ -470,7 +470,7 @@ void __cpuinit numa_remove_cpu(int cpu)
470 cpumask_clear_cpu(cpu, node_to_cpumask_map[i]); 470 cpumask_clear_cpu(cpu, node_to_cpumask_map[i]);
471} 471}
472#else /* !CONFIG_DEBUG_PER_CPU_MAPS */ 472#else /* !CONFIG_DEBUG_PER_CPU_MAPS */
473static void __cpuinit numa_set_cpumask(int cpu, bool enable) 473static void numa_set_cpumask(int cpu, bool enable)
474{ 474{
475 int nid, physnid; 475 int nid, physnid;
476 476
@@ -490,12 +490,12 @@ static void __cpuinit numa_set_cpumask(int cpu, bool enable)
490 } 490 }
491} 491}
492 492
493void __cpuinit numa_add_cpu(int cpu) 493void numa_add_cpu(int cpu)
494{ 494{
495 numa_set_cpumask(cpu, true); 495 numa_set_cpumask(cpu, true);
496} 496}
497 497
498void __cpuinit numa_remove_cpu(int cpu) 498void numa_remove_cpu(int cpu)
499{ 499{
500 numa_set_cpumask(cpu, false); 500 numa_set_cpumask(cpu, false);
501} 501}
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index 17fda6a8b3c2..dfa537a03be1 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -240,7 +240,6 @@ static void pgd_mop_up_pmds(struct mm_struct *mm, pgd_t *pgdp)
240static void pgd_prepopulate_pmd(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmds[]) 240static void pgd_prepopulate_pmd(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmds[])
241{ 241{
242 pud_t *pud; 242 pud_t *pud;
243 unsigned long addr;
244 int i; 243 int i;
245 244
246 if (PREALLOCATED_PMDS == 0) /* Work around gcc-3.4.x bug */ 245 if (PREALLOCATED_PMDS == 0) /* Work around gcc-3.4.x bug */
@@ -248,8 +247,7 @@ static void pgd_prepopulate_pmd(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmds[])
248 247
249 pud = pud_offset(pgd, 0); 248 pud = pud_offset(pgd, 0);
250 249
251 for (addr = i = 0; i < PREALLOCATED_PMDS; 250 for (i = 0; i < PREALLOCATED_PMDS; i++, pud++) {
252 i++, pud++, addr += PUD_SIZE) {
253 pmd_t *pmd = pmds[i]; 251 pmd_t *pmd = pmds[i];
254 252
255 if (i >= KERNEL_PGD_BOUNDARY) 253 if (i >= KERNEL_PGD_BOUNDARY)
diff --git a/arch/x86/mm/setup_nx.c b/arch/x86/mm/setup_nx.c
index 410531d3c292..90555bf60aa4 100644
--- a/arch/x86/mm/setup_nx.c
+++ b/arch/x86/mm/setup_nx.c
@@ -5,7 +5,7 @@
5#include <asm/pgtable.h> 5#include <asm/pgtable.h>
6#include <asm/proto.h> 6#include <asm/proto.h>
7 7
8static int disable_nx __cpuinitdata; 8static int disable_nx;
9 9
10/* 10/*
11 * noexec = on|off 11 * noexec = on|off
@@ -29,7 +29,7 @@ static int __init noexec_setup(char *str)
29} 29}
30early_param("noexec", noexec_setup); 30early_param("noexec", noexec_setup);
31 31
32void __cpuinit x86_configure_nx(void) 32void x86_configure_nx(void)
33{ 33{
34 if (cpu_has_nx && !disable_nx) 34 if (cpu_has_nx && !disable_nx)
35 __supported_pte_mask |= _PAGE_NX; 35 __supported_pte_mask |= _PAGE_NX;
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index f66b54086ce5..79c216aa0e2b 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -12,6 +12,7 @@
12#include <linux/netdevice.h> 12#include <linux/netdevice.h>
13#include <linux/filter.h> 13#include <linux/filter.h>
14#include <linux/if_vlan.h> 14#include <linux/if_vlan.h>
15#include <linux/random.h>
15 16
16/* 17/*
17 * Conventions : 18 * Conventions :
@@ -144,6 +145,39 @@ static int pkt_type_offset(void)
144 return -1; 145 return -1;
145} 146}
146 147
148struct bpf_binary_header {
149 unsigned int pages;
150 /* Note : for security reasons, bpf code will follow a randomly
151 * sized amount of int3 instructions
152 */
153 u8 image[];
154};
155
156static struct bpf_binary_header *bpf_alloc_binary(unsigned int proglen,
157 u8 **image_ptr)
158{
159 unsigned int sz, hole;
160 struct bpf_binary_header *header;
161
162 /* Most of BPF filters are really small,
163 * but if some of them fill a page, allow at least
164 * 128 extra bytes to insert a random section of int3
165 */
166 sz = round_up(proglen + sizeof(*header) + 128, PAGE_SIZE);
167 header = module_alloc(sz);
168 if (!header)
169 return NULL;
170
171 memset(header, 0xcc, sz); /* fill whole space with int3 instructions */
172
173 header->pages = sz / PAGE_SIZE;
174 hole = sz - (proglen + sizeof(*header));
175
176 /* insert a random number of int3 instructions before BPF code */
177 *image_ptr = &header->image[prandom_u32() % hole];
178 return header;
179}
180
147void bpf_jit_compile(struct sk_filter *fp) 181void bpf_jit_compile(struct sk_filter *fp)
148{ 182{
149 u8 temp[64]; 183 u8 temp[64];
@@ -153,6 +187,7 @@ void bpf_jit_compile(struct sk_filter *fp)
153 int t_offset, f_offset; 187 int t_offset, f_offset;
154 u8 t_op, f_op, seen = 0, pass; 188 u8 t_op, f_op, seen = 0, pass;
155 u8 *image = NULL; 189 u8 *image = NULL;
190 struct bpf_binary_header *header = NULL;
156 u8 *func; 191 u8 *func;
157 int pc_ret0 = -1; /* bpf index of first RET #0 instruction (if any) */ 192 int pc_ret0 = -1; /* bpf index of first RET #0 instruction (if any) */
158 unsigned int cleanup_addr; /* epilogue code offset */ 193 unsigned int cleanup_addr; /* epilogue code offset */
@@ -693,7 +728,7 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
693 if (unlikely(proglen + ilen > oldproglen)) { 728 if (unlikely(proglen + ilen > oldproglen)) {
694 pr_err("bpb_jit_compile fatal error\n"); 729 pr_err("bpb_jit_compile fatal error\n");
695 kfree(addrs); 730 kfree(addrs);
696 module_free(NULL, image); 731 module_free(NULL, header);
697 return; 732 return;
698 } 733 }
699 memcpy(image + proglen, temp, ilen); 734 memcpy(image + proglen, temp, ilen);
@@ -717,10 +752,8 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
717 break; 752 break;
718 } 753 }
719 if (proglen == oldproglen) { 754 if (proglen == oldproglen) {
720 image = module_alloc(max_t(unsigned int, 755 header = bpf_alloc_binary(proglen, &image);
721 proglen, 756 if (!header)
722 sizeof(struct work_struct)));
723 if (!image)
724 goto out; 757 goto out;
725 } 758 }
726 oldproglen = proglen; 759 oldproglen = proglen;
@@ -730,7 +763,8 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
730 bpf_jit_dump(flen, proglen, pass, image); 763 bpf_jit_dump(flen, proglen, pass, image);
731 764
732 if (image) { 765 if (image) {
733 bpf_flush_icache(image, image + proglen); 766 bpf_flush_icache(header, image + proglen);
767 set_memory_ro((unsigned long)header, header->pages);
734 fp->bpf_func = (void *)image; 768 fp->bpf_func = (void *)image;
735 } 769 }
736out: 770out:
@@ -738,20 +772,13 @@ out:
738 return; 772 return;
739} 773}
740 774
741static void jit_free_defer(struct work_struct *arg)
742{
743 module_free(NULL, arg);
744}
745
746/* run from softirq, we must use a work_struct to call
747 * module_free() from process context
748 */
749void bpf_jit_free(struct sk_filter *fp) 775void bpf_jit_free(struct sk_filter *fp)
750{ 776{
751 if (fp->bpf_func != sk_run_filter) { 777 if (fp->bpf_func != sk_run_filter) {
752 struct work_struct *work = (struct work_struct *)fp->bpf_func; 778 unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK;
779 struct bpf_binary_header *header = (void *)addr;
753 780
754 INIT_WORK(work, jit_free_defer); 781 set_memory_rw(addr, header->pages);
755 schedule_work(work); 782 module_free(NULL, header);
756 } 783 }
757} 784}
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
index e9e6ed5cdf94..a48be98e9ded 100644
--- a/arch/x86/pci/amd_bus.c
+++ b/arch/x86/pci/amd_bus.c
@@ -312,7 +312,7 @@ static int __init early_fill_mp_bus_info(void)
312 312
313#define ENABLE_CF8_EXT_CFG (1ULL << 46) 313#define ENABLE_CF8_EXT_CFG (1ULL << 46)
314 314
315static void __cpuinit enable_pci_io_ecs(void *unused) 315static void enable_pci_io_ecs(void *unused)
316{ 316{
317 u64 reg; 317 u64 reg;
318 rdmsrl(MSR_AMD64_NB_CFG, reg); 318 rdmsrl(MSR_AMD64_NB_CFG, reg);
@@ -322,8 +322,8 @@ static void __cpuinit enable_pci_io_ecs(void *unused)
322 } 322 }
323} 323}
324 324
325static int __cpuinit amd_cpu_notify(struct notifier_block *self, 325static int amd_cpu_notify(struct notifier_block *self, unsigned long action,
326 unsigned long action, void *hcpu) 326 void *hcpu)
327{ 327{
328 int cpu = (long)hcpu; 328 int cpu = (long)hcpu;
329 switch (action) { 329 switch (action) {
@@ -337,7 +337,7 @@ static int __cpuinit amd_cpu_notify(struct notifier_block *self,
337 return NOTIFY_OK; 337 return NOTIFY_OK;
338} 338}
339 339
340static struct notifier_block __cpuinitdata amd_cpu_notifier = { 340static struct notifier_block amd_cpu_notifier = {
341 .notifier_call = amd_cpu_notify, 341 .notifier_call = amd_cpu_notify,
342}; 342};
343 343
diff --git a/arch/x86/platform/ce4100/ce4100.c b/arch/x86/platform/ce4100/ce4100.c
index f8ab4945892e..643b8b5eee86 100644
--- a/arch/x86/platform/ce4100/ce4100.c
+++ b/arch/x86/platform/ce4100/ce4100.c
@@ -14,6 +14,7 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/serial_reg.h> 15#include <linux/serial_reg.h>
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/reboot.h>
17 18
18#include <asm/ce4100.h> 19#include <asm/ce4100.h>
19#include <asm/prom.h> 20#include <asm/prom.h>
@@ -134,7 +135,7 @@ static void __init sdv_arch_setup(void)
134} 135}
135 136
136#ifdef CONFIG_X86_IO_APIC 137#ifdef CONFIG_X86_IO_APIC
137static void __cpuinit sdv_pci_init(void) 138static void sdv_pci_init(void)
138{ 139{
139 x86_of_pci_init(); 140 x86_of_pci_init();
140 /* We can't set this earlier, because we need to calibrate the timer */ 141 /* We can't set this earlier, because we need to calibrate the timer */
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index b410b71bdcf7..90f6ed127096 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -274,8 +274,9 @@ static efi_status_t __init phys_efi_get_time(efi_time_t *tm,
274 return status; 274 return status;
275} 275}
276 276
277int efi_set_rtc_mmss(unsigned long nowtime) 277int efi_set_rtc_mmss(const struct timespec *now)
278{ 278{
279 unsigned long nowtime = now->tv_sec;
279 efi_status_t status; 280 efi_status_t status;
280 efi_time_t eft; 281 efi_time_t eft;
281 efi_time_cap_t cap; 282 efi_time_cap_t cap;
@@ -310,7 +311,7 @@ int efi_set_rtc_mmss(unsigned long nowtime)
310 return 0; 311 return 0;
311} 312}
312 313
313unsigned long efi_get_time(void) 314void efi_get_time(struct timespec *now)
314{ 315{
315 efi_status_t status; 316 efi_status_t status;
316 efi_time_t eft; 317 efi_time_t eft;
@@ -320,8 +321,9 @@ unsigned long efi_get_time(void)
320 if (status != EFI_SUCCESS) 321 if (status != EFI_SUCCESS)
321 pr_err("Oops: efitime: can't read time!\n"); 322 pr_err("Oops: efitime: can't read time!\n");
322 323
323 return mktime(eft.year, eft.month, eft.day, eft.hour, 324 now->tv_sec = mktime(eft.year, eft.month, eft.day, eft.hour,
324 eft.minute, eft.second); 325 eft.minute, eft.second);
326 now->tv_nsec = 0;
325} 327}
326 328
327/* 329/*
@@ -929,13 +931,6 @@ void __init efi_enter_virtual_mode(void)
929 va = efi_ioremap(md->phys_addr, size, 931 va = efi_ioremap(md->phys_addr, size,
930 md->type, md->attribute); 932 md->type, md->attribute);
931 933
932 if (!(md->attribute & EFI_MEMORY_RUNTIME)) {
933 if (!va)
934 pr_err("ioremap of 0x%llX failed!\n",
935 (unsigned long long)md->phys_addr);
936 continue;
937 }
938
939 md->virt_addr = (u64) (unsigned long) va; 934 md->virt_addr = (u64) (unsigned long) va;
940 935
941 if (!va) { 936 if (!va) {
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
index a0a0a4389bbd..47fe66fe61f1 100644
--- a/arch/x86/platform/mrst/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
@@ -65,7 +65,7 @@
65 * lapic (always-on,ARAT) ------ 150 65 * lapic (always-on,ARAT) ------ 150
66 */ 66 */
67 67
68__cpuinitdata enum mrst_timer_options mrst_timer_options; 68enum mrst_timer_options mrst_timer_options;
69 69
70static u32 sfi_mtimer_usage[SFI_MTMR_MAX_NUM]; 70static u32 sfi_mtimer_usage[SFI_MTMR_MAX_NUM];
71static struct sfi_timer_table_entry sfi_mtimer_array[SFI_MTMR_MAX_NUM]; 71static struct sfi_timer_table_entry sfi_mtimer_array[SFI_MTMR_MAX_NUM];
@@ -248,7 +248,7 @@ static void __init mrst_time_init(void)
248 apbt_time_init(); 248 apbt_time_init();
249} 249}
250 250
251static void __cpuinit mrst_arch_setup(void) 251static void mrst_arch_setup(void)
252{ 252{
253 if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x27) 253 if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x27)
254 __mrst_cpu_chip = MRST_CPU_CHIP_PENWELL; 254 __mrst_cpu_chip = MRST_CPU_CHIP_PENWELL;
diff --git a/arch/x86/platform/mrst/vrtc.c b/arch/x86/platform/mrst/vrtc.c
index d62b0a3b5c14..5e355b134ba4 100644
--- a/arch/x86/platform/mrst/vrtc.c
+++ b/arch/x86/platform/mrst/vrtc.c
@@ -56,7 +56,7 @@ void vrtc_cmos_write(unsigned char val, unsigned char reg)
56} 56}
57EXPORT_SYMBOL_GPL(vrtc_cmos_write); 57EXPORT_SYMBOL_GPL(vrtc_cmos_write);
58 58
59unsigned long vrtc_get_time(void) 59void vrtc_get_time(struct timespec *now)
60{ 60{
61 u8 sec, min, hour, mday, mon; 61 u8 sec, min, hour, mday, mon;
62 unsigned long flags; 62 unsigned long flags;
@@ -82,17 +82,18 @@ unsigned long vrtc_get_time(void)
82 printk(KERN_INFO "vRTC: sec: %d min: %d hour: %d day: %d " 82 printk(KERN_INFO "vRTC: sec: %d min: %d hour: %d day: %d "
83 "mon: %d year: %d\n", sec, min, hour, mday, mon, year); 83 "mon: %d year: %d\n", sec, min, hour, mday, mon, year);
84 84
85 return mktime(year, mon, mday, hour, min, sec); 85 now->tv_sec = mktime(year, mon, mday, hour, min, sec);
86 now->tv_nsec = 0;
86} 87}
87 88
88int vrtc_set_mmss(unsigned long nowtime) 89int vrtc_set_mmss(const struct timespec *now)
89{ 90{
90 unsigned long flags; 91 unsigned long flags;
91 struct rtc_time tm; 92 struct rtc_time tm;
92 int year; 93 int year;
93 int retval = 0; 94 int retval = 0;
94 95
95 rtc_time_to_tm(nowtime, &tm); 96 rtc_time_to_tm(now->tv_sec, &tm);
96 if (!rtc_valid_tm(&tm) && tm.tm_year >= 72) { 97 if (!rtc_valid_tm(&tm) && tm.tm_year >= 72) {
97 /* 98 /*
98 * tm.year is the number of years since 1900, and the 99 * tm.year is the number of years since 1900, and the
@@ -110,7 +111,7 @@ int vrtc_set_mmss(unsigned long nowtime)
110 } else { 111 } else {
111 printk(KERN_ERR 112 printk(KERN_ERR
112 "%s: Invalid vRTC value: write of %lx to vRTC failed\n", 113 "%s: Invalid vRTC value: write of %lx to vRTC failed\n",
113 __FUNCTION__, nowtime); 114 __FUNCTION__, now->tv_sec);
114 retval = -EINVAL; 115 retval = -EINVAL;
115 } 116 }
116 return retval; 117 return retval;
diff --git a/arch/x86/um/signal.c b/arch/x86/um/signal.c
index ae7319db18ee..5e04a1c899fa 100644
--- a/arch/x86/um/signal.c
+++ b/arch/x86/um/signal.c
@@ -508,7 +508,6 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
508{ 508{
509 struct rt_sigframe __user *frame; 509 struct rt_sigframe __user *frame;
510 int err = 0; 510 int err = 0;
511 struct task_struct *me = current;
512 511
513 frame = (struct rt_sigframe __user *) 512 frame = (struct rt_sigframe __user *)
514 round_down(stack_top - sizeof(struct rt_sigframe), 16); 513 round_down(stack_top - sizeof(struct rt_sigframe), 16);
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 2fa02bc50034..193097ef3d7d 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1681,8 +1681,8 @@ static void __init init_hvm_pv_info(void)
1681 xen_domain_type = XEN_HVM_DOMAIN; 1681 xen_domain_type = XEN_HVM_DOMAIN;
1682} 1682}
1683 1683
1684static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self, 1684static int xen_hvm_cpu_notify(struct notifier_block *self, unsigned long action,
1685 unsigned long action, void *hcpu) 1685 void *hcpu)
1686{ 1686{
1687 int cpu = (long)hcpu; 1687 int cpu = (long)hcpu;
1688 switch (action) { 1688 switch (action) {
@@ -1700,7 +1700,7 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self,
1700 return NOTIFY_OK; 1700 return NOTIFY_OK;
1701} 1701}
1702 1702
1703static struct notifier_block xen_hvm_cpu_notifier __cpuinitdata = { 1703static struct notifier_block xen_hvm_cpu_notifier = {
1704 .notifier_call = xen_hvm_cpu_notify, 1704 .notifier_call = xen_hvm_cpu_notify,
1705}; 1705};
1706 1706
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 94eac5c85cdc..056d11faef21 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -475,7 +475,7 @@ static void __init fiddle_vdso(void)
475#endif 475#endif
476} 476}
477 477
478static int __cpuinit register_callback(unsigned type, const void *func) 478static int register_callback(unsigned type, const void *func)
479{ 479{
480 struct callback_register callback = { 480 struct callback_register callback = {
481 .type = type, 481 .type = type,
@@ -486,7 +486,7 @@ static int __cpuinit register_callback(unsigned type, const void *func)
486 return HYPERVISOR_callback_op(CALLBACKOP_register, &callback); 486 return HYPERVISOR_callback_op(CALLBACKOP_register, &callback);
487} 487}
488 488
489void __cpuinit xen_enable_sysenter(void) 489void xen_enable_sysenter(void)
490{ 490{
491 int ret; 491 int ret;
492 unsigned sysenter_feature; 492 unsigned sysenter_feature;
@@ -505,7 +505,7 @@ void __cpuinit xen_enable_sysenter(void)
505 setup_clear_cpu_cap(sysenter_feature); 505 setup_clear_cpu_cap(sysenter_feature);
506} 506}
507 507
508void __cpuinit xen_enable_syscall(void) 508void xen_enable_syscall(void)
509{ 509{
510#ifdef CONFIG_X86_64 510#ifdef CONFIG_X86_64
511 int ret; 511 int ret;
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index c1367b29c3b1..ca92754eb846 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -65,7 +65,7 @@ static irqreturn_t xen_reschedule_interrupt(int irq, void *dev_id)
65 return IRQ_HANDLED; 65 return IRQ_HANDLED;
66} 66}
67 67
68static void __cpuinit cpu_bringup(void) 68static void cpu_bringup(void)
69{ 69{
70 int cpu; 70 int cpu;
71 71
@@ -97,7 +97,7 @@ static void __cpuinit cpu_bringup(void)
97 wmb(); /* make sure everything is out */ 97 wmb(); /* make sure everything is out */
98} 98}
99 99
100static void __cpuinit cpu_bringup_and_idle(void) 100static void cpu_bringup_and_idle(void)
101{ 101{
102 cpu_bringup(); 102 cpu_bringup();
103 cpu_startup_entry(CPUHP_ONLINE); 103 cpu_startup_entry(CPUHP_ONLINE);
@@ -326,7 +326,7 @@ static void __init xen_smp_prepare_cpus(unsigned int max_cpus)
326 set_cpu_present(cpu, true); 326 set_cpu_present(cpu, true);
327} 327}
328 328
329static int __cpuinit 329static int
330cpu_initialize_context(unsigned int cpu, struct task_struct *idle) 330cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
331{ 331{
332 struct vcpu_guest_context *ctxt; 332 struct vcpu_guest_context *ctxt;
@@ -397,7 +397,7 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
397 return 0; 397 return 0;
398} 398}
399 399
400static int __cpuinit xen_cpu_up(unsigned int cpu, struct task_struct *idle) 400static int xen_cpu_up(unsigned int cpu, struct task_struct *idle)
401{ 401{
402 int rc; 402 int rc;
403 403
@@ -470,7 +470,7 @@ static void xen_cpu_die(unsigned int cpu)
470 xen_teardown_timer(cpu); 470 xen_teardown_timer(cpu);
471} 471}
472 472
473static void __cpuinit xen_play_dead(void) /* used only with HOTPLUG_CPU */ 473static void xen_play_dead(void) /* used only with HOTPLUG_CPU */
474{ 474{
475 play_dead_common(); 475 play_dead_common();
476 HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL); 476 HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL);
@@ -691,7 +691,7 @@ static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus)
691 xen_init_lock_cpu(0); 691 xen_init_lock_cpu(0);
692} 692}
693 693
694static int __cpuinit xen_hvm_cpu_up(unsigned int cpu, struct task_struct *tidle) 694static int xen_hvm_cpu_up(unsigned int cpu, struct task_struct *tidle)
695{ 695{
696 int rc; 696 int rc;
697 rc = native_cpu_up(cpu, tidle); 697 rc = native_cpu_up(cpu, tidle);
diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index a40f8508e760..cf3caee356b3 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -361,7 +361,7 @@ static irqreturn_t dummy_handler(int irq, void *dev_id)
361 return IRQ_HANDLED; 361 return IRQ_HANDLED;
362} 362}
363 363
364void __cpuinit xen_init_lock_cpu(int cpu) 364void xen_init_lock_cpu(int cpu)
365{ 365{
366 int irq; 366 int irq;
367 char *name; 367 char *name;
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index a690868be837..ee365895b06b 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -15,6 +15,7 @@
15#include <linux/math64.h> 15#include <linux/math64.h>
16#include <linux/gfp.h> 16#include <linux/gfp.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/pvclock_gtod.h>
18 19
19#include <asm/pvclock.h> 20#include <asm/pvclock.h>
20#include <asm/xen/hypervisor.h> 21#include <asm/xen/hypervisor.h>
@@ -179,34 +180,56 @@ static void xen_read_wallclock(struct timespec *ts)
179 put_cpu_var(xen_vcpu); 180 put_cpu_var(xen_vcpu);
180} 181}
181 182
182static unsigned long xen_get_wallclock(void) 183static void xen_get_wallclock(struct timespec *now)
183{ 184{
184 struct timespec ts; 185 xen_read_wallclock(now);
186}
185 187
186 xen_read_wallclock(&ts); 188static int xen_set_wallclock(const struct timespec *now)
187 return ts.tv_sec; 189{
190 return -1;
188} 191}
189 192
190static int xen_set_wallclock(unsigned long now) 193static int xen_pvclock_gtod_notify(struct notifier_block *nb,
194 unsigned long was_set, void *priv)
191{ 195{
196 /* Protected by the calling core code serialization */
197 static struct timespec next_sync;
198
192 struct xen_platform_op op; 199 struct xen_platform_op op;
193 int rc; 200 struct timespec now;
194 201
195 /* do nothing for domU */ 202 now = __current_kernel_time();
196 if (!xen_initial_domain()) 203
197 return -1; 204 /*
205 * We only take the expensive HV call when the clock was set
206 * or when the 11 minutes RTC synchronization time elapsed.
207 */
208 if (!was_set && timespec_compare(&now, &next_sync) < 0)
209 return NOTIFY_OK;
198 210
199 op.cmd = XENPF_settime; 211 op.cmd = XENPF_settime;
200 op.u.settime.secs = now; 212 op.u.settime.secs = now.tv_sec;
201 op.u.settime.nsecs = 0; 213 op.u.settime.nsecs = now.tv_nsec;
202 op.u.settime.system_time = xen_clocksource_read(); 214 op.u.settime.system_time = xen_clocksource_read();
203 215
204 rc = HYPERVISOR_dom0_op(&op); 216 (void)HYPERVISOR_dom0_op(&op);
205 WARN(rc != 0, "XENPF_settime failed: now=%ld\n", now);
206 217
207 return rc; 218 /*
219 * Move the next drift compensation time 11 minutes
220 * ahead. That's emulating the sync_cmos_clock() update for
221 * the hardware RTC.
222 */
223 next_sync = now;
224 next_sync.tv_sec += 11 * 60;
225
226 return NOTIFY_OK;
208} 227}
209 228
229static struct notifier_block xen_pvclock_gtod_notifier = {
230 .notifier_call = xen_pvclock_gtod_notify,
231};
232
210static struct clocksource xen_clocksource __read_mostly = { 233static struct clocksource xen_clocksource __read_mostly = {
211 .name = "xen", 234 .name = "xen",
212 .rating = 400, 235 .rating = 400,
@@ -482,6 +505,9 @@ static void __init xen_time_init(void)
482 xen_setup_runstate_info(cpu); 505 xen_setup_runstate_info(cpu);
483 xen_setup_timer(cpu); 506 xen_setup_timer(cpu);
484 xen_setup_cpu_clockevents(); 507 xen_setup_cpu_clockevents();
508
509 if (xen_initial_domain())
510 pvclock_gtod_register_notifier(&xen_pvclock_gtod_notifier);
485} 511}
486 512
487void __init xen_init_time_ops(void) 513void __init xen_init_time_ops(void)
@@ -494,7 +520,9 @@ void __init xen_init_time_ops(void)
494 520
495 x86_platform.calibrate_tsc = xen_tsc_khz; 521 x86_platform.calibrate_tsc = xen_tsc_khz;
496 x86_platform.get_wallclock = xen_get_wallclock; 522 x86_platform.get_wallclock = xen_get_wallclock;
497 x86_platform.set_wallclock = xen_set_wallclock; 523 /* Dom0 uses the native method to set the hardware RTC. */
524 if (!xen_initial_domain())
525 x86_platform.set_wallclock = xen_set_wallclock;
498} 526}
499 527
500#ifdef CONFIG_XEN_PVHVM 528#ifdef CONFIG_XEN_PVHVM
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index a95b41744ad0..86782c5d7e2a 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -73,7 +73,7 @@ static inline void xen_hvm_smp_init(void) {}
73 73
74#ifdef CONFIG_PARAVIRT_SPINLOCKS 74#ifdef CONFIG_PARAVIRT_SPINLOCKS
75void __init xen_init_spinlocks(void); 75void __init xen_init_spinlocks(void);
76void __cpuinit xen_init_lock_cpu(int cpu); 76void xen_init_lock_cpu(int cpu);
77void xen_uninit_lock_cpu(int cpu); 77void xen_uninit_lock_cpu(int cpu);
78#else 78#else
79static inline void xen_init_spinlocks(void) 79static inline void xen_init_spinlocks(void)
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 0a1b95f81a32..7ea6451a3a33 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -6,10 +6,12 @@ config XTENSA
6 select ARCH_WANT_FRAME_POINTERS 6 select ARCH_WANT_FRAME_POINTERS
7 select HAVE_IDE 7 select HAVE_IDE
8 select GENERIC_ATOMIC64 8 select GENERIC_ATOMIC64
9 select GENERIC_CLOCKEVENTS
9 select HAVE_GENERIC_HARDIRQS 10 select HAVE_GENERIC_HARDIRQS
10 select VIRT_TO_BUS 11 select VIRT_TO_BUS
11 select GENERIC_IRQ_SHOW 12 select GENERIC_IRQ_SHOW
12 select GENERIC_CPU_DEVICES 13 select GENERIC_CPU_DEVICES
14 select GENERIC_SCHED_CLOCK
13 select MODULES_USE_ELF_RELA 15 select MODULES_USE_ELF_RELA
14 select GENERIC_PCI_IOMAP 16 select GENERIC_PCI_IOMAP
15 select ARCH_WANT_IPC_PARSE_VERSION 17 select ARCH_WANT_IPC_PARSE_VERSION
@@ -17,6 +19,7 @@ config XTENSA
17 select CLONE_BACKWARDS 19 select CLONE_BACKWARDS
18 select IRQ_DOMAIN 20 select IRQ_DOMAIN
19 select HAVE_OPROFILE 21 select HAVE_OPROFILE
22 select HAVE_FUNCTION_TRACER
20 help 23 help
21 Xtensa processors are 32-bit RISC machines designed by Tensilica 24 Xtensa processors are 32-bit RISC machines designed by Tensilica
22 primarily for embedded systems. These processors are both 25 primarily for embedded systems. These processors are both
diff --git a/arch/xtensa/Kconfig.debug b/arch/xtensa/Kconfig.debug
index a34010e0e51c..af7da74d535f 100644
--- a/arch/xtensa/Kconfig.debug
+++ b/arch/xtensa/Kconfig.debug
@@ -2,6 +2,16 @@ menu "Kernel hacking"
2 2
3source "lib/Kconfig.debug" 3source "lib/Kconfig.debug"
4 4
5config DEBUG_TLB_SANITY
6 bool "Debug TLB sanity"
7 depends on DEBUG_KERNEL
8 help
9 Enable this to turn on TLB sanity check on each entry to userspace.
10 This check can spot missing TLB invalidation/wrong PTE permissions/
11 premature page freeing.
12
13 If unsure, say N.
14
5config LD_NO_RELAX 15config LD_NO_RELAX
6 bool "Disable linker relaxation" 16 bool "Disable linker relaxation"
7 default n 17 default n
diff --git a/arch/xtensa/boot/.gitignore b/arch/xtensa/boot/.gitignore
new file mode 100644
index 000000000000..be7655998b26
--- /dev/null
+++ b/arch/xtensa/boot/.gitignore
@@ -0,0 +1,3 @@
1uImage
2zImage.redboot
3*.dtb
diff --git a/arch/xtensa/boot/boot-elf/.gitignore b/arch/xtensa/boot/boot-elf/.gitignore
new file mode 100644
index 000000000000..5ff8fbb8561b
--- /dev/null
+++ b/arch/xtensa/boot/boot-elf/.gitignore
@@ -0,0 +1 @@
boot.lds
diff --git a/arch/xtensa/boot/lib/.gitignore b/arch/xtensa/boot/lib/.gitignore
new file mode 100644
index 000000000000..1629a6167755
--- /dev/null
+++ b/arch/xtensa/boot/lib/.gitignore
@@ -0,0 +1,3 @@
1inffast.c
2inflate.c
3inftrees.c
diff --git a/arch/xtensa/boot/lib/Makefile b/arch/xtensa/boot/lib/Makefile
index ad8952e8a07f..6868f2ca6af8 100644
--- a/arch/xtensa/boot/lib/Makefile
+++ b/arch/xtensa/boot/lib/Makefile
@@ -7,6 +7,13 @@ zlib := inffast.c inflate.c inftrees.c
7lib-y += $(zlib:.c=.o) zmem.o 7lib-y += $(zlib:.c=.o) zmem.o
8 8
9ccflags-y := -Ilib/zlib_inflate 9ccflags-y := -Ilib/zlib_inflate
10ifdef CONFIG_FUNCTION_TRACER
11CFLAGS_REMOVE_inflate.o = -pg
12CFLAGS_REMOVE_zmem.o = -pg
13CFLAGS_REMOVE_inftrees.o = -pg
14CFLAGS_REMOVE_inffast.o = -pg
15endif
16
10 17
11quiet_cmd_copy_zlib = COPY $@ 18quiet_cmd_copy_zlib = COPY $@
12 cmd_copy_zlib = cat $< > $@ 19 cmd_copy_zlib = cat $< > $@
diff --git a/arch/xtensa/include/asm/bootparam.h b/arch/xtensa/include/asm/bootparam.h
index 0c25799facab..23392c5630ce 100644
--- a/arch/xtensa/include/asm/bootparam.h
+++ b/arch/xtensa/include/asm/bootparam.h
@@ -20,7 +20,7 @@
20#define BP_TAG_COMMAND_LINE 0x1001 /* command line (0-terminated string)*/ 20#define BP_TAG_COMMAND_LINE 0x1001 /* command line (0-terminated string)*/
21#define BP_TAG_INITRD 0x1002 /* ramdisk addr and size (bp_meminfo) */ 21#define BP_TAG_INITRD 0x1002 /* ramdisk addr and size (bp_meminfo) */
22#define BP_TAG_MEMORY 0x1003 /* memory addr and size (bp_meminfo) */ 22#define BP_TAG_MEMORY 0x1003 /* memory addr and size (bp_meminfo) */
23#define BP_TAG_SERIAL_BAUSRATE 0x1004 /* baud rate of current console. */ 23#define BP_TAG_SERIAL_BAUDRATE 0x1004 /* baud rate of current console. */
24#define BP_TAG_SERIAL_PORT 0x1005 /* serial device of current console */ 24#define BP_TAG_SERIAL_PORT 0x1005 /* serial device of current console */
25#define BP_TAG_FDT 0x1006 /* flat device tree addr */ 25#define BP_TAG_FDT 0x1006 /* flat device tree addr */
26 26
diff --git a/arch/xtensa/include/asm/cmpxchg.h b/arch/xtensa/include/asm/cmpxchg.h
index d9ab131bc1aa..370b26f38414 100644
--- a/arch/xtensa/include/asm/cmpxchg.h
+++ b/arch/xtensa/include/asm/cmpxchg.h
@@ -93,6 +93,7 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
93 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ 93 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
94 (unsigned long)(n), sizeof(*(ptr)))) 94 (unsigned long)(n), sizeof(*(ptr))))
95#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) 95#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
96#define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n))
96 97
97/* 98/*
98 * xchg_u32 99 * xchg_u32
diff --git a/arch/xtensa/include/asm/delay.h b/arch/xtensa/include/asm/delay.h
index 61fc5faeb46c..3899610c1dff 100644
--- a/arch/xtensa/include/asm/delay.h
+++ b/arch/xtensa/include/asm/delay.h
@@ -12,7 +12,7 @@
12#ifndef _XTENSA_DELAY_H 12#ifndef _XTENSA_DELAY_H
13#define _XTENSA_DELAY_H 13#define _XTENSA_DELAY_H
14 14
15#include <asm/processor.h> 15#include <asm/timex.h>
16#include <asm/param.h> 16#include <asm/param.h>
17 17
18extern unsigned long loops_per_jiffy; 18extern unsigned long loops_per_jiffy;
@@ -24,24 +24,17 @@ static inline void __delay(unsigned long loops)
24 : "=r" (loops) : "0" (loops)); 24 : "=r" (loops) : "0" (loops));
25} 25}
26 26
27static __inline__ u32 xtensa_get_ccount(void)
28{
29 u32 ccount;
30 asm volatile ("rsr %0, ccount\n" : "=r" (ccount));
31 return ccount;
32}
33
34/* For SMP/NUMA systems, change boot_cpu_data to something like 27/* For SMP/NUMA systems, change boot_cpu_data to something like
35 * local_cpu_data->... where local_cpu_data points to the current 28 * local_cpu_data->... where local_cpu_data points to the current
36 * cpu. */ 29 * cpu. */
37 30
38static __inline__ void udelay (unsigned long usecs) 31static __inline__ void udelay (unsigned long usecs)
39{ 32{
40 unsigned long start = xtensa_get_ccount(); 33 unsigned long start = get_ccount();
41 unsigned long cycles = usecs * (loops_per_jiffy / (1000000UL / HZ)); 34 unsigned long cycles = usecs * (loops_per_jiffy / (1000000UL / HZ));
42 35
43 /* Note: all variables are unsigned (can wrap around)! */ 36 /* Note: all variables are unsigned (can wrap around)! */
44 while (((unsigned long)xtensa_get_ccount()) - start < cycles) 37 while (((unsigned long)get_ccount()) - start < cycles)
45 ; 38 ;
46} 39}
47 40
diff --git a/arch/xtensa/include/asm/ftrace.h b/arch/xtensa/include/asm/ftrace.h
index 36dc7a684397..73cc3f482304 100644
--- a/arch/xtensa/include/asm/ftrace.h
+++ b/arch/xtensa/include/asm/ftrace.h
@@ -13,6 +13,7 @@
13#include <asm/processor.h> 13#include <asm/processor.h>
14 14
15#define HAVE_ARCH_CALLER_ADDR 15#define HAVE_ARCH_CALLER_ADDR
16#ifndef __ASSEMBLY__
16#define CALLER_ADDR0 ({ unsigned long a0, a1; \ 17#define CALLER_ADDR0 ({ unsigned long a0, a1; \
17 __asm__ __volatile__ ( \ 18 __asm__ __volatile__ ( \
18 "mov %0, a0\n" \ 19 "mov %0, a0\n" \
@@ -24,10 +25,22 @@ extern unsigned long return_address(unsigned level);
24#define CALLER_ADDR1 return_address(1) 25#define CALLER_ADDR1 return_address(1)
25#define CALLER_ADDR2 return_address(2) 26#define CALLER_ADDR2 return_address(2)
26#define CALLER_ADDR3 return_address(3) 27#define CALLER_ADDR3 return_address(3)
27#else 28#else /* CONFIG_FRAME_POINTER */
28#define CALLER_ADDR1 (0) 29#define CALLER_ADDR1 (0)
29#define CALLER_ADDR2 (0) 30#define CALLER_ADDR2 (0)
30#define CALLER_ADDR3 (0) 31#define CALLER_ADDR3 (0)
31#endif 32#endif /* CONFIG_FRAME_POINTER */
33#endif /* __ASSEMBLY__ */
34
35#ifdef CONFIG_FUNCTION_TRACER
36
37#define MCOUNT_ADDR ((unsigned long)(_mcount))
38#define MCOUNT_INSN_SIZE 3
39
40#ifndef __ASSEMBLY__
41extern void _mcount(void);
42#define mcount _mcount
43#endif /* __ASSEMBLY__ */
44#endif /* CONFIG_FUNCTION_TRACER */
32 45
33#endif /* _XTENSA_FTRACE_H */ 46#endif /* _XTENSA_FTRACE_H */
diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h
index 8f017eb309bd..0fdf5d043f82 100644
--- a/arch/xtensa/include/asm/pgtable.h
+++ b/arch/xtensa/include/asm/pgtable.h
@@ -5,7 +5,7 @@
5 * it under the terms of the GNU General Public License version 2 as 5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 * 7 *
8 * Copyright (C) 2001 - 2007 Tensilica Inc. 8 * Copyright (C) 2001 - 2013 Tensilica Inc.
9 */ 9 */
10 10
11#ifndef _XTENSA_PGTABLE_H 11#ifndef _XTENSA_PGTABLE_H
@@ -64,41 +64,82 @@
64 * Virtual memory area. We keep a distance to other memory regions to be 64 * Virtual memory area. We keep a distance to other memory regions to be
65 * on the safe side. We also use this area for cache aliasing. 65 * on the safe side. We also use this area for cache aliasing.
66 */ 66 */
67
68#define VMALLOC_START 0xC0000000 67#define VMALLOC_START 0xC0000000
69#define VMALLOC_END 0xC7FEFFFF 68#define VMALLOC_END 0xC7FEFFFF
70#define TLBTEMP_BASE_1 0xC7FF0000 69#define TLBTEMP_BASE_1 0xC7FF0000
71#define TLBTEMP_BASE_2 0xC7FF8000 70#define TLBTEMP_BASE_2 0xC7FF8000
72 71
73/* 72/*
74 * Xtensa Linux config PTE layout (when present): 73 * For the Xtensa architecture, the PTE layout is as follows:
75 * 31-12: PPN 74 *
76 * 11-6: Software 75 * 31------12 11 10-9 8-6 5-4 3-2 1-0
77 * 5-4: RING 76 * +-----------------------------------------+
78 * 3-0: CA 77 * | | Software | HARDWARE |
78 * | PPN | ADW | RI |Attribute|
79 * +-----------------------------------------+
80 * pte_none | MBZ | 01 | 11 | 00 |
81 * +-----------------------------------------+
82 * present | PPN | 0 | 00 | ADW | RI | CA | wx |
83 * +- - - - - - - - - - - - - - - - - - - - -+
84 * (PAGE_NONE)| PPN | 0 | 00 | ADW | 01 | 11 | 11 |
85 * +-----------------------------------------+
86 * swap | index | type | 01 | 11 | 00 |
87 * +- - - - - - - - - - - - - - - - - - - - -+
88 * file | file offset | 01 | 11 | 10 |
89 * +-----------------------------------------+
90 *
91 * For T1050 hardware and earlier the layout differs for present and (PAGE_NONE)
92 * +-----------------------------------------+
93 * present | PPN | 0 | 00 | ADW | RI | CA | w1 |
94 * +-----------------------------------------+
95 * (PAGE_NONE)| PPN | 0 | 00 | ADW | 01 | 01 | 00 |
96 * +-----------------------------------------+
79 * 97 *
80 * Similar to the Alpha and MIPS ports, we need to keep track of the ref 98 * Legend:
81 * and mod bits in software. We have a software "you can read 99 * PPN Physical Page Number
82 * from this page" bit, and a hardware one which actually lets the 100 * ADW software: accessed (young) / dirty / writable
83 * process read from the page. On the same token we have a software 101 * RI ring (0=privileged, 1=user, 2 and 3 are unused)
84 * writable bit and the real hardware one which actually lets the 102 * CA cache attribute: 00 bypass, 01 writeback, 10 writethrough
85 * process write to the page. 103 * (11 is invalid and used to mark pages that are not present)
104 * w page is writable (hw)
105 * x page is executable (hw)
106 * index swap offset / PAGE_SIZE (bit 11-31: 21 bits -> 8 GB)
107 * (note that the index is always non-zero)
108 * type swap type (5 bits -> 32 types)
109 * file offset 26-bit offset into the file, in increments of PAGE_SIZE
86 * 110 *
87 * See further below for PTE layout for swapped-out pages. 111 * Notes:
112 * - (PROT_NONE) is a special case of 'present' but causes an exception for
113 * any access (read, write, and execute).
114 * - 'multihit-exception' has the highest priority of all MMU exceptions,
115 * so the ring must be set to 'RING_USER' even for 'non-present' pages.
116 * - on older hardware, the exectuable flag was not supported and
117 * used as a 'valid' flag, so it needs to be always set.
118 * - we need to keep track of certain flags in software (dirty and young)
119 * to do this, we use write exceptions and have a separate software w-flag.
120 * - attribute value 1101 (and 1111 on T1050 and earlier) is reserved
88 */ 121 */
89 122
123#define _PAGE_ATTRIB_MASK 0xf
124
90#define _PAGE_HW_EXEC (1<<0) /* hardware: page is executable */ 125#define _PAGE_HW_EXEC (1<<0) /* hardware: page is executable */
91#define _PAGE_HW_WRITE (1<<1) /* hardware: page is writable */ 126#define _PAGE_HW_WRITE (1<<1) /* hardware: page is writable */
92 127
93#define _PAGE_FILE (1<<1) /* non-linear mapping, if !present */
94#define _PAGE_PROTNONE (3<<0) /* special case for VM_PROT_NONE */
95
96/* None of these cache modes include MP coherency: */
97#define _PAGE_CA_BYPASS (0<<2) /* bypass, non-speculative */ 128#define _PAGE_CA_BYPASS (0<<2) /* bypass, non-speculative */
98#define _PAGE_CA_WB (1<<2) /* write-back */ 129#define _PAGE_CA_WB (1<<2) /* write-back */
99#define _PAGE_CA_WT (2<<2) /* write-through */ 130#define _PAGE_CA_WT (2<<2) /* write-through */
100#define _PAGE_CA_MASK (3<<2) 131#define _PAGE_CA_MASK (3<<2)
101#define _PAGE_INVALID (3<<2) 132#define _PAGE_CA_INVALID (3<<2)
133
134/* We use invalid attribute values to distinguish special pte entries */
135#if XCHAL_HW_VERSION_MAJOR < 2000
136#define _PAGE_HW_VALID 0x01 /* older HW needed this bit set */
137#define _PAGE_NONE 0x04
138#else
139#define _PAGE_HW_VALID 0x00
140#define _PAGE_NONE 0x0f
141#endif
142#define _PAGE_FILE (1<<1) /* file mapped page, only if !present */
102 143
103#define _PAGE_USER (1<<4) /* user access (ring=1) */ 144#define _PAGE_USER (1<<4) /* user access (ring=1) */
104 145
@@ -108,19 +149,12 @@
108#define _PAGE_DIRTY (1<<7) /* software: page dirty */ 149#define _PAGE_DIRTY (1<<7) /* software: page dirty */
109#define _PAGE_ACCESSED (1<<8) /* software: page accessed (read) */ 150#define _PAGE_ACCESSED (1<<8) /* software: page accessed (read) */
110 151
111/* On older HW revisions, we always have to set bit 0 */
112#if XCHAL_HW_VERSION_MAJOR < 2000
113# define _PAGE_VALID (1<<0)
114#else
115# define _PAGE_VALID 0
116#endif
117
118#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
119#define _PAGE_PRESENT (_PAGE_VALID | _PAGE_CA_WB | _PAGE_ACCESSED)
120
121#ifdef CONFIG_MMU 152#ifdef CONFIG_MMU
122 153
123#define PAGE_NONE __pgprot(_PAGE_INVALID | _PAGE_USER | _PAGE_PROTNONE) 154#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
155#define _PAGE_PRESENT (_PAGE_HW_VALID | _PAGE_CA_WB | _PAGE_ACCESSED)
156
157#define PAGE_NONE __pgprot(_PAGE_NONE | _PAGE_USER)
124#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER) 158#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER)
125#define PAGE_COPY_EXEC __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_HW_EXEC) 159#define PAGE_COPY_EXEC __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_HW_EXEC)
126#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER) 160#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER)
@@ -132,9 +166,9 @@
132#define PAGE_KERNEL_EXEC __pgprot(_PAGE_PRESENT|_PAGE_HW_WRITE|_PAGE_HW_EXEC) 166#define PAGE_KERNEL_EXEC __pgprot(_PAGE_PRESENT|_PAGE_HW_WRITE|_PAGE_HW_EXEC)
133 167
134#if (DCACHE_WAY_SIZE > PAGE_SIZE) 168#if (DCACHE_WAY_SIZE > PAGE_SIZE)
135# define _PAGE_DIRECTORY (_PAGE_VALID | _PAGE_ACCESSED) 169# define _PAGE_DIRECTORY (_PAGE_HW_VALID | _PAGE_ACCESSED | _PAGE_CA_BYPASS)
136#else 170#else
137# define _PAGE_DIRECTORY (_PAGE_VALID | _PAGE_ACCESSED | _PAGE_CA_WB) 171# define _PAGE_DIRECTORY (_PAGE_HW_VALID | _PAGE_ACCESSED | _PAGE_CA_WB)
138#endif 172#endif
139 173
140#else /* no mmu */ 174#else /* no mmu */
@@ -202,12 +236,16 @@ static inline void pgtable_cache_init(void) { }
202/* 236/*
203 * pte status. 237 * pte status.
204 */ 238 */
205#define pte_none(pte) (pte_val(pte) == _PAGE_INVALID) 239# define pte_none(pte) (pte_val(pte) == (_PAGE_CA_INVALID | _PAGE_USER))
206#define pte_present(pte) \ 240#if XCHAL_HW_VERSION_MAJOR < 2000
207 (((pte_val(pte) & _PAGE_CA_MASK) != _PAGE_INVALID) \ 241# define pte_present(pte) ((pte_val(pte) & _PAGE_CA_MASK) != _PAGE_CA_INVALID)
208 || ((pte_val(pte) & _PAGE_PROTNONE) == _PAGE_PROTNONE)) 242#else
243# define pte_present(pte) \
244 (((pte_val(pte) & _PAGE_CA_MASK) != _PAGE_CA_INVALID) \
245 || ((pte_val(pte) & _PAGE_ATTRIB_MASK) == _PAGE_NONE))
246#endif
209#define pte_clear(mm,addr,ptep) \ 247#define pte_clear(mm,addr,ptep) \
210 do { update_pte(ptep, __pte(_PAGE_INVALID)); } while(0) 248 do { update_pte(ptep, __pte(_PAGE_CA_INVALID | _PAGE_USER)); } while (0)
211 249
212#define pmd_none(pmd) (!pmd_val(pmd)) 250#define pmd_none(pmd) (!pmd_val(pmd))
213#define pmd_present(pmd) (pmd_val(pmd) & PAGE_MASK) 251#define pmd_present(pmd) (pmd_val(pmd) & PAGE_MASK)
@@ -328,35 +366,23 @@ ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
328 366
329 367
330/* 368/*
331 * Encode and decode a swap entry. 369 * Encode and decode a swap and file entry.
332 *
333 * Format of swap pte:
334 * bit 0 MBZ
335 * bit 1 page-file (must be zero)
336 * bits 2 - 3 page hw access mode (must be 11: _PAGE_INVALID)
337 * bits 4 - 5 ring protection (must be 01: _PAGE_USER)
338 * bits 6 - 10 swap type (5 bits -> 32 types)
339 * bits 11 - 31 swap offset / PAGE_SIZE (21 bits -> 8GB)
340
341 * Format of file pte:
342 * bit 0 MBZ
343 * bit 1 page-file (must be one: _PAGE_FILE)
344 * bits 2 - 3 page hw access mode (must be 11: _PAGE_INVALID)
345 * bits 4 - 5 ring protection (must be 01: _PAGE_USER)
346 * bits 6 - 31 file offset / PAGE_SIZE
347 */ 370 */
371#define SWP_TYPE_BITS 5
372#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > SWP_TYPE_BITS)
348 373
349#define __swp_type(entry) (((entry).val >> 6) & 0x1f) 374#define __swp_type(entry) (((entry).val >> 6) & 0x1f)
350#define __swp_offset(entry) ((entry).val >> 11) 375#define __swp_offset(entry) ((entry).val >> 11)
351#define __swp_entry(type,offs) \ 376#define __swp_entry(type,offs) \
352 ((swp_entry_t) {((type) << 6) | ((offs) << 11) | _PAGE_INVALID}) 377 ((swp_entry_t){((type) << 6) | ((offs) << 11) | \
378 _PAGE_CA_INVALID | _PAGE_USER})
353#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 379#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
354#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 380#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
355 381
356#define PTE_FILE_MAX_BITS 28 382#define PTE_FILE_MAX_BITS 26
357#define pte_to_pgoff(pte) (pte_val(pte) >> 4) 383#define pte_to_pgoff(pte) (pte_val(pte) >> 6)
358#define pgoff_to_pte(off) \ 384#define pgoff_to_pte(off) \
359 ((pte_t) { ((off) << 4) | _PAGE_INVALID | _PAGE_FILE }) 385 ((pte_t) { ((off) << 6) | _PAGE_CA_INVALID | _PAGE_FILE | _PAGE_USER })
360 386
361#endif /* !defined (__ASSEMBLY__) */ 387#endif /* !defined (__ASSEMBLY__) */
362 388
diff --git a/arch/xtensa/include/asm/platform.h b/arch/xtensa/include/asm/platform.h
index ec098b68fb9a..32e98f27ce97 100644
--- a/arch/xtensa/include/asm/platform.h
+++ b/arch/xtensa/include/asm/platform.h
@@ -30,11 +30,6 @@ extern void platform_init(bp_tag_t*);
30extern void platform_setup (char **); 30extern void platform_setup (char **);
31 31
32/* 32/*
33 * platform_init_irq is called from init_IRQ.
34 */
35extern void platform_init_irq (void);
36
37/*
38 * platform_restart is called to restart the system. 33 * platform_restart is called to restart the system.
39 */ 34 */
40extern void platform_restart (void); 35extern void platform_restart (void);
diff --git a/arch/xtensa/include/asm/timex.h b/arch/xtensa/include/asm/timex.h
index 3d35e5d0367e..69f901713fb6 100644
--- a/arch/xtensa/include/asm/timex.h
+++ b/arch/xtensa/include/asm/timex.h
@@ -35,19 +35,11 @@
35# error "Bad timer number for Linux configurations!" 35# error "Bad timer number for Linux configurations!"
36#endif 36#endif
37 37
38#define LINUX_TIMER_MASK (1L << LINUX_TIMER_INT)
39
40#define CLOCK_TICK_RATE 1193180 /* (everyone is using this value) */
41#define CLOCK_TICK_FACTOR 20 /* Factor of both 10^6 and CLOCK_TICK_RATE */
42
43#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT 38#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
44extern unsigned long ccount_per_jiffy; 39extern unsigned long ccount_freq;
45extern unsigned long nsec_per_ccount; 40#define CCOUNT_PER_JIFFY (ccount_freq / HZ)
46#define CCOUNT_PER_JIFFY ccount_per_jiffy
47#define NSEC_PER_CCOUNT nsec_per_ccount
48#else 41#else
49#define CCOUNT_PER_JIFFY (CONFIG_XTENSA_CPU_CLOCK*(1000000UL/HZ)) 42#define CCOUNT_PER_JIFFY (CONFIG_XTENSA_CPU_CLOCK*(1000000UL/HZ))
50#define NSEC_PER_CCOUNT (1000UL / CONFIG_XTENSA_CPU_CLOCK)
51#endif 43#endif
52 44
53 45
diff --git a/arch/xtensa/include/uapi/asm/socket.h b/arch/xtensa/include/uapi/asm/socket.h
index a8f44f50e651..c114483010c1 100644
--- a/arch/xtensa/include/uapi/asm/socket.h
+++ b/arch/xtensa/include/uapi/asm/socket.h
@@ -85,4 +85,6 @@
85 85
86#define SO_SELECT_ERR_QUEUE 45 86#define SO_SELECT_ERR_QUEUE 45
87 87
88#define SO_BUSY_POLL 46
89
88#endif /* _XTENSA_SOCKET_H */ 90#endif /* _XTENSA_SOCKET_H */
diff --git a/arch/xtensa/kernel/.gitignore b/arch/xtensa/kernel/.gitignore
new file mode 100644
index 000000000000..c5f676c3c224
--- /dev/null
+++ b/arch/xtensa/kernel/.gitignore
@@ -0,0 +1 @@
vmlinux.lds
diff --git a/arch/xtensa/kernel/Makefile b/arch/xtensa/kernel/Makefile
index 1e7fc87a94bb..f90265ec1ccc 100644
--- a/arch/xtensa/kernel/Makefile
+++ b/arch/xtensa/kernel/Makefile
@@ -11,6 +11,7 @@ obj-y := align.o coprocessor.o entry.o irq.o pci-dma.o platform.o process.o \
11obj-$(CONFIG_KGDB) += xtensa-stub.o 11obj-$(CONFIG_KGDB) += xtensa-stub.o
12obj-$(CONFIG_PCI) += pci.o 12obj-$(CONFIG_PCI) += pci.o
13obj-$(CONFIG_MODULES) += xtensa_ksyms.o module.o 13obj-$(CONFIG_MODULES) += xtensa_ksyms.o module.o
14obj-$(CONFIG_FUNCTION_TRACER) += mcount.o
14 15
15AFLAGS_head.o += -mtext-section-literals 16AFLAGS_head.o += -mtext-section-literals
16 17
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index 5082507d5631..9298742f0fd0 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -458,7 +458,7 @@ common_exception_return:
458 458
459 _bbsi.l a4, TIF_NEED_RESCHED, 3f 459 _bbsi.l a4, TIF_NEED_RESCHED, 3f
460 _bbsi.l a4, TIF_NOTIFY_RESUME, 2f 460 _bbsi.l a4, TIF_NOTIFY_RESUME, 2f
461 _bbci.l a4, TIF_SIGPENDING, 4f 461 _bbci.l a4, TIF_SIGPENDING, 5f
462 462
4632: l32i a4, a1, PT_DEPC 4632: l32i a4, a1, PT_DEPC
464 bgeui a4, VALID_DOUBLE_EXCEPTION_ADDRESS, 4f 464 bgeui a4, VALID_DOUBLE_EXCEPTION_ADDRESS, 4f
@@ -476,6 +476,13 @@ common_exception_return:
476 callx4 a4 476 callx4 a4
477 j 1b 477 j 1b
478 478
4795:
480#ifdef CONFIG_DEBUG_TLB_SANITY
481 l32i a4, a1, PT_DEPC
482 bgeui a4, VALID_DOUBLE_EXCEPTION_ADDRESS, 4f
483 movi a4, check_tlb_sanity
484 callx4 a4
485#endif
4794: /* Restore optional registers. */ 4864: /* Restore optional registers. */
480 487
481 load_xtregs_opt a1 a2 a4 a5 a6 a7 PT_XTREGS_OPT 488 load_xtregs_opt a1 a2 a4 a5 a6 a7 PT_XTREGS_OPT
@@ -1792,10 +1799,15 @@ ENTRY(fast_store_prohibited)
1792 l32i a0, a0, 0 1799 l32i a0, a0, 0
1793 beqz a0, 2f 1800 beqz a0, 2f
1794 1801
1795 /* Note that we assume _PAGE_WRITABLE_BIT is only set if pte is valid.*/ 1802 /*
1803 * Note that we test _PAGE_WRITABLE_BIT only if PTE is present
1804 * and is not PAGE_NONE. See pgtable.h for possible PTE layouts.
1805 */
1796 1806
1797 _PTE_OFFSET(a0, a1, a4) 1807 _PTE_OFFSET(a0, a1, a4)
1798 l32i a4, a0, 0 # read pteval 1808 l32i a4, a0, 0 # read pteval
1809 movi a1, _PAGE_CA_INVALID
1810 ball a4, a1, 2f
1799 bbci.l a4, _PAGE_WRITABLE_BIT, 2f 1811 bbci.l a4, _PAGE_WRITABLE_BIT, 2f
1800 1812
1801 movi a1, _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_HW_WRITE 1813 movi a1, _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_HW_WRITE
diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S
index ef12c0e6fa25..7d740ebbe198 100644
--- a/arch/xtensa/kernel/head.S
+++ b/arch/xtensa/kernel/head.S
@@ -68,6 +68,15 @@ _SetupMMU:
68 68
69#ifdef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX 69#ifdef CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
70 initialize_mmu 70 initialize_mmu
71#if defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
72 rsr a2, excsave1
73 movi a3, 0x08000000
74 bgeu a2, a3, 1f
75 movi a3, 0xd0000000
76 add a2, a2, a3
77 wsr a2, excsave1
781:
79#endif
71#endif 80#endif
72 .end no-absolute-literals 81 .end no-absolute-literals
73 82
diff --git a/arch/xtensa/kernel/mcount.S b/arch/xtensa/kernel/mcount.S
new file mode 100644
index 000000000000..0eeda2e4a25e
--- /dev/null
+++ b/arch/xtensa/kernel/mcount.S
@@ -0,0 +1,50 @@
1/*
2 * arch/xtensa/kernel/mcount.S
3 *
4 * Xtensa specific mcount support
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (C) 2013 Tensilica Inc.
11 */
12
13#include <linux/linkage.h>
14#include <asm/ftrace.h>
15
16/*
17 * Entry condition:
18 *
19 * a2: a0 of the caller
20 */
21
22ENTRY(_mcount)
23
24 entry a1, 16
25
26 movi a4, ftrace_trace_function
27 l32i a4, a4, 0
28 movi a3, ftrace_stub
29 bne a3, a4, 1f
30 retw
31
321: xor a7, a2, a1
33 movi a3, 0x3fffffff
34 and a7, a7, a3
35 xor a7, a7, a1
36
37 xor a6, a0, a1
38 and a6, a6, a3
39 xor a6, a6, a1
40 addi a6, a6, -MCOUNT_INSN_SIZE
41 callx4 a4
42
43 retw
44
45ENDPROC(_mcount)
46
47ENTRY(ftrace_stub)
48 entry a1, 16
49 retw
50ENDPROC(ftrace_stub)
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c
index 126c18839409..5b3403388d7f 100644
--- a/arch/xtensa/kernel/pci.c
+++ b/arch/xtensa/kernel/pci.c
@@ -77,9 +77,9 @@ pcibios_align_resource(void *data, const struct resource *res,
77 77
78 if (res->flags & IORESOURCE_IO) { 78 if (res->flags & IORESOURCE_IO) {
79 if (size > 0x100) { 79 if (size > 0x100) {
80 printk(KERN_ERR "PCI: I/O Region %s/%d too large" 80 pr_err("PCI: I/O Region %s/%d too large (%u bytes)\n",
81 " (%ld bytes)\n", pci_name(dev), 81 pci_name(dev), dev->resource - res,
82 dev->resource - res, size); 82 size);
83 } 83 }
84 84
85 if (start & 0x300) 85 if (start & 0x300)
@@ -174,7 +174,7 @@ static int __init pcibios_init(void)
174 struct pci_controller *pci_ctrl; 174 struct pci_controller *pci_ctrl;
175 struct list_head resources; 175 struct list_head resources;
176 struct pci_bus *bus; 176 struct pci_bus *bus;
177 int next_busno = 0, i; 177 int next_busno = 0;
178 178
179 printk("PCI: Probing PCI hardware\n"); 179 printk("PCI: Probing PCI hardware\n");
180 180
@@ -197,7 +197,7 @@ static int __init pcibios_init(void)
197 197
198subsys_initcall(pcibios_init); 198subsys_initcall(pcibios_init);
199 199
200void __init pcibios_fixup_bus(struct pci_bus *bus) 200void pcibios_fixup_bus(struct pci_bus *bus)
201{ 201{
202 if (bus->parent) { 202 if (bus->parent) {
203 /* This is a subordinate bridge */ 203 /* This is a subordinate bridge */
diff --git a/arch/xtensa/kernel/platform.c b/arch/xtensa/kernel/platform.c
index 2bd6c351f37c..1cf008284dd2 100644
--- a/arch/xtensa/kernel/platform.c
+++ b/arch/xtensa/kernel/platform.c
@@ -29,7 +29,6 @@
29 */ 29 */
30 30
31_F(void, setup, (char** cmd), { }); 31_F(void, setup, (char** cmd), { });
32_F(void, init_irq, (void), { });
33_F(void, restart, (void), { while(1); }); 32_F(void, restart, (void), { while(1); });
34_F(void, halt, (void), { while(1); }); 33_F(void, halt, (void), { while(1); });
35_F(void, power_off, (void), { while(1); }); 34_F(void, power_off, (void), { while(1); });
@@ -42,6 +41,6 @@ _F(void, pcibios_init, (void), { });
42_F(void, calibrate_ccount, (void), 41_F(void, calibrate_ccount, (void),
43{ 42{
44 pr_err("ERROR: Cannot calibrate cpu frequency! Assuming 10MHz.\n"); 43 pr_err("ERROR: Cannot calibrate cpu frequency! Assuming 10MHz.\n");
45 ccount_per_jiffy = 10 * (1000000UL/HZ); 44 ccount_freq = 10 * 1000000UL;
46}); 45});
47#endif 46#endif
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 6dd25ecde3f5..42a8bba0b0ea 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -152,8 +152,8 @@ static int __init parse_tag_initrd(const bp_tag_t* tag)
152{ 152{
153 meminfo_t* mi; 153 meminfo_t* mi;
154 mi = (meminfo_t*)(tag->data); 154 mi = (meminfo_t*)(tag->data);
155 initrd_start = (void*)(mi->start); 155 initrd_start = __va(mi->start);
156 initrd_end = (void*)(mi->end); 156 initrd_end = __va(mi->end);
157 157
158 return 0; 158 return 0;
159} 159}
@@ -164,7 +164,7 @@ __tagtable(BP_TAG_INITRD, parse_tag_initrd);
164 164
165static int __init parse_tag_fdt(const bp_tag_t *tag) 165static int __init parse_tag_fdt(const bp_tag_t *tag)
166{ 166{
167 dtb_start = (void *)(tag->data[0]); 167 dtb_start = __va(tag->data[0]);
168 return 0; 168 return 0;
169} 169}
170 170
@@ -256,7 +256,7 @@ void __init early_init_devtree(void *params)
256static void __init copy_devtree(void) 256static void __init copy_devtree(void)
257{ 257{
258 void *alloc = early_init_dt_alloc_memory_arch( 258 void *alloc = early_init_dt_alloc_memory_arch(
259 be32_to_cpu(initial_boot_params->totalsize), 0); 259 be32_to_cpu(initial_boot_params->totalsize), 8);
260 if (alloc) { 260 if (alloc) {
261 memcpy(alloc, initial_boot_params, 261 memcpy(alloc, initial_boot_params,
262 be32_to_cpu(initial_boot_params->totalsize)); 262 be32_to_cpu(initial_boot_params->totalsize));
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index ffb474104311..24bb0c1776ba 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -16,6 +16,7 @@
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/time.h> 17#include <linux/time.h>
18#include <linux/clocksource.h> 18#include <linux/clocksource.h>
19#include <linux/clockchips.h>
19#include <linux/interrupt.h> 20#include <linux/interrupt.h>
20#include <linux/module.h> 21#include <linux/module.h>
21#include <linux/init.h> 22#include <linux/init.h>
@@ -23,13 +24,13 @@
23#include <linux/profile.h> 24#include <linux/profile.h>
24#include <linux/delay.h> 25#include <linux/delay.h>
25#include <linux/irqdomain.h> 26#include <linux/irqdomain.h>
27#include <linux/sched_clock.h>
26 28
27#include <asm/timex.h> 29#include <asm/timex.h>
28#include <asm/platform.h> 30#include <asm/platform.h>
29 31
30#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT 32#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
31unsigned long ccount_per_jiffy; /* per 1/HZ */ 33unsigned long ccount_freq; /* ccount Hz */
32unsigned long nsec_per_ccount; /* nsec per ccount increment */
33#endif 34#endif
34 35
35static cycle_t ccount_read(struct clocksource *cs) 36static cycle_t ccount_read(struct clocksource *cs)
@@ -37,6 +38,11 @@ static cycle_t ccount_read(struct clocksource *cs)
37 return (cycle_t)get_ccount(); 38 return (cycle_t)get_ccount();
38} 39}
39 40
41static u32 notrace ccount_sched_clock_read(void)
42{
43 return get_ccount();
44}
45
40static struct clocksource ccount_clocksource = { 46static struct clocksource ccount_clocksource = {
41 .name = "ccount", 47 .name = "ccount",
42 .rating = 200, 48 .rating = 200,
@@ -44,29 +50,98 @@ static struct clocksource ccount_clocksource = {
44 .mask = CLOCKSOURCE_MASK(32), 50 .mask = CLOCKSOURCE_MASK(32),
45}; 51};
46 52
53static int ccount_timer_set_next_event(unsigned long delta,
54 struct clock_event_device *dev);
55static void ccount_timer_set_mode(enum clock_event_mode mode,
56 struct clock_event_device *evt);
57static struct ccount_timer_t {
58 struct clock_event_device evt;
59 int irq_enabled;
60} ccount_timer = {
61 .evt = {
62 .name = "ccount_clockevent",
63 .features = CLOCK_EVT_FEAT_ONESHOT,
64 .rating = 300,
65 .set_next_event = ccount_timer_set_next_event,
66 .set_mode = ccount_timer_set_mode,
67 },
68};
69
70static int ccount_timer_set_next_event(unsigned long delta,
71 struct clock_event_device *dev)
72{
73 unsigned long flags, next;
74 int ret = 0;
75
76 local_irq_save(flags);
77 next = get_ccount() + delta;
78 set_linux_timer(next);
79 if (next - get_ccount() > delta)
80 ret = -ETIME;
81 local_irq_restore(flags);
82
83 return ret;
84}
85
86static void ccount_timer_set_mode(enum clock_event_mode mode,
87 struct clock_event_device *evt)
88{
89 struct ccount_timer_t *timer =
90 container_of(evt, struct ccount_timer_t, evt);
91
92 /*
93 * There is no way to disable the timer interrupt at the device level,
94 * only at the intenable register itself. Since enable_irq/disable_irq
95 * calls are nested, we need to make sure that these calls are
96 * balanced.
97 */
98 switch (mode) {
99 case CLOCK_EVT_MODE_SHUTDOWN:
100 case CLOCK_EVT_MODE_UNUSED:
101 if (timer->irq_enabled) {
102 disable_irq(evt->irq);
103 timer->irq_enabled = 0;
104 }
105 break;
106 case CLOCK_EVT_MODE_RESUME:
107 case CLOCK_EVT_MODE_ONESHOT:
108 if (!timer->irq_enabled) {
109 enable_irq(evt->irq);
110 timer->irq_enabled = 1;
111 }
112 default:
113 break;
114 }
115}
116
47static irqreturn_t timer_interrupt(int irq, void *dev_id); 117static irqreturn_t timer_interrupt(int irq, void *dev_id);
48static struct irqaction timer_irqaction = { 118static struct irqaction timer_irqaction = {
49 .handler = timer_interrupt, 119 .handler = timer_interrupt,
50 .flags = IRQF_DISABLED, 120 .flags = IRQF_TIMER,
51 .name = "timer", 121 .name = "timer",
122 .dev_id = &ccount_timer,
52}; 123};
53 124
54void __init time_init(void) 125void __init time_init(void)
55{ 126{
56 unsigned int irq;
57#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT 127#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
58 printk("Calibrating CPU frequency "); 128 printk("Calibrating CPU frequency ");
59 platform_calibrate_ccount(); 129 platform_calibrate_ccount();
60 printk("%d.%02d MHz\n", (int)ccount_per_jiffy/(1000000/HZ), 130 printk("%d.%02d MHz\n", (int)ccount_freq/1000000,
61 (int)(ccount_per_jiffy/(10000/HZ))%100); 131 (int)(ccount_freq/10000)%100);
62#endif 132#endif
63 clocksource_register_hz(&ccount_clocksource, CCOUNT_PER_JIFFY * HZ); 133 clocksource_register_hz(&ccount_clocksource, CCOUNT_PER_JIFFY * HZ);
64 134
65 /* Initialize the linux timer interrupt. */ 135 ccount_timer.evt.cpumask = cpumask_of(0);
136 ccount_timer.evt.irq = irq_create_mapping(NULL, LINUX_TIMER_INT);
137 if (WARN(!ccount_timer.evt.irq, "error: can't map timer irq"))
138 return;
139 clockevents_config_and_register(&ccount_timer.evt, ccount_freq, 0xf,
140 0xffffffff);
141 setup_irq(ccount_timer.evt.irq, &timer_irqaction);
142 ccount_timer.irq_enabled = 1;
66 143
67 irq = irq_create_mapping(NULL, LINUX_TIMER_INT); 144 setup_sched_clock(ccount_sched_clock_read, 32, ccount_freq);
68 setup_irq(irq, &timer_irqaction);
69 set_linux_timer(get_ccount() + CCOUNT_PER_JIFFY);
70} 145}
71 146
72/* 147/*
@@ -75,41 +150,19 @@ void __init time_init(void)
75 150
76irqreturn_t timer_interrupt (int irq, void *dev_id) 151irqreturn_t timer_interrupt (int irq, void *dev_id)
77{ 152{
153 struct ccount_timer_t *timer = dev_id;
154 struct clock_event_device *evt = &timer->evt;
78 155
79 unsigned long next; 156 evt->event_handler(evt);
80
81 next = get_linux_timer();
82
83again:
84 while ((signed long)(get_ccount() - next) > 0) {
85
86 profile_tick(CPU_PROFILING);
87#ifndef CONFIG_SMP
88 update_process_times(user_mode(get_irq_regs()));
89#endif
90
91 xtime_update(1); /* Linux handler in kernel/time/timekeeping */
92
93 /* Note that writing CCOMPARE clears the interrupt. */
94
95 next += CCOUNT_PER_JIFFY;
96 set_linux_timer(next);
97 }
98 157
99 /* Allow platform to do something useful (Wdog). */ 158 /* Allow platform to do something useful (Wdog). */
100
101 platform_heartbeat(); 159 platform_heartbeat();
102 160
103 /* Make sure we didn't miss any tick... */
104
105 if ((signed long)(get_ccount() - next) > 0)
106 goto again;
107
108 return IRQ_HANDLED; 161 return IRQ_HANDLED;
109} 162}
110 163
111#ifndef CONFIG_GENERIC_CALIBRATE_DELAY 164#ifndef CONFIG_GENERIC_CALIBRATE_DELAY
112void __cpuinit calibrate_delay(void) 165void calibrate_delay(void)
113{ 166{
114 loops_per_jiffy = CCOUNT_PER_JIFFY; 167 loops_per_jiffy = CCOUNT_PER_JIFFY;
115 printk("Calibrating delay loop (skipped)... " 168 printk("Calibrating delay loop (skipped)... "
diff --git a/arch/xtensa/kernel/xtensa_ksyms.c b/arch/xtensa/kernel/xtensa_ksyms.c
index 42c53c87c204..d8507f812f46 100644
--- a/arch/xtensa/kernel/xtensa_ksyms.c
+++ b/arch/xtensa/kernel/xtensa_ksyms.c
@@ -124,3 +124,7 @@ extern long common_exception_return;
124extern long _spill_registers; 124extern long _spill_registers;
125EXPORT_SYMBOL(common_exception_return); 125EXPORT_SYMBOL(common_exception_return);
126EXPORT_SYMBOL(_spill_registers); 126EXPORT_SYMBOL(_spill_registers);
127
128#ifdef CONFIG_FUNCTION_TRACER
129EXPORT_SYMBOL(_mcount);
130#endif
diff --git a/arch/xtensa/mm/tlb.c b/arch/xtensa/mm/tlb.c
index 5411aa67c68e..ca9d2366bf12 100644
--- a/arch/xtensa/mm/tlb.c
+++ b/arch/xtensa/mm/tlb.c
@@ -64,7 +64,7 @@ void flush_tlb_mm(struct mm_struct *mm)
64{ 64{
65 if (mm == current->active_mm) { 65 if (mm == current->active_mm) {
66 unsigned long flags; 66 unsigned long flags;
67 local_save_flags(flags); 67 local_irq_save(flags);
68 __get_new_mmu_context(mm); 68 __get_new_mmu_context(mm);
69 __load_mmu_context(mm); 69 __load_mmu_context(mm);
70 local_irq_restore(flags); 70 local_irq_restore(flags);
@@ -94,7 +94,7 @@ void flush_tlb_range (struct vm_area_struct *vma,
94 printk("[tlbrange<%02lx,%08lx,%08lx>]\n", 94 printk("[tlbrange<%02lx,%08lx,%08lx>]\n",
95 (unsigned long)mm->context, start, end); 95 (unsigned long)mm->context, start, end);
96#endif 96#endif
97 local_save_flags(flags); 97 local_irq_save(flags);
98 98
99 if (end-start + (PAGE_SIZE-1) <= _TLB_ENTRIES << PAGE_SHIFT) { 99 if (end-start + (PAGE_SIZE-1) <= _TLB_ENTRIES << PAGE_SHIFT) {
100 int oldpid = get_rasid_register(); 100 int oldpid = get_rasid_register();
@@ -128,9 +128,10 @@ void flush_tlb_page (struct vm_area_struct *vma, unsigned long page)
128 if(mm->context == NO_CONTEXT) 128 if(mm->context == NO_CONTEXT)
129 return; 129 return;
130 130
131 local_save_flags(flags); 131 local_irq_save(flags);
132 132
133 oldpid = get_rasid_register(); 133 oldpid = get_rasid_register();
134 set_rasid_register(ASID_INSERT(mm->context));
134 135
135 if (vma->vm_flags & VM_EXEC) 136 if (vma->vm_flags & VM_EXEC)
136 invalidate_itlb_mapping(page); 137 invalidate_itlb_mapping(page);
@@ -140,3 +141,116 @@ void flush_tlb_page (struct vm_area_struct *vma, unsigned long page)
140 141
141 local_irq_restore(flags); 142 local_irq_restore(flags);
142} 143}
144
145#ifdef CONFIG_DEBUG_TLB_SANITY
146
147static unsigned get_pte_for_vaddr(unsigned vaddr)
148{
149 struct task_struct *task = get_current();
150 struct mm_struct *mm = task->mm;
151 pgd_t *pgd;
152 pmd_t *pmd;
153 pte_t *pte;
154
155 if (!mm)
156 mm = task->active_mm;
157 pgd = pgd_offset(mm, vaddr);
158 if (pgd_none_or_clear_bad(pgd))
159 return 0;
160 pmd = pmd_offset(pgd, vaddr);
161 if (pmd_none_or_clear_bad(pmd))
162 return 0;
163 pte = pte_offset_map(pmd, vaddr);
164 if (!pte)
165 return 0;
166 return pte_val(*pte);
167}
168
169enum {
170 TLB_SUSPICIOUS = 1,
171 TLB_INSANE = 2,
172};
173
174static void tlb_insane(void)
175{
176 BUG_ON(1);
177}
178
179static void tlb_suspicious(void)
180{
181 WARN_ON(1);
182}
183
184/*
185 * Check that TLB entries with kernel ASID (1) have kernel VMA (>= TASK_SIZE),
186 * and TLB entries with user ASID (>=4) have VMA < TASK_SIZE.
187 *
188 * Check that valid TLB entries either have the same PA as the PTE, or PTE is
189 * marked as non-present. Non-present PTE and the page with non-zero refcount
190 * and zero mapcount is normal for batched TLB flush operation. Zero refcount
191 * means that the page was freed prematurely. Non-zero mapcount is unusual,
192 * but does not necessary means an error, thus marked as suspicious.
193 */
194static int check_tlb_entry(unsigned w, unsigned e, bool dtlb)
195{
196 unsigned tlbidx = w | (e << PAGE_SHIFT);
197 unsigned r0 = dtlb ?
198 read_dtlb_virtual(tlbidx) : read_itlb_virtual(tlbidx);
199 unsigned vpn = (r0 & PAGE_MASK) | (e << PAGE_SHIFT);
200 unsigned pte = get_pte_for_vaddr(vpn);
201 unsigned mm_asid = (get_rasid_register() >> 8) & ASID_MASK;
202 unsigned tlb_asid = r0 & ASID_MASK;
203 bool kernel = tlb_asid == 1;
204 int rc = 0;
205
206 if (tlb_asid > 0 && ((vpn < TASK_SIZE) == kernel)) {
207 pr_err("%cTLB: way: %u, entry: %u, VPN %08x in %s PTE\n",
208 dtlb ? 'D' : 'I', w, e, vpn,
209 kernel ? "kernel" : "user");
210 rc |= TLB_INSANE;
211 }
212
213 if (tlb_asid == mm_asid) {
214 unsigned r1 = dtlb ? read_dtlb_translation(tlbidx) :
215 read_itlb_translation(tlbidx);
216 if ((pte ^ r1) & PAGE_MASK) {
217 pr_err("%cTLB: way: %u, entry: %u, mapping: %08x->%08x, PTE: %08x\n",
218 dtlb ? 'D' : 'I', w, e, r0, r1, pte);
219 if (pte == 0 || !pte_present(__pte(pte))) {
220 struct page *p = pfn_to_page(r1 >> PAGE_SHIFT);
221 pr_err("page refcount: %d, mapcount: %d\n",
222 page_count(p),
223 page_mapcount(p));
224 if (!page_count(p))
225 rc |= TLB_INSANE;
226 else if (page_mapped(p))
227 rc |= TLB_SUSPICIOUS;
228 } else {
229 rc |= TLB_INSANE;
230 }
231 }
232 }
233 return rc;
234}
235
236void check_tlb_sanity(void)
237{
238 unsigned long flags;
239 unsigned w, e;
240 int bug = 0;
241
242 local_irq_save(flags);
243 for (w = 0; w < DTLB_ARF_WAYS; ++w)
244 for (e = 0; e < (1 << XCHAL_DTLB_ARF_ENTRIES_LOG2); ++e)
245 bug |= check_tlb_entry(w, e, true);
246 for (w = 0; w < ITLB_ARF_WAYS; ++w)
247 for (e = 0; e < (1 << XCHAL_ITLB_ARF_ENTRIES_LOG2); ++e)
248 bug |= check_tlb_entry(w, e, false);
249 if (bug & TLB_INSANE)
250 tlb_insane();
251 if (bug & TLB_SUSPICIOUS)
252 tlb_suspicious();
253 local_irq_restore(flags);
254}
255
256#endif /* CONFIG_DEBUG_TLB_SANITY */
diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c
index 7d0fea6d7f20..56f88b7afe2f 100644
--- a/arch/xtensa/platforms/iss/network.c
+++ b/arch/xtensa/platforms/iss/network.c
@@ -700,7 +700,7 @@ struct iss_net_init {
700 700
701#define ERR KERN_ERR "iss_net_setup: " 701#define ERR KERN_ERR "iss_net_setup: "
702 702
703static int iss_net_setup(char *str) 703static int __init iss_net_setup(char *str)
704{ 704{
705 struct iss_net_private *device = NULL; 705 struct iss_net_private *device = NULL;
706 struct iss_net_init *new; 706 struct iss_net_init *new;
diff --git a/arch/xtensa/platforms/iss/simdisk.c b/arch/xtensa/platforms/iss/simdisk.c
index c0edb35424ce..8c6e819cd8ed 100644
--- a/arch/xtensa/platforms/iss/simdisk.c
+++ b/arch/xtensa/platforms/iss/simdisk.c
@@ -108,13 +108,13 @@ static int simdisk_xfer_bio(struct simdisk *dev, struct bio *bio)
108 sector_t sector = bio->bi_sector; 108 sector_t sector = bio->bi_sector;
109 109
110 bio_for_each_segment(bvec, bio, i) { 110 bio_for_each_segment(bvec, bio, i) {
111 char *buffer = __bio_kmap_atomic(bio, i, KM_USER0); 111 char *buffer = __bio_kmap_atomic(bio, i);
112 unsigned len = bvec->bv_len >> SECTOR_SHIFT; 112 unsigned len = bvec->bv_len >> SECTOR_SHIFT;
113 113
114 simdisk_transfer(dev, sector, len, buffer, 114 simdisk_transfer(dev, sector, len, buffer,
115 bio_data_dir(bio) == WRITE); 115 bio_data_dir(bio) == WRITE);
116 sector += len; 116 sector += len;
117 __bio_kunmap_atomic(bio, KM_USER0); 117 __bio_kunmap_atomic(bio);
118 } 118 }
119 return 0; 119 return 0;
120} 120}
diff --git a/arch/xtensa/platforms/xtfpga/setup.c b/arch/xtensa/platforms/xtfpga/setup.c
index 96ef8eeb064e..74bb74fa3f87 100644
--- a/arch/xtensa/platforms/xtfpga/setup.c
+++ b/arch/xtensa/platforms/xtfpga/setup.c
@@ -163,7 +163,7 @@ void platform_heartbeat(void)
163 163
164#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT 164#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
165 165
166void platform_calibrate_ccount(void) 166void __init platform_calibrate_ccount(void)
167{ 167{
168 long clk_freq = 0; 168 long clk_freq = 0;
169#ifdef CONFIG_OF 169#ifdef CONFIG_OF
@@ -179,8 +179,7 @@ void platform_calibrate_ccount(void)
179 if (!clk_freq) 179 if (!clk_freq)
180 clk_freq = *(long *)XTFPGA_CLKFRQ_VADDR; 180 clk_freq = *(long *)XTFPGA_CLKFRQ_VADDR;
181 181
182 ccount_per_jiffy = clk_freq / HZ; 182 ccount_freq = clk_freq;
183 nsec_per_ccount = 1000000000UL / clk_freq;
184} 183}
185 184
186#endif 185#endif
diff --git a/arch/xtensa/variants/s6000/delay.c b/arch/xtensa/variants/s6000/delay.c
index 54b2b573f166..39154563ee17 100644
--- a/arch/xtensa/variants/s6000/delay.c
+++ b/arch/xtensa/variants/s6000/delay.c
@@ -1,4 +1,3 @@
1#include <asm/delay.h>
2#include <asm/timex.h> 1#include <asm/timex.h>
3#include <asm/io.h> 2#include <asm/io.h>
4#include <variant/hardware.h> 3#include <variant/hardware.h>
@@ -17,11 +16,10 @@ void platform_calibrate_ccount(void)
17 "1: l32i %0, %2, 0 ;" 16 "1: l32i %0, %2, 0 ;"
18 " beq %0, %1, 1b ;" 17 " beq %0, %1, 1b ;"
19 : "=&a"(u) : "a"(t), "a"(tstamp)); 18 : "=&a"(u) : "a"(t), "a"(tstamp));
20 b = xtensa_get_ccount(); 19 b = get_ccount();
21 if (i == LOOPS) 20 if (i == LOOPS)
22 a = b; 21 a = b;
23 } while (--i >= 0); 22 } while (--i >= 0);
24 b -= a; 23 b -= a;
25 nsec_per_ccount = (LOOPS * 10000) / b; 24 ccount_freq = b * (100000UL / LOOPS);
26 ccount_per_jiffy = b * (100000UL / (LOOPS * HZ));
27} 25}