aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2014-04-02 03:48:56 -0400
committerIngo Molnar <mingo@kernel.org>2014-04-02 03:48:56 -0400
commitb8764fe6d0ba654c8705ebbb8c2c8ddd776d8928 (patch)
tree3e28a08a044547d5429f011bcce24a3c82c89fec
parentb8c89c6a0d56d47ae7f22755a133540b32fa81cf (diff)
parent683b6c6f82a60fabf47012581c2cfbf1b037ab95 (diff)
Merge branch 'linus' into x86/urgent
Pick up Linus's latest, to fix a bug. Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--Documentation/arm64/memory.txt16
-rw-r--r--Documentation/devicetree/bindings/arm/armada-370-xp-mpic.txt8
-rw-r--r--Documentation/devicetree/bindings/ata/ahci-platform.txt22
-rw-r--r--Documentation/devicetree/bindings/ata/apm-xgene.txt76
-rw-r--r--Documentation/devicetree/bindings/interrupt-controller/allwinner,sun4i-ic.txt4
-rw-r--r--Documentation/devicetree/bindings/interrupt-controller/allwinner,sun67i-sc-nmi.txt27
-rw-r--r--Documentation/devicetree/bindings/timer/allwinner,sun4i-timer.txt4
-rw-r--r--Documentation/devicetree/bindings/timer/ti,keystone-timer.txt29
-rw-r--r--MAINTAINERS28
-rw-r--r--arch/alpha/include/asm/Kbuild1
-rw-r--r--arch/alpha/include/asm/cputime.h6
-rw-r--r--arch/arm/boot/dts/sun4i-a10.dtsi4
-rw-r--r--arch/arm/boot/dts/sun5i-a10s.dtsi4
-rw-r--r--arch/arm/boot/dts/sun5i-a13.dtsi4
-rw-r--r--arch/arm/boot/dts/sun6i-a31.dtsi10
-rw-r--r--arch/arm/boot/dts/sun7i-a20.dtsi10
-rw-r--r--arch/arm/boot/dts/zynq-7000.dtsi6
-rw-r--r--arch/arm/mach-davinci/da850.c2
-rw-r--r--arch/arm/mach-davinci/devices-da8xx.c99
-rw-r--r--arch/arm/mach-imx/pm-imx6q.c7
-rw-r--r--arch/arm/mach-mmp/pm-mmp2.c16
-rw-r--r--arch/arm/mach-mmp/pm-pxa910.c20
-rw-r--r--arch/arm/mach-omap1/ams-delta-fiq.c7
-rw-r--r--arch/arm/mach-shmobile/Kconfig36
-rw-r--r--arch/arm/mach-u300/Makefile2
-rw-r--r--arch/arm/mach-zynq/Kconfig4
-rw-r--r--arch/arm/mach-zynq/common.c3
-rw-r--r--arch/arm64/Kconfig26
-rw-r--r--arch/arm64/boot/dts/apm-storm.dtsi152
-rw-r--r--arch/arm64/include/asm/Kbuild1
-rw-r--r--arch/arm64/include/asm/barrier.h1
-rw-r--r--arch/arm64/include/asm/cacheflush.h7
-rw-r--r--arch/arm64/include/asm/compat.h2
-rw-r--r--arch/arm64/include/asm/cpufeature.h29
-rw-r--r--arch/arm64/include/asm/debug-monitors.h64
-rw-r--r--arch/arm64/include/asm/dma-mapping.h7
-rw-r--r--arch/arm64/include/asm/hwcap.h9
-rw-r--r--arch/arm64/include/asm/io.h2
-rw-r--r--arch/arm64/include/asm/irqflags.h23
-rw-r--r--arch/arm64/include/asm/kgdb.h84
-rw-r--r--arch/arm64/include/asm/kvm_arm.h15
-rw-r--r--arch/arm64/include/asm/pgtable-hwdef.h5
-rw-r--r--arch/arm64/include/asm/pgtable.h60
-rw-r--r--arch/arm64/include/asm/psci.h2
-rw-r--r--arch/arm64/include/asm/ptrace.h5
-rw-r--r--arch/arm64/include/asm/tlb.h136
-rw-r--r--arch/arm64/include/asm/topology.h39
-rw-r--r--arch/arm64/include/asm/uaccess.h4
-rw-r--r--arch/arm64/include/asm/unistd.h1
-rw-r--r--arch/arm64/include/uapi/asm/Kbuild1
-rw-r--r--arch/arm64/include/uapi/asm/perf_regs.h40
-rw-r--r--arch/arm64/kernel/Makefile6
-rw-r--r--arch/arm64/kernel/debug-monitors.c10
-rw-r--r--arch/arm64/kernel/head.S20
-rw-r--r--arch/arm64/kernel/kgdb.c336
-rw-r--r--arch/arm64/kernel/perf_event.c75
-rw-r--r--arch/arm64/kernel/perf_regs.c44
-rw-r--r--arch/arm64/kernel/process.c11
-rw-r--r--arch/arm64/kernel/psci.c13
-rw-r--r--arch/arm64/kernel/setup.c33
-rw-r--r--arch/arm64/kernel/smp.c12
-rw-r--r--arch/arm64/kernel/smp_spin_table.c2
-rw-r--r--arch/arm64/kernel/topology.c95
-rw-r--r--arch/arm64/kernel/vdso.c42
-rw-r--r--arch/arm64/kvm/hyp-init.S6
-rw-r--r--arch/arm64/mm/cache.S80
-rw-r--r--arch/arm64/mm/dma-mapping.c246
-rw-r--r--arch/arm64/mm/init.c33
-rw-r--r--arch/arm64/mm/proc.S14
-rw-r--r--arch/avr32/include/asm/bugs.h2
-rw-r--r--arch/avr32/include/asm/processor.h7
-rw-r--r--arch/avr32/kernel/cpu.c48
-rw-r--r--arch/avr32/mm/cache.c1
-rw-r--r--arch/cris/include/asm/Kbuild1
-rw-r--r--arch/cris/include/asm/cputime.h6
-rw-r--r--arch/frv/include/asm/Kbuild1
-rw-r--r--arch/frv/include/asm/cputime.h6
-rw-r--r--arch/ia64/configs/generic_defconfig4
-rw-r--r--arch/ia64/hp/common/sba_iommu.c6
-rw-r--r--arch/ia64/kernel/irq_ia64.c14
-rw-r--r--arch/ia64/kernel/mca.c10
-rw-r--r--arch/ia64/kernel/msi_ia64.c10
-rw-r--r--arch/ia64/kernel/perfmon.c1
-rw-r--r--arch/ia64/kernel/time.c2
-rw-r--r--arch/ia64/sn/kernel/irq.c4
-rw-r--r--arch/ia64/sn/kernel/msi_sn.c2
-rw-r--r--arch/m32r/include/asm/Kbuild1
-rw-r--r--arch/m32r/include/asm/cputime.h6
-rw-r--r--arch/m68k/amiga/cia.c1
-rw-r--r--arch/m68k/atari/ataints.c1
-rw-r--r--arch/m68k/configs/amiga_defconfig10
-rw-r--r--arch/m68k/configs/apollo_defconfig10
-rw-r--r--arch/m68k/configs/atari_defconfig10
-rw-r--r--arch/m68k/configs/bvme6000_defconfig10
-rw-r--r--arch/m68k/configs/hp300_defconfig10
-rw-r--r--arch/m68k/configs/mac_defconfig10
-rw-r--r--arch/m68k/configs/multi_defconfig10
-rw-r--r--arch/m68k/configs/mvme147_defconfig10
-rw-r--r--arch/m68k/configs/mvme16x_defconfig10
-rw-r--r--arch/m68k/configs/q40_defconfig10
-rw-r--r--arch/m68k/configs/sun3_defconfig10
-rw-r--r--arch/m68k/configs/sun3x_defconfig10
-rw-r--r--arch/m68k/kernel/head.S70
-rw-r--r--arch/m68k/kernel/ints.c2
-rw-r--r--arch/microblaze/include/asm/Kbuild1
-rw-r--r--arch/microblaze/include/asm/cputime.h1
-rw-r--r--arch/mips/include/asm/unistd.h1
-rw-r--r--arch/mips/kernel/smtc.c2
-rw-r--r--arch/mips/sgi-ip22/ip22-int.c2
-rw-r--r--arch/mips/sgi-ip22/ip22-time.c2
-rw-r--r--arch/mips/sibyte/bcm1480/irq.c2
-rw-r--r--arch/mips/sibyte/bcm1480/smp.c2
-rw-r--r--arch/mips/sibyte/sb1250/irq.c2
-rw-r--r--arch/mips/sibyte/sb1250/smp.c2
-rw-r--r--arch/mn10300/include/asm/Kbuild1
-rw-r--r--arch/mn10300/include/asm/cputime.h1
-rw-r--r--arch/mn10300/kernel/cevt-mn10300.c2
-rw-r--r--arch/mn10300/kernel/mn10300-serial.c6
-rw-r--r--arch/mn10300/kernel/mn10300-watchdog.c2
-rw-r--r--arch/mn10300/kernel/smp.c2
-rw-r--r--arch/mn10300/unit-asb2364/irq-fpga.c2
-rw-r--r--arch/parisc/kernel/irq.c2
-rw-r--r--arch/powerpc/kernel/eeh_driver.c25
-rw-r--r--arch/powerpc/kernel/irq.c8
-rw-r--r--arch/powerpc/sysdev/ehv_pic.c10
-rw-r--r--arch/s390/Kconfig5
-rw-r--r--arch/s390/appldata/appldata_os.c2
-rw-r--r--arch/s390/configs/default_defconfig46
-rw-r--r--arch/s390/configs/gcov_defconfig33
-rw-r--r--arch/s390/configs/performance_defconfig33
-rw-r--r--arch/s390/configs/zfcpdump_defconfig1
-rw-r--r--arch/s390/defconfig10
-rw-r--r--arch/s390/hypfs/hypfs_vm.c9
-rw-r--r--arch/s390/include/asm/airq.h14
-rw-r--r--arch/s390/include/asm/bitops.h8
-rw-r--r--arch/s390/include/asm/ccwdev.h4
-rw-r--r--arch/s390/include/asm/checksum.h11
-rw-r--r--arch/s390/include/asm/compat.h6
-rw-r--r--arch/s390/include/asm/futex.h13
-rw-r--r--arch/s390/include/asm/kvm_host.h5
-rw-r--r--arch/s390/include/asm/mmu_context.h39
-rw-r--r--arch/s390/include/asm/pgalloc.h18
-rw-r--r--arch/s390/include/asm/pgtable.h105
-rw-r--r--arch/s390/include/asm/ptrace.h1
-rw-r--r--arch/s390/include/asm/sclp.h1
-rw-r--r--arch/s390/include/asm/setup.h3
-rw-r--r--arch/s390/include/asm/thread_info.h3
-rw-r--r--arch/s390/include/asm/uaccess.h171
-rw-r--r--arch/s390/include/uapi/asm/ptrace.h6
-rw-r--r--arch/s390/kernel/Makefile5
-rw-r--r--arch/s390/kernel/compat_exec_domain.c29
-rw-r--r--arch/s390/kernel/compat_linux.c116
-rw-r--r--arch/s390/kernel/compat_linux.h81
-rw-r--r--arch/s390/kernel/compat_signal.c4
-rw-r--r--arch/s390/kernel/compat_wrapper.S1425
-rw-r--r--arch/s390/kernel/compat_wrapper.c215
-rw-r--r--arch/s390/kernel/early.c2
-rw-r--r--arch/s390/kernel/entry.S9
-rw-r--r--arch/s390/kernel/entry.h6
-rw-r--r--arch/s390/kernel/entry64.S9
-rw-r--r--arch/s390/kernel/irq.c1
-rw-r--r--arch/s390/kernel/perf_event.c2
-rw-r--r--arch/s390/kernel/ptrace.c13
-rw-r--r--arch/s390/kernel/setup.c17
-rw-r--r--arch/s390/kernel/smp.c8
-rw-r--r--arch/s390/kernel/syscalls.S504
-rw-r--r--arch/s390/kernel/topology.c1
-rw-r--r--arch/s390/kvm/diag.c3
-rw-r--r--arch/s390/kvm/kvm-s390.c25
-rw-r--r--arch/s390/kvm/kvm-s390.h2
-rw-r--r--arch/s390/kvm/priv.c41
-rw-r--r--arch/s390/lib/Makefile3
-rw-r--r--arch/s390/lib/find.c2
-rw-r--r--arch/s390/lib/uaccess.h8
-rw-r--r--arch/s390/lib/uaccess_mvcos.c116
-rw-r--r--arch/s390/lib/uaccess_pt.c69
-rw-r--r--arch/s390/mm/maccess.c28
-rw-r--r--arch/s390/mm/pgtable.c158
-rw-r--r--arch/s390/pci/pci_debug.c2
-rw-r--r--arch/score/include/asm/Kbuild1
-rw-r--r--arch/score/include/asm/cputime.h6
-rw-r--r--arch/sh/Kconfig76
-rw-r--r--arch/sh/kernel/irq.c18
-rw-r--r--arch/sparc/kernel/time_64.c2
-rw-r--r--arch/x86/include/asm/Kbuild1
-rw-r--r--arch/x86/include/asm/cpufeature.h4
-rw-r--r--arch/x86/include/asm/cputime.h1
-rw-r--r--arch/x86/include/asm/floppy.h4
-rw-r--r--arch/x86/include/asm/hardirq.h3
-rw-r--r--arch/x86/include/asm/mshyperv.h4
-rw-r--r--arch/x86/include/asm/processor.h9
-rw-r--r--arch/x86/include/asm/thread_info.h53
-rw-r--r--arch/x86/include/asm/unistd.h3
-rw-r--r--arch/x86/kernel/cpu/common.c11
-rw-r--r--arch/x86/kernel/cpu/mshyperv.c78
-rw-r--r--arch/x86/kernel/dumpstack_32.c44
-rw-r--r--arch/x86/kernel/dumpstack_64.c117
-rw-r--r--arch/x86/kernel/early-quirks.c15
-rw-r--r--arch/x86/kernel/hpet.c4
-rw-r--r--arch/x86/kernel/irq.c6
-rw-r--r--arch/x86/kernel/irq_32.c83
-rw-r--r--arch/x86/kernel/process_32.c4
-rw-r--r--arch/x86/kernel/ptrace.c8
-rw-r--r--arch/x86/kernel/reboot.c15
-rw-r--r--arch/x86/kernel/smpboot.c4
-rw-r--r--arch/x86/kernel/time.c2
-rw-r--r--arch/x86/kvm/cpuid.c2
-rw-r--r--arch/x86/mm/srat.c12
-rw-r--r--arch/x86/xen/spinlock.c2
-rw-r--r--arch/xtensa/kernel/irq.c22
-rw-r--r--drivers/ata/Kconfig56
-rw-r--r--drivers/ata/Makefile8
-rw-r--r--drivers/ata/acard-ahci.c1
-rw-r--r--drivers/ata/ahci.c7
-rw-r--r--drivers/ata/ahci.h14
-rw-r--r--drivers/ata/ahci_da850.c114
-rw-r--r--drivers/ata/ahci_imx.c333
-rw-r--r--drivers/ata/ahci_platform.c291
-rw-r--r--drivers/ata/ahci_st.c245
-rw-r--r--drivers/ata/ahci_sunxi.c249
-rw-r--r--drivers/ata/ahci_xgene.c486
-rw-r--r--drivers/ata/ata_generic.c1
-rw-r--r--drivers/ata/libahci.c38
-rw-r--r--drivers/ata/libahci_platform.c541
-rw-r--r--drivers/ata/libata-acpi.c1
-rw-r--r--drivers/ata/libata-core.c135
-rw-r--r--drivers/ata/libata-eh.c18
-rw-r--r--drivers/ata/libata-zpodd.c21
-rw-r--r--drivers/ata/pata_acpi.c1
-rw-r--r--drivers/ata/pata_amd.c1
-rw-r--r--drivers/ata/pata_arasan_cf.c2
-rw-r--r--drivers/ata/pata_artop.c1
-rw-r--r--drivers/ata/pata_at91.c1
-rw-r--r--drivers/ata/pata_atiixp.c1
-rw-r--r--drivers/ata/pata_atp867x.c1
-rw-r--r--drivers/ata/pata_cmd640.c1
-rw-r--r--drivers/ata/pata_cmd64x.c1
-rw-r--r--drivers/ata/pata_cs5520.c1
-rw-r--r--drivers/ata/pata_cs5530.c1
-rw-r--r--drivers/ata/pata_cs5535.c1
-rw-r--r--drivers/ata/pata_cs5536.c1
-rw-r--r--drivers/ata/pata_cypress.c1
-rw-r--r--drivers/ata/pata_efar.c1
-rw-r--r--drivers/ata/pata_ep93xx.c1
-rw-r--r--drivers/ata/pata_hpt366.c1
-rw-r--r--drivers/ata/pata_hpt37x.c1
-rw-r--r--drivers/ata/pata_hpt3x2n.c1
-rw-r--r--drivers/ata/pata_hpt3x3.c1
-rw-r--r--drivers/ata/pata_imx.c18
-rw-r--r--drivers/ata/pata_it8213.c1
-rw-r--r--drivers/ata/pata_it821x.c1
-rw-r--r--drivers/ata/pata_jmicron.c1
-rw-r--r--drivers/ata/pata_legacy.c1
-rw-r--r--drivers/ata/pata_marvell.c1
-rw-r--r--drivers/ata/pata_mpiix.c1
-rw-r--r--drivers/ata/pata_netcell.c1
-rw-r--r--drivers/ata/pata_ninja32.c1
-rw-r--r--drivers/ata/pata_ns87410.c1
-rw-r--r--drivers/ata/pata_ns87415.c1
-rw-r--r--drivers/ata/pata_oldpiix.c1
-rw-r--r--drivers/ata/pata_opti.c1
-rw-r--r--drivers/ata/pata_optidma.c1
-rw-r--r--drivers/ata/pata_pcmcia.c1
-rw-r--r--drivers/ata/pata_pdc2027x.c1
-rw-r--r--drivers/ata/pata_pdc202xx_old.c1
-rw-r--r--drivers/ata/pata_piccolo.c1
-rw-r--r--drivers/ata/pata_platform.c1
-rw-r--r--drivers/ata/pata_pxa.c1
-rw-r--r--drivers/ata/pata_radisys.c1
-rw-r--r--drivers/ata/pata_rdc.c1
-rw-r--r--drivers/ata/pata_rz1000.c1
-rw-r--r--drivers/ata/pata_sc1200.c1
-rw-r--r--drivers/ata/pata_scc.c1
-rw-r--r--drivers/ata/pata_sch.c1
-rw-r--r--drivers/ata/pata_serverworks.c1
-rw-r--r--drivers/ata/pata_sil680.c1
-rw-r--r--drivers/ata/pata_sis.c1
-rw-r--r--drivers/ata/pata_sl82c105.c1
-rw-r--r--drivers/ata/pata_triflex.c1
-rw-r--r--drivers/ata/pata_via.c1
-rw-r--r--drivers/ata/pdc_adma.c1
-rw-r--r--drivers/ata/sata_dwc_460ex.c4
-rw-r--r--drivers/ata/sata_highbank.c6
-rw-r--r--drivers/ata/sata_nv.c1
-rw-r--r--drivers/ata/sata_promise.c1
-rw-r--r--drivers/ata/sata_qstor.c1
-rw-r--r--drivers/ata/sata_sil.c1
-rw-r--r--drivers/ata/sata_sis.c1
-rw-r--r--drivers/ata/sata_svw.c1
-rw-r--r--drivers/ata/sata_sx4.c10
-rw-r--r--drivers/ata/sata_uli.c1
-rw-r--r--drivers/ata/sata_via.c1
-rw-r--r--drivers/ata/sata_vsc.c1
-rw-r--r--drivers/block/floppy.c42
-rw-r--r--drivers/block/nvme-core.c18
-rw-r--r--drivers/clocksource/Kconfig48
-rw-r--r--drivers/clocksource/Makefile2
-rw-r--r--drivers/clocksource/arm_arch_timer.c1
-rw-r--r--drivers/clocksource/cadence_ttc_timer.c121
-rw-r--r--drivers/clocksource/exynos_mct.c2
-rw-r--r--drivers/clocksource/sun4i_timer.c2
-rw-r--r--drivers/clocksource/time-armada-370-xp.c12
-rw-r--r--drivers/clocksource/time-orion.c28
-rw-r--r--drivers/clocksource/timer-keystone.c241
-rw-r--r--drivers/clocksource/timer-u300.c (renamed from arch/arm/mach-u300/timer.c)4
-rw-r--r--drivers/cpufreq/Kconfig2
-rw-r--r--drivers/cpufreq/cpufreq_stats.c2
-rw-r--r--drivers/cpuidle/cpuidle.c14
-rw-r--r--drivers/gpu/drm/gma500/mmu.c2
-rw-r--r--drivers/hv/vmbus_drv.c57
-rw-r--r--drivers/irqchip/Makefile1
-rw-r--r--drivers/irqchip/irq-armada-370-xp.c98
-rw-r--r--drivers/irqchip/irq-bcm2835.c4
-rw-r--r--drivers/irqchip/irq-gic.c11
-rw-r--r--drivers/irqchip/irq-mmp.c6
-rw-r--r--drivers/irqchip/irq-moxart.c2
-rw-r--r--drivers/irqchip/irq-orion.c2
-rw-r--r--drivers/irqchip/irq-sirfsoc.c2
-rw-r--r--drivers/irqchip/irq-sun4i.c42
-rw-r--r--drivers/irqchip/irq-sunxi-nmi.c208
-rw-r--r--drivers/irqchip/irq-vic.c2
-rw-r--r--drivers/irqchip/irq-vt8500.c3
-rw-r--r--drivers/irqchip/irq-xtensa-mx.c2
-rw-r--r--drivers/irqchip/irq-zevio.c2
-rw-r--r--drivers/irqchip/irqchip.c3
-rw-r--r--drivers/mmc/host/dw_mmc.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c2
-rw-r--r--drivers/pci/host/pcie-designware.c4
-rw-r--r--drivers/ps3/ps3-vuart.c4
-rw-r--r--drivers/s390/char/con3215.c8
-rw-r--r--drivers/s390/char/con3270.c13
-rw-r--r--drivers/s390/char/raw3270.c26
-rw-r--r--drivers/s390/char/raw3270.h3
-rw-r--r--drivers/s390/char/sclp_early.c31
-rw-r--r--drivers/s390/cio/airq.c66
-rw-r--r--drivers/s390/cio/chsc_sch.c3
-rw-r--r--drivers/s390/cio/cio.c12
-rw-r--r--drivers/s390/cio/device.c52
-rw-r--r--drivers/s390/net/qeth_core_main.c4
-rw-r--r--drivers/scsi/atari_scsi.c12
-rw-r--r--drivers/scsi/libsas/sas_ata.c35
-rw-r--r--drivers/staging/fwserial/fwserial.c13
-rw-r--r--drivers/staging/fwserial/fwserial.h1
-rw-r--r--drivers/usb/core/hub.c4
-rw-r--r--drivers/xen/events/events_2l.c15
-rw-r--r--drivers/xen/events/events_base.c25
-rw-r--r--drivers/xen/events/events_fifo.c8
-rw-r--r--fs/afs/internal.h1
-rw-r--r--fs/afs/rxrpc.c12
-rw-r--r--fs/compat.c121
-rw-r--r--fs/compat_binfmt_elf.c5
-rw-r--r--fs/compat_ioctl.c5
-rw-r--r--fs/exec.c6
-rw-r--r--fs/proc/stat.c2
-rw-r--r--fs/proc/uptime.c2
-rw-r--r--fs/read_write.c36
-rw-r--r--fs/timerfd.c1
-rw-r--r--include/asm-generic/cputime_jiffies.h4
-rw-r--r--include/asm-generic/cputime_nsecs.h5
-rw-r--r--include/asm-generic/pgtable.h13
-rw-r--r--include/asm-generic/rwsem.h10
-rw-r--r--include/linux/ahci_platform.h28
-rw-r--r--include/linux/clockchips.h16
-rw-r--r--include/linux/compat.h63
-rw-r--r--include/linux/cputime.h16
-rw-r--r--include/linux/hardirq.h1
-rw-r--r--include/linux/hrtimer.h4
-rw-r--r--include/linux/interrupt.h1
-rw-r--r--include/linux/irq.h9
-rw-r--r--include/linux/kernel_stat.h10
-rw-r--r--include/linux/kexec.h6
-rw-r--r--include/linux/libata.h11
-rw-r--r--include/linux/mm.h10
-rw-r--r--include/linux/nvme.h1
-rw-r--r--include/linux/sched.h8
-rw-r--r--include/linux/syscalls.h2
-rw-r--r--include/linux/workqueue.h40
-rw-r--r--include/scsi/libsas.h1
-rw-r--r--include/uapi/asm-generic/unistd.h1
-rw-r--r--ipc/compat.c13
-rw-r--r--ipc/compat_mq.c32
-rw-r--r--kernel/compat.c100
-rw-r--r--kernel/debug/debug_core.c2
-rw-r--r--kernel/hrtimer.c15
-rw-r--r--kernel/irq/chip.c48
-rw-r--r--kernel/irq/handle.c5
-rw-r--r--kernel/irq/internals.h9
-rw-r--r--kernel/irq/irqdesc.c5
-rw-r--r--kernel/irq/manage.c129
-rw-r--r--kernel/irq/proc.c8
-rw-r--r--kernel/kexec.c8
-rw-r--r--kernel/ptrace.c4
-rw-r--r--kernel/sched/core.c15
-rw-r--r--kernel/sched/cputime.c16
-rw-r--r--kernel/sched/sched.h10
-rw-r--r--kernel/softirq.c1
-rw-r--r--kernel/time/Kconfig2
-rw-r--r--kernel/time/Makefile5
-rw-r--r--kernel/time/clockevents.c40
-rw-r--r--kernel/time/ntp.c5
-rw-r--r--kernel/time/tick-broadcast-hrtimer.c106
-rw-r--r--kernel/time/tick-broadcast.c85
-rw-r--r--kernel/time/tick-common.c16
-rw-r--r--kernel/time/tick-internal.h11
-rw-r--r--kernel/time/timekeeping_debug.c2
-rw-r--r--kernel/timer.c57
-rw-r--r--kernel/workqueue.c7
-rw-r--r--mm/mempolicy.c18
-rw-r--r--mm/mmu_context.c3
-rw-r--r--mm/percpu.c208
-rw-r--r--mm/process_vm_access.c26
-rw-r--r--mm/rmap.c10
-rw-r--r--net/compat.c32
-rw-r--r--net/l2tp/l2tp_core.c2
-rw-r--r--security/keys/compat.c4
415 files changed, 7486 insertions, 4729 deletions
diff --git a/Documentation/arm64/memory.txt b/Documentation/arm64/memory.txt
index 5e054bfe4dde..85e24c4f215c 100644
--- a/Documentation/arm64/memory.txt
+++ b/Documentation/arm64/memory.txt
@@ -35,11 +35,13 @@ ffffffbc00000000 ffffffbdffffffff 8GB vmemmap
35 35
36ffffffbe00000000 ffffffbffbbfffff ~8GB [guard, future vmmemap] 36ffffffbe00000000 ffffffbffbbfffff ~8GB [guard, future vmmemap]
37 37
38ffffffbffbc00000 ffffffbffbdfffff 2MB earlyprintk device 38ffffffbffa000000 ffffffbffaffffff 16MB PCI I/O space
39
40ffffffbffb000000 ffffffbffbbfffff 12MB [guard]
39 41
40ffffffbffbe00000 ffffffbffbe0ffff 64KB PCI I/O space 42ffffffbffbc00000 ffffffbffbdfffff 2MB earlyprintk device
41 43
42ffffffbffbe10000 ffffffbcffffffff ~2MB [guard] 44ffffffbffbe00000 ffffffbffbffffff 2MB [guard]
43 45
44ffffffbffc000000 ffffffbfffffffff 64MB modules 46ffffffbffc000000 ffffffbfffffffff 64MB modules
45 47
@@ -60,11 +62,13 @@ fffffdfc00000000 fffffdfdffffffff 8GB vmemmap
60 62
61fffffdfe00000000 fffffdfffbbfffff ~8GB [guard, future vmmemap] 63fffffdfe00000000 fffffdfffbbfffff ~8GB [guard, future vmmemap]
62 64
63fffffdfffbc00000 fffffdfffbdfffff 2MB earlyprintk device 65fffffdfffa000000 fffffdfffaffffff 16MB PCI I/O space
66
67fffffdfffb000000 fffffdfffbbfffff 12MB [guard]
64 68
65fffffdfffbe00000 fffffdfffbe0ffff 64KB PCI I/O space 69fffffdfffbc00000 fffffdfffbdfffff 2MB earlyprintk device
66 70
67fffffdfffbe10000 fffffdfffbffffff ~2MB [guard] 71fffffdfffbe00000 fffffdfffbffffff 2MB [guard]
68 72
69fffffdfffc000000 fffffdffffffffff 64MB modules 73fffffdfffc000000 fffffdffffffffff 64MB modules
70 74
diff --git a/Documentation/devicetree/bindings/arm/armada-370-xp-mpic.txt b/Documentation/devicetree/bindings/arm/armada-370-xp-mpic.txt
index d74091a8a3bf..5fc03134a999 100644
--- a/Documentation/devicetree/bindings/arm/armada-370-xp-mpic.txt
+++ b/Documentation/devicetree/bindings/arm/armada-370-xp-mpic.txt
@@ -1,4 +1,4 @@
1Marvell Armada 370 and Armada XP Interrupt Controller 1Marvell Armada 370, 375, 38x, XP Interrupt Controller
2----------------------------------------------------- 2-----------------------------------------------------
3 3
4Required properties: 4Required properties:
@@ -16,7 +16,13 @@ Required properties:
16 automatically map to the interrupt controller registers of the 16 automatically map to the interrupt controller registers of the
17 current CPU) 17 current CPU)
18 18
19Optional properties:
19 20
21- interrupts: If defined, then it indicates that this MPIC is
22 connected as a slave to another interrupt controller. This is
23 typically the case on Armada 375 and Armada 38x, where the MPIC is
24 connected as a slave to the Cortex-A9 GIC. The provided interrupt
25 indicate to which GIC interrupt the MPIC output is connected.
20 26
21Example: 27Example:
22 28
diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt
index 89de1564950c..48b285ffa3a6 100644
--- a/Documentation/devicetree/bindings/ata/ahci-platform.txt
+++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt
@@ -4,17 +4,33 @@ SATA nodes are defined to describe on-chip Serial ATA controllers.
4Each SATA controller should have its own node. 4Each SATA controller should have its own node.
5 5
6Required properties: 6Required properties:
7- compatible : compatible list, contains "snps,spear-ahci" 7- compatible : compatible list, one of "snps,spear-ahci",
8 "snps,exynos5440-ahci", "ibm,476gtr-ahci",
9 "allwinner,sun4i-a10-ahci", "fsl,imx53-ahci"
10 "fsl,imx6q-ahci" or "snps,dwc-ahci"
8- interrupts : <interrupt mapping for SATA IRQ> 11- interrupts : <interrupt mapping for SATA IRQ>
9- reg : <registers mapping> 12- reg : <registers mapping>
10 13
11Optional properties: 14Optional properties:
12- dma-coherent : Present if dma operations are coherent 15- dma-coherent : Present if dma operations are coherent
16- clocks : a list of phandle + clock specifier pairs
17- target-supply : regulator for SATA target power
13 18
14Example: 19"fsl,imx53-ahci", "fsl,imx6q-ahci" required properties:
20- clocks : must contain the sata, sata_ref and ahb clocks
21- clock-names : must contain "ahb" for the ahb clock
22
23Examples:
15 sata@ffe08000 { 24 sata@ffe08000 {
16 compatible = "snps,spear-ahci"; 25 compatible = "snps,spear-ahci";
17 reg = <0xffe08000 0x1000>; 26 reg = <0xffe08000 0x1000>;
18 interrupts = <115>; 27 interrupts = <115>;
19
20 }; 28 };
29
30 ahci: sata@01c18000 {
31 compatible = "allwinner,sun4i-a10-ahci";
32 reg = <0x01c18000 0x1000>;
33 interrupts = <56>;
34 clocks = <&pll6 0>, <&ahb_gates 25>;
35 target-supply = <&reg_ahci_5v>;
36 };
diff --git a/Documentation/devicetree/bindings/ata/apm-xgene.txt b/Documentation/devicetree/bindings/ata/apm-xgene.txt
new file mode 100644
index 000000000000..7bcfbf59810e
--- /dev/null
+++ b/Documentation/devicetree/bindings/ata/apm-xgene.txt
@@ -0,0 +1,76 @@
1* APM X-Gene 6.0 Gb/s SATA host controller nodes
2
3SATA host controller nodes are defined to describe on-chip Serial ATA
4controllers. Each SATA controller (pair of ports) have its own node.
5
6Required properties:
7- compatible : Shall contain:
8 * "apm,xgene-ahci"
9- reg : First memory resource shall be the AHCI memory
10 resource.
11 Second memory resource shall be the host controller
12 core memory resource.
13 Third memory resource shall be the host controller
14 diagnostic memory resource.
15 4th memory resource shall be the host controller
16 AXI memory resource.
17 5th optional memory resource shall be the host
18 controller MUX memory resource if required.
19- interrupts : Interrupt-specifier for SATA host controller IRQ.
20- clocks : Reference to the clock entry.
21- phys : A list of phandles + phy-specifiers, one for each
22 entry in phy-names.
23- phy-names : Should contain:
24 * "sata-phy" for the SATA 6.0Gbps PHY
25
26Optional properties:
27- status : Shall be "ok" if enabled or "disabled" if disabled.
28 Default is "ok".
29
30Example:
31 sataclk: sataclk {
32 compatible = "fixed-clock";
33 #clock-cells = <1>;
34 clock-frequency = <100000000>;
35 clock-output-names = "sataclk";
36 };
37
38 phy2: phy@1f22a000 {
39 compatible = "apm,xgene-phy";
40 reg = <0x0 0x1f22a000 0x0 0x100>;
41 #phy-cells = <1>;
42 };
43
44 phy3: phy@1f23a000 {
45 compatible = "apm,xgene-phy";
46 reg = <0x0 0x1f23a000 0x0 0x100>;
47 #phy-cells = <1>;
48 };
49
50 sata2: sata@1a400000 {
51 compatible = "apm,xgene-ahci";
52 reg = <0x0 0x1a400000 0x0 0x1000>,
53 <0x0 0x1f220000 0x0 0x1000>,
54 <0x0 0x1f22d000 0x0 0x1000>,
55 <0x0 0x1f22e000 0x0 0x1000>,
56 <0x0 0x1f227000 0x0 0x1000>;
57 interrupts = <0x0 0x87 0x4>;
58 status = "ok";
59 clocks = <&sataclk 0>;
60 phys = <&phy2 0>;
61 phy-names = "sata-phy";
62 };
63
64 sata3: sata@1a800000 {
65 compatible = "apm,xgene-ahci-pcie";
66 reg = <0x0 0x1a800000 0x0 0x1000>,
67 <0x0 0x1f230000 0x0 0x1000>,
68 <0x0 0x1f23d000 0x0 0x1000>,
69 <0x0 0x1f23e000 0x0 0x1000>,
70 <0x0 0x1f237000 0x0 0x1000>;
71 interrupts = <0x0 0x88 0x4>;
72 status = "ok";
73 clocks = <&sataclk 0>;
74 phys = <&phy3 0>;
75 phy-names = "sata-phy";
76 };
diff --git a/Documentation/devicetree/bindings/interrupt-controller/allwinner,sun4i-ic.txt b/Documentation/devicetree/bindings/interrupt-controller/allwinner,sun4i-ic.txt
index 32cec4b26cd0..b290ca150d30 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/allwinner,sun4i-ic.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/allwinner,sun4i-ic.txt
@@ -2,7 +2,7 @@ Allwinner Sunxi Interrupt Controller
2 2
3Required properties: 3Required properties:
4 4
5- compatible : should be "allwinner,sun4i-ic" 5- compatible : should be "allwinner,sun4i-a10-ic"
6- reg : Specifies base physical address and size of the registers. 6- reg : Specifies base physical address and size of the registers.
7- interrupt-controller : Identifies the node as an interrupt controller 7- interrupt-controller : Identifies the node as an interrupt controller
8- #interrupt-cells : Specifies the number of cells needed to encode an 8- #interrupt-cells : Specifies the number of cells needed to encode an
@@ -11,7 +11,7 @@ Required properties:
11Example: 11Example:
12 12
13intc: interrupt-controller { 13intc: interrupt-controller {
14 compatible = "allwinner,sun4i-ic"; 14 compatible = "allwinner,sun4i-a10-ic";
15 reg = <0x01c20400 0x400>; 15 reg = <0x01c20400 0x400>;
16 interrupt-controller; 16 interrupt-controller;
17 #interrupt-cells = <1>; 17 #interrupt-cells = <1>;
diff --git a/Documentation/devicetree/bindings/interrupt-controller/allwinner,sun67i-sc-nmi.txt b/Documentation/devicetree/bindings/interrupt-controller/allwinner,sun67i-sc-nmi.txt
new file mode 100644
index 000000000000..d1c5cdabc3e0
--- /dev/null
+++ b/Documentation/devicetree/bindings/interrupt-controller/allwinner,sun67i-sc-nmi.txt
@@ -0,0 +1,27 @@
1Allwinner Sunxi NMI Controller
2==============================
3
4Required properties:
5
6- compatible : should be "allwinner,sun7i-a20-sc-nmi" or
7 "allwinner,sun6i-a31-sc-nmi"
8- reg : Specifies base physical address and size of the registers.
9- interrupt-controller : Identifies the node as an interrupt controller
10- #interrupt-cells : Specifies the number of cells needed to encode an
11 interrupt source. The value shall be 2. The first cell is the IRQ number, the
12 second cell the trigger type as defined in interrupt.txt in this directory.
13- interrupt-parent: Specifies the parent interrupt controller.
14- interrupts: Specifies the interrupt line (NMI) which is handled by
15 the interrupt controller in the parent controller's notation. This value
16 shall be the NMI.
17
18Example:
19
20sc-nmi-intc@01c00030 {
21 compatible = "allwinner,sun7i-a20-sc-nmi";
22 interrupt-controller;
23 #interrupt-cells = <2>;
24 reg = <0x01c00030 0x0c>;
25 interrupt-parent = <&gic>;
26 interrupts = <0 0 4>;
27};
diff --git a/Documentation/devicetree/bindings/timer/allwinner,sun4i-timer.txt b/Documentation/devicetree/bindings/timer/allwinner,sun4i-timer.txt
index 48aeb7884ed3..5c2e23574ca0 100644
--- a/Documentation/devicetree/bindings/timer/allwinner,sun4i-timer.txt
+++ b/Documentation/devicetree/bindings/timer/allwinner,sun4i-timer.txt
@@ -2,7 +2,7 @@ Allwinner A1X SoCs Timer Controller
2 2
3Required properties: 3Required properties:
4 4
5- compatible : should be "allwinner,sun4i-timer" 5- compatible : should be "allwinner,sun4i-a10-timer"
6- reg : Specifies base physical address and size of the registers. 6- reg : Specifies base physical address and size of the registers.
7- interrupts : The interrupt of the first timer 7- interrupts : The interrupt of the first timer
8- clocks: phandle to the source clock (usually a 24 MHz fixed clock) 8- clocks: phandle to the source clock (usually a 24 MHz fixed clock)
@@ -10,7 +10,7 @@ Required properties:
10Example: 10Example:
11 11
12timer { 12timer {
13 compatible = "allwinner,sun4i-timer"; 13 compatible = "allwinner,sun4i-a10-timer";
14 reg = <0x01c20c00 0x400>; 14 reg = <0x01c20c00 0x400>;
15 interrupts = <22>; 15 interrupts = <22>;
16 clocks = <&osc>; 16 clocks = <&osc>;
diff --git a/Documentation/devicetree/bindings/timer/ti,keystone-timer.txt b/Documentation/devicetree/bindings/timer/ti,keystone-timer.txt
new file mode 100644
index 000000000000..5fbe361252b4
--- /dev/null
+++ b/Documentation/devicetree/bindings/timer/ti,keystone-timer.txt
@@ -0,0 +1,29 @@
1* Device tree bindings for Texas instruments Keystone timer
2
3This document provides bindings for the 64-bit timer in the KeyStone
4architecture devices. The timer can be configured as a general-purpose 64-bit
5timer, dual general-purpose 32-bit timers. When configured as dual 32-bit
6timers, each half can operate in conjunction (chain mode) or independently
7(unchained mode) of each other.
8
9It is global timer is a free running up-counter and can generate interrupt
10when the counter reaches preset counter values.
11
12Documentation:
13http://www.ti.com/lit/ug/sprugv5a/sprugv5a.pdf
14
15Required properties:
16
17- compatible : should be "ti,keystone-timer".
18- reg : specifies base physical address and count of the registers.
19- interrupts : interrupt generated by the timer.
20- clocks : the clock feeding the timer clock.
21
22Example:
23
24timer@22f0000 {
25 compatible = "ti,keystone-timer";
26 reg = <0x022f0000 0x80>;
27 interrupts = <GIC_SPI 110 IRQ_TYPE_EDGE_RISING>;
28 clocks = <&clktimer15>;
29};
diff --git a/MAINTAINERS b/MAINTAINERS
index 900d98eec2fc..d1f3cb340e01 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1320,6 +1320,7 @@ M: Linus Walleij <linus.walleij@linaro.org>
1320L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1320L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1321S: Supported 1321S: Supported
1322F: arch/arm/mach-u300/ 1322F: arch/arm/mach-u300/
1323F: drivers/clocksource/timer-u300.c
1323F: drivers/i2c/busses/i2c-stu300.c 1324F: drivers/i2c/busses/i2c-stu300.c
1324F: drivers/rtc/rtc-coh901331.c 1325F: drivers/rtc/rtc-coh901331.c
1325F: drivers/watchdog/coh901327_wdt.c 1326F: drivers/watchdog/coh901327_wdt.c
@@ -7405,10 +7406,26 @@ W: http://www.ibm.com/developerworks/linux/linux390/
7405S: Supported 7406S: Supported
7406F: arch/s390/ 7407F: arch/s390/
7407F: drivers/s390/ 7408F: drivers/s390/
7408F: block/partitions/ibm.c
7409F: Documentation/s390/ 7409F: Documentation/s390/
7410F: Documentation/DocBook/s390* 7410F: Documentation/DocBook/s390*
7411 7411
7412S390 COMMON I/O LAYER
7413M: Sebastian Ott <sebott@linux.vnet.ibm.com>
7414M: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
7415L: linux-s390@vger.kernel.org
7416W: http://www.ibm.com/developerworks/linux/linux390/
7417S: Supported
7418F: drivers/s390/cio/
7419
7420S390 DASD DRIVER
7421M: Stefan Weinhuber <wein@de.ibm.com>
7422M: Stefan Haberland <stefan.haberland@de.ibm.com>
7423L: linux-s390@vger.kernel.org
7424W: http://www.ibm.com/developerworks/linux/linux390/
7425S: Supported
7426F: drivers/s390/block/dasd*
7427F: block/partitions/ibm.c
7428
7412S390 NETWORK DRIVERS 7429S390 NETWORK DRIVERS
7413M: Ursula Braun <ursula.braun@de.ibm.com> 7430M: Ursula Braun <ursula.braun@de.ibm.com>
7414M: Frank Blaschka <blaschka@linux.vnet.ibm.com> 7431M: Frank Blaschka <blaschka@linux.vnet.ibm.com>
@@ -7418,6 +7435,15 @@ W: http://www.ibm.com/developerworks/linux/linux390/
7418S: Supported 7435S: Supported
7419F: drivers/s390/net/ 7436F: drivers/s390/net/
7420 7437
7438S390 PCI SUBSYSTEM
7439M: Sebastian Ott <sebott@linux.vnet.ibm.com>
7440M: Gerald Schaefer <gerald.schaefer@de.ibm.com>
7441L: linux-s390@vger.kernel.org
7442W: http://www.ibm.com/developerworks/linux/linux390/
7443S: Supported
7444F: arch/s390/pci/
7445F: drivers/pci/hotplug/s390_pci_hpc.c
7446
7421S390 ZCRYPT DRIVER 7447S390 ZCRYPT DRIVER
7422M: Ingo Tuchscherer <ingo.tuchscherer@de.ibm.com> 7448M: Ingo Tuchscherer <ingo.tuchscherer@de.ibm.com>
7423M: linux390@de.ibm.com 7449M: linux390@de.ibm.com
diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
index 7736f426ff3b..96e54bed5088 100644
--- a/arch/alpha/include/asm/Kbuild
+++ b/arch/alpha/include/asm/Kbuild
@@ -1,6 +1,7 @@
1 1
2 2
3generic-y += clkdev.h 3generic-y += clkdev.h
4generic-y += cputime.h
4generic-y += exec.h 5generic-y += exec.h
5generic-y += hash.h 6generic-y += hash.h
6generic-y += mcs_spinlock.h 7generic-y += mcs_spinlock.h
diff --git a/arch/alpha/include/asm/cputime.h b/arch/alpha/include/asm/cputime.h
deleted file mode 100644
index 19577fd93230..000000000000
--- a/arch/alpha/include/asm/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ALPHA_CPUTIME_H
2#define __ALPHA_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __ALPHA_CPUTIME_H */
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index d4d2763f4794..249b6e0ba737 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -331,7 +331,7 @@
331 }; 331 };
332 332
333 intc: interrupt-controller@01c20400 { 333 intc: interrupt-controller@01c20400 {
334 compatible = "allwinner,sun4i-ic"; 334 compatible = "allwinner,sun4i-a10-ic";
335 reg = <0x01c20400 0x400>; 335 reg = <0x01c20400 0x400>;
336 interrupt-controller; 336 interrupt-controller;
337 #interrupt-cells = <1>; 337 #interrupt-cells = <1>;
@@ -403,7 +403,7 @@
403 }; 403 };
404 404
405 timer@01c20c00 { 405 timer@01c20c00 {
406 compatible = "allwinner,sun4i-timer"; 406 compatible = "allwinner,sun4i-a10-timer";
407 reg = <0x01c20c00 0x90>; 407 reg = <0x01c20c00 0x90>;
408 interrupts = <22>; 408 interrupts = <22>;
409 clocks = <&osc24M>; 409 clocks = <&osc24M>;
diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi
index 79fd412005b0..ddb25452d78e 100644
--- a/arch/arm/boot/dts/sun5i-a10s.dtsi
+++ b/arch/arm/boot/dts/sun5i-a10s.dtsi
@@ -294,7 +294,7 @@
294 }; 294 };
295 295
296 intc: interrupt-controller@01c20400 { 296 intc: interrupt-controller@01c20400 {
297 compatible = "allwinner,sun4i-ic"; 297 compatible = "allwinner,sun4i-a10-ic";
298 reg = <0x01c20400 0x400>; 298 reg = <0x01c20400 0x400>;
299 interrupt-controller; 299 interrupt-controller;
300 #interrupt-cells = <1>; 300 #interrupt-cells = <1>;
@@ -366,7 +366,7 @@
366 }; 366 };
367 367
368 timer@01c20c00 { 368 timer@01c20c00 {
369 compatible = "allwinner,sun4i-timer"; 369 compatible = "allwinner,sun4i-a10-timer";
370 reg = <0x01c20c00 0x90>; 370 reg = <0x01c20c00 0x90>;
371 interrupts = <22>; 371 interrupts = <22>;
372 clocks = <&osc24M>; 372 clocks = <&osc24M>;
diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi
index c463fd730c91..b373c74a9b3d 100644
--- a/arch/arm/boot/dts/sun5i-a13.dtsi
+++ b/arch/arm/boot/dts/sun5i-a13.dtsi
@@ -275,7 +275,7 @@
275 ranges; 275 ranges;
276 276
277 intc: interrupt-controller@01c20400 { 277 intc: interrupt-controller@01c20400 {
278 compatible = "allwinner,sun4i-ic"; 278 compatible = "allwinner,sun4i-a10-ic";
279 reg = <0x01c20400 0x400>; 279 reg = <0x01c20400 0x400>;
280 interrupt-controller; 280 interrupt-controller;
281 #interrupt-cells = <1>; 281 #interrupt-cells = <1>;
@@ -329,7 +329,7 @@
329 }; 329 };
330 330
331 timer@01c20c00 { 331 timer@01c20c00 {
332 compatible = "allwinner,sun4i-timer"; 332 compatible = "allwinner,sun4i-a10-timer";
333 reg = <0x01c20c00 0x90>; 333 reg = <0x01c20c00 0x90>;
334 interrupts = <22>; 334 interrupts = <22>;
335 clocks = <&osc24M>; 335 clocks = <&osc24M>;
diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi
index 5256ad9be52c..38d43febda4c 100644
--- a/arch/arm/boot/dts/sun6i-a31.dtsi
+++ b/arch/arm/boot/dts/sun6i-a31.dtsi
@@ -190,6 +190,14 @@
190 #size-cells = <1>; 190 #size-cells = <1>;
191 ranges; 191 ranges;
192 192
193 nmi_intc: interrupt-controller@01f00c0c {
194 compatible = "allwinner,sun6i-a31-sc-nmi";
195 interrupt-controller;
196 #interrupt-cells = <2>;
197 reg = <0x01f00c0c 0x38>;
198 interrupts = <0 32 4>;
199 };
200
193 pio: pinctrl@01c20800 { 201 pio: pinctrl@01c20800 {
194 compatible = "allwinner,sun6i-a31-pinctrl"; 202 compatible = "allwinner,sun6i-a31-pinctrl";
195 reg = <0x01c20800 0x400>; 203 reg = <0x01c20800 0x400>;
@@ -231,7 +239,7 @@
231 }; 239 };
232 240
233 timer@01c20c00 { 241 timer@01c20c00 {
234 compatible = "allwinner,sun4i-timer"; 242 compatible = "allwinner,sun4i-a10-timer";
235 reg = <0x01c20c00 0xa0>; 243 reg = <0x01c20c00 0xa0>;
236 interrupts = <0 18 4>, 244 interrupts = <0 18 4>,
237 <0 19 4>, 245 <0 19 4>,
diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi
index 6f25cf559ad0..cadcf2f9881d 100644
--- a/arch/arm/boot/dts/sun7i-a20.dtsi
+++ b/arch/arm/boot/dts/sun7i-a20.dtsi
@@ -339,6 +339,14 @@
339 #size-cells = <1>; 339 #size-cells = <1>;
340 ranges; 340 ranges;
341 341
342 nmi_intc: interrupt-controller@01c00030 {
343 compatible = "allwinner,sun7i-a20-sc-nmi";
344 interrupt-controller;
345 #interrupt-cells = <2>;
346 reg = <0x01c00030 0x0c>;
347 interrupts = <0 0 4>;
348 };
349
342 emac: ethernet@01c0b000 { 350 emac: ethernet@01c0b000 {
343 compatible = "allwinner,sun4i-a10-emac"; 351 compatible = "allwinner,sun4i-a10-emac";
344 reg = <0x01c0b000 0x1000>; 352 reg = <0x01c0b000 0x1000>;
@@ -435,7 +443,7 @@
435 }; 443 };
436 444
437 timer@01c20c00 { 445 timer@01c20c00 {
438 compatible = "allwinner,sun4i-timer"; 446 compatible = "allwinner,sun4i-a10-timer";
439 reg = <0x01c20c00 0x90>; 447 reg = <0x01c20c00 0x90>;
440 interrupts = <0 22 4>, 448 interrupts = <0 22 4>,
441 <0 23 4>, 449 <0 23 4>,
diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi
index 8b67b19392ec..789d0bacc110 100644
--- a/arch/arm/boot/dts/zynq-7000.dtsi
+++ b/arch/arm/boot/dts/zynq-7000.dtsi
@@ -24,6 +24,12 @@
24 device_type = "cpu"; 24 device_type = "cpu";
25 reg = <0>; 25 reg = <0>;
26 clocks = <&clkc 3>; 26 clocks = <&clkc 3>;
27 operating-points = <
28 /* kHz uV */
29 666667 1000000
30 333334 1000000
31 222223 1000000
32 >;
27 }; 33 };
28 34
29 cpu@1 { 35 cpu@1 {
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 2ab00434b2eb..85399c98f84a 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -472,7 +472,7 @@ static struct clk_lookup da850_clks[] = {
472 CLK("spi_davinci.0", NULL, &spi0_clk), 472 CLK("spi_davinci.0", NULL, &spi0_clk),
473 CLK("spi_davinci.1", NULL, &spi1_clk), 473 CLK("spi_davinci.1", NULL, &spi1_clk),
474 CLK("vpif", NULL, &vpif_clk), 474 CLK("vpif", NULL, &vpif_clk),
475 CLK("ahci", NULL, &sata_clk), 475 CLK("ahci_da850", NULL, &sata_clk),
476 CLK("davinci-rproc.0", NULL, &dsp_clk), 476 CLK("davinci-rproc.0", NULL, &dsp_clk),
477 CLK("ehrpwm", "fck", &ehrpwm_clk), 477 CLK("ehrpwm", "fck", &ehrpwm_clk),
478 CLK("ehrpwm", "tbclk", &ehrpwm_tbclk), 478 CLK("ehrpwm", "tbclk", &ehrpwm_tbclk),
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 0486cdf28c8d..56ea41d5f849 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -1020,7 +1020,6 @@ int __init da8xx_register_spi_bus(int instance, unsigned num_chipselect)
1020} 1020}
1021 1021
1022#ifdef CONFIG_ARCH_DAVINCI_DA850 1022#ifdef CONFIG_ARCH_DAVINCI_DA850
1023
1024static struct resource da850_sata_resources[] = { 1023static struct resource da850_sata_resources[] = {
1025 { 1024 {
1026 .start = DA850_SATA_BASE, 1025 .start = DA850_SATA_BASE,
@@ -1028,103 +1027,22 @@ static struct resource da850_sata_resources[] = {
1028 .flags = IORESOURCE_MEM, 1027 .flags = IORESOURCE_MEM,
1029 }, 1028 },
1030 { 1029 {
1030 .start = DA8XX_SYSCFG1_BASE + DA8XX_PWRDN_REG,
1031 .end = DA8XX_SYSCFG1_BASE + DA8XX_PWRDN_REG + 0x3,
1032 .flags = IORESOURCE_MEM,
1033 },
1034 {
1031 .start = IRQ_DA850_SATAINT, 1035 .start = IRQ_DA850_SATAINT,
1032 .flags = IORESOURCE_IRQ, 1036 .flags = IORESOURCE_IRQ,
1033 }, 1037 },
1034}; 1038};
1035 1039
1036/* SATA PHY Control Register offset from AHCI base */
1037#define SATA_P0PHYCR_REG 0x178
1038
1039#define SATA_PHY_MPY(x) ((x) << 0)
1040#define SATA_PHY_LOS(x) ((x) << 6)
1041#define SATA_PHY_RXCDR(x) ((x) << 10)
1042#define SATA_PHY_RXEQ(x) ((x) << 13)
1043#define SATA_PHY_TXSWING(x) ((x) << 19)
1044#define SATA_PHY_ENPLL(x) ((x) << 31)
1045
1046static struct clk *da850_sata_clk;
1047static unsigned long da850_sata_refclkpn;
1048
1049/* Supported DA850 SATA crystal frequencies */
1050#define KHZ_TO_HZ(freq) ((freq) * 1000)
1051static unsigned long da850_sata_xtal[] = {
1052 KHZ_TO_HZ(300000),
1053 KHZ_TO_HZ(250000),
1054 0, /* Reserved */
1055 KHZ_TO_HZ(187500),
1056 KHZ_TO_HZ(150000),
1057 KHZ_TO_HZ(125000),
1058 KHZ_TO_HZ(120000),
1059 KHZ_TO_HZ(100000),
1060 KHZ_TO_HZ(75000),
1061 KHZ_TO_HZ(60000),
1062};
1063
1064static int da850_sata_init(struct device *dev, void __iomem *addr)
1065{
1066 int i, ret;
1067 unsigned int val;
1068
1069 da850_sata_clk = clk_get(dev, NULL);
1070 if (IS_ERR(da850_sata_clk))
1071 return PTR_ERR(da850_sata_clk);
1072
1073 ret = clk_prepare_enable(da850_sata_clk);
1074 if (ret)
1075 goto err0;
1076
1077 /* Enable SATA clock receiver */
1078 val = __raw_readl(DA8XX_SYSCFG1_VIRT(DA8XX_PWRDN_REG));
1079 val &= ~BIT(0);
1080 __raw_writel(val, DA8XX_SYSCFG1_VIRT(DA8XX_PWRDN_REG));
1081
1082 /* Get the multiplier needed for 1.5GHz PLL output */
1083 for (i = 0; i < ARRAY_SIZE(da850_sata_xtal); i++)
1084 if (da850_sata_xtal[i] == da850_sata_refclkpn)
1085 break;
1086
1087 if (i == ARRAY_SIZE(da850_sata_xtal)) {
1088 ret = -EINVAL;
1089 goto err1;
1090 }
1091
1092 val = SATA_PHY_MPY(i + 1) |
1093 SATA_PHY_LOS(1) |
1094 SATA_PHY_RXCDR(4) |
1095 SATA_PHY_RXEQ(1) |
1096 SATA_PHY_TXSWING(3) |
1097 SATA_PHY_ENPLL(1);
1098
1099 __raw_writel(val, addr + SATA_P0PHYCR_REG);
1100
1101 return 0;
1102
1103err1:
1104 clk_disable_unprepare(da850_sata_clk);
1105err0:
1106 clk_put(da850_sata_clk);
1107 return ret;
1108}
1109
1110static void da850_sata_exit(struct device *dev)
1111{
1112 clk_disable_unprepare(da850_sata_clk);
1113 clk_put(da850_sata_clk);
1114}
1115
1116static struct ahci_platform_data da850_sata_pdata = {
1117 .init = da850_sata_init,
1118 .exit = da850_sata_exit,
1119};
1120
1121static u64 da850_sata_dmamask = DMA_BIT_MASK(32); 1040static u64 da850_sata_dmamask = DMA_BIT_MASK(32);
1122 1041
1123static struct platform_device da850_sata_device = { 1042static struct platform_device da850_sata_device = {
1124 .name = "ahci", 1043 .name = "ahci_da850",
1125 .id = -1, 1044 .id = -1,
1126 .dev = { 1045 .dev = {
1127 .platform_data = &da850_sata_pdata,
1128 .dma_mask = &da850_sata_dmamask, 1046 .dma_mask = &da850_sata_dmamask,
1129 .coherent_dma_mask = DMA_BIT_MASK(32), 1047 .coherent_dma_mask = DMA_BIT_MASK(32),
1130 }, 1048 },
@@ -1134,9 +1052,8 @@ static struct platform_device da850_sata_device = {
1134 1052
1135int __init da850_register_sata(unsigned long refclkpn) 1053int __init da850_register_sata(unsigned long refclkpn)
1136{ 1054{
1137 da850_sata_refclkpn = refclkpn; 1055 /* please see comment in drivers/ata/ahci_da850.c */
1138 if (!da850_sata_refclkpn) 1056 BUG_ON(refclkpn != 100 * 1000 * 1000);
1139 return -EINVAL;
1140 1057
1141 return platform_device_register(&da850_sata_device); 1058 return platform_device_register(&da850_sata_device);
1142} 1059}
diff --git a/arch/arm/mach-imx/pm-imx6q.c b/arch/arm/mach-imx/pm-imx6q.c
index 7a9b98589db7..29e3fe6a6669 100644
--- a/arch/arm/mach-imx/pm-imx6q.c
+++ b/arch/arm/mach-imx/pm-imx6q.c
@@ -120,7 +120,7 @@ static void imx6q_enable_wb(bool enable)
120 120
121int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode) 121int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
122{ 122{
123 struct irq_desc *iomuxc_irq_desc; 123 struct irq_data *iomuxc_irq_data = irq_get_irq_data(32);
124 u32 val = readl_relaxed(ccm_base + CLPCR); 124 u32 val = readl_relaxed(ccm_base + CLPCR);
125 125
126 val &= ~BM_CLPCR_LPM; 126 val &= ~BM_CLPCR_LPM;
@@ -167,10 +167,9 @@ int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
167 * 3) Software should mask IRQ #32 right after CCM Low-Power mode 167 * 3) Software should mask IRQ #32 right after CCM Low-Power mode
168 * is set (set bits 0-1 of CCM_CLPCR). 168 * is set (set bits 0-1 of CCM_CLPCR).
169 */ 169 */
170 iomuxc_irq_desc = irq_to_desc(32); 170 imx_gpc_irq_unmask(iomuxc_irq_data);
171 imx_gpc_irq_unmask(&iomuxc_irq_desc->irq_data);
172 writel_relaxed(val, ccm_base + CLPCR); 171 writel_relaxed(val, ccm_base + CLPCR);
173 imx_gpc_irq_mask(&iomuxc_irq_desc->irq_data); 172 imx_gpc_irq_mask(iomuxc_irq_data);
174 173
175 return 0; 174 return 0;
176} 175}
diff --git a/arch/arm/mach-mmp/pm-mmp2.c b/arch/arm/mach-mmp/pm-mmp2.c
index 461a191a32d2..43b1a516957f 100644
--- a/arch/arm/mach-mmp/pm-mmp2.c
+++ b/arch/arm/mach-mmp/pm-mmp2.c
@@ -27,22 +27,8 @@
27 27
28int mmp2_set_wake(struct irq_data *d, unsigned int on) 28int mmp2_set_wake(struct irq_data *d, unsigned int on)
29{ 29{
30 int irq = d->irq;
31 struct irq_desc *desc = irq_to_desc(irq);
32 unsigned long data = 0; 30 unsigned long data = 0;
33 31 int irq = d->irq;
34 if (unlikely(irq >= nr_irqs)) {
35 pr_err("IRQ nubmers are out of boundary!\n");
36 return -EINVAL;
37 }
38
39 if (on) {
40 if (desc->action)
41 desc->action->flags |= IRQF_NO_SUSPEND;
42 } else {
43 if (desc->action)
44 desc->action->flags &= ~IRQF_NO_SUSPEND;
45 }
46 32
47 /* enable wakeup sources */ 33 /* enable wakeup sources */
48 switch (irq) { 34 switch (irq) {
diff --git a/arch/arm/mach-mmp/pm-pxa910.c b/arch/arm/mach-mmp/pm-pxa910.c
index 48981ca801a5..04c9daf9f8d7 100644
--- a/arch/arm/mach-mmp/pm-pxa910.c
+++ b/arch/arm/mach-mmp/pm-pxa910.c
@@ -27,22 +27,8 @@
27 27
28int pxa910_set_wake(struct irq_data *data, unsigned int on) 28int pxa910_set_wake(struct irq_data *data, unsigned int on)
29{ 29{
30 int irq = data->irq;
31 struct irq_desc *desc = irq_to_desc(data->irq);
32 uint32_t awucrm = 0, apcr = 0; 30 uint32_t awucrm = 0, apcr = 0;
33 31 int irq = data->irq;
34 if (unlikely(irq >= nr_irqs)) {
35 pr_err("IRQ nubmers are out of boundary!\n");
36 return -EINVAL;
37 }
38
39 if (on) {
40 if (desc->action)
41 desc->action->flags |= IRQF_NO_SUSPEND;
42 } else {
43 if (desc->action)
44 desc->action->flags &= ~IRQF_NO_SUSPEND;
45 }
46 32
47 /* setting wakeup sources */ 33 /* setting wakeup sources */
48 switch (irq) { 34 switch (irq) {
@@ -115,9 +101,11 @@ int pxa910_set_wake(struct irq_data *data, unsigned int on)
115 if (irq >= IRQ_GPIO_START && irq < IRQ_BOARD_START) { 101 if (irq >= IRQ_GPIO_START && irq < IRQ_BOARD_START) {
116 awucrm = MPMU_AWUCRM_WAKEUP(2); 102 awucrm = MPMU_AWUCRM_WAKEUP(2);
117 apcr |= MPMU_APCR_SLPWP2; 103 apcr |= MPMU_APCR_SLPWP2;
118 } else 104 } else {
105 /* FIXME: This should return a proper error code ! */
119 printk(KERN_ERR "Error: no defined wake up source irq: %d\n", 106 printk(KERN_ERR "Error: no defined wake up source irq: %d\n",
120 irq); 107 irq);
108 }
121 } 109 }
122 110
123 if (on) { 111 if (on) {
diff --git a/arch/arm/mach-omap1/ams-delta-fiq.c b/arch/arm/mach-omap1/ams-delta-fiq.c
index f12a12af3523..d1f12095f315 100644
--- a/arch/arm/mach-omap1/ams-delta-fiq.c
+++ b/arch/arm/mach-omap1/ams-delta-fiq.c
@@ -44,13 +44,10 @@ static unsigned int irq_counter[16];
44 44
45static irqreturn_t deferred_fiq(int irq, void *dev_id) 45static irqreturn_t deferred_fiq(int irq, void *dev_id)
46{ 46{
47 struct irq_desc *irq_desc;
48 struct irq_chip *irq_chip = NULL;
49 int gpio, irq_num, fiq_count; 47 int gpio, irq_num, fiq_count;
48 struct irq_chip *irq_chip;
50 49
51 irq_desc = irq_to_desc(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK)); 50 irq_chip = irq_get_chip(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK));
52 if (irq_desc)
53 irq_chip = irq_desc->irq_data.chip;
54 51
55 /* 52 /*
56 * For each handled GPIO interrupt, keep calling its interrupt handler 53 * For each handled GPIO interrupt, keep calling its interrupt handler
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 05fa505df585..f6db7dcae3f4 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -24,17 +24,21 @@ comment "Renesas ARM SoCs System Type"
24 24
25config ARCH_EMEV2 25config ARCH_EMEV2
26 bool "Emma Mobile EV2" 26 bool "Emma Mobile EV2"
27 select SYS_SUPPORTS_EM_STI
27 28
28config ARCH_R7S72100 29config ARCH_R7S72100
29 bool "RZ/A1H (R7S72100)" 30 bool "RZ/A1H (R7S72100)"
31 select SYS_SUPPORTS_SH_MTU2
30 32
31config ARCH_R8A7790 33config ARCH_R8A7790
32 bool "R-Car H2 (R8A77900)" 34 bool "R-Car H2 (R8A77900)"
33 select RENESAS_IRQC 35 select RENESAS_IRQC
36 select SYS_SUPPORTS_SH_CMT
34 37
35config ARCH_R8A7791 38config ARCH_R8A7791
36 bool "R-Car M2 (R8A77910)" 39 bool "R-Car M2 (R8A77910)"
37 select RENESAS_IRQC 40 select RENESAS_IRQC
41 select SYS_SUPPORTS_SH_CMT
38 42
39comment "Renesas ARM SoCs Board Type" 43comment "Renesas ARM SoCs Board Type"
40 44
@@ -68,6 +72,8 @@ config ARCH_SH7372
68 select ARM_CPU_SUSPEND if PM || CPU_IDLE 72 select ARM_CPU_SUSPEND if PM || CPU_IDLE
69 select CPU_V7 73 select CPU_V7
70 select SH_CLK_CPG 74 select SH_CLK_CPG
75 select SYS_SUPPORTS_SH_CMT
76 select SYS_SUPPORTS_SH_TMU
71 77
72config ARCH_SH73A0 78config ARCH_SH73A0
73 bool "SH-Mobile AG5 (R8A73A00)" 79 bool "SH-Mobile AG5 (R8A73A00)"
@@ -77,6 +83,8 @@ config ARCH_SH73A0
77 select I2C 83 select I2C
78 select SH_CLK_CPG 84 select SH_CLK_CPG
79 select RENESAS_INTC_IRQPIN 85 select RENESAS_INTC_IRQPIN
86 select SYS_SUPPORTS_SH_CMT
87 select SYS_SUPPORTS_SH_TMU
80 88
81config ARCH_R8A73A4 89config ARCH_R8A73A4
82 bool "R-Mobile APE6 (R8A73A40)" 90 bool "R-Mobile APE6 (R8A73A40)"
@@ -87,6 +95,8 @@ config ARCH_R8A73A4
87 select RENESAS_IRQC 95 select RENESAS_IRQC
88 select ARCH_HAS_CPUFREQ 96 select ARCH_HAS_CPUFREQ
89 select ARCH_HAS_OPP 97 select ARCH_HAS_OPP
98 select SYS_SUPPORTS_SH_CMT
99 select SYS_SUPPORTS_SH_TMU
90 100
91config ARCH_R8A7740 101config ARCH_R8A7740
92 bool "R-Mobile A1 (R8A77400)" 102 bool "R-Mobile A1 (R8A77400)"
@@ -95,6 +105,8 @@ config ARCH_R8A7740
95 select CPU_V7 105 select CPU_V7
96 select SH_CLK_CPG 106 select SH_CLK_CPG
97 select RENESAS_INTC_IRQPIN 107 select RENESAS_INTC_IRQPIN
108 select SYS_SUPPORTS_SH_CMT
109 select SYS_SUPPORTS_SH_TMU
98 110
99config ARCH_R8A7778 111config ARCH_R8A7778
100 bool "R-Car M1A (R8A77781)" 112 bool "R-Car M1A (R8A77781)"
@@ -104,6 +116,7 @@ config ARCH_R8A7778
104 select ARM_GIC 116 select ARM_GIC
105 select USB_ARCH_HAS_EHCI 117 select USB_ARCH_HAS_EHCI
106 select USB_ARCH_HAS_OHCI 118 select USB_ARCH_HAS_OHCI
119 select SYS_SUPPORTS_SH_TMU
107 120
108config ARCH_R8A7779 121config ARCH_R8A7779
109 bool "R-Car H1 (R8A77790)" 122 bool "R-Car H1 (R8A77790)"
@@ -114,6 +127,7 @@ config ARCH_R8A7779
114 select USB_ARCH_HAS_EHCI 127 select USB_ARCH_HAS_EHCI
115 select USB_ARCH_HAS_OHCI 128 select USB_ARCH_HAS_OHCI
116 select RENESAS_INTC_IRQPIN 129 select RENESAS_INTC_IRQPIN
130 select SYS_SUPPORTS_SH_TMU
117 131
118config ARCH_R8A7790 132config ARCH_R8A7790
119 bool "R-Car H2 (R8A77900)" 133 bool "R-Car H2 (R8A77900)"
@@ -123,6 +137,7 @@ config ARCH_R8A7790
123 select MIGHT_HAVE_PCI 137 select MIGHT_HAVE_PCI
124 select SH_CLK_CPG 138 select SH_CLK_CPG
125 select RENESAS_IRQC 139 select RENESAS_IRQC
140 select SYS_SUPPORTS_SH_CMT
126 141
127config ARCH_R8A7791 142config ARCH_R8A7791
128 bool "R-Car M2 (R8A77910)" 143 bool "R-Car M2 (R8A77910)"
@@ -132,6 +147,7 @@ config ARCH_R8A7791
132 select MIGHT_HAVE_PCI 147 select MIGHT_HAVE_PCI
133 select SH_CLK_CPG 148 select SH_CLK_CPG
134 select RENESAS_IRQC 149 select RENESAS_IRQC
150 select SYS_SUPPORTS_SH_CMT
135 151
136config ARCH_EMEV2 152config ARCH_EMEV2
137 bool "Emma Mobile EV2" 153 bool "Emma Mobile EV2"
@@ -141,6 +157,7 @@ config ARCH_EMEV2
141 select MIGHT_HAVE_PCI 157 select MIGHT_HAVE_PCI
142 select USE_OF 158 select USE_OF
143 select AUTO_ZRELADDR 159 select AUTO_ZRELADDR
160 select SYS_SUPPORTS_EM_STI
144 161
145config ARCH_R7S72100 162config ARCH_R7S72100
146 bool "RZ/A1H (R7S72100)" 163 bool "RZ/A1H (R7S72100)"
@@ -148,6 +165,7 @@ config ARCH_R7S72100
148 select ARM_GIC 165 select ARM_GIC
149 select CPU_V7 166 select CPU_V7
150 select SH_CLK_CPG 167 select SH_CLK_CPG
168 select SYS_SUPPORTS_SH_MTU2
151 169
152comment "Renesas ARM SoCs Board Type" 170comment "Renesas ARM SoCs Board Type"
153 171
@@ -321,24 +339,6 @@ config SHMOBILE_TIMER_HZ
321 want to select a HZ value such as 128 that can evenly divide RCLK. 339 want to select a HZ value such as 128 that can evenly divide RCLK.
322 A HZ value that does not divide evenly may cause timer drift. 340 A HZ value that does not divide evenly may cause timer drift.
323 341
324config SH_TIMER_CMT
325 bool "CMT timer driver"
326 default y
327 help
328 This enables build of the CMT timer driver.
329
330config SH_TIMER_TMU
331 bool "TMU timer driver"
332 default y
333 help
334 This enables build of the TMU timer driver.
335
336config EM_TIMER_STI
337 bool "STI timer driver"
338 default y
339 help
340 This enables build of the STI timer driver.
341
342endmenu 342endmenu
343 343
344endif 344endif
diff --git a/arch/arm/mach-u300/Makefile b/arch/arm/mach-u300/Makefile
index 0f362b64fb87..3ec74ac95bc1 100644
--- a/arch/arm/mach-u300/Makefile
+++ b/arch/arm/mach-u300/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the linux kernel, U300 machine. 2# Makefile for the linux kernel, U300 machine.
3# 3#
4 4
5obj-y := core.o timer.o 5obj-y := core.o
6obj-m := 6obj-m :=
7obj-n := 7obj-n :=
8obj- := 8obj- :=
diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig
index 6b04260aa142..f03e75bd0b2b 100644
--- a/arch/arm/mach-zynq/Kconfig
+++ b/arch/arm/mach-zynq/Kconfig
@@ -2,6 +2,8 @@ config ARCH_ZYNQ
2 bool "Xilinx Zynq ARM Cortex A9 Platform" if ARCH_MULTI_V7 2 bool "Xilinx Zynq ARM Cortex A9 Platform" if ARCH_MULTI_V7
3 select ARM_AMBA 3 select ARM_AMBA
4 select ARM_GIC 4 select ARM_GIC
5 select ARCH_HAS_CPUFREQ
6 select ARCH_HAS_OPP
5 select COMMON_CLK 7 select COMMON_CLK
6 select CPU_V7 8 select CPU_V7
7 select GENERIC_CLOCKEVENTS 9 select GENERIC_CLOCKEVENTS
@@ -13,6 +15,6 @@ config ARCH_ZYNQ
13 select HAVE_SMP 15 select HAVE_SMP
14 select SPARSE_IRQ 16 select SPARSE_IRQ
15 select CADENCE_TTC_TIMER 17 select CADENCE_TTC_TIMER
16 select ARM_GLOBAL_TIMER 18 select ARM_GLOBAL_TIMER if !CPU_FREQ
17 help 19 help
18 Support for Xilinx Zynq ARM Cortex A9 Platform 20 Support for Xilinx Zynq ARM Cortex A9 Platform
diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c
index 8c09a8393fb6..a39be8e80856 100644
--- a/arch/arm/mach-zynq/common.c
+++ b/arch/arm/mach-zynq/common.c
@@ -64,6 +64,8 @@ static struct platform_device zynq_cpuidle_device = {
64 */ 64 */
65static void __init zynq_init_machine(void) 65static void __init zynq_init_machine(void)
66{ 66{
67 struct platform_device_info devinfo = { .name = "cpufreq-cpu0", };
68
67 /* 69 /*
68 * 64KB way size, 8-way associativity, parity disabled 70 * 64KB way size, 8-way associativity, parity disabled
69 */ 71 */
@@ -72,6 +74,7 @@ static void __init zynq_init_machine(void)
72 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 74 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
73 75
74 platform_device_register(&zynq_cpuidle_device); 76 platform_device_register(&zynq_cpuidle_device);
77 platform_device_register_full(&devinfo);
75} 78}
76 79
77static void __init zynq_timer_init(void) 80static void __init zynq_timer_init(void)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 27bbcfc7202a..516d8a7ca697 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -16,6 +16,7 @@ config ARM64
16 select DCACHE_WORD_ACCESS 16 select DCACHE_WORD_ACCESS
17 select GENERIC_CLOCKEVENTS 17 select GENERIC_CLOCKEVENTS
18 select GENERIC_CLOCKEVENTS_BROADCAST if SMP 18 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
19 select GENERIC_CPU_AUTOPROBE
19 select GENERIC_IOMAP 20 select GENERIC_IOMAP
20 select GENERIC_IRQ_PROBE 21 select GENERIC_IRQ_PROBE
21 select GENERIC_IRQ_SHOW 22 select GENERIC_IRQ_SHOW
@@ -26,6 +27,7 @@ config ARM64
26 select GENERIC_TIME_VSYSCALL 27 select GENERIC_TIME_VSYSCALL
27 select HARDIRQS_SW_RESEND 28 select HARDIRQS_SW_RESEND
28 select HAVE_ARCH_JUMP_LABEL 29 select HAVE_ARCH_JUMP_LABEL
30 select HAVE_ARCH_KGDB
29 select HAVE_ARCH_TRACEHOOK 31 select HAVE_ARCH_TRACEHOOK
30 select HAVE_DEBUG_BUGVERBOSE 32 select HAVE_DEBUG_BUGVERBOSE
31 select HAVE_DEBUG_KMEMLEAK 33 select HAVE_DEBUG_KMEMLEAK
@@ -38,6 +40,8 @@ config ARM64
38 select HAVE_MEMBLOCK 40 select HAVE_MEMBLOCK
39 select HAVE_PATA_PLATFORM 41 select HAVE_PATA_PLATFORM
40 select HAVE_PERF_EVENTS 42 select HAVE_PERF_EVENTS
43 select HAVE_PERF_REGS
44 select HAVE_PERF_USER_STACK_DUMP
41 select IRQ_DOMAIN 45 select IRQ_DOMAIN
42 select MODULES_USE_ELF_RELA 46 select MODULES_USE_ELF_RELA
43 select NO_BOOTMEM 47 select NO_BOOTMEM
@@ -73,7 +77,7 @@ config LOCKDEP_SUPPORT
73config TRACE_IRQFLAGS_SUPPORT 77config TRACE_IRQFLAGS_SUPPORT
74 def_bool y 78 def_bool y
75 79
76config RWSEM_GENERIC_SPINLOCK 80config RWSEM_XCHGADD_ALGORITHM
77 def_bool y 81 def_bool y
78 82
79config GENERIC_HWEIGHT 83config GENERIC_HWEIGHT
@@ -85,7 +89,7 @@ config GENERIC_CSUM
85config GENERIC_CALIBRATE_DELAY 89config GENERIC_CALIBRATE_DELAY
86 def_bool y 90 def_bool y
87 91
88config ZONE_DMA32 92config ZONE_DMA
89 def_bool y 93 def_bool y
90 94
91config ARCH_DMA_ADDR_T_64BIT 95config ARCH_DMA_ADDR_T_64BIT
@@ -164,6 +168,22 @@ config SMP
164 168
165 If you don't know what to do here, say N. 169 If you don't know what to do here, say N.
166 170
171config SCHED_MC
172 bool "Multi-core scheduler support"
173 depends on SMP
174 help
175 Multi-core scheduler support improves the CPU scheduler's decision
176 making when dealing with multi-core CPU chips at a cost of slightly
177 increased overhead in some places. If unsure say N here.
178
179config SCHED_SMT
180 bool "SMT scheduler support"
181 depends on SMP
182 help
183 Improves the CPU scheduler's decision making when dealing with
184 MultiThreading at a cost of slightly increased overhead in some
185 places. If unsure say N here.
186
167config NR_CPUS 187config NR_CPUS
168 int "Maximum number of CPUs (2-32)" 188 int "Maximum number of CPUs (2-32)"
169 range 2 32 189 range 2 32
@@ -301,6 +321,8 @@ menu "CPU Power Management"
301 321
302source "drivers/cpuidle/Kconfig" 322source "drivers/cpuidle/Kconfig"
303 323
324source "drivers/cpufreq/Kconfig"
325
304endmenu 326endmenu
305 327
306source "net/Kconfig" 328source "net/Kconfig"
diff --git a/arch/arm64/boot/dts/apm-storm.dtsi b/arch/arm64/boot/dts/apm-storm.dtsi
index d37d7369e260..93f4b2dd9248 100644
--- a/arch/arm64/boot/dts/apm-storm.dtsi
+++ b/arch/arm64/boot/dts/apm-storm.dtsi
@@ -176,6 +176,87 @@
176 reg-names = "csr-reg"; 176 reg-names = "csr-reg";
177 clock-output-names = "eth8clk"; 177 clock-output-names = "eth8clk";
178 }; 178 };
179
180 sataphy1clk: sataphy1clk@1f21c000 {
181 compatible = "apm,xgene-device-clock";
182 #clock-cells = <1>;
183 clocks = <&socplldiv2 0>;
184 reg = <0x0 0x1f21c000 0x0 0x1000>;
185 reg-names = "csr-reg";
186 clock-output-names = "sataphy1clk";
187 status = "disabled";
188 csr-offset = <0x4>;
189 csr-mask = <0x00>;
190 enable-offset = <0x0>;
191 enable-mask = <0x06>;
192 };
193
194 sataphy2clk: sataphy1clk@1f22c000 {
195 compatible = "apm,xgene-device-clock";
196 #clock-cells = <1>;
197 clocks = <&socplldiv2 0>;
198 reg = <0x0 0x1f22c000 0x0 0x1000>;
199 reg-names = "csr-reg";
200 clock-output-names = "sataphy2clk";
201 status = "ok";
202 csr-offset = <0x4>;
203 csr-mask = <0x3a>;
204 enable-offset = <0x0>;
205 enable-mask = <0x06>;
206 };
207
208 sataphy3clk: sataphy1clk@1f23c000 {
209 compatible = "apm,xgene-device-clock";
210 #clock-cells = <1>;
211 clocks = <&socplldiv2 0>;
212 reg = <0x0 0x1f23c000 0x0 0x1000>;
213 reg-names = "csr-reg";
214 clock-output-names = "sataphy3clk";
215 status = "ok";
216 csr-offset = <0x4>;
217 csr-mask = <0x3a>;
218 enable-offset = <0x0>;
219 enable-mask = <0x06>;
220 };
221
222 sata01clk: sata01clk@1f21c000 {
223 compatible = "apm,xgene-device-clock";
224 #clock-cells = <1>;
225 clocks = <&socplldiv2 0>;
226 reg = <0x0 0x1f21c000 0x0 0x1000>;
227 reg-names = "csr-reg";
228 clock-output-names = "sata01clk";
229 csr-offset = <0x4>;
230 csr-mask = <0x05>;
231 enable-offset = <0x0>;
232 enable-mask = <0x39>;
233 };
234
235 sata23clk: sata23clk@1f22c000 {
236 compatible = "apm,xgene-device-clock";
237 #clock-cells = <1>;
238 clocks = <&socplldiv2 0>;
239 reg = <0x0 0x1f22c000 0x0 0x1000>;
240 reg-names = "csr-reg";
241 clock-output-names = "sata23clk";
242 csr-offset = <0x4>;
243 csr-mask = <0x05>;
244 enable-offset = <0x0>;
245 enable-mask = <0x39>;
246 };
247
248 sata45clk: sata45clk@1f23c000 {
249 compatible = "apm,xgene-device-clock";
250 #clock-cells = <1>;
251 clocks = <&socplldiv2 0>;
252 reg = <0x0 0x1f23c000 0x0 0x1000>;
253 reg-names = "csr-reg";
254 clock-output-names = "sata45clk";
255 csr-offset = <0x4>;
256 csr-mask = <0x05>;
257 enable-offset = <0x0>;
258 enable-mask = <0x39>;
259 };
179 }; 260 };
180 261
181 serial0: serial@1c020000 { 262 serial0: serial@1c020000 {
@@ -187,5 +268,76 @@
187 interrupt-parent = <&gic>; 268 interrupt-parent = <&gic>;
188 interrupts = <0x0 0x4c 0x4>; 269 interrupts = <0x0 0x4c 0x4>;
189 }; 270 };
271
272 phy1: phy@1f21a000 {
273 compatible = "apm,xgene-phy";
274 reg = <0x0 0x1f21a000 0x0 0x100>;
275 #phy-cells = <1>;
276 clocks = <&sataphy1clk 0>;
277 status = "disabled";
278 apm,tx-boost-gain = <30 30 30 30 30 30>;
279 apm,tx-eye-tuning = <2 10 10 2 10 10>;
280 };
281
282 phy2: phy@1f22a000 {
283 compatible = "apm,xgene-phy";
284 reg = <0x0 0x1f22a000 0x0 0x100>;
285 #phy-cells = <1>;
286 clocks = <&sataphy2clk 0>;
287 status = "ok";
288 apm,tx-boost-gain = <30 30 30 30 30 30>;
289 apm,tx-eye-tuning = <1 10 10 2 10 10>;
290 };
291
292 phy3: phy@1f23a000 {
293 compatible = "apm,xgene-phy";
294 reg = <0x0 0x1f23a000 0x0 0x100>;
295 #phy-cells = <1>;
296 clocks = <&sataphy3clk 0>;
297 status = "ok";
298 apm,tx-boost-gain = <31 31 31 31 31 31>;
299 apm,tx-eye-tuning = <2 10 10 2 10 10>;
300 };
301
302 sata1: sata@1a000000 {
303 compatible = "apm,xgene-ahci";
304 reg = <0x0 0x1a000000 0x0 0x1000>,
305 <0x0 0x1f210000 0x0 0x1000>,
306 <0x0 0x1f21d000 0x0 0x1000>,
307 <0x0 0x1f21e000 0x0 0x1000>,
308 <0x0 0x1f217000 0x0 0x1000>;
309 interrupts = <0x0 0x86 0x4>;
310 status = "disabled";
311 clocks = <&sata01clk 0>;
312 phys = <&phy1 0>;
313 phy-names = "sata-phy";
314 };
315
316 sata2: sata@1a400000 {
317 compatible = "apm,xgene-ahci";
318 reg = <0x0 0x1a400000 0x0 0x1000>,
319 <0x0 0x1f220000 0x0 0x1000>,
320 <0x0 0x1f22d000 0x0 0x1000>,
321 <0x0 0x1f22e000 0x0 0x1000>,
322 <0x0 0x1f227000 0x0 0x1000>;
323 interrupts = <0x0 0x87 0x4>;
324 status = "ok";
325 clocks = <&sata23clk 0>;
326 phys = <&phy2 0>;
327 phy-names = "sata-phy";
328 };
329
330 sata3: sata@1a800000 {
331 compatible = "apm,xgene-ahci";
332 reg = <0x0 0x1a800000 0x0 0x1000>,
333 <0x0 0x1f230000 0x0 0x1000>,
334 <0x0 0x1f23d000 0x0 0x1000>,
335 <0x0 0x1f23e000 0x0 0x1000>;
336 interrupts = <0x0 0x88 0x4>;
337 status = "ok";
338 clocks = <&sata45clk 0>;
339 phys = <&phy3 0>;
340 phy-names = "sata-phy";
341 };
190 }; 342 };
191}; 343};
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index 3bdfdda70567..4bca4923fc0b 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -32,6 +32,7 @@ generic-y += poll.h
32generic-y += posix_types.h 32generic-y += posix_types.h
33generic-y += preempt.h 33generic-y += preempt.h
34generic-y += resource.h 34generic-y += resource.h
35generic-y += rwsem.h
35generic-y += scatterlist.h 36generic-y += scatterlist.h
36generic-y += sections.h 37generic-y += sections.h
37generic-y += segment.h 38generic-y += segment.h
diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h
index 409ca370cfe2..66eb7648043b 100644
--- a/arch/arm64/include/asm/barrier.h
+++ b/arch/arm64/include/asm/barrier.h
@@ -25,6 +25,7 @@
25#define wfi() asm volatile("wfi" : : : "memory") 25#define wfi() asm volatile("wfi" : : : "memory")
26 26
27#define isb() asm volatile("isb" : : : "memory") 27#define isb() asm volatile("isb" : : : "memory")
28#define dmb(opt) asm volatile("dmb sy" : : : "memory")
28#define dsb(opt) asm volatile("dsb sy" : : : "memory") 29#define dsb(opt) asm volatile("dsb sy" : : : "memory")
29 30
30#define mb() dsb() 31#define mb() dsb()
diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h
index 889324981aa4..4c60e64a801c 100644
--- a/arch/arm64/include/asm/cacheflush.h
+++ b/arch/arm64/include/asm/cacheflush.h
@@ -85,6 +85,13 @@ static inline void flush_cache_page(struct vm_area_struct *vma,
85} 85}
86 86
87/* 87/*
88 * Cache maintenance functions used by the DMA API. No to be used directly.
89 */
90extern void __dma_map_area(const void *, size_t, int);
91extern void __dma_unmap_area(const void *, size_t, int);
92extern void __dma_flush_range(const void *, const void *);
93
94/*
88 * Copy user data from/to a page which is mapped into a different 95 * Copy user data from/to a page which is mapped into a different
89 * processes address space. Really, we want to allow our "user 96 * processes address space. Really, we want to allow our "user
90 * space" model to handle this. 97 * space" model to handle this.
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h
index fda2704b3f9f..e71f81fe127a 100644
--- a/arch/arm64/include/asm/compat.h
+++ b/arch/arm64/include/asm/compat.h
@@ -228,7 +228,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
228 return (u32)(unsigned long)uptr; 228 return (u32)(unsigned long)uptr;
229} 229}
230 230
231#define compat_user_stack_pointer() (current_pt_regs()->compat_sp) 231#define compat_user_stack_pointer() (user_stack_pointer(current_pt_regs()))
232 232
233static inline void __user *arch_compat_alloc_user_space(long len) 233static inline void __user *arch_compat_alloc_user_space(long len)
234{ 234{
diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
new file mode 100644
index 000000000000..cd4ac0516488
--- /dev/null
+++ b/arch/arm64/include/asm/cpufeature.h
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
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#ifndef __ASM_CPUFEATURE_H
10#define __ASM_CPUFEATURE_H
11
12#include <asm/hwcap.h>
13
14/*
15 * In the arm64 world (as in the ARM world), elf_hwcap is used both internally
16 * in the kernel and for user space to keep track of which optional features
17 * are supported by the current system. So let's map feature 'x' to HWCAP_x.
18 * Note that HWCAP_x constants are bit fields so we need to take the log.
19 */
20
21#define MAX_CPU_FEATURES (8 * sizeof(elf_hwcap))
22#define cpu_feature(x) ilog2(HWCAP_ ## x)
23
24static inline bool cpu_have_feature(unsigned int num)
25{
26 return elf_hwcap & (1UL << num);
27}
28
29#endif
diff --git a/arch/arm64/include/asm/debug-monitors.h b/arch/arm64/include/asm/debug-monitors.h
index 62314791570c..6e9b5b36921c 100644
--- a/arch/arm64/include/asm/debug-monitors.h
+++ b/arch/arm64/include/asm/debug-monitors.h
@@ -26,6 +26,53 @@
26#define DBG_ESR_EVT_HWWP 0x2 26#define DBG_ESR_EVT_HWWP 0x2
27#define DBG_ESR_EVT_BRK 0x6 27#define DBG_ESR_EVT_BRK 0x6
28 28
29/*
30 * Break point instruction encoding
31 */
32#define BREAK_INSTR_SIZE 4
33
34/*
35 * ESR values expected for dynamic and compile time BRK instruction
36 */
37#define DBG_ESR_VAL_BRK(x) (0xf2000000 | ((x) & 0xfffff))
38
39/*
40 * #imm16 values used for BRK instruction generation
41 * Allowed values for kgbd are 0x400 - 0x7ff
42 * 0x400: for dynamic BRK instruction
43 * 0x401: for compile time BRK instruction
44 */
45#define KGDB_DYN_DGB_BRK_IMM 0x400
46#define KDBG_COMPILED_DBG_BRK_IMM 0x401
47
48/*
49 * BRK instruction encoding
50 * The #imm16 value should be placed at bits[20:5] within BRK ins
51 */
52#define AARCH64_BREAK_MON 0xd4200000
53
54/*
55 * Extract byte from BRK instruction
56 */
57#define KGDB_DYN_DGB_BRK_INS_BYTE(x) \
58 ((((AARCH64_BREAK_MON) & 0xffe0001f) >> (x * 8)) & 0xff)
59
60/*
61 * Extract byte from BRK #imm16
62 */
63#define KGBD_DYN_DGB_BRK_IMM_BYTE(x) \
64 (((((KGDB_DYN_DGB_BRK_IMM) & 0xffff) << 5) >> (x * 8)) & 0xff)
65
66#define KGDB_DYN_DGB_BRK_BYTE(x) \
67 (KGDB_DYN_DGB_BRK_INS_BYTE(x) | KGBD_DYN_DGB_BRK_IMM_BYTE(x))
68
69#define KGDB_DYN_BRK_INS_BYTE0 KGDB_DYN_DGB_BRK_BYTE(0)
70#define KGDB_DYN_BRK_INS_BYTE1 KGDB_DYN_DGB_BRK_BYTE(1)
71#define KGDB_DYN_BRK_INS_BYTE2 KGDB_DYN_DGB_BRK_BYTE(2)
72#define KGDB_DYN_BRK_INS_BYTE3 KGDB_DYN_DGB_BRK_BYTE(3)
73
74#define CACHE_FLUSH_IS_SAFE 1
75
29enum debug_el { 76enum debug_el {
30 DBG_ACTIVE_EL0 = 0, 77 DBG_ACTIVE_EL0 = 0,
31 DBG_ACTIVE_EL1, 78 DBG_ACTIVE_EL1,
@@ -43,23 +90,6 @@ enum debug_el {
43#ifndef __ASSEMBLY__ 90#ifndef __ASSEMBLY__
44struct task_struct; 91struct task_struct;
45 92
46#define local_dbg_save(flags) \
47 do { \
48 typecheck(unsigned long, flags); \
49 asm volatile( \
50 "mrs %0, daif // local_dbg_save\n" \
51 "msr daifset, #8" \
52 : "=r" (flags) : : "memory"); \
53 } while (0)
54
55#define local_dbg_restore(flags) \
56 do { \
57 typecheck(unsigned long, flags); \
58 asm volatile( \
59 "msr daif, %0 // local_dbg_restore\n" \
60 : : "r" (flags) : "memory"); \
61 } while (0)
62
63#define DBG_ARCH_ID_RESERVED 0 /* In case of ptrace ABI updates. */ 93#define DBG_ARCH_ID_RESERVED 0 /* In case of ptrace ABI updates. */
64 94
65#define DBG_HOOK_HANDLED 0 95#define DBG_HOOK_HANDLED 0
diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h
index fd0c0c0e447a..3a4572ec3273 100644
--- a/arch/arm64/include/asm/dma-mapping.h
+++ b/arch/arm64/include/asm/dma-mapping.h
@@ -30,6 +30,8 @@
30 30
31#define DMA_ERROR_CODE (~(dma_addr_t)0) 31#define DMA_ERROR_CODE (~(dma_addr_t)0)
32extern struct dma_map_ops *dma_ops; 32extern struct dma_map_ops *dma_ops;
33extern struct dma_map_ops coherent_swiotlb_dma_ops;
34extern struct dma_map_ops noncoherent_swiotlb_dma_ops;
33 35
34static inline struct dma_map_ops *__generic_dma_ops(struct device *dev) 36static inline struct dma_map_ops *__generic_dma_ops(struct device *dev)
35{ 37{
@@ -47,6 +49,11 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
47 return __generic_dma_ops(dev); 49 return __generic_dma_ops(dev);
48} 50}
49 51
52static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
53{
54 dev->archdata.dma_ops = ops;
55}
56
50#include <asm-generic/dma-mapping-common.h> 57#include <asm-generic/dma-mapping-common.h>
51 58
52static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr) 59static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
diff --git a/arch/arm64/include/asm/hwcap.h b/arch/arm64/include/asm/hwcap.h
index 6cddbb0c9f54..024c46183c3c 100644
--- a/arch/arm64/include/asm/hwcap.h
+++ b/arch/arm64/include/asm/hwcap.h
@@ -32,6 +32,12 @@
32#define COMPAT_HWCAP_IDIV (COMPAT_HWCAP_IDIVA|COMPAT_HWCAP_IDIVT) 32#define COMPAT_HWCAP_IDIV (COMPAT_HWCAP_IDIVA|COMPAT_HWCAP_IDIVT)
33#define COMPAT_HWCAP_EVTSTRM (1 << 21) 33#define COMPAT_HWCAP_EVTSTRM (1 << 21)
34 34
35#define COMPAT_HWCAP2_AES (1 << 0)
36#define COMPAT_HWCAP2_PMULL (1 << 1)
37#define COMPAT_HWCAP2_SHA1 (1 << 2)
38#define COMPAT_HWCAP2_SHA2 (1 << 3)
39#define COMPAT_HWCAP2_CRC32 (1 << 4)
40
35#ifndef __ASSEMBLY__ 41#ifndef __ASSEMBLY__
36/* 42/*
37 * This yields a mask that user programs can use to figure out what 43 * This yields a mask that user programs can use to figure out what
@@ -41,7 +47,8 @@
41 47
42#ifdef CONFIG_COMPAT 48#ifdef CONFIG_COMPAT
43#define COMPAT_ELF_HWCAP (compat_elf_hwcap) 49#define COMPAT_ELF_HWCAP (compat_elf_hwcap)
44extern unsigned int compat_elf_hwcap; 50#define COMPAT_ELF_HWCAP2 (compat_elf_hwcap2)
51extern unsigned int compat_elf_hwcap, compat_elf_hwcap2;
45#endif 52#endif
46 53
47extern unsigned long elf_hwcap; 54extern unsigned long elf_hwcap;
diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index 4cc813eddacb..7846a6bb0833 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -121,7 +121,7 @@ static inline u64 __raw_readq(const volatile void __iomem *addr)
121 * I/O port access primitives. 121 * I/O port access primitives.
122 */ 122 */
123#define IO_SPACE_LIMIT 0xffff 123#define IO_SPACE_LIMIT 0xffff
124#define PCI_IOBASE ((void __iomem *)(MODULES_VADDR - SZ_2M)) 124#define PCI_IOBASE ((void __iomem *)(MODULES_VADDR - SZ_32M))
125 125
126static inline u8 inb(unsigned long addr) 126static inline u8 inb(unsigned long addr)
127{ 127{
diff --git a/arch/arm64/include/asm/irqflags.h b/arch/arm64/include/asm/irqflags.h
index b2fcfbc51ecc..11cc941bd107 100644
--- a/arch/arm64/include/asm/irqflags.h
+++ b/arch/arm64/include/asm/irqflags.h
@@ -90,5 +90,28 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
90 return flags & PSR_I_BIT; 90 return flags & PSR_I_BIT;
91} 91}
92 92
93/*
94 * save and restore debug state
95 */
96#define local_dbg_save(flags) \
97 do { \
98 typecheck(unsigned long, flags); \
99 asm volatile( \
100 "mrs %0, daif // local_dbg_save\n" \
101 "msr daifset, #8" \
102 : "=r" (flags) : : "memory"); \
103 } while (0)
104
105#define local_dbg_restore(flags) \
106 do { \
107 typecheck(unsigned long, flags); \
108 asm volatile( \
109 "msr daif, %0 // local_dbg_restore\n" \
110 : : "r" (flags) : "memory"); \
111 } while (0)
112
113#define local_dbg_enable() asm("msr daifclr, #8" : : : "memory")
114#define local_dbg_disable() asm("msr daifset, #8" : : : "memory")
115
93#endif 116#endif
94#endif 117#endif
diff --git a/arch/arm64/include/asm/kgdb.h b/arch/arm64/include/asm/kgdb.h
new file mode 100644
index 000000000000..3c8aafc1082f
--- /dev/null
+++ b/arch/arm64/include/asm/kgdb.h
@@ -0,0 +1,84 @@
1/*
2 * AArch64 KGDB support
3 *
4 * Based on arch/arm/include/kgdb.h
5 *
6 * Copyright (C) 2013 Cavium Inc.
7 * Author: Vijaya Kumar K <vijaya.kumar@caviumnetworks.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef __ARM_KGDB_H
23#define __ARM_KGDB_H
24
25#include <linux/ptrace.h>
26#include <asm/debug-monitors.h>
27
28#ifndef __ASSEMBLY__
29
30static inline void arch_kgdb_breakpoint(void)
31{
32 asm ("brk %0" : : "I" (KDBG_COMPILED_DBG_BRK_IMM));
33}
34
35extern void kgdb_handle_bus_error(void);
36extern int kgdb_fault_expected;
37
38#endif /* !__ASSEMBLY__ */
39
40/*
41 * gdb is expecting the following registers layout.
42 *
43 * General purpose regs:
44 * r0-r30: 64 bit
45 * sp,pc : 64 bit
46 * pstate : 64 bit
47 * Total: 34
48 * FPU regs:
49 * f0-f31: 128 bit
50 * Total: 32
51 * Extra regs
52 * fpsr & fpcr: 32 bit
53 * Total: 2
54 *
55 */
56
57#define _GP_REGS 34
58#define _FP_REGS 32
59#define _EXTRA_REGS 2
60/*
61 * general purpose registers size in bytes.
62 * pstate is only 4 bytes. subtract 4 bytes
63 */
64#define GP_REG_BYTES (_GP_REGS * 8)
65#define DBG_MAX_REG_NUM (_GP_REGS + _FP_REGS + _EXTRA_REGS)
66
67/*
68 * Size of I/O buffer for gdb packet.
69 * considering to hold all register contents, size is set
70 */
71
72#define BUFMAX 2048
73
74/*
75 * Number of bytes required for gdb_regs buffer.
76 * _GP_REGS: 8 bytes, _FP_REGS: 16 bytes and _EXTRA_REGS: 4 bytes each
77 * GDB fails to connect for size beyond this with error
78 * "'g' packet reply is too long"
79 */
80
81#define NUMREGBYTES ((_GP_REGS * 8) + (_FP_REGS * 16) + \
82 (_EXTRA_REGS * 4))
83
84#endif /* __ASM_KGDB_H */
diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h
index 0eb398655378..21ef48d32ff2 100644
--- a/arch/arm64/include/asm/kvm_arm.h
+++ b/arch/arm64/include/asm/kvm_arm.h
@@ -106,7 +106,6 @@
106 106
107/* VTCR_EL2 Registers bits */ 107/* VTCR_EL2 Registers bits */
108#define VTCR_EL2_PS_MASK (7 << 16) 108#define VTCR_EL2_PS_MASK (7 << 16)
109#define VTCR_EL2_PS_40B (2 << 16)
110#define VTCR_EL2_TG0_MASK (1 << 14) 109#define VTCR_EL2_TG0_MASK (1 << 14)
111#define VTCR_EL2_TG0_4K (0 << 14) 110#define VTCR_EL2_TG0_4K (0 << 14)
112#define VTCR_EL2_TG0_64K (1 << 14) 111#define VTCR_EL2_TG0_64K (1 << 14)
@@ -129,10 +128,9 @@
129 * 64kB pages (TG0 = 1) 128 * 64kB pages (TG0 = 1)
130 * 2 level page tables (SL = 1) 129 * 2 level page tables (SL = 1)
131 */ 130 */
132#define VTCR_EL2_FLAGS (VTCR_EL2_PS_40B | VTCR_EL2_TG0_64K | \ 131#define VTCR_EL2_FLAGS (VTCR_EL2_TG0_64K | VTCR_EL2_SH0_INNER | \
133 VTCR_EL2_SH0_INNER | VTCR_EL2_ORGN0_WBWA | \ 132 VTCR_EL2_ORGN0_WBWA | VTCR_EL2_IRGN0_WBWA | \
134 VTCR_EL2_IRGN0_WBWA | VTCR_EL2_SL0_LVL1 | \ 133 VTCR_EL2_SL0_LVL1 | VTCR_EL2_T0SZ_40B)
135 VTCR_EL2_T0SZ_40B)
136#define VTTBR_X (38 - VTCR_EL2_T0SZ_40B) 134#define VTTBR_X (38 - VTCR_EL2_T0SZ_40B)
137#else 135#else
138/* 136/*
@@ -142,10 +140,9 @@
142 * 4kB pages (TG0 = 0) 140 * 4kB pages (TG0 = 0)
143 * 3 level page tables (SL = 1) 141 * 3 level page tables (SL = 1)
144 */ 142 */
145#define VTCR_EL2_FLAGS (VTCR_EL2_PS_40B | VTCR_EL2_TG0_4K | \ 143#define VTCR_EL2_FLAGS (VTCR_EL2_TG0_4K | VTCR_EL2_SH0_INNER | \
146 VTCR_EL2_SH0_INNER | VTCR_EL2_ORGN0_WBWA | \ 144 VTCR_EL2_ORGN0_WBWA | VTCR_EL2_IRGN0_WBWA | \
147 VTCR_EL2_IRGN0_WBWA | VTCR_EL2_SL0_LVL1 | \ 145 VTCR_EL2_SL0_LVL1 | VTCR_EL2_T0SZ_40B)
148 VTCR_EL2_T0SZ_40B)
149#define VTTBR_X (37 - VTCR_EL2_T0SZ_40B) 146#define VTTBR_X (37 - VTCR_EL2_T0SZ_40B)
150#endif 147#endif
151 148
diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h
index b1d2e26c3c88..f7af66b54cb2 100644
--- a/arch/arm64/include/asm/pgtable-hwdef.h
+++ b/arch/arm64/include/asm/pgtable-hwdef.h
@@ -100,9 +100,9 @@
100#define PTE_HYP PTE_USER 100#define PTE_HYP PTE_USER
101 101
102/* 102/*
103 * 40-bit physical address supported. 103 * Highest possible physical address supported.
104 */ 104 */
105#define PHYS_MASK_SHIFT (40) 105#define PHYS_MASK_SHIFT (48)
106#define PHYS_MASK ((UL(1) << PHYS_MASK_SHIFT) - 1) 106#define PHYS_MASK ((UL(1) << PHYS_MASK_SHIFT) - 1)
107 107
108/* 108/*
@@ -122,7 +122,6 @@
122#define TCR_SHARED ((UL(3) << 12) | (UL(3) << 28)) 122#define TCR_SHARED ((UL(3) << 12) | (UL(3) << 28))
123#define TCR_TG0_64K (UL(1) << 14) 123#define TCR_TG0_64K (UL(1) << 14)
124#define TCR_TG1_64K (UL(1) << 30) 124#define TCR_TG1_64K (UL(1) << 30)
125#define TCR_IPS_40BIT (UL(2) << 32)
126#define TCR_ASID16 (UL(1) << 36) 125#define TCR_ASID16 (UL(1) << 36)
127#define TCR_TBI0 (UL(1) << 37) 126#define TCR_TBI0 (UL(1) << 37)
128 127
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index aa3917c8b623..90c811f05a2e 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -199,7 +199,7 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
199 pte_t *ptep, pte_t pte) 199 pte_t *ptep, pte_t pte)
200{ 200{
201 if (pte_valid_user(pte)) { 201 if (pte_valid_user(pte)) {
202 if (pte_exec(pte)) 202 if (!pte_special(pte) && pte_exec(pte))
203 __sync_icache_dcache(pte, addr); 203 __sync_icache_dcache(pte, addr);
204 if (pte_dirty(pte) && pte_write(pte)) 204 if (pte_dirty(pte) && pte_write(pte))
205 pte_val(pte) &= ~PTE_RDONLY; 205 pte_val(pte) &= ~PTE_RDONLY;
@@ -227,36 +227,36 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
227 227
228#define __HAVE_ARCH_PTE_SPECIAL 228#define __HAVE_ARCH_PTE_SPECIAL
229 229
230/* 230static inline pte_t pmd_pte(pmd_t pmd)
231 * Software PMD bits for THP 231{
232 */ 232 return __pte(pmd_val(pmd));
233}
233 234
234#define PMD_SECT_DIRTY (_AT(pmdval_t, 1) << 55) 235static inline pmd_t pte_pmd(pte_t pte)
235#define PMD_SECT_SPLITTING (_AT(pmdval_t, 1) << 57) 236{
237 return __pmd(pte_val(pte));
238}
236 239
237/* 240/*
238 * THP definitions. 241 * THP definitions.
239 */ 242 */
240#define pmd_young(pmd) (pmd_val(pmd) & PMD_SECT_AF)
241
242#define __HAVE_ARCH_PMD_WRITE
243#define pmd_write(pmd) (!(pmd_val(pmd) & PMD_SECT_RDONLY))
244 243
245#ifdef CONFIG_TRANSPARENT_HUGEPAGE 244#ifdef CONFIG_TRANSPARENT_HUGEPAGE
246#define pmd_trans_huge(pmd) (pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT)) 245#define pmd_trans_huge(pmd) (pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT))
247#define pmd_trans_splitting(pmd) (pmd_val(pmd) & PMD_SECT_SPLITTING) 246#define pmd_trans_splitting(pmd) pte_special(pmd_pte(pmd))
248#endif 247#endif
249 248
250#define PMD_BIT_FUNC(fn,op) \ 249#define pmd_young(pmd) pte_young(pmd_pte(pmd))
251static inline pmd_t pmd_##fn(pmd_t pmd) { pmd_val(pmd) op; return pmd; } 250#define pmd_wrprotect(pmd) pte_pmd(pte_wrprotect(pmd_pte(pmd)))
251#define pmd_mksplitting(pmd) pte_pmd(pte_mkspecial(pmd_pte(pmd)))
252#define pmd_mkold(pmd) pte_pmd(pte_mkold(pmd_pte(pmd)))
253#define pmd_mkwrite(pmd) pte_pmd(pte_mkwrite(pmd_pte(pmd)))
254#define pmd_mkdirty(pmd) pte_pmd(pte_mkdirty(pmd_pte(pmd)))
255#define pmd_mkyoung(pmd) pte_pmd(pte_mkyoung(pmd_pte(pmd)))
256#define pmd_mknotpresent(pmd) (__pmd(pmd_val(pmd) &= ~PMD_TYPE_MASK))
252 257
253PMD_BIT_FUNC(wrprotect, |= PMD_SECT_RDONLY); 258#define __HAVE_ARCH_PMD_WRITE
254PMD_BIT_FUNC(mkold, &= ~PMD_SECT_AF); 259#define pmd_write(pmd) pte_write(pmd_pte(pmd))
255PMD_BIT_FUNC(mksplitting, |= PMD_SECT_SPLITTING);
256PMD_BIT_FUNC(mkwrite, &= ~PMD_SECT_RDONLY);
257PMD_BIT_FUNC(mkdirty, |= PMD_SECT_DIRTY);
258PMD_BIT_FUNC(mkyoung, |= PMD_SECT_AF);
259PMD_BIT_FUNC(mknotpresent, &= ~PMD_TYPE_MASK);
260 260
261#define pmd_mkhuge(pmd) (__pmd(pmd_val(pmd) & ~PMD_TABLE_BIT)) 261#define pmd_mkhuge(pmd) (__pmd(pmd_val(pmd) & ~PMD_TABLE_BIT))
262 262
@@ -266,15 +266,6 @@ PMD_BIT_FUNC(mknotpresent, &= ~PMD_TYPE_MASK);
266 266
267#define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK)) 267#define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK))
268 268
269static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
270{
271 const pmdval_t mask = PMD_SECT_USER | PMD_SECT_PXN | PMD_SECT_UXN |
272 PMD_SECT_RDONLY | PMD_SECT_PROT_NONE |
273 PMD_SECT_VALID;
274 pmd_val(pmd) = (pmd_val(pmd) & ~mask) | (pgprot_val(newprot) & mask);
275 return pmd;
276}
277
278#define set_pmd_at(mm, addr, pmdp, pmd) set_pmd(pmdp, pmd) 269#define set_pmd_at(mm, addr, pmdp, pmd) set_pmd(pmdp, pmd)
279 270
280static inline int has_transparent_hugepage(void) 271static inline int has_transparent_hugepage(void)
@@ -286,11 +277,9 @@ static inline int has_transparent_hugepage(void)
286 * Mark the prot value as uncacheable and unbufferable. 277 * Mark the prot value as uncacheable and unbufferable.
287 */ 278 */
288#define pgprot_noncached(prot) \ 279#define pgprot_noncached(prot) \
289 __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRnE)) 280 __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRnE) | PTE_PXN | PTE_UXN)
290#define pgprot_writecombine(prot) \ 281#define pgprot_writecombine(prot) \
291 __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC)) 282 __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN)
292#define pgprot_dmacoherent(prot) \
293 __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC))
294#define __HAVE_PHYS_MEM_ACCESS_PROT 283#define __HAVE_PHYS_MEM_ACCESS_PROT
295struct file; 284struct file;
296extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, 285extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
@@ -383,6 +372,11 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
383 return pte; 372 return pte;
384} 373}
385 374
375static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
376{
377 return pte_pmd(pte_modify(pmd_pte(pmd), newprot));
378}
379
386extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; 380extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
387extern pgd_t idmap_pg_dir[PTRS_PER_PGD]; 381extern pgd_t idmap_pg_dir[PTRS_PER_PGD];
388 382
diff --git a/arch/arm64/include/asm/psci.h b/arch/arm64/include/asm/psci.h
index e5312ea0ec1a..d15ab8b46336 100644
--- a/arch/arm64/include/asm/psci.h
+++ b/arch/arm64/include/asm/psci.h
@@ -14,6 +14,6 @@
14#ifndef __ASM_PSCI_H 14#ifndef __ASM_PSCI_H
15#define __ASM_PSCI_H 15#define __ASM_PSCI_H
16 16
17int psci_init(void); 17void psci_init(void);
18 18
19#endif /* __ASM_PSCI_H */ 19#endif /* __ASM_PSCI_H */
diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h
index 0e7fa4963735..c7ba261dd4b3 100644
--- a/arch/arm64/include/asm/ptrace.h
+++ b/arch/arm64/include/asm/ptrace.h
@@ -68,6 +68,7 @@
68 68
69/* Architecturally defined mapping between AArch32 and AArch64 registers */ 69/* Architecturally defined mapping between AArch32 and AArch64 registers */
70#define compat_usr(x) regs[(x)] 70#define compat_usr(x) regs[(x)]
71#define compat_fp regs[11]
71#define compat_sp regs[13] 72#define compat_sp regs[13]
72#define compat_lr regs[14] 73#define compat_lr regs[14]
73#define compat_sp_hyp regs[15] 74#define compat_sp_hyp regs[15]
@@ -132,7 +133,7 @@ struct pt_regs {
132 (!((regs)->pstate & PSR_F_BIT)) 133 (!((regs)->pstate & PSR_F_BIT))
133 134
134#define user_stack_pointer(regs) \ 135#define user_stack_pointer(regs) \
135 ((regs)->sp) 136 (!compat_user_mode(regs)) ? ((regs)->sp) : ((regs)->compat_sp)
136 137
137/* 138/*
138 * Are the current registers suitable for user mode? (used to maintain 139 * Are the current registers suitable for user mode? (used to maintain
@@ -164,7 +165,7 @@ static inline int valid_user_regs(struct user_pt_regs *regs)
164 return 0; 165 return 0;
165} 166}
166 167
167#define instruction_pointer(regs) (regs)->pc 168#define instruction_pointer(regs) ((unsigned long)(regs)->pc)
168 169
169#ifdef CONFIG_SMP 170#ifdef CONFIG_SMP
170extern unsigned long profile_pc(struct pt_regs *regs); 171extern unsigned long profile_pc(struct pt_regs *regs);
diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h
index 717031a762c2..72cadf52ca80 100644
--- a/arch/arm64/include/asm/tlb.h
+++ b/arch/arm64/include/asm/tlb.h
@@ -19,115 +19,44 @@
19#ifndef __ASM_TLB_H 19#ifndef __ASM_TLB_H
20#define __ASM_TLB_H 20#define __ASM_TLB_H
21 21
22#include <linux/pagemap.h>
23#include <linux/swap.h>
24 22
25#include <asm/pgalloc.h> 23#include <asm-generic/tlb.h>
26#include <asm/tlbflush.h>
27
28#define MMU_GATHER_BUNDLE 8
29
30/*
31 * TLB handling. This allows us to remove pages from the page
32 * tables, and efficiently handle the TLB issues.
33 */
34struct mmu_gather {
35 struct mm_struct *mm;
36 unsigned int fullmm;
37 struct vm_area_struct *vma;
38 unsigned long start, end;
39 unsigned long range_start;
40 unsigned long range_end;
41 unsigned int nr;
42 unsigned int max;
43 struct page **pages;
44 struct page *local[MMU_GATHER_BUNDLE];
45};
46 24
47/* 25/*
48 * This is unnecessarily complex. There's three ways the TLB shootdown 26 * There's three ways the TLB shootdown code is used:
49 * code is used:
50 * 1. Unmapping a range of vmas. See zap_page_range(), unmap_region(). 27 * 1. Unmapping a range of vmas. See zap_page_range(), unmap_region().
51 * tlb->fullmm = 0, and tlb_start_vma/tlb_end_vma will be called. 28 * tlb->fullmm = 0, and tlb_start_vma/tlb_end_vma will be called.
52 * tlb->vma will be non-NULL.
53 * 2. Unmapping all vmas. See exit_mmap(). 29 * 2. Unmapping all vmas. See exit_mmap().
54 * tlb->fullmm = 1, and tlb_start_vma/tlb_end_vma will be called. 30 * tlb->fullmm = 1, and tlb_start_vma/tlb_end_vma will be called.
55 * tlb->vma will be non-NULL. Additionally, page tables will be freed. 31 * Page tables will be freed.
56 * 3. Unmapping argument pages. See shift_arg_pages(). 32 * 3. Unmapping argument pages. See shift_arg_pages().
57 * tlb->fullmm = 0, but tlb_start_vma/tlb_end_vma will not be called. 33 * tlb->fullmm = 0, but tlb_start_vma/tlb_end_vma will not be called.
58 * tlb->vma will be NULL.
59 */ 34 */
60static inline void tlb_flush(struct mmu_gather *tlb) 35static inline void tlb_flush(struct mmu_gather *tlb)
61{ 36{
62 if (tlb->fullmm || !tlb->vma) 37 if (tlb->fullmm) {
63 flush_tlb_mm(tlb->mm); 38 flush_tlb_mm(tlb->mm);
64 else if (tlb->range_end > 0) { 39 } else if (tlb->end > 0) {
65 flush_tlb_range(tlb->vma, tlb->range_start, tlb->range_end); 40 struct vm_area_struct vma = { .vm_mm = tlb->mm, };
66 tlb->range_start = TASK_SIZE; 41 flush_tlb_range(&vma, tlb->start, tlb->end);
67 tlb->range_end = 0; 42 tlb->start = TASK_SIZE;
43 tlb->end = 0;
68 } 44 }
69} 45}
70 46
71static inline void tlb_add_flush(struct mmu_gather *tlb, unsigned long addr) 47static inline void tlb_add_flush(struct mmu_gather *tlb, unsigned long addr)
72{ 48{
73 if (!tlb->fullmm) { 49 if (!tlb->fullmm) {
74 if (addr < tlb->range_start) 50 tlb->start = min(tlb->start, addr);
75 tlb->range_start = addr; 51 tlb->end = max(tlb->end, addr + PAGE_SIZE);
76 if (addr + PAGE_SIZE > tlb->range_end)
77 tlb->range_end = addr + PAGE_SIZE;
78 }
79}
80
81static inline void __tlb_alloc_page(struct mmu_gather *tlb)
82{
83 unsigned long addr = __get_free_pages(GFP_NOWAIT | __GFP_NOWARN, 0);
84
85 if (addr) {
86 tlb->pages = (void *)addr;
87 tlb->max = PAGE_SIZE / sizeof(struct page *);
88 } 52 }
89} 53}
90 54
91static inline void tlb_flush_mmu(struct mmu_gather *tlb)
92{
93 tlb_flush(tlb);
94 free_pages_and_swap_cache(tlb->pages, tlb->nr);
95 tlb->nr = 0;
96 if (tlb->pages == tlb->local)
97 __tlb_alloc_page(tlb);
98}
99
100static inline void
101tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end)
102{
103 tlb->mm = mm;
104 tlb->fullmm = !(start | (end+1));
105 tlb->start = start;
106 tlb->end = end;
107 tlb->vma = NULL;
108 tlb->max = ARRAY_SIZE(tlb->local);
109 tlb->pages = tlb->local;
110 tlb->nr = 0;
111 __tlb_alloc_page(tlb);
112}
113
114static inline void
115tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
116{
117 tlb_flush_mmu(tlb);
118
119 /* keep the page table cache within bounds */
120 check_pgt_cache();
121
122 if (tlb->pages != tlb->local)
123 free_pages((unsigned long)tlb->pages, 0);
124}
125
126/* 55/*
127 * Memorize the range for the TLB flush. 56 * Memorize the range for the TLB flush.
128 */ 57 */
129static inline void 58static inline void __tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep,
130tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep, unsigned long addr) 59 unsigned long addr)
131{ 60{
132 tlb_add_flush(tlb, addr); 61 tlb_add_flush(tlb, addr);
133} 62}
@@ -137,38 +66,24 @@ tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep, unsigned long addr)
137 * case where we're doing a full MM flush. When we're doing a munmap, 66 * case where we're doing a full MM flush. When we're doing a munmap,
138 * the vmas are adjusted to only cover the region to be torn down. 67 * the vmas are adjusted to only cover the region to be torn down.
139 */ 68 */
140static inline void 69static inline void tlb_start_vma(struct mmu_gather *tlb,
141tlb_start_vma(struct mmu_gather *tlb, struct vm_area_struct *vma) 70 struct vm_area_struct *vma)
142{ 71{
143 if (!tlb->fullmm) { 72 if (!tlb->fullmm) {
144 tlb->vma = vma; 73 tlb->start = TASK_SIZE;
145 tlb->range_start = TASK_SIZE; 74 tlb->end = 0;
146 tlb->range_end = 0;
147 } 75 }
148} 76}
149 77
150static inline void 78static inline void tlb_end_vma(struct mmu_gather *tlb,
151tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vma) 79 struct vm_area_struct *vma)
152{ 80{
153 if (!tlb->fullmm) 81 if (!tlb->fullmm)
154 tlb_flush(tlb); 82 tlb_flush(tlb);
155} 83}
156 84
157static inline int __tlb_remove_page(struct mmu_gather *tlb, struct page *page)
158{
159 tlb->pages[tlb->nr++] = page;
160 VM_BUG_ON(tlb->nr > tlb->max);
161 return tlb->max - tlb->nr;
162}
163
164static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
165{
166 if (!__tlb_remove_page(tlb, page))
167 tlb_flush_mmu(tlb);
168}
169
170static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, 85static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
171 unsigned long addr) 86 unsigned long addr)
172{ 87{
173 pgtable_page_dtor(pte); 88 pgtable_page_dtor(pte);
174 tlb_add_flush(tlb, addr); 89 tlb_add_flush(tlb, addr);
@@ -184,16 +99,5 @@ static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmdp,
184} 99}
185#endif 100#endif
186 101
187#define pte_free_tlb(tlb, ptep, addr) __pte_free_tlb(tlb, ptep, addr)
188#define pmd_free_tlb(tlb, pmdp, addr) __pmd_free_tlb(tlb, pmdp, addr)
189#define pud_free_tlb(tlb, pudp, addr) pud_free((tlb)->mm, pudp)
190
191#define tlb_migrate_finish(mm) do { } while (0)
192
193static inline void
194tlb_remove_pmd_tlb_entry(struct mmu_gather *tlb, pmd_t *pmdp, unsigned long addr)
195{
196 tlb_add_flush(tlb, addr);
197}
198 102
199#endif 103#endif
diff --git a/arch/arm64/include/asm/topology.h b/arch/arm64/include/asm/topology.h
new file mode 100644
index 000000000000..0172e6d76bf3
--- /dev/null
+++ b/arch/arm64/include/asm/topology.h
@@ -0,0 +1,39 @@
1#ifndef __ASM_TOPOLOGY_H
2#define __ASM_TOPOLOGY_H
3
4#ifdef CONFIG_SMP
5
6#include <linux/cpumask.h>
7
8struct cpu_topology {
9 int thread_id;
10 int core_id;
11 int cluster_id;
12 cpumask_t thread_sibling;
13 cpumask_t core_sibling;
14};
15
16extern struct cpu_topology cpu_topology[NR_CPUS];
17
18#define topology_physical_package_id(cpu) (cpu_topology[cpu].cluster_id)
19#define topology_core_id(cpu) (cpu_topology[cpu].core_id)
20#define topology_core_cpumask(cpu) (&cpu_topology[cpu].core_sibling)
21#define topology_thread_cpumask(cpu) (&cpu_topology[cpu].thread_sibling)
22
23#define mc_capable() (cpu_topology[0].cluster_id != -1)
24#define smt_capable() (cpu_topology[0].thread_id != -1)
25
26void init_cpu_topology(void);
27void store_cpu_topology(unsigned int cpuid);
28const struct cpumask *cpu_coregroup_mask(int cpu);
29
30#else
31
32static inline void init_cpu_topology(void) { }
33static inline void store_cpu_topology(unsigned int cpuid) { }
34
35#endif
36
37#include <asm-generic/topology.h>
38
39#endif /* _ASM_ARM_TOPOLOGY_H */
diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h
index 6c0f684aca81..3bf8f4e99a51 100644
--- a/arch/arm64/include/asm/uaccess.h
+++ b/arch/arm64/include/asm/uaccess.h
@@ -83,7 +83,7 @@ static inline void set_fs(mm_segment_t fs)
83 * Returns 1 if the range is valid, 0 otherwise. 83 * Returns 1 if the range is valid, 0 otherwise.
84 * 84 *
85 * This is equivalent to the following test: 85 * This is equivalent to the following test:
86 * (u65)addr + (u65)size < (u65)current->addr_limit 86 * (u65)addr + (u65)size <= current->addr_limit
87 * 87 *
88 * This needs 65-bit arithmetic. 88 * This needs 65-bit arithmetic.
89 */ 89 */
@@ -91,7 +91,7 @@ static inline void set_fs(mm_segment_t fs)
91({ \ 91({ \
92 unsigned long flag, roksum; \ 92 unsigned long flag, roksum; \
93 __chk_user_ptr(addr); \ 93 __chk_user_ptr(addr); \
94 asm("adds %1, %1, %3; ccmp %1, %4, #2, cc; cset %0, cc" \ 94 asm("adds %1, %1, %3; ccmp %1, %4, #2, cc; cset %0, ls" \
95 : "=&r" (flag), "=&r" (roksum) \ 95 : "=&r" (flag), "=&r" (roksum) \
96 : "1" (addr), "Ir" (size), \ 96 : "1" (addr), "Ir" (size), \
97 "r" (current_thread_info()->addr_limit) \ 97 "r" (current_thread_info()->addr_limit) \
diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
index 82ce217e94cf..a4654c656a1e 100644
--- a/arch/arm64/include/asm/unistd.h
+++ b/arch/arm64/include/asm/unistd.h
@@ -14,6 +14,7 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#ifdef CONFIG_COMPAT 16#ifdef CONFIG_COMPAT
17#define __ARCH_WANT_COMPAT_SYS_GETDENTS64
17#define __ARCH_WANT_COMPAT_STAT64 18#define __ARCH_WANT_COMPAT_STAT64
18#define __ARCH_WANT_SYS_GETHOSTNAME 19#define __ARCH_WANT_SYS_GETHOSTNAME
19#define __ARCH_WANT_SYS_PAUSE 20#define __ARCH_WANT_SYS_PAUSE
diff --git a/arch/arm64/include/uapi/asm/Kbuild b/arch/arm64/include/uapi/asm/Kbuild
index e4b78bdca19e..942376d37d22 100644
--- a/arch/arm64/include/uapi/asm/Kbuild
+++ b/arch/arm64/include/uapi/asm/Kbuild
@@ -9,6 +9,7 @@ header-y += byteorder.h
9header-y += fcntl.h 9header-y += fcntl.h
10header-y += hwcap.h 10header-y += hwcap.h
11header-y += kvm_para.h 11header-y += kvm_para.h
12header-y += perf_regs.h
12header-y += param.h 13header-y += param.h
13header-y += ptrace.h 14header-y += ptrace.h
14header-y += setup.h 15header-y += setup.h
diff --git a/arch/arm64/include/uapi/asm/perf_regs.h b/arch/arm64/include/uapi/asm/perf_regs.h
new file mode 100644
index 000000000000..172b8317ee49
--- /dev/null
+++ b/arch/arm64/include/uapi/asm/perf_regs.h
@@ -0,0 +1,40 @@
1#ifndef _ASM_ARM64_PERF_REGS_H
2#define _ASM_ARM64_PERF_REGS_H
3
4enum perf_event_arm_regs {
5 PERF_REG_ARM64_X0,
6 PERF_REG_ARM64_X1,
7 PERF_REG_ARM64_X2,
8 PERF_REG_ARM64_X3,
9 PERF_REG_ARM64_X4,
10 PERF_REG_ARM64_X5,
11 PERF_REG_ARM64_X6,
12 PERF_REG_ARM64_X7,
13 PERF_REG_ARM64_X8,
14 PERF_REG_ARM64_X9,
15 PERF_REG_ARM64_X10,
16 PERF_REG_ARM64_X11,
17 PERF_REG_ARM64_X12,
18 PERF_REG_ARM64_X13,
19 PERF_REG_ARM64_X14,
20 PERF_REG_ARM64_X15,
21 PERF_REG_ARM64_X16,
22 PERF_REG_ARM64_X17,
23 PERF_REG_ARM64_X18,
24 PERF_REG_ARM64_X19,
25 PERF_REG_ARM64_X20,
26 PERF_REG_ARM64_X21,
27 PERF_REG_ARM64_X22,
28 PERF_REG_ARM64_X23,
29 PERF_REG_ARM64_X24,
30 PERF_REG_ARM64_X25,
31 PERF_REG_ARM64_X26,
32 PERF_REG_ARM64_X27,
33 PERF_REG_ARM64_X28,
34 PERF_REG_ARM64_X29,
35 PERF_REG_ARM64_LR,
36 PERF_REG_ARM64_SP,
37 PERF_REG_ARM64_PC,
38 PERF_REG_ARM64_MAX,
39};
40#endif /* _ASM_ARM64_PERF_REGS_H */
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index 2d4554b13410..7d811d9522bc 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -14,12 +14,14 @@ arm64-obj-y := cputable.o debug-monitors.o entry.o irq.o fpsimd.o \
14arm64-obj-$(CONFIG_COMPAT) += sys32.o kuser32.o signal32.o \ 14arm64-obj-$(CONFIG_COMPAT) += sys32.o kuser32.o signal32.o \
15 sys_compat.o 15 sys_compat.o
16arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o module.o 16arm64-obj-$(CONFIG_MODULES) += arm64ksyms.o module.o
17arm64-obj-$(CONFIG_SMP) += smp.o smp_spin_table.o 17arm64-obj-$(CONFIG_SMP) += smp.o smp_spin_table.o topology.o
18arm64-obj-$(CONFIG_PERF_EVENTS) += perf_regs.o
18arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o 19arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o
19arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT)+= hw_breakpoint.o 20arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
20arm64-obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 21arm64-obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
21arm64-obj-$(CONFIG_ARM64_CPU_SUSPEND) += sleep.o suspend.o 22arm64-obj-$(CONFIG_ARM64_CPU_SUSPEND) += sleep.o suspend.o
22arm64-obj-$(CONFIG_JUMP_LABEL) += jump_label.o 23arm64-obj-$(CONFIG_JUMP_LABEL) += jump_label.o
24arm64-obj-$(CONFIG_KGDB) += kgdb.o
23 25
24obj-y += $(arm64-obj-y) vdso/ 26obj-y += $(arm64-obj-y) vdso/
25obj-m += $(arm64-obj-m) 27obj-m += $(arm64-obj-m)
diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
index 636ba8b6240b..14ba23c61153 100644
--- a/arch/arm64/kernel/debug-monitors.c
+++ b/arch/arm64/kernel/debug-monitors.c
@@ -137,7 +137,6 @@ void disable_debug_monitors(enum debug_el el)
137static void clear_os_lock(void *unused) 137static void clear_os_lock(void *unused)
138{ 138{
139 asm volatile("msr oslar_el1, %0" : : "r" (0)); 139 asm volatile("msr oslar_el1, %0" : : "r" (0));
140 isb();
141} 140}
142 141
143static int os_lock_notify(struct notifier_block *self, 142static int os_lock_notify(struct notifier_block *self,
@@ -156,8 +155,9 @@ static struct notifier_block os_lock_nb = {
156static int debug_monitors_init(void) 155static int debug_monitors_init(void)
157{ 156{
158 /* Clear the OS lock. */ 157 /* Clear the OS lock. */
159 smp_call_function(clear_os_lock, NULL, 1); 158 on_each_cpu(clear_os_lock, NULL, 1);
160 clear_os_lock(NULL); 159 isb();
160 local_dbg_enable();
161 161
162 /* Register hotplug handler. */ 162 /* Register hotplug handler. */
163 register_cpu_notifier(&os_lock_nb); 163 register_cpu_notifier(&os_lock_nb);
@@ -189,7 +189,7 @@ static void clear_regs_spsr_ss(struct pt_regs *regs)
189 189
190/* EL1 Single Step Handler hooks */ 190/* EL1 Single Step Handler hooks */
191static LIST_HEAD(step_hook); 191static LIST_HEAD(step_hook);
192DEFINE_RWLOCK(step_hook_lock); 192static DEFINE_RWLOCK(step_hook_lock);
193 193
194void register_step_hook(struct step_hook *hook) 194void register_step_hook(struct step_hook *hook)
195{ 195{
@@ -276,7 +276,7 @@ static int single_step_handler(unsigned long addr, unsigned int esr,
276 * Use reader/writer locks instead of plain spinlock. 276 * Use reader/writer locks instead of plain spinlock.
277 */ 277 */
278static LIST_HEAD(break_hook); 278static LIST_HEAD(break_hook);
279DEFINE_RWLOCK(break_hook_lock); 279static DEFINE_RWLOCK(break_hook_lock);
280 280
281void register_break_hook(struct break_hook *hook) 281void register_break_hook(struct break_hook *hook)
282{ 282{
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 0b281fffda51..61035d6814cb 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -384,26 +384,18 @@ ENDPROC(__calc_phys_offset)
384 * Preserves: tbl, flags 384 * Preserves: tbl, flags
385 * Corrupts: phys, start, end, pstate 385 * Corrupts: phys, start, end, pstate
386 */ 386 */
387 .macro create_block_map, tbl, flags, phys, start, end, idmap=0 387 .macro create_block_map, tbl, flags, phys, start, end
388 lsr \phys, \phys, #BLOCK_SHIFT 388 lsr \phys, \phys, #BLOCK_SHIFT
389 .if \idmap
390 and \start, \phys, #PTRS_PER_PTE - 1 // table index
391 .else
392 lsr \start, \start, #BLOCK_SHIFT 389 lsr \start, \start, #BLOCK_SHIFT
393 and \start, \start, #PTRS_PER_PTE - 1 // table index 390 and \start, \start, #PTRS_PER_PTE - 1 // table index
394 .endif
395 orr \phys, \flags, \phys, lsl #BLOCK_SHIFT // table entry 391 orr \phys, \flags, \phys, lsl #BLOCK_SHIFT // table entry
396 .ifnc \start,\end
397 lsr \end, \end, #BLOCK_SHIFT 392 lsr \end, \end, #BLOCK_SHIFT
398 and \end, \end, #PTRS_PER_PTE - 1 // table end index 393 and \end, \end, #PTRS_PER_PTE - 1 // table end index
399 .endif
4009999: str \phys, [\tbl, \start, lsl #3] // store the entry 3949999: str \phys, [\tbl, \start, lsl #3] // store the entry
401 .ifnc \start,\end
402 add \start, \start, #1 // next entry 395 add \start, \start, #1 // next entry
403 add \phys, \phys, #BLOCK_SIZE // next block 396 add \phys, \phys, #BLOCK_SIZE // next block
404 cmp \start, \end 397 cmp \start, \end
405 b.ls 9999b 398 b.ls 9999b
406 .endif
407 .endm 399 .endm
408 400
409/* 401/*
@@ -435,9 +427,13 @@ __create_page_tables:
435 * Create the identity mapping. 427 * Create the identity mapping.
436 */ 428 */
437 add x0, x25, #PAGE_SIZE // section table address 429 add x0, x25, #PAGE_SIZE // section table address
438 adr x3, __turn_mmu_on // virtual/physical address 430 ldr x3, =KERNEL_START
431 add x3, x3, x28 // __pa(KERNEL_START)
439 create_pgd_entry x25, x0, x3, x5, x6 432 create_pgd_entry x25, x0, x3, x5, x6
440 create_block_map x0, x7, x3, x5, x5, idmap=1 433 ldr x6, =KERNEL_END
434 mov x5, x3 // __pa(KERNEL_START)
435 add x6, x6, x28 // __pa(KERNEL_END)
436 create_block_map x0, x7, x3, x5, x6
441 437
442 /* 438 /*
443 * Map the kernel image (starting with PHYS_OFFSET). 439 * Map the kernel image (starting with PHYS_OFFSET).
@@ -445,7 +441,7 @@ __create_page_tables:
445 add x0, x26, #PAGE_SIZE // section table address 441 add x0, x26, #PAGE_SIZE // section table address
446 mov x5, #PAGE_OFFSET 442 mov x5, #PAGE_OFFSET
447 create_pgd_entry x26, x0, x5, x3, x6 443 create_pgd_entry x26, x0, x5, x3, x6
448 ldr x6, =KERNEL_END - 1 444 ldr x6, =KERNEL_END
449 mov x3, x24 // phys offset 445 mov x3, x24 // phys offset
450 create_block_map x0, x7, x3, x5, x6 446 create_block_map x0, x7, x3, x5, x6
451 447
diff --git a/arch/arm64/kernel/kgdb.c b/arch/arm64/kernel/kgdb.c
new file mode 100644
index 000000000000..75c9cf1aafee
--- /dev/null
+++ b/arch/arm64/kernel/kgdb.c
@@ -0,0 +1,336 @@
1/*
2 * AArch64 KGDB support
3 *
4 * Based on arch/arm/kernel/kgdb.c
5 *
6 * Copyright (C) 2013 Cavium Inc.
7 * Author: Vijaya Kumar K <vijaya.kumar@caviumnetworks.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include <linux/irq.h>
23#include <linux/kdebug.h>
24#include <linux/kgdb.h>
25#include <asm/traps.h>
26
27struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = {
28 { "x0", 8, offsetof(struct pt_regs, regs[0])},
29 { "x1", 8, offsetof(struct pt_regs, regs[1])},
30 { "x2", 8, offsetof(struct pt_regs, regs[2])},
31 { "x3", 8, offsetof(struct pt_regs, regs[3])},
32 { "x4", 8, offsetof(struct pt_regs, regs[4])},
33 { "x5", 8, offsetof(struct pt_regs, regs[5])},
34 { "x6", 8, offsetof(struct pt_regs, regs[6])},
35 { "x7", 8, offsetof(struct pt_regs, regs[7])},
36 { "x8", 8, offsetof(struct pt_regs, regs[8])},
37 { "x9", 8, offsetof(struct pt_regs, regs[9])},
38 { "x10", 8, offsetof(struct pt_regs, regs[10])},
39 { "x11", 8, offsetof(struct pt_regs, regs[11])},
40 { "x12", 8, offsetof(struct pt_regs, regs[12])},
41 { "x13", 8, offsetof(struct pt_regs, regs[13])},
42 { "x14", 8, offsetof(struct pt_regs, regs[14])},
43 { "x15", 8, offsetof(struct pt_regs, regs[15])},
44 { "x16", 8, offsetof(struct pt_regs, regs[16])},
45 { "x17", 8, offsetof(struct pt_regs, regs[17])},
46 { "x18", 8, offsetof(struct pt_regs, regs[18])},
47 { "x19", 8, offsetof(struct pt_regs, regs[19])},
48 { "x20", 8, offsetof(struct pt_regs, regs[20])},
49 { "x21", 8, offsetof(struct pt_regs, regs[21])},
50 { "x22", 8, offsetof(struct pt_regs, regs[22])},
51 { "x23", 8, offsetof(struct pt_regs, regs[23])},
52 { "x24", 8, offsetof(struct pt_regs, regs[24])},
53 { "x25", 8, offsetof(struct pt_regs, regs[25])},
54 { "x26", 8, offsetof(struct pt_regs, regs[26])},
55 { "x27", 8, offsetof(struct pt_regs, regs[27])},
56 { "x28", 8, offsetof(struct pt_regs, regs[28])},
57 { "x29", 8, offsetof(struct pt_regs, regs[29])},
58 { "x30", 8, offsetof(struct pt_regs, regs[30])},
59 { "sp", 8, offsetof(struct pt_regs, sp)},
60 { "pc", 8, offsetof(struct pt_regs, pc)},
61 { "pstate", 8, offsetof(struct pt_regs, pstate)},
62 { "v0", 16, -1 },
63 { "v1", 16, -1 },
64 { "v2", 16, -1 },
65 { "v3", 16, -1 },
66 { "v4", 16, -1 },
67 { "v5", 16, -1 },
68 { "v6", 16, -1 },
69 { "v7", 16, -1 },
70 { "v8", 16, -1 },
71 { "v9", 16, -1 },
72 { "v10", 16, -1 },
73 { "v11", 16, -1 },
74 { "v12", 16, -1 },
75 { "v13", 16, -1 },
76 { "v14", 16, -1 },
77 { "v15", 16, -1 },
78 { "v16", 16, -1 },
79 { "v17", 16, -1 },
80 { "v18", 16, -1 },
81 { "v19", 16, -1 },
82 { "v20", 16, -1 },
83 { "v21", 16, -1 },
84 { "v22", 16, -1 },
85 { "v23", 16, -1 },
86 { "v24", 16, -1 },
87 { "v25", 16, -1 },
88 { "v26", 16, -1 },
89 { "v27", 16, -1 },
90 { "v28", 16, -1 },
91 { "v29", 16, -1 },
92 { "v30", 16, -1 },
93 { "v31", 16, -1 },
94 { "fpsr", 4, -1 },
95 { "fpcr", 4, -1 },
96};
97
98char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs)
99{
100 if (regno >= DBG_MAX_REG_NUM || regno < 0)
101 return NULL;
102
103 if (dbg_reg_def[regno].offset != -1)
104 memcpy(mem, (void *)regs + dbg_reg_def[regno].offset,
105 dbg_reg_def[regno].size);
106 else
107 memset(mem, 0, dbg_reg_def[regno].size);
108 return dbg_reg_def[regno].name;
109}
110
111int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)
112{
113 if (regno >= DBG_MAX_REG_NUM || regno < 0)
114 return -EINVAL;
115
116 if (dbg_reg_def[regno].offset != -1)
117 memcpy((void *)regs + dbg_reg_def[regno].offset, mem,
118 dbg_reg_def[regno].size);
119 return 0;
120}
121
122void
123sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *task)
124{
125 struct pt_regs *thread_regs;
126
127 /* Initialize to zero */
128 memset((char *)gdb_regs, 0, NUMREGBYTES);
129 thread_regs = task_pt_regs(task);
130 memcpy((void *)gdb_regs, (void *)thread_regs->regs, GP_REG_BYTES);
131}
132
133void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)
134{
135 regs->pc = pc;
136}
137
138static int compiled_break;
139
140static void kgdb_arch_update_addr(struct pt_regs *regs,
141 char *remcom_in_buffer)
142{
143 unsigned long addr;
144 char *ptr;
145
146 ptr = &remcom_in_buffer[1];
147 if (kgdb_hex2long(&ptr, &addr))
148 kgdb_arch_set_pc(regs, addr);
149 else if (compiled_break == 1)
150 kgdb_arch_set_pc(regs, regs->pc + 4);
151
152 compiled_break = 0;
153}
154
155int kgdb_arch_handle_exception(int exception_vector, int signo,
156 int err_code, char *remcom_in_buffer,
157 char *remcom_out_buffer,
158 struct pt_regs *linux_regs)
159{
160 int err;
161
162 switch (remcom_in_buffer[0]) {
163 case 'D':
164 case 'k':
165 /*
166 * Packet D (Detach), k (kill). No special handling
167 * is required here. Handle same as c packet.
168 */
169 case 'c':
170 /*
171 * Packet c (Continue) to continue executing.
172 * Set pc to required address.
173 * Try to read optional parameter and set pc.
174 * If this was a compiled breakpoint, we need to move
175 * to the next instruction else we will just breakpoint
176 * over and over again.
177 */
178 kgdb_arch_update_addr(linux_regs, remcom_in_buffer);
179 atomic_set(&kgdb_cpu_doing_single_step, -1);
180 kgdb_single_step = 0;
181
182 /*
183 * Received continue command, disable single step
184 */
185 if (kernel_active_single_step())
186 kernel_disable_single_step();
187
188 err = 0;
189 break;
190 case 's':
191 /*
192 * Update step address value with address passed
193 * with step packet.
194 * On debug exception return PC is copied to ELR
195 * So just update PC.
196 * If no step address is passed, resume from the address
197 * pointed by PC. Do not update PC
198 */
199 kgdb_arch_update_addr(linux_regs, remcom_in_buffer);
200 atomic_set(&kgdb_cpu_doing_single_step, raw_smp_processor_id());
201 kgdb_single_step = 1;
202
203 /*
204 * Enable single step handling
205 */
206 if (!kernel_active_single_step())
207 kernel_enable_single_step(linux_regs);
208 err = 0;
209 break;
210 default:
211 err = -1;
212 }
213 return err;
214}
215
216static int kgdb_brk_fn(struct pt_regs *regs, unsigned int esr)
217{
218 kgdb_handle_exception(1, SIGTRAP, 0, regs);
219 return 0;
220}
221
222static int kgdb_compiled_brk_fn(struct pt_regs *regs, unsigned int esr)
223{
224 compiled_break = 1;
225 kgdb_handle_exception(1, SIGTRAP, 0, regs);
226
227 return 0;
228}
229
230static int kgdb_step_brk_fn(struct pt_regs *regs, unsigned int esr)
231{
232 kgdb_handle_exception(1, SIGTRAP, 0, regs);
233 return 0;
234}
235
236static struct break_hook kgdb_brkpt_hook = {
237 .esr_mask = 0xffffffff,
238 .esr_val = DBG_ESR_VAL_BRK(KGDB_DYN_DGB_BRK_IMM),
239 .fn = kgdb_brk_fn
240};
241
242static struct break_hook kgdb_compiled_brkpt_hook = {
243 .esr_mask = 0xffffffff,
244 .esr_val = DBG_ESR_VAL_BRK(KDBG_COMPILED_DBG_BRK_IMM),
245 .fn = kgdb_compiled_brk_fn
246};
247
248static struct step_hook kgdb_step_hook = {
249 .fn = kgdb_step_brk_fn
250};
251
252static void kgdb_call_nmi_hook(void *ignored)
253{
254 kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs());
255}
256
257void kgdb_roundup_cpus(unsigned long flags)
258{
259 local_irq_enable();
260 smp_call_function(kgdb_call_nmi_hook, NULL, 0);
261 local_irq_disable();
262}
263
264static int __kgdb_notify(struct die_args *args, unsigned long cmd)
265{
266 struct pt_regs *regs = args->regs;
267
268 if (kgdb_handle_exception(1, args->signr, cmd, regs))
269 return NOTIFY_DONE;
270 return NOTIFY_STOP;
271}
272
273static int
274kgdb_notify(struct notifier_block *self, unsigned long cmd, void *ptr)
275{
276 unsigned long flags;
277 int ret;
278
279 local_irq_save(flags);
280 ret = __kgdb_notify(ptr, cmd);
281 local_irq_restore(flags);
282
283 return ret;
284}
285
286static struct notifier_block kgdb_notifier = {
287 .notifier_call = kgdb_notify,
288 /*
289 * Want to be lowest priority
290 */
291 .priority = -INT_MAX,
292};
293
294/*
295 * kgdb_arch_init - Perform any architecture specific initalization.
296 * This function will handle the initalization of any architecture
297 * specific callbacks.
298 */
299int kgdb_arch_init(void)
300{
301 int ret = register_die_notifier(&kgdb_notifier);
302
303 if (ret != 0)
304 return ret;
305
306 register_break_hook(&kgdb_brkpt_hook);
307 register_break_hook(&kgdb_compiled_brkpt_hook);
308 register_step_hook(&kgdb_step_hook);
309 return 0;
310}
311
312/*
313 * kgdb_arch_exit - Perform any architecture specific uninitalization.
314 * This function will handle the uninitalization of any architecture
315 * specific callbacks, for dynamic registration and unregistration.
316 */
317void kgdb_arch_exit(void)
318{
319 unregister_break_hook(&kgdb_brkpt_hook);
320 unregister_break_hook(&kgdb_compiled_brkpt_hook);
321 unregister_step_hook(&kgdb_step_hook);
322 unregister_die_notifier(&kgdb_notifier);
323}
324
325/*
326 * ARM instructions are always in LE.
327 * Break instruction is encoded in LE format
328 */
329struct kgdb_arch arch_kgdb_ops = {
330 .gdb_bpt_instr = {
331 KGDB_DYN_BRK_INS_BYTE0,
332 KGDB_DYN_BRK_INS_BYTE1,
333 KGDB_DYN_BRK_INS_BYTE2,
334 KGDB_DYN_BRK_INS_BYTE3,
335 }
336};
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index 5b1cd792274a..e868c72a7938 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -1348,8 +1348,8 @@ early_initcall(init_hw_perf_events);
1348 * Callchain handling code. 1348 * Callchain handling code.
1349 */ 1349 */
1350struct frame_tail { 1350struct frame_tail {
1351 struct frame_tail __user *fp; 1351 struct frame_tail __user *fp;
1352 unsigned long lr; 1352 unsigned long lr;
1353} __attribute__((packed)); 1353} __attribute__((packed));
1354 1354
1355/* 1355/*
@@ -1386,22 +1386,80 @@ user_backtrace(struct frame_tail __user *tail,
1386 return buftail.fp; 1386 return buftail.fp;
1387} 1387}
1388 1388
1389/*
1390 * The registers we're interested in are at the end of the variable
1391 * length saved register structure. The fp points at the end of this
1392 * structure so the address of this struct is:
1393 * (struct compat_frame_tail *)(xxx->fp)-1
1394 *
1395 * This code has been adapted from the ARM OProfile support.
1396 */
1397struct compat_frame_tail {
1398 compat_uptr_t fp; /* a (struct compat_frame_tail *) in compat mode */
1399 u32 sp;
1400 u32 lr;
1401} __attribute__((packed));
1402
1403static struct compat_frame_tail __user *
1404compat_user_backtrace(struct compat_frame_tail __user *tail,
1405 struct perf_callchain_entry *entry)
1406{
1407 struct compat_frame_tail buftail;
1408 unsigned long err;
1409
1410 /* Also check accessibility of one struct frame_tail beyond */
1411 if (!access_ok(VERIFY_READ, tail, sizeof(buftail)))
1412 return NULL;
1413
1414 pagefault_disable();
1415 err = __copy_from_user_inatomic(&buftail, tail, sizeof(buftail));
1416 pagefault_enable();
1417
1418 if (err)
1419 return NULL;
1420
1421 perf_callchain_store(entry, buftail.lr);
1422
1423 /*
1424 * Frame pointers should strictly progress back up the stack
1425 * (towards higher addresses).
1426 */
1427 if (tail + 1 >= (struct compat_frame_tail __user *)
1428 compat_ptr(buftail.fp))
1429 return NULL;
1430
1431 return (struct compat_frame_tail __user *)compat_ptr(buftail.fp) - 1;
1432}
1433
1389void perf_callchain_user(struct perf_callchain_entry *entry, 1434void perf_callchain_user(struct perf_callchain_entry *entry,
1390 struct pt_regs *regs) 1435 struct pt_regs *regs)
1391{ 1436{
1392 struct frame_tail __user *tail;
1393
1394 if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) { 1437 if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) {
1395 /* We don't support guest os callchain now */ 1438 /* We don't support guest os callchain now */
1396 return; 1439 return;
1397 } 1440 }
1398 1441
1399 perf_callchain_store(entry, regs->pc); 1442 perf_callchain_store(entry, regs->pc);
1400 tail = (struct frame_tail __user *)regs->regs[29];
1401 1443
1402 while (entry->nr < PERF_MAX_STACK_DEPTH && 1444 if (!compat_user_mode(regs)) {
1403 tail && !((unsigned long)tail & 0xf)) 1445 /* AARCH64 mode */
1404 tail = user_backtrace(tail, entry); 1446 struct frame_tail __user *tail;
1447
1448 tail = (struct frame_tail __user *)regs->regs[29];
1449
1450 while (entry->nr < PERF_MAX_STACK_DEPTH &&
1451 tail && !((unsigned long)tail & 0xf))
1452 tail = user_backtrace(tail, entry);
1453 } else {
1454 /* AARCH32 compat mode */
1455 struct compat_frame_tail __user *tail;
1456
1457 tail = (struct compat_frame_tail __user *)regs->compat_fp - 1;
1458
1459 while ((entry->nr < PERF_MAX_STACK_DEPTH) &&
1460 tail && !((unsigned long)tail & 0x3))
1461 tail = compat_user_backtrace(tail, entry);
1462 }
1405} 1463}
1406 1464
1407/* 1465/*
@@ -1429,6 +1487,7 @@ void perf_callchain_kernel(struct perf_callchain_entry *entry,
1429 frame.fp = regs->regs[29]; 1487 frame.fp = regs->regs[29];
1430 frame.sp = regs->sp; 1488 frame.sp = regs->sp;
1431 frame.pc = regs->pc; 1489 frame.pc = regs->pc;
1490
1432 walk_stackframe(&frame, callchain_trace, entry); 1491 walk_stackframe(&frame, callchain_trace, entry);
1433} 1492}
1434 1493
diff --git a/arch/arm64/kernel/perf_regs.c b/arch/arm64/kernel/perf_regs.c
new file mode 100644
index 000000000000..f2d6f0a36d63
--- /dev/null
+++ b/arch/arm64/kernel/perf_regs.c
@@ -0,0 +1,44 @@
1#include <linux/errno.h>
2#include <linux/kernel.h>
3#include <linux/perf_event.h>
4#include <linux/bug.h>
5#include <asm/perf_regs.h>
6#include <asm/ptrace.h>
7
8u64 perf_reg_value(struct pt_regs *regs, int idx)
9{
10 if (WARN_ON_ONCE((u32)idx >= PERF_REG_ARM64_MAX))
11 return 0;
12
13 /*
14 * Compat (i.e. 32 bit) mode:
15 * - PC has been set in the pt_regs struct in kernel_entry,
16 * - Handle SP and LR here.
17 */
18 if (compat_user_mode(regs)) {
19 if ((u32)idx == PERF_REG_ARM64_SP)
20 return regs->compat_sp;
21 if ((u32)idx == PERF_REG_ARM64_LR)
22 return regs->compat_lr;
23 }
24
25 return regs->regs[idx];
26}
27
28#define REG_RESERVED (~((1ULL << PERF_REG_ARM64_MAX) - 1))
29
30int perf_reg_validate(u64 mask)
31{
32 if (!mask || mask & REG_RESERVED)
33 return -EINVAL;
34
35 return 0;
36}
37
38u64 perf_reg_abi(struct task_struct *task)
39{
40 if (is_compat_thread(task_thread_info(task)))
41 return PERF_SAMPLE_REGS_ABI_32;
42 else
43 return PERF_SAMPLE_REGS_ABI_64;
44}
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 9cce0098f4cd..6391485f342d 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -71,8 +71,17 @@ static void setup_restart(void)
71 71
72void soft_restart(unsigned long addr) 72void soft_restart(unsigned long addr)
73{ 73{
74 typedef void (*phys_reset_t)(unsigned long);
75 phys_reset_t phys_reset;
76
74 setup_restart(); 77 setup_restart();
75 cpu_reset(addr); 78
79 /* Switch to the identity mapping */
80 phys_reset = (phys_reset_t)virt_to_phys(cpu_reset);
81 phys_reset(addr);
82
83 /* Should never get here */
84 BUG();
76} 85}
77 86
78/* 87/*
diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
index 4f97db3d7363..ea4828a4aa96 100644
--- a/arch/arm64/kernel/psci.c
+++ b/arch/arm64/kernel/psci.c
@@ -176,22 +176,20 @@ static const struct of_device_id psci_of_match[] __initconst = {
176 {}, 176 {},
177}; 177};
178 178
179int __init psci_init(void) 179void __init psci_init(void)
180{ 180{
181 struct device_node *np; 181 struct device_node *np;
182 const char *method; 182 const char *method;
183 u32 id; 183 u32 id;
184 int err = 0;
185 184
186 np = of_find_matching_node(NULL, psci_of_match); 185 np = of_find_matching_node(NULL, psci_of_match);
187 if (!np) 186 if (!np)
188 return -ENODEV; 187 return;
189 188
190 pr_info("probing function IDs from device-tree\n"); 189 pr_info("probing function IDs from device-tree\n");
191 190
192 if (of_property_read_string(np, "method", &method)) { 191 if (of_property_read_string(np, "method", &method)) {
193 pr_warning("missing \"method\" property\n"); 192 pr_warning("missing \"method\" property\n");
194 err = -ENXIO;
195 goto out_put_node; 193 goto out_put_node;
196 } 194 }
197 195
@@ -201,7 +199,6 @@ int __init psci_init(void)
201 invoke_psci_fn = __invoke_psci_fn_smc; 199 invoke_psci_fn = __invoke_psci_fn_smc;
202 } else { 200 } else {
203 pr_warning("invalid \"method\" property: %s\n", method); 201 pr_warning("invalid \"method\" property: %s\n", method);
204 err = -EINVAL;
205 goto out_put_node; 202 goto out_put_node;
206 } 203 }
207 204
@@ -227,7 +224,7 @@ int __init psci_init(void)
227 224
228out_put_node: 225out_put_node:
229 of_node_put(np); 226 of_node_put(np);
230 return err; 227 return;
231} 228}
232 229
233#ifdef CONFIG_SMP 230#ifdef CONFIG_SMP
@@ -251,7 +248,7 @@ static int cpu_psci_cpu_boot(unsigned int cpu)
251{ 248{
252 int err = psci_ops.cpu_on(cpu_logical_map(cpu), __pa(secondary_entry)); 249 int err = psci_ops.cpu_on(cpu_logical_map(cpu), __pa(secondary_entry));
253 if (err) 250 if (err)
254 pr_err("psci: failed to boot CPU%d (%d)\n", cpu, err); 251 pr_err("failed to boot CPU%d (%d)\n", cpu, err);
255 252
256 return err; 253 return err;
257} 254}
@@ -278,7 +275,7 @@ static void cpu_psci_cpu_die(unsigned int cpu)
278 275
279 ret = psci_ops.cpu_off(state); 276 ret = psci_ops.cpu_off(state);
280 277
281 pr_crit("psci: unable to power off CPU%u (%d)\n", cpu, ret); 278 pr_crit("unable to power off CPU%u (%d)\n", cpu, ret);
282} 279}
283#endif 280#endif
284 281
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index c8e9effe52e1..67da30741a1b 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -69,6 +69,7 @@ EXPORT_SYMBOL_GPL(elf_hwcap);
69 COMPAT_HWCAP_VFPv3|COMPAT_HWCAP_VFPv4|\ 69 COMPAT_HWCAP_VFPv3|COMPAT_HWCAP_VFPv4|\
70 COMPAT_HWCAP_NEON|COMPAT_HWCAP_IDIV) 70 COMPAT_HWCAP_NEON|COMPAT_HWCAP_IDIV)
71unsigned int compat_elf_hwcap __read_mostly = COMPAT_ELF_HWCAP_DEFAULT; 71unsigned int compat_elf_hwcap __read_mostly = COMPAT_ELF_HWCAP_DEFAULT;
72unsigned int compat_elf_hwcap2 __read_mostly;
72#endif 73#endif
73 74
74static const char *cpu_name; 75static const char *cpu_name;
@@ -242,6 +243,38 @@ static void __init setup_processor(void)
242 block = (features >> 16) & 0xf; 243 block = (features >> 16) & 0xf;
243 if (block && !(block & 0x8)) 244 if (block && !(block & 0x8))
244 elf_hwcap |= HWCAP_CRC32; 245 elf_hwcap |= HWCAP_CRC32;
246
247#ifdef CONFIG_COMPAT
248 /*
249 * ID_ISAR5_EL1 carries similar information as above, but pertaining to
250 * the Aarch32 32-bit execution state.
251 */
252 features = read_cpuid(ID_ISAR5_EL1);
253 block = (features >> 4) & 0xf;
254 if (!(block & 0x8)) {
255 switch (block) {
256 default:
257 case 2:
258 compat_elf_hwcap2 |= COMPAT_HWCAP2_PMULL;
259 case 1:
260 compat_elf_hwcap2 |= COMPAT_HWCAP2_AES;
261 case 0:
262 break;
263 }
264 }
265
266 block = (features >> 8) & 0xf;
267 if (block && !(block & 0x8))
268 compat_elf_hwcap2 |= COMPAT_HWCAP2_SHA1;
269
270 block = (features >> 12) & 0xf;
271 if (block && !(block & 0x8))
272 compat_elf_hwcap2 |= COMPAT_HWCAP2_SHA2;
273
274 block = (features >> 16) & 0xf;
275 if (block && !(block & 0x8))
276 compat_elf_hwcap2 |= COMPAT_HWCAP2_CRC32;
277#endif
245} 278}
246 279
247static void __init setup_machine_fdt(phys_addr_t dt_phys) 280static void __init setup_machine_fdt(phys_addr_t dt_phys)
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c
index 7cfb92a4ab66..f0a141dd5655 100644
--- a/arch/arm64/kernel/smp.c
+++ b/arch/arm64/kernel/smp.c
@@ -114,6 +114,11 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
114 return ret; 114 return ret;
115} 115}
116 116
117static void smp_store_cpu_info(unsigned int cpuid)
118{
119 store_cpu_topology(cpuid);
120}
121
117/* 122/*
118 * This is the secondary CPU boot entry. We're using this CPUs 123 * This is the secondary CPU boot entry. We're using this CPUs
119 * idle thread stack, but a set of temporary page tables. 124 * idle thread stack, but a set of temporary page tables.
@@ -152,6 +157,8 @@ asmlinkage void secondary_start_kernel(void)
152 */ 157 */
153 notify_cpu_starting(cpu); 158 notify_cpu_starting(cpu);
154 159
160 smp_store_cpu_info(cpu);
161
155 /* 162 /*
156 * OK, now it's safe to let the boot CPU continue. Wait for 163 * OK, now it's safe to let the boot CPU continue. Wait for
157 * the CPU migration code to notice that the CPU is online 164 * the CPU migration code to notice that the CPU is online
@@ -160,6 +167,7 @@ asmlinkage void secondary_start_kernel(void)
160 set_cpu_online(cpu, true); 167 set_cpu_online(cpu, true);
161 complete(&cpu_running); 168 complete(&cpu_running);
162 169
170 local_dbg_enable();
163 local_irq_enable(); 171 local_irq_enable();
164 local_async_enable(); 172 local_async_enable();
165 173
@@ -390,6 +398,10 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
390 int err; 398 int err;
391 unsigned int cpu, ncores = num_possible_cpus(); 399 unsigned int cpu, ncores = num_possible_cpus();
392 400
401 init_cpu_topology();
402
403 smp_store_cpu_info(smp_processor_id());
404
393 /* 405 /*
394 * are we trying to boot more cores than exist? 406 * are we trying to boot more cores than exist?
395 */ 407 */
diff --git a/arch/arm64/kernel/smp_spin_table.c b/arch/arm64/kernel/smp_spin_table.c
index 44c22805d2e2..7a530d2cc807 100644
--- a/arch/arm64/kernel/smp_spin_table.c
+++ b/arch/arm64/kernel/smp_spin_table.c
@@ -128,7 +128,7 @@ static int smp_spin_table_cpu_boot(unsigned int cpu)
128 return secondary_holding_pen_release != INVALID_HWID ? -ENOSYS : 0; 128 return secondary_holding_pen_release != INVALID_HWID ? -ENOSYS : 0;
129} 129}
130 130
131void smp_spin_table_cpu_postboot(void) 131static void smp_spin_table_cpu_postboot(void)
132{ 132{
133 /* 133 /*
134 * Let the primary processor know we're out of the pen. 134 * Let the primary processor know we're out of the pen.
diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c
new file mode 100644
index 000000000000..3e06b0be4ec8
--- /dev/null
+++ b/arch/arm64/kernel/topology.c
@@ -0,0 +1,95 @@
1/*
2 * arch/arm64/kernel/topology.c
3 *
4 * Copyright (C) 2011,2013,2014 Linaro Limited.
5 *
6 * Based on the arm32 version written by Vincent Guittot in turn based on
7 * arch/sh/kernel/topology.c
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 */
13
14#include <linux/cpu.h>
15#include <linux/cpumask.h>
16#include <linux/init.h>
17#include <linux/percpu.h>
18#include <linux/node.h>
19#include <linux/nodemask.h>
20#include <linux/sched.h>
21
22#include <asm/topology.h>
23
24/*
25 * cpu topology table
26 */
27struct cpu_topology cpu_topology[NR_CPUS];
28EXPORT_SYMBOL_GPL(cpu_topology);
29
30const struct cpumask *cpu_coregroup_mask(int cpu)
31{
32 return &cpu_topology[cpu].core_sibling;
33}
34
35static void update_siblings_masks(unsigned int cpuid)
36{
37 struct cpu_topology *cpu_topo, *cpuid_topo = &cpu_topology[cpuid];
38 int cpu;
39
40 if (cpuid_topo->cluster_id == -1) {
41 /*
42 * DT does not contain topology information for this cpu
43 * reset it to default behaviour
44 */
45 pr_debug("CPU%u: No topology information configured\n", cpuid);
46 cpuid_topo->core_id = 0;
47 cpumask_set_cpu(cpuid, &cpuid_topo->core_sibling);
48 cpumask_set_cpu(cpuid, &cpuid_topo->thread_sibling);
49 return;
50 }
51
52 /* update core and thread sibling masks */
53 for_each_possible_cpu(cpu) {
54 cpu_topo = &cpu_topology[cpu];
55
56 if (cpuid_topo->cluster_id != cpu_topo->cluster_id)
57 continue;
58
59 cpumask_set_cpu(cpuid, &cpu_topo->core_sibling);
60 if (cpu != cpuid)
61 cpumask_set_cpu(cpu, &cpuid_topo->core_sibling);
62
63 if (cpuid_topo->core_id != cpu_topo->core_id)
64 continue;
65
66 cpumask_set_cpu(cpuid, &cpu_topo->thread_sibling);
67 if (cpu != cpuid)
68 cpumask_set_cpu(cpu, &cpuid_topo->thread_sibling);
69 }
70}
71
72void store_cpu_topology(unsigned int cpuid)
73{
74 update_siblings_masks(cpuid);
75}
76
77/*
78 * init_cpu_topology is called at boot when only one cpu is running
79 * which prevent simultaneous write access to cpu_topology array
80 */
81void __init init_cpu_topology(void)
82{
83 unsigned int cpu;
84
85 /* init core mask and power*/
86 for_each_possible_cpu(cpu) {
87 struct cpu_topology *cpu_topo = &cpu_topology[cpu];
88
89 cpu_topo->thread_id = -1;
90 cpu_topo->core_id = -1;
91 cpu_topo->cluster_id = -1;
92 cpumask_clear(&cpu_topo->core_sibling);
93 cpumask_clear(&cpu_topo->thread_sibling);
94 }
95}
diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
index a7149cae1615..50384fec56c4 100644
--- a/arch/arm64/kernel/vdso.c
+++ b/arch/arm64/kernel/vdso.c
@@ -106,49 +106,31 @@ int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp)
106 106
107static int __init vdso_init(void) 107static int __init vdso_init(void)
108{ 108{
109 struct page *pg; 109 int i;
110 char *vbase; 110
111 int i, ret = 0; 111 if (memcmp(&vdso_start, "\177ELF", 4)) {
112 pr_err("vDSO is not a valid ELF object!\n");
113 return -EINVAL;
114 }
112 115
113 vdso_pages = (&vdso_end - &vdso_start) >> PAGE_SHIFT; 116 vdso_pages = (&vdso_end - &vdso_start) >> PAGE_SHIFT;
114 pr_info("vdso: %ld pages (%ld code, %ld data) at base %p\n", 117 pr_info("vdso: %ld pages (%ld code, %ld data) at base %p\n",
115 vdso_pages + 1, vdso_pages, 1L, &vdso_start); 118 vdso_pages + 1, vdso_pages, 1L, &vdso_start);
116 119
117 /* Allocate the vDSO pagelist, plus a page for the data. */ 120 /* Allocate the vDSO pagelist, plus a page for the data. */
118 vdso_pagelist = kzalloc(sizeof(struct page *) * (vdso_pages + 1), 121 vdso_pagelist = kcalloc(vdso_pages + 1, sizeof(struct page *),
119 GFP_KERNEL); 122 GFP_KERNEL);
120 if (vdso_pagelist == NULL) { 123 if (vdso_pagelist == NULL)
121 pr_err("Failed to allocate vDSO pagelist!\n");
122 return -ENOMEM; 124 return -ENOMEM;
123 }
124 125
125 /* Grab the vDSO code pages. */ 126 /* Grab the vDSO code pages. */
126 for (i = 0; i < vdso_pages; i++) { 127 for (i = 0; i < vdso_pages; i++)
127 pg = virt_to_page(&vdso_start + i*PAGE_SIZE); 128 vdso_pagelist[i] = virt_to_page(&vdso_start + i * PAGE_SIZE);
128 ClearPageReserved(pg);
129 get_page(pg);
130 vdso_pagelist[i] = pg;
131 }
132
133 /* Sanity check the shared object header. */
134 vbase = vmap(vdso_pagelist, 1, 0, PAGE_KERNEL);
135 if (vbase == NULL) {
136 pr_err("Failed to map vDSO pagelist!\n");
137 return -ENOMEM;
138 } else if (memcmp(vbase, "\177ELF", 4)) {
139 pr_err("vDSO is not a valid ELF object!\n");
140 ret = -EINVAL;
141 goto unmap;
142 }
143 129
144 /* Grab the vDSO data page. */ 130 /* Grab the vDSO data page. */
145 pg = virt_to_page(vdso_data); 131 vdso_pagelist[i] = virt_to_page(vdso_data);
146 get_page(pg);
147 vdso_pagelist[i] = pg;
148 132
149unmap: 133 return 0;
150 vunmap(vbase);
151 return ret;
152} 134}
153arch_initcall(vdso_init); 135arch_initcall(vdso_init);
154 136
diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S
index 2b0244d65c16..d968796f4b2d 100644
--- a/arch/arm64/kvm/hyp-init.S
+++ b/arch/arm64/kvm/hyp-init.S
@@ -68,6 +68,12 @@ __do_hyp_init:
68 msr tcr_el2, x4 68 msr tcr_el2, x4
69 69
70 ldr x4, =VTCR_EL2_FLAGS 70 ldr x4, =VTCR_EL2_FLAGS
71 /*
72 * Read the PARange bits from ID_AA64MMFR0_EL1 and set the PS bits in
73 * VTCR_EL2.
74 */
75 mrs x5, ID_AA64MMFR0_EL1
76 bfi x4, x5, #16, #3
71 msr vtcr_el2, x4 77 msr vtcr_el2, x4
72 78
73 mrs x4, mair_el1 79 mrs x4, mair_el1
diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S
index 1ea9f26d1b70..c46f48b33c14 100644
--- a/arch/arm64/mm/cache.S
+++ b/arch/arm64/mm/cache.S
@@ -30,7 +30,7 @@
30 * 30 *
31 * Corrupted registers: x0-x7, x9-x11 31 * Corrupted registers: x0-x7, x9-x11
32 */ 32 */
33ENTRY(__flush_dcache_all) 33__flush_dcache_all:
34 dsb sy // ensure ordering with previous memory accesses 34 dsb sy // ensure ordering with previous memory accesses
35 mrs x0, clidr_el1 // read clidr 35 mrs x0, clidr_el1 // read clidr
36 and x3, x0, #0x7000000 // extract loc from clidr 36 and x3, x0, #0x7000000 // extract loc from clidr
@@ -166,3 +166,81 @@ ENTRY(__flush_dcache_area)
166 dsb sy 166 dsb sy
167 ret 167 ret
168ENDPROC(__flush_dcache_area) 168ENDPROC(__flush_dcache_area)
169
170/*
171 * __dma_inv_range(start, end)
172 * - start - virtual start address of region
173 * - end - virtual end address of region
174 */
175__dma_inv_range:
176 dcache_line_size x2, x3
177 sub x3, x2, #1
178 bic x0, x0, x3
179 bic x1, x1, x3
1801: dc ivac, x0 // invalidate D / U line
181 add x0, x0, x2
182 cmp x0, x1
183 b.lo 1b
184 dsb sy
185 ret
186ENDPROC(__dma_inv_range)
187
188/*
189 * __dma_clean_range(start, end)
190 * - start - virtual start address of region
191 * - end - virtual end address of region
192 */
193__dma_clean_range:
194 dcache_line_size x2, x3
195 sub x3, x2, #1
196 bic x0, x0, x3
1971: dc cvac, x0 // clean D / U line
198 add x0, x0, x2
199 cmp x0, x1
200 b.lo 1b
201 dsb sy
202 ret
203ENDPROC(__dma_clean_range)
204
205/*
206 * __dma_flush_range(start, end)
207 * - start - virtual start address of region
208 * - end - virtual end address of region
209 */
210ENTRY(__dma_flush_range)
211 dcache_line_size x2, x3
212 sub x3, x2, #1
213 bic x0, x0, x3
2141: dc civac, x0 // clean & invalidate D / U line
215 add x0, x0, x2
216 cmp x0, x1
217 b.lo 1b
218 dsb sy
219 ret
220ENDPROC(__dma_flush_range)
221
222/*
223 * __dma_map_area(start, size, dir)
224 * - start - kernel virtual start address
225 * - size - size of region
226 * - dir - DMA direction
227 */
228ENTRY(__dma_map_area)
229 add x1, x1, x0
230 cmp w2, #DMA_FROM_DEVICE
231 b.eq __dma_inv_range
232 b __dma_clean_range
233ENDPROC(__dma_map_area)
234
235/*
236 * __dma_unmap_area(start, size, dir)
237 * - start - kernel virtual start address
238 * - size - size of region
239 * - dir - DMA direction
240 */
241ENTRY(__dma_unmap_area)
242 add x1, x1, x0
243 cmp w2, #DMA_TO_DEVICE
244 b.ne __dma_inv_range
245 ret
246ENDPROC(__dma_unmap_area)
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index fbd76785c5db..0ba347e59f06 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -30,18 +30,26 @@
30struct dma_map_ops *dma_ops; 30struct dma_map_ops *dma_ops;
31EXPORT_SYMBOL(dma_ops); 31EXPORT_SYMBOL(dma_ops);
32 32
33static void *arm64_swiotlb_alloc_coherent(struct device *dev, size_t size, 33static pgprot_t __get_dma_pgprot(struct dma_attrs *attrs, pgprot_t prot,
34 dma_addr_t *dma_handle, gfp_t flags, 34 bool coherent)
35 struct dma_attrs *attrs) 35{
36 if (!coherent || dma_get_attr(DMA_ATTR_WRITE_COMBINE, attrs))
37 return pgprot_writecombine(prot);
38 return prot;
39}
40
41static void *__dma_alloc_coherent(struct device *dev, size_t size,
42 dma_addr_t *dma_handle, gfp_t flags,
43 struct dma_attrs *attrs)
36{ 44{
37 if (dev == NULL) { 45 if (dev == NULL) {
38 WARN_ONCE(1, "Use an actual device structure for DMA allocation\n"); 46 WARN_ONCE(1, "Use an actual device structure for DMA allocation\n");
39 return NULL; 47 return NULL;
40 } 48 }
41 49
42 if (IS_ENABLED(CONFIG_ZONE_DMA32) && 50 if (IS_ENABLED(CONFIG_ZONE_DMA) &&
43 dev->coherent_dma_mask <= DMA_BIT_MASK(32)) 51 dev->coherent_dma_mask <= DMA_BIT_MASK(32))
44 flags |= GFP_DMA32; 52 flags |= GFP_DMA;
45 if (IS_ENABLED(CONFIG_DMA_CMA)) { 53 if (IS_ENABLED(CONFIG_DMA_CMA)) {
46 struct page *page; 54 struct page *page;
47 55
@@ -58,9 +66,9 @@ static void *arm64_swiotlb_alloc_coherent(struct device *dev, size_t size,
58 } 66 }
59} 67}
60 68
61static void arm64_swiotlb_free_coherent(struct device *dev, size_t size, 69static void __dma_free_coherent(struct device *dev, size_t size,
62 void *vaddr, dma_addr_t dma_handle, 70 void *vaddr, dma_addr_t dma_handle,
63 struct dma_attrs *attrs) 71 struct dma_attrs *attrs)
64{ 72{
65 if (dev == NULL) { 73 if (dev == NULL) {
66 WARN_ONCE(1, "Use an actual device structure for DMA allocation\n"); 74 WARN_ONCE(1, "Use an actual device structure for DMA allocation\n");
@@ -78,9 +86,212 @@ static void arm64_swiotlb_free_coherent(struct device *dev, size_t size,
78 } 86 }
79} 87}
80 88
81static struct dma_map_ops arm64_swiotlb_dma_ops = { 89static void *__dma_alloc_noncoherent(struct device *dev, size_t size,
82 .alloc = arm64_swiotlb_alloc_coherent, 90 dma_addr_t *dma_handle, gfp_t flags,
83 .free = arm64_swiotlb_free_coherent, 91 struct dma_attrs *attrs)
92{
93 struct page *page, **map;
94 void *ptr, *coherent_ptr;
95 int order, i;
96
97 size = PAGE_ALIGN(size);
98 order = get_order(size);
99
100 ptr = __dma_alloc_coherent(dev, size, dma_handle, flags, attrs);
101 if (!ptr)
102 goto no_mem;
103 map = kmalloc(sizeof(struct page *) << order, flags & ~GFP_DMA);
104 if (!map)
105 goto no_map;
106
107 /* remove any dirty cache lines on the kernel alias */
108 __dma_flush_range(ptr, ptr + size);
109
110 /* create a coherent mapping */
111 page = virt_to_page(ptr);
112 for (i = 0; i < (size >> PAGE_SHIFT); i++)
113 map[i] = page + i;
114 coherent_ptr = vmap(map, size >> PAGE_SHIFT, VM_MAP,
115 __get_dma_pgprot(attrs, pgprot_default, false));
116 kfree(map);
117 if (!coherent_ptr)
118 goto no_map;
119
120 return coherent_ptr;
121
122no_map:
123 __dma_free_coherent(dev, size, ptr, *dma_handle, attrs);
124no_mem:
125 *dma_handle = ~0;
126 return NULL;
127}
128
129static void __dma_free_noncoherent(struct device *dev, size_t size,
130 void *vaddr, dma_addr_t dma_handle,
131 struct dma_attrs *attrs)
132{
133 void *swiotlb_addr = phys_to_virt(dma_to_phys(dev, dma_handle));
134
135 vunmap(vaddr);
136 __dma_free_coherent(dev, size, swiotlb_addr, dma_handle, attrs);
137}
138
139static dma_addr_t __swiotlb_map_page(struct device *dev, struct page *page,
140 unsigned long offset, size_t size,
141 enum dma_data_direction dir,
142 struct dma_attrs *attrs)
143{
144 dma_addr_t dev_addr;
145
146 dev_addr = swiotlb_map_page(dev, page, offset, size, dir, attrs);
147 __dma_map_area(phys_to_virt(dma_to_phys(dev, dev_addr)), size, dir);
148
149 return dev_addr;
150}
151
152
153static void __swiotlb_unmap_page(struct device *dev, dma_addr_t dev_addr,
154 size_t size, enum dma_data_direction dir,
155 struct dma_attrs *attrs)
156{
157 __dma_unmap_area(phys_to_virt(dma_to_phys(dev, dev_addr)), size, dir);
158 swiotlb_unmap_page(dev, dev_addr, size, dir, attrs);
159}
160
161static int __swiotlb_map_sg_attrs(struct device *dev, struct scatterlist *sgl,
162 int nelems, enum dma_data_direction dir,
163 struct dma_attrs *attrs)
164{
165 struct scatterlist *sg;
166 int i, ret;
167
168 ret = swiotlb_map_sg_attrs(dev, sgl, nelems, dir, attrs);
169 for_each_sg(sgl, sg, ret, i)
170 __dma_map_area(phys_to_virt(dma_to_phys(dev, sg->dma_address)),
171 sg->length, dir);
172
173 return ret;
174}
175
176static void __swiotlb_unmap_sg_attrs(struct device *dev,
177 struct scatterlist *sgl, int nelems,
178 enum dma_data_direction dir,
179 struct dma_attrs *attrs)
180{
181 struct scatterlist *sg;
182 int i;
183
184 for_each_sg(sgl, sg, nelems, i)
185 __dma_unmap_area(phys_to_virt(dma_to_phys(dev, sg->dma_address)),
186 sg->length, dir);
187 swiotlb_unmap_sg_attrs(dev, sgl, nelems, dir, attrs);
188}
189
190static void __swiotlb_sync_single_for_cpu(struct device *dev,
191 dma_addr_t dev_addr, size_t size,
192 enum dma_data_direction dir)
193{
194 __dma_unmap_area(phys_to_virt(dma_to_phys(dev, dev_addr)), size, dir);
195 swiotlb_sync_single_for_cpu(dev, dev_addr, size, dir);
196}
197
198static void __swiotlb_sync_single_for_device(struct device *dev,
199 dma_addr_t dev_addr, size_t size,
200 enum dma_data_direction dir)
201{
202 swiotlb_sync_single_for_device(dev, dev_addr, size, dir);
203 __dma_map_area(phys_to_virt(dma_to_phys(dev, dev_addr)), size, dir);
204}
205
206static void __swiotlb_sync_sg_for_cpu(struct device *dev,
207 struct scatterlist *sgl, int nelems,
208 enum dma_data_direction dir)
209{
210 struct scatterlist *sg;
211 int i;
212
213 for_each_sg(sgl, sg, nelems, i)
214 __dma_unmap_area(phys_to_virt(dma_to_phys(dev, sg->dma_address)),
215 sg->length, dir);
216 swiotlb_sync_sg_for_cpu(dev, sgl, nelems, dir);
217}
218
219static void __swiotlb_sync_sg_for_device(struct device *dev,
220 struct scatterlist *sgl, int nelems,
221 enum dma_data_direction dir)
222{
223 struct scatterlist *sg;
224 int i;
225
226 swiotlb_sync_sg_for_device(dev, sgl, nelems, dir);
227 for_each_sg(sgl, sg, nelems, i)
228 __dma_map_area(phys_to_virt(dma_to_phys(dev, sg->dma_address)),
229 sg->length, dir);
230}
231
232/* vma->vm_page_prot must be set appropriately before calling this function */
233static int __dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
234 void *cpu_addr, dma_addr_t dma_addr, size_t size)
235{
236 int ret = -ENXIO;
237 unsigned long nr_vma_pages = (vma->vm_end - vma->vm_start) >>
238 PAGE_SHIFT;
239 unsigned long nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT;
240 unsigned long pfn = dma_to_phys(dev, dma_addr) >> PAGE_SHIFT;
241 unsigned long off = vma->vm_pgoff;
242
243 if (dma_mmap_from_coherent(dev, vma, cpu_addr, size, &ret))
244 return ret;
245
246 if (off < nr_pages && nr_vma_pages <= (nr_pages - off)) {
247 ret = remap_pfn_range(vma, vma->vm_start,
248 pfn + off,
249 vma->vm_end - vma->vm_start,
250 vma->vm_page_prot);
251 }
252
253 return ret;
254}
255
256static int __swiotlb_mmap_noncoherent(struct device *dev,
257 struct vm_area_struct *vma,
258 void *cpu_addr, dma_addr_t dma_addr, size_t size,
259 struct dma_attrs *attrs)
260{
261 vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot, false);
262 return __dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
263}
264
265static int __swiotlb_mmap_coherent(struct device *dev,
266 struct vm_area_struct *vma,
267 void *cpu_addr, dma_addr_t dma_addr, size_t size,
268 struct dma_attrs *attrs)
269{
270 /* Just use whatever page_prot attributes were specified */
271 return __dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
272}
273
274struct dma_map_ops noncoherent_swiotlb_dma_ops = {
275 .alloc = __dma_alloc_noncoherent,
276 .free = __dma_free_noncoherent,
277 .mmap = __swiotlb_mmap_noncoherent,
278 .map_page = __swiotlb_map_page,
279 .unmap_page = __swiotlb_unmap_page,
280 .map_sg = __swiotlb_map_sg_attrs,
281 .unmap_sg = __swiotlb_unmap_sg_attrs,
282 .sync_single_for_cpu = __swiotlb_sync_single_for_cpu,
283 .sync_single_for_device = __swiotlb_sync_single_for_device,
284 .sync_sg_for_cpu = __swiotlb_sync_sg_for_cpu,
285 .sync_sg_for_device = __swiotlb_sync_sg_for_device,
286 .dma_supported = swiotlb_dma_supported,
287 .mapping_error = swiotlb_dma_mapping_error,
288};
289EXPORT_SYMBOL(noncoherent_swiotlb_dma_ops);
290
291struct dma_map_ops coherent_swiotlb_dma_ops = {
292 .alloc = __dma_alloc_coherent,
293 .free = __dma_free_coherent,
294 .mmap = __swiotlb_mmap_coherent,
84 .map_page = swiotlb_map_page, 295 .map_page = swiotlb_map_page,
85 .unmap_page = swiotlb_unmap_page, 296 .unmap_page = swiotlb_unmap_page,
86 .map_sg = swiotlb_map_sg_attrs, 297 .map_sg = swiotlb_map_sg_attrs,
@@ -92,12 +303,19 @@ static struct dma_map_ops arm64_swiotlb_dma_ops = {
92 .dma_supported = swiotlb_dma_supported, 303 .dma_supported = swiotlb_dma_supported,
93 .mapping_error = swiotlb_dma_mapping_error, 304 .mapping_error = swiotlb_dma_mapping_error,
94}; 305};
306EXPORT_SYMBOL(coherent_swiotlb_dma_ops);
307
308extern int swiotlb_late_init_with_default_size(size_t default_size);
95 309
96void __init arm64_swiotlb_init(void) 310static int __init swiotlb_late_init(void)
97{ 311{
98 dma_ops = &arm64_swiotlb_dma_ops; 312 size_t swiotlb_size = min(SZ_64M, MAX_ORDER_NR_PAGES << PAGE_SHIFT);
99 swiotlb_init(1); 313
314 dma_ops = &coherent_swiotlb_dma_ops;
315
316 return swiotlb_late_init_with_default_size(swiotlb_size);
100} 317}
318subsys_initcall(swiotlb_late_init);
101 319
102#define PREALLOC_DMA_DEBUG_ENTRIES 4096 320#define PREALLOC_DMA_DEBUG_ENTRIES 4096
103 321
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index d0b4c2efda90..88627c450a6c 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -30,6 +30,7 @@
30#include <linux/memblock.h> 30#include <linux/memblock.h>
31#include <linux/sort.h> 31#include <linux/sort.h>
32#include <linux/of_fdt.h> 32#include <linux/of_fdt.h>
33#include <linux/dma-mapping.h>
33#include <linux/dma-contiguous.h> 34#include <linux/dma-contiguous.h>
34 35
35#include <asm/sections.h> 36#include <asm/sections.h>
@@ -59,22 +60,22 @@ static int __init early_initrd(char *p)
59early_param("initrd", early_initrd); 60early_param("initrd", early_initrd);
60#endif 61#endif
61 62
62#define MAX_DMA32_PFN ((4UL * 1024 * 1024 * 1024) >> PAGE_SHIFT)
63
64static void __init zone_sizes_init(unsigned long min, unsigned long max) 63static void __init zone_sizes_init(unsigned long min, unsigned long max)
65{ 64{
66 struct memblock_region *reg; 65 struct memblock_region *reg;
67 unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; 66 unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES];
68 unsigned long max_dma32 = min; 67 unsigned long max_dma = min;
69 68
70 memset(zone_size, 0, sizeof(zone_size)); 69 memset(zone_size, 0, sizeof(zone_size));
71 70
72#ifdef CONFIG_ZONE_DMA32
73 /* 4GB maximum for 32-bit only capable devices */ 71 /* 4GB maximum for 32-bit only capable devices */
74 max_dma32 = max(min, min(max, MAX_DMA32_PFN)); 72 if (IS_ENABLED(CONFIG_ZONE_DMA)) {
75 zone_size[ZONE_DMA32] = max_dma32 - min; 73 unsigned long max_dma_phys =
76#endif 74 (unsigned long)dma_to_phys(NULL, DMA_BIT_MASK(32) + 1);
77 zone_size[ZONE_NORMAL] = max - max_dma32; 75 max_dma = max(min, min(max, max_dma_phys >> PAGE_SHIFT));
76 zone_size[ZONE_DMA] = max_dma - min;
77 }
78 zone_size[ZONE_NORMAL] = max - max_dma;
78 79
79 memcpy(zhole_size, zone_size, sizeof(zhole_size)); 80 memcpy(zhole_size, zone_size, sizeof(zhole_size));
80 81
@@ -84,15 +85,15 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max)
84 85
85 if (start >= max) 86 if (start >= max)
86 continue; 87 continue;
87#ifdef CONFIG_ZONE_DMA32 88
88 if (start < max_dma32) { 89 if (IS_ENABLED(CONFIG_ZONE_DMA) && start < max_dma) {
89 unsigned long dma_end = min(end, max_dma32); 90 unsigned long dma_end = min(end, max_dma);
90 zhole_size[ZONE_DMA32] -= dma_end - start; 91 zhole_size[ZONE_DMA] -= dma_end - start;
91 } 92 }
92#endif 93
93 if (end > max_dma32) { 94 if (end > max_dma) {
94 unsigned long normal_end = min(end, max); 95 unsigned long normal_end = min(end, max);
95 unsigned long normal_start = max(start, max_dma32); 96 unsigned long normal_start = max(start, max_dma);
96 zhole_size[ZONE_NORMAL] -= normal_end - normal_start; 97 zhole_size[ZONE_NORMAL] -= normal_end - normal_start;
97 } 98 }
98 } 99 }
@@ -261,8 +262,6 @@ static void __init free_unused_memmap(void)
261 */ 262 */
262void __init mem_init(void) 263void __init mem_init(void)
263{ 264{
264 arm64_swiotlb_init();
265
266 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; 265 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map;
267 266
268#ifndef CONFIG_SPARSEMEM_VMEMMAP 267#ifndef CONFIG_SPARSEMEM_VMEMMAP
diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
index 1333e6f9a8e5..e085ee6ef4e2 100644
--- a/arch/arm64/mm/proc.S
+++ b/arch/arm64/mm/proc.S
@@ -173,12 +173,6 @@ ENDPROC(cpu_do_switch_mm)
173 * value of the SCTLR_EL1 register. 173 * value of the SCTLR_EL1 register.
174 */ 174 */
175ENTRY(__cpu_setup) 175ENTRY(__cpu_setup)
176 /*
177 * Preserve the link register across the function call.
178 */
179 mov x28, lr
180 bl __flush_dcache_all
181 mov lr, x28
182 ic iallu // I+BTB cache invalidate 176 ic iallu // I+BTB cache invalidate
183 tlbi vmalle1is // invalidate I + D TLBs 177 tlbi vmalle1is // invalidate I + D TLBs
184 dsb sy 178 dsb sy
@@ -215,8 +209,14 @@ ENTRY(__cpu_setup)
215 * Set/prepare TCR and TTBR. We use 512GB (39-bit) address range for 209 * Set/prepare TCR and TTBR. We use 512GB (39-bit) address range for
216 * both user and kernel. 210 * both user and kernel.
217 */ 211 */
218 ldr x10, =TCR_TxSZ(VA_BITS) | TCR_FLAGS | TCR_IPS_40BIT | \ 212 ldr x10, =TCR_TxSZ(VA_BITS) | TCR_FLAGS | \
219 TCR_ASID16 | TCR_TBI0 | (1 << 31) 213 TCR_ASID16 | TCR_TBI0 | (1 << 31)
214 /*
215 * Read the PARange bits from ID_AA64MMFR0_EL1 and set the IPS bits in
216 * TCR_EL1.
217 */
218 mrs x9, ID_AA64MMFR0_EL1
219 bfi x10, x9, #32, #3
220#ifdef CONFIG_ARM64_64K_PAGES 220#ifdef CONFIG_ARM64_64K_PAGES
221 orr x10, x10, TCR_TG0_64K 221 orr x10, x10, TCR_TG0_64K
222 orr x10, x10, TCR_TG1_64K 222 orr x10, x10, TCR_TG1_64K
diff --git a/arch/avr32/include/asm/bugs.h b/arch/avr32/include/asm/bugs.h
index 7635e770622e..278661bbd1b0 100644
--- a/arch/avr32/include/asm/bugs.h
+++ b/arch/avr32/include/asm/bugs.h
@@ -9,7 +9,7 @@
9 9
10static void __init check_bugs(void) 10static void __init check_bugs(void)
11{ 11{
12 cpu_data->loops_per_jiffy = loops_per_jiffy; 12 boot_cpu_data.loops_per_jiffy = loops_per_jiffy;
13} 13}
14 14
15#endif /* __ASM_AVR32_BUGS_H */ 15#endif /* __ASM_AVR32_BUGS_H */
diff --git a/arch/avr32/include/asm/processor.h b/arch/avr32/include/asm/processor.h
index 48d71c5c898a..972adcc1e8f4 100644
--- a/arch/avr32/include/asm/processor.h
+++ b/arch/avr32/include/asm/processor.h
@@ -83,13 +83,8 @@ static inline unsigned int avr32_get_chip_revision(struct avr32_cpuinfo *cpu)
83 83
84extern struct avr32_cpuinfo boot_cpu_data; 84extern struct avr32_cpuinfo boot_cpu_data;
85 85
86#ifdef CONFIG_SMP 86/* No SMP support so far */
87extern struct avr32_cpuinfo cpu_data[];
88#define current_cpu_data cpu_data[smp_processor_id()]
89#else
90#define cpu_data (&boot_cpu_data)
91#define current_cpu_data boot_cpu_data 87#define current_cpu_data boot_cpu_data
92#endif
93 88
94/* This decides where the kernel will search for a free chunk of vm 89/* This decides where the kernel will search for a free chunk of vm
95 * space during mmap's 90 * space during mmap's
diff --git a/arch/avr32/kernel/cpu.c b/arch/avr32/kernel/cpu.c
index 2233be71e2e8..0341ae27c9ec 100644
--- a/arch/avr32/kernel/cpu.c
+++ b/arch/avr32/kernel/cpu.c
@@ -39,10 +39,12 @@ static ssize_t store_pc0event(struct device *dev,
39 size_t count) 39 size_t count)
40{ 40{
41 unsigned long val; 41 unsigned long val;
42 char *endp; 42 int ret;
43 43
44 val = simple_strtoul(buf, &endp, 0); 44 ret = kstrtoul(buf, 0, &val);
45 if (endp == buf || val > 0x3f) 45 if (ret)
46 return ret;
47 if (val > 0x3f)
46 return -EINVAL; 48 return -EINVAL;
47 val = (val << 12) | (sysreg_read(PCCR) & 0xfffc0fff); 49 val = (val << 12) | (sysreg_read(PCCR) & 0xfffc0fff);
48 sysreg_write(PCCR, val); 50 sysreg_write(PCCR, val);
@@ -61,11 +63,11 @@ static ssize_t store_pc0count(struct device *dev,
61 const char *buf, size_t count) 63 const char *buf, size_t count)
62{ 64{
63 unsigned long val; 65 unsigned long val;
64 char *endp; 66 int ret;
65 67
66 val = simple_strtoul(buf, &endp, 0); 68 ret = kstrtoul(buf, 0, &val);
67 if (endp == buf) 69 if (ret)
68 return -EINVAL; 70 return ret;
69 sysreg_write(PCNT0, val); 71 sysreg_write(PCNT0, val);
70 72
71 return count; 73 return count;
@@ -84,10 +86,12 @@ static ssize_t store_pc1event(struct device *dev,
84 size_t count) 86 size_t count)
85{ 87{
86 unsigned long val; 88 unsigned long val;
87 char *endp; 89 int ret;
88 90
89 val = simple_strtoul(buf, &endp, 0); 91 ret = kstrtoul(buf, 0, &val);
90 if (endp == buf || val > 0x3f) 92 if (ret)
93 return ret;
94 if (val > 0x3f)
91 return -EINVAL; 95 return -EINVAL;
92 val = (val << 18) | (sysreg_read(PCCR) & 0xff03ffff); 96 val = (val << 18) | (sysreg_read(PCCR) & 0xff03ffff);
93 sysreg_write(PCCR, val); 97 sysreg_write(PCCR, val);
@@ -106,11 +110,11 @@ static ssize_t store_pc1count(struct device *dev,
106 size_t count) 110 size_t count)
107{ 111{
108 unsigned long val; 112 unsigned long val;
109 char *endp; 113 int ret;
110 114
111 val = simple_strtoul(buf, &endp, 0); 115 ret = kstrtoul(buf, 0, &val);
112 if (endp == buf) 116 if (ret)
113 return -EINVAL; 117 return ret;
114 sysreg_write(PCNT1, val); 118 sysreg_write(PCNT1, val);
115 119
116 return count; 120 return count;
@@ -129,11 +133,11 @@ static ssize_t store_pccycles(struct device *dev,
129 size_t count) 133 size_t count)
130{ 134{
131 unsigned long val; 135 unsigned long val;
132 char *endp; 136 int ret;
133 137
134 val = simple_strtoul(buf, &endp, 0); 138 ret = kstrtoul(buf, 0, &val);
135 if (endp == buf) 139 if (ret)
136 return -EINVAL; 140 return ret;
137 sysreg_write(PCCNT, val); 141 sysreg_write(PCCNT, val);
138 142
139 return count; 143 return count;
@@ -152,11 +156,11 @@ static ssize_t store_pcenable(struct device *dev,
152 size_t count) 156 size_t count)
153{ 157{
154 unsigned long pccr, val; 158 unsigned long pccr, val;
155 char *endp; 159 int ret;
156 160
157 val = simple_strtoul(buf, &endp, 0); 161 ret = kstrtoul(buf, 0, &val);
158 if (endp == buf) 162 if (ret)
159 return -EINVAL; 163 return ret;
160 if (val) 164 if (val)
161 val = 1; 165 val = 1;
162 166
diff --git a/arch/avr32/mm/cache.c b/arch/avr32/mm/cache.c
index 6a46ecd56cfd..85d635cd7b28 100644
--- a/arch/avr32/mm/cache.c
+++ b/arch/avr32/mm/cache.c
@@ -111,6 +111,7 @@ void flush_icache_range(unsigned long start, unsigned long end)
111 __flush_icache_range(start & ~(linesz - 1), 111 __flush_icache_range(start & ~(linesz - 1),
112 (end + linesz - 1) & ~(linesz - 1)); 112 (end + linesz - 1) & ~(linesz - 1));
113} 113}
114EXPORT_SYMBOL(flush_icache_range);
114 115
115/* 116/*
116 * This one is called from __do_fault() and do_swap_page(). 117 * This one is called from __do_fault() and do_swap_page().
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
index 056027f38351..afff5105909d 100644
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@ -5,6 +5,7 @@ header-y += arch-v32/
5 5
6generic-y += barrier.h 6generic-y += barrier.h
7generic-y += clkdev.h 7generic-y += clkdev.h
8generic-y += cputime.h
8generic-y += exec.h 9generic-y += exec.h
9generic-y += hash.h 10generic-y += hash.h
10generic-y += kvm_para.h 11generic-y += kvm_para.h
diff --git a/arch/cris/include/asm/cputime.h b/arch/cris/include/asm/cputime.h
deleted file mode 100644
index 4446a65656fa..000000000000
--- a/arch/cris/include/asm/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __CRIS_CPUTIME_H
2#define __CRIS_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __CRIS_CPUTIME_H */
diff --git a/arch/frv/include/asm/Kbuild b/arch/frv/include/asm/Kbuild
index babb9338ebf8..87b95eb8aee5 100644
--- a/arch/frv/include/asm/Kbuild
+++ b/arch/frv/include/asm/Kbuild
@@ -1,5 +1,6 @@
1 1
2generic-y += clkdev.h 2generic-y += clkdev.h
3generic-y += cputime.h
3generic-y += exec.h 4generic-y += exec.h
4generic-y += hash.h 5generic-y += hash.h
5generic-y += mcs_spinlock.h 6generic-y += mcs_spinlock.h
diff --git a/arch/frv/include/asm/cputime.h b/arch/frv/include/asm/cputime.h
deleted file mode 100644
index f6c373ad2b80..000000000000
--- a/arch/frv/include/asm/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_CPUTIME_H
2#define _ASM_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* _ASM_CPUTIME_H */
diff --git a/arch/ia64/configs/generic_defconfig b/arch/ia64/configs/generic_defconfig
index efbd2929aeb7..6404acbb84b2 100644
--- a/arch/ia64/configs/generic_defconfig
+++ b/arch/ia64/configs/generic_defconfig
@@ -30,9 +30,9 @@ CONFIG_ACPI_BUTTON=m
30CONFIG_ACPI_FAN=m 30CONFIG_ACPI_FAN=m
31CONFIG_ACPI_DOCK=y 31CONFIG_ACPI_DOCK=y
32CONFIG_ACPI_PROCESSOR=m 32CONFIG_ACPI_PROCESSOR=m
33CONFIG_ACPI_CONTAINER=m 33CONFIG_ACPI_CONTAINER=y
34CONFIG_HOTPLUG_PCI=y 34CONFIG_HOTPLUG_PCI=y
35CONFIG_HOTPLUG_PCI_ACPI=m 35CONFIG_HOTPLUG_PCI_ACPI=y
36CONFIG_PACKET=y 36CONFIG_PACKET=y
37CONFIG_UNIX=y 37CONFIG_UNIX=y
38CONFIG_INET=y 38CONFIG_INET=y
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 8e858b593e4f..30c43d39dede 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -1596,7 +1596,7 @@ static void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist,
1596* 1596*
1597***************************************************************/ 1597***************************************************************/
1598 1598
1599static void __init 1599static void
1600ioc_iova_init(struct ioc *ioc) 1600ioc_iova_init(struct ioc *ioc)
1601{ 1601{
1602 int tcnfg; 1602 int tcnfg;
@@ -1807,7 +1807,7 @@ static struct ioc_iommu ioc_iommu_info[] __initdata = {
1807 { SX2000_IOC_ID, "sx2000", NULL }, 1807 { SX2000_IOC_ID, "sx2000", NULL },
1808}; 1808};
1809 1809
1810static struct ioc * __init 1810static struct ioc *
1811ioc_init(unsigned long hpa, void *handle) 1811ioc_init(unsigned long hpa, void *handle)
1812{ 1812{
1813 struct ioc *ioc; 1813 struct ioc *ioc;
@@ -2041,7 +2041,7 @@ sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle)
2041#define sba_map_ioc_to_node(ioc, handle) 2041#define sba_map_ioc_to_node(ioc, handle)
2042#endif 2042#endif
2043 2043
2044static int __init 2044static int
2045acpi_sba_ioc_add(struct acpi_device *device, 2045acpi_sba_ioc_add(struct acpi_device *device,
2046 const struct acpi_device_id *not_used) 2046 const struct acpi_device_id *not_used)
2047{ 2047{
diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c
index 1034884b77da..0884f5ecbcc3 100644
--- a/arch/ia64/kernel/irq_ia64.c
+++ b/arch/ia64/kernel/irq_ia64.c
@@ -364,7 +364,6 @@ static irqreturn_t smp_irq_move_cleanup_interrupt(int irq, void *dev_id)
364 364
365static struct irqaction irq_move_irqaction = { 365static struct irqaction irq_move_irqaction = {
366 .handler = smp_irq_move_cleanup_interrupt, 366 .handler = smp_irq_move_cleanup_interrupt,
367 .flags = IRQF_DISABLED,
368 .name = "irq_move" 367 .name = "irq_move"
369}; 368};
370 369
@@ -489,14 +488,13 @@ ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
489 ia64_srlz_d(); 488 ia64_srlz_d();
490 while (vector != IA64_SPURIOUS_INT_VECTOR) { 489 while (vector != IA64_SPURIOUS_INT_VECTOR) {
491 int irq = local_vector_to_irq(vector); 490 int irq = local_vector_to_irq(vector);
492 struct irq_desc *desc = irq_to_desc(irq);
493 491
494 if (unlikely(IS_LOCAL_TLB_FLUSH(vector))) { 492 if (unlikely(IS_LOCAL_TLB_FLUSH(vector))) {
495 smp_local_flush_tlb(); 493 smp_local_flush_tlb();
496 kstat_incr_irqs_this_cpu(irq, desc); 494 kstat_incr_irq_this_cpu(irq);
497 } else if (unlikely(IS_RESCHEDULE(vector))) { 495 } else if (unlikely(IS_RESCHEDULE(vector))) {
498 scheduler_ipi(); 496 scheduler_ipi();
499 kstat_incr_irqs_this_cpu(irq, desc); 497 kstat_incr_irq_this_cpu(irq);
500 } else { 498 } else {
501 ia64_setreg(_IA64_REG_CR_TPR, vector); 499 ia64_setreg(_IA64_REG_CR_TPR, vector);
502 ia64_srlz_d(); 500 ia64_srlz_d();
@@ -549,13 +547,12 @@ void ia64_process_pending_intr(void)
549 */ 547 */
550 while (vector != IA64_SPURIOUS_INT_VECTOR) { 548 while (vector != IA64_SPURIOUS_INT_VECTOR) {
551 int irq = local_vector_to_irq(vector); 549 int irq = local_vector_to_irq(vector);
552 struct irq_desc *desc = irq_to_desc(irq);
553 550
554 if (unlikely(IS_LOCAL_TLB_FLUSH(vector))) { 551 if (unlikely(IS_LOCAL_TLB_FLUSH(vector))) {
555 smp_local_flush_tlb(); 552 smp_local_flush_tlb();
556 kstat_incr_irqs_this_cpu(irq, desc); 553 kstat_incr_irq_this_cpu(irq);
557 } else if (unlikely(IS_RESCHEDULE(vector))) { 554 } else if (unlikely(IS_RESCHEDULE(vector))) {
558 kstat_incr_irqs_this_cpu(irq, desc); 555 kstat_incr_irq_this_cpu(irq);
559 } else { 556 } else {
560 struct pt_regs *old_regs = set_irq_regs(NULL); 557 struct pt_regs *old_regs = set_irq_regs(NULL);
561 558
@@ -602,7 +599,6 @@ static irqreturn_t dummy_handler (int irq, void *dev_id)
602 599
603static struct irqaction ipi_irqaction = { 600static struct irqaction ipi_irqaction = {
604 .handler = handle_IPI, 601 .handler = handle_IPI,
605 .flags = IRQF_DISABLED,
606 .name = "IPI" 602 .name = "IPI"
607}; 603};
608 604
@@ -611,13 +607,11 @@ static struct irqaction ipi_irqaction = {
611 */ 607 */
612static struct irqaction resched_irqaction = { 608static struct irqaction resched_irqaction = {
613 .handler = dummy_handler, 609 .handler = dummy_handler,
614 .flags = IRQF_DISABLED,
615 .name = "resched" 610 .name = "resched"
616}; 611};
617 612
618static struct irqaction tlb_irqaction = { 613static struct irqaction tlb_irqaction = {
619 .handler = dummy_handler, 614 .handler = dummy_handler,
620 .flags = IRQF_DISABLED,
621 .name = "tlb_flush" 615 .name = "tlb_flush"
622}; 616};
623 617
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index b8edfa75a83f..db7b36bb068b 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -217,7 +217,7 @@ void ia64_mca_printk(const char *fmt, ...)
217 /* Copy the output into mlogbuf */ 217 /* Copy the output into mlogbuf */
218 if (oops_in_progress) { 218 if (oops_in_progress) {
219 /* mlogbuf was abandoned, use printk directly instead. */ 219 /* mlogbuf was abandoned, use printk directly instead. */
220 printk(temp_buf); 220 printk("%s", temp_buf);
221 } else { 221 } else {
222 spin_lock(&mlogbuf_wlock); 222 spin_lock(&mlogbuf_wlock);
223 for (p = temp_buf; *p; p++) { 223 for (p = temp_buf; *p; p++) {
@@ -268,7 +268,7 @@ void ia64_mlogbuf_dump(void)
268 } 268 }
269 *p = '\0'; 269 *p = '\0';
270 if (temp_buf[0]) 270 if (temp_buf[0])
271 printk(temp_buf); 271 printk("%s", temp_buf);
272 mlogbuf_start = index; 272 mlogbuf_start = index;
273 273
274 mlogbuf_timestamp = 0; 274 mlogbuf_timestamp = 0;
@@ -1772,38 +1772,32 @@ __setup("disable_cpe_poll", ia64_mca_disable_cpe_polling);
1772 1772
1773static struct irqaction cmci_irqaction = { 1773static struct irqaction cmci_irqaction = {
1774 .handler = ia64_mca_cmc_int_handler, 1774 .handler = ia64_mca_cmc_int_handler,
1775 .flags = IRQF_DISABLED,
1776 .name = "cmc_hndlr" 1775 .name = "cmc_hndlr"
1777}; 1776};
1778 1777
1779static struct irqaction cmcp_irqaction = { 1778static struct irqaction cmcp_irqaction = {
1780 .handler = ia64_mca_cmc_int_caller, 1779 .handler = ia64_mca_cmc_int_caller,
1781 .flags = IRQF_DISABLED,
1782 .name = "cmc_poll" 1780 .name = "cmc_poll"
1783}; 1781};
1784 1782
1785static struct irqaction mca_rdzv_irqaction = { 1783static struct irqaction mca_rdzv_irqaction = {
1786 .handler = ia64_mca_rendez_int_handler, 1784 .handler = ia64_mca_rendez_int_handler,
1787 .flags = IRQF_DISABLED,
1788 .name = "mca_rdzv" 1785 .name = "mca_rdzv"
1789}; 1786};
1790 1787
1791static struct irqaction mca_wkup_irqaction = { 1788static struct irqaction mca_wkup_irqaction = {
1792 .handler = ia64_mca_wakeup_int_handler, 1789 .handler = ia64_mca_wakeup_int_handler,
1793 .flags = IRQF_DISABLED,
1794 .name = "mca_wkup" 1790 .name = "mca_wkup"
1795}; 1791};
1796 1792
1797#ifdef CONFIG_ACPI 1793#ifdef CONFIG_ACPI
1798static struct irqaction mca_cpe_irqaction = { 1794static struct irqaction mca_cpe_irqaction = {
1799 .handler = ia64_mca_cpe_int_handler, 1795 .handler = ia64_mca_cpe_int_handler,
1800 .flags = IRQF_DISABLED,
1801 .name = "cpe_hndlr" 1796 .name = "cpe_hndlr"
1802}; 1797};
1803 1798
1804static struct irqaction mca_cpep_irqaction = { 1799static struct irqaction mca_cpep_irqaction = {
1805 .handler = ia64_mca_cpe_int_caller, 1800 .handler = ia64_mca_cpe_int_caller,
1806 .flags = IRQF_DISABLED,
1807 .name = "cpe_poll" 1801 .name = "cpe_poll"
1808}; 1802};
1809#endif /* CONFIG_ACPI */ 1803#endif /* CONFIG_ACPI */
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index fb2f1e622877..c430f9198d1b 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -17,12 +17,9 @@ static int ia64_set_msi_irq_affinity(struct irq_data *idata,
17{ 17{
18 struct msi_msg msg; 18 struct msi_msg msg;
19 u32 addr, data; 19 u32 addr, data;
20 int cpu = first_cpu(*cpu_mask); 20 int cpu = cpumask_first_and(cpu_mask, cpu_online_mask);
21 unsigned int irq = idata->irq; 21 unsigned int irq = idata->irq;
22 22
23 if (!cpu_online(cpu))
24 return -1;
25
26 if (irq_prepare_move(irq, cpu)) 23 if (irq_prepare_move(irq, cpu))
27 return -1; 24 return -1;
28 25
@@ -139,10 +136,7 @@ static int dmar_msi_set_affinity(struct irq_data *data,
139 unsigned int irq = data->irq; 136 unsigned int irq = data->irq;
140 struct irq_cfg *cfg = irq_cfg + irq; 137 struct irq_cfg *cfg = irq_cfg + irq;
141 struct msi_msg msg; 138 struct msi_msg msg;
142 int cpu = cpumask_first(mask); 139 int cpu = cpumask_first_and(mask, cpu_online_mask);
143
144 if (!cpu_online(cpu))
145 return -1;
146 140
147 if (irq_prepare_move(irq, cpu)) 141 if (irq_prepare_move(irq, cpu))
148 return -1; 142 return -1;
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index cb592773c78b..d841c4bd6864 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -6387,7 +6387,6 @@ pfm_flush_pmds(struct task_struct *task, pfm_context_t *ctx)
6387 6387
6388static struct irqaction perfmon_irqaction = { 6388static struct irqaction perfmon_irqaction = {
6389 .handler = pfm_interrupt_handler, 6389 .handler = pfm_interrupt_handler,
6390 .flags = IRQF_DISABLED,
6391 .name = "perfmon" 6390 .name = "perfmon"
6392}; 6391};
6393 6392
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index fbaac1afb844..71c52bc7c28d 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -380,7 +380,7 @@ static cycle_t itc_get_cycles(struct clocksource *cs)
380 380
381static struct irqaction timer_irqaction = { 381static struct irqaction timer_irqaction = {
382 .handler = timer_interrupt, 382 .handler = timer_interrupt,
383 .flags = IRQF_DISABLED | IRQF_IRQPOLL, 383 .flags = IRQF_IRQPOLL,
384 .name = "timer" 384 .name = "timer"
385}; 385};
386 386
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index 62cf4dde6a04..85d095154902 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -209,8 +209,8 @@ static int sn_set_affinity_irq(struct irq_data *data,
209 nasid_t nasid; 209 nasid_t nasid;
210 int slice; 210 int slice;
211 211
212 nasid = cpuid_to_nasid(cpumask_first(mask)); 212 nasid = cpuid_to_nasid(cpumask_first_and(mask, cpu_online_mask));
213 slice = cpuid_to_slice(cpumask_first(mask)); 213 slice = cpuid_to_slice(cpumask_first_and(mask, cpu_online_mask));
214 214
215 list_for_each_entry_safe(sn_irq_info, sn_irq_info_safe, 215 list_for_each_entry_safe(sn_irq_info, sn_irq_info_safe,
216 sn_irq_lh[irq], list) 216 sn_irq_lh[irq], list)
diff --git a/arch/ia64/sn/kernel/msi_sn.c b/arch/ia64/sn/kernel/msi_sn.c
index 2b98b9e088de..afc58d2799ad 100644
--- a/arch/ia64/sn/kernel/msi_sn.c
+++ b/arch/ia64/sn/kernel/msi_sn.c
@@ -166,7 +166,7 @@ static int sn_set_msi_irq_affinity(struct irq_data *data,
166 struct sn_pcibus_provider *provider; 166 struct sn_pcibus_provider *provider;
167 unsigned int cpu, irq = data->irq; 167 unsigned int cpu, irq = data->irq;
168 168
169 cpu = cpumask_first(cpu_mask); 169 cpu = cpumask_first_and(cpu_mask, cpu_online_mask);
170 sn_irq_info = sn_msi_info[irq].sn_irq_info; 170 sn_irq_info = sn_msi_info[irq].sn_irq_info;
171 if (sn_irq_info == NULL || sn_irq_info->irq_int_bit >= 0) 171 if (sn_irq_info == NULL || sn_irq_info->irq_int_bit >= 0)
172 return -1; 172 return -1;
diff --git a/arch/m32r/include/asm/Kbuild b/arch/m32r/include/asm/Kbuild
index 5825a35b2c56..67779a74b62d 100644
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@ -1,5 +1,6 @@
1 1
2generic-y += clkdev.h 2generic-y += clkdev.h
3generic-y += cputime.h
3generic-y += exec.h 4generic-y += exec.h
4generic-y += hash.h 5generic-y += hash.h
5generic-y += mcs_spinlock.h 6generic-y += mcs_spinlock.h
diff --git a/arch/m32r/include/asm/cputime.h b/arch/m32r/include/asm/cputime.h
deleted file mode 100644
index 0a47550df2b7..000000000000
--- a/arch/m32r/include/asm/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __M32R_CPUTIME_H
2#define __M32R_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __M32R_CPUTIME_H */
diff --git a/arch/m68k/amiga/cia.c b/arch/m68k/amiga/cia.c
index 18c0e29976e3..2081b8cd5591 100644
--- a/arch/m68k/amiga/cia.c
+++ b/arch/m68k/amiga/cia.c
@@ -18,6 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/seq_file.h> 19#include <linux/seq_file.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/irq.h>
21 22
22#include <asm/irq.h> 23#include <asm/irq.h>
23#include <asm/amigahw.h> 24#include <asm/amigahw.h>
diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c
index 3e73a63c066f..3d2b63bedf05 100644
--- a/arch/m68k/atari/ataints.c
+++ b/arch/m68k/atari/ataints.c
@@ -41,6 +41,7 @@
41#include <linux/init.h> 41#include <linux/init.h>
42#include <linux/seq_file.h> 42#include <linux/seq_file.h>
43#include <linux/module.h> 43#include <linux/module.h>
44#include <linux/irq.h>
44 45
45#include <asm/traps.h> 46#include <asm/traps.h>
46 47
diff --git a/arch/m68k/configs/amiga_defconfig b/arch/m68k/configs/amiga_defconfig
index 559ff3af8ff7..96da4963d14b 100644
--- a/arch/m68k/configs/amiga_defconfig
+++ b/arch/m68k/configs/amiga_defconfig
@@ -24,6 +24,8 @@ CONFIG_SUN_PARTITION=y
24# CONFIG_EFI_PARTITION is not set 24# CONFIG_EFI_PARTITION is not set
25CONFIG_SYSV68_PARTITION=y 25CONFIG_SYSV68_PARTITION=y
26CONFIG_IOSCHED_DEADLINE=m 26CONFIG_IOSCHED_DEADLINE=m
27CONFIG_KEXEC=y
28CONFIG_BOOTINFO_PROC=y
27CONFIG_M68020=y 29CONFIG_M68020=y
28CONFIG_M68030=y 30CONFIG_M68030=y
29CONFIG_M68040=y 31CONFIG_M68040=y
@@ -85,6 +87,7 @@ CONFIG_NF_CONNTRACK_SANE=m
85CONFIG_NF_CONNTRACK_SIP=m 87CONFIG_NF_CONNTRACK_SIP=m
86CONFIG_NF_CONNTRACK_TFTP=m 88CONFIG_NF_CONNTRACK_TFTP=m
87CONFIG_NF_TABLES=m 89CONFIG_NF_TABLES=m
90CONFIG_NF_TABLES_INET=m
88CONFIG_NFT_EXTHDR=m 91CONFIG_NFT_EXTHDR=m
89CONFIG_NFT_META=m 92CONFIG_NFT_META=m
90CONFIG_NFT_CT=m 93CONFIG_NFT_CT=m
@@ -94,6 +97,8 @@ CONFIG_NFT_COUNTER=m
94CONFIG_NFT_LOG=m 97CONFIG_NFT_LOG=m
95CONFIG_NFT_LIMIT=m 98CONFIG_NFT_LIMIT=m
96CONFIG_NFT_NAT=m 99CONFIG_NFT_NAT=m
100CONFIG_NFT_QUEUE=m
101CONFIG_NFT_REJECT=m
97CONFIG_NFT_COMPAT=m 102CONFIG_NFT_COMPAT=m
98CONFIG_NETFILTER_XT_SET=m 103CONFIG_NETFILTER_XT_SET=m
99CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m 104CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
@@ -126,6 +131,7 @@ CONFIG_NETFILTER_XT_MATCH_DSCP=m
126CONFIG_NETFILTER_XT_MATCH_ESP=m 131CONFIG_NETFILTER_XT_MATCH_ESP=m
127CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m 132CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
128CONFIG_NETFILTER_XT_MATCH_HELPER=m 133CONFIG_NETFILTER_XT_MATCH_HELPER=m
134CONFIG_NETFILTER_XT_MATCH_IPCOMP=m
129CONFIG_NETFILTER_XT_MATCH_IPRANGE=m 135CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
130CONFIG_NETFILTER_XT_MATCH_LENGTH=m 136CONFIG_NETFILTER_XT_MATCH_LENGTH=m
131CONFIG_NETFILTER_XT_MATCH_LIMIT=m 137CONFIG_NETFILTER_XT_MATCH_LIMIT=m
@@ -163,8 +169,6 @@ CONFIG_IP_SET_HASH_NETPORT=m
163CONFIG_IP_SET_HASH_NETIFACE=m 169CONFIG_IP_SET_HASH_NETIFACE=m
164CONFIG_IP_SET_LIST_SET=m 170CONFIG_IP_SET_LIST_SET=m
165CONFIG_NF_CONNTRACK_IPV4=m 171CONFIG_NF_CONNTRACK_IPV4=m
166CONFIG_NF_TABLES_IPV4=m
167CONFIG_NFT_REJECT_IPV4=m
168CONFIG_NFT_CHAIN_ROUTE_IPV4=m 172CONFIG_NFT_CHAIN_ROUTE_IPV4=m
169CONFIG_NFT_CHAIN_NAT_IPV4=m 173CONFIG_NFT_CHAIN_NAT_IPV4=m
170CONFIG_NF_TABLES_ARP=m 174CONFIG_NF_TABLES_ARP=m
@@ -190,7 +194,6 @@ CONFIG_IP_NF_ARPTABLES=m
190CONFIG_IP_NF_ARPFILTER=m 194CONFIG_IP_NF_ARPFILTER=m
191CONFIG_IP_NF_ARP_MANGLE=m 195CONFIG_IP_NF_ARP_MANGLE=m
192CONFIG_NF_CONNTRACK_IPV6=m 196CONFIG_NF_CONNTRACK_IPV6=m
193CONFIG_NF_TABLES_IPV6=m
194CONFIG_NFT_CHAIN_ROUTE_IPV6=m 197CONFIG_NFT_CHAIN_ROUTE_IPV6=m
195CONFIG_NFT_CHAIN_NAT_IPV6=m 198CONFIG_NFT_CHAIN_NAT_IPV6=m
196CONFIG_IP6_NF_IPTABLES=m 199CONFIG_IP6_NF_IPTABLES=m
@@ -512,7 +515,6 @@ CONFIG_CRYPTO_LZ4HC=m
512CONFIG_CRYPTO_USER_API_HASH=m 515CONFIG_CRYPTO_USER_API_HASH=m
513CONFIG_CRYPTO_USER_API_SKCIPHER=m 516CONFIG_CRYPTO_USER_API_SKCIPHER=m
514# CONFIG_CRYPTO_HW is not set 517# CONFIG_CRYPTO_HW is not set
515CONFIG_CRC_T10DIF=y
516CONFIG_XZ_DEC_X86=y 518CONFIG_XZ_DEC_X86=y
517CONFIG_XZ_DEC_POWERPC=y 519CONFIG_XZ_DEC_POWERPC=y
518CONFIG_XZ_DEC_IA64=y 520CONFIG_XZ_DEC_IA64=y
diff --git a/arch/m68k/configs/apollo_defconfig b/arch/m68k/configs/apollo_defconfig
index cb1f55df69b6..1b8739f50cbf 100644
--- a/arch/m68k/configs/apollo_defconfig
+++ b/arch/m68k/configs/apollo_defconfig
@@ -25,6 +25,8 @@ CONFIG_SUN_PARTITION=y
25# CONFIG_EFI_PARTITION is not set 25# CONFIG_EFI_PARTITION is not set
26CONFIG_SYSV68_PARTITION=y 26CONFIG_SYSV68_PARTITION=y
27CONFIG_IOSCHED_DEADLINE=m 27CONFIG_IOSCHED_DEADLINE=m
28CONFIG_KEXEC=y
29CONFIG_BOOTINFO_PROC=y
28CONFIG_M68020=y 30CONFIG_M68020=y
29CONFIG_M68030=y 31CONFIG_M68030=y
30CONFIG_M68040=y 32CONFIG_M68040=y
@@ -83,6 +85,7 @@ CONFIG_NF_CONNTRACK_SANE=m
83CONFIG_NF_CONNTRACK_SIP=m 85CONFIG_NF_CONNTRACK_SIP=m
84CONFIG_NF_CONNTRACK_TFTP=m 86CONFIG_NF_CONNTRACK_TFTP=m
85CONFIG_NF_TABLES=m 87CONFIG_NF_TABLES=m
88CONFIG_NF_TABLES_INET=m
86CONFIG_NFT_EXTHDR=m 89CONFIG_NFT_EXTHDR=m
87CONFIG_NFT_META=m 90CONFIG_NFT_META=m
88CONFIG_NFT_CT=m 91CONFIG_NFT_CT=m
@@ -92,6 +95,8 @@ CONFIG_NFT_COUNTER=m
92CONFIG_NFT_LOG=m 95CONFIG_NFT_LOG=m
93CONFIG_NFT_LIMIT=m 96CONFIG_NFT_LIMIT=m
94CONFIG_NFT_NAT=m 97CONFIG_NFT_NAT=m
98CONFIG_NFT_QUEUE=m
99CONFIG_NFT_REJECT=m
95CONFIG_NFT_COMPAT=m 100CONFIG_NFT_COMPAT=m
96CONFIG_NETFILTER_XT_SET=m 101CONFIG_NETFILTER_XT_SET=m
97CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m 102CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
@@ -124,6 +129,7 @@ CONFIG_NETFILTER_XT_MATCH_DSCP=m
124CONFIG_NETFILTER_XT_MATCH_ESP=m 129CONFIG_NETFILTER_XT_MATCH_ESP=m
125CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m 130CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
126CONFIG_NETFILTER_XT_MATCH_HELPER=m 131CONFIG_NETFILTER_XT_MATCH_HELPER=m
132CONFIG_NETFILTER_XT_MATCH_IPCOMP=m
127CONFIG_NETFILTER_XT_MATCH_IPRANGE=m 133CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
128CONFIG_NETFILTER_XT_MATCH_LENGTH=m 134CONFIG_NETFILTER_XT_MATCH_LENGTH=m
129CONFIG_NETFILTER_XT_MATCH_LIMIT=m 135CONFIG_NETFILTER_XT_MATCH_LIMIT=m
@@ -161,8 +167,6 @@ CONFIG_IP_SET_HASH_NETPORT=m
161CONFIG_IP_SET_HASH_NETIFACE=m 167CONFIG_IP_SET_HASH_NETIFACE=m
162CONFIG_IP_SET_LIST_SET=m 168CONFIG_IP_SET_LIST_SET=m
163CONFIG_NF_CONNTRACK_IPV4=m 169CONFIG_NF_CONNTRACK_IPV4=m
164CONFIG_NF_TABLES_IPV4=m
165CONFIG_NFT_REJECT_IPV4=m
166CONFIG_NFT_CHAIN_ROUTE_IPV4=m 170CONFIG_NFT_CHAIN_ROUTE_IPV4=m
167CONFIG_NFT_CHAIN_NAT_IPV4=m 171CONFIG_NFT_CHAIN_NAT_IPV4=m
168CONFIG_NF_TABLES_ARP=m 172CONFIG_NF_TABLES_ARP=m
@@ -188,7 +192,6 @@ CONFIG_IP_NF_ARPTABLES=m
188CONFIG_IP_NF_ARPFILTER=m 192CONFIG_IP_NF_ARPFILTER=m
189CONFIG_IP_NF_ARP_MANGLE=m 193CONFIG_IP_NF_ARP_MANGLE=m
190CONFIG_NF_CONNTRACK_IPV6=m 194CONFIG_NF_CONNTRACK_IPV6=m
191CONFIG_NF_TABLES_IPV6=m
192CONFIG_NFT_CHAIN_ROUTE_IPV6=m 195CONFIG_NFT_CHAIN_ROUTE_IPV6=m
193CONFIG_NFT_CHAIN_NAT_IPV6=m 196CONFIG_NFT_CHAIN_NAT_IPV6=m
194CONFIG_IP6_NF_IPTABLES=m 197CONFIG_IP6_NF_IPTABLES=m
@@ -470,7 +473,6 @@ CONFIG_CRYPTO_LZ4HC=m
470CONFIG_CRYPTO_USER_API_HASH=m 473CONFIG_CRYPTO_USER_API_HASH=m
471CONFIG_CRYPTO_USER_API_SKCIPHER=m 474CONFIG_CRYPTO_USER_API_SKCIPHER=m
472# CONFIG_CRYPTO_HW is not set 475# CONFIG_CRYPTO_HW is not set
473CONFIG_CRC_T10DIF=y
474CONFIG_XZ_DEC_X86=y 476CONFIG_XZ_DEC_X86=y
475CONFIG_XZ_DEC_POWERPC=y 477CONFIG_XZ_DEC_POWERPC=y
476CONFIG_XZ_DEC_IA64=y 478CONFIG_XZ_DEC_IA64=y
diff --git a/arch/m68k/configs/atari_defconfig b/arch/m68k/configs/atari_defconfig
index e880cfbb62d9..6ea4e91f0caa 100644
--- a/arch/m68k/configs/atari_defconfig
+++ b/arch/m68k/configs/atari_defconfig
@@ -24,6 +24,8 @@ CONFIG_SUN_PARTITION=y
24# CONFIG_EFI_PARTITION is not set 24# CONFIG_EFI_PARTITION is not set
25CONFIG_SYSV68_PARTITION=y 25CONFIG_SYSV68_PARTITION=y
26CONFIG_IOSCHED_DEADLINE=m 26CONFIG_IOSCHED_DEADLINE=m
27CONFIG_KEXEC=y
28CONFIG_BOOTINFO_PROC=y
27CONFIG_M68020=y 29CONFIG_M68020=y
28CONFIG_M68030=y 30CONFIG_M68030=y
29CONFIG_M68040=y 31CONFIG_M68040=y
@@ -82,6 +84,7 @@ CONFIG_NF_CONNTRACK_SANE=m
82CONFIG_NF_CONNTRACK_SIP=m 84CONFIG_NF_CONNTRACK_SIP=m
83CONFIG_NF_CONNTRACK_TFTP=m 85CONFIG_NF_CONNTRACK_TFTP=m
84CONFIG_NF_TABLES=m 86CONFIG_NF_TABLES=m
87CONFIG_NF_TABLES_INET=m
85CONFIG_NFT_EXTHDR=m 88CONFIG_NFT_EXTHDR=m
86CONFIG_NFT_META=m 89CONFIG_NFT_META=m
87CONFIG_NFT_CT=m 90CONFIG_NFT_CT=m
@@ -91,6 +94,8 @@ CONFIG_NFT_COUNTER=m
91CONFIG_NFT_LOG=m 94CONFIG_NFT_LOG=m
92CONFIG_NFT_LIMIT=m 95CONFIG_NFT_LIMIT=m
93CONFIG_NFT_NAT=m 96CONFIG_NFT_NAT=m
97CONFIG_NFT_QUEUE=m
98CONFIG_NFT_REJECT=m
94CONFIG_NFT_COMPAT=m 99CONFIG_NFT_COMPAT=m
95CONFIG_NETFILTER_XT_SET=m 100CONFIG_NETFILTER_XT_SET=m
96CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m 101CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
@@ -123,6 +128,7 @@ CONFIG_NETFILTER_XT_MATCH_DSCP=m
123CONFIG_NETFILTER_XT_MATCH_ESP=m 128CONFIG_NETFILTER_XT_MATCH_ESP=m
124CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m 129CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
125CONFIG_NETFILTER_XT_MATCH_HELPER=m 130CONFIG_NETFILTER_XT_MATCH_HELPER=m
131CONFIG_NETFILTER_XT_MATCH_IPCOMP=m
126CONFIG_NETFILTER_XT_MATCH_IPRANGE=m 132CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
127CONFIG_NETFILTER_XT_MATCH_LENGTH=m 133CONFIG_NETFILTER_XT_MATCH_LENGTH=m
128CONFIG_NETFILTER_XT_MATCH_LIMIT=m 134CONFIG_NETFILTER_XT_MATCH_LIMIT=m
@@ -160,8 +166,6 @@ CONFIG_IP_SET_HASH_NETPORT=m
160CONFIG_IP_SET_HASH_NETIFACE=m 166CONFIG_IP_SET_HASH_NETIFACE=m
161CONFIG_IP_SET_LIST_SET=m 167CONFIG_IP_SET_LIST_SET=m
162CONFIG_NF_CONNTRACK_IPV4=m 168CONFIG_NF_CONNTRACK_IPV4=m
163CONFIG_NF_TABLES_IPV4=m
164CONFIG_NFT_REJECT_IPV4=m
165CONFIG_NFT_CHAIN_ROUTE_IPV4=m 169CONFIG_NFT_CHAIN_ROUTE_IPV4=m
166CONFIG_NFT_CHAIN_NAT_IPV4=m 170CONFIG_NFT_CHAIN_NAT_IPV4=m
167CONFIG_NF_TABLES_ARP=m 171CONFIG_NF_TABLES_ARP=m
@@ -187,7 +191,6 @@ CONFIG_IP_NF_ARPTABLES=m
187CONFIG_IP_NF_ARPFILTER=m 191CONFIG_IP_NF_ARPFILTER=m
188CONFIG_IP_NF_ARP_MANGLE=m 192CONFIG_IP_NF_ARP_MANGLE=m
189CONFIG_NF_CONNTRACK_IPV6=m 193CONFIG_NF_CONNTRACK_IPV6=m
190CONFIG_NF_TABLES_IPV6=m
191CONFIG_NFT_CHAIN_ROUTE_IPV6=m 194CONFIG_NFT_CHAIN_ROUTE_IPV6=m
192CONFIG_NFT_CHAIN_NAT_IPV6=m 195CONFIG_NFT_CHAIN_NAT_IPV6=m
193CONFIG_IP6_NF_IPTABLES=m 196CONFIG_IP6_NF_IPTABLES=m
@@ -487,7 +490,6 @@ CONFIG_CRYPTO_LZ4HC=m
487CONFIG_CRYPTO_USER_API_HASH=m 490CONFIG_CRYPTO_USER_API_HASH=m
488CONFIG_CRYPTO_USER_API_SKCIPHER=m 491CONFIG_CRYPTO_USER_API_SKCIPHER=m
489# CONFIG_CRYPTO_HW is not set 492# CONFIG_CRYPTO_HW is not set
490CONFIG_CRC_T10DIF=y
491CONFIG_XZ_DEC_X86=y 493CONFIG_XZ_DEC_X86=y
492CONFIG_XZ_DEC_POWERPC=y 494CONFIG_XZ_DEC_POWERPC=y
493CONFIG_XZ_DEC_IA64=y 495CONFIG_XZ_DEC_IA64=y
diff --git a/arch/m68k/configs/bvme6000_defconfig b/arch/m68k/configs/bvme6000_defconfig
index 4aa4f45e52a8..e5a12739ff2d 100644
--- a/arch/m68k/configs/bvme6000_defconfig
+++ b/arch/m68k/configs/bvme6000_defconfig
@@ -24,6 +24,8 @@ CONFIG_UNIXWARE_DISKLABEL=y
24CONFIG_SUN_PARTITION=y 24CONFIG_SUN_PARTITION=y
25# CONFIG_EFI_PARTITION is not set 25# CONFIG_EFI_PARTITION is not set
26CONFIG_IOSCHED_DEADLINE=m 26CONFIG_IOSCHED_DEADLINE=m
27CONFIG_KEXEC=y
28CONFIG_BOOTINFO_PROC=y
27CONFIG_M68040=y 29CONFIG_M68040=y
28CONFIG_M68060=y 30CONFIG_M68060=y
29CONFIG_VME=y 31CONFIG_VME=y
@@ -81,6 +83,7 @@ CONFIG_NF_CONNTRACK_SANE=m
81CONFIG_NF_CONNTRACK_SIP=m 83CONFIG_NF_CONNTRACK_SIP=m
82CONFIG_NF_CONNTRACK_TFTP=m 84CONFIG_NF_CONNTRACK_TFTP=m
83CONFIG_NF_TABLES=m 85CONFIG_NF_TABLES=m
86CONFIG_NF_TABLES_INET=m
84CONFIG_NFT_EXTHDR=m 87CONFIG_NFT_EXTHDR=m
85CONFIG_NFT_META=m 88CONFIG_NFT_META=m
86CONFIG_NFT_CT=m 89CONFIG_NFT_CT=m
@@ -90,6 +93,8 @@ CONFIG_NFT_COUNTER=m
90CONFIG_NFT_LOG=m 93CONFIG_NFT_LOG=m
91CONFIG_NFT_LIMIT=m 94CONFIG_NFT_LIMIT=m
92CONFIG_NFT_NAT=m 95CONFIG_NFT_NAT=m
96CONFIG_NFT_QUEUE=m
97CONFIG_NFT_REJECT=m
93CONFIG_NFT_COMPAT=m 98CONFIG_NFT_COMPAT=m
94CONFIG_NETFILTER_XT_SET=m 99CONFIG_NETFILTER_XT_SET=m
95CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m 100CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
@@ -122,6 +127,7 @@ CONFIG_NETFILTER_XT_MATCH_DSCP=m
122CONFIG_NETFILTER_XT_MATCH_ESP=m 127CONFIG_NETFILTER_XT_MATCH_ESP=m
123CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m 128CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
124CONFIG_NETFILTER_XT_MATCH_HELPER=m 129CONFIG_NETFILTER_XT_MATCH_HELPER=m
130CONFIG_NETFILTER_XT_MATCH_IPCOMP=m
125CONFIG_NETFILTER_XT_MATCH_IPRANGE=m 131CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
126CONFIG_NETFILTER_XT_MATCH_LENGTH=m 132CONFIG_NETFILTER_XT_MATCH_LENGTH=m
127CONFIG_NETFILTER_XT_MATCH_LIMIT=m 133CONFIG_NETFILTER_XT_MATCH_LIMIT=m
@@ -159,8 +165,6 @@ CONFIG_IP_SET_HASH_NETPORT=m
159CONFIG_IP_SET_HASH_NETIFACE=m 165CONFIG_IP_SET_HASH_NETIFACE=m
160CONFIG_IP_SET_LIST_SET=m 166CONFIG_IP_SET_LIST_SET=m
161CONFIG_NF_CONNTRACK_IPV4=m 167CONFIG_NF_CONNTRACK_IPV4=m
162CONFIG_NF_TABLES_IPV4=m
163CONFIG_NFT_REJECT_IPV4=m
164CONFIG_NFT_CHAIN_ROUTE_IPV4=m 168CONFIG_NFT_CHAIN_ROUTE_IPV4=m
165CONFIG_NFT_CHAIN_NAT_IPV4=m 169CONFIG_NFT_CHAIN_NAT_IPV4=m
166CONFIG_NF_TABLES_ARP=m 170CONFIG_NF_TABLES_ARP=m
@@ -186,7 +190,6 @@ CONFIG_IP_NF_ARPTABLES=m
186CONFIG_IP_NF_ARPFILTER=m 190CONFIG_IP_NF_ARPFILTER=m
187CONFIG_IP_NF_ARP_MANGLE=m 191CONFIG_IP_NF_ARP_MANGLE=m
188CONFIG_NF_CONNTRACK_IPV6=m 192CONFIG_NF_CONNTRACK_IPV6=m
189CONFIG_NF_TABLES_IPV6=m
190CONFIG_NFT_CHAIN_ROUTE_IPV6=m 193CONFIG_NFT_CHAIN_ROUTE_IPV6=m
191CONFIG_NFT_CHAIN_NAT_IPV6=m 194CONFIG_NFT_CHAIN_NAT_IPV6=m
192CONFIG_IP6_NF_IPTABLES=m 195CONFIG_IP6_NF_IPTABLES=m
@@ -463,7 +466,6 @@ CONFIG_CRYPTO_LZ4HC=m
463CONFIG_CRYPTO_USER_API_HASH=m 466CONFIG_CRYPTO_USER_API_HASH=m
464CONFIG_CRYPTO_USER_API_SKCIPHER=m 467CONFIG_CRYPTO_USER_API_SKCIPHER=m
465# CONFIG_CRYPTO_HW is not set 468# CONFIG_CRYPTO_HW is not set
466CONFIG_CRC_T10DIF=y
467CONFIG_XZ_DEC_X86=y 469CONFIG_XZ_DEC_X86=y
468CONFIG_XZ_DEC_POWERPC=y 470CONFIG_XZ_DEC_POWERPC=y
469CONFIG_XZ_DEC_IA64=y 471CONFIG_XZ_DEC_IA64=y
diff --git a/arch/m68k/configs/hp300_defconfig b/arch/m68k/configs/hp300_defconfig
index 7cd9d9f456fb..8936d7fb0f0f 100644
--- a/arch/m68k/configs/hp300_defconfig
+++ b/arch/m68k/configs/hp300_defconfig
@@ -25,6 +25,8 @@ CONFIG_SUN_PARTITION=y
25# CONFIG_EFI_PARTITION is not set 25# CONFIG_EFI_PARTITION is not set
26CONFIG_SYSV68_PARTITION=y 26CONFIG_SYSV68_PARTITION=y
27CONFIG_IOSCHED_DEADLINE=m 27CONFIG_IOSCHED_DEADLINE=m
28CONFIG_KEXEC=y
29CONFIG_BOOTINFO_PROC=y
28CONFIG_M68020=y 30CONFIG_M68020=y
29CONFIG_M68030=y 31CONFIG_M68030=y
30CONFIG_M68040=y 32CONFIG_M68040=y
@@ -83,6 +85,7 @@ CONFIG_NF_CONNTRACK_SANE=m
83CONFIG_NF_CONNTRACK_SIP=m 85CONFIG_NF_CONNTRACK_SIP=m
84CONFIG_NF_CONNTRACK_TFTP=m 86CONFIG_NF_CONNTRACK_TFTP=m
85CONFIG_NF_TABLES=m 87CONFIG_NF_TABLES=m
88CONFIG_NF_TABLES_INET=m
86CONFIG_NFT_EXTHDR=m 89CONFIG_NFT_EXTHDR=m
87CONFIG_NFT_META=m 90CONFIG_NFT_META=m
88CONFIG_NFT_CT=m 91CONFIG_NFT_CT=m
@@ -92,6 +95,8 @@ CONFIG_NFT_COUNTER=m
92CONFIG_NFT_LOG=m 95CONFIG_NFT_LOG=m
93CONFIG_NFT_LIMIT=m 96CONFIG_NFT_LIMIT=m
94CONFIG_NFT_NAT=m 97CONFIG_NFT_NAT=m
98CONFIG_NFT_QUEUE=m
99CONFIG_NFT_REJECT=m
95CONFIG_NFT_COMPAT=m 100CONFIG_NFT_COMPAT=m
96CONFIG_NETFILTER_XT_SET=m 101CONFIG_NETFILTER_XT_SET=m
97CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m 102CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
@@ -124,6 +129,7 @@ CONFIG_NETFILTER_XT_MATCH_DSCP=m
124CONFIG_NETFILTER_XT_MATCH_ESP=m 129CONFIG_NETFILTER_XT_MATCH_ESP=m
125CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m 130CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
126CONFIG_NETFILTER_XT_MATCH_HELPER=m 131CONFIG_NETFILTER_XT_MATCH_HELPER=m
132CONFIG_NETFILTER_XT_MATCH_IPCOMP=m
127CONFIG_NETFILTER_XT_MATCH_IPRANGE=m 133CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
128CONFIG_NETFILTER_XT_MATCH_LENGTH=m 134CONFIG_NETFILTER_XT_MATCH_LENGTH=m
129CONFIG_NETFILTER_XT_MATCH_LIMIT=m 135CONFIG_NETFILTER_XT_MATCH_LIMIT=m
@@ -161,8 +167,6 @@ CONFIG_IP_SET_HASH_NETPORT=m
161CONFIG_IP_SET_HASH_NETIFACE=m 167CONFIG_IP_SET_HASH_NETIFACE=m
162CONFIG_IP_SET_LIST_SET=m 168CONFIG_IP_SET_LIST_SET=m
163CONFIG_NF_CONNTRACK_IPV4=m 169CONFIG_NF_CONNTRACK_IPV4=m
164CONFIG_NF_TABLES_IPV4=m
165CONFIG_NFT_REJECT_IPV4=m
166CONFIG_NFT_CHAIN_ROUTE_IPV4=m 170CONFIG_NFT_CHAIN_ROUTE_IPV4=m
167CONFIG_NFT_CHAIN_NAT_IPV4=m 171CONFIG_NFT_CHAIN_NAT_IPV4=m
168CONFIG_NF_TABLES_ARP=m 172CONFIG_NF_TABLES_ARP=m
@@ -188,7 +192,6 @@ CONFIG_IP_NF_ARPTABLES=m
188CONFIG_IP_NF_ARPFILTER=m 192CONFIG_IP_NF_ARPFILTER=m
189CONFIG_IP_NF_ARP_MANGLE=m 193CONFIG_IP_NF_ARP_MANGLE=m
190CONFIG_NF_CONNTRACK_IPV6=m 194CONFIG_NF_CONNTRACK_IPV6=m
191CONFIG_NF_TABLES_IPV6=m
192CONFIG_NFT_CHAIN_ROUTE_IPV6=m 195CONFIG_NFT_CHAIN_ROUTE_IPV6=m
193CONFIG_NFT_CHAIN_NAT_IPV6=m 196CONFIG_NFT_CHAIN_NAT_IPV6=m
194CONFIG_IP6_NF_IPTABLES=m 197CONFIG_IP6_NF_IPTABLES=m
@@ -472,7 +475,6 @@ CONFIG_CRYPTO_LZ4HC=m
472CONFIG_CRYPTO_USER_API_HASH=m 475CONFIG_CRYPTO_USER_API_HASH=m
473CONFIG_CRYPTO_USER_API_SKCIPHER=m 476CONFIG_CRYPTO_USER_API_SKCIPHER=m
474# CONFIG_CRYPTO_HW is not set 477# CONFIG_CRYPTO_HW is not set
475CONFIG_CRC_T10DIF=y
476CONFIG_XZ_DEC_X86=y 478CONFIG_XZ_DEC_X86=y
477CONFIG_XZ_DEC_POWERPC=y 479CONFIG_XZ_DEC_POWERPC=y
478CONFIG_XZ_DEC_IA64=y 480CONFIG_XZ_DEC_IA64=y
diff --git a/arch/m68k/configs/mac_defconfig b/arch/m68k/configs/mac_defconfig
index 31f5bd061d14..be5342cca25b 100644
--- a/arch/m68k/configs/mac_defconfig
+++ b/arch/m68k/configs/mac_defconfig
@@ -24,6 +24,8 @@ CONFIG_SUN_PARTITION=y
24# CONFIG_EFI_PARTITION is not set 24# CONFIG_EFI_PARTITION is not set
25CONFIG_SYSV68_PARTITION=y 25CONFIG_SYSV68_PARTITION=y
26CONFIG_IOSCHED_DEADLINE=m 26CONFIG_IOSCHED_DEADLINE=m
27CONFIG_KEXEC=y
28CONFIG_BOOTINFO_PROC=y
27CONFIG_M68020=y 29CONFIG_M68020=y
28CONFIG_M68030=y 30CONFIG_M68030=y
29CONFIG_M68040=y 31CONFIG_M68040=y
@@ -82,6 +84,7 @@ CONFIG_NF_CONNTRACK_SANE=m
82CONFIG_NF_CONNTRACK_SIP=m 84CONFIG_NF_CONNTRACK_SIP=m
83CONFIG_NF_CONNTRACK_TFTP=m 85CONFIG_NF_CONNTRACK_TFTP=m
84CONFIG_NF_TABLES=m 86CONFIG_NF_TABLES=m
87CONFIG_NF_TABLES_INET=m
85CONFIG_NFT_EXTHDR=m 88CONFIG_NFT_EXTHDR=m
86CONFIG_NFT_META=m 89CONFIG_NFT_META=m
87CONFIG_NFT_CT=m 90CONFIG_NFT_CT=m
@@ -91,6 +94,8 @@ CONFIG_NFT_COUNTER=m
91CONFIG_NFT_LOG=m 94CONFIG_NFT_LOG=m
92CONFIG_NFT_LIMIT=m 95CONFIG_NFT_LIMIT=m
93CONFIG_NFT_NAT=m 96CONFIG_NFT_NAT=m
97CONFIG_NFT_QUEUE=m
98CONFIG_NFT_REJECT=m
94CONFIG_NFT_COMPAT=m 99CONFIG_NFT_COMPAT=m
95CONFIG_NETFILTER_XT_SET=m 100CONFIG_NETFILTER_XT_SET=m
96CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m 101CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
@@ -123,6 +128,7 @@ CONFIG_NETFILTER_XT_MATCH_DSCP=m
123CONFIG_NETFILTER_XT_MATCH_ESP=m 128CONFIG_NETFILTER_XT_MATCH_ESP=m
124CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m 129CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
125CONFIG_NETFILTER_XT_MATCH_HELPER=m 130CONFIG_NETFILTER_XT_MATCH_HELPER=m
131CONFIG_NETFILTER_XT_MATCH_IPCOMP=m
126CONFIG_NETFILTER_XT_MATCH_IPRANGE=m 132CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
127CONFIG_NETFILTER_XT_MATCH_LENGTH=m 133CONFIG_NETFILTER_XT_MATCH_LENGTH=m
128CONFIG_NETFILTER_XT_MATCH_LIMIT=m 134CONFIG_NETFILTER_XT_MATCH_LIMIT=m
@@ -160,8 +166,6 @@ CONFIG_IP_SET_HASH_NETPORT=m
160CONFIG_IP_SET_HASH_NETIFACE=m 166CONFIG_IP_SET_HASH_NETIFACE=m
161CONFIG_IP_SET_LIST_SET=m 167CONFIG_IP_SET_LIST_SET=m
162CONFIG_NF_CONNTRACK_IPV4=m 168CONFIG_NF_CONNTRACK_IPV4=m
163CONFIG_NF_TABLES_IPV4=m
164CONFIG_NFT_REJECT_IPV4=m
165CONFIG_NFT_CHAIN_ROUTE_IPV4=m 169CONFIG_NFT_CHAIN_ROUTE_IPV4=m
166CONFIG_NFT_CHAIN_NAT_IPV4=m 170CONFIG_NFT_CHAIN_NAT_IPV4=m
167CONFIG_NF_TABLES_ARP=m 171CONFIG_NF_TABLES_ARP=m
@@ -187,7 +191,6 @@ CONFIG_IP_NF_ARPTABLES=m
187CONFIG_IP_NF_ARPFILTER=m 191CONFIG_IP_NF_ARPFILTER=m
188CONFIG_IP_NF_ARP_MANGLE=m 192CONFIG_IP_NF_ARP_MANGLE=m
189CONFIG_NF_CONNTRACK_IPV6=m 193CONFIG_NF_CONNTRACK_IPV6=m
190CONFIG_NF_TABLES_IPV6=m
191CONFIG_NFT_CHAIN_ROUTE_IPV6=m 194CONFIG_NFT_CHAIN_ROUTE_IPV6=m
192CONFIG_NFT_CHAIN_NAT_IPV6=m 195CONFIG_NFT_CHAIN_NAT_IPV6=m
193CONFIG_IP6_NF_IPTABLES=m 196CONFIG_IP6_NF_IPTABLES=m
@@ -495,7 +498,6 @@ CONFIG_CRYPTO_LZ4HC=m
495CONFIG_CRYPTO_USER_API_HASH=m 498CONFIG_CRYPTO_USER_API_HASH=m
496CONFIG_CRYPTO_USER_API_SKCIPHER=m 499CONFIG_CRYPTO_USER_API_SKCIPHER=m
497# CONFIG_CRYPTO_HW is not set 500# CONFIG_CRYPTO_HW is not set
498CONFIG_CRC_T10DIF=y
499CONFIG_XZ_DEC_X86=y 501CONFIG_XZ_DEC_X86=y
500CONFIG_XZ_DEC_POWERPC=y 502CONFIG_XZ_DEC_POWERPC=y
501CONFIG_XZ_DEC_IA64=y 503CONFIG_XZ_DEC_IA64=y
diff --git a/arch/m68k/configs/multi_defconfig b/arch/m68k/configs/multi_defconfig
index 4e5adff326ee..f27194ade167 100644
--- a/arch/m68k/configs/multi_defconfig
+++ b/arch/m68k/configs/multi_defconfig
@@ -20,6 +20,8 @@ CONFIG_SOLARIS_X86_PARTITION=y
20CONFIG_UNIXWARE_DISKLABEL=y 20CONFIG_UNIXWARE_DISKLABEL=y
21# CONFIG_EFI_PARTITION is not set 21# CONFIG_EFI_PARTITION is not set
22CONFIG_IOSCHED_DEADLINE=m 22CONFIG_IOSCHED_DEADLINE=m
23CONFIG_KEXEC=y
24CONFIG_BOOTINFO_PROC=y
23CONFIG_M68020=y 25CONFIG_M68020=y
24CONFIG_M68040=y 26CONFIG_M68040=y
25CONFIG_M68060=y 27CONFIG_M68060=y
@@ -91,6 +93,7 @@ CONFIG_NF_CONNTRACK_SANE=m
91CONFIG_NF_CONNTRACK_SIP=m 93CONFIG_NF_CONNTRACK_SIP=m
92CONFIG_NF_CONNTRACK_TFTP=m 94CONFIG_NF_CONNTRACK_TFTP=m
93CONFIG_NF_TABLES=m 95CONFIG_NF_TABLES=m
96CONFIG_NF_TABLES_INET=m
94CONFIG_NFT_EXTHDR=m 97CONFIG_NFT_EXTHDR=m
95CONFIG_NFT_META=m 98CONFIG_NFT_META=m
96CONFIG_NFT_CT=m 99CONFIG_NFT_CT=m
@@ -100,6 +103,8 @@ CONFIG_NFT_COUNTER=m
100CONFIG_NFT_LOG=m 103CONFIG_NFT_LOG=m
101CONFIG_NFT_LIMIT=m 104CONFIG_NFT_LIMIT=m
102CONFIG_NFT_NAT=m 105CONFIG_NFT_NAT=m
106CONFIG_NFT_QUEUE=m
107CONFIG_NFT_REJECT=m
103CONFIG_NFT_COMPAT=m 108CONFIG_NFT_COMPAT=m
104CONFIG_NETFILTER_XT_SET=m 109CONFIG_NETFILTER_XT_SET=m
105CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m 110CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
@@ -132,6 +137,7 @@ CONFIG_NETFILTER_XT_MATCH_DSCP=m
132CONFIG_NETFILTER_XT_MATCH_ESP=m 137CONFIG_NETFILTER_XT_MATCH_ESP=m
133CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m 138CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
134CONFIG_NETFILTER_XT_MATCH_HELPER=m 139CONFIG_NETFILTER_XT_MATCH_HELPER=m
140CONFIG_NETFILTER_XT_MATCH_IPCOMP=m
135CONFIG_NETFILTER_XT_MATCH_IPRANGE=m 141CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
136CONFIG_NETFILTER_XT_MATCH_LENGTH=m 142CONFIG_NETFILTER_XT_MATCH_LENGTH=m
137CONFIG_NETFILTER_XT_MATCH_LIMIT=m 143CONFIG_NETFILTER_XT_MATCH_LIMIT=m
@@ -169,8 +175,6 @@ CONFIG_IP_SET_HASH_NETPORT=m
169CONFIG_IP_SET_HASH_NETIFACE=m 175CONFIG_IP_SET_HASH_NETIFACE=m
170CONFIG_IP_SET_LIST_SET=m 176CONFIG_IP_SET_LIST_SET=m
171CONFIG_NF_CONNTRACK_IPV4=m 177CONFIG_NF_CONNTRACK_IPV4=m
172CONFIG_NF_TABLES_IPV4=m
173CONFIG_NFT_REJECT_IPV4=m
174CONFIG_NFT_CHAIN_ROUTE_IPV4=m 178CONFIG_NFT_CHAIN_ROUTE_IPV4=m
175CONFIG_NFT_CHAIN_NAT_IPV4=m 179CONFIG_NFT_CHAIN_NAT_IPV4=m
176CONFIG_NF_TABLES_ARP=m 180CONFIG_NF_TABLES_ARP=m
@@ -196,7 +200,6 @@ CONFIG_IP_NF_ARPTABLES=m
196CONFIG_IP_NF_ARPFILTER=m 200CONFIG_IP_NF_ARPFILTER=m
197CONFIG_IP_NF_ARP_MANGLE=m 201CONFIG_IP_NF_ARP_MANGLE=m
198CONFIG_NF_CONNTRACK_IPV6=m 202CONFIG_NF_CONNTRACK_IPV6=m
199CONFIG_NF_TABLES_IPV6=m
200CONFIG_NFT_CHAIN_ROUTE_IPV6=m 203CONFIG_NFT_CHAIN_ROUTE_IPV6=m
201CONFIG_NFT_CHAIN_NAT_IPV6=m 204CONFIG_NFT_CHAIN_NAT_IPV6=m
202CONFIG_IP6_NF_IPTABLES=m 205CONFIG_IP6_NF_IPTABLES=m
@@ -571,7 +574,6 @@ CONFIG_CRYPTO_LZ4HC=m
571CONFIG_CRYPTO_USER_API_HASH=m 574CONFIG_CRYPTO_USER_API_HASH=m
572CONFIG_CRYPTO_USER_API_SKCIPHER=m 575CONFIG_CRYPTO_USER_API_SKCIPHER=m
573# CONFIG_CRYPTO_HW is not set 576# CONFIG_CRYPTO_HW is not set
574CONFIG_CRC_T10DIF=y
575CONFIG_XZ_DEC_X86=y 577CONFIG_XZ_DEC_X86=y
576CONFIG_XZ_DEC_POWERPC=y 578CONFIG_XZ_DEC_POWERPC=y
577CONFIG_XZ_DEC_IA64=y 579CONFIG_XZ_DEC_IA64=y
diff --git a/arch/m68k/configs/mvme147_defconfig b/arch/m68k/configs/mvme147_defconfig
index 02cdbac5565e..c3887603c1db 100644
--- a/arch/m68k/configs/mvme147_defconfig
+++ b/arch/m68k/configs/mvme147_defconfig
@@ -24,6 +24,8 @@ CONFIG_UNIXWARE_DISKLABEL=y
24CONFIG_SUN_PARTITION=y 24CONFIG_SUN_PARTITION=y
25# CONFIG_EFI_PARTITION is not set 25# CONFIG_EFI_PARTITION is not set
26CONFIG_IOSCHED_DEADLINE=m 26CONFIG_IOSCHED_DEADLINE=m
27CONFIG_KEXEC=y
28CONFIG_BOOTINFO_PROC=y
27CONFIG_M68030=y 29CONFIG_M68030=y
28CONFIG_VME=y 30CONFIG_VME=y
29CONFIG_MVME147=y 31CONFIG_MVME147=y
@@ -80,6 +82,7 @@ CONFIG_NF_CONNTRACK_SANE=m
80CONFIG_NF_CONNTRACK_SIP=m 82CONFIG_NF_CONNTRACK_SIP=m
81CONFIG_NF_CONNTRACK_TFTP=m 83CONFIG_NF_CONNTRACK_TFTP=m
82CONFIG_NF_TABLES=m 84CONFIG_NF_TABLES=m
85CONFIG_NF_TABLES_INET=m
83CONFIG_NFT_EXTHDR=m 86CONFIG_NFT_EXTHDR=m
84CONFIG_NFT_META=m 87CONFIG_NFT_META=m
85CONFIG_NFT_CT=m 88CONFIG_NFT_CT=m
@@ -89,6 +92,8 @@ CONFIG_NFT_COUNTER=m
89CONFIG_NFT_LOG=m 92CONFIG_NFT_LOG=m
90CONFIG_NFT_LIMIT=m 93CONFIG_NFT_LIMIT=m
91CONFIG_NFT_NAT=m 94CONFIG_NFT_NAT=m
95CONFIG_NFT_QUEUE=m
96CONFIG_NFT_REJECT=m
92CONFIG_NFT_COMPAT=m 97CONFIG_NFT_COMPAT=m
93CONFIG_NETFILTER_XT_SET=m 98CONFIG_NETFILTER_XT_SET=m
94CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m 99CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
@@ -121,6 +126,7 @@ CONFIG_NETFILTER_XT_MATCH_DSCP=m
121CONFIG_NETFILTER_XT_MATCH_ESP=m 126CONFIG_NETFILTER_XT_MATCH_ESP=m
122CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m 127CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
123CONFIG_NETFILTER_XT_MATCH_HELPER=m 128CONFIG_NETFILTER_XT_MATCH_HELPER=m
129CONFIG_NETFILTER_XT_MATCH_IPCOMP=m
124CONFIG_NETFILTER_XT_MATCH_IPRANGE=m 130CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
125CONFIG_NETFILTER_XT_MATCH_LENGTH=m 131CONFIG_NETFILTER_XT_MATCH_LENGTH=m
126CONFIG_NETFILTER_XT_MATCH_LIMIT=m 132CONFIG_NETFILTER_XT_MATCH_LIMIT=m
@@ -158,8 +164,6 @@ CONFIG_IP_SET_HASH_NETPORT=m
158CONFIG_IP_SET_HASH_NETIFACE=m 164CONFIG_IP_SET_HASH_NETIFACE=m
159CONFIG_IP_SET_LIST_SET=m 165CONFIG_IP_SET_LIST_SET=m
160CONFIG_NF_CONNTRACK_IPV4=m 166CONFIG_NF_CONNTRACK_IPV4=m
161CONFIG_NF_TABLES_IPV4=m
162CONFIG_NFT_REJECT_IPV4=m
163CONFIG_NFT_CHAIN_ROUTE_IPV4=m 167CONFIG_NFT_CHAIN_ROUTE_IPV4=m
164CONFIG_NFT_CHAIN_NAT_IPV4=m 168CONFIG_NFT_CHAIN_NAT_IPV4=m
165CONFIG_NF_TABLES_ARP=m 169CONFIG_NF_TABLES_ARP=m
@@ -185,7 +189,6 @@ CONFIG_IP_NF_ARPTABLES=m
185CONFIG_IP_NF_ARPFILTER=m 189CONFIG_IP_NF_ARPFILTER=m
186CONFIG_IP_NF_ARP_MANGLE=m 190CONFIG_IP_NF_ARP_MANGLE=m
187CONFIG_NF_CONNTRACK_IPV6=m 191CONFIG_NF_CONNTRACK_IPV6=m
188CONFIG_NF_TABLES_IPV6=m
189CONFIG_NFT_CHAIN_ROUTE_IPV6=m 192CONFIG_NFT_CHAIN_ROUTE_IPV6=m
190CONFIG_NFT_CHAIN_NAT_IPV6=m 193CONFIG_NFT_CHAIN_NAT_IPV6=m
191CONFIG_IP6_NF_IPTABLES=m 194CONFIG_IP6_NF_IPTABLES=m
@@ -463,7 +466,6 @@ CONFIG_CRYPTO_LZ4HC=m
463CONFIG_CRYPTO_USER_API_HASH=m 466CONFIG_CRYPTO_USER_API_HASH=m
464CONFIG_CRYPTO_USER_API_SKCIPHER=m 467CONFIG_CRYPTO_USER_API_SKCIPHER=m
465# CONFIG_CRYPTO_HW is not set 468# CONFIG_CRYPTO_HW is not set
466CONFIG_CRC_T10DIF=y
467CONFIG_XZ_DEC_X86=y 469CONFIG_XZ_DEC_X86=y
468CONFIG_XZ_DEC_POWERPC=y 470CONFIG_XZ_DEC_POWERPC=y
469CONFIG_XZ_DEC_IA64=y 471CONFIG_XZ_DEC_IA64=y
diff --git a/arch/m68k/configs/mvme16x_defconfig b/arch/m68k/configs/mvme16x_defconfig
index 05a990a9dbd4..f7ff784d05ac 100644
--- a/arch/m68k/configs/mvme16x_defconfig
+++ b/arch/m68k/configs/mvme16x_defconfig
@@ -24,6 +24,8 @@ CONFIG_UNIXWARE_DISKLABEL=y
24CONFIG_SUN_PARTITION=y 24CONFIG_SUN_PARTITION=y
25# CONFIG_EFI_PARTITION is not set 25# CONFIG_EFI_PARTITION is not set
26CONFIG_IOSCHED_DEADLINE=m 26CONFIG_IOSCHED_DEADLINE=m
27CONFIG_KEXEC=y
28CONFIG_BOOTINFO_PROC=y
27CONFIG_M68040=y 29CONFIG_M68040=y
28CONFIG_M68060=y 30CONFIG_M68060=y
29CONFIG_VME=y 31CONFIG_VME=y
@@ -81,6 +83,7 @@ CONFIG_NF_CONNTRACK_SANE=m
81CONFIG_NF_CONNTRACK_SIP=m 83CONFIG_NF_CONNTRACK_SIP=m
82CONFIG_NF_CONNTRACK_TFTP=m 84CONFIG_NF_CONNTRACK_TFTP=m
83CONFIG_NF_TABLES=m 85CONFIG_NF_TABLES=m
86CONFIG_NF_TABLES_INET=m
84CONFIG_NFT_EXTHDR=m 87CONFIG_NFT_EXTHDR=m
85CONFIG_NFT_META=m 88CONFIG_NFT_META=m
86CONFIG_NFT_CT=m 89CONFIG_NFT_CT=m
@@ -90,6 +93,8 @@ CONFIG_NFT_COUNTER=m
90CONFIG_NFT_LOG=m 93CONFIG_NFT_LOG=m
91CONFIG_NFT_LIMIT=m 94CONFIG_NFT_LIMIT=m
92CONFIG_NFT_NAT=m 95CONFIG_NFT_NAT=m
96CONFIG_NFT_QUEUE=m
97CONFIG_NFT_REJECT=m
93CONFIG_NFT_COMPAT=m 98CONFIG_NFT_COMPAT=m
94CONFIG_NETFILTER_XT_SET=m 99CONFIG_NETFILTER_XT_SET=m
95CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m 100CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
@@ -122,6 +127,7 @@ CONFIG_NETFILTER_XT_MATCH_DSCP=m
122CONFIG_NETFILTER_XT_MATCH_ESP=m 127CONFIG_NETFILTER_XT_MATCH_ESP=m
123CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m 128CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
124CONFIG_NETFILTER_XT_MATCH_HELPER=m 129CONFIG_NETFILTER_XT_MATCH_HELPER=m
130CONFIG_NETFILTER_XT_MATCH_IPCOMP=m
125CONFIG_NETFILTER_XT_MATCH_IPRANGE=m 131CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
126CONFIG_NETFILTER_XT_MATCH_LENGTH=m 132CONFIG_NETFILTER_XT_MATCH_LENGTH=m
127CONFIG_NETFILTER_XT_MATCH_LIMIT=m 133CONFIG_NETFILTER_XT_MATCH_LIMIT=m
@@ -159,8 +165,6 @@ CONFIG_IP_SET_HASH_NETPORT=m
159CONFIG_IP_SET_HASH_NETIFACE=m 165CONFIG_IP_SET_HASH_NETIFACE=m
160CONFIG_IP_SET_LIST_SET=m 166CONFIG_IP_SET_LIST_SET=m
161CONFIG_NF_CONNTRACK_IPV4=m 167CONFIG_NF_CONNTRACK_IPV4=m
162CONFIG_NF_TABLES_IPV4=m
163CONFIG_NFT_REJECT_IPV4=m
164CONFIG_NFT_CHAIN_ROUTE_IPV4=m 168CONFIG_NFT_CHAIN_ROUTE_IPV4=m
165CONFIG_NFT_CHAIN_NAT_IPV4=m 169CONFIG_NFT_CHAIN_NAT_IPV4=m
166CONFIG_NF_TABLES_ARP=m 170CONFIG_NF_TABLES_ARP=m
@@ -186,7 +190,6 @@ CONFIG_IP_NF_ARPTABLES=m
186CONFIG_IP_NF_ARPFILTER=m 190CONFIG_IP_NF_ARPFILTER=m
187CONFIG_IP_NF_ARP_MANGLE=m 191CONFIG_IP_NF_ARP_MANGLE=m
188CONFIG_NF_CONNTRACK_IPV6=m 192CONFIG_NF_CONNTRACK_IPV6=m
189CONFIG_NF_TABLES_IPV6=m
190CONFIG_NFT_CHAIN_ROUTE_IPV6=m 193CONFIG_NFT_CHAIN_ROUTE_IPV6=m
191CONFIG_NFT_CHAIN_NAT_IPV6=m 194CONFIG_NFT_CHAIN_NAT_IPV6=m
192CONFIG_IP6_NF_IPTABLES=m 195CONFIG_IP6_NF_IPTABLES=m
@@ -464,7 +467,6 @@ CONFIG_CRYPTO_LZ4HC=m
464CONFIG_CRYPTO_USER_API_HASH=m 467CONFIG_CRYPTO_USER_API_HASH=m
465CONFIG_CRYPTO_USER_API_SKCIPHER=m 468CONFIG_CRYPTO_USER_API_SKCIPHER=m
466# CONFIG_CRYPTO_HW is not set 469# CONFIG_CRYPTO_HW is not set
467CONFIG_CRC_T10DIF=y
468CONFIG_XZ_DEC_X86=y 470CONFIG_XZ_DEC_X86=y
469CONFIG_XZ_DEC_POWERPC=y 471CONFIG_XZ_DEC_POWERPC=y
470CONFIG_XZ_DEC_IA64=y 472CONFIG_XZ_DEC_IA64=y
diff --git a/arch/m68k/configs/q40_defconfig b/arch/m68k/configs/q40_defconfig
index 568e2a98f976..f0c72ab037be 100644
--- a/arch/m68k/configs/q40_defconfig
+++ b/arch/m68k/configs/q40_defconfig
@@ -25,6 +25,8 @@ CONFIG_SUN_PARTITION=y
25# CONFIG_EFI_PARTITION is not set 25# CONFIG_EFI_PARTITION is not set
26CONFIG_SYSV68_PARTITION=y 26CONFIG_SYSV68_PARTITION=y
27CONFIG_IOSCHED_DEADLINE=m 27CONFIG_IOSCHED_DEADLINE=m
28CONFIG_KEXEC=y
29CONFIG_BOOTINFO_PROC=y
28CONFIG_M68040=y 30CONFIG_M68040=y
29CONFIG_M68060=y 31CONFIG_M68060=y
30CONFIG_Q40=y 32CONFIG_Q40=y
@@ -81,6 +83,7 @@ CONFIG_NF_CONNTRACK_SANE=m
81CONFIG_NF_CONNTRACK_SIP=m 83CONFIG_NF_CONNTRACK_SIP=m
82CONFIG_NF_CONNTRACK_TFTP=m 84CONFIG_NF_CONNTRACK_TFTP=m
83CONFIG_NF_TABLES=m 85CONFIG_NF_TABLES=m
86CONFIG_NF_TABLES_INET=m
84CONFIG_NFT_EXTHDR=m 87CONFIG_NFT_EXTHDR=m
85CONFIG_NFT_META=m 88CONFIG_NFT_META=m
86CONFIG_NFT_CT=m 89CONFIG_NFT_CT=m
@@ -90,6 +93,8 @@ CONFIG_NFT_COUNTER=m
90CONFIG_NFT_LOG=m 93CONFIG_NFT_LOG=m
91CONFIG_NFT_LIMIT=m 94CONFIG_NFT_LIMIT=m
92CONFIG_NFT_NAT=m 95CONFIG_NFT_NAT=m
96CONFIG_NFT_QUEUE=m
97CONFIG_NFT_REJECT=m
93CONFIG_NFT_COMPAT=m 98CONFIG_NFT_COMPAT=m
94CONFIG_NETFILTER_XT_SET=m 99CONFIG_NETFILTER_XT_SET=m
95CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m 100CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
@@ -122,6 +127,7 @@ CONFIG_NETFILTER_XT_MATCH_DSCP=m
122CONFIG_NETFILTER_XT_MATCH_ESP=m 127CONFIG_NETFILTER_XT_MATCH_ESP=m
123CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m 128CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
124CONFIG_NETFILTER_XT_MATCH_HELPER=m 129CONFIG_NETFILTER_XT_MATCH_HELPER=m
130CONFIG_NETFILTER_XT_MATCH_IPCOMP=m
125CONFIG_NETFILTER_XT_MATCH_IPRANGE=m 131CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
126CONFIG_NETFILTER_XT_MATCH_LENGTH=m 132CONFIG_NETFILTER_XT_MATCH_LENGTH=m
127CONFIG_NETFILTER_XT_MATCH_LIMIT=m 133CONFIG_NETFILTER_XT_MATCH_LIMIT=m
@@ -159,8 +165,6 @@ CONFIG_IP_SET_HASH_NETPORT=m
159CONFIG_IP_SET_HASH_NETIFACE=m 165CONFIG_IP_SET_HASH_NETIFACE=m
160CONFIG_IP_SET_LIST_SET=m 166CONFIG_IP_SET_LIST_SET=m
161CONFIG_NF_CONNTRACK_IPV4=m 167CONFIG_NF_CONNTRACK_IPV4=m
162CONFIG_NF_TABLES_IPV4=m
163CONFIG_NFT_REJECT_IPV4=m
164CONFIG_NFT_CHAIN_ROUTE_IPV4=m 168CONFIG_NFT_CHAIN_ROUTE_IPV4=m
165CONFIG_NFT_CHAIN_NAT_IPV4=m 169CONFIG_NFT_CHAIN_NAT_IPV4=m
166CONFIG_NF_TABLES_ARP=m 170CONFIG_NF_TABLES_ARP=m
@@ -186,7 +190,6 @@ CONFIG_IP_NF_ARPTABLES=m
186CONFIG_IP_NF_ARPFILTER=m 190CONFIG_IP_NF_ARPFILTER=m
187CONFIG_IP_NF_ARP_MANGLE=m 191CONFIG_IP_NF_ARP_MANGLE=m
188CONFIG_NF_CONNTRACK_IPV6=m 192CONFIG_NF_CONNTRACK_IPV6=m
189CONFIG_NF_TABLES_IPV6=m
190CONFIG_NFT_CHAIN_ROUTE_IPV6=m 193CONFIG_NFT_CHAIN_ROUTE_IPV6=m
191CONFIG_NFT_CHAIN_NAT_IPV6=m 194CONFIG_NFT_CHAIN_NAT_IPV6=m
192CONFIG_IP6_NF_IPTABLES=m 195CONFIG_IP6_NF_IPTABLES=m
@@ -485,7 +488,6 @@ CONFIG_CRYPTO_LZ4HC=m
485CONFIG_CRYPTO_USER_API_HASH=m 488CONFIG_CRYPTO_USER_API_HASH=m
486CONFIG_CRYPTO_USER_API_SKCIPHER=m 489CONFIG_CRYPTO_USER_API_SKCIPHER=m
487# CONFIG_CRYPTO_HW is not set 490# CONFIG_CRYPTO_HW is not set
488CONFIG_CRC_T10DIF=y
489CONFIG_XZ_DEC_X86=y 491CONFIG_XZ_DEC_X86=y
490CONFIG_XZ_DEC_POWERPC=y 492CONFIG_XZ_DEC_POWERPC=y
491CONFIG_XZ_DEC_IA64=y 493CONFIG_XZ_DEC_IA64=y
diff --git a/arch/m68k/configs/sun3_defconfig b/arch/m68k/configs/sun3_defconfig
index 60b0aeac5742..7bca0f464521 100644
--- a/arch/m68k/configs/sun3_defconfig
+++ b/arch/m68k/configs/sun3_defconfig
@@ -24,6 +24,8 @@ CONFIG_UNIXWARE_DISKLABEL=y
24# CONFIG_EFI_PARTITION is not set 24# CONFIG_EFI_PARTITION is not set
25CONFIG_SYSV68_PARTITION=y 25CONFIG_SYSV68_PARTITION=y
26CONFIG_IOSCHED_DEADLINE=m 26CONFIG_IOSCHED_DEADLINE=m
27CONFIG_KEXEC=y
28CONFIG_BOOTINFO_PROC=y
27CONFIG_SUN3=y 29CONFIG_SUN3=y
28# CONFIG_COMPACTION is not set 30# CONFIG_COMPACTION is not set
29CONFIG_CLEANCACHE=y 31CONFIG_CLEANCACHE=y
@@ -78,6 +80,7 @@ CONFIG_NF_CONNTRACK_SANE=m
78CONFIG_NF_CONNTRACK_SIP=m 80CONFIG_NF_CONNTRACK_SIP=m
79CONFIG_NF_CONNTRACK_TFTP=m 81CONFIG_NF_CONNTRACK_TFTP=m
80CONFIG_NF_TABLES=m 82CONFIG_NF_TABLES=m
83CONFIG_NF_TABLES_INET=m
81CONFIG_NFT_EXTHDR=m 84CONFIG_NFT_EXTHDR=m
82CONFIG_NFT_META=m 85CONFIG_NFT_META=m
83CONFIG_NFT_CT=m 86CONFIG_NFT_CT=m
@@ -87,6 +90,8 @@ CONFIG_NFT_COUNTER=m
87CONFIG_NFT_LOG=m 90CONFIG_NFT_LOG=m
88CONFIG_NFT_LIMIT=m 91CONFIG_NFT_LIMIT=m
89CONFIG_NFT_NAT=m 92CONFIG_NFT_NAT=m
93CONFIG_NFT_QUEUE=m
94CONFIG_NFT_REJECT=m
90CONFIG_NFT_COMPAT=m 95CONFIG_NFT_COMPAT=m
91CONFIG_NETFILTER_XT_SET=m 96CONFIG_NETFILTER_XT_SET=m
92CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m 97CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
@@ -119,6 +124,7 @@ CONFIG_NETFILTER_XT_MATCH_DSCP=m
119CONFIG_NETFILTER_XT_MATCH_ESP=m 124CONFIG_NETFILTER_XT_MATCH_ESP=m
120CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m 125CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
121CONFIG_NETFILTER_XT_MATCH_HELPER=m 126CONFIG_NETFILTER_XT_MATCH_HELPER=m
127CONFIG_NETFILTER_XT_MATCH_IPCOMP=m
122CONFIG_NETFILTER_XT_MATCH_IPRANGE=m 128CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
123CONFIG_NETFILTER_XT_MATCH_LENGTH=m 129CONFIG_NETFILTER_XT_MATCH_LENGTH=m
124CONFIG_NETFILTER_XT_MATCH_LIMIT=m 130CONFIG_NETFILTER_XT_MATCH_LIMIT=m
@@ -156,8 +162,6 @@ CONFIG_IP_SET_HASH_NETPORT=m
156CONFIG_IP_SET_HASH_NETIFACE=m 162CONFIG_IP_SET_HASH_NETIFACE=m
157CONFIG_IP_SET_LIST_SET=m 163CONFIG_IP_SET_LIST_SET=m
158CONFIG_NF_CONNTRACK_IPV4=m 164CONFIG_NF_CONNTRACK_IPV4=m
159CONFIG_NF_TABLES_IPV4=m
160CONFIG_NFT_REJECT_IPV4=m
161CONFIG_NFT_CHAIN_ROUTE_IPV4=m 165CONFIG_NFT_CHAIN_ROUTE_IPV4=m
162CONFIG_NFT_CHAIN_NAT_IPV4=m 166CONFIG_NFT_CHAIN_NAT_IPV4=m
163CONFIG_NF_TABLES_ARP=m 167CONFIG_NF_TABLES_ARP=m
@@ -183,7 +187,6 @@ CONFIG_IP_NF_ARPTABLES=m
183CONFIG_IP_NF_ARPFILTER=m 187CONFIG_IP_NF_ARPFILTER=m
184CONFIG_IP_NF_ARP_MANGLE=m 188CONFIG_IP_NF_ARP_MANGLE=m
185CONFIG_NF_CONNTRACK_IPV6=m 189CONFIG_NF_CONNTRACK_IPV6=m
186CONFIG_NF_TABLES_IPV6=m
187CONFIG_NFT_CHAIN_ROUTE_IPV6=m 190CONFIG_NFT_CHAIN_ROUTE_IPV6=m
188CONFIG_NFT_CHAIN_NAT_IPV6=m 191CONFIG_NFT_CHAIN_NAT_IPV6=m
189CONFIG_IP6_NF_IPTABLES=m 192CONFIG_IP6_NF_IPTABLES=m
@@ -464,7 +467,6 @@ CONFIG_CRYPTO_LZ4HC=m
464CONFIG_CRYPTO_USER_API_HASH=m 467CONFIG_CRYPTO_USER_API_HASH=m
465CONFIG_CRYPTO_USER_API_SKCIPHER=m 468CONFIG_CRYPTO_USER_API_SKCIPHER=m
466# CONFIG_CRYPTO_HW is not set 469# CONFIG_CRYPTO_HW is not set
467CONFIG_CRC_T10DIF=y
468CONFIG_XZ_DEC_X86=y 470CONFIG_XZ_DEC_X86=y
469CONFIG_XZ_DEC_POWERPC=y 471CONFIG_XZ_DEC_POWERPC=y
470CONFIG_XZ_DEC_IA64=y 472CONFIG_XZ_DEC_IA64=y
diff --git a/arch/m68k/configs/sun3x_defconfig b/arch/m68k/configs/sun3x_defconfig
index 21bda331eebb..317f3e1fec95 100644
--- a/arch/m68k/configs/sun3x_defconfig
+++ b/arch/m68k/configs/sun3x_defconfig
@@ -24,6 +24,8 @@ CONFIG_UNIXWARE_DISKLABEL=y
24# CONFIG_EFI_PARTITION is not set 24# CONFIG_EFI_PARTITION is not set
25CONFIG_SYSV68_PARTITION=y 25CONFIG_SYSV68_PARTITION=y
26CONFIG_IOSCHED_DEADLINE=m 26CONFIG_IOSCHED_DEADLINE=m
27CONFIG_KEXEC=y
28CONFIG_BOOTINFO_PROC=y
27CONFIG_SUN3X=y 29CONFIG_SUN3X=y
28# CONFIG_COMPACTION is not set 30# CONFIG_COMPACTION is not set
29CONFIG_CLEANCACHE=y 31CONFIG_CLEANCACHE=y
@@ -78,6 +80,7 @@ CONFIG_NF_CONNTRACK_SANE=m
78CONFIG_NF_CONNTRACK_SIP=m 80CONFIG_NF_CONNTRACK_SIP=m
79CONFIG_NF_CONNTRACK_TFTP=m 81CONFIG_NF_CONNTRACK_TFTP=m
80CONFIG_NF_TABLES=m 82CONFIG_NF_TABLES=m
83CONFIG_NF_TABLES_INET=m
81CONFIG_NFT_EXTHDR=m 84CONFIG_NFT_EXTHDR=m
82CONFIG_NFT_META=m 85CONFIG_NFT_META=m
83CONFIG_NFT_CT=m 86CONFIG_NFT_CT=m
@@ -87,6 +90,8 @@ CONFIG_NFT_COUNTER=m
87CONFIG_NFT_LOG=m 90CONFIG_NFT_LOG=m
88CONFIG_NFT_LIMIT=m 91CONFIG_NFT_LIMIT=m
89CONFIG_NFT_NAT=m 92CONFIG_NFT_NAT=m
93CONFIG_NFT_QUEUE=m
94CONFIG_NFT_REJECT=m
90CONFIG_NFT_COMPAT=m 95CONFIG_NFT_COMPAT=m
91CONFIG_NETFILTER_XT_SET=m 96CONFIG_NETFILTER_XT_SET=m
92CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m 97CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
@@ -119,6 +124,7 @@ CONFIG_NETFILTER_XT_MATCH_DSCP=m
119CONFIG_NETFILTER_XT_MATCH_ESP=m 124CONFIG_NETFILTER_XT_MATCH_ESP=m
120CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m 125CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
121CONFIG_NETFILTER_XT_MATCH_HELPER=m 126CONFIG_NETFILTER_XT_MATCH_HELPER=m
127CONFIG_NETFILTER_XT_MATCH_IPCOMP=m
122CONFIG_NETFILTER_XT_MATCH_IPRANGE=m 128CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
123CONFIG_NETFILTER_XT_MATCH_LENGTH=m 129CONFIG_NETFILTER_XT_MATCH_LENGTH=m
124CONFIG_NETFILTER_XT_MATCH_LIMIT=m 130CONFIG_NETFILTER_XT_MATCH_LIMIT=m
@@ -156,8 +162,6 @@ CONFIG_IP_SET_HASH_NETPORT=m
156CONFIG_IP_SET_HASH_NETIFACE=m 162CONFIG_IP_SET_HASH_NETIFACE=m
157CONFIG_IP_SET_LIST_SET=m 163CONFIG_IP_SET_LIST_SET=m
158CONFIG_NF_CONNTRACK_IPV4=m 164CONFIG_NF_CONNTRACK_IPV4=m
159CONFIG_NF_TABLES_IPV4=m
160CONFIG_NFT_REJECT_IPV4=m
161CONFIG_NFT_CHAIN_ROUTE_IPV4=m 165CONFIG_NFT_CHAIN_ROUTE_IPV4=m
162CONFIG_NFT_CHAIN_NAT_IPV4=m 166CONFIG_NFT_CHAIN_NAT_IPV4=m
163CONFIG_NF_TABLES_ARP=m 167CONFIG_NF_TABLES_ARP=m
@@ -183,7 +187,6 @@ CONFIG_IP_NF_ARPTABLES=m
183CONFIG_IP_NF_ARPFILTER=m 187CONFIG_IP_NF_ARPFILTER=m
184CONFIG_IP_NF_ARP_MANGLE=m 188CONFIG_IP_NF_ARP_MANGLE=m
185CONFIG_NF_CONNTRACK_IPV6=m 189CONFIG_NF_CONNTRACK_IPV6=m
186CONFIG_NF_TABLES_IPV6=m
187CONFIG_NFT_CHAIN_ROUTE_IPV6=m 190CONFIG_NFT_CHAIN_ROUTE_IPV6=m
188CONFIG_NFT_CHAIN_NAT_IPV6=m 191CONFIG_NFT_CHAIN_NAT_IPV6=m
189CONFIG_IP6_NF_IPTABLES=m 192CONFIG_IP6_NF_IPTABLES=m
@@ -464,7 +467,6 @@ CONFIG_CRYPTO_LZ4HC=m
464CONFIG_CRYPTO_USER_API_HASH=m 467CONFIG_CRYPTO_USER_API_HASH=m
465CONFIG_CRYPTO_USER_API_SKCIPHER=m 468CONFIG_CRYPTO_USER_API_SKCIPHER=m
466# CONFIG_CRYPTO_HW is not set 469# CONFIG_CRYPTO_HW is not set
467CONFIG_CRC_T10DIF=y
468CONFIG_XZ_DEC_X86=y 470CONFIG_XZ_DEC_X86=y
469CONFIG_XZ_DEC_POWERPC=y 471CONFIG_XZ_DEC_POWERPC=y
470CONFIG_XZ_DEC_IA64=y 472CONFIG_XZ_DEC_IA64=y
diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
index 4c99bab7e664..3ab329b88521 100644
--- a/arch/m68k/kernel/head.S
+++ b/arch/m68k/kernel/head.S
@@ -275,7 +275,6 @@
275 275
276#ifdef CONFIG_FRAMEBUFFER_CONSOLE 276#ifdef CONFIG_FRAMEBUFFER_CONSOLE
277#define CONSOLE 277#define CONSOLE
278#define CONSOLE_PENGUIN
279#endif 278#endif
280 279
281#ifdef CONFIG_EARLY_PRINTK 280#ifdef CONFIG_EARLY_PRINTK
@@ -658,27 +657,6 @@ ENTRY(__start)
658 movel %a0@,%a1@ 657 movel %a0@,%a1@
659#endif 658#endif
660 659
661#if 0
662 /*
663 * Clear the screen
664 */
665 lea %pc@(L(mac_videobase)),%a0
666 movel %a0@,%a1
667 lea %pc@(L(mac_dimensions)),%a0
668 movel %a0@,%d1
669 swap %d1 /* #rows is high bytes */
670 andl #0xFFFF,%d1 /* rows */
671 subl #10,%d1
672 lea %pc@(L(mac_rowbytes)),%a0
673loopy2:
674 movel %a0@,%d0
675 subql #1,%d0
676loopx2:
677 moveb #0x55, %a1@+
678 dbra %d0,loopx2
679 dbra %d1,loopy2
680#endif
681
682L(test_notmac): 660L(test_notmac):
683#endif /* CONFIG_MAC */ 661#endif /* CONFIG_MAC */
684 662
@@ -907,15 +885,15 @@ L(nothp):
907 */ 885 */
908#ifdef CONFIG_MAC 886#ifdef CONFIG_MAC
909 is_not_mac(L(nocon)) 887 is_not_mac(L(nocon))
910#ifdef CONSOLE 888# ifdef CONSOLE
911 console_init 889 console_init
912#ifdef CONSOLE_PENGUIN 890# ifdef CONFIG_LOGO
913 console_put_penguin 891 console_put_penguin
914#endif /* CONSOLE_PENGUIN */ 892# endif /* CONFIG_LOGO */
915 console_put_stats 893 console_put_stats
916#endif /* CONSOLE */ 894# endif /* CONSOLE */
917L(nocon): 895L(nocon):
918#endif /* CONFIG_MAC */ 896#endif /* CONFIG_MAC */
919 897
920 898
921 putc '\n' 899 putc '\n'
@@ -3324,14 +3302,13 @@ func_return set_leds
3324#define Lconsole_struct_num_columns 8 3302#define Lconsole_struct_num_columns 8
3325#define Lconsole_struct_num_rows 12 3303#define Lconsole_struct_num_rows 12
3326#define Lconsole_struct_left_edge 16 3304#define Lconsole_struct_left_edge 16
3327#define Lconsole_struct_penguin_putc 20
3328 3305
3329func_start console_init,%a0-%a4/%d0-%d7 3306func_start console_init,%a0-%a4/%d0-%d7
3330 /* 3307 /*
3331 * Some of the register usage that follows 3308 * Some of the register usage that follows
3332 * a0 = pointer to boot_info 3309 * a0 = pointer to boot_info
3333 * a1 = pointer to screen 3310 * a1 = pointer to screen
3334 * a2 = pointer to Lconsole_globals 3311 * a2 = pointer to console_globals
3335 * d3 = pixel width of screen 3312 * d3 = pixel width of screen
3336 * d4 = pixel height of screen 3313 * d4 = pixel height of screen
3337 * (d3,d4) ~= (x,y) of a point just below 3314 * (d3,d4) ~= (x,y) of a point just below
@@ -3456,7 +3433,7 @@ func_start console_put_stats,%a0/%d7
3456 3433
3457func_return console_put_stats 3434func_return console_put_stats
3458 3435
3459#ifdef CONSOLE_PENGUIN 3436#ifdef CONFIG_LOGO
3460func_start console_put_penguin,%a0-%a1/%d0-%d7 3437func_start console_put_penguin,%a0-%a1/%d0-%d7
3461 /* 3438 /*
3462 * Get 'that_penguin' onto the screen in the upper right corner 3439 * Get 'that_penguin' onto the screen in the upper right corner
@@ -3799,38 +3776,6 @@ L(console_plot_pixel_exit):
3799func_return console_plot_pixel 3776func_return console_plot_pixel
3800#endif /* CONSOLE */ 3777#endif /* CONSOLE */
3801 3778
3802#if 0
3803/*
3804 * This is some old code lying around. I don't believe
3805 * it's used or important anymore. My guess is it contributed
3806 * to getting to this point, but it's done for now.
3807 * It was still in the 2.1.77 head.S, so it's still here.
3808 * (And still not used!)
3809 */
3810L(showtest):
3811 moveml %a0/%d7,%sp@-
3812 puts "A="
3813 putn %a1
3814
3815 .long 0xf0119f15 | ptestr #5,%a1@,#7,%a0
3816
3817 puts "DA="
3818 putn %a0
3819
3820 puts "D="
3821 putn %a0@
3822
3823 puts "S="
3824 lea %pc@(L(mmu)),%a0
3825 .long 0xf0106200 | pmove %psr,%a0@
3826 clrl %d7
3827 movew %a0@,%d7
3828 putn %d7
3829
3830 putc '\n'
3831 moveml %sp@+,%a0/%d7
3832 rts
3833#endif /* 0 */
3834 3779
3835__INITDATA 3780__INITDATA
3836 .align 4 3781 .align 4
@@ -3849,7 +3794,6 @@ L(console_globals):
3849 .long 0 /* max num columns */ 3794 .long 0 /* max num columns */
3850 .long 0 /* max num rows */ 3795 .long 0 /* max num rows */
3851 .long 0 /* left edge */ 3796 .long 0 /* left edge */
3852 .long 0 /* mac putc */
3853L(console_font): 3797L(console_font):
3854 .long 0 /* pointer to console font (struct font_desc) */ 3798 .long 0 /* pointer to console font (struct font_desc) */
3855L(console_font_data): 3799L(console_font_data):
diff --git a/arch/m68k/kernel/ints.c b/arch/m68k/kernel/ints.c
index 077d3a70fed1..5b8d66fbf383 100644
--- a/arch/m68k/kernel/ints.c
+++ b/arch/m68k/kernel/ints.c
@@ -10,9 +10,9 @@
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/kernel_stat.h>
14#include <linux/errno.h> 13#include <linux/errno.h>
15#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/irq.h>
16 16
17#include <asm/setup.h> 17#include <asm/setup.h>
18#include <asm/irq.h> 18#include <asm/irq.h>
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index 1f590ab8f323..c98ed95c0541 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -1,6 +1,7 @@
1 1
2generic-y += barrier.h 2generic-y += barrier.h
3generic-y += clkdev.h 3generic-y += clkdev.h
4generic-y += cputime.h
4generic-y += exec.h 5generic-y += exec.h
5generic-y += hash.h 6generic-y += hash.h
6generic-y += mcs_spinlock.h 7generic-y += mcs_spinlock.h
diff --git a/arch/microblaze/include/asm/cputime.h b/arch/microblaze/include/asm/cputime.h
deleted file mode 100644
index 6d68ad7e0ea3..000000000000
--- a/arch/microblaze/include/asm/cputime.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/cputime.h>
diff --git a/arch/mips/include/asm/unistd.h b/arch/mips/include/asm/unistd.h
index 4d3b92886665..413d6c612bec 100644
--- a/arch/mips/include/asm/unistd.h
+++ b/arch/mips/include/asm/unistd.h
@@ -24,7 +24,6 @@
24 24
25#ifndef __ASSEMBLY__ 25#ifndef __ASSEMBLY__
26 26
27#define __ARCH_OMIT_COMPAT_SYS_GETDENTS64
28#define __ARCH_WANT_OLD_READDIR 27#define __ARCH_WANT_OLD_READDIR
29#define __ARCH_WANT_SYS_ALARM 28#define __ARCH_WANT_SYS_ALARM
30#define __ARCH_WANT_SYS_GETHOSTNAME 29#define __ARCH_WANT_SYS_GETHOSTNAME
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index dfc1b911be04..c1681d65dd5c 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -1007,7 +1007,7 @@ static void __irq_entry smtc_clock_tick_interrupt(void)
1007 int irq = MIPS_CPU_IRQ_BASE + 1; 1007 int irq = MIPS_CPU_IRQ_BASE + 1;
1008 1008
1009 irq_enter(); 1009 irq_enter();
1010 kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq)); 1010 kstat_incr_irq_this_cpu(irq);
1011 cd = &per_cpu(mips_clockevent_device, cpu); 1011 cd = &per_cpu(mips_clockevent_device, cpu);
1012 cd->event_handler(cd); 1012 cd->event_handler(cd);
1013 irq_exit(); 1013 irq_exit();
diff --git a/arch/mips/sgi-ip22/ip22-int.c b/arch/mips/sgi-ip22/ip22-int.c
index 3db64d51798d..58b40ae59335 100644
--- a/arch/mips/sgi-ip22/ip22-int.c
+++ b/arch/mips/sgi-ip22/ip22-int.c
@@ -148,7 +148,7 @@ static void __irq_entry indy_buserror_irq(void)
148 int irq = SGI_BUSERR_IRQ; 148 int irq = SGI_BUSERR_IRQ;
149 149
150 irq_enter(); 150 irq_enter();
151 kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq)); 151 kstat_incr_irq_this_cpu(irq);
152 ip22_be_interrupt(irq); 152 ip22_be_interrupt(irq);
153 irq_exit(); 153 irq_exit();
154} 154}
diff --git a/arch/mips/sgi-ip22/ip22-time.c b/arch/mips/sgi-ip22/ip22-time.c
index 607192449335..045aa89f28d8 100644
--- a/arch/mips/sgi-ip22/ip22-time.c
+++ b/arch/mips/sgi-ip22/ip22-time.c
@@ -123,7 +123,7 @@ void __irq_entry indy_8254timer_irq(void)
123 char c; 123 char c;
124 124
125 irq_enter(); 125 irq_enter();
126 kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq)); 126 kstat_incr_irq_this_cpu(irq);
127 printk(KERN_ALERT "Oops, got 8254 interrupt.\n"); 127 printk(KERN_ALERT "Oops, got 8254 interrupt.\n");
128 ArcRead(0, &c, 1, &cnt); 128 ArcRead(0, &c, 1, &cnt);
129 ArcEnterInteractiveMode(); 129 ArcEnterInteractiveMode();
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c
index 09d6e16a70f1..59cfe2659771 100644
--- a/arch/mips/sibyte/bcm1480/irq.c
+++ b/arch/mips/sibyte/bcm1480/irq.c
@@ -95,7 +95,7 @@ static int bcm1480_set_affinity(struct irq_data *d, const struct cpumask *mask,
95 u64 cur_ints; 95 u64 cur_ints;
96 unsigned long flags; 96 unsigned long flags;
97 97
98 i = cpumask_first(mask); 98 i = cpumask_first_and(mask, cpu_online_mask);
99 99
100 /* Convert logical CPU to physical CPU */ 100 /* Convert logical CPU to physical CPU */
101 cpu = cpu_logical_map(i); 101 cpu = cpu_logical_map(i);
diff --git a/arch/mips/sibyte/bcm1480/smp.c b/arch/mips/sibyte/bcm1480/smp.c
index 54e2c4de15c1..70d9182b26f1 100644
--- a/arch/mips/sibyte/bcm1480/smp.c
+++ b/arch/mips/sibyte/bcm1480/smp.c
@@ -182,7 +182,7 @@ void bcm1480_mailbox_interrupt(void)
182 int irq = K_BCM1480_INT_MBOX_0_0; 182 int irq = K_BCM1480_INT_MBOX_0_0;
183 unsigned int action; 183 unsigned int action;
184 184
185 kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq)); 185 kstat_incr_irq_this_cpu(irq);
186 /* Load the mailbox register to figure out what we're supposed to do */ 186 /* Load the mailbox register to figure out what we're supposed to do */
187 action = (__raw_readq(mailbox_0_regs[cpu]) >> 48) & 0xffff; 187 action = (__raw_readq(mailbox_0_regs[cpu]) >> 48) & 0xffff;
188 188
diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c
index fca0cdb99509..6d8dba5cf348 100644
--- a/arch/mips/sibyte/sb1250/irq.c
+++ b/arch/mips/sibyte/sb1250/irq.c
@@ -88,7 +88,7 @@ static int sb1250_set_affinity(struct irq_data *d, const struct cpumask *mask,
88 u64 cur_ints; 88 u64 cur_ints;
89 unsigned long flags; 89 unsigned long flags;
90 90
91 i = cpumask_first(mask); 91 i = cpumask_first_and(mask, cpu_online_mask);
92 92
93 /* Convert logical CPU to physical CPU */ 93 /* Convert logical CPU to physical CPU */
94 cpu = cpu_logical_map(i); 94 cpu = cpu_logical_map(i);
diff --git a/arch/mips/sibyte/sb1250/smp.c b/arch/mips/sibyte/sb1250/smp.c
index d7b942db0ea5..db976117dd4d 100644
--- a/arch/mips/sibyte/sb1250/smp.c
+++ b/arch/mips/sibyte/sb1250/smp.c
@@ -170,7 +170,7 @@ void sb1250_mailbox_interrupt(void)
170 int irq = K_INT_MBOX_0; 170 int irq = K_INT_MBOX_0;
171 unsigned int action; 171 unsigned int action;
172 172
173 kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq)); 173 kstat_incr_irq_this_cpu(irq);
174 /* Load the mailbox register to figure out what we're supposed to do */ 174 /* Load the mailbox register to figure out what we're supposed to do */
175 action = (____raw_readq(mailbox_regs[cpu]) >> 48) & 0xffff; 175 action = (____raw_readq(mailbox_regs[cpu]) >> 48) & 0xffff;
176 176
diff --git a/arch/mn10300/include/asm/Kbuild b/arch/mn10300/include/asm/Kbuild
index cbc6b9bf45da..654d5ba6e310 100644
--- a/arch/mn10300/include/asm/Kbuild
+++ b/arch/mn10300/include/asm/Kbuild
@@ -1,6 +1,7 @@
1 1
2generic-y += barrier.h 2generic-y += barrier.h
3generic-y += clkdev.h 3generic-y += clkdev.h
4generic-y += cputime.h
4generic-y += exec.h 5generic-y += exec.h
5generic-y += hash.h 6generic-y += hash.h
6generic-y += mcs_spinlock.h 7generic-y += mcs_spinlock.h
diff --git a/arch/mn10300/include/asm/cputime.h b/arch/mn10300/include/asm/cputime.h
deleted file mode 100644
index 6d68ad7e0ea3..000000000000
--- a/arch/mn10300/include/asm/cputime.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/cputime.h>
diff --git a/arch/mn10300/kernel/cevt-mn10300.c b/arch/mn10300/kernel/cevt-mn10300.c
index ccce35e3e179..60f64ca1752a 100644
--- a/arch/mn10300/kernel/cevt-mn10300.c
+++ b/arch/mn10300/kernel/cevt-mn10300.c
@@ -113,7 +113,7 @@ int __init init_clockevents(void)
113 cd->set_next_event = next_event; 113 cd->set_next_event = next_event;
114 114
115 iact = &per_cpu(timer_irq, cpu); 115 iact = &per_cpu(timer_irq, cpu);
116 iact->flags = IRQF_DISABLED | IRQF_SHARED | IRQF_TIMER; 116 iact->flags = IRQF_SHARED | IRQF_TIMER;
117 iact->handler = timer_interrupt; 117 iact->handler = timer_interrupt;
118 118
119 clockevents_register_device(cd); 119 clockevents_register_device(cd);
diff --git a/arch/mn10300/kernel/mn10300-serial.c b/arch/mn10300/kernel/mn10300-serial.c
index bf6e949a2f87..7ecf69879e2d 100644
--- a/arch/mn10300/kernel/mn10300-serial.c
+++ b/arch/mn10300/kernel/mn10300-serial.c
@@ -985,17 +985,17 @@ static int mn10300_serial_startup(struct uart_port *_port)
985 irq_set_chip(port->tm_irq, &mn10300_serial_pic); 985 irq_set_chip(port->tm_irq, &mn10300_serial_pic);
986 986
987 if (request_irq(port->rx_irq, mn10300_serial_interrupt, 987 if (request_irq(port->rx_irq, mn10300_serial_interrupt,
988 IRQF_DISABLED | IRQF_NOBALANCING, 988 IRQF_NOBALANCING,
989 port->rx_name, port) < 0) 989 port->rx_name, port) < 0)
990 goto error; 990 goto error;
991 991
992 if (request_irq(port->tx_irq, mn10300_serial_interrupt, 992 if (request_irq(port->tx_irq, mn10300_serial_interrupt,
993 IRQF_DISABLED | IRQF_NOBALANCING, 993 IRQF_NOBALANCING,
994 port->tx_name, port) < 0) 994 port->tx_name, port) < 0)
995 goto error2; 995 goto error2;
996 996
997 if (request_irq(port->tm_irq, mn10300_serial_interrupt, 997 if (request_irq(port->tm_irq, mn10300_serial_interrupt,
998 IRQF_DISABLED | IRQF_NOBALANCING, 998 IRQF_NOBALANCING,
999 port->tm_name, port) < 0) 999 port->tm_name, port) < 0)
1000 goto error3; 1000 goto error3;
1001 mn10300_serial_mask_ack(port->tm_irq); 1001 mn10300_serial_mask_ack(port->tm_irq);
diff --git a/arch/mn10300/kernel/mn10300-watchdog.c b/arch/mn10300/kernel/mn10300-watchdog.c
index db64a7166c09..a2d8e6938d67 100644
--- a/arch/mn10300/kernel/mn10300-watchdog.c
+++ b/arch/mn10300/kernel/mn10300-watchdog.c
@@ -142,7 +142,7 @@ void watchdog_interrupt(struct pt_regs *regs, enum exception_code excep)
142 NMICR = NMICR_WDIF; 142 NMICR = NMICR_WDIF;
143 143
144 nmi_count(smp_processor_id())++; 144 nmi_count(smp_processor_id())++;
145 kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq)); 145 kstat_incr_irq_this_cpu(irq);
146 146
147 for_each_online_cpu(cpu) { 147 for_each_online_cpu(cpu) {
148 148
diff --git a/arch/mn10300/kernel/smp.c b/arch/mn10300/kernel/smp.c
index a17f9c9c14c9..f984193718b1 100644
--- a/arch/mn10300/kernel/smp.c
+++ b/arch/mn10300/kernel/smp.c
@@ -143,7 +143,7 @@ static struct irqaction call_function_ipi = {
143static irqreturn_t smp_ipi_timer_interrupt(int irq, void *dev_id); 143static irqreturn_t smp_ipi_timer_interrupt(int irq, void *dev_id);
144static struct irqaction local_timer_ipi = { 144static struct irqaction local_timer_ipi = {
145 .handler = smp_ipi_timer_interrupt, 145 .handler = smp_ipi_timer_interrupt,
146 .flags = IRQF_DISABLED | IRQF_NOBALANCING, 146 .flags = IRQF_NOBALANCING,
147 .name = "smp local timer IPI" 147 .name = "smp local timer IPI"
148}; 148};
149#endif 149#endif
diff --git a/arch/mn10300/unit-asb2364/irq-fpga.c b/arch/mn10300/unit-asb2364/irq-fpga.c
index e16c216f31dc..073e2ccc4a44 100644
--- a/arch/mn10300/unit-asb2364/irq-fpga.c
+++ b/arch/mn10300/unit-asb2364/irq-fpga.c
@@ -76,7 +76,7 @@ static irqreturn_t fpga_interrupt(int irq, void *_mask)
76static struct irqaction fpga_irq[] = { 76static struct irqaction fpga_irq[] = {
77 [0] = { 77 [0] = {
78 .handler = fpga_interrupt, 78 .handler = fpga_interrupt,
79 .flags = IRQF_DISABLED | IRQF_SHARED, 79 .flags = IRQF_SHARED,
80 .name = "fpga", 80 .name = "fpga",
81 }, 81 },
82}; 82};
diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
index 8ceac4785609..cfe056fe7f5c 100644
--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -117,7 +117,7 @@ int cpu_check_affinity(struct irq_data *d, const struct cpumask *dest)
117 return -EINVAL; 117 return -EINVAL;
118 118
119 /* whatever mask they set, we just allow one CPU */ 119 /* whatever mask they set, we just allow one CPU */
120 cpu_dest = first_cpu(*dest); 120 cpu_dest = cpumask_first_and(dest, cpu_online_mask);
121 121
122 return cpu_dest; 122 return cpu_dest;
123} 123}
diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c
index fdc679d309ec..bb61ca58ca6d 100644
--- a/arch/powerpc/kernel/eeh_driver.c
+++ b/arch/powerpc/kernel/eeh_driver.c
@@ -143,13 +143,30 @@ static void eeh_disable_irq(struct pci_dev *dev)
143static void eeh_enable_irq(struct pci_dev *dev) 143static void eeh_enable_irq(struct pci_dev *dev)
144{ 144{
145 struct eeh_dev *edev = pci_dev_to_eeh_dev(dev); 145 struct eeh_dev *edev = pci_dev_to_eeh_dev(dev);
146 struct irq_desc *desc;
147 146
148 if ((edev->mode) & EEH_DEV_IRQ_DISABLED) { 147 if ((edev->mode) & EEH_DEV_IRQ_DISABLED) {
149 edev->mode &= ~EEH_DEV_IRQ_DISABLED; 148 edev->mode &= ~EEH_DEV_IRQ_DISABLED;
150 149 /*
151 desc = irq_to_desc(dev->irq); 150 * FIXME !!!!!
152 if (desc && desc->depth > 0) 151 *
152 * This is just ass backwards. This maze has
153 * unbalanced irq_enable/disable calls. So instead of
154 * finding the root cause it works around the warning
155 * in the irq_enable code by conditionally calling
156 * into it.
157 *
158 * That's just wrong.The warning in the core code is
159 * there to tell people to fix their assymetries in
160 * their own code, not by abusing the core information
161 * to avoid it.
162 *
163 * I so wish that the assymetry would be the other way
164 * round and a few more irq_disable calls render that
165 * shit unusable forever.
166 *
167 * tglx
168 */
169 if (irqd_irq_disabled(irq_get_irq_data(dev->irq)))
153 enable_irq(dev->irq); 170 enable_irq(dev->irq);
154 } 171 }
155} 172}
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 1d0848bba049..ca1cd7459c4a 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -465,7 +465,6 @@ static inline void check_stack_overflow(void)
465 465
466void __do_irq(struct pt_regs *regs) 466void __do_irq(struct pt_regs *regs)
467{ 467{
468 struct irq_desc *desc;
469 unsigned int irq; 468 unsigned int irq;
470 469
471 irq_enter(); 470 irq_enter();
@@ -487,11 +486,8 @@ void __do_irq(struct pt_regs *regs)
487 /* And finally process it */ 486 /* And finally process it */
488 if (unlikely(irq == NO_IRQ)) 487 if (unlikely(irq == NO_IRQ))
489 __get_cpu_var(irq_stat).spurious_irqs++; 488 __get_cpu_var(irq_stat).spurious_irqs++;
490 else { 489 else
491 desc = irq_to_desc(irq); 490 generic_handle_irq(irq);
492 if (likely(desc))
493 desc->handle_irq(irq, desc);
494 }
495 491
496 trace_irq_exit(regs); 492 trace_irq_exit(regs);
497 493
diff --git a/arch/powerpc/sysdev/ehv_pic.c b/arch/powerpc/sysdev/ehv_pic.c
index b74085cea1af..2d20f10a4203 100644
--- a/arch/powerpc/sysdev/ehv_pic.c
+++ b/arch/powerpc/sysdev/ehv_pic.c
@@ -28,8 +28,6 @@
28#include <asm/ehv_pic.h> 28#include <asm/ehv_pic.h>
29#include <asm/fsl_hcalls.h> 29#include <asm/fsl_hcalls.h>
30 30
31#include "../../../kernel/irq/settings.h"
32
33static struct ehv_pic *global_ehv_pic; 31static struct ehv_pic *global_ehv_pic;
34static DEFINE_SPINLOCK(ehv_pic_lock); 32static DEFINE_SPINLOCK(ehv_pic_lock);
35 33
@@ -113,17 +111,13 @@ static unsigned int ehv_pic_type_to_vecpri(unsigned int type)
113int ehv_pic_set_irq_type(struct irq_data *d, unsigned int flow_type) 111int ehv_pic_set_irq_type(struct irq_data *d, unsigned int flow_type)
114{ 112{
115 unsigned int src = virq_to_hw(d->irq); 113 unsigned int src = virq_to_hw(d->irq);
116 struct irq_desc *desc = irq_to_desc(d->irq);
117 unsigned int vecpri, vold, vnew, prio, cpu_dest; 114 unsigned int vecpri, vold, vnew, prio, cpu_dest;
118 unsigned long flags; 115 unsigned long flags;
119 116
120 if (flow_type == IRQ_TYPE_NONE) 117 if (flow_type == IRQ_TYPE_NONE)
121 flow_type = IRQ_TYPE_LEVEL_LOW; 118 flow_type = IRQ_TYPE_LEVEL_LOW;
122 119
123 irq_settings_clr_level(desc); 120 irqd_set_trigger_type(d, flow_type);
124 irq_settings_set_trigger_mask(desc, flow_type);
125 if (flow_type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW))
126 irq_settings_set_level(desc);
127 121
128 vecpri = ehv_pic_type_to_vecpri(flow_type); 122 vecpri = ehv_pic_type_to_vecpri(flow_type);
129 123
@@ -144,7 +138,7 @@ int ehv_pic_set_irq_type(struct irq_data *d, unsigned int flow_type)
144 ev_int_set_config(src, vecpri, prio, cpu_dest); 138 ev_int_set_config(src, vecpri, prio, cpu_dest);
145 139
146 spin_unlock_irqrestore(&ehv_pic_lock, flags); 140 spin_unlock_irqrestore(&ehv_pic_lock, flags);
147 return 0; 141 return IRQ_SET_MASK_OK_NOCOPY;
148} 142}
149 143
150static struct irq_chip ehv_pic_irq_chip = { 144static struct irq_chip ehv_pic_irq_chip = {
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index bb74b21f007a..953f17c8d17c 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -141,6 +141,7 @@ config S390
141 select OLD_SIGACTION 141 select OLD_SIGACTION
142 select OLD_SIGSUSPEND3 142 select OLD_SIGSUSPEND3
143 select SYSCTL_EXCEPTION_TRACE 143 select SYSCTL_EXCEPTION_TRACE
144 select TTY
144 select VIRT_CPU_ACCOUNTING 145 select VIRT_CPU_ACCOUNTING
145 select VIRT_TO_BUS 146 select VIRT_TO_BUS
146 147
@@ -416,6 +417,10 @@ config ARCH_ENABLE_MEMORY_HOTPLUG
416config ARCH_ENABLE_MEMORY_HOTREMOVE 417config ARCH_ENABLE_MEMORY_HOTREMOVE
417 def_bool y 418 def_bool y
418 419
420config ARCH_ENABLE_SPLIT_PMD_PTLOCK
421 def_bool y
422 depends on 64BIT
423
419config FORCE_MAX_ZONEORDER 424config FORCE_MAX_ZONEORDER
420 int 425 int
421 default "9" 426 default "9"
diff --git a/arch/s390/appldata/appldata_os.c b/arch/s390/appldata/appldata_os.c
index de8e2b3b0180..69b23b25ac34 100644
--- a/arch/s390/appldata/appldata_os.c
+++ b/arch/s390/appldata/appldata_os.c
@@ -171,7 +171,7 @@ static int __init appldata_os_init(void)
171 int rc, max_size; 171 int rc, max_size;
172 172
173 max_size = sizeof(struct appldata_os_data) + 173 max_size = sizeof(struct appldata_os_data) +
174 (NR_CPUS * sizeof(struct appldata_os_per_cpu)); 174 (num_possible_cpus() * sizeof(struct appldata_os_per_cpu));
175 if (max_size > APPLDATA_MAX_REC_SIZE) { 175 if (max_size > APPLDATA_MAX_REC_SIZE) {
176 pr_err("Maximum OS record size %i exceeds the maximum " 176 pr_err("Maximum OS record size %i exceeds the maximum "
177 "record size %i\n", max_size, APPLDATA_MAX_REC_SIZE); 177 "record size %i\n", max_size, APPLDATA_MAX_REC_SIZE);
diff --git a/arch/s390/configs/default_defconfig b/arch/s390/configs/default_defconfig
index e0af2ee58751..ddaae2f5c913 100644
--- a/arch/s390/configs/default_defconfig
+++ b/arch/s390/configs/default_defconfig
@@ -46,6 +46,7 @@ CONFIG_UNIXWARE_DISKLABEL=y
46CONFIG_CFQ_GROUP_IOSCHED=y 46CONFIG_CFQ_GROUP_IOSCHED=y
47CONFIG_DEFAULT_DEADLINE=y 47CONFIG_DEFAULT_DEADLINE=y
48CONFIG_MARCH_Z9_109=y 48CONFIG_MARCH_Z9_109=y
49CONFIG_NR_CPUS=256
49CONFIG_PREEMPT=y 50CONFIG_PREEMPT=y
50CONFIG_HZ_100=y 51CONFIG_HZ_100=y
51CONFIG_MEMORY_HOTPLUG=y 52CONFIG_MEMORY_HOTPLUG=y
@@ -58,7 +59,6 @@ CONFIG_HOTPLUG_PCI=y
58CONFIG_HOTPLUG_PCI_S390=y 59CONFIG_HOTPLUG_PCI_S390=y
59CONFIG_CHSC_SCH=y 60CONFIG_CHSC_SCH=y
60CONFIG_CRASH_DUMP=y 61CONFIG_CRASH_DUMP=y
61CONFIG_ZFCPDUMP=y
62# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 62# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
63CONFIG_BINFMT_MISC=m 63CONFIG_BINFMT_MISC=m
64CONFIG_HIBERNATION=y 64CONFIG_HIBERNATION=y
@@ -101,7 +101,6 @@ CONFIG_TCP_CONG_VENO=m
101CONFIG_TCP_CONG_YEAH=m 101CONFIG_TCP_CONG_YEAH=m
102CONFIG_TCP_CONG_ILLINOIS=m 102CONFIG_TCP_CONG_ILLINOIS=m
103CONFIG_IPV6=y 103CONFIG_IPV6=y
104CONFIG_IPV6_PRIVACY=y
105CONFIG_IPV6_ROUTER_PREF=y 104CONFIG_IPV6_ROUTER_PREF=y
106CONFIG_INET6_AH=m 105CONFIG_INET6_AH=m
107CONFIG_INET6_ESP=m 106CONFIG_INET6_ESP=m
@@ -111,6 +110,7 @@ CONFIG_INET6_XFRM_MODE_TRANSPORT=m
111CONFIG_INET6_XFRM_MODE_TUNNEL=m 110CONFIG_INET6_XFRM_MODE_TUNNEL=m
112CONFIG_INET6_XFRM_MODE_BEET=m 111CONFIG_INET6_XFRM_MODE_BEET=m
113CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m 112CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
113CONFIG_IPV6_VTI=m
114CONFIG_IPV6_SIT=m 114CONFIG_IPV6_SIT=m
115CONFIG_IPV6_GRE=m 115CONFIG_IPV6_GRE=m
116CONFIG_IPV6_MULTIPLE_TABLES=y 116CONFIG_IPV6_MULTIPLE_TABLES=y
@@ -135,7 +135,17 @@ CONFIG_NF_CONNTRACK_SIP=m
135CONFIG_NF_CONNTRACK_TFTP=m 135CONFIG_NF_CONNTRACK_TFTP=m
136CONFIG_NF_CT_NETLINK=m 136CONFIG_NF_CT_NETLINK=m
137CONFIG_NF_CT_NETLINK_TIMEOUT=m 137CONFIG_NF_CT_NETLINK_TIMEOUT=m
138CONFIG_NETFILTER_TPROXY=m 138CONFIG_NF_TABLES=m
139CONFIG_NFT_EXTHDR=m
140CONFIG_NFT_META=m
141CONFIG_NFT_CT=m
142CONFIG_NFT_RBTREE=m
143CONFIG_NFT_HASH=m
144CONFIG_NFT_COUNTER=m
145CONFIG_NFT_LOG=m
146CONFIG_NFT_LIMIT=m
147CONFIG_NFT_NAT=m
148CONFIG_NFT_COMPAT=m
139CONFIG_NETFILTER_XT_SET=m 149CONFIG_NETFILTER_XT_SET=m
140CONFIG_NETFILTER_XT_TARGET_AUDIT=m 150CONFIG_NETFILTER_XT_TARGET_AUDIT=m
141CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m 151CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
@@ -204,7 +214,9 @@ CONFIG_IP_SET_HASH_IP=m
204CONFIG_IP_SET_HASH_IPPORT=m 214CONFIG_IP_SET_HASH_IPPORT=m
205CONFIG_IP_SET_HASH_IPPORTIP=m 215CONFIG_IP_SET_HASH_IPPORTIP=m
206CONFIG_IP_SET_HASH_IPPORTNET=m 216CONFIG_IP_SET_HASH_IPPORTNET=m
217CONFIG_IP_SET_HASH_NETPORTNET=m
207CONFIG_IP_SET_HASH_NET=m 218CONFIG_IP_SET_HASH_NET=m
219CONFIG_IP_SET_HASH_NETNET=m
208CONFIG_IP_SET_HASH_NETPORT=m 220CONFIG_IP_SET_HASH_NETPORT=m
209CONFIG_IP_SET_HASH_NETIFACE=m 221CONFIG_IP_SET_HASH_NETIFACE=m
210CONFIG_IP_SET_LIST_SET=m 222CONFIG_IP_SET_LIST_SET=m
@@ -227,6 +239,11 @@ CONFIG_IP_VS_FTP=m
227CONFIG_IP_VS_PE_SIP=m 239CONFIG_IP_VS_PE_SIP=m
228CONFIG_NF_CONNTRACK_IPV4=m 240CONFIG_NF_CONNTRACK_IPV4=m
229# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set 241# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set
242CONFIG_NF_TABLES_IPV4=m
243CONFIG_NFT_REJECT_IPV4=m
244CONFIG_NFT_CHAIN_ROUTE_IPV4=m
245CONFIG_NFT_CHAIN_NAT_IPV4=m
246CONFIG_NF_TABLES_ARP=m
230CONFIG_IP_NF_IPTABLES=m 247CONFIG_IP_NF_IPTABLES=m
231CONFIG_IP_NF_MATCH_AH=m 248CONFIG_IP_NF_MATCH_AH=m
232CONFIG_IP_NF_MATCH_ECN=m 249CONFIG_IP_NF_MATCH_ECN=m
@@ -249,6 +266,9 @@ CONFIG_IP_NF_ARPTABLES=m
249CONFIG_IP_NF_ARPFILTER=m 266CONFIG_IP_NF_ARPFILTER=m
250CONFIG_IP_NF_ARP_MANGLE=m 267CONFIG_IP_NF_ARP_MANGLE=m
251CONFIG_NF_CONNTRACK_IPV6=m 268CONFIG_NF_CONNTRACK_IPV6=m
269CONFIG_NF_TABLES_IPV6=m
270CONFIG_NFT_CHAIN_ROUTE_IPV6=m
271CONFIG_NFT_CHAIN_NAT_IPV6=m
252CONFIG_IP6_NF_IPTABLES=m 272CONFIG_IP6_NF_IPTABLES=m
253CONFIG_IP6_NF_MATCH_AH=m 273CONFIG_IP6_NF_MATCH_AH=m
254CONFIG_IP6_NF_MATCH_EUI64=m 274CONFIG_IP6_NF_MATCH_EUI64=m
@@ -268,6 +288,7 @@ CONFIG_IP6_NF_SECURITY=m
268CONFIG_NF_NAT_IPV6=m 288CONFIG_NF_NAT_IPV6=m
269CONFIG_IP6_NF_TARGET_MASQUERADE=m 289CONFIG_IP6_NF_TARGET_MASQUERADE=m
270CONFIG_IP6_NF_TARGET_NPT=m 290CONFIG_IP6_NF_TARGET_NPT=m
291CONFIG_NF_TABLES_BRIDGE=m
271CONFIG_NET_SCTPPROBE=m 292CONFIG_NET_SCTPPROBE=m
272CONFIG_RDS=m 293CONFIG_RDS=m
273CONFIG_RDS_RDMA=m 294CONFIG_RDS_RDMA=m
@@ -314,6 +335,7 @@ CONFIG_NET_CLS_RSVP=m
314CONFIG_NET_CLS_RSVP6=m 335CONFIG_NET_CLS_RSVP6=m
315CONFIG_NET_CLS_FLOW=m 336CONFIG_NET_CLS_FLOW=m
316CONFIG_NET_CLS_CGROUP=y 337CONFIG_NET_CLS_CGROUP=y
338CONFIG_NET_CLS_BPF=m
317CONFIG_NET_CLS_ACT=y 339CONFIG_NET_CLS_ACT=y
318CONFIG_NET_ACT_POLICE=m 340CONFIG_NET_ACT_POLICE=m
319CONFIG_NET_ACT_GACT=m 341CONFIG_NET_ACT_GACT=m
@@ -381,8 +403,8 @@ CONFIG_BLK_DEV_DM=m
381CONFIG_DM_CRYPT=m 403CONFIG_DM_CRYPT=m
382CONFIG_DM_SNAPSHOT=m 404CONFIG_DM_SNAPSHOT=m
383CONFIG_DM_MIRROR=m 405CONFIG_DM_MIRROR=m
384CONFIG_DM_RAID=m
385CONFIG_DM_LOG_USERSPACE=m 406CONFIG_DM_LOG_USERSPACE=m
407CONFIG_DM_RAID=m
386CONFIG_DM_ZERO=m 408CONFIG_DM_ZERO=m
387CONFIG_DM_MULTIPATH=m 409CONFIG_DM_MULTIPATH=m
388CONFIG_DM_MULTIPATH_QL=m 410CONFIG_DM_MULTIPATH_QL=m
@@ -434,7 +456,6 @@ CONFIG_TN3270_FS=y
434CONFIG_WATCHDOG=y 456CONFIG_WATCHDOG=y
435CONFIG_WATCHDOG_NOWAYOUT=y 457CONFIG_WATCHDOG_NOWAYOUT=y
436CONFIG_SOFT_WATCHDOG=m 458CONFIG_SOFT_WATCHDOG=m
437CONFIG_ZVM_WATCHDOG=m
438# CONFIG_HID is not set 459# CONFIG_HID is not set
439# CONFIG_USB_SUPPORT is not set 460# CONFIG_USB_SUPPORT is not set
440CONFIG_INFINIBAND=m 461CONFIG_INFINIBAND=m
@@ -534,13 +555,23 @@ CONFIG_UNUSED_SYMBOLS=y
534CONFIG_MAGIC_SYSRQ=y 555CONFIG_MAGIC_SYSRQ=y
535CONFIG_DEBUG_KERNEL=y 556CONFIG_DEBUG_KERNEL=y
536CONFIG_DEBUG_PAGEALLOC=y 557CONFIG_DEBUG_PAGEALLOC=y
558CONFIG_DEBUG_OBJECTS=y
559CONFIG_DEBUG_OBJECTS_SELFTEST=y
560CONFIG_DEBUG_OBJECTS_FREE=y
561CONFIG_DEBUG_OBJECTS_TIMERS=y
562CONFIG_DEBUG_OBJECTS_WORK=y
563CONFIG_DEBUG_OBJECTS_RCU_HEAD=y
564CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER=y
537CONFIG_SLUB_DEBUG_ON=y 565CONFIG_SLUB_DEBUG_ON=y
538CONFIG_SLUB_STATS=y 566CONFIG_SLUB_STATS=y
567CONFIG_DEBUG_KMEMLEAK=y
539CONFIG_DEBUG_STACK_USAGE=y 568CONFIG_DEBUG_STACK_USAGE=y
540CONFIG_DEBUG_VM=y 569CONFIG_DEBUG_VM=y
541CONFIG_DEBUG_VM_RB=y 570CONFIG_DEBUG_VM_RB=y
542CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m 571CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m
543CONFIG_DEBUG_PER_CPU_MAPS=y 572CONFIG_DEBUG_PER_CPU_MAPS=y
573CONFIG_DEBUG_SHIRQ=y
574CONFIG_DETECT_HUNG_TASK=y
544CONFIG_TIMER_STATS=y 575CONFIG_TIMER_STATS=y
545CONFIG_DEBUG_RT_MUTEXES=y 576CONFIG_DEBUG_RT_MUTEXES=y
546CONFIG_RT_MUTEX_TESTER=y 577CONFIG_RT_MUTEX_TESTER=y
@@ -573,9 +604,11 @@ CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y
573CONFIG_BLK_DEV_IO_TRACE=y 604CONFIG_BLK_DEV_IO_TRACE=y
574# CONFIG_KPROBE_EVENT is not set 605# CONFIG_KPROBE_EVENT is not set
575CONFIG_LKDTM=m 606CONFIG_LKDTM=m
607CONFIG_TEST_LIST_SORT=y
576CONFIG_KPROBES_SANITY_TEST=y 608CONFIG_KPROBES_SANITY_TEST=y
577CONFIG_RBTREE_TEST=m 609CONFIG_RBTREE_TEST=y
578CONFIG_INTERVAL_TREE_TEST=m 610CONFIG_INTERVAL_TREE_TEST=m
611CONFIG_PERCPU_TEST=m
579CONFIG_ATOMIC64_SELFTEST=y 612CONFIG_ATOMIC64_SELFTEST=y
580CONFIG_DMA_API_DEBUG=y 613CONFIG_DMA_API_DEBUG=y
581# CONFIG_STRICT_DEVMEM is not set 614# CONFIG_STRICT_DEVMEM is not set
@@ -638,7 +671,6 @@ CONFIG_CRYPTO_AES_S390=m
638CONFIG_CRYPTO_GHASH_S390=m 671CONFIG_CRYPTO_GHASH_S390=m
639CONFIG_ASYMMETRIC_KEY_TYPE=m 672CONFIG_ASYMMETRIC_KEY_TYPE=m
640CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m 673CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m
641CONFIG_PUBLIC_KEY_ALGO_RSA=m
642CONFIG_X509_CERTIFICATE_PARSER=m 674CONFIG_X509_CERTIFICATE_PARSER=m
643CONFIG_CRC7=m 675CONFIG_CRC7=m
644CONFIG_CRC8=m 676CONFIG_CRC8=m
diff --git a/arch/s390/configs/gcov_defconfig b/arch/s390/configs/gcov_defconfig
index b9f6b4cab927..c81a74e3e25a 100644
--- a/arch/s390/configs/gcov_defconfig
+++ b/arch/s390/configs/gcov_defconfig
@@ -46,6 +46,7 @@ CONFIG_UNIXWARE_DISKLABEL=y
46CONFIG_CFQ_GROUP_IOSCHED=y 46CONFIG_CFQ_GROUP_IOSCHED=y
47CONFIG_DEFAULT_DEADLINE=y 47CONFIG_DEFAULT_DEADLINE=y
48CONFIG_MARCH_Z9_109=y 48CONFIG_MARCH_Z9_109=y
49CONFIG_NR_CPUS=256
49CONFIG_HZ_100=y 50CONFIG_HZ_100=y
50CONFIG_MEMORY_HOTPLUG=y 51CONFIG_MEMORY_HOTPLUG=y
51CONFIG_MEMORY_HOTREMOVE=y 52CONFIG_MEMORY_HOTREMOVE=y
@@ -56,7 +57,6 @@ CONFIG_HOTPLUG_PCI=y
56CONFIG_HOTPLUG_PCI_S390=y 57CONFIG_HOTPLUG_PCI_S390=y
57CONFIG_CHSC_SCH=y 58CONFIG_CHSC_SCH=y
58CONFIG_CRASH_DUMP=y 59CONFIG_CRASH_DUMP=y
59CONFIG_ZFCPDUMP=y
60# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 60# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
61CONFIG_BINFMT_MISC=m 61CONFIG_BINFMT_MISC=m
62CONFIG_HIBERNATION=y 62CONFIG_HIBERNATION=y
@@ -99,7 +99,6 @@ CONFIG_TCP_CONG_VENO=m
99CONFIG_TCP_CONG_YEAH=m 99CONFIG_TCP_CONG_YEAH=m
100CONFIG_TCP_CONG_ILLINOIS=m 100CONFIG_TCP_CONG_ILLINOIS=m
101CONFIG_IPV6=y 101CONFIG_IPV6=y
102CONFIG_IPV6_PRIVACY=y
103CONFIG_IPV6_ROUTER_PREF=y 102CONFIG_IPV6_ROUTER_PREF=y
104CONFIG_INET6_AH=m 103CONFIG_INET6_AH=m
105CONFIG_INET6_ESP=m 104CONFIG_INET6_ESP=m
@@ -109,6 +108,7 @@ CONFIG_INET6_XFRM_MODE_TRANSPORT=m
109CONFIG_INET6_XFRM_MODE_TUNNEL=m 108CONFIG_INET6_XFRM_MODE_TUNNEL=m
110CONFIG_INET6_XFRM_MODE_BEET=m 109CONFIG_INET6_XFRM_MODE_BEET=m
111CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m 110CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
111CONFIG_IPV6_VTI=m
112CONFIG_IPV6_SIT=m 112CONFIG_IPV6_SIT=m
113CONFIG_IPV6_GRE=m 113CONFIG_IPV6_GRE=m
114CONFIG_IPV6_MULTIPLE_TABLES=y 114CONFIG_IPV6_MULTIPLE_TABLES=y
@@ -133,7 +133,17 @@ CONFIG_NF_CONNTRACK_SIP=m
133CONFIG_NF_CONNTRACK_TFTP=m 133CONFIG_NF_CONNTRACK_TFTP=m
134CONFIG_NF_CT_NETLINK=m 134CONFIG_NF_CT_NETLINK=m
135CONFIG_NF_CT_NETLINK_TIMEOUT=m 135CONFIG_NF_CT_NETLINK_TIMEOUT=m
136CONFIG_NETFILTER_TPROXY=m 136CONFIG_NF_TABLES=m
137CONFIG_NFT_EXTHDR=m
138CONFIG_NFT_META=m
139CONFIG_NFT_CT=m
140CONFIG_NFT_RBTREE=m
141CONFIG_NFT_HASH=m
142CONFIG_NFT_COUNTER=m
143CONFIG_NFT_LOG=m
144CONFIG_NFT_LIMIT=m
145CONFIG_NFT_NAT=m
146CONFIG_NFT_COMPAT=m
137CONFIG_NETFILTER_XT_SET=m 147CONFIG_NETFILTER_XT_SET=m
138CONFIG_NETFILTER_XT_TARGET_AUDIT=m 148CONFIG_NETFILTER_XT_TARGET_AUDIT=m
139CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m 149CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
@@ -202,7 +212,9 @@ CONFIG_IP_SET_HASH_IP=m
202CONFIG_IP_SET_HASH_IPPORT=m 212CONFIG_IP_SET_HASH_IPPORT=m
203CONFIG_IP_SET_HASH_IPPORTIP=m 213CONFIG_IP_SET_HASH_IPPORTIP=m
204CONFIG_IP_SET_HASH_IPPORTNET=m 214CONFIG_IP_SET_HASH_IPPORTNET=m
215CONFIG_IP_SET_HASH_NETPORTNET=m
205CONFIG_IP_SET_HASH_NET=m 216CONFIG_IP_SET_HASH_NET=m
217CONFIG_IP_SET_HASH_NETNET=m
206CONFIG_IP_SET_HASH_NETPORT=m 218CONFIG_IP_SET_HASH_NETPORT=m
207CONFIG_IP_SET_HASH_NETIFACE=m 219CONFIG_IP_SET_HASH_NETIFACE=m
208CONFIG_IP_SET_LIST_SET=m 220CONFIG_IP_SET_LIST_SET=m
@@ -225,6 +237,11 @@ CONFIG_IP_VS_FTP=m
225CONFIG_IP_VS_PE_SIP=m 237CONFIG_IP_VS_PE_SIP=m
226CONFIG_NF_CONNTRACK_IPV4=m 238CONFIG_NF_CONNTRACK_IPV4=m
227# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set 239# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set
240CONFIG_NF_TABLES_IPV4=m
241CONFIG_NFT_REJECT_IPV4=m
242CONFIG_NFT_CHAIN_ROUTE_IPV4=m
243CONFIG_NFT_CHAIN_NAT_IPV4=m
244CONFIG_NF_TABLES_ARP=m
228CONFIG_IP_NF_IPTABLES=m 245CONFIG_IP_NF_IPTABLES=m
229CONFIG_IP_NF_MATCH_AH=m 246CONFIG_IP_NF_MATCH_AH=m
230CONFIG_IP_NF_MATCH_ECN=m 247CONFIG_IP_NF_MATCH_ECN=m
@@ -247,6 +264,9 @@ CONFIG_IP_NF_ARPTABLES=m
247CONFIG_IP_NF_ARPFILTER=m 264CONFIG_IP_NF_ARPFILTER=m
248CONFIG_IP_NF_ARP_MANGLE=m 265CONFIG_IP_NF_ARP_MANGLE=m
249CONFIG_NF_CONNTRACK_IPV6=m 266CONFIG_NF_CONNTRACK_IPV6=m
267CONFIG_NF_TABLES_IPV6=m
268CONFIG_NFT_CHAIN_ROUTE_IPV6=m
269CONFIG_NFT_CHAIN_NAT_IPV6=m
250CONFIG_IP6_NF_IPTABLES=m 270CONFIG_IP6_NF_IPTABLES=m
251CONFIG_IP6_NF_MATCH_AH=m 271CONFIG_IP6_NF_MATCH_AH=m
252CONFIG_IP6_NF_MATCH_EUI64=m 272CONFIG_IP6_NF_MATCH_EUI64=m
@@ -266,6 +286,7 @@ CONFIG_IP6_NF_SECURITY=m
266CONFIG_NF_NAT_IPV6=m 286CONFIG_NF_NAT_IPV6=m
267CONFIG_IP6_NF_TARGET_MASQUERADE=m 287CONFIG_IP6_NF_TARGET_MASQUERADE=m
268CONFIG_IP6_NF_TARGET_NPT=m 288CONFIG_IP6_NF_TARGET_NPT=m
289CONFIG_NF_TABLES_BRIDGE=m
269CONFIG_NET_SCTPPROBE=m 290CONFIG_NET_SCTPPROBE=m
270CONFIG_RDS=m 291CONFIG_RDS=m
271CONFIG_RDS_RDMA=m 292CONFIG_RDS_RDMA=m
@@ -311,6 +332,7 @@ CONFIG_NET_CLS_RSVP=m
311CONFIG_NET_CLS_RSVP6=m 332CONFIG_NET_CLS_RSVP6=m
312CONFIG_NET_CLS_FLOW=m 333CONFIG_NET_CLS_FLOW=m
313CONFIG_NET_CLS_CGROUP=y 334CONFIG_NET_CLS_CGROUP=y
335CONFIG_NET_CLS_BPF=m
314CONFIG_NET_CLS_ACT=y 336CONFIG_NET_CLS_ACT=y
315CONFIG_NET_ACT_POLICE=m 337CONFIG_NET_ACT_POLICE=m
316CONFIG_NET_ACT_GACT=m 338CONFIG_NET_ACT_GACT=m
@@ -378,8 +400,8 @@ CONFIG_BLK_DEV_DM=m
378CONFIG_DM_CRYPT=m 400CONFIG_DM_CRYPT=m
379CONFIG_DM_SNAPSHOT=m 401CONFIG_DM_SNAPSHOT=m
380CONFIG_DM_MIRROR=m 402CONFIG_DM_MIRROR=m
381CONFIG_DM_RAID=m
382CONFIG_DM_LOG_USERSPACE=m 403CONFIG_DM_LOG_USERSPACE=m
404CONFIG_DM_RAID=m
383CONFIG_DM_ZERO=m 405CONFIG_DM_ZERO=m
384CONFIG_DM_MULTIPATH=m 406CONFIG_DM_MULTIPATH=m
385CONFIG_DM_MULTIPATH_QL=m 407CONFIG_DM_MULTIPATH_QL=m
@@ -431,7 +453,6 @@ CONFIG_TN3270_FS=y
431CONFIG_WATCHDOG=y 453CONFIG_WATCHDOG=y
432CONFIG_WATCHDOG_NOWAYOUT=y 454CONFIG_WATCHDOG_NOWAYOUT=y
433CONFIG_SOFT_WATCHDOG=m 455CONFIG_SOFT_WATCHDOG=m
434CONFIG_ZVM_WATCHDOG=m
435# CONFIG_HID is not set 456# CONFIG_HID is not set
436# CONFIG_USB_SUPPORT is not set 457# CONFIG_USB_SUPPORT is not set
437CONFIG_INFINIBAND=m 458CONFIG_INFINIBAND=m
@@ -540,6 +561,7 @@ CONFIG_BLK_DEV_IO_TRACE=y
540CONFIG_LKDTM=m 561CONFIG_LKDTM=m
541CONFIG_RBTREE_TEST=m 562CONFIG_RBTREE_TEST=m
542CONFIG_INTERVAL_TREE_TEST=m 563CONFIG_INTERVAL_TREE_TEST=m
564CONFIG_PERCPU_TEST=m
543CONFIG_ATOMIC64_SELFTEST=y 565CONFIG_ATOMIC64_SELFTEST=y
544# CONFIG_STRICT_DEVMEM is not set 566# CONFIG_STRICT_DEVMEM is not set
545CONFIG_S390_PTDUMP=y 567CONFIG_S390_PTDUMP=y
@@ -601,7 +623,6 @@ CONFIG_CRYPTO_AES_S390=m
601CONFIG_CRYPTO_GHASH_S390=m 623CONFIG_CRYPTO_GHASH_S390=m
602CONFIG_ASYMMETRIC_KEY_TYPE=m 624CONFIG_ASYMMETRIC_KEY_TYPE=m
603CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m 625CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m
604CONFIG_PUBLIC_KEY_ALGO_RSA=m
605CONFIG_X509_CERTIFICATE_PARSER=m 626CONFIG_X509_CERTIFICATE_PARSER=m
606CONFIG_CRC7=m 627CONFIG_CRC7=m
607CONFIG_CRC8=m 628CONFIG_CRC8=m
diff --git a/arch/s390/configs/performance_defconfig b/arch/s390/configs/performance_defconfig
index 91087b43e8fa..b5ba8fe1cc64 100644
--- a/arch/s390/configs/performance_defconfig
+++ b/arch/s390/configs/performance_defconfig
@@ -44,6 +44,7 @@ CONFIG_UNIXWARE_DISKLABEL=y
44CONFIG_CFQ_GROUP_IOSCHED=y 44CONFIG_CFQ_GROUP_IOSCHED=y
45CONFIG_DEFAULT_DEADLINE=y 45CONFIG_DEFAULT_DEADLINE=y
46CONFIG_MARCH_Z9_109=y 46CONFIG_MARCH_Z9_109=y
47CONFIG_NR_CPUS=256
47CONFIG_HZ_100=y 48CONFIG_HZ_100=y
48CONFIG_MEMORY_HOTPLUG=y 49CONFIG_MEMORY_HOTPLUG=y
49CONFIG_MEMORY_HOTREMOVE=y 50CONFIG_MEMORY_HOTREMOVE=y
@@ -54,7 +55,6 @@ CONFIG_HOTPLUG_PCI=y
54CONFIG_HOTPLUG_PCI_S390=y 55CONFIG_HOTPLUG_PCI_S390=y
55CONFIG_CHSC_SCH=y 56CONFIG_CHSC_SCH=y
56CONFIG_CRASH_DUMP=y 57CONFIG_CRASH_DUMP=y
57CONFIG_ZFCPDUMP=y
58# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 58# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
59CONFIG_BINFMT_MISC=m 59CONFIG_BINFMT_MISC=m
60CONFIG_HIBERNATION=y 60CONFIG_HIBERNATION=y
@@ -97,7 +97,6 @@ CONFIG_TCP_CONG_VENO=m
97CONFIG_TCP_CONG_YEAH=m 97CONFIG_TCP_CONG_YEAH=m
98CONFIG_TCP_CONG_ILLINOIS=m 98CONFIG_TCP_CONG_ILLINOIS=m
99CONFIG_IPV6=y 99CONFIG_IPV6=y
100CONFIG_IPV6_PRIVACY=y
101CONFIG_IPV6_ROUTER_PREF=y 100CONFIG_IPV6_ROUTER_PREF=y
102CONFIG_INET6_AH=m 101CONFIG_INET6_AH=m
103CONFIG_INET6_ESP=m 102CONFIG_INET6_ESP=m
@@ -107,6 +106,7 @@ CONFIG_INET6_XFRM_MODE_TRANSPORT=m
107CONFIG_INET6_XFRM_MODE_TUNNEL=m 106CONFIG_INET6_XFRM_MODE_TUNNEL=m
108CONFIG_INET6_XFRM_MODE_BEET=m 107CONFIG_INET6_XFRM_MODE_BEET=m
109CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m 108CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
109CONFIG_IPV6_VTI=m
110CONFIG_IPV6_SIT=m 110CONFIG_IPV6_SIT=m
111CONFIG_IPV6_GRE=m 111CONFIG_IPV6_GRE=m
112CONFIG_IPV6_MULTIPLE_TABLES=y 112CONFIG_IPV6_MULTIPLE_TABLES=y
@@ -131,7 +131,17 @@ CONFIG_NF_CONNTRACK_SIP=m
131CONFIG_NF_CONNTRACK_TFTP=m 131CONFIG_NF_CONNTRACK_TFTP=m
132CONFIG_NF_CT_NETLINK=m 132CONFIG_NF_CT_NETLINK=m
133CONFIG_NF_CT_NETLINK_TIMEOUT=m 133CONFIG_NF_CT_NETLINK_TIMEOUT=m
134CONFIG_NETFILTER_TPROXY=m 134CONFIG_NF_TABLES=m
135CONFIG_NFT_EXTHDR=m
136CONFIG_NFT_META=m
137CONFIG_NFT_CT=m
138CONFIG_NFT_RBTREE=m
139CONFIG_NFT_HASH=m
140CONFIG_NFT_COUNTER=m
141CONFIG_NFT_LOG=m
142CONFIG_NFT_LIMIT=m
143CONFIG_NFT_NAT=m
144CONFIG_NFT_COMPAT=m
135CONFIG_NETFILTER_XT_SET=m 145CONFIG_NETFILTER_XT_SET=m
136CONFIG_NETFILTER_XT_TARGET_AUDIT=m 146CONFIG_NETFILTER_XT_TARGET_AUDIT=m
137CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m 147CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m
@@ -200,7 +210,9 @@ CONFIG_IP_SET_HASH_IP=m
200CONFIG_IP_SET_HASH_IPPORT=m 210CONFIG_IP_SET_HASH_IPPORT=m
201CONFIG_IP_SET_HASH_IPPORTIP=m 211CONFIG_IP_SET_HASH_IPPORTIP=m
202CONFIG_IP_SET_HASH_IPPORTNET=m 212CONFIG_IP_SET_HASH_IPPORTNET=m
213CONFIG_IP_SET_HASH_NETPORTNET=m
203CONFIG_IP_SET_HASH_NET=m 214CONFIG_IP_SET_HASH_NET=m
215CONFIG_IP_SET_HASH_NETNET=m
204CONFIG_IP_SET_HASH_NETPORT=m 216CONFIG_IP_SET_HASH_NETPORT=m
205CONFIG_IP_SET_HASH_NETIFACE=m 217CONFIG_IP_SET_HASH_NETIFACE=m
206CONFIG_IP_SET_LIST_SET=m 218CONFIG_IP_SET_LIST_SET=m
@@ -223,6 +235,11 @@ CONFIG_IP_VS_FTP=m
223CONFIG_IP_VS_PE_SIP=m 235CONFIG_IP_VS_PE_SIP=m
224CONFIG_NF_CONNTRACK_IPV4=m 236CONFIG_NF_CONNTRACK_IPV4=m
225# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set 237# CONFIG_NF_CONNTRACK_PROC_COMPAT is not set
238CONFIG_NF_TABLES_IPV4=m
239CONFIG_NFT_REJECT_IPV4=m
240CONFIG_NFT_CHAIN_ROUTE_IPV4=m
241CONFIG_NFT_CHAIN_NAT_IPV4=m
242CONFIG_NF_TABLES_ARP=m
226CONFIG_IP_NF_IPTABLES=m 243CONFIG_IP_NF_IPTABLES=m
227CONFIG_IP_NF_MATCH_AH=m 244CONFIG_IP_NF_MATCH_AH=m
228CONFIG_IP_NF_MATCH_ECN=m 245CONFIG_IP_NF_MATCH_ECN=m
@@ -245,6 +262,9 @@ CONFIG_IP_NF_ARPTABLES=m
245CONFIG_IP_NF_ARPFILTER=m 262CONFIG_IP_NF_ARPFILTER=m
246CONFIG_IP_NF_ARP_MANGLE=m 263CONFIG_IP_NF_ARP_MANGLE=m
247CONFIG_NF_CONNTRACK_IPV6=m 264CONFIG_NF_CONNTRACK_IPV6=m
265CONFIG_NF_TABLES_IPV6=m
266CONFIG_NFT_CHAIN_ROUTE_IPV6=m
267CONFIG_NFT_CHAIN_NAT_IPV6=m
248CONFIG_IP6_NF_IPTABLES=m 268CONFIG_IP6_NF_IPTABLES=m
249CONFIG_IP6_NF_MATCH_AH=m 269CONFIG_IP6_NF_MATCH_AH=m
250CONFIG_IP6_NF_MATCH_EUI64=m 270CONFIG_IP6_NF_MATCH_EUI64=m
@@ -264,6 +284,7 @@ CONFIG_IP6_NF_SECURITY=m
264CONFIG_NF_NAT_IPV6=m 284CONFIG_NF_NAT_IPV6=m
265CONFIG_IP6_NF_TARGET_MASQUERADE=m 285CONFIG_IP6_NF_TARGET_MASQUERADE=m
266CONFIG_IP6_NF_TARGET_NPT=m 286CONFIG_IP6_NF_TARGET_NPT=m
287CONFIG_NF_TABLES_BRIDGE=m
267CONFIG_NET_SCTPPROBE=m 288CONFIG_NET_SCTPPROBE=m
268CONFIG_RDS=m 289CONFIG_RDS=m
269CONFIG_RDS_RDMA=m 290CONFIG_RDS_RDMA=m
@@ -309,6 +330,7 @@ CONFIG_NET_CLS_RSVP=m
309CONFIG_NET_CLS_RSVP6=m 330CONFIG_NET_CLS_RSVP6=m
310CONFIG_NET_CLS_FLOW=m 331CONFIG_NET_CLS_FLOW=m
311CONFIG_NET_CLS_CGROUP=y 332CONFIG_NET_CLS_CGROUP=y
333CONFIG_NET_CLS_BPF=m
312CONFIG_NET_CLS_ACT=y 334CONFIG_NET_CLS_ACT=y
313CONFIG_NET_ACT_POLICE=m 335CONFIG_NET_ACT_POLICE=m
314CONFIG_NET_ACT_GACT=m 336CONFIG_NET_ACT_GACT=m
@@ -376,8 +398,8 @@ CONFIG_BLK_DEV_DM=m
376CONFIG_DM_CRYPT=m 398CONFIG_DM_CRYPT=m
377CONFIG_DM_SNAPSHOT=m 399CONFIG_DM_SNAPSHOT=m
378CONFIG_DM_MIRROR=m 400CONFIG_DM_MIRROR=m
379CONFIG_DM_RAID=m
380CONFIG_DM_LOG_USERSPACE=m 401CONFIG_DM_LOG_USERSPACE=m
402CONFIG_DM_RAID=m
381CONFIG_DM_ZERO=m 403CONFIG_DM_ZERO=m
382CONFIG_DM_MULTIPATH=m 404CONFIG_DM_MULTIPATH=m
383CONFIG_DM_MULTIPATH_QL=m 405CONFIG_DM_MULTIPATH_QL=m
@@ -429,7 +451,6 @@ CONFIG_TN3270_FS=y
429CONFIG_WATCHDOG=y 451CONFIG_WATCHDOG=y
430CONFIG_WATCHDOG_NOWAYOUT=y 452CONFIG_WATCHDOG_NOWAYOUT=y
431CONFIG_SOFT_WATCHDOG=m 453CONFIG_SOFT_WATCHDOG=m
432CONFIG_ZVM_WATCHDOG=m
433# CONFIG_HID is not set 454# CONFIG_HID is not set
434# CONFIG_USB_SUPPORT is not set 455# CONFIG_USB_SUPPORT is not set
435CONFIG_INFINIBAND=m 456CONFIG_INFINIBAND=m
@@ -532,6 +553,7 @@ CONFIG_LATENCYTOP=y
532CONFIG_BLK_DEV_IO_TRACE=y 553CONFIG_BLK_DEV_IO_TRACE=y
533# CONFIG_KPROBE_EVENT is not set 554# CONFIG_KPROBE_EVENT is not set
534CONFIG_LKDTM=m 555CONFIG_LKDTM=m
556CONFIG_PERCPU_TEST=m
535CONFIG_ATOMIC64_SELFTEST=y 557CONFIG_ATOMIC64_SELFTEST=y
536# CONFIG_STRICT_DEVMEM is not set 558# CONFIG_STRICT_DEVMEM is not set
537CONFIG_S390_PTDUMP=y 559CONFIG_S390_PTDUMP=y
@@ -593,7 +615,6 @@ CONFIG_CRYPTO_AES_S390=m
593CONFIG_CRYPTO_GHASH_S390=m 615CONFIG_CRYPTO_GHASH_S390=m
594CONFIG_ASYMMETRIC_KEY_TYPE=m 616CONFIG_ASYMMETRIC_KEY_TYPE=m
595CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m 617CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m
596CONFIG_PUBLIC_KEY_ALGO_RSA=m
597CONFIG_X509_CERTIFICATE_PARSER=m 618CONFIG_X509_CERTIFICATE_PARSER=m
598CONFIG_CRC7=m 619CONFIG_CRC7=m
599CONFIG_CRC8=m 620CONFIG_CRC8=m
diff --git a/arch/s390/configs/zfcpdump_defconfig b/arch/s390/configs/zfcpdump_defconfig
index d725c4d956e4..cef073ca1f07 100644
--- a/arch/s390/configs/zfcpdump_defconfig
+++ b/arch/s390/configs/zfcpdump_defconfig
@@ -19,7 +19,6 @@ CONFIG_HZ_100=y
19# CONFIG_CHSC_SCH is not set 19# CONFIG_CHSC_SCH is not set
20# CONFIG_SCM_BUS is not set 20# CONFIG_SCM_BUS is not set
21CONFIG_CRASH_DUMP=y 21CONFIG_CRASH_DUMP=y
22CONFIG_ZFCPDUMP=y
23# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set 22# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
24# CONFIG_SECCOMP is not set 23# CONFIG_SECCOMP is not set
25# CONFIG_IUCV is not set 24# CONFIG_IUCV is not set
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index 33f57514f424..4557cb7ffddf 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -40,6 +40,7 @@ CONFIG_PARTITION_ADVANCED=y
40CONFIG_IBM_PARTITION=y 40CONFIG_IBM_PARTITION=y
41CONFIG_DEFAULT_DEADLINE=y 41CONFIG_DEFAULT_DEADLINE=y
42CONFIG_MARCH_Z196=y 42CONFIG_MARCH_Z196=y
43CONFIG_NR_CPUS=256
43CONFIG_HZ_100=y 44CONFIG_HZ_100=y
44CONFIG_MEMORY_HOTPLUG=y 45CONFIG_MEMORY_HOTPLUG=y
45CONFIG_MEMORY_HOTREMOVE=y 46CONFIG_MEMORY_HOTREMOVE=y
@@ -122,22 +123,31 @@ CONFIG_TMPFS=y
122CONFIG_TMPFS_POSIX_ACL=y 123CONFIG_TMPFS_POSIX_ACL=y
123CONFIG_HUGETLBFS=y 124CONFIG_HUGETLBFS=y
124# CONFIG_NETWORK_FILESYSTEMS is not set 125# CONFIG_NETWORK_FILESYSTEMS is not set
126CONFIG_UNUSED_SYMBOLS=y
127CONFIG_DEBUG_SECTION_MISMATCH=y
125CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y 128CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y
126CONFIG_MAGIC_SYSRQ=y 129CONFIG_MAGIC_SYSRQ=y
127CONFIG_DEBUG_PAGEALLOC=y 130CONFIG_DEBUG_PAGEALLOC=y
131CONFIG_DETECT_HUNG_TASK=y
128CONFIG_TIMER_STATS=y 132CONFIG_TIMER_STATS=y
133CONFIG_DEBUG_RT_MUTEXES=y
129CONFIG_PROVE_LOCKING=y 134CONFIG_PROVE_LOCKING=y
130CONFIG_LOCK_STAT=y 135CONFIG_LOCK_STAT=y
131CONFIG_DEBUG_LOCKDEP=y 136CONFIG_DEBUG_LOCKDEP=y
137CONFIG_DEBUG_ATOMIC_SLEEP=y
138CONFIG_DEBUG_WRITECOUNT=y
132CONFIG_DEBUG_LIST=y 139CONFIG_DEBUG_LIST=y
140CONFIG_DEBUG_SG=y
133CONFIG_DEBUG_NOTIFIERS=y 141CONFIG_DEBUG_NOTIFIERS=y
134CONFIG_PROVE_RCU=y 142CONFIG_PROVE_RCU=y
135CONFIG_RCU_CPU_STALL_TIMEOUT=60 143CONFIG_RCU_CPU_STALL_TIMEOUT=60
136CONFIG_RCU_TRACE=y 144CONFIG_RCU_TRACE=y
137CONFIG_LATENCYTOP=y 145CONFIG_LATENCYTOP=y
146CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y
138CONFIG_BLK_DEV_IO_TRACE=y 147CONFIG_BLK_DEV_IO_TRACE=y
139CONFIG_KPROBES_SANITY_TEST=y 148CONFIG_KPROBES_SANITY_TEST=y
140# CONFIG_STRICT_DEVMEM is not set 149# CONFIG_STRICT_DEVMEM is not set
150CONFIG_S390_PTDUMP=y
141CONFIG_CRYPTO_CRYPTD=m 151CONFIG_CRYPTO_CRYPTD=m
142CONFIG_CRYPTO_AUTHENC=m 152CONFIG_CRYPTO_AUTHENC=m
143CONFIG_CRYPTO_TEST=m 153CONFIG_CRYPTO_TEST=m
diff --git a/arch/s390/hypfs/hypfs_vm.c b/arch/s390/hypfs/hypfs_vm.c
index 24908ce149f1..32040ace00ea 100644
--- a/arch/s390/hypfs/hypfs_vm.c
+++ b/arch/s390/hypfs/hypfs_vm.c
@@ -32,7 +32,7 @@ struct diag2fc_data {
32 __u32 pcpus; 32 __u32 pcpus;
33 __u32 lcpus; 33 __u32 lcpus;
34 __u32 vcpus; 34 __u32 vcpus;
35 __u32 cpu_min; 35 __u32 ocpus;
36 __u32 cpu_max; 36 __u32 cpu_max;
37 __u32 cpu_shares; 37 __u32 cpu_shares;
38 __u32 cpu_use_samp; 38 __u32 cpu_use_samp;
@@ -142,7 +142,12 @@ static int hpyfs_vm_create_guest(struct dentry *systems_dir,
142 ATTRIBUTE(cpus_dir, "capped", capped_value); 142 ATTRIBUTE(cpus_dir, "capped", capped_value);
143 ATTRIBUTE(cpus_dir, "dedicated", dedicated_flag); 143 ATTRIBUTE(cpus_dir, "dedicated", dedicated_flag);
144 ATTRIBUTE(cpus_dir, "count", data->vcpus); 144 ATTRIBUTE(cpus_dir, "count", data->vcpus);
145 ATTRIBUTE(cpus_dir, "weight_min", data->cpu_min); 145 /*
146 * Note: The "weight_min" attribute got the wrong name.
147 * The value represents the number of non-stopped (operating)
148 * CPUS.
149 */
150 ATTRIBUTE(cpus_dir, "weight_min", data->ocpus);
146 ATTRIBUTE(cpus_dir, "weight_max", data->cpu_max); 151 ATTRIBUTE(cpus_dir, "weight_max", data->cpu_max);
147 ATTRIBUTE(cpus_dir, "weight_cur", data->cpu_shares); 152 ATTRIBUTE(cpus_dir, "weight_cur", data->cpu_shares);
148 153
diff --git a/arch/s390/include/asm/airq.h b/arch/s390/include/asm/airq.h
index 4bbb5957ed1b..bd93ff6661b8 100644
--- a/arch/s390/include/asm/airq.h
+++ b/arch/s390/include/asm/airq.h
@@ -44,11 +44,21 @@ struct airq_iv {
44 44
45struct airq_iv *airq_iv_create(unsigned long bits, unsigned long flags); 45struct airq_iv *airq_iv_create(unsigned long bits, unsigned long flags);
46void airq_iv_release(struct airq_iv *iv); 46void airq_iv_release(struct airq_iv *iv);
47unsigned long airq_iv_alloc_bit(struct airq_iv *iv); 47unsigned long airq_iv_alloc(struct airq_iv *iv, unsigned long num);
48void airq_iv_free_bit(struct airq_iv *iv, unsigned long bit); 48void airq_iv_free(struct airq_iv *iv, unsigned long bit, unsigned long num);
49unsigned long airq_iv_scan(struct airq_iv *iv, unsigned long start, 49unsigned long airq_iv_scan(struct airq_iv *iv, unsigned long start,
50 unsigned long end); 50 unsigned long end);
51 51
52static inline unsigned long airq_iv_alloc_bit(struct airq_iv *iv)
53{
54 return airq_iv_alloc(iv, 1);
55}
56
57static inline void airq_iv_free_bit(struct airq_iv *iv, unsigned long bit)
58{
59 airq_iv_free(iv, bit, 1);
60}
61
52static inline unsigned long airq_iv_end(struct airq_iv *iv) 62static inline unsigned long airq_iv_end(struct airq_iv *iv)
53{ 63{
54 return iv->end; 64 return iv->end;
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h
index 6e6ad0680829..ec5ef891db6b 100644
--- a/arch/s390/include/asm/bitops.h
+++ b/arch/s390/include/asm/bitops.h
@@ -13,9 +13,9 @@
13 * 13 *
14 * The bitop functions are defined to work on unsigned longs, so for an 14 * The bitop functions are defined to work on unsigned longs, so for an
15 * s390x system the bits end up numbered: 15 * s390x system the bits end up numbered:
16 * |63..............0|127............64|191...........128|255...........196| 16 * |63..............0|127............64|191...........128|255...........192|
17 * and on s390: 17 * and on s390:
18 * |31.....0|63....31|95....64|127...96|159..128|191..160|223..192|255..224| 18 * |31.....0|63....32|95....64|127...96|159..128|191..160|223..192|255..224|
19 * 19 *
20 * There are a few little-endian macros used mostly for filesystem 20 * There are a few little-endian macros used mostly for filesystem
21 * bitmaps, these work on similar bit arrays layouts, but 21 * bitmaps, these work on similar bit arrays layouts, but
@@ -30,7 +30,7 @@
30 * on an s390x system the bits are numbered: 30 * on an s390x system the bits are numbered:
31 * |0..............63|64............127|128...........191|192...........255| 31 * |0..............63|64............127|128...........191|192...........255|
32 * and on s390: 32 * and on s390:
33 * |0.....31|31....63|64....95|96...127|128..159|160..191|192..223|224..255| 33 * |0.....31|32....63|64....95|96...127|128..159|160..191|192..223|224..255|
34 * 34 *
35 * The main difference is that bit 0-63 (64b) or 0-31 (32b) in the bit 35 * The main difference is that bit 0-63 (64b) or 0-31 (32b) in the bit
36 * number field needs to be reversed compared to the LSB0 encoded bit 36 * number field needs to be reversed compared to the LSB0 encoded bit
@@ -304,7 +304,7 @@ static inline int test_bit(unsigned long nr, const volatile unsigned long *ptr)
304 * On an s390x system the bits are numbered: 304 * On an s390x system the bits are numbered:
305 * |0..............63|64............127|128...........191|192...........255| 305 * |0..............63|64............127|128...........191|192...........255|
306 * and on s390: 306 * and on s390:
307 * |0.....31|31....63|64....95|96...127|128..159|160..191|192..223|224..255| 307 * |0.....31|32....63|64....95|96...127|128..159|160..191|192..223|224..255|
308 */ 308 */
309unsigned long find_first_bit_inv(const unsigned long *addr, unsigned long size); 309unsigned long find_first_bit_inv(const unsigned long *addr, unsigned long size);
310unsigned long find_next_bit_inv(const unsigned long *addr, unsigned long size, 310unsigned long find_next_bit_inv(const unsigned long *addr, unsigned long size,
diff --git a/arch/s390/include/asm/ccwdev.h b/arch/s390/include/asm/ccwdev.h
index f201af8be580..a9c2c0686177 100644
--- a/arch/s390/include/asm/ccwdev.h
+++ b/arch/s390/include/asm/ccwdev.h
@@ -219,7 +219,9 @@ extern void ccw_device_get_id(struct ccw_device *, struct ccw_dev_id *);
219#define to_ccwdev(n) container_of(n, struct ccw_device, dev) 219#define to_ccwdev(n) container_of(n, struct ccw_device, dev)
220#define to_ccwdrv(n) container_of(n, struct ccw_driver, driver) 220#define to_ccwdrv(n) container_of(n, struct ccw_driver, driver)
221 221
222extern struct ccw_device *ccw_device_probe_console(void); 222extern struct ccw_device *ccw_device_create_console(struct ccw_driver *);
223extern void ccw_device_destroy_console(struct ccw_device *);
224extern int ccw_device_enable_console(struct ccw_device *);
223extern void ccw_device_wait_idle(struct ccw_device *); 225extern void ccw_device_wait_idle(struct ccw_device *);
224extern int ccw_device_force_console(struct ccw_device *); 226extern int ccw_device_force_console(struct ccw_device *);
225 227
diff --git a/arch/s390/include/asm/checksum.h b/arch/s390/include/asm/checksum.h
index 4f57a4f3909a..740364856355 100644
--- a/arch/s390/include/asm/checksum.h
+++ b/arch/s390/include/asm/checksum.h
@@ -44,22 +44,15 @@ csum_partial(const void *buff, int len, __wsum sum)
44 * here even more important to align src and dst on a 32-bit (or even 44 * here even more important to align src and dst on a 32-bit (or even
45 * better 64-bit) boundary 45 * better 64-bit) boundary
46 * 46 *
47 * Copy from userspace and compute checksum. If we catch an exception 47 * Copy from userspace and compute checksum.
48 * then zero the rest of the buffer.
49 */ 48 */
50static inline __wsum 49static inline __wsum
51csum_partial_copy_from_user(const void __user *src, void *dst, 50csum_partial_copy_from_user(const void __user *src, void *dst,
52 int len, __wsum sum, 51 int len, __wsum sum,
53 int *err_ptr) 52 int *err_ptr)
54{ 53{
55 int missing; 54 if (unlikely(copy_from_user(dst, src, len)))
56
57 missing = copy_from_user(dst, src, len);
58 if (missing) {
59 memset(dst + len - missing, 0, missing);
60 *err_ptr = -EFAULT; 55 *err_ptr = -EFAULT;
61 }
62
63 return csum_partial(dst, len, sum); 56 return csum_partial(dst, len, sum);
64} 57}
65 58
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h
index 5d7e8cf83bd6..d350ed9d0fbb 100644
--- a/arch/s390/include/asm/compat.h
+++ b/arch/s390/include/asm/compat.h
@@ -8,7 +8,11 @@
8#include <linux/thread_info.h> 8#include <linux/thread_info.h>
9 9
10#define __TYPE_IS_PTR(t) (!__builtin_types_compatible_p(typeof(0?(t)0:0ULL), u64)) 10#define __TYPE_IS_PTR(t) (!__builtin_types_compatible_p(typeof(0?(t)0:0ULL), u64))
11#define __SC_DELOUSE(t,v) (t)(__TYPE_IS_PTR(t) ? ((v) & 0x7fffffff) : (v)) 11
12#define __SC_DELOUSE(t,v) ({ \
13 BUILD_BUG_ON(sizeof(t) > 4 && !__TYPE_IS_PTR(t)); \
14 (t)(__TYPE_IS_PTR(t) ? ((v) & 0x7fffffff) : (v)); \
15})
12 16
13#define PSW32_MASK_PER 0x40000000UL 17#define PSW32_MASK_PER 0x40000000UL
14#define PSW32_MASK_DAT 0x04000000UL 18#define PSW32_MASK_DAT 0x04000000UL
diff --git a/arch/s390/include/asm/futex.h b/arch/s390/include/asm/futex.h
index 51bcaa0fdeef..fda46bd38c99 100644
--- a/arch/s390/include/asm/futex.h
+++ b/arch/s390/include/asm/futex.h
@@ -5,7 +5,10 @@
5#include <linux/uaccess.h> 5#include <linux/uaccess.h>
6#include <asm/errno.h> 6#include <asm/errno.h>
7 7
8static inline int futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) 8int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval, u32 newval);
9int __futex_atomic_op_inuser(int op, u32 __user *uaddr, int oparg, int *old);
10
11static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr)
9{ 12{
10 int op = (encoded_op >> 28) & 7; 13 int op = (encoded_op >> 28) & 7;
11 int cmp = (encoded_op >> 24) & 15; 14 int cmp = (encoded_op >> 24) & 15;
@@ -17,7 +20,7 @@ static inline int futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
17 oparg = 1 << oparg; 20 oparg = 1 << oparg;
18 21
19 pagefault_disable(); 22 pagefault_disable();
20 ret = uaccess.futex_atomic_op(op, uaddr, oparg, &oldval); 23 ret = __futex_atomic_op_inuser(op, uaddr, oparg, &oldval);
21 pagefault_enable(); 24 pagefault_enable();
22 25
23 if (!ret) { 26 if (!ret) {
@@ -34,10 +37,4 @@ static inline int futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
34 return ret; 37 return ret;
35} 38}
36 39
37static inline int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
38 u32 oldval, u32 newval)
39{
40 return uaccess.futex_atomic_cmpxchg(uval, uaddr, oldval, newval);
41}
42
43#endif /* _ASM_S390_FUTEX_H */ 40#endif /* _ASM_S390_FUTEX_H */
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index eef3dd3fd9a9..9bf95bb30f1a 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -106,7 +106,9 @@ struct kvm_s390_sie_block {
106 __u64 gbea; /* 0x0180 */ 106 __u64 gbea; /* 0x0180 */
107 __u8 reserved188[24]; /* 0x0188 */ 107 __u8 reserved188[24]; /* 0x0188 */
108 __u32 fac; /* 0x01a0 */ 108 __u32 fac; /* 0x01a0 */
109 __u8 reserved1a4[68]; /* 0x01a4 */ 109 __u8 reserved1a4[20]; /* 0x01a4 */
110 __u64 cbrlo; /* 0x01b8 */
111 __u8 reserved1c0[40]; /* 0x01c0 */
110 __u64 itdba; /* 0x01e8 */ 112 __u64 itdba; /* 0x01e8 */
111 __u8 reserved1f0[16]; /* 0x01f0 */ 113 __u8 reserved1f0[16]; /* 0x01f0 */
112} __attribute__((packed)); 114} __attribute__((packed));
@@ -155,6 +157,7 @@ struct kvm_vcpu_stat {
155 u32 instruction_stsi; 157 u32 instruction_stsi;
156 u32 instruction_stfl; 158 u32 instruction_stfl;
157 u32 instruction_tprot; 159 u32 instruction_tprot;
160 u32 instruction_essa;
158 u32 instruction_sigp_sense; 161 u32 instruction_sigp_sense;
159 u32 instruction_sigp_sense_running; 162 u32 instruction_sigp_sense_running;
160 u32 instruction_sigp_external_call; 163 u32 instruction_sigp_external_call;
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h
index 5d1f950704dc..38149b63dc44 100644
--- a/arch/s390/include/asm/mmu_context.h
+++ b/arch/s390/include/asm/mmu_context.h
@@ -48,13 +48,42 @@ static inline void update_mm(struct mm_struct *mm, struct task_struct *tsk)
48static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 48static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
49 struct task_struct *tsk) 49 struct task_struct *tsk)
50{ 50{
51 cpumask_set_cpu(smp_processor_id(), mm_cpumask(next)); 51 int cpu = smp_processor_id();
52 update_mm(next, tsk); 52
53 if (prev == next)
54 return;
55 if (atomic_inc_return(&next->context.attach_count) >> 16) {
56 /* Delay update_mm until all TLB flushes are done. */
57 set_tsk_thread_flag(tsk, TIF_TLB_WAIT);
58 } else {
59 cpumask_set_cpu(cpu, mm_cpumask(next));
60 update_mm(next, tsk);
61 if (next->context.flush_mm)
62 /* Flush pending TLBs */
63 __tlb_flush_mm(next);
64 }
53 atomic_dec(&prev->context.attach_count); 65 atomic_dec(&prev->context.attach_count);
54 WARN_ON(atomic_read(&prev->context.attach_count) < 0); 66 WARN_ON(atomic_read(&prev->context.attach_count) < 0);
55 atomic_inc(&next->context.attach_count); 67}
56 /* Check for TLBs not flushed yet */ 68
57 __tlb_flush_mm_lazy(next); 69#define finish_arch_post_lock_switch finish_arch_post_lock_switch
70static inline void finish_arch_post_lock_switch(void)
71{
72 struct task_struct *tsk = current;
73 struct mm_struct *mm = tsk->mm;
74
75 if (!test_tsk_thread_flag(tsk, TIF_TLB_WAIT))
76 return;
77 preempt_disable();
78 clear_tsk_thread_flag(tsk, TIF_TLB_WAIT);
79 while (atomic_read(&mm->context.attach_count) >> 16)
80 cpu_relax();
81
82 cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm));
83 update_mm(mm, tsk);
84 if (mm->context.flush_mm)
85 __tlb_flush_mm(mm);
86 preempt_enable();
58} 87}
59 88
60#define enter_lazy_tlb(mm,tsk) do { } while (0) 89#define enter_lazy_tlb(mm,tsk) do { } while (0)
diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h
index e1408ddb94f8..884017cbfa9f 100644
--- a/arch/s390/include/asm/pgalloc.h
+++ b/arch/s390/include/asm/pgalloc.h
@@ -22,6 +22,7 @@ unsigned long *page_table_alloc(struct mm_struct *, unsigned long);
22void page_table_free(struct mm_struct *, unsigned long *); 22void page_table_free(struct mm_struct *, unsigned long *);
23void page_table_free_rcu(struct mmu_gather *, unsigned long *); 23void page_table_free_rcu(struct mmu_gather *, unsigned long *);
24 24
25void page_table_reset_pgste(struct mm_struct *, unsigned long, unsigned long);
25int set_guest_storage_key(struct mm_struct *mm, unsigned long addr, 26int set_guest_storage_key(struct mm_struct *mm, unsigned long addr,
26 unsigned long key, bool nq); 27 unsigned long key, bool nq);
27 28
@@ -91,11 +92,22 @@ static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address)
91static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr) 92static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
92{ 93{
93 unsigned long *table = crst_table_alloc(mm); 94 unsigned long *table = crst_table_alloc(mm);
94 if (table) 95
95 crst_table_init(table, _SEGMENT_ENTRY_EMPTY); 96 if (!table)
97 return NULL;
98 crst_table_init(table, _SEGMENT_ENTRY_EMPTY);
99 if (!pgtable_pmd_page_ctor(virt_to_page(table))) {
100 crst_table_free(mm, table);
101 return NULL;
102 }
96 return (pmd_t *) table; 103 return (pmd_t *) table;
97} 104}
98#define pmd_free(mm, pmd) crst_table_free(mm, (unsigned long *) pmd) 105
106static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
107{
108 pgtable_pmd_page_dtor(virt_to_page(pmd));
109 crst_table_free(mm, (unsigned long *) pmd);
110}
99 111
100static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud) 112static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud)
101{ 113{
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 2204400d0bd5..1ab75eaacbd4 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -229,6 +229,7 @@ extern unsigned long MODULES_END;
229#define _PAGE_READ 0x010 /* SW pte read bit */ 229#define _PAGE_READ 0x010 /* SW pte read bit */
230#define _PAGE_WRITE 0x020 /* SW pte write bit */ 230#define _PAGE_WRITE 0x020 /* SW pte write bit */
231#define _PAGE_SPECIAL 0x040 /* SW associated with special page */ 231#define _PAGE_SPECIAL 0x040 /* SW associated with special page */
232#define _PAGE_UNUSED 0x080 /* SW bit for pgste usage state */
232#define __HAVE_ARCH_PTE_SPECIAL 233#define __HAVE_ARCH_PTE_SPECIAL
233 234
234/* Set of bits not changed in pte_modify */ 235/* Set of bits not changed in pte_modify */
@@ -394,6 +395,12 @@ extern unsigned long MODULES_END;
394 395
395#endif /* CONFIG_64BIT */ 396#endif /* CONFIG_64BIT */
396 397
398/* Guest Page State used for virtualization */
399#define _PGSTE_GPS_ZERO 0x0000000080000000UL
400#define _PGSTE_GPS_USAGE_MASK 0x0000000003000000UL
401#define _PGSTE_GPS_USAGE_STABLE 0x0000000000000000UL
402#define _PGSTE_GPS_USAGE_UNUSED 0x0000000001000000UL
403
397/* 404/*
398 * A user page table pointer has the space-switch-event bit, the 405 * A user page table pointer has the space-switch-event bit, the
399 * private-space-control bit and the storage-alteration-event-control 406 * private-space-control bit and the storage-alteration-event-control
@@ -617,6 +624,14 @@ static inline int pte_none(pte_t pte)
617 return pte_val(pte) == _PAGE_INVALID; 624 return pte_val(pte) == _PAGE_INVALID;
618} 625}
619 626
627static inline int pte_swap(pte_t pte)
628{
629 /* Bit pattern: (pte & 0x603) == 0x402 */
630 return (pte_val(pte) & (_PAGE_INVALID | _PAGE_PROTECT |
631 _PAGE_TYPE | _PAGE_PRESENT))
632 == (_PAGE_INVALID | _PAGE_TYPE);
633}
634
620static inline int pte_file(pte_t pte) 635static inline int pte_file(pte_t pte)
621{ 636{
622 /* Bit pattern: (pte & 0x601) == 0x600 */ 637 /* Bit pattern: (pte & 0x601) == 0x600 */
@@ -821,20 +836,20 @@ unsigned long gmap_translate(unsigned long address, struct gmap *);
821unsigned long __gmap_fault(unsigned long address, struct gmap *); 836unsigned long __gmap_fault(unsigned long address, struct gmap *);
822unsigned long gmap_fault(unsigned long address, struct gmap *); 837unsigned long gmap_fault(unsigned long address, struct gmap *);
823void gmap_discard(unsigned long from, unsigned long to, struct gmap *); 838void gmap_discard(unsigned long from, unsigned long to, struct gmap *);
839void __gmap_zap(unsigned long address, struct gmap *);
824 840
825void gmap_register_ipte_notifier(struct gmap_notifier *); 841void gmap_register_ipte_notifier(struct gmap_notifier *);
826void gmap_unregister_ipte_notifier(struct gmap_notifier *); 842void gmap_unregister_ipte_notifier(struct gmap_notifier *);
827int gmap_ipte_notify(struct gmap *, unsigned long start, unsigned long len); 843int gmap_ipte_notify(struct gmap *, unsigned long start, unsigned long len);
828void gmap_do_ipte_notify(struct mm_struct *, unsigned long addr, pte_t *); 844void gmap_do_ipte_notify(struct mm_struct *, pte_t *);
829 845
830static inline pgste_t pgste_ipte_notify(struct mm_struct *mm, 846static inline pgste_t pgste_ipte_notify(struct mm_struct *mm,
831 unsigned long addr,
832 pte_t *ptep, pgste_t pgste) 847 pte_t *ptep, pgste_t pgste)
833{ 848{
834#ifdef CONFIG_PGSTE 849#ifdef CONFIG_PGSTE
835 if (pgste_val(pgste) & PGSTE_IN_BIT) { 850 if (pgste_val(pgste) & PGSTE_IN_BIT) {
836 pgste_val(pgste) &= ~PGSTE_IN_BIT; 851 pgste_val(pgste) &= ~PGSTE_IN_BIT;
837 gmap_do_ipte_notify(mm, addr, ptep); 852 gmap_do_ipte_notify(mm, ptep);
838 } 853 }
839#endif 854#endif
840 return pgste; 855 return pgste;
@@ -852,6 +867,7 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
852 867
853 if (mm_has_pgste(mm)) { 868 if (mm_has_pgste(mm)) {
854 pgste = pgste_get_lock(ptep); 869 pgste = pgste_get_lock(ptep);
870 pgste_val(pgste) &= ~_PGSTE_GPS_ZERO;
855 pgste_set_key(ptep, pgste, entry); 871 pgste_set_key(ptep, pgste, entry);
856 pgste_set_pte(ptep, entry); 872 pgste_set_pte(ptep, entry);
857 pgste_set_unlock(ptep, pgste); 873 pgste_set_unlock(ptep, pgste);
@@ -881,6 +897,12 @@ static inline int pte_young(pte_t pte)
881 return (pte_val(pte) & _PAGE_YOUNG) != 0; 897 return (pte_val(pte) & _PAGE_YOUNG) != 0;
882} 898}
883 899
900#define __HAVE_ARCH_PTE_UNUSED
901static inline int pte_unused(pte_t pte)
902{
903 return pte_val(pte) & _PAGE_UNUSED;
904}
905
884/* 906/*
885 * pgd/pmd/pte modification functions 907 * pgd/pmd/pte modification functions
886 */ 908 */
@@ -1034,30 +1056,41 @@ static inline int ptep_test_and_clear_user_young(struct mm_struct *mm,
1034 1056
1035static inline void __ptep_ipte(unsigned long address, pte_t *ptep) 1057static inline void __ptep_ipte(unsigned long address, pte_t *ptep)
1036{ 1058{
1037 if (!(pte_val(*ptep) & _PAGE_INVALID)) { 1059 unsigned long pto = (unsigned long) ptep;
1060
1038#ifndef CONFIG_64BIT 1061#ifndef CONFIG_64BIT
1039 /* pto must point to the start of the segment table */ 1062 /* pto in ESA mode must point to the start of the segment table */
1040 pte_t *pto = (pte_t *) (((unsigned long) ptep) & 0x7ffffc00); 1063 pto &= 0x7ffffc00;
1041#else
1042 /* ipte in zarch mode can do the math */
1043 pte_t *pto = ptep;
1044#endif 1064#endif
1045 asm volatile( 1065 /* Invalidation + global TLB flush for the pte */
1046 " ipte %2,%3" 1066 asm volatile(
1047 : "=m" (*ptep) : "m" (*ptep), 1067 " ipte %2,%3"
1048 "a" (pto), "a" (address)); 1068 : "=m" (*ptep) : "m" (*ptep), "a" (pto), "a" (address));
1049 } 1069}
1070
1071static inline void ptep_flush_direct(struct mm_struct *mm,
1072 unsigned long address, pte_t *ptep)
1073{
1074 if (pte_val(*ptep) & _PAGE_INVALID)
1075 return;
1076 __ptep_ipte(address, ptep);
1050} 1077}
1051 1078
1052static inline void ptep_flush_lazy(struct mm_struct *mm, 1079static inline void ptep_flush_lazy(struct mm_struct *mm,
1053 unsigned long address, pte_t *ptep) 1080 unsigned long address, pte_t *ptep)
1054{ 1081{
1055 int active = (mm == current->active_mm) ? 1 : 0; 1082 int active, count;
1056 1083
1057 if (atomic_read(&mm->context.attach_count) > active) 1084 if (pte_val(*ptep) & _PAGE_INVALID)
1058 __ptep_ipte(address, ptep); 1085 return;
1059 else 1086 active = (mm == current->active_mm) ? 1 : 0;
1087 count = atomic_add_return(0x10000, &mm->context.attach_count);
1088 if ((count & 0xffff) <= active) {
1089 pte_val(*ptep) |= _PAGE_INVALID;
1060 mm->context.flush_mm = 1; 1090 mm->context.flush_mm = 1;
1091 } else
1092 __ptep_ipte(address, ptep);
1093 atomic_sub(0x10000, &mm->context.attach_count);
1061} 1094}
1062 1095
1063#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 1096#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
@@ -1070,11 +1103,11 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,
1070 1103
1071 if (mm_has_pgste(vma->vm_mm)) { 1104 if (mm_has_pgste(vma->vm_mm)) {
1072 pgste = pgste_get_lock(ptep); 1105 pgste = pgste_get_lock(ptep);
1073 pgste = pgste_ipte_notify(vma->vm_mm, addr, ptep, pgste); 1106 pgste = pgste_ipte_notify(vma->vm_mm, ptep, pgste);
1074 } 1107 }
1075 1108
1076 pte = *ptep; 1109 pte = *ptep;
1077 __ptep_ipte(addr, ptep); 1110 ptep_flush_direct(vma->vm_mm, addr, ptep);
1078 young = pte_young(pte); 1111 young = pte_young(pte);
1079 pte = pte_mkold(pte); 1112 pte = pte_mkold(pte);
1080 1113
@@ -1116,7 +1149,7 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
1116 1149
1117 if (mm_has_pgste(mm)) { 1150 if (mm_has_pgste(mm)) {
1118 pgste = pgste_get_lock(ptep); 1151 pgste = pgste_get_lock(ptep);
1119 pgste = pgste_ipte_notify(mm, address, ptep, pgste); 1152 pgste = pgste_ipte_notify(mm, ptep, pgste);
1120 } 1153 }
1121 1154
1122 pte = *ptep; 1155 pte = *ptep;
@@ -1140,12 +1173,11 @@ static inline pte_t ptep_modify_prot_start(struct mm_struct *mm,
1140 1173
1141 if (mm_has_pgste(mm)) { 1174 if (mm_has_pgste(mm)) {
1142 pgste = pgste_get_lock(ptep); 1175 pgste = pgste_get_lock(ptep);
1143 pgste_ipte_notify(mm, address, ptep, pgste); 1176 pgste_ipte_notify(mm, ptep, pgste);
1144 } 1177 }
1145 1178
1146 pte = *ptep; 1179 pte = *ptep;
1147 ptep_flush_lazy(mm, address, ptep); 1180 ptep_flush_lazy(mm, address, ptep);
1148 pte_val(*ptep) |= _PAGE_INVALID;
1149 1181
1150 if (mm_has_pgste(mm)) { 1182 if (mm_has_pgste(mm)) {
1151 pgste = pgste_update_all(&pte, pgste); 1183 pgste = pgste_update_all(&pte, pgste);
@@ -1178,14 +1210,17 @@ static inline pte_t ptep_clear_flush(struct vm_area_struct *vma,
1178 1210
1179 if (mm_has_pgste(vma->vm_mm)) { 1211 if (mm_has_pgste(vma->vm_mm)) {
1180 pgste = pgste_get_lock(ptep); 1212 pgste = pgste_get_lock(ptep);
1181 pgste = pgste_ipte_notify(vma->vm_mm, address, ptep, pgste); 1213 pgste = pgste_ipte_notify(vma->vm_mm, ptep, pgste);
1182 } 1214 }
1183 1215
1184 pte = *ptep; 1216 pte = *ptep;
1185 __ptep_ipte(address, ptep); 1217 ptep_flush_direct(vma->vm_mm, address, ptep);
1186 pte_val(*ptep) = _PAGE_INVALID; 1218 pte_val(*ptep) = _PAGE_INVALID;
1187 1219
1188 if (mm_has_pgste(vma->vm_mm)) { 1220 if (mm_has_pgste(vma->vm_mm)) {
1221 if ((pgste_val(pgste) & _PGSTE_GPS_USAGE_MASK) ==
1222 _PGSTE_GPS_USAGE_UNUSED)
1223 pte_val(pte) |= _PAGE_UNUSED;
1189 pgste = pgste_update_all(&pte, pgste); 1224 pgste = pgste_update_all(&pte, pgste);
1190 pgste_set_unlock(ptep, pgste); 1225 pgste_set_unlock(ptep, pgste);
1191 } 1226 }
@@ -1209,7 +1244,7 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm,
1209 1244
1210 if (!full && mm_has_pgste(mm)) { 1245 if (!full && mm_has_pgste(mm)) {
1211 pgste = pgste_get_lock(ptep); 1246 pgste = pgste_get_lock(ptep);
1212 pgste = pgste_ipte_notify(mm, address, ptep, pgste); 1247 pgste = pgste_ipte_notify(mm, ptep, pgste);
1213 } 1248 }
1214 1249
1215 pte = *ptep; 1250 pte = *ptep;
@@ -1234,7 +1269,7 @@ static inline pte_t ptep_set_wrprotect(struct mm_struct *mm,
1234 if (pte_write(pte)) { 1269 if (pte_write(pte)) {
1235 if (mm_has_pgste(mm)) { 1270 if (mm_has_pgste(mm)) {
1236 pgste = pgste_get_lock(ptep); 1271 pgste = pgste_get_lock(ptep);
1237 pgste = pgste_ipte_notify(mm, address, ptep, pgste); 1272 pgste = pgste_ipte_notify(mm, ptep, pgste);
1238 } 1273 }
1239 1274
1240 ptep_flush_lazy(mm, address, ptep); 1275 ptep_flush_lazy(mm, address, ptep);
@@ -1260,10 +1295,10 @@ static inline int ptep_set_access_flags(struct vm_area_struct *vma,
1260 return 0; 1295 return 0;
1261 if (mm_has_pgste(vma->vm_mm)) { 1296 if (mm_has_pgste(vma->vm_mm)) {
1262 pgste = pgste_get_lock(ptep); 1297 pgste = pgste_get_lock(ptep);
1263 pgste = pgste_ipte_notify(vma->vm_mm, address, ptep, pgste); 1298 pgste = pgste_ipte_notify(vma->vm_mm, ptep, pgste);
1264 } 1299 }
1265 1300
1266 __ptep_ipte(address, ptep); 1301 ptep_flush_direct(vma->vm_mm, address, ptep);
1267 1302
1268 if (mm_has_pgste(vma->vm_mm)) { 1303 if (mm_has_pgste(vma->vm_mm)) {
1269 pgste_set_pte(ptep, entry); 1304 pgste_set_pte(ptep, entry);
@@ -1447,12 +1482,16 @@ static inline pmd_t pmd_mkwrite(pmd_t pmd)
1447static inline void pmdp_flush_lazy(struct mm_struct *mm, 1482static inline void pmdp_flush_lazy(struct mm_struct *mm,
1448 unsigned long address, pmd_t *pmdp) 1483 unsigned long address, pmd_t *pmdp)
1449{ 1484{
1450 int active = (mm == current->active_mm) ? 1 : 0; 1485 int active, count;
1451 1486
1452 if ((atomic_read(&mm->context.attach_count) & 0xffff) > active) 1487 active = (mm == current->active_mm) ? 1 : 0;
1453 __pmd_idte(address, pmdp); 1488 count = atomic_add_return(0x10000, &mm->context.attach_count);
1454 else 1489 if ((count & 0xffff) <= active) {
1490 pmd_val(*pmdp) |= _SEGMENT_ENTRY_INVALID;
1455 mm->context.flush_mm = 1; 1491 mm->context.flush_mm = 1;
1492 } else
1493 __pmd_idte(address, pmdp);
1494 atomic_sub(0x10000, &mm->context.attach_count);
1456} 1495}
1457 1496
1458#ifdef CONFIG_TRANSPARENT_HUGEPAGE 1497#ifdef CONFIG_TRANSPARENT_HUGEPAGE
diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h
index 9c82cebddabd..f4783c0b7b43 100644
--- a/arch/s390/include/asm/ptrace.h
+++ b/arch/s390/include/asm/ptrace.h
@@ -83,6 +83,7 @@ struct per_struct_kernel {
83 * These are defined as per linux/ptrace.h, which see. 83 * These are defined as per linux/ptrace.h, which see.
84 */ 84 */
85#define arch_has_single_step() (1) 85#define arch_has_single_step() (1)
86#define arch_has_block_step() (1)
86 87
87#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) 88#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0)
88#define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN) 89#define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN)
diff --git a/arch/s390/include/asm/sclp.h b/arch/s390/include/asm/sclp.h
index abaca2275c7a..2f5e9932b4de 100644
--- a/arch/s390/include/asm/sclp.h
+++ b/arch/s390/include/asm/sclp.h
@@ -46,6 +46,7 @@ int sclp_cpu_configure(u8 cpu);
46int sclp_cpu_deconfigure(u8 cpu); 46int sclp_cpu_deconfigure(u8 cpu);
47unsigned long long sclp_get_rnmax(void); 47unsigned long long sclp_get_rnmax(void);
48unsigned long long sclp_get_rzm(void); 48unsigned long long sclp_get_rzm(void);
49unsigned int sclp_get_max_cpu(void);
49int sclp_sdias_blk_count(void); 50int sclp_sdias_blk_count(void);
50int sclp_sdias_copy(void *dest, int blk_num, int nr_blks); 51int sclp_sdias_copy(void *dest, int blk_num, int nr_blks);
51int sclp_chp_configure(struct chp_id chpid); 52int sclp_chp_configure(struct chp_id chpid);
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h
index 94cfbe442f12..406f3a1e63ef 100644
--- a/arch/s390/include/asm/setup.h
+++ b/arch/s390/include/asm/setup.h
@@ -59,7 +59,6 @@ void create_mem_hole(struct mem_chunk mem_chunk[], unsigned long addr,
59#define MACHINE_FLAG_DIAG44 (1UL << 4) 59#define MACHINE_FLAG_DIAG44 (1UL << 4)
60#define MACHINE_FLAG_IDTE (1UL << 5) 60#define MACHINE_FLAG_IDTE (1UL << 5)
61#define MACHINE_FLAG_DIAG9C (1UL << 6) 61#define MACHINE_FLAG_DIAG9C (1UL << 6)
62#define MACHINE_FLAG_MVCOS (1UL << 7)
63#define MACHINE_FLAG_KVM (1UL << 8) 62#define MACHINE_FLAG_KVM (1UL << 8)
64#define MACHINE_FLAG_ESOP (1UL << 9) 63#define MACHINE_FLAG_ESOP (1UL << 9)
65#define MACHINE_FLAG_EDAT1 (1UL << 10) 64#define MACHINE_FLAG_EDAT1 (1UL << 10)
@@ -85,7 +84,6 @@ void create_mem_hole(struct mem_chunk mem_chunk[], unsigned long addr,
85#define MACHINE_HAS_IDTE (0) 84#define MACHINE_HAS_IDTE (0)
86#define MACHINE_HAS_DIAG44 (1) 85#define MACHINE_HAS_DIAG44 (1)
87#define MACHINE_HAS_MVPG (S390_lowcore.machine_flags & MACHINE_FLAG_MVPG) 86#define MACHINE_HAS_MVPG (S390_lowcore.machine_flags & MACHINE_FLAG_MVPG)
88#define MACHINE_HAS_MVCOS (0)
89#define MACHINE_HAS_EDAT1 (0) 87#define MACHINE_HAS_EDAT1 (0)
90#define MACHINE_HAS_EDAT2 (0) 88#define MACHINE_HAS_EDAT2 (0)
91#define MACHINE_HAS_LPP (0) 89#define MACHINE_HAS_LPP (0)
@@ -98,7 +96,6 @@ void create_mem_hole(struct mem_chunk mem_chunk[], unsigned long addr,
98#define MACHINE_HAS_IDTE (S390_lowcore.machine_flags & MACHINE_FLAG_IDTE) 96#define MACHINE_HAS_IDTE (S390_lowcore.machine_flags & MACHINE_FLAG_IDTE)
99#define MACHINE_HAS_DIAG44 (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG44) 97#define MACHINE_HAS_DIAG44 (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG44)
100#define MACHINE_HAS_MVPG (1) 98#define MACHINE_HAS_MVPG (1)
101#define MACHINE_HAS_MVCOS (S390_lowcore.machine_flags & MACHINE_FLAG_MVCOS)
102#define MACHINE_HAS_EDAT1 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT1) 99#define MACHINE_HAS_EDAT1 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT1)
103#define MACHINE_HAS_EDAT2 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT2) 100#define MACHINE_HAS_EDAT2 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT2)
104#define MACHINE_HAS_LPP (S390_lowcore.machine_flags & MACHINE_FLAG_LPP) 101#define MACHINE_HAS_LPP (S390_lowcore.machine_flags & MACHINE_FLAG_LPP)
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h
index 10e0fcd3633d..3ccd71b90345 100644
--- a/arch/s390/include/asm/thread_info.h
+++ b/arch/s390/include/asm/thread_info.h
@@ -81,6 +81,7 @@ static inline struct thread_info *current_thread_info(void)
81#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */ 81#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
82#define TIF_SIGPENDING 2 /* signal pending */ 82#define TIF_SIGPENDING 2 /* signal pending */
83#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 83#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
84#define TIF_TLB_WAIT 4 /* wait for TLB flush completion */
84#define TIF_PER_TRAP 6 /* deliver sigtrap on return to user */ 85#define TIF_PER_TRAP 6 /* deliver sigtrap on return to user */
85#define TIF_MCCK_PENDING 7 /* machine check handling is pending */ 86#define TIF_MCCK_PENDING 7 /* machine check handling is pending */
86#define TIF_SYSCALL_TRACE 8 /* syscall trace active */ 87#define TIF_SYSCALL_TRACE 8 /* syscall trace active */
@@ -91,11 +92,13 @@ static inline struct thread_info *current_thread_info(void)
91#define TIF_MEMDIE 18 /* is terminating due to OOM killer */ 92#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
92#define TIF_RESTORE_SIGMASK 19 /* restore signal mask in do_signal() */ 93#define TIF_RESTORE_SIGMASK 19 /* restore signal mask in do_signal() */
93#define TIF_SINGLE_STEP 20 /* This task is single stepped */ 94#define TIF_SINGLE_STEP 20 /* This task is single stepped */
95#define TIF_BLOCK_STEP 21 /* This task is block stepped */
94 96
95#define _TIF_SYSCALL (1<<TIF_SYSCALL) 97#define _TIF_SYSCALL (1<<TIF_SYSCALL)
96#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) 98#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
97#define _TIF_SIGPENDING (1<<TIF_SIGPENDING) 99#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
98#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 100#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
101#define _TIF_TLB_WAIT (1<<TIF_TLB_WAIT)
99#define _TIF_PER_TRAP (1<<TIF_PER_TRAP) 102#define _TIF_PER_TRAP (1<<TIF_PER_TRAP)
100#define _TIF_MCCK_PENDING (1<<TIF_MCCK_PENDING) 103#define _TIF_MCCK_PENDING (1<<TIF_MCCK_PENDING)
101#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) 104#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h
index 79330af9a5f8..4133b3f72fb0 100644
--- a/arch/s390/include/asm/uaccess.h
+++ b/arch/s390/include/asm/uaccess.h
@@ -92,33 +92,58 @@ static inline unsigned long extable_fixup(const struct exception_table_entry *x)
92#define ARCH_HAS_SORT_EXTABLE 92#define ARCH_HAS_SORT_EXTABLE
93#define ARCH_HAS_SEARCH_EXTABLE 93#define ARCH_HAS_SEARCH_EXTABLE
94 94
95struct uaccess_ops { 95int __handle_fault(unsigned long, unsigned long, int);
96 size_t (*copy_from_user)(size_t, const void __user *, void *);
97 size_t (*copy_to_user)(size_t, void __user *, const void *);
98 size_t (*copy_in_user)(size_t, void __user *, const void __user *);
99 size_t (*clear_user)(size_t, void __user *);
100 size_t (*strnlen_user)(size_t, const char __user *);
101 size_t (*strncpy_from_user)(size_t, const char __user *, char *);
102 int (*futex_atomic_op)(int op, u32 __user *, int oparg, int *old);
103 int (*futex_atomic_cmpxchg)(u32 *, u32 __user *, u32 old, u32 new);
104};
105 96
106extern struct uaccess_ops uaccess; 97/**
107extern struct uaccess_ops uaccess_mvcos; 98 * __copy_from_user: - Copy a block of data from user space, with less checking.
108extern struct uaccess_ops uaccess_pt; 99 * @to: Destination address, in kernel space.
100 * @from: Source address, in user space.
101 * @n: Number of bytes to copy.
102 *
103 * Context: User context only. This function may sleep.
104 *
105 * Copy data from user space to kernel space. Caller must check
106 * the specified block with access_ok() before calling this function.
107 *
108 * Returns number of bytes that could not be copied.
109 * On success, this will be zero.
110 *
111 * If some data could not be copied, this function will pad the copied
112 * data to the requested size using zero bytes.
113 */
114unsigned long __must_check __copy_from_user(void *to, const void __user *from,
115 unsigned long n);
116
117/**
118 * __copy_to_user: - Copy a block of data into user space, with less checking.
119 * @to: Destination address, in user space.
120 * @from: Source address, in kernel space.
121 * @n: Number of bytes to copy.
122 *
123 * Context: User context only. This function may sleep.
124 *
125 * Copy data from kernel space to user space. Caller must check
126 * the specified block with access_ok() before calling this function.
127 *
128 * Returns number of bytes that could not be copied.
129 * On success, this will be zero.
130 */
131unsigned long __must_check __copy_to_user(void __user *to, const void *from,
132 unsigned long n);
109 133
110extern int __handle_fault(unsigned long, unsigned long, int); 134#define __copy_to_user_inatomic __copy_to_user
135#define __copy_from_user_inatomic __copy_from_user
111 136
112static inline int __put_user_fn(size_t size, void __user *ptr, void *x) 137static inline int __put_user_fn(void *x, void __user *ptr, unsigned long size)
113{ 138{
114 size = uaccess.copy_to_user(size, ptr, x); 139 size = __copy_to_user(ptr, x, size);
115 return size ? -EFAULT : size; 140 return size ? -EFAULT : 0;
116} 141}
117 142
118static inline int __get_user_fn(size_t size, const void __user *ptr, void *x) 143static inline int __get_user_fn(void *x, const void __user *ptr, unsigned long size)
119{ 144{
120 size = uaccess.copy_from_user(size, ptr, x); 145 size = __copy_from_user(x, ptr, size);
121 return size ? -EFAULT : size; 146 return size ? -EFAULT : 0;
122} 147}
123 148
124/* 149/*
@@ -135,8 +160,8 @@ static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
135 case 2: \ 160 case 2: \
136 case 4: \ 161 case 4: \
137 case 8: \ 162 case 8: \
138 __pu_err = __put_user_fn(sizeof (*(ptr)), \ 163 __pu_err = __put_user_fn(&__x, ptr, \
139 ptr, &__x); \ 164 sizeof(*(ptr))); \
140 break; \ 165 break; \
141 default: \ 166 default: \
142 __put_user_bad(); \ 167 __put_user_bad(); \
@@ -152,7 +177,7 @@ static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
152}) 177})
153 178
154 179
155extern int __put_user_bad(void) __attribute__((noreturn)); 180int __put_user_bad(void) __attribute__((noreturn));
156 181
157#define __get_user(x, ptr) \ 182#define __get_user(x, ptr) \
158({ \ 183({ \
@@ -161,29 +186,29 @@ extern int __put_user_bad(void) __attribute__((noreturn));
161 switch (sizeof(*(ptr))) { \ 186 switch (sizeof(*(ptr))) { \
162 case 1: { \ 187 case 1: { \
163 unsigned char __x; \ 188 unsigned char __x; \
164 __gu_err = __get_user_fn(sizeof (*(ptr)), \ 189 __gu_err = __get_user_fn(&__x, ptr, \
165 ptr, &__x); \ 190 sizeof(*(ptr))); \
166 (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 191 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
167 break; \ 192 break; \
168 }; \ 193 }; \
169 case 2: { \ 194 case 2: { \
170 unsigned short __x; \ 195 unsigned short __x; \
171 __gu_err = __get_user_fn(sizeof (*(ptr)), \ 196 __gu_err = __get_user_fn(&__x, ptr, \
172 ptr, &__x); \ 197 sizeof(*(ptr))); \
173 (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 198 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
174 break; \ 199 break; \
175 }; \ 200 }; \
176 case 4: { \ 201 case 4: { \
177 unsigned int __x; \ 202 unsigned int __x; \
178 __gu_err = __get_user_fn(sizeof (*(ptr)), \ 203 __gu_err = __get_user_fn(&__x, ptr, \
179 ptr, &__x); \ 204 sizeof(*(ptr))); \
180 (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 205 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
181 break; \ 206 break; \
182 }; \ 207 }; \
183 case 8: { \ 208 case 8: { \
184 unsigned long long __x; \ 209 unsigned long long __x; \
185 __gu_err = __get_user_fn(sizeof (*(ptr)), \ 210 __gu_err = __get_user_fn(&__x, ptr, \
186 ptr, &__x); \ 211 sizeof(*(ptr))); \
187 (x) = *(__force __typeof__(*(ptr)) *) &__x; \ 212 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
188 break; \ 213 break; \
189 }; \ 214 }; \
@@ -200,35 +225,12 @@ extern int __put_user_bad(void) __attribute__((noreturn));
200 __get_user(x, ptr); \ 225 __get_user(x, ptr); \
201}) 226})
202 227
203extern int __get_user_bad(void) __attribute__((noreturn)); 228int __get_user_bad(void) __attribute__((noreturn));
204 229
205#define __put_user_unaligned __put_user 230#define __put_user_unaligned __put_user
206#define __get_user_unaligned __get_user 231#define __get_user_unaligned __get_user
207 232
208/** 233/**
209 * __copy_to_user: - Copy a block of data into user space, with less checking.
210 * @to: Destination address, in user space.
211 * @from: Source address, in kernel space.
212 * @n: Number of bytes to copy.
213 *
214 * Context: User context only. This function may sleep.
215 *
216 * Copy data from kernel space to user space. Caller must check
217 * the specified block with access_ok() before calling this function.
218 *
219 * Returns number of bytes that could not be copied.
220 * On success, this will be zero.
221 */
222static inline unsigned long __must_check
223__copy_to_user(void __user *to, const void *from, unsigned long n)
224{
225 return uaccess.copy_to_user(n, to, from);
226}
227
228#define __copy_to_user_inatomic __copy_to_user
229#define __copy_from_user_inatomic __copy_from_user
230
231/**
232 * copy_to_user: - Copy a block of data into user space. 234 * copy_to_user: - Copy a block of data into user space.
233 * @to: Destination address, in user space. 235 * @to: Destination address, in user space.
234 * @from: Source address, in kernel space. 236 * @from: Source address, in kernel space.
@@ -248,30 +250,7 @@ copy_to_user(void __user *to, const void *from, unsigned long n)
248 return __copy_to_user(to, from, n); 250 return __copy_to_user(to, from, n);
249} 251}
250 252
251/** 253void copy_from_user_overflow(void)
252 * __copy_from_user: - Copy a block of data from user space, with less checking.
253 * @to: Destination address, in kernel space.
254 * @from: Source address, in user space.
255 * @n: Number of bytes to copy.
256 *
257 * Context: User context only. This function may sleep.
258 *
259 * Copy data from user space to kernel space. Caller must check
260 * the specified block with access_ok() before calling this function.
261 *
262 * Returns number of bytes that could not be copied.
263 * On success, this will be zero.
264 *
265 * If some data could not be copied, this function will pad the copied
266 * data to the requested size using zero bytes.
267 */
268static inline unsigned long __must_check
269__copy_from_user(void *to, const void __user *from, unsigned long n)
270{
271 return uaccess.copy_from_user(n, from, to);
272}
273
274extern void copy_from_user_overflow(void)
275#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS 254#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
276__compiletime_warning("copy_from_user() buffer size is not provably correct") 255__compiletime_warning("copy_from_user() buffer size is not provably correct")
277#endif 256#endif
@@ -306,11 +285,8 @@ copy_from_user(void *to, const void __user *from, unsigned long n)
306 return __copy_from_user(to, from, n); 285 return __copy_from_user(to, from, n);
307} 286}
308 287
309static inline unsigned long __must_check 288unsigned long __must_check
310__copy_in_user(void __user *to, const void __user *from, unsigned long n) 289__copy_in_user(void __user *to, const void __user *from, unsigned long n);
311{
312 return uaccess.copy_in_user(n, to, from);
313}
314 290
315static inline unsigned long __must_check 291static inline unsigned long __must_check
316copy_in_user(void __user *to, const void __user *from, unsigned long n) 292copy_in_user(void __user *to, const void __user *from, unsigned long n)
@@ -322,18 +298,22 @@ copy_in_user(void __user *to, const void __user *from, unsigned long n)
322/* 298/*
323 * Copy a null terminated string from userspace. 299 * Copy a null terminated string from userspace.
324 */ 300 */
301
302long __strncpy_from_user(char *dst, const char __user *src, long count);
303
325static inline long __must_check 304static inline long __must_check
326strncpy_from_user(char *dst, const char __user *src, long count) 305strncpy_from_user(char *dst, const char __user *src, long count)
327{ 306{
328 might_fault(); 307 might_fault();
329 return uaccess.strncpy_from_user(count, src, dst); 308 return __strncpy_from_user(dst, src, count);
330} 309}
331 310
332static inline unsigned long 311unsigned long __must_check __strnlen_user(const char __user *src, unsigned long count);
333strnlen_user(const char __user * src, unsigned long n) 312
313static inline unsigned long strnlen_user(const char __user *src, unsigned long n)
334{ 314{
335 might_fault(); 315 might_fault();
336 return uaccess.strnlen_user(n, src); 316 return __strnlen_user(src, n);
337} 317}
338 318
339/** 319/**
@@ -355,21 +335,14 @@ strnlen_user(const char __user * src, unsigned long n)
355/* 335/*
356 * Zero Userspace 336 * Zero Userspace
357 */ 337 */
338unsigned long __must_check __clear_user(void __user *to, unsigned long size);
358 339
359static inline unsigned long __must_check 340static inline unsigned long __must_check clear_user(void __user *to, unsigned long n)
360__clear_user(void __user *to, unsigned long n)
361{
362 return uaccess.clear_user(n, to);
363}
364
365static inline unsigned long __must_check
366clear_user(void __user *to, unsigned long n)
367{ 341{
368 might_fault(); 342 might_fault();
369 return uaccess.clear_user(n, to); 343 return __clear_user(to, n);
370} 344}
371 345
372extern int copy_to_user_real(void __user *dest, void *src, size_t count); 346int copy_to_user_real(void __user *dest, void *src, unsigned long count);
373extern int copy_from_user_real(void *dest, void __user *src, size_t count);
374 347
375#endif /* __S390_UACCESS_H */ 348#endif /* __S390_UACCESS_H */
diff --git a/arch/s390/include/uapi/asm/ptrace.h b/arch/s390/include/uapi/asm/ptrace.h
index 7e0b498a2c2b..a150f4fabe43 100644
--- a/arch/s390/include/uapi/asm/ptrace.h
+++ b/arch/s390/include/uapi/asm/ptrace.h
@@ -403,6 +403,12 @@ typedef struct
403#define PTRACE_TE_ABORT_RAND 0x5011 403#define PTRACE_TE_ABORT_RAND 0x5011
404 404
405/* 405/*
406 * The numbers chosen here are somewhat arbitrary but absolutely MUST
407 * not overlap with any of the number assigned in <linux/ptrace.h>.
408 */
409#define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */
410
411/*
406 * PT_PROT definition is loosely based on hppa bsd definition in 412 * PT_PROT definition is loosely based on hppa bsd definition in
407 * gdb/hppab-nat.c 413 * gdb/hppab-nat.c
408 */ 414 */
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 1b3ac09c11b6..a95c4ca99617 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -47,9 +47,8 @@ obj-$(CONFIG_SCHED_BOOK) += topology.o
47obj-$(CONFIG_HIBERNATION) += suspend.o swsusp_asm64.o 47obj-$(CONFIG_HIBERNATION) += suspend.o swsusp_asm64.o
48obj-$(CONFIG_AUDIT) += audit.o 48obj-$(CONFIG_AUDIT) += audit.o
49compat-obj-$(CONFIG_AUDIT) += compat_audit.o 49compat-obj-$(CONFIG_AUDIT) += compat_audit.o
50obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o \ 50obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o
51 compat_wrapper.o compat_exec_domain.o \ 51obj-$(CONFIG_COMPAT) += compat_wrapper.o $(compat-obj-y)
52 $(compat-obj-y)
53 52
54obj-$(CONFIG_STACKTRACE) += stacktrace.o 53obj-$(CONFIG_STACKTRACE) += stacktrace.o
55obj-$(CONFIG_KPROBES) += kprobes.o 54obj-$(CONFIG_KPROBES) += kprobes.o
diff --git a/arch/s390/kernel/compat_exec_domain.c b/arch/s390/kernel/compat_exec_domain.c
deleted file mode 100644
index 765fabdada9f..000000000000
--- a/arch/s390/kernel/compat_exec_domain.c
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Support for 32-bit Linux for S390 personality.
3 *
4 * Copyright IBM Corp. 2000
5 * Author(s): Gerhard Tonn (ton@de.ibm.com)
6 *
7 *
8 */
9
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/personality.h>
13#include <linux/sched.h>
14
15static struct exec_domain s390_exec_domain;
16
17static int __init s390_init (void)
18{
19 s390_exec_domain.name = "Linux/s390";
20 s390_exec_domain.handler = NULL;
21 s390_exec_domain.pers_low = PER_LINUX32;
22 s390_exec_domain.pers_high = PER_LINUX32;
23 s390_exec_domain.signal_map = default_exec_domain.signal_map;
24 s390_exec_domain.signal_invmap = default_exec_domain.signal_invmap;
25 register_exec_domain(&s390_exec_domain);
26 return 0;
27}
28
29__initcall(s390_init);
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index db02052bd137..ca38139423ae 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -86,48 +86,51 @@
86#define SET_STAT_UID(stat, uid) (stat).st_uid = high2lowuid(uid) 86#define SET_STAT_UID(stat, uid) (stat).st_uid = high2lowuid(uid)
87#define SET_STAT_GID(stat, gid) (stat).st_gid = high2lowgid(gid) 87#define SET_STAT_GID(stat, gid) (stat).st_gid = high2lowgid(gid)
88 88
89asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group) 89COMPAT_SYSCALL_DEFINE3(s390_chown16, const char __user *, filename,
90 u16, user, u16, group)
90{ 91{
91 return sys_chown(filename, low2highuid(user), low2highgid(group)); 92 return sys_chown(filename, low2highuid(user), low2highgid(group));
92} 93}
93 94
94asmlinkage long sys32_lchown16(const char __user * filename, u16 user, u16 group) 95COMPAT_SYSCALL_DEFINE3(s390_lchown16, const char __user *,
96 filename, u16, user, u16, group)
95{ 97{
96 return sys_lchown(filename, low2highuid(user), low2highgid(group)); 98 return sys_lchown(filename, low2highuid(user), low2highgid(group));
97} 99}
98 100
99asmlinkage long sys32_fchown16(unsigned int fd, u16 user, u16 group) 101COMPAT_SYSCALL_DEFINE3(s390_fchown16, unsigned int, fd, u16, user, u16, group)
100{ 102{
101 return sys_fchown(fd, low2highuid(user), low2highgid(group)); 103 return sys_fchown(fd, low2highuid(user), low2highgid(group));
102} 104}
103 105
104asmlinkage long sys32_setregid16(u16 rgid, u16 egid) 106COMPAT_SYSCALL_DEFINE2(s390_setregid16, u16, rgid, u16, egid)
105{ 107{
106 return sys_setregid(low2highgid(rgid), low2highgid(egid)); 108 return sys_setregid(low2highgid(rgid), low2highgid(egid));
107} 109}
108 110
109asmlinkage long sys32_setgid16(u16 gid) 111COMPAT_SYSCALL_DEFINE1(s390_setgid16, u16, gid)
110{ 112{
111 return sys_setgid((gid_t)gid); 113 return sys_setgid((gid_t)gid);
112} 114}
113 115
114asmlinkage long sys32_setreuid16(u16 ruid, u16 euid) 116COMPAT_SYSCALL_DEFINE2(s390_setreuid16, u16, ruid, u16, euid)
115{ 117{
116 return sys_setreuid(low2highuid(ruid), low2highuid(euid)); 118 return sys_setreuid(low2highuid(ruid), low2highuid(euid));
117} 119}
118 120
119asmlinkage long sys32_setuid16(u16 uid) 121COMPAT_SYSCALL_DEFINE1(s390_setuid16, u16, uid)
120{ 122{
121 return sys_setuid((uid_t)uid); 123 return sys_setuid((uid_t)uid);
122} 124}
123 125
124asmlinkage long sys32_setresuid16(u16 ruid, u16 euid, u16 suid) 126COMPAT_SYSCALL_DEFINE3(s390_setresuid16, u16, ruid, u16, euid, u16, suid)
125{ 127{
126 return sys_setresuid(low2highuid(ruid), low2highuid(euid), 128 return sys_setresuid(low2highuid(ruid), low2highuid(euid),
127 low2highuid(suid)); 129 low2highuid(suid));
128} 130}
129 131
130asmlinkage long sys32_getresuid16(u16 __user *ruidp, u16 __user *euidp, u16 __user *suidp) 132COMPAT_SYSCALL_DEFINE3(s390_getresuid16, u16 __user *, ruidp,
133 u16 __user *, euidp, u16 __user *, suidp)
131{ 134{
132 const struct cred *cred = current_cred(); 135 const struct cred *cred = current_cred();
133 int retval; 136 int retval;
@@ -144,13 +147,14 @@ asmlinkage long sys32_getresuid16(u16 __user *ruidp, u16 __user *euidp, u16 __us
144 return retval; 147 return retval;
145} 148}
146 149
147asmlinkage long sys32_setresgid16(u16 rgid, u16 egid, u16 sgid) 150COMPAT_SYSCALL_DEFINE3(s390_setresgid16, u16, rgid, u16, egid, u16, sgid)
148{ 151{
149 return sys_setresgid(low2highgid(rgid), low2highgid(egid), 152 return sys_setresgid(low2highgid(rgid), low2highgid(egid),
150 low2highgid(sgid)); 153 low2highgid(sgid));
151} 154}
152 155
153asmlinkage long sys32_getresgid16(u16 __user *rgidp, u16 __user *egidp, u16 __user *sgidp) 156COMPAT_SYSCALL_DEFINE3(s390_getresgid16, u16 __user *, rgidp,
157 u16 __user *, egidp, u16 __user *, sgidp)
154{ 158{
155 const struct cred *cred = current_cred(); 159 const struct cred *cred = current_cred();
156 int retval; 160 int retval;
@@ -167,12 +171,12 @@ asmlinkage long sys32_getresgid16(u16 __user *rgidp, u16 __user *egidp, u16 __us
167 return retval; 171 return retval;
168} 172}
169 173
170asmlinkage long sys32_setfsuid16(u16 uid) 174COMPAT_SYSCALL_DEFINE1(s390_setfsuid16, u16, uid)
171{ 175{
172 return sys_setfsuid((uid_t)uid); 176 return sys_setfsuid((uid_t)uid);
173} 177}
174 178
175asmlinkage long sys32_setfsgid16(u16 gid) 179COMPAT_SYSCALL_DEFINE1(s390_setfsgid16, u16, gid)
176{ 180{
177 return sys_setfsgid((gid_t)gid); 181 return sys_setfsgid((gid_t)gid);
178} 182}
@@ -215,7 +219,7 @@ static int groups16_from_user(struct group_info *group_info, u16 __user *groupli
215 return 0; 219 return 0;
216} 220}
217 221
218asmlinkage long sys32_getgroups16(int gidsetsize, u16 __user *grouplist) 222COMPAT_SYSCALL_DEFINE2(s390_getgroups16, int, gidsetsize, u16 __user *, grouplist)
219{ 223{
220 const struct cred *cred = current_cred(); 224 const struct cred *cred = current_cred();
221 int i; 225 int i;
@@ -240,7 +244,7 @@ out:
240 return i; 244 return i;
241} 245}
242 246
243asmlinkage long sys32_setgroups16(int gidsetsize, u16 __user *grouplist) 247COMPAT_SYSCALL_DEFINE2(s390_setgroups16, int, gidsetsize, u16 __user *, grouplist)
244{ 248{
245 struct group_info *group_info; 249 struct group_info *group_info;
246 int retval; 250 int retval;
@@ -265,22 +269,22 @@ asmlinkage long sys32_setgroups16(int gidsetsize, u16 __user *grouplist)
265 return retval; 269 return retval;
266} 270}
267 271
268asmlinkage long sys32_getuid16(void) 272COMPAT_SYSCALL_DEFINE0(s390_getuid16)
269{ 273{
270 return high2lowuid(from_kuid_munged(current_user_ns(), current_uid())); 274 return high2lowuid(from_kuid_munged(current_user_ns(), current_uid()));
271} 275}
272 276
273asmlinkage long sys32_geteuid16(void) 277COMPAT_SYSCALL_DEFINE0(s390_geteuid16)
274{ 278{
275 return high2lowuid(from_kuid_munged(current_user_ns(), current_euid())); 279 return high2lowuid(from_kuid_munged(current_user_ns(), current_euid()));
276} 280}
277 281
278asmlinkage long sys32_getgid16(void) 282COMPAT_SYSCALL_DEFINE0(s390_getgid16)
279{ 283{
280 return high2lowgid(from_kgid_munged(current_user_ns(), current_gid())); 284 return high2lowgid(from_kgid_munged(current_user_ns(), current_gid()));
281} 285}
282 286
283asmlinkage long sys32_getegid16(void) 287COMPAT_SYSCALL_DEFINE0(s390_getegid16)
284{ 288{
285 return high2lowgid(from_kgid_munged(current_user_ns(), current_egid())); 289 return high2lowgid(from_kgid_munged(current_user_ns(), current_egid()));
286} 290}
@@ -295,41 +299,35 @@ COMPAT_SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, compat_ulong_t, second,
295} 299}
296#endif 300#endif
297 301
298asmlinkage long sys32_truncate64(const char __user * path, unsigned long high, unsigned long low) 302COMPAT_SYSCALL_DEFINE3(s390_truncate64, const char __user *, path, u32, high, u32, low)
299{ 303{
300 if ((int)high < 0) 304 return sys_truncate(path, (unsigned long)high << 32 | low);
301 return -EINVAL;
302 else
303 return sys_truncate(path, (high << 32) | low);
304} 305}
305 306
306asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low) 307COMPAT_SYSCALL_DEFINE3(s390_ftruncate64, unsigned int, fd, u32, high, u32, low)
307{ 308{
308 if ((int)high < 0) 309 return sys_ftruncate(fd, (unsigned long)high << 32 | low);
309 return -EINVAL;
310 else
311 return sys_ftruncate(fd, (high << 32) | low);
312} 310}
313 311
314asmlinkage long sys32_pread64(unsigned int fd, char __user *ubuf, 312COMPAT_SYSCALL_DEFINE5(s390_pread64, unsigned int, fd, char __user *, ubuf,
315 size_t count, u32 poshi, u32 poslo) 313 compat_size_t, count, u32, high, u32, low)
316{ 314{
317 if ((compat_ssize_t) count < 0) 315 if ((compat_ssize_t) count < 0)
318 return -EINVAL; 316 return -EINVAL;
319 return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); 317 return sys_pread64(fd, ubuf, count, (unsigned long)high << 32 | low);
320} 318}
321 319
322asmlinkage long sys32_pwrite64(unsigned int fd, const char __user *ubuf, 320COMPAT_SYSCALL_DEFINE5(s390_pwrite64, unsigned int, fd, const char __user *, ubuf,
323 size_t count, u32 poshi, u32 poslo) 321 compat_size_t, count, u32, high, u32, low)
324{ 322{
325 if ((compat_ssize_t) count < 0) 323 if ((compat_ssize_t) count < 0)
326 return -EINVAL; 324 return -EINVAL;
327 return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); 325 return sys_pwrite64(fd, ubuf, count, (unsigned long)high << 32 | low);
328} 326}
329 327
330asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count) 328COMPAT_SYSCALL_DEFINE4(s390_readahead, int, fd, u32, high, u32, low, s32, count)
331{ 329{
332 return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count); 330 return sys_readahead(fd, (unsigned long)high << 32 | low, count);
333} 331}
334 332
335struct stat64_emu31 { 333struct stat64_emu31 {
@@ -381,7 +379,7 @@ static int cp_stat64(struct stat64_emu31 __user *ubuf, struct kstat *stat)
381 return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 379 return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
382} 380}
383 381
384asmlinkage long sys32_stat64(const char __user * filename, struct stat64_emu31 __user * statbuf) 382COMPAT_SYSCALL_DEFINE2(s390_stat64, const char __user *, filename, struct stat64_emu31 __user *, statbuf)
385{ 383{
386 struct kstat stat; 384 struct kstat stat;
387 int ret = vfs_stat(filename, &stat); 385 int ret = vfs_stat(filename, &stat);
@@ -390,7 +388,7 @@ asmlinkage long sys32_stat64(const char __user * filename, struct stat64_emu31 _
390 return ret; 388 return ret;
391} 389}
392 390
393asmlinkage long sys32_lstat64(const char __user * filename, struct stat64_emu31 __user * statbuf) 391COMPAT_SYSCALL_DEFINE2(s390_lstat64, const char __user *, filename, struct stat64_emu31 __user *, statbuf)
394{ 392{
395 struct kstat stat; 393 struct kstat stat;
396 int ret = vfs_lstat(filename, &stat); 394 int ret = vfs_lstat(filename, &stat);
@@ -399,7 +397,7 @@ asmlinkage long sys32_lstat64(const char __user * filename, struct stat64_emu31
399 return ret; 397 return ret;
400} 398}
401 399
402asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * statbuf) 400COMPAT_SYSCALL_DEFINE2(s390_fstat64, unsigned int, fd, struct stat64_emu31 __user *, statbuf)
403{ 401{
404 struct kstat stat; 402 struct kstat stat;
405 int ret = vfs_fstat(fd, &stat); 403 int ret = vfs_fstat(fd, &stat);
@@ -408,8 +406,8 @@ asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * sta
408 return ret; 406 return ret;
409} 407}
410 408
411asmlinkage long sys32_fstatat64(unsigned int dfd, const char __user *filename, 409COMPAT_SYSCALL_DEFINE4(s390_fstatat64, unsigned int, dfd, const char __user *, filename,
412 struct stat64_emu31 __user* statbuf, int flag) 410 struct stat64_emu31 __user *, statbuf, int, flag)
413{ 411{
414 struct kstat stat; 412 struct kstat stat;
415 int error; 413 int error;
@@ -435,7 +433,7 @@ struct mmap_arg_struct_emu31 {
435 compat_ulong_t offset; 433 compat_ulong_t offset;
436}; 434};
437 435
438asmlinkage unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg) 436COMPAT_SYSCALL_DEFINE1(s390_old_mmap, struct mmap_arg_struct_emu31 __user *, arg)
439{ 437{
440 struct mmap_arg_struct_emu31 a; 438 struct mmap_arg_struct_emu31 a;
441 439
@@ -447,7 +445,7 @@ asmlinkage unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
447 a.offset >> PAGE_SHIFT); 445 a.offset >> PAGE_SHIFT);
448} 446}
449 447
450asmlinkage long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg) 448COMPAT_SYSCALL_DEFINE1(s390_mmap2, struct mmap_arg_struct_emu31 __user *, arg)
451{ 449{
452 struct mmap_arg_struct_emu31 a; 450 struct mmap_arg_struct_emu31 a;
453 451
@@ -456,7 +454,7 @@ asmlinkage long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
456 return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); 454 return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
457} 455}
458 456
459asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count) 457COMPAT_SYSCALL_DEFINE3(s390_read, unsigned int, fd, char __user *, buf, compat_size_t, count)
460{ 458{
461 if ((compat_ssize_t) count < 0) 459 if ((compat_ssize_t) count < 0)
462 return -EINVAL; 460 return -EINVAL;
@@ -464,7 +462,7 @@ asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count)
464 return sys_read(fd, buf, count); 462 return sys_read(fd, buf, count);
465} 463}
466 464
467asmlinkage long sys32_write(unsigned int fd, const char __user * buf, size_t count) 465COMPAT_SYSCALL_DEFINE3(s390_write, unsigned int, fd, const char __user *, buf, compat_size_t, count)
468{ 466{
469 if ((compat_ssize_t) count < 0) 467 if ((compat_ssize_t) count < 0)
470 return -EINVAL; 468 return -EINVAL;
@@ -478,14 +476,13 @@ asmlinkage long sys32_write(unsigned int fd, const char __user * buf, size_t cou
478 * because the 31 bit values differ from the 64 bit values. 476 * because the 31 bit values differ from the 64 bit values.
479 */ 477 */
480 478
481asmlinkage long 479COMPAT_SYSCALL_DEFINE5(s390_fadvise64, int, fd, u32, high, u32, low, compat_size_t, len, int, advise)
482sys32_fadvise64(int fd, loff_t offset, size_t len, int advise)
483{ 480{
484 if (advise == 4) 481 if (advise == 4)
485 advise = POSIX_FADV_DONTNEED; 482 advise = POSIX_FADV_DONTNEED;
486 else if (advise == 5) 483 else if (advise == 5)
487 advise = POSIX_FADV_NOREUSE; 484 advise = POSIX_FADV_NOREUSE;
488 return sys_fadvise64(fd, offset, len, advise); 485 return sys_fadvise64(fd, (unsigned long)high << 32 | low, len, advise);
489} 486}
490 487
491struct fadvise64_64_args { 488struct fadvise64_64_args {
@@ -495,8 +492,7 @@ struct fadvise64_64_args {
495 int advice; 492 int advice;
496}; 493};
497 494
498asmlinkage long 495COMPAT_SYSCALL_DEFINE1(s390_fadvise64_64, struct fadvise64_64_args __user *, args)
499sys32_fadvise64_64(struct fadvise64_64_args __user *args)
500{ 496{
501 struct fadvise64_64_args a; 497 struct fadvise64_64_args a;
502 498
@@ -508,3 +504,17 @@ sys32_fadvise64_64(struct fadvise64_64_args __user *args)
508 a.advice = POSIX_FADV_NOREUSE; 504 a.advice = POSIX_FADV_NOREUSE;
509 return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice); 505 return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice);
510} 506}
507
508COMPAT_SYSCALL_DEFINE6(s390_sync_file_range, int, fd, u32, offhigh, u32, offlow,
509 u32, nhigh, u32, nlow, unsigned int, flags)
510{
511 return sys_sync_file_range(fd, ((loff_t)offhigh << 32) + offlow,
512 ((u64)nhigh << 32) + nlow, flags);
513}
514
515COMPAT_SYSCALL_DEFINE6(s390_fallocate, int, fd, int, mode, u32, offhigh, u32, offlow,
516 u32, lenhigh, u32, lenlow)
517{
518 return sys_fallocate(fd, mode, ((loff_t)offhigh << 32) + offlow,
519 ((u64)lenhigh << 32) + lenlow);
520}
diff --git a/arch/s390/kernel/compat_linux.h b/arch/s390/kernel/compat_linux.h
index 1bfda3eca379..39ddfdb40ae8 100644
--- a/arch/s390/kernel/compat_linux.h
+++ b/arch/s390/kernel/compat_linux.h
@@ -76,46 +76,43 @@ struct stat64_emu31;
76struct mmap_arg_struct_emu31; 76struct mmap_arg_struct_emu31;
77struct fadvise64_64_args; 77struct fadvise64_64_args;
78 78
79long sys32_chown16(const char __user * filename, u16 user, u16 group); 79long compat_sys_s390_chown16(const char __user *filename, u16 user, u16 group);
80long sys32_lchown16(const char __user * filename, u16 user, u16 group); 80long compat_sys_s390_lchown16(const char __user *filename, u16 user, u16 group);
81long sys32_fchown16(unsigned int fd, u16 user, u16 group); 81long compat_sys_s390_fchown16(unsigned int fd, u16 user, u16 group);
82long sys32_setregid16(u16 rgid, u16 egid); 82long compat_sys_s390_setregid16(u16 rgid, u16 egid);
83long sys32_setgid16(u16 gid); 83long compat_sys_s390_setgid16(u16 gid);
84long sys32_setreuid16(u16 ruid, u16 euid); 84long compat_sys_s390_setreuid16(u16 ruid, u16 euid);
85long sys32_setuid16(u16 uid); 85long compat_sys_s390_setuid16(u16 uid);
86long sys32_setresuid16(u16 ruid, u16 euid, u16 suid); 86long compat_sys_s390_setresuid16(u16 ruid, u16 euid, u16 suid);
87long sys32_getresuid16(u16 __user *ruid, u16 __user *euid, u16 __user *suid); 87long compat_sys_s390_getresuid16(u16 __user *ruid, u16 __user *euid, u16 __user *suid);
88long sys32_setresgid16(u16 rgid, u16 egid, u16 sgid); 88long compat_sys_s390_setresgid16(u16 rgid, u16 egid, u16 sgid);
89long sys32_getresgid16(u16 __user *rgid, u16 __user *egid, u16 __user *sgid); 89long compat_sys_s390_getresgid16(u16 __user *rgid, u16 __user *egid, u16 __user *sgid);
90long sys32_setfsuid16(u16 uid); 90long compat_sys_s390_setfsuid16(u16 uid);
91long sys32_setfsgid16(u16 gid); 91long compat_sys_s390_setfsgid16(u16 gid);
92long sys32_getgroups16(int gidsetsize, u16 __user *grouplist); 92long compat_sys_s390_getgroups16(int gidsetsize, u16 __user *grouplist);
93long sys32_setgroups16(int gidsetsize, u16 __user *grouplist); 93long compat_sys_s390_setgroups16(int gidsetsize, u16 __user *grouplist);
94long sys32_getuid16(void); 94long compat_sys_s390_getuid16(void);
95long sys32_geteuid16(void); 95long compat_sys_s390_geteuid16(void);
96long sys32_getgid16(void); 96long compat_sys_s390_getgid16(void);
97long sys32_getegid16(void); 97long compat_sys_s390_getegid16(void);
98long sys32_truncate64(const char __user * path, unsigned long high, 98long compat_sys_s390_truncate64(const char __user *path, u32 high, u32 low);
99 unsigned long low); 99long compat_sys_s390_ftruncate64(unsigned int fd, u32 high, u32 low);
100long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low); 100long compat_sys_s390_pread64(unsigned int fd, char __user *ubuf, compat_size_t count, u32 high, u32 low);
101long sys32_init_module(void __user *umod, unsigned long len, 101long compat_sys_s390_pwrite64(unsigned int fd, const char __user *ubuf, compat_size_t count, u32 high, u32 low);
102 const char __user *uargs); 102long compat_sys_s390_readahead(int fd, u32 high, u32 low, s32 count);
103long sys32_delete_module(const char __user *name_user, unsigned int flags); 103long compat_sys_s390_stat64(const char __user *filename, struct stat64_emu31 __user *statbuf);
104long sys32_pread64(unsigned int fd, char __user *ubuf, size_t count, 104long compat_sys_s390_lstat64(const char __user *filename, struct stat64_emu31 __user *statbuf);
105 u32 poshi, u32 poslo); 105long compat_sys_s390_fstat64(unsigned int fd, struct stat64_emu31 __user *statbuf);
106long sys32_pwrite64(unsigned int fd, const char __user *ubuf, 106long compat_sys_s390_fstatat64(unsigned int dfd, const char __user *filename, struct stat64_emu31 __user *statbuf, int flag);
107 size_t count, u32 poshi, u32 poslo); 107long compat_sys_s390_old_mmap(struct mmap_arg_struct_emu31 __user *arg);
108compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count); 108long compat_sys_s390_mmap2(struct mmap_arg_struct_emu31 __user *arg);
109long sys32_stat64(const char __user * filename, struct stat64_emu31 __user * statbuf); 109long compat_sys_s390_read(unsigned int fd, char __user * buf, compat_size_t count);
110long sys32_lstat64(const char __user * filename, 110long compat_sys_s390_write(unsigned int fd, const char __user * buf, compat_size_t count);
111 struct stat64_emu31 __user * statbuf); 111long compat_sys_s390_fadvise64(int fd, u32 high, u32 low, compat_size_t len, int advise);
112long sys32_fstat64(unsigned long fd, struct stat64_emu31 __user * statbuf); 112long compat_sys_s390_fadvise64_64(struct fadvise64_64_args __user *args);
113long sys32_fstatat64(unsigned int dfd, const char __user *filename, 113long compat_sys_s390_sync_file_range(int fd, u32 offhigh, u32 offlow, u32 nhigh, u32 nlow, unsigned int flags);
114 struct stat64_emu31 __user* statbuf, int flag); 114long compat_sys_s390_fallocate(int fd, int mode, u32 offhigh, u32 offlow, u32 lenhigh, u32 lenlow);
115unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg); 115long compat_sys_sigreturn(void);
116long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg); 116long compat_sys_rt_sigreturn(void);
117long sys32_read(unsigned int fd, char __user * buf, size_t count); 117
118long sys32_write(unsigned int fd, const char __user * buf, size_t count);
119long sys32_fadvise64(int fd, loff_t offset, size_t len, int advise);
120long sys32_fadvise64_64(struct fadvise64_64_args __user *args);
121#endif /* _ASM_S390X_S390_H */ 118#endif /* _ASM_S390X_S390_H */
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index 8b84bc373e94..7df5ed9f44d7 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -241,7 +241,7 @@ static int restore_sigregs_gprs_high(struct pt_regs *regs, __u32 __user *uregs)
241 return 0; 241 return 0;
242} 242}
243 243
244asmlinkage long sys32_sigreturn(void) 244COMPAT_SYSCALL_DEFINE0(sigreturn)
245{ 245{
246 struct pt_regs *regs = task_pt_regs(current); 246 struct pt_regs *regs = task_pt_regs(current);
247 sigframe32 __user *frame = (sigframe32 __user *)regs->gprs[15]; 247 sigframe32 __user *frame = (sigframe32 __user *)regs->gprs[15];
@@ -260,7 +260,7 @@ badframe:
260 return 0; 260 return 0;
261} 261}
262 262
263asmlinkage long sys32_rt_sigreturn(void) 263COMPAT_SYSCALL_DEFINE0(rt_sigreturn)
264{ 264{
265 struct pt_regs *regs = task_pt_regs(current); 265 struct pt_regs *regs = task_pt_regs(current);
266 rt_sigframe32 __user *frame = (rt_sigframe32 __user *)regs->gprs[15]; 266 rt_sigframe32 __user *frame = (rt_sigframe32 __user *)regs->gprs[15];
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
deleted file mode 100644
index 0248949a756d..000000000000
--- a/arch/s390/kernel/compat_wrapper.S
+++ /dev/null
@@ -1,1425 +0,0 @@
1/*
2* wrapper for 31 bit compatible system calls.
3*
4* Copyright IBM Corp. 2000, 2006
5* Author(s): Gerhard Tonn (ton@de.ibm.com),
6* Thomas Spatzier (tspat@de.ibm.com)
7*/
8
9#include <linux/linkage.h>
10
11ENTRY(sys32_exit_wrapper)
12 lgfr %r2,%r2 # int
13 jg sys_exit # branch to sys_exit
14
15ENTRY(sys32_read_wrapper)
16 llgfr %r2,%r2 # unsigned int
17 llgtr %r3,%r3 # char *
18 llgfr %r4,%r4 # size_t
19 jg sys32_read # branch to sys_read
20
21ENTRY(sys32_write_wrapper)
22 llgfr %r2,%r2 # unsigned int
23 llgtr %r3,%r3 # const char *
24 llgfr %r4,%r4 # size_t
25 jg sys32_write # branch to system call
26
27ENTRY(sys32_close_wrapper)
28 llgfr %r2,%r2 # unsigned int
29 jg sys_close # branch to system call
30
31ENTRY(sys32_creat_wrapper)
32 llgtr %r2,%r2 # const char *
33 lgfr %r3,%r3 # int
34 jg sys_creat # branch to system call
35
36ENTRY(sys32_link_wrapper)
37 llgtr %r2,%r2 # const char *
38 llgtr %r3,%r3 # const char *
39 jg sys_link # branch to system call
40
41ENTRY(sys32_unlink_wrapper)
42 llgtr %r2,%r2 # const char *
43 jg sys_unlink # branch to system call
44
45ENTRY(sys32_chdir_wrapper)
46 llgtr %r2,%r2 # const char *
47 jg sys_chdir # branch to system call
48
49ENTRY(sys32_time_wrapper)
50 llgtr %r2,%r2 # int *
51 jg compat_sys_time # branch to system call
52
53ENTRY(sys32_mknod_wrapper)
54 llgtr %r2,%r2 # const char *
55 lgfr %r3,%r3 # int
56 llgfr %r4,%r4 # dev
57 jg sys_mknod # branch to system call
58
59ENTRY(sys32_chmod_wrapper)
60 llgtr %r2,%r2 # const char *
61 llgfr %r3,%r3 # mode_t
62 jg sys_chmod # branch to system call
63
64ENTRY(sys32_lchown16_wrapper)
65 llgtr %r2,%r2 # const char *
66 llgfr %r3,%r3 # __kernel_old_uid_emu31_t
67 llgfr %r4,%r4 # __kernel_old_uid_emu31_t
68 jg sys32_lchown16 # branch to system call
69
70#sys32_getpid_wrapper # void
71
72ENTRY(sys32_mount_wrapper)
73 llgtr %r2,%r2 # char *
74 llgtr %r3,%r3 # char *
75 llgtr %r4,%r4 # char *
76 llgfr %r5,%r5 # unsigned long
77 llgtr %r6,%r6 # void *
78 jg compat_sys_mount # branch to system call
79
80ENTRY(sys32_oldumount_wrapper)
81 llgtr %r2,%r2 # char *
82 jg sys_oldumount # branch to system call
83
84ENTRY(sys32_setuid16_wrapper)
85 llgfr %r2,%r2 # __kernel_old_uid_emu31_t
86 jg sys32_setuid16 # branch to system call
87
88#sys32_getuid16_wrapper # void
89
90ENTRY(sys32_ptrace_wrapper)
91 lgfr %r2,%r2 # long
92 lgfr %r3,%r3 # long
93 llgtr %r4,%r4 # long
94 llgfr %r5,%r5 # long
95 jg compat_sys_ptrace # branch to system call
96
97ENTRY(sys32_alarm_wrapper)
98 llgfr %r2,%r2 # unsigned int
99 jg sys_alarm # branch to system call
100
101ENTRY(compat_sys_utime_wrapper)
102 llgtr %r2,%r2 # char *
103 llgtr %r3,%r3 # struct compat_utimbuf *
104 jg compat_sys_utime # branch to system call
105
106ENTRY(sys32_access_wrapper)
107 llgtr %r2,%r2 # const char *
108 lgfr %r3,%r3 # int
109 jg sys_access # branch to system call
110
111ENTRY(sys32_nice_wrapper)
112 lgfr %r2,%r2 # int
113 jg sys_nice # branch to system call
114
115#sys32_sync_wrapper # void
116
117ENTRY(sys32_kill_wrapper)
118 lgfr %r2,%r2 # int
119 lgfr %r3,%r3 # int
120 jg sys_kill # branch to system call
121
122ENTRY(sys32_rename_wrapper)
123 llgtr %r2,%r2 # const char *
124 llgtr %r3,%r3 # const char *
125 jg sys_rename # branch to system call
126
127ENTRY(sys32_mkdir_wrapper)
128 llgtr %r2,%r2 # const char *
129 lgfr %r3,%r3 # int
130 jg sys_mkdir # branch to system call
131
132ENTRY(sys32_rmdir_wrapper)
133 llgtr %r2,%r2 # const char *
134 jg sys_rmdir # branch to system call
135
136ENTRY(sys32_dup_wrapper)
137 llgfr %r2,%r2 # unsigned int
138 jg sys_dup # branch to system call
139
140ENTRY(sys32_pipe_wrapper)
141 llgtr %r2,%r2 # u32 *
142 jg sys_pipe # branch to system call
143
144ENTRY(compat_sys_times_wrapper)
145 llgtr %r2,%r2 # struct compat_tms *
146 jg compat_sys_times # branch to system call
147
148ENTRY(sys32_brk_wrapper)
149 llgtr %r2,%r2 # unsigned long
150 jg sys_brk # branch to system call
151
152ENTRY(sys32_setgid16_wrapper)
153 llgfr %r2,%r2 # __kernel_old_gid_emu31_t
154 jg sys32_setgid16 # branch to system call
155
156#sys32_getgid16_wrapper # void
157
158ENTRY(sys32_signal_wrapper)
159 lgfr %r2,%r2 # int
160 llgtr %r3,%r3 # __sighandler_t
161 jg sys_signal
162
163#sys32_geteuid16_wrapper # void
164
165#sys32_getegid16_wrapper # void
166
167ENTRY(sys32_acct_wrapper)
168 llgtr %r2,%r2 # char *
169 jg sys_acct # branch to system call
170
171ENTRY(sys32_umount_wrapper)
172 llgtr %r2,%r2 # char *
173 lgfr %r3,%r3 # int
174 jg sys_umount # branch to system call
175
176ENTRY(compat_sys_ioctl_wrapper)
177 llgfr %r2,%r2 # unsigned int
178 llgfr %r3,%r3 # unsigned int
179 llgfr %r4,%r4 # unsigned int
180 jg compat_sys_ioctl # branch to system call
181
182ENTRY(compat_sys_fcntl_wrapper)
183 llgfr %r2,%r2 # unsigned int
184 llgfr %r3,%r3 # unsigned int
185 llgfr %r4,%r4 # unsigned long
186 jg compat_sys_fcntl # branch to system call
187
188ENTRY(sys32_setpgid_wrapper)
189 lgfr %r2,%r2 # pid_t
190 lgfr %r3,%r3 # pid_t
191 jg sys_setpgid # branch to system call
192
193ENTRY(sys32_umask_wrapper)
194 lgfr %r2,%r2 # int
195 jg sys_umask # branch to system call
196
197ENTRY(sys32_chroot_wrapper)
198 llgtr %r2,%r2 # char *
199 jg sys_chroot # branch to system call
200
201ENTRY(sys32_ustat_wrapper)
202 llgfr %r2,%r2 # dev_t
203 llgtr %r3,%r3 # struct ustat *
204 jg compat_sys_ustat
205
206ENTRY(sys32_dup2_wrapper)
207 llgfr %r2,%r2 # unsigned int
208 llgfr %r3,%r3 # unsigned int
209 jg sys_dup2 # branch to system call
210
211#sys32_getppid_wrapper # void
212
213#sys32_getpgrp_wrapper # void
214
215#sys32_setsid_wrapper # void
216
217ENTRY(sys32_setreuid16_wrapper)
218 llgfr %r2,%r2 # __kernel_old_uid_emu31_t
219 llgfr %r3,%r3 # __kernel_old_uid_emu31_t
220 jg sys32_setreuid16 # branch to system call
221
222ENTRY(sys32_setregid16_wrapper)
223 llgfr %r2,%r2 # __kernel_old_gid_emu31_t
224 llgfr %r3,%r3 # __kernel_old_gid_emu31_t
225 jg sys32_setregid16 # branch to system call
226
227ENTRY(sys_sigsuspend_wrapper)
228 lgfr %r2,%r2 # int
229 lgfr %r3,%r3 # int
230 llgfr %r4,%r4 # old_sigset_t
231 jg sys_sigsuspend
232
233ENTRY(compat_sys_sigpending_wrapper)
234 llgtr %r2,%r2 # compat_old_sigset_t *
235 jg compat_sys_sigpending # branch to system call
236
237ENTRY(sys32_sethostname_wrapper)
238 llgtr %r2,%r2 # char *
239 lgfr %r3,%r3 # int
240 jg sys_sethostname # branch to system call
241
242ENTRY(compat_sys_setrlimit_wrapper)
243 llgfr %r2,%r2 # unsigned int
244 llgtr %r3,%r3 # struct rlimit_emu31 *
245 jg compat_sys_setrlimit # branch to system call
246
247ENTRY(compat_sys_old_getrlimit_wrapper)
248 llgfr %r2,%r2 # unsigned int
249 llgtr %r3,%r3 # struct rlimit_emu31 *
250 jg compat_sys_old_getrlimit # branch to system call
251
252ENTRY(compat_sys_getrlimit_wrapper)
253 llgfr %r2,%r2 # unsigned int
254 llgtr %r3,%r3 # struct rlimit_emu31 *
255 jg compat_sys_getrlimit # branch to system call
256
257ENTRY(sys32_mmap2_wrapper)
258 llgtr %r2,%r2 # struct mmap_arg_struct_emu31 *
259 jg sys32_mmap2 # branch to system call
260
261ENTRY(compat_sys_gettimeofday_wrapper)
262 llgtr %r2,%r2 # struct timeval_emu31 *
263 llgtr %r3,%r3 # struct timezone *
264 jg compat_sys_gettimeofday # branch to system call
265
266ENTRY(compat_sys_settimeofday_wrapper)
267 llgtr %r2,%r2 # struct timeval_emu31 *
268 llgtr %r3,%r3 # struct timezone *
269 jg compat_sys_settimeofday # branch to system call
270
271ENTRY(sys32_getgroups16_wrapper)
272 lgfr %r2,%r2 # int
273 llgtr %r3,%r3 # __kernel_old_gid_emu31_t *
274 jg sys32_getgroups16 # branch to system call
275
276ENTRY(sys32_setgroups16_wrapper)
277 lgfr %r2,%r2 # int
278 llgtr %r3,%r3 # __kernel_old_gid_emu31_t *
279 jg sys32_setgroups16 # branch to system call
280
281ENTRY(sys32_symlink_wrapper)
282 llgtr %r2,%r2 # const char *
283 llgtr %r3,%r3 # const char *
284 jg sys_symlink # branch to system call
285
286ENTRY(sys32_readlink_wrapper)
287 llgtr %r2,%r2 # const char *
288 llgtr %r3,%r3 # char *
289 lgfr %r4,%r4 # int
290 jg sys_readlink # branch to system call
291
292ENTRY(sys32_uselib_wrapper)
293 llgtr %r2,%r2 # const char *
294 jg sys_uselib # branch to system call
295
296ENTRY(sys32_swapon_wrapper)
297 llgtr %r2,%r2 # const char *
298 lgfr %r3,%r3 # int
299 jg sys_swapon # branch to system call
300
301ENTRY(sys32_reboot_wrapper)
302 lgfr %r2,%r2 # int
303 lgfr %r3,%r3 # int
304 llgfr %r4,%r4 # unsigned int
305 llgtr %r5,%r5 # void *
306 jg sys_reboot # branch to system call
307
308ENTRY(old32_readdir_wrapper)
309 llgfr %r2,%r2 # unsigned int
310 llgtr %r3,%r3 # void *
311 llgfr %r4,%r4 # unsigned int
312 jg compat_sys_old_readdir # branch to system call
313
314ENTRY(old32_mmap_wrapper)
315 llgtr %r2,%r2 # struct mmap_arg_struct_emu31 *
316 jg old32_mmap # branch to system call
317
318ENTRY(sys32_munmap_wrapper)
319 llgfr %r2,%r2 # unsigned long
320 llgfr %r3,%r3 # size_t
321 jg sys_munmap # branch to system call
322
323ENTRY(sys32_fchmod_wrapper)
324 llgfr %r2,%r2 # unsigned int
325 llgfr %r3,%r3 # mode_t
326 jg sys_fchmod # branch to system call
327
328ENTRY(sys32_fchown16_wrapper)
329 llgfr %r2,%r2 # unsigned int
330 llgfr %r3,%r3 # compat_uid_t
331 llgfr %r4,%r4 # compat_uid_t
332 jg sys32_fchown16 # branch to system call
333
334ENTRY(sys32_getpriority_wrapper)
335 lgfr %r2,%r2 # int
336 lgfr %r3,%r3 # int
337 jg sys_getpriority # branch to system call
338
339ENTRY(sys32_setpriority_wrapper)
340 lgfr %r2,%r2 # int
341 lgfr %r3,%r3 # int
342 lgfr %r4,%r4 # int
343 jg sys_setpriority # branch to system call
344
345ENTRY(compat_sys_statfs_wrapper)
346 llgtr %r2,%r2 # char *
347 llgtr %r3,%r3 # struct compat_statfs *
348 jg compat_sys_statfs # branch to system call
349
350ENTRY(compat_sys_fstatfs_wrapper)
351 llgfr %r2,%r2 # unsigned int
352 llgtr %r3,%r3 # struct compat_statfs *
353 jg compat_sys_fstatfs # branch to system call
354
355ENTRY(compat_sys_socketcall_wrapper)
356 lgfr %r2,%r2 # int
357 llgtr %r3,%r3 # u32 *
358 jg compat_sys_socketcall # branch to system call
359
360ENTRY(sys32_syslog_wrapper)
361 lgfr %r2,%r2 # int
362 llgtr %r3,%r3 # char *
363 lgfr %r4,%r4 # int
364 jg sys_syslog # branch to system call
365
366ENTRY(compat_sys_newstat_wrapper)
367 llgtr %r2,%r2 # char *
368 llgtr %r3,%r3 # struct stat_emu31 *
369 jg compat_sys_newstat # branch to system call
370
371ENTRY(compat_sys_newlstat_wrapper)
372 llgtr %r2,%r2 # char *
373 llgtr %r3,%r3 # struct stat_emu31 *
374 jg compat_sys_newlstat # branch to system call
375
376ENTRY(compat_sys_newfstat_wrapper)
377 llgfr %r2,%r2 # unsigned int
378 llgtr %r3,%r3 # struct stat_emu31 *
379 jg compat_sys_newfstat # branch to system call
380
381#sys32_vhangup_wrapper # void
382
383ENTRY(sys32_swapoff_wrapper)
384 llgtr %r2,%r2 # const char *
385 jg sys_swapoff # branch to system call
386
387ENTRY(compat_sys_sysinfo_wrapper)
388 llgtr %r2,%r2 # struct sysinfo_emu31 *
389 jg compat_sys_sysinfo # branch to system call
390
391ENTRY(sys32_fsync_wrapper)
392 llgfr %r2,%r2 # unsigned int
393 jg sys_fsync # branch to system call
394
395#sys32_sigreturn_wrapper # done in sigreturn_glue
396
397#sys32_clone_wrapper # done in clone_glue
398
399ENTRY(sys32_setdomainname_wrapper)
400 llgtr %r2,%r2 # char *
401 lgfr %r3,%r3 # int
402 jg sys_setdomainname # branch to system call
403
404ENTRY(sys32_newuname_wrapper)
405 llgtr %r2,%r2 # struct new_utsname *
406 jg sys_newuname # branch to system call
407
408ENTRY(compat_sys_adjtimex_wrapper)
409 llgtr %r2,%r2 # struct compat_timex *
410 jg compat_sys_adjtimex # branch to system call
411
412ENTRY(sys32_mprotect_wrapper)
413 llgtr %r2,%r2 # unsigned long (actually pointer
414 llgfr %r3,%r3 # size_t
415 llgfr %r4,%r4 # unsigned long
416 jg sys_mprotect # branch to system call
417
418ENTRY(sys_init_module_wrapper)
419 llgtr %r2,%r2 # void *
420 llgfr %r3,%r3 # unsigned long
421 llgtr %r4,%r4 # char *
422 jg sys_init_module # branch to system call
423
424ENTRY(sys_delete_module_wrapper)
425 llgtr %r2,%r2 # const char *
426 llgfr %r3,%r3 # unsigned int
427 jg sys_delete_module # branch to system call
428
429ENTRY(sys32_quotactl_wrapper)
430 llgfr %r2,%r2 # unsigned int
431 llgtr %r3,%r3 # const char *
432 llgfr %r4,%r4 # qid_t
433 llgtr %r5,%r5 # caddr_t
434 jg sys_quotactl # branch to system call
435
436ENTRY(sys32_getpgid_wrapper)
437 lgfr %r2,%r2 # pid_t
438 jg sys_getpgid # branch to system call
439
440ENTRY(sys32_fchdir_wrapper)
441 llgfr %r2,%r2 # unsigned int
442 jg sys_fchdir # branch to system call
443
444ENTRY(sys32_bdflush_wrapper)
445 lgfr %r2,%r2 # int
446 lgfr %r3,%r3 # long
447 jg sys_bdflush # branch to system call
448
449ENTRY(sys32_sysfs_wrapper)
450 lgfr %r2,%r2 # int
451 llgfr %r3,%r3 # unsigned long
452 llgfr %r4,%r4 # unsigned long
453 jg sys_sysfs # branch to system call
454
455ENTRY(sys32_personality_wrapper)
456 llgfr %r2,%r2 # unsigned int
457 jg sys_s390_personality # branch to system call
458
459ENTRY(sys32_setfsuid16_wrapper)
460 llgfr %r2,%r2 # __kernel_old_uid_emu31_t
461 jg sys32_setfsuid16 # branch to system call
462
463ENTRY(sys32_setfsgid16_wrapper)
464 llgfr %r2,%r2 # __kernel_old_gid_emu31_t
465 jg sys32_setfsgid16 # branch to system call
466
467ENTRY(sys32_llseek_wrapper)
468 llgfr %r2,%r2 # unsigned int
469 llgfr %r3,%r3 # unsigned long
470 llgfr %r4,%r4 # unsigned long
471 llgtr %r5,%r5 # loff_t *
472 llgfr %r6,%r6 # unsigned int
473 jg sys_llseek # branch to system call
474
475ENTRY(sys32_getdents_wrapper)
476 llgfr %r2,%r2 # unsigned int
477 llgtr %r3,%r3 # void *
478 llgfr %r4,%r4 # unsigned int
479 jg compat_sys_getdents # branch to system call
480
481ENTRY(compat_sys_select_wrapper)
482 lgfr %r2,%r2 # int
483 llgtr %r3,%r3 # compat_fd_set *
484 llgtr %r4,%r4 # compat_fd_set *
485 llgtr %r5,%r5 # compat_fd_set *
486 llgtr %r6,%r6 # struct compat_timeval *
487 jg compat_sys_select # branch to system call
488
489ENTRY(sys32_flock_wrapper)
490 llgfr %r2,%r2 # unsigned int
491 llgfr %r3,%r3 # unsigned int
492 jg sys_flock # branch to system call
493
494ENTRY(sys32_msync_wrapper)
495 llgfr %r2,%r2 # unsigned long
496 llgfr %r3,%r3 # size_t
497 lgfr %r4,%r4 # int
498 jg sys_msync # branch to system call
499
500ENTRY(compat_sys_readv_wrapper)
501 lgfr %r2,%r2 # int
502 llgtr %r3,%r3 # const struct compat_iovec *
503 llgfr %r4,%r4 # unsigned long
504 jg compat_sys_readv # branch to system call
505
506ENTRY(compat_sys_writev_wrapper)
507 lgfr %r2,%r2 # int
508 llgtr %r3,%r3 # const struct compat_iovec *
509 llgfr %r4,%r4 # unsigned long
510 jg compat_sys_writev # branch to system call
511
512ENTRY(sys32_getsid_wrapper)
513 lgfr %r2,%r2 # pid_t
514 jg sys_getsid # branch to system call
515
516ENTRY(sys32_fdatasync_wrapper)
517 llgfr %r2,%r2 # unsigned int
518 jg sys_fdatasync # branch to system call
519
520ENTRY(sys32_mlock_wrapper)
521 llgfr %r2,%r2 # unsigned long
522 llgfr %r3,%r3 # size_t
523 jg sys_mlock # branch to system call
524
525ENTRY(sys32_munlock_wrapper)
526 llgfr %r2,%r2 # unsigned long
527 llgfr %r3,%r3 # size_t
528 jg sys_munlock # branch to system call
529
530ENTRY(sys32_mlockall_wrapper)
531 lgfr %r2,%r2 # int
532 jg sys_mlockall # branch to system call
533
534#sys32_munlockall_wrapper # void
535
536ENTRY(sys32_sched_setparam_wrapper)
537 lgfr %r2,%r2 # pid_t
538 llgtr %r3,%r3 # struct sched_param *
539 jg sys_sched_setparam # branch to system call
540
541ENTRY(sys32_sched_getparam_wrapper)
542 lgfr %r2,%r2 # pid_t
543 llgtr %r3,%r3 # struct sched_param *
544 jg sys_sched_getparam # branch to system call
545
546ENTRY(sys32_sched_setscheduler_wrapper)
547 lgfr %r2,%r2 # pid_t
548 lgfr %r3,%r3 # int
549 llgtr %r4,%r4 # struct sched_param *
550 jg sys_sched_setscheduler # branch to system call
551
552ENTRY(sys32_sched_getscheduler_wrapper)
553 lgfr %r2,%r2 # pid_t
554 jg sys_sched_getscheduler # branch to system call
555
556#sys32_sched_yield_wrapper # void
557
558ENTRY(sys32_sched_get_priority_max_wrapper)
559 lgfr %r2,%r2 # int
560 jg sys_sched_get_priority_max # branch to system call
561
562ENTRY(sys32_sched_get_priority_min_wrapper)
563 lgfr %r2,%r2 # int
564 jg sys_sched_get_priority_min # branch to system call
565
566ENTRY(compat_sys_nanosleep_wrapper)
567 llgtr %r2,%r2 # struct compat_timespec *
568 llgtr %r3,%r3 # struct compat_timespec *
569 jg compat_sys_nanosleep # branch to system call
570
571ENTRY(sys32_mremap_wrapper)
572 llgfr %r2,%r2 # unsigned long
573 llgfr %r3,%r3 # unsigned long
574 llgfr %r4,%r4 # unsigned long
575 llgfr %r5,%r5 # unsigned long
576 llgfr %r6,%r6 # unsigned long
577 jg sys_mremap # branch to system call
578
579ENTRY(sys32_setresuid16_wrapper)
580 llgfr %r2,%r2 # __kernel_old_uid_emu31_t
581 llgfr %r3,%r3 # __kernel_old_uid_emu31_t
582 llgfr %r4,%r4 # __kernel_old_uid_emu31_t
583 jg sys32_setresuid16 # branch to system call
584
585ENTRY(sys32_getresuid16_wrapper)
586 llgtr %r2,%r2 # __kernel_old_uid_emu31_t *
587 llgtr %r3,%r3 # __kernel_old_uid_emu31_t *
588 llgtr %r4,%r4 # __kernel_old_uid_emu31_t *
589 jg sys32_getresuid16 # branch to system call
590
591ENTRY(sys32_poll_wrapper)
592 llgtr %r2,%r2 # struct pollfd *
593 llgfr %r3,%r3 # unsigned int
594 lgfr %r4,%r4 # int
595 jg sys_poll # branch to system call
596
597ENTRY(sys32_setresgid16_wrapper)
598 llgfr %r2,%r2 # __kernel_old_gid_emu31_t
599 llgfr %r3,%r3 # __kernel_old_gid_emu31_t
600 llgfr %r4,%r4 # __kernel_old_gid_emu31_t
601 jg sys32_setresgid16 # branch to system call
602
603ENTRY(sys32_getresgid16_wrapper)
604 llgtr %r2,%r2 # __kernel_old_gid_emu31_t *
605 llgtr %r3,%r3 # __kernel_old_gid_emu31_t *
606 llgtr %r4,%r4 # __kernel_old_gid_emu31_t *
607 jg sys32_getresgid16 # branch to system call
608
609ENTRY(sys32_prctl_wrapper)
610 lgfr %r2,%r2 # int
611 llgfr %r3,%r3 # unsigned long
612 llgfr %r4,%r4 # unsigned long
613 llgfr %r5,%r5 # unsigned long
614 llgfr %r6,%r6 # unsigned long
615 jg sys_prctl # branch to system call
616
617#sys32_rt_sigreturn_wrapper # done in rt_sigreturn_glue
618
619ENTRY(sys32_pread64_wrapper)
620 llgfr %r2,%r2 # unsigned int
621 llgtr %r3,%r3 # char *
622 llgfr %r4,%r4 # size_t
623 llgfr %r5,%r5 # u32
624 llgfr %r6,%r6 # u32
625 jg sys32_pread64 # branch to system call
626
627ENTRY(sys32_pwrite64_wrapper)
628 llgfr %r2,%r2 # unsigned int
629 llgtr %r3,%r3 # const char *
630 llgfr %r4,%r4 # size_t
631 llgfr %r5,%r5 # u32
632 llgfr %r6,%r6 # u32
633 jg sys32_pwrite64 # branch to system call
634
635ENTRY(sys32_chown16_wrapper)
636 llgtr %r2,%r2 # const char *
637 llgfr %r3,%r3 # __kernel_old_uid_emu31_t
638 llgfr %r4,%r4 # __kernel_old_gid_emu31_t
639 jg sys32_chown16 # branch to system call
640
641ENTRY(sys32_getcwd_wrapper)
642 llgtr %r2,%r2 # char *
643 llgfr %r3,%r3 # unsigned long
644 jg sys_getcwd # branch to system call
645
646ENTRY(sys32_capget_wrapper)
647 llgtr %r2,%r2 # cap_user_header_t
648 llgtr %r3,%r3 # cap_user_data_t
649 jg sys_capget # branch to system call
650
651ENTRY(sys32_capset_wrapper)
652 llgtr %r2,%r2 # cap_user_header_t
653 llgtr %r3,%r3 # const cap_user_data_t
654 jg sys_capset # branch to system call
655
656#sys32_vfork_wrapper # done in vfork_glue
657
658ENTRY(sys32_truncate64_wrapper)
659 llgtr %r2,%r2 # const char *
660 llgfr %r3,%r3 # unsigned long
661 llgfr %r4,%r4 # unsigned long
662 jg sys32_truncate64 # branch to system call
663
664ENTRY(sys32_ftruncate64_wrapper)
665 llgfr %r2,%r2 # unsigned int
666 llgfr %r3,%r3 # unsigned long
667 llgfr %r4,%r4 # unsigned long
668 jg sys32_ftruncate64 # branch to system call
669
670ENTRY(sys32_lchown_wrapper)
671 llgtr %r2,%r2 # const char *
672 llgfr %r3,%r3 # uid_t
673 llgfr %r4,%r4 # gid_t
674 jg sys_lchown # branch to system call
675
676#sys32_getuid_wrapper # void
677#sys32_getgid_wrapper # void
678#sys32_geteuid_wrapper # void
679#sys32_getegid_wrapper # void
680
681ENTRY(sys32_setreuid_wrapper)
682 llgfr %r2,%r2 # uid_t
683 llgfr %r3,%r3 # uid_t
684 jg sys_setreuid # branch to system call
685
686ENTRY(sys32_setregid_wrapper)
687 llgfr %r2,%r2 # gid_t
688 llgfr %r3,%r3 # gid_t
689 jg sys_setregid # branch to system call
690
691ENTRY(sys32_getgroups_wrapper)
692 lgfr %r2,%r2 # int
693 llgtr %r3,%r3 # gid_t *
694 jg sys_getgroups # branch to system call
695
696ENTRY(sys32_setgroups_wrapper)
697 lgfr %r2,%r2 # int
698 llgtr %r3,%r3 # gid_t *
699 jg sys_setgroups # branch to system call
700
701ENTRY(sys32_fchown_wrapper)
702 llgfr %r2,%r2 # unsigned int
703 llgfr %r3,%r3 # uid_t
704 llgfr %r4,%r4 # gid_t
705 jg sys_fchown # branch to system call
706
707ENTRY(sys32_setresuid_wrapper)
708 llgfr %r2,%r2 # uid_t
709 llgfr %r3,%r3 # uid_t
710 llgfr %r4,%r4 # uid_t
711 jg sys_setresuid # branch to system call
712
713ENTRY(sys32_getresuid_wrapper)
714 llgtr %r2,%r2 # uid_t *
715 llgtr %r3,%r3 # uid_t *
716 llgtr %r4,%r4 # uid_t *
717 jg sys_getresuid # branch to system call
718
719ENTRY(sys32_setresgid_wrapper)
720 llgfr %r2,%r2 # gid_t
721 llgfr %r3,%r3 # gid_t
722 llgfr %r4,%r4 # gid_t
723 jg sys_setresgid # branch to system call
724
725ENTRY(sys32_getresgid_wrapper)
726 llgtr %r2,%r2 # gid_t *
727 llgtr %r3,%r3 # gid_t *
728 llgtr %r4,%r4 # gid_t *
729 jg sys_getresgid # branch to system call
730
731ENTRY(sys32_chown_wrapper)
732 llgtr %r2,%r2 # const char *
733 llgfr %r3,%r3 # uid_t
734 llgfr %r4,%r4 # gid_t
735 jg sys_chown # branch to system call
736
737ENTRY(sys32_setuid_wrapper)
738 llgfr %r2,%r2 # uid_t
739 jg sys_setuid # branch to system call
740
741ENTRY(sys32_setgid_wrapper)
742 llgfr %r2,%r2 # gid_t
743 jg sys_setgid # branch to system call
744
745ENTRY(sys32_setfsuid_wrapper)
746 llgfr %r2,%r2 # uid_t
747 jg sys_setfsuid # branch to system call
748
749ENTRY(sys32_setfsgid_wrapper)
750 llgfr %r2,%r2 # gid_t
751 jg sys_setfsgid # branch to system call
752
753ENTRY(sys32_pivot_root_wrapper)
754 llgtr %r2,%r2 # const char *
755 llgtr %r3,%r3 # const char *
756 jg sys_pivot_root # branch to system call
757
758ENTRY(sys32_mincore_wrapper)
759 llgfr %r2,%r2 # unsigned long
760 llgfr %r3,%r3 # size_t
761 llgtr %r4,%r4 # unsigned char *
762 jg sys_mincore # branch to system call
763
764ENTRY(sys32_madvise_wrapper)
765 llgfr %r2,%r2 # unsigned long
766 llgfr %r3,%r3 # size_t
767 lgfr %r4,%r4 # int
768 jg sys_madvise # branch to system call
769
770ENTRY(sys32_getdents64_wrapper)
771 llgfr %r2,%r2 # unsigned int
772 llgtr %r3,%r3 # void *
773 llgfr %r4,%r4 # unsigned int
774 jg sys_getdents64 # branch to system call
775
776ENTRY(compat_sys_fcntl64_wrapper)
777 llgfr %r2,%r2 # unsigned int
778 llgfr %r3,%r3 # unsigned int
779 llgfr %r4,%r4 # unsigned long
780 jg compat_sys_fcntl64 # branch to system call
781
782ENTRY(sys32_stat64_wrapper)
783 llgtr %r2,%r2 # char *
784 llgtr %r3,%r3 # struct stat64 *
785 jg sys32_stat64 # branch to system call
786
787ENTRY(sys32_lstat64_wrapper)
788 llgtr %r2,%r2 # char *
789 llgtr %r3,%r3 # struct stat64 *
790 jg sys32_lstat64 # branch to system call
791
792ENTRY(sys32_stime_wrapper)
793 llgtr %r2,%r2 # long *
794 jg compat_sys_stime # branch to system call
795
796ENTRY(sys32_fstat64_wrapper)
797 llgfr %r2,%r2 # unsigned long
798 llgtr %r3,%r3 # struct stat64 *
799 jg sys32_fstat64 # branch to system call
800
801ENTRY(sys32_setxattr_wrapper)
802 llgtr %r2,%r2 # char *
803 llgtr %r3,%r3 # char *
804 llgtr %r4,%r4 # void *
805 llgfr %r5,%r5 # size_t
806 lgfr %r6,%r6 # int
807 jg sys_setxattr
808
809ENTRY(sys32_lsetxattr_wrapper)
810 llgtr %r2,%r2 # char *
811 llgtr %r3,%r3 # char *
812 llgtr %r4,%r4 # void *
813 llgfr %r5,%r5 # size_t
814 lgfr %r6,%r6 # int
815 jg sys_lsetxattr
816
817ENTRY(sys32_fsetxattr_wrapper)
818 lgfr %r2,%r2 # int
819 llgtr %r3,%r3 # char *
820 llgtr %r4,%r4 # void *
821 llgfr %r5,%r5 # size_t
822 lgfr %r6,%r6 # int
823 jg sys_fsetxattr
824
825ENTRY(sys32_getxattr_wrapper)
826 llgtr %r2,%r2 # char *
827 llgtr %r3,%r3 # char *
828 llgtr %r4,%r4 # void *
829 llgfr %r5,%r5 # size_t
830 jg sys_getxattr
831
832ENTRY(sys32_lgetxattr_wrapper)
833 llgtr %r2,%r2 # char *
834 llgtr %r3,%r3 # char *
835 llgtr %r4,%r4 # void *
836 llgfr %r5,%r5 # size_t
837 jg sys_lgetxattr
838
839ENTRY(sys32_fgetxattr_wrapper)
840 lgfr %r2,%r2 # int
841 llgtr %r3,%r3 # char *
842 llgtr %r4,%r4 # void *
843 llgfr %r5,%r5 # size_t
844 jg sys_fgetxattr
845
846ENTRY(sys32_listxattr_wrapper)
847 llgtr %r2,%r2 # char *
848 llgtr %r3,%r3 # char *
849 llgfr %r4,%r4 # size_t
850 jg sys_listxattr
851
852ENTRY(sys32_llistxattr_wrapper)
853 llgtr %r2,%r2 # char *
854 llgtr %r3,%r3 # char *
855 llgfr %r4,%r4 # size_t
856 jg sys_llistxattr
857
858ENTRY(sys32_flistxattr_wrapper)
859 lgfr %r2,%r2 # int
860 llgtr %r3,%r3 # char *
861 llgfr %r4,%r4 # size_t
862 jg sys_flistxattr
863
864ENTRY(sys32_removexattr_wrapper)
865 llgtr %r2,%r2 # char *
866 llgtr %r3,%r3 # char *
867 jg sys_removexattr
868
869ENTRY(sys32_lremovexattr_wrapper)
870 llgtr %r2,%r2 # char *
871 llgtr %r3,%r3 # char *
872 jg sys_lremovexattr
873
874ENTRY(sys32_fremovexattr_wrapper)
875 lgfr %r2,%r2 # int
876 llgtr %r3,%r3 # char *
877 jg sys_fremovexattr
878
879ENTRY(sys32_sched_setaffinity_wrapper)
880 lgfr %r2,%r2 # int
881 llgfr %r3,%r3 # unsigned int
882 llgtr %r4,%r4 # unsigned long *
883 jg compat_sys_sched_setaffinity
884
885ENTRY(sys32_sched_getaffinity_wrapper)
886 lgfr %r2,%r2 # int
887 llgfr %r3,%r3 # unsigned int
888 llgtr %r4,%r4 # unsigned long *
889 jg compat_sys_sched_getaffinity
890
891ENTRY(sys32_exit_group_wrapper)
892 lgfr %r2,%r2 # int
893 jg sys_exit_group # branch to system call
894
895ENTRY(sys32_set_tid_address_wrapper)
896 llgtr %r2,%r2 # int *
897 jg sys_set_tid_address # branch to system call
898
899ENTRY(sys_epoll_create_wrapper)
900 lgfr %r2,%r2 # int
901 jg sys_epoll_create # branch to system call
902
903ENTRY(sys_epoll_ctl_wrapper)
904 lgfr %r2,%r2 # int
905 lgfr %r3,%r3 # int
906 lgfr %r4,%r4 # int
907 llgtr %r5,%r5 # struct epoll_event *
908 jg sys_epoll_ctl # branch to system call
909
910ENTRY(sys_epoll_wait_wrapper)
911 lgfr %r2,%r2 # int
912 llgtr %r3,%r3 # struct epoll_event *
913 lgfr %r4,%r4 # int
914 lgfr %r5,%r5 # int
915 jg sys_epoll_wait # branch to system call
916
917ENTRY(sys32_fadvise64_wrapper)
918 lgfr %r2,%r2 # int
919 sllg %r3,%r3,32 # get high word of 64bit loff_t
920 or %r3,%r4 # get low word of 64bit loff_t
921 llgfr %r4,%r5 # size_t (unsigned long)
922 lgfr %r5,%r6 # int
923 jg sys32_fadvise64
924
925ENTRY(sys32_fadvise64_64_wrapper)
926 llgtr %r2,%r2 # struct fadvise64_64_args *
927 jg sys32_fadvise64_64
928
929ENTRY(sys32_clock_settime_wrapper)
930 lgfr %r2,%r2 # clockid_t (int)
931 llgtr %r3,%r3 # struct compat_timespec *
932 jg compat_sys_clock_settime
933
934ENTRY(sys32_clock_gettime_wrapper)
935 lgfr %r2,%r2 # clockid_t (int)
936 llgtr %r3,%r3 # struct compat_timespec *
937 jg compat_sys_clock_gettime
938
939ENTRY(sys32_clock_getres_wrapper)
940 lgfr %r2,%r2 # clockid_t (int)
941 llgtr %r3,%r3 # struct compat_timespec *
942 jg compat_sys_clock_getres
943
944ENTRY(sys32_clock_nanosleep_wrapper)
945 lgfr %r2,%r2 # clockid_t (int)
946 lgfr %r3,%r3 # int
947 llgtr %r4,%r4 # struct compat_timespec *
948 llgtr %r5,%r5 # struct compat_timespec *
949 jg compat_sys_clock_nanosleep
950
951ENTRY(sys32_timer_create_wrapper)
952 lgfr %r2,%r2 # timer_t (int)
953 llgtr %r3,%r3 # struct compat_sigevent *
954 llgtr %r4,%r4 # timer_t *
955 jg compat_sys_timer_create
956
957ENTRY(sys32_timer_settime_wrapper)
958 lgfr %r2,%r2 # timer_t (int)
959 lgfr %r3,%r3 # int
960 llgtr %r4,%r4 # struct compat_itimerspec *
961 llgtr %r5,%r5 # struct compat_itimerspec *
962 jg compat_sys_timer_settime
963
964ENTRY(sys32_timer_gettime_wrapper)
965 lgfr %r2,%r2 # timer_t (int)
966 llgtr %r3,%r3 # struct compat_itimerspec *
967 jg compat_sys_timer_gettime
968
969ENTRY(sys32_timer_getoverrun_wrapper)
970 lgfr %r2,%r2 # timer_t (int)
971 jg sys_timer_getoverrun
972
973ENTRY(sys32_timer_delete_wrapper)
974 lgfr %r2,%r2 # timer_t (int)
975 jg sys_timer_delete
976
977ENTRY(sys32_io_setup_wrapper)
978 llgfr %r2,%r2 # unsigned int
979 llgtr %r3,%r3 # u32 *
980 jg compat_sys_io_setup
981
982ENTRY(sys32_io_destroy_wrapper)
983 llgfr %r2,%r2 # (aio_context_t) u32
984 jg sys_io_destroy
985
986ENTRY(sys32_io_getevents_wrapper)
987 llgfr %r2,%r2 # (aio_context_t) u32
988 lgfr %r3,%r3 # long
989 lgfr %r4,%r4 # long
990 llgtr %r5,%r5 # struct io_event *
991 llgtr %r6,%r6 # struct compat_timespec *
992 jg compat_sys_io_getevents
993
994ENTRY(sys32_io_submit_wrapper)
995 llgfr %r2,%r2 # (aio_context_t) u32
996 lgfr %r3,%r3 # long
997 llgtr %r4,%r4 # struct iocb **
998 jg compat_sys_io_submit
999
1000ENTRY(sys32_io_cancel_wrapper)
1001 llgfr %r2,%r2 # (aio_context_t) u32
1002 llgtr %r3,%r3 # struct iocb *
1003 llgtr %r4,%r4 # struct io_event *
1004 jg sys_io_cancel
1005
1006ENTRY(compat_sys_statfs64_wrapper)
1007 llgtr %r2,%r2 # const char *
1008 llgfr %r3,%r3 # compat_size_t
1009 llgtr %r4,%r4 # struct compat_statfs64 *
1010 jg compat_sys_statfs64
1011
1012ENTRY(compat_sys_fstatfs64_wrapper)
1013 llgfr %r2,%r2 # unsigned int fd
1014 llgfr %r3,%r3 # compat_size_t
1015 llgtr %r4,%r4 # struct compat_statfs64 *
1016 jg compat_sys_fstatfs64
1017
1018ENTRY(compat_sys_mq_open_wrapper)
1019 llgtr %r2,%r2 # const char *
1020 lgfr %r3,%r3 # int
1021 llgfr %r4,%r4 # mode_t
1022 llgtr %r5,%r5 # struct compat_mq_attr *
1023 jg compat_sys_mq_open
1024
1025ENTRY(sys32_mq_unlink_wrapper)
1026 llgtr %r2,%r2 # const char *
1027 jg sys_mq_unlink
1028
1029ENTRY(compat_sys_mq_timedsend_wrapper)
1030 lgfr %r2,%r2 # mqd_t
1031 llgtr %r3,%r3 # const char *
1032 llgfr %r4,%r4 # size_t
1033 llgfr %r5,%r5 # unsigned int
1034 llgtr %r6,%r6 # const struct compat_timespec *
1035 jg compat_sys_mq_timedsend
1036
1037ENTRY(compat_sys_mq_timedreceive_wrapper)
1038 lgfr %r2,%r2 # mqd_t
1039 llgtr %r3,%r3 # char *
1040 llgfr %r4,%r4 # size_t
1041 llgtr %r5,%r5 # unsigned int *
1042 llgtr %r6,%r6 # const struct compat_timespec *
1043 jg compat_sys_mq_timedreceive
1044
1045ENTRY(compat_sys_mq_notify_wrapper)
1046 lgfr %r2,%r2 # mqd_t
1047 llgtr %r3,%r3 # struct compat_sigevent *
1048 jg compat_sys_mq_notify
1049
1050ENTRY(compat_sys_mq_getsetattr_wrapper)
1051 lgfr %r2,%r2 # mqd_t
1052 llgtr %r3,%r3 # struct compat_mq_attr *
1053 llgtr %r4,%r4 # struct compat_mq_attr *
1054 jg compat_sys_mq_getsetattr
1055
1056ENTRY(compat_sys_add_key_wrapper)
1057 llgtr %r2,%r2 # const char *
1058 llgtr %r3,%r3 # const char *
1059 llgtr %r4,%r4 # const void *
1060 llgfr %r5,%r5 # size_t
1061 llgfr %r6,%r6 # (key_serial_t) u32
1062 jg sys_add_key
1063
1064ENTRY(compat_sys_request_key_wrapper)
1065 llgtr %r2,%r2 # const char *
1066 llgtr %r3,%r3 # const char *
1067 llgtr %r4,%r4 # const void *
1068 llgfr %r5,%r5 # (key_serial_t) u32
1069 jg sys_request_key
1070
1071ENTRY(sys32_remap_file_pages_wrapper)
1072 llgfr %r2,%r2 # unsigned long
1073 llgfr %r3,%r3 # unsigned long
1074 llgfr %r4,%r4 # unsigned long
1075 llgfr %r5,%r5 # unsigned long
1076 llgfr %r6,%r6 # unsigned long
1077 jg sys_remap_file_pages
1078
1079ENTRY(compat_sys_kexec_load_wrapper)
1080 llgfr %r2,%r2 # unsigned long
1081 llgfr %r3,%r3 # unsigned long
1082 llgtr %r4,%r4 # struct kexec_segment *
1083 llgfr %r5,%r5 # unsigned long
1084 jg compat_sys_kexec_load
1085
1086ENTRY(sys_ioprio_set_wrapper)
1087 lgfr %r2,%r2 # int
1088 lgfr %r3,%r3 # int
1089 lgfr %r4,%r4 # int
1090 jg sys_ioprio_set
1091
1092ENTRY(sys_ioprio_get_wrapper)
1093 lgfr %r2,%r2 # int
1094 lgfr %r3,%r3 # int
1095 jg sys_ioprio_get
1096
1097ENTRY(sys_inotify_add_watch_wrapper)
1098 lgfr %r2,%r2 # int
1099 llgtr %r3,%r3 # const char *
1100 llgfr %r4,%r4 # u32
1101 jg sys_inotify_add_watch
1102
1103ENTRY(sys_inotify_rm_watch_wrapper)
1104 lgfr %r2,%r2 # int
1105 llgfr %r3,%r3 # u32
1106 jg sys_inotify_rm_watch
1107
1108ENTRY(sys_mkdirat_wrapper)
1109 lgfr %r2,%r2 # int
1110 llgtr %r3,%r3 # const char *
1111 lgfr %r4,%r4 # int
1112 jg sys_mkdirat
1113
1114ENTRY(sys_mknodat_wrapper)
1115 lgfr %r2,%r2 # int
1116 llgtr %r3,%r3 # const char *
1117 lgfr %r4,%r4 # int
1118 llgfr %r5,%r5 # unsigned int
1119 jg sys_mknodat
1120
1121ENTRY(sys_fchownat_wrapper)
1122 lgfr %r2,%r2 # int
1123 llgtr %r3,%r3 # const char *
1124 llgfr %r4,%r4 # uid_t
1125 llgfr %r5,%r5 # gid_t
1126 lgfr %r6,%r6 # int
1127 jg sys_fchownat
1128
1129ENTRY(compat_sys_futimesat_wrapper)
1130 llgfr %r2,%r2 # unsigned int
1131 llgtr %r3,%r3 # char *
1132 llgtr %r4,%r4 # struct timeval *
1133 jg compat_sys_futimesat
1134
1135ENTRY(sys32_fstatat64_wrapper)
1136 llgfr %r2,%r2 # unsigned int
1137 llgtr %r3,%r3 # char *
1138 llgtr %r4,%r4 # struct stat64 *
1139 lgfr %r5,%r5 # int
1140 jg sys32_fstatat64
1141
1142ENTRY(sys_unlinkat_wrapper)
1143 lgfr %r2,%r2 # int
1144 llgtr %r3,%r3 # const char *
1145 lgfr %r4,%r4 # int
1146 jg sys_unlinkat
1147
1148ENTRY(sys_renameat_wrapper)
1149 lgfr %r2,%r2 # int
1150 llgtr %r3,%r3 # const char *
1151 lgfr %r4,%r4 # int
1152 llgtr %r5,%r5 # const char *
1153 jg sys_renameat
1154
1155ENTRY(sys_linkat_wrapper)
1156 lgfr %r2,%r2 # int
1157 llgtr %r3,%r3 # const char *
1158 lgfr %r4,%r4 # int
1159 llgtr %r5,%r5 # const char *
1160 lgfr %r6,%r6 # int
1161 jg sys_linkat
1162
1163ENTRY(sys_symlinkat_wrapper)
1164 llgtr %r2,%r2 # const char *
1165 lgfr %r3,%r3 # int
1166 llgtr %r4,%r4 # const char *
1167 jg sys_symlinkat
1168
1169ENTRY(sys_readlinkat_wrapper)
1170 lgfr %r2,%r2 # int
1171 llgtr %r3,%r3 # const char *
1172 llgtr %r4,%r4 # char *
1173 lgfr %r5,%r5 # int
1174 jg sys_readlinkat
1175
1176ENTRY(sys_fchmodat_wrapper)
1177 lgfr %r2,%r2 # int
1178 llgtr %r3,%r3 # const char *
1179 llgfr %r4,%r4 # mode_t
1180 jg sys_fchmodat
1181
1182ENTRY(sys_faccessat_wrapper)
1183 lgfr %r2,%r2 # int
1184 llgtr %r3,%r3 # const char *
1185 lgfr %r4,%r4 # int
1186 jg sys_faccessat
1187
1188ENTRY(compat_sys_pselect6_wrapper)
1189 lgfr %r2,%r2 # int
1190 llgtr %r3,%r3 # fd_set *
1191 llgtr %r4,%r4 # fd_set *
1192 llgtr %r5,%r5 # fd_set *
1193 llgtr %r6,%r6 # struct timespec *
1194 llgt %r0,164(%r15) # void *
1195 stg %r0,160(%r15)
1196 jg compat_sys_pselect6
1197
1198ENTRY(compat_sys_ppoll_wrapper)
1199 llgtr %r2,%r2 # struct pollfd *
1200 llgfr %r3,%r3 # unsigned int
1201 llgtr %r4,%r4 # struct timespec *
1202 llgtr %r5,%r5 # const sigset_t *
1203 llgfr %r6,%r6 # size_t
1204 jg compat_sys_ppoll
1205
1206ENTRY(sys_unshare_wrapper)
1207 llgfr %r2,%r2 # unsigned long
1208 jg sys_unshare
1209
1210ENTRY(sys_splice_wrapper)
1211 lgfr %r2,%r2 # int
1212 llgtr %r3,%r3 # loff_t *
1213 lgfr %r4,%r4 # int
1214 llgtr %r5,%r5 # loff_t *
1215 llgfr %r6,%r6 # size_t
1216 llgf %r0,164(%r15) # unsigned int
1217 stg %r0,160(%r15)
1218 jg sys_splice
1219
1220ENTRY(sys_sync_file_range_wrapper)
1221 lgfr %r2,%r2 # int
1222 sllg %r3,%r3,32 # get high word of 64bit loff_t
1223 or %r3,%r4 # get low word of 64bit loff_t
1224 sllg %r4,%r5,32 # get high word of 64bit loff_t
1225 or %r4,%r6 # get low word of 64bit loff_t
1226 llgf %r5,164(%r15) # unsigned int
1227 jg sys_sync_file_range
1228
1229ENTRY(sys_tee_wrapper)
1230 lgfr %r2,%r2 # int
1231 lgfr %r3,%r3 # int
1232 llgfr %r4,%r4 # size_t
1233 llgfr %r5,%r5 # unsigned int
1234 jg sys_tee
1235
1236ENTRY(sys_getcpu_wrapper)
1237 llgtr %r2,%r2 # unsigned *
1238 llgtr %r3,%r3 # unsigned *
1239 llgtr %r4,%r4 # struct getcpu_cache *
1240 jg sys_getcpu
1241
1242ENTRY(compat_sys_utimes_wrapper)
1243 llgtr %r2,%r2 # char *
1244 llgtr %r3,%r3 # struct compat_timeval *
1245 jg compat_sys_utimes
1246
1247ENTRY(compat_sys_utimensat_wrapper)
1248 llgfr %r2,%r2 # unsigned int
1249 llgtr %r3,%r3 # char *
1250 llgtr %r4,%r4 # struct compat_timespec *
1251 lgfr %r5,%r5 # int
1252 jg compat_sys_utimensat
1253
1254ENTRY(sys_eventfd_wrapper)
1255 llgfr %r2,%r2 # unsigned int
1256 jg sys_eventfd
1257
1258ENTRY(sys_fallocate_wrapper)
1259 lgfr %r2,%r2 # int
1260 lgfr %r3,%r3 # int
1261 sllg %r4,%r4,32 # get high word of 64bit loff_t
1262 lr %r4,%r5 # get low word of 64bit loff_t
1263 sllg %r5,%r6,32 # get high word of 64bit loff_t
1264 l %r5,164(%r15) # get low word of 64bit loff_t
1265 jg sys_fallocate
1266
1267ENTRY(sys_timerfd_create_wrapper)
1268 lgfr %r2,%r2 # int
1269 lgfr %r3,%r3 # int
1270 jg sys_timerfd_create
1271
1272ENTRY(sys_eventfd2_wrapper)
1273 llgfr %r2,%r2 # unsigned int
1274 lgfr %r3,%r3 # int
1275 jg sys_eventfd2
1276
1277ENTRY(sys_inotify_init1_wrapper)
1278 lgfr %r2,%r2 # int
1279 jg sys_inotify_init1
1280
1281ENTRY(sys_pipe2_wrapper)
1282 llgtr %r2,%r2 # u32 *
1283 lgfr %r3,%r3 # int
1284 jg sys_pipe2 # branch to system call
1285
1286ENTRY(sys_dup3_wrapper)
1287 llgfr %r2,%r2 # unsigned int
1288 llgfr %r3,%r3 # unsigned int
1289 lgfr %r4,%r4 # int
1290 jg sys_dup3 # branch to system call
1291
1292ENTRY(sys_epoll_create1_wrapper)
1293 lgfr %r2,%r2 # int
1294 jg sys_epoll_create1 # branch to system call
1295
1296ENTRY(sys32_readahead_wrapper)
1297 lgfr %r2,%r2 # int
1298 llgfr %r3,%r3 # u32
1299 llgfr %r4,%r4 # u32
1300 lgfr %r5,%r5 # s32
1301 jg sys32_readahead # branch to system call
1302
1303ENTRY(sys_tkill_wrapper)
1304 lgfr %r2,%r2 # pid_t
1305 lgfr %r3,%r3 # int
1306 jg sys_tkill # branch to system call
1307
1308ENTRY(sys_tgkill_wrapper)
1309 lgfr %r2,%r2 # pid_t
1310 lgfr %r3,%r3 # pid_t
1311 lgfr %r4,%r4 # int
1312 jg sys_tgkill # branch to system call
1313
1314ENTRY(compat_sys_keyctl_wrapper)
1315 llgfr %r2,%r2 # u32
1316 llgfr %r3,%r3 # u32
1317 llgfr %r4,%r4 # u32
1318 llgfr %r5,%r5 # u32
1319 llgfr %r6,%r6 # u32
1320 jg compat_sys_keyctl # branch to system call
1321
1322ENTRY(sys_perf_event_open_wrapper)
1323 llgtr %r2,%r2 # const struct perf_event_attr *
1324 lgfr %r3,%r3 # pid_t
1325 lgfr %r4,%r4 # int
1326 lgfr %r5,%r5 # int
1327 llgfr %r6,%r6 # unsigned long
1328 jg sys_perf_event_open # branch to system call
1329
1330ENTRY(sys_clone_wrapper)
1331 llgfr %r2,%r2 # unsigned long
1332 llgfr %r3,%r3 # unsigned long
1333 llgtr %r4,%r4 # int *
1334 llgtr %r5,%r5 # int *
1335 jg sys_clone # branch to system call
1336
1337ENTRY(sys32_execve_wrapper)
1338 llgtr %r2,%r2 # char *
1339 llgtr %r3,%r3 # compat_uptr_t *
1340 llgtr %r4,%r4 # compat_uptr_t *
1341 jg compat_sys_execve # branch to system call
1342
1343ENTRY(sys_fanotify_init_wrapper)
1344 llgfr %r2,%r2 # unsigned int
1345 llgfr %r3,%r3 # unsigned int
1346 jg sys_fanotify_init # branch to system call
1347
1348ENTRY(sys_prlimit64_wrapper)
1349 lgfr %r2,%r2 # pid_t
1350 llgfr %r3,%r3 # unsigned int
1351 llgtr %r4,%r4 # const struct rlimit64 __user *
1352 llgtr %r5,%r5 # struct rlimit64 __user *
1353 jg sys_prlimit64 # branch to system call
1354
1355ENTRY(sys_name_to_handle_at_wrapper)
1356 lgfr %r2,%r2 # int
1357 llgtr %r3,%r3 # const char __user *
1358 llgtr %r4,%r4 # struct file_handle __user *
1359 llgtr %r5,%r5 # int __user *
1360 lgfr %r6,%r6 # int
1361 jg sys_name_to_handle_at
1362
1363ENTRY(compat_sys_clock_adjtime_wrapper)
1364 lgfr %r2,%r2 # clockid_t (int)
1365 llgtr %r3,%r3 # struct compat_timex __user *
1366 jg compat_sys_clock_adjtime
1367
1368ENTRY(sys_syncfs_wrapper)
1369 lgfr %r2,%r2 # int
1370 jg sys_syncfs
1371
1372ENTRY(sys_setns_wrapper)
1373 lgfr %r2,%r2 # int
1374 lgfr %r3,%r3 # int
1375 jg sys_setns
1376
1377ENTRY(compat_sys_process_vm_readv_wrapper)
1378 lgfr %r2,%r2 # compat_pid_t
1379 llgtr %r3,%r3 # struct compat_iovec __user *
1380 llgfr %r4,%r4 # unsigned long
1381 llgtr %r5,%r5 # struct compat_iovec __user *
1382 llgfr %r6,%r6 # unsigned long
1383 llgf %r0,164(%r15) # unsigned long
1384 stg %r0,160(%r15)
1385 jg compat_sys_process_vm_readv
1386
1387ENTRY(compat_sys_process_vm_writev_wrapper)
1388 lgfr %r2,%r2 # compat_pid_t
1389 llgtr %r3,%r3 # struct compat_iovec __user *
1390 llgfr %r4,%r4 # unsigned long
1391 llgtr %r5,%r5 # struct compat_iovec __user *
1392 llgfr %r6,%r6 # unsigned long
1393 llgf %r0,164(%r15) # unsigned long
1394 stg %r0,160(%r15)
1395 jg compat_sys_process_vm_writev
1396
1397ENTRY(sys_s390_runtime_instr_wrapper)
1398 lgfr %r2,%r2 # int
1399 lgfr %r3,%r3 # int
1400 jg sys_s390_runtime_instr
1401
1402ENTRY(sys_kcmp_wrapper)
1403 lgfr %r2,%r2 # pid_t
1404 lgfr %r3,%r3 # pid_t
1405 lgfr %r4,%r4 # int
1406 llgfr %r5,%r5 # unsigned long
1407 llgfr %r6,%r6 # unsigned long
1408 jg sys_kcmp
1409
1410ENTRY(sys_finit_module_wrapper)
1411 lgfr %r2,%r2 # int
1412 llgtr %r3,%r3 # const char __user *
1413 lgfr %r4,%r4 # int
1414 jg sys_finit_module
1415
1416ENTRY(sys_sched_setattr_wrapper)
1417 lgfr %r2,%r2 # pid_t
1418 llgtr %r3,%r3 # struct sched_attr __user *
1419 jg sys_sched_setattr
1420
1421ENTRY(sys_sched_getattr_wrapper)
1422 lgfr %r2,%r2 # pid_t
1423 llgtr %r3,%r3 # const char __user *
1424 llgfr %r4,%r4 # unsigned int
1425 jg sys_sched_getattr
diff --git a/arch/s390/kernel/compat_wrapper.c b/arch/s390/kernel/compat_wrapper.c
new file mode 100644
index 000000000000..824c39dfddfc
--- /dev/null
+++ b/arch/s390/kernel/compat_wrapper.c
@@ -0,0 +1,215 @@
1/*
2 * Compat sytem call wrappers.
3 *
4 * Copyright IBM Corp. 2014
5 */
6
7#include <linux/syscalls.h>
8#include <linux/compat.h>
9#include "entry.h"
10
11#define COMPAT_SYSCALL_WRAP1(name, ...) \
12 COMPAT_SYSCALL_WRAPx(1, _##name, __VA_ARGS__)
13#define COMPAT_SYSCALL_WRAP2(name, ...) \
14 COMPAT_SYSCALL_WRAPx(2, _##name, __VA_ARGS__)
15#define COMPAT_SYSCALL_WRAP3(name, ...) \
16 COMPAT_SYSCALL_WRAPx(3, _##name, __VA_ARGS__)
17#define COMPAT_SYSCALL_WRAP4(name, ...) \
18 COMPAT_SYSCALL_WRAPx(4, _##name, __VA_ARGS__)
19#define COMPAT_SYSCALL_WRAP5(name, ...) \
20 COMPAT_SYSCALL_WRAPx(5, _##name, __VA_ARGS__)
21#define COMPAT_SYSCALL_WRAP6(name, ...) \
22 COMPAT_SYSCALL_WRAPx(6, _##name, __VA_ARGS__)
23
24#define __SC_COMPAT_TYPE(t, a) \
25 __typeof(__builtin_choose_expr(sizeof(t) > 4, 0L, (t)0)) a
26
27#define __SC_COMPAT_CAST(t, a) \
28({ \
29 long __ReS = a; \
30 \
31 BUILD_BUG_ON((sizeof(t) > 4) && !__TYPE_IS_L(t) && \
32 !__TYPE_IS_UL(t) && !__TYPE_IS_PTR(t)); \
33 if (__TYPE_IS_L(t)) \
34 __ReS = (s32)a; \
35 if (__TYPE_IS_UL(t)) \
36 __ReS = (u32)a; \
37 if (__TYPE_IS_PTR(t)) \
38 __ReS = a & 0x7fffffff; \
39 (t)__ReS; \
40})
41
42/*
43 * The COMPAT_SYSCALL_WRAP macro generates system call wrappers to be used by
44 * compat tasks. These wrappers will only be used for system calls where only
45 * the system call arguments need sign or zero extension or zeroing of the upper
46 * 33 bits of pointers.
47 * Note: since the wrapper function will afterwards call a system call which
48 * again performs zero and sign extension for all system call arguments with
49 * a size of less than eight bytes, these compat wrappers only touch those
50 * system call arguments with a size of eight bytes ((unsigned) long and
51 * pointers). Zero and sign extension for e.g. int parameters will be done by
52 * the regular system call wrappers.
53 */
54#define COMPAT_SYSCALL_WRAPx(x, name, ...) \
55 asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
56 asmlinkage long compat_sys##name(__MAP(x,__SC_COMPAT_TYPE,__VA_ARGS__));\
57 asmlinkage long compat_sys##name(__MAP(x,__SC_COMPAT_TYPE,__VA_ARGS__)) \
58 { \
59 return sys##name(__MAP(x,__SC_COMPAT_CAST,__VA_ARGS__)); \
60 }
61
62COMPAT_SYSCALL_WRAP1(exit, int, error_code);
63COMPAT_SYSCALL_WRAP1(close, unsigned int, fd);
64COMPAT_SYSCALL_WRAP2(creat, const char __user *, pathname, umode_t, mode);
65COMPAT_SYSCALL_WRAP2(link, const char __user *, oldname, const char __user *, newname);
66COMPAT_SYSCALL_WRAP1(unlink, const char __user *, pathname);
67COMPAT_SYSCALL_WRAP1(chdir, const char __user *, filename);
68COMPAT_SYSCALL_WRAP3(mknod, const char __user *, filename, umode_t, mode, unsigned, dev);
69COMPAT_SYSCALL_WRAP2(chmod, const char __user *, filename, umode_t, mode);
70COMPAT_SYSCALL_WRAP1(oldumount, char __user *, name);
71COMPAT_SYSCALL_WRAP1(alarm, unsigned int, seconds);
72COMPAT_SYSCALL_WRAP2(access, const char __user *, filename, int, mode);
73COMPAT_SYSCALL_WRAP1(nice, int, increment);
74COMPAT_SYSCALL_WRAP2(kill, int, pid, int, sig);
75COMPAT_SYSCALL_WRAP2(rename, const char __user *, oldname, const char __user *, newname);
76COMPAT_SYSCALL_WRAP2(mkdir, const char __user *, pathname, umode_t, mode);
77COMPAT_SYSCALL_WRAP1(rmdir, const char __user *, pathname);
78COMPAT_SYSCALL_WRAP1(dup, unsigned int, fildes);
79COMPAT_SYSCALL_WRAP1(pipe, int __user *, fildes);
80COMPAT_SYSCALL_WRAP1(brk, unsigned long, brk);
81COMPAT_SYSCALL_WRAP2(signal, int, sig, __sighandler_t, handler);
82COMPAT_SYSCALL_WRAP1(acct, const char __user *, name);
83COMPAT_SYSCALL_WRAP2(umount, char __user *, name, int, flags);
84COMPAT_SYSCALL_WRAP2(setpgid, pid_t, pid, pid_t, pgid);
85COMPAT_SYSCALL_WRAP1(umask, int, mask);
86COMPAT_SYSCALL_WRAP1(chroot, const char __user *, filename);
87COMPAT_SYSCALL_WRAP2(dup2, unsigned int, oldfd, unsigned int, newfd);
88COMPAT_SYSCALL_WRAP3(sigsuspend, int, unused1, int, unused2, old_sigset_t, mask);
89COMPAT_SYSCALL_WRAP2(sethostname, char __user *, name, int, len);
90COMPAT_SYSCALL_WRAP2(symlink, const char __user *, old, const char __user *, new);
91COMPAT_SYSCALL_WRAP3(readlink, const char __user *, path, char __user *, buf, int, bufsiz);
92COMPAT_SYSCALL_WRAP1(uselib, const char __user *, library);
93COMPAT_SYSCALL_WRAP2(swapon, const char __user *, specialfile, int, swap_flags);
94COMPAT_SYSCALL_WRAP4(reboot, int, magic1, int, magic2, unsigned int, cmd, void __user *, arg);
95COMPAT_SYSCALL_WRAP2(munmap, unsigned long, addr, size_t, len);
96COMPAT_SYSCALL_WRAP2(fchmod, unsigned int, fd, umode_t, mode);
97COMPAT_SYSCALL_WRAP2(getpriority, int, which, int, who);
98COMPAT_SYSCALL_WRAP3(setpriority, int, which, int, who, int, niceval);
99COMPAT_SYSCALL_WRAP3(syslog, int, type, char __user *, buf, int, len);
100COMPAT_SYSCALL_WRAP1(swapoff, const char __user *, specialfile);
101COMPAT_SYSCALL_WRAP1(fsync, unsigned int, fd);
102COMPAT_SYSCALL_WRAP2(setdomainname, char __user *, name, int, len);
103COMPAT_SYSCALL_WRAP1(newuname, struct new_utsname __user *, name);
104COMPAT_SYSCALL_WRAP3(mprotect, unsigned long, start, size_t, len, unsigned long, prot);
105COMPAT_SYSCALL_WRAP3(init_module, void __user *, umod, unsigned long, len, const char __user *, uargs);
106COMPAT_SYSCALL_WRAP2(delete_module, const char __user *, name_user, unsigned int, flags);
107COMPAT_SYSCALL_WRAP4(quotactl, unsigned int, cmd, const char __user *, special, qid_t, id, void __user *, addr);
108COMPAT_SYSCALL_WRAP1(getpgid, pid_t, pid);
109COMPAT_SYSCALL_WRAP1(fchdir, unsigned int, fd);
110COMPAT_SYSCALL_WRAP2(bdflush, int, func, long, data);
111COMPAT_SYSCALL_WRAP3(sysfs, int, option, unsigned long, arg1, unsigned long, arg2);
112COMPAT_SYSCALL_WRAP1(s390_personality, unsigned int, personality);
113COMPAT_SYSCALL_WRAP5(llseek, unsigned int, fd, unsigned long, high, unsigned long, low, loff_t __user *, result, unsigned int, whence);
114COMPAT_SYSCALL_WRAP2(flock, unsigned int, fd, unsigned int, cmd);
115COMPAT_SYSCALL_WRAP3(msync, unsigned long, start, size_t, len, int, flags);
116COMPAT_SYSCALL_WRAP1(getsid, pid_t, pid);
117COMPAT_SYSCALL_WRAP1(fdatasync, unsigned int, fd);
118COMPAT_SYSCALL_WRAP2(mlock, unsigned long, start, size_t, len);
119COMPAT_SYSCALL_WRAP2(munlock, unsigned long, start, size_t, len);
120COMPAT_SYSCALL_WRAP1(mlockall, int, flags);
121COMPAT_SYSCALL_WRAP2(sched_setparam, pid_t, pid, struct sched_param __user *, param);
122COMPAT_SYSCALL_WRAP2(sched_getparam, pid_t, pid, struct sched_param __user *, param);
123COMPAT_SYSCALL_WRAP3(sched_setscheduler, pid_t, pid, int, policy, struct sched_param __user *, param);
124COMPAT_SYSCALL_WRAP1(sched_getscheduler, pid_t, pid);
125COMPAT_SYSCALL_WRAP1(sched_get_priority_max, int, policy);
126COMPAT_SYSCALL_WRAP1(sched_get_priority_min, int, policy);
127COMPAT_SYSCALL_WRAP5(mremap, unsigned long, addr, unsigned long, old_len, unsigned long, new_len, unsigned long, flags, unsigned long, new_addr);
128COMPAT_SYSCALL_WRAP3(poll, struct pollfd __user *, ufds, unsigned int, nfds, int, timeout);
129COMPAT_SYSCALL_WRAP5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, unsigned long, arg4, unsigned long, arg5);
130COMPAT_SYSCALL_WRAP2(getcwd, char __user *, buf, unsigned long, size);
131COMPAT_SYSCALL_WRAP2(capget, cap_user_header_t, header, cap_user_data_t, dataptr);
132COMPAT_SYSCALL_WRAP2(capset, cap_user_header_t, header, const cap_user_data_t, data);
133COMPAT_SYSCALL_WRAP3(lchown, const char __user *, filename, uid_t, user, gid_t, group);
134COMPAT_SYSCALL_WRAP2(setreuid, uid_t, ruid, uid_t, euid);
135COMPAT_SYSCALL_WRAP2(setregid, gid_t, rgid, gid_t, egid);
136COMPAT_SYSCALL_WRAP2(getgroups, int, gidsetsize, gid_t __user *, grouplist);
137COMPAT_SYSCALL_WRAP2(setgroups, int, gidsetsize, gid_t __user *, grouplist);
138COMPAT_SYSCALL_WRAP3(fchown, unsigned int, fd, uid_t, user, gid_t, group);
139COMPAT_SYSCALL_WRAP3(setresuid, uid_t, ruid, uid_t, euid, uid_t, suid);
140COMPAT_SYSCALL_WRAP3(getresuid, uid_t __user *, ruid, uid_t __user *, euid, uid_t __user *, suid);
141COMPAT_SYSCALL_WRAP3(setresgid, gid_t, rgid, gid_t, egid, gid_t, sgid);
142COMPAT_SYSCALL_WRAP3(getresgid, gid_t __user *, rgid, gid_t __user *, egid, gid_t __user *, sgid);
143COMPAT_SYSCALL_WRAP3(chown, const char __user *, filename, uid_t, user, gid_t, group);
144COMPAT_SYSCALL_WRAP1(setuid, uid_t, uid);
145COMPAT_SYSCALL_WRAP1(setgid, gid_t, gid);
146COMPAT_SYSCALL_WRAP1(setfsuid, uid_t, uid);
147COMPAT_SYSCALL_WRAP1(setfsgid, gid_t, gid);
148COMPAT_SYSCALL_WRAP2(pivot_root, const char __user *, new_root, const char __user *, put_old);
149COMPAT_SYSCALL_WRAP3(mincore, unsigned long, start, size_t, len, unsigned char __user *, vec);
150COMPAT_SYSCALL_WRAP3(madvise, unsigned long, start, size_t, len, int, behavior);
151COMPAT_SYSCALL_WRAP5(setxattr, const char __user *, path, const char __user *, name, const void __user *, value, size_t, size, int, flags);
152COMPAT_SYSCALL_WRAP5(lsetxattr, const char __user *, path, const char __user *, name, const void __user *, value, size_t, size, int, flags);
153COMPAT_SYSCALL_WRAP5(fsetxattr, int, fd, const char __user *, name, const void __user *, value, size_t, size, int, flags);
154COMPAT_SYSCALL_WRAP3(getdents64, unsigned int, fd, struct linux_dirent64 __user *, dirent, unsigned int, count);
155COMPAT_SYSCALL_WRAP4(getxattr, const char __user *, path, const char __user *, name, void __user *, value, size_t, size);
156COMPAT_SYSCALL_WRAP4(lgetxattr, const char __user *, path, const char __user *, name, void __user *, value, size_t, size);
157COMPAT_SYSCALL_WRAP4(fgetxattr, int, fd, const char __user *, name, void __user *, value, size_t, size);
158COMPAT_SYSCALL_WRAP3(listxattr, const char __user *, path, char __user *, list, size_t, size);
159COMPAT_SYSCALL_WRAP3(llistxattr, const char __user *, path, char __user *, list, size_t, size);
160COMPAT_SYSCALL_WRAP3(flistxattr, int, fd, char __user *, list, size_t, size);
161COMPAT_SYSCALL_WRAP2(removexattr, const char __user *, path, const char __user *, name);
162COMPAT_SYSCALL_WRAP2(lremovexattr, const char __user *, path, const char __user *, name);
163COMPAT_SYSCALL_WRAP2(fremovexattr, int, fd, const char __user *, name);
164COMPAT_SYSCALL_WRAP1(exit_group, int, error_code);
165COMPAT_SYSCALL_WRAP1(set_tid_address, int __user *, tidptr);
166COMPAT_SYSCALL_WRAP1(epoll_create, int, size);
167COMPAT_SYSCALL_WRAP4(epoll_ctl, int, epfd, int, op, int, fd, struct epoll_event __user *, event);
168COMPAT_SYSCALL_WRAP4(epoll_wait, int, epfd, struct epoll_event __user *, events, int, maxevents, int, timeout);
169COMPAT_SYSCALL_WRAP1(timer_getoverrun, timer_t, timer_id);
170COMPAT_SYSCALL_WRAP1(timer_delete, compat_timer_t, compat_timer_id);
171COMPAT_SYSCALL_WRAP1(io_destroy, aio_context_t, ctx);
172COMPAT_SYSCALL_WRAP3(io_cancel, aio_context_t, ctx_id, struct iocb __user *, iocb, struct io_event __user *, result);
173COMPAT_SYSCALL_WRAP1(mq_unlink, const char __user *, name);
174COMPAT_SYSCALL_WRAP5(add_key, const char __user *, tp, const char __user *, dsc, const void __user *, pld, size_t, len, key_serial_t, id);
175COMPAT_SYSCALL_WRAP4(request_key, const char __user *, tp, const char __user *, dsc, const char __user *, info, key_serial_t, id);
176COMPAT_SYSCALL_WRAP5(remap_file_pages, unsigned long, start, unsigned long, size, unsigned long, prot, unsigned long, pgoff, unsigned long, flags);
177COMPAT_SYSCALL_WRAP3(ioprio_set, int, which, int, who, int, ioprio);
178COMPAT_SYSCALL_WRAP2(ioprio_get, int, which, int, who);
179COMPAT_SYSCALL_WRAP3(inotify_add_watch, int, fd, const char __user *, path, u32, mask);
180COMPAT_SYSCALL_WRAP2(inotify_rm_watch, int, fd, __s32, wd);
181COMPAT_SYSCALL_WRAP3(mkdirat, int, dfd, const char __user *, pathname, umode_t, mode);
182COMPAT_SYSCALL_WRAP4(mknodat, int, dfd, const char __user *, filename, umode_t, mode, unsigned, dev);
183COMPAT_SYSCALL_WRAP5(fchownat, int, dfd, const char __user *, filename, uid_t, user, gid_t, group, int, flag);
184COMPAT_SYSCALL_WRAP3(unlinkat, int, dfd, const char __user *, pathname, int, flag);
185COMPAT_SYSCALL_WRAP4(renameat, int, olddfd, const char __user *, oldname, int, newdfd, const char __user *, newname);
186COMPAT_SYSCALL_WRAP5(linkat, int, olddfd, const char __user *, oldname, int, newdfd, const char __user *, newname, int, flags);
187COMPAT_SYSCALL_WRAP3(symlinkat, const char __user *, oldname, int, newdfd, const char __user *, newname);
188COMPAT_SYSCALL_WRAP4(readlinkat, int, dfd, const char __user *, path, char __user *, buf, int, bufsiz);
189COMPAT_SYSCALL_WRAP3(fchmodat, int, dfd, const char __user *, filename, umode_t, mode);
190COMPAT_SYSCALL_WRAP3(faccessat, int, dfd, const char __user *, filename, int, mode);
191COMPAT_SYSCALL_WRAP1(unshare, unsigned long, unshare_flags);
192COMPAT_SYSCALL_WRAP6(splice, int, fd_in, loff_t __user *, off_in, int, fd_out, loff_t __user *, off_out, size_t, len, unsigned int, flags);
193COMPAT_SYSCALL_WRAP4(tee, int, fdin, int, fdout, size_t, len, unsigned int, flags);
194COMPAT_SYSCALL_WRAP3(getcpu, unsigned __user *, cpu, unsigned __user *, node, struct getcpu_cache __user *, cache);
195COMPAT_SYSCALL_WRAP1(eventfd, unsigned int, count);
196COMPAT_SYSCALL_WRAP2(timerfd_create, int, clockid, int, flags);
197COMPAT_SYSCALL_WRAP2(eventfd2, unsigned int, count, int, flags);
198COMPAT_SYSCALL_WRAP1(inotify_init1, int, flags);
199COMPAT_SYSCALL_WRAP2(pipe2, int __user *, fildes, int, flags);
200COMPAT_SYSCALL_WRAP3(dup3, unsigned int, oldfd, unsigned int, newfd, int, flags);
201COMPAT_SYSCALL_WRAP1(epoll_create1, int, flags);
202COMPAT_SYSCALL_WRAP2(tkill, int, pid, int, sig);
203COMPAT_SYSCALL_WRAP3(tgkill, int, tgid, int, pid, int, sig);
204COMPAT_SYSCALL_WRAP5(perf_event_open, struct perf_event_attr __user *, attr_uptr, pid_t, pid, int, cpu, int, group_fd, unsigned long, flags);
205COMPAT_SYSCALL_WRAP5(clone, unsigned long, newsp, unsigned long, clone_flags, int __user *, parent_tidptr, int __user *, child_tidptr, int, tls_val);
206COMPAT_SYSCALL_WRAP2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags);
207COMPAT_SYSCALL_WRAP4(prlimit64, pid_t, pid, unsigned int, resource, const struct rlimit64 __user *, new_rlim, struct rlimit64 __user *, old_rlim);
208COMPAT_SYSCALL_WRAP5(name_to_handle_at, int, dfd, const char __user *, name, struct file_handle __user *, handle, int __user *, mnt_id, int, flag);
209COMPAT_SYSCALL_WRAP1(syncfs, int, fd);
210COMPAT_SYSCALL_WRAP2(setns, int, fd, int, nstype);
211COMPAT_SYSCALL_WRAP2(s390_runtime_instr, int, command, int, signum);
212COMPAT_SYSCALL_WRAP5(kcmp, pid_t, pid1, pid_t, pid2, int, type, unsigned long, idx1, unsigned long, idx2);
213COMPAT_SYSCALL_WRAP3(finit_module, int, fd, const char __user *, uargs, int, flags);
214COMPAT_SYSCALL_WRAP3(sched_setattr, pid_t, pid, struct sched_attr __user *, attr, unsigned int, flags);
215COMPAT_SYSCALL_WRAP4(sched_getattr, pid_t, pid, struct sched_attr __user *, attr, unsigned int, size, unsigned int, flags);
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index fca20b5fe79e..6b594439cca5 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -380,8 +380,6 @@ static __init void detect_machine_facilities(void)
380 S390_lowcore.machine_flags |= MACHINE_FLAG_EDAT2; 380 S390_lowcore.machine_flags |= MACHINE_FLAG_EDAT2;
381 if (test_facility(3)) 381 if (test_facility(3))
382 S390_lowcore.machine_flags |= MACHINE_FLAG_IDTE; 382 S390_lowcore.machine_flags |= MACHINE_FLAG_IDTE;
383 if (test_facility(27))
384 S390_lowcore.machine_flags |= MACHINE_FLAG_MVCOS;
385 if (test_facility(40)) 383 if (test_facility(40))
386 S390_lowcore.machine_flags |= MACHINE_FLAG_LPP; 384 S390_lowcore.machine_flags |= MACHINE_FLAG_LPP;
387 if (test_facility(50) && test_facility(73)) 385 if (test_facility(50) && test_facility(73))
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 0dc2b6d0a1ec..526d3735ed29 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -43,6 +43,7 @@ _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \
43 _TIF_MCCK_PENDING) 43 _TIF_MCCK_PENDING)
44_TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \ 44_TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \
45 _TIF_SYSCALL_TRACEPOINT) 45 _TIF_SYSCALL_TRACEPOINT)
46_TIF_TRANSFER = (_TIF_MCCK_PENDING | _TIF_TLB_WAIT)
46 47
47STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER 48STACK_SHIFT = PAGE_SHIFT + THREAD_ORDER
48STACK_SIZE = 1 << STACK_SHIFT 49STACK_SIZE = 1 << STACK_SHIFT
@@ -159,10 +160,12 @@ ENTRY(__switch_to)
159 lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4 160 lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4
160 mvc __LC_CURRENT_PID(4,%r0),__TASK_pid(%r3) # store pid of next 161 mvc __LC_CURRENT_PID(4,%r0),__TASK_pid(%r3) # store pid of next
161 l %r15,__THREAD_ksp(%r3) # load kernel stack of next 162 l %r15,__THREAD_ksp(%r3) # load kernel stack of next
162 tm __TI_flags+3(%r4),_TIF_MCCK_PENDING # machine check pending? 163 lhi %r6,_TIF_TRANSFER # transfer TIF bits
164 n %r6,__TI_flags(%r4) # isolate TIF bits
163 jz 0f 165 jz 0f
164 ni __TI_flags+3(%r4),255-_TIF_MCCK_PENDING # clear flag in prev 166 o %r6,__TI_flags(%r5) # set TIF bits of next
165 oi __TI_flags+3(%r5),_TIF_MCCK_PENDING # set it in next 167 st %r6,__TI_flags(%r5)
168 ni __TI_flags+3(%r4),255-_TIF_TRANSFER # clear TIF bits of prev
1660: lm %r6,%r15,__SF_GPRS(%r15) # load gprs of next task 1690: lm %r6,%r15,__SF_GPRS(%r15) # load gprs of next task
167 br %r14 170 br %r14
168 171
diff --git a/arch/s390/kernel/entry.h b/arch/s390/kernel/entry.h
index cb533f78c09e..6ac78192455f 100644
--- a/arch/s390/kernel/entry.h
+++ b/arch/s390/kernel/entry.h
@@ -67,9 +67,7 @@ struct s390_mmap_arg_struct;
67struct fadvise64_64_args; 67struct fadvise64_64_args;
68struct old_sigaction; 68struct old_sigaction;
69 69
70long sys_sigreturn(void); 70long sys_s390_personality(unsigned int personality);
71long sys_rt_sigreturn(void); 71long sys_s390_runtime_instr(int command, int signum);
72long sys32_sigreturn(void);
73long sys32_rt_sigreturn(void);
74 72
75#endif /* _ENTRY_H */ 73#endif /* _ENTRY_H */
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 384e609b4711..e09dbe5f2901 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -48,6 +48,7 @@ _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_NEED_RESCHED | \
48 _TIF_MCCK_PENDING) 48 _TIF_MCCK_PENDING)
49_TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \ 49_TIF_TRACE = (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \
50 _TIF_SYSCALL_TRACEPOINT) 50 _TIF_SYSCALL_TRACEPOINT)
51_TIF_TRANSFER = (_TIF_MCCK_PENDING | _TIF_TLB_WAIT)
51 52
52#define BASED(name) name-system_call(%r13) 53#define BASED(name) name-system_call(%r13)
53 54
@@ -189,10 +190,12 @@ ENTRY(__switch_to)
189 lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4 190 lctl %c4,%c4,__TASK_pid(%r3) # load pid to control reg. 4
190 mvc __LC_CURRENT_PID+4(4,%r0),__TASK_pid(%r3) # store pid of next 191 mvc __LC_CURRENT_PID+4(4,%r0),__TASK_pid(%r3) # store pid of next
191 lg %r15,__THREAD_ksp(%r3) # load kernel stack of next 192 lg %r15,__THREAD_ksp(%r3) # load kernel stack of next
192 tm __TI_flags+7(%r4),_TIF_MCCK_PENDING # machine check pending? 193 llill %r6,_TIF_TRANSFER # transfer TIF bits
194 ng %r6,__TI_flags(%r4) # isolate TIF bits
193 jz 0f 195 jz 0f
194 ni __TI_flags+7(%r4),255-_TIF_MCCK_PENDING # clear flag in prev 196 og %r6,__TI_flags(%r5) # set TIF bits of next
195 oi __TI_flags+7(%r5),_TIF_MCCK_PENDING # set it in next 197 stg %r6,__TI_flags(%r5)
198 ni __TI_flags+7(%r4),255-_TIF_TRANSFER # clear TIF bits of prev
1960: lmg %r6,%r15,__SF_GPRS(%r15) # load gprs of next task 1990: lmg %r6,%r15,__SF_GPRS(%r15) # load gprs of next task
197 br %r14 200 br %r14
198 201
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index bb27a262c44a..a770be97db4d 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -18,6 +18,7 @@
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/cpu.h> 20#include <linux/cpu.h>
21#include <linux/irq.h>
21#include <asm/irq_regs.h> 22#include <asm/irq_regs.h>
22#include <asm/cputime.h> 23#include <asm/cputime.h>
23#include <asm/lowcore.h> 24#include <asm/lowcore.h>
diff --git a/arch/s390/kernel/perf_event.c b/arch/s390/kernel/perf_event.c
index 5d2dfa31c4ef..61595c1f0a0f 100644
--- a/arch/s390/kernel/perf_event.c
+++ b/arch/s390/kernel/perf_event.c
@@ -121,7 +121,7 @@ unsigned long perf_misc_flags(struct pt_regs *regs)
121 : PERF_RECORD_MISC_KERNEL; 121 : PERF_RECORD_MISC_KERNEL;
122} 122}
123 123
124void print_debug_cf(void) 124static void print_debug_cf(void)
125{ 125{
126 struct cpumf_ctr_info cf_info; 126 struct cpumf_ctr_info cf_info;
127 int cpu = smp_processor_id(); 127 int cpu = smp_processor_id();
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index f6be6087a0e9..4ac8fafec95f 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -85,7 +85,10 @@ void update_cr_regs(struct task_struct *task)
85 85
86 /* merge TIF_SINGLE_STEP into user specified PER registers. */ 86 /* merge TIF_SINGLE_STEP into user specified PER registers. */
87 if (test_tsk_thread_flag(task, TIF_SINGLE_STEP)) { 87 if (test_tsk_thread_flag(task, TIF_SINGLE_STEP)) {
88 new.control |= PER_EVENT_IFETCH; 88 if (test_tsk_thread_flag(task, TIF_BLOCK_STEP))
89 new.control |= PER_EVENT_BRANCH;
90 else
91 new.control |= PER_EVENT_IFETCH;
89#ifdef CONFIG_64BIT 92#ifdef CONFIG_64BIT
90 new.control |= PER_CONTROL_SUSPENSION; 93 new.control |= PER_CONTROL_SUSPENSION;
91 new.control |= PER_EVENT_TRANSACTION_END; 94 new.control |= PER_EVENT_TRANSACTION_END;
@@ -107,14 +110,22 @@ void update_cr_regs(struct task_struct *task)
107 110
108void user_enable_single_step(struct task_struct *task) 111void user_enable_single_step(struct task_struct *task)
109{ 112{
113 clear_tsk_thread_flag(task, TIF_BLOCK_STEP);
110 set_tsk_thread_flag(task, TIF_SINGLE_STEP); 114 set_tsk_thread_flag(task, TIF_SINGLE_STEP);
111} 115}
112 116
113void user_disable_single_step(struct task_struct *task) 117void user_disable_single_step(struct task_struct *task)
114{ 118{
119 clear_tsk_thread_flag(task, TIF_BLOCK_STEP);
115 clear_tsk_thread_flag(task, TIF_SINGLE_STEP); 120 clear_tsk_thread_flag(task, TIF_SINGLE_STEP);
116} 121}
117 122
123void user_enable_block_step(struct task_struct *task)
124{
125 set_tsk_thread_flag(task, TIF_SINGLE_STEP);
126 set_tsk_thread_flag(task, TIF_BLOCK_STEP);
127}
128
118/* 129/*
119 * Called by kernel/ptrace.c when detaching.. 130 * Called by kernel/ptrace.c when detaching..
120 * 131 *
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 09e2f468f48b..f70f2489fa5f 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -47,7 +47,6 @@
47#include <linux/compat.h> 47#include <linux/compat.h>
48 48
49#include <asm/ipl.h> 49#include <asm/ipl.h>
50#include <asm/uaccess.h>
51#include <asm/facility.h> 50#include <asm/facility.h>
52#include <asm/smp.h> 51#include <asm/smp.h>
53#include <asm/mmu_context.h> 52#include <asm/mmu_context.h>
@@ -65,12 +64,6 @@
65#include "entry.h" 64#include "entry.h"
66 65
67/* 66/*
68 * User copy operations.
69 */
70struct uaccess_ops uaccess;
71EXPORT_SYMBOL(uaccess);
72
73/*
74 * Machine setup.. 67 * Machine setup..
75 */ 68 */
76unsigned int console_mode = 0; 69unsigned int console_mode = 0;
@@ -294,14 +287,6 @@ static int __init parse_vmalloc(char *arg)
294} 287}
295early_param("vmalloc", parse_vmalloc); 288early_param("vmalloc", parse_vmalloc);
296 289
297static int __init early_parse_user_mode(char *p)
298{
299 if (!p || strcmp(p, "primary") == 0)
300 return 0;
301 return 1;
302}
303early_param("user_mode", early_parse_user_mode);
304
305void *restart_stack __attribute__((__section__(".data"))); 290void *restart_stack __attribute__((__section__(".data")));
306 291
307static void __init setup_lowcore(void) 292static void __init setup_lowcore(void)
@@ -1009,8 +994,6 @@ void __init setup_arch(char **cmdline_p)
1009 init_mm.end_data = (unsigned long) &_edata; 994 init_mm.end_data = (unsigned long) &_edata;
1010 init_mm.brk = (unsigned long) &_end; 995 init_mm.brk = (unsigned long) &_end;
1011 996
1012 uaccess = MACHINE_HAS_MVCOS ? uaccess_mvcos : uaccess_pt;
1013
1014 parse_early_param(); 997 parse_early_param();
1015 detect_memory_layout(memory_chunk, memory_end); 998 detect_memory_layout(memory_chunk, memory_end);
1016 os_info_init(); 999 os_info_init();
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index a7125b62a9a6..8827883310dd 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -773,11 +773,11 @@ void __noreturn cpu_die(void)
773 773
774void __init smp_fill_possible_mask(void) 774void __init smp_fill_possible_mask(void)
775{ 775{
776 unsigned int possible, cpu; 776 unsigned int possible, sclp, cpu;
777 777
778 possible = setup_possible_cpus; 778 sclp = sclp_get_max_cpu() ?: nr_cpu_ids;
779 if (!possible) 779 possible = setup_possible_cpus ?: nr_cpu_ids;
780 possible = MACHINE_IS_VM ? 64 : nr_cpu_ids; 780 possible = min(possible, sclp);
781 for (cpu = 0; cpu < possible && cpu < nr_cpu_ids; cpu++) 781 for (cpu = 0; cpu < possible && cpu < nr_cpu_ids; cpu++)
782 set_cpu_possible(cpu, true); 782 set_cpu_possible(cpu, true);
783} 783}
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index 143992152ec9..542ef488bac1 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -9,349 +9,349 @@
9#define NI_SYSCALL SYSCALL(sys_ni_syscall,sys_ni_syscall,sys_ni_syscall) 9#define NI_SYSCALL SYSCALL(sys_ni_syscall,sys_ni_syscall,sys_ni_syscall)
10 10
11NI_SYSCALL /* 0 */ 11NI_SYSCALL /* 0 */
12SYSCALL(sys_exit,sys_exit,sys32_exit_wrapper) 12SYSCALL(sys_exit,sys_exit,compat_sys_exit)
13SYSCALL(sys_fork,sys_fork,sys_fork) 13SYSCALL(sys_fork,sys_fork,sys_fork)
14SYSCALL(sys_read,sys_read,sys32_read_wrapper) 14SYSCALL(sys_read,sys_read,compat_sys_s390_read)
15SYSCALL(sys_write,sys_write,sys32_write_wrapper) 15SYSCALL(sys_write,sys_write,compat_sys_s390_write)
16SYSCALL(sys_open,sys_open,compat_sys_open) /* 5 */ 16SYSCALL(sys_open,sys_open,compat_sys_open) /* 5 */
17SYSCALL(sys_close,sys_close,sys32_close_wrapper) 17SYSCALL(sys_close,sys_close,compat_sys_close)
18SYSCALL(sys_restart_syscall,sys_restart_syscall,sys_restart_syscall) 18SYSCALL(sys_restart_syscall,sys_restart_syscall,sys_restart_syscall)
19SYSCALL(sys_creat,sys_creat,sys32_creat_wrapper) 19SYSCALL(sys_creat,sys_creat,compat_sys_creat)
20SYSCALL(sys_link,sys_link,sys32_link_wrapper) 20SYSCALL(sys_link,sys_link,compat_sys_link)
21SYSCALL(sys_unlink,sys_unlink,sys32_unlink_wrapper) /* 10 */ 21SYSCALL(sys_unlink,sys_unlink,compat_sys_unlink) /* 10 */
22SYSCALL(sys_execve,sys_execve,sys32_execve_wrapper) 22SYSCALL(sys_execve,sys_execve,compat_sys_execve)
23SYSCALL(sys_chdir,sys_chdir,sys32_chdir_wrapper) 23SYSCALL(sys_chdir,sys_chdir,compat_sys_chdir)
24SYSCALL(sys_time,sys_ni_syscall,sys32_time_wrapper) /* old time syscall */ 24SYSCALL(sys_time,sys_ni_syscall,compat_sys_time) /* old time syscall */
25SYSCALL(sys_mknod,sys_mknod,sys32_mknod_wrapper) 25SYSCALL(sys_mknod,sys_mknod,compat_sys_mknod)
26SYSCALL(sys_chmod,sys_chmod,sys32_chmod_wrapper) /* 15 */ 26SYSCALL(sys_chmod,sys_chmod,compat_sys_chmod) /* 15 */
27SYSCALL(sys_lchown16,sys_ni_syscall,sys32_lchown16_wrapper) /* old lchown16 syscall*/ 27SYSCALL(sys_lchown16,sys_ni_syscall,compat_sys_s390_lchown16) /* old lchown16 syscall*/
28NI_SYSCALL /* old break syscall holder */ 28NI_SYSCALL /* old break syscall holder */
29NI_SYSCALL /* old stat syscall holder */ 29NI_SYSCALL /* old stat syscall holder */
30SYSCALL(sys_lseek,sys_lseek,compat_sys_lseek) 30SYSCALL(sys_lseek,sys_lseek,compat_sys_lseek)
31SYSCALL(sys_getpid,sys_getpid,sys_getpid) /* 20 */ 31SYSCALL(sys_getpid,sys_getpid,sys_getpid) /* 20 */
32SYSCALL(sys_mount,sys_mount,sys32_mount_wrapper) 32SYSCALL(sys_mount,sys_mount,compat_sys_mount)
33SYSCALL(sys_oldumount,sys_oldumount,sys32_oldumount_wrapper) 33SYSCALL(sys_oldumount,sys_oldumount,compat_sys_oldumount)
34SYSCALL(sys_setuid16,sys_ni_syscall,sys32_setuid16_wrapper) /* old setuid16 syscall*/ 34SYSCALL(sys_setuid16,sys_ni_syscall,compat_sys_s390_setuid16) /* old setuid16 syscall*/
35SYSCALL(sys_getuid16,sys_ni_syscall,sys32_getuid16) /* old getuid16 syscall*/ 35SYSCALL(sys_getuid16,sys_ni_syscall,compat_sys_s390_getuid16) /* old getuid16 syscall*/
36SYSCALL(sys_stime,sys_ni_syscall,sys32_stime_wrapper) /* 25 old stime syscall */ 36SYSCALL(sys_stime,sys_ni_syscall,compat_sys_stime) /* 25 old stime syscall */
37SYSCALL(sys_ptrace,sys_ptrace,sys32_ptrace_wrapper) 37SYSCALL(sys_ptrace,sys_ptrace,compat_sys_ptrace)
38SYSCALL(sys_alarm,sys_alarm,sys32_alarm_wrapper) 38SYSCALL(sys_alarm,sys_alarm,compat_sys_alarm)
39NI_SYSCALL /* old fstat syscall */ 39NI_SYSCALL /* old fstat syscall */
40SYSCALL(sys_pause,sys_pause,sys_pause) 40SYSCALL(sys_pause,sys_pause,sys_pause)
41SYSCALL(sys_utime,sys_utime,compat_sys_utime_wrapper) /* 30 */ 41SYSCALL(sys_utime,sys_utime,compat_sys_utime) /* 30 */
42NI_SYSCALL /* old stty syscall */ 42NI_SYSCALL /* old stty syscall */
43NI_SYSCALL /* old gtty syscall */ 43NI_SYSCALL /* old gtty syscall */
44SYSCALL(sys_access,sys_access,sys32_access_wrapper) 44SYSCALL(sys_access,sys_access,compat_sys_access)
45SYSCALL(sys_nice,sys_nice,sys32_nice_wrapper) 45SYSCALL(sys_nice,sys_nice,compat_sys_nice)
46NI_SYSCALL /* 35 old ftime syscall */ 46NI_SYSCALL /* 35 old ftime syscall */
47SYSCALL(sys_sync,sys_sync,sys_sync) 47SYSCALL(sys_sync,sys_sync,sys_sync)
48SYSCALL(sys_kill,sys_kill,sys32_kill_wrapper) 48SYSCALL(sys_kill,sys_kill,compat_sys_kill)
49SYSCALL(sys_rename,sys_rename,sys32_rename_wrapper) 49SYSCALL(sys_rename,sys_rename,compat_sys_rename)
50SYSCALL(sys_mkdir,sys_mkdir,sys32_mkdir_wrapper) 50SYSCALL(sys_mkdir,sys_mkdir,compat_sys_mkdir)
51SYSCALL(sys_rmdir,sys_rmdir,sys32_rmdir_wrapper) /* 40 */ 51SYSCALL(sys_rmdir,sys_rmdir,compat_sys_rmdir) /* 40 */
52SYSCALL(sys_dup,sys_dup,sys32_dup_wrapper) 52SYSCALL(sys_dup,sys_dup,compat_sys_dup)
53SYSCALL(sys_pipe,sys_pipe,sys32_pipe_wrapper) 53SYSCALL(sys_pipe,sys_pipe,compat_sys_pipe)
54SYSCALL(sys_times,sys_times,compat_sys_times_wrapper) 54SYSCALL(sys_times,sys_times,compat_sys_times)
55NI_SYSCALL /* old prof syscall */ 55NI_SYSCALL /* old prof syscall */
56SYSCALL(sys_brk,sys_brk,sys32_brk_wrapper) /* 45 */ 56SYSCALL(sys_brk,sys_brk,compat_sys_brk) /* 45 */
57SYSCALL(sys_setgid16,sys_ni_syscall,sys32_setgid16_wrapper) /* old setgid16 syscall*/ 57SYSCALL(sys_setgid16,sys_ni_syscall,compat_sys_s390_setgid16) /* old setgid16 syscall*/
58SYSCALL(sys_getgid16,sys_ni_syscall,sys32_getgid16) /* old getgid16 syscall*/ 58SYSCALL(sys_getgid16,sys_ni_syscall,compat_sys_s390_getgid16) /* old getgid16 syscall*/
59SYSCALL(sys_signal,sys_signal,sys32_signal_wrapper) 59SYSCALL(sys_signal,sys_signal,compat_sys_signal)
60SYSCALL(sys_geteuid16,sys_ni_syscall,sys32_geteuid16) /* old geteuid16 syscall */ 60SYSCALL(sys_geteuid16,sys_ni_syscall,compat_sys_s390_geteuid16) /* old geteuid16 syscall */
61SYSCALL(sys_getegid16,sys_ni_syscall,sys32_getegid16) /* 50 old getegid16 syscall */ 61SYSCALL(sys_getegid16,sys_ni_syscall,compat_sys_s390_getegid16) /* 50 old getegid16 syscall */
62SYSCALL(sys_acct,sys_acct,sys32_acct_wrapper) 62SYSCALL(sys_acct,sys_acct,compat_sys_acct)
63SYSCALL(sys_umount,sys_umount,sys32_umount_wrapper) 63SYSCALL(sys_umount,sys_umount,compat_sys_umount)
64NI_SYSCALL /* old lock syscall */ 64NI_SYSCALL /* old lock syscall */
65SYSCALL(sys_ioctl,sys_ioctl,compat_sys_ioctl_wrapper) 65SYSCALL(sys_ioctl,sys_ioctl,compat_sys_ioctl)
66SYSCALL(sys_fcntl,sys_fcntl,compat_sys_fcntl_wrapper) /* 55 */ 66SYSCALL(sys_fcntl,sys_fcntl,compat_sys_fcntl) /* 55 */
67NI_SYSCALL /* intel mpx syscall */ 67NI_SYSCALL /* intel mpx syscall */
68SYSCALL(sys_setpgid,sys_setpgid,sys32_setpgid_wrapper) 68SYSCALL(sys_setpgid,sys_setpgid,compat_sys_setpgid)
69NI_SYSCALL /* old ulimit syscall */ 69NI_SYSCALL /* old ulimit syscall */
70NI_SYSCALL /* old uname syscall */ 70NI_SYSCALL /* old uname syscall */
71SYSCALL(sys_umask,sys_umask,sys32_umask_wrapper) /* 60 */ 71SYSCALL(sys_umask,sys_umask,compat_sys_umask) /* 60 */
72SYSCALL(sys_chroot,sys_chroot,sys32_chroot_wrapper) 72SYSCALL(sys_chroot,sys_chroot,compat_sys_chroot)
73SYSCALL(sys_ustat,sys_ustat,sys32_ustat_wrapper) 73SYSCALL(sys_ustat,sys_ustat,compat_sys_ustat)
74SYSCALL(sys_dup2,sys_dup2,sys32_dup2_wrapper) 74SYSCALL(sys_dup2,sys_dup2,compat_sys_dup2)
75SYSCALL(sys_getppid,sys_getppid,sys_getppid) 75SYSCALL(sys_getppid,sys_getppid,sys_getppid)
76SYSCALL(sys_getpgrp,sys_getpgrp,sys_getpgrp) /* 65 */ 76SYSCALL(sys_getpgrp,sys_getpgrp,sys_getpgrp) /* 65 */
77SYSCALL(sys_setsid,sys_setsid,sys_setsid) 77SYSCALL(sys_setsid,sys_setsid,sys_setsid)
78SYSCALL(sys_sigaction,sys_sigaction,compat_sys_sigaction) 78SYSCALL(sys_sigaction,sys_sigaction,compat_sys_sigaction)
79NI_SYSCALL /* old sgetmask syscall*/ 79NI_SYSCALL /* old sgetmask syscall*/
80NI_SYSCALL /* old ssetmask syscall*/ 80NI_SYSCALL /* old ssetmask syscall*/
81SYSCALL(sys_setreuid16,sys_ni_syscall,sys32_setreuid16_wrapper) /* old setreuid16 syscall */ 81SYSCALL(sys_setreuid16,sys_ni_syscall,compat_sys_s390_setreuid16) /* old setreuid16 syscall */
82SYSCALL(sys_setregid16,sys_ni_syscall,sys32_setregid16_wrapper) /* old setregid16 syscall */ 82SYSCALL(sys_setregid16,sys_ni_syscall,compat_sys_s390_setregid16) /* old setregid16 syscall */
83SYSCALL(sys_sigsuspend,sys_sigsuspend,sys_sigsuspend_wrapper) 83SYSCALL(sys_sigsuspend,sys_sigsuspend,compat_sys_sigsuspend)
84SYSCALL(sys_sigpending,sys_sigpending,compat_sys_sigpending_wrapper) 84SYSCALL(sys_sigpending,sys_sigpending,compat_sys_sigpending)
85SYSCALL(sys_sethostname,sys_sethostname,sys32_sethostname_wrapper) 85SYSCALL(sys_sethostname,sys_sethostname,compat_sys_sethostname)
86SYSCALL(sys_setrlimit,sys_setrlimit,compat_sys_setrlimit_wrapper) /* 75 */ 86SYSCALL(sys_setrlimit,sys_setrlimit,compat_sys_setrlimit) /* 75 */
87SYSCALL(sys_old_getrlimit,sys_getrlimit,compat_sys_old_getrlimit_wrapper) 87SYSCALL(sys_old_getrlimit,sys_getrlimit,compat_sys_old_getrlimit)
88SYSCALL(sys_getrusage,sys_getrusage,compat_sys_getrusage) 88SYSCALL(sys_getrusage,sys_getrusage,compat_sys_getrusage)
89SYSCALL(sys_gettimeofday,sys_gettimeofday,compat_sys_gettimeofday_wrapper) 89SYSCALL(sys_gettimeofday,sys_gettimeofday,compat_sys_gettimeofday)
90SYSCALL(sys_settimeofday,sys_settimeofday,compat_sys_settimeofday_wrapper) 90SYSCALL(sys_settimeofday,sys_settimeofday,compat_sys_settimeofday)
91SYSCALL(sys_getgroups16,sys_ni_syscall,sys32_getgroups16_wrapper) /* 80 old getgroups16 syscall */ 91SYSCALL(sys_getgroups16,sys_ni_syscall,compat_sys_s390_getgroups16) /* 80 old getgroups16 syscall */
92SYSCALL(sys_setgroups16,sys_ni_syscall,sys32_setgroups16_wrapper) /* old setgroups16 syscall */ 92SYSCALL(sys_setgroups16,sys_ni_syscall,compat_sys_s390_setgroups16) /* old setgroups16 syscall */
93NI_SYSCALL /* old select syscall */ 93NI_SYSCALL /* old select syscall */
94SYSCALL(sys_symlink,sys_symlink,sys32_symlink_wrapper) 94SYSCALL(sys_symlink,sys_symlink,compat_sys_symlink)
95NI_SYSCALL /* old lstat syscall */ 95NI_SYSCALL /* old lstat syscall */
96SYSCALL(sys_readlink,sys_readlink,sys32_readlink_wrapper) /* 85 */ 96SYSCALL(sys_readlink,sys_readlink,compat_sys_readlink) /* 85 */
97SYSCALL(sys_uselib,sys_uselib,sys32_uselib_wrapper) 97SYSCALL(sys_uselib,sys_uselib,compat_sys_uselib)
98SYSCALL(sys_swapon,sys_swapon,sys32_swapon_wrapper) 98SYSCALL(sys_swapon,sys_swapon,compat_sys_swapon)
99SYSCALL(sys_reboot,sys_reboot,sys32_reboot_wrapper) 99SYSCALL(sys_reboot,sys_reboot,compat_sys_reboot)
100SYSCALL(sys_ni_syscall,sys_ni_syscall,old32_readdir_wrapper) /* old readdir syscall */ 100SYSCALL(sys_ni_syscall,sys_ni_syscall,compat_sys_old_readdir) /* old readdir syscall */
101SYSCALL(sys_old_mmap,sys_old_mmap,old32_mmap_wrapper) /* 90 */ 101SYSCALL(sys_old_mmap,sys_old_mmap,compat_sys_s390_old_mmap) /* 90 */
102SYSCALL(sys_munmap,sys_munmap,sys32_munmap_wrapper) 102SYSCALL(sys_munmap,sys_munmap,compat_sys_munmap)
103SYSCALL(sys_truncate,sys_truncate,compat_sys_truncate) 103SYSCALL(sys_truncate,sys_truncate,compat_sys_truncate)
104SYSCALL(sys_ftruncate,sys_ftruncate,compat_sys_ftruncate) 104SYSCALL(sys_ftruncate,sys_ftruncate,compat_sys_ftruncate)
105SYSCALL(sys_fchmod,sys_fchmod,sys32_fchmod_wrapper) 105SYSCALL(sys_fchmod,sys_fchmod,compat_sys_fchmod)
106SYSCALL(sys_fchown16,sys_ni_syscall,sys32_fchown16_wrapper) /* 95 old fchown16 syscall*/ 106SYSCALL(sys_fchown16,sys_ni_syscall,compat_sys_s390_fchown16) /* 95 old fchown16 syscall*/
107SYSCALL(sys_getpriority,sys_getpriority,sys32_getpriority_wrapper) 107SYSCALL(sys_getpriority,sys_getpriority,compat_sys_getpriority)
108SYSCALL(sys_setpriority,sys_setpriority,sys32_setpriority_wrapper) 108SYSCALL(sys_setpriority,sys_setpriority,compat_sys_setpriority)
109NI_SYSCALL /* old profil syscall */ 109NI_SYSCALL /* old profil syscall */
110SYSCALL(sys_statfs,sys_statfs,compat_sys_statfs_wrapper) 110SYSCALL(sys_statfs,sys_statfs,compat_sys_statfs)
111SYSCALL(sys_fstatfs,sys_fstatfs,compat_sys_fstatfs_wrapper) /* 100 */ 111SYSCALL(sys_fstatfs,sys_fstatfs,compat_sys_fstatfs) /* 100 */
112NI_SYSCALL /* ioperm for i386 */ 112NI_SYSCALL /* ioperm for i386 */
113SYSCALL(sys_socketcall,sys_socketcall,compat_sys_socketcall_wrapper) 113SYSCALL(sys_socketcall,sys_socketcall,compat_sys_socketcall)
114SYSCALL(sys_syslog,sys_syslog,sys32_syslog_wrapper) 114SYSCALL(sys_syslog,sys_syslog,compat_sys_syslog)
115SYSCALL(sys_setitimer,sys_setitimer,compat_sys_setitimer) 115SYSCALL(sys_setitimer,sys_setitimer,compat_sys_setitimer)
116SYSCALL(sys_getitimer,sys_getitimer,compat_sys_getitimer) /* 105 */ 116SYSCALL(sys_getitimer,sys_getitimer,compat_sys_getitimer) /* 105 */
117SYSCALL(sys_newstat,sys_newstat,compat_sys_newstat_wrapper) 117SYSCALL(sys_newstat,sys_newstat,compat_sys_newstat)
118SYSCALL(sys_newlstat,sys_newlstat,compat_sys_newlstat_wrapper) 118SYSCALL(sys_newlstat,sys_newlstat,compat_sys_newlstat)
119SYSCALL(sys_newfstat,sys_newfstat,compat_sys_newfstat_wrapper) 119SYSCALL(sys_newfstat,sys_newfstat,compat_sys_newfstat)
120NI_SYSCALL /* old uname syscall */ 120NI_SYSCALL /* old uname syscall */
121SYSCALL(sys_lookup_dcookie,sys_lookup_dcookie,compat_sys_lookup_dcookie) /* 110 */ 121SYSCALL(sys_lookup_dcookie,sys_lookup_dcookie,compat_sys_lookup_dcookie) /* 110 */
122SYSCALL(sys_vhangup,sys_vhangup,sys_vhangup) 122SYSCALL(sys_vhangup,sys_vhangup,sys_vhangup)
123NI_SYSCALL /* old "idle" system call */ 123NI_SYSCALL /* old "idle" system call */
124NI_SYSCALL /* vm86old for i386 */ 124NI_SYSCALL /* vm86old for i386 */
125SYSCALL(sys_wait4,sys_wait4,compat_sys_wait4) 125SYSCALL(sys_wait4,sys_wait4,compat_sys_wait4)
126SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper) /* 115 */ 126SYSCALL(sys_swapoff,sys_swapoff,compat_sys_swapoff) /* 115 */
127SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo_wrapper) 127SYSCALL(sys_sysinfo,sys_sysinfo,compat_sys_sysinfo)
128SYSCALL(sys_s390_ipc,sys_s390_ipc,compat_sys_s390_ipc) 128SYSCALL(sys_s390_ipc,sys_s390_ipc,compat_sys_s390_ipc)
129SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper) 129SYSCALL(sys_fsync,sys_fsync,compat_sys_fsync)
130SYSCALL(sys_sigreturn,sys_sigreturn,sys32_sigreturn) 130SYSCALL(sys_sigreturn,sys_sigreturn,compat_sys_sigreturn)
131SYSCALL(sys_clone,sys_clone,sys_clone_wrapper) /* 120 */ 131SYSCALL(sys_clone,sys_clone,compat_sys_clone) /* 120 */
132SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper) 132SYSCALL(sys_setdomainname,sys_setdomainname,compat_sys_setdomainname)
133SYSCALL(sys_newuname,sys_newuname,sys32_newuname_wrapper) 133SYSCALL(sys_newuname,sys_newuname,compat_sys_newuname)
134NI_SYSCALL /* modify_ldt for i386 */ 134NI_SYSCALL /* modify_ldt for i386 */
135SYSCALL(sys_adjtimex,sys_adjtimex,compat_sys_adjtimex_wrapper) 135SYSCALL(sys_adjtimex,sys_adjtimex,compat_sys_adjtimex)
136SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper) /* 125 */ 136SYSCALL(sys_mprotect,sys_mprotect,compat_sys_mprotect) /* 125 */
137SYSCALL(sys_sigprocmask,sys_sigprocmask,compat_sys_sigprocmask) 137SYSCALL(sys_sigprocmask,sys_sigprocmask,compat_sys_sigprocmask)
138NI_SYSCALL /* old "create module" */ 138NI_SYSCALL /* old "create module" */
139SYSCALL(sys_init_module,sys_init_module,sys_init_module_wrapper) 139SYSCALL(sys_init_module,sys_init_module,compat_sys_init_module)
140SYSCALL(sys_delete_module,sys_delete_module,sys_delete_module_wrapper) 140SYSCALL(sys_delete_module,sys_delete_module,compat_sys_delete_module)
141NI_SYSCALL /* 130: old get_kernel_syms */ 141NI_SYSCALL /* 130: old get_kernel_syms */
142SYSCALL(sys_quotactl,sys_quotactl,sys32_quotactl_wrapper) 142SYSCALL(sys_quotactl,sys_quotactl,compat_sys_quotactl)
143SYSCALL(sys_getpgid,sys_getpgid,sys32_getpgid_wrapper) 143SYSCALL(sys_getpgid,sys_getpgid,compat_sys_getpgid)
144SYSCALL(sys_fchdir,sys_fchdir,sys32_fchdir_wrapper) 144SYSCALL(sys_fchdir,sys_fchdir,compat_sys_fchdir)
145SYSCALL(sys_bdflush,sys_bdflush,sys32_bdflush_wrapper) 145SYSCALL(sys_bdflush,sys_bdflush,compat_sys_bdflush)
146SYSCALL(sys_sysfs,sys_sysfs,sys32_sysfs_wrapper) /* 135 */ 146SYSCALL(sys_sysfs,sys_sysfs,compat_sys_sysfs) /* 135 */
147SYSCALL(sys_personality,sys_s390_personality,sys32_personality_wrapper) 147SYSCALL(sys_personality,sys_s390_personality,compat_sys_s390_personality)
148NI_SYSCALL /* for afs_syscall */ 148NI_SYSCALL /* for afs_syscall */
149SYSCALL(sys_setfsuid16,sys_ni_syscall,sys32_setfsuid16_wrapper) /* old setfsuid16 syscall */ 149SYSCALL(sys_setfsuid16,sys_ni_syscall,compat_sys_s390_setfsuid16) /* old setfsuid16 syscall */
150SYSCALL(sys_setfsgid16,sys_ni_syscall,sys32_setfsgid16_wrapper) /* old setfsgid16 syscall */ 150SYSCALL(sys_setfsgid16,sys_ni_syscall,compat_sys_s390_setfsgid16) /* old setfsgid16 syscall */
151SYSCALL(sys_llseek,sys_llseek,sys32_llseek_wrapper) /* 140 */ 151SYSCALL(sys_llseek,sys_llseek,compat_sys_llseek) /* 140 */
152SYSCALL(sys_getdents,sys_getdents,sys32_getdents_wrapper) 152SYSCALL(sys_getdents,sys_getdents,compat_sys_getdents)
153SYSCALL(sys_select,sys_select,compat_sys_select_wrapper) 153SYSCALL(sys_select,sys_select,compat_sys_select)
154SYSCALL(sys_flock,sys_flock,sys32_flock_wrapper) 154SYSCALL(sys_flock,sys_flock,compat_sys_flock)
155SYSCALL(sys_msync,sys_msync,sys32_msync_wrapper) 155SYSCALL(sys_msync,sys_msync,compat_sys_msync)
156SYSCALL(sys_readv,sys_readv,compat_sys_readv_wrapper) /* 145 */ 156SYSCALL(sys_readv,sys_readv,compat_sys_readv) /* 145 */
157SYSCALL(sys_writev,sys_writev,compat_sys_writev_wrapper) 157SYSCALL(sys_writev,sys_writev,compat_sys_writev)
158SYSCALL(sys_getsid,sys_getsid,sys32_getsid_wrapper) 158SYSCALL(sys_getsid,sys_getsid,compat_sys_getsid)
159SYSCALL(sys_fdatasync,sys_fdatasync,sys32_fdatasync_wrapper) 159SYSCALL(sys_fdatasync,sys_fdatasync,compat_sys_fdatasync)
160SYSCALL(sys_sysctl,sys_sysctl,compat_sys_sysctl) 160SYSCALL(sys_sysctl,sys_sysctl,compat_sys_sysctl)
161SYSCALL(sys_mlock,sys_mlock,sys32_mlock_wrapper) /* 150 */ 161SYSCALL(sys_mlock,sys_mlock,compat_sys_mlock) /* 150 */
162SYSCALL(sys_munlock,sys_munlock,sys32_munlock_wrapper) 162SYSCALL(sys_munlock,sys_munlock,compat_sys_munlock)
163SYSCALL(sys_mlockall,sys_mlockall,sys32_mlockall_wrapper) 163SYSCALL(sys_mlockall,sys_mlockall,compat_sys_mlockall)
164SYSCALL(sys_munlockall,sys_munlockall,sys_munlockall) 164SYSCALL(sys_munlockall,sys_munlockall,sys_munlockall)
165SYSCALL(sys_sched_setparam,sys_sched_setparam,sys32_sched_setparam_wrapper) 165SYSCALL(sys_sched_setparam,sys_sched_setparam,compat_sys_sched_setparam)
166SYSCALL(sys_sched_getparam,sys_sched_getparam,sys32_sched_getparam_wrapper) /* 155 */ 166SYSCALL(sys_sched_getparam,sys_sched_getparam,compat_sys_sched_getparam) /* 155 */
167SYSCALL(sys_sched_setscheduler,sys_sched_setscheduler,sys32_sched_setscheduler_wrapper) 167SYSCALL(sys_sched_setscheduler,sys_sched_setscheduler,compat_sys_sched_setscheduler)
168SYSCALL(sys_sched_getscheduler,sys_sched_getscheduler,sys32_sched_getscheduler_wrapper) 168SYSCALL(sys_sched_getscheduler,sys_sched_getscheduler,compat_sys_sched_getscheduler)
169SYSCALL(sys_sched_yield,sys_sched_yield,sys_sched_yield) 169SYSCALL(sys_sched_yield,sys_sched_yield,sys_sched_yield)
170SYSCALL(sys_sched_get_priority_max,sys_sched_get_priority_max,sys32_sched_get_priority_max_wrapper) 170SYSCALL(sys_sched_get_priority_max,sys_sched_get_priority_max,compat_sys_sched_get_priority_max)
171SYSCALL(sys_sched_get_priority_min,sys_sched_get_priority_min,sys32_sched_get_priority_min_wrapper) /* 160 */ 171SYSCALL(sys_sched_get_priority_min,sys_sched_get_priority_min,compat_sys_sched_get_priority_min) /* 160 */
172SYSCALL(sys_sched_rr_get_interval,sys_sched_rr_get_interval,compat_sys_sched_rr_get_interval) 172SYSCALL(sys_sched_rr_get_interval,sys_sched_rr_get_interval,compat_sys_sched_rr_get_interval)
173SYSCALL(sys_nanosleep,sys_nanosleep,compat_sys_nanosleep_wrapper) 173SYSCALL(sys_nanosleep,sys_nanosleep,compat_sys_nanosleep)
174SYSCALL(sys_mremap,sys_mremap,sys32_mremap_wrapper) 174SYSCALL(sys_mremap,sys_mremap,compat_sys_mremap)
175SYSCALL(sys_setresuid16,sys_ni_syscall,sys32_setresuid16_wrapper) /* old setresuid16 syscall */ 175SYSCALL(sys_setresuid16,sys_ni_syscall,compat_sys_s390_setresuid16) /* old setresuid16 syscall */
176SYSCALL(sys_getresuid16,sys_ni_syscall,sys32_getresuid16_wrapper) /* 165 old getresuid16 syscall */ 176SYSCALL(sys_getresuid16,sys_ni_syscall,compat_sys_s390_getresuid16) /* 165 old getresuid16 syscall */
177NI_SYSCALL /* for vm86 */ 177NI_SYSCALL /* for vm86 */
178NI_SYSCALL /* old sys_query_module */ 178NI_SYSCALL /* old sys_query_module */
179SYSCALL(sys_poll,sys_poll,sys32_poll_wrapper) 179SYSCALL(sys_poll,sys_poll,compat_sys_poll)
180NI_SYSCALL /* old nfsservctl */ 180NI_SYSCALL /* old nfsservctl */
181SYSCALL(sys_setresgid16,sys_ni_syscall,sys32_setresgid16_wrapper) /* 170 old setresgid16 syscall */ 181SYSCALL(sys_setresgid16,sys_ni_syscall,compat_sys_s390_setresgid16) /* 170 old setresgid16 syscall */
182SYSCALL(sys_getresgid16,sys_ni_syscall,sys32_getresgid16_wrapper) /* old getresgid16 syscall */ 182SYSCALL(sys_getresgid16,sys_ni_syscall,compat_sys_s390_getresgid16) /* old getresgid16 syscall */
183SYSCALL(sys_prctl,sys_prctl,sys32_prctl_wrapper) 183SYSCALL(sys_prctl,sys_prctl,compat_sys_prctl)
184SYSCALL(sys_rt_sigreturn,sys_rt_sigreturn,sys32_rt_sigreturn) 184SYSCALL(sys_rt_sigreturn,sys_rt_sigreturn,compat_sys_rt_sigreturn)
185SYSCALL(sys_rt_sigaction,sys_rt_sigaction,compat_sys_rt_sigaction) 185SYSCALL(sys_rt_sigaction,sys_rt_sigaction,compat_sys_rt_sigaction)
186SYSCALL(sys_rt_sigprocmask,sys_rt_sigprocmask,compat_sys_rt_sigprocmask) /* 175 */ 186SYSCALL(sys_rt_sigprocmask,sys_rt_sigprocmask,compat_sys_rt_sigprocmask) /* 175 */
187SYSCALL(sys_rt_sigpending,sys_rt_sigpending,compat_sys_rt_sigpending) 187SYSCALL(sys_rt_sigpending,sys_rt_sigpending,compat_sys_rt_sigpending)
188SYSCALL(sys_rt_sigtimedwait,sys_rt_sigtimedwait,compat_sys_rt_sigtimedwait) 188SYSCALL(sys_rt_sigtimedwait,sys_rt_sigtimedwait,compat_sys_rt_sigtimedwait)
189SYSCALL(sys_rt_sigqueueinfo,sys_rt_sigqueueinfo,compat_sys_rt_sigqueueinfo) 189SYSCALL(sys_rt_sigqueueinfo,sys_rt_sigqueueinfo,compat_sys_rt_sigqueueinfo)
190SYSCALL(sys_rt_sigsuspend,sys_rt_sigsuspend,compat_sys_rt_sigsuspend) 190SYSCALL(sys_rt_sigsuspend,sys_rt_sigsuspend,compat_sys_rt_sigsuspend)
191SYSCALL(sys_pread64,sys_pread64,sys32_pread64_wrapper) /* 180 */ 191SYSCALL(sys_pread64,sys_pread64,compat_sys_s390_pread64) /* 180 */
192SYSCALL(sys_pwrite64,sys_pwrite64,sys32_pwrite64_wrapper) 192SYSCALL(sys_pwrite64,sys_pwrite64,compat_sys_s390_pwrite64)
193SYSCALL(sys_chown16,sys_ni_syscall,sys32_chown16_wrapper) /* old chown16 syscall */ 193SYSCALL(sys_chown16,sys_ni_syscall,compat_sys_s390_chown16) /* old chown16 syscall */
194SYSCALL(sys_getcwd,sys_getcwd,sys32_getcwd_wrapper) 194SYSCALL(sys_getcwd,sys_getcwd,compat_sys_getcwd)
195SYSCALL(sys_capget,sys_capget,sys32_capget_wrapper) 195SYSCALL(sys_capget,sys_capget,compat_sys_capget)
196SYSCALL(sys_capset,sys_capset,sys32_capset_wrapper) /* 185 */ 196SYSCALL(sys_capset,sys_capset,compat_sys_capset) /* 185 */
197SYSCALL(sys_sigaltstack,sys_sigaltstack,compat_sys_sigaltstack) 197SYSCALL(sys_sigaltstack,sys_sigaltstack,compat_sys_sigaltstack)
198SYSCALL(sys_sendfile,sys_sendfile64,compat_sys_sendfile) 198SYSCALL(sys_sendfile,sys_sendfile64,compat_sys_sendfile)
199NI_SYSCALL /* streams1 */ 199NI_SYSCALL /* streams1 */
200NI_SYSCALL /* streams2 */ 200NI_SYSCALL /* streams2 */
201SYSCALL(sys_vfork,sys_vfork,sys_vfork) /* 190 */ 201SYSCALL(sys_vfork,sys_vfork,sys_vfork) /* 190 */
202SYSCALL(sys_getrlimit,sys_getrlimit,compat_sys_getrlimit_wrapper) 202SYSCALL(sys_getrlimit,sys_getrlimit,compat_sys_getrlimit)
203SYSCALL(sys_mmap2,sys_mmap2,sys32_mmap2_wrapper) 203SYSCALL(sys_mmap2,sys_mmap2,compat_sys_s390_mmap2)
204SYSCALL(sys_truncate64,sys_ni_syscall,sys32_truncate64_wrapper) 204SYSCALL(sys_truncate64,sys_ni_syscall,compat_sys_s390_truncate64)
205SYSCALL(sys_ftruncate64,sys_ni_syscall,sys32_ftruncate64_wrapper) 205SYSCALL(sys_ftruncate64,sys_ni_syscall,compat_sys_s390_ftruncate64)
206SYSCALL(sys_stat64,sys_ni_syscall,sys32_stat64_wrapper) /* 195 */ 206SYSCALL(sys_stat64,sys_ni_syscall,compat_sys_s390_stat64) /* 195 */
207SYSCALL(sys_lstat64,sys_ni_syscall,sys32_lstat64_wrapper) 207SYSCALL(sys_lstat64,sys_ni_syscall,compat_sys_s390_lstat64)
208SYSCALL(sys_fstat64,sys_ni_syscall,sys32_fstat64_wrapper) 208SYSCALL(sys_fstat64,sys_ni_syscall,compat_sys_s390_fstat64)
209SYSCALL(sys_lchown,sys_lchown,sys32_lchown_wrapper) 209SYSCALL(sys_lchown,sys_lchown,compat_sys_lchown)
210SYSCALL(sys_getuid,sys_getuid,sys_getuid) 210SYSCALL(sys_getuid,sys_getuid,sys_getuid)
211SYSCALL(sys_getgid,sys_getgid,sys_getgid) /* 200 */ 211SYSCALL(sys_getgid,sys_getgid,sys_getgid) /* 200 */
212SYSCALL(sys_geteuid,sys_geteuid,sys_geteuid) 212SYSCALL(sys_geteuid,sys_geteuid,sys_geteuid)
213SYSCALL(sys_getegid,sys_getegid,sys_getegid) 213SYSCALL(sys_getegid,sys_getegid,sys_getegid)
214SYSCALL(sys_setreuid,sys_setreuid,sys32_setreuid_wrapper) 214SYSCALL(sys_setreuid,sys_setreuid,compat_sys_setreuid)
215SYSCALL(sys_setregid,sys_setregid,sys32_setregid_wrapper) 215SYSCALL(sys_setregid,sys_setregid,compat_sys_setregid)
216SYSCALL(sys_getgroups,sys_getgroups,sys32_getgroups_wrapper) /* 205 */ 216SYSCALL(sys_getgroups,sys_getgroups,compat_sys_getgroups) /* 205 */
217SYSCALL(sys_setgroups,sys_setgroups,sys32_setgroups_wrapper) 217SYSCALL(sys_setgroups,sys_setgroups,compat_sys_setgroups)
218SYSCALL(sys_fchown,sys_fchown,sys32_fchown_wrapper) 218SYSCALL(sys_fchown,sys_fchown,compat_sys_fchown)
219SYSCALL(sys_setresuid,sys_setresuid,sys32_setresuid_wrapper) 219SYSCALL(sys_setresuid,sys_setresuid,compat_sys_setresuid)
220SYSCALL(sys_getresuid,sys_getresuid,sys32_getresuid_wrapper) 220SYSCALL(sys_getresuid,sys_getresuid,compat_sys_getresuid)
221SYSCALL(sys_setresgid,sys_setresgid,sys32_setresgid_wrapper) /* 210 */ 221SYSCALL(sys_setresgid,sys_setresgid,compat_sys_setresgid) /* 210 */
222SYSCALL(sys_getresgid,sys_getresgid,sys32_getresgid_wrapper) 222SYSCALL(sys_getresgid,sys_getresgid,compat_sys_getresgid)
223SYSCALL(sys_chown,sys_chown,sys32_chown_wrapper) 223SYSCALL(sys_chown,sys_chown,compat_sys_chown)
224SYSCALL(sys_setuid,sys_setuid,sys32_setuid_wrapper) 224SYSCALL(sys_setuid,sys_setuid,compat_sys_setuid)
225SYSCALL(sys_setgid,sys_setgid,sys32_setgid_wrapper) 225SYSCALL(sys_setgid,sys_setgid,compat_sys_setgid)
226SYSCALL(sys_setfsuid,sys_setfsuid,sys32_setfsuid_wrapper) /* 215 */ 226SYSCALL(sys_setfsuid,sys_setfsuid,compat_sys_setfsuid) /* 215 */
227SYSCALL(sys_setfsgid,sys_setfsgid,sys32_setfsgid_wrapper) 227SYSCALL(sys_setfsgid,sys_setfsgid,compat_sys_setfsgid)
228SYSCALL(sys_pivot_root,sys_pivot_root,sys32_pivot_root_wrapper) 228SYSCALL(sys_pivot_root,sys_pivot_root,compat_sys_pivot_root)
229SYSCALL(sys_mincore,sys_mincore,sys32_mincore_wrapper) 229SYSCALL(sys_mincore,sys_mincore,compat_sys_mincore)
230SYSCALL(sys_madvise,sys_madvise,sys32_madvise_wrapper) 230SYSCALL(sys_madvise,sys_madvise,compat_sys_madvise)
231SYSCALL(sys_getdents64,sys_getdents64,sys32_getdents64_wrapper) /* 220 */ 231SYSCALL(sys_getdents64,sys_getdents64,compat_sys_getdents64) /* 220 */
232SYSCALL(sys_fcntl64,sys_ni_syscall,compat_sys_fcntl64_wrapper) 232SYSCALL(sys_fcntl64,sys_ni_syscall,compat_sys_fcntl64)
233SYSCALL(sys_readahead,sys_readahead,sys32_readahead_wrapper) 233SYSCALL(sys_readahead,sys_readahead,compat_sys_s390_readahead)
234SYSCALL(sys_sendfile64,sys_ni_syscall,compat_sys_sendfile64) 234SYSCALL(sys_sendfile64,sys_ni_syscall,compat_sys_sendfile64)
235SYSCALL(sys_setxattr,sys_setxattr,sys32_setxattr_wrapper) 235SYSCALL(sys_setxattr,sys_setxattr,compat_sys_setxattr)
236SYSCALL(sys_lsetxattr,sys_lsetxattr,sys32_lsetxattr_wrapper) /* 225 */ 236SYSCALL(sys_lsetxattr,sys_lsetxattr,compat_sys_lsetxattr) /* 225 */
237SYSCALL(sys_fsetxattr,sys_fsetxattr,sys32_fsetxattr_wrapper) 237SYSCALL(sys_fsetxattr,sys_fsetxattr,compat_sys_fsetxattr)
238SYSCALL(sys_getxattr,sys_getxattr,sys32_getxattr_wrapper) 238SYSCALL(sys_getxattr,sys_getxattr,compat_sys_getxattr)
239SYSCALL(sys_lgetxattr,sys_lgetxattr,sys32_lgetxattr_wrapper) 239SYSCALL(sys_lgetxattr,sys_lgetxattr,compat_sys_lgetxattr)
240SYSCALL(sys_fgetxattr,sys_fgetxattr,sys32_fgetxattr_wrapper) 240SYSCALL(sys_fgetxattr,sys_fgetxattr,compat_sys_fgetxattr)
241SYSCALL(sys_listxattr,sys_listxattr,sys32_listxattr_wrapper) /* 230 */ 241SYSCALL(sys_listxattr,sys_listxattr,compat_sys_listxattr) /* 230 */
242SYSCALL(sys_llistxattr,sys_llistxattr,sys32_llistxattr_wrapper) 242SYSCALL(sys_llistxattr,sys_llistxattr,compat_sys_llistxattr)
243SYSCALL(sys_flistxattr,sys_flistxattr,sys32_flistxattr_wrapper) 243SYSCALL(sys_flistxattr,sys_flistxattr,compat_sys_flistxattr)
244SYSCALL(sys_removexattr,sys_removexattr,sys32_removexattr_wrapper) 244SYSCALL(sys_removexattr,sys_removexattr,compat_sys_removexattr)
245SYSCALL(sys_lremovexattr,sys_lremovexattr,sys32_lremovexattr_wrapper) 245SYSCALL(sys_lremovexattr,sys_lremovexattr,compat_sys_lremovexattr)
246SYSCALL(sys_fremovexattr,sys_fremovexattr,sys32_fremovexattr_wrapper) /* 235 */ 246SYSCALL(sys_fremovexattr,sys_fremovexattr,compat_sys_fremovexattr) /* 235 */
247SYSCALL(sys_gettid,sys_gettid,sys_gettid) 247SYSCALL(sys_gettid,sys_gettid,sys_gettid)
248SYSCALL(sys_tkill,sys_tkill,sys_tkill_wrapper) 248SYSCALL(sys_tkill,sys_tkill,compat_sys_tkill)
249SYSCALL(sys_futex,sys_futex,compat_sys_futex) 249SYSCALL(sys_futex,sys_futex,compat_sys_futex)
250SYSCALL(sys_sched_setaffinity,sys_sched_setaffinity,sys32_sched_setaffinity_wrapper) 250SYSCALL(sys_sched_setaffinity,sys_sched_setaffinity,compat_sys_sched_setaffinity)
251SYSCALL(sys_sched_getaffinity,sys_sched_getaffinity,sys32_sched_getaffinity_wrapper) /* 240 */ 251SYSCALL(sys_sched_getaffinity,sys_sched_getaffinity,compat_sys_sched_getaffinity) /* 240 */
252SYSCALL(sys_tgkill,sys_tgkill,sys_tgkill_wrapper) 252SYSCALL(sys_tgkill,sys_tgkill,compat_sys_tgkill)
253NI_SYSCALL /* reserved for TUX */ 253NI_SYSCALL /* reserved for TUX */
254SYSCALL(sys_io_setup,sys_io_setup,sys32_io_setup_wrapper) 254SYSCALL(sys_io_setup,sys_io_setup,compat_sys_io_setup)
255SYSCALL(sys_io_destroy,sys_io_destroy,sys32_io_destroy_wrapper) 255SYSCALL(sys_io_destroy,sys_io_destroy,compat_sys_io_destroy)
256SYSCALL(sys_io_getevents,sys_io_getevents,sys32_io_getevents_wrapper) /* 245 */ 256SYSCALL(sys_io_getevents,sys_io_getevents,compat_sys_io_getevents) /* 245 */
257SYSCALL(sys_io_submit,sys_io_submit,sys32_io_submit_wrapper) 257SYSCALL(sys_io_submit,sys_io_submit,compat_sys_io_submit)
258SYSCALL(sys_io_cancel,sys_io_cancel,sys32_io_cancel_wrapper) 258SYSCALL(sys_io_cancel,sys_io_cancel,compat_sys_io_cancel)
259SYSCALL(sys_exit_group,sys_exit_group,sys32_exit_group_wrapper) 259SYSCALL(sys_exit_group,sys_exit_group,compat_sys_exit_group)
260SYSCALL(sys_epoll_create,sys_epoll_create,sys_epoll_create_wrapper) 260SYSCALL(sys_epoll_create,sys_epoll_create,compat_sys_epoll_create)
261SYSCALL(sys_epoll_ctl,sys_epoll_ctl,sys_epoll_ctl_wrapper) /* 250 */ 261SYSCALL(sys_epoll_ctl,sys_epoll_ctl,compat_sys_epoll_ctl) /* 250 */
262SYSCALL(sys_epoll_wait,sys_epoll_wait,sys_epoll_wait_wrapper) 262SYSCALL(sys_epoll_wait,sys_epoll_wait,compat_sys_epoll_wait)
263SYSCALL(sys_set_tid_address,sys_set_tid_address,sys32_set_tid_address_wrapper) 263SYSCALL(sys_set_tid_address,sys_set_tid_address,compat_sys_set_tid_address)
264SYSCALL(sys_s390_fadvise64,sys_fadvise64_64,sys32_fadvise64_wrapper) 264SYSCALL(sys_s390_fadvise64,sys_fadvise64_64,compat_sys_s390_fadvise64)
265SYSCALL(sys_timer_create,sys_timer_create,sys32_timer_create_wrapper) 265SYSCALL(sys_timer_create,sys_timer_create,compat_sys_timer_create)
266SYSCALL(sys_timer_settime,sys_timer_settime,sys32_timer_settime_wrapper) /* 255 */ 266SYSCALL(sys_timer_settime,sys_timer_settime,compat_sys_timer_settime) /* 255 */
267SYSCALL(sys_timer_gettime,sys_timer_gettime,sys32_timer_gettime_wrapper) 267SYSCALL(sys_timer_gettime,sys_timer_gettime,compat_sys_timer_gettime)
268SYSCALL(sys_timer_getoverrun,sys_timer_getoverrun,sys32_timer_getoverrun_wrapper) 268SYSCALL(sys_timer_getoverrun,sys_timer_getoverrun,compat_sys_timer_getoverrun)
269SYSCALL(sys_timer_delete,sys_timer_delete,sys32_timer_delete_wrapper) 269SYSCALL(sys_timer_delete,sys_timer_delete,compat_sys_timer_delete)
270SYSCALL(sys_clock_settime,sys_clock_settime,sys32_clock_settime_wrapper) 270SYSCALL(sys_clock_settime,sys_clock_settime,compat_sys_clock_settime)
271SYSCALL(sys_clock_gettime,sys_clock_gettime,sys32_clock_gettime_wrapper) /* 260 */ 271SYSCALL(sys_clock_gettime,sys_clock_gettime,compat_sys_clock_gettime) /* 260 */
272SYSCALL(sys_clock_getres,sys_clock_getres,sys32_clock_getres_wrapper) 272SYSCALL(sys_clock_getres,sys_clock_getres,compat_sys_clock_getres)
273SYSCALL(sys_clock_nanosleep,sys_clock_nanosleep,sys32_clock_nanosleep_wrapper) 273SYSCALL(sys_clock_nanosleep,sys_clock_nanosleep,compat_sys_clock_nanosleep)
274NI_SYSCALL /* reserved for vserver */ 274NI_SYSCALL /* reserved for vserver */
275SYSCALL(sys_s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper) 275SYSCALL(sys_s390_fadvise64_64,sys_ni_syscall,compat_sys_s390_fadvise64_64)
276SYSCALL(sys_statfs64,sys_statfs64,compat_sys_statfs64_wrapper) 276SYSCALL(sys_statfs64,sys_statfs64,compat_sys_statfs64)
277SYSCALL(sys_fstatfs64,sys_fstatfs64,compat_sys_fstatfs64_wrapper) 277SYSCALL(sys_fstatfs64,sys_fstatfs64,compat_sys_fstatfs64)
278SYSCALL(sys_remap_file_pages,sys_remap_file_pages,sys32_remap_file_pages_wrapper) 278SYSCALL(sys_remap_file_pages,sys_remap_file_pages,compat_sys_remap_file_pages)
279NI_SYSCALL /* 268 sys_mbind */ 279NI_SYSCALL /* 268 sys_mbind */
280NI_SYSCALL /* 269 sys_get_mempolicy */ 280NI_SYSCALL /* 269 sys_get_mempolicy */
281NI_SYSCALL /* 270 sys_set_mempolicy */ 281NI_SYSCALL /* 270 sys_set_mempolicy */
282SYSCALL(sys_mq_open,sys_mq_open,compat_sys_mq_open_wrapper) 282SYSCALL(sys_mq_open,sys_mq_open,compat_sys_mq_open)
283SYSCALL(sys_mq_unlink,sys_mq_unlink,sys32_mq_unlink_wrapper) 283SYSCALL(sys_mq_unlink,sys_mq_unlink,compat_sys_mq_unlink)
284SYSCALL(sys_mq_timedsend,sys_mq_timedsend,compat_sys_mq_timedsend_wrapper) 284SYSCALL(sys_mq_timedsend,sys_mq_timedsend,compat_sys_mq_timedsend)
285SYSCALL(sys_mq_timedreceive,sys_mq_timedreceive,compat_sys_mq_timedreceive_wrapper) 285SYSCALL(sys_mq_timedreceive,sys_mq_timedreceive,compat_sys_mq_timedreceive)
286SYSCALL(sys_mq_notify,sys_mq_notify,compat_sys_mq_notify_wrapper) /* 275 */ 286SYSCALL(sys_mq_notify,sys_mq_notify,compat_sys_mq_notify) /* 275 */
287SYSCALL(sys_mq_getsetattr,sys_mq_getsetattr,compat_sys_mq_getsetattr_wrapper) 287SYSCALL(sys_mq_getsetattr,sys_mq_getsetattr,compat_sys_mq_getsetattr)
288SYSCALL(sys_kexec_load,sys_kexec_load,compat_sys_kexec_load_wrapper) 288SYSCALL(sys_kexec_load,sys_kexec_load,compat_sys_kexec_load)
289SYSCALL(sys_add_key,sys_add_key,compat_sys_add_key_wrapper) 289SYSCALL(sys_add_key,sys_add_key,compat_sys_add_key)
290SYSCALL(sys_request_key,sys_request_key,compat_sys_request_key_wrapper) 290SYSCALL(sys_request_key,sys_request_key,compat_sys_request_key)
291SYSCALL(sys_keyctl,sys_keyctl,compat_sys_keyctl_wrapper) /* 280 */ 291SYSCALL(sys_keyctl,sys_keyctl,compat_sys_keyctl) /* 280 */
292SYSCALL(sys_waitid,sys_waitid,compat_sys_waitid) 292SYSCALL(sys_waitid,sys_waitid,compat_sys_waitid)
293SYSCALL(sys_ioprio_set,sys_ioprio_set,sys_ioprio_set_wrapper) 293SYSCALL(sys_ioprio_set,sys_ioprio_set,compat_sys_ioprio_set)
294SYSCALL(sys_ioprio_get,sys_ioprio_get,sys_ioprio_get_wrapper) 294SYSCALL(sys_ioprio_get,sys_ioprio_get,compat_sys_ioprio_get)
295SYSCALL(sys_inotify_init,sys_inotify_init,sys_inotify_init) 295SYSCALL(sys_inotify_init,sys_inotify_init,sys_inotify_init)
296SYSCALL(sys_inotify_add_watch,sys_inotify_add_watch,sys_inotify_add_watch_wrapper) /* 285 */ 296SYSCALL(sys_inotify_add_watch,sys_inotify_add_watch,compat_sys_inotify_add_watch) /* 285 */
297SYSCALL(sys_inotify_rm_watch,sys_inotify_rm_watch,sys_inotify_rm_watch_wrapper) 297SYSCALL(sys_inotify_rm_watch,sys_inotify_rm_watch,compat_sys_inotify_rm_watch)
298NI_SYSCALL /* 287 sys_migrate_pages */ 298NI_SYSCALL /* 287 sys_migrate_pages */
299SYSCALL(sys_openat,sys_openat,compat_sys_openat) 299SYSCALL(sys_openat,sys_openat,compat_sys_openat)
300SYSCALL(sys_mkdirat,sys_mkdirat,sys_mkdirat_wrapper) 300SYSCALL(sys_mkdirat,sys_mkdirat,compat_sys_mkdirat)
301SYSCALL(sys_mknodat,sys_mknodat,sys_mknodat_wrapper) /* 290 */ 301SYSCALL(sys_mknodat,sys_mknodat,compat_sys_mknodat) /* 290 */
302SYSCALL(sys_fchownat,sys_fchownat,sys_fchownat_wrapper) 302SYSCALL(sys_fchownat,sys_fchownat,compat_sys_fchownat)
303SYSCALL(sys_futimesat,sys_futimesat,compat_sys_futimesat_wrapper) 303SYSCALL(sys_futimesat,sys_futimesat,compat_sys_futimesat)
304SYSCALL(sys_fstatat64,sys_newfstatat,sys32_fstatat64_wrapper) 304SYSCALL(sys_fstatat64,sys_newfstatat,compat_sys_s390_fstatat64)
305SYSCALL(sys_unlinkat,sys_unlinkat,sys_unlinkat_wrapper) 305SYSCALL(sys_unlinkat,sys_unlinkat,compat_sys_unlinkat)
306SYSCALL(sys_renameat,sys_renameat,sys_renameat_wrapper) /* 295 */ 306SYSCALL(sys_renameat,sys_renameat,compat_sys_renameat) /* 295 */
307SYSCALL(sys_linkat,sys_linkat,sys_linkat_wrapper) 307SYSCALL(sys_linkat,sys_linkat,compat_sys_linkat)
308SYSCALL(sys_symlinkat,sys_symlinkat,sys_symlinkat_wrapper) 308SYSCALL(sys_symlinkat,sys_symlinkat,compat_sys_symlinkat)
309SYSCALL(sys_readlinkat,sys_readlinkat,sys_readlinkat_wrapper) 309SYSCALL(sys_readlinkat,sys_readlinkat,compat_sys_readlinkat)
310SYSCALL(sys_fchmodat,sys_fchmodat,sys_fchmodat_wrapper) 310SYSCALL(sys_fchmodat,sys_fchmodat,compat_sys_fchmodat)
311SYSCALL(sys_faccessat,sys_faccessat,sys_faccessat_wrapper) /* 300 */ 311SYSCALL(sys_faccessat,sys_faccessat,compat_sys_faccessat) /* 300 */
312SYSCALL(sys_pselect6,sys_pselect6,compat_sys_pselect6_wrapper) 312SYSCALL(sys_pselect6,sys_pselect6,compat_sys_pselect6)
313SYSCALL(sys_ppoll,sys_ppoll,compat_sys_ppoll_wrapper) 313SYSCALL(sys_ppoll,sys_ppoll,compat_sys_ppoll)
314SYSCALL(sys_unshare,sys_unshare,sys_unshare_wrapper) 314SYSCALL(sys_unshare,sys_unshare,compat_sys_unshare)
315SYSCALL(sys_set_robust_list,sys_set_robust_list,compat_sys_set_robust_list) 315SYSCALL(sys_set_robust_list,sys_set_robust_list,compat_sys_set_robust_list)
316SYSCALL(sys_get_robust_list,sys_get_robust_list,compat_sys_get_robust_list) 316SYSCALL(sys_get_robust_list,sys_get_robust_list,compat_sys_get_robust_list)
317SYSCALL(sys_splice,sys_splice,sys_splice_wrapper) 317SYSCALL(sys_splice,sys_splice,compat_sys_splice)
318SYSCALL(sys_sync_file_range,sys_sync_file_range,sys_sync_file_range_wrapper) 318SYSCALL(sys_sync_file_range,sys_sync_file_range,compat_sys_s390_sync_file_range)
319SYSCALL(sys_tee,sys_tee,sys_tee_wrapper) 319SYSCALL(sys_tee,sys_tee,compat_sys_tee)
320SYSCALL(sys_vmsplice,sys_vmsplice,compat_sys_vmsplice) 320SYSCALL(sys_vmsplice,sys_vmsplice,compat_sys_vmsplice)
321NI_SYSCALL /* 310 sys_move_pages */ 321NI_SYSCALL /* 310 sys_move_pages */
322SYSCALL(sys_getcpu,sys_getcpu,sys_getcpu_wrapper) 322SYSCALL(sys_getcpu,sys_getcpu,compat_sys_getcpu)
323SYSCALL(sys_epoll_pwait,sys_epoll_pwait,compat_sys_epoll_pwait) 323SYSCALL(sys_epoll_pwait,sys_epoll_pwait,compat_sys_epoll_pwait)
324SYSCALL(sys_utimes,sys_utimes,compat_sys_utimes_wrapper) 324SYSCALL(sys_utimes,sys_utimes,compat_sys_utimes)
325SYSCALL(sys_s390_fallocate,sys_fallocate,sys_fallocate_wrapper) 325SYSCALL(sys_s390_fallocate,sys_fallocate,compat_sys_s390_fallocate)
326SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper) /* 315 */ 326SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat) /* 315 */
327SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd) 327SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd)
328NI_SYSCALL /* 317 old sys_timer_fd */ 328NI_SYSCALL /* 317 old sys_timer_fd */
329SYSCALL(sys_eventfd,sys_eventfd,sys_eventfd_wrapper) 329SYSCALL(sys_eventfd,sys_eventfd,compat_sys_eventfd)
330SYSCALL(sys_timerfd_create,sys_timerfd_create,sys_timerfd_create_wrapper) 330SYSCALL(sys_timerfd_create,sys_timerfd_create,compat_sys_timerfd_create)
331SYSCALL(sys_timerfd_settime,sys_timerfd_settime,compat_sys_timerfd_settime) /* 320 */ 331SYSCALL(sys_timerfd_settime,sys_timerfd_settime,compat_sys_timerfd_settime) /* 320 */
332SYSCALL(sys_timerfd_gettime,sys_timerfd_gettime,compat_sys_timerfd_gettime) 332SYSCALL(sys_timerfd_gettime,sys_timerfd_gettime,compat_sys_timerfd_gettime)
333SYSCALL(sys_signalfd4,sys_signalfd4,compat_sys_signalfd4) 333SYSCALL(sys_signalfd4,sys_signalfd4,compat_sys_signalfd4)
334SYSCALL(sys_eventfd2,sys_eventfd2,sys_eventfd2_wrapper) 334SYSCALL(sys_eventfd2,sys_eventfd2,compat_sys_eventfd2)
335SYSCALL(sys_inotify_init1,sys_inotify_init1,sys_inotify_init1_wrapper) 335SYSCALL(sys_inotify_init1,sys_inotify_init1,compat_sys_inotify_init1)
336SYSCALL(sys_pipe2,sys_pipe2,sys_pipe2_wrapper) /* 325 */ 336SYSCALL(sys_pipe2,sys_pipe2,compat_sys_pipe2) /* 325 */
337SYSCALL(sys_dup3,sys_dup3,sys_dup3_wrapper) 337SYSCALL(sys_dup3,sys_dup3,compat_sys_dup3)
338SYSCALL(sys_epoll_create1,sys_epoll_create1,sys_epoll_create1_wrapper) 338SYSCALL(sys_epoll_create1,sys_epoll_create1,compat_sys_epoll_create1)
339SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv) 339SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv)
340SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev) 340SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev)
341SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo) /* 330 */ 341SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo) /* 330 */
342SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper) 342SYSCALL(sys_perf_event_open,sys_perf_event_open,compat_sys_perf_event_open)
343SYSCALL(sys_fanotify_init,sys_fanotify_init,sys_fanotify_init_wrapper) 343SYSCALL(sys_fanotify_init,sys_fanotify_init,compat_sys_fanotify_init)
344SYSCALL(sys_fanotify_mark,sys_fanotify_mark,compat_sys_fanotify_mark) 344SYSCALL(sys_fanotify_mark,sys_fanotify_mark,compat_sys_fanotify_mark)
345SYSCALL(sys_prlimit64,sys_prlimit64,sys_prlimit64_wrapper) 345SYSCALL(sys_prlimit64,sys_prlimit64,compat_sys_prlimit64)
346SYSCALL(sys_name_to_handle_at,sys_name_to_handle_at,sys_name_to_handle_at_wrapper) /* 335 */ 346SYSCALL(sys_name_to_handle_at,sys_name_to_handle_at,compat_sys_name_to_handle_at) /* 335 */
347SYSCALL(sys_open_by_handle_at,sys_open_by_handle_at,compat_sys_open_by_handle_at) 347SYSCALL(sys_open_by_handle_at,sys_open_by_handle_at,compat_sys_open_by_handle_at)
348SYSCALL(sys_clock_adjtime,sys_clock_adjtime,compat_sys_clock_adjtime_wrapper) 348SYSCALL(sys_clock_adjtime,sys_clock_adjtime,compat_sys_clock_adjtime)
349SYSCALL(sys_syncfs,sys_syncfs,sys_syncfs_wrapper) 349SYSCALL(sys_syncfs,sys_syncfs,compat_sys_syncfs)
350SYSCALL(sys_setns,sys_setns,sys_setns_wrapper) 350SYSCALL(sys_setns,sys_setns,compat_sys_setns)
351SYSCALL(sys_process_vm_readv,sys_process_vm_readv,compat_sys_process_vm_readv_wrapper) /* 340 */ 351SYSCALL(sys_process_vm_readv,sys_process_vm_readv,compat_sys_process_vm_readv) /* 340 */
352SYSCALL(sys_process_vm_writev,sys_process_vm_writev,compat_sys_process_vm_writev_wrapper) 352SYSCALL(sys_process_vm_writev,sys_process_vm_writev,compat_sys_process_vm_writev)
353SYSCALL(sys_ni_syscall,sys_s390_runtime_instr,sys_s390_runtime_instr_wrapper) 353SYSCALL(sys_ni_syscall,sys_s390_runtime_instr,compat_sys_s390_runtime_instr)
354SYSCALL(sys_kcmp,sys_kcmp,sys_kcmp_wrapper) 354SYSCALL(sys_kcmp,sys_kcmp,compat_sys_kcmp)
355SYSCALL(sys_finit_module,sys_finit_module,sys_finit_module_wrapper) 355SYSCALL(sys_finit_module,sys_finit_module,compat_sys_finit_module)
356SYSCALL(sys_sched_setattr,sys_sched_setattr,sys_sched_setattr_wrapper) /* 345 */ 356SYSCALL(sys_sched_setattr,sys_sched_setattr,compat_sys_sched_setattr) /* 345 */
357SYSCALL(sys_sched_getattr,sys_sched_getattr,sys_sched_getattr_wrapper) 357SYSCALL(sys_sched_getattr,sys_sched_getattr,compat_sys_sched_getattr)
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 4b2e3e317004..6298fed11ced 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -451,7 +451,6 @@ static int __init topology_init(void)
451 } 451 }
452 set_topology_timer(); 452 set_topology_timer();
453out: 453out:
454 update_cpu_masks();
455 return device_create_file(cpu_subsys.dev_root, &dev_attr_dispatching); 454 return device_create_file(cpu_subsys.dev_root, &dev_attr_dispatching);
456} 455}
457device_initcall(topology_init); 456device_initcall(topology_init);
diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c
index 8216c0e0b2e2..6f9cfa500372 100644
--- a/arch/s390/kvm/diag.c
+++ b/arch/s390/kvm/diag.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/kvm.h> 14#include <linux/kvm.h>
15#include <linux/kvm_host.h> 15#include <linux/kvm_host.h>
16#include <asm/pgalloc.h>
16#include <asm/virtio-ccw.h> 17#include <asm/virtio-ccw.h>
17#include "kvm-s390.h" 18#include "kvm-s390.h"
18#include "trace.h" 19#include "trace.h"
@@ -86,9 +87,11 @@ static int __diag_ipl_functions(struct kvm_vcpu *vcpu)
86 switch (subcode) { 87 switch (subcode) {
87 case 3: 88 case 3:
88 vcpu->run->s390_reset_flags = KVM_S390_RESET_CLEAR; 89 vcpu->run->s390_reset_flags = KVM_S390_RESET_CLEAR;
90 page_table_reset_pgste(current->mm, 0, TASK_SIZE);
89 break; 91 break;
90 case 4: 92 case 4:
91 vcpu->run->s390_reset_flags = 0; 93 vcpu->run->s390_reset_flags = 0;
94 page_table_reset_pgste(current->mm, 0, TASK_SIZE);
92 break; 95 break;
93 default: 96 default:
94 return -EOPNOTSUPP; 97 return -EOPNOTSUPP;
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index e0676f390d57..10b5db3c9bc4 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -68,6 +68,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
68 { "instruction_storage_key", VCPU_STAT(instruction_storage_key) }, 68 { "instruction_storage_key", VCPU_STAT(instruction_storage_key) },
69 { "instruction_stsch", VCPU_STAT(instruction_stsch) }, 69 { "instruction_stsch", VCPU_STAT(instruction_stsch) },
70 { "instruction_chsc", VCPU_STAT(instruction_chsc) }, 70 { "instruction_chsc", VCPU_STAT(instruction_chsc) },
71 { "instruction_essa", VCPU_STAT(instruction_essa) },
71 { "instruction_stsi", VCPU_STAT(instruction_stsi) }, 72 { "instruction_stsi", VCPU_STAT(instruction_stsi) },
72 { "instruction_stfl", VCPU_STAT(instruction_stfl) }, 73 { "instruction_stfl", VCPU_STAT(instruction_stfl) },
73 { "instruction_tprot", VCPU_STAT(instruction_tprot) }, 74 { "instruction_tprot", VCPU_STAT(instruction_tprot) },
@@ -283,7 +284,11 @@ void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
283 if (kvm_is_ucontrol(vcpu->kvm)) 284 if (kvm_is_ucontrol(vcpu->kvm))
284 gmap_free(vcpu->arch.gmap); 285 gmap_free(vcpu->arch.gmap);
285 286
287 if (vcpu->arch.sie_block->cbrlo)
288 __free_page(__pfn_to_page(
289 vcpu->arch.sie_block->cbrlo >> PAGE_SHIFT));
286 free_page((unsigned long)(vcpu->arch.sie_block)); 290 free_page((unsigned long)(vcpu->arch.sie_block));
291
287 kvm_vcpu_uninit(vcpu); 292 kvm_vcpu_uninit(vcpu);
288 kmem_cache_free(kvm_vcpu_cache, vcpu); 293 kmem_cache_free(kvm_vcpu_cache, vcpu);
289} 294}
@@ -390,6 +395,8 @@ int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
390 395
391int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) 396int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
392{ 397{
398 struct page *cbrl;
399
393 atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH | 400 atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH |
394 CPUSTAT_SM | 401 CPUSTAT_SM |
395 CPUSTAT_STOPPED | 402 CPUSTAT_STOPPED |
@@ -401,6 +408,14 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
401 vcpu->arch.sie_block->ecb2 = 8; 408 vcpu->arch.sie_block->ecb2 = 8;
402 vcpu->arch.sie_block->eca = 0xC1002001U; 409 vcpu->arch.sie_block->eca = 0xC1002001U;
403 vcpu->arch.sie_block->fac = (int) (long) vfacilities; 410 vcpu->arch.sie_block->fac = (int) (long) vfacilities;
411 if (kvm_enabled_cmma()) {
412 cbrl = alloc_page(GFP_KERNEL | __GFP_ZERO);
413 if (cbrl) {
414 vcpu->arch.sie_block->ecb2 |= 0x80;
415 vcpu->arch.sie_block->ecb2 &= ~0x08;
416 vcpu->arch.sie_block->cbrlo = page_to_phys(cbrl);
417 }
418 }
404 hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); 419 hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
405 tasklet_init(&vcpu->arch.tasklet, kvm_s390_tasklet, 420 tasklet_init(&vcpu->arch.tasklet, kvm_s390_tasklet,
406 (unsigned long) vcpu); 421 (unsigned long) vcpu);
@@ -761,6 +776,16 @@ static int vcpu_post_run(struct kvm_vcpu *vcpu, int exit_reason)
761 return rc; 776 return rc;
762} 777}
763 778
779bool kvm_enabled_cmma(void)
780{
781 if (!MACHINE_IS_LPAR)
782 return false;
783 /* only enable for z10 and later */
784 if (!MACHINE_HAS_EDAT1)
785 return false;
786 return true;
787}
788
764static int __vcpu_run(struct kvm_vcpu *vcpu) 789static int __vcpu_run(struct kvm_vcpu *vcpu)
765{ 790{
766 int rc, exit_reason; 791 int rc, exit_reason;
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index f9559b0bd620..564514f410f4 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -156,6 +156,8 @@ void s390_vcpu_block(struct kvm_vcpu *vcpu);
156void s390_vcpu_unblock(struct kvm_vcpu *vcpu); 156void s390_vcpu_unblock(struct kvm_vcpu *vcpu);
157void exit_sie(struct kvm_vcpu *vcpu); 157void exit_sie(struct kvm_vcpu *vcpu);
158void exit_sie_sync(struct kvm_vcpu *vcpu); 158void exit_sie_sync(struct kvm_vcpu *vcpu);
159/* are we going to support cmma? */
160bool kvm_enabled_cmma(void);
159/* implemented in diag.c */ 161/* implemented in diag.c */
160int kvm_s390_handle_diag(struct kvm_vcpu *vcpu); 162int kvm_s390_handle_diag(struct kvm_vcpu *vcpu);
161 163
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 75beea632a10..aacb6b129914 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -636,8 +636,49 @@ static int handle_pfmf(struct kvm_vcpu *vcpu)
636 return 0; 636 return 0;
637} 637}
638 638
639static int handle_essa(struct kvm_vcpu *vcpu)
640{
641 /* entries expected to be 1FF */
642 int entries = (vcpu->arch.sie_block->cbrlo & ~PAGE_MASK) >> 3;
643 unsigned long *cbrlo, cbrle;
644 struct gmap *gmap;
645 int i;
646
647 VCPU_EVENT(vcpu, 5, "cmma release %d pages", entries);
648 gmap = vcpu->arch.gmap;
649 vcpu->stat.instruction_essa++;
650 if (!kvm_enabled_cmma() || !vcpu->arch.sie_block->cbrlo)
651 return kvm_s390_inject_program_int(vcpu, PGM_OPERATION);
652
653 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
654 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
655
656 if (((vcpu->arch.sie_block->ipb & 0xf0000000) >> 28) > 6)
657 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
658
659 /* Rewind PSW to repeat the ESSA instruction */
660 vcpu->arch.sie_block->gpsw.addr =
661 __rewind_psw(vcpu->arch.sie_block->gpsw, 4);
662 vcpu->arch.sie_block->cbrlo &= PAGE_MASK; /* reset nceo */
663 cbrlo = phys_to_virt(vcpu->arch.sie_block->cbrlo);
664 down_read(&gmap->mm->mmap_sem);
665 for (i = 0; i < entries; ++i) {
666 cbrle = cbrlo[i];
667 if (unlikely(cbrle & ~PAGE_MASK || cbrle < 2 * PAGE_SIZE))
668 /* invalid entry */
669 break;
670 /* try to free backing */
671 __gmap_zap(cbrle, gmap);
672 }
673 up_read(&gmap->mm->mmap_sem);
674 if (i < entries)
675 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
676 return 0;
677}
678
639static const intercept_handler_t b9_handlers[256] = { 679static const intercept_handler_t b9_handlers[256] = {
640 [0x8d] = handle_epsw, 680 [0x8d] = handle_epsw,
681 [0xab] = handle_essa,
641 [0xaf] = handle_pfmf, 682 [0xaf] = handle_pfmf,
642}; 683};
643 684
diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile
index b068729e50ac..e3fffe1dff51 100644
--- a/arch/s390/lib/Makefile
+++ b/arch/s390/lib/Makefile
@@ -2,8 +2,7 @@
2# Makefile for s390-specific library files.. 2# Makefile for s390-specific library files..
3# 3#
4 4
5lib-y += delay.o string.o uaccess_pt.o find.o 5lib-y += delay.o string.o uaccess_pt.o uaccess_mvcos.o find.o
6obj-$(CONFIG_32BIT) += div64.o qrnnd.o ucmpdi2.o mem32.o 6obj-$(CONFIG_32BIT) += div64.o qrnnd.o ucmpdi2.o mem32.o
7obj-$(CONFIG_64BIT) += mem64.o 7obj-$(CONFIG_64BIT) += mem64.o
8lib-$(CONFIG_64BIT) += uaccess_mvcos.o
9lib-$(CONFIG_SMP) += spinlock.o 8lib-$(CONFIG_SMP) += spinlock.o
diff --git a/arch/s390/lib/find.c b/arch/s390/lib/find.c
index 620d34d6487e..922003c1b90d 100644
--- a/arch/s390/lib/find.c
+++ b/arch/s390/lib/find.c
@@ -4,7 +4,7 @@
4 * On s390x the bits are numbered: 4 * On s390x the bits are numbered:
5 * |0..............63|64............127|128...........191|192...........255| 5 * |0..............63|64............127|128...........191|192...........255|
6 * and on s390: 6 * and on s390:
7 * |0.....31|31....63|64....95|96...127|128..159|160..191|192..223|224..255| 7 * |0.....31|32....63|64....95|96...127|128..159|160..191|192..223|224..255|
8 * 8 *
9 * The reason for this bit numbering is the fact that the hardware sets bits 9 * The reason for this bit numbering is the fact that the hardware sets bits
10 * in a bitmap starting at bit 0 (MSB) and we don't want to scan the bitmap 10 * in a bitmap starting at bit 0 (MSB) and we don't want to scan the bitmap
diff --git a/arch/s390/lib/uaccess.h b/arch/s390/lib/uaccess.h
index b1a22173d027..c7e0e81f4b4e 100644
--- a/arch/s390/lib/uaccess.h
+++ b/arch/s390/lib/uaccess.h
@@ -6,7 +6,11 @@
6#ifndef __ARCH_S390_LIB_UACCESS_H 6#ifndef __ARCH_S390_LIB_UACCESS_H
7#define __ARCH_S390_LIB_UACCESS_H 7#define __ARCH_S390_LIB_UACCESS_H
8 8
9extern int futex_atomic_op_pt(int, u32 __user *, int, int *); 9unsigned long copy_from_user_pt(void *to, const void __user *from, unsigned long n);
10extern int futex_atomic_cmpxchg_pt(u32 *, u32 __user *, u32, u32); 10unsigned long copy_to_user_pt(void __user *to, const void *from, unsigned long n);
11unsigned long copy_in_user_pt(void __user *to, const void __user *from, unsigned long n);
12unsigned long clear_user_pt(void __user *to, unsigned long n);
13unsigned long strnlen_user_pt(const char __user *src, unsigned long count);
14long strncpy_from_user_pt(char *dst, const char __user *src, long count);
11 15
12#endif /* __ARCH_S390_LIB_UACCESS_H */ 16#endif /* __ARCH_S390_LIB_UACCESS_H */
diff --git a/arch/s390/lib/uaccess_mvcos.c b/arch/s390/lib/uaccess_mvcos.c
index 4b7993bf69b9..ae97b8df11aa 100644
--- a/arch/s390/lib/uaccess_mvcos.c
+++ b/arch/s390/lib/uaccess_mvcos.c
@@ -6,8 +6,11 @@
6 * Gerald Schaefer (gerald.schaefer@de.ibm.com) 6 * Gerald Schaefer (gerald.schaefer@de.ibm.com)
7 */ 7 */
8 8
9#include <linux/jump_label.h>
9#include <linux/errno.h> 10#include <linux/errno.h>
11#include <linux/init.h>
10#include <linux/mm.h> 12#include <linux/mm.h>
13#include <asm/facility.h>
11#include <asm/uaccess.h> 14#include <asm/uaccess.h>
12#include <asm/futex.h> 15#include <asm/futex.h>
13#include "uaccess.h" 16#include "uaccess.h"
@@ -26,7 +29,10 @@
26#define SLR "slgr" 29#define SLR "slgr"
27#endif 30#endif
28 31
29static size_t copy_from_user_mvcos(size_t size, const void __user *ptr, void *x) 32static struct static_key have_mvcos = STATIC_KEY_INIT_TRUE;
33
34static inline unsigned long copy_from_user_mvcos(void *x, const void __user *ptr,
35 unsigned long size)
30{ 36{
31 register unsigned long reg0 asm("0") = 0x81UL; 37 register unsigned long reg0 asm("0") = 0x81UL;
32 unsigned long tmp1, tmp2; 38 unsigned long tmp1, tmp2;
@@ -65,7 +71,16 @@ static size_t copy_from_user_mvcos(size_t size, const void __user *ptr, void *x)
65 return size; 71 return size;
66} 72}
67 73
68static size_t copy_to_user_mvcos(size_t size, void __user *ptr, const void *x) 74unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n)
75{
76 if (static_key_true(&have_mvcos))
77 return copy_from_user_mvcos(to, from, n);
78 return copy_from_user_pt(to, from, n);
79}
80EXPORT_SYMBOL(__copy_from_user);
81
82static inline unsigned long copy_to_user_mvcos(void __user *ptr, const void *x,
83 unsigned long size)
69{ 84{
70 register unsigned long reg0 asm("0") = 0x810000UL; 85 register unsigned long reg0 asm("0") = 0x810000UL;
71 unsigned long tmp1, tmp2; 86 unsigned long tmp1, tmp2;
@@ -94,8 +109,16 @@ static size_t copy_to_user_mvcos(size_t size, void __user *ptr, const void *x)
94 return size; 109 return size;
95} 110}
96 111
97static size_t copy_in_user_mvcos(size_t size, void __user *to, 112unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n)
98 const void __user *from) 113{
114 if (static_key_true(&have_mvcos))
115 return copy_to_user_mvcos(to, from, n);
116 return copy_to_user_pt(to, from, n);
117}
118EXPORT_SYMBOL(__copy_to_user);
119
120static inline unsigned long copy_in_user_mvcos(void __user *to, const void __user *from,
121 unsigned long size)
99{ 122{
100 register unsigned long reg0 asm("0") = 0x810081UL; 123 register unsigned long reg0 asm("0") = 0x810081UL;
101 unsigned long tmp1, tmp2; 124 unsigned long tmp1, tmp2;
@@ -117,7 +140,15 @@ static size_t copy_in_user_mvcos(size_t size, void __user *to,
117 return size; 140 return size;
118} 141}
119 142
120static size_t clear_user_mvcos(size_t size, void __user *to) 143unsigned long __copy_in_user(void __user *to, const void __user *from, unsigned long n)
144{
145 if (static_key_true(&have_mvcos))
146 return copy_in_user_mvcos(to, from, n);
147 return copy_in_user_pt(to, from, n);
148}
149EXPORT_SYMBOL(__copy_in_user);
150
151static inline unsigned long clear_user_mvcos(void __user *to, unsigned long size)
121{ 152{
122 register unsigned long reg0 asm("0") = 0x810000UL; 153 register unsigned long reg0 asm("0") = 0x810000UL;
123 unsigned long tmp1, tmp2; 154 unsigned long tmp1, tmp2;
@@ -145,17 +176,26 @@ static size_t clear_user_mvcos(size_t size, void __user *to)
145 return size; 176 return size;
146} 177}
147 178
148static size_t strnlen_user_mvcos(size_t count, const char __user *src) 179unsigned long __clear_user(void __user *to, unsigned long size)
149{ 180{
150 size_t done, len, offset, len_str; 181 if (static_key_true(&have_mvcos))
182 return clear_user_mvcos(to, size);
183 return clear_user_pt(to, size);
184}
185EXPORT_SYMBOL(__clear_user);
186
187static inline unsigned long strnlen_user_mvcos(const char __user *src,
188 unsigned long count)
189{
190 unsigned long done, len, offset, len_str;
151 char buf[256]; 191 char buf[256];
152 192
153 done = 0; 193 done = 0;
154 do { 194 do {
155 offset = (size_t)src & ~PAGE_MASK; 195 offset = (unsigned long)src & ~PAGE_MASK;
156 len = min(256UL, PAGE_SIZE - offset); 196 len = min(256UL, PAGE_SIZE - offset);
157 len = min(count - done, len); 197 len = min(count - done, len);
158 if (copy_from_user_mvcos(len, src, buf)) 198 if (copy_from_user_mvcos(buf, src, len))
159 return 0; 199 return 0;
160 len_str = strnlen(buf, len); 200 len_str = strnlen(buf, len);
161 done += len_str; 201 done += len_str;
@@ -164,18 +204,26 @@ static size_t strnlen_user_mvcos(size_t count, const char __user *src)
164 return done + 1; 204 return done + 1;
165} 205}
166 206
167static size_t strncpy_from_user_mvcos(size_t count, const char __user *src, 207unsigned long __strnlen_user(const char __user *src, unsigned long count)
168 char *dst)
169{ 208{
170 size_t done, len, offset, len_str; 209 if (static_key_true(&have_mvcos))
210 return strnlen_user_mvcos(src, count);
211 return strnlen_user_pt(src, count);
212}
213EXPORT_SYMBOL(__strnlen_user);
171 214
172 if (unlikely(!count)) 215static inline long strncpy_from_user_mvcos(char *dst, const char __user *src,
216 long count)
217{
218 unsigned long done, len, offset, len_str;
219
220 if (unlikely(count <= 0))
173 return 0; 221 return 0;
174 done = 0; 222 done = 0;
175 do { 223 do {
176 offset = (size_t)src & ~PAGE_MASK; 224 offset = (unsigned long)src & ~PAGE_MASK;
177 len = min(count - done, PAGE_SIZE - offset); 225 len = min(count - done, PAGE_SIZE - offset);
178 if (copy_from_user_mvcos(len, src, dst)) 226 if (copy_from_user_mvcos(dst, src, len))
179 return -EFAULT; 227 return -EFAULT;
180 len_str = strnlen(dst, len); 228 len_str = strnlen(dst, len);
181 done += len_str; 229 done += len_str;
@@ -185,13 +233,31 @@ static size_t strncpy_from_user_mvcos(size_t count, const char __user *src,
185 return done; 233 return done;
186} 234}
187 235
188struct uaccess_ops uaccess_mvcos = { 236long __strncpy_from_user(char *dst, const char __user *src, long count)
189 .copy_from_user = copy_from_user_mvcos, 237{
190 .copy_to_user = copy_to_user_mvcos, 238 if (static_key_true(&have_mvcos))
191 .copy_in_user = copy_in_user_mvcos, 239 return strncpy_from_user_mvcos(dst, src, count);
192 .clear_user = clear_user_mvcos, 240 return strncpy_from_user_pt(dst, src, count);
193 .strnlen_user = strnlen_user_mvcos, 241}
194 .strncpy_from_user = strncpy_from_user_mvcos, 242EXPORT_SYMBOL(__strncpy_from_user);
195 .futex_atomic_op = futex_atomic_op_pt, 243
196 .futex_atomic_cmpxchg = futex_atomic_cmpxchg_pt, 244/*
197}; 245 * The uaccess page tabe walk variant can be enforced with the "uaccesspt"
246 * kernel parameter. This is mainly for debugging purposes.
247 */
248static int force_uaccess_pt __initdata;
249
250static int __init parse_uaccess_pt(char *__unused)
251{
252 force_uaccess_pt = 1;
253 return 0;
254}
255early_param("uaccesspt", parse_uaccess_pt);
256
257static int __init uaccess_init(void)
258{
259 if (IS_ENABLED(CONFIG_32BIT) || force_uaccess_pt || !test_facility(27))
260 static_key_slow_dec(&have_mvcos);
261 return 0;
262}
263early_initcall(uaccess_init);
diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c
index 61ebcc9ccb34..8d39760bae68 100644
--- a/arch/s390/lib/uaccess_pt.c
+++ b/arch/s390/lib/uaccess_pt.c
@@ -22,7 +22,7 @@
22#define SLR "slgr" 22#define SLR "slgr"
23#endif 23#endif
24 24
25static size_t strnlen_kernel(size_t count, const char __user *src) 25static unsigned long strnlen_kernel(const char __user *src, unsigned long count)
26{ 26{
27 register unsigned long reg0 asm("0") = 0UL; 27 register unsigned long reg0 asm("0") = 0UL;
28 unsigned long tmp1, tmp2; 28 unsigned long tmp1, tmp2;
@@ -42,8 +42,8 @@ static size_t strnlen_kernel(size_t count, const char __user *src)
42 return count; 42 return count;
43} 43}
44 44
45static size_t copy_in_kernel(size_t count, void __user *to, 45static unsigned long copy_in_kernel(void __user *to, const void __user *from,
46 const void __user *from) 46 unsigned long count)
47{ 47{
48 unsigned long tmp1; 48 unsigned long tmp1;
49 49
@@ -146,8 +146,8 @@ static unsigned long follow_table(struct mm_struct *mm,
146 146
147#endif /* CONFIG_64BIT */ 147#endif /* CONFIG_64BIT */
148 148
149static __always_inline size_t __user_copy_pt(unsigned long uaddr, void *kptr, 149static inline unsigned long __user_copy_pt(unsigned long uaddr, void *kptr,
150 size_t n, int write_user) 150 unsigned long n, int write_user)
151{ 151{
152 struct mm_struct *mm = current->mm; 152 struct mm_struct *mm = current->mm;
153 unsigned long offset, done, size, kaddr; 153 unsigned long offset, done, size, kaddr;
@@ -189,8 +189,7 @@ fault:
189 * Do DAT for user address by page table walk, return kernel address. 189 * Do DAT for user address by page table walk, return kernel address.
190 * This function needs to be called with current->mm->page_table_lock held. 190 * This function needs to be called with current->mm->page_table_lock held.
191 */ 191 */
192static __always_inline unsigned long __dat_user_addr(unsigned long uaddr, 192static inline unsigned long __dat_user_addr(unsigned long uaddr, int write)
193 int write)
194{ 193{
195 struct mm_struct *mm = current->mm; 194 struct mm_struct *mm = current->mm;
196 unsigned long kaddr; 195 unsigned long kaddr;
@@ -211,29 +210,29 @@ fault:
211 return 0; 210 return 0;
212} 211}
213 212
214static size_t copy_from_user_pt(size_t n, const void __user *from, void *to) 213unsigned long copy_from_user_pt(void *to, const void __user *from, unsigned long n)
215{ 214{
216 size_t rc; 215 unsigned long rc;
217 216
218 if (segment_eq(get_fs(), KERNEL_DS)) 217 if (segment_eq(get_fs(), KERNEL_DS))
219 return copy_in_kernel(n, (void __user *) to, from); 218 return copy_in_kernel((void __user *) to, from, n);
220 rc = __user_copy_pt((unsigned long) from, to, n, 0); 219 rc = __user_copy_pt((unsigned long) from, to, n, 0);
221 if (unlikely(rc)) 220 if (unlikely(rc))
222 memset(to + n - rc, 0, rc); 221 memset(to + n - rc, 0, rc);
223 return rc; 222 return rc;
224} 223}
225 224
226static size_t copy_to_user_pt(size_t n, void __user *to, const void *from) 225unsigned long copy_to_user_pt(void __user *to, const void *from, unsigned long n)
227{ 226{
228 if (segment_eq(get_fs(), KERNEL_DS)) 227 if (segment_eq(get_fs(), KERNEL_DS))
229 return copy_in_kernel(n, to, (void __user *) from); 228 return copy_in_kernel(to, (void __user *) from, n);
230 return __user_copy_pt((unsigned long) to, (void *) from, n, 1); 229 return __user_copy_pt((unsigned long) to, (void *) from, n, 1);
231} 230}
232 231
233static size_t clear_user_pt(size_t n, void __user *to) 232unsigned long clear_user_pt(void __user *to, unsigned long n)
234{ 233{
235 void *zpage = (void *) empty_zero_page; 234 void *zpage = (void *) empty_zero_page;
236 long done, size, ret; 235 unsigned long done, size, ret;
237 236
238 done = 0; 237 done = 0;
239 do { 238 do {
@@ -242,7 +241,7 @@ static size_t clear_user_pt(size_t n, void __user *to)
242 else 241 else
243 size = n - done; 242 size = n - done;
244 if (segment_eq(get_fs(), KERNEL_DS)) 243 if (segment_eq(get_fs(), KERNEL_DS))
245 ret = copy_in_kernel(n, to, (void __user *) zpage); 244 ret = copy_in_kernel(to, (void __user *) zpage, n);
246 else 245 else
247 ret = __user_copy_pt((unsigned long) to, zpage, size, 1); 246 ret = __user_copy_pt((unsigned long) to, zpage, size, 1);
248 done += size; 247 done += size;
@@ -253,17 +252,17 @@ static size_t clear_user_pt(size_t n, void __user *to)
253 return 0; 252 return 0;
254} 253}
255 254
256static size_t strnlen_user_pt(size_t count, const char __user *src) 255unsigned long strnlen_user_pt(const char __user *src, unsigned long count)
257{ 256{
258 unsigned long uaddr = (unsigned long) src; 257 unsigned long uaddr = (unsigned long) src;
259 struct mm_struct *mm = current->mm; 258 struct mm_struct *mm = current->mm;
260 unsigned long offset, done, len, kaddr; 259 unsigned long offset, done, len, kaddr;
261 size_t len_str; 260 unsigned long len_str;
262 261
263 if (unlikely(!count)) 262 if (unlikely(!count))
264 return 0; 263 return 0;
265 if (segment_eq(get_fs(), KERNEL_DS)) 264 if (segment_eq(get_fs(), KERNEL_DS))
266 return strnlen_kernel(count, src); 265 return strnlen_kernel(src, count);
267 if (!mm) 266 if (!mm)
268 return 0; 267 return 0;
269 done = 0; 268 done = 0;
@@ -289,19 +288,18 @@ fault:
289 goto retry; 288 goto retry;
290} 289}
291 290
292static size_t strncpy_from_user_pt(size_t count, const char __user *src, 291long strncpy_from_user_pt(char *dst, const char __user *src, long count)
293 char *dst)
294{ 292{
295 size_t done, len, offset, len_str; 293 unsigned long done, len, offset, len_str;
296 294
297 if (unlikely(!count)) 295 if (unlikely(count <= 0))
298 return 0; 296 return 0;
299 done = 0; 297 done = 0;
300 do { 298 do {
301 offset = (size_t)src & ~PAGE_MASK; 299 offset = (unsigned long)src & ~PAGE_MASK;
302 len = min(count - done, PAGE_SIZE - offset); 300 len = min(count - done, PAGE_SIZE - offset);
303 if (segment_eq(get_fs(), KERNEL_DS)) { 301 if (segment_eq(get_fs(), KERNEL_DS)) {
304 if (copy_in_kernel(len, (void __user *) dst, src)) 302 if (copy_in_kernel((void __user *) dst, src, len))
305 return -EFAULT; 303 return -EFAULT;
306 } else { 304 } else {
307 if (__user_copy_pt((unsigned long) src, dst, len, 0)) 305 if (__user_copy_pt((unsigned long) src, dst, len, 0))
@@ -315,8 +313,8 @@ static size_t strncpy_from_user_pt(size_t count, const char __user *src,
315 return done; 313 return done;
316} 314}
317 315
318static size_t copy_in_user_pt(size_t n, void __user *to, 316unsigned long copy_in_user_pt(void __user *to, const void __user *from,
319 const void __user *from) 317 unsigned long n)
320{ 318{
321 struct mm_struct *mm = current->mm; 319 struct mm_struct *mm = current->mm;
322 unsigned long offset_max, uaddr, done, size, error_code; 320 unsigned long offset_max, uaddr, done, size, error_code;
@@ -326,7 +324,7 @@ static size_t copy_in_user_pt(size_t n, void __user *to,
326 int write_user; 324 int write_user;
327 325
328 if (segment_eq(get_fs(), KERNEL_DS)) 326 if (segment_eq(get_fs(), KERNEL_DS))
329 return copy_in_kernel(n, to, from); 327 return copy_in_kernel(to, from, n);
330 if (!mm) 328 if (!mm)
331 return n; 329 return n;
332 done = 0; 330 done = 0;
@@ -411,7 +409,7 @@ static int __futex_atomic_op_pt(int op, u32 __user *uaddr, int oparg, int *old)
411 return ret; 409 return ret;
412} 410}
413 411
414int futex_atomic_op_pt(int op, u32 __user *uaddr, int oparg, int *old) 412int __futex_atomic_op_inuser(int op, u32 __user *uaddr, int oparg, int *old)
415{ 413{
416 int ret; 414 int ret;
417 415
@@ -449,8 +447,8 @@ static int __futex_atomic_cmpxchg_pt(u32 *uval, u32 __user *uaddr,
449 return ret; 447 return ret;
450} 448}
451 449
452int futex_atomic_cmpxchg_pt(u32 *uval, u32 __user *uaddr, 450int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
453 u32 oldval, u32 newval) 451 u32 oldval, u32 newval)
454{ 452{
455 int ret; 453 int ret;
456 454
@@ -471,14 +469,3 @@ int futex_atomic_cmpxchg_pt(u32 *uval, u32 __user *uaddr,
471 put_page(virt_to_page(uaddr)); 469 put_page(virt_to_page(uaddr));
472 return ret; 470 return ret;
473} 471}
474
475struct uaccess_ops uaccess_pt = {
476 .copy_from_user = copy_from_user_pt,
477 .copy_to_user = copy_to_user_pt,
478 .copy_in_user = copy_in_user_pt,
479 .clear_user = clear_user_pt,
480 .strnlen_user = strnlen_user_pt,
481 .strncpy_from_user = strncpy_from_user_pt,
482 .futex_atomic_op = futex_atomic_op_pt,
483 .futex_atomic_cmpxchg = futex_atomic_cmpxchg_pt,
484};
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c
index d1e0e0c7a7e2..2a2e35416d2f 100644
--- a/arch/s390/mm/maccess.c
+++ b/arch/s390/mm/maccess.c
@@ -128,7 +128,7 @@ void memcpy_absolute(void *dest, void *src, size_t count)
128/* 128/*
129 * Copy memory from kernel (real) to user (virtual) 129 * Copy memory from kernel (real) to user (virtual)
130 */ 130 */
131int copy_to_user_real(void __user *dest, void *src, size_t count) 131int copy_to_user_real(void __user *dest, void *src, unsigned long count)
132{ 132{
133 int offs = 0, size, rc; 133 int offs = 0, size, rc;
134 char *buf; 134 char *buf;
@@ -152,32 +152,6 @@ out:
152} 152}
153 153
154/* 154/*
155 * Copy memory from user (virtual) to kernel (real)
156 */
157int copy_from_user_real(void *dest, void __user *src, size_t count)
158{
159 int offs = 0, size, rc;
160 char *buf;
161
162 buf = (char *) __get_free_page(GFP_KERNEL);
163 if (!buf)
164 return -ENOMEM;
165 rc = -EFAULT;
166 while (offs < count) {
167 size = min(PAGE_SIZE, count - offs);
168 if (copy_from_user(buf, src + offs, size))
169 goto out;
170 if (memcpy_real(dest + offs, buf, size))
171 goto out;
172 offs += size;
173 }
174 rc = 0;
175out:
176 free_page((unsigned long) buf);
177 return rc;
178}
179
180/*
181 * Check if physical address is within prefix or zero page 155 * Check if physical address is within prefix or zero page
182 */ 156 */
183static int is_swapped(unsigned long addr) 157static int is_swapped(unsigned long addr)
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 3584ed9b20a1..796c9320c709 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -17,6 +17,7 @@
17#include <linux/quicklist.h> 17#include <linux/quicklist.h>
18#include <linux/rcupdate.h> 18#include <linux/rcupdate.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/swapops.h>
20 21
21#include <asm/pgtable.h> 22#include <asm/pgtable.h>
22#include <asm/pgalloc.h> 23#include <asm/pgalloc.h>
@@ -594,6 +595,82 @@ unsigned long gmap_fault(unsigned long address, struct gmap *gmap)
594} 595}
595EXPORT_SYMBOL_GPL(gmap_fault); 596EXPORT_SYMBOL_GPL(gmap_fault);
596 597
598static void gmap_zap_swap_entry(swp_entry_t entry, struct mm_struct *mm)
599{
600 if (!non_swap_entry(entry))
601 dec_mm_counter(mm, MM_SWAPENTS);
602 else if (is_migration_entry(entry)) {
603 struct page *page = migration_entry_to_page(entry);
604
605 if (PageAnon(page))
606 dec_mm_counter(mm, MM_ANONPAGES);
607 else
608 dec_mm_counter(mm, MM_FILEPAGES);
609 }
610 free_swap_and_cache(entry);
611}
612
613/**
614 * The mm->mmap_sem lock must be held
615 */
616static void gmap_zap_unused(struct mm_struct *mm, unsigned long address)
617{
618 unsigned long ptev, pgstev;
619 spinlock_t *ptl;
620 pgste_t pgste;
621 pte_t *ptep, pte;
622
623 ptep = get_locked_pte(mm, address, &ptl);
624 if (unlikely(!ptep))
625 return;
626 pte = *ptep;
627 if (!pte_swap(pte))
628 goto out_pte;
629 /* Zap unused and logically-zero pages */
630 pgste = pgste_get_lock(ptep);
631 pgstev = pgste_val(pgste);
632 ptev = pte_val(pte);
633 if (((pgstev & _PGSTE_GPS_USAGE_MASK) == _PGSTE_GPS_USAGE_UNUSED) ||
634 ((pgstev & _PGSTE_GPS_ZERO) && (ptev & _PAGE_INVALID))) {
635 gmap_zap_swap_entry(pte_to_swp_entry(pte), mm);
636 pte_clear(mm, address, ptep);
637 }
638 pgste_set_unlock(ptep, pgste);
639out_pte:
640 pte_unmap_unlock(*ptep, ptl);
641}
642
643/*
644 * this function is assumed to be called with mmap_sem held
645 */
646void __gmap_zap(unsigned long address, struct gmap *gmap)
647{
648 unsigned long *table, *segment_ptr;
649 unsigned long segment, pgstev, ptev;
650 struct gmap_pgtable *mp;
651 struct page *page;
652
653 segment_ptr = gmap_table_walk(address, gmap);
654 if (IS_ERR(segment_ptr))
655 return;
656 segment = *segment_ptr;
657 if (segment & _SEGMENT_ENTRY_INVALID)
658 return;
659 page = pfn_to_page(segment >> PAGE_SHIFT);
660 mp = (struct gmap_pgtable *) page->index;
661 address = mp->vmaddr | (address & ~PMD_MASK);
662 /* Page table is present */
663 table = (unsigned long *)(segment & _SEGMENT_ENTRY_ORIGIN);
664 table = table + ((address >> 12) & 0xff);
665 pgstev = table[PTRS_PER_PTE];
666 ptev = table[0];
667 /* quick check, checked again with locks held */
668 if (((pgstev & _PGSTE_GPS_USAGE_MASK) == _PGSTE_GPS_USAGE_UNUSED) ||
669 ((pgstev & _PGSTE_GPS_ZERO) && (ptev & _PAGE_INVALID)))
670 gmap_zap_unused(gmap->mm, address);
671}
672EXPORT_SYMBOL_GPL(__gmap_zap);
673
597void gmap_discard(unsigned long from, unsigned long to, struct gmap *gmap) 674void gmap_discard(unsigned long from, unsigned long to, struct gmap *gmap)
598{ 675{
599 676
@@ -671,7 +748,7 @@ EXPORT_SYMBOL_GPL(gmap_unregister_ipte_notifier);
671/** 748/**
672 * gmap_ipte_notify - mark a range of ptes for invalidation notification 749 * gmap_ipte_notify - mark a range of ptes for invalidation notification
673 * @gmap: pointer to guest mapping meta data structure 750 * @gmap: pointer to guest mapping meta data structure
674 * @address: virtual address in the guest address space 751 * @start: virtual address in the guest address space
675 * @len: size of area 752 * @len: size of area
676 * 753 *
677 * Returns 0 if for each page in the given range a gmap mapping exists and 754 * Returns 0 if for each page in the given range a gmap mapping exists and
@@ -725,13 +802,12 @@ EXPORT_SYMBOL_GPL(gmap_ipte_notify);
725/** 802/**
726 * gmap_do_ipte_notify - call all invalidation callbacks for a specific pte. 803 * gmap_do_ipte_notify - call all invalidation callbacks for a specific pte.
727 * @mm: pointer to the process mm_struct 804 * @mm: pointer to the process mm_struct
728 * @addr: virtual address in the process address space
729 * @pte: pointer to the page table entry 805 * @pte: pointer to the page table entry
730 * 806 *
731 * This function is assumed to be called with the page table lock held 807 * This function is assumed to be called with the page table lock held
732 * for the pte to notify. 808 * for the pte to notify.
733 */ 809 */
734void gmap_do_ipte_notify(struct mm_struct *mm, unsigned long addr, pte_t *pte) 810void gmap_do_ipte_notify(struct mm_struct *mm, pte_t *pte)
735{ 811{
736 unsigned long segment_offset; 812 unsigned long segment_offset;
737 struct gmap_notifier *nb; 813 struct gmap_notifier *nb;
@@ -802,6 +878,78 @@ static inline void page_table_free_pgste(unsigned long *table)
802 __free_page(page); 878 __free_page(page);
803} 879}
804 880
881static inline unsigned long page_table_reset_pte(struct mm_struct *mm,
882 pmd_t *pmd, unsigned long addr, unsigned long end)
883{
884 pte_t *start_pte, *pte;
885 spinlock_t *ptl;
886 pgste_t pgste;
887
888 start_pte = pte_offset_map_lock(mm, pmd, addr, &ptl);
889 pte = start_pte;
890 do {
891 pgste = pgste_get_lock(pte);
892 pgste_val(pgste) &= ~_PGSTE_GPS_USAGE_MASK;
893 pgste_set_unlock(pte, pgste);
894 } while (pte++, addr += PAGE_SIZE, addr != end);
895 pte_unmap_unlock(start_pte, ptl);
896
897 return addr;
898}
899
900static inline unsigned long page_table_reset_pmd(struct mm_struct *mm,
901 pud_t *pud, unsigned long addr, unsigned long end)
902{
903 unsigned long next;
904 pmd_t *pmd;
905
906 pmd = pmd_offset(pud, addr);
907 do {
908 next = pmd_addr_end(addr, end);
909 if (pmd_none_or_clear_bad(pmd))
910 continue;
911 next = page_table_reset_pte(mm, pmd, addr, next);
912 } while (pmd++, addr = next, addr != end);
913
914 return addr;
915}
916
917static inline unsigned long page_table_reset_pud(struct mm_struct *mm,
918 pgd_t *pgd, unsigned long addr, unsigned long end)
919{
920 unsigned long next;
921 pud_t *pud;
922
923 pud = pud_offset(pgd, addr);
924 do {
925 next = pud_addr_end(addr, end);
926 if (pud_none_or_clear_bad(pud))
927 continue;
928 next = page_table_reset_pmd(mm, pud, addr, next);
929 } while (pud++, addr = next, addr != end);
930
931 return addr;
932}
933
934void page_table_reset_pgste(struct mm_struct *mm,
935 unsigned long start, unsigned long end)
936{
937 unsigned long addr, next;
938 pgd_t *pgd;
939
940 addr = start;
941 down_read(&mm->mmap_sem);
942 pgd = pgd_offset(mm, addr);
943 do {
944 next = pgd_addr_end(addr, end);
945 if (pgd_none_or_clear_bad(pgd))
946 continue;
947 next = page_table_reset_pud(mm, pgd, addr, next);
948 } while (pgd++, addr = next, addr != end);
949 up_read(&mm->mmap_sem);
950}
951EXPORT_SYMBOL(page_table_reset_pgste);
952
805int set_guest_storage_key(struct mm_struct *mm, unsigned long addr, 953int set_guest_storage_key(struct mm_struct *mm, unsigned long addr,
806 unsigned long key, bool nq) 954 unsigned long key, bool nq)
807{ 955{
@@ -1248,7 +1396,7 @@ void pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,
1248{ 1396{
1249 struct list_head *lh = (struct list_head *) pgtable; 1397 struct list_head *lh = (struct list_head *) pgtable;
1250 1398
1251 assert_spin_locked(&mm->page_table_lock); 1399 assert_spin_locked(pmd_lockptr(mm, pmdp));
1252 1400
1253 /* FIFO */ 1401 /* FIFO */
1254 if (!pmd_huge_pte(mm, pmdp)) 1402 if (!pmd_huge_pte(mm, pmdp))
@@ -1264,7 +1412,7 @@ pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp)
1264 pgtable_t pgtable; 1412 pgtable_t pgtable;
1265 pte_t *ptep; 1413 pte_t *ptep;
1266 1414
1267 assert_spin_locked(&mm->page_table_lock); 1415 assert_spin_locked(pmd_lockptr(mm, pmdp));
1268 1416
1269 /* FIFO */ 1417 /* FIFO */
1270 pgtable = pmd_huge_pte(mm, pmdp); 1418 pgtable = pmd_huge_pte(mm, pmdp);
diff --git a/arch/s390/pci/pci_debug.c b/arch/s390/pci/pci_debug.c
index 75c69b402e05..c5c66840ac00 100644
--- a/arch/s390/pci/pci_debug.c
+++ b/arch/s390/pci/pci_debug.c
@@ -139,7 +139,7 @@ void zpci_debug_exit_device(struct zpci_dev *zdev)
139int __init zpci_debug_init(void) 139int __init zpci_debug_init(void)
140{ 140{
141 /* event trace buffer */ 141 /* event trace buffer */
142 pci_debug_msg_id = debug_register("pci_msg", 16, 1, 16 * sizeof(long)); 142 pci_debug_msg_id = debug_register("pci_msg", 8, 1, 8 * sizeof(long));
143 if (!pci_debug_msg_id) 143 if (!pci_debug_msg_id)
144 return -EINVAL; 144 return -EINVAL;
145 debug_register_view(pci_debug_msg_id, &debug_sprintf_view); 145 debug_register_view(pci_debug_msg_id, &debug_sprintf_view);
diff --git a/arch/score/include/asm/Kbuild b/arch/score/include/asm/Kbuild
index 4630cf217b5b..2f947aba4bd4 100644
--- a/arch/score/include/asm/Kbuild
+++ b/arch/score/include/asm/Kbuild
@@ -4,6 +4,7 @@ header-y +=
4 4
5generic-y += barrier.h 5generic-y += barrier.h
6generic-y += clkdev.h 6generic-y += clkdev.h
7generic-y += cputime.h
7generic-y += hash.h 8generic-y += hash.h
8generic-y += mcs_spinlock.h 9generic-y += mcs_spinlock.h
9generic-y += preempt.h 10generic-y += preempt.h
diff --git a/arch/score/include/asm/cputime.h b/arch/score/include/asm/cputime.h
deleted file mode 100644
index 1fced99f0d67..000000000000
--- a/arch/score/include/asm/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_SCORE_CPUTIME_H
2#define _ASM_SCORE_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* _ASM_SCORE_CPUTIME_H */
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 6357710753d5..364d204298fa 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -123,15 +123,6 @@ config SYS_SUPPORTS_NUMA
123config SYS_SUPPORTS_PCI 123config SYS_SUPPORTS_PCI
124 bool 124 bool
125 125
126config SYS_SUPPORTS_CMT
127 bool
128
129config SYS_SUPPORTS_MTU2
130 bool
131
132config SYS_SUPPORTS_TMU
133 bool
134
135config STACKTRACE_SUPPORT 126config STACKTRACE_SUPPORT
136 def_bool y 127 def_bool y
137 128
@@ -191,14 +182,14 @@ config CPU_SH3
191 bool 182 bool
192 select CPU_HAS_INTEVT 183 select CPU_HAS_INTEVT
193 select CPU_HAS_SR_RB 184 select CPU_HAS_SR_RB
194 select SYS_SUPPORTS_TMU 185 select SYS_SUPPORTS_SH_TMU
195 186
196config CPU_SH4 187config CPU_SH4
197 bool 188 bool
198 select CPU_HAS_INTEVT 189 select CPU_HAS_INTEVT
199 select CPU_HAS_SR_RB 190 select CPU_HAS_SR_RB
200 select CPU_HAS_FPU if !CPU_SH4AL_DSP 191 select CPU_HAS_FPU if !CPU_SH4AL_DSP
201 select SYS_SUPPORTS_TMU 192 select SYS_SUPPORTS_SH_TMU
202 select SYS_SUPPORTS_HUGETLBFS if MMU 193 select SYS_SUPPORTS_HUGETLBFS if MMU
203 194
204config CPU_SH4A 195config CPU_SH4A
@@ -213,7 +204,7 @@ config CPU_SH4AL_DSP
213config CPU_SH5 204config CPU_SH5
214 bool 205 bool
215 select CPU_HAS_FPU 206 select CPU_HAS_FPU
216 select SYS_SUPPORTS_TMU 207 select SYS_SUPPORTS_SH_TMU
217 select SYS_SUPPORTS_HUGETLBFS if MMU 208 select SYS_SUPPORTS_HUGETLBFS if MMU
218 209
219config CPU_SHX2 210config CPU_SHX2
@@ -250,7 +241,7 @@ choice
250config CPU_SUBTYPE_SH7619 241config CPU_SUBTYPE_SH7619
251 bool "Support SH7619 processor" 242 bool "Support SH7619 processor"
252 select CPU_SH2 243 select CPU_SH2
253 select SYS_SUPPORTS_CMT 244 select SYS_SUPPORTS_SH_CMT
254 245
255# SH-2A Processor Support 246# SH-2A Processor Support
256 247
@@ -258,50 +249,50 @@ config CPU_SUBTYPE_SH7201
258 bool "Support SH7201 processor" 249 bool "Support SH7201 processor"
259 select CPU_SH2A 250 select CPU_SH2A
260 select CPU_HAS_FPU 251 select CPU_HAS_FPU
261 select SYS_SUPPORTS_MTU2 252 select SYS_SUPPORTS_SH_MTU2
262 253
263config CPU_SUBTYPE_SH7203 254config CPU_SUBTYPE_SH7203
264 bool "Support SH7203 processor" 255 bool "Support SH7203 processor"
265 select CPU_SH2A 256 select CPU_SH2A
266 select CPU_HAS_FPU 257 select CPU_HAS_FPU
267 select SYS_SUPPORTS_CMT 258 select SYS_SUPPORTS_SH_CMT
268 select SYS_SUPPORTS_MTU2 259 select SYS_SUPPORTS_SH_MTU2
269 select ARCH_WANT_OPTIONAL_GPIOLIB 260 select ARCH_WANT_OPTIONAL_GPIOLIB
270 select PINCTRL 261 select PINCTRL
271 262
272config CPU_SUBTYPE_SH7206 263config CPU_SUBTYPE_SH7206
273 bool "Support SH7206 processor" 264 bool "Support SH7206 processor"
274 select CPU_SH2A 265 select CPU_SH2A
275 select SYS_SUPPORTS_CMT 266 select SYS_SUPPORTS_SH_CMT
276 select SYS_SUPPORTS_MTU2 267 select SYS_SUPPORTS_SH_MTU2
277 268
278config CPU_SUBTYPE_SH7263 269config CPU_SUBTYPE_SH7263
279 bool "Support SH7263 processor" 270 bool "Support SH7263 processor"
280 select CPU_SH2A 271 select CPU_SH2A
281 select CPU_HAS_FPU 272 select CPU_HAS_FPU
282 select SYS_SUPPORTS_CMT 273 select SYS_SUPPORTS_SH_CMT
283 select SYS_SUPPORTS_MTU2 274 select SYS_SUPPORTS_SH_MTU2
284 275
285config CPU_SUBTYPE_SH7264 276config CPU_SUBTYPE_SH7264
286 bool "Support SH7264 processor" 277 bool "Support SH7264 processor"
287 select CPU_SH2A 278 select CPU_SH2A
288 select CPU_HAS_FPU 279 select CPU_HAS_FPU
289 select SYS_SUPPORTS_CMT 280 select SYS_SUPPORTS_SH_CMT
290 select SYS_SUPPORTS_MTU2 281 select SYS_SUPPORTS_SH_MTU2
291 select PINCTRL 282 select PINCTRL
292 283
293config CPU_SUBTYPE_SH7269 284config CPU_SUBTYPE_SH7269
294 bool "Support SH7269 processor" 285 bool "Support SH7269 processor"
295 select CPU_SH2A 286 select CPU_SH2A
296 select CPU_HAS_FPU 287 select CPU_HAS_FPU
297 select SYS_SUPPORTS_CMT 288 select SYS_SUPPORTS_SH_CMT
298 select SYS_SUPPORTS_MTU2 289 select SYS_SUPPORTS_SH_MTU2
299 select PINCTRL 290 select PINCTRL
300 291
301config CPU_SUBTYPE_MXG 292config CPU_SUBTYPE_MXG
302 bool "Support MX-G processor" 293 bool "Support MX-G processor"
303 select CPU_SH2A 294 select CPU_SH2A
304 select SYS_SUPPORTS_MTU2 295 select SYS_SUPPORTS_SH_MTU2
305 help 296 help
306 Select MX-G if running on an R8A03022BG part. 297 Select MX-G if running on an R8A03022BG part.
307 298
@@ -354,7 +345,7 @@ config CPU_SUBTYPE_SH7720
354 bool "Support SH7720 processor" 345 bool "Support SH7720 processor"
355 select CPU_SH3 346 select CPU_SH3
356 select CPU_HAS_DSP 347 select CPU_HAS_DSP
357 select SYS_SUPPORTS_CMT 348 select SYS_SUPPORTS_SH_CMT
358 select ARCH_WANT_OPTIONAL_GPIOLIB 349 select ARCH_WANT_OPTIONAL_GPIOLIB
359 select USB_ARCH_HAS_OHCI 350 select USB_ARCH_HAS_OHCI
360 select USB_OHCI_SH if USB_OHCI_HCD 351 select USB_OHCI_SH if USB_OHCI_HCD
@@ -366,7 +357,7 @@ config CPU_SUBTYPE_SH7721
366 bool "Support SH7721 processor" 357 bool "Support SH7721 processor"
367 select CPU_SH3 358 select CPU_SH3
368 select CPU_HAS_DSP 359 select CPU_HAS_DSP
369 select SYS_SUPPORTS_CMT 360 select SYS_SUPPORTS_SH_CMT
370 select USB_ARCH_HAS_OHCI 361 select USB_ARCH_HAS_OHCI
371 select USB_OHCI_SH if USB_OHCI_HCD 362 select USB_OHCI_SH if USB_OHCI_HCD
372 help 363 help
@@ -422,7 +413,7 @@ config CPU_SUBTYPE_SH7723
422 select CPU_SHX2 413 select CPU_SHX2
423 select ARCH_SHMOBILE 414 select ARCH_SHMOBILE
424 select ARCH_SPARSEMEM_ENABLE 415 select ARCH_SPARSEMEM_ENABLE
425 select SYS_SUPPORTS_CMT 416 select SYS_SUPPORTS_SH_CMT
426 select ARCH_WANT_OPTIONAL_GPIOLIB 417 select ARCH_WANT_OPTIONAL_GPIOLIB
427 select PINCTRL 418 select PINCTRL
428 help 419 help
@@ -434,7 +425,7 @@ config CPU_SUBTYPE_SH7724
434 select CPU_SHX2 425 select CPU_SHX2
435 select ARCH_SHMOBILE 426 select ARCH_SHMOBILE
436 select ARCH_SPARSEMEM_ENABLE 427 select ARCH_SPARSEMEM_ENABLE
437 select SYS_SUPPORTS_CMT 428 select SYS_SUPPORTS_SH_CMT
438 select ARCH_WANT_OPTIONAL_GPIOLIB 429 select ARCH_WANT_OPTIONAL_GPIOLIB
439 select PINCTRL 430 select PINCTRL
440 help 431 help
@@ -514,7 +505,7 @@ config CPU_SUBTYPE_SH7343
514 bool "Support SH7343 processor" 505 bool "Support SH7343 processor"
515 select CPU_SH4AL_DSP 506 select CPU_SH4AL_DSP
516 select ARCH_SHMOBILE 507 select ARCH_SHMOBILE
517 select SYS_SUPPORTS_CMT 508 select SYS_SUPPORTS_SH_CMT
518 509
519config CPU_SUBTYPE_SH7722 510config CPU_SUBTYPE_SH7722
520 bool "Support SH7722 processor" 511 bool "Support SH7722 processor"
@@ -523,7 +514,7 @@ config CPU_SUBTYPE_SH7722
523 select ARCH_SHMOBILE 514 select ARCH_SHMOBILE
524 select ARCH_SPARSEMEM_ENABLE 515 select ARCH_SPARSEMEM_ENABLE
525 select SYS_SUPPORTS_NUMA 516 select SYS_SUPPORTS_NUMA
526 select SYS_SUPPORTS_CMT 517 select SYS_SUPPORTS_SH_CMT
527 select ARCH_WANT_OPTIONAL_GPIOLIB 518 select ARCH_WANT_OPTIONAL_GPIOLIB
528 select PINCTRL 519 select PINCTRL
529 520
@@ -534,7 +525,7 @@ config CPU_SUBTYPE_SH7366
534 select ARCH_SHMOBILE 525 select ARCH_SHMOBILE
535 select ARCH_SPARSEMEM_ENABLE 526 select ARCH_SPARSEMEM_ENABLE
536 select SYS_SUPPORTS_NUMA 527 select SYS_SUPPORTS_NUMA
537 select SYS_SUPPORTS_CMT 528 select SYS_SUPPORTS_SH_CMT
538 529
539endchoice 530endchoice
540 531
@@ -567,27 +558,6 @@ source "arch/sh/boards/Kconfig"
567 558
568menu "Timer and clock configuration" 559menu "Timer and clock configuration"
569 560
570config SH_TIMER_TMU
571 bool "TMU timer driver"
572 depends on SYS_SUPPORTS_TMU
573 default y
574 help
575 This enables the build of the TMU timer driver.
576
577config SH_TIMER_CMT
578 bool "CMT timer driver"
579 depends on SYS_SUPPORTS_CMT
580 default y
581 help
582 This enables build of the CMT timer driver.
583
584config SH_TIMER_MTU2
585 bool "MTU2 timer driver"
586 depends on SYS_SUPPORTS_MTU2
587 default y
588 help
589 This enables build of the MTU2 timer driver.
590
591config SH_PCLK_FREQ 561config SH_PCLK_FREQ
592 int "Peripheral clock frequency (in Hz)" 562 int "Peripheral clock frequency (in Hz)"
593 depends on SH_CLK_CPG_LEGACY 563 depends on SH_CLK_CPG_LEGACY
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index 0833736afa32..65a1ecd77f96 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -217,19 +217,6 @@ void __init init_IRQ(void)
217} 217}
218 218
219#ifdef CONFIG_HOTPLUG_CPU 219#ifdef CONFIG_HOTPLUG_CPU
220static void route_irq(struct irq_data *data, unsigned int irq, unsigned int cpu)
221{
222 struct irq_desc *desc = irq_to_desc(irq);
223 struct irq_chip *chip = irq_data_get_irq_chip(data);
224
225 printk(KERN_INFO "IRQ%u: moving from cpu%u to cpu%u\n",
226 irq, data->node, cpu);
227
228 raw_spin_lock_irq(&desc->lock);
229 chip->irq_set_affinity(data, cpumask_of(cpu), false);
230 raw_spin_unlock_irq(&desc->lock);
231}
232
233/* 220/*
234 * The CPU has been marked offline. Migrate IRQs off this CPU. If 221 * The CPU has been marked offline. Migrate IRQs off this CPU. If
235 * the affinity settings do not allow other CPUs, force them onto any 222 * the affinity settings do not allow other CPUs, force them onto any
@@ -250,11 +237,8 @@ void migrate_irqs(void)
250 irq, cpu); 237 irq, cpu);
251 238
252 cpumask_setall(data->affinity); 239 cpumask_setall(data->affinity);
253 newcpu = cpumask_any_and(data->affinity,
254 cpu_online_mask);
255 } 240 }
256 241 irq_set_affinity(irq, data->affinity);
257 route_irq(data, irq, newcpu);
258 } 242 }
259 } 243 }
260} 244}
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index c3d82b5f54ca..24e8b8705e7f 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -733,7 +733,7 @@ void __irq_entry timer_interrupt(int irq, struct pt_regs *regs)
733 irq_enter(); 733 irq_enter();
734 734
735 local_cpu_data().irq0_irqs++; 735 local_cpu_data().irq0_irqs++;
736 kstat_incr_irqs_this_cpu(0, irq_to_desc(0)); 736 kstat_incr_irq_this_cpu(0);
737 737
738 if (unlikely(!evt->event_handler)) { 738 if (unlikely(!evt->event_handler)) {
739 printk(KERN_WARNING 739 printk(KERN_WARNING
diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild
index a8fee078b92f..4acddc43ee0c 100644
--- a/arch/x86/include/asm/Kbuild
+++ b/arch/x86/include/asm/Kbuild
@@ -5,4 +5,5 @@ genhdr-y += unistd_64.h
5genhdr-y += unistd_x32.h 5genhdr-y += unistd_x32.h
6 6
7generic-y += clkdev.h 7generic-y += clkdev.h
8generic-y += cputime.h
8generic-y += mcs_spinlock.h 9generic-y += mcs_spinlock.h
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index bc507d7640f8..63211ef5046a 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -37,7 +37,7 @@
37#define X86_FEATURE_PAT (0*32+16) /* Page Attribute Table */ 37#define X86_FEATURE_PAT (0*32+16) /* Page Attribute Table */
38#define X86_FEATURE_PSE36 (0*32+17) /* 36-bit PSEs */ 38#define X86_FEATURE_PSE36 (0*32+17) /* 36-bit PSEs */
39#define X86_FEATURE_PN (0*32+18) /* Processor serial number */ 39#define X86_FEATURE_PN (0*32+18) /* Processor serial number */
40#define X86_FEATURE_CLFLSH (0*32+19) /* "clflush" CLFLUSH instruction */ 40#define X86_FEATURE_CLFLUSH (0*32+19) /* CLFLUSH instruction */
41#define X86_FEATURE_DS (0*32+21) /* "dts" Debug Store */ 41#define X86_FEATURE_DS (0*32+21) /* "dts" Debug Store */
42#define X86_FEATURE_ACPI (0*32+22) /* ACPI via MSR */ 42#define X86_FEATURE_ACPI (0*32+22) /* ACPI via MSR */
43#define X86_FEATURE_MMX (0*32+23) /* Multimedia Extensions */ 43#define X86_FEATURE_MMX (0*32+23) /* Multimedia Extensions */
@@ -318,7 +318,7 @@ extern const char * const x86_power_flags[32];
318#define cpu_has_pmm_enabled boot_cpu_has(X86_FEATURE_PMM_EN) 318#define cpu_has_pmm_enabled boot_cpu_has(X86_FEATURE_PMM_EN)
319#define cpu_has_ds boot_cpu_has(X86_FEATURE_DS) 319#define cpu_has_ds boot_cpu_has(X86_FEATURE_DS)
320#define cpu_has_pebs boot_cpu_has(X86_FEATURE_PEBS) 320#define cpu_has_pebs boot_cpu_has(X86_FEATURE_PEBS)
321#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLSH) 321#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLUSH)
322#define cpu_has_bts boot_cpu_has(X86_FEATURE_BTS) 322#define cpu_has_bts boot_cpu_has(X86_FEATURE_BTS)
323#define cpu_has_gbpages boot_cpu_has(X86_FEATURE_GBPAGES) 323#define cpu_has_gbpages boot_cpu_has(X86_FEATURE_GBPAGES)
324#define cpu_has_arch_perfmon boot_cpu_has(X86_FEATURE_ARCH_PERFMON) 324#define cpu_has_arch_perfmon boot_cpu_has(X86_FEATURE_ARCH_PERFMON)
diff --git a/arch/x86/include/asm/cputime.h b/arch/x86/include/asm/cputime.h
deleted file mode 100644
index 6d68ad7e0ea3..000000000000
--- a/arch/x86/include/asm/cputime.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/cputime.h>
diff --git a/arch/x86/include/asm/floppy.h b/arch/x86/include/asm/floppy.h
index d3d74698dce9..1c7eefe32502 100644
--- a/arch/x86/include/asm/floppy.h
+++ b/arch/x86/include/asm/floppy.h
@@ -145,10 +145,10 @@ static int fd_request_irq(void)
145{ 145{
146 if (can_use_virtual_dma) 146 if (can_use_virtual_dma)
147 return request_irq(FLOPPY_IRQ, floppy_hardint, 147 return request_irq(FLOPPY_IRQ, floppy_hardint,
148 IRQF_DISABLED, "floppy", NULL); 148 0, "floppy", NULL);
149 else 149 else
150 return request_irq(FLOPPY_IRQ, floppy_interrupt, 150 return request_irq(FLOPPY_IRQ, floppy_interrupt,
151 IRQF_DISABLED, "floppy", NULL); 151 0, "floppy", NULL);
152} 152}
153 153
154static unsigned long dma_mem_alloc(unsigned long size) 154static unsigned long dma_mem_alloc(unsigned long size)
diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h
index ab0ae1aa6d0a..230853da4ec0 100644
--- a/arch/x86/include/asm/hardirq.h
+++ b/arch/x86/include/asm/hardirq.h
@@ -33,6 +33,9 @@ typedef struct {
33#ifdef CONFIG_X86_MCE_THRESHOLD 33#ifdef CONFIG_X86_MCE_THRESHOLD
34 unsigned int irq_threshold_count; 34 unsigned int irq_threshold_count;
35#endif 35#endif
36#if IS_ENABLED(CONFIG_HYPERV) || defined(CONFIG_XEN)
37 unsigned int irq_hv_callback_count;
38#endif
36} ____cacheline_aligned irq_cpustat_t; 39} ____cacheline_aligned irq_cpustat_t;
37 40
38DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat); 41DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index cd9c41938b8a..c163215abb9a 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -2,6 +2,7 @@
2#define _ASM_X86_MSHYPER_H 2#define _ASM_X86_MSHYPER_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/interrupt.h>
5#include <asm/hyperv.h> 6#include <asm/hyperv.h>
6 7
7struct ms_hyperv_info { 8struct ms_hyperv_info {
@@ -16,6 +17,7 @@ void hyperv_callback_vector(void);
16#define trace_hyperv_callback_vector hyperv_callback_vector 17#define trace_hyperv_callback_vector hyperv_callback_vector
17#endif 18#endif
18void hyperv_vector_handler(struct pt_regs *regs); 19void hyperv_vector_handler(struct pt_regs *regs);
19void hv_register_vmbus_handler(int irq, irq_handler_t handler); 20void hv_setup_vmbus_irq(void (*handler)(void));
21void hv_remove_vmbus_irq(void);
20 22
21#endif 23#endif
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index fdedd38fd0fc..a4ea02351f4d 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -449,6 +449,15 @@ struct stack_canary {
449}; 449};
450DECLARE_PER_CPU_ALIGNED(struct stack_canary, stack_canary); 450DECLARE_PER_CPU_ALIGNED(struct stack_canary, stack_canary);
451#endif 451#endif
452/*
453 * per-CPU IRQ handling stacks
454 */
455struct irq_stack {
456 u32 stack[THREAD_SIZE/sizeof(u32)];
457} __aligned(THREAD_SIZE);
458
459DECLARE_PER_CPU(struct irq_stack *, hardirq_stack);
460DECLARE_PER_CPU(struct irq_stack *, softirq_stack);
452#endif /* X86_64 */ 461#endif /* X86_64 */
453 462
454extern unsigned int xstate_size; 463extern unsigned int xstate_size;
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index e1940c06ed02..47e5de25ba79 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -9,6 +9,7 @@
9 9
10#include <linux/compiler.h> 10#include <linux/compiler.h>
11#include <asm/page.h> 11#include <asm/page.h>
12#include <asm/percpu.h>
12#include <asm/types.h> 13#include <asm/types.h>
13 14
14/* 15/*
@@ -32,12 +33,6 @@ struct thread_info {
32 mm_segment_t addr_limit; 33 mm_segment_t addr_limit;
33 struct restart_block restart_block; 34 struct restart_block restart_block;
34 void __user *sysenter_return; 35 void __user *sysenter_return;
35#ifdef CONFIG_X86_32
36 unsigned long previous_esp; /* ESP of the previous stack in
37 case of nested (IRQ) stacks
38 */
39 __u8 supervisor_stack[0];
40#endif
41 unsigned int sig_on_uaccess_error:1; 36 unsigned int sig_on_uaccess_error:1;
42 unsigned int uaccess_err:1; /* uaccess failed */ 37 unsigned int uaccess_err:1; /* uaccess failed */
43}; 38};
@@ -153,9 +148,9 @@ struct thread_info {
153#define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY) 148#define _TIF_WORK_CTXSW_PREV (_TIF_WORK_CTXSW|_TIF_USER_RETURN_NOTIFY)
154#define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW) 149#define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW)
155 150
156#ifdef CONFIG_X86_32 151#define STACK_WARN (THREAD_SIZE/8)
152#define KERNEL_STACK_OFFSET (5*(BITS_PER_LONG/8))
157 153
158#define STACK_WARN (THREAD_SIZE/8)
159/* 154/*
160 * macros/functions for gaining access to the thread information structure 155 * macros/functions for gaining access to the thread information structure
161 * 156 *
@@ -163,42 +158,6 @@ struct thread_info {
163 */ 158 */
164#ifndef __ASSEMBLY__ 159#ifndef __ASSEMBLY__
165 160
166#define current_stack_pointer ({ \
167 unsigned long sp; \
168 asm("mov %%esp,%0" : "=g" (sp)); \
169 sp; \
170})
171
172/* how to get the thread information struct from C */
173static inline struct thread_info *current_thread_info(void)
174{
175 return (struct thread_info *)
176 (current_stack_pointer & ~(THREAD_SIZE - 1));
177}
178
179#else /* !__ASSEMBLY__ */
180
181/* how to get the thread information struct from ASM */
182#define GET_THREAD_INFO(reg) \
183 movl $-THREAD_SIZE, reg; \
184 andl %esp, reg
185
186/* use this one if reg already contains %esp */
187#define GET_THREAD_INFO_WITH_ESP(reg) \
188 andl $-THREAD_SIZE, reg
189
190#endif
191
192#else /* X86_32 */
193
194#include <asm/percpu.h>
195#define KERNEL_STACK_OFFSET (5*8)
196
197/*
198 * macros/functions for gaining access to the thread information structure
199 * preempt_count needs to be 1 initially, until the scheduler is functional.
200 */
201#ifndef __ASSEMBLY__
202DECLARE_PER_CPU(unsigned long, kernel_stack); 161DECLARE_PER_CPU(unsigned long, kernel_stack);
203 162
204static inline struct thread_info *current_thread_info(void) 163static inline struct thread_info *current_thread_info(void)
@@ -213,8 +172,8 @@ static inline struct thread_info *current_thread_info(void)
213 172
214/* how to get the thread information struct from ASM */ 173/* how to get the thread information struct from ASM */
215#define GET_THREAD_INFO(reg) \ 174#define GET_THREAD_INFO(reg) \
216 movq PER_CPU_VAR(kernel_stack),reg ; \ 175 _ASM_MOV PER_CPU_VAR(kernel_stack),reg ; \
217 subq $(THREAD_SIZE-KERNEL_STACK_OFFSET),reg 176 _ASM_SUB $(THREAD_SIZE-KERNEL_STACK_OFFSET),reg ;
218 177
219/* 178/*
220 * Same if PER_CPU_VAR(kernel_stack) is, perhaps with some offset, already in 179 * Same if PER_CPU_VAR(kernel_stack) is, perhaps with some offset, already in
@@ -224,8 +183,6 @@ static inline struct thread_info *current_thread_info(void)
224 183
225#endif 184#endif
226 185
227#endif /* !X86_32 */
228
229/* 186/*
230 * Thread-synchronous status. 187 * Thread-synchronous status.
231 * 188 *
diff --git a/arch/x86/include/asm/unistd.h b/arch/x86/include/asm/unistd.h
index c2a48139c340..3f556c6a0157 100644
--- a/arch/x86/include/asm/unistd.h
+++ b/arch/x86/include/asm/unistd.h
@@ -23,6 +23,9 @@
23# include <asm/unistd_64.h> 23# include <asm/unistd_64.h>
24# include <asm/unistd_64_x32.h> 24# include <asm/unistd_64_x32.h>
25# define __ARCH_WANT_COMPAT_SYS_TIME 25# define __ARCH_WANT_COMPAT_SYS_TIME
26# define __ARCH_WANT_COMPAT_SYS_GETDENTS64
27# define __ARCH_WANT_COMPAT_SYS_PREADV64
28# define __ARCH_WANT_COMPAT_SYS_PWRITEV64
26 29
27# endif 30# endif
28 31
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 8e28bf2fc3ef..a135239badb7 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1025,7 +1025,8 @@ __setup("show_msr=", setup_show_msr);
1025 1025
1026static __init int setup_noclflush(char *arg) 1026static __init int setup_noclflush(char *arg)
1027{ 1027{
1028 setup_clear_cpu_cap(X86_FEATURE_CLFLSH); 1028 setup_clear_cpu_cap(X86_FEATURE_CLFLUSH);
1029 setup_clear_cpu_cap(X86_FEATURE_CLFLUSHOPT);
1029 return 1; 1030 return 1;
1030} 1031}
1031__setup("noclflush", setup_noclflush); 1032__setup("noclflush", setup_noclflush);
@@ -1078,6 +1079,10 @@ static __init int setup_disablecpuid(char *arg)
1078} 1079}
1079__setup("clearcpuid=", setup_disablecpuid); 1080__setup("clearcpuid=", setup_disablecpuid);
1080 1081
1082DEFINE_PER_CPU(unsigned long, kernel_stack) =
1083 (unsigned long)&init_thread_union - KERNEL_STACK_OFFSET + THREAD_SIZE;
1084EXPORT_PER_CPU_SYMBOL(kernel_stack);
1085
1081#ifdef CONFIG_X86_64 1086#ifdef CONFIG_X86_64
1082struct desc_ptr idt_descr = { NR_VECTORS * 16 - 1, (unsigned long) idt_table }; 1087struct desc_ptr idt_descr = { NR_VECTORS * 16 - 1, (unsigned long) idt_table };
1083struct desc_ptr debug_idt_descr = { NR_VECTORS * 16 - 1, 1088struct desc_ptr debug_idt_descr = { NR_VECTORS * 16 - 1,
@@ -1094,10 +1099,6 @@ DEFINE_PER_CPU(struct task_struct *, current_task) ____cacheline_aligned =
1094 &init_task; 1099 &init_task;
1095EXPORT_PER_CPU_SYMBOL(current_task); 1100EXPORT_PER_CPU_SYMBOL(current_task);
1096 1101
1097DEFINE_PER_CPU(unsigned long, kernel_stack) =
1098 (unsigned long)&init_thread_union - KERNEL_STACK_OFFSET + THREAD_SIZE;
1099EXPORT_PER_CPU_SYMBOL(kernel_stack);
1100
1101DEFINE_PER_CPU(char *, irq_stack_ptr) = 1102DEFINE_PER_CPU(char *, irq_stack_ptr) =
1102 init_per_cpu_var(irq_stack_union.irq_stack) + IRQ_STACK_SIZE - 64; 1103 init_per_cpu_var(irq_stack_union.irq_stack) + IRQ_STACK_SIZE - 64;
1103 1104
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 832d05a914ba..76f98fe5b35c 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -17,6 +17,7 @@
17#include <linux/hardirq.h> 17#include <linux/hardirq.h>
18#include <linux/efi.h> 18#include <linux/efi.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/irq.h>
20#include <asm/processor.h> 21#include <asm/processor.h>
21#include <asm/hypervisor.h> 22#include <asm/hypervisor.h>
22#include <asm/hyperv.h> 23#include <asm/hyperv.h>
@@ -31,6 +32,45 @@
31struct ms_hyperv_info ms_hyperv; 32struct ms_hyperv_info ms_hyperv;
32EXPORT_SYMBOL_GPL(ms_hyperv); 33EXPORT_SYMBOL_GPL(ms_hyperv);
33 34
35#if IS_ENABLED(CONFIG_HYPERV)
36static void (*vmbus_handler)(void);
37
38void hyperv_vector_handler(struct pt_regs *regs)
39{
40 struct pt_regs *old_regs = set_irq_regs(regs);
41
42 irq_enter();
43 exit_idle();
44
45 inc_irq_stat(irq_hv_callback_count);
46 if (vmbus_handler)
47 vmbus_handler();
48
49 irq_exit();
50 set_irq_regs(old_regs);
51}
52
53void hv_setup_vmbus_irq(void (*handler)(void))
54{
55 vmbus_handler = handler;
56 /*
57 * Setup the IDT for hypervisor callback. Prevent reallocation
58 * at module reload.
59 */
60 if (!test_bit(HYPERVISOR_CALLBACK_VECTOR, used_vectors))
61 alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR,
62 hyperv_callback_vector);
63}
64
65void hv_remove_vmbus_irq(void)
66{
67 /* We have no way to deallocate the interrupt gate */
68 vmbus_handler = NULL;
69}
70EXPORT_SYMBOL_GPL(hv_setup_vmbus_irq);
71EXPORT_SYMBOL_GPL(hv_remove_vmbus_irq);
72#endif
73
34static uint32_t __init ms_hyperv_platform(void) 74static uint32_t __init ms_hyperv_platform(void)
35{ 75{
36 u32 eax; 76 u32 eax;
@@ -119,41 +159,3 @@ const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
119 .init_platform = ms_hyperv_init_platform, 159 .init_platform = ms_hyperv_init_platform,
120}; 160};
121EXPORT_SYMBOL(x86_hyper_ms_hyperv); 161EXPORT_SYMBOL(x86_hyper_ms_hyperv);
122
123#if IS_ENABLED(CONFIG_HYPERV)
124static int vmbus_irq = -1;
125static irq_handler_t vmbus_isr;
126
127void hv_register_vmbus_handler(int irq, irq_handler_t handler)
128{
129 /*
130 * Setup the IDT for hypervisor callback.
131 */
132 alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, hyperv_callback_vector);
133
134 vmbus_irq = irq;
135 vmbus_isr = handler;
136}
137
138void hyperv_vector_handler(struct pt_regs *regs)
139{
140 struct pt_regs *old_regs = set_irq_regs(regs);
141 struct irq_desc *desc;
142
143 irq_enter();
144 exit_idle();
145
146 desc = irq_to_desc(vmbus_irq);
147
148 if (desc)
149 generic_handle_irq_desc(vmbus_irq, desc);
150
151 irq_exit();
152 set_irq_regs(old_regs);
153}
154#else
155void hv_register_vmbus_handler(int irq, irq_handler_t handler)
156{
157}
158#endif
159EXPORT_SYMBOL_GPL(hv_register_vmbus_handler);
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index a21d49c071db..5abd4cd4230c 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -16,12 +16,35 @@
16 16
17#include <asm/stacktrace.h> 17#include <asm/stacktrace.h>
18 18
19static void *is_irq_stack(void *p, void *irq)
20{
21 if (p < irq || p >= (irq + THREAD_SIZE))
22 return NULL;
23 return irq + THREAD_SIZE;
24}
25
26
27static void *is_hardirq_stack(unsigned long *stack, int cpu)
28{
29 void *irq = per_cpu(hardirq_stack, cpu);
30
31 return is_irq_stack(stack, irq);
32}
33
34static void *is_softirq_stack(unsigned long *stack, int cpu)
35{
36 void *irq = per_cpu(softirq_stack, cpu);
37
38 return is_irq_stack(stack, irq);
39}
19 40
20void dump_trace(struct task_struct *task, struct pt_regs *regs, 41void dump_trace(struct task_struct *task, struct pt_regs *regs,
21 unsigned long *stack, unsigned long bp, 42 unsigned long *stack, unsigned long bp,
22 const struct stacktrace_ops *ops, void *data) 43 const struct stacktrace_ops *ops, void *data)
23{ 44{
45 const unsigned cpu = get_cpu();
24 int graph = 0; 46 int graph = 0;
47 u32 *prev_esp;
25 48
26 if (!task) 49 if (!task)
27 task = current; 50 task = current;
@@ -39,18 +62,31 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
39 62
40 for (;;) { 63 for (;;) {
41 struct thread_info *context; 64 struct thread_info *context;
65 void *end_stack;
66
67 end_stack = is_hardirq_stack(stack, cpu);
68 if (!end_stack)
69 end_stack = is_softirq_stack(stack, cpu);
42 70
43 context = (struct thread_info *) 71 context = task_thread_info(task);
44 ((unsigned long)stack & (~(THREAD_SIZE - 1))); 72 bp = ops->walk_stack(context, stack, bp, ops, data,
45 bp = ops->walk_stack(context, stack, bp, ops, data, NULL, &graph); 73 end_stack, &graph);
46 74
47 stack = (unsigned long *)context->previous_esp; 75 /* Stop if not on irq stack */
76 if (!end_stack)
77 break;
78
79 /* The previous esp is saved on the bottom of the stack */
80 prev_esp = (u32 *)(end_stack - THREAD_SIZE);
81 stack = (unsigned long *)*prev_esp;
48 if (!stack) 82 if (!stack)
49 break; 83 break;
84
50 if (ops->stack(data, "IRQ") < 0) 85 if (ops->stack(data, "IRQ") < 0)
51 break; 86 break;
52 touch_nmi_watchdog(); 87 touch_nmi_watchdog();
53 } 88 }
89 put_cpu();
54} 90}
55EXPORT_SYMBOL(dump_trace); 91EXPORT_SYMBOL(dump_trace);
56 92
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index addb207dab92..346b1df2412e 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -104,6 +104,45 @@ in_irq_stack(unsigned long *stack, unsigned long *irq_stack,
104 return (stack >= irq_stack && stack < irq_stack_end); 104 return (stack >= irq_stack && stack < irq_stack_end);
105} 105}
106 106
107static const unsigned long irq_stack_size =
108 (IRQ_STACK_SIZE - 64) / sizeof(unsigned long);
109
110enum stack_type {
111 STACK_IS_UNKNOWN,
112 STACK_IS_NORMAL,
113 STACK_IS_EXCEPTION,
114 STACK_IS_IRQ,
115};
116
117static enum stack_type
118analyze_stack(int cpu, struct task_struct *task,
119 unsigned long *stack, unsigned long **stack_end, char **id)
120{
121 unsigned long *irq_stack;
122 unsigned long addr;
123 unsigned used = 0;
124
125 addr = ((unsigned long)stack & (~(THREAD_SIZE - 1)));
126 if ((unsigned long)task_stack_page(task) == addr)
127 return STACK_IS_NORMAL;
128
129 *stack_end = in_exception_stack(cpu, (unsigned long)stack,
130 &used, id);
131 if (*stack_end)
132 return STACK_IS_EXCEPTION;
133
134 *stack_end = (unsigned long *)per_cpu(irq_stack_ptr, cpu);
135 if (!*stack_end)
136 return STACK_IS_UNKNOWN;
137
138 irq_stack = *stack_end - irq_stack_size;
139
140 if (in_irq_stack(stack, irq_stack, *stack_end))
141 return STACK_IS_IRQ;
142
143 return STACK_IS_UNKNOWN;
144}
145
107/* 146/*
108 * x86-64 can have up to three kernel stacks: 147 * x86-64 can have up to three kernel stacks:
109 * process stack 148 * process stack
@@ -116,12 +155,11 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
116 const struct stacktrace_ops *ops, void *data) 155 const struct stacktrace_ops *ops, void *data)
117{ 156{
118 const unsigned cpu = get_cpu(); 157 const unsigned cpu = get_cpu();
119 unsigned long *irq_stack_end =
120 (unsigned long *)per_cpu(irq_stack_ptr, cpu);
121 unsigned used = 0;
122 struct thread_info *tinfo; 158 struct thread_info *tinfo;
123 int graph = 0; 159 unsigned long *irq_stack;
124 unsigned long dummy; 160 unsigned long dummy;
161 int graph = 0;
162 int done = 0;
125 163
126 if (!task) 164 if (!task)
127 task = current; 165 task = current;
@@ -143,49 +181,60 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
143 * exceptions 181 * exceptions
144 */ 182 */
145 tinfo = task_thread_info(task); 183 tinfo = task_thread_info(task);
146 for (;;) { 184 while (!done) {
185 unsigned long *stack_end;
186 enum stack_type stype;
147 char *id; 187 char *id;
148 unsigned long *estack_end;
149 estack_end = in_exception_stack(cpu, (unsigned long)stack,
150 &used, &id);
151 188
152 if (estack_end) { 189 stype = analyze_stack(cpu, task, stack, &stack_end, &id);
190
191 /* Default finish unless specified to continue */
192 done = 1;
193
194 switch (stype) {
195
196 /* Break out early if we are on the thread stack */
197 case STACK_IS_NORMAL:
198 break;
199
200 case STACK_IS_EXCEPTION:
201
153 if (ops->stack(data, id) < 0) 202 if (ops->stack(data, id) < 0)
154 break; 203 break;
155 204
156 bp = ops->walk_stack(tinfo, stack, bp, ops, 205 bp = ops->walk_stack(tinfo, stack, bp, ops,
157 data, estack_end, &graph); 206 data, stack_end, &graph);
158 ops->stack(data, "<EOE>"); 207 ops->stack(data, "<EOE>");
159 /* 208 /*
160 * We link to the next stack via the 209 * We link to the next stack via the
161 * second-to-last pointer (index -2 to end) in the 210 * second-to-last pointer (index -2 to end) in the
162 * exception stack: 211 * exception stack:
163 */ 212 */
164 stack = (unsigned long *) estack_end[-2]; 213 stack = (unsigned long *) stack_end[-2];
165 continue; 214 done = 0;
166 } 215 break;
167 if (irq_stack_end) { 216
168 unsigned long *irq_stack; 217 case STACK_IS_IRQ:
169 irq_stack = irq_stack_end - 218
170 (IRQ_STACK_SIZE - 64) / sizeof(*irq_stack); 219 if (ops->stack(data, "IRQ") < 0)
171 220 break;
172 if (in_irq_stack(stack, irq_stack, irq_stack_end)) { 221 bp = ops->walk_stack(tinfo, stack, bp,
173 if (ops->stack(data, "IRQ") < 0) 222 ops, data, stack_end, &graph);
174 break; 223 /*
175 bp = ops->walk_stack(tinfo, stack, bp, 224 * We link to the next stack (which would be
176 ops, data, irq_stack_end, &graph); 225 * the process stack normally) the last
177 /* 226 * pointer (index -1 to end) in the IRQ stack:
178 * We link to the next stack (which would be 227 */
179 * the process stack normally) the last 228 stack = (unsigned long *) (stack_end[-1]);
180 * pointer (index -1 to end) in the IRQ stack: 229 irq_stack = stack_end - irq_stack_size;
181 */ 230 ops->stack(data, "EOI");
182 stack = (unsigned long *) (irq_stack_end[-1]); 231 done = 0;
183 irq_stack_end = NULL; 232 break;
184 ops->stack(data, "EOI"); 233
185 continue; 234 case STACK_IS_UNKNOWN:
186 } 235 ops->stack(data, "UNK");
236 break;
187 } 237 }
188 break;
189 } 238 }
190 239
191 /* 240 /*
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index bc4a088f9023..6d7d5a1260a6 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -203,18 +203,15 @@ static void __init intel_remapping_check(int num, int slot, int func)
203 revision = read_pci_config_byte(num, slot, func, PCI_REVISION_ID); 203 revision = read_pci_config_byte(num, slot, func, PCI_REVISION_ID);
204 204
205 /* 205 /*
206 * Revision 13 of all triggering devices id in this quirk have 206 * Revision <= 13 of all triggering devices id in this quirk
207 * a problem draining interrupts when irq remapping is enabled, 207 * have a problem draining interrupts when irq remapping is
208 * and should be flagged as broken. Additionally revisions 0x12 208 * enabled, and should be flagged as broken. Additionally
209 * and 0x22 of device id 0x3405 has this problem. 209 * revision 0x22 of device id 0x3405 has this problem.
210 */ 210 */
211 if (revision == 0x13) 211 if (revision <= 0x13)
212 set_irq_remapping_broken(); 212 set_irq_remapping_broken();
213 else if ((device == 0x3405) && 213 else if (device == 0x3405 && revision == 0x22)
214 ((revision == 0x12) ||
215 (revision == 0x22)))
216 set_irq_remapping_broken(); 214 set_irq_remapping_broken();
217
218} 215}
219 216
220/* 217/*
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index da85a8e830a1..014618dbaa7b 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -521,7 +521,7 @@ static int hpet_setup_irq(struct hpet_dev *dev)
521{ 521{
522 522
523 if (request_irq(dev->irq, hpet_interrupt_handler, 523 if (request_irq(dev->irq, hpet_interrupt_handler,
524 IRQF_TIMER | IRQF_DISABLED | IRQF_NOBALANCING, 524 IRQF_TIMER | IRQF_NOBALANCING,
525 dev->name, dev)) 525 dev->name, dev))
526 return -1; 526 return -1;
527 527
@@ -699,7 +699,7 @@ static int hpet_cpuhp_notify(struct notifier_block *n,
699 /* FIXME: add schedule_work_on() */ 699 /* FIXME: add schedule_work_on() */
700 schedule_delayed_work_on(cpu, &work.work, 0); 700 schedule_delayed_work_on(cpu, &work.work, 0);
701 wait_for_completion(&work.complete); 701 wait_for_completion(&work.complete);
702 destroy_timer_on_stack(&work.work.timer); 702 destroy_delayed_work_on_stack(&work.work);
703 break; 703 break;
704 case CPU_DEAD: 704 case CPU_DEAD:
705 if (hdev) { 705 if (hdev) {
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index d99f31d9a750..42805fac0092 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -125,6 +125,12 @@ int arch_show_interrupts(struct seq_file *p, int prec)
125 seq_printf(p, "%10u ", per_cpu(mce_poll_count, j)); 125 seq_printf(p, "%10u ", per_cpu(mce_poll_count, j));
126 seq_printf(p, " Machine check polls\n"); 126 seq_printf(p, " Machine check polls\n");
127#endif 127#endif
128#if defined(CONFIG_HYPERV) || defined(CONFIG_XEN)
129 seq_printf(p, "%*s: ", prec, "THR");
130 for_each_online_cpu(j)
131 seq_printf(p, "%10u ", irq_stats(j)->irq_hv_callback_count);
132 seq_printf(p, " Hypervisor callback interrupts\n");
133#endif
128 seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(&irq_err_count)); 134 seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(&irq_err_count));
129#if defined(CONFIG_X86_IO_APIC) 135#if defined(CONFIG_X86_IO_APIC)
130 seq_printf(p, "%*s: %10u\n", prec, "MIS", atomic_read(&irq_mis_count)); 136 seq_printf(p, "%*s: %10u\n", prec, "MIS", atomic_read(&irq_mis_count));
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index d7fcbedc9c43..63ce838e5a54 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -55,16 +55,8 @@ static inline int check_stack_overflow(void) { return 0; }
55static inline void print_stack_overflow(void) { } 55static inline void print_stack_overflow(void) { }
56#endif 56#endif
57 57
58/* 58DEFINE_PER_CPU(struct irq_stack *, hardirq_stack);
59 * per-CPU IRQ handling contexts (thread information and stack) 59DEFINE_PER_CPU(struct irq_stack *, softirq_stack);
60 */
61union irq_ctx {
62 struct thread_info tinfo;
63 u32 stack[THREAD_SIZE/sizeof(u32)];
64} __attribute__((aligned(THREAD_SIZE)));
65
66static DEFINE_PER_CPU(union irq_ctx *, hardirq_ctx);
67static DEFINE_PER_CPU(union irq_ctx *, softirq_ctx);
68 60
69static void call_on_stack(void *func, void *stack) 61static void call_on_stack(void *func, void *stack)
70{ 62{
@@ -77,14 +69,26 @@ static void call_on_stack(void *func, void *stack)
77 : "memory", "cc", "edx", "ecx", "eax"); 69 : "memory", "cc", "edx", "ecx", "eax");
78} 70}
79 71
72/* how to get the current stack pointer from C */
73#define current_stack_pointer ({ \
74 unsigned long sp; \
75 asm("mov %%esp,%0" : "=g" (sp)); \
76 sp; \
77})
78
79static inline void *current_stack(void)
80{
81 return (void *)(current_stack_pointer & ~(THREAD_SIZE - 1));
82}
83
80static inline int 84static inline int
81execute_on_irq_stack(int overflow, struct irq_desc *desc, int irq) 85execute_on_irq_stack(int overflow, struct irq_desc *desc, int irq)
82{ 86{
83 union irq_ctx *curctx, *irqctx; 87 struct irq_stack *curstk, *irqstk;
84 u32 *isp, arg1, arg2; 88 u32 *isp, *prev_esp, arg1, arg2;
85 89
86 curctx = (union irq_ctx *) current_thread_info(); 90 curstk = (struct irq_stack *) current_stack();
87 irqctx = __this_cpu_read(hardirq_ctx); 91 irqstk = __this_cpu_read(hardirq_stack);
88 92
89 /* 93 /*
90 * this is where we switch to the IRQ stack. However, if we are 94 * this is where we switch to the IRQ stack. However, if we are
@@ -92,13 +96,14 @@ execute_on_irq_stack(int overflow, struct irq_desc *desc, int irq)
92 * handler) we can't do that and just have to keep using the 96 * handler) we can't do that and just have to keep using the
93 * current stack (which is the irq stack already after all) 97 * current stack (which is the irq stack already after all)
94 */ 98 */
95 if (unlikely(curctx == irqctx)) 99 if (unlikely(curstk == irqstk))
96 return 0; 100 return 0;
97 101
98 /* build the stack frame on the IRQ stack */ 102 isp = (u32 *) ((char *)irqstk + sizeof(*irqstk));
99 isp = (u32 *) ((char *)irqctx + sizeof(*irqctx)); 103
100 irqctx->tinfo.task = curctx->tinfo.task; 104 /* Save the next esp at the bottom of the stack */
101 irqctx->tinfo.previous_esp = current_stack_pointer; 105 prev_esp = (u32 *)irqstk;
106 *prev_esp = current_stack_pointer;
102 107
103 if (unlikely(overflow)) 108 if (unlikely(overflow))
104 call_on_stack(print_stack_overflow, isp); 109 call_on_stack(print_stack_overflow, isp);
@@ -118,46 +123,40 @@ execute_on_irq_stack(int overflow, struct irq_desc *desc, int irq)
118 */ 123 */
119void irq_ctx_init(int cpu) 124void irq_ctx_init(int cpu)
120{ 125{
121 union irq_ctx *irqctx; 126 struct irq_stack *irqstk;
122 127
123 if (per_cpu(hardirq_ctx, cpu)) 128 if (per_cpu(hardirq_stack, cpu))
124 return; 129 return;
125 130
126 irqctx = page_address(alloc_pages_node(cpu_to_node(cpu), 131 irqstk = page_address(alloc_pages_node(cpu_to_node(cpu),
127 THREADINFO_GFP, 132 THREADINFO_GFP,
128 THREAD_SIZE_ORDER)); 133 THREAD_SIZE_ORDER));
129 memset(&irqctx->tinfo, 0, sizeof(struct thread_info)); 134 per_cpu(hardirq_stack, cpu) = irqstk;
130 irqctx->tinfo.cpu = cpu;
131 irqctx->tinfo.addr_limit = MAKE_MM_SEG(0);
132
133 per_cpu(hardirq_ctx, cpu) = irqctx;
134 135
135 irqctx = page_address(alloc_pages_node(cpu_to_node(cpu), 136 irqstk = page_address(alloc_pages_node(cpu_to_node(cpu),
136 THREADINFO_GFP, 137 THREADINFO_GFP,
137 THREAD_SIZE_ORDER)); 138 THREAD_SIZE_ORDER));
138 memset(&irqctx->tinfo, 0, sizeof(struct thread_info)); 139 per_cpu(softirq_stack, cpu) = irqstk;
139 irqctx->tinfo.cpu = cpu;
140 irqctx->tinfo.addr_limit = MAKE_MM_SEG(0);
141
142 per_cpu(softirq_ctx, cpu) = irqctx;
143 140
144 printk(KERN_DEBUG "CPU %u irqstacks, hard=%p soft=%p\n", 141 printk(KERN_DEBUG "CPU %u irqstacks, hard=%p soft=%p\n",
145 cpu, per_cpu(hardirq_ctx, cpu), per_cpu(softirq_ctx, cpu)); 142 cpu, per_cpu(hardirq_stack, cpu), per_cpu(softirq_stack, cpu));
146} 143}
147 144
148void do_softirq_own_stack(void) 145void do_softirq_own_stack(void)
149{ 146{
150 struct thread_info *curctx; 147 struct thread_info *curstk;
151 union irq_ctx *irqctx; 148 struct irq_stack *irqstk;
152 u32 *isp; 149 u32 *isp, *prev_esp;
153 150
154 curctx = current_thread_info(); 151 curstk = current_stack();
155 irqctx = __this_cpu_read(softirq_ctx); 152 irqstk = __this_cpu_read(softirq_stack);
156 irqctx->tinfo.task = curctx->task;
157 irqctx->tinfo.previous_esp = current_stack_pointer;
158 153
159 /* build the stack frame on the softirq stack */ 154 /* build the stack frame on the softirq stack */
160 isp = (u32 *) ((char *)irqctx + sizeof(*irqctx)); 155 isp = (u32 *) ((char *)irqstk + sizeof(*irqstk));
156
157 /* Push the previous esp onto the stack */
158 prev_esp = (u32 *)irqstk;
159 *prev_esp = current_stack_pointer;
161 160
162 call_on_stack(__do_softirq, isp); 161 call_on_stack(__do_softirq, isp);
163} 162}
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 0de43e98ce08..7bc86bbe7485 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -314,6 +314,10 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
314 */ 314 */
315 arch_end_context_switch(next_p); 315 arch_end_context_switch(next_p);
316 316
317 this_cpu_write(kernel_stack,
318 (unsigned long)task_stack_page(next_p) +
319 THREAD_SIZE - KERNEL_STACK_OFFSET);
320
317 /* 321 /*
318 * Restore %gs if needed (which is common) 322 * Restore %gs if needed (which is common)
319 */ 323 */
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 7461f50d5bb1..678c0ada3b3c 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -184,14 +184,14 @@ unsigned long kernel_stack_pointer(struct pt_regs *regs)
184{ 184{
185 unsigned long context = (unsigned long)regs & ~(THREAD_SIZE - 1); 185 unsigned long context = (unsigned long)regs & ~(THREAD_SIZE - 1);
186 unsigned long sp = (unsigned long)&regs->sp; 186 unsigned long sp = (unsigned long)&regs->sp;
187 struct thread_info *tinfo; 187 u32 *prev_esp;
188 188
189 if (context == (sp & ~(THREAD_SIZE - 1))) 189 if (context == (sp & ~(THREAD_SIZE - 1)))
190 return sp; 190 return sp;
191 191
192 tinfo = (struct thread_info *)context; 192 prev_esp = (u32 *)(context);
193 if (tinfo->previous_esp) 193 if (prev_esp)
194 return tinfo->previous_esp; 194 return (unsigned long)prev_esp;
195 195
196 return (unsigned long)regs; 196 return (unsigned long)regs;
197} 197}
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index c752cb43e52f..654b46574b91 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -464,9 +464,12 @@ void __attribute__((weak)) mach_reboot_fixups(void)
464 * 2) If still alive, write to the keyboard controller 464 * 2) If still alive, write to the keyboard controller
465 * 3) If still alive, write to the ACPI reboot register again 465 * 3) If still alive, write to the ACPI reboot register again
466 * 4) If still alive, write to the keyboard controller again 466 * 4) If still alive, write to the keyboard controller again
467 * 5) If still alive, call the EFI runtime service to reboot
468 * 6) If still alive, write to the PCI IO port 0xCF9 to reboot
469 * 7) If still alive, inform BIOS to do a proper reboot
467 * 470 *
468 * If the machine is still alive at this stage, it gives up. We default to 471 * If the machine is still alive at this stage, it gives up. We default to
469 * following the same pattern, except that if we're still alive after (4) we'll 472 * following the same pattern, except that if we're still alive after (7) we'll
470 * try to force a triple fault and then cycle between hitting the keyboard 473 * try to force a triple fault and then cycle between hitting the keyboard
471 * controller and doing that 474 * controller and doing that
472 */ 475 */
@@ -502,7 +505,7 @@ static void native_machine_emergency_restart(void)
502 attempt = 1; 505 attempt = 1;
503 reboot_type = BOOT_ACPI; 506 reboot_type = BOOT_ACPI;
504 } else { 507 } else {
505 reboot_type = BOOT_TRIPLE; 508 reboot_type = BOOT_EFI;
506 } 509 }
507 break; 510 break;
508 511
@@ -510,13 +513,15 @@ static void native_machine_emergency_restart(void)
510 load_idt(&no_idt); 513 load_idt(&no_idt);
511 __asm__ __volatile__("int3"); 514 __asm__ __volatile__("int3");
512 515
516 /* We're probably dead after this, but... */
513 reboot_type = BOOT_KBD; 517 reboot_type = BOOT_KBD;
514 break; 518 break;
515 519
516 case BOOT_BIOS: 520 case BOOT_BIOS:
517 machine_real_restart(MRR_BIOS); 521 machine_real_restart(MRR_BIOS);
518 522
519 reboot_type = BOOT_KBD; 523 /* We're probably dead after this, but... */
524 reboot_type = BOOT_TRIPLE;
520 break; 525 break;
521 526
522 case BOOT_ACPI: 527 case BOOT_ACPI:
@@ -530,7 +535,7 @@ static void native_machine_emergency_restart(void)
530 EFI_RESET_WARM : 535 EFI_RESET_WARM :
531 EFI_RESET_COLD, 536 EFI_RESET_COLD,
532 EFI_SUCCESS, 0, NULL); 537 EFI_SUCCESS, 0, NULL);
533 reboot_type = BOOT_KBD; 538 reboot_type = BOOT_CF9_COND;
534 break; 539 break;
535 540
536 case BOOT_CF9: 541 case BOOT_CF9:
@@ -548,7 +553,7 @@ static void native_machine_emergency_restart(void)
548 outb(cf9|reboot_code, 0xcf9); 553 outb(cf9|reboot_code, 0xcf9);
549 udelay(50); 554 udelay(50);
550 } 555 }
551 reboot_type = BOOT_KBD; 556 reboot_type = BOOT_BIOS;
552 break; 557 break;
553 } 558 }
554 } 559 }
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 60179ec39d4c..34826934d4a7 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -766,10 +766,10 @@ static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
766#else 766#else
767 clear_tsk_thread_flag(idle, TIF_FORK); 767 clear_tsk_thread_flag(idle, TIF_FORK);
768 initial_gs = per_cpu_offset(cpu); 768 initial_gs = per_cpu_offset(cpu);
769#endif
769 per_cpu(kernel_stack, cpu) = 770 per_cpu(kernel_stack, cpu) =
770 (unsigned long)task_stack_page(idle) - 771 (unsigned long)task_stack_page(idle) -
771 KERNEL_STACK_OFFSET + THREAD_SIZE; 772 KERNEL_STACK_OFFSET + THREAD_SIZE;
772#endif
773 early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu); 773 early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu);
774 initial_code = (unsigned long)start_secondary; 774 initial_code = (unsigned long)start_secondary;
775 stack_start = idle->thread.sp; 775 stack_start = idle->thread.sp;
@@ -1387,7 +1387,7 @@ static inline void mwait_play_dead(void)
1387 1387
1388 if (!this_cpu_has(X86_FEATURE_MWAIT)) 1388 if (!this_cpu_has(X86_FEATURE_MWAIT))
1389 return; 1389 return;
1390 if (!this_cpu_has(X86_FEATURE_CLFLSH)) 1390 if (!this_cpu_has(X86_FEATURE_CLFLUSH))
1391 return; 1391 return;
1392 if (__this_cpu_read(cpu_info.cpuid_level) < CPUID_MWAIT_LEAF) 1392 if (__this_cpu_read(cpu_info.cpuid_level) < CPUID_MWAIT_LEAF)
1393 return; 1393 return;
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
index 6ec91c00d84d..bf7ef5ce29df 100644
--- a/arch/x86/kernel/time.c
+++ b/arch/x86/kernel/time.c
@@ -62,7 +62,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
62 62
63static struct irqaction irq0 = { 63static struct irqaction irq0 = {
64 .handler = timer_interrupt, 64 .handler = timer_interrupt,
65 .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER, 65 .flags = IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER,
66 .name = "timer" 66 .name = "timer"
67}; 67};
68 68
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index c6976257eff5..e5503d8aec1d 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -263,7 +263,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
263 F(TSC) | F(MSR) | F(PAE) | F(MCE) | 263 F(TSC) | F(MSR) | F(PAE) | F(MCE) |
264 F(CX8) | F(APIC) | 0 /* Reserved */ | F(SEP) | 264 F(CX8) | F(APIC) | 0 /* Reserved */ | F(SEP) |
265 F(MTRR) | F(PGE) | F(MCA) | F(CMOV) | 265 F(MTRR) | F(PGE) | F(MCA) | F(CMOV) |
266 F(PAT) | F(PSE36) | 0 /* PSN */ | F(CLFLSH) | 266 F(PAT) | F(PSE36) | 0 /* PSN */ | F(CLFLUSH) |
267 0 /* Reserved, DS, ACPI */ | F(MMX) | 267 0 /* Reserved, DS, ACPI */ | F(MMX) |
268 F(FXSR) | F(XMM) | F(XMM2) | F(SELFSNOOP) | 268 F(FXSR) | F(XMM) | F(XMM2) | F(SELFSNOOP) |
269 0 /* HTT, TM, Reserved, PBE */; 269 0 /* HTT, TM, Reserved, PBE */;
diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c
index 1953e9c9391a..66338a60aa6e 100644
--- a/arch/x86/mm/srat.c
+++ b/arch/x86/mm/srat.c
@@ -52,12 +52,18 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
52 int i, j; 52 int i, j;
53 53
54 for (i = 0; i < slit->locality_count; i++) { 54 for (i = 0; i < slit->locality_count; i++) {
55 if (pxm_to_node(i) == NUMA_NO_NODE) 55 const int from_node = pxm_to_node(i);
56
57 if (from_node == NUMA_NO_NODE)
56 continue; 58 continue;
59
57 for (j = 0; j < slit->locality_count; j++) { 60 for (j = 0; j < slit->locality_count; j++) {
58 if (pxm_to_node(j) == NUMA_NO_NODE) 61 const int to_node = pxm_to_node(j);
62
63 if (to_node == NUMA_NO_NODE)
59 continue; 64 continue;
60 numa_set_distance(pxm_to_node(i), pxm_to_node(j), 65
66 numa_set_distance(from_node, to_node,
61 slit->entry[slit->locality_count * i + j]); 67 slit->entry[slit->locality_count * i + j]);
62 } 68 }
63 } 69 }
diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index 581521c843a5..4d3acc34a998 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -183,7 +183,7 @@ __visible void xen_lock_spinning(struct arch_spinlock *lock, __ticket_t want)
183 183
184 local_irq_save(flags); 184 local_irq_save(flags);
185 185
186 kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq)); 186 kstat_incr_irq_this_cpu(irq);
187out: 187out:
188 cpumask_clear_cpu(cpu, &waiting_cpus); 188 cpumask_clear_cpu(cpu, &waiting_cpus);
189 w->lock = NULL; 189 w->lock = NULL;
diff --git a/arch/xtensa/kernel/irq.c b/arch/xtensa/kernel/irq.c
index 482868a2de6e..3eee94f621eb 100644
--- a/arch/xtensa/kernel/irq.c
+++ b/arch/xtensa/kernel/irq.c
@@ -155,18 +155,6 @@ void __init init_IRQ(void)
155} 155}
156 156
157#ifdef CONFIG_HOTPLUG_CPU 157#ifdef CONFIG_HOTPLUG_CPU
158static void route_irq(struct irq_data *data, unsigned int irq, unsigned int cpu)
159{
160 struct irq_desc *desc = irq_to_desc(irq);
161 struct irq_chip *chip = irq_data_get_irq_chip(data);
162 unsigned long flags;
163
164 raw_spin_lock_irqsave(&desc->lock, flags);
165 if (chip->irq_set_affinity)
166 chip->irq_set_affinity(data, cpumask_of(cpu), false);
167 raw_spin_unlock_irqrestore(&desc->lock, flags);
168}
169
170/* 158/*
171 * The CPU has been marked offline. Migrate IRQs off this CPU. If 159 * The CPU has been marked offline. Migrate IRQs off this CPU. If
172 * the affinity settings do not allow other CPUs, force them onto any 160 * the affinity settings do not allow other CPUs, force them onto any
@@ -175,10 +163,9 @@ static void route_irq(struct irq_data *data, unsigned int irq, unsigned int cpu)
175void migrate_irqs(void) 163void migrate_irqs(void)
176{ 164{
177 unsigned int i, cpu = smp_processor_id(); 165 unsigned int i, cpu = smp_processor_id();
178 struct irq_desc *desc;
179 166
180 for_each_irq_desc(i, desc) { 167 for_each_active_irq(i) {
181 struct irq_data *data = irq_desc_get_irq_data(desc); 168 struct irq_data *data = irq_get_irq_data(i);
182 unsigned int newcpu; 169 unsigned int newcpu;
183 170
184 if (irqd_is_per_cpu(data)) 171 if (irqd_is_per_cpu(data))
@@ -194,11 +181,8 @@ void migrate_irqs(void)
194 i, cpu); 181 i, cpu);
195 182
196 cpumask_setall(data->affinity); 183 cpumask_setall(data->affinity);
197 newcpu = cpumask_any_and(data->affinity,
198 cpu_online_mask);
199 } 184 }
200 185 irq_set_affinity(i, data->affinity);
201 route_irq(data, i, newcpu);
202 } 186 }
203} 187}
204#endif /* CONFIG_HOTPLUG_CPU */ 188#endif /* CONFIG_HOTPLUG_CPU */
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 868429a47be4..20e03a7eb8b4 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -11,13 +11,13 @@ config HAVE_PATA_PLATFORM
11 to update the PATA_PLATFORM entry. 11 to update the PATA_PLATFORM entry.
12 12
13menuconfig ATA 13menuconfig ATA
14 tristate "Serial ATA and Parallel ATA drivers" 14 tristate "Serial ATA and Parallel ATA drivers (libata)"
15 depends on HAS_IOMEM 15 depends on HAS_IOMEM
16 depends on BLOCK 16 depends on BLOCK
17 depends on !(M32R || M68K || S390) || BROKEN 17 depends on !(M32R || M68K || S390) || BROKEN
18 select SCSI 18 select SCSI
19 ---help--- 19 ---help---
20 If you want to use a ATA hard disk, ATA tape drive, ATA CD-ROM or 20 If you want to use an ATA hard disk, ATA tape drive, ATA CD-ROM or
21 any other ATA device under Linux, say Y and make sure that you know 21 any other ATA device under Linux, say Y and make sure that you know
22 the name of your ATA host adapter (the card inside your computer 22 the name of your ATA host adapter (the card inside your computer
23 that "speaks" the ATA protocol, also called ATA controller), 23 that "speaks" the ATA protocol, also called ATA controller),
@@ -60,7 +60,7 @@ config ATA_ACPI
60 60
61config SATA_ZPODD 61config SATA_ZPODD
62 bool "SATA Zero Power Optical Disc Drive (ZPODD) support" 62 bool "SATA Zero Power Optical Disc Drive (ZPODD) support"
63 depends on ATA_ACPI 63 depends on ATA_ACPI && PM_RUNTIME
64 default n 64 default n
65 help 65 help
66 This option adds support for SATA Zero Power Optical Disc 66 This option adds support for SATA Zero Power Optical Disc
@@ -97,15 +97,48 @@ config SATA_AHCI_PLATFORM
97 97
98 If unsure, say N. 98 If unsure, say N.
99 99
100config AHCI_DA850
101 tristate "DaVinci DA850 AHCI SATA support"
102 depends on ARCH_DAVINCI_DA850
103 help
104 This option enables support for the DaVinci DA850 SoC's
105 onboard AHCI SATA.
106
107 If unsure, say N.
108
109config AHCI_ST
110 tristate "ST AHCI SATA support"
111 depends on ARCH_STI
112 help
113 This option enables support for ST AHCI SATA controller.
114
115 If unsure, say N.
116
100config AHCI_IMX 117config AHCI_IMX
101 tristate "Freescale i.MX AHCI SATA support" 118 tristate "Freescale i.MX AHCI SATA support"
102 depends on SATA_AHCI_PLATFORM && MFD_SYSCON 119 depends on MFD_SYSCON
103 help 120 help
104 This option enables support for the Freescale i.MX SoC's 121 This option enables support for the Freescale i.MX SoC's
105 onboard AHCI SATA. 122 onboard AHCI SATA.
106 123
107 If unsure, say N. 124 If unsure, say N.
108 125
126config AHCI_SUNXI
127 tristate "Allwinner sunxi AHCI SATA support"
128 depends on ARCH_SUNXI
129 help
130 This option enables support for the Allwinner sunxi SoC's
131 onboard AHCI SATA.
132
133 If unsure, say N.
134
135config AHCI_XGENE
136 tristate "APM X-Gene 6.0Gbps AHCI SATA host controller support"
137 depends on ARM64 || COMPILE_TEST
138 select PHY_XGENE
139 help
140 This option enables support for APM X-Gene SoC SATA host controller.
141
109config SATA_FSL 142config SATA_FSL
110 tristate "Freescale 3.0Gbps SATA support" 143 tristate "Freescale 3.0Gbps SATA support"
111 depends on FSL_SOC 144 depends on FSL_SOC
@@ -239,6 +272,7 @@ config SATA_DWC_VDEBUG
239 272
240config SATA_HIGHBANK 273config SATA_HIGHBANK
241 tristate "Calxeda Highbank SATA support" 274 tristate "Calxeda Highbank SATA support"
275 depends on ARCH_HIGHBANK || COMPILE_TEST
242 help 276 help
243 This option enables support for the Calxeda Highbank SoC's 277 This option enables support for the Calxeda Highbank SoC's
244 onboard SATA. 278 onboard SATA.
@@ -247,6 +281,8 @@ config SATA_HIGHBANK
247 281
248config SATA_MV 282config SATA_MV
249 tristate "Marvell SATA support" 283 tristate "Marvell SATA support"
284 depends on PCI || ARCH_DOVE || ARCH_KIRKWOOD || ARCH_MV78XX0 || \
285 ARCH_MVEBU || ARCH_ORION5X || COMPILE_TEST
250 select GENERIC_PHY 286 select GENERIC_PHY
251 help 287 help
252 This option enables support for the Marvell Serial ATA family. 288 This option enables support for the Marvell Serial ATA family.
@@ -273,6 +309,7 @@ config SATA_PROMISE
273 309
274config SATA_RCAR 310config SATA_RCAR
275 tristate "Renesas R-Car SATA support" 311 tristate "Renesas R-Car SATA support"
312 depends on ARCH_SHMOBILE || COMPILE_TEST
276 help 313 help
277 This option enables support for Renesas R-Car Serial ATA. 314 This option enables support for Renesas R-Car Serial ATA.
278 315
@@ -352,6 +389,7 @@ config PATA_AMD
352 389
353config PATA_ARASAN_CF 390config PATA_ARASAN_CF
354 tristate "ARASAN CompactFlash PATA Controller Support" 391 tristate "ARASAN CompactFlash PATA Controller Support"
392 depends on ARCH_SPEAR13XX || COMPILE_TEST
355 depends on DMADEVICES 393 depends on DMADEVICES
356 select DMA_ENGINE 394 select DMA_ENGINE
357 help 395 help
@@ -403,7 +441,7 @@ config PATA_CMD64X
403 441
404config PATA_CS5520 442config PATA_CS5520
405 tristate "CS5510/5520 PATA support" 443 tristate "CS5510/5520 PATA support"
406 depends on PCI 444 depends on PCI && (X86_32 || COMPILE_TEST)
407 help 445 help
408 This option enables support for the Cyrix 5510/5520 446 This option enables support for the Cyrix 5510/5520
409 companion chip used with the MediaGX/Geode processor family. 447 companion chip used with the MediaGX/Geode processor family.
@@ -412,7 +450,7 @@ config PATA_CS5520
412 450
413config PATA_CS5530 451config PATA_CS5530
414 tristate "CS5530 PATA support" 452 tristate "CS5530 PATA support"
415 depends on PCI 453 depends on PCI && (X86_32 || COMPILE_TEST)
416 help 454 help
417 This option enables support for the Cyrix/NatSemi/AMD CS5530 455 This option enables support for the Cyrix/NatSemi/AMD CS5530
418 companion chip used with the MediaGX/Geode processor family. 456 companion chip used with the MediaGX/Geode processor family.
@@ -421,7 +459,7 @@ config PATA_CS5530
421 459
422config PATA_CS5535 460config PATA_CS5535
423 tristate "CS5535 PATA support (Experimental)" 461 tristate "CS5535 PATA support (Experimental)"
424 depends on PCI && X86 && !X86_64 462 depends on PCI && X86_32
425 help 463 help
426 This option enables support for the NatSemi/AMD CS5535 464 This option enables support for the NatSemi/AMD CS5535
427 companion chip used with the Geode processor family. 465 companion chip used with the Geode processor family.
@@ -430,7 +468,7 @@ config PATA_CS5535
430 468
431config PATA_CS5536 469config PATA_CS5536
432 tristate "CS5536 PATA support" 470 tristate "CS5536 PATA support"
433 depends on PCI 471 depends on PCI && (X86_32 || MIPS || COMPILE_TEST)
434 help 472 help
435 This option enables support for the AMD CS5536 473 This option enables support for the AMD CS5536
436 companion chip used with the Geode LX processor family. 474 companion chip used with the Geode LX processor family.
@@ -666,7 +704,7 @@ config PATA_RDC
666 704
667config PATA_SC1200 705config PATA_SC1200
668 tristate "SC1200 PATA support" 706 tristate "SC1200 PATA support"
669 depends on PCI 707 depends on PCI && (X86_32 || COMPILE_TEST)
670 help 708 help
671 This option enables support for the NatSemi/AMD SC1200 SoC 709 This option enables support for the NatSemi/AMD SC1200 SoC
672 companion chip used with the Geode processor family. 710 companion chip used with the Geode processor family.
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index 46518c622460..44c8016e565c 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -4,13 +4,17 @@ obj-$(CONFIG_ATA) += libata.o
4# non-SFF interface 4# non-SFF interface
5obj-$(CONFIG_SATA_AHCI) += ahci.o libahci.o 5obj-$(CONFIG_SATA_AHCI) += ahci.o libahci.o
6obj-$(CONFIG_SATA_ACARD_AHCI) += acard-ahci.o libahci.o 6obj-$(CONFIG_SATA_ACARD_AHCI) += acard-ahci.o libahci.o
7obj-$(CONFIG_SATA_AHCI_PLATFORM) += ahci_platform.o libahci.o 7obj-$(CONFIG_SATA_AHCI_PLATFORM) += ahci_platform.o libahci.o libahci_platform.o
8obj-$(CONFIG_SATA_FSL) += sata_fsl.o 8obj-$(CONFIG_SATA_FSL) += sata_fsl.o
9obj-$(CONFIG_SATA_INIC162X) += sata_inic162x.o 9obj-$(CONFIG_SATA_INIC162X) += sata_inic162x.o
10obj-$(CONFIG_SATA_SIL24) += sata_sil24.o 10obj-$(CONFIG_SATA_SIL24) += sata_sil24.o
11obj-$(CONFIG_SATA_DWC) += sata_dwc_460ex.o 11obj-$(CONFIG_SATA_DWC) += sata_dwc_460ex.o
12obj-$(CONFIG_SATA_HIGHBANK) += sata_highbank.o libahci.o 12obj-$(CONFIG_SATA_HIGHBANK) += sata_highbank.o libahci.o
13obj-$(CONFIG_AHCI_IMX) += ahci_imx.o 13obj-$(CONFIG_AHCI_DA850) += ahci_da850.o libahci.o libahci_platform.o
14obj-$(CONFIG_AHCI_IMX) += ahci_imx.o libahci.o libahci_platform.o
15obj-$(CONFIG_AHCI_SUNXI) += ahci_sunxi.o libahci.o libahci_platform.o
16obj-$(CONFIG_AHCI_ST) += ahci_st.o libahci.o libahci_platform.o
17obj-$(CONFIG_AHCI_XGENE) += ahci_xgene.o libahci.o libahci_platform.o
14 18
15# SFF w/ custom DMA 19# SFF w/ custom DMA
16obj-$(CONFIG_PDC_ADMA) += pdc_adma.o 20obj-$(CONFIG_PDC_ADMA) += pdc_adma.o
diff --git a/drivers/ata/acard-ahci.c b/drivers/ata/acard-ahci.c
index fd665d919df2..b51605ac5974 100644
--- a/drivers/ata/acard-ahci.c
+++ b/drivers/ata/acard-ahci.c
@@ -36,7 +36,6 @@
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <linux/module.h> 37#include <linux/module.h>
38#include <linux/pci.h> 38#include <linux/pci.h>
39#include <linux/init.h>
40#include <linux/blkdev.h> 39#include <linux/blkdev.h>
41#include <linux/delay.h> 40#include <linux/delay.h>
42#include <linux/interrupt.h> 41#include <linux/interrupt.h>
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index c81d809c111b..a52a5b662f35 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -35,7 +35,6 @@
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/module.h> 36#include <linux/module.h>
37#include <linux/pci.h> 37#include <linux/pci.h>
38#include <linux/init.h>
39#include <linux/blkdev.h> 38#include <linux/blkdev.h>
40#include <linux/delay.h> 39#include <linux/delay.h>
41#include <linux/interrupt.h> 40#include <linux/interrupt.h>
@@ -578,6 +577,7 @@ static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
578 unsigned long deadline) 577 unsigned long deadline)
579{ 578{
580 struct ata_port *ap = link->ap; 579 struct ata_port *ap = link->ap;
580 struct ahci_host_priv *hpriv = ap->host->private_data;
581 bool online; 581 bool online;
582 int rc; 582 int rc;
583 583
@@ -588,7 +588,7 @@ static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
588 rc = sata_link_hardreset(link, sata_ehc_deb_timing(&link->eh_context), 588 rc = sata_link_hardreset(link, sata_ehc_deb_timing(&link->eh_context),
589 deadline, &online, NULL); 589 deadline, &online, NULL);
590 590
591 ahci_start_engine(ap); 591 hpriv->start_engine(ap);
592 592
593 DPRINTK("EXIT, rc=%d, class=%u\n", rc, *class); 593 DPRINTK("EXIT, rc=%d, class=%u\n", rc, *class);
594 594
@@ -603,6 +603,7 @@ static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,
603{ 603{
604 struct ata_port *ap = link->ap; 604 struct ata_port *ap = link->ap;
605 struct ahci_port_priv *pp = ap->private_data; 605 struct ahci_port_priv *pp = ap->private_data;
606 struct ahci_host_priv *hpriv = ap->host->private_data;
606 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; 607 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
607 struct ata_taskfile tf; 608 struct ata_taskfile tf;
608 bool online; 609 bool online;
@@ -618,7 +619,7 @@ static int ahci_p5wdh_hardreset(struct ata_link *link, unsigned int *class,
618 rc = sata_link_hardreset(link, sata_ehc_deb_timing(&link->eh_context), 619 rc = sata_link_hardreset(link, sata_ehc_deb_timing(&link->eh_context),
619 deadline, &online, NULL); 620 deadline, &online, NULL);
620 621
621 ahci_start_engine(ap); 622 hpriv->start_engine(ap);
622 623
623 /* The pseudo configuration device on SIMG4726 attached to 624 /* The pseudo configuration device on SIMG4726 attached to
624 * ASUS P5W-DH Deluxe doesn't send signature FIS after 625 * ASUS P5W-DH Deluxe doesn't send signature FIS after
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 2289efdf8203..51af275b3388 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -37,6 +37,8 @@
37 37
38#include <linux/clk.h> 38#include <linux/clk.h>
39#include <linux/libata.h> 39#include <linux/libata.h>
40#include <linux/phy/phy.h>
41#include <linux/regulator/consumer.h>
40 42
41/* Enclosure Management Control */ 43/* Enclosure Management Control */
42#define EM_CTRL_MSG_TYPE 0x000f0000 44#define EM_CTRL_MSG_TYPE 0x000f0000
@@ -51,6 +53,7 @@
51 53
52enum { 54enum {
53 AHCI_MAX_PORTS = 32, 55 AHCI_MAX_PORTS = 32,
56 AHCI_MAX_CLKS = 3,
54 AHCI_MAX_SG = 168, /* hardware max is 64K */ 57 AHCI_MAX_SG = 168, /* hardware max is 64K */
55 AHCI_DMA_BOUNDARY = 0xffffffff, 58 AHCI_DMA_BOUNDARY = 0xffffffff,
56 AHCI_MAX_CMDS = 32, 59 AHCI_MAX_CMDS = 32,
@@ -321,8 +324,17 @@ struct ahci_host_priv {
321 u32 em_loc; /* enclosure management location */ 324 u32 em_loc; /* enclosure management location */
322 u32 em_buf_sz; /* EM buffer size in byte */ 325 u32 em_buf_sz; /* EM buffer size in byte */
323 u32 em_msg_type; /* EM message type */ 326 u32 em_msg_type; /* EM message type */
324 struct clk *clk; /* Only for platforms supporting clk */ 327 bool got_runtime_pm; /* Did we do pm_runtime_get? */
328 struct clk *clks[AHCI_MAX_CLKS]; /* Optional */
329 struct regulator *target_pwr; /* Optional */
330 struct phy *phy; /* If platform uses phy */
325 void *plat_data; /* Other platform data */ 331 void *plat_data; /* Other platform data */
332 /*
333 * Optional ahci_start_engine override, if not set this gets set to the
334 * default ahci_start_engine during ahci_save_initial_config, this can
335 * be overridden anytime before the host is activated.
336 */
337 void (*start_engine)(struct ata_port *ap);
326}; 338};
327 339
328extern int ahci_ignore_sss; 340extern int ahci_ignore_sss;
diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c
new file mode 100644
index 000000000000..2c83613ce2db
--- /dev/null
+++ b/drivers/ata/ahci_da850.c
@@ -0,0 +1,114 @@
1/*
2 * DaVinci DA850 AHCI SATA platform driver
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2, or (at your option)
7 * any later version.
8 */
9
10#include <linux/kernel.h>
11#include <linux/module.h>
12#include <linux/pm.h>
13#include <linux/device.h>
14#include <linux/platform_device.h>
15#include <linux/libata.h>
16#include <linux/ahci_platform.h>
17#include "ahci.h"
18
19/* SATA PHY Control Register offset from AHCI base */
20#define SATA_P0PHYCR_REG 0x178
21
22#define SATA_PHY_MPY(x) ((x) << 0)
23#define SATA_PHY_LOS(x) ((x) << 6)
24#define SATA_PHY_RXCDR(x) ((x) << 10)
25#define SATA_PHY_RXEQ(x) ((x) << 13)
26#define SATA_PHY_TXSWING(x) ((x) << 19)
27#define SATA_PHY_ENPLL(x) ((x) << 31)
28
29/*
30 * The multiplier needed for 1.5GHz PLL output.
31 *
32 * NOTE: This is currently hardcoded to be suitable for 100MHz crystal
33 * frequency (which is used by DA850 EVM board) and may need to be changed
34 * if you would like to use this driver on some other board.
35 */
36#define DA850_SATA_CLK_MULTIPLIER 7
37
38static void da850_sata_init(struct device *dev, void __iomem *pwrdn_reg,
39 void __iomem *ahci_base)
40{
41 unsigned int val;
42
43 /* Enable SATA clock receiver */
44 val = readl(pwrdn_reg);
45 val &= ~BIT(0);
46 writel(val, pwrdn_reg);
47
48 val = SATA_PHY_MPY(DA850_SATA_CLK_MULTIPLIER + 1) | SATA_PHY_LOS(1) |
49 SATA_PHY_RXCDR(4) | SATA_PHY_RXEQ(1) | SATA_PHY_TXSWING(3) |
50 SATA_PHY_ENPLL(1);
51
52 writel(val, ahci_base + SATA_P0PHYCR_REG);
53}
54
55static const struct ata_port_info ahci_da850_port_info = {
56 .flags = AHCI_FLAG_COMMON,
57 .pio_mask = ATA_PIO4,
58 .udma_mask = ATA_UDMA6,
59 .port_ops = &ahci_platform_ops,
60};
61
62static int ahci_da850_probe(struct platform_device *pdev)
63{
64 struct device *dev = &pdev->dev;
65 struct ahci_host_priv *hpriv;
66 struct resource *res;
67 void __iomem *pwrdn_reg;
68 int rc;
69
70 hpriv = ahci_platform_get_resources(pdev);
71 if (IS_ERR(hpriv))
72 return PTR_ERR(hpriv);
73
74 rc = ahci_platform_enable_resources(hpriv);
75 if (rc)
76 return rc;
77
78 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
79 if (!res)
80 goto disable_resources;
81
82 pwrdn_reg = devm_ioremap(dev, res->start, resource_size(res));
83 if (!pwrdn_reg)
84 goto disable_resources;
85
86 da850_sata_init(dev, pwrdn_reg, hpriv->mmio);
87
88 rc = ahci_platform_init_host(pdev, hpriv, &ahci_da850_port_info, 0, 0);
89 if (rc)
90 goto disable_resources;
91
92 return 0;
93disable_resources:
94 ahci_platform_disable_resources(hpriv);
95 return rc;
96}
97
98static SIMPLE_DEV_PM_OPS(ahci_da850_pm_ops, ahci_platform_suspend,
99 ahci_platform_resume);
100
101static struct platform_driver ahci_da850_driver = {
102 .probe = ahci_da850_probe,
103 .remove = ata_platform_remove_one,
104 .driver = {
105 .name = "ahci_da850",
106 .owner = THIS_MODULE,
107 .pm = &ahci_da850_pm_ops,
108 },
109};
110module_platform_driver(ahci_da850_driver);
111
112MODULE_DESCRIPTION("DaVinci DA850 AHCI SATA platform driver");
113MODULE_AUTHOR("Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>");
114MODULE_LICENSE("GPL");
diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c
index dd4d6f74d7bd..497c7abe1c7d 100644
--- a/drivers/ata/ahci_imx.c
+++ b/drivers/ata/ahci_imx.c
@@ -42,13 +42,7 @@ enum ahci_imx_type {
42struct imx_ahci_priv { 42struct imx_ahci_priv {
43 struct platform_device *ahci_pdev; 43 struct platform_device *ahci_pdev;
44 enum ahci_imx_type type; 44 enum ahci_imx_type type;
45
46 /* i.MX53 clock */
47 struct clk *sata_gate_clk;
48 /* Common clock */
49 struct clk *sata_ref_clk;
50 struct clk *ahb_clk; 45 struct clk *ahb_clk;
51
52 struct regmap *gpr; 46 struct regmap *gpr;
53 bool no_device; 47 bool no_device;
54 bool first_time; 48 bool first_time;
@@ -58,28 +52,52 @@ static int ahci_imx_hotplug;
58module_param_named(hotplug, ahci_imx_hotplug, int, 0644); 52module_param_named(hotplug, ahci_imx_hotplug, int, 0644);
59MODULE_PARM_DESC(hotplug, "AHCI IMX hot-plug support (0=Don't support, 1=support)"); 53MODULE_PARM_DESC(hotplug, "AHCI IMX hot-plug support (0=Don't support, 1=support)");
60 54
61static int imx_sata_clock_enable(struct device *dev) 55static void ahci_imx_host_stop(struct ata_host *host);
56
57static int imx_sata_enable(struct ahci_host_priv *hpriv)
62{ 58{
63 struct imx_ahci_priv *imxpriv = dev_get_drvdata(dev->parent); 59 struct imx_ahci_priv *imxpriv = hpriv->plat_data;
64 int ret; 60 int ret;
65 61
66 if (imxpriv->type == AHCI_IMX53) { 62 if (imxpriv->no_device)
67 ret = clk_prepare_enable(imxpriv->sata_gate_clk); 63 return 0;
68 if (ret < 0) { 64
69 dev_err(dev, "prepare-enable sata_gate clock err:%d\n", 65 if (hpriv->target_pwr) {
70 ret); 66 ret = regulator_enable(hpriv->target_pwr);
67 if (ret)
71 return ret; 68 return ret;
72 }
73 } 69 }
74 70
75 ret = clk_prepare_enable(imxpriv->sata_ref_clk); 71 ret = ahci_platform_enable_clks(hpriv);
76 if (ret < 0) { 72 if (ret < 0)
77 dev_err(dev, "prepare-enable sata_ref clock err:%d\n", 73 goto disable_regulator;
78 ret);
79 goto clk_err;
80 }
81 74
82 if (imxpriv->type == AHCI_IMX6Q) { 75 if (imxpriv->type == AHCI_IMX6Q) {
76 /*
77 * set PHY Paremeters, two steps to configure the GPR13,
78 * one write for rest of parameters, mask of first write
79 * is 0x07ffffff, and the other one write for setting
80 * the mpll_clk_en.
81 */
82 regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13,
83 IMX6Q_GPR13_SATA_RX_EQ_VAL_MASK |
84 IMX6Q_GPR13_SATA_RX_LOS_LVL_MASK |
85 IMX6Q_GPR13_SATA_RX_DPLL_MODE_MASK |
86 IMX6Q_GPR13_SATA_SPD_MODE_MASK |
87 IMX6Q_GPR13_SATA_MPLL_SS_EN |
88 IMX6Q_GPR13_SATA_TX_ATTEN_MASK |
89 IMX6Q_GPR13_SATA_TX_BOOST_MASK |
90 IMX6Q_GPR13_SATA_TX_LVL_MASK |
91 IMX6Q_GPR13_SATA_MPLL_CLK_EN |
92 IMX6Q_GPR13_SATA_TX_EDGE_RATE,
93 IMX6Q_GPR13_SATA_RX_EQ_VAL_3_0_DB |
94 IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2M |
95 IMX6Q_GPR13_SATA_RX_DPLL_MODE_2P_4F |
96 IMX6Q_GPR13_SATA_SPD_MODE_3P0G |
97 IMX6Q_GPR13_SATA_MPLL_SS_EN |
98 IMX6Q_GPR13_SATA_TX_ATTEN_9_16 |
99 IMX6Q_GPR13_SATA_TX_BOOST_3_33_DB |
100 IMX6Q_GPR13_SATA_TX_LVL_1_025_V);
83 regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13, 101 regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13,
84 IMX6Q_GPR13_SATA_MPLL_CLK_EN, 102 IMX6Q_GPR13_SATA_MPLL_CLK_EN,
85 IMX6Q_GPR13_SATA_MPLL_CLK_EN); 103 IMX6Q_GPR13_SATA_MPLL_CLK_EN);
@@ -89,15 +107,19 @@ static int imx_sata_clock_enable(struct device *dev)
89 107
90 return 0; 108 return 0;
91 109
92clk_err: 110disable_regulator:
93 if (imxpriv->type == AHCI_IMX53) 111 if (hpriv->target_pwr)
94 clk_disable_unprepare(imxpriv->sata_gate_clk); 112 regulator_disable(hpriv->target_pwr);
113
95 return ret; 114 return ret;
96} 115}
97 116
98static void imx_sata_clock_disable(struct device *dev) 117static void imx_sata_disable(struct ahci_host_priv *hpriv)
99{ 118{
100 struct imx_ahci_priv *imxpriv = dev_get_drvdata(dev->parent); 119 struct imx_ahci_priv *imxpriv = hpriv->plat_data;
120
121 if (imxpriv->no_device)
122 return;
101 123
102 if (imxpriv->type == AHCI_IMX6Q) { 124 if (imxpriv->type == AHCI_IMX6Q) {
103 regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13, 125 regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13,
@@ -105,10 +127,10 @@ static void imx_sata_clock_disable(struct device *dev)
105 !IMX6Q_GPR13_SATA_MPLL_CLK_EN); 127 !IMX6Q_GPR13_SATA_MPLL_CLK_EN);
106 } 128 }
107 129
108 clk_disable_unprepare(imxpriv->sata_ref_clk); 130 ahci_platform_disable_clks(hpriv);
109 131
110 if (imxpriv->type == AHCI_IMX53) 132 if (hpriv->target_pwr)
111 clk_disable_unprepare(imxpriv->sata_gate_clk); 133 regulator_disable(hpriv->target_pwr);
112} 134}
113 135
114static void ahci_imx_error_handler(struct ata_port *ap) 136static void ahci_imx_error_handler(struct ata_port *ap)
@@ -118,7 +140,7 @@ static void ahci_imx_error_handler(struct ata_port *ap)
118 struct ata_host *host = dev_get_drvdata(ap->dev); 140 struct ata_host *host = dev_get_drvdata(ap->dev);
119 struct ahci_host_priv *hpriv = host->private_data; 141 struct ahci_host_priv *hpriv = host->private_data;
120 void __iomem *mmio = hpriv->mmio; 142 void __iomem *mmio = hpriv->mmio;
121 struct imx_ahci_priv *imxpriv = dev_get_drvdata(ap->dev->parent); 143 struct imx_ahci_priv *imxpriv = hpriv->plat_data;
122 144
123 ahci_error_handler(ap); 145 ahci_error_handler(ap);
124 146
@@ -136,7 +158,7 @@ static void ahci_imx_error_handler(struct ata_port *ap)
136 */ 158 */
137 reg_val = readl(mmio + PORT_PHY_CTL); 159 reg_val = readl(mmio + PORT_PHY_CTL);
138 writel(reg_val | PORT_PHY_CTL_PDDQ_LOC, mmio + PORT_PHY_CTL); 160 writel(reg_val | PORT_PHY_CTL_PDDQ_LOC, mmio + PORT_PHY_CTL);
139 imx_sata_clock_disable(ap->dev); 161 imx_sata_disable(hpriv);
140 imxpriv->no_device = true; 162 imxpriv->no_device = true;
141} 163}
142 164
@@ -144,7 +166,9 @@ static int ahci_imx_softreset(struct ata_link *link, unsigned int *class,
144 unsigned long deadline) 166 unsigned long deadline)
145{ 167{
146 struct ata_port *ap = link->ap; 168 struct ata_port *ap = link->ap;
147 struct imx_ahci_priv *imxpriv = dev_get_drvdata(ap->dev->parent); 169 struct ata_host *host = dev_get_drvdata(ap->dev);
170 struct ahci_host_priv *hpriv = host->private_data;
171 struct imx_ahci_priv *imxpriv = hpriv->plat_data;
148 int ret = -EIO; 172 int ret = -EIO;
149 173
150 if (imxpriv->type == AHCI_IMX53) 174 if (imxpriv->type == AHCI_IMX53)
@@ -156,7 +180,8 @@ static int ahci_imx_softreset(struct ata_link *link, unsigned int *class,
156} 180}
157 181
158static struct ata_port_operations ahci_imx_ops = { 182static struct ata_port_operations ahci_imx_ops = {
159 .inherits = &ahci_platform_ops, 183 .inherits = &ahci_ops,
184 .host_stop = ahci_imx_host_stop,
160 .error_handler = ahci_imx_error_handler, 185 .error_handler = ahci_imx_error_handler,
161 .softreset = ahci_imx_softreset, 186 .softreset = ahci_imx_softreset,
162}; 187};
@@ -168,79 +193,6 @@ static const struct ata_port_info ahci_imx_port_info = {
168 .port_ops = &ahci_imx_ops, 193 .port_ops = &ahci_imx_ops,
169}; 194};
170 195
171static int imx_sata_init(struct device *dev, void __iomem *mmio)
172{
173 int ret = 0;
174 unsigned int reg_val;
175 struct imx_ahci_priv *imxpriv = dev_get_drvdata(dev->parent);
176
177 ret = imx_sata_clock_enable(dev);
178 if (ret < 0)
179 return ret;
180
181 /*
182 * Configure the HWINIT bits of the HOST_CAP and HOST_PORTS_IMPL,
183 * and IP vendor specific register HOST_TIMER1MS.
184 * Configure CAP_SSS (support stagered spin up).
185 * Implement the port0.
186 * Get the ahb clock rate, and configure the TIMER1MS register.
187 */
188 reg_val = readl(mmio + HOST_CAP);
189 if (!(reg_val & HOST_CAP_SSS)) {
190 reg_val |= HOST_CAP_SSS;
191 writel(reg_val, mmio + HOST_CAP);
192 }
193 reg_val = readl(mmio + HOST_PORTS_IMPL);
194 if (!(reg_val & 0x1)) {
195 reg_val |= 0x1;
196 writel(reg_val, mmio + HOST_PORTS_IMPL);
197 }
198
199 reg_val = clk_get_rate(imxpriv->ahb_clk) / 1000;
200 writel(reg_val, mmio + HOST_TIMER1MS);
201
202 return 0;
203}
204
205static void imx_sata_exit(struct device *dev)
206{
207 imx_sata_clock_disable(dev);
208}
209
210static int imx_ahci_suspend(struct device *dev)
211{
212 struct imx_ahci_priv *imxpriv = dev_get_drvdata(dev->parent);
213
214 /*
215 * If no_device is set, The CLKs had been gated off in the
216 * initialization so don't do it again here.
217 */
218 if (!imxpriv->no_device)
219 imx_sata_clock_disable(dev);
220
221 return 0;
222}
223
224static int imx_ahci_resume(struct device *dev)
225{
226 struct imx_ahci_priv *imxpriv = dev_get_drvdata(dev->parent);
227 int ret = 0;
228
229 if (!imxpriv->no_device)
230 ret = imx_sata_clock_enable(dev);
231
232 return ret;
233}
234
235static struct ahci_platform_data imx_sata_pdata = {
236 .init = imx_sata_init,
237 .exit = imx_sata_exit,
238 .ata_port_info = &ahci_imx_port_info,
239 .suspend = imx_ahci_suspend,
240 .resume = imx_ahci_resume,
241
242};
243
244static const struct of_device_id imx_ahci_of_match[] = { 196static const struct of_device_id imx_ahci_of_match[] = {
245 { .compatible = "fsl,imx53-ahci", .data = (void *)AHCI_IMX53 }, 197 { .compatible = "fsl,imx53-ahci", .data = (void *)AHCI_IMX53 },
246 { .compatible = "fsl,imx6q-ahci", .data = (void *)AHCI_IMX6Q }, 198 { .compatible = "fsl,imx6q-ahci", .data = (void *)AHCI_IMX6Q },
@@ -251,151 +203,124 @@ MODULE_DEVICE_TABLE(of, imx_ahci_of_match);
251static int imx_ahci_probe(struct platform_device *pdev) 203static int imx_ahci_probe(struct platform_device *pdev)
252{ 204{
253 struct device *dev = &pdev->dev; 205 struct device *dev = &pdev->dev;
254 struct resource *mem, *irq, res[2];
255 const struct of_device_id *of_id; 206 const struct of_device_id *of_id;
256 enum ahci_imx_type type; 207 struct ahci_host_priv *hpriv;
257 const struct ahci_platform_data *pdata = NULL;
258 struct imx_ahci_priv *imxpriv; 208 struct imx_ahci_priv *imxpriv;
259 struct device *ahci_dev; 209 unsigned int reg_val;
260 struct platform_device *ahci_pdev;
261 int ret; 210 int ret;
262 211
263 of_id = of_match_device(imx_ahci_of_match, dev); 212 of_id = of_match_device(imx_ahci_of_match, dev);
264 if (!of_id) 213 if (!of_id)
265 return -EINVAL; 214 return -EINVAL;
266 215
267 type = (enum ahci_imx_type)of_id->data;
268 pdata = &imx_sata_pdata;
269
270 imxpriv = devm_kzalloc(dev, sizeof(*imxpriv), GFP_KERNEL); 216 imxpriv = devm_kzalloc(dev, sizeof(*imxpriv), GFP_KERNEL);
271 if (!imxpriv) { 217 if (!imxpriv)
272 dev_err(dev, "can't alloc ahci_host_priv\n");
273 return -ENOMEM; 218 return -ENOMEM;
274 }
275
276 ahci_pdev = platform_device_alloc("ahci", -1);
277 if (!ahci_pdev)
278 return -ENODEV;
279
280 ahci_dev = &ahci_pdev->dev;
281 ahci_dev->parent = dev;
282 219
283 imxpriv->no_device = false; 220 imxpriv->no_device = false;
284 imxpriv->first_time = true; 221 imxpriv->first_time = true;
285 imxpriv->type = type; 222 imxpriv->type = (enum ahci_imx_type)of_id->data;
286
287 imxpriv->ahb_clk = devm_clk_get(dev, "ahb"); 223 imxpriv->ahb_clk = devm_clk_get(dev, "ahb");
288 if (IS_ERR(imxpriv->ahb_clk)) { 224 if (IS_ERR(imxpriv->ahb_clk)) {
289 dev_err(dev, "can't get ahb clock.\n"); 225 dev_err(dev, "can't get ahb clock.\n");
290 ret = PTR_ERR(imxpriv->ahb_clk); 226 return PTR_ERR(imxpriv->ahb_clk);
291 goto err_out;
292 } 227 }
293 228
294 if (type == AHCI_IMX53) { 229 if (imxpriv->type == AHCI_IMX6Q) {
295 imxpriv->sata_gate_clk = devm_clk_get(dev, "sata_gate"); 230 imxpriv->gpr = syscon_regmap_lookup_by_compatible(
296 if (IS_ERR(imxpriv->sata_gate_clk)) { 231 "fsl,imx6q-iomuxc-gpr");
297 dev_err(dev, "can't get sata_gate clock.\n"); 232 if (IS_ERR(imxpriv->gpr)) {
298 ret = PTR_ERR(imxpriv->sata_gate_clk); 233 dev_err(dev,
299 goto err_out; 234 "failed to find fsl,imx6q-iomux-gpr regmap\n");
235 return PTR_ERR(imxpriv->gpr);
300 } 236 }
301 } 237 }
302 238
303 imxpriv->sata_ref_clk = devm_clk_get(dev, "sata_ref"); 239 hpriv = ahci_platform_get_resources(pdev);
304 if (IS_ERR(imxpriv->sata_ref_clk)) { 240 if (IS_ERR(hpriv))
305 dev_err(dev, "can't get sata_ref clock.\n"); 241 return PTR_ERR(hpriv);
306 ret = PTR_ERR(imxpriv->sata_ref_clk); 242
307 goto err_out; 243 hpriv->plat_data = imxpriv;
308 }
309 244
310 imxpriv->ahci_pdev = ahci_pdev; 245 ret = imx_sata_enable(hpriv);
311 platform_set_drvdata(pdev, imxpriv); 246 if (ret)
247 return ret;
312 248
313 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 249 /*
314 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 250 * Configure the HWINIT bits of the HOST_CAP and HOST_PORTS_IMPL,
315 if (!mem || !irq) { 251 * and IP vendor specific register HOST_TIMER1MS.
316 dev_err(dev, "no mmio/irq resource\n"); 252 * Configure CAP_SSS (support stagered spin up).
317 ret = -ENOMEM; 253 * Implement the port0.
318 goto err_out; 254 * Get the ahb clock rate, and configure the TIMER1MS register.
255 */
256 reg_val = readl(hpriv->mmio + HOST_CAP);
257 if (!(reg_val & HOST_CAP_SSS)) {
258 reg_val |= HOST_CAP_SSS;
259 writel(reg_val, hpriv->mmio + HOST_CAP);
260 }
261 reg_val = readl(hpriv->mmio + HOST_PORTS_IMPL);
262 if (!(reg_val & 0x1)) {
263 reg_val |= 0x1;
264 writel(reg_val, hpriv->mmio + HOST_PORTS_IMPL);
319 } 265 }
320 266
321 res[0] = *mem; 267 reg_val = clk_get_rate(imxpriv->ahb_clk) / 1000;
322 res[1] = *irq; 268 writel(reg_val, hpriv->mmio + HOST_TIMER1MS);
323 269
324 ahci_dev->coherent_dma_mask = DMA_BIT_MASK(32); 270 ret = ahci_platform_init_host(pdev, hpriv, &ahci_imx_port_info, 0, 0);
325 ahci_dev->dma_mask = &ahci_dev->coherent_dma_mask; 271 if (ret)
326 ahci_dev->of_node = dev->of_node; 272 imx_sata_disable(hpriv);
327 273
328 if (type == AHCI_IMX6Q) { 274 return ret;
329 imxpriv->gpr = syscon_regmap_lookup_by_compatible( 275}
330 "fsl,imx6q-iomuxc-gpr");
331 if (IS_ERR(imxpriv->gpr)) {
332 dev_err(dev,
333 "failed to find fsl,imx6q-iomux-gpr regmap\n");
334 ret = PTR_ERR(imxpriv->gpr);
335 goto err_out;
336 }
337 276
338 /* 277static void ahci_imx_host_stop(struct ata_host *host)
339 * Set PHY Paremeters, two steps to configure the GPR13, 278{
340 * one write for rest of parameters, mask of first write 279 struct ahci_host_priv *hpriv = host->private_data;
341 * is 0x07fffffe, and the other one write for setting
342 * the mpll_clk_en happens in imx_sata_clock_enable().
343 */
344 regmap_update_bits(imxpriv->gpr, IOMUXC_GPR13,
345 IMX6Q_GPR13_SATA_RX_EQ_VAL_MASK |
346 IMX6Q_GPR13_SATA_RX_LOS_LVL_MASK |
347 IMX6Q_GPR13_SATA_RX_DPLL_MODE_MASK |
348 IMX6Q_GPR13_SATA_SPD_MODE_MASK |
349 IMX6Q_GPR13_SATA_MPLL_SS_EN |
350 IMX6Q_GPR13_SATA_TX_ATTEN_MASK |
351 IMX6Q_GPR13_SATA_TX_BOOST_MASK |
352 IMX6Q_GPR13_SATA_TX_LVL_MASK |
353 IMX6Q_GPR13_SATA_MPLL_CLK_EN |
354 IMX6Q_GPR13_SATA_TX_EDGE_RATE,
355 IMX6Q_GPR13_SATA_RX_EQ_VAL_3_0_DB |
356 IMX6Q_GPR13_SATA_RX_LOS_LVL_SATA2M |
357 IMX6Q_GPR13_SATA_RX_DPLL_MODE_2P_4F |
358 IMX6Q_GPR13_SATA_SPD_MODE_3P0G |
359 IMX6Q_GPR13_SATA_MPLL_SS_EN |
360 IMX6Q_GPR13_SATA_TX_ATTEN_9_16 |
361 IMX6Q_GPR13_SATA_TX_BOOST_3_33_DB |
362 IMX6Q_GPR13_SATA_TX_LVL_1_025_V);
363 }
364 280
365 ret = platform_device_add_resources(ahci_pdev, res, 2); 281 imx_sata_disable(hpriv);
366 if (ret) 282}
367 goto err_out;
368 283
369 ret = platform_device_add_data(ahci_pdev, pdata, sizeof(*pdata)); 284#ifdef CONFIG_PM_SLEEP
370 if (ret) 285static int imx_ahci_suspend(struct device *dev)
371 goto err_out; 286{
287 struct ata_host *host = dev_get_drvdata(dev);
288 struct ahci_host_priv *hpriv = host->private_data;
289 int ret;
372 290
373 ret = platform_device_add(ahci_pdev); 291 ret = ahci_platform_suspend_host(dev);
374 if (ret) { 292 if (ret)
375err_out:
376 platform_device_put(ahci_pdev);
377 return ret; 293 return ret;
378 } 294
295 imx_sata_disable(hpriv);
379 296
380 return 0; 297 return 0;
381} 298}
382 299
383static int imx_ahci_remove(struct platform_device *pdev) 300static int imx_ahci_resume(struct device *dev)
384{ 301{
385 struct imx_ahci_priv *imxpriv = platform_get_drvdata(pdev); 302 struct ata_host *host = dev_get_drvdata(dev);
386 struct platform_device *ahci_pdev = imxpriv->ahci_pdev; 303 struct ahci_host_priv *hpriv = host->private_data;
304 int ret;
387 305
388 platform_device_unregister(ahci_pdev); 306 ret = imx_sata_enable(hpriv);
389 return 0; 307 if (ret)
308 return ret;
309
310 return ahci_platform_resume_host(dev);
390} 311}
312#endif
313
314static SIMPLE_DEV_PM_OPS(ahci_imx_pm_ops, imx_ahci_suspend, imx_ahci_resume);
391 315
392static struct platform_driver imx_ahci_driver = { 316static struct platform_driver imx_ahci_driver = {
393 .probe = imx_ahci_probe, 317 .probe = imx_ahci_probe,
394 .remove = imx_ahci_remove, 318 .remove = ata_platform_remove_one,
395 .driver = { 319 .driver = {
396 .name = "ahci-imx", 320 .name = "ahci-imx",
397 .owner = THIS_MODULE, 321 .owner = THIS_MODULE,
398 .of_match_table = imx_ahci_of_match, 322 .of_match_table = imx_ahci_of_match,
323 .pm = &ahci_imx_pm_ops,
399 }, 324 },
400}; 325};
401module_platform_driver(imx_ahci_driver); 326module_platform_driver(imx_ahci_driver);
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index 4b231baceb09..ef67e79944f9 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -12,135 +12,36 @@
12 * any later version. 12 * any later version.
13 */ 13 */
14 14
15#include <linux/clk.h>
16#include <linux/kernel.h> 15#include <linux/kernel.h>
17#include <linux/gfp.h>
18#include <linux/module.h> 16#include <linux/module.h>
19#include <linux/pm.h> 17#include <linux/pm.h>
20#include <linux/init.h>
21#include <linux/interrupt.h>
22#include <linux/device.h> 18#include <linux/device.h>
23#include <linux/platform_device.h> 19#include <linux/platform_device.h>
24#include <linux/libata.h> 20#include <linux/libata.h>
25#include <linux/ahci_platform.h> 21#include <linux/ahci_platform.h>
26#include "ahci.h" 22#include "ahci.h"
27 23
28static void ahci_host_stop(struct ata_host *host); 24static const struct ata_port_info ahci_port_info = {
29 25 .flags = AHCI_FLAG_COMMON,
30enum ahci_type { 26 .pio_mask = ATA_PIO4,
31 AHCI, /* standard platform ahci */ 27 .udma_mask = ATA_UDMA6,
32 IMX53_AHCI, /* ahci on i.mx53 */ 28 .port_ops = &ahci_platform_ops,
33 STRICT_AHCI, /* delayed DMA engine start */
34};
35
36static struct platform_device_id ahci_devtype[] = {
37 {
38 .name = "ahci",
39 .driver_data = AHCI,
40 }, {
41 .name = "imx53-ahci",
42 .driver_data = IMX53_AHCI,
43 }, {
44 .name = "strict-ahci",
45 .driver_data = STRICT_AHCI,
46 }, {
47 /* sentinel */
48 }
49};
50MODULE_DEVICE_TABLE(platform, ahci_devtype);
51
52struct ata_port_operations ahci_platform_ops = {
53 .inherits = &ahci_ops,
54 .host_stop = ahci_host_stop,
55};
56EXPORT_SYMBOL_GPL(ahci_platform_ops);
57
58static struct ata_port_operations ahci_platform_retry_srst_ops = {
59 .inherits = &ahci_pmp_retry_srst_ops,
60 .host_stop = ahci_host_stop,
61};
62
63static const struct ata_port_info ahci_port_info[] = {
64 /* by features */
65 [AHCI] = {
66 .flags = AHCI_FLAG_COMMON,
67 .pio_mask = ATA_PIO4,
68 .udma_mask = ATA_UDMA6,
69 .port_ops = &ahci_platform_ops,
70 },
71 [IMX53_AHCI] = {
72 .flags = AHCI_FLAG_COMMON,
73 .pio_mask = ATA_PIO4,
74 .udma_mask = ATA_UDMA6,
75 .port_ops = &ahci_platform_retry_srst_ops,
76 },
77 [STRICT_AHCI] = {
78 AHCI_HFLAGS (AHCI_HFLAG_DELAY_ENGINE),
79 .flags = AHCI_FLAG_COMMON,
80 .pio_mask = ATA_PIO4,
81 .udma_mask = ATA_UDMA6,
82 .port_ops = &ahci_platform_ops,
83 },
84};
85
86static struct scsi_host_template ahci_platform_sht = {
87 AHCI_SHT("ahci_platform"),
88}; 29};
89 30
90static int ahci_probe(struct platform_device *pdev) 31static int ahci_probe(struct platform_device *pdev)
91{ 32{
92 struct device *dev = &pdev->dev; 33 struct device *dev = &pdev->dev;
93 struct ahci_platform_data *pdata = dev_get_platdata(dev); 34 struct ahci_platform_data *pdata = dev_get_platdata(dev);
94 const struct platform_device_id *id = platform_get_device_id(pdev);
95 struct ata_port_info pi = ahci_port_info[id ? id->driver_data : 0];
96 const struct ata_port_info *ppi[] = { &pi, NULL };
97 struct ahci_host_priv *hpriv; 35 struct ahci_host_priv *hpriv;
98 struct ata_host *host;
99 struct resource *mem;
100 int irq;
101 int n_ports;
102 int i;
103 int rc; 36 int rc;
104 37
105 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 38 hpriv = ahci_platform_get_resources(pdev);
106 if (!mem) { 39 if (IS_ERR(hpriv))
107 dev_err(dev, "no mmio space\n"); 40 return PTR_ERR(hpriv);
108 return -EINVAL;
109 }
110
111 irq = platform_get_irq(pdev, 0);
112 if (irq <= 0) {
113 dev_err(dev, "no irq\n");
114 return -EINVAL;
115 }
116
117 if (pdata && pdata->ata_port_info)
118 pi = *pdata->ata_port_info;
119
120 hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
121 if (!hpriv) {
122 dev_err(dev, "can't alloc ahci_host_priv\n");
123 return -ENOMEM;
124 }
125
126 hpriv->flags |= (unsigned long)pi.private_data;
127
128 hpriv->mmio = devm_ioremap(dev, mem->start, resource_size(mem));
129 if (!hpriv->mmio) {
130 dev_err(dev, "can't map %pR\n", mem);
131 return -ENOMEM;
132 }
133 41
134 hpriv->clk = clk_get(dev, NULL); 42 rc = ahci_platform_enable_resources(hpriv);
135 if (IS_ERR(hpriv->clk)) { 43 if (rc)
136 dev_err(dev, "can't get clock\n"); 44 return rc;
137 } else {
138 rc = clk_prepare_enable(hpriv->clk);
139 if (rc) {
140 dev_err(dev, "clock prepare enable failed");
141 goto free_clk;
142 }
143 }
144 45
145 /* 46 /*
146 * Some platforms might need to prepare for mmio region access, 47 * Some platforms might need to prepare for mmio region access,
@@ -151,69 +52,10 @@ static int ahci_probe(struct platform_device *pdev)
151 if (pdata && pdata->init) { 52 if (pdata && pdata->init) {
152 rc = pdata->init(dev, hpriv->mmio); 53 rc = pdata->init(dev, hpriv->mmio);
153 if (rc) 54 if (rc)
154 goto disable_unprepare_clk; 55 goto disable_resources;
155 }
156
157 ahci_save_initial_config(dev, hpriv,
158 pdata ? pdata->force_port_map : 0,
159 pdata ? pdata->mask_port_map : 0);
160
161 /* prepare host */
162 if (hpriv->cap & HOST_CAP_NCQ)
163 pi.flags |= ATA_FLAG_NCQ;
164
165 if (hpriv->cap & HOST_CAP_PMP)
166 pi.flags |= ATA_FLAG_PMP;
167
168 ahci_set_em_messages(hpriv, &pi);
169
170 /* CAP.NP sometimes indicate the index of the last enabled
171 * port, at other times, that of the last possible port, so
172 * determining the maximum port number requires looking at
173 * both CAP.NP and port_map.
174 */
175 n_ports = max(ahci_nr_ports(hpriv->cap), fls(hpriv->port_map));
176
177 host = ata_host_alloc_pinfo(dev, ppi, n_ports);
178 if (!host) {
179 rc = -ENOMEM;
180 goto pdata_exit;
181 }
182
183 host->private_data = hpriv;
184
185 if (!(hpriv->cap & HOST_CAP_SSS) || ahci_ignore_sss)
186 host->flags |= ATA_HOST_PARALLEL_SCAN;
187 else
188 dev_info(dev, "SSS flag set, parallel bus scan disabled\n");
189
190 if (pi.flags & ATA_FLAG_EM)
191 ahci_reset_em(host);
192
193 for (i = 0; i < host->n_ports; i++) {
194 struct ata_port *ap = host->ports[i];
195
196 ata_port_desc(ap, "mmio %pR", mem);
197 ata_port_desc(ap, "port 0x%x", 0x100 + ap->port_no * 0x80);
198
199 /* set enclosure management message type */
200 if (ap->flags & ATA_FLAG_EM)
201 ap->em_message_type = hpriv->em_msg_type;
202
203 /* disabled/not-implemented port */
204 if (!(hpriv->port_map & (1 << i)))
205 ap->ops = &ata_dummy_port_ops;
206 } 56 }
207 57
208 rc = ahci_reset_controller(host); 58 rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info, 0, 0);
209 if (rc)
210 goto pdata_exit;
211
212 ahci_init_controller(host);
213 ahci_print_info(host, "platform");
214
215 rc = ata_host_activate(host, irq, ahci_interrupt, IRQF_SHARED,
216 &ahci_platform_sht);
217 if (rc) 59 if (rc)
218 goto pdata_exit; 60 goto pdata_exit;
219 61
@@ -221,115 +63,19 @@ static int ahci_probe(struct platform_device *pdev)
221pdata_exit: 63pdata_exit:
222 if (pdata && pdata->exit) 64 if (pdata && pdata->exit)
223 pdata->exit(dev); 65 pdata->exit(dev);
224disable_unprepare_clk: 66disable_resources:
225 if (!IS_ERR(hpriv->clk)) 67 ahci_platform_disable_resources(hpriv);
226 clk_disable_unprepare(hpriv->clk);
227free_clk:
228 if (!IS_ERR(hpriv->clk))
229 clk_put(hpriv->clk);
230 return rc;
231}
232
233static void ahci_host_stop(struct ata_host *host)
234{
235 struct device *dev = host->dev;
236 struct ahci_platform_data *pdata = dev_get_platdata(dev);
237 struct ahci_host_priv *hpriv = host->private_data;
238
239 if (pdata && pdata->exit)
240 pdata->exit(dev);
241
242 if (!IS_ERR(hpriv->clk)) {
243 clk_disable_unprepare(hpriv->clk);
244 clk_put(hpriv->clk);
245 }
246}
247
248#ifdef CONFIG_PM_SLEEP
249static int ahci_suspend(struct device *dev)
250{
251 struct ahci_platform_data *pdata = dev_get_platdata(dev);
252 struct ata_host *host = dev_get_drvdata(dev);
253 struct ahci_host_priv *hpriv = host->private_data;
254 void __iomem *mmio = hpriv->mmio;
255 u32 ctl;
256 int rc;
257
258 if (hpriv->flags & AHCI_HFLAG_NO_SUSPEND) {
259 dev_err(dev, "firmware update required for suspend/resume\n");
260 return -EIO;
261 }
262
263 /*
264 * AHCI spec rev1.1 section 8.3.3:
265 * Software must disable interrupts prior to requesting a
266 * transition of the HBA to D3 state.
267 */
268 ctl = readl(mmio + HOST_CTL);
269 ctl &= ~HOST_IRQ_EN;
270 writel(ctl, mmio + HOST_CTL);
271 readl(mmio + HOST_CTL); /* flush */
272
273 rc = ata_host_suspend(host, PMSG_SUSPEND);
274 if (rc)
275 return rc;
276
277 if (pdata && pdata->suspend)
278 return pdata->suspend(dev);
279
280 if (!IS_ERR(hpriv->clk))
281 clk_disable_unprepare(hpriv->clk);
282
283 return 0;
284}
285
286static int ahci_resume(struct device *dev)
287{
288 struct ahci_platform_data *pdata = dev_get_platdata(dev);
289 struct ata_host *host = dev_get_drvdata(dev);
290 struct ahci_host_priv *hpriv = host->private_data;
291 int rc;
292
293 if (!IS_ERR(hpriv->clk)) {
294 rc = clk_prepare_enable(hpriv->clk);
295 if (rc) {
296 dev_err(dev, "clock prepare enable failed");
297 return rc;
298 }
299 }
300
301 if (pdata && pdata->resume) {
302 rc = pdata->resume(dev);
303 if (rc)
304 goto disable_unprepare_clk;
305 }
306
307 if (dev->power.power_state.event == PM_EVENT_SUSPEND) {
308 rc = ahci_reset_controller(host);
309 if (rc)
310 goto disable_unprepare_clk;
311
312 ahci_init_controller(host);
313 }
314
315 ata_host_resume(host);
316
317 return 0;
318
319disable_unprepare_clk:
320 if (!IS_ERR(hpriv->clk))
321 clk_disable_unprepare(hpriv->clk);
322
323 return rc; 68 return rc;
324} 69}
325#endif
326 70
327static SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_suspend, ahci_resume); 71static SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_platform_suspend,
72 ahci_platform_resume);
328 73
329static const struct of_device_id ahci_of_match[] = { 74static const struct of_device_id ahci_of_match[] = {
330 { .compatible = "snps,spear-ahci", }, 75 { .compatible = "snps,spear-ahci", },
331 { .compatible = "snps,exynos5440-ahci", }, 76 { .compatible = "snps,exynos5440-ahci", },
332 { .compatible = "ibm,476gtr-ahci", }, 77 { .compatible = "ibm,476gtr-ahci", },
78 { .compatible = "snps,dwc-ahci", },
333 {}, 79 {},
334}; 80};
335MODULE_DEVICE_TABLE(of, ahci_of_match); 81MODULE_DEVICE_TABLE(of, ahci_of_match);
@@ -343,7 +89,6 @@ static struct platform_driver ahci_driver = {
343 .of_match_table = ahci_of_match, 89 .of_match_table = ahci_of_match,
344 .pm = &ahci_pm_ops, 90 .pm = &ahci_pm_ops,
345 }, 91 },
346 .id_table = ahci_devtype,
347}; 92};
348module_platform_driver(ahci_driver); 93module_platform_driver(ahci_driver);
349 94
diff --git a/drivers/ata/ahci_st.c b/drivers/ata/ahci_st.c
new file mode 100644
index 000000000000..633222226c19
--- /dev/null
+++ b/drivers/ata/ahci_st.c
@@ -0,0 +1,245 @@
1/*
2 * Copyright (C) 2012 STMicroelectronics Limited
3 *
4 * Authors: Francesco Virlinzi <francesco.virlinzi@st.com>
5 * Alexandre Torgue <alexandre.torgue@st.com>
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
12#include <linux/init.h>
13#include <linux/module.h>
14#include <linux/export.h>
15#include <linux/platform_device.h>
16#include <linux/clk.h>
17#include <linux/of.h>
18#include <linux/ahci_platform.h>
19#include <linux/libata.h>
20#include <linux/reset.h>
21#include <linux/io.h>
22#include <linux/dma-mapping.h>
23
24#include "ahci.h"
25
26#define ST_AHCI_OOBR 0xbc
27#define ST_AHCI_OOBR_WE BIT(31)
28#define ST_AHCI_OOBR_CWMIN_SHIFT 24
29#define ST_AHCI_OOBR_CWMAX_SHIFT 16
30#define ST_AHCI_OOBR_CIMIN_SHIFT 8
31#define ST_AHCI_OOBR_CIMAX_SHIFT 0
32
33struct st_ahci_drv_data {
34 struct platform_device *ahci;
35 struct reset_control *pwr;
36 struct reset_control *sw_rst;
37 struct reset_control *pwr_rst;
38 struct ahci_host_priv *hpriv;
39};
40
41static void st_ahci_configure_oob(void __iomem *mmio)
42{
43 unsigned long old_val, new_val;
44
45 new_val = (0x02 << ST_AHCI_OOBR_CWMIN_SHIFT) |
46 (0x04 << ST_AHCI_OOBR_CWMAX_SHIFT) |
47 (0x08 << ST_AHCI_OOBR_CIMIN_SHIFT) |
48 (0x0C << ST_AHCI_OOBR_CIMAX_SHIFT);
49
50 old_val = readl(mmio + ST_AHCI_OOBR);
51 writel(old_val | ST_AHCI_OOBR_WE, mmio + ST_AHCI_OOBR);
52 writel(new_val | ST_AHCI_OOBR_WE, mmio + ST_AHCI_OOBR);
53 writel(new_val, mmio + ST_AHCI_OOBR);
54}
55
56static int st_ahci_deassert_resets(struct device *dev)
57{
58 struct st_ahci_drv_data *drv_data = dev_get_drvdata(dev);
59 int err;
60
61 if (drv_data->pwr) {
62 err = reset_control_deassert(drv_data->pwr);
63 if (err) {
64 dev_err(dev, "unable to bring out of pwrdwn\n");
65 return err;
66 }
67 }
68
69 st_ahci_configure_oob(drv_data->hpriv->mmio);
70
71 if (drv_data->sw_rst) {
72 err = reset_control_deassert(drv_data->sw_rst);
73 if (err) {
74 dev_err(dev, "unable to bring out of sw-rst\n");
75 return err;
76 }
77 }
78
79 if (drv_data->pwr_rst) {
80 err = reset_control_deassert(drv_data->pwr_rst);
81 if (err) {
82 dev_err(dev, "unable to bring out of pwr-rst\n");
83 return err;
84 }
85 }
86
87 return 0;
88}
89
90static void st_ahci_host_stop(struct ata_host *host)
91{
92 struct ahci_host_priv *hpriv = host->private_data;
93 struct device *dev = host->dev;
94 struct st_ahci_drv_data *drv_data = dev_get_drvdata(dev);
95 int err;
96
97 if (drv_data->pwr) {
98 err = reset_control_assert(drv_data->pwr);
99 if (err)
100 dev_err(dev, "unable to pwrdwn\n");
101 }
102
103 ahci_platform_disable_resources(hpriv);
104}
105
106static int st_ahci_probe_resets(struct platform_device *pdev)
107{
108 struct st_ahci_drv_data *drv_data = platform_get_drvdata(pdev);
109
110 drv_data->pwr = devm_reset_control_get(&pdev->dev, "pwr-dwn");
111 if (IS_ERR(drv_data->pwr)) {
112 dev_info(&pdev->dev, "power reset control not defined\n");
113 drv_data->pwr = NULL;
114 }
115
116 drv_data->sw_rst = devm_reset_control_get(&pdev->dev, "sw-rst");
117 if (IS_ERR(drv_data->sw_rst)) {
118 dev_info(&pdev->dev, "soft reset control not defined\n");
119 drv_data->sw_rst = NULL;
120 }
121
122 drv_data->pwr_rst = devm_reset_control_get(&pdev->dev, "pwr-rst");
123 if (IS_ERR(drv_data->pwr_rst)) {
124 dev_dbg(&pdev->dev, "power soft reset control not defined\n");
125 drv_data->pwr_rst = NULL;
126 }
127
128 return st_ahci_deassert_resets(&pdev->dev);
129}
130
131static struct ata_port_operations st_ahci_port_ops = {
132 .inherits = &ahci_platform_ops,
133 .host_stop = st_ahci_host_stop,
134};
135
136static const struct ata_port_info st_ahci_port_info = {
137 .flags = AHCI_FLAG_COMMON,
138 .pio_mask = ATA_PIO4,
139 .udma_mask = ATA_UDMA6,
140 .port_ops = &st_ahci_port_ops,
141};
142
143static int st_ahci_probe(struct platform_device *pdev)
144{
145 struct st_ahci_drv_data *drv_data;
146 struct ahci_host_priv *hpriv;
147 int err;
148
149 drv_data = devm_kzalloc(&pdev->dev, sizeof(*drv_data), GFP_KERNEL);
150 if (!drv_data)
151 return -ENOMEM;
152
153 platform_set_drvdata(pdev, drv_data);
154
155 hpriv = ahci_platform_get_resources(pdev);
156 if (IS_ERR(hpriv))
157 return PTR_ERR(hpriv);
158
159 drv_data->hpriv = hpriv;
160
161 err = st_ahci_probe_resets(pdev);
162 if (err)
163 return err;
164
165 err = ahci_platform_enable_resources(hpriv);
166 if (err)
167 return err;
168
169 err = ahci_platform_init_host(pdev, hpriv, &st_ahci_port_info, 0, 0);
170 if (err) {
171 ahci_platform_disable_resources(hpriv);
172 return err;
173 }
174
175 return 0;
176}
177
178#ifdef CONFIG_PM_SLEEP
179static int st_ahci_suspend(struct device *dev)
180{
181 struct st_ahci_drv_data *drv_data = dev_get_drvdata(dev);
182 struct ahci_host_priv *hpriv = drv_data->hpriv;
183 int err;
184
185 err = ahci_platform_suspend_host(dev);
186 if (err)
187 return err;
188
189 if (drv_data->pwr) {
190 err = reset_control_assert(drv_data->pwr);
191 if (err) {
192 dev_err(dev, "unable to pwrdwn");
193 return err;
194 }
195 }
196
197 ahci_platform_disable_resources(hpriv);
198
199 return 0;
200}
201
202static int st_ahci_resume(struct device *dev)
203{
204 struct st_ahci_drv_data *drv_data = dev_get_drvdata(dev);
205 struct ahci_host_priv *hpriv = drv_data->hpriv;
206 int err;
207
208 err = ahci_platform_enable_resources(hpriv);
209 if (err)
210 return err;
211
212 err = st_ahci_deassert_resets(dev);
213 if (err) {
214 ahci_platform_disable_resources(hpriv);
215 return err;
216 }
217
218 return ahci_platform_resume_host(dev);
219}
220#endif
221
222static SIMPLE_DEV_PM_OPS(st_ahci_pm_ops, st_ahci_suspend, st_ahci_resume);
223
224static struct of_device_id st_ahci_match[] = {
225 { .compatible = "st,ahci", },
226 {},
227};
228MODULE_DEVICE_TABLE(of, st_ahci_match);
229
230static struct platform_driver st_ahci_driver = {
231 .driver = {
232 .name = "st_ahci",
233 .owner = THIS_MODULE,
234 .pm = &st_ahci_pm_ops,
235 .of_match_table = of_match_ptr(st_ahci_match),
236 },
237 .probe = st_ahci_probe,
238 .remove = ata_platform_remove_one,
239};
240module_platform_driver(st_ahci_driver);
241
242MODULE_AUTHOR("Alexandre Torgue <alexandre.torgue@st.com>");
243MODULE_AUTHOR("Francesco Virlinzi <francesco.virlinzi@st.com>");
244MODULE_DESCRIPTION("STMicroelectronics SATA AHCI Driver");
245MODULE_LICENSE("GPL v2");
diff --git a/drivers/ata/ahci_sunxi.c b/drivers/ata/ahci_sunxi.c
new file mode 100644
index 000000000000..42d3f64e74b3
--- /dev/null
+++ b/drivers/ata/ahci_sunxi.c
@@ -0,0 +1,249 @@
1/*
2 * Allwinner sunxi AHCI SATA platform driver
3 * Copyright 2013 Olliver Schinagl <oliver@schinagl.nl>
4 * Copyright 2014 Hans de Goede <hdegoede@redhat.com>
5 *
6 * based on the AHCI SATA platform driver by Jeff Garzik and Anton Vorontsov
7 * Based on code from Allwinner Technology Co., Ltd. <www.allwinnertech.com>,
8 * Daniel Wang <danielwang@allwinnertech.com>
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms and conditions of the GNU General Public License,
12 * version 2, as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 */
19
20#include <linux/ahci_platform.h>
21#include <linux/clk.h>
22#include <linux/errno.h>
23#include <linux/kernel.h>
24#include <linux/module.h>
25#include <linux/of_device.h>
26#include <linux/platform_device.h>
27#include <linux/regulator/consumer.h>
28#include "ahci.h"
29
30#define AHCI_BISTAFR 0x00a0
31#define AHCI_BISTCR 0x00a4
32#define AHCI_BISTFCTR 0x00a8
33#define AHCI_BISTSR 0x00ac
34#define AHCI_BISTDECR 0x00b0
35#define AHCI_DIAGNR0 0x00b4
36#define AHCI_DIAGNR1 0x00b8
37#define AHCI_OOBR 0x00bc
38#define AHCI_PHYCS0R 0x00c0
39#define AHCI_PHYCS1R 0x00c4
40#define AHCI_PHYCS2R 0x00c8
41#define AHCI_TIMER1MS 0x00e0
42#define AHCI_GPARAM1R 0x00e8
43#define AHCI_GPARAM2R 0x00ec
44#define AHCI_PPARAMR 0x00f0
45#define AHCI_TESTR 0x00f4
46#define AHCI_VERSIONR 0x00f8
47#define AHCI_IDR 0x00fc
48#define AHCI_RWCR 0x00fc
49#define AHCI_P0DMACR 0x0170
50#define AHCI_P0PHYCR 0x0178
51#define AHCI_P0PHYSR 0x017c
52
53static void sunxi_clrbits(void __iomem *reg, u32 clr_val)
54{
55 u32 reg_val;
56
57 reg_val = readl(reg);
58 reg_val &= ~(clr_val);
59 writel(reg_val, reg);
60}
61
62static void sunxi_setbits(void __iomem *reg, u32 set_val)
63{
64 u32 reg_val;
65
66 reg_val = readl(reg);
67 reg_val |= set_val;
68 writel(reg_val, reg);
69}
70
71static void sunxi_clrsetbits(void __iomem *reg, u32 clr_val, u32 set_val)
72{
73 u32 reg_val;
74
75 reg_val = readl(reg);
76 reg_val &= ~(clr_val);
77 reg_val |= set_val;
78 writel(reg_val, reg);
79}
80
81static u32 sunxi_getbits(void __iomem *reg, u8 mask, u8 shift)
82{
83 return (readl(reg) >> shift) & mask;
84}
85
86static int ahci_sunxi_phy_init(struct device *dev, void __iomem *reg_base)
87{
88 u32 reg_val;
89 int timeout;
90
91 /* This magic is from the original code */
92 writel(0, reg_base + AHCI_RWCR);
93 msleep(5);
94
95 sunxi_setbits(reg_base + AHCI_PHYCS1R, BIT(19));
96 sunxi_clrsetbits(reg_base + AHCI_PHYCS0R,
97 (0x7 << 24),
98 (0x5 << 24) | BIT(23) | BIT(18));
99 sunxi_clrsetbits(reg_base + AHCI_PHYCS1R,
100 (0x3 << 16) | (0x1f << 8) | (0x3 << 6),
101 (0x2 << 16) | (0x6 << 8) | (0x2 << 6));
102 sunxi_setbits(reg_base + AHCI_PHYCS1R, BIT(28) | BIT(15));
103 sunxi_clrbits(reg_base + AHCI_PHYCS1R, BIT(19));
104 sunxi_clrsetbits(reg_base + AHCI_PHYCS0R,
105 (0x7 << 20), (0x3 << 20));
106 sunxi_clrsetbits(reg_base + AHCI_PHYCS2R,
107 (0x1f << 5), (0x19 << 5));
108 msleep(5);
109
110 sunxi_setbits(reg_base + AHCI_PHYCS0R, (0x1 << 19));
111
112 timeout = 250; /* Power up takes aprox 50 us */
113 do {
114 reg_val = sunxi_getbits(reg_base + AHCI_PHYCS0R, 0x7, 28);
115 if (reg_val == 0x02)
116 break;
117
118 if (--timeout == 0) {
119 dev_err(dev, "PHY power up failed.\n");
120 return -EIO;
121 }
122 udelay(1);
123 } while (1);
124
125 sunxi_setbits(reg_base + AHCI_PHYCS2R, (0x1 << 24));
126
127 timeout = 100; /* Calibration takes aprox 10 us */
128 do {
129 reg_val = sunxi_getbits(reg_base + AHCI_PHYCS2R, 0x1, 24);
130 if (reg_val == 0x00)
131 break;
132
133 if (--timeout == 0) {
134 dev_err(dev, "PHY calibration failed.\n");
135 return -EIO;
136 }
137 udelay(1);
138 } while (1);
139
140 msleep(15);
141
142 writel(0x7, reg_base + AHCI_RWCR);
143
144 return 0;
145}
146
147static void ahci_sunxi_start_engine(struct ata_port *ap)
148{
149 void __iomem *port_mmio = ahci_port_base(ap);
150 struct ahci_host_priv *hpriv = ap->host->private_data;
151
152 /* Setup DMA before DMA start */
153 sunxi_clrsetbits(hpriv->mmio + AHCI_P0DMACR, 0x0000ff00, 0x00004400);
154
155 /* Start DMA */
156 sunxi_setbits(port_mmio + PORT_CMD, PORT_CMD_START);
157}
158
159static const struct ata_port_info ahci_sunxi_port_info = {
160 AHCI_HFLAGS(AHCI_HFLAG_32BIT_ONLY | AHCI_HFLAG_NO_MSI |
161 AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ),
162 .flags = AHCI_FLAG_COMMON | ATA_FLAG_NCQ,
163 .pio_mask = ATA_PIO4,
164 .udma_mask = ATA_UDMA6,
165 .port_ops = &ahci_platform_ops,
166};
167
168static int ahci_sunxi_probe(struct platform_device *pdev)
169{
170 struct device *dev = &pdev->dev;
171 struct ahci_host_priv *hpriv;
172 int rc;
173
174 hpriv = ahci_platform_get_resources(pdev);
175 if (IS_ERR(hpriv))
176 return PTR_ERR(hpriv);
177
178 hpriv->start_engine = ahci_sunxi_start_engine;
179
180 rc = ahci_platform_enable_resources(hpriv);
181 if (rc)
182 return rc;
183
184 rc = ahci_sunxi_phy_init(dev, hpriv->mmio);
185 if (rc)
186 goto disable_resources;
187
188 rc = ahci_platform_init_host(pdev, hpriv, &ahci_sunxi_port_info, 0, 0);
189 if (rc)
190 goto disable_resources;
191
192 return 0;
193
194disable_resources:
195 ahci_platform_disable_resources(hpriv);
196 return rc;
197}
198
199#ifdef CONFIG_PM_SLEEP
200static int ahci_sunxi_resume(struct device *dev)
201{
202 struct ata_host *host = dev_get_drvdata(dev);
203 struct ahci_host_priv *hpriv = host->private_data;
204 int rc;
205
206 rc = ahci_platform_enable_resources(hpriv);
207 if (rc)
208 return rc;
209
210 rc = ahci_sunxi_phy_init(dev, hpriv->mmio);
211 if (rc)
212 goto disable_resources;
213
214 rc = ahci_platform_resume_host(dev);
215 if (rc)
216 goto disable_resources;
217
218 return 0;
219
220disable_resources:
221 ahci_platform_disable_resources(hpriv);
222 return rc;
223}
224#endif
225
226static SIMPLE_DEV_PM_OPS(ahci_sunxi_pm_ops, ahci_platform_suspend,
227 ahci_sunxi_resume);
228
229static const struct of_device_id ahci_sunxi_of_match[] = {
230 { .compatible = "allwinner,sun4i-a10-ahci", },
231 { },
232};
233MODULE_DEVICE_TABLE(of, ahci_sunxi_of_match);
234
235static struct platform_driver ahci_sunxi_driver = {
236 .probe = ahci_sunxi_probe,
237 .remove = ata_platform_remove_one,
238 .driver = {
239 .name = "ahci-sunxi",
240 .owner = THIS_MODULE,
241 .of_match_table = ahci_sunxi_of_match,
242 .pm = &ahci_sunxi_pm_ops,
243 },
244};
245module_platform_driver(ahci_sunxi_driver);
246
247MODULE_DESCRIPTION("Allwinner sunxi AHCI SATA driver");
248MODULE_AUTHOR("Olliver Schinagl <oliver@schinagl.nl>");
249MODULE_LICENSE("GPL");
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
new file mode 100644
index 000000000000..77c89bf171f1
--- /dev/null
+++ b/drivers/ata/ahci_xgene.c
@@ -0,0 +1,486 @@
1/*
2 * AppliedMicro X-Gene SoC SATA Host Controller Driver
3 *
4 * Copyright (c) 2014, Applied Micro Circuits Corporation
5 * Author: Loc Ho <lho@apm.com>
6 * Tuan Phan <tphan@apm.com>
7 * Suman Tripathi <stripathi@apm.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
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 *
22 * NOTE: PM support is not currently available.
23 *
24 */
25#include <linux/module.h>
26#include <linux/platform_device.h>
27#include <linux/ahci_platform.h>
28#include <linux/of_address.h>
29#include <linux/of_irq.h>
30#include <linux/phy/phy.h>
31#include "ahci.h"
32
33/* Max # of disk per a controller */
34#define MAX_AHCI_CHN_PERCTR 2
35
36/* MUX CSR */
37#define SATA_ENET_CONFIG_REG 0x00000000
38#define CFG_SATA_ENET_SELECT_MASK 0x00000001
39
40/* SATA core host controller CSR */
41#define SLVRDERRATTRIBUTES 0x00000000
42#define SLVWRERRATTRIBUTES 0x00000004
43#define MSTRDERRATTRIBUTES 0x00000008
44#define MSTWRERRATTRIBUTES 0x0000000c
45#define BUSCTLREG 0x00000014
46#define IOFMSTRWAUX 0x00000018
47#define INTSTATUSMASK 0x0000002c
48#define ERRINTSTATUS 0x00000030
49#define ERRINTSTATUSMASK 0x00000034
50
51/* SATA host AHCI CSR */
52#define PORTCFG 0x000000a4
53#define PORTADDR_SET(dst, src) \
54 (((dst) & ~0x0000003f) | (((u32)(src)) & 0x0000003f))
55#define PORTPHY1CFG 0x000000a8
56#define PORTPHY1CFG_FRCPHYRDY_SET(dst, src) \
57 (((dst) & ~0x00100000) | (((u32)(src) << 0x14) & 0x00100000))
58#define PORTPHY2CFG 0x000000ac
59#define PORTPHY3CFG 0x000000b0
60#define PORTPHY4CFG 0x000000b4
61#define PORTPHY5CFG 0x000000b8
62#define SCTL0 0x0000012C
63#define PORTPHY5CFG_RTCHG_SET(dst, src) \
64 (((dst) & ~0xfff00000) | (((u32)(src) << 0x14) & 0xfff00000))
65#define PORTAXICFG_EN_CONTEXT_SET(dst, src) \
66 (((dst) & ~0x01000000) | (((u32)(src) << 0x18) & 0x01000000))
67#define PORTAXICFG 0x000000bc
68#define PORTAXICFG_OUTTRANS_SET(dst, src) \
69 (((dst) & ~0x00f00000) | (((u32)(src) << 0x14) & 0x00f00000))
70
71/* SATA host controller AXI CSR */
72#define INT_SLV_TMOMASK 0x00000010
73
74/* SATA diagnostic CSR */
75#define CFG_MEM_RAM_SHUTDOWN 0x00000070
76#define BLOCK_MEM_RDY 0x00000074
77
78struct xgene_ahci_context {
79 struct ahci_host_priv *hpriv;
80 struct device *dev;
81 void __iomem *csr_core; /* Core CSR address of IP */
82 void __iomem *csr_diag; /* Diag CSR address of IP */
83 void __iomem *csr_axi; /* AXI CSR address of IP */
84 void __iomem *csr_mux; /* MUX CSR address of IP */
85};
86
87static int xgene_ahci_init_memram(struct xgene_ahci_context *ctx)
88{
89 dev_dbg(ctx->dev, "Release memory from shutdown\n");
90 writel(0x0, ctx->csr_diag + CFG_MEM_RAM_SHUTDOWN);
91 readl(ctx->csr_diag + CFG_MEM_RAM_SHUTDOWN); /* Force a barrier */
92 msleep(1); /* reset may take up to 1ms */
93 if (readl(ctx->csr_diag + BLOCK_MEM_RDY) != 0xFFFFFFFF) {
94 dev_err(ctx->dev, "failed to release memory from shutdown\n");
95 return -ENODEV;
96 }
97 return 0;
98}
99
100/**
101 * xgene_ahci_read_id - Read ID data from the specified device
102 * @dev: device
103 * @tf: proposed taskfile
104 * @id: data buffer
105 *
106 * This custom read ID function is required due to the fact that the HW
107 * does not support DEVSLP and the controller state machine may get stuck
108 * after processing the ID query command.
109 */
110static unsigned int xgene_ahci_read_id(struct ata_device *dev,
111 struct ata_taskfile *tf, u16 *id)
112{
113 u32 err_mask;
114 void __iomem *port_mmio = ahci_port_base(dev->link->ap);
115
116 err_mask = ata_do_dev_read_id(dev, tf, id);
117 if (err_mask)
118 return err_mask;
119
120 /*
121 * Mask reserved area. Word78 spec of Link Power Management
122 * bit15-8: reserved
123 * bit7: NCQ autosence
124 * bit6: Software settings preservation supported
125 * bit5: reserved
126 * bit4: In-order sata delivery supported
127 * bit3: DIPM requests supported
128 * bit2: DMA Setup FIS Auto-Activate optimization supported
129 * bit1: DMA Setup FIX non-Zero buffer offsets supported
130 * bit0: Reserved
131 *
132 * Clear reserved bit 8 (DEVSLP bit) as we don't support DEVSLP
133 */
134 id[ATA_ID_FEATURE_SUPP] &= ~(1 << 8);
135
136 /*
137 * Due to HW errata, restart the port if no other command active.
138 * Otherwise the controller may get stuck.
139 */
140 if (!readl(port_mmio + PORT_CMD_ISSUE)) {
141 writel(PORT_CMD_FIS_RX, port_mmio + PORT_CMD);
142 readl(port_mmio + PORT_CMD); /* Force a barrier */
143 writel(PORT_CMD_FIS_RX | PORT_CMD_START, port_mmio + PORT_CMD);
144 readl(port_mmio + PORT_CMD); /* Force a barrier */
145 }
146 return 0;
147}
148
149static void xgene_ahci_set_phy_cfg(struct xgene_ahci_context *ctx, int channel)
150{
151 void __iomem *mmio = ctx->hpriv->mmio;
152 u32 val;
153
154 dev_dbg(ctx->dev, "port configure mmio 0x%p channel %d\n",
155 mmio, channel);
156 val = readl(mmio + PORTCFG);
157 val = PORTADDR_SET(val, channel == 0 ? 2 : 3);
158 writel(val, mmio + PORTCFG);
159 readl(mmio + PORTCFG); /* Force a barrier */
160 /* Disable fix rate */
161 writel(0x0001fffe, mmio + PORTPHY1CFG);
162 readl(mmio + PORTPHY1CFG); /* Force a barrier */
163 writel(0x5018461c, mmio + PORTPHY2CFG);
164 readl(mmio + PORTPHY2CFG); /* Force a barrier */
165 writel(0x1c081907, mmio + PORTPHY3CFG);
166 readl(mmio + PORTPHY3CFG); /* Force a barrier */
167 writel(0x1c080815, mmio + PORTPHY4CFG);
168 readl(mmio + PORTPHY4CFG); /* Force a barrier */
169 /* Set window negotiation */
170 val = readl(mmio + PORTPHY5CFG);
171 val = PORTPHY5CFG_RTCHG_SET(val, 0x300);
172 writel(val, mmio + PORTPHY5CFG);
173 readl(mmio + PORTPHY5CFG); /* Force a barrier */
174 val = readl(mmio + PORTAXICFG);
175 val = PORTAXICFG_EN_CONTEXT_SET(val, 0x1); /* Enable context mgmt */
176 val = PORTAXICFG_OUTTRANS_SET(val, 0xe); /* Set outstanding */
177 writel(val, mmio + PORTAXICFG);
178 readl(mmio + PORTAXICFG); /* Force a barrier */
179}
180
181/**
182 * xgene_ahci_do_hardreset - Issue the actual COMRESET
183 * @link: link to reset
184 * @deadline: deadline jiffies for the operation
185 * @online: Return value to indicate if device online
186 *
187 * Due to the limitation of the hardware PHY, a difference set of setting is
188 * required for each supported disk speed - Gen3 (6.0Gbps), Gen2 (3.0Gbps),
189 * and Gen1 (1.5Gbps). Otherwise during long IO stress test, the PHY will
190 * report disparity error and etc. In addition, during COMRESET, there can
191 * be error reported in the register PORT_SCR_ERR. For SERR_DISPARITY and
192 * SERR_10B_8B_ERR, the PHY receiver line must be reseted. The following
193 * algorithm is followed to proper configure the hardware PHY during COMRESET:
194 *
195 * Alg Part 1:
196 * 1. Start the PHY at Gen3 speed (default setting)
197 * 2. Issue the COMRESET
198 * 3. If no link, go to Alg Part 3
199 * 4. If link up, determine if the negotiated speed matches the PHY
200 * configured speed
201 * 5. If they matched, go to Alg Part 2
202 * 6. If they do not matched and first time, configure the PHY for the linked
203 * up disk speed and repeat step 2
204 * 7. Go to Alg Part 2
205 *
206 * Alg Part 2:
207 * 1. On link up, if there are any SERR_DISPARITY and SERR_10B_8B_ERR error
208 * reported in the register PORT_SCR_ERR, then reset the PHY receiver line
209 * 2. Go to Alg Part 3
210 *
211 * Alg Part 3:
212 * 1. Clear any pending from register PORT_SCR_ERR.
213 *
214 * NOTE: For the initial version, we will NOT support Gen1/Gen2. In addition
215 * and until the underlying PHY supports an method to reset the receiver
216 * line, on detection of SERR_DISPARITY or SERR_10B_8B_ERR errors,
217 * an warning message will be printed.
218 */
219static int xgene_ahci_do_hardreset(struct ata_link *link,
220 unsigned long deadline, bool *online)
221{
222 const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context);
223 struct ata_port *ap = link->ap;
224 struct ahci_host_priv *hpriv = ap->host->private_data;
225 struct xgene_ahci_context *ctx = hpriv->plat_data;
226 struct ahci_port_priv *pp = ap->private_data;
227 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
228 void __iomem *port_mmio = ahci_port_base(ap);
229 struct ata_taskfile tf;
230 int rc;
231 u32 val;
232
233 /* clear D2H reception area to properly wait for D2H FIS */
234 ata_tf_init(link->device, &tf);
235 tf.command = ATA_BUSY;
236 ata_tf_to_fis(&tf, 0, 0, d2h_fis);
237 rc = sata_link_hardreset(link, timing, deadline, online,
238 ahci_check_ready);
239
240 val = readl(port_mmio + PORT_SCR_ERR);
241 if (val & (SERR_DISPARITY | SERR_10B_8B_ERR))
242 dev_warn(ctx->dev, "link has error\n");
243
244 /* clear all errors if any pending */
245 val = readl(port_mmio + PORT_SCR_ERR);
246 writel(val, port_mmio + PORT_SCR_ERR);
247
248 return rc;
249}
250
251static int xgene_ahci_hardreset(struct ata_link *link, unsigned int *class,
252 unsigned long deadline)
253{
254 struct ata_port *ap = link->ap;
255 struct ahci_host_priv *hpriv = ap->host->private_data;
256 void __iomem *port_mmio = ahci_port_base(ap);
257 bool online;
258 int rc;
259 u32 portcmd_saved;
260 u32 portclb_saved;
261 u32 portclbhi_saved;
262 u32 portrxfis_saved;
263 u32 portrxfishi_saved;
264
265 /* As hardreset resets these CSR, save it to restore later */
266 portcmd_saved = readl(port_mmio + PORT_CMD);
267 portclb_saved = readl(port_mmio + PORT_LST_ADDR);
268 portclbhi_saved = readl(port_mmio + PORT_LST_ADDR_HI);
269 portrxfis_saved = readl(port_mmio + PORT_FIS_ADDR);
270 portrxfishi_saved = readl(port_mmio + PORT_FIS_ADDR_HI);
271
272 ahci_stop_engine(ap);
273
274 rc = xgene_ahci_do_hardreset(link, deadline, &online);
275
276 /* As controller hardreset clears them, restore them */
277 writel(portcmd_saved, port_mmio + PORT_CMD);
278 writel(portclb_saved, port_mmio + PORT_LST_ADDR);
279 writel(portclbhi_saved, port_mmio + PORT_LST_ADDR_HI);
280 writel(portrxfis_saved, port_mmio + PORT_FIS_ADDR);
281 writel(portrxfishi_saved, port_mmio + PORT_FIS_ADDR_HI);
282
283 hpriv->start_engine(ap);
284
285 if (online)
286 *class = ahci_dev_classify(ap);
287
288 return rc;
289}
290
291static void xgene_ahci_host_stop(struct ata_host *host)
292{
293 struct ahci_host_priv *hpriv = host->private_data;
294
295 ahci_platform_disable_resources(hpriv);
296}
297
298static struct ata_port_operations xgene_ahci_ops = {
299 .inherits = &ahci_ops,
300 .host_stop = xgene_ahci_host_stop,
301 .hardreset = xgene_ahci_hardreset,
302 .read_id = xgene_ahci_read_id,
303};
304
305static const struct ata_port_info xgene_ahci_port_info = {
306 AHCI_HFLAGS(AHCI_HFLAG_NO_PMP | AHCI_HFLAG_YES_NCQ),
307 .flags = AHCI_FLAG_COMMON | ATA_FLAG_NCQ,
308 .pio_mask = ATA_PIO4,
309 .udma_mask = ATA_UDMA6,
310 .port_ops = &xgene_ahci_ops,
311};
312
313static int xgene_ahci_hw_init(struct ahci_host_priv *hpriv)
314{
315 struct xgene_ahci_context *ctx = hpriv->plat_data;
316 int i;
317 int rc;
318 u32 val;
319
320 /* Remove IP RAM out of shutdown */
321 rc = xgene_ahci_init_memram(ctx);
322 if (rc)
323 return rc;
324
325 for (i = 0; i < MAX_AHCI_CHN_PERCTR; i++)
326 xgene_ahci_set_phy_cfg(ctx, i);
327
328 /* AXI disable Mask */
329 writel(0xffffffff, hpriv->mmio + HOST_IRQ_STAT);
330 readl(hpriv->mmio + HOST_IRQ_STAT); /* Force a barrier */
331 writel(0, ctx->csr_core + INTSTATUSMASK);
332 val = readl(ctx->csr_core + INTSTATUSMASK); /* Force a barrier */
333 dev_dbg(ctx->dev, "top level interrupt mask 0x%X value 0x%08X\n",
334 INTSTATUSMASK, val);
335
336 writel(0x0, ctx->csr_core + ERRINTSTATUSMASK);
337 readl(ctx->csr_core + ERRINTSTATUSMASK); /* Force a barrier */
338 writel(0x0, ctx->csr_axi + INT_SLV_TMOMASK);
339 readl(ctx->csr_axi + INT_SLV_TMOMASK);
340
341 /* Enable AXI Interrupt */
342 writel(0xffffffff, ctx->csr_core + SLVRDERRATTRIBUTES);
343 writel(0xffffffff, ctx->csr_core + SLVWRERRATTRIBUTES);
344 writel(0xffffffff, ctx->csr_core + MSTRDERRATTRIBUTES);
345 writel(0xffffffff, ctx->csr_core + MSTWRERRATTRIBUTES);
346
347 /* Enable coherency */
348 val = readl(ctx->csr_core + BUSCTLREG);
349 val &= ~0x00000002; /* Enable write coherency */
350 val &= ~0x00000001; /* Enable read coherency */
351 writel(val, ctx->csr_core + BUSCTLREG);
352
353 val = readl(ctx->csr_core + IOFMSTRWAUX);
354 val |= (1 << 3); /* Enable read coherency */
355 val |= (1 << 9); /* Enable write coherency */
356 writel(val, ctx->csr_core + IOFMSTRWAUX);
357 val = readl(ctx->csr_core + IOFMSTRWAUX);
358 dev_dbg(ctx->dev, "coherency 0x%X value 0x%08X\n",
359 IOFMSTRWAUX, val);
360
361 return rc;
362}
363
364static int xgene_ahci_mux_select(struct xgene_ahci_context *ctx)
365{
366 u32 val;
367
368 /* Check for optional MUX resource */
369 if (IS_ERR(ctx->csr_mux))
370 return 0;
371
372 val = readl(ctx->csr_mux + SATA_ENET_CONFIG_REG);
373 val &= ~CFG_SATA_ENET_SELECT_MASK;
374 writel(val, ctx->csr_mux + SATA_ENET_CONFIG_REG);
375 val = readl(ctx->csr_mux + SATA_ENET_CONFIG_REG);
376 return val & CFG_SATA_ENET_SELECT_MASK ? -1 : 0;
377}
378
379static int xgene_ahci_probe(struct platform_device *pdev)
380{
381 struct device *dev = &pdev->dev;
382 struct ahci_host_priv *hpriv;
383 struct xgene_ahci_context *ctx;
384 struct resource *res;
385 int rc;
386
387 hpriv = ahci_platform_get_resources(pdev);
388 if (IS_ERR(hpriv))
389 return PTR_ERR(hpriv);
390
391 ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
392 if (!ctx)
393 return -ENOMEM;
394
395 hpriv->plat_data = ctx;
396 ctx->hpriv = hpriv;
397 ctx->dev = dev;
398
399 /* Retrieve the IP core resource */
400 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
401 ctx->csr_core = devm_ioremap_resource(dev, res);
402 if (IS_ERR(ctx->csr_core))
403 return PTR_ERR(ctx->csr_core);
404
405 /* Retrieve the IP diagnostic resource */
406 res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
407 ctx->csr_diag = devm_ioremap_resource(dev, res);
408 if (IS_ERR(ctx->csr_diag))
409 return PTR_ERR(ctx->csr_diag);
410
411 /* Retrieve the IP AXI resource */
412 res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
413 ctx->csr_axi = devm_ioremap_resource(dev, res);
414 if (IS_ERR(ctx->csr_axi))
415 return PTR_ERR(ctx->csr_axi);
416
417 /* Retrieve the optional IP mux resource */
418 res = platform_get_resource(pdev, IORESOURCE_MEM, 4);
419 ctx->csr_mux = devm_ioremap_resource(dev, res);
420
421 dev_dbg(dev, "VAddr 0x%p Mmio VAddr 0x%p\n", ctx->csr_core,
422 hpriv->mmio);
423
424 /* Select ATA */
425 if ((rc = xgene_ahci_mux_select(ctx))) {
426 dev_err(dev, "SATA mux selection failed error %d\n", rc);
427 return -ENODEV;
428 }
429
430 /* Due to errata, HW requires full toggle transition */
431 rc = ahci_platform_enable_clks(hpriv);
432 if (rc)
433 goto disable_resources;
434 ahci_platform_disable_clks(hpriv);
435
436 rc = ahci_platform_enable_resources(hpriv);
437 if (rc)
438 goto disable_resources;
439
440 /* Configure the host controller */
441 xgene_ahci_hw_init(hpriv);
442
443 /*
444 * Setup DMA mask. This is preliminary until the DMA range is sorted
445 * out.
446 */
447 rc = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
448 if (rc) {
449 dev_err(dev, "Unable to set dma mask\n");
450 goto disable_resources;
451 }
452
453 rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info, 0, 0);
454 if (rc)
455 goto disable_resources;
456
457 dev_dbg(dev, "X-Gene SATA host controller initialized\n");
458 return 0;
459
460disable_resources:
461 ahci_platform_disable_resources(hpriv);
462 return rc;
463}
464
465static const struct of_device_id xgene_ahci_of_match[] = {
466 {.compatible = "apm,xgene-ahci"},
467 {},
468};
469MODULE_DEVICE_TABLE(of, xgene_ahci_of_match);
470
471static struct platform_driver xgene_ahci_driver = {
472 .probe = xgene_ahci_probe,
473 .remove = ata_platform_remove_one,
474 .driver = {
475 .name = "xgene-ahci",
476 .owner = THIS_MODULE,
477 .of_match_table = xgene_ahci_of_match,
478 },
479};
480
481module_platform_driver(xgene_ahci_driver);
482
483MODULE_DESCRIPTION("APM X-Gene AHCI SATA driver");
484MODULE_AUTHOR("Loc Ho <lho@apm.com>");
485MODULE_LICENSE("GPL");
486MODULE_VERSION("0.4");
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c
index 7d196656adb5..9498a7d3846f 100644
--- a/drivers/ata/ata_generic.c
+++ b/drivers/ata/ata_generic.c
@@ -19,7 +19,6 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/pci.h> 21#include <linux/pci.h>
22#include <linux/init.h>
23#include <linux/blkdev.h> 22#include <linux/blkdev.h>
24#include <linux/delay.h> 23#include <linux/delay.h>
25#include <scsi/scsi_host.h> 24#include <scsi/scsi_host.h>
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 36605abe5a67..6bd4f660b4e1 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -35,7 +35,6 @@
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/gfp.h> 36#include <linux/gfp.h>
37#include <linux/module.h> 37#include <linux/module.h>
38#include <linux/init.h>
39#include <linux/blkdev.h> 38#include <linux/blkdev.h>
40#include <linux/delay.h> 39#include <linux/delay.h>
41#include <linux/interrupt.h> 40#include <linux/interrupt.h>
@@ -394,6 +393,9 @@ static ssize_t ahci_show_em_supported(struct device *dev,
394 * 393 *
395 * If inconsistent, config values are fixed up by this function. 394 * If inconsistent, config values are fixed up by this function.
396 * 395 *
396 * If it is not set already this function sets hpriv->start_engine to
397 * ahci_start_engine.
398 *
397 * LOCKING: 399 * LOCKING:
398 * None. 400 * None.
399 */ 401 */
@@ -500,6 +502,9 @@ void ahci_save_initial_config(struct device *dev,
500 hpriv->cap = cap; 502 hpriv->cap = cap;
501 hpriv->cap2 = cap2; 503 hpriv->cap2 = cap2;
502 hpriv->port_map = port_map; 504 hpriv->port_map = port_map;
505
506 if (!hpriv->start_engine)
507 hpriv->start_engine = ahci_start_engine;
503} 508}
504EXPORT_SYMBOL_GPL(ahci_save_initial_config); 509EXPORT_SYMBOL_GPL(ahci_save_initial_config);
505 510
@@ -766,7 +771,7 @@ static void ahci_start_port(struct ata_port *ap)
766 771
767 /* enable DMA */ 772 /* enable DMA */
768 if (!(hpriv->flags & AHCI_HFLAG_DELAY_ENGINE)) 773 if (!(hpriv->flags & AHCI_HFLAG_DELAY_ENGINE))
769 ahci_start_engine(ap); 774 hpriv->start_engine(ap);
770 775
771 /* turn on LEDs */ 776 /* turn on LEDs */
772 if (ap->flags & ATA_FLAG_EM) { 777 if (ap->flags & ATA_FLAG_EM) {
@@ -1032,12 +1037,13 @@ static ssize_t ahci_led_show(struct ata_port *ap, char *buf)
1032static ssize_t ahci_led_store(struct ata_port *ap, const char *buf, 1037static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
1033 size_t size) 1038 size_t size)
1034{ 1039{
1035 int state; 1040 unsigned int state;
1036 int pmp; 1041 int pmp;
1037 struct ahci_port_priv *pp = ap->private_data; 1042 struct ahci_port_priv *pp = ap->private_data;
1038 struct ahci_em_priv *emp; 1043 struct ahci_em_priv *emp;
1039 1044
1040 state = simple_strtoul(buf, NULL, 0); 1045 if (kstrtouint(buf, 0, &state) < 0)
1046 return -EINVAL;
1041 1047
1042 /* get the slot number from the message */ 1048 /* get the slot number from the message */
1043 pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8; 1049 pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8;
@@ -1234,7 +1240,7 @@ int ahci_kick_engine(struct ata_port *ap)
1234 1240
1235 /* restart engine */ 1241 /* restart engine */
1236 out_restart: 1242 out_restart:
1237 ahci_start_engine(ap); 1243 hpriv->start_engine(ap);
1238 return rc; 1244 return rc;
1239} 1245}
1240EXPORT_SYMBOL_GPL(ahci_kick_engine); 1246EXPORT_SYMBOL_GPL(ahci_kick_engine);
@@ -1387,8 +1393,8 @@ static int ahci_bad_pmp_check_ready(struct ata_link *link)
1387 return ata_check_ready(status); 1393 return ata_check_ready(status);
1388} 1394}
1389 1395
1390int ahci_pmp_retry_softreset(struct ata_link *link, unsigned int *class, 1396static int ahci_pmp_retry_softreset(struct ata_link *link, unsigned int *class,
1391 unsigned long deadline) 1397 unsigned long deadline)
1392{ 1398{
1393 struct ata_port *ap = link->ap; 1399 struct ata_port *ap = link->ap;
1394 void __iomem *port_mmio = ahci_port_base(ap); 1400 void __iomem *port_mmio = ahci_port_base(ap);
@@ -1426,6 +1432,7 @@ static int ahci_hardreset(struct ata_link *link, unsigned int *class,
1426 const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context); 1432 const unsigned long *timing = sata_ehc_deb_timing(&link->eh_context);
1427 struct ata_port *ap = link->ap; 1433 struct ata_port *ap = link->ap;
1428 struct ahci_port_priv *pp = ap->private_data; 1434 struct ahci_port_priv *pp = ap->private_data;
1435 struct ahci_host_priv *hpriv = ap->host->private_data;
1429 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; 1436 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
1430 struct ata_taskfile tf; 1437 struct ata_taskfile tf;
1431 bool online; 1438 bool online;
@@ -1443,7 +1450,7 @@ static int ahci_hardreset(struct ata_link *link, unsigned int *class,
1443 rc = sata_link_hardreset(link, timing, deadline, &online, 1450 rc = sata_link_hardreset(link, timing, deadline, &online,
1444 ahci_check_ready); 1451 ahci_check_ready);
1445 1452
1446 ahci_start_engine(ap); 1453 hpriv->start_engine(ap);
1447 1454
1448 if (online) 1455 if (online)
1449 *class = ahci_dev_classify(ap); 1456 *class = ahci_dev_classify(ap);
@@ -1629,7 +1636,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
1629 } 1636 }
1630 1637
1631 if (irq_stat & PORT_IRQ_UNK_FIS) { 1638 if (irq_stat & PORT_IRQ_UNK_FIS) {
1632 u32 *unk = (u32 *)(pp->rx_fis + RX_FIS_UNK); 1639 u32 *unk = pp->rx_fis + RX_FIS_UNK;
1633 1640
1634 active_ehi->err_mask |= AC_ERR_HSM; 1641 active_ehi->err_mask |= AC_ERR_HSM;
1635 active_ehi->action |= ATA_EH_RESET; 1642 active_ehi->action |= ATA_EH_RESET;
@@ -2007,10 +2014,12 @@ static void ahci_thaw(struct ata_port *ap)
2007 2014
2008void ahci_error_handler(struct ata_port *ap) 2015void ahci_error_handler(struct ata_port *ap)
2009{ 2016{
2017 struct ahci_host_priv *hpriv = ap->host->private_data;
2018
2010 if (!(ap->pflags & ATA_PFLAG_FROZEN)) { 2019 if (!(ap->pflags & ATA_PFLAG_FROZEN)) {
2011 /* restart engine */ 2020 /* restart engine */
2012 ahci_stop_engine(ap); 2021 ahci_stop_engine(ap);
2013 ahci_start_engine(ap); 2022 hpriv->start_engine(ap);
2014 } 2023 }
2015 2024
2016 sata_pmp_error_handler(ap); 2025 sata_pmp_error_handler(ap);
@@ -2031,6 +2040,7 @@ static void ahci_post_internal_cmd(struct ata_queued_cmd *qc)
2031 2040
2032static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep) 2041static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep)
2033{ 2042{
2043 struct ahci_host_priv *hpriv = ap->host->private_data;
2034 void __iomem *port_mmio = ahci_port_base(ap); 2044 void __iomem *port_mmio = ahci_port_base(ap);
2035 struct ata_device *dev = ap->link.device; 2045 struct ata_device *dev = ap->link.device;
2036 u32 devslp, dm, dito, mdat, deto; 2046 u32 devslp, dm, dito, mdat, deto;
@@ -2094,7 +2104,7 @@ static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep)
2094 PORT_DEVSLP_ADSE); 2104 PORT_DEVSLP_ADSE);
2095 writel(devslp, port_mmio + PORT_DEVSLP); 2105 writel(devslp, port_mmio + PORT_DEVSLP);
2096 2106
2097 ahci_start_engine(ap); 2107 hpriv->start_engine(ap);
2098 2108
2099 /* enable device sleep feature for the drive */ 2109 /* enable device sleep feature for the drive */
2100 err_mask = ata_dev_set_feature(dev, 2110 err_mask = ata_dev_set_feature(dev,
@@ -2106,6 +2116,7 @@ static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep)
2106 2116
2107static void ahci_enable_fbs(struct ata_port *ap) 2117static void ahci_enable_fbs(struct ata_port *ap)
2108{ 2118{
2119 struct ahci_host_priv *hpriv = ap->host->private_data;
2109 struct ahci_port_priv *pp = ap->private_data; 2120 struct ahci_port_priv *pp = ap->private_data;
2110 void __iomem *port_mmio = ahci_port_base(ap); 2121 void __iomem *port_mmio = ahci_port_base(ap);
2111 u32 fbs; 2122 u32 fbs;
@@ -2134,11 +2145,12 @@ static void ahci_enable_fbs(struct ata_port *ap)
2134 } else 2145 } else
2135 dev_err(ap->host->dev, "Failed to enable FBS\n"); 2146 dev_err(ap->host->dev, "Failed to enable FBS\n");
2136 2147
2137 ahci_start_engine(ap); 2148 hpriv->start_engine(ap);
2138} 2149}
2139 2150
2140static void ahci_disable_fbs(struct ata_port *ap) 2151static void ahci_disable_fbs(struct ata_port *ap)
2141{ 2152{
2153 struct ahci_host_priv *hpriv = ap->host->private_data;
2142 struct ahci_port_priv *pp = ap->private_data; 2154 struct ahci_port_priv *pp = ap->private_data;
2143 void __iomem *port_mmio = ahci_port_base(ap); 2155 void __iomem *port_mmio = ahci_port_base(ap);
2144 u32 fbs; 2156 u32 fbs;
@@ -2166,7 +2178,7 @@ static void ahci_disable_fbs(struct ata_port *ap)
2166 pp->fbs_enabled = false; 2178 pp->fbs_enabled = false;
2167 } 2179 }
2168 2180
2169 ahci_start_engine(ap); 2181 hpriv->start_engine(ap);
2170} 2182}
2171 2183
2172static void ahci_pmp_attach(struct ata_port *ap) 2184static void ahci_pmp_attach(struct ata_port *ap)
diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
new file mode 100644
index 000000000000..7cb3a85719c0
--- /dev/null
+++ b/drivers/ata/libahci_platform.c
@@ -0,0 +1,541 @@
1/*
2 * AHCI SATA platform library
3 *
4 * Copyright 2004-2005 Red Hat, Inc.
5 * Jeff Garzik <jgarzik@pobox.com>
6 * Copyright 2010 MontaVista Software, LLC.
7 * Anton Vorontsov <avorontsov@ru.mvista.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
12 * any later version.
13 */
14
15#include <linux/clk.h>
16#include <linux/kernel.h>
17#include <linux/gfp.h>
18#include <linux/module.h>
19#include <linux/pm.h>
20#include <linux/interrupt.h>
21#include <linux/device.h>
22#include <linux/platform_device.h>
23#include <linux/libata.h>
24#include <linux/ahci_platform.h>
25#include <linux/phy/phy.h>
26#include <linux/pm_runtime.h>
27#include "ahci.h"
28
29static void ahci_host_stop(struct ata_host *host);
30
31struct ata_port_operations ahci_platform_ops = {
32 .inherits = &ahci_ops,
33 .host_stop = ahci_host_stop,
34};
35EXPORT_SYMBOL_GPL(ahci_platform_ops);
36
37static struct scsi_host_template ahci_platform_sht = {
38 AHCI_SHT("ahci_platform"),
39};
40
41/**
42 * ahci_platform_enable_clks - Enable platform clocks
43 * @hpriv: host private area to store config values
44 *
45 * This function enables all the clks found in hpriv->clks, starting at
46 * index 0. If any clk fails to enable it disables all the clks already
47 * enabled in reverse order, and then returns an error.
48 *
49 * RETURNS:
50 * 0 on success otherwise a negative error code
51 */
52int ahci_platform_enable_clks(struct ahci_host_priv *hpriv)
53{
54 int c, rc;
55
56 for (c = 0; c < AHCI_MAX_CLKS && hpriv->clks[c]; c++) {
57 rc = clk_prepare_enable(hpriv->clks[c]);
58 if (rc)
59 goto disable_unprepare_clk;
60 }
61 return 0;
62
63disable_unprepare_clk:
64 while (--c >= 0)
65 clk_disable_unprepare(hpriv->clks[c]);
66 return rc;
67}
68EXPORT_SYMBOL_GPL(ahci_platform_enable_clks);
69
70/**
71 * ahci_platform_disable_clks - Disable platform clocks
72 * @hpriv: host private area to store config values
73 *
74 * This function disables all the clks found in hpriv->clks, in reverse
75 * order of ahci_platform_enable_clks (starting at the end of the array).
76 */
77void ahci_platform_disable_clks(struct ahci_host_priv *hpriv)
78{
79 int c;
80
81 for (c = AHCI_MAX_CLKS - 1; c >= 0; c--)
82 if (hpriv->clks[c])
83 clk_disable_unprepare(hpriv->clks[c]);
84}
85EXPORT_SYMBOL_GPL(ahci_platform_disable_clks);
86
87/**
88 * ahci_platform_enable_resources - Enable platform resources
89 * @hpriv: host private area to store config values
90 *
91 * This function enables all ahci_platform managed resources in the
92 * following order:
93 * 1) Regulator
94 * 2) Clocks (through ahci_platform_enable_clks)
95 * 3) Phy
96 *
97 * If resource enabling fails at any point the previous enabled resources
98 * are disabled in reverse order.
99 *
100 * RETURNS:
101 * 0 on success otherwise a negative error code
102 */
103int ahci_platform_enable_resources(struct ahci_host_priv *hpriv)
104{
105 int rc;
106
107 if (hpriv->target_pwr) {
108 rc = regulator_enable(hpriv->target_pwr);
109 if (rc)
110 return rc;
111 }
112
113 rc = ahci_platform_enable_clks(hpriv);
114 if (rc)
115 goto disable_regulator;
116
117 if (hpriv->phy) {
118 rc = phy_init(hpriv->phy);
119 if (rc)
120 goto disable_clks;
121
122 rc = phy_power_on(hpriv->phy);
123 if (rc) {
124 phy_exit(hpriv->phy);
125 goto disable_clks;
126 }
127 }
128
129 return 0;
130
131disable_clks:
132 ahci_platform_disable_clks(hpriv);
133
134disable_regulator:
135 if (hpriv->target_pwr)
136 regulator_disable(hpriv->target_pwr);
137 return rc;
138}
139EXPORT_SYMBOL_GPL(ahci_platform_enable_resources);
140
141/**
142 * ahci_platform_disable_resources - Disable platform resources
143 * @hpriv: host private area to store config values
144 *
145 * This function disables all ahci_platform managed resources in the
146 * following order:
147 * 1) Phy
148 * 2) Clocks (through ahci_platform_disable_clks)
149 * 3) Regulator
150 */
151void ahci_platform_disable_resources(struct ahci_host_priv *hpriv)
152{
153 if (hpriv->phy) {
154 phy_power_off(hpriv->phy);
155 phy_exit(hpriv->phy);
156 }
157
158 ahci_platform_disable_clks(hpriv);
159
160 if (hpriv->target_pwr)
161 regulator_disable(hpriv->target_pwr);
162}
163EXPORT_SYMBOL_GPL(ahci_platform_disable_resources);
164
165static void ahci_platform_put_resources(struct device *dev, void *res)
166{
167 struct ahci_host_priv *hpriv = res;
168 int c;
169
170 if (hpriv->got_runtime_pm) {
171 pm_runtime_put_sync(dev);
172 pm_runtime_disable(dev);
173 }
174
175 for (c = 0; c < AHCI_MAX_CLKS && hpriv->clks[c]; c++)
176 clk_put(hpriv->clks[c]);
177}
178
179/**
180 * ahci_platform_get_resources - Get platform resources
181 * @pdev: platform device to get resources for
182 *
183 * This function allocates an ahci_host_priv struct, and gets the following
184 * resources, storing a reference to them inside the returned struct:
185 *
186 * 1) mmio registers (IORESOURCE_MEM 0, mandatory)
187 * 2) regulator for controlling the targets power (optional)
188 * 3) 0 - AHCI_MAX_CLKS clocks, as specified in the devs devicetree node,
189 * or for non devicetree enabled platforms a single clock
190 * 4) phy (optional)
191 *
192 * RETURNS:
193 * The allocated ahci_host_priv on success, otherwise an ERR_PTR value
194 */
195struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev)
196{
197 struct device *dev = &pdev->dev;
198 struct ahci_host_priv *hpriv;
199 struct clk *clk;
200 int i, rc = -ENOMEM;
201
202 if (!devres_open_group(dev, NULL, GFP_KERNEL))
203 return ERR_PTR(-ENOMEM);
204
205 hpriv = devres_alloc(ahci_platform_put_resources, sizeof(*hpriv),
206 GFP_KERNEL);
207 if (!hpriv)
208 goto err_out;
209
210 devres_add(dev, hpriv);
211
212 hpriv->mmio = devm_ioremap_resource(dev,
213 platform_get_resource(pdev, IORESOURCE_MEM, 0));
214 if (IS_ERR(hpriv->mmio)) {
215 dev_err(dev, "no mmio space\n");
216 rc = PTR_ERR(hpriv->mmio);
217 goto err_out;
218 }
219
220 hpriv->target_pwr = devm_regulator_get_optional(dev, "target");
221 if (IS_ERR(hpriv->target_pwr)) {
222 rc = PTR_ERR(hpriv->target_pwr);
223 if (rc == -EPROBE_DEFER)
224 goto err_out;
225 hpriv->target_pwr = NULL;
226 }
227
228 for (i = 0; i < AHCI_MAX_CLKS; i++) {
229 /*
230 * For now we must use clk_get(dev, NULL) for the first clock,
231 * because some platforms (da850, spear13xx) are not yet
232 * converted to use devicetree for clocks. For new platforms
233 * this is equivalent to of_clk_get(dev->of_node, 0).
234 */
235 if (i == 0)
236 clk = clk_get(dev, NULL);
237 else
238 clk = of_clk_get(dev->of_node, i);
239
240 if (IS_ERR(clk)) {
241 rc = PTR_ERR(clk);
242 if (rc == -EPROBE_DEFER)
243 goto err_out;
244 break;
245 }
246 hpriv->clks[i] = clk;
247 }
248
249 hpriv->phy = devm_phy_get(dev, "sata-phy");
250 if (IS_ERR(hpriv->phy)) {
251 rc = PTR_ERR(hpriv->phy);
252 switch (rc) {
253 case -ENODEV:
254 case -ENOSYS:
255 /* continue normally */
256 hpriv->phy = NULL;
257 break;
258
259 case -EPROBE_DEFER:
260 goto err_out;
261
262 default:
263 dev_err(dev, "couldn't get sata-phy\n");
264 goto err_out;
265 }
266 }
267
268 pm_runtime_enable(dev);
269 pm_runtime_get_sync(dev);
270 hpriv->got_runtime_pm = true;
271
272 devres_remove_group(dev, NULL);
273 return hpriv;
274
275err_out:
276 devres_release_group(dev, NULL);
277 return ERR_PTR(rc);
278}
279EXPORT_SYMBOL_GPL(ahci_platform_get_resources);
280
281/**
282 * ahci_platform_init_host - Bring up an ahci-platform host
283 * @pdev: platform device pointer for the host
284 * @hpriv: ahci-host private data for the host
285 * @pi_template: template for the ata_port_info to use
286 * @force_port_map: param passed to ahci_save_initial_config
287 * @mask_port_map: param passed to ahci_save_initial_config
288 *
289 * This function does all the usual steps needed to bring up an
290 * ahci-platform host, note any necessary resources (ie clks, phy, etc.)
291 * must be initialized / enabled before calling this.
292 *
293 * RETURNS:
294 * 0 on success otherwise a negative error code
295 */
296int ahci_platform_init_host(struct platform_device *pdev,
297 struct ahci_host_priv *hpriv,
298 const struct ata_port_info *pi_template,
299 unsigned int force_port_map,
300 unsigned int mask_port_map)
301{
302 struct device *dev = &pdev->dev;
303 struct ata_port_info pi = *pi_template;
304 const struct ata_port_info *ppi[] = { &pi, NULL };
305 struct ata_host *host;
306 int i, irq, n_ports, rc;
307
308 irq = platform_get_irq(pdev, 0);
309 if (irq <= 0) {
310 dev_err(dev, "no irq\n");
311 return -EINVAL;
312 }
313
314 /* prepare host */
315 hpriv->flags |= (unsigned long)pi.private_data;
316
317 ahci_save_initial_config(dev, hpriv, force_port_map, mask_port_map);
318
319 if (hpriv->cap & HOST_CAP_NCQ)
320 pi.flags |= ATA_FLAG_NCQ;
321
322 if (hpriv->cap & HOST_CAP_PMP)
323 pi.flags |= ATA_FLAG_PMP;
324
325 ahci_set_em_messages(hpriv, &pi);
326
327 /* CAP.NP sometimes indicate the index of the last enabled
328 * port, at other times, that of the last possible port, so
329 * determining the maximum port number requires looking at
330 * both CAP.NP and port_map.
331 */
332 n_ports = max(ahci_nr_ports(hpriv->cap), fls(hpriv->port_map));
333
334 host = ata_host_alloc_pinfo(dev, ppi, n_ports);
335 if (!host)
336 return -ENOMEM;
337
338 host->private_data = hpriv;
339
340 if (!(hpriv->cap & HOST_CAP_SSS) || ahci_ignore_sss)
341 host->flags |= ATA_HOST_PARALLEL_SCAN;
342 else
343 dev_info(dev, "SSS flag set, parallel bus scan disabled\n");
344
345 if (pi.flags & ATA_FLAG_EM)
346 ahci_reset_em(host);
347
348 for (i = 0; i < host->n_ports; i++) {
349 struct ata_port *ap = host->ports[i];
350
351 ata_port_desc(ap, "mmio %pR",
352 platform_get_resource(pdev, IORESOURCE_MEM, 0));
353 ata_port_desc(ap, "port 0x%x", 0x100 + ap->port_no * 0x80);
354
355 /* set enclosure management message type */
356 if (ap->flags & ATA_FLAG_EM)
357 ap->em_message_type = hpriv->em_msg_type;
358
359 /* disabled/not-implemented port */
360 if (!(hpriv->port_map & (1 << i)))
361 ap->ops = &ata_dummy_port_ops;
362 }
363
364 rc = ahci_reset_controller(host);
365 if (rc)
366 return rc;
367
368 ahci_init_controller(host);
369 ahci_print_info(host, "platform");
370
371 return ata_host_activate(host, irq, ahci_interrupt, IRQF_SHARED,
372 &ahci_platform_sht);
373}
374EXPORT_SYMBOL_GPL(ahci_platform_init_host);
375
376static void ahci_host_stop(struct ata_host *host)
377{
378 struct device *dev = host->dev;
379 struct ahci_platform_data *pdata = dev_get_platdata(dev);
380 struct ahci_host_priv *hpriv = host->private_data;
381
382 if (pdata && pdata->exit)
383 pdata->exit(dev);
384
385 ahci_platform_disable_resources(hpriv);
386}
387
388#ifdef CONFIG_PM_SLEEP
389/**
390 * ahci_platform_suspend_host - Suspend an ahci-platform host
391 * @dev: device pointer for the host
392 *
393 * This function does all the usual steps needed to suspend an
394 * ahci-platform host, note any necessary resources (ie clks, phy, etc.)
395 * must be disabled after calling this.
396 *
397 * RETURNS:
398 * 0 on success otherwise a negative error code
399 */
400int ahci_platform_suspend_host(struct device *dev)
401{
402 struct ata_host *host = dev_get_drvdata(dev);
403 struct ahci_host_priv *hpriv = host->private_data;
404 void __iomem *mmio = hpriv->mmio;
405 u32 ctl;
406
407 if (hpriv->flags & AHCI_HFLAG_NO_SUSPEND) {
408 dev_err(dev, "firmware update required for suspend/resume\n");
409 return -EIO;
410 }
411
412 /*
413 * AHCI spec rev1.1 section 8.3.3:
414 * Software must disable interrupts prior to requesting a
415 * transition of the HBA to D3 state.
416 */
417 ctl = readl(mmio + HOST_CTL);
418 ctl &= ~HOST_IRQ_EN;
419 writel(ctl, mmio + HOST_CTL);
420 readl(mmio + HOST_CTL); /* flush */
421
422 return ata_host_suspend(host, PMSG_SUSPEND);
423}
424EXPORT_SYMBOL_GPL(ahci_platform_suspend_host);
425
426/**
427 * ahci_platform_resume_host - Resume an ahci-platform host
428 * @dev: device pointer for the host
429 *
430 * This function does all the usual steps needed to resume an ahci-platform
431 * host, note any necessary resources (ie clks, phy, etc.) must be
432 * initialized / enabled before calling this.
433 *
434 * RETURNS:
435 * 0 on success otherwise a negative error code
436 */
437int ahci_platform_resume_host(struct device *dev)
438{
439 struct ata_host *host = dev_get_drvdata(dev);
440 int rc;
441
442 if (dev->power.power_state.event == PM_EVENT_SUSPEND) {
443 rc = ahci_reset_controller(host);
444 if (rc)
445 return rc;
446
447 ahci_init_controller(host);
448 }
449
450 ata_host_resume(host);
451
452 return 0;
453}
454EXPORT_SYMBOL_GPL(ahci_platform_resume_host);
455
456/**
457 * ahci_platform_suspend - Suspend an ahci-platform device
458 * @dev: the platform device to suspend
459 *
460 * This function suspends the host associated with the device, followed by
461 * disabling all the resources of the device.
462 *
463 * RETURNS:
464 * 0 on success otherwise a negative error code
465 */
466int ahci_platform_suspend(struct device *dev)
467{
468 struct ahci_platform_data *pdata = dev_get_platdata(dev);
469 struct ata_host *host = dev_get_drvdata(dev);
470 struct ahci_host_priv *hpriv = host->private_data;
471 int rc;
472
473 rc = ahci_platform_suspend_host(dev);
474 if (rc)
475 return rc;
476
477 if (pdata && pdata->suspend) {
478 rc = pdata->suspend(dev);
479 if (rc)
480 goto resume_host;
481 }
482
483 ahci_platform_disable_resources(hpriv);
484
485 return 0;
486
487resume_host:
488 ahci_platform_resume_host(dev);
489 return rc;
490}
491EXPORT_SYMBOL_GPL(ahci_platform_suspend);
492
493/**
494 * ahci_platform_resume - Resume an ahci-platform device
495 * @dev: the platform device to resume
496 *
497 * This function enables all the resources of the device followed by
498 * resuming the host associated with the device.
499 *
500 * RETURNS:
501 * 0 on success otherwise a negative error code
502 */
503int ahci_platform_resume(struct device *dev)
504{
505 struct ahci_platform_data *pdata = dev_get_platdata(dev);
506 struct ata_host *host = dev_get_drvdata(dev);
507 struct ahci_host_priv *hpriv = host->private_data;
508 int rc;
509
510 rc = ahci_platform_enable_resources(hpriv);
511 if (rc)
512 return rc;
513
514 if (pdata && pdata->resume) {
515 rc = pdata->resume(dev);
516 if (rc)
517 goto disable_resources;
518 }
519
520 rc = ahci_platform_resume_host(dev);
521 if (rc)
522 goto disable_resources;
523
524 /* We resumed so update PM runtime state */
525 pm_runtime_disable(dev);
526 pm_runtime_set_active(dev);
527 pm_runtime_enable(dev);
528
529 return 0;
530
531disable_resources:
532 ahci_platform_disable_resources(hpriv);
533
534 return rc;
535}
536EXPORT_SYMBOL_GPL(ahci_platform_resume);
537#endif
538
539MODULE_DESCRIPTION("AHCI SATA platform library");
540MODULE_AUTHOR("Anton Vorontsov <avorontsov@ru.mvista.com>");
541MODULE_LICENSE("GPL");
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 9e69a5308693..b4f7cc2522d9 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -835,6 +835,7 @@ void ata_acpi_on_resume(struct ata_port *ap)
835 ata_for_each_dev(dev, &ap->link, ALL) { 835 ata_for_each_dev(dev, &ap->link, ALL) {
836 ata_acpi_clear_gtf(dev); 836 ata_acpi_clear_gtf(dev);
837 if (ata_dev_enabled(dev) && 837 if (ata_dev_enabled(dev) &&
838 ata_dev_acpi_handle(dev) &&
838 ata_dev_get_GTF(dev, NULL) >= 0) 839 ata_dev_get_GTF(dev, NULL) >= 0)
839 dev->flags |= ATA_DFLAG_ACPI_PENDING; 840 dev->flags |= ATA_DFLAG_ACPI_PENDING;
840 } 841 }
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 8cb2522d592a..34406f7fdd7a 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5352,22 +5352,17 @@ bool ata_link_offline(struct ata_link *link)
5352} 5352}
5353 5353
5354#ifdef CONFIG_PM 5354#ifdef CONFIG_PM
5355static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg, 5355static void ata_port_request_pm(struct ata_port *ap, pm_message_t mesg,
5356 unsigned int action, unsigned int ehi_flags, 5356 unsigned int action, unsigned int ehi_flags,
5357 int *async) 5357 bool async)
5358{ 5358{
5359 struct ata_link *link; 5359 struct ata_link *link;
5360 unsigned long flags; 5360 unsigned long flags;
5361 int rc = 0;
5362 5361
5363 /* Previous resume operation might still be in 5362 /* Previous resume operation might still be in
5364 * progress. Wait for PM_PENDING to clear. 5363 * progress. Wait for PM_PENDING to clear.
5365 */ 5364 */
5366 if (ap->pflags & ATA_PFLAG_PM_PENDING) { 5365 if (ap->pflags & ATA_PFLAG_PM_PENDING) {
5367 if (async) {
5368 *async = -EAGAIN;
5369 return 0;
5370 }
5371 ata_port_wait_eh(ap); 5366 ata_port_wait_eh(ap);
5372 WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING); 5367 WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING);
5373 } 5368 }
@@ -5376,11 +5371,6 @@ static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg,
5376 spin_lock_irqsave(ap->lock, flags); 5371 spin_lock_irqsave(ap->lock, flags);
5377 5372
5378 ap->pm_mesg = mesg; 5373 ap->pm_mesg = mesg;
5379 if (async)
5380 ap->pm_result = async;
5381 else
5382 ap->pm_result = &rc;
5383
5384 ap->pflags |= ATA_PFLAG_PM_PENDING; 5374 ap->pflags |= ATA_PFLAG_PM_PENDING;
5385 ata_for_each_link(link, ap, HOST_FIRST) { 5375 ata_for_each_link(link, ap, HOST_FIRST) {
5386 link->eh_info.action |= action; 5376 link->eh_info.action |= action;
@@ -5391,87 +5381,81 @@ static int ata_port_request_pm(struct ata_port *ap, pm_message_t mesg,
5391 5381
5392 spin_unlock_irqrestore(ap->lock, flags); 5382 spin_unlock_irqrestore(ap->lock, flags);
5393 5383
5394 /* wait and check result */
5395 if (!async) { 5384 if (!async) {
5396 ata_port_wait_eh(ap); 5385 ata_port_wait_eh(ap);
5397 WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING); 5386 WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING);
5398 } 5387 }
5399
5400 return rc;
5401} 5388}
5402 5389
5403static int __ata_port_suspend_common(struct ata_port *ap, pm_message_t mesg, int *async) 5390/*
5391 * On some hardware, device fails to respond after spun down for suspend. As
5392 * the device won't be used before being resumed, we don't need to touch the
5393 * device. Ask EH to skip the usual stuff and proceed directly to suspend.
5394 *
5395 * http://thread.gmane.org/gmane.linux.ide/46764
5396 */
5397static const unsigned int ata_port_suspend_ehi = ATA_EHI_QUIET
5398 | ATA_EHI_NO_AUTOPSY
5399 | ATA_EHI_NO_RECOVERY;
5400
5401static void ata_port_suspend(struct ata_port *ap, pm_message_t mesg)
5404{ 5402{
5405 /* 5403 ata_port_request_pm(ap, mesg, 0, ata_port_suspend_ehi, false);
5406 * On some hardware, device fails to respond after spun down
5407 * for suspend. As the device won't be used before being
5408 * resumed, we don't need to touch the device. Ask EH to skip
5409 * the usual stuff and proceed directly to suspend.
5410 *
5411 * http://thread.gmane.org/gmane.linux.ide/46764
5412 */
5413 unsigned int ehi_flags = ATA_EHI_QUIET | ATA_EHI_NO_AUTOPSY |
5414 ATA_EHI_NO_RECOVERY;
5415 return ata_port_request_pm(ap, mesg, 0, ehi_flags, async);
5416} 5404}
5417 5405
5418static int ata_port_suspend_common(struct device *dev, pm_message_t mesg) 5406static void ata_port_suspend_async(struct ata_port *ap, pm_message_t mesg)
5419{ 5407{
5420 struct ata_port *ap = to_ata_port(dev); 5408 ata_port_request_pm(ap, mesg, 0, ata_port_suspend_ehi, true);
5421
5422 return __ata_port_suspend_common(ap, mesg, NULL);
5423} 5409}
5424 5410
5425static int ata_port_suspend(struct device *dev) 5411static int ata_port_pm_suspend(struct device *dev)
5426{ 5412{
5413 struct ata_port *ap = to_ata_port(dev);
5414
5427 if (pm_runtime_suspended(dev)) 5415 if (pm_runtime_suspended(dev))
5428 return 0; 5416 return 0;
5429 5417
5430 return ata_port_suspend_common(dev, PMSG_SUSPEND); 5418 ata_port_suspend(ap, PMSG_SUSPEND);
5419 return 0;
5431} 5420}
5432 5421
5433static int ata_port_do_freeze(struct device *dev) 5422static int ata_port_pm_freeze(struct device *dev)
5434{ 5423{
5424 struct ata_port *ap = to_ata_port(dev);
5425
5435 if (pm_runtime_suspended(dev)) 5426 if (pm_runtime_suspended(dev))
5436 return 0; 5427 return 0;
5437 5428
5438 return ata_port_suspend_common(dev, PMSG_FREEZE); 5429 ata_port_suspend(ap, PMSG_FREEZE);
5430 return 0;
5439} 5431}
5440 5432
5441static int ata_port_poweroff(struct device *dev) 5433static int ata_port_pm_poweroff(struct device *dev)
5442{ 5434{
5443 return ata_port_suspend_common(dev, PMSG_HIBERNATE); 5435 ata_port_suspend(to_ata_port(dev), PMSG_HIBERNATE);
5436 return 0;
5444} 5437}
5445 5438
5446static int __ata_port_resume_common(struct ata_port *ap, pm_message_t mesg, 5439static const unsigned int ata_port_resume_ehi = ATA_EHI_NO_AUTOPSY
5447 int *async) 5440 | ATA_EHI_QUIET;
5448{
5449 int rc;
5450 5441
5451 rc = ata_port_request_pm(ap, mesg, ATA_EH_RESET, 5442static void ata_port_resume(struct ata_port *ap, pm_message_t mesg)
5452 ATA_EHI_NO_AUTOPSY | ATA_EHI_QUIET, async); 5443{
5453 return rc; 5444 ata_port_request_pm(ap, mesg, ATA_EH_RESET, ata_port_resume_ehi, false);
5454} 5445}
5455 5446
5456static int ata_port_resume_common(struct device *dev, pm_message_t mesg) 5447static void ata_port_resume_async(struct ata_port *ap, pm_message_t mesg)
5457{ 5448{
5458 struct ata_port *ap = to_ata_port(dev); 5449 ata_port_request_pm(ap, mesg, ATA_EH_RESET, ata_port_resume_ehi, true);
5459
5460 return __ata_port_resume_common(ap, mesg, NULL);
5461} 5450}
5462 5451
5463static int ata_port_resume(struct device *dev) 5452static int ata_port_pm_resume(struct device *dev)
5464{ 5453{
5465 int rc; 5454 ata_port_resume_async(to_ata_port(dev), PMSG_RESUME);
5466 5455 pm_runtime_disable(dev);
5467 rc = ata_port_resume_common(dev, PMSG_RESUME); 5456 pm_runtime_set_active(dev);
5468 if (!rc) { 5457 pm_runtime_enable(dev);
5469 pm_runtime_disable(dev); 5458 return 0;
5470 pm_runtime_set_active(dev);
5471 pm_runtime_enable(dev);
5472 }
5473
5474 return rc;
5475} 5459}
5476 5460
5477/* 5461/*
@@ -5500,21 +5484,23 @@ static int ata_port_runtime_idle(struct device *dev)
5500 5484
5501static int ata_port_runtime_suspend(struct device *dev) 5485static int ata_port_runtime_suspend(struct device *dev)
5502{ 5486{
5503 return ata_port_suspend_common(dev, PMSG_AUTO_SUSPEND); 5487 ata_port_suspend(to_ata_port(dev), PMSG_AUTO_SUSPEND);
5488 return 0;
5504} 5489}
5505 5490
5506static int ata_port_runtime_resume(struct device *dev) 5491static int ata_port_runtime_resume(struct device *dev)
5507{ 5492{
5508 return ata_port_resume_common(dev, PMSG_AUTO_RESUME); 5493 ata_port_resume(to_ata_port(dev), PMSG_AUTO_RESUME);
5494 return 0;
5509} 5495}
5510 5496
5511static const struct dev_pm_ops ata_port_pm_ops = { 5497static const struct dev_pm_ops ata_port_pm_ops = {
5512 .suspend = ata_port_suspend, 5498 .suspend = ata_port_pm_suspend,
5513 .resume = ata_port_resume, 5499 .resume = ata_port_pm_resume,
5514 .freeze = ata_port_do_freeze, 5500 .freeze = ata_port_pm_freeze,
5515 .thaw = ata_port_resume, 5501 .thaw = ata_port_pm_resume,
5516 .poweroff = ata_port_poweroff, 5502 .poweroff = ata_port_pm_poweroff,
5517 .restore = ata_port_resume, 5503 .restore = ata_port_pm_resume,
5518 5504
5519 .runtime_suspend = ata_port_runtime_suspend, 5505 .runtime_suspend = ata_port_runtime_suspend,
5520 .runtime_resume = ata_port_runtime_resume, 5506 .runtime_resume = ata_port_runtime_resume,
@@ -5526,18 +5512,17 @@ static const struct dev_pm_ops ata_port_pm_ops = {
5526 * level. sas suspend/resume is async to allow parallel port recovery 5512 * level. sas suspend/resume is async to allow parallel port recovery
5527 * since sas has multiple ata_port instances per Scsi_Host. 5513 * since sas has multiple ata_port instances per Scsi_Host.
5528 */ 5514 */
5529int ata_sas_port_async_suspend(struct ata_port *ap, int *async) 5515void ata_sas_port_suspend(struct ata_port *ap)
5530{ 5516{
5531 return __ata_port_suspend_common(ap, PMSG_SUSPEND, async); 5517 ata_port_suspend_async(ap, PMSG_SUSPEND);
5532} 5518}
5533EXPORT_SYMBOL_GPL(ata_sas_port_async_suspend); 5519EXPORT_SYMBOL_GPL(ata_sas_port_suspend);
5534 5520
5535int ata_sas_port_async_resume(struct ata_port *ap, int *async) 5521void ata_sas_port_resume(struct ata_port *ap)
5536{ 5522{
5537 return __ata_port_resume_common(ap, PMSG_RESUME, async); 5523 ata_port_resume_async(ap, PMSG_RESUME);
5538} 5524}
5539EXPORT_SYMBOL_GPL(ata_sas_port_async_resume); 5525EXPORT_SYMBOL_GPL(ata_sas_port_resume);
5540
5541 5526
5542/** 5527/**
5543 * ata_host_suspend - suspend host 5528 * ata_host_suspend - suspend host
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 6d8757008318..6760fc4e85b8 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -95,12 +95,13 @@ enum {
95 * represents timeout for that try. The first try can be soft or 95 * represents timeout for that try. The first try can be soft or
96 * hardreset. All others are hardreset if available. In most cases 96 * hardreset. All others are hardreset if available. In most cases
97 * the first reset w/ 10sec timeout should succeed. Following entries 97 * the first reset w/ 10sec timeout should succeed. Following entries
98 * are mostly for error handling, hotplug and retarded devices. 98 * are mostly for error handling, hotplug and those outlier devices that
99 * take an exceptionally long time to recover from reset.
99 */ 100 */
100static const unsigned long ata_eh_reset_timeouts[] = { 101static const unsigned long ata_eh_reset_timeouts[] = {
101 10000, /* most drives spin up by 10sec */ 102 10000, /* most drives spin up by 10sec */
102 10000, /* > 99% working drives spin up before 20sec */ 103 10000, /* > 99% working drives spin up before 20sec */
103 35000, /* give > 30 secs of idleness for retarded devices */ 104 35000, /* give > 30 secs of idleness for outlier devices */
104 5000, /* and sweet one last chance */ 105 5000, /* and sweet one last chance */
105 ULONG_MAX, /* > 1 min has elapsed, give up */ 106 ULONG_MAX, /* > 1 min has elapsed, give up */
106}; 107};
@@ -4069,7 +4070,7 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap)
4069 4070
4070 ata_acpi_set_state(ap, ap->pm_mesg); 4071 ata_acpi_set_state(ap, ap->pm_mesg);
4071 out: 4072 out:
4072 /* report result */ 4073 /* update the flags */
4073 spin_lock_irqsave(ap->lock, flags); 4074 spin_lock_irqsave(ap->lock, flags);
4074 4075
4075 ap->pflags &= ~ATA_PFLAG_PM_PENDING; 4076 ap->pflags &= ~ATA_PFLAG_PM_PENDING;
@@ -4078,11 +4079,6 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap)
4078 else if (ap->pflags & ATA_PFLAG_FROZEN) 4079 else if (ap->pflags & ATA_PFLAG_FROZEN)
4079 ata_port_schedule_eh(ap); 4080 ata_port_schedule_eh(ap);
4080 4081
4081 if (ap->pm_result) {
4082 *ap->pm_result = rc;
4083 ap->pm_result = NULL;
4084 }
4085
4086 spin_unlock_irqrestore(ap->lock, flags); 4082 spin_unlock_irqrestore(ap->lock, flags);
4087 4083
4088 return; 4084 return;
@@ -4134,13 +4130,9 @@ static void ata_eh_handle_port_resume(struct ata_port *ap)
4134 /* tell ACPI that we're resuming */ 4130 /* tell ACPI that we're resuming */
4135 ata_acpi_on_resume(ap); 4131 ata_acpi_on_resume(ap);
4136 4132
4137 /* report result */ 4133 /* update the flags */
4138 spin_lock_irqsave(ap->lock, flags); 4134 spin_lock_irqsave(ap->lock, flags);
4139 ap->pflags &= ~(ATA_PFLAG_PM_PENDING | ATA_PFLAG_SUSPENDED); 4135 ap->pflags &= ~(ATA_PFLAG_PM_PENDING | ATA_PFLAG_SUSPENDED);
4140 if (ap->pm_result) {
4141 *ap->pm_result = rc;
4142 ap->pm_result = NULL;
4143 }
4144 spin_unlock_irqrestore(ap->lock, flags); 4136 spin_unlock_irqrestore(ap->lock, flags);
4145} 4137}
4146#endif /* CONFIG_PM */ 4138#endif /* CONFIG_PM */
diff --git a/drivers/ata/libata-zpodd.c b/drivers/ata/libata-zpodd.c
index 88949c6d55dd..f3a65a3140d3 100644
--- a/drivers/ata/libata-zpodd.c
+++ b/drivers/ata/libata-zpodd.c
@@ -85,21 +85,6 @@ static enum odd_mech_type zpodd_get_mech_type(struct ata_device *dev)
85 return ODD_MECH_TYPE_UNSUPPORTED; 85 return ODD_MECH_TYPE_UNSUPPORTED;
86} 86}
87 87
88static bool odd_can_poweroff(struct ata_device *ata_dev)
89{
90 acpi_handle handle;
91 struct acpi_device *acpi_dev;
92
93 handle = ata_dev_acpi_handle(ata_dev);
94 if (!handle)
95 return false;
96
97 if (acpi_bus_get_device(handle, &acpi_dev))
98 return false;
99
100 return acpi_device_can_poweroff(acpi_dev);
101}
102
103/* Test if ODD is zero power ready by sense code */ 88/* Test if ODD is zero power ready by sense code */
104static bool zpready(struct ata_device *dev) 89static bool zpready(struct ata_device *dev)
105{ 90{
@@ -267,13 +252,11 @@ static void ata_acpi_remove_pm_notifier(struct ata_device *dev)
267 252
268void zpodd_init(struct ata_device *dev) 253void zpodd_init(struct ata_device *dev)
269{ 254{
255 struct acpi_device *adev = ACPI_COMPANION(&dev->tdev);
270 enum odd_mech_type mech_type; 256 enum odd_mech_type mech_type;
271 struct zpodd *zpodd; 257 struct zpodd *zpodd;
272 258
273 if (dev->zpodd) 259 if (dev->zpodd || !adev || !acpi_device_can_poweroff(adev))
274 return;
275
276 if (!odd_can_poweroff(dev))
277 return; 260 return;
278 261
279 mech_type = zpodd_get_mech_type(dev); 262 mech_type = zpodd_get_mech_type(dev);
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c
index 62c9ac80c6e9..5108b8744dce 100644
--- a/drivers/ata/pata_acpi.c
+++ b/drivers/ata/pata_acpi.c
@@ -7,7 +7,6 @@
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/pci.h> 9#include <linux/pci.h>
10#include <linux/init.h>
11#include <linux/blkdev.h> 10#include <linux/blkdev.h>
12#include <linux/delay.h> 11#include <linux/delay.h>
13#include <linux/device.h> 12#include <linux/device.h>
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c
index d23e2b3ca0b6..1206fa6b62ca 100644
--- a/drivers/ata/pata_amd.c
+++ b/drivers/ata/pata_amd.c
@@ -17,7 +17,6 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/pci.h> 19#include <linux/pci.h>
20#include <linux/init.h>
21#include <linux/blkdev.h> 20#include <linux/blkdev.h>
22#include <linux/delay.h> 21#include <linux/delay.h>
23#include <scsi/scsi_host.h> 22#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
index 73492dd4a4bc..6fac524c2f50 100644
--- a/drivers/ata/pata_arasan_cf.c
+++ b/drivers/ata/pata_arasan_cf.c
@@ -356,7 +356,7 @@ static void cf_exit(struct arasan_cf_dev *acdev)
356 356
357static void dma_callback(void *dev) 357static void dma_callback(void *dev)
358{ 358{
359 struct arasan_cf_dev *acdev = (struct arasan_cf_dev *) dev; 359 struct arasan_cf_dev *acdev = dev;
360 360
361 complete(&acdev->dma_completion); 361 complete(&acdev->dma_completion);
362} 362}
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c
index 1581dee2967a..3aa4e655e3c6 100644
--- a/drivers/ata/pata_artop.c
+++ b/drivers/ata/pata_artop.c
@@ -19,7 +19,6 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/pci.h> 21#include <linux/pci.h>
22#include <linux/init.h>
23#include <linux/blkdev.h> 22#include <linux/blkdev.h>
24#include <linux/delay.h> 23#include <linux/delay.h>
25#include <linux/device.h> 24#include <linux/device.h>
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c
index d63ee8f41a4f..e9c87274a781 100644
--- a/drivers/ata/pata_at91.c
+++ b/drivers/ata/pata_at91.c
@@ -18,7 +18,6 @@
18 18
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/init.h>
22#include <linux/blkdev.h> 21#include <linux/blkdev.h>
23#include <linux/gfp.h> 22#include <linux/gfp.h>
24#include <scsi/scsi_host.h> 23#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c
index 24e51056ac26..30fa4ca4cef6 100644
--- a/drivers/ata/pata_atiixp.c
+++ b/drivers/ata/pata_atiixp.c
@@ -15,7 +15,6 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/pci.h> 17#include <linux/pci.h>
18#include <linux/init.h>
19#include <linux/blkdev.h> 18#include <linux/blkdev.h>
20#include <linux/delay.h> 19#include <linux/delay.h>
21#include <scsi/scsi_host.h> 20#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_atp867x.c b/drivers/ata/pata_atp867x.c
index 2ca5026f2c15..7e73a0f1e323 100644
--- a/drivers/ata/pata_atp867x.c
+++ b/drivers/ata/pata_atp867x.c
@@ -29,7 +29,6 @@
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/pci.h> 31#include <linux/pci.h>
32#include <linux/init.h>
33#include <linux/blkdev.h> 32#include <linux/blkdev.h>
34#include <linux/delay.h> 33#include <linux/delay.h>
35#include <linux/device.h> 34#include <linux/device.h>
diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c
index 8fb69e5ca1b7..57f1be64dbf2 100644
--- a/drivers/ata/pata_cmd640.c
+++ b/drivers/ata/pata_cmd640.c
@@ -15,7 +15,6 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/pci.h> 17#include <linux/pci.h>
18#include <linux/init.h>
19#include <linux/blkdev.h> 18#include <linux/blkdev.h>
20#include <linux/delay.h> 19#include <linux/delay.h>
21#include <linux/gfp.h> 20#include <linux/gfp.h>
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c
index 1275a8d4dedc..6bca3505b9e9 100644
--- a/drivers/ata/pata_cmd64x.c
+++ b/drivers/ata/pata_cmd64x.c
@@ -26,7 +26,6 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/pci.h> 28#include <linux/pci.h>
29#include <linux/init.h>
30#include <linux/blkdev.h> 29#include <linux/blkdev.h>
31#include <linux/delay.h> 30#include <linux/delay.h>
32#include <scsi/scsi_host.h> 31#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c
index f10baabbf5db..bcde4b786807 100644
--- a/drivers/ata/pata_cs5520.c
+++ b/drivers/ata/pata_cs5520.c
@@ -34,7 +34,6 @@
34#include <linux/kernel.h> 34#include <linux/kernel.h>
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/pci.h> 36#include <linux/pci.h>
37#include <linux/init.h>
38#include <linux/blkdev.h> 37#include <linux/blkdev.h>
39#include <linux/delay.h> 38#include <linux/delay.h>
40#include <scsi/scsi_host.h> 39#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c
index f07f2296acdc..8afe854a5a50 100644
--- a/drivers/ata/pata_cs5530.c
+++ b/drivers/ata/pata_cs5530.c
@@ -26,7 +26,6 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/pci.h> 28#include <linux/pci.h>
29#include <linux/init.h>
30#include <linux/blkdev.h> 29#include <linux/blkdev.h>
31#include <linux/delay.h> 30#include <linux/delay.h>
32#include <scsi/scsi_host.h> 31#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_cs5535.c b/drivers/ata/pata_cs5535.c
index 997e16a3a63f..2c0986fa4bb2 100644
--- a/drivers/ata/pata_cs5535.c
+++ b/drivers/ata/pata_cs5535.c
@@ -31,7 +31,6 @@
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/pci.h> 33#include <linux/pci.h>
34#include <linux/init.h>
35#include <linux/blkdev.h> 34#include <linux/blkdev.h>
36#include <linux/delay.h> 35#include <linux/delay.h>
37#include <scsi/scsi_host.h> 36#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c
index 0448860a2077..32ddcae5a360 100644
--- a/drivers/ata/pata_cs5536.c
+++ b/drivers/ata/pata_cs5536.c
@@ -33,7 +33,6 @@
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/pci.h> 35#include <linux/pci.h>
36#include <linux/init.h>
37#include <linux/blkdev.h> 36#include <linux/blkdev.h>
38#include <linux/delay.h> 37#include <linux/delay.h>
39#include <linux/libata.h> 38#include <linux/libata.h>
diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c
index 810bc9964dde..3435bd6a5cc9 100644
--- a/drivers/ata/pata_cypress.c
+++ b/drivers/ata/pata_cypress.c
@@ -11,7 +11,6 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <linux/init.h>
15#include <linux/blkdev.h> 14#include <linux/blkdev.h>
16#include <linux/delay.h> 15#include <linux/delay.h>
17#include <scsi/scsi_host.h> 16#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_efar.c b/drivers/ata/pata_efar.c
index 3c12fd7acd41..f440892225f4 100644
--- a/drivers/ata/pata_efar.c
+++ b/drivers/ata/pata_efar.c
@@ -14,7 +14,6 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/pci.h> 16#include <linux/pci.h>
17#include <linux/init.h>
18#include <linux/blkdev.h> 17#include <linux/blkdev.h>
19#include <linux/delay.h> 18#include <linux/delay.h>
20#include <linux/device.h> 19#include <linux/device.h>
diff --git a/drivers/ata/pata_ep93xx.c b/drivers/ata/pata_ep93xx.c
index 980b88e109fc..cad9d45749c4 100644
--- a/drivers/ata/pata_ep93xx.c
+++ b/drivers/ata/pata_ep93xx.c
@@ -34,7 +34,6 @@
34#include <linux/err.h> 34#include <linux/err.h>
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/module.h> 36#include <linux/module.h>
37#include <linux/init.h>
38#include <linux/blkdev.h> 37#include <linux/blkdev.h>
39#include <scsi/scsi_host.h> 38#include <scsi/scsi_host.h>
40#include <linux/ata.h> 39#include <linux/ata.h>
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
index 35b521348d31..8e76f79689d3 100644
--- a/drivers/ata/pata_hpt366.c
+++ b/drivers/ata/pata_hpt366.c
@@ -19,7 +19,6 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/pci.h> 21#include <linux/pci.h>
22#include <linux/init.h>
23#include <linux/blkdev.h> 22#include <linux/blkdev.h>
24#include <linux/delay.h> 23#include <linux/delay.h>
25#include <scsi/scsi_host.h> 24#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index a9d74eff5fc4..3ba843f5cdc0 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -19,7 +19,6 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/pci.h> 21#include <linux/pci.h>
22#include <linux/init.h>
23#include <linux/blkdev.h> 22#include <linux/blkdev.h>
24#include <linux/delay.h> 23#include <linux/delay.h>
25#include <scsi/scsi_host.h> 24#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c
index 4be0398c153d..b93c0f0729e7 100644
--- a/drivers/ata/pata_hpt3x2n.c
+++ b/drivers/ata/pata_hpt3x2n.c
@@ -20,7 +20,6 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/pci.h> 22#include <linux/pci.h>
23#include <linux/init.h>
24#include <linux/blkdev.h> 23#include <linux/blkdev.h>
25#include <linux/delay.h> 24#include <linux/delay.h>
26#include <scsi/scsi_host.h> 25#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_hpt3x3.c b/drivers/ata/pata_hpt3x3.c
index 85cf2861e0b7..255c5aaff3a8 100644
--- a/drivers/ata/pata_hpt3x3.c
+++ b/drivers/ata/pata_hpt3x3.c
@@ -16,7 +16,6 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/init.h>
20#include <linux/blkdev.h> 19#include <linux/blkdev.h>
21#include <linux/delay.h> 20#include <linux/delay.h>
22#include <scsi/scsi_host.h> 21#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c
index b0b18ec5465f..e0872db913d6 100644
--- a/drivers/ata/pata_imx.c
+++ b/drivers/ata/pata_imx.c
@@ -15,7 +15,6 @@
15 */ 15 */
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/init.h>
19#include <linux/blkdev.h> 18#include <linux/blkdev.h>
20#include <scsi/scsi_host.h> 19#include <scsi/scsi_host.h>
21#include <linux/ata.h> 20#include <linux/ata.h>
@@ -100,13 +99,9 @@ static int pata_imx_probe(struct platform_device *pdev)
100 struct resource *io_res; 99 struct resource *io_res;
101 int ret; 100 int ret;
102 101
103 io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
104 if (io_res == NULL)
105 return -EINVAL;
106
107 irq = platform_get_irq(pdev, 0); 102 irq = platform_get_irq(pdev, 0);
108 if (irq <= 0) 103 if (irq < 0)
109 return -EINVAL; 104 return irq;
110 105
111 priv = devm_kzalloc(&pdev->dev, 106 priv = devm_kzalloc(&pdev->dev,
112 sizeof(struct pata_imx_priv), GFP_KERNEL); 107 sizeof(struct pata_imx_priv), GFP_KERNEL);
@@ -136,11 +131,10 @@ static int pata_imx_probe(struct platform_device *pdev)
136 ap->pio_mask = ATA_PIO0; 131 ap->pio_mask = ATA_PIO0;
137 ap->flags |= ATA_FLAG_SLAVE_POSS; 132 ap->flags |= ATA_FLAG_SLAVE_POSS;
138 133
139 priv->host_regs = devm_ioremap(&pdev->dev, io_res->start, 134 io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
140 resource_size(io_res)); 135 priv->host_regs = devm_ioremap_resource(&pdev->dev, io_res);
141 if (!priv->host_regs) { 136 if (IS_ERR(priv->host_regs)) {
142 dev_err(&pdev->dev, "failed to map IO/CTL base\n"); 137 ret = PTR_ERR(priv->host_regs);
143 ret = -EBUSY;
144 goto err; 138 goto err;
145 } 139 }
146 140
diff --git a/drivers/ata/pata_it8213.c b/drivers/ata/pata_it8213.c
index 2a8dd9527ecc..81369d187a5c 100644
--- a/drivers/ata/pata_it8213.c
+++ b/drivers/ata/pata_it8213.c
@@ -10,7 +10,6 @@
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/init.h>
14#include <linux/blkdev.h> 13#include <linux/blkdev.h>
15#include <linux/delay.h> 14#include <linux/delay.h>
16#include <linux/device.h> 15#include <linux/device.h>
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index 581e04d80367..dc3d7877f29d 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -72,7 +72,6 @@
72#include <linux/kernel.h> 72#include <linux/kernel.h>
73#include <linux/module.h> 73#include <linux/module.h>
74#include <linux/pci.h> 74#include <linux/pci.h>
75#include <linux/init.h>
76#include <linux/blkdev.h> 75#include <linux/blkdev.h>
77#include <linux/delay.h> 76#include <linux/delay.h>
78#include <linux/slab.h> 77#include <linux/slab.h>
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c
index 76e739b031b6..b1cfa0258fd3 100644
--- a/drivers/ata/pata_jmicron.c
+++ b/drivers/ata/pata_jmicron.c
@@ -10,7 +10,6 @@
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/init.h>
14#include <linux/blkdev.h> 13#include <linux/blkdev.h>
15#include <linux/delay.h> 14#include <linux/delay.h>
16#include <linux/device.h> 15#include <linux/device.h>
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index be816428b430..bce2a8ca4678 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -916,7 +916,6 @@ static __init int probe_chip_type(struct legacy_probe *probe)
916 local_irq_restore(flags); 916 local_irq_restore(flags);
917 return BIOS; 917 return BIOS;
918 } 918 }
919 local_irq_restore(flags);
920 } 919 }
921 920
922 if (ht6560a & mask) 921 if (ht6560a & mask)
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c
index a4f5e781c8c2..6bad3df3a13c 100644
--- a/drivers/ata/pata_marvell.c
+++ b/drivers/ata/pata_marvell.c
@@ -11,7 +11,6 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <linux/init.h>
15#include <linux/blkdev.h> 14#include <linux/blkdev.h>
16#include <linux/delay.h> 15#include <linux/delay.h>
17#include <linux/device.h> 16#include <linux/device.h>
diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c
index 1f5f28bb0bb8..f39a5379e816 100644
--- a/drivers/ata/pata_mpiix.c
+++ b/drivers/ata/pata_mpiix.c
@@ -28,7 +28,6 @@
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/pci.h> 30#include <linux/pci.h>
31#include <linux/init.h>
32#include <linux/blkdev.h> 31#include <linux/blkdev.h>
33#include <linux/delay.h> 32#include <linux/delay.h>
34#include <scsi/scsi_host.h> 33#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_netcell.c b/drivers/ata/pata_netcell.c
index ad1a0febd620..e3b97093ef9a 100644
--- a/drivers/ata/pata_netcell.c
+++ b/drivers/ata/pata_netcell.c
@@ -7,7 +7,6 @@
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/pci.h> 9#include <linux/pci.h>
10#include <linux/init.h>
11#include <linux/blkdev.h> 10#include <linux/blkdev.h>
12#include <linux/delay.h> 11#include <linux/delay.h>
13#include <linux/device.h> 12#include <linux/device.h>
diff --git a/drivers/ata/pata_ninja32.c b/drivers/ata/pata_ninja32.c
index 9513e071040d..56201a69af12 100644
--- a/drivers/ata/pata_ninja32.c
+++ b/drivers/ata/pata_ninja32.c
@@ -37,7 +37,6 @@
37#include <linux/kernel.h> 37#include <linux/kernel.h>
38#include <linux/module.h> 38#include <linux/module.h>
39#include <linux/pci.h> 39#include <linux/pci.h>
40#include <linux/init.h>
41#include <linux/blkdev.h> 40#include <linux/blkdev.h>
42#include <linux/delay.h> 41#include <linux/delay.h>
43#include <scsi/scsi_host.h> 42#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c
index 0c424dae56e7..6154c3ee11a5 100644
--- a/drivers/ata/pata_ns87410.c
+++ b/drivers/ata/pata_ns87410.c
@@ -20,7 +20,6 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/pci.h> 22#include <linux/pci.h>
23#include <linux/init.h>
24#include <linux/blkdev.h> 23#include <linux/blkdev.h>
25#include <linux/delay.h> 24#include <linux/delay.h>
26#include <scsi/scsi_host.h> 25#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_ns87415.c b/drivers/ata/pata_ns87415.c
index 16dc3a63a23d..d44df7ccfe43 100644
--- a/drivers/ata/pata_ns87415.c
+++ b/drivers/ata/pata_ns87415.c
@@ -25,7 +25,6 @@
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/pci.h> 27#include <linux/pci.h>
28#include <linux/init.h>
29#include <linux/blkdev.h> 28#include <linux/blkdev.h>
30#include <linux/delay.h> 29#include <linux/delay.h>
31#include <linux/device.h> 30#include <linux/device.h>
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c
index d77b2e1054ef..319b64491b7b 100644
--- a/drivers/ata/pata_oldpiix.c
+++ b/drivers/ata/pata_oldpiix.c
@@ -16,7 +16,6 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/init.h>
20#include <linux/blkdev.h> 19#include <linux/blkdev.h>
21#include <linux/delay.h> 20#include <linux/delay.h>
22#include <linux/device.h> 21#include <linux/device.h>
diff --git a/drivers/ata/pata_opti.c b/drivers/ata/pata_opti.c
index 4ea70cd22aee..fb042e0519d0 100644
--- a/drivers/ata/pata_opti.c
+++ b/drivers/ata/pata_opti.c
@@ -26,7 +26,6 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/pci.h> 28#include <linux/pci.h>
29#include <linux/init.h>
30#include <linux/blkdev.h> 29#include <linux/blkdev.h>
31#include <linux/delay.h> 30#include <linux/delay.h>
32#include <scsi/scsi_host.h> 31#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c
index 78ede3fd1875..bb71ea214b99 100644
--- a/drivers/ata/pata_optidma.c
+++ b/drivers/ata/pata_optidma.c
@@ -25,7 +25,6 @@
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/pci.h> 27#include <linux/pci.h>
28#include <linux/init.h>
29#include <linux/blkdev.h> 28#include <linux/blkdev.h>
30#include <linux/delay.h> 29#include <linux/delay.h>
31#include <scsi/scsi_host.h> 30#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index 40254f4df584..bcc4b968c049 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -26,7 +26,6 @@
26 26
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/init.h>
30#include <linux/blkdev.h> 29#include <linux/blkdev.h>
31#include <linux/delay.h> 30#include <linux/delay.h>
32#include <linux/slab.h> 31#include <linux/slab.h>
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index 9d874c85d64d..1151f23177bb 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -25,7 +25,6 @@
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/pci.h> 27#include <linux/pci.h>
28#include <linux/init.h>
29#include <linux/blkdev.h> 28#include <linux/blkdev.h>
30#include <linux/delay.h> 29#include <linux/delay.h>
31#include <linux/device.h> 30#include <linux/device.h>
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index c34fc50070a6..defa050e1784 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -15,7 +15,6 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/pci.h> 17#include <linux/pci.h>
18#include <linux/init.h>
19#include <linux/blkdev.h> 18#include <linux/blkdev.h>
20#include <linux/delay.h> 19#include <linux/delay.h>
21#include <scsi/scsi_host.h> 20#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_piccolo.c b/drivers/ata/pata_piccolo.c
index 2beb6b5045f8..0b46be117051 100644
--- a/drivers/ata/pata_piccolo.c
+++ b/drivers/ata/pata_piccolo.c
@@ -18,7 +18,6 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/pci.h> 20#include <linux/pci.h>
21#include <linux/init.h>
22#include <linux/blkdev.h> 21#include <linux/blkdev.h>
23#include <linux/delay.h> 22#include <linux/delay.h>
24#include <scsi/scsi_host.h> 23#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c
index 02794885de10..a5579b55e332 100644
--- a/drivers/ata/pata_platform.c
+++ b/drivers/ata/pata_platform.c
@@ -13,7 +13,6 @@
13 */ 13 */
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/init.h>
17#include <linux/blkdev.h> 16#include <linux/blkdev.h>
18#include <scsi/scsi_host.h> 17#include <scsi/scsi_host.h>
19#include <linux/ata.h> 18#include <linux/ata.h>
diff --git a/drivers/ata/pata_pxa.c b/drivers/ata/pata_pxa.c
index a6f05acad61e..73259bfda1e3 100644
--- a/drivers/ata/pata_pxa.c
+++ b/drivers/ata/pata_pxa.c
@@ -20,7 +20,6 @@
20 20
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/init.h>
24#include <linux/blkdev.h> 23#include <linux/blkdev.h>
25#include <linux/ata.h> 24#include <linux/ata.h>
26#include <linux/libata.h> 25#include <linux/libata.h>
diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c
index f582ba180a7d..be3f10240dca 100644
--- a/drivers/ata/pata_radisys.c
+++ b/drivers/ata/pata_radisys.c
@@ -15,7 +15,6 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/pci.h> 17#include <linux/pci.h>
18#include <linux/init.h>
19#include <linux/blkdev.h> 18#include <linux/blkdev.h>
20#include <linux/delay.h> 19#include <linux/delay.h>
21#include <linux/device.h> 20#include <linux/device.h>
diff --git a/drivers/ata/pata_rdc.c b/drivers/ata/pata_rdc.c
index 79a970f05a2e..521b2137ea3e 100644
--- a/drivers/ata/pata_rdc.c
+++ b/drivers/ata/pata_rdc.c
@@ -24,7 +24,6 @@
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include <linux/init.h>
28#include <linux/blkdev.h> 27#include <linux/blkdev.h>
29#include <linux/delay.h> 28#include <linux/delay.h>
30#include <linux/device.h> 29#include <linux/device.h>
diff --git a/drivers/ata/pata_rz1000.c b/drivers/ata/pata_rz1000.c
index 040b093617a4..caedc90855b2 100644
--- a/drivers/ata/pata_rz1000.c
+++ b/drivers/ata/pata_rz1000.c
@@ -14,7 +14,6 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/pci.h> 16#include <linux/pci.h>
17#include <linux/init.h>
18#include <linux/blkdev.h> 17#include <linux/blkdev.h>
19#include <linux/delay.h> 18#include <linux/delay.h>
20#include <scsi/scsi_host.h> 19#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c
index ce2f828c17b3..96a232fffae6 100644
--- a/drivers/ata/pata_sc1200.c
+++ b/drivers/ata/pata_sc1200.c
@@ -32,7 +32,6 @@
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/pci.h> 34#include <linux/pci.h>
35#include <linux/init.h>
36#include <linux/blkdev.h> 35#include <linux/blkdev.h>
37#include <linux/delay.h> 36#include <linux/delay.h>
38#include <scsi/scsi_host.h> 37#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
index f35f15f4d83e..f1f5b5ae3382 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -35,7 +35,6 @@
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/module.h> 36#include <linux/module.h>
37#include <linux/pci.h> 37#include <linux/pci.h>
38#include <linux/init.h>
39#include <linux/blkdev.h> 38#include <linux/blkdev.h>
40#include <linux/delay.h> 39#include <linux/delay.h>
41#include <linux/device.h> 40#include <linux/device.h>
diff --git a/drivers/ata/pata_sch.c b/drivers/ata/pata_sch.c
index d3830c45a369..5a1cde0ea360 100644
--- a/drivers/ata/pata_sch.c
+++ b/drivers/ata/pata_sch.c
@@ -27,7 +27,6 @@
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/pci.h> 29#include <linux/pci.h>
30#include <linux/init.h>
31#include <linux/blkdev.h> 30#include <linux/blkdev.h>
32#include <linux/delay.h> 31#include <linux/delay.h>
33#include <linux/device.h> 32#include <linux/device.h>
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c
index 96c6a79ef606..e27f31fe1b67 100644
--- a/drivers/ata/pata_serverworks.c
+++ b/drivers/ata/pata_serverworks.c
@@ -34,7 +34,6 @@
34#include <linux/kernel.h> 34#include <linux/kernel.h>
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/pci.h> 36#include <linux/pci.h>
37#include <linux/init.h>
38#include <linux/blkdev.h> 37#include <linux/blkdev.h>
39#include <linux/delay.h> 38#include <linux/delay.h>
40#include <scsi/scsi_host.h> 39#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
index c4b0b073ba8e..73fe362d9716 100644
--- a/drivers/ata/pata_sil680.c
+++ b/drivers/ata/pata_sil680.c
@@ -25,7 +25,6 @@
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/pci.h> 27#include <linux/pci.h>
28#include <linux/init.h>
29#include <linux/blkdev.h> 28#include <linux/blkdev.h>
30#include <linux/delay.h> 29#include <linux/delay.h>
31#include <scsi/scsi_host.h> 30#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index 1e8363640bf5..78d913aa93c8 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -26,7 +26,6 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/pci.h> 28#include <linux/pci.h>
29#include <linux/init.h>
30#include <linux/blkdev.h> 29#include <linux/blkdev.h>
31#include <linux/delay.h> 30#include <linux/delay.h>
32#include <linux/device.h> 31#include <linux/device.h>
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c
index 6816911ac422..900f0e4a1faf 100644
--- a/drivers/ata/pata_sl82c105.c
+++ b/drivers/ata/pata_sl82c105.c
@@ -19,7 +19,6 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/pci.h> 21#include <linux/pci.h>
22#include <linux/init.h>
23#include <linux/blkdev.h> 22#include <linux/blkdev.h>
24#include <linux/delay.h> 23#include <linux/delay.h>
25#include <scsi/scsi_host.h> 24#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_triflex.c b/drivers/ata/pata_triflex.c
index 94473da68c02..7bc78e264f9e 100644
--- a/drivers/ata/pata_triflex.c
+++ b/drivers/ata/pata_triflex.c
@@ -36,7 +36,6 @@
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <linux/module.h> 37#include <linux/module.h>
38#include <linux/pci.h> 38#include <linux/pci.h>
39#include <linux/init.h>
40#include <linux/blkdev.h> 39#include <linux/blkdev.h>
41#include <linux/delay.h> 40#include <linux/delay.h>
42#include <scsi/scsi_host.h> 41#include <scsi/scsi_host.h>
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index c3ab9a6c3965..f6c9632bdff6 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -55,7 +55,6 @@
55#include <linux/kernel.h> 55#include <linux/kernel.h>
56#include <linux/module.h> 56#include <linux/module.h>
57#include <linux/pci.h> 57#include <linux/pci.h>
58#include <linux/init.h>
59#include <linux/blkdev.h> 58#include <linux/blkdev.h>
60#include <linux/delay.h> 59#include <linux/delay.h>
61#include <linux/gfp.h> 60#include <linux/gfp.h>
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c
index 8ea6e6afd041..f10631beffa8 100644
--- a/drivers/ata/pdc_adma.c
+++ b/drivers/ata/pdc_adma.c
@@ -36,7 +36,6 @@
36#include <linux/module.h> 36#include <linux/module.h>
37#include <linux/gfp.h> 37#include <linux/gfp.h>
38#include <linux/pci.h> 38#include <linux/pci.h>
39#include <linux/init.h>
40#include <linux/blkdev.h> 39#include <linux/blkdev.h>
41#include <linux/delay.h> 40#include <linux/delay.h>
42#include <linux/interrupt.h> 41#include <linux/interrupt.h>
diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
index 523524b68022..0bb2cabd2197 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -29,7 +29,6 @@
29 29
30#include <linux/kernel.h> 30#include <linux/kernel.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/init.h>
33#include <linux/device.h> 32#include <linux/device.h>
34#include <linux/of_address.h> 33#include <linux/of_address.h>
35#include <linux/of_irq.h> 34#include <linux/of_irq.h>
@@ -462,8 +461,7 @@ static irqreturn_t dma_dwc_interrupt(int irq, void *hsdev_instance)
462 int chan; 461 int chan;
463 u32 tfr_reg, err_reg; 462 u32 tfr_reg, err_reg;
464 unsigned long flags; 463 unsigned long flags;
465 struct sata_dwc_device *hsdev = 464 struct sata_dwc_device *hsdev = hsdev_instance;
466 (struct sata_dwc_device *)hsdev_instance;
467 struct ata_host *host = (struct ata_host *)hsdev->host; 465 struct ata_host *host = (struct ata_host *)hsdev->host;
468 struct ata_port *ap; 466 struct ata_port *ap;
469 struct sata_dwc_device_port *hsdevp; 467 struct sata_dwc_device_port *hsdevp;
diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c
index 870b11eadc6d..65965cf5af06 100644
--- a/drivers/ata/sata_highbank.c
+++ b/drivers/ata/sata_highbank.c
@@ -19,7 +19,6 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/gfp.h> 20#include <linux/gfp.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/init.h>
23#include <linux/types.h> 22#include <linux/types.h>
24#include <linux/err.h> 23#include <linux/err.h>
25#include <linux/io.h> 24#include <linux/io.h>
@@ -142,7 +141,7 @@ static ssize_t ecx_transmit_led_message(struct ata_port *ap, u32 state,
142 ssize_t size) 141 ssize_t size)
143{ 142{
144 struct ahci_host_priv *hpriv = ap->host->private_data; 143 struct ahci_host_priv *hpriv = ap->host->private_data;
145 struct ecx_plat_data *pdata = (struct ecx_plat_data *) hpriv->plat_data; 144 struct ecx_plat_data *pdata = hpriv->plat_data;
146 struct ahci_port_priv *pp = ap->private_data; 145 struct ahci_port_priv *pp = ap->private_data;
147 unsigned long flags; 146 unsigned long flags;
148 int pmp, i; 147 int pmp, i;
@@ -403,6 +402,7 @@ static int ahci_highbank_hardreset(struct ata_link *link, unsigned int *class,
403 static const unsigned long timing[] = { 5, 100, 500}; 402 static const unsigned long timing[] = { 5, 100, 500};
404 struct ata_port *ap = link->ap; 403 struct ata_port *ap = link->ap;
405 struct ahci_port_priv *pp = ap->private_data; 404 struct ahci_port_priv *pp = ap->private_data;
405 struct ahci_host_priv *hpriv = ap->host->private_data;
406 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; 406 u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
407 struct ata_taskfile tf; 407 struct ata_taskfile tf;
408 bool online; 408 bool online;
@@ -431,7 +431,7 @@ static int ahci_highbank_hardreset(struct ata_link *link, unsigned int *class,
431 break; 431 break;
432 } while (!online && retry--); 432 } while (!online && retry--);
433 433
434 ahci_start_engine(ap); 434 hpriv->start_engine(ap);
435 435
436 if (online) 436 if (online)
437 *class = ahci_dev_classify(ap); 437 *class = ahci_dev_classify(ap);
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index d74def823d3e..ba5f27120332 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -40,7 +40,6 @@
40#include <linux/module.h> 40#include <linux/module.h>
41#include <linux/gfp.h> 41#include <linux/gfp.h>
42#include <linux/pci.h> 42#include <linux/pci.h>
43#include <linux/init.h>
44#include <linux/blkdev.h> 43#include <linux/blkdev.h>
45#include <linux/delay.h> 44#include <linux/delay.h>
46#include <linux/interrupt.h> 45#include <linux/interrupt.h>
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 97f4acb54ad6..3638887476f6 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -35,7 +35,6 @@
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/gfp.h> 36#include <linux/gfp.h>
37#include <linux/pci.h> 37#include <linux/pci.h>
38#include <linux/init.h>
39#include <linux/blkdev.h> 38#include <linux/blkdev.h>
40#include <linux/delay.h> 39#include <linux/delay.h>
41#include <linux/interrupt.h> 40#include <linux/interrupt.h>
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c
index 3b0dd57984e1..9a6bd4cd29a0 100644
--- a/drivers/ata/sata_qstor.c
+++ b/drivers/ata/sata_qstor.c
@@ -31,7 +31,6 @@
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/gfp.h> 32#include <linux/gfp.h>
33#include <linux/pci.h> 33#include <linux/pci.h>
34#include <linux/init.h>
35#include <linux/blkdev.h> 34#include <linux/blkdev.h>
36#include <linux/delay.h> 35#include <linux/delay.h>
37#include <linux/interrupt.h> 36#include <linux/interrupt.h>
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index b7695e804635..3062f8605b29 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -37,7 +37,6 @@
37#include <linux/kernel.h> 37#include <linux/kernel.h>
38#include <linux/module.h> 38#include <linux/module.h>
39#include <linux/pci.h> 39#include <linux/pci.h>
40#include <linux/init.h>
41#include <linux/blkdev.h> 40#include <linux/blkdev.h>
42#include <linux/delay.h> 41#include <linux/delay.h>
43#include <linux/interrupt.h> 42#include <linux/interrupt.h>
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
index 1ad2f62d34b9..b513428171b3 100644
--- a/drivers/ata/sata_sis.c
+++ b/drivers/ata/sata_sis.c
@@ -33,7 +33,6 @@
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/pci.h> 35#include <linux/pci.h>
36#include <linux/init.h>
37#include <linux/blkdev.h> 36#include <linux/blkdev.h>
38#include <linux/delay.h> 37#include <linux/delay.h>
39#include <linux/interrupt.h> 38#include <linux/interrupt.h>
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
index dc4f70179e7d..c630fa812624 100644
--- a/drivers/ata/sata_svw.c
+++ b/drivers/ata/sata_svw.c
@@ -39,7 +39,6 @@
39#include <linux/kernel.h> 39#include <linux/kernel.h>
40#include <linux/module.h> 40#include <linux/module.h>
41#include <linux/pci.h> 41#include <linux/pci.h>
42#include <linux/init.h>
43#include <linux/blkdev.h> 42#include <linux/blkdev.h>
44#include <linux/delay.h> 43#include <linux/delay.h>
45#include <linux/interrupt.h> 44#include <linux/interrupt.h>
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c
index 9947010afc0f..39b5de60a1f9 100644
--- a/drivers/ata/sata_sx4.c
+++ b/drivers/ata/sata_sx4.c
@@ -82,7 +82,6 @@
82#include <linux/module.h> 82#include <linux/module.h>
83#include <linux/pci.h> 83#include <linux/pci.h>
84#include <linux/slab.h> 84#include <linux/slab.h>
85#include <linux/init.h>
86#include <linux/blkdev.h> 85#include <linux/blkdev.h>
87#include <linux/delay.h> 86#include <linux/delay.h>
88#include <linux/interrupt.h> 87#include <linux/interrupt.h>
@@ -1021,8 +1020,7 @@ static void pdc20621_get_from_dimm(struct ata_host *host, void *psource,
1021 idx++; 1020 idx++;
1022 dist = ((long) (window_size - (offset + size))) >= 0 ? size : 1021 dist = ((long) (window_size - (offset + size))) >= 0 ? size :
1023 (long) (window_size - offset); 1022 (long) (window_size - offset);
1024 memcpy_fromio((char *) psource, (char *) (dimm_mmio + offset / 4), 1023 memcpy_fromio(psource, dimm_mmio + offset / 4, dist);
1025 dist);
1026 1024
1027 psource += dist; 1025 psource += dist;
1028 size -= dist; 1026 size -= dist;
@@ -1031,8 +1029,7 @@ static void pdc20621_get_from_dimm(struct ata_host *host, void *psource,
1031 readl(mmio + PDC_GENERAL_CTLR); 1029 readl(mmio + PDC_GENERAL_CTLR);
1032 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); 1030 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
1033 readl(mmio + PDC_DIMM_WINDOW_CTLR); 1031 readl(mmio + PDC_DIMM_WINDOW_CTLR);
1034 memcpy_fromio((char *) psource, (char *) (dimm_mmio), 1032 memcpy_fromio(psource, dimm_mmio, window_size / 4);
1035 window_size / 4);
1036 psource += window_size; 1033 psource += window_size;
1037 size -= window_size; 1034 size -= window_size;
1038 idx++; 1035 idx++;
@@ -1043,8 +1040,7 @@ static void pdc20621_get_from_dimm(struct ata_host *host, void *psource,
1043 readl(mmio + PDC_GENERAL_CTLR); 1040 readl(mmio + PDC_GENERAL_CTLR);
1044 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR); 1041 writel(((idx) << page_mask), mmio + PDC_DIMM_WINDOW_CTLR);
1045 readl(mmio + PDC_DIMM_WINDOW_CTLR); 1042 readl(mmio + PDC_DIMM_WINDOW_CTLR);
1046 memcpy_fromio((char *) psource, (char *) (dimm_mmio), 1043 memcpy_fromio(psource, dimm_mmio, size / 4);
1047 size / 4);
1048 } 1044 }
1049} 1045}
1050#endif 1046#endif
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c
index 6d6489118873..08f98c3ed5c8 100644
--- a/drivers/ata/sata_uli.c
+++ b/drivers/ata/sata_uli.c
@@ -28,7 +28,6 @@
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/gfp.h> 29#include <linux/gfp.h>
30#include <linux/pci.h> 30#include <linux/pci.h>
31#include <linux/init.h>
32#include <linux/blkdev.h> 31#include <linux/blkdev.h>
33#include <linux/delay.h> 32#include <linux/delay.h>
34#include <linux/interrupt.h> 33#include <linux/interrupt.h>
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 87f056e54a9d..f72e84228c5c 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -36,7 +36,6 @@
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <linux/module.h> 37#include <linux/module.h>
38#include <linux/pci.h> 38#include <linux/pci.h>
39#include <linux/init.h>
40#include <linux/blkdev.h> 39#include <linux/blkdev.h>
41#include <linux/delay.h> 40#include <linux/delay.h>
42#include <linux/device.h> 41#include <linux/device.h>
diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c
index 44f304b3de63..29e847aac34b 100644
--- a/drivers/ata/sata_vsc.c
+++ b/drivers/ata/sata_vsc.c
@@ -37,7 +37,6 @@
37#include <linux/kernel.h> 37#include <linux/kernel.h>
38#include <linux/module.h> 38#include <linux/module.h>
39#include <linux/pci.h> 39#include <linux/pci.h>
40#include <linux/init.h>
41#include <linux/blkdev.h> 40#include <linux/blkdev.h>
42#include <linux/delay.h> 41#include <linux/delay.h>
43#include <linux/interrupt.h> 42#include <linux/interrupt.h>
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 2023043ce7c0..8f5565bf34cd 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -961,17 +961,31 @@ static void empty(void)
961{ 961{
962} 962}
963 963
964static DECLARE_WORK(floppy_work, NULL); 964static void (*floppy_work_fn)(void);
965
966static void floppy_work_workfn(struct work_struct *work)
967{
968 floppy_work_fn();
969}
970
971static DECLARE_WORK(floppy_work, floppy_work_workfn);
965 972
966static void schedule_bh(void (*handler)(void)) 973static void schedule_bh(void (*handler)(void))
967{ 974{
968 WARN_ON(work_pending(&floppy_work)); 975 WARN_ON(work_pending(&floppy_work));
969 976
970 PREPARE_WORK(&floppy_work, (work_func_t)handler); 977 floppy_work_fn = handler;
971 queue_work(floppy_wq, &floppy_work); 978 queue_work(floppy_wq, &floppy_work);
972} 979}
973 980
974static DECLARE_DELAYED_WORK(fd_timer, NULL); 981static void (*fd_timer_fn)(void) = NULL;
982
983static void fd_timer_workfn(struct work_struct *work)
984{
985 fd_timer_fn();
986}
987
988static DECLARE_DELAYED_WORK(fd_timer, fd_timer_workfn);
975 989
976static void cancel_activity(void) 990static void cancel_activity(void)
977{ 991{
@@ -982,7 +996,7 @@ static void cancel_activity(void)
982 996
983/* this function makes sure that the disk stays in the drive during the 997/* this function makes sure that the disk stays in the drive during the
984 * transfer */ 998 * transfer */
985static void fd_watchdog(struct work_struct *arg) 999static void fd_watchdog(void)
986{ 1000{
987 debug_dcl(DP->flags, "calling disk change from watchdog\n"); 1001 debug_dcl(DP->flags, "calling disk change from watchdog\n");
988 1002
@@ -993,7 +1007,7 @@ static void fd_watchdog(struct work_struct *arg)
993 reset_fdc(); 1007 reset_fdc();
994 } else { 1008 } else {
995 cancel_delayed_work(&fd_timer); 1009 cancel_delayed_work(&fd_timer);
996 PREPARE_DELAYED_WORK(&fd_timer, fd_watchdog); 1010 fd_timer_fn = fd_watchdog;
997 queue_delayed_work(floppy_wq, &fd_timer, HZ / 10); 1011 queue_delayed_work(floppy_wq, &fd_timer, HZ / 10);
998 } 1012 }
999} 1013}
@@ -1005,7 +1019,8 @@ static void main_command_interrupt(void)
1005} 1019}
1006 1020
1007/* waits for a delay (spinup or select) to pass */ 1021/* waits for a delay (spinup or select) to pass */
1008static int fd_wait_for_completion(unsigned long expires, work_func_t function) 1022static int fd_wait_for_completion(unsigned long expires,
1023 void (*function)(void))
1009{ 1024{
1010 if (FDCS->reset) { 1025 if (FDCS->reset) {
1011 reset_fdc(); /* do the reset during sleep to win time 1026 reset_fdc(); /* do the reset during sleep to win time
@@ -1016,7 +1031,7 @@ static int fd_wait_for_completion(unsigned long expires, work_func_t function)
1016 1031
1017 if (time_before(jiffies, expires)) { 1032 if (time_before(jiffies, expires)) {
1018 cancel_delayed_work(&fd_timer); 1033 cancel_delayed_work(&fd_timer);
1019 PREPARE_DELAYED_WORK(&fd_timer, function); 1034 fd_timer_fn = function;
1020 queue_delayed_work(floppy_wq, &fd_timer, expires - jiffies); 1035 queue_delayed_work(floppy_wq, &fd_timer, expires - jiffies);
1021 return 1; 1036 return 1;
1022 } 1037 }
@@ -1334,8 +1349,7 @@ static int fdc_dtr(void)
1334 * Pause 5 msec to avoid trouble. (Needs to be 2 jiffies) 1349 * Pause 5 msec to avoid trouble. (Needs to be 2 jiffies)
1335 */ 1350 */
1336 FDCS->dtr = raw_cmd->rate & 3; 1351 FDCS->dtr = raw_cmd->rate & 3;
1337 return fd_wait_for_completion(jiffies + 2UL * HZ / 100, 1352 return fd_wait_for_completion(jiffies + 2UL * HZ / 100, floppy_ready);
1338 (work_func_t)floppy_ready);
1339} /* fdc_dtr */ 1353} /* fdc_dtr */
1340 1354
1341static void tell_sector(void) 1355static void tell_sector(void)
@@ -1440,7 +1454,7 @@ static void setup_rw_floppy(void)
1440 int flags; 1454 int flags;
1441 int dflags; 1455 int dflags;
1442 unsigned long ready_date; 1456 unsigned long ready_date;
1443 work_func_t function; 1457 void (*function)(void);
1444 1458
1445 flags = raw_cmd->flags; 1459 flags = raw_cmd->flags;
1446 if (flags & (FD_RAW_READ | FD_RAW_WRITE)) 1460 if (flags & (FD_RAW_READ | FD_RAW_WRITE))
@@ -1454,9 +1468,9 @@ static void setup_rw_floppy(void)
1454 */ 1468 */
1455 if (time_after(ready_date, jiffies + DP->select_delay)) { 1469 if (time_after(ready_date, jiffies + DP->select_delay)) {
1456 ready_date -= DP->select_delay; 1470 ready_date -= DP->select_delay;
1457 function = (work_func_t)floppy_start; 1471 function = floppy_start;
1458 } else 1472 } else
1459 function = (work_func_t)setup_rw_floppy; 1473 function = setup_rw_floppy;
1460 1474
1461 /* wait until the floppy is spinning fast enough */ 1475 /* wait until the floppy is spinning fast enough */
1462 if (fd_wait_for_completion(ready_date, function)) 1476 if (fd_wait_for_completion(ready_date, function))
@@ -1486,7 +1500,7 @@ static void setup_rw_floppy(void)
1486 inr = result(); 1500 inr = result();
1487 cont->interrupt(); 1501 cont->interrupt();
1488 } else if (flags & FD_RAW_NEED_DISK) 1502 } else if (flags & FD_RAW_NEED_DISK)
1489 fd_watchdog(NULL); 1503 fd_watchdog();
1490} 1504}
1491 1505
1492static int blind_seek; 1506static int blind_seek;
@@ -1863,7 +1877,7 @@ static int start_motor(void (*function)(void))
1863 1877
1864 /* wait_for_completion also schedules reset if needed. */ 1878 /* wait_for_completion also schedules reset if needed. */
1865 return fd_wait_for_completion(DRS->select_date + DP->select_delay, 1879 return fd_wait_for_completion(DRS->select_date + DP->select_delay,
1866 (work_func_t)function); 1880 function);
1867} 1881}
1868 1882
1869static void floppy_ready(void) 1883static void floppy_ready(void)
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 51824d1f23ea..8459e4e7c719 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -993,7 +993,7 @@ static void nvme_abort_cmd(int cmdid, struct nvme_queue *nvmeq)
993 dev_warn(&dev->pci_dev->dev, 993 dev_warn(&dev->pci_dev->dev,
994 "I/O %d QID %d timeout, reset controller\n", cmdid, 994 "I/O %d QID %d timeout, reset controller\n", cmdid,
995 nvmeq->qid); 995 nvmeq->qid);
996 PREPARE_WORK(&dev->reset_work, nvme_reset_failed_dev); 996 dev->reset_workfn = nvme_reset_failed_dev;
997 queue_work(nvme_workq, &dev->reset_work); 997 queue_work(nvme_workq, &dev->reset_work);
998 return; 998 return;
999 } 999 }
@@ -1696,8 +1696,7 @@ static int nvme_kthread(void *data)
1696 list_del_init(&dev->node); 1696 list_del_init(&dev->node);
1697 dev_warn(&dev->pci_dev->dev, 1697 dev_warn(&dev->pci_dev->dev,
1698 "Failed status, reset controller\n"); 1698 "Failed status, reset controller\n");
1699 PREPARE_WORK(&dev->reset_work, 1699 dev->reset_workfn = nvme_reset_failed_dev;
1700 nvme_reset_failed_dev);
1701 queue_work(nvme_workq, &dev->reset_work); 1700 queue_work(nvme_workq, &dev->reset_work);
1702 continue; 1701 continue;
1703 } 1702 }
@@ -2406,7 +2405,7 @@ static int nvme_dev_resume(struct nvme_dev *dev)
2406 return ret; 2405 return ret;
2407 if (ret == -EBUSY) { 2406 if (ret == -EBUSY) {
2408 spin_lock(&dev_list_lock); 2407 spin_lock(&dev_list_lock);
2409 PREPARE_WORK(&dev->reset_work, nvme_remove_disks); 2408 dev->reset_workfn = nvme_remove_disks;
2410 queue_work(nvme_workq, &dev->reset_work); 2409 queue_work(nvme_workq, &dev->reset_work);
2411 spin_unlock(&dev_list_lock); 2410 spin_unlock(&dev_list_lock);
2412 } 2411 }
@@ -2435,6 +2434,12 @@ static void nvme_reset_failed_dev(struct work_struct *ws)
2435 nvme_dev_reset(dev); 2434 nvme_dev_reset(dev);
2436} 2435}
2437 2436
2437static void nvme_reset_workfn(struct work_struct *work)
2438{
2439 struct nvme_dev *dev = container_of(work, struct nvme_dev, reset_work);
2440 dev->reset_workfn(work);
2441}
2442
2438static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) 2443static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2439{ 2444{
2440 int result = -ENOMEM; 2445 int result = -ENOMEM;
@@ -2453,7 +2458,8 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2453 goto free; 2458 goto free;
2454 2459
2455 INIT_LIST_HEAD(&dev->namespaces); 2460 INIT_LIST_HEAD(&dev->namespaces);
2456 INIT_WORK(&dev->reset_work, nvme_reset_failed_dev); 2461 dev->reset_workfn = nvme_reset_failed_dev;
2462 INIT_WORK(&dev->reset_work, nvme_reset_workfn);
2457 dev->pci_dev = pdev; 2463 dev->pci_dev = pdev;
2458 pci_set_drvdata(pdev, dev); 2464 pci_set_drvdata(pdev, dev);
2459 result = nvme_set_instance(dev); 2465 result = nvme_set_instance(dev);
@@ -2553,7 +2559,7 @@ static int nvme_resume(struct device *dev)
2553 struct nvme_dev *ndev = pci_get_drvdata(pdev); 2559 struct nvme_dev *ndev = pci_get_drvdata(pdev);
2554 2560
2555 if (nvme_dev_resume(ndev) && !work_busy(&ndev->reset_work)) { 2561 if (nvme_dev_resume(ndev) && !work_busy(&ndev->reset_work)) {
2556 PREPARE_WORK(&ndev->reset_work, nvme_reset_failed_dev); 2562 ndev->reset_workfn = nvme_reset_failed_dev;
2557 queue_work(nvme_workq, &ndev->reset_work); 2563 queue_work(nvme_workq, &ndev->reset_work);
2558 } 2564 }
2559 return 0; 2565 return 0;
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index cd6950fd8caf..52e9329e3c51 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -140,3 +140,51 @@ config VF_PIT_TIMER
140 bool 140 bool
141 help 141 help
142 Support for Period Interrupt Timer on Freescale Vybrid Family SoCs. 142 Support for Period Interrupt Timer on Freescale Vybrid Family SoCs.
143
144config SYS_SUPPORTS_SH_CMT
145 bool
146
147config SYS_SUPPORTS_SH_MTU2
148 bool
149
150config SYS_SUPPORTS_SH_TMU
151 bool
152
153config SYS_SUPPORTS_EM_STI
154 bool
155
156config SH_TIMER_CMT
157 bool "Renesas CMT timer driver" if COMPILE_TEST
158 depends on GENERIC_CLOCKEVENTS
159 default SYS_SUPPORTS_SH_CMT
160 help
161 This enables build of a clocksource and clockevent driver for
162 the Compare Match Timer (CMT) hardware available in 16/32/48-bit
163 variants on a wide range of Mobile and Automotive SoCs from Renesas.
164
165config SH_TIMER_MTU2
166 bool "Renesas MTU2 timer driver" if COMPILE_TEST
167 depends on GENERIC_CLOCKEVENTS
168 default SYS_SUPPORTS_SH_MTU2
169 help
170 This enables build of a clockevent driver for the Multi-Function
171 Timer Pulse Unit 2 (TMU2) hardware available on SoCs from Renesas.
172 This hardware comes with 16 bit-timer registers.
173
174config SH_TIMER_TMU
175 bool "Renesas TMU timer driver" if COMPILE_TEST
176 depends on GENERIC_CLOCKEVENTS
177 default SYS_SUPPORTS_SH_TMU
178 help
179 This enables build of a clocksource and clockevent driver for
180 the 32-bit Timer Unit (TMU) hardware available on a wide range
181 SoCs from Renesas.
182
183config EM_TIMER_STI
184 bool "Renesas STI timer driver" if COMPILE_TEST
185 depends on GENERIC_CLOCKEVENTS
186 default SYS_SUPPORTS_EM_STI
187 help
188 This enables build of a clocksource and clockevent driver for
189 the 48-bit System Timer (STI) hardware available on a SoCs
190 such as EMEV2 from former NEC Electronics.
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index c7ca50a9c232..aed3488d9426 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_ARCH_MARCO) += timer-marco.o
21obj-$(CONFIG_ARCH_MOXART) += moxart_timer.o 21obj-$(CONFIG_ARCH_MOXART) += moxart_timer.o
22obj-$(CONFIG_ARCH_MXS) += mxs_timer.o 22obj-$(CONFIG_ARCH_MXS) += mxs_timer.o
23obj-$(CONFIG_ARCH_PRIMA2) += timer-prima2.o 23obj-$(CONFIG_ARCH_PRIMA2) += timer-prima2.o
24obj-$(CONFIG_ARCH_U300) += timer-u300.o
24obj-$(CONFIG_SUN4I_TIMER) += sun4i_timer.o 25obj-$(CONFIG_SUN4I_TIMER) += sun4i_timer.o
25obj-$(CONFIG_SUN5I_HSTIMER) += timer-sun5i.o 26obj-$(CONFIG_SUN5I_HSTIMER) += timer-sun5i.o
26obj-$(CONFIG_ARCH_TEGRA) += tegra20_timer.o 27obj-$(CONFIG_ARCH_TEGRA) += tegra20_timer.o
@@ -37,3 +38,4 @@ obj-$(CONFIG_ARM_ARCH_TIMER) += arm_arch_timer.o
37obj-$(CONFIG_ARM_GLOBAL_TIMER) += arm_global_timer.o 38obj-$(CONFIG_ARM_GLOBAL_TIMER) += arm_global_timer.o
38obj-$(CONFIG_CLKSRC_METAG_GENERIC) += metag_generic.o 39obj-$(CONFIG_CLKSRC_METAG_GENERIC) += metag_generic.o
39obj-$(CONFIG_ARCH_HAS_TICK_BROADCAST) += dummy_timer.o 40obj-$(CONFIG_ARCH_HAS_TICK_BROADCAST) += dummy_timer.o
41obj-$(CONFIG_ARCH_KEYSTONE) += timer-keystone.o
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 95fb944e15ee..57e823c44d2a 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -277,6 +277,7 @@ static void __arch_timer_setup(unsigned type,
277 clk->set_next_event = arch_timer_set_next_event_phys; 277 clk->set_next_event = arch_timer_set_next_event_phys;
278 } 278 }
279 } else { 279 } else {
280 clk->features |= CLOCK_EVT_FEAT_DYNIRQ;
280 clk->name = "arch_mem_timer"; 281 clk->name = "arch_mem_timer";
281 clk->rating = 400; 282 clk->rating = 400;
282 clk->cpumask = cpu_all_mask; 283 clk->cpumask = cpu_all_mask;
diff --git a/drivers/clocksource/cadence_ttc_timer.c b/drivers/clocksource/cadence_ttc_timer.c
index 63f176de0d02..49fbe2847c84 100644
--- a/drivers/clocksource/cadence_ttc_timer.c
+++ b/drivers/clocksource/cadence_ttc_timer.c
@@ -16,6 +16,7 @@
16 */ 16 */
17 17
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/clk-provider.h>
19#include <linux/interrupt.h> 20#include <linux/interrupt.h>
20#include <linux/clockchips.h> 21#include <linux/clockchips.h>
21#include <linux/of_address.h> 22#include <linux/of_address.h>
@@ -52,6 +53,8 @@
52#define TTC_CNT_CNTRL_DISABLE_MASK 0x1 53#define TTC_CNT_CNTRL_DISABLE_MASK 0x1
53 54
54#define TTC_CLK_CNTRL_CSRC_MASK (1 << 5) /* clock source */ 55#define TTC_CLK_CNTRL_CSRC_MASK (1 << 5) /* clock source */
56#define TTC_CLK_CNTRL_PSV_MASK 0x1e
57#define TTC_CLK_CNTRL_PSV_SHIFT 1
55 58
56/* 59/*
57 * Setup the timers to use pre-scaling, using a fixed value for now that will 60 * Setup the timers to use pre-scaling, using a fixed value for now that will
@@ -63,6 +66,8 @@
63#define CLK_CNTRL_PRESCALE_EN 1 66#define CLK_CNTRL_PRESCALE_EN 1
64#define CNT_CNTRL_RESET (1 << 4) 67#define CNT_CNTRL_RESET (1 << 4)
65 68
69#define MAX_F_ERR 50
70
66/** 71/**
67 * struct ttc_timer - This definition defines local timer structure 72 * struct ttc_timer - This definition defines local timer structure
68 * 73 *
@@ -82,6 +87,8 @@ struct ttc_timer {
82 container_of(x, struct ttc_timer, clk_rate_change_nb) 87 container_of(x, struct ttc_timer, clk_rate_change_nb)
83 88
84struct ttc_timer_clocksource { 89struct ttc_timer_clocksource {
90 u32 scale_clk_ctrl_reg_old;
91 u32 scale_clk_ctrl_reg_new;
85 struct ttc_timer ttc; 92 struct ttc_timer ttc;
86 struct clocksource cs; 93 struct clocksource cs;
87}; 94};
@@ -229,32 +236,89 @@ static int ttc_rate_change_clocksource_cb(struct notifier_block *nb,
229 struct ttc_timer_clocksource, ttc); 236 struct ttc_timer_clocksource, ttc);
230 237
231 switch (event) { 238 switch (event) {
232 case POST_RATE_CHANGE: 239 case PRE_RATE_CHANGE:
240 {
241 u32 psv;
242 unsigned long factor, rate_low, rate_high;
243
244 if (ndata->new_rate > ndata->old_rate) {
245 factor = DIV_ROUND_CLOSEST(ndata->new_rate,
246 ndata->old_rate);
247 rate_low = ndata->old_rate;
248 rate_high = ndata->new_rate;
249 } else {
250 factor = DIV_ROUND_CLOSEST(ndata->old_rate,
251 ndata->new_rate);
252 rate_low = ndata->new_rate;
253 rate_high = ndata->old_rate;
254 }
255
256 if (!is_power_of_2(factor))
257 return NOTIFY_BAD;
258
259 if (abs(rate_high - (factor * rate_low)) > MAX_F_ERR)
260 return NOTIFY_BAD;
261
262 factor = __ilog2_u32(factor);
263
233 /* 264 /*
234 * Do whatever is necessary to maintain a proper time base 265 * store timer clock ctrl register so we can restore it in case
235 * 266 * of an abort.
236 * I cannot find a way to adjust the currently used clocksource
237 * to the new frequency. __clocksource_updatefreq_hz() sounds
238 * good, but does not work. Not sure what's that missing.
239 *
240 * This approach works, but triggers two clocksource switches.
241 * The first after unregister to clocksource jiffies. And
242 * another one after the register to the newly registered timer.
243 *
244 * Alternatively we could 'waste' another HW timer to ping pong
245 * between clock sources. That would also use one register and
246 * one unregister call, but only trigger one clocksource switch
247 * for the cost of another HW timer used by the OS.
248 */ 267 */
249 clocksource_unregister(&ttccs->cs); 268 ttccs->scale_clk_ctrl_reg_old =
250 clocksource_register_hz(&ttccs->cs, 269 __raw_readl(ttccs->ttc.base_addr +
251 ndata->new_rate / PRESCALE); 270 TTC_CLK_CNTRL_OFFSET);
252 /* fall through */ 271
253 case PRE_RATE_CHANGE: 272 psv = (ttccs->scale_clk_ctrl_reg_old &
273 TTC_CLK_CNTRL_PSV_MASK) >>
274 TTC_CLK_CNTRL_PSV_SHIFT;
275 if (ndata->new_rate < ndata->old_rate)
276 psv -= factor;
277 else
278 psv += factor;
279
280 /* prescaler within legal range? */
281 if (psv & ~(TTC_CLK_CNTRL_PSV_MASK >> TTC_CLK_CNTRL_PSV_SHIFT))
282 return NOTIFY_BAD;
283
284 ttccs->scale_clk_ctrl_reg_new = ttccs->scale_clk_ctrl_reg_old &
285 ~TTC_CLK_CNTRL_PSV_MASK;
286 ttccs->scale_clk_ctrl_reg_new |= psv << TTC_CLK_CNTRL_PSV_SHIFT;
287
288
289 /* scale down: adjust divider in post-change notification */
290 if (ndata->new_rate < ndata->old_rate)
291 return NOTIFY_DONE;
292
293 /* scale up: adjust divider now - before frequency change */
294 __raw_writel(ttccs->scale_clk_ctrl_reg_new,
295 ttccs->ttc.base_addr + TTC_CLK_CNTRL_OFFSET);
296 break;
297 }
298 case POST_RATE_CHANGE:
299 /* scale up: pre-change notification did the adjustment */
300 if (ndata->new_rate > ndata->old_rate)
301 return NOTIFY_OK;
302
303 /* scale down: adjust divider now - after frequency change */
304 __raw_writel(ttccs->scale_clk_ctrl_reg_new,
305 ttccs->ttc.base_addr + TTC_CLK_CNTRL_OFFSET);
306 break;
307
254 case ABORT_RATE_CHANGE: 308 case ABORT_RATE_CHANGE:
309 /* we have to undo the adjustment in case we scale up */
310 if (ndata->new_rate < ndata->old_rate)
311 return NOTIFY_OK;
312
313 /* restore original register value */
314 __raw_writel(ttccs->scale_clk_ctrl_reg_old,
315 ttccs->ttc.base_addr + TTC_CLK_CNTRL_OFFSET);
316 /* fall through */
255 default: 317 default:
256 return NOTIFY_DONE; 318 return NOTIFY_DONE;
257 } 319 }
320
321 return NOTIFY_DONE;
258} 322}
259 323
260static void __init ttc_setup_clocksource(struct clk *clk, void __iomem *base) 324static void __init ttc_setup_clocksource(struct clk *clk, void __iomem *base)
@@ -321,25 +385,12 @@ static int ttc_rate_change_clockevent_cb(struct notifier_block *nb,
321 385
322 switch (event) { 386 switch (event) {
323 case POST_RATE_CHANGE: 387 case POST_RATE_CHANGE:
324 {
325 unsigned long flags;
326
327 /*
328 * clockevents_update_freq should be called with IRQ disabled on
329 * the CPU the timer provides events for. The timer we use is
330 * common to both CPUs, not sure if we need to run on both
331 * cores.
332 */
333 local_irq_save(flags);
334 clockevents_update_freq(&ttcce->ce,
335 ndata->new_rate / PRESCALE);
336 local_irq_restore(flags);
337
338 /* update cached frequency */ 388 /* update cached frequency */
339 ttc->freq = ndata->new_rate; 389 ttc->freq = ndata->new_rate;
340 390
391 clockevents_update_freq(&ttcce->ce, ndata->new_rate / PRESCALE);
392
341 /* fall through */ 393 /* fall through */
342 }
343 case PRE_RATE_CHANGE: 394 case PRE_RATE_CHANGE:
344 case ABORT_RATE_CHANGE: 395 case ABORT_RATE_CHANGE:
345 default: 396 default:
diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
index 48f76bc05da0..c2e390efbdca 100644
--- a/drivers/clocksource/exynos_mct.c
+++ b/drivers/clocksource/exynos_mct.c
@@ -410,7 +410,7 @@ static int exynos4_local_timer_setup(struct clock_event_device *evt)
410 mevt = container_of(evt, struct mct_clock_event_device, evt); 410 mevt = container_of(evt, struct mct_clock_event_device, evt);
411 411
412 mevt->base = EXYNOS4_MCT_L_BASE(cpu); 412 mevt->base = EXYNOS4_MCT_L_BASE(cpu);
413 sprintf(mevt->name, "mct_tick%d", cpu); 413 snprintf(mevt->name, sizeof(mevt->name), "mct_tick%d", cpu);
414 414
415 evt->name = mevt->name; 415 evt->name = mevt->name;
416 evt->cpumask = cpumask_of(cpu); 416 evt->cpumask = cpumask_of(cpu);
diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c
index bf497afba9ad..efb17c3ee120 100644
--- a/drivers/clocksource/sun4i_timer.c
+++ b/drivers/clocksource/sun4i_timer.c
@@ -196,5 +196,5 @@ static void __init sun4i_timer_init(struct device_node *node)
196 clockevents_config_and_register(&sun4i_clockevent, rate, 196 clockevents_config_and_register(&sun4i_clockevent, rate,
197 TIMER_SYNC_TICKS, 0xffffffff); 197 TIMER_SYNC_TICKS, 0xffffffff);
198} 198}
199CLOCKSOURCE_OF_DECLARE(sun4i, "allwinner,sun4i-timer", 199CLOCKSOURCE_OF_DECLARE(sun4i, "allwinner,sun4i-a10-timer",
200 sun4i_timer_init); 200 sun4i_timer_init);
diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c
index ee8691b89944..0451e62fac7a 100644
--- a/drivers/clocksource/time-armada-370-xp.c
+++ b/drivers/clocksource/time-armada-370-xp.c
@@ -85,12 +85,6 @@ static u32 ticks_per_jiffy;
85 85
86static struct clock_event_device __percpu *armada_370_xp_evt; 86static struct clock_event_device __percpu *armada_370_xp_evt;
87 87
88static void timer_ctrl_clrset(u32 clr, u32 set)
89{
90 writel((readl(timer_base + TIMER_CTRL_OFF) & ~clr) | set,
91 timer_base + TIMER_CTRL_OFF);
92}
93
94static void local_timer_ctrl_clrset(u32 clr, u32 set) 88static void local_timer_ctrl_clrset(u32 clr, u32 set)
95{ 89{
96 writel((readl(local_base + TIMER_CTRL_OFF) & ~clr) | set, 90 writel((readl(local_base + TIMER_CTRL_OFF) & ~clr) | set,
@@ -245,7 +239,7 @@ static void __init armada_370_xp_timer_common_init(struct device_node *np)
245 clr = TIMER0_25MHZ; 239 clr = TIMER0_25MHZ;
246 enable_mask = TIMER0_EN | TIMER0_DIV(TIMER_DIVIDER_SHIFT); 240 enable_mask = TIMER0_EN | TIMER0_DIV(TIMER_DIVIDER_SHIFT);
247 } 241 }
248 timer_ctrl_clrset(clr, set); 242 atomic_io_modify(timer_base + TIMER_CTRL_OFF, clr | set, set);
249 local_timer_ctrl_clrset(clr, set); 243 local_timer_ctrl_clrset(clr, set);
250 244
251 /* 245 /*
@@ -263,7 +257,9 @@ static void __init armada_370_xp_timer_common_init(struct device_node *np)
263 writel(0xffffffff, timer_base + TIMER0_VAL_OFF); 257 writel(0xffffffff, timer_base + TIMER0_VAL_OFF);
264 writel(0xffffffff, timer_base + TIMER0_RELOAD_OFF); 258 writel(0xffffffff, timer_base + TIMER0_RELOAD_OFF);
265 259
266 timer_ctrl_clrset(0, TIMER0_RELOAD_EN | enable_mask); 260 atomic_io_modify(timer_base + TIMER_CTRL_OFF,
261 TIMER0_RELOAD_EN | enable_mask,
262 TIMER0_RELOAD_EN | enable_mask);
267 263
268 /* 264 /*
269 * Set scale and timer for sched_clock. 265 * Set scale and timer for sched_clock.
diff --git a/drivers/clocksource/time-orion.c b/drivers/clocksource/time-orion.c
index 20066222f3f2..0b3ce0399c51 100644
--- a/drivers/clocksource/time-orion.c
+++ b/drivers/clocksource/time-orion.c
@@ -35,20 +35,6 @@
35#define ORION_ONESHOT_MAX 0xfffffffe 35#define ORION_ONESHOT_MAX 0xfffffffe
36 36
37static void __iomem *timer_base; 37static void __iomem *timer_base;
38static DEFINE_SPINLOCK(timer_ctrl_lock);
39
40/*
41 * Thread-safe access to TIMER_CTRL register
42 * (shared with watchdog timer)
43 */
44void orion_timer_ctrl_clrset(u32 clr, u32 set)
45{
46 spin_lock(&timer_ctrl_lock);
47 writel((readl(timer_base + TIMER_CTRL) & ~clr) | set,
48 timer_base + TIMER_CTRL);
49 spin_unlock(&timer_ctrl_lock);
50}
51EXPORT_SYMBOL(orion_timer_ctrl_clrset);
52 38
53/* 39/*
54 * Free-running clocksource handling. 40 * Free-running clocksource handling.
@@ -68,7 +54,8 @@ static int orion_clkevt_next_event(unsigned long delta,
68{ 54{
69 /* setup and enable one-shot timer */ 55 /* setup and enable one-shot timer */
70 writel(delta, timer_base + TIMER1_VAL); 56 writel(delta, timer_base + TIMER1_VAL);
71 orion_timer_ctrl_clrset(TIMER1_RELOAD_EN, TIMER1_EN); 57 atomic_io_modify(timer_base + TIMER_CTRL,
58 TIMER1_RELOAD_EN | TIMER1_EN, TIMER1_EN);
72 59
73 return 0; 60 return 0;
74} 61}
@@ -80,10 +67,13 @@ static void orion_clkevt_mode(enum clock_event_mode mode,
80 /* setup and enable periodic timer at 1/HZ intervals */ 67 /* setup and enable periodic timer at 1/HZ intervals */
81 writel(ticks_per_jiffy - 1, timer_base + TIMER1_RELOAD); 68 writel(ticks_per_jiffy - 1, timer_base + TIMER1_RELOAD);
82 writel(ticks_per_jiffy - 1, timer_base + TIMER1_VAL); 69 writel(ticks_per_jiffy - 1, timer_base + TIMER1_VAL);
83 orion_timer_ctrl_clrset(0, TIMER1_RELOAD_EN | TIMER1_EN); 70 atomic_io_modify(timer_base + TIMER_CTRL,
71 TIMER1_RELOAD_EN | TIMER1_EN,
72 TIMER1_RELOAD_EN | TIMER1_EN);
84 } else { 73 } else {
85 /* disable timer */ 74 /* disable timer */
86 orion_timer_ctrl_clrset(TIMER1_RELOAD_EN | TIMER1_EN, 0); 75 atomic_io_modify(timer_base + TIMER_CTRL,
76 TIMER1_RELOAD_EN | TIMER1_EN, 0);
87 } 77 }
88} 78}
89 79
@@ -131,7 +121,9 @@ static void __init orion_timer_init(struct device_node *np)
131 /* setup timer0 as free-running clocksource */ 121 /* setup timer0 as free-running clocksource */
132 writel(~0, timer_base + TIMER0_VAL); 122 writel(~0, timer_base + TIMER0_VAL);
133 writel(~0, timer_base + TIMER0_RELOAD); 123 writel(~0, timer_base + TIMER0_RELOAD);
134 orion_timer_ctrl_clrset(0, TIMER0_RELOAD_EN | TIMER0_EN); 124 atomic_io_modify(timer_base + TIMER_CTRL,
125 TIMER0_RELOAD_EN | TIMER0_EN,
126 TIMER0_RELOAD_EN | TIMER0_EN);
135 clocksource_mmio_init(timer_base + TIMER0_VAL, "orion_clocksource", 127 clocksource_mmio_init(timer_base + TIMER0_VAL, "orion_clocksource",
136 clk_get_rate(clk), 300, 32, 128 clk_get_rate(clk), 300, 32,
137 clocksource_mmio_readl_down); 129 clocksource_mmio_readl_down);
diff --git a/drivers/clocksource/timer-keystone.c b/drivers/clocksource/timer-keystone.c
new file mode 100644
index 000000000000..0250354f7e55
--- /dev/null
+++ b/drivers/clocksource/timer-keystone.c
@@ -0,0 +1,241 @@
1/*
2 * Keystone broadcast clock-event
3 *
4 * Copyright 2013 Texas Instruments, Inc.
5 *
6 * Author: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14#include <linux/clk.h>
15#include <linux/clockchips.h>
16#include <linux/clocksource.h>
17#include <linux/interrupt.h>
18#include <linux/of_address.h>
19#include <linux/of_irq.h>
20
21#define TIMER_NAME "timer-keystone"
22
23/* Timer register offsets */
24#define TIM12 0x10
25#define TIM34 0x14
26#define PRD12 0x18
27#define PRD34 0x1c
28#define TCR 0x20
29#define TGCR 0x24
30#define INTCTLSTAT 0x44
31
32/* Timer register bitfields */
33#define TCR_ENAMODE_MASK 0xC0
34#define TCR_ENAMODE_ONESHOT_MASK 0x40
35#define TCR_ENAMODE_PERIODIC_MASK 0x80
36
37#define TGCR_TIM_UNRESET_MASK 0x03
38#define INTCTLSTAT_ENINT_MASK 0x01
39
40/**
41 * struct keystone_timer: holds timer's data
42 * @base: timer memory base address
43 * @hz_period: cycles per HZ period
44 * @event_dev: event device based on timer
45 */
46static struct keystone_timer {
47 void __iomem *base;
48 unsigned long hz_period;
49 struct clock_event_device event_dev;
50} timer;
51
52static inline u32 keystone_timer_readl(unsigned long rg)
53{
54 return readl_relaxed(timer.base + rg);
55}
56
57static inline void keystone_timer_writel(u32 val, unsigned long rg)
58{
59 writel_relaxed(val, timer.base + rg);
60}
61
62/**
63 * keystone_timer_barrier: write memory barrier
64 * use explicit barrier to avoid using readl/writel non relaxed function
65 * variants, because in our case non relaxed variants hide the true places
66 * where barrier is needed.
67 */
68static inline void keystone_timer_barrier(void)
69{
70 __iowmb();
71}
72
73/**
74 * keystone_timer_config: configures timer to work in oneshot/periodic modes.
75 * @ mode: mode to configure
76 * @ period: cycles number to configure for
77 */
78static int keystone_timer_config(u64 period, enum clock_event_mode mode)
79{
80 u32 tcr;
81 u32 off;
82
83 tcr = keystone_timer_readl(TCR);
84 off = tcr & ~(TCR_ENAMODE_MASK);
85
86 /* set enable mode */
87 switch (mode) {
88 case CLOCK_EVT_MODE_ONESHOT:
89 tcr |= TCR_ENAMODE_ONESHOT_MASK;
90 break;
91 case CLOCK_EVT_MODE_PERIODIC:
92 tcr |= TCR_ENAMODE_PERIODIC_MASK;
93 break;
94 default:
95 return -1;
96 }
97
98 /* disable timer */
99 keystone_timer_writel(off, TCR);
100 /* here we have to be sure the timer has been disabled */
101 keystone_timer_barrier();
102
103 /* reset counter to zero, set new period */
104 keystone_timer_writel(0, TIM12);
105 keystone_timer_writel(0, TIM34);
106 keystone_timer_writel(period & 0xffffffff, PRD12);
107 keystone_timer_writel(period >> 32, PRD34);
108
109 /*
110 * enable timer
111 * here we have to be sure that CNTLO, CNTHI, PRDLO, PRDHI registers
112 * have been written.
113 */
114 keystone_timer_barrier();
115 keystone_timer_writel(tcr, TCR);
116 return 0;
117}
118
119static void keystone_timer_disable(void)
120{
121 u32 tcr;
122
123 tcr = keystone_timer_readl(TCR);
124
125 /* disable timer */
126 tcr &= ~(TCR_ENAMODE_MASK);
127 keystone_timer_writel(tcr, TCR);
128}
129
130static irqreturn_t keystone_timer_interrupt(int irq, void *dev_id)
131{
132 struct clock_event_device *evt = dev_id;
133
134 evt->event_handler(evt);
135 return IRQ_HANDLED;
136}
137
138static int keystone_set_next_event(unsigned long cycles,
139 struct clock_event_device *evt)
140{
141 return keystone_timer_config(cycles, evt->mode);
142}
143
144static void keystone_set_mode(enum clock_event_mode mode,
145 struct clock_event_device *evt)
146{
147 switch (mode) {
148 case CLOCK_EVT_MODE_PERIODIC:
149 keystone_timer_config(timer.hz_period, CLOCK_EVT_MODE_PERIODIC);
150 break;
151 case CLOCK_EVT_MODE_UNUSED:
152 case CLOCK_EVT_MODE_SHUTDOWN:
153 case CLOCK_EVT_MODE_ONESHOT:
154 keystone_timer_disable();
155 break;
156 default:
157 break;
158 }
159}
160
161static void __init keystone_timer_init(struct device_node *np)
162{
163 struct clock_event_device *event_dev = &timer.event_dev;
164 unsigned long rate;
165 struct clk *clk;
166 int irq, error;
167
168 irq = irq_of_parse_and_map(np, 0);
169 if (irq == NO_IRQ) {
170 pr_err("%s: failed to map interrupts\n", __func__);
171 return;
172 }
173
174 timer.base = of_iomap(np, 0);
175 if (!timer.base) {
176 pr_err("%s: failed to map registers\n", __func__);
177 return;
178 }
179
180 clk = of_clk_get(np, 0);
181 if (IS_ERR(clk)) {
182 pr_err("%s: failed to get clock\n", __func__);
183 iounmap(timer.base);
184 return;
185 }
186
187 error = clk_prepare_enable(clk);
188 if (error) {
189 pr_err("%s: failed to enable clock\n", __func__);
190 goto err;
191 }
192
193 rate = clk_get_rate(clk);
194
195 /* disable, use internal clock source */
196 keystone_timer_writel(0, TCR);
197 /* here we have to be sure the timer has been disabled */
198 keystone_timer_barrier();
199
200 /* reset timer as 64-bit, no pre-scaler, plus features are disabled */
201 keystone_timer_writel(0, TGCR);
202
203 /* unreset timer */
204 keystone_timer_writel(TGCR_TIM_UNRESET_MASK, TGCR);
205
206 /* init counter to zero */
207 keystone_timer_writel(0, TIM12);
208 keystone_timer_writel(0, TIM34);
209
210 timer.hz_period = DIV_ROUND_UP(rate, HZ);
211
212 /* enable timer interrupts */
213 keystone_timer_writel(INTCTLSTAT_ENINT_MASK, INTCTLSTAT);
214
215 error = request_irq(irq, keystone_timer_interrupt, IRQF_TIMER,
216 TIMER_NAME, event_dev);
217 if (error) {
218 pr_err("%s: failed to setup irq\n", __func__);
219 goto err;
220 }
221
222 /* setup clockevent */
223 event_dev->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT;
224 event_dev->set_next_event = keystone_set_next_event;
225 event_dev->set_mode = keystone_set_mode;
226 event_dev->cpumask = cpu_all_mask;
227 event_dev->owner = THIS_MODULE;
228 event_dev->name = TIMER_NAME;
229 event_dev->irq = irq;
230
231 clockevents_config_and_register(event_dev, rate, 1, ULONG_MAX);
232
233 pr_info("keystone timer clock @%lu Hz\n", rate);
234 return;
235err:
236 clk_put(clk);
237 iounmap(timer.base);
238}
239
240CLOCKSOURCE_OF_DECLARE(keystone_timer, "ti,keystone-timer",
241 keystone_timer_init);
diff --git a/arch/arm/mach-u300/timer.c b/drivers/clocksource/timer-u300.c
index fe08fd34c0ce..e63d469661fd 100644
--- a/arch/arm/mach-u300/timer.c
+++ b/drivers/clocksource/timer-u300.c
@@ -1,8 +1,4 @@
1/* 1/*
2 *
3 * arch/arm/mach-u300/timer.c
4 *
5 *
6 * Copyright (C) 2007-2009 ST-Ericsson AB 2 * Copyright (C) 2007-2009 ST-Ericsson AB
7 * License terms: GNU General Public License (GPL) version 2 3 * License terms: GNU General Public License (GPL) version 2
8 * Timer COH 901 328, runs the OS timer interrupt. 4 * Timer COH 901 328, runs the OS timer interrupt.
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index 4b029c0944af..1fbe11f2a146 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -200,7 +200,7 @@ source "drivers/cpufreq/Kconfig.x86"
200endmenu 200endmenu
201 201
202menu "ARM CPU frequency scaling drivers" 202menu "ARM CPU frequency scaling drivers"
203depends on ARM 203depends on ARM || ARM64
204source "drivers/cpufreq/Kconfig.arm" 204source "drivers/cpufreq/Kconfig.arm"
205endmenu 205endmenu
206 206
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index 5793e1447fb1..79911a27a48a 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -13,7 +13,7 @@
13#include <linux/cpufreq.h> 13#include <linux/cpufreq.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <asm/cputime.h> 16#include <linux/cputime.h>
17 17
18static spinlock_t cpufreq_stats_lock; 18static spinlock_t cpufreq_stats_lock;
19 19
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index a55e68f2cfc8..09d05ab262be 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -140,12 +140,14 @@ int cpuidle_idle_call(void)
140 return 0; 140 return 0;
141 } 141 }
142 142
143 trace_cpu_idle_rcuidle(next_state, dev->cpu);
144
145 broadcast = !!(drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP); 143 broadcast = !!(drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP);
146 144
147 if (broadcast) 145 if (broadcast &&
148 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu); 146 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu))
147 return -EBUSY;
148
149
150 trace_cpu_idle_rcuidle(next_state, dev->cpu);
149 151
150 if (cpuidle_state_is_coupled(dev, drv, next_state)) 152 if (cpuidle_state_is_coupled(dev, drv, next_state))
151 entered_state = cpuidle_enter_state_coupled(dev, drv, 153 entered_state = cpuidle_enter_state_coupled(dev, drv,
@@ -153,11 +155,11 @@ int cpuidle_idle_call(void)
153 else 155 else
154 entered_state = cpuidle_enter_state(dev, drv, next_state); 156 entered_state = cpuidle_enter_state(dev, drv, next_state);
155 157
158 trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);
159
156 if (broadcast) 160 if (broadcast)
157 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); 161 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
158 162
159 trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);
160
161 /* give the governor an opportunity to reflect on the outcome */ 163 /* give the governor an opportunity to reflect on the outcome */
162 if (cpuidle_curr_governor->reflect) 164 if (cpuidle_curr_governor->reflect)
163 cpuidle_curr_governor->reflect(dev, entered_state); 165 cpuidle_curr_governor->reflect(dev, entered_state);
diff --git a/drivers/gpu/drm/gma500/mmu.c b/drivers/gpu/drm/gma500/mmu.c
index 49bac41beefb..c3e67ba94446 100644
--- a/drivers/gpu/drm/gma500/mmu.c
+++ b/drivers/gpu/drm/gma500/mmu.c
@@ -520,7 +520,7 @@ struct psb_mmu_driver *psb_mmu_driver_init(uint8_t __iomem * registers,
520 520
521 driver->has_clflush = 0; 521 driver->has_clflush = 0;
522 522
523 if (boot_cpu_has(X86_FEATURE_CLFLSH)) { 523 if (boot_cpu_has(X86_FEATURE_CLFLUSH)) {
524 uint32_t tfms, misc, cap0, cap4, clflush_size; 524 uint32_t tfms, misc, cap0, cap4, clflush_size;
525 525
526 /* 526 /*
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 077bb1bdac34..3f0a95290e14 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -25,7 +25,6 @@
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/device.h> 27#include <linux/device.h>
28#include <linux/irq.h>
29#include <linux/interrupt.h> 28#include <linux/interrupt.h>
30#include <linux/sysctl.h> 29#include <linux/sysctl.h>
31#include <linux/slab.h> 30#include <linux/slab.h>
@@ -558,9 +557,6 @@ static struct bus_type hv_bus = {
558 .dev_groups = vmbus_groups, 557 .dev_groups = vmbus_groups,
559}; 558};
560 559
561static const char *driver_name = "hyperv";
562
563
564struct onmessage_work_context { 560struct onmessage_work_context {
565 struct work_struct work; 561 struct work_struct work;
566 struct hv_message msg; 562 struct hv_message msg;
@@ -619,7 +615,7 @@ static void vmbus_on_msg_dpc(unsigned long data)
619 } 615 }
620} 616}
621 617
622static irqreturn_t vmbus_isr(int irq, void *dev_id) 618static void vmbus_isr(void)
623{ 619{
624 int cpu = smp_processor_id(); 620 int cpu = smp_processor_id();
625 void *page_addr; 621 void *page_addr;
@@ -629,7 +625,7 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)
629 625
630 page_addr = hv_context.synic_event_page[cpu]; 626 page_addr = hv_context.synic_event_page[cpu];
631 if (page_addr == NULL) 627 if (page_addr == NULL)
632 return IRQ_NONE; 628 return;
633 629
634 event = (union hv_synic_event_flags *)page_addr + 630 event = (union hv_synic_event_flags *)page_addr +
635 VMBUS_MESSAGE_SINT; 631 VMBUS_MESSAGE_SINT;
@@ -665,28 +661,8 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)
665 msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; 661 msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT;
666 662
667 /* Check if there are actual msgs to be processed */ 663 /* Check if there are actual msgs to be processed */
668 if (msg->header.message_type != HVMSG_NONE) { 664 if (msg->header.message_type != HVMSG_NONE)
669 handled = true;
670 tasklet_schedule(&msg_dpc); 665 tasklet_schedule(&msg_dpc);
671 }
672
673 if (handled)
674 return IRQ_HANDLED;
675 else
676 return IRQ_NONE;
677}
678
679/*
680 * vmbus interrupt flow handler:
681 * vmbus interrupts can concurrently occur on multiple CPUs and
682 * can be handled concurrently.
683 */
684
685static void vmbus_flow_handler(unsigned int irq, struct irq_desc *desc)
686{
687 kstat_incr_irqs_this_cpu(irq, desc);
688
689 desc->action->handler(irq, desc->action->dev_id);
690} 666}
691 667
692/* 668/*
@@ -715,25 +691,7 @@ static int vmbus_bus_init(int irq)
715 if (ret) 691 if (ret)
716 goto err_cleanup; 692 goto err_cleanup;
717 693
718 ret = request_irq(irq, vmbus_isr, 0, driver_name, hv_acpi_dev); 694 hv_setup_vmbus_irq(vmbus_isr);
719
720 if (ret != 0) {
721 pr_err("Unable to request IRQ %d\n",
722 irq);
723 goto err_unregister;
724 }
725
726 /*
727 * Vmbus interrupts can be handled concurrently on
728 * different CPUs. Establish an appropriate interrupt flow
729 * handler that can support this model.
730 */
731 irq_set_handler(irq, vmbus_flow_handler);
732
733 /*
734 * Register our interrupt handler.
735 */
736 hv_register_vmbus_handler(irq, vmbus_isr);
737 695
738 ret = hv_synic_alloc(); 696 ret = hv_synic_alloc();
739 if (ret) 697 if (ret)
@@ -753,9 +711,8 @@ static int vmbus_bus_init(int irq)
753 711
754err_alloc: 712err_alloc:
755 hv_synic_free(); 713 hv_synic_free();
756 free_irq(irq, hv_acpi_dev); 714 hv_remove_vmbus_irq();
757 715
758err_unregister:
759 bus_unregister(&hv_bus); 716 bus_unregister(&hv_bus);
760 717
761err_cleanup: 718err_cleanup:
@@ -947,7 +904,6 @@ static int __init hv_acpi_init(void)
947 /* 904 /*
948 * Get irq resources first. 905 * Get irq resources first.
949 */ 906 */
950
951 ret = acpi_bus_register_driver(&vmbus_acpi_driver); 907 ret = acpi_bus_register_driver(&vmbus_acpi_driver);
952 908
953 if (ret) 909 if (ret)
@@ -978,8 +934,7 @@ cleanup:
978 934
979static void __exit vmbus_exit(void) 935static void __exit vmbus_exit(void)
980{ 936{
981 937 hv_remove_vmbus_irq();
982 free_irq(irq, hv_acpi_dev);
983 vmbus_free_channels(); 938 vmbus_free_channels();
984 bus_unregister(&hv_bus); 939 bus_unregister(&hv_bus);
985 hv_cleanup(); 940 hv_cleanup();
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index 5194afb39e78..1c0c151d108c 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o
12obj-$(CONFIG_ARCH_MOXART) += irq-moxart.o 12obj-$(CONFIG_ARCH_MOXART) += irq-moxart.o
13obj-$(CONFIG_ORION_IRQCHIP) += irq-orion.o 13obj-$(CONFIG_ORION_IRQCHIP) += irq-orion.o
14obj-$(CONFIG_ARCH_SUNXI) += irq-sun4i.o 14obj-$(CONFIG_ARCH_SUNXI) += irq-sun4i.o
15obj-$(CONFIG_ARCH_SUNXI) += irq-sunxi-nmi.o
15obj-$(CONFIG_ARCH_SPEAR3XX) += spear-shirq.o 16obj-$(CONFIG_ARCH_SPEAR3XX) += spear-shirq.o
16obj-$(CONFIG_ARM_GIC) += irq-gic.o 17obj-$(CONFIG_ARM_GIC) += irq-gic.o
17obj-$(CONFIG_ARM_NVIC) += irq-nvic.o 18obj-$(CONFIG_ARM_NVIC) += irq-nvic.o
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 540956465ed2..41be897df8d5 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -18,6 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/irqchip/chained_irq.h>
21#include <linux/io.h> 22#include <linux/io.h>
22#include <linux/of_address.h> 23#include <linux/of_address.h>
23#include <linux/of_irq.h> 24#include <linux/of_irq.h>
@@ -42,6 +43,7 @@
42#define ARMADA_370_XP_INT_SOURCE_CTL(irq) (0x100 + irq*4) 43#define ARMADA_370_XP_INT_SOURCE_CTL(irq) (0x100 + irq*4)
43 44
44#define ARMADA_370_XP_CPU_INTACK_OFFS (0x44) 45#define ARMADA_370_XP_CPU_INTACK_OFFS (0x44)
46#define ARMADA_375_PPI_CAUSE (0x10)
45 47
46#define ARMADA_370_XP_SW_TRIG_INT_OFFS (0x4) 48#define ARMADA_370_XP_SW_TRIG_INT_OFFS (0x4)
47#define ARMADA_370_XP_IN_DRBEL_MSK_OFFS (0xc) 49#define ARMADA_370_XP_IN_DRBEL_MSK_OFFS (0xc)
@@ -352,7 +354,63 @@ static struct irq_domain_ops armada_370_xp_mpic_irq_ops = {
352 .xlate = irq_domain_xlate_onecell, 354 .xlate = irq_domain_xlate_onecell,
353}; 355};
354 356
355static asmlinkage void __exception_irq_entry 357#ifdef CONFIG_PCI_MSI
358static void armada_370_xp_handle_msi_irq(struct pt_regs *regs, bool is_chained)
359{
360 u32 msimask, msinr;
361
362 msimask = readl_relaxed(per_cpu_int_base +
363 ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS)
364 & PCI_MSI_DOORBELL_MASK;
365
366 writel(~msimask, per_cpu_int_base +
367 ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS);
368
369 for (msinr = PCI_MSI_DOORBELL_START;
370 msinr < PCI_MSI_DOORBELL_END; msinr++) {
371 int irq;
372
373 if (!(msimask & BIT(msinr)))
374 continue;
375
376 irq = irq_find_mapping(armada_370_xp_msi_domain,
377 msinr - 16);
378
379 if (is_chained)
380 generic_handle_irq(irq);
381 else
382 handle_IRQ(irq, regs);
383 }
384}
385#else
386static void armada_370_xp_handle_msi_irq(struct pt_regs *r, bool b) {}
387#endif
388
389static void armada_370_xp_mpic_handle_cascade_irq(unsigned int irq,
390 struct irq_desc *desc)
391{
392 struct irq_chip *chip = irq_get_chip(irq);
393 unsigned long irqmap, irqn;
394 unsigned int cascade_irq;
395
396 chained_irq_enter(chip, desc);
397
398 irqmap = readl_relaxed(per_cpu_int_base + ARMADA_375_PPI_CAUSE);
399
400 if (irqmap & BIT(0)) {
401 armada_370_xp_handle_msi_irq(NULL, true);
402 irqmap &= ~BIT(0);
403 }
404
405 for_each_set_bit(irqn, &irqmap, BITS_PER_LONG) {
406 cascade_irq = irq_find_mapping(armada_370_xp_mpic_domain, irqn);
407 generic_handle_irq(cascade_irq);
408 }
409
410 chained_irq_exit(chip, desc);
411}
412
413static void __exception_irq_entry
356armada_370_xp_handle_irq(struct pt_regs *regs) 414armada_370_xp_handle_irq(struct pt_regs *regs)
357{ 415{
358 u32 irqstat, irqnr; 416 u32 irqstat, irqnr;
@@ -372,31 +430,9 @@ armada_370_xp_handle_irq(struct pt_regs *regs)
372 continue; 430 continue;
373 } 431 }
374 432
375#ifdef CONFIG_PCI_MSI
376 /* MSI handling */ 433 /* MSI handling */
377 if (irqnr == 1) { 434 if (irqnr == 1)
378 u32 msimask, msinr; 435 armada_370_xp_handle_msi_irq(regs, false);
379
380 msimask = readl_relaxed(per_cpu_int_base +
381 ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS)
382 & PCI_MSI_DOORBELL_MASK;
383
384 writel(~msimask, per_cpu_int_base +
385 ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS);
386
387 for (msinr = PCI_MSI_DOORBELL_START;
388 msinr < PCI_MSI_DOORBELL_END; msinr++) {
389 int irq;
390
391 if (!(msimask & BIT(msinr)))
392 continue;
393
394 irq = irq_find_mapping(armada_370_xp_msi_domain,
395 msinr - 16);
396 handle_IRQ(irq, regs);
397 }
398 }
399#endif
400 436
401#ifdef CONFIG_SMP 437#ifdef CONFIG_SMP
402 /* IPI Handling */ 438 /* IPI Handling */
@@ -427,6 +463,7 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,
427 struct device_node *parent) 463 struct device_node *parent)
428{ 464{
429 struct resource main_int_res, per_cpu_int_res; 465 struct resource main_int_res, per_cpu_int_res;
466 int parent_irq;
430 u32 control; 467 u32 control;
431 468
432 BUG_ON(of_address_to_resource(node, 0, &main_int_res)); 469 BUG_ON(of_address_to_resource(node, 0, &main_int_res));
@@ -455,8 +492,6 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,
455 492
456 BUG_ON(!armada_370_xp_mpic_domain); 493 BUG_ON(!armada_370_xp_mpic_domain);
457 494
458 irq_set_default_host(armada_370_xp_mpic_domain);
459
460#ifdef CONFIG_SMP 495#ifdef CONFIG_SMP
461 armada_xp_mpic_smp_cpu_init(); 496 armada_xp_mpic_smp_cpu_init();
462 497
@@ -472,7 +507,14 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,
472 507
473 armada_370_xp_msi_init(node, main_int_res.start); 508 armada_370_xp_msi_init(node, main_int_res.start);
474 509
475 set_handle_irq(armada_370_xp_handle_irq); 510 parent_irq = irq_of_parse_and_map(node, 0);
511 if (parent_irq <= 0) {
512 irq_set_default_host(armada_370_xp_mpic_domain);
513 set_handle_irq(armada_370_xp_handle_irq);
514 } else {
515 irq_set_chained_handler(parent_irq,
516 armada_370_xp_mpic_handle_cascade_irq);
517 }
476 518
477 return 0; 519 return 0;
478} 520}
diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c
index 1693b8e7f26a..5916d6cdafa1 100644
--- a/drivers/irqchip/irq-bcm2835.c
+++ b/drivers/irqchip/irq-bcm2835.c
@@ -95,7 +95,7 @@ struct armctrl_ic {
95}; 95};
96 96
97static struct armctrl_ic intc __read_mostly; 97static struct armctrl_ic intc __read_mostly;
98static asmlinkage void __exception_irq_entry bcm2835_handle_irq( 98static void __exception_irq_entry bcm2835_handle_irq(
99 struct pt_regs *regs); 99 struct pt_regs *regs);
100 100
101static void armctrl_mask_irq(struct irq_data *d) 101static void armctrl_mask_irq(struct irq_data *d)
@@ -196,7 +196,7 @@ static void armctrl_handle_shortcut(int bank, struct pt_regs *regs,
196 handle_IRQ(irq_linear_revmap(intc.domain, irq), regs); 196 handle_IRQ(irq_linear_revmap(intc.domain, irq), regs);
197} 197}
198 198
199static asmlinkage void __exception_irq_entry bcm2835_handle_irq( 199static void __exception_irq_entry bcm2835_handle_irq(
200 struct pt_regs *regs) 200 struct pt_regs *regs)
201{ 201{
202 u32 stat, irq; 202 u32 stat, irq;
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 341c6016812d..531769b2433a 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -50,7 +50,7 @@
50 50
51union gic_base { 51union gic_base {
52 void __iomem *common_base; 52 void __iomem *common_base;
53 void __percpu __iomem **percpu_base; 53 void __percpu * __iomem *percpu_base;
54}; 54};
55 55
56struct gic_chip_data { 56struct gic_chip_data {
@@ -279,7 +279,7 @@ static int gic_set_wake(struct irq_data *d, unsigned int on)
279#define gic_set_wake NULL 279#define gic_set_wake NULL
280#endif 280#endif
281 281
282static asmlinkage void __exception_irq_entry gic_handle_irq(struct pt_regs *regs) 282static void __exception_irq_entry gic_handle_irq(struct pt_regs *regs)
283{ 283{
284 u32 irqstat, irqnr; 284 u32 irqstat, irqnr;
285 struct gic_chip_data *gic = &gic_data[0]; 285 struct gic_chip_data *gic = &gic_data[0];
@@ -648,7 +648,7 @@ static void __init gic_pm_init(struct gic_chip_data *gic)
648#endif 648#endif
649 649
650#ifdef CONFIG_SMP 650#ifdef CONFIG_SMP
651void gic_raise_softirq(const struct cpumask *mask, unsigned int irq) 651static void gic_raise_softirq(const struct cpumask *mask, unsigned int irq)
652{ 652{
653 int cpu; 653 int cpu;
654 unsigned long flags, map = 0; 654 unsigned long flags, map = 0;
@@ -869,7 +869,7 @@ static struct notifier_block gic_cpu_notifier = {
869}; 869};
870#endif 870#endif
871 871
872const struct irq_domain_ops gic_irq_domain_ops = { 872static const struct irq_domain_ops gic_irq_domain_ops = {
873 .map = gic_irq_domain_map, 873 .map = gic_irq_domain_map,
874 .xlate = gic_irq_domain_xlate, 874 .xlate = gic_irq_domain_xlate,
875}; 875};
@@ -974,7 +974,8 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start,
974#ifdef CONFIG_OF 974#ifdef CONFIG_OF
975static int gic_cnt __initdata; 975static int gic_cnt __initdata;
976 976
977int __init gic_of_init(struct device_node *node, struct device_node *parent) 977static int __init
978gic_of_init(struct device_node *node, struct device_node *parent)
978{ 979{
979 void __iomem *cpu_base; 980 void __iomem *cpu_base;
980 void __iomem *dist_base; 981 void __iomem *dist_base;
diff --git a/drivers/irqchip/irq-mmp.c b/drivers/irqchip/irq-mmp.c
index 2cb7cd0bc2f5..3c8827fe83f3 100644
--- a/drivers/irqchip/irq-mmp.c
+++ b/drivers/irqchip/irq-mmp.c
@@ -194,8 +194,7 @@ static struct mmp_intc_conf mmp2_conf = {
194 .conf_mask = 0x7f, 194 .conf_mask = 0x7f,
195}; 195};
196 196
197static asmlinkage void __exception_irq_entry 197static void __exception_irq_entry mmp_handle_irq(struct pt_regs *regs)
198mmp_handle_irq(struct pt_regs *regs)
199{ 198{
200 int irq, hwirq; 199 int irq, hwirq;
201 200
@@ -207,8 +206,7 @@ mmp_handle_irq(struct pt_regs *regs)
207 handle_IRQ(irq, regs); 206 handle_IRQ(irq, regs);
208} 207}
209 208
210static asmlinkage void __exception_irq_entry 209static void __exception_irq_entry mmp2_handle_irq(struct pt_regs *regs)
211mmp2_handle_irq(struct pt_regs *regs)
212{ 210{
213 int irq, hwirq; 211 int irq, hwirq;
214 212
diff --git a/drivers/irqchip/irq-moxart.c b/drivers/irqchip/irq-moxart.c
index 5552fc2bf28a..00b3cc908f76 100644
--- a/drivers/irqchip/irq-moxart.c
+++ b/drivers/irqchip/irq-moxart.c
@@ -44,7 +44,7 @@ struct moxart_irq_data {
44 44
45static struct moxart_irq_data intc; 45static struct moxart_irq_data intc;
46 46
47static asmlinkage void __exception_irq_entry handle_irq(struct pt_regs *regs) 47static void __exception_irq_entry handle_irq(struct pt_regs *regs)
48{ 48{
49 u32 irqstat; 49 u32 irqstat;
50 int hwirq; 50 int hwirq;
diff --git a/drivers/irqchip/irq-orion.c b/drivers/irqchip/irq-orion.c
index 8e41be62812e..e25f246cd2fb 100644
--- a/drivers/irqchip/irq-orion.c
+++ b/drivers/irqchip/irq-orion.c
@@ -30,7 +30,7 @@
30 30
31static struct irq_domain *orion_irq_domain; 31static struct irq_domain *orion_irq_domain;
32 32
33static asmlinkage void 33static void
34__exception_irq_entry orion_handle_irq(struct pt_regs *regs) 34__exception_irq_entry orion_handle_irq(struct pt_regs *regs)
35{ 35{
36 struct irq_domain_chip_generic *dgc = orion_irq_domain->gc; 36 struct irq_domain_chip_generic *dgc = orion_irq_domain->gc;
diff --git a/drivers/irqchip/irq-sirfsoc.c b/drivers/irqchip/irq-sirfsoc.c
index 3a070c587ed9..581eefe331ae 100644
--- a/drivers/irqchip/irq-sirfsoc.c
+++ b/drivers/irqchip/irq-sirfsoc.c
@@ -47,7 +47,7 @@ sirfsoc_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
47 ct->regs.mask = SIRFSOC_INT_RISC_MASK0; 47 ct->regs.mask = SIRFSOC_INT_RISC_MASK0;
48} 48}
49 49
50static asmlinkage void __exception_irq_entry sirfsoc_handle_irq(struct pt_regs *regs) 50static void __exception_irq_entry sirfsoc_handle_irq(struct pt_regs *regs)
51{ 51{
52 void __iomem *base = sirfsoc_irqdomain->host_data; 52 void __iomem *base = sirfsoc_irqdomain->host_data;
53 u32 irqstat, irqnr; 53 u32 irqstat, irqnr;
diff --git a/drivers/irqchip/irq-sun4i.c b/drivers/irqchip/irq-sun4i.c
index a5438d889245..6fcef4a95a18 100644
--- a/drivers/irqchip/irq-sun4i.c
+++ b/drivers/irqchip/irq-sun4i.c
@@ -36,18 +36,16 @@
36static void __iomem *sun4i_irq_base; 36static void __iomem *sun4i_irq_base;
37static struct irq_domain *sun4i_irq_domain; 37static struct irq_domain *sun4i_irq_domain;
38 38
39static asmlinkage void __exception_irq_entry sun4i_handle_irq(struct pt_regs *regs); 39static void __exception_irq_entry sun4i_handle_irq(struct pt_regs *regs);
40 40
41static void sun4i_irq_ack(struct irq_data *irqd) 41static void sun4i_irq_ack(struct irq_data *irqd)
42{ 42{
43 unsigned int irq = irqd_to_hwirq(irqd); 43 unsigned int irq = irqd_to_hwirq(irqd);
44 unsigned int irq_off = irq % 32;
45 int reg = irq / 32;
46 u32 val;
47 44
48 val = readl(sun4i_irq_base + SUN4I_IRQ_PENDING_REG(reg)); 45 if (irq != 0)
49 writel(val | (1 << irq_off), 46 return; /* Only IRQ 0 / the ENMI needs to be acked */
50 sun4i_irq_base + SUN4I_IRQ_PENDING_REG(reg)); 47
48 writel(BIT(0), sun4i_irq_base + SUN4I_IRQ_PENDING_REG(0));
51} 49}
52 50
53static void sun4i_irq_mask(struct irq_data *irqd) 51static void sun4i_irq_mask(struct irq_data *irqd)
@@ -76,16 +74,16 @@ static void sun4i_irq_unmask(struct irq_data *irqd)
76 74
77static struct irq_chip sun4i_irq_chip = { 75static struct irq_chip sun4i_irq_chip = {
78 .name = "sun4i_irq", 76 .name = "sun4i_irq",
79 .irq_ack = sun4i_irq_ack, 77 .irq_eoi = sun4i_irq_ack,
80 .irq_mask = sun4i_irq_mask, 78 .irq_mask = sun4i_irq_mask,
81 .irq_unmask = sun4i_irq_unmask, 79 .irq_unmask = sun4i_irq_unmask,
80 .flags = IRQCHIP_EOI_THREADED | IRQCHIP_EOI_IF_HANDLED,
82}; 81};
83 82
84static int sun4i_irq_map(struct irq_domain *d, unsigned int virq, 83static int sun4i_irq_map(struct irq_domain *d, unsigned int virq,
85 irq_hw_number_t hw) 84 irq_hw_number_t hw)
86{ 85{
87 irq_set_chip_and_handler(virq, &sun4i_irq_chip, 86 irq_set_chip_and_handler(virq, &sun4i_irq_chip, handle_fasteoi_irq);
88 handle_level_irq);
89 set_irq_flags(virq, IRQF_VALID | IRQF_PROBE); 87 set_irq_flags(virq, IRQF_VALID | IRQF_PROBE);
90 88
91 return 0; 89 return 0;
@@ -109,7 +107,7 @@ static int __init sun4i_of_init(struct device_node *node,
109 writel(0, sun4i_irq_base + SUN4I_IRQ_ENABLE_REG(1)); 107 writel(0, sun4i_irq_base + SUN4I_IRQ_ENABLE_REG(1));
110 writel(0, sun4i_irq_base + SUN4I_IRQ_ENABLE_REG(2)); 108 writel(0, sun4i_irq_base + SUN4I_IRQ_ENABLE_REG(2));
111 109
112 /* Mask all the interrupts */ 110 /* Unmask all the interrupts, ENABLE_REG(x) is used for masking */
113 writel(0, sun4i_irq_base + SUN4I_IRQ_MASK_REG(0)); 111 writel(0, sun4i_irq_base + SUN4I_IRQ_MASK_REG(0));
114 writel(0, sun4i_irq_base + SUN4I_IRQ_MASK_REG(1)); 112 writel(0, sun4i_irq_base + SUN4I_IRQ_MASK_REG(1));
115 writel(0, sun4i_irq_base + SUN4I_IRQ_MASK_REG(2)); 113 writel(0, sun4i_irq_base + SUN4I_IRQ_MASK_REG(2));
@@ -134,16 +132,30 @@ static int __init sun4i_of_init(struct device_node *node,
134 132
135 return 0; 133 return 0;
136} 134}
137IRQCHIP_DECLARE(allwinner_sun4i_ic, "allwinner,sun4i-ic", sun4i_of_init); 135IRQCHIP_DECLARE(allwinner_sun4i_ic, "allwinner,sun4i-a10-ic", sun4i_of_init);
138 136
139static asmlinkage void __exception_irq_entry sun4i_handle_irq(struct pt_regs *regs) 137static void __exception_irq_entry sun4i_handle_irq(struct pt_regs *regs)
140{ 138{
141 u32 irq, hwirq; 139 u32 irq, hwirq;
142 140
141 /*
142 * hwirq == 0 can mean one of 3 things:
143 * 1) no more irqs pending
144 * 2) irq 0 pending
145 * 3) spurious irq
146 * So if we immediately get a reading of 0, check the irq-pending reg
147 * to differentiate between 2 and 3. We only do this once to avoid
148 * the extra check in the common case of 1 hapening after having
149 * read the vector-reg once.
150 */
143 hwirq = readl(sun4i_irq_base + SUN4I_IRQ_VECTOR_REG) >> 2; 151 hwirq = readl(sun4i_irq_base + SUN4I_IRQ_VECTOR_REG) >> 2;
144 while (hwirq != 0) { 152 if (hwirq == 0 &&
153 !(readl(sun4i_irq_base + SUN4I_IRQ_PENDING_REG(0)) & BIT(0)))
154 return;
155
156 do {
145 irq = irq_find_mapping(sun4i_irq_domain, hwirq); 157 irq = irq_find_mapping(sun4i_irq_domain, hwirq);
146 handle_IRQ(irq, regs); 158 handle_IRQ(irq, regs);
147 hwirq = readl(sun4i_irq_base + SUN4I_IRQ_VECTOR_REG) >> 2; 159 hwirq = readl(sun4i_irq_base + SUN4I_IRQ_VECTOR_REG) >> 2;
148 } 160 } while (hwirq != 0);
149} 161}
diff --git a/drivers/irqchip/irq-sunxi-nmi.c b/drivers/irqchip/irq-sunxi-nmi.c
new file mode 100644
index 000000000000..12f547a44ae4
--- /dev/null
+++ b/drivers/irqchip/irq-sunxi-nmi.c
@@ -0,0 +1,208 @@
1/*
2 * Allwinner A20/A31 SoCs NMI IRQ chip driver.
3 *
4 * Carlo Caione <carlo.caione@gmail.com>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#include <linux/bitops.h>
12#include <linux/device.h>
13#include <linux/io.h>
14#include <linux/irq.h>
15#include <linux/interrupt.h>
16#include <linux/irqdomain.h>
17#include <linux/of_irq.h>
18#include <linux/of_address.h>
19#include <linux/of_platform.h>
20#include <linux/irqchip/chained_irq.h>
21#include "irqchip.h"
22
23#define SUNXI_NMI_SRC_TYPE_MASK 0x00000003
24
25enum {
26 SUNXI_SRC_TYPE_LEVEL_LOW = 0,
27 SUNXI_SRC_TYPE_EDGE_FALLING,
28 SUNXI_SRC_TYPE_LEVEL_HIGH,
29 SUNXI_SRC_TYPE_EDGE_RISING,
30};
31
32struct sunxi_sc_nmi_reg_offs {
33 u32 ctrl;
34 u32 pend;
35 u32 enable;
36};
37
38static struct sunxi_sc_nmi_reg_offs sun7i_reg_offs = {
39 .ctrl = 0x00,
40 .pend = 0x04,
41 .enable = 0x08,
42};
43
44static struct sunxi_sc_nmi_reg_offs sun6i_reg_offs = {
45 .ctrl = 0x00,
46 .pend = 0x04,
47 .enable = 0x34,
48};
49
50static inline void sunxi_sc_nmi_write(struct irq_chip_generic *gc, u32 off,
51 u32 val)
52{
53 irq_reg_writel(val, gc->reg_base + off);
54}
55
56static inline u32 sunxi_sc_nmi_read(struct irq_chip_generic *gc, u32 off)
57{
58 return irq_reg_readl(gc->reg_base + off);
59}
60
61static void sunxi_sc_nmi_handle_irq(unsigned int irq, struct irq_desc *desc)
62{
63 struct irq_domain *domain = irq_desc_get_handler_data(desc);
64 struct irq_chip *chip = irq_get_chip(irq);
65 unsigned int virq = irq_find_mapping(domain, 0);
66
67 chained_irq_enter(chip, desc);
68 generic_handle_irq(virq);
69 chained_irq_exit(chip, desc);
70}
71
72static int sunxi_sc_nmi_set_type(struct irq_data *data, unsigned int flow_type)
73{
74 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data);
75 struct irq_chip_type *ct = gc->chip_types;
76 u32 src_type_reg;
77 u32 ctrl_off = ct->regs.type;
78 unsigned int src_type;
79 unsigned int i;
80
81 irq_gc_lock(gc);
82
83 switch (flow_type & IRQF_TRIGGER_MASK) {
84 case IRQ_TYPE_EDGE_FALLING:
85 src_type = SUNXI_SRC_TYPE_EDGE_FALLING;
86 break;
87 case IRQ_TYPE_EDGE_RISING:
88 src_type = SUNXI_SRC_TYPE_EDGE_RISING;
89 break;
90 case IRQ_TYPE_LEVEL_HIGH:
91 src_type = SUNXI_SRC_TYPE_LEVEL_HIGH;
92 break;
93 case IRQ_TYPE_NONE:
94 case IRQ_TYPE_LEVEL_LOW:
95 src_type = SUNXI_SRC_TYPE_LEVEL_LOW;
96 break;
97 default:
98 irq_gc_unlock(gc);
99 pr_err("%s: Cannot assign multiple trigger modes to IRQ %d.\n",
100 __func__, data->irq);
101 return -EBADR;
102 }
103
104 irqd_set_trigger_type(data, flow_type);
105 irq_setup_alt_chip(data, flow_type);
106
107 for (i = 0; i <= gc->num_ct; i++, ct++)
108 if (ct->type & flow_type)
109 ctrl_off = ct->regs.type;
110
111 src_type_reg = sunxi_sc_nmi_read(gc, ctrl_off);
112 src_type_reg &= ~SUNXI_NMI_SRC_TYPE_MASK;
113 src_type_reg |= src_type;
114 sunxi_sc_nmi_write(gc, ctrl_off, src_type_reg);
115
116 irq_gc_unlock(gc);
117
118 return IRQ_SET_MASK_OK;
119}
120
121static int __init sunxi_sc_nmi_irq_init(struct device_node *node,
122 struct sunxi_sc_nmi_reg_offs *reg_offs)
123{
124 struct irq_domain *domain;
125 struct irq_chip_generic *gc;
126 unsigned int irq;
127 unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
128 int ret;
129
130
131 domain = irq_domain_add_linear(node, 1, &irq_generic_chip_ops, NULL);
132 if (!domain) {
133 pr_err("%s: Could not register interrupt domain.\n", node->name);
134 return -ENOMEM;
135 }
136
137 ret = irq_alloc_domain_generic_chips(domain, 1, 2, node->name,
138 handle_fasteoi_irq, clr, 0,
139 IRQ_GC_INIT_MASK_CACHE);
140 if (ret) {
141 pr_err("%s: Could not allocate generic interrupt chip.\n",
142 node->name);
143 goto fail_irqd_remove;
144 }
145
146 irq = irq_of_parse_and_map(node, 0);
147 if (irq <= 0) {
148 pr_err("%s: unable to parse irq\n", node->name);
149 ret = -EINVAL;
150 goto fail_irqd_remove;
151 }
152
153 gc = irq_get_domain_generic_chip(domain, 0);
154 gc->reg_base = of_iomap(node, 0);
155 if (!gc->reg_base) {
156 pr_err("%s: unable to map resource\n", node->name);
157 ret = -ENOMEM;
158 goto fail_irqd_remove;
159 }
160
161 gc->chip_types[0].type = IRQ_TYPE_LEVEL_MASK;
162 gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit;
163 gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit;
164 gc->chip_types[0].chip.irq_eoi = irq_gc_ack_set_bit;
165 gc->chip_types[0].chip.irq_set_type = sunxi_sc_nmi_set_type;
166 gc->chip_types[0].chip.flags = IRQCHIP_EOI_THREADED | IRQCHIP_EOI_IF_HANDLED;
167 gc->chip_types[0].regs.ack = reg_offs->pend;
168 gc->chip_types[0].regs.mask = reg_offs->enable;
169 gc->chip_types[0].regs.type = reg_offs->ctrl;
170
171 gc->chip_types[1].type = IRQ_TYPE_EDGE_BOTH;
172 gc->chip_types[1].chip.name = gc->chip_types[0].chip.name;
173 gc->chip_types[1].chip.irq_ack = irq_gc_ack_set_bit;
174 gc->chip_types[1].chip.irq_mask = irq_gc_mask_clr_bit;
175 gc->chip_types[1].chip.irq_unmask = irq_gc_mask_set_bit;
176 gc->chip_types[1].chip.irq_set_type = sunxi_sc_nmi_set_type;
177 gc->chip_types[1].regs.ack = reg_offs->pend;
178 gc->chip_types[1].regs.mask = reg_offs->enable;
179 gc->chip_types[1].regs.type = reg_offs->ctrl;
180 gc->chip_types[1].handler = handle_edge_irq;
181
182 sunxi_sc_nmi_write(gc, reg_offs->enable, 0);
183 sunxi_sc_nmi_write(gc, reg_offs->pend, 0x1);
184
185 irq_set_handler_data(irq, domain);
186 irq_set_chained_handler(irq, sunxi_sc_nmi_handle_irq);
187
188 return 0;
189
190fail_irqd_remove:
191 irq_domain_remove(domain);
192
193 return ret;
194}
195
196static int __init sun6i_sc_nmi_irq_init(struct device_node *node,
197 struct device_node *parent)
198{
199 return sunxi_sc_nmi_irq_init(node, &sun6i_reg_offs);
200}
201IRQCHIP_DECLARE(sun6i_sc_nmi, "allwinner,sun6i-a31-sc-nmi", sun6i_sc_nmi_irq_init);
202
203static int __init sun7i_sc_nmi_irq_init(struct device_node *node,
204 struct device_node *parent)
205{
206 return sunxi_sc_nmi_irq_init(node, &sun7i_reg_offs);
207}
208IRQCHIP_DECLARE(sun7i_sc_nmi, "allwinner,sun7i-a20-sc-nmi", sun7i_sc_nmi_irq_init);
diff --git a/drivers/irqchip/irq-vic.c b/drivers/irqchip/irq-vic.c
index 8e21ae0bab46..473f09a74d4d 100644
--- a/drivers/irqchip/irq-vic.c
+++ b/drivers/irqchip/irq-vic.c
@@ -228,7 +228,7 @@ static int handle_one_vic(struct vic_device *vic, struct pt_regs *regs)
228 * Keep iterating over all registered VIC's until there are no pending 228 * Keep iterating over all registered VIC's until there are no pending
229 * interrupts. 229 * interrupts.
230 */ 230 */
231static asmlinkage void __exception_irq_entry vic_handle_irq(struct pt_regs *regs) 231static void __exception_irq_entry vic_handle_irq(struct pt_regs *regs)
232{ 232{
233 int i, handled; 233 int i, handled;
234 234
diff --git a/drivers/irqchip/irq-vt8500.c b/drivers/irqchip/irq-vt8500.c
index 1846e7d66681..eb6e91efdec8 100644
--- a/drivers/irqchip/irq-vt8500.c
+++ b/drivers/irqchip/irq-vt8500.c
@@ -178,8 +178,7 @@ static struct irq_domain_ops vt8500_irq_domain_ops = {
178 .xlate = irq_domain_xlate_onecell, 178 .xlate = irq_domain_xlate_onecell,
179}; 179};
180 180
181static asmlinkage 181static void __exception_irq_entry vt8500_handle_irq(struct pt_regs *regs)
182void __exception_irq_entry vt8500_handle_irq(struct pt_regs *regs)
183{ 182{
184 u32 stat, i; 183 u32 stat, i;
185 int irqnr, virq; 184 int irqnr, virq;
diff --git a/drivers/irqchip/irq-xtensa-mx.c b/drivers/irqchip/irq-xtensa-mx.c
index f693f1bc1348..e1c2f9632893 100644
--- a/drivers/irqchip/irq-xtensa-mx.c
+++ b/drivers/irqchip/irq-xtensa-mx.c
@@ -122,7 +122,7 @@ static int xtensa_mx_irq_retrigger(struct irq_data *d)
122static int xtensa_mx_irq_set_affinity(struct irq_data *d, 122static int xtensa_mx_irq_set_affinity(struct irq_data *d,
123 const struct cpumask *dest, bool force) 123 const struct cpumask *dest, bool force)
124{ 124{
125 unsigned mask = 1u << cpumask_any(dest); 125 unsigned mask = 1u << cpumask_any_and(dest, cpu_online_mask);
126 126
127 set_er(mask, MIROUT(d->hwirq - HW_IRQ_MX_BASE)); 127 set_er(mask, MIROUT(d->hwirq - HW_IRQ_MX_BASE));
128 return 0; 128 return 0;
diff --git a/drivers/irqchip/irq-zevio.c b/drivers/irqchip/irq-zevio.c
index 8ed04c4a43ee..ceb3a4318f73 100644
--- a/drivers/irqchip/irq-zevio.c
+++ b/drivers/irqchip/irq-zevio.c
@@ -50,7 +50,7 @@ static void zevio_irq_ack(struct irq_data *irqd)
50 readl(gc->reg_base + regs->ack); 50 readl(gc->reg_base + regs->ack);
51} 51}
52 52
53static asmlinkage void __exception_irq_entry zevio_handle_irq(struct pt_regs *regs) 53static void __exception_irq_entry zevio_handle_irq(struct pt_regs *regs)
54{ 54{
55 int irqnr; 55 int irqnr;
56 56
diff --git a/drivers/irqchip/irqchip.c b/drivers/irqchip/irqchip.c
index f496afce29de..cad3e2495552 100644
--- a/drivers/irqchip/irqchip.c
+++ b/drivers/irqchip/irqchip.c
@@ -10,8 +10,7 @@
10 10
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/of_irq.h> 12#include <linux/of_irq.h>
13 13#include <linux/irqchip.h>
14#include "irqchip.h"
15 14
16/* 15/*
17 * This special of_device_id is the sentinel at the end of the 16 * This special of_device_id is the sentinel at the end of the
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 55cd110a49c4..c204b7d1532c 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -2607,7 +2607,7 @@ int dw_mci_probe(struct dw_mci *host)
2607 2607
2608 tasklet_init(&host->tasklet, dw_mci_tasklet_func, (unsigned long)host); 2608 tasklet_init(&host->tasklet, dw_mci_tasklet_func, (unsigned long)host);
2609 host->card_workqueue = alloc_workqueue("dw-mci-card", 2609 host->card_workqueue = alloc_workqueue("dw-mci-card",
2610 WQ_MEM_RECLAIM | WQ_NON_REENTRANT, 1); 2610 WQ_MEM_RECLAIM, 1);
2611 if (!host->card_workqueue) { 2611 if (!host->card_workqueue) {
2612 ret = -ENOMEM; 2612 ret = -ENOMEM;
2613 goto err_dmaunmap; 2613 goto err_dmaunmap;
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index caddc1b427a9..42a2e06512f2 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -764,7 +764,7 @@ static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
764 /* 764 /*
765 * Overwrite TX done handler 765 * Overwrite TX done handler
766 */ 766 */
767 PREPARE_WORK(&rt2x00dev->txdone_work, rt2800usb_work_txdone); 767 INIT_WORK(&rt2x00dev->txdone_work, rt2800usb_work_txdone);
768 768
769 return 0; 769 return 0;
770} 770}
diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
index 17ce88f79d2b..2e48ecf09e2c 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -294,14 +294,12 @@ no_valid_irq:
294static void clear_irq(unsigned int irq) 294static void clear_irq(unsigned int irq)
295{ 295{
296 unsigned int pos, nvec; 296 unsigned int pos, nvec;
297 struct irq_desc *desc;
298 struct msi_desc *msi; 297 struct msi_desc *msi;
299 struct pcie_port *pp; 298 struct pcie_port *pp;
300 struct irq_data *data = irq_get_irq_data(irq); 299 struct irq_data *data = irq_get_irq_data(irq);
301 300
302 /* get the port structure */ 301 /* get the port structure */
303 desc = irq_to_desc(irq); 302 msi = irq_data_get_msi(data);
304 msi = irq_desc_get_msi_desc(desc);
305 pp = sys_to_pcie(msi->dev->bus->sysdata); 303 pp = sys_to_pcie(msi->dev->bus->sysdata);
306 if (!pp) { 304 if (!pp) {
307 BUG(); 305 BUG();
diff --git a/drivers/ps3/ps3-vuart.c b/drivers/ps3/ps3-vuart.c
index fb7300837fee..bc1e5139ba29 100644
--- a/drivers/ps3/ps3-vuart.c
+++ b/drivers/ps3/ps3-vuart.c
@@ -699,8 +699,6 @@ int ps3_vuart_read_async(struct ps3_system_bus_device *dev, unsigned int bytes)
699 699
700 BUG_ON(!bytes); 700 BUG_ON(!bytes);
701 701
702 PREPARE_WORK(&priv->rx_list.work.work, ps3_vuart_work);
703
704 spin_lock_irqsave(&priv->rx_list.lock, flags); 702 spin_lock_irqsave(&priv->rx_list.lock, flags);
705 if (priv->rx_list.bytes_held >= bytes) { 703 if (priv->rx_list.bytes_held >= bytes) {
706 dev_dbg(&dev->core, "%s:%d: schedule_work %xh bytes\n", 704 dev_dbg(&dev->core, "%s:%d: schedule_work %xh bytes\n",
@@ -1052,7 +1050,7 @@ static int ps3_vuart_probe(struct ps3_system_bus_device *dev)
1052 INIT_LIST_HEAD(&priv->rx_list.head); 1050 INIT_LIST_HEAD(&priv->rx_list.head);
1053 spin_lock_init(&priv->rx_list.lock); 1051 spin_lock_init(&priv->rx_list.lock);
1054 1052
1055 INIT_WORK(&priv->rx_list.work.work, NULL); 1053 INIT_WORK(&priv->rx_list.work.work, ps3_vuart_work);
1056 priv->rx_list.work.trigger = 0; 1054 priv->rx_list.work.trigger = 0;
1057 priv->rx_list.work.dev = dev; 1055 priv->rx_list.work.dev = dev;
1058 1056
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index eb5d22795c47..5af7f0bd6125 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -922,7 +922,7 @@ static int __init con3215_init(void)
922 raw3215_freelist = req; 922 raw3215_freelist = req;
923 } 923 }
924 924
925 cdev = ccw_device_probe_console(); 925 cdev = ccw_device_create_console(&raw3215_ccw_driver);
926 if (IS_ERR(cdev)) 926 if (IS_ERR(cdev))
927 return -ENODEV; 927 return -ENODEV;
928 928
@@ -932,6 +932,12 @@ static int __init con3215_init(void)
932 cdev->handler = raw3215_irq; 932 cdev->handler = raw3215_irq;
933 933
934 raw->flags |= RAW3215_FIXED; 934 raw->flags |= RAW3215_FIXED;
935 if (ccw_device_enable_console(cdev)) {
936 ccw_device_destroy_console(cdev);
937 raw3215_free_info(raw);
938 raw3215[0] = NULL;
939 return -ENODEV;
940 }
935 941
936 /* Request the console irq */ 942 /* Request the console irq */
937 if (raw3215_startup(raw) != 0) { 943 if (raw3215_startup(raw) != 0) {
diff --git a/drivers/s390/char/con3270.c b/drivers/s390/char/con3270.c
index 699fd3e363df..75ffe9980c3e 100644
--- a/drivers/s390/char/con3270.c
+++ b/drivers/s390/char/con3270.c
@@ -7,6 +7,7 @@
7 * Copyright IBM Corp. 2003, 2009 7 * Copyright IBM Corp. 2003, 2009
8 */ 8 */
9 9
10#include <linux/module.h>
10#include <linux/console.h> 11#include <linux/console.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/interrupt.h> 13#include <linux/interrupt.h>
@@ -30,6 +31,9 @@
30 31
31static struct raw3270_fn con3270_fn; 32static struct raw3270_fn con3270_fn;
32 33
34static bool auto_update = 1;
35module_param(auto_update, bool, 0);
36
33/* 37/*
34 * Main 3270 console view data structure. 38 * Main 3270 console view data structure.
35 */ 39 */
@@ -204,6 +208,8 @@ con3270_update(struct con3270 *cp)
204 struct string *s, *n; 208 struct string *s, *n;
205 int rc; 209 int rc;
206 210
211 if (!auto_update && !raw3270_view_active(&cp->view))
212 return;
207 if (cp->view.dev) 213 if (cp->view.dev)
208 raw3270_activate_view(&cp->view); 214 raw3270_activate_view(&cp->view);
209 215
@@ -529,6 +535,7 @@ con3270_flush(void)
529 if (!cp->view.dev) 535 if (!cp->view.dev)
530 return; 536 return;
531 raw3270_pm_unfreeze(&cp->view); 537 raw3270_pm_unfreeze(&cp->view);
538 raw3270_activate_view(&cp->view);
532 spin_lock_irqsave(&cp->view.lock, flags); 539 spin_lock_irqsave(&cp->view.lock, flags);
533 con3270_wait_write(cp); 540 con3270_wait_write(cp);
534 cp->nr_up = 0; 541 cp->nr_up = 0;
@@ -576,7 +583,6 @@ static struct console con3270 = {
576static int __init 583static int __init
577con3270_init(void) 584con3270_init(void)
578{ 585{
579 struct ccw_device *cdev;
580 struct raw3270 *rp; 586 struct raw3270 *rp;
581 void *cbuf; 587 void *cbuf;
582 int i; 588 int i;
@@ -591,10 +597,7 @@ con3270_init(void)
591 cpcmd("TERM AUTOCR OFF", NULL, 0, NULL); 597 cpcmd("TERM AUTOCR OFF", NULL, 0, NULL);
592 } 598 }
593 599
594 cdev = ccw_device_probe_console(); 600 rp = raw3270_setup_console();
595 if (IS_ERR(cdev))
596 return -ENODEV;
597 rp = raw3270_setup_console(cdev);
598 if (IS_ERR(rp)) 601 if (IS_ERR(rp))
599 return PTR_ERR(rp); 602 return PTR_ERR(rp);
600 603
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c
index 2cdec21e8924..9f849df4381e 100644
--- a/drivers/s390/char/raw3270.c
+++ b/drivers/s390/char/raw3270.c
@@ -276,6 +276,15 @@ __raw3270_start(struct raw3270 *rp, struct raw3270_view *view,
276} 276}
277 277
278int 278int
279raw3270_view_active(struct raw3270_view *view)
280{
281 struct raw3270 *rp = view->dev;
282
283 return rp && rp->view == view &&
284 !test_bit(RAW3270_FLAGS_FROZEN, &rp->flags);
285}
286
287int
279raw3270_start(struct raw3270_view *view, struct raw3270_request *rq) 288raw3270_start(struct raw3270_view *view, struct raw3270_request *rq)
280{ 289{
281 unsigned long flags; 290 unsigned long flags;
@@ -776,22 +785,37 @@ raw3270_setup_device(struct ccw_device *cdev, struct raw3270 *rp, char *ascebc)
776} 785}
777 786
778#ifdef CONFIG_TN3270_CONSOLE 787#ifdef CONFIG_TN3270_CONSOLE
788/* Tentative definition - see below for actual definition. */
789static struct ccw_driver raw3270_ccw_driver;
790
779/* 791/*
780 * Setup 3270 device configured as console. 792 * Setup 3270 device configured as console.
781 */ 793 */
782struct raw3270 __init *raw3270_setup_console(struct ccw_device *cdev) 794struct raw3270 __init *raw3270_setup_console(void)
783{ 795{
796 struct ccw_device *cdev;
784 unsigned long flags; 797 unsigned long flags;
785 struct raw3270 *rp; 798 struct raw3270 *rp;
786 char *ascebc; 799 char *ascebc;
787 int rc; 800 int rc;
788 801
802 cdev = ccw_device_create_console(&raw3270_ccw_driver);
803 if (IS_ERR(cdev))
804 return ERR_CAST(cdev);
805
789 rp = kzalloc(sizeof(struct raw3270), GFP_KERNEL | GFP_DMA); 806 rp = kzalloc(sizeof(struct raw3270), GFP_KERNEL | GFP_DMA);
790 ascebc = kzalloc(256, GFP_KERNEL); 807 ascebc = kzalloc(256, GFP_KERNEL);
791 rc = raw3270_setup_device(cdev, rp, ascebc); 808 rc = raw3270_setup_device(cdev, rp, ascebc);
792 if (rc) 809 if (rc)
793 return ERR_PTR(rc); 810 return ERR_PTR(rc);
794 set_bit(RAW3270_FLAGS_CONSOLE, &rp->flags); 811 set_bit(RAW3270_FLAGS_CONSOLE, &rp->flags);
812
813 rc = ccw_device_enable_console(cdev);
814 if (rc) {
815 ccw_device_destroy_console(cdev);
816 return ERR_PTR(rc);
817 }
818
795 spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags); 819 spin_lock_irqsave(get_ccwdev_lock(rp->cdev), flags);
796 do { 820 do {
797 __raw3270_reset_device(rp); 821 __raw3270_reset_device(rp);
diff --git a/drivers/s390/char/raw3270.h b/drivers/s390/char/raw3270.h
index 7b73ff8c1bd7..e1e41c2861fb 100644
--- a/drivers/s390/char/raw3270.h
+++ b/drivers/s390/char/raw3270.h
@@ -173,6 +173,7 @@ int raw3270_start_locked(struct raw3270_view *, struct raw3270_request *);
173int raw3270_start_irq(struct raw3270_view *, struct raw3270_request *); 173int raw3270_start_irq(struct raw3270_view *, struct raw3270_request *);
174int raw3270_reset(struct raw3270_view *); 174int raw3270_reset(struct raw3270_view *);
175struct raw3270_view *raw3270_view(struct raw3270_view *); 175struct raw3270_view *raw3270_view(struct raw3270_view *);
176int raw3270_view_active(struct raw3270_view *);
176 177
177/* Reference count inliner for view structures. */ 178/* Reference count inliner for view structures. */
178static inline void 179static inline void
@@ -190,7 +191,7 @@ raw3270_put_view(struct raw3270_view *view)
190 wake_up(&raw3270_wait_queue); 191 wake_up(&raw3270_wait_queue);
191} 192}
192 193
193struct raw3270 *raw3270_setup_console(struct ccw_device *cdev); 194struct raw3270 *raw3270_setup_console(void);
194void raw3270_wait_cons_dev(struct raw3270 *); 195void raw3270_wait_cons_dev(struct raw3270 *);
195 196
196/* Notifier for device addition/removal */ 197/* Notifier for device addition/removal */
diff --git a/drivers/s390/char/sclp_early.c b/drivers/s390/char/sclp_early.c
index 82f2c389b4d1..14196ea0fdf3 100644
--- a/drivers/s390/char/sclp_early.c
+++ b/drivers/s390/char/sclp_early.c
@@ -20,7 +20,9 @@ struct read_info_sccb {
20 struct sccb_header header; /* 0-7 */ 20 struct sccb_header header; /* 0-7 */
21 u16 rnmax; /* 8-9 */ 21 u16 rnmax; /* 8-9 */
22 u8 rnsize; /* 10 */ 22 u8 rnsize; /* 10 */
23 u8 _reserved0[24 - 11]; /* 11-15 */ 23 u8 _reserved0[16 - 11]; /* 11-15 */
24 u16 ncpurl; /* 16-17 */
25 u8 _reserved7[24 - 18]; /* 18-23 */
24 u8 loadparm[8]; /* 24-31 */ 26 u8 loadparm[8]; /* 24-31 */
25 u8 _reserved1[48 - 32]; /* 32-47 */ 27 u8 _reserved1[48 - 32]; /* 32-47 */
26 u64 facilities; /* 48-55 */ 28 u64 facilities; /* 48-55 */
@@ -32,13 +34,16 @@ struct read_info_sccb {
32 u8 _reserved4[100 - 92]; /* 92-99 */ 34 u8 _reserved4[100 - 92]; /* 92-99 */
33 u32 rnsize2; /* 100-103 */ 35 u32 rnsize2; /* 100-103 */
34 u64 rnmax2; /* 104-111 */ 36 u64 rnmax2; /* 104-111 */
35 u8 _reserved5[4096 - 112]; /* 112-4095 */ 37 u8 _reserved5[120 - 112]; /* 112-119 */
38 u16 hcpua; /* 120-121 */
39 u8 _reserved6[4096 - 122]; /* 122-4095 */
36} __packed __aligned(PAGE_SIZE); 40} __packed __aligned(PAGE_SIZE);
37 41
38static char sccb_early[PAGE_SIZE] __aligned(PAGE_SIZE) __initdata; 42static char sccb_early[PAGE_SIZE] __aligned(PAGE_SIZE) __initdata;
39static unsigned int sclp_con_has_vt220 __initdata; 43static unsigned int sclp_con_has_vt220 __initdata;
40static unsigned int sclp_con_has_linemode __initdata; 44static unsigned int sclp_con_has_linemode __initdata;
41static unsigned long sclp_hsa_size; 45static unsigned long sclp_hsa_size;
46static unsigned int sclp_max_cpu;
42static struct sclp_ipl_info sclp_ipl_info; 47static struct sclp_ipl_info sclp_ipl_info;
43 48
44u64 sclp_facilities; 49u64 sclp_facilities;
@@ -102,6 +107,15 @@ static void __init sclp_facilities_detect(struct read_info_sccb *sccb)
102 sclp_rzm = sccb->rnsize ? sccb->rnsize : sccb->rnsize2; 107 sclp_rzm = sccb->rnsize ? sccb->rnsize : sccb->rnsize2;
103 sclp_rzm <<= 20; 108 sclp_rzm <<= 20;
104 109
110 if (!sccb->hcpua) {
111 if (MACHINE_IS_VM)
112 sclp_max_cpu = 64;
113 else
114 sclp_max_cpu = sccb->ncpurl;
115 } else {
116 sclp_max_cpu = sccb->hcpua + 1;
117 }
118
105 /* Save IPL information */ 119 /* Save IPL information */
106 sclp_ipl_info.is_valid = 1; 120 sclp_ipl_info.is_valid = 1;
107 if (sccb->flags & 0x2) 121 if (sccb->flags & 0x2)
@@ -129,6 +143,11 @@ unsigned long long sclp_get_rzm(void)
129 return sclp_rzm; 143 return sclp_rzm;
130} 144}
131 145
146unsigned int sclp_get_max_cpu(void)
147{
148 return sclp_max_cpu;
149}
150
132/* 151/*
133 * This function will be called after sclp_facilities_detect(), which gets 152 * This function will be called after sclp_facilities_detect(), which gets
134 * called from early.c code. The sclp_facilities_detect() function retrieves 153 * called from early.c code. The sclp_facilities_detect() function retrieves
@@ -184,9 +203,9 @@ static long __init sclp_hsa_size_init(struct sdias_sccb *sccb)
184 sccb_init_eq_size(sccb); 203 sccb_init_eq_size(sccb);
185 if (sclp_cmd_early(SCLP_CMDW_WRITE_EVENT_DATA, sccb)) 204 if (sclp_cmd_early(SCLP_CMDW_WRITE_EVENT_DATA, sccb))
186 return -EIO; 205 return -EIO;
187 if (sccb->evbuf.blk_cnt != 0) 206 if (sccb->evbuf.blk_cnt == 0)
188 return (sccb->evbuf.blk_cnt - 1) * PAGE_SIZE; 207 return 0;
189 return 0; 208 return (sccb->evbuf.blk_cnt - 1) * PAGE_SIZE;
190} 209}
191 210
192static long __init sclp_hsa_copy_wait(struct sccb_header *sccb) 211static long __init sclp_hsa_copy_wait(struct sccb_header *sccb)
@@ -195,6 +214,8 @@ static long __init sclp_hsa_copy_wait(struct sccb_header *sccb)
195 sccb->length = PAGE_SIZE; 214 sccb->length = PAGE_SIZE;
196 if (sclp_cmd_early(SCLP_CMDW_READ_EVENT_DATA, sccb)) 215 if (sclp_cmd_early(SCLP_CMDW_READ_EVENT_DATA, sccb))
197 return -EIO; 216 return -EIO;
217 if (((struct sdias_sccb *) sccb)->evbuf.blk_cnt == 0)
218 return 0;
198 return (((struct sdias_sccb *) sccb)->evbuf.blk_cnt - 1) * PAGE_SIZE; 219 return (((struct sdias_sccb *) sccb)->evbuf.blk_cnt - 1) * PAGE_SIZE;
199} 220}
200 221
diff --git a/drivers/s390/cio/airq.c b/drivers/s390/cio/airq.c
index f055df0b167f..445564c790f6 100644
--- a/drivers/s390/cio/airq.c
+++ b/drivers/s390/cio/airq.c
@@ -186,55 +186,71 @@ void airq_iv_release(struct airq_iv *iv)
186EXPORT_SYMBOL(airq_iv_release); 186EXPORT_SYMBOL(airq_iv_release);
187 187
188/** 188/**
189 * airq_iv_alloc_bit - allocate an irq bit from an interrupt vector 189 * airq_iv_alloc - allocate irq bits from an interrupt vector
190 * @iv: pointer to an interrupt vector structure 190 * @iv: pointer to an interrupt vector structure
191 * @num: number of consecutive irq bits to allocate
191 * 192 *
192 * Returns the bit number of the allocated irq, or -1UL if no bit 193 * Returns the bit number of the first irq in the allocated block of irqs,
193 * is available or the AIRQ_IV_ALLOC flag has not been specified 194 * or -1UL if no bit is available or the AIRQ_IV_ALLOC flag has not been
195 * specified
194 */ 196 */
195unsigned long airq_iv_alloc_bit(struct airq_iv *iv) 197unsigned long airq_iv_alloc(struct airq_iv *iv, unsigned long num)
196{ 198{
197 unsigned long bit; 199 unsigned long bit, i;
198 200
199 if (!iv->avail) 201 if (!iv->avail || num == 0)
200 return -1UL; 202 return -1UL;
201 spin_lock(&iv->lock); 203 spin_lock(&iv->lock);
202 bit = find_first_bit_inv(iv->avail, iv->bits); 204 bit = find_first_bit_inv(iv->avail, iv->bits);
203 if (bit < iv->bits) { 205 while (bit + num <= iv->bits) {
204 clear_bit_inv(bit, iv->avail); 206 for (i = 1; i < num; i++)
205 if (bit >= iv->end) 207 if (!test_bit_inv(bit + i, iv->avail))
206 iv->end = bit + 1; 208 break;
207 } else 209 if (i >= num) {
210 /* Found a suitable block of irqs */
211 for (i = 0; i < num; i++)
212 clear_bit_inv(bit + i, iv->avail);
213 if (bit + num >= iv->end)
214 iv->end = bit + num + 1;
215 break;
216 }
217 bit = find_next_bit_inv(iv->avail, iv->bits, bit + i + 1);
218 }
219 if (bit + num > iv->bits)
208 bit = -1UL; 220 bit = -1UL;
209 spin_unlock(&iv->lock); 221 spin_unlock(&iv->lock);
210 return bit; 222 return bit;
211 223
212} 224}
213EXPORT_SYMBOL(airq_iv_alloc_bit); 225EXPORT_SYMBOL(airq_iv_alloc);
214 226
215/** 227/**
216 * airq_iv_free_bit - free an irq bit of an interrupt vector 228 * airq_iv_free - free irq bits of an interrupt vector
217 * @iv: pointer to interrupt vector structure 229 * @iv: pointer to interrupt vector structure
218 * @bit: number of the irq bit to free 230 * @bit: number of the first irq bit to free
231 * @num: number of consecutive irq bits to free
219 */ 232 */
220void airq_iv_free_bit(struct airq_iv *iv, unsigned long bit) 233void airq_iv_free(struct airq_iv *iv, unsigned long bit, unsigned long num)
221{ 234{
222 if (!iv->avail) 235 unsigned long i;
236
237 if (!iv->avail || num == 0)
223 return; 238 return;
224 spin_lock(&iv->lock); 239 spin_lock(&iv->lock);
225 /* Clear (possibly left over) interrupt bit */ 240 for (i = 0; i < num; i++) {
226 clear_bit_inv(bit, iv->vector); 241 /* Clear (possibly left over) interrupt bit */
227 /* Make the bit position available again */ 242 clear_bit_inv(bit + i, iv->vector);
228 set_bit_inv(bit, iv->avail); 243 /* Make the bit positions available again */
229 if (bit == iv->end - 1) { 244 set_bit_inv(bit + i, iv->avail);
245 }
246 if (bit + num >= iv->end) {
230 /* Find new end of bit-field */ 247 /* Find new end of bit-field */
231 while (--iv->end > 0) 248 while (iv->end > 0 && !test_bit_inv(iv->end - 1, iv->avail))
232 if (!test_bit_inv(iv->end - 1, iv->avail)) 249 iv->end--;
233 break;
234 } 250 }
235 spin_unlock(&iv->lock); 251 spin_unlock(&iv->lock);
236} 252}
237EXPORT_SYMBOL(airq_iv_free_bit); 253EXPORT_SYMBOL(airq_iv_free);
238 254
239/** 255/**
240 * airq_iv_scan - scan interrupt vector for non-zero bits 256 * airq_iv_scan - scan interrupt vector for non-zero bits
diff --git a/drivers/s390/cio/chsc_sch.c b/drivers/s390/cio/chsc_sch.c
index 7b29d0be0ca3..1d3661af7bd8 100644
--- a/drivers/s390/cio/chsc_sch.c
+++ b/drivers/s390/cio/chsc_sch.c
@@ -173,8 +173,7 @@ static struct css_driver chsc_subchannel_driver = {
173 173
174static int __init chsc_init_dbfs(void) 174static int __init chsc_init_dbfs(void)
175{ 175{
176 chsc_debug_msg_id = debug_register("chsc_msg", 16, 1, 176 chsc_debug_msg_id = debug_register("chsc_msg", 8, 1, 4 * sizeof(long));
177 16 * sizeof(long));
178 if (!chsc_debug_msg_id) 177 if (!chsc_debug_msg_id)
179 goto out; 178 goto out;
180 debug_register_view(chsc_debug_msg_id, &debug_sprintf_view); 179 debug_register_view(chsc_debug_msg_id, &debug_sprintf_view);
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c
index 8ee88c4ebd83..9e058c4657a3 100644
--- a/drivers/s390/cio/cio.c
+++ b/drivers/s390/cio/cio.c
@@ -18,6 +18,7 @@
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/kernel_stat.h> 19#include <linux/kernel_stat.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/irq.h>
21#include <asm/cio.h> 22#include <asm/cio.h>
22#include <asm/delay.h> 23#include <asm/delay.h>
23#include <asm/irq.h> 24#include <asm/irq.h>
@@ -28,7 +29,7 @@
28#include <asm/chpid.h> 29#include <asm/chpid.h>
29#include <asm/airq.h> 30#include <asm/airq.h>
30#include <asm/isc.h> 31#include <asm/isc.h>
31#include <asm/cputime.h> 32#include <linux/cputime.h>
32#include <asm/fcx.h> 33#include <asm/fcx.h>
33#include <asm/nmi.h> 34#include <asm/nmi.h>
34#include <asm/crw.h> 35#include <asm/crw.h>
@@ -54,7 +55,7 @@ debug_info_t *cio_debug_crw_id;
54 */ 55 */
55static int __init cio_debug_init(void) 56static int __init cio_debug_init(void)
56{ 57{
57 cio_debug_msg_id = debug_register("cio_msg", 16, 1, 16 * sizeof(long)); 58 cio_debug_msg_id = debug_register("cio_msg", 16, 1, 11 * sizeof(long));
58 if (!cio_debug_msg_id) 59 if (!cio_debug_msg_id)
59 goto out_unregister; 60 goto out_unregister;
60 debug_register_view(cio_debug_msg_id, &debug_sprintf_view); 61 debug_register_view(cio_debug_msg_id, &debug_sprintf_view);
@@ -64,7 +65,7 @@ static int __init cio_debug_init(void)
64 goto out_unregister; 65 goto out_unregister;
65 debug_register_view(cio_debug_trace_id, &debug_hex_ascii_view); 66 debug_register_view(cio_debug_trace_id, &debug_hex_ascii_view);
66 debug_set_level(cio_debug_trace_id, 2); 67 debug_set_level(cio_debug_trace_id, 2);
67 cio_debug_crw_id = debug_register("cio_crw", 16, 1, 16 * sizeof(long)); 68 cio_debug_crw_id = debug_register("cio_crw", 8, 1, 8 * sizeof(long));
68 if (!cio_debug_crw_id) 69 if (!cio_debug_crw_id)
69 goto out_unregister; 70 goto out_unregister;
70 debug_register_view(cio_debug_crw_id, &debug_sprintf_view); 71 debug_register_view(cio_debug_crw_id, &debug_sprintf_view);
@@ -584,8 +585,6 @@ static irqreturn_t do_cio_interrupt(int irq, void *dummy)
584 return IRQ_HANDLED; 585 return IRQ_HANDLED;
585} 586}
586 587
587static struct irq_desc *irq_desc_io;
588
589static struct irqaction io_interrupt = { 588static struct irqaction io_interrupt = {
590 .name = "IO", 589 .name = "IO",
591 .handler = do_cio_interrupt, 590 .handler = do_cio_interrupt,
@@ -596,7 +595,6 @@ void __init init_cio_interrupts(void)
596 irq_set_chip_and_handler(IO_INTERRUPT, 595 irq_set_chip_and_handler(IO_INTERRUPT,
597 &dummy_irq_chip, handle_percpu_irq); 596 &dummy_irq_chip, handle_percpu_irq);
598 setup_irq(IO_INTERRUPT, &io_interrupt); 597 setup_irq(IO_INTERRUPT, &io_interrupt);
599 irq_desc_io = irq_to_desc(IO_INTERRUPT);
600} 598}
601 599
602#ifdef CONFIG_CCW_CONSOLE 600#ifdef CONFIG_CCW_CONSOLE
@@ -623,7 +621,7 @@ void cio_tsch(struct subchannel *sch)
623 local_bh_disable(); 621 local_bh_disable();
624 irq_enter(); 622 irq_enter();
625 } 623 }
626 kstat_incr_irqs_this_cpu(IO_INTERRUPT, irq_desc_io); 624 kstat_incr_irq_this_cpu(IO_INTERRUPT);
627 if (sch->driver && sch->driver->irq) 625 if (sch->driver && sch->driver->irq)
628 sch->driver->irq(sch); 626 sch->driver->irq(sch);
629 else 627 else
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index e9d783563cbb..d8d9b5b5cc56 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -1571,12 +1571,27 @@ out:
1571 return rc; 1571 return rc;
1572} 1572}
1573 1573
1574static void ccw_device_set_int_class(struct ccw_device *cdev)
1575{
1576 struct ccw_driver *cdrv = cdev->drv;
1577
1578 /* Note: we interpret class 0 in this context as an uninitialized
1579 * field since it translates to a non-I/O interrupt class. */
1580 if (cdrv->int_class != 0)
1581 cdev->private->int_class = cdrv->int_class;
1582 else
1583 cdev->private->int_class = IRQIO_CIO;
1584}
1585
1574#ifdef CONFIG_CCW_CONSOLE 1586#ifdef CONFIG_CCW_CONSOLE
1575static int ccw_device_console_enable(struct ccw_device *cdev, 1587int __init ccw_device_enable_console(struct ccw_device *cdev)
1576 struct subchannel *sch)
1577{ 1588{
1589 struct subchannel *sch = to_subchannel(cdev->dev.parent);
1578 int rc; 1590 int rc;
1579 1591
1592 if (!cdev->drv || !cdev->handler)
1593 return -EINVAL;
1594
1580 io_subchannel_init_fields(sch); 1595 io_subchannel_init_fields(sch);
1581 rc = cio_commit_config(sch); 1596 rc = cio_commit_config(sch);
1582 if (rc) 1597 if (rc)
@@ -1609,12 +1624,11 @@ out_unlock:
1609 return rc; 1624 return rc;
1610} 1625}
1611 1626
1612struct ccw_device *ccw_device_probe_console(void) 1627struct ccw_device * __init ccw_device_create_console(struct ccw_driver *drv)
1613{ 1628{
1614 struct io_subchannel_private *io_priv; 1629 struct io_subchannel_private *io_priv;
1615 struct ccw_device *cdev; 1630 struct ccw_device *cdev;
1616 struct subchannel *sch; 1631 struct subchannel *sch;
1617 int ret;
1618 1632
1619 sch = cio_probe_console(); 1633 sch = cio_probe_console();
1620 if (IS_ERR(sch)) 1634 if (IS_ERR(sch))
@@ -1631,18 +1645,23 @@ struct ccw_device *ccw_device_probe_console(void)
1631 kfree(io_priv); 1645 kfree(io_priv);
1632 return cdev; 1646 return cdev;
1633 } 1647 }
1648 cdev->drv = drv;
1634 set_io_private(sch, io_priv); 1649 set_io_private(sch, io_priv);
1635 ret = ccw_device_console_enable(cdev, sch); 1650 ccw_device_set_int_class(cdev);
1636 if (ret) {
1637 set_io_private(sch, NULL);
1638 put_device(&sch->dev);
1639 put_device(&cdev->dev);
1640 kfree(io_priv);
1641 return ERR_PTR(ret);
1642 }
1643 return cdev; 1651 return cdev;
1644} 1652}
1645 1653
1654void __init ccw_device_destroy_console(struct ccw_device *cdev)
1655{
1656 struct subchannel *sch = to_subchannel(cdev->dev.parent);
1657 struct io_subchannel_private *io_priv = to_io_private(sch);
1658
1659 set_io_private(sch, NULL);
1660 put_device(&sch->dev);
1661 put_device(&cdev->dev);
1662 kfree(io_priv);
1663}
1664
1646/** 1665/**
1647 * ccw_device_wait_idle() - busy wait for device to become idle 1666 * ccw_device_wait_idle() - busy wait for device to become idle
1648 * @cdev: ccw device 1667 * @cdev: ccw device
@@ -1726,15 +1745,8 @@ ccw_device_probe (struct device *dev)
1726 int ret; 1745 int ret;
1727 1746
1728 cdev->drv = cdrv; /* to let the driver call _set_online */ 1747 cdev->drv = cdrv; /* to let the driver call _set_online */
1729 /* Note: we interpret class 0 in this context as an uninitialized 1748 ccw_device_set_int_class(cdev);
1730 * field since it translates to a non-I/O interrupt class. */
1731 if (cdrv->int_class != 0)
1732 cdev->private->int_class = cdrv->int_class;
1733 else
1734 cdev->private->int_class = IRQIO_CIO;
1735
1736 ret = cdrv->probe ? cdrv->probe(cdev) : -ENODEV; 1749 ret = cdrv->probe ? cdrv->probe(cdev) : -ENODEV;
1737
1738 if (ret) { 1750 if (ret) {
1739 cdev->drv = NULL; 1751 cdev->drv = NULL;
1740 cdev->private->int_class = IRQIO_CIO; 1752 cdev->private->int_class = IRQIO_CIO;
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 795ed61a5496..a0aff2eb247c 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -33,8 +33,8 @@ struct qeth_dbf_info qeth_dbf[QETH_DBF_INFOS] = {
33 /* N P A M L V H */ 33 /* N P A M L V H */
34 [QETH_DBF_SETUP] = {"qeth_setup", 34 [QETH_DBF_SETUP] = {"qeth_setup",
35 8, 1, 8, 5, &debug_hex_ascii_view, NULL}, 35 8, 1, 8, 5, &debug_hex_ascii_view, NULL},
36 [QETH_DBF_MSG] = {"qeth_msg", 36 [QETH_DBF_MSG] = {"qeth_msg", 8, 1, 11 * sizeof(long), 3,
37 8, 1, 128, 3, &debug_sprintf_view, NULL}, 37 &debug_sprintf_view, NULL},
38 [QETH_DBF_CTRL] = {"qeth_control", 38 [QETH_DBF_CTRL] = {"qeth_control",
39 8, 1, QETH_DBF_CTRL_LEN, 5, &debug_hex_ascii_view, NULL}, 39 8, 1, QETH_DBF_CTRL_LEN, 5, &debug_hex_ascii_view, NULL},
40}; 40};
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c
index a3e6c8a3ff0f..296c936cc03c 100644
--- a/drivers/scsi/atari_scsi.c
+++ b/drivers/scsi/atari_scsi.c
@@ -90,6 +90,7 @@
90#include <linux/init.h> 90#include <linux/init.h>
91#include <linux/nvram.h> 91#include <linux/nvram.h>
92#include <linux/bitops.h> 92#include <linux/bitops.h>
93#include <linux/wait.h>
93 94
94#include <asm/setup.h> 95#include <asm/setup.h>
95#include <asm/atarihw.h> 96#include <asm/atarihw.h>
@@ -549,8 +550,10 @@ static void falcon_get_lock(void)
549 550
550 local_irq_save(flags); 551 local_irq_save(flags);
551 552
552 while (!in_irq() && falcon_got_lock && stdma_others_waiting()) 553 wait_event_cmd(falcon_fairness_wait,
553 sleep_on(&falcon_fairness_wait); 554 in_interrupt() || !falcon_got_lock || !stdma_others_waiting(),
555 local_irq_restore(flags),
556 local_irq_save(flags));
554 557
555 while (!falcon_got_lock) { 558 while (!falcon_got_lock) {
556 if (in_irq()) 559 if (in_irq())
@@ -562,7 +565,10 @@ static void falcon_get_lock(void)
562 falcon_trying_lock = 0; 565 falcon_trying_lock = 0;
563 wake_up(&falcon_try_wait); 566 wake_up(&falcon_try_wait);
564 } else { 567 } else {
565 sleep_on(&falcon_try_wait); 568 wait_event_cmd(falcon_try_wait,
569 falcon_got_lock && !falcon_trying_lock,
570 local_irq_restore(flags),
571 local_irq_save(flags));
566 } 572 }
567 } 573 }
568 574
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index d2895836f9fa..766098af4eb7 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -700,46 +700,26 @@ void sas_probe_sata(struct asd_sas_port *port)
700 700
701} 701}
702 702
703static bool sas_ata_flush_pm_eh(struct asd_sas_port *port, const char *func) 703static void sas_ata_flush_pm_eh(struct asd_sas_port *port, const char *func)
704{ 704{
705 struct domain_device *dev, *n; 705 struct domain_device *dev, *n;
706 bool retry = false;
707 706
708 list_for_each_entry_safe(dev, n, &port->dev_list, dev_list_node) { 707 list_for_each_entry_safe(dev, n, &port->dev_list, dev_list_node) {
709 int rc;
710
711 if (!dev_is_sata(dev)) 708 if (!dev_is_sata(dev))
712 continue; 709 continue;
713 710
714 sas_ata_wait_eh(dev); 711 sas_ata_wait_eh(dev);
715 rc = dev->sata_dev.pm_result;
716 if (rc == -EAGAIN)
717 retry = true;
718 else if (rc) {
719 /* since we don't have a
720 * ->port_{suspend|resume} routine in our
721 * ata_port ops, and no entanglements with
722 * acpi, suspend should just be mechanical trip
723 * through eh, catch cases where these
724 * assumptions are invalidated
725 */
726 WARN_ONCE(1, "failed %s %s error: %d\n", func,
727 dev_name(&dev->rphy->dev), rc);
728 }
729 712
730 /* if libata failed to power manage the device, tear it down */ 713 /* if libata failed to power manage the device, tear it down */
731 if (ata_dev_disabled(sas_to_ata_dev(dev))) 714 if (ata_dev_disabled(sas_to_ata_dev(dev)))
732 sas_fail_probe(dev, func, -ENODEV); 715 sas_fail_probe(dev, func, -ENODEV);
733 } 716 }
734
735 return retry;
736} 717}
737 718
738void sas_suspend_sata(struct asd_sas_port *port) 719void sas_suspend_sata(struct asd_sas_port *port)
739{ 720{
740 struct domain_device *dev; 721 struct domain_device *dev;
741 722
742 retry:
743 mutex_lock(&port->ha->disco_mutex); 723 mutex_lock(&port->ha->disco_mutex);
744 list_for_each_entry(dev, &port->dev_list, dev_list_node) { 724 list_for_each_entry(dev, &port->dev_list, dev_list_node) {
745 struct sata_device *sata; 725 struct sata_device *sata;
@@ -751,20 +731,17 @@ void sas_suspend_sata(struct asd_sas_port *port)
751 if (sata->ap->pm_mesg.event == PM_EVENT_SUSPEND) 731 if (sata->ap->pm_mesg.event == PM_EVENT_SUSPEND)
752 continue; 732 continue;
753 733
754 sata->pm_result = -EIO; 734 ata_sas_port_suspend(sata->ap);
755 ata_sas_port_async_suspend(sata->ap, &sata->pm_result);
756 } 735 }
757 mutex_unlock(&port->ha->disco_mutex); 736 mutex_unlock(&port->ha->disco_mutex);
758 737
759 if (sas_ata_flush_pm_eh(port, __func__)) 738 sas_ata_flush_pm_eh(port, __func__);
760 goto retry;
761} 739}
762 740
763void sas_resume_sata(struct asd_sas_port *port) 741void sas_resume_sata(struct asd_sas_port *port)
764{ 742{
765 struct domain_device *dev; 743 struct domain_device *dev;
766 744
767 retry:
768 mutex_lock(&port->ha->disco_mutex); 745 mutex_lock(&port->ha->disco_mutex);
769 list_for_each_entry(dev, &port->dev_list, dev_list_node) { 746 list_for_each_entry(dev, &port->dev_list, dev_list_node) {
770 struct sata_device *sata; 747 struct sata_device *sata;
@@ -776,13 +753,11 @@ void sas_resume_sata(struct asd_sas_port *port)
776 if (sata->ap->pm_mesg.event == PM_EVENT_ON) 753 if (sata->ap->pm_mesg.event == PM_EVENT_ON)
777 continue; 754 continue;
778 755
779 sata->pm_result = -EIO; 756 ata_sas_port_resume(sata->ap);
780 ata_sas_port_async_resume(sata->ap, &sata->pm_result);
781 } 757 }
782 mutex_unlock(&port->ha->disco_mutex); 758 mutex_unlock(&port->ha->disco_mutex);
783 759
784 if (sas_ata_flush_pm_eh(port, __func__)) 760 sas_ata_flush_pm_eh(port, __func__);
785 goto retry;
786} 761}
787 762
788/** 763/**
diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c
index 8af136e9c9dc..b22142ee5262 100644
--- a/drivers/staging/fwserial/fwserial.c
+++ b/drivers/staging/fwserial/fwserial.c
@@ -2036,6 +2036,13 @@ static void fwserial_auto_connect(struct work_struct *work)
2036 schedule_delayed_work(&peer->connect, CONNECT_RETRY_DELAY); 2036 schedule_delayed_work(&peer->connect, CONNECT_RETRY_DELAY);
2037} 2037}
2038 2038
2039static void fwserial_peer_workfn(struct work_struct *work)
2040{
2041 struct fwtty_peer *peer = to_peer(work, work);
2042
2043 peer->workfn(work);
2044}
2045
2039/** 2046/**
2040 * fwserial_add_peer - add a newly probed 'serial' unit device as a 'peer' 2047 * fwserial_add_peer - add a newly probed 'serial' unit device as a 'peer'
2041 * @serial: aggregate representing the specific fw_card to add the peer to 2048 * @serial: aggregate representing the specific fw_card to add the peer to
@@ -2100,7 +2107,7 @@ static int fwserial_add_peer(struct fw_serial *serial, struct fw_unit *unit)
2100 peer->port = NULL; 2107 peer->port = NULL;
2101 2108
2102 init_timer(&peer->timer); 2109 init_timer(&peer->timer);
2103 INIT_WORK(&peer->work, NULL); 2110 INIT_WORK(&peer->work, fwserial_peer_workfn);
2104 INIT_DELAYED_WORK(&peer->connect, fwserial_auto_connect); 2111 INIT_DELAYED_WORK(&peer->connect, fwserial_auto_connect);
2105 2112
2106 /* associate peer with specific fw_card */ 2113 /* associate peer with specific fw_card */
@@ -2702,7 +2709,7 @@ static int fwserial_parse_mgmt_write(struct fwtty_peer *peer,
2702 2709
2703 } else { 2710 } else {
2704 peer->work_params.plug_req = pkt->plug_req; 2711 peer->work_params.plug_req = pkt->plug_req;
2705 PREPARE_WORK(&peer->work, fwserial_handle_plug_req); 2712 peer->workfn = fwserial_handle_plug_req;
2706 queue_work(system_unbound_wq, &peer->work); 2713 queue_work(system_unbound_wq, &peer->work);
2707 } 2714 }
2708 break; 2715 break;
@@ -2731,7 +2738,7 @@ static int fwserial_parse_mgmt_write(struct fwtty_peer *peer,
2731 fwtty_err(&peer->unit, "unplug req: busy\n"); 2738 fwtty_err(&peer->unit, "unplug req: busy\n");
2732 rcode = RCODE_CONFLICT_ERROR; 2739 rcode = RCODE_CONFLICT_ERROR;
2733 } else { 2740 } else {
2734 PREPARE_WORK(&peer->work, fwserial_handle_unplug_req); 2741 peer->workfn = fwserial_handle_unplug_req;
2735 queue_work(system_unbound_wq, &peer->work); 2742 queue_work(system_unbound_wq, &peer->work);
2736 } 2743 }
2737 break; 2744 break;
diff --git a/drivers/staging/fwserial/fwserial.h b/drivers/staging/fwserial/fwserial.h
index 54f7f9b9b212..98b853d4acbc 100644
--- a/drivers/staging/fwserial/fwserial.h
+++ b/drivers/staging/fwserial/fwserial.h
@@ -91,6 +91,7 @@ struct fwtty_peer {
91 struct rcu_head rcu; 91 struct rcu_head rcu;
92 92
93 spinlock_t lock; 93 spinlock_t lock;
94 work_func_t workfn;
94 struct work_struct work; 95 struct work_struct work;
95 struct peer_work_params work_params; 96 struct peer_work_params work_params;
96 struct timer_list timer; 97 struct timer_list timer;
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 64ea21971be2..5cbf78d0be25 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1040,7 +1040,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
1040 */ 1040 */
1041 if (type == HUB_INIT) { 1041 if (type == HUB_INIT) {
1042 delay = hub_power_on(hub, false); 1042 delay = hub_power_on(hub, false);
1043 PREPARE_DELAYED_WORK(&hub->init_work, hub_init_func2); 1043 INIT_DELAYED_WORK(&hub->init_work, hub_init_func2);
1044 schedule_delayed_work(&hub->init_work, 1044 schedule_delayed_work(&hub->init_work,
1045 msecs_to_jiffies(delay)); 1045 msecs_to_jiffies(delay));
1046 1046
@@ -1194,7 +1194,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
1194 1194
1195 /* Don't do a long sleep inside a workqueue routine */ 1195 /* Don't do a long sleep inside a workqueue routine */
1196 if (type == HUB_INIT2) { 1196 if (type == HUB_INIT2) {
1197 PREPARE_DELAYED_WORK(&hub->init_work, hub_init_func3); 1197 INIT_DELAYED_WORK(&hub->init_work, hub_init_func3);
1198 schedule_delayed_work(&hub->init_work, 1198 schedule_delayed_work(&hub->init_work,
1199 msecs_to_jiffies(delay)); 1199 msecs_to_jiffies(delay));
1200 return; /* Continues at init3: below */ 1200 return; /* Continues at init3: below */
diff --git a/drivers/xen/events/events_2l.c b/drivers/xen/events/events_2l.c
index d7ff91757307..5db43fc100a4 100644
--- a/drivers/xen/events/events_2l.c
+++ b/drivers/xen/events/events_2l.c
@@ -166,7 +166,6 @@ static void evtchn_2l_handle_events(unsigned cpu)
166 int start_word_idx, start_bit_idx; 166 int start_word_idx, start_bit_idx;
167 int word_idx, bit_idx; 167 int word_idx, bit_idx;
168 int i; 168 int i;
169 struct irq_desc *desc;
170 struct shared_info *s = HYPERVISOR_shared_info; 169 struct shared_info *s = HYPERVISOR_shared_info;
171 struct vcpu_info *vcpu_info = __this_cpu_read(xen_vcpu); 170 struct vcpu_info *vcpu_info = __this_cpu_read(xen_vcpu);
172 171
@@ -176,11 +175,8 @@ static void evtchn_2l_handle_events(unsigned cpu)
176 unsigned int evtchn = evtchn_from_irq(irq); 175 unsigned int evtchn = evtchn_from_irq(irq);
177 word_idx = evtchn / BITS_PER_LONG; 176 word_idx = evtchn / BITS_PER_LONG;
178 bit_idx = evtchn % BITS_PER_LONG; 177 bit_idx = evtchn % BITS_PER_LONG;
179 if (active_evtchns(cpu, s, word_idx) & (1ULL << bit_idx)) { 178 if (active_evtchns(cpu, s, word_idx) & (1ULL << bit_idx))
180 desc = irq_to_desc(irq); 179 generic_handle_irq(irq);
181 if (desc)
182 generic_handle_irq_desc(irq, desc);
183 }
184 } 180 }
185 181
186 /* 182 /*
@@ -245,11 +241,8 @@ static void evtchn_2l_handle_events(unsigned cpu)
245 port = (word_idx * BITS_PER_EVTCHN_WORD) + bit_idx; 241 port = (word_idx * BITS_PER_EVTCHN_WORD) + bit_idx;
246 irq = get_evtchn_to_irq(port); 242 irq = get_evtchn_to_irq(port);
247 243
248 if (irq != -1) { 244 if (irq != -1)
249 desc = irq_to_desc(irq); 245 generic_handle_irq(irq);
250 if (desc)
251 generic_handle_irq_desc(irq, desc);
252 }
253 246
254 bit_idx = (bit_idx + 1) % BITS_PER_EVTCHN_WORD; 247 bit_idx = (bit_idx + 1) % BITS_PER_EVTCHN_WORD;
255 248
diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index f4a9e3311297..c3458f58de90 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -336,9 +336,8 @@ static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu)
336 336
337 BUG_ON(irq == -1); 337 BUG_ON(irq == -1);
338#ifdef CONFIG_SMP 338#ifdef CONFIG_SMP
339 cpumask_copy(irq_to_desc(irq)->irq_data.affinity, cpumask_of(cpu)); 339 cpumask_copy(irq_get_irq_data(irq)->affinity, cpumask_of(cpu));
340#endif 340#endif
341
342 xen_evtchn_port_bind_to_cpu(info, cpu); 341 xen_evtchn_port_bind_to_cpu(info, cpu);
343 342
344 info->cpu = cpu; 343 info->cpu = cpu;
@@ -373,10 +372,8 @@ static void xen_irq_init(unsigned irq)
373{ 372{
374 struct irq_info *info; 373 struct irq_info *info;
375#ifdef CONFIG_SMP 374#ifdef CONFIG_SMP
376 struct irq_desc *desc = irq_to_desc(irq);
377
378 /* By default all event channels notify CPU#0. */ 375 /* By default all event channels notify CPU#0. */
379 cpumask_copy(desc->irq_data.affinity, cpumask_of(0)); 376 cpumask_copy(irq_get_irq_data(irq)->affinity, cpumask_of(0));
380#endif 377#endif
381 378
382 info = kzalloc(sizeof(*info), GFP_KERNEL); 379 info = kzalloc(sizeof(*info), GFP_KERNEL);
@@ -490,13 +487,6 @@ static void pirq_query_unmask(int irq)
490 info->u.pirq.flags |= PIRQ_NEEDS_EOI; 487 info->u.pirq.flags |= PIRQ_NEEDS_EOI;
491} 488}
492 489
493static bool probing_irq(int irq)
494{
495 struct irq_desc *desc = irq_to_desc(irq);
496
497 return desc && desc->action == NULL;
498}
499
500static void eoi_pirq(struct irq_data *data) 490static void eoi_pirq(struct irq_data *data)
501{ 491{
502 int evtchn = evtchn_from_irq(data->irq); 492 int evtchn = evtchn_from_irq(data->irq);
@@ -538,8 +528,7 @@ static unsigned int __startup_pirq(unsigned int irq)
538 BIND_PIRQ__WILL_SHARE : 0; 528 BIND_PIRQ__WILL_SHARE : 0;
539 rc = HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq); 529 rc = HYPERVISOR_event_channel_op(EVTCHNOP_bind_pirq, &bind_pirq);
540 if (rc != 0) { 530 if (rc != 0) {
541 if (!probing_irq(irq)) 531 pr_warn("Failed to obtain physical IRQ %d\n", irq);
542 pr_info("Failed to obtain physical IRQ %d\n", irq);
543 return 0; 532 return 0;
544 } 533 }
545 evtchn = bind_pirq.port; 534 evtchn = bind_pirq.port;
@@ -772,17 +761,12 @@ error_irq:
772 761
773int xen_destroy_irq(int irq) 762int xen_destroy_irq(int irq)
774{ 763{
775 struct irq_desc *desc;
776 struct physdev_unmap_pirq unmap_irq; 764 struct physdev_unmap_pirq unmap_irq;
777 struct irq_info *info = info_for_irq(irq); 765 struct irq_info *info = info_for_irq(irq);
778 int rc = -ENOENT; 766 int rc = -ENOENT;
779 767
780 mutex_lock(&irq_mapping_update_lock); 768 mutex_lock(&irq_mapping_update_lock);
781 769
782 desc = irq_to_desc(irq);
783 if (!desc)
784 goto out;
785
786 if (xen_initial_domain()) { 770 if (xen_initial_domain()) {
787 unmap_irq.pirq = info->u.pirq.pirq; 771 unmap_irq.pirq = info->u.pirq.pirq;
788 unmap_irq.domid = info->u.pirq.domid; 772 unmap_irq.domid = info->u.pirq.domid;
@@ -1251,6 +1235,7 @@ void xen_evtchn_do_upcall(struct pt_regs *regs)
1251#ifdef CONFIG_X86 1235#ifdef CONFIG_X86
1252 exit_idle(); 1236 exit_idle();
1253#endif 1237#endif
1238 inc_irq_stat(irq_hv_callback_count);
1254 1239
1255 __xen_evtchn_do_upcall(); 1240 __xen_evtchn_do_upcall();
1256 1241
@@ -1339,7 +1324,7 @@ static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
1339static int set_affinity_irq(struct irq_data *data, const struct cpumask *dest, 1324static int set_affinity_irq(struct irq_data *data, const struct cpumask *dest,
1340 bool force) 1325 bool force)
1341{ 1326{
1342 unsigned tcpu = cpumask_first(dest); 1327 unsigned tcpu = cpumask_first_and(dest, cpu_online_mask);
1343 1328
1344 return rebind_irq_to_cpu(data->irq, tcpu); 1329 return rebind_irq_to_cpu(data->irq, tcpu);
1345} 1330}
diff --git a/drivers/xen/events/events_fifo.c b/drivers/xen/events/events_fifo.c
index 1de2a191b395..96109a9972b6 100644
--- a/drivers/xen/events/events_fifo.c
+++ b/drivers/xen/events/events_fifo.c
@@ -235,14 +235,10 @@ static uint32_t clear_linked(volatile event_word_t *word)
235static void handle_irq_for_port(unsigned port) 235static void handle_irq_for_port(unsigned port)
236{ 236{
237 int irq; 237 int irq;
238 struct irq_desc *desc;
239 238
240 irq = get_evtchn_to_irq(port); 239 irq = get_evtchn_to_irq(port);
241 if (irq != -1) { 240 if (irq != -1)
242 desc = irq_to_desc(irq); 241 generic_handle_irq(irq);
243 if (desc)
244 generic_handle_irq_desc(irq, desc);
245 }
246} 242}
247 243
248static void consume_one_event(unsigned cpu, 244static void consume_one_event(unsigned cpu,
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 6621f8008122..be75b500005d 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -75,6 +75,7 @@ struct afs_call {
75 const struct afs_call_type *type; /* type of call */ 75 const struct afs_call_type *type; /* type of call */
76 const struct afs_wait_mode *wait_mode; /* completion wait mode */ 76 const struct afs_wait_mode *wait_mode; /* completion wait mode */
77 wait_queue_head_t waitq; /* processes awaiting completion */ 77 wait_queue_head_t waitq; /* processes awaiting completion */
78 work_func_t async_workfn;
78 struct work_struct async_work; /* asynchronous work processor */ 79 struct work_struct async_work; /* asynchronous work processor */
79 struct work_struct work; /* actual work processor */ 80 struct work_struct work; /* actual work processor */
80 struct sk_buff_head rx_queue; /* received packets */ 81 struct sk_buff_head rx_queue; /* received packets */
diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c
index 8ad8c2a0703a..ef943df73b8c 100644
--- a/fs/afs/rxrpc.c
+++ b/fs/afs/rxrpc.c
@@ -644,7 +644,7 @@ static void afs_process_async_call(struct work_struct *work)
644 644
645 /* we can't just delete the call because the work item may be 645 /* we can't just delete the call because the work item may be
646 * queued */ 646 * queued */
647 PREPARE_WORK(&call->async_work, afs_delete_async_call); 647 call->async_workfn = afs_delete_async_call;
648 queue_work(afs_async_calls, &call->async_work); 648 queue_work(afs_async_calls, &call->async_work);
649 } 649 }
650 650
@@ -663,6 +663,13 @@ void afs_transfer_reply(struct afs_call *call, struct sk_buff *skb)
663 call->reply_size += len; 663 call->reply_size += len;
664} 664}
665 665
666static void afs_async_workfn(struct work_struct *work)
667{
668 struct afs_call *call = container_of(work, struct afs_call, async_work);
669
670 call->async_workfn(work);
671}
672
666/* 673/*
667 * accept the backlog of incoming calls 674 * accept the backlog of incoming calls
668 */ 675 */
@@ -685,7 +692,8 @@ static void afs_collect_incoming_call(struct work_struct *work)
685 return; 692 return;
686 } 693 }
687 694
688 INIT_WORK(&call->async_work, afs_process_async_call); 695 call->async_workfn = afs_process_async_call;
696 INIT_WORK(&call->async_work, afs_async_workfn);
689 call->wait_mode = &afs_async_incoming_call; 697 call->wait_mode = &afs_async_incoming_call;
690 call->type = &afs_RXCMxxxx; 698 call->type = &afs_RXCMxxxx;
691 init_waitqueue_head(&call->waitq); 699 init_waitqueue_head(&call->waitq);
diff --git a/fs/compat.c b/fs/compat.c
index 6af20de2c1a3..19252b97f0cc 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -72,8 +72,8 @@ int compat_printk(const char *fmt, ...)
72 * Not all architectures have sys_utime, so implement this in terms 72 * Not all architectures have sys_utime, so implement this in terms
73 * of sys_utimes. 73 * of sys_utimes.
74 */ 74 */
75asmlinkage long compat_sys_utime(const char __user *filename, 75COMPAT_SYSCALL_DEFINE2(utime, const char __user *, filename,
76 struct compat_utimbuf __user *t) 76 struct compat_utimbuf __user *, t)
77{ 77{
78 struct timespec tv[2]; 78 struct timespec tv[2];
79 79
@@ -87,7 +87,7 @@ asmlinkage long compat_sys_utime(const char __user *filename,
87 return do_utimes(AT_FDCWD, filename, t ? tv : NULL, 0); 87 return do_utimes(AT_FDCWD, filename, t ? tv : NULL, 0);
88} 88}
89 89
90asmlinkage long compat_sys_utimensat(unsigned int dfd, const char __user *filename, struct compat_timespec __user *t, int flags) 90COMPAT_SYSCALL_DEFINE4(utimensat, unsigned int, dfd, const char __user *, filename, struct compat_timespec __user *, t, int, flags)
91{ 91{
92 struct timespec tv[2]; 92 struct timespec tv[2];
93 93
@@ -102,7 +102,7 @@ asmlinkage long compat_sys_utimensat(unsigned int dfd, const char __user *filena
102 return do_utimes(dfd, filename, t ? tv : NULL, flags); 102 return do_utimes(dfd, filename, t ? tv : NULL, flags);
103} 103}
104 104
105asmlinkage long compat_sys_futimesat(unsigned int dfd, const char __user *filename, struct compat_timeval __user *t) 105COMPAT_SYSCALL_DEFINE3(futimesat, unsigned int, dfd, const char __user *, filename, struct compat_timeval __user *, t)
106{ 106{
107 struct timespec tv[2]; 107 struct timespec tv[2];
108 108
@@ -121,7 +121,7 @@ asmlinkage long compat_sys_futimesat(unsigned int dfd, const char __user *filena
121 return do_utimes(dfd, filename, t ? tv : NULL, 0); 121 return do_utimes(dfd, filename, t ? tv : NULL, 0);
122} 122}
123 123
124asmlinkage long compat_sys_utimes(const char __user *filename, struct compat_timeval __user *t) 124COMPAT_SYSCALL_DEFINE2(utimes, const char __user *, filename, struct compat_timeval __user *, t)
125{ 125{
126 return compat_sys_futimesat(AT_FDCWD, filename, t); 126 return compat_sys_futimesat(AT_FDCWD, filename, t);
127} 127}
@@ -159,8 +159,8 @@ static int cp_compat_stat(struct kstat *stat, struct compat_stat __user *ubuf)
159 return copy_to_user(ubuf, &tmp, sizeof(tmp)) ? -EFAULT : 0; 159 return copy_to_user(ubuf, &tmp, sizeof(tmp)) ? -EFAULT : 0;
160} 160}
161 161
162asmlinkage long compat_sys_newstat(const char __user * filename, 162COMPAT_SYSCALL_DEFINE2(newstat, const char __user *, filename,
163 struct compat_stat __user *statbuf) 163 struct compat_stat __user *, statbuf)
164{ 164{
165 struct kstat stat; 165 struct kstat stat;
166 int error; 166 int error;
@@ -171,8 +171,8 @@ asmlinkage long compat_sys_newstat(const char __user * filename,
171 return cp_compat_stat(&stat, statbuf); 171 return cp_compat_stat(&stat, statbuf);
172} 172}
173 173
174asmlinkage long compat_sys_newlstat(const char __user * filename, 174COMPAT_SYSCALL_DEFINE2(newlstat, const char __user *, filename,
175 struct compat_stat __user *statbuf) 175 struct compat_stat __user *, statbuf)
176{ 176{
177 struct kstat stat; 177 struct kstat stat;
178 int error; 178 int error;
@@ -184,9 +184,9 @@ asmlinkage long compat_sys_newlstat(const char __user * filename,
184} 184}
185 185
186#ifndef __ARCH_WANT_STAT64 186#ifndef __ARCH_WANT_STAT64
187asmlinkage long compat_sys_newfstatat(unsigned int dfd, 187COMPAT_SYSCALL_DEFINE4(newfstatat, unsigned int, dfd,
188 const char __user *filename, 188 const char __user *, filename,
189 struct compat_stat __user *statbuf, int flag) 189 struct compat_stat __user *, statbuf, int, flag)
190{ 190{
191 struct kstat stat; 191 struct kstat stat;
192 int error; 192 int error;
@@ -198,8 +198,8 @@ asmlinkage long compat_sys_newfstatat(unsigned int dfd,
198} 198}
199#endif 199#endif
200 200
201asmlinkage long compat_sys_newfstat(unsigned int fd, 201COMPAT_SYSCALL_DEFINE2(newfstat, unsigned int, fd,
202 struct compat_stat __user * statbuf) 202 struct compat_stat __user *, statbuf)
203{ 203{
204 struct kstat stat; 204 struct kstat stat;
205 int error = vfs_fstat(fd, &stat); 205 int error = vfs_fstat(fd, &stat);
@@ -247,7 +247,7 @@ static int put_compat_statfs(struct compat_statfs __user *ubuf, struct kstatfs *
247 * The following statfs calls are copies of code from fs/statfs.c and 247 * The following statfs calls are copies of code from fs/statfs.c and
248 * should be checked against those from time to time 248 * should be checked against those from time to time
249 */ 249 */
250asmlinkage long compat_sys_statfs(const char __user *pathname, struct compat_statfs __user *buf) 250COMPAT_SYSCALL_DEFINE2(statfs, const char __user *, pathname, struct compat_statfs __user *, buf)
251{ 251{
252 struct kstatfs tmp; 252 struct kstatfs tmp;
253 int error = user_statfs(pathname, &tmp); 253 int error = user_statfs(pathname, &tmp);
@@ -256,7 +256,7 @@ asmlinkage long compat_sys_statfs(const char __user *pathname, struct compat_sta
256 return error; 256 return error;
257} 257}
258 258
259asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs __user *buf) 259COMPAT_SYSCALL_DEFINE2(fstatfs, unsigned int, fd, struct compat_statfs __user *, buf)
260{ 260{
261 struct kstatfs tmp; 261 struct kstatfs tmp;
262 int error = fd_statfs(fd, &tmp); 262 int error = fd_statfs(fd, &tmp);
@@ -298,7 +298,7 @@ static int put_compat_statfs64(struct compat_statfs64 __user *ubuf, struct kstat
298 return 0; 298 return 0;
299} 299}
300 300
301asmlinkage long compat_sys_statfs64(const char __user *pathname, compat_size_t sz, struct compat_statfs64 __user *buf) 301COMPAT_SYSCALL_DEFINE3(statfs64, const char __user *, pathname, compat_size_t, sz, struct compat_statfs64 __user *, buf)
302{ 302{
303 struct kstatfs tmp; 303 struct kstatfs tmp;
304 int error; 304 int error;
@@ -312,7 +312,7 @@ asmlinkage long compat_sys_statfs64(const char __user *pathname, compat_size_t s
312 return error; 312 return error;
313} 313}
314 314
315asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct compat_statfs64 __user *buf) 315COMPAT_SYSCALL_DEFINE3(fstatfs64, unsigned int, fd, compat_size_t, sz, struct compat_statfs64 __user *, buf)
316{ 316{
317 struct kstatfs tmp; 317 struct kstatfs tmp;
318 int error; 318 int error;
@@ -331,7 +331,7 @@ asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct c
331 * Given how simple this syscall is that apporach is more maintainable 331 * Given how simple this syscall is that apporach is more maintainable
332 * than the various conversion hacks. 332 * than the various conversion hacks.
333 */ 333 */
334asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u) 334COMPAT_SYSCALL_DEFINE2(ustat, unsigned, dev, struct compat_ustat __user *, u)
335{ 335{
336 struct compat_ustat tmp; 336 struct compat_ustat tmp;
337 struct kstatfs sbuf; 337 struct kstatfs sbuf;
@@ -399,8 +399,8 @@ static int put_compat_flock64(struct flock *kfl, struct compat_flock64 __user *u
399} 399}
400#endif 400#endif
401 401
402asmlinkage long compat_sys_fcntl64(unsigned int fd, unsigned int cmd, 402COMPAT_SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd,
403 unsigned long arg) 403 compat_ulong_t, arg)
404{ 404{
405 mm_segment_t old_fs; 405 mm_segment_t old_fs;
406 struct flock f; 406 struct flock f;
@@ -468,16 +468,15 @@ asmlinkage long compat_sys_fcntl64(unsigned int fd, unsigned int cmd,
468 return ret; 468 return ret;
469} 469}
470 470
471asmlinkage long compat_sys_fcntl(unsigned int fd, unsigned int cmd, 471COMPAT_SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd,
472 unsigned long arg) 472 compat_ulong_t, arg)
473{ 473{
474 if ((cmd == F_GETLK64) || (cmd == F_SETLK64) || (cmd == F_SETLKW64)) 474 if ((cmd == F_GETLK64) || (cmd == F_SETLK64) || (cmd == F_SETLKW64))
475 return -EINVAL; 475 return -EINVAL;
476 return compat_sys_fcntl64(fd, cmd, arg); 476 return compat_sys_fcntl64(fd, cmd, arg);
477} 477}
478 478
479asmlinkage long 479COMPAT_SYSCALL_DEFINE2(io_setup, unsigned, nr_reqs, u32 __user *, ctx32p)
480compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p)
481{ 480{
482 long ret; 481 long ret;
483 aio_context_t ctx64; 482 aio_context_t ctx64;
@@ -496,32 +495,24 @@ compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p)
496 return ret; 495 return ret;
497} 496}
498 497
499asmlinkage long 498COMPAT_SYSCALL_DEFINE5(io_getevents, compat_aio_context_t, ctx_id,
500compat_sys_io_getevents(aio_context_t ctx_id, 499 compat_long_t, min_nr,
501 unsigned long min_nr, 500 compat_long_t, nr,
502 unsigned long nr, 501 struct io_event __user *, events,
503 struct io_event __user *events, 502 struct compat_timespec __user *, timeout)
504 struct compat_timespec __user *timeout)
505{ 503{
506 long ret;
507 struct timespec t; 504 struct timespec t;
508 struct timespec __user *ut = NULL; 505 struct timespec __user *ut = NULL;
509 506
510 ret = -EFAULT;
511 if (unlikely(!access_ok(VERIFY_WRITE, events,
512 nr * sizeof(struct io_event))))
513 goto out;
514 if (timeout) { 507 if (timeout) {
515 if (get_compat_timespec(&t, timeout)) 508 if (get_compat_timespec(&t, timeout))
516 goto out; 509 return -EFAULT;
517 510
518 ut = compat_alloc_user_space(sizeof(*ut)); 511 ut = compat_alloc_user_space(sizeof(*ut));
519 if (copy_to_user(ut, &t, sizeof(t)) ) 512 if (copy_to_user(ut, &t, sizeof(t)) )
520 goto out; 513 return -EFAULT;
521 } 514 }
522 ret = sys_io_getevents(ctx_id, min_nr, nr, events, ut); 515 return sys_io_getevents(ctx_id, min_nr, nr, events, ut);
523out:
524 return ret;
525} 516}
526 517
527/* A write operation does a read from user space and vice versa */ 518/* A write operation does a read from user space and vice versa */
@@ -617,8 +608,8 @@ copy_iocb(long nr, u32 __user *ptr32, struct iocb __user * __user *ptr64)
617 608
618#define MAX_AIO_SUBMITS (PAGE_SIZE/sizeof(struct iocb *)) 609#define MAX_AIO_SUBMITS (PAGE_SIZE/sizeof(struct iocb *))
619 610
620asmlinkage long 611COMPAT_SYSCALL_DEFINE3(io_submit, compat_aio_context_t, ctx_id,
621compat_sys_io_submit(aio_context_t ctx_id, int nr, u32 __user *iocb) 612 int, nr, u32 __user *, iocb)
622{ 613{
623 struct iocb __user * __user *iocb64; 614 struct iocb __user * __user *iocb64;
624 long ret; 615 long ret;
@@ -770,10 +761,10 @@ static int do_nfs4_super_data_conv(void *raw_data)
770#define NCPFS_NAME "ncpfs" 761#define NCPFS_NAME "ncpfs"
771#define NFS4_NAME "nfs4" 762#define NFS4_NAME "nfs4"
772 763
773asmlinkage long compat_sys_mount(const char __user * dev_name, 764COMPAT_SYSCALL_DEFINE5(mount, const char __user *, dev_name,
774 const char __user * dir_name, 765 const char __user *, dir_name,
775 const char __user * type, unsigned long flags, 766 const char __user *, type, compat_ulong_t, flags,
776 const void __user * data) 767 const void __user *, data)
777{ 768{
778 char *kernel_type; 769 char *kernel_type;
779 unsigned long data_page; 770 unsigned long data_page;
@@ -869,8 +860,8 @@ efault:
869 return -EFAULT; 860 return -EFAULT;
870} 861}
871 862
872asmlinkage long compat_sys_old_readdir(unsigned int fd, 863COMPAT_SYSCALL_DEFINE3(old_readdir, unsigned int, fd,
873 struct compat_old_linux_dirent __user *dirent, unsigned int count) 864 struct compat_old_linux_dirent __user *, dirent, unsigned int, count)
874{ 865{
875 int error; 866 int error;
876 struct fd f = fdget(fd); 867 struct fd f = fdget(fd);
@@ -948,8 +939,8 @@ efault:
948 return -EFAULT; 939 return -EFAULT;
949} 940}
950 941
951asmlinkage long compat_sys_getdents(unsigned int fd, 942COMPAT_SYSCALL_DEFINE3(getdents, unsigned int, fd,
952 struct compat_linux_dirent __user *dirent, unsigned int count) 943 struct compat_linux_dirent __user *, dirent, unsigned int, count)
953{ 944{
954 struct fd f; 945 struct fd f;
955 struct compat_linux_dirent __user * lastdirent; 946 struct compat_linux_dirent __user * lastdirent;
@@ -981,7 +972,7 @@ asmlinkage long compat_sys_getdents(unsigned int fd,
981 return error; 972 return error;
982} 973}
983 974
984#ifndef __ARCH_OMIT_COMPAT_SYS_GETDENTS64 975#ifdef __ARCH_WANT_COMPAT_SYS_GETDENTS64
985 976
986struct compat_getdents_callback64 { 977struct compat_getdents_callback64 {
987 struct dir_context ctx; 978 struct dir_context ctx;
@@ -1033,8 +1024,8 @@ efault:
1033 return -EFAULT; 1024 return -EFAULT;
1034} 1025}
1035 1026
1036asmlinkage long compat_sys_getdents64(unsigned int fd, 1027COMPAT_SYSCALL_DEFINE3(getdents64, unsigned int, fd,
1037 struct linux_dirent64 __user * dirent, unsigned int count) 1028 struct linux_dirent64 __user *, dirent, unsigned int, count)
1038{ 1029{
1039 struct fd f; 1030 struct fd f;
1040 struct linux_dirent64 __user * lastdirent; 1031 struct linux_dirent64 __user * lastdirent;
@@ -1066,7 +1057,7 @@ asmlinkage long compat_sys_getdents64(unsigned int fd,
1066 fdput(f); 1057 fdput(f);
1067 return error; 1058 return error;
1068} 1059}
1069#endif /* ! __ARCH_OMIT_COMPAT_SYS_GETDENTS64 */ 1060#endif /* __ARCH_WANT_COMPAT_SYS_GETDENTS64 */
1070 1061
1071/* 1062/*
1072 * Exactly like fs/open.c:sys_open(), except that it doesn't set the 1063 * Exactly like fs/open.c:sys_open(), except that it doesn't set the
@@ -1287,9 +1278,9 @@ out_nofds:
1287 return ret; 1278 return ret;
1288} 1279}
1289 1280
1290asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, 1281COMPAT_SYSCALL_DEFINE5(select, int, n, compat_ulong_t __user *, inp,
1291 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 1282 compat_ulong_t __user *, outp, compat_ulong_t __user *, exp,
1292 struct compat_timeval __user *tvp) 1283 struct compat_timeval __user *, tvp)
1293{ 1284{
1294 struct timespec end_time, *to = NULL; 1285 struct timespec end_time, *to = NULL;
1295 struct compat_timeval tv; 1286 struct compat_timeval tv;
@@ -1320,7 +1311,7 @@ struct compat_sel_arg_struct {
1320 compat_uptr_t tvp; 1311 compat_uptr_t tvp;
1321}; 1312};
1322 1313
1323asmlinkage long compat_sys_old_select(struct compat_sel_arg_struct __user *arg) 1314COMPAT_SYSCALL_DEFINE1(old_select, struct compat_sel_arg_struct __user *, arg)
1324{ 1315{
1325 struct compat_sel_arg_struct a; 1316 struct compat_sel_arg_struct a;
1326 1317
@@ -1381,9 +1372,9 @@ static long do_compat_pselect(int n, compat_ulong_t __user *inp,
1381 return ret; 1372 return ret;
1382} 1373}
1383 1374
1384asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp, 1375COMPAT_SYSCALL_DEFINE6(pselect6, int, n, compat_ulong_t __user *, inp,
1385 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 1376 compat_ulong_t __user *, outp, compat_ulong_t __user *, exp,
1386 struct compat_timespec __user *tsp, void __user *sig) 1377 struct compat_timespec __user *, tsp, void __user *, sig)
1387{ 1378{
1388 compat_size_t sigsetsize = 0; 1379 compat_size_t sigsetsize = 0;
1389 compat_uptr_t up = 0; 1380 compat_uptr_t up = 0;
@@ -1400,9 +1391,9 @@ asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp,
1400 sigsetsize); 1391 sigsetsize);
1401} 1392}
1402 1393
1403asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds, 1394COMPAT_SYSCALL_DEFINE5(ppoll, struct pollfd __user *, ufds,
1404 unsigned int nfds, struct compat_timespec __user *tsp, 1395 unsigned int, nfds, struct compat_timespec __user *, tsp,
1405 const compat_sigset_t __user *sigmask, compat_size_t sigsetsize) 1396 const compat_sigset_t __user *, sigmask, compat_size_t, sigsetsize)
1406{ 1397{
1407 compat_sigset_t ss32; 1398 compat_sigset_t ss32;
1408 sigset_t ksigmask, sigsaved; 1399 sigset_t ksigmask, sigsaved;
diff --git a/fs/compat_binfmt_elf.c b/fs/compat_binfmt_elf.c
index a81147e2e4ef..4d24d17bcfc1 100644
--- a/fs/compat_binfmt_elf.c
+++ b/fs/compat_binfmt_elf.c
@@ -88,6 +88,11 @@ static void cputime_to_compat_timeval(const cputime_t cputime,
88#define ELF_HWCAP COMPAT_ELF_HWCAP 88#define ELF_HWCAP COMPAT_ELF_HWCAP
89#endif 89#endif
90 90
91#ifdef COMPAT_ELF_HWCAP2
92#undef ELF_HWCAP2
93#define ELF_HWCAP2 COMPAT_ELF_HWCAP2
94#endif
95
91#ifdef COMPAT_ARCH_DLINFO 96#ifdef COMPAT_ARCH_DLINFO
92#undef ARCH_DLINFO 97#undef ARCH_DLINFO
93#define ARCH_DLINFO COMPAT_ARCH_DLINFO 98#define ARCH_DLINFO COMPAT_ARCH_DLINFO
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 3881610b6438..e82289047272 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -1538,9 +1538,10 @@ static int compat_ioctl_check_table(unsigned int xcmd)
1538 return ioctl_pointer[i] == xcmd; 1538 return ioctl_pointer[i] == xcmd;
1539} 1539}
1540 1540
1541asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, 1541COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd,
1542 unsigned long arg) 1542 compat_ulong_t, arg32)
1543{ 1543{
1544 unsigned long arg = arg32;
1544 struct fd f = fdget(fd); 1545 struct fd f = fdget(fd);
1545 int error = -EBADF; 1546 int error = -EBADF;
1546 if (!f.file) 1547 if (!f.file)
diff --git a/fs/exec.c b/fs/exec.c
index 3d78fccdd723..4f59402fdda5 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1619,9 +1619,9 @@ SYSCALL_DEFINE3(execve,
1619 return do_execve(getname(filename), argv, envp); 1619 return do_execve(getname(filename), argv, envp);
1620} 1620}
1621#ifdef CONFIG_COMPAT 1621#ifdef CONFIG_COMPAT
1622asmlinkage long compat_sys_execve(const char __user * filename, 1622COMPAT_SYSCALL_DEFINE3(execve, const char __user *, filename,
1623 const compat_uptr_t __user * argv, 1623 const compat_uptr_t __user *, argv,
1624 const compat_uptr_t __user * envp) 1624 const compat_uptr_t __user *, envp)
1625{ 1625{
1626 return compat_do_execve(getname(filename), argv, envp); 1626 return compat_do_execve(getname(filename), argv, envp);
1627} 1627}
diff --git a/fs/proc/stat.c b/fs/proc/stat.c
index 6f599c62f0cc..9d231e9e5f0e 100644
--- a/fs/proc/stat.c
+++ b/fs/proc/stat.c
@@ -9,7 +9,7 @@
9#include <linux/slab.h> 9#include <linux/slab.h>
10#include <linux/time.h> 10#include <linux/time.h>
11#include <linux/irqnr.h> 11#include <linux/irqnr.h>
12#include <asm/cputime.h> 12#include <linux/cputime.h>
13#include <linux/tick.h> 13#include <linux/tick.h>
14 14
15#ifndef arch_irq_stat_cpu 15#ifndef arch_irq_stat_cpu
diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c
index 7141b8d0ca9e..33de567c25af 100644
--- a/fs/proc/uptime.c
+++ b/fs/proc/uptime.c
@@ -5,7 +5,7 @@
5#include <linux/seq_file.h> 5#include <linux/seq_file.h>
6#include <linux/time.h> 6#include <linux/time.h>
7#include <linux/kernel_stat.h> 7#include <linux/kernel_stat.h>
8#include <asm/cputime.h> 8#include <linux/cputime.h>
9 9
10static int uptime_proc_show(struct seq_file *m, void *v) 10static int uptime_proc_show(struct seq_file *m, void *v)
11{ 11{
diff --git a/fs/read_write.c b/fs/read_write.c
index 28cc9c810744..31c6efa43183 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -994,9 +994,9 @@ COMPAT_SYSCALL_DEFINE3(readv, compat_ulong_t, fd,
994 return ret; 994 return ret;
995} 995}
996 996
997COMPAT_SYSCALL_DEFINE4(preadv64, unsigned long, fd, 997static long __compat_sys_preadv64(unsigned long fd,
998 const struct compat_iovec __user *,vec, 998 const struct compat_iovec __user *vec,
999 unsigned long, vlen, loff_t, pos) 999 unsigned long vlen, loff_t pos)
1000{ 1000{
1001 struct fd f; 1001 struct fd f;
1002 ssize_t ret; 1002 ssize_t ret;
@@ -1013,12 +1013,22 @@ COMPAT_SYSCALL_DEFINE4(preadv64, unsigned long, fd,
1013 return ret; 1013 return ret;
1014} 1014}
1015 1015
1016#ifdef __ARCH_WANT_COMPAT_SYS_PREADV64
1017COMPAT_SYSCALL_DEFINE4(preadv64, unsigned long, fd,
1018 const struct compat_iovec __user *,vec,
1019 unsigned long, vlen, loff_t, pos)
1020{
1021 return __compat_sys_preadv64(fd, vec, vlen, pos);
1022}
1023#endif
1024
1016COMPAT_SYSCALL_DEFINE5(preadv, compat_ulong_t, fd, 1025COMPAT_SYSCALL_DEFINE5(preadv, compat_ulong_t, fd,
1017 const struct compat_iovec __user *,vec, 1026 const struct compat_iovec __user *,vec,
1018 compat_ulong_t, vlen, u32, pos_low, u32, pos_high) 1027 compat_ulong_t, vlen, u32, pos_low, u32, pos_high)
1019{ 1028{
1020 loff_t pos = ((loff_t)pos_high << 32) | pos_low; 1029 loff_t pos = ((loff_t)pos_high << 32) | pos_low;
1021 return compat_sys_preadv64(fd, vec, vlen, pos); 1030
1031 return __compat_sys_preadv64(fd, vec, vlen, pos);
1022} 1032}
1023 1033
1024static size_t compat_writev(struct file *file, 1034static size_t compat_writev(struct file *file,
@@ -1061,9 +1071,9 @@ COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
1061 return ret; 1071 return ret;
1062} 1072}
1063 1073
1064COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd, 1074static long __compat_sys_pwritev64(unsigned long fd,
1065 const struct compat_iovec __user *,vec, 1075 const struct compat_iovec __user *vec,
1066 unsigned long, vlen, loff_t, pos) 1076 unsigned long vlen, loff_t pos)
1067{ 1077{
1068 struct fd f; 1078 struct fd f;
1069 ssize_t ret; 1079 ssize_t ret;
@@ -1080,12 +1090,22 @@ COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd,
1080 return ret; 1090 return ret;
1081} 1091}
1082 1092
1093#ifdef __ARCH_WANT_COMPAT_SYS_PWRITEV64
1094COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd,
1095 const struct compat_iovec __user *,vec,
1096 unsigned long, vlen, loff_t, pos)
1097{
1098 return __compat_sys_pwritev64(fd, vec, vlen, pos);
1099}
1100#endif
1101
1083COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd, 1102COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd,
1084 const struct compat_iovec __user *,vec, 1103 const struct compat_iovec __user *,vec,
1085 compat_ulong_t, vlen, u32, pos_low, u32, pos_high) 1104 compat_ulong_t, vlen, u32, pos_low, u32, pos_high)
1086{ 1105{
1087 loff_t pos = ((loff_t)pos_high << 32) | pos_low; 1106 loff_t pos = ((loff_t)pos_high << 32) | pos_low;
1088 return compat_sys_pwritev64(fd, vec, vlen, pos); 1107
1108 return __compat_sys_pwritev64(fd, vec, vlen, pos);
1089} 1109}
1090#endif 1110#endif
1091 1111
diff --git a/fs/timerfd.c b/fs/timerfd.c
index 929312180dd0..0013142c0475 100644
--- a/fs/timerfd.c
+++ b/fs/timerfd.c
@@ -317,6 +317,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
317 (clockid != CLOCK_MONOTONIC && 317 (clockid != CLOCK_MONOTONIC &&
318 clockid != CLOCK_REALTIME && 318 clockid != CLOCK_REALTIME &&
319 clockid != CLOCK_REALTIME_ALARM && 319 clockid != CLOCK_REALTIME_ALARM &&
320 clockid != CLOCK_BOOTTIME &&
320 clockid != CLOCK_BOOTTIME_ALARM)) 321 clockid != CLOCK_BOOTTIME_ALARM))
321 return -EINVAL; 322 return -EINVAL;
322 323
diff --git a/include/asm-generic/cputime_jiffies.h b/include/asm-generic/cputime_jiffies.h
index 272ecba9f588..d5cb78f53986 100644
--- a/include/asm-generic/cputime_jiffies.h
+++ b/include/asm-generic/cputime_jiffies.h
@@ -15,8 +15,10 @@ typedef u64 __nocast cputime64_t;
15 15
16 16
17/* 17/*
18 * Convert nanoseconds to cputime 18 * Convert nanoseconds <-> cputime
19 */ 19 */
20#define cputime_to_nsecs(__ct) \
21 jiffies_to_nsecs(cputime_to_jiffies(__ct))
20#define nsecs_to_cputime64(__nsec) \ 22#define nsecs_to_cputime64(__nsec) \
21 jiffies64_to_cputime64(nsecs_to_jiffies64(__nsec)) 23 jiffies64_to_cputime64(nsecs_to_jiffies64(__nsec))
22#define nsecs_to_cputime(__nsec) \ 24#define nsecs_to_cputime(__nsec) \
diff --git a/include/asm-generic/cputime_nsecs.h b/include/asm-generic/cputime_nsecs.h
index 2c9e62c2bfd0..4e817606c549 100644
--- a/include/asm-generic/cputime_nsecs.h
+++ b/include/asm-generic/cputime_nsecs.h
@@ -44,7 +44,10 @@ typedef u64 __nocast cputime64_t;
44/* 44/*
45 * Convert cputime <-> nanoseconds 45 * Convert cputime <-> nanoseconds
46 */ 46 */
47#define nsecs_to_cputime(__nsecs) ((__force u64)(__nsecs)) 47#define cputime_to_nsecs(__ct) \
48 (__force u64)(__ct)
49#define nsecs_to_cputime(__nsecs) \
50 (__force cputime_t)(__nsecs)
48 51
49 52
50/* 53/*
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 34c7bdc06014..1ec08c198b66 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -193,6 +193,19 @@ static inline int pte_same(pte_t pte_a, pte_t pte_b)
193} 193}
194#endif 194#endif
195 195
196#ifndef __HAVE_ARCH_PTE_UNUSED
197/*
198 * Some architectures provide facilities to virtualization guests
199 * so that they can flag allocated pages as unused. This allows the
200 * host to transparently reclaim unused pages. This function returns
201 * whether the pte's page is unused.
202 */
203static inline int pte_unused(pte_t pte)
204{
205 return 0;
206}
207#endif
208
196#ifndef __HAVE_ARCH_PMD_SAME 209#ifndef __HAVE_ARCH_PMD_SAME
197#ifdef CONFIG_TRANSPARENT_HUGEPAGE 210#ifdef CONFIG_TRANSPARENT_HUGEPAGE
198static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b) 211static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
diff --git a/include/asm-generic/rwsem.h b/include/asm-generic/rwsem.h
index bb1e2cdeb9bf..d48bf5a95cc1 100644
--- a/include/asm-generic/rwsem.h
+++ b/include/asm-generic/rwsem.h
@@ -1,5 +1,5 @@
1#ifndef _ASM_POWERPC_RWSEM_H 1#ifndef _ASM_GENERIC_RWSEM_H
2#define _ASM_POWERPC_RWSEM_H 2#define _ASM_GENERIC_RWSEM_H
3 3
4#ifndef _LINUX_RWSEM_H 4#ifndef _LINUX_RWSEM_H
5#error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead." 5#error "Please don't include <asm/rwsem.h> directly, use <linux/rwsem.h> instead."
@@ -8,7 +8,7 @@
8#ifdef __KERNEL__ 8#ifdef __KERNEL__
9 9
10/* 10/*
11 * R/W semaphores for PPC using the stuff in lib/rwsem.c. 11 * R/W semaphores originally for PPC using the stuff in lib/rwsem.c.
12 * Adapted largely from include/asm-i386/rwsem.h 12 * Adapted largely from include/asm-i386/rwsem.h
13 * by Paul Mackerras <paulus@samba.org>. 13 * by Paul Mackerras <paulus@samba.org>.
14 */ 14 */
@@ -16,7 +16,7 @@
16/* 16/*
17 * the semaphore definition 17 * the semaphore definition
18 */ 18 */
19#ifdef CONFIG_PPC64 19#ifdef CONFIG_64BIT
20# define RWSEM_ACTIVE_MASK 0xffffffffL 20# define RWSEM_ACTIVE_MASK 0xffffffffL
21#else 21#else
22# define RWSEM_ACTIVE_MASK 0x0000ffffL 22# define RWSEM_ACTIVE_MASK 0x0000ffffL
@@ -129,4 +129,4 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)
129} 129}
130 130
131#endif /* __KERNEL__ */ 131#endif /* __KERNEL__ */
132#endif /* _ASM_POWERPC_RWSEM_H */ 132#endif /* _ASM_GENERIC_RWSEM_H */
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
index 73a25005d88a..1f16d502600c 100644
--- a/include/linux/ahci_platform.h
+++ b/include/linux/ahci_platform.h
@@ -19,15 +19,37 @@
19 19
20struct device; 20struct device;
21struct ata_port_info; 21struct ata_port_info;
22struct ahci_host_priv;
23struct platform_device;
22 24
25/*
26 * Note ahci_platform_data is deprecated, it is only kept around for use
27 * by the old da850 and spear13xx ahci code.
28 * New drivers should instead declare their own platform_driver struct, and
29 * use ahci_platform* functions in their own probe, suspend and resume methods.
30 */
23struct ahci_platform_data { 31struct ahci_platform_data {
24 int (*init)(struct device *dev, void __iomem *addr); 32 int (*init)(struct device *dev, void __iomem *addr);
25 void (*exit)(struct device *dev); 33 void (*exit)(struct device *dev);
26 int (*suspend)(struct device *dev); 34 int (*suspend)(struct device *dev);
27 int (*resume)(struct device *dev); 35 int (*resume)(struct device *dev);
28 const struct ata_port_info *ata_port_info;
29 unsigned int force_port_map;
30 unsigned int mask_port_map;
31}; 36};
32 37
38int ahci_platform_enable_clks(struct ahci_host_priv *hpriv);
39void ahci_platform_disable_clks(struct ahci_host_priv *hpriv);
40int ahci_platform_enable_resources(struct ahci_host_priv *hpriv);
41void ahci_platform_disable_resources(struct ahci_host_priv *hpriv);
42struct ahci_host_priv *ahci_platform_get_resources(
43 struct platform_device *pdev);
44int ahci_platform_init_host(struct platform_device *pdev,
45 struct ahci_host_priv *hpriv,
46 const struct ata_port_info *pi_template,
47 unsigned int force_port_map,
48 unsigned int mask_port_map);
49
50int ahci_platform_suspend_host(struct device *dev);
51int ahci_platform_resume_host(struct device *dev);
52int ahci_platform_suspend(struct device *dev);
53int ahci_platform_resume(struct device *dev);
54
33#endif /* _AHCI_PLATFORM_H */ 55#endif /* _AHCI_PLATFORM_H */
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 493aa021c7a9..2e4cb67f6e56 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -62,6 +62,11 @@ enum clock_event_mode {
62#define CLOCK_EVT_FEAT_DYNIRQ 0x000020 62#define CLOCK_EVT_FEAT_DYNIRQ 0x000020
63#define CLOCK_EVT_FEAT_PERCPU 0x000040 63#define CLOCK_EVT_FEAT_PERCPU 0x000040
64 64
65/*
66 * Clockevent device is based on a hrtimer for broadcast
67 */
68#define CLOCK_EVT_FEAT_HRTIMER 0x000080
69
65/** 70/**
66 * struct clock_event_device - clock event device descriptor 71 * struct clock_event_device - clock event device descriptor
67 * @event_handler: Assigned by the framework to be called by the low 72 * @event_handler: Assigned by the framework to be called by the low
@@ -83,6 +88,7 @@ enum clock_event_mode {
83 * @name: ptr to clock event name 88 * @name: ptr to clock event name
84 * @rating: variable to rate clock event devices 89 * @rating: variable to rate clock event devices
85 * @irq: IRQ number (only for non CPU local devices) 90 * @irq: IRQ number (only for non CPU local devices)
91 * @bound_on: Bound on CPU
86 * @cpumask: cpumask to indicate for which CPUs this device works 92 * @cpumask: cpumask to indicate for which CPUs this device works
87 * @list: list head for the management code 93 * @list: list head for the management code
88 * @owner: module reference 94 * @owner: module reference
@@ -113,6 +119,7 @@ struct clock_event_device {
113 const char *name; 119 const char *name;
114 int rating; 120 int rating;
115 int irq; 121 int irq;
122 int bound_on;
116 const struct cpumask *cpumask; 123 const struct cpumask *cpumask;
117 struct list_head list; 124 struct list_head list;
118 struct module *owner; 125 struct module *owner;
@@ -180,15 +187,17 @@ extern int tick_receive_broadcast(void);
180#endif 187#endif
181 188
182#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT) 189#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT)
190extern void tick_setup_hrtimer_broadcast(void);
183extern int tick_check_broadcast_expired(void); 191extern int tick_check_broadcast_expired(void);
184#else 192#else
185static inline int tick_check_broadcast_expired(void) { return 0; } 193static inline int tick_check_broadcast_expired(void) { return 0; }
194static inline void tick_setup_hrtimer_broadcast(void) {};
186#endif 195#endif
187 196
188#ifdef CONFIG_GENERIC_CLOCKEVENTS 197#ifdef CONFIG_GENERIC_CLOCKEVENTS
189extern void clockevents_notify(unsigned long reason, void *arg); 198extern int clockevents_notify(unsigned long reason, void *arg);
190#else 199#else
191static inline void clockevents_notify(unsigned long reason, void *arg) {} 200static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; }
192#endif 201#endif
193 202
194#else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */ 203#else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */
@@ -196,8 +205,9 @@ static inline void clockevents_notify(unsigned long reason, void *arg) {}
196static inline void clockevents_suspend(void) {} 205static inline void clockevents_suspend(void) {}
197static inline void clockevents_resume(void) {} 206static inline void clockevents_resume(void) {}
198 207
199static inline void clockevents_notify(unsigned long reason, void *arg) {} 208static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; }
200static inline int tick_check_broadcast_expired(void) { return 0; } 209static inline int tick_check_broadcast_expired(void) { return 0; }
210static inline void tick_setup_hrtimer_broadcast(void) {};
201 211
202#endif 212#endif
203 213
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 3f448c65511b..01c0aa57ccec 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -14,6 +14,7 @@
14#include <linux/if.h> 14#include <linux/if.h>
15#include <linux/fs.h> 15#include <linux/fs.h>
16#include <linux/aio_abi.h> /* for aio_context_t */ 16#include <linux/aio_abi.h> /* for aio_context_t */
17#include <linux/unistd.h>
17 18
18#include <asm/compat.h> 19#include <asm/compat.h>
19#include <asm/siginfo.h> 20#include <asm/siginfo.h>
@@ -27,6 +28,9 @@
27#define __SC_DELOUSE(t,v) ((t)(unsigned long)(v)) 28#define __SC_DELOUSE(t,v) ((t)(unsigned long)(v))
28#endif 29#endif
29 30
31#define COMPAT_SYSCALL_DEFINE0(name) \
32 asmlinkage long compat_sys_##name(void)
33
30#define COMPAT_SYSCALL_DEFINE1(name, ...) \ 34#define COMPAT_SYSCALL_DEFINE1(name, ...) \
31 COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__) 35 COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
32#define COMPAT_SYSCALL_DEFINE2(name, ...) \ 36#define COMPAT_SYSCALL_DEFINE2(name, ...) \
@@ -68,6 +72,8 @@ typedef struct compat_sigaltstack {
68typedef __compat_uid32_t compat_uid_t; 72typedef __compat_uid32_t compat_uid_t;
69typedef __compat_gid32_t compat_gid_t; 73typedef __compat_gid32_t compat_gid_t;
70 74
75typedef compat_ulong_t compat_aio_context_t;
76
71struct compat_sel_arg_struct; 77struct compat_sel_arg_struct;
72struct rusage; 78struct rusage;
73 79
@@ -318,7 +324,7 @@ asmlinkage long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
318asmlinkage long compat_sys_msgsnd(int msqid, compat_uptr_t msgp, 324asmlinkage long compat_sys_msgsnd(int msqid, compat_uptr_t msgp,
319 compat_ssize_t msgsz, int msgflg); 325 compat_ssize_t msgsz, int msgflg);
320asmlinkage long compat_sys_msgrcv(int msqid, compat_uptr_t msgp, 326asmlinkage long compat_sys_msgrcv(int msqid, compat_uptr_t msgp,
321 compat_ssize_t msgsz, long msgtyp, int msgflg); 327 compat_ssize_t msgsz, compat_long_t msgtyp, int msgflg);
322long compat_sys_msgctl(int first, int second, void __user *uptr); 328long compat_sys_msgctl(int first, int second, void __user *uptr);
323long compat_sys_shmctl(int first, int second, void __user *uptr); 329long compat_sys_shmctl(int first, int second, void __user *uptr);
324long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, 330long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
@@ -337,6 +343,19 @@ asmlinkage ssize_t compat_sys_preadv(compat_ulong_t fd,
337asmlinkage ssize_t compat_sys_pwritev(compat_ulong_t fd, 343asmlinkage ssize_t compat_sys_pwritev(compat_ulong_t fd,
338 const struct compat_iovec __user *vec, 344 const struct compat_iovec __user *vec,
339 compat_ulong_t vlen, u32 pos_low, u32 pos_high); 345 compat_ulong_t vlen, u32 pos_low, u32 pos_high);
346
347#ifdef __ARCH_WANT_COMPAT_SYS_PREADV64
348asmlinkage long compat_sys_preadv64(unsigned long fd,
349 const struct compat_iovec __user *vec,
350 unsigned long vlen, loff_t pos);
351#endif
352
353#ifdef __ARCH_WANT_COMPAT_SYS_PWRITEV64
354asmlinkage long compat_sys_pwritev64(unsigned long fd,
355 const struct compat_iovec __user *vec,
356 unsigned long vlen, loff_t pos);
357#endif
358
340asmlinkage long compat_sys_lseek(unsigned int, compat_off_t, unsigned int); 359asmlinkage long compat_sys_lseek(unsigned int, compat_off_t, unsigned int);
341 360
342asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv, 361asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv,
@@ -451,7 +470,7 @@ asmlinkage long compat_sys_timerfd_settime(int ufd, int flags,
451asmlinkage long compat_sys_timerfd_gettime(int ufd, 470asmlinkage long compat_sys_timerfd_gettime(int ufd,
452 struct compat_itimerspec __user *otmr); 471 struct compat_itimerspec __user *otmr);
453 472
454asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_page, 473asmlinkage long compat_sys_move_pages(pid_t pid, compat_ulong_t nr_pages,
455 __u32 __user *pages, 474 __u32 __user *pages,
456 const int __user *nodes, 475 const int __user *nodes,
457 int __user *status, 476 int __user *status,
@@ -481,20 +500,20 @@ asmlinkage long compat_sys_statfs64(const char __user *pathname,
481asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, 500asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz,
482 struct compat_statfs64 __user *buf); 501 struct compat_statfs64 __user *buf);
483asmlinkage long compat_sys_fcntl64(unsigned int fd, unsigned int cmd, 502asmlinkage long compat_sys_fcntl64(unsigned int fd, unsigned int cmd,
484 unsigned long arg); 503 compat_ulong_t arg);
485asmlinkage long compat_sys_fcntl(unsigned int fd, unsigned int cmd, 504asmlinkage long compat_sys_fcntl(unsigned int fd, unsigned int cmd,
486 unsigned long arg); 505 compat_ulong_t arg);
487asmlinkage long compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p); 506asmlinkage long compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p);
488asmlinkage long compat_sys_io_getevents(aio_context_t ctx_id, 507asmlinkage long compat_sys_io_getevents(compat_aio_context_t ctx_id,
489 unsigned long min_nr, 508 compat_long_t min_nr,
490 unsigned long nr, 509 compat_long_t nr,
491 struct io_event __user *events, 510 struct io_event __user *events,
492 struct compat_timespec __user *timeout); 511 struct compat_timespec __user *timeout);
493asmlinkage long compat_sys_io_submit(aio_context_t ctx_id, int nr, 512asmlinkage long compat_sys_io_submit(compat_aio_context_t ctx_id, int nr,
494 u32 __user *iocb); 513 u32 __user *iocb);
495asmlinkage long compat_sys_mount(const char __user *dev_name, 514asmlinkage long compat_sys_mount(const char __user *dev_name,
496 const char __user *dir_name, 515 const char __user *dir_name,
497 const char __user *type, unsigned long flags, 516 const char __user *type, compat_ulong_t flags,
498 const void __user *data); 517 const void __user *data);
499asmlinkage long compat_sys_old_readdir(unsigned int fd, 518asmlinkage long compat_sys_old_readdir(unsigned int fd,
500 struct compat_old_linux_dirent __user *, 519 struct compat_old_linux_dirent __user *,
@@ -502,9 +521,11 @@ asmlinkage long compat_sys_old_readdir(unsigned int fd,
502asmlinkage long compat_sys_getdents(unsigned int fd, 521asmlinkage long compat_sys_getdents(unsigned int fd,
503 struct compat_linux_dirent __user *dirent, 522 struct compat_linux_dirent __user *dirent,
504 unsigned int count); 523 unsigned int count);
524#ifdef __ARCH_WANT_COMPAT_SYS_GETDENTS64
505asmlinkage long compat_sys_getdents64(unsigned int fd, 525asmlinkage long compat_sys_getdents64(unsigned int fd,
506 struct linux_dirent64 __user *dirent, 526 struct linux_dirent64 __user *dirent,
507 unsigned int count); 527 unsigned int count);
528#endif
508asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *, 529asmlinkage long compat_sys_vmsplice(int fd, const struct compat_iovec __user *,
509 unsigned int nr_segs, unsigned int flags); 530 unsigned int nr_segs, unsigned int flags);
510asmlinkage long compat_sys_open(const char __user *filename, int flags, 531asmlinkage long compat_sys_open(const char __user *filename, int flags,
@@ -549,9 +570,9 @@ asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg,
549 unsigned vlen, unsigned int flags); 570 unsigned vlen, unsigned int flags);
550asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg, 571asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg,
551 unsigned int flags); 572 unsigned int flags);
552asmlinkage long compat_sys_recv(int fd, void __user *buf, size_t len, 573asmlinkage long compat_sys_recv(int fd, void __user *buf, compat_size_t len,
553 unsigned flags); 574 unsigned flags);
554asmlinkage long compat_sys_recvfrom(int fd, void __user *buf, size_t len, 575asmlinkage long compat_sys_recvfrom(int fd, void __user *buf, compat_size_t len,
555 unsigned flags, struct sockaddr __user *addr, 576 unsigned flags, struct sockaddr __user *addr,
556 int __user *addrlen); 577 int __user *addrlen);
557asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, 578asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
@@ -615,16 +636,16 @@ asmlinkage long compat_sys_rt_sigqueueinfo(compat_pid_t pid, int sig,
615 struct compat_siginfo __user *uinfo); 636 struct compat_siginfo __user *uinfo);
616asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info); 637asmlinkage long compat_sys_sysinfo(struct compat_sysinfo __user *info);
617asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, 638asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
618 unsigned long arg); 639 compat_ulong_t arg);
619asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val, 640asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
620 struct compat_timespec __user *utime, u32 __user *uaddr2, 641 struct compat_timespec __user *utime, u32 __user *uaddr2,
621 u32 val3); 642 u32 val3);
622asmlinkage long compat_sys_getsockopt(int fd, int level, int optname, 643asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
623 char __user *optval, int __user *optlen); 644 char __user *optval, int __user *optlen);
624asmlinkage long compat_sys_kexec_load(unsigned long entry, 645asmlinkage long compat_sys_kexec_load(compat_ulong_t entry,
625 unsigned long nr_segments, 646 compat_ulong_t nr_segments,
626 struct compat_kexec_segment __user *, 647 struct compat_kexec_segment __user *,
627 unsigned long flags); 648 compat_ulong_t flags);
628asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes, 649asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes,
629 const struct compat_mq_attr __user *u_mqstat, 650 const struct compat_mq_attr __user *u_mqstat,
630 struct compat_mq_attr __user *u_omqstat); 651 struct compat_mq_attr __user *u_omqstat);
@@ -635,11 +656,11 @@ asmlinkage long compat_sys_mq_open(const char __user *u_name,
635 struct compat_mq_attr __user *u_attr); 656 struct compat_mq_attr __user *u_attr);
636asmlinkage long compat_sys_mq_timedsend(mqd_t mqdes, 657asmlinkage long compat_sys_mq_timedsend(mqd_t mqdes,
637 const char __user *u_msg_ptr, 658 const char __user *u_msg_ptr,
638 size_t msg_len, unsigned int msg_prio, 659 compat_size_t msg_len, unsigned int msg_prio,
639 const struct compat_timespec __user *u_abs_timeout); 660 const struct compat_timespec __user *u_abs_timeout);
640asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes, 661asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes,
641 char __user *u_msg_ptr, 662 char __user *u_msg_ptr,
642 size_t msg_len, unsigned int __user *u_msg_prio, 663 compat_size_t msg_len, unsigned int __user *u_msg_prio,
643 const struct compat_timespec __user *u_abs_timeout); 664 const struct compat_timespec __user *u_abs_timeout);
644asmlinkage long compat_sys_socketcall(int call, u32 __user *args); 665asmlinkage long compat_sys_socketcall(int call, u32 __user *args);
645asmlinkage long compat_sys_sysctl(struct compat_sysctl_args __user *args); 666asmlinkage long compat_sys_sysctl(struct compat_sysctl_args __user *args);
@@ -654,12 +675,12 @@ extern void __user *compat_alloc_user_space(unsigned long len);
654 675
655asmlinkage ssize_t compat_sys_process_vm_readv(compat_pid_t pid, 676asmlinkage ssize_t compat_sys_process_vm_readv(compat_pid_t pid,
656 const struct compat_iovec __user *lvec, 677 const struct compat_iovec __user *lvec,
657 unsigned long liovcnt, const struct compat_iovec __user *rvec, 678 compat_ulong_t liovcnt, const struct compat_iovec __user *rvec,
658 unsigned long riovcnt, unsigned long flags); 679 compat_ulong_t riovcnt, compat_ulong_t flags);
659asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid, 680asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
660 const struct compat_iovec __user *lvec, 681 const struct compat_iovec __user *lvec,
661 unsigned long liovcnt, const struct compat_iovec __user *rvec, 682 compat_ulong_t liovcnt, const struct compat_iovec __user *rvec,
662 unsigned long riovcnt, unsigned long flags); 683 compat_ulong_t riovcnt, compat_ulong_t flags);
663 684
664asmlinkage long compat_sys_sendfile(int out_fd, int in_fd, 685asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
665 compat_off_t __user *offset, compat_size_t count); 686 compat_off_t __user *offset, compat_size_t count);
diff --git a/include/linux/cputime.h b/include/linux/cputime.h
new file mode 100644
index 000000000000..f2eb2ee535ca
--- /dev/null
+++ b/include/linux/cputime.h
@@ -0,0 +1,16 @@
1#ifndef __LINUX_CPUTIME_H
2#define __LINUX_CPUTIME_H
3
4#include <asm/cputime.h>
5
6#ifndef cputime_to_nsecs
7# define cputime_to_nsecs(__ct) \
8 (cputime_to_usecs(__ct) * NSEC_PER_USEC)
9#endif
10
11#ifndef nsecs_to_cputime
12# define nsecs_to_cputime(__nsecs) \
13 usecs_to_cputime((__nsecs) / NSEC_PER_USEC)
14#endif
15
16#endif /* __LINUX_CPUTIME_H */
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 12d5f972f23f..cba442ec3c66 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -9,6 +9,7 @@
9 9
10 10
11extern void synchronize_irq(unsigned int irq); 11extern void synchronize_irq(unsigned int irq);
12extern void synchronize_hardirq(unsigned int irq);
12 13
13#if defined(CONFIG_TINY_RCU) 14#if defined(CONFIG_TINY_RCU)
14 15
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index d19a5c2d2270..e7a8d3fa91d5 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -96,12 +96,12 @@ enum hrtimer_restart {
96 * @function: timer expiry callback function 96 * @function: timer expiry callback function
97 * @base: pointer to the timer base (per cpu and per clock) 97 * @base: pointer to the timer base (per cpu and per clock)
98 * @state: state information (See bit values above) 98 * @state: state information (See bit values above)
99 * @start_pid: timer statistics field to store the pid of the task which
100 * started the timer
99 * @start_site: timer statistics field to store the site where the timer 101 * @start_site: timer statistics field to store the site where the timer
100 * was started 102 * was started
101 * @start_comm: timer statistics field to store the name of the process which 103 * @start_comm: timer statistics field to store the name of the process which
102 * started the timer 104 * started the timer
103 * @start_pid: timer statistics field to store the pid of the task which
104 * started the timer
105 * 105 *
106 * The hrtimer structure must be initialized by hrtimer_init() 106 * The hrtimer structure must be initialized by hrtimer_init()
107 */ 107 */
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index a2678d35b5a2..c7bfac1c4a7b 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -188,6 +188,7 @@ extern void disable_irq(unsigned int irq);
188extern void disable_percpu_irq(unsigned int irq); 188extern void disable_percpu_irq(unsigned int irq);
189extern void enable_irq(unsigned int irq); 189extern void enable_irq(unsigned int irq);
190extern void enable_percpu_irq(unsigned int irq, unsigned int type); 190extern void enable_percpu_irq(unsigned int irq, unsigned int type);
191extern void irq_wake_thread(unsigned int irq, void *dev_id);
191 192
192/* The following three functions are for the core kernel use only. */ 193/* The following three functions are for the core kernel use only. */
193extern void suspend_device_irqs(void); 194extern void suspend_device_irqs(void);
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 7dc10036eff5..d278838908cb 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -303,6 +303,10 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
303 * @irq_pm_shutdown: function called from core code on shutdown once per chip 303 * @irq_pm_shutdown: function called from core code on shutdown once per chip
304 * @irq_calc_mask: Optional function to set irq_data.mask for special cases 304 * @irq_calc_mask: Optional function to set irq_data.mask for special cases
305 * @irq_print_chip: optional to print special chip info in show_interrupts 305 * @irq_print_chip: optional to print special chip info in show_interrupts
306 * @irq_request_resources: optional to request resources before calling
307 * any other callback related to this irq
308 * @irq_release_resources: optional to release resources acquired with
309 * irq_request_resources
306 * @flags: chip specific flags 310 * @flags: chip specific flags
307 */ 311 */
308struct irq_chip { 312struct irq_chip {
@@ -336,6 +340,8 @@ struct irq_chip {
336 void (*irq_calc_mask)(struct irq_data *data); 340 void (*irq_calc_mask)(struct irq_data *data);
337 341
338 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p); 342 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p);
343 int (*irq_request_resources)(struct irq_data *data);
344 void (*irq_release_resources)(struct irq_data *data);
339 345
340 unsigned long flags; 346 unsigned long flags;
341}; 347};
@@ -349,6 +355,8 @@ struct irq_chip {
349 * IRQCHIP_ONOFFLINE_ENABLED: Only call irq_on/off_line callbacks 355 * IRQCHIP_ONOFFLINE_ENABLED: Only call irq_on/off_line callbacks
350 * when irq enabled 356 * when irq enabled
351 * IRQCHIP_SKIP_SET_WAKE: Skip chip.irq_set_wake(), for this irq chip 357 * IRQCHIP_SKIP_SET_WAKE: Skip chip.irq_set_wake(), for this irq chip
358 * IRQCHIP_ONESHOT_SAFE: One shot does not require mask/unmask
359 * IRQCHIP_EOI_THREADED: Chip requires eoi() on unmask in threaded mode
352 */ 360 */
353enum { 361enum {
354 IRQCHIP_SET_TYPE_MASKED = (1 << 0), 362 IRQCHIP_SET_TYPE_MASKED = (1 << 0),
@@ -357,6 +365,7 @@ enum {
357 IRQCHIP_ONOFFLINE_ENABLED = (1 << 3), 365 IRQCHIP_ONOFFLINE_ENABLED = (1 << 3),
358 IRQCHIP_SKIP_SET_WAKE = (1 << 4), 366 IRQCHIP_SKIP_SET_WAKE = (1 << 4),
359 IRQCHIP_ONESHOT_SAFE = (1 << 5), 367 IRQCHIP_ONESHOT_SAFE = (1 << 5),
368 IRQCHIP_EOI_THREADED = (1 << 6),
360}; 369};
361 370
362/* This include will go away once we isolated irq_desc usage to core code */ 371/* This include will go away once we isolated irq_desc usage to core code */
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 51c72be4a7c3..ecbc52f9ff77 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -9,7 +9,7 @@
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/vtime.h> 10#include <linux/vtime.h>
11#include <asm/irq.h> 11#include <asm/irq.h>
12#include <asm/cputime.h> 12#include <linux/cputime.h>
13 13
14/* 14/*
15 * 'kernel_stat.h' contains the definitions needed for doing 15 * 'kernel_stat.h' contains the definitions needed for doing
@@ -51,14 +51,8 @@ DECLARE_PER_CPU(struct kernel_cpustat, kernel_cpustat);
51 51
52extern unsigned long long nr_context_switches(void); 52extern unsigned long long nr_context_switches(void);
53 53
54#include <linux/irq.h>
55extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu); 54extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu);
56 55extern void kstat_incr_irq_this_cpu(unsigned int irq);
57#define kstat_incr_irqs_this_cpu(irqno, DESC) \
58do { \
59 __this_cpu_inc(*(DESC)->kstat_irqs); \
60 __this_cpu_inc(kstat.irqs_sum); \
61} while (0)
62 56
63static inline void kstat_incr_softirqs_this_cpu(unsigned int irq) 57static inline void kstat_incr_softirqs_this_cpu(unsigned int irq)
64{ 58{
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 6d4066cdb5b5..a75641930049 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -127,12 +127,6 @@ extern asmlinkage long sys_kexec_load(unsigned long entry,
127 struct kexec_segment __user *segments, 127 struct kexec_segment __user *segments,
128 unsigned long flags); 128 unsigned long flags);
129extern int kernel_kexec(void); 129extern int kernel_kexec(void);
130#ifdef CONFIG_COMPAT
131extern asmlinkage long compat_sys_kexec_load(unsigned long entry,
132 unsigned long nr_segments,
133 struct compat_kexec_segment __user *segments,
134 unsigned long flags);
135#endif
136extern struct page *kimage_alloc_control_pages(struct kimage *image, 130extern struct page *kimage_alloc_control_pages(struct kimage *image,
137 unsigned int order); 131 unsigned int order);
138extern void crash_kexec(struct pt_regs *); 132extern void crash_kexec(struct pt_regs *);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index bec6dbe939a0..1de36be64df4 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -848,7 +848,6 @@ struct ata_port {
848 struct completion park_req_pending; 848 struct completion park_req_pending;
849 849
850 pm_message_t pm_mesg; 850 pm_message_t pm_mesg;
851 int *pm_result;
852 enum ata_lpm_policy target_lpm_policy; 851 enum ata_lpm_policy target_lpm_policy;
853 852
854 struct timer_list fastdrain_timer; 853 struct timer_list fastdrain_timer;
@@ -1140,16 +1139,14 @@ extern bool ata_link_offline(struct ata_link *link);
1140#ifdef CONFIG_PM 1139#ifdef CONFIG_PM
1141extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); 1140extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
1142extern void ata_host_resume(struct ata_host *host); 1141extern void ata_host_resume(struct ata_host *host);
1143extern int ata_sas_port_async_suspend(struct ata_port *ap, int *async); 1142extern void ata_sas_port_suspend(struct ata_port *ap);
1144extern int ata_sas_port_async_resume(struct ata_port *ap, int *async); 1143extern void ata_sas_port_resume(struct ata_port *ap);
1145#else 1144#else
1146static inline int ata_sas_port_async_suspend(struct ata_port *ap, int *async) 1145static inline void ata_sas_port_suspend(struct ata_port *ap)
1147{ 1146{
1148 return 0;
1149} 1147}
1150static inline int ata_sas_port_async_resume(struct ata_port *ap, int *async) 1148static inline void ata_sas_port_resume(struct ata_port *ap)
1151{ 1149{
1152 return 0;
1153} 1150}
1154#endif 1151#endif
1155extern int ata_ratelimit(void); 1152extern int ata_ratelimit(void);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index c1b7414c7bef..a0df4295e171 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1487,9 +1487,15 @@ static inline void pgtable_page_dtor(struct page *page)
1487 1487
1488#if USE_SPLIT_PMD_PTLOCKS 1488#if USE_SPLIT_PMD_PTLOCKS
1489 1489
1490static struct page *pmd_to_page(pmd_t *pmd)
1491{
1492 unsigned long mask = ~(PTRS_PER_PMD * sizeof(pmd_t) - 1);
1493 return virt_to_page((void *)((unsigned long) pmd & mask));
1494}
1495
1490static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd) 1496static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd)
1491{ 1497{
1492 return ptlock_ptr(virt_to_page(pmd)); 1498 return ptlock_ptr(pmd_to_page(pmd));
1493} 1499}
1494 1500
1495static inline bool pgtable_pmd_page_ctor(struct page *page) 1501static inline bool pgtable_pmd_page_ctor(struct page *page)
@@ -1508,7 +1514,7 @@ static inline void pgtable_pmd_page_dtor(struct page *page)
1508 ptlock_free(page); 1514 ptlock_free(page);
1509} 1515}
1510 1516
1511#define pmd_huge_pte(mm, pmd) (virt_to_page(pmd)->pmd_huge_pte) 1517#define pmd_huge_pte(mm, pmd) (pmd_to_page(pmd)->pmd_huge_pte)
1512 1518
1513#else 1519#else
1514 1520
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 69ae03f6eb15..6b9aafed225f 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -87,6 +87,7 @@ struct nvme_dev {
87 struct list_head namespaces; 87 struct list_head namespaces;
88 struct kref kref; 88 struct kref kref;
89 struct miscdevice miscdev; 89 struct miscdevice miscdev;
90 work_func_t reset_workfn;
90 struct work_struct reset_work; 91 struct work_struct reset_work;
91 char name[12]; 92 char name[12];
92 char serial[20]; 93 char serial[20];
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 825ed838d4b9..7cb07fd26680 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -29,7 +29,7 @@ struct sched_param {
29 29
30#include <asm/page.h> 30#include <asm/page.h>
31#include <asm/ptrace.h> 31#include <asm/ptrace.h>
32#include <asm/cputime.h> 32#include <linux/cputime.h>
33 33
34#include <linux/smp.h> 34#include <linux/smp.h>
35#include <linux/sem.h> 35#include <linux/sem.h>
@@ -294,10 +294,14 @@ extern int runqueue_is_locked(int cpu);
294#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) 294#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
295extern void nohz_balance_enter_idle(int cpu); 295extern void nohz_balance_enter_idle(int cpu);
296extern void set_cpu_sd_state_idle(void); 296extern void set_cpu_sd_state_idle(void);
297extern int get_nohz_timer_target(void); 297extern int get_nohz_timer_target(int pinned);
298#else 298#else
299static inline void nohz_balance_enter_idle(int cpu) { } 299static inline void nohz_balance_enter_idle(int cpu) { }
300static inline void set_cpu_sd_state_idle(void) { } 300static inline void set_cpu_sd_state_idle(void) { }
301static inline int get_nohz_timer_target(int pinned)
302{
303 return smp_processor_id();
304}
301#endif 305#endif
302 306
303/* 307/*
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index a747a77ea584..1e67b7a5968c 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -98,6 +98,8 @@ struct sigaltstack;
98#define __MAP(n,...) __MAP##n(__VA_ARGS__) 98#define __MAP(n,...) __MAP##n(__VA_ARGS__)
99 99
100#define __SC_DECL(t, a) t a 100#define __SC_DECL(t, a) t a
101#define __TYPE_IS_L(t) (__same_type((t)0, 0L))
102#define __TYPE_IS_UL(t) (__same_type((t)0, 0UL))
101#define __TYPE_IS_LL(t) (__same_type((t)0, 0LL) || __same_type((t)0, 0ULL)) 103#define __TYPE_IS_LL(t) (__same_type((t)0, 0LL) || __same_type((t)0, 0ULL))
102#define __SC_LONG(t, a) __typeof(__builtin_choose_expr(__TYPE_IS_LL(t), 0LL, 0L)) a 104#define __SC_LONG(t, a) __typeof(__builtin_choose_expr(__TYPE_IS_LL(t), 0LL, 0L)) a
103#define __SC_CAST(t, a) (t) a 105#define __SC_CAST(t, a) (t) a
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 704f4f652d0a..1b22c42e9c2d 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -177,20 +177,10 @@ struct execute_work {
177#define DECLARE_DEFERRABLE_WORK(n, f) \ 177#define DECLARE_DEFERRABLE_WORK(n, f) \
178 struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, TIMER_DEFERRABLE) 178 struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, TIMER_DEFERRABLE)
179 179
180/*
181 * initialize a work item's function pointer
182 */
183#define PREPARE_WORK(_work, _func) \
184 do { \
185 (_work)->func = (_func); \
186 } while (0)
187
188#define PREPARE_DELAYED_WORK(_work, _func) \
189 PREPARE_WORK(&(_work)->work, (_func))
190
191#ifdef CONFIG_DEBUG_OBJECTS_WORK 180#ifdef CONFIG_DEBUG_OBJECTS_WORK
192extern void __init_work(struct work_struct *work, int onstack); 181extern void __init_work(struct work_struct *work, int onstack);
193extern void destroy_work_on_stack(struct work_struct *work); 182extern void destroy_work_on_stack(struct work_struct *work);
183extern void destroy_delayed_work_on_stack(struct delayed_work *work);
194static inline unsigned int work_static(struct work_struct *work) 184static inline unsigned int work_static(struct work_struct *work)
195{ 185{
196 return *work_data_bits(work) & WORK_STRUCT_STATIC; 186 return *work_data_bits(work) & WORK_STRUCT_STATIC;
@@ -198,6 +188,7 @@ static inline unsigned int work_static(struct work_struct *work)
198#else 188#else
199static inline void __init_work(struct work_struct *work, int onstack) { } 189static inline void __init_work(struct work_struct *work, int onstack) { }
200static inline void destroy_work_on_stack(struct work_struct *work) { } 190static inline void destroy_work_on_stack(struct work_struct *work) { }
191static inline void destroy_delayed_work_on_stack(struct delayed_work *work) { }
201static inline unsigned int work_static(struct work_struct *work) { return 0; } 192static inline unsigned int work_static(struct work_struct *work) { return 0; }
202#endif 193#endif
203 194
@@ -217,7 +208,7 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
217 (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ 208 (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \
218 lockdep_init_map(&(_work)->lockdep_map, #_work, &__key, 0); \ 209 lockdep_init_map(&(_work)->lockdep_map, #_work, &__key, 0); \
219 INIT_LIST_HEAD(&(_work)->entry); \ 210 INIT_LIST_HEAD(&(_work)->entry); \
220 PREPARE_WORK((_work), (_func)); \ 211 (_work)->func = (_func); \
221 } while (0) 212 } while (0)
222#else 213#else
223#define __INIT_WORK(_work, _func, _onstack) \ 214#define __INIT_WORK(_work, _func, _onstack) \
@@ -225,7 +216,7 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
225 __init_work((_work), _onstack); \ 216 __init_work((_work), _onstack); \
226 (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ 217 (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \
227 INIT_LIST_HEAD(&(_work)->entry); \ 218 INIT_LIST_HEAD(&(_work)->entry); \
228 PREPARE_WORK((_work), (_func)); \ 219 (_work)->func = (_func); \
229 } while (0) 220 } while (0)
230#endif 221#endif
231 222
@@ -295,17 +286,11 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
295 * Documentation/workqueue.txt. 286 * Documentation/workqueue.txt.
296 */ 287 */
297enum { 288enum {
298 /*
299 * All wqs are now non-reentrant making the following flag
300 * meaningless. Will be removed.
301 */
302 WQ_NON_REENTRANT = 1 << 0, /* DEPRECATED */
303
304 WQ_UNBOUND = 1 << 1, /* not bound to any cpu */ 289 WQ_UNBOUND = 1 << 1, /* not bound to any cpu */
305 WQ_FREEZABLE = 1 << 2, /* freeze during suspend */ 290 WQ_FREEZABLE = 1 << 2, /* freeze during suspend */
306 WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */ 291 WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */
307 WQ_HIGHPRI = 1 << 4, /* high priority */ 292 WQ_HIGHPRI = 1 << 4, /* high priority */
308 WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ 293 WQ_CPU_INTENSIVE = 1 << 5, /* cpu intensive workqueue */
309 WQ_SYSFS = 1 << 6, /* visible in sysfs, see wq_sysfs_register() */ 294 WQ_SYSFS = 1 << 6, /* visible in sysfs, see wq_sysfs_register() */
310 295
311 /* 296 /*
@@ -602,21 +587,6 @@ static inline bool keventd_up(void)
602 return system_wq != NULL; 587 return system_wq != NULL;
603} 588}
604 589
605/*
606 * Like above, but uses del_timer() instead of del_timer_sync(). This means,
607 * if it returns 0 the timer function may be running and the queueing is in
608 * progress.
609 */
610static inline bool __deprecated __cancel_delayed_work(struct delayed_work *work)
611{
612 bool ret;
613
614 ret = del_timer(&work->timer);
615 if (ret)
616 work_clear_pending(&work->work);
617 return ret;
618}
619
620/* used to be different but now identical to flush_work(), deprecated */ 590/* used to be different but now identical to flush_work(), deprecated */
621static inline bool __deprecated flush_work_sync(struct work_struct *work) 591static inline bool __deprecated flush_work_sync(struct work_struct *work)
622{ 592{
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index f843dd8722a9..ef7872c20da9 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -172,7 +172,6 @@ struct sata_device {
172 enum ata_command_set command_set; 172 enum ata_command_set command_set;
173 struct smp_resp rps_resp; /* report_phy_sata_resp */ 173 struct smp_resp rps_resp; /* report_phy_sata_resp */
174 u8 port_no; /* port number, if this is a PM (Port) */ 174 u8 port_no; /* port number, if this is a PM (Port) */
175 int pm_result;
176 175
177 struct ata_port *ap; 176 struct ata_port *ap;
178 struct ata_host ata_host; 177 struct ata_host ata_host;
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index dde8041f40d2..6db66783d268 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -191,6 +191,7 @@ __SYSCALL(__NR_quotactl, sys_quotactl)
191 191
192/* fs/readdir.c */ 192/* fs/readdir.c */
193#define __NR_getdents64 61 193#define __NR_getdents64 61
194#define __ARCH_WANT_COMPAT_SYS_GETDENTS64
194__SC_COMP(__NR_getdents64, sys_getdents64, compat_sys_getdents64) 195__SC_COMP(__NR_getdents64, sys_getdents64, compat_sys_getdents64)
195 196
196/* fs/read_write.c */ 197/* fs/read_write.c */
diff --git a/ipc/compat.c b/ipc/compat.c
index f486b0096a67..98b9016cab6c 100644
--- a/ipc/compat.c
+++ b/ipc/compat.c
@@ -430,9 +430,9 @@ COMPAT_SYSCALL_DEFINE4(msgsnd, int, msqid, compat_uptr_t, msgp,
430} 430}
431 431
432COMPAT_SYSCALL_DEFINE5(msgrcv, int, msqid, compat_uptr_t, msgp, 432COMPAT_SYSCALL_DEFINE5(msgrcv, int, msqid, compat_uptr_t, msgp,
433 compat_ssize_t, msgsz, long, msgtyp, int, msgflg) 433 compat_ssize_t, msgsz, compat_long_t, msgtyp, int, msgflg)
434{ 434{
435 return do_msgrcv(msqid, compat_ptr(msgp), (ssize_t)msgsz, msgtyp, 435 return do_msgrcv(msqid, compat_ptr(msgp), (ssize_t)msgsz, (long)msgtyp,
436 msgflg, compat_do_msg_fill); 436 msgflg, compat_do_msg_fill);
437} 437}
438 438
@@ -498,7 +498,7 @@ static inline int put_compat_msqid_ds(struct msqid64_ds *m,
498 return err; 498 return err;
499} 499}
500 500
501long compat_sys_msgctl(int first, int second, void __user *uptr) 501COMPAT_SYSCALL_DEFINE3(msgctl, int, first, int, second, void __user *, uptr)
502{ 502{
503 int err, err2; 503 int err, err2;
504 struct msqid64_ds m64; 504 struct msqid64_ds m64;
@@ -668,7 +668,7 @@ static inline int put_compat_shm_info(struct shm_info __user *ip,
668 return err; 668 return err;
669} 669}
670 670
671long compat_sys_shmctl(int first, int second, void __user *uptr) 671COMPAT_SYSCALL_DEFINE3(shmctl, int, first, int, second, void __user *, uptr)
672{ 672{
673 void __user *p; 673 void __user *p;
674 struct shmid64_ds s64; 674 struct shmid64_ds s64;
@@ -749,8 +749,9 @@ long compat_sys_shmctl(int first, int second, void __user *uptr)
749 return err; 749 return err;
750} 750}
751 751
752long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, 752COMPAT_SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsems,
753 unsigned nsops, const struct compat_timespec __user *timeout) 753 unsigned, nsops,
754 const struct compat_timespec __user *, timeout)
754{ 755{
755 struct timespec __user *ts64 = NULL; 756 struct timespec __user *ts64 = NULL;
756 if (timeout) { 757 if (timeout) {
diff --git a/ipc/compat_mq.c b/ipc/compat_mq.c
index 63d7c6de335b..d58747293772 100644
--- a/ipc/compat_mq.c
+++ b/ipc/compat_mq.c
@@ -46,9 +46,9 @@ static inline int put_compat_mq_attr(const struct mq_attr *attr,
46 | __put_user(attr->mq_curmsgs, &uattr->mq_curmsgs); 46 | __put_user(attr->mq_curmsgs, &uattr->mq_curmsgs);
47} 47}
48 48
49asmlinkage long compat_sys_mq_open(const char __user *u_name, 49COMPAT_SYSCALL_DEFINE4(mq_open, const char __user *, u_name,
50 int oflag, compat_mode_t mode, 50 int, oflag, compat_mode_t, mode,
51 struct compat_mq_attr __user *u_attr) 51 struct compat_mq_attr __user *, u_attr)
52{ 52{
53 void __user *p = NULL; 53 void __user *p = NULL;
54 if (u_attr && oflag & O_CREAT) { 54 if (u_attr && oflag & O_CREAT) {
@@ -78,10 +78,10 @@ static int compat_prepare_timeout(struct timespec __user **p,
78 return 0; 78 return 0;
79} 79}
80 80
81asmlinkage long compat_sys_mq_timedsend(mqd_t mqdes, 81COMPAT_SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes,
82 const char __user *u_msg_ptr, 82 const char __user *, u_msg_ptr,
83 size_t msg_len, unsigned int msg_prio, 83 compat_size_t, msg_len, unsigned int, msg_prio,
84 const struct compat_timespec __user *u_abs_timeout) 84 const struct compat_timespec __user *, u_abs_timeout)
85{ 85{
86 struct timespec __user *u_ts; 86 struct timespec __user *u_ts;
87 87
@@ -92,10 +92,10 @@ asmlinkage long compat_sys_mq_timedsend(mqd_t mqdes,
92 msg_prio, u_ts); 92 msg_prio, u_ts);
93} 93}
94 94
95asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes, 95COMPAT_SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes,
96 char __user *u_msg_ptr, 96 char __user *, u_msg_ptr,
97 size_t msg_len, unsigned int __user *u_msg_prio, 97 compat_size_t, msg_len, unsigned int __user *, u_msg_prio,
98 const struct compat_timespec __user *u_abs_timeout) 98 const struct compat_timespec __user *, u_abs_timeout)
99{ 99{
100 struct timespec __user *u_ts; 100 struct timespec __user *u_ts;
101 if (compat_prepare_timeout(&u_ts, u_abs_timeout)) 101 if (compat_prepare_timeout(&u_ts, u_abs_timeout))
@@ -105,8 +105,8 @@ asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes,
105 u_msg_prio, u_ts); 105 u_msg_prio, u_ts);
106} 106}
107 107
108asmlinkage long compat_sys_mq_notify(mqd_t mqdes, 108COMPAT_SYSCALL_DEFINE2(mq_notify, mqd_t, mqdes,
109 const struct compat_sigevent __user *u_notification) 109 const struct compat_sigevent __user *, u_notification)
110{ 110{
111 struct sigevent __user *p = NULL; 111 struct sigevent __user *p = NULL;
112 if (u_notification) { 112 if (u_notification) {
@@ -122,9 +122,9 @@ asmlinkage long compat_sys_mq_notify(mqd_t mqdes,
122 return sys_mq_notify(mqdes, p); 122 return sys_mq_notify(mqdes, p);
123} 123}
124 124
125asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes, 125COMPAT_SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes,
126 const struct compat_mq_attr __user *u_mqstat, 126 const struct compat_mq_attr __user *, u_mqstat,
127 struct compat_mq_attr __user *u_omqstat) 127 struct compat_mq_attr __user *, u_omqstat)
128{ 128{
129 struct mq_attr mqstat; 129 struct mq_attr mqstat;
130 struct mq_attr __user *p = compat_alloc_user_space(2 * sizeof(*p)); 130 struct mq_attr __user *p = compat_alloc_user_space(2 * sizeof(*p));
diff --git a/kernel/compat.c b/kernel/compat.c
index 0a09e481b70b..488ff8c4cf48 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -110,8 +110,8 @@ static int compat_put_timex(struct compat_timex __user *utp, struct timex *txc)
110 return 0; 110 return 0;
111} 111}
112 112
113asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv, 113COMPAT_SYSCALL_DEFINE2(gettimeofday, struct compat_timeval __user *, tv,
114 struct timezone __user *tz) 114 struct timezone __user *, tz)
115{ 115{
116 if (tv) { 116 if (tv) {
117 struct timeval ktv; 117 struct timeval ktv;
@@ -127,8 +127,8 @@ asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv,
127 return 0; 127 return 0;
128} 128}
129 129
130asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv, 130COMPAT_SYSCALL_DEFINE2(settimeofday, struct compat_timeval __user *, tv,
131 struct timezone __user *tz) 131 struct timezone __user *, tz)
132{ 132{
133 struct timespec kts; 133 struct timespec kts;
134 struct timezone ktz; 134 struct timezone ktz;
@@ -236,8 +236,8 @@ static long compat_nanosleep_restart(struct restart_block *restart)
236 return ret; 236 return ret;
237} 237}
238 238
239asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp, 239COMPAT_SYSCALL_DEFINE2(nanosleep, struct compat_timespec __user *, rqtp,
240 struct compat_timespec __user *rmtp) 240 struct compat_timespec __user *, rmtp)
241{ 241{
242 struct timespec tu, rmt; 242 struct timespec tu, rmt;
243 mm_segment_t oldfs; 243 mm_segment_t oldfs;
@@ -328,7 +328,7 @@ static compat_clock_t clock_t_to_compat_clock_t(clock_t x)
328 return compat_jiffies_to_clock_t(clock_t_to_jiffies(x)); 328 return compat_jiffies_to_clock_t(clock_t_to_jiffies(x));
329} 329}
330 330
331asmlinkage long compat_sys_times(struct compat_tms __user *tbuf) 331COMPAT_SYSCALL_DEFINE1(times, struct compat_tms __user *, tbuf)
332{ 332{
333 if (tbuf) { 333 if (tbuf) {
334 struct tms tms; 334 struct tms tms;
@@ -354,7 +354,7 @@ asmlinkage long compat_sys_times(struct compat_tms __user *tbuf)
354 * types that can be passed to put_user()/get_user(). 354 * types that can be passed to put_user()/get_user().
355 */ 355 */
356 356
357asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set) 357COMPAT_SYSCALL_DEFINE1(sigpending, compat_old_sigset_t __user *, set)
358{ 358{
359 old_sigset_t s; 359 old_sigset_t s;
360 long ret; 360 long ret;
@@ -424,8 +424,8 @@ COMPAT_SYSCALL_DEFINE3(sigprocmask, int, how,
424 424
425#endif 425#endif
426 426
427asmlinkage long compat_sys_setrlimit(unsigned int resource, 427COMPAT_SYSCALL_DEFINE2(setrlimit, unsigned int, resource,
428 struct compat_rlimit __user *rlim) 428 struct compat_rlimit __user *, rlim)
429{ 429{
430 struct rlimit r; 430 struct rlimit r;
431 431
@@ -443,8 +443,8 @@ asmlinkage long compat_sys_setrlimit(unsigned int resource,
443 443
444#ifdef COMPAT_RLIM_OLD_INFINITY 444#ifdef COMPAT_RLIM_OLD_INFINITY
445 445
446asmlinkage long compat_sys_old_getrlimit(unsigned int resource, 446COMPAT_SYSCALL_DEFINE2(old_getrlimit, unsigned int, resource,
447 struct compat_rlimit __user *rlim) 447 struct compat_rlimit __user *, rlim)
448{ 448{
449 struct rlimit r; 449 struct rlimit r;
450 int ret; 450 int ret;
@@ -470,8 +470,8 @@ asmlinkage long compat_sys_old_getrlimit(unsigned int resource,
470 470
471#endif 471#endif
472 472
473asmlinkage long compat_sys_getrlimit(unsigned int resource, 473COMPAT_SYSCALL_DEFINE2(getrlimit, unsigned int, resource,
474 struct compat_rlimit __user *rlim) 474 struct compat_rlimit __user *, rlim)
475{ 475{
476 struct rlimit r; 476 struct rlimit r;
477 int ret; 477 int ret;
@@ -596,9 +596,9 @@ static int compat_get_user_cpu_mask(compat_ulong_t __user *user_mask_ptr,
596 return compat_get_bitmap(k, user_mask_ptr, len * 8); 596 return compat_get_bitmap(k, user_mask_ptr, len * 8);
597} 597}
598 598
599asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, 599COMPAT_SYSCALL_DEFINE3(sched_setaffinity, compat_pid_t, pid,
600 unsigned int len, 600 unsigned int, len,
601 compat_ulong_t __user *user_mask_ptr) 601 compat_ulong_t __user *, user_mask_ptr)
602{ 602{
603 cpumask_var_t new_mask; 603 cpumask_var_t new_mask;
604 int retval; 604 int retval;
@@ -616,8 +616,8 @@ out:
616 return retval; 616 return retval;
617} 617}
618 618
619asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, 619COMPAT_SYSCALL_DEFINE3(sched_getaffinity, compat_pid_t, pid, unsigned int, len,
620 compat_ulong_t __user *user_mask_ptr) 620 compat_ulong_t __user *, user_mask_ptr)
621{ 621{
622 int ret; 622 int ret;
623 cpumask_var_t mask; 623 cpumask_var_t mask;
@@ -662,9 +662,9 @@ int put_compat_itimerspec(struct compat_itimerspec __user *dst,
662 return 0; 662 return 0;
663} 663}
664 664
665long compat_sys_timer_create(clockid_t which_clock, 665COMPAT_SYSCALL_DEFINE3(timer_create, clockid_t, which_clock,
666 struct compat_sigevent __user *timer_event_spec, 666 struct compat_sigevent __user *, timer_event_spec,
667 timer_t __user *created_timer_id) 667 timer_t __user *, created_timer_id)
668{ 668{
669 struct sigevent __user *event = NULL; 669 struct sigevent __user *event = NULL;
670 670
@@ -680,9 +680,9 @@ long compat_sys_timer_create(clockid_t which_clock,
680 return sys_timer_create(which_clock, event, created_timer_id); 680 return sys_timer_create(which_clock, event, created_timer_id);
681} 681}
682 682
683long compat_sys_timer_settime(timer_t timer_id, int flags, 683COMPAT_SYSCALL_DEFINE4(timer_settime, timer_t, timer_id, int, flags,
684 struct compat_itimerspec __user *new, 684 struct compat_itimerspec __user *, new,
685 struct compat_itimerspec __user *old) 685 struct compat_itimerspec __user *, old)
686{ 686{
687 long err; 687 long err;
688 mm_segment_t oldfs; 688 mm_segment_t oldfs;
@@ -703,8 +703,8 @@ long compat_sys_timer_settime(timer_t timer_id, int flags,
703 return err; 703 return err;
704} 704}
705 705
706long compat_sys_timer_gettime(timer_t timer_id, 706COMPAT_SYSCALL_DEFINE2(timer_gettime, timer_t, timer_id,
707 struct compat_itimerspec __user *setting) 707 struct compat_itimerspec __user *, setting)
708{ 708{
709 long err; 709 long err;
710 mm_segment_t oldfs; 710 mm_segment_t oldfs;
@@ -720,8 +720,8 @@ long compat_sys_timer_gettime(timer_t timer_id,
720 return err; 720 return err;
721} 721}
722 722
723long compat_sys_clock_settime(clockid_t which_clock, 723COMPAT_SYSCALL_DEFINE2(clock_settime, clockid_t, which_clock,
724 struct compat_timespec __user *tp) 724 struct compat_timespec __user *, tp)
725{ 725{
726 long err; 726 long err;
727 mm_segment_t oldfs; 727 mm_segment_t oldfs;
@@ -737,8 +737,8 @@ long compat_sys_clock_settime(clockid_t which_clock,
737 return err; 737 return err;
738} 738}
739 739
740long compat_sys_clock_gettime(clockid_t which_clock, 740COMPAT_SYSCALL_DEFINE2(clock_gettime, clockid_t, which_clock,
741 struct compat_timespec __user *tp) 741 struct compat_timespec __user *, tp)
742{ 742{
743 long err; 743 long err;
744 mm_segment_t oldfs; 744 mm_segment_t oldfs;
@@ -754,8 +754,8 @@ long compat_sys_clock_gettime(clockid_t which_clock,
754 return err; 754 return err;
755} 755}
756 756
757long compat_sys_clock_adjtime(clockid_t which_clock, 757COMPAT_SYSCALL_DEFINE2(clock_adjtime, clockid_t, which_clock,
758 struct compat_timex __user *utp) 758 struct compat_timex __user *, utp)
759{ 759{
760 struct timex txc; 760 struct timex txc;
761 mm_segment_t oldfs; 761 mm_segment_t oldfs;
@@ -777,8 +777,8 @@ long compat_sys_clock_adjtime(clockid_t which_clock,
777 return ret; 777 return ret;
778} 778}
779 779
780long compat_sys_clock_getres(clockid_t which_clock, 780COMPAT_SYSCALL_DEFINE2(clock_getres, clockid_t, which_clock,
781 struct compat_timespec __user *tp) 781 struct compat_timespec __user *, tp)
782{ 782{
783 long err; 783 long err;
784 mm_segment_t oldfs; 784 mm_segment_t oldfs;
@@ -818,9 +818,9 @@ static long compat_clock_nanosleep_restart(struct restart_block *restart)
818 return err; 818 return err;
819} 819}
820 820
821long compat_sys_clock_nanosleep(clockid_t which_clock, int flags, 821COMPAT_SYSCALL_DEFINE4(clock_nanosleep, clockid_t, which_clock, int, flags,
822 struct compat_timespec __user *rqtp, 822 struct compat_timespec __user *, rqtp,
823 struct compat_timespec __user *rmtp) 823 struct compat_timespec __user *, rmtp)
824{ 824{
825 long err; 825 long err;
826 mm_segment_t oldfs; 826 mm_segment_t oldfs;
@@ -1010,7 +1010,7 @@ COMPAT_SYSCALL_DEFINE4(rt_sigtimedwait, compat_sigset_t __user *, uthese,
1010 1010
1011/* compat_time_t is a 32 bit "long" and needs to get converted. */ 1011/* compat_time_t is a 32 bit "long" and needs to get converted. */
1012 1012
1013asmlinkage long compat_sys_time(compat_time_t __user * tloc) 1013COMPAT_SYSCALL_DEFINE1(time, compat_time_t __user *, tloc)
1014{ 1014{
1015 compat_time_t i; 1015 compat_time_t i;
1016 struct timeval tv; 1016 struct timeval tv;
@@ -1026,7 +1026,7 @@ asmlinkage long compat_sys_time(compat_time_t __user * tloc)
1026 return i; 1026 return i;
1027} 1027}
1028 1028
1029asmlinkage long compat_sys_stime(compat_time_t __user *tptr) 1029COMPAT_SYSCALL_DEFINE1(stime, compat_time_t __user *, tptr)
1030{ 1030{
1031 struct timespec tv; 1031 struct timespec tv;
1032 int err; 1032 int err;
@@ -1046,7 +1046,7 @@ asmlinkage long compat_sys_stime(compat_time_t __user *tptr)
1046 1046
1047#endif /* __ARCH_WANT_COMPAT_SYS_TIME */ 1047#endif /* __ARCH_WANT_COMPAT_SYS_TIME */
1048 1048
1049asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp) 1049COMPAT_SYSCALL_DEFINE1(adjtimex, struct compat_timex __user *, utp)
1050{ 1050{
1051 struct timex txc; 1051 struct timex txc;
1052 int err, ret; 1052 int err, ret;
@@ -1065,11 +1065,11 @@ asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp)
1065} 1065}
1066 1066
1067#ifdef CONFIG_NUMA 1067#ifdef CONFIG_NUMA
1068asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_pages, 1068COMPAT_SYSCALL_DEFINE6(move_pages, pid_t, pid, compat_ulong_t, nr_pages,
1069 compat_uptr_t __user *pages32, 1069 compat_uptr_t __user *, pages32,
1070 const int __user *nodes, 1070 const int __user *, nodes,
1071 int __user *status, 1071 int __user *, status,
1072 int flags) 1072 int, flags)
1073{ 1073{
1074 const void __user * __user *pages; 1074 const void __user * __user *pages;
1075 int i; 1075 int i;
@@ -1085,10 +1085,10 @@ asmlinkage long compat_sys_move_pages(pid_t pid, unsigned long nr_pages,
1085 return sys_move_pages(pid, nr_pages, pages, nodes, status, flags); 1085 return sys_move_pages(pid, nr_pages, pages, nodes, status, flags);
1086} 1086}
1087 1087
1088asmlinkage long compat_sys_migrate_pages(compat_pid_t pid, 1088COMPAT_SYSCALL_DEFINE4(migrate_pages, compat_pid_t, pid,
1089 compat_ulong_t maxnode, 1089 compat_ulong_t, maxnode,
1090 const compat_ulong_t __user *old_nodes, 1090 const compat_ulong_t __user *, old_nodes,
1091 const compat_ulong_t __user *new_nodes) 1091 const compat_ulong_t __user *, new_nodes)
1092{ 1092{
1093 unsigned long __user *old = NULL; 1093 unsigned long __user *old = NULL;
1094 unsigned long __user *new = NULL; 1094 unsigned long __user *new = NULL;
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c
index 334b3980ffc1..99982a70ddad 100644
--- a/kernel/debug/debug_core.c
+++ b/kernel/debug/debug_core.c
@@ -1035,7 +1035,7 @@ int dbg_io_get_char(void)
1035 * otherwise as a quick means to stop program execution and "break" into 1035 * otherwise as a quick means to stop program execution and "break" into
1036 * the debugger. 1036 * the debugger.
1037 */ 1037 */
1038void kgdb_breakpoint(void) 1038noinline void kgdb_breakpoint(void)
1039{ 1039{
1040 atomic_inc(&kgdb_setting_breakpoint); 1040 atomic_inc(&kgdb_setting_breakpoint);
1041 wmb(); /* Sync point before breakpoint */ 1041 wmb(); /* Sync point before breakpoint */
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 09094361dce5..d55092ceee29 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -168,19 +168,6 @@ struct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer,
168 } 168 }
169} 169}
170 170
171
172/*
173 * Get the preferred target CPU for NOHZ
174 */
175static int hrtimer_get_target(int this_cpu, int pinned)
176{
177#ifdef CONFIG_NO_HZ_COMMON
178 if (!pinned && get_sysctl_timer_migration() && idle_cpu(this_cpu))
179 return get_nohz_timer_target();
180#endif
181 return this_cpu;
182}
183
184/* 171/*
185 * With HIGHRES=y we do not migrate the timer when it is expiring 172 * With HIGHRES=y we do not migrate the timer when it is expiring
186 * before the next event on the target cpu because we cannot reprogram 173 * before the next event on the target cpu because we cannot reprogram
@@ -214,7 +201,7 @@ switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base,
214 struct hrtimer_clock_base *new_base; 201 struct hrtimer_clock_base *new_base;
215 struct hrtimer_cpu_base *new_cpu_base; 202 struct hrtimer_cpu_base *new_cpu_base;
216 int this_cpu = smp_processor_id(); 203 int this_cpu = smp_processor_id();
217 int cpu = hrtimer_get_target(this_cpu, pinned); 204 int cpu = get_nohz_timer_target(pinned);
218 int basenum = base->index; 205 int basenum = base->index;
219 206
220again: 207again:
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index dc04c166c54d..6397df2d6945 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -281,6 +281,19 @@ void unmask_irq(struct irq_desc *desc)
281 } 281 }
282} 282}
283 283
284void unmask_threaded_irq(struct irq_desc *desc)
285{
286 struct irq_chip *chip = desc->irq_data.chip;
287
288 if (chip->flags & IRQCHIP_EOI_THREADED)
289 chip->irq_eoi(&desc->irq_data);
290
291 if (chip->irq_unmask) {
292 chip->irq_unmask(&desc->irq_data);
293 irq_state_clr_masked(desc);
294 }
295}
296
284/* 297/*
285 * handle_nested_irq - Handle a nested irq from a irq thread 298 * handle_nested_irq - Handle a nested irq from a irq thread
286 * @irq: the interrupt number 299 * @irq: the interrupt number
@@ -435,6 +448,27 @@ static inline void preflow_handler(struct irq_desc *desc)
435static inline void preflow_handler(struct irq_desc *desc) { } 448static inline void preflow_handler(struct irq_desc *desc) { }
436#endif 449#endif
437 450
451static void cond_unmask_eoi_irq(struct irq_desc *desc, struct irq_chip *chip)
452{
453 if (!(desc->istate & IRQS_ONESHOT)) {
454 chip->irq_eoi(&desc->irq_data);
455 return;
456 }
457 /*
458 * We need to unmask in the following cases:
459 * - Oneshot irq which did not wake the thread (caused by a
460 * spurious interrupt or a primary handler handling it
461 * completely).
462 */
463 if (!irqd_irq_disabled(&desc->irq_data) &&
464 irqd_irq_masked(&desc->irq_data) && !desc->threads_oneshot) {
465 chip->irq_eoi(&desc->irq_data);
466 unmask_irq(desc);
467 } else if (!(chip->flags & IRQCHIP_EOI_THREADED)) {
468 chip->irq_eoi(&desc->irq_data);
469 }
470}
471
438/** 472/**
439 * handle_fasteoi_irq - irq handler for transparent controllers 473 * handle_fasteoi_irq - irq handler for transparent controllers
440 * @irq: the interrupt number 474 * @irq: the interrupt number
@@ -448,6 +482,8 @@ static inline void preflow_handler(struct irq_desc *desc) { }
448void 482void
449handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc) 483handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
450{ 484{
485 struct irq_chip *chip = desc->irq_data.chip;
486
451 raw_spin_lock(&desc->lock); 487 raw_spin_lock(&desc->lock);
452 488
453 if (unlikely(irqd_irq_inprogress(&desc->irq_data))) 489 if (unlikely(irqd_irq_inprogress(&desc->irq_data)))
@@ -473,18 +509,14 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
473 preflow_handler(desc); 509 preflow_handler(desc);
474 handle_irq_event(desc); 510 handle_irq_event(desc);
475 511
476 if (desc->istate & IRQS_ONESHOT) 512 cond_unmask_eoi_irq(desc, chip);
477 cond_unmask_irq(desc);
478 513
479out_eoi:
480 desc->irq_data.chip->irq_eoi(&desc->irq_data);
481out_unlock:
482 raw_spin_unlock(&desc->lock); 514 raw_spin_unlock(&desc->lock);
483 return; 515 return;
484out: 516out:
485 if (!(desc->irq_data.chip->flags & IRQCHIP_EOI_IF_HANDLED)) 517 if (!(chip->flags & IRQCHIP_EOI_IF_HANDLED))
486 goto out_eoi; 518 chip->irq_eoi(&desc->irq_data);
487 goto out_unlock; 519 raw_spin_unlock(&desc->lock);
488} 520}
489 521
490/** 522/**
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 131ca176b497..635480270858 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -41,6 +41,7 @@ irqreturn_t no_action(int cpl, void *dev_id)
41{ 41{
42 return IRQ_NONE; 42 return IRQ_NONE;
43} 43}
44EXPORT_SYMBOL_GPL(no_action);
44 45
45static void warn_no_thread(unsigned int irq, struct irqaction *action) 46static void warn_no_thread(unsigned int irq, struct irqaction *action)
46{ 47{
@@ -51,7 +52,7 @@ static void warn_no_thread(unsigned int irq, struct irqaction *action)
51 "but no thread function available.", irq, action->name); 52 "but no thread function available.", irq, action->name);
52} 53}
53 54
54static void irq_wake_thread(struct irq_desc *desc, struct irqaction *action) 55void __irq_wake_thread(struct irq_desc *desc, struct irqaction *action)
55{ 56{
56 /* 57 /*
57 * In case the thread crashed and was killed we just pretend that 58 * In case the thread crashed and was killed we just pretend that
@@ -157,7 +158,7 @@ handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action)
157 break; 158 break;
158 } 159 }
159 160
160 irq_wake_thread(desc, action); 161 __irq_wake_thread(desc, action);
161 162
162 /* Fall through to add to randomness */ 163 /* Fall through to add to randomness */
163 case IRQ_HANDLED: 164 case IRQ_HANDLED:
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index 001fa5bab490..ddf1ffeb79f1 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -6,6 +6,7 @@
6 * of this file for your non core code. 6 * of this file for your non core code.
7 */ 7 */
8#include <linux/irqdesc.h> 8#include <linux/irqdesc.h>
9#include <linux/kernel_stat.h>
9 10
10#ifdef CONFIG_SPARSE_IRQ 11#ifdef CONFIG_SPARSE_IRQ
11# define IRQ_BITMAP_BITS (NR_IRQS + 8196) 12# define IRQ_BITMAP_BITS (NR_IRQS + 8196)
@@ -73,6 +74,7 @@ extern void irq_percpu_enable(struct irq_desc *desc, unsigned int cpu);
73extern void irq_percpu_disable(struct irq_desc *desc, unsigned int cpu); 74extern void irq_percpu_disable(struct irq_desc *desc, unsigned int cpu);
74extern void mask_irq(struct irq_desc *desc); 75extern void mask_irq(struct irq_desc *desc);
75extern void unmask_irq(struct irq_desc *desc); 76extern void unmask_irq(struct irq_desc *desc);
77extern void unmask_threaded_irq(struct irq_desc *desc);
76 78
77extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr); 79extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr);
78 80
@@ -82,6 +84,7 @@ irqreturn_t handle_irq_event(struct irq_desc *desc);
82/* Resending of interrupts :*/ 84/* Resending of interrupts :*/
83void check_irq_resend(struct irq_desc *desc, unsigned int irq); 85void check_irq_resend(struct irq_desc *desc, unsigned int irq);
84bool irq_wait_for_poll(struct irq_desc *desc); 86bool irq_wait_for_poll(struct irq_desc *desc);
87void __irq_wake_thread(struct irq_desc *desc, struct irqaction *action);
85 88
86#ifdef CONFIG_PROC_FS 89#ifdef CONFIG_PROC_FS
87extern void register_irq_proc(unsigned int irq, struct irq_desc *desc); 90extern void register_irq_proc(unsigned int irq, struct irq_desc *desc);
@@ -179,3 +182,9 @@ static inline bool irqd_has_set(struct irq_data *d, unsigned int mask)
179{ 182{
180 return d->state_use_accessors & mask; 183 return d->state_use_accessors & mask;
181} 184}
185
186static inline void kstat_incr_irqs_this_cpu(unsigned int irq, struct irq_desc *desc)
187{
188 __this_cpu_inc(*desc->kstat_irqs);
189 __this_cpu_inc(kstat.irqs_sum);
190}
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 8ab8e9390297..a7174617616b 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -489,6 +489,11 @@ void dynamic_irq_cleanup(unsigned int irq)
489 raw_spin_unlock_irqrestore(&desc->lock, flags); 489 raw_spin_unlock_irqrestore(&desc->lock, flags);
490} 490}
491 491
492void kstat_incr_irq_this_cpu(unsigned int irq)
493{
494 kstat_incr_irqs_this_cpu(irq, irq_to_desc(irq));
495}
496
492unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) 497unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)
493{ 498{
494 struct irq_desc *desc = irq_to_desc(irq); 499 struct irq_desc *desc = irq_to_desc(irq);
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index d3bf660cb57f..2486a4c1a710 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -32,24 +32,10 @@ static int __init setup_forced_irqthreads(char *arg)
32early_param("threadirqs", setup_forced_irqthreads); 32early_param("threadirqs", setup_forced_irqthreads);
33#endif 33#endif
34 34
35/** 35static void __synchronize_hardirq(struct irq_desc *desc)
36 * synchronize_irq - wait for pending IRQ handlers (on other CPUs)
37 * @irq: interrupt number to wait for
38 *
39 * This function waits for any pending IRQ handlers for this interrupt
40 * to complete before returning. If you use this function while
41 * holding a resource the IRQ handler may need you will deadlock.
42 *
43 * This function may be called - with care - from IRQ context.
44 */
45void synchronize_irq(unsigned int irq)
46{ 36{
47 struct irq_desc *desc = irq_to_desc(irq);
48 bool inprogress; 37 bool inprogress;
49 38
50 if (!desc)
51 return;
52
53 do { 39 do {
54 unsigned long flags; 40 unsigned long flags;
55 41
@@ -67,12 +53,56 @@ void synchronize_irq(unsigned int irq)
67 53
68 /* Oops, that failed? */ 54 /* Oops, that failed? */
69 } while (inprogress); 55 } while (inprogress);
56}
70 57
71 /* 58/**
72 * We made sure that no hardirq handler is running. Now verify 59 * synchronize_hardirq - wait for pending hard IRQ handlers (on other CPUs)
73 * that no threaded handlers are active. 60 * @irq: interrupt number to wait for
74 */ 61 *
75 wait_event(desc->wait_for_threads, !atomic_read(&desc->threads_active)); 62 * This function waits for any pending hard IRQ handlers for this
63 * interrupt to complete before returning. If you use this
64 * function while holding a resource the IRQ handler may need you
65 * will deadlock. It does not take associated threaded handlers
66 * into account.
67 *
68 * Do not use this for shutdown scenarios where you must be sure
69 * that all parts (hardirq and threaded handler) have completed.
70 *
71 * This function may be called - with care - from IRQ context.
72 */
73void synchronize_hardirq(unsigned int irq)
74{
75 struct irq_desc *desc = irq_to_desc(irq);
76
77 if (desc)
78 __synchronize_hardirq(desc);
79}
80EXPORT_SYMBOL(synchronize_hardirq);
81
82/**
83 * synchronize_irq - wait for pending IRQ handlers (on other CPUs)
84 * @irq: interrupt number to wait for
85 *
86 * This function waits for any pending IRQ handlers for this interrupt
87 * to complete before returning. If you use this function while
88 * holding a resource the IRQ handler may need you will deadlock.
89 *
90 * This function may be called - with care - from IRQ context.
91 */
92void synchronize_irq(unsigned int irq)
93{
94 struct irq_desc *desc = irq_to_desc(irq);
95
96 if (desc) {
97 __synchronize_hardirq(desc);
98 /*
99 * We made sure that no hardirq handler is
100 * running. Now verify that no threaded handlers are
101 * active.
102 */
103 wait_event(desc->wait_for_threads,
104 !atomic_read(&desc->threads_active));
105 }
76} 106}
77EXPORT_SYMBOL(synchronize_irq); 107EXPORT_SYMBOL(synchronize_irq);
78 108
@@ -718,7 +748,7 @@ again:
718 748
719 if (!desc->threads_oneshot && !irqd_irq_disabled(&desc->irq_data) && 749 if (!desc->threads_oneshot && !irqd_irq_disabled(&desc->irq_data) &&
720 irqd_irq_masked(&desc->irq_data)) 750 irqd_irq_masked(&desc->irq_data))
721 unmask_irq(desc); 751 unmask_threaded_irq(desc);
722 752
723out_unlock: 753out_unlock:
724 raw_spin_unlock_irq(&desc->lock); 754 raw_spin_unlock_irq(&desc->lock);
@@ -727,7 +757,7 @@ out_unlock:
727 757
728#ifdef CONFIG_SMP 758#ifdef CONFIG_SMP
729/* 759/*
730 * Check whether we need to chasnge the affinity of the interrupt thread. 760 * Check whether we need to change the affinity of the interrupt thread.
731 */ 761 */
732static void 762static void
733irq_thread_check_affinity(struct irq_desc *desc, struct irqaction *action) 763irq_thread_check_affinity(struct irq_desc *desc, struct irqaction *action)
@@ -880,6 +910,33 @@ static int irq_thread(void *data)
880 return 0; 910 return 0;
881} 911}
882 912
913/**
914 * irq_wake_thread - wake the irq thread for the action identified by dev_id
915 * @irq: Interrupt line
916 * @dev_id: Device identity for which the thread should be woken
917 *
918 */
919void irq_wake_thread(unsigned int irq, void *dev_id)
920{
921 struct irq_desc *desc = irq_to_desc(irq);
922 struct irqaction *action;
923 unsigned long flags;
924
925 if (!desc || WARN_ON(irq_settings_is_per_cpu_devid(desc)))
926 return;
927
928 raw_spin_lock_irqsave(&desc->lock, flags);
929 for (action = desc->action; action; action = action->next) {
930 if (action->dev_id == dev_id) {
931 if (action->thread)
932 __irq_wake_thread(desc, action);
933 break;
934 }
935 }
936 raw_spin_unlock_irqrestore(&desc->lock, flags);
937}
938EXPORT_SYMBOL_GPL(irq_wake_thread);
939
883static void irq_setup_forced_threading(struct irqaction *new) 940static void irq_setup_forced_threading(struct irqaction *new)
884{ 941{
885 if (!force_irqthreads) 942 if (!force_irqthreads)
@@ -896,6 +953,23 @@ static void irq_setup_forced_threading(struct irqaction *new)
896 } 953 }
897} 954}
898 955
956static int irq_request_resources(struct irq_desc *desc)
957{
958 struct irq_data *d = &desc->irq_data;
959 struct irq_chip *c = d->chip;
960
961 return c->irq_request_resources ? c->irq_request_resources(d) : 0;
962}
963
964static void irq_release_resources(struct irq_desc *desc)
965{
966 struct irq_data *d = &desc->irq_data;
967 struct irq_chip *c = d->chip;
968
969 if (c->irq_release_resources)
970 c->irq_release_resources(d);
971}
972
899/* 973/*
900 * Internal function to register an irqaction - typically used to 974 * Internal function to register an irqaction - typically used to
901 * allocate special interrupts that are part of the architecture. 975 * allocate special interrupts that are part of the architecture.
@@ -1091,6 +1165,13 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
1091 } 1165 }
1092 1166
1093 if (!shared) { 1167 if (!shared) {
1168 ret = irq_request_resources(desc);
1169 if (ret) {
1170 pr_err("Failed to request resources for %s (irq %d) on irqchip %s\n",
1171 new->name, irq, desc->irq_data.chip->name);
1172 goto out_mask;
1173 }
1174
1094 init_waitqueue_head(&desc->wait_for_threads); 1175 init_waitqueue_head(&desc->wait_for_threads);
1095 1176
1096 /* Setup the type (level, edge polarity) if configured: */ 1177 /* Setup the type (level, edge polarity) if configured: */
@@ -1261,8 +1342,10 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id)
1261 *action_ptr = action->next; 1342 *action_ptr = action->next;
1262 1343
1263 /* If this was the last handler, shut down the IRQ line: */ 1344 /* If this was the last handler, shut down the IRQ line: */
1264 if (!desc->action) 1345 if (!desc->action) {
1265 irq_shutdown(desc); 1346 irq_shutdown(desc);
1347 irq_release_resources(desc);
1348 }
1266 1349
1267#ifdef CONFIG_SMP 1350#ifdef CONFIG_SMP
1268 /* make sure affinity_hint is cleaned up */ 1351 /* make sure affinity_hint is cleaned up */
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 36f6ee181b0c..ac1ba2f11032 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -324,15 +324,15 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc)
324 324
325#ifdef CONFIG_SMP 325#ifdef CONFIG_SMP
326 /* create /proc/irq/<irq>/smp_affinity */ 326 /* create /proc/irq/<irq>/smp_affinity */
327 proc_create_data("smp_affinity", 0600, desc->dir, 327 proc_create_data("smp_affinity", 0644, desc->dir,
328 &irq_affinity_proc_fops, (void *)(long)irq); 328 &irq_affinity_proc_fops, (void *)(long)irq);
329 329
330 /* create /proc/irq/<irq>/affinity_hint */ 330 /* create /proc/irq/<irq>/affinity_hint */
331 proc_create_data("affinity_hint", 0400, desc->dir, 331 proc_create_data("affinity_hint", 0444, desc->dir,
332 &irq_affinity_hint_proc_fops, (void *)(long)irq); 332 &irq_affinity_hint_proc_fops, (void *)(long)irq);
333 333
334 /* create /proc/irq/<irq>/smp_affinity_list */ 334 /* create /proc/irq/<irq>/smp_affinity_list */
335 proc_create_data("smp_affinity_list", 0600, desc->dir, 335 proc_create_data("smp_affinity_list", 0644, desc->dir,
336 &irq_affinity_list_proc_fops, (void *)(long)irq); 336 &irq_affinity_list_proc_fops, (void *)(long)irq);
337 337
338 proc_create_data("node", 0444, desc->dir, 338 proc_create_data("node", 0444, desc->dir,
@@ -372,7 +372,7 @@ void unregister_handler_proc(unsigned int irq, struct irqaction *action)
372static void register_default_affinity_proc(void) 372static void register_default_affinity_proc(void)
373{ 373{
374#ifdef CONFIG_SMP 374#ifdef CONFIG_SMP
375 proc_create("irq/default_smp_affinity", 0600, NULL, 375 proc_create("irq/default_smp_affinity", 0644, NULL,
376 &default_affinity_proc_fops); 376 &default_affinity_proc_fops);
377#endif 377#endif
378} 378}
diff --git a/kernel/kexec.c b/kernel/kexec.c
index 60bafbed06ab..45601cf41bee 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -1039,10 +1039,10 @@ void __weak crash_unmap_reserved_pages(void)
1039{} 1039{}
1040 1040
1041#ifdef CONFIG_COMPAT 1041#ifdef CONFIG_COMPAT
1042asmlinkage long compat_sys_kexec_load(unsigned long entry, 1042COMPAT_SYSCALL_DEFINE4(kexec_load, compat_ulong_t, entry,
1043 unsigned long nr_segments, 1043 compat_ulong_t, nr_segments,
1044 struct compat_kexec_segment __user *segments, 1044 struct compat_kexec_segment __user *, segments,
1045 unsigned long flags) 1045 compat_ulong_t, flags)
1046{ 1046{
1047 struct compat_kexec_segment in; 1047 struct compat_kexec_segment in;
1048 struct kexec_segment out, __user *ksegments; 1048 struct kexec_segment out, __user *ksegments;
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 1f4bcb3cc21c..adf98622cb32 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -1180,8 +1180,8 @@ int compat_ptrace_request(struct task_struct *child, compat_long_t request,
1180 return ret; 1180 return ret;
1181} 1181}
1182 1182
1183asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, 1183COMPAT_SYSCALL_DEFINE4(ptrace, compat_long_t, request, compat_long_t, pid,
1184 compat_long_t addr, compat_long_t data) 1184 compat_long_t, addr, compat_long_t, data)
1185{ 1185{
1186 struct task_struct *child; 1186 struct task_struct *child;
1187 long ret; 1187 long ret;
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index ae365aaa8181..3c4d096544ce 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -555,12 +555,15 @@ void resched_cpu(int cpu)
555 * selecting an idle cpu will add more delays to the timers than intended 555 * selecting an idle cpu will add more delays to the timers than intended
556 * (as that cpu's timer base may not be uptodate wrt jiffies etc). 556 * (as that cpu's timer base may not be uptodate wrt jiffies etc).
557 */ 557 */
558int get_nohz_timer_target(void) 558int get_nohz_timer_target(int pinned)
559{ 559{
560 int cpu = smp_processor_id(); 560 int cpu = smp_processor_id();
561 int i; 561 int i;
562 struct sched_domain *sd; 562 struct sched_domain *sd;
563 563
564 if (pinned || !get_sysctl_timer_migration() || !idle_cpu(cpu))
565 return cpu;
566
564 rcu_read_lock(); 567 rcu_read_lock();
565 for_each_domain(cpu, sd) { 568 for_each_domain(cpu, sd) {
566 for_each_cpu(i, sched_domain_span(sd)) { 569 for_each_cpu(i, sched_domain_span(sd)) {
@@ -823,19 +826,13 @@ static void update_rq_clock_task(struct rq *rq, s64 delta)
823#endif 826#endif
824#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING 827#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
825 if (static_key_false((&paravirt_steal_rq_enabled))) { 828 if (static_key_false((&paravirt_steal_rq_enabled))) {
826 u64 st;
827
828 steal = paravirt_steal_clock(cpu_of(rq)); 829 steal = paravirt_steal_clock(cpu_of(rq));
829 steal -= rq->prev_steal_time_rq; 830 steal -= rq->prev_steal_time_rq;
830 831
831 if (unlikely(steal > delta)) 832 if (unlikely(steal > delta))
832 steal = delta; 833 steal = delta;
833 834
834 st = steal_ticks(steal);
835 steal = st * TICK_NSEC;
836
837 rq->prev_steal_time_rq += steal; 835 rq->prev_steal_time_rq += steal;
838
839 delta -= steal; 836 delta -= steal;
840 } 837 }
841#endif 838#endif
@@ -4721,8 +4718,10 @@ void idle_task_exit(void)
4721 4718
4722 BUG_ON(cpu_online(smp_processor_id())); 4719 BUG_ON(cpu_online(smp_processor_id()));
4723 4720
4724 if (mm != &init_mm) 4721 if (mm != &init_mm) {
4725 switch_mm(mm, &init_mm, current); 4722 switch_mm(mm, &init_mm, current);
4723 finish_arch_post_lock_switch();
4724 }
4726 mmdrop(mm); 4725 mmdrop(mm);
4727} 4726}
4728 4727
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index 58624a65f124..a95097cb4591 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -258,16 +258,22 @@ static __always_inline bool steal_account_process_tick(void)
258{ 258{
259#ifdef CONFIG_PARAVIRT 259#ifdef CONFIG_PARAVIRT
260 if (static_key_false(&paravirt_steal_enabled)) { 260 if (static_key_false(&paravirt_steal_enabled)) {
261 u64 steal, st = 0; 261 u64 steal;
262 cputime_t steal_ct;
262 263
263 steal = paravirt_steal_clock(smp_processor_id()); 264 steal = paravirt_steal_clock(smp_processor_id());
264 steal -= this_rq()->prev_steal_time; 265 steal -= this_rq()->prev_steal_time;
265 266
266 st = steal_ticks(steal); 267 /*
267 this_rq()->prev_steal_time += st * TICK_NSEC; 268 * cputime_t may be less precise than nsecs (eg: if it's
269 * based on jiffies). Lets cast the result to cputime
270 * granularity and account the rest on the next rounds.
271 */
272 steal_ct = nsecs_to_cputime(steal);
273 this_rq()->prev_steal_time += cputime_to_nsecs(steal_ct);
268 274
269 account_steal_time(st); 275 account_steal_time(steal_ct);
270 return st; 276 return steal_ct;
271 } 277 }
272#endif 278#endif
273 return false; 279 return false;
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index f2de7a175620..c9007f28d3a2 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1216,16 +1216,6 @@ extern void update_idle_cpu_load(struct rq *this_rq);
1216 1216
1217extern void init_task_runnable_average(struct task_struct *p); 1217extern void init_task_runnable_average(struct task_struct *p);
1218 1218
1219#ifdef CONFIG_PARAVIRT
1220static inline u64 steal_ticks(u64 steal)
1221{
1222 if (unlikely(steal > NSEC_PER_SEC))
1223 return div_u64(steal, TICK_NSEC);
1224
1225 return __iter_div_u64_rem(steal, TICK_NSEC, &steal);
1226}
1227#endif
1228
1229static inline void inc_nr_running(struct rq *rq) 1219static inline void inc_nr_running(struct rq *rq)
1230{ 1220{
1231 rq->nr_running++; 1221 rq->nr_running++;
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 490fcbb1dc5b..b50990a5bea0 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -25,6 +25,7 @@
25#include <linux/smp.h> 25#include <linux/smp.h>
26#include <linux/smpboot.h> 26#include <linux/smpboot.h>
27#include <linux/tick.h> 27#include <linux/tick.h>
28#include <linux/irq.h>
28 29
29#define CREATE_TRACE_POINTS 30#define CREATE_TRACE_POINTS
30#include <trace/events/irq.h> 31#include <trace/events/irq.h>
diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig
index 3ce6e8c5f3fc..f448513a45ed 100644
--- a/kernel/time/Kconfig
+++ b/kernel/time/Kconfig
@@ -124,7 +124,7 @@ config NO_HZ_FULL
124endchoice 124endchoice
125 125
126config NO_HZ_FULL_ALL 126config NO_HZ_FULL_ALL
127 bool "Full dynticks system on all CPUs by default" 127 bool "Full dynticks system on all CPUs by default (except CPU 0)"
128 depends on NO_HZ_FULL 128 depends on NO_HZ_FULL
129 help 129 help
130 If the user doesn't pass the nohz_full boot option to 130 If the user doesn't pass the nohz_full boot option to
diff --git a/kernel/time/Makefile b/kernel/time/Makefile
index 9250130646f5..57a413fd0ebf 100644
--- a/kernel/time/Makefile
+++ b/kernel/time/Makefile
@@ -3,7 +3,10 @@ obj-y += timeconv.o posix-clock.o alarmtimer.o
3 3
4obj-$(CONFIG_GENERIC_CLOCKEVENTS_BUILD) += clockevents.o 4obj-$(CONFIG_GENERIC_CLOCKEVENTS_BUILD) += clockevents.o
5obj-$(CONFIG_GENERIC_CLOCKEVENTS) += tick-common.o 5obj-$(CONFIG_GENERIC_CLOCKEVENTS) += tick-common.o
6obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) += tick-broadcast.o 6ifeq ($(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST),y)
7 obj-y += tick-broadcast.o
8 obj-$(CONFIG_TICK_ONESHOT) += tick-broadcast-hrtimer.o
9endif
7obj-$(CONFIG_GENERIC_SCHED_CLOCK) += sched_clock.o 10obj-$(CONFIG_GENERIC_SCHED_CLOCK) += sched_clock.o
8obj-$(CONFIG_TICK_ONESHOT) += tick-oneshot.o 11obj-$(CONFIG_TICK_ONESHOT) += tick-oneshot.o
9obj-$(CONFIG_TICK_ONESHOT) += tick-sched.o 12obj-$(CONFIG_TICK_ONESHOT) += tick-sched.o
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 086ad6043bcb..ad362c260ef4 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -439,6 +439,19 @@ void clockevents_config_and_register(struct clock_event_device *dev,
439} 439}
440EXPORT_SYMBOL_GPL(clockevents_config_and_register); 440EXPORT_SYMBOL_GPL(clockevents_config_and_register);
441 441
442int __clockevents_update_freq(struct clock_event_device *dev, u32 freq)
443{
444 clockevents_config(dev, freq);
445
446 if (dev->mode == CLOCK_EVT_MODE_ONESHOT)
447 return clockevents_program_event(dev, dev->next_event, false);
448
449 if (dev->mode == CLOCK_EVT_MODE_PERIODIC)
450 dev->set_mode(CLOCK_EVT_MODE_PERIODIC, dev);
451
452 return 0;
453}
454
442/** 455/**
443 * clockevents_update_freq - Update frequency and reprogram a clock event device. 456 * clockevents_update_freq - Update frequency and reprogram a clock event device.
444 * @dev: device to modify 457 * @dev: device to modify
@@ -446,17 +459,22 @@ EXPORT_SYMBOL_GPL(clockevents_config_and_register);
446 * 459 *
447 * Reconfigure and reprogram a clock event device in oneshot 460 * Reconfigure and reprogram a clock event device in oneshot
448 * mode. Must be called on the cpu for which the device delivers per 461 * mode. Must be called on the cpu for which the device delivers per
449 * cpu timer events with interrupts disabled! Returns 0 on success, 462 * cpu timer events. If called for the broadcast device the core takes
450 * -ETIME when the event is in the past. 463 * care of serialization.
464 *
465 * Returns 0 on success, -ETIME when the event is in the past.
451 */ 466 */
452int clockevents_update_freq(struct clock_event_device *dev, u32 freq) 467int clockevents_update_freq(struct clock_event_device *dev, u32 freq)
453{ 468{
454 clockevents_config(dev, freq); 469 unsigned long flags;
455 470 int ret;
456 if (dev->mode != CLOCK_EVT_MODE_ONESHOT)
457 return 0;
458 471
459 return clockevents_program_event(dev, dev->next_event, false); 472 local_irq_save(flags);
473 ret = tick_broadcast_update_freq(dev, freq);
474 if (ret == -ENODEV)
475 ret = __clockevents_update_freq(dev, freq);
476 local_irq_restore(flags);
477 return ret;
460} 478}
461 479
462/* 480/*
@@ -524,12 +542,13 @@ void clockevents_resume(void)
524#ifdef CONFIG_GENERIC_CLOCKEVENTS 542#ifdef CONFIG_GENERIC_CLOCKEVENTS
525/** 543/**
526 * clockevents_notify - notification about relevant events 544 * clockevents_notify - notification about relevant events
545 * Returns 0 on success, any other value on error
527 */ 546 */
528void clockevents_notify(unsigned long reason, void *arg) 547int clockevents_notify(unsigned long reason, void *arg)
529{ 548{
530 struct clock_event_device *dev, *tmp; 549 struct clock_event_device *dev, *tmp;
531 unsigned long flags; 550 unsigned long flags;
532 int cpu; 551 int cpu, ret = 0;
533 552
534 raw_spin_lock_irqsave(&clockevents_lock, flags); 553 raw_spin_lock_irqsave(&clockevents_lock, flags);
535 554
@@ -542,7 +561,7 @@ void clockevents_notify(unsigned long reason, void *arg)
542 561
543 case CLOCK_EVT_NOTIFY_BROADCAST_ENTER: 562 case CLOCK_EVT_NOTIFY_BROADCAST_ENTER:
544 case CLOCK_EVT_NOTIFY_BROADCAST_EXIT: 563 case CLOCK_EVT_NOTIFY_BROADCAST_EXIT:
545 tick_broadcast_oneshot_control(reason); 564 ret = tick_broadcast_oneshot_control(reason);
546 break; 565 break;
547 566
548 case CLOCK_EVT_NOTIFY_CPU_DYING: 567 case CLOCK_EVT_NOTIFY_CPU_DYING:
@@ -585,6 +604,7 @@ void clockevents_notify(unsigned long reason, void *arg)
585 break; 604 break;
586 } 605 }
587 raw_spin_unlock_irqrestore(&clockevents_lock, flags); 606 raw_spin_unlock_irqrestore(&clockevents_lock, flags);
607 return ret;
588} 608}
589EXPORT_SYMBOL_GPL(clockevents_notify); 609EXPORT_SYMBOL_GPL(clockevents_notify);
590 610
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index af8d1d4f3d55..419a52cecd20 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -514,12 +514,13 @@ static void sync_cmos_clock(struct work_struct *work)
514 next.tv_sec++; 514 next.tv_sec++;
515 next.tv_nsec -= NSEC_PER_SEC; 515 next.tv_nsec -= NSEC_PER_SEC;
516 } 516 }
517 schedule_delayed_work(&sync_cmos_work, timespec_to_jiffies(&next)); 517 queue_delayed_work(system_power_efficient_wq,
518 &sync_cmos_work, timespec_to_jiffies(&next));
518} 519}
519 520
520void ntp_notify_cmos_timer(void) 521void ntp_notify_cmos_timer(void)
521{ 522{
522 schedule_delayed_work(&sync_cmos_work, 0); 523 queue_delayed_work(system_power_efficient_wq, &sync_cmos_work, 0);
523} 524}
524 525
525#else 526#else
diff --git a/kernel/time/tick-broadcast-hrtimer.c b/kernel/time/tick-broadcast-hrtimer.c
new file mode 100644
index 000000000000..eb682d5c697c
--- /dev/null
+++ b/kernel/time/tick-broadcast-hrtimer.c
@@ -0,0 +1,106 @@
1/*
2 * linux/kernel/time/tick-broadcast-hrtimer.c
3 * This file emulates a local clock event device
4 * via a pseudo clock device.
5 */
6#include <linux/cpu.h>
7#include <linux/err.h>
8#include <linux/hrtimer.h>
9#include <linux/interrupt.h>
10#include <linux/percpu.h>
11#include <linux/profile.h>
12#include <linux/clockchips.h>
13#include <linux/sched.h>
14#include <linux/smp.h>
15#include <linux/module.h>
16
17#include "tick-internal.h"
18
19static struct hrtimer bctimer;
20
21static void bc_set_mode(enum clock_event_mode mode,
22 struct clock_event_device *bc)
23{
24 switch (mode) {
25 case CLOCK_EVT_MODE_SHUTDOWN:
26 /*
27 * Note, we cannot cancel the timer here as we might
28 * run into the following live lock scenario:
29 *
30 * cpu 0 cpu1
31 * lock(broadcast_lock);
32 * hrtimer_interrupt()
33 * bc_handler()
34 * tick_handle_oneshot_broadcast();
35 * lock(broadcast_lock);
36 * hrtimer_cancel()
37 * wait_for_callback()
38 */
39 hrtimer_try_to_cancel(&bctimer);
40 break;
41 default:
42 break;
43 }
44}
45
46/*
47 * This is called from the guts of the broadcast code when the cpu
48 * which is about to enter idle has the earliest broadcast timer event.
49 */
50static int bc_set_next(ktime_t expires, struct clock_event_device *bc)
51{
52 /*
53 * We try to cancel the timer first. If the callback is on
54 * flight on some other cpu then we let it handle it. If we
55 * were able to cancel the timer nothing can rearm it as we
56 * own broadcast_lock.
57 *
58 * However we can also be called from the event handler of
59 * ce_broadcast_hrtimer itself when it expires. We cannot
60 * restart the timer because we are in the callback, but we
61 * can set the expiry time and let the callback return
62 * HRTIMER_RESTART.
63 */
64 if (hrtimer_try_to_cancel(&bctimer) >= 0) {
65 hrtimer_start(&bctimer, expires, HRTIMER_MODE_ABS_PINNED);
66 /* Bind the "device" to the cpu */
67 bc->bound_on = smp_processor_id();
68 } else if (bc->bound_on == smp_processor_id()) {
69 hrtimer_set_expires(&bctimer, expires);
70 }
71 return 0;
72}
73
74static struct clock_event_device ce_broadcast_hrtimer = {
75 .set_mode = bc_set_mode,
76 .set_next_ktime = bc_set_next,
77 .features = CLOCK_EVT_FEAT_ONESHOT |
78 CLOCK_EVT_FEAT_KTIME |
79 CLOCK_EVT_FEAT_HRTIMER,
80 .rating = 0,
81 .bound_on = -1,
82 .min_delta_ns = 1,
83 .max_delta_ns = KTIME_MAX,
84 .min_delta_ticks = 1,
85 .max_delta_ticks = ULONG_MAX,
86 .mult = 1,
87 .shift = 0,
88 .cpumask = cpu_all_mask,
89};
90
91static enum hrtimer_restart bc_handler(struct hrtimer *t)
92{
93 ce_broadcast_hrtimer.event_handler(&ce_broadcast_hrtimer);
94
95 if (ce_broadcast_hrtimer.next_event.tv64 == KTIME_MAX)
96 return HRTIMER_NORESTART;
97
98 return HRTIMER_RESTART;
99}
100
101void tick_setup_hrtimer_broadcast(void)
102{
103 hrtimer_init(&bctimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
104 bctimer.function = bc_handler;
105 clockevents_register_device(&ce_broadcast_hrtimer);
106}
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 98977a57ac72..64c5990fd500 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -120,6 +120,19 @@ int tick_is_broadcast_device(struct clock_event_device *dev)
120 return (dev && tick_broadcast_device.evtdev == dev); 120 return (dev && tick_broadcast_device.evtdev == dev);
121} 121}
122 122
123int tick_broadcast_update_freq(struct clock_event_device *dev, u32 freq)
124{
125 int ret = -ENODEV;
126
127 if (tick_is_broadcast_device(dev)) {
128 raw_spin_lock(&tick_broadcast_lock);
129 ret = __clockevents_update_freq(dev, freq);
130 raw_spin_unlock(&tick_broadcast_lock);
131 }
132 return ret;
133}
134
135
123static void err_broadcast(const struct cpumask *mask) 136static void err_broadcast(const struct cpumask *mask)
124{ 137{
125 pr_crit_once("Failed to broadcast timer tick. Some CPUs may be unresponsive.\n"); 138 pr_crit_once("Failed to broadcast timer tick. Some CPUs may be unresponsive.\n");
@@ -272,12 +285,8 @@ static void tick_do_broadcast(struct cpumask *mask)
272 */ 285 */
273static void tick_do_periodic_broadcast(void) 286static void tick_do_periodic_broadcast(void)
274{ 287{
275 raw_spin_lock(&tick_broadcast_lock);
276
277 cpumask_and(tmpmask, cpu_online_mask, tick_broadcast_mask); 288 cpumask_and(tmpmask, cpu_online_mask, tick_broadcast_mask);
278 tick_do_broadcast(tmpmask); 289 tick_do_broadcast(tmpmask);
279
280 raw_spin_unlock(&tick_broadcast_lock);
281} 290}
282 291
283/* 292/*
@@ -287,13 +296,15 @@ static void tick_handle_periodic_broadcast(struct clock_event_device *dev)
287{ 296{
288 ktime_t next; 297 ktime_t next;
289 298
299 raw_spin_lock(&tick_broadcast_lock);
300
290 tick_do_periodic_broadcast(); 301 tick_do_periodic_broadcast();
291 302
292 /* 303 /*
293 * The device is in periodic mode. No reprogramming necessary: 304 * The device is in periodic mode. No reprogramming necessary:
294 */ 305 */
295 if (dev->mode == CLOCK_EVT_MODE_PERIODIC) 306 if (dev->mode == CLOCK_EVT_MODE_PERIODIC)
296 return; 307 goto unlock;
297 308
298 /* 309 /*
299 * Setup the next period for devices, which do not have 310 * Setup the next period for devices, which do not have
@@ -306,9 +317,11 @@ static void tick_handle_periodic_broadcast(struct clock_event_device *dev)
306 next = ktime_add(next, tick_period); 317 next = ktime_add(next, tick_period);
307 318
308 if (!clockevents_program_event(dev, next, false)) 319 if (!clockevents_program_event(dev, next, false))
309 return; 320 goto unlock;
310 tick_do_periodic_broadcast(); 321 tick_do_periodic_broadcast();
311 } 322 }
323unlock:
324 raw_spin_unlock(&tick_broadcast_lock);
312} 325}
313 326
314/* 327/*
@@ -630,24 +643,61 @@ again:
630 raw_spin_unlock(&tick_broadcast_lock); 643 raw_spin_unlock(&tick_broadcast_lock);
631} 644}
632 645
646static int broadcast_needs_cpu(struct clock_event_device *bc, int cpu)
647{
648 if (!(bc->features & CLOCK_EVT_FEAT_HRTIMER))
649 return 0;
650 if (bc->next_event.tv64 == KTIME_MAX)
651 return 0;
652 return bc->bound_on == cpu ? -EBUSY : 0;
653}
654
655static void broadcast_shutdown_local(struct clock_event_device *bc,
656 struct clock_event_device *dev)
657{
658 /*
659 * For hrtimer based broadcasting we cannot shutdown the cpu
660 * local device if our own event is the first one to expire or
661 * if we own the broadcast timer.
662 */
663 if (bc->features & CLOCK_EVT_FEAT_HRTIMER) {
664 if (broadcast_needs_cpu(bc, smp_processor_id()))
665 return;
666 if (dev->next_event.tv64 < bc->next_event.tv64)
667 return;
668 }
669 clockevents_set_mode(dev, CLOCK_EVT_MODE_SHUTDOWN);
670}
671
672static void broadcast_move_bc(int deadcpu)
673{
674 struct clock_event_device *bc = tick_broadcast_device.evtdev;
675
676 if (!bc || !broadcast_needs_cpu(bc, deadcpu))
677 return;
678 /* This moves the broadcast assignment to this cpu */
679 clockevents_program_event(bc, bc->next_event, 1);
680}
681
633/* 682/*
634 * Powerstate information: The system enters/leaves a state, where 683 * Powerstate information: The system enters/leaves a state, where
635 * affected devices might stop 684 * affected devices might stop
685 * Returns 0 on success, -EBUSY if the cpu is used to broadcast wakeups.
636 */ 686 */
637void tick_broadcast_oneshot_control(unsigned long reason) 687int tick_broadcast_oneshot_control(unsigned long reason)
638{ 688{
639 struct clock_event_device *bc, *dev; 689 struct clock_event_device *bc, *dev;
640 struct tick_device *td; 690 struct tick_device *td;
641 unsigned long flags; 691 unsigned long flags;
642 ktime_t now; 692 ktime_t now;
643 int cpu; 693 int cpu, ret = 0;
644 694
645 /* 695 /*
646 * Periodic mode does not care about the enter/exit of power 696 * Periodic mode does not care about the enter/exit of power
647 * states 697 * states
648 */ 698 */
649 if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) 699 if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC)
650 return; 700 return 0;
651 701
652 /* 702 /*
653 * We are called with preemtion disabled from the depth of the 703 * We are called with preemtion disabled from the depth of the
@@ -658,7 +708,7 @@ void tick_broadcast_oneshot_control(unsigned long reason)
658 dev = td->evtdev; 708 dev = td->evtdev;
659 709
660 if (!(dev->features & CLOCK_EVT_FEAT_C3STOP)) 710 if (!(dev->features & CLOCK_EVT_FEAT_C3STOP))
661 return; 711 return 0;
662 712
663 bc = tick_broadcast_device.evtdev; 713 bc = tick_broadcast_device.evtdev;
664 714
@@ -666,7 +716,7 @@ void tick_broadcast_oneshot_control(unsigned long reason)
666 if (reason == CLOCK_EVT_NOTIFY_BROADCAST_ENTER) { 716 if (reason == CLOCK_EVT_NOTIFY_BROADCAST_ENTER) {
667 if (!cpumask_test_and_set_cpu(cpu, tick_broadcast_oneshot_mask)) { 717 if (!cpumask_test_and_set_cpu(cpu, tick_broadcast_oneshot_mask)) {
668 WARN_ON_ONCE(cpumask_test_cpu(cpu, tick_broadcast_pending_mask)); 718 WARN_ON_ONCE(cpumask_test_cpu(cpu, tick_broadcast_pending_mask));
669 clockevents_set_mode(dev, CLOCK_EVT_MODE_SHUTDOWN); 719 broadcast_shutdown_local(bc, dev);
670 /* 720 /*
671 * We only reprogram the broadcast timer if we 721 * We only reprogram the broadcast timer if we
672 * did not mark ourself in the force mask and 722 * did not mark ourself in the force mask and
@@ -679,6 +729,16 @@ void tick_broadcast_oneshot_control(unsigned long reason)
679 dev->next_event.tv64 < bc->next_event.tv64) 729 dev->next_event.tv64 < bc->next_event.tv64)
680 tick_broadcast_set_event(bc, cpu, dev->next_event, 1); 730 tick_broadcast_set_event(bc, cpu, dev->next_event, 1);
681 } 731 }
732 /*
733 * If the current CPU owns the hrtimer broadcast
734 * mechanism, it cannot go deep idle and we remove the
735 * CPU from the broadcast mask. We don't have to go
736 * through the EXIT path as the local timer is not
737 * shutdown.
738 */
739 ret = broadcast_needs_cpu(bc, cpu);
740 if (ret)
741 cpumask_clear_cpu(cpu, tick_broadcast_oneshot_mask);
682 } else { 742 } else {
683 if (cpumask_test_and_clear_cpu(cpu, tick_broadcast_oneshot_mask)) { 743 if (cpumask_test_and_clear_cpu(cpu, tick_broadcast_oneshot_mask)) {
684 clockevents_set_mode(dev, CLOCK_EVT_MODE_ONESHOT); 744 clockevents_set_mode(dev, CLOCK_EVT_MODE_ONESHOT);
@@ -746,6 +806,7 @@ void tick_broadcast_oneshot_control(unsigned long reason)
746 } 806 }
747out: 807out:
748 raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags); 808 raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
809 return ret;
749} 810}
750 811
751/* 812/*
@@ -852,6 +913,8 @@ void tick_shutdown_broadcast_oneshot(unsigned int *cpup)
852 cpumask_clear_cpu(cpu, tick_broadcast_pending_mask); 913 cpumask_clear_cpu(cpu, tick_broadcast_pending_mask);
853 cpumask_clear_cpu(cpu, tick_broadcast_force_mask); 914 cpumask_clear_cpu(cpu, tick_broadcast_force_mask);
854 915
916 broadcast_move_bc(cpu);
917
855 raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags); 918 raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
856} 919}
857 920
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index 20b2fe37d105..015661279b68 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -98,18 +98,19 @@ static void tick_periodic(int cpu)
98void tick_handle_periodic(struct clock_event_device *dev) 98void tick_handle_periodic(struct clock_event_device *dev)
99{ 99{
100 int cpu = smp_processor_id(); 100 int cpu = smp_processor_id();
101 ktime_t next; 101 ktime_t next = dev->next_event;
102 102
103 tick_periodic(cpu); 103 tick_periodic(cpu);
104 104
105 if (dev->mode != CLOCK_EVT_MODE_ONESHOT) 105 if (dev->mode != CLOCK_EVT_MODE_ONESHOT)
106 return; 106 return;
107 /*
108 * Setup the next period for devices, which do not have
109 * periodic mode:
110 */
111 next = ktime_add(dev->next_event, tick_period);
112 for (;;) { 107 for (;;) {
108 /*
109 * Setup the next period for devices, which do not have
110 * periodic mode:
111 */
112 next = ktime_add(next, tick_period);
113
113 if (!clockevents_program_event(dev, next, false)) 114 if (!clockevents_program_event(dev, next, false))
114 return; 115 return;
115 /* 116 /*
@@ -118,12 +119,11 @@ void tick_handle_periodic(struct clock_event_device *dev)
118 * to be sure we're using a real hardware clocksource. 119 * to be sure we're using a real hardware clocksource.
119 * Otherwise we could get trapped in an infinite 120 * Otherwise we could get trapped in an infinite
120 * loop, as the tick_periodic() increments jiffies, 121 * loop, as the tick_periodic() increments jiffies,
121 * when then will increment time, posibly causing 122 * which then will increment time, possibly causing
122 * the loop to trigger again and again. 123 * the loop to trigger again and again.
123 */ 124 */
124 if (timekeeping_valid_for_hres()) 125 if (timekeeping_valid_for_hres())
125 tick_periodic(cpu); 126 tick_periodic(cpu);
126 next = ktime_add(next, tick_period);
127 } 127 }
128} 128}
129 129
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
index 8329669b51ec..7ab92b19965a 100644
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -46,7 +46,7 @@ extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *));
46extern void tick_resume_oneshot(void); 46extern void tick_resume_oneshot(void);
47# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST 47# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
48extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc); 48extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc);
49extern void tick_broadcast_oneshot_control(unsigned long reason); 49extern int tick_broadcast_oneshot_control(unsigned long reason);
50extern void tick_broadcast_switch_to_oneshot(void); 50extern void tick_broadcast_switch_to_oneshot(void);
51extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup); 51extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup);
52extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc); 52extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc);
@@ -58,7 +58,7 @@ static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
58{ 58{
59 BUG(); 59 BUG();
60} 60}
61static inline void tick_broadcast_oneshot_control(unsigned long reason) { } 61static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; }
62static inline void tick_broadcast_switch_to_oneshot(void) { } 62static inline void tick_broadcast_switch_to_oneshot(void) { }
63static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } 63static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
64static inline int tick_broadcast_oneshot_active(void) { return 0; } 64static inline int tick_broadcast_oneshot_active(void) { return 0; }
@@ -87,7 +87,7 @@ static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
87{ 87{
88 BUG(); 88 BUG();
89} 89}
90static inline void tick_broadcast_oneshot_control(unsigned long reason) { } 90static inline int tick_broadcast_oneshot_control(unsigned long reason) { return 0; }
91static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } 91static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
92static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc) 92static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
93{ 93{
@@ -111,6 +111,7 @@ extern int tick_resume_broadcast(void);
111extern void tick_broadcast_init(void); 111extern void tick_broadcast_init(void);
112extern void 112extern void
113tick_set_periodic_handler(struct clock_event_device *dev, int broadcast); 113tick_set_periodic_handler(struct clock_event_device *dev, int broadcast);
114int tick_broadcast_update_freq(struct clock_event_device *dev, u32 freq);
114 115
115#else /* !BROADCAST */ 116#else /* !BROADCAST */
116 117
@@ -133,6 +134,8 @@ static inline void tick_shutdown_broadcast(unsigned int *cpup) { }
133static inline void tick_suspend_broadcast(void) { } 134static inline void tick_suspend_broadcast(void) { }
134static inline int tick_resume_broadcast(void) { return 0; } 135static inline int tick_resume_broadcast(void) { return 0; }
135static inline void tick_broadcast_init(void) { } 136static inline void tick_broadcast_init(void) { }
137static inline int tick_broadcast_update_freq(struct clock_event_device *dev,
138 u32 freq) { return -ENODEV; }
136 139
137/* 140/*
138 * Set the periodic handler in non broadcast mode 141 * Set the periodic handler in non broadcast mode
@@ -152,6 +155,8 @@ static inline int tick_device_is_functional(struct clock_event_device *dev)
152 return !(dev->features & CLOCK_EVT_FEAT_DUMMY); 155 return !(dev->features & CLOCK_EVT_FEAT_DUMMY);
153} 156}
154 157
158int __clockevents_update_freq(struct clock_event_device *dev, u32 freq);
159
155#endif 160#endif
156 161
157extern void do_timer(unsigned long ticks); 162extern void do_timer(unsigned long ticks);
diff --git a/kernel/time/timekeeping_debug.c b/kernel/time/timekeeping_debug.c
index 802433a4f5eb..4d54f97558df 100644
--- a/kernel/time/timekeeping_debug.c
+++ b/kernel/time/timekeeping_debug.c
@@ -21,6 +21,8 @@
21#include <linux/seq_file.h> 21#include <linux/seq_file.h>
22#include <linux/time.h> 22#include <linux/time.h>
23 23
24#include "timekeeping_internal.h"
25
24static unsigned int sleep_time_bin[32] = {0}; 26static unsigned int sleep_time_bin[32] = {0};
25 27
26static int tk_debug_show_sleep_time(struct seq_file *s, void *data) 28static int tk_debug_show_sleep_time(struct seq_file *s, void *data)
diff --git a/kernel/timer.c b/kernel/timer.c
index d78de047599b..87bd529879c2 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -81,6 +81,7 @@ struct tvec_base {
81 unsigned long timer_jiffies; 81 unsigned long timer_jiffies;
82 unsigned long next_timer; 82 unsigned long next_timer;
83 unsigned long active_timers; 83 unsigned long active_timers;
84 unsigned long all_timers;
84 struct tvec_root tv1; 85 struct tvec_root tv1;
85 struct tvec tv2; 86 struct tvec tv2;
86 struct tvec tv3; 87 struct tvec tv3;
@@ -337,6 +338,20 @@ void set_timer_slack(struct timer_list *timer, int slack_hz)
337} 338}
338EXPORT_SYMBOL_GPL(set_timer_slack); 339EXPORT_SYMBOL_GPL(set_timer_slack);
339 340
341/*
342 * If the list is empty, catch up ->timer_jiffies to the current time.
343 * The caller must hold the tvec_base lock. Returns true if the list
344 * was empty and therefore ->timer_jiffies was updated.
345 */
346static bool catchup_timer_jiffies(struct tvec_base *base)
347{
348 if (!base->all_timers) {
349 base->timer_jiffies = jiffies;
350 return true;
351 }
352 return false;
353}
354
340static void 355static void
341__internal_add_timer(struct tvec_base *base, struct timer_list *timer) 356__internal_add_timer(struct tvec_base *base, struct timer_list *timer)
342{ 357{
@@ -383,15 +398,17 @@ __internal_add_timer(struct tvec_base *base, struct timer_list *timer)
383 398
384static void internal_add_timer(struct tvec_base *base, struct timer_list *timer) 399static void internal_add_timer(struct tvec_base *base, struct timer_list *timer)
385{ 400{
401 (void)catchup_timer_jiffies(base);
386 __internal_add_timer(base, timer); 402 __internal_add_timer(base, timer);
387 /* 403 /*
388 * Update base->active_timers and base->next_timer 404 * Update base->active_timers and base->next_timer
389 */ 405 */
390 if (!tbase_get_deferrable(timer->base)) { 406 if (!tbase_get_deferrable(timer->base)) {
391 if (time_before(timer->expires, base->next_timer)) 407 if (!base->active_timers++ ||
408 time_before(timer->expires, base->next_timer))
392 base->next_timer = timer->expires; 409 base->next_timer = timer->expires;
393 base->active_timers++;
394 } 410 }
411 base->all_timers++;
395} 412}
396 413
397#ifdef CONFIG_TIMER_STATS 414#ifdef CONFIG_TIMER_STATS
@@ -671,6 +688,8 @@ detach_expired_timer(struct timer_list *timer, struct tvec_base *base)
671 detach_timer(timer, true); 688 detach_timer(timer, true);
672 if (!tbase_get_deferrable(timer->base)) 689 if (!tbase_get_deferrable(timer->base))
673 base->active_timers--; 690 base->active_timers--;
691 base->all_timers--;
692 (void)catchup_timer_jiffies(base);
674} 693}
675 694
676static int detach_if_pending(struct timer_list *timer, struct tvec_base *base, 695static int detach_if_pending(struct timer_list *timer, struct tvec_base *base,
@@ -685,6 +704,8 @@ static int detach_if_pending(struct timer_list *timer, struct tvec_base *base,
685 if (timer->expires == base->next_timer) 704 if (timer->expires == base->next_timer)
686 base->next_timer = base->timer_jiffies; 705 base->next_timer = base->timer_jiffies;
687 } 706 }
707 base->all_timers--;
708 (void)catchup_timer_jiffies(base);
688 return 1; 709 return 1;
689} 710}
690 711
@@ -739,12 +760,7 @@ __mod_timer(struct timer_list *timer, unsigned long expires,
739 760
740 debug_activate(timer, expires); 761 debug_activate(timer, expires);
741 762
742 cpu = smp_processor_id(); 763 cpu = get_nohz_timer_target(pinned);
743
744#if defined(CONFIG_NO_HZ_COMMON) && defined(CONFIG_SMP)
745 if (!pinned && get_sysctl_timer_migration() && idle_cpu(cpu))
746 cpu = get_nohz_timer_target();
747#endif
748 new_base = per_cpu(tvec_bases, cpu); 764 new_base = per_cpu(tvec_bases, cpu);
749 765
750 if (base != new_base) { 766 if (base != new_base) {
@@ -939,8 +955,15 @@ void add_timer_on(struct timer_list *timer, int cpu)
939 * with the timer by holding the timer base lock. This also 955 * with the timer by holding the timer base lock. This also
940 * makes sure that a CPU on the way to stop its tick can not 956 * makes sure that a CPU on the way to stop its tick can not
941 * evaluate the timer wheel. 957 * evaluate the timer wheel.
958 *
959 * Spare the IPI for deferrable timers on idle targets though.
960 * The next busy ticks will take care of it. Except full dynticks
961 * require special care against races with idle_cpu(), lets deal
962 * with that later.
942 */ 963 */
943 wake_up_nohz_cpu(cpu); 964 if (!tbase_get_deferrable(timer->base) || tick_nohz_full_cpu(cpu))
965 wake_up_nohz_cpu(cpu);
966
944 spin_unlock_irqrestore(&base->lock, flags); 967 spin_unlock_irqrestore(&base->lock, flags);
945} 968}
946EXPORT_SYMBOL_GPL(add_timer_on); 969EXPORT_SYMBOL_GPL(add_timer_on);
@@ -1146,6 +1169,10 @@ static inline void __run_timers(struct tvec_base *base)
1146 struct timer_list *timer; 1169 struct timer_list *timer;
1147 1170
1148 spin_lock_irq(&base->lock); 1171 spin_lock_irq(&base->lock);
1172 if (catchup_timer_jiffies(base)) {
1173 spin_unlock_irq(&base->lock);
1174 return;
1175 }
1149 while (time_after_eq(jiffies, base->timer_jiffies)) { 1176 while (time_after_eq(jiffies, base->timer_jiffies)) {
1150 struct list_head work_list; 1177 struct list_head work_list;
1151 struct list_head *head = &work_list; 1178 struct list_head *head = &work_list;
@@ -1160,7 +1187,7 @@ static inline void __run_timers(struct tvec_base *base)
1160 !cascade(base, &base->tv4, INDEX(2))) 1187 !cascade(base, &base->tv4, INDEX(2)))
1161 cascade(base, &base->tv5, INDEX(3)); 1188 cascade(base, &base->tv5, INDEX(3));
1162 ++base->timer_jiffies; 1189 ++base->timer_jiffies;
1163 list_replace_init(base->tv1.vec + index, &work_list); 1190 list_replace_init(base->tv1.vec + index, head);
1164 while (!list_empty(head)) { 1191 while (!list_empty(head)) {
1165 void (*fn)(unsigned long); 1192 void (*fn)(unsigned long);
1166 unsigned long data; 1193 unsigned long data;
@@ -1523,9 +1550,8 @@ static int init_timers_cpu(int cpu)
1523 if (!base) 1550 if (!base)
1524 return -ENOMEM; 1551 return -ENOMEM;
1525 1552
1526 /* Make sure that tvec_base is 2 byte aligned */ 1553 /* Make sure tvec_base has TIMER_FLAG_MASK bits free */
1527 if (tbase_get_deferrable(base)) { 1554 if (WARN_ON(base != tbase_get_base(base))) {
1528 WARN_ON(1);
1529 kfree(base); 1555 kfree(base);
1530 return -ENOMEM; 1556 return -ENOMEM;
1531 } 1557 }
@@ -1559,6 +1585,7 @@ static int init_timers_cpu(int cpu)
1559 base->timer_jiffies = jiffies; 1585 base->timer_jiffies = jiffies;
1560 base->next_timer = base->timer_jiffies; 1586 base->next_timer = base->timer_jiffies;
1561 base->active_timers = 0; 1587 base->active_timers = 0;
1588 base->all_timers = 0;
1562 return 0; 1589 return 0;
1563} 1590}
1564 1591
@@ -1648,9 +1675,9 @@ void __init init_timers(void)
1648 1675
1649 err = timer_cpu_notify(&timers_nb, (unsigned long)CPU_UP_PREPARE, 1676 err = timer_cpu_notify(&timers_nb, (unsigned long)CPU_UP_PREPARE,
1650 (void *)(long)smp_processor_id()); 1677 (void *)(long)smp_processor_id());
1651 init_timer_stats();
1652
1653 BUG_ON(err != NOTIFY_OK); 1678 BUG_ON(err != NOTIFY_OK);
1679
1680 init_timer_stats();
1654 register_cpu_notifier(&timers_nb); 1681 register_cpu_notifier(&timers_nb);
1655 open_softirq(TIMER_SOFTIRQ, run_timer_softirq); 1682 open_softirq(TIMER_SOFTIRQ, run_timer_softirq);
1656} 1683}
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 3fa5b8f3aae3..0ee63af30bd1 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -516,6 +516,13 @@ void destroy_work_on_stack(struct work_struct *work)
516} 516}
517EXPORT_SYMBOL_GPL(destroy_work_on_stack); 517EXPORT_SYMBOL_GPL(destroy_work_on_stack);
518 518
519void destroy_delayed_work_on_stack(struct delayed_work *work)
520{
521 destroy_timer_on_stack(&work->timer);
522 debug_object_free(&work->work, &work_debug_descr);
523}
524EXPORT_SYMBOL_GPL(destroy_delayed_work_on_stack);
525
519#else 526#else
520static inline void debug_work_activate(struct work_struct *work) { } 527static inline void debug_work_activate(struct work_struct *work) { }
521static inline void debug_work_deactivate(struct work_struct *work) { } 528static inline void debug_work_deactivate(struct work_struct *work) { }
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index f520b9da9c1f..4755c8576942 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1556,10 +1556,10 @@ SYSCALL_DEFINE5(get_mempolicy, int __user *, policy,
1556 1556
1557#ifdef CONFIG_COMPAT 1557#ifdef CONFIG_COMPAT
1558 1558
1559asmlinkage long compat_sys_get_mempolicy(int __user *policy, 1559COMPAT_SYSCALL_DEFINE5(get_mempolicy, int __user *, policy,
1560 compat_ulong_t __user *nmask, 1560 compat_ulong_t __user *, nmask,
1561 compat_ulong_t maxnode, 1561 compat_ulong_t, maxnode,
1562 compat_ulong_t addr, compat_ulong_t flags) 1562 compat_ulong_t, addr, compat_ulong_t, flags)
1563{ 1563{
1564 long err; 1564 long err;
1565 unsigned long __user *nm = NULL; 1565 unsigned long __user *nm = NULL;
@@ -1586,8 +1586,8 @@ asmlinkage long compat_sys_get_mempolicy(int __user *policy,
1586 return err; 1586 return err;
1587} 1587}
1588 1588
1589asmlinkage long compat_sys_set_mempolicy(int mode, compat_ulong_t __user *nmask, 1589COMPAT_SYSCALL_DEFINE3(set_mempolicy, int, mode, compat_ulong_t __user *, nmask,
1590 compat_ulong_t maxnode) 1590 compat_ulong_t, maxnode)
1591{ 1591{
1592 long err = 0; 1592 long err = 0;
1593 unsigned long __user *nm = NULL; 1593 unsigned long __user *nm = NULL;
@@ -1609,9 +1609,9 @@ asmlinkage long compat_sys_set_mempolicy(int mode, compat_ulong_t __user *nmask,
1609 return sys_set_mempolicy(mode, nm, nr_bits+1); 1609 return sys_set_mempolicy(mode, nm, nr_bits+1);
1610} 1610}
1611 1611
1612asmlinkage long compat_sys_mbind(compat_ulong_t start, compat_ulong_t len, 1612COMPAT_SYSCALL_DEFINE6(mbind, compat_ulong_t, start, compat_ulong_t, len,
1613 compat_ulong_t mode, compat_ulong_t __user *nmask, 1613 compat_ulong_t, mode, compat_ulong_t __user *, nmask,
1614 compat_ulong_t maxnode, compat_ulong_t flags) 1614 compat_ulong_t, maxnode, compat_ulong_t, flags)
1615{ 1615{
1616 long err = 0; 1616 long err = 0;
1617 unsigned long __user *nm = NULL; 1617 unsigned long __user *nm = NULL;
diff --git a/mm/mmu_context.c b/mm/mmu_context.c
index 8a8cd0265e52..f802c2d216a7 100644
--- a/mm/mmu_context.c
+++ b/mm/mmu_context.c
@@ -31,6 +31,9 @@ void use_mm(struct mm_struct *mm)
31 tsk->mm = mm; 31 tsk->mm = mm;
32 switch_mm(active_mm, mm, tsk); 32 switch_mm(active_mm, mm, tsk);
33 task_unlock(tsk); 33 task_unlock(tsk);
34#ifdef finish_arch_post_lock_switch
35 finish_arch_post_lock_switch();
36#endif
34 37
35 if (active_mm != mm) 38 if (active_mm != mm)
36 mmdrop(active_mm); 39 mmdrop(active_mm);
diff --git a/mm/percpu.c b/mm/percpu.c
index 036cfe07050f..63e24fb4387b 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -102,10 +102,11 @@ struct pcpu_chunk {
102 int free_size; /* free bytes in the chunk */ 102 int free_size; /* free bytes in the chunk */
103 int contig_hint; /* max contiguous size hint */ 103 int contig_hint; /* max contiguous size hint */
104 void *base_addr; /* base address of this chunk */ 104 void *base_addr; /* base address of this chunk */
105 int map_used; /* # of map entries used */ 105 int map_used; /* # of map entries used before the sentry */
106 int map_alloc; /* # of map entries allocated */ 106 int map_alloc; /* # of map entries allocated */
107 int *map; /* allocation map */ 107 int *map; /* allocation map */
108 void *data; /* chunk data */ 108 void *data; /* chunk data */
109 int first_free; /* no free below this */
109 bool immutable; /* no [de]population allowed */ 110 bool immutable; /* no [de]population allowed */
110 unsigned long populated[]; /* populated bitmap */ 111 unsigned long populated[]; /* populated bitmap */
111}; 112};
@@ -356,11 +357,11 @@ static int pcpu_need_to_extend(struct pcpu_chunk *chunk)
356{ 357{
357 int new_alloc; 358 int new_alloc;
358 359
359 if (chunk->map_alloc >= chunk->map_used + 2) 360 if (chunk->map_alloc >= chunk->map_used + 3)
360 return 0; 361 return 0;
361 362
362 new_alloc = PCPU_DFL_MAP_ALLOC; 363 new_alloc = PCPU_DFL_MAP_ALLOC;
363 while (new_alloc < chunk->map_used + 2) 364 while (new_alloc < chunk->map_used + 3)
364 new_alloc *= 2; 365 new_alloc *= 2;
365 366
366 return new_alloc; 367 return new_alloc;
@@ -418,48 +419,6 @@ out_unlock:
418} 419}
419 420
420/** 421/**
421 * pcpu_split_block - split a map block
422 * @chunk: chunk of interest
423 * @i: index of map block to split
424 * @head: head size in bytes (can be 0)
425 * @tail: tail size in bytes (can be 0)
426 *
427 * Split the @i'th map block into two or three blocks. If @head is
428 * non-zero, @head bytes block is inserted before block @i moving it
429 * to @i+1 and reducing its size by @head bytes.
430 *
431 * If @tail is non-zero, the target block, which can be @i or @i+1
432 * depending on @head, is reduced by @tail bytes and @tail byte block
433 * is inserted after the target block.
434 *
435 * @chunk->map must have enough free slots to accommodate the split.
436 *
437 * CONTEXT:
438 * pcpu_lock.
439 */
440static void pcpu_split_block(struct pcpu_chunk *chunk, int i,
441 int head, int tail)
442{
443 int nr_extra = !!head + !!tail;
444
445 BUG_ON(chunk->map_alloc < chunk->map_used + nr_extra);
446
447 /* insert new subblocks */
448 memmove(&chunk->map[i + nr_extra], &chunk->map[i],
449 sizeof(chunk->map[0]) * (chunk->map_used - i));
450 chunk->map_used += nr_extra;
451
452 if (head) {
453 chunk->map[i + 1] = chunk->map[i] - head;
454 chunk->map[i++] = head;
455 }
456 if (tail) {
457 chunk->map[i++] -= tail;
458 chunk->map[i] = tail;
459 }
460}
461
462/**
463 * pcpu_alloc_area - allocate area from a pcpu_chunk 422 * pcpu_alloc_area - allocate area from a pcpu_chunk
464 * @chunk: chunk of interest 423 * @chunk: chunk of interest
465 * @size: wanted size in bytes 424 * @size: wanted size in bytes
@@ -483,19 +442,27 @@ static int pcpu_alloc_area(struct pcpu_chunk *chunk, int size, int align)
483 int oslot = pcpu_chunk_slot(chunk); 442 int oslot = pcpu_chunk_slot(chunk);
484 int max_contig = 0; 443 int max_contig = 0;
485 int i, off; 444 int i, off;
445 bool seen_free = false;
446 int *p;
486 447
487 for (i = 0, off = 0; i < chunk->map_used; off += abs(chunk->map[i++])) { 448 for (i = chunk->first_free, p = chunk->map + i; i < chunk->map_used; i++, p++) {
488 bool is_last = i + 1 == chunk->map_used;
489 int head, tail; 449 int head, tail;
450 int this_size;
451
452 off = *p;
453 if (off & 1)
454 continue;
490 455
491 /* extra for alignment requirement */ 456 /* extra for alignment requirement */
492 head = ALIGN(off, align) - off; 457 head = ALIGN(off, align) - off;
493 BUG_ON(i == 0 && head != 0);
494 458
495 if (chunk->map[i] < 0) 459 this_size = (p[1] & ~1) - off;
496 continue; 460 if (this_size < head + size) {
497 if (chunk->map[i] < head + size) { 461 if (!seen_free) {
498 max_contig = max(chunk->map[i], max_contig); 462 chunk->first_free = i;
463 seen_free = true;
464 }
465 max_contig = max(this_size, max_contig);
499 continue; 466 continue;
500 } 467 }
501 468
@@ -505,44 +472,59 @@ static int pcpu_alloc_area(struct pcpu_chunk *chunk, int size, int align)
505 * than sizeof(int), which is very small but isn't too 472 * than sizeof(int), which is very small but isn't too
506 * uncommon for percpu allocations. 473 * uncommon for percpu allocations.
507 */ 474 */
508 if (head && (head < sizeof(int) || chunk->map[i - 1] > 0)) { 475 if (head && (head < sizeof(int) || !(p[-1] & 1))) {
509 if (chunk->map[i - 1] > 0) 476 *p = off += head;
510 chunk->map[i - 1] += head; 477 if (p[-1] & 1)
511 else {
512 chunk->map[i - 1] -= head;
513 chunk->free_size -= head; 478 chunk->free_size -= head;
514 } 479 else
515 chunk->map[i] -= head; 480 max_contig = max(*p - p[-1], max_contig);
516 off += head; 481 this_size -= head;
517 head = 0; 482 head = 0;
518 } 483 }
519 484
520 /* if tail is small, just keep it around */ 485 /* if tail is small, just keep it around */
521 tail = chunk->map[i] - head - size; 486 tail = this_size - head - size;
522 if (tail < sizeof(int)) 487 if (tail < sizeof(int)) {
523 tail = 0; 488 tail = 0;
489 size = this_size - head;
490 }
524 491
525 /* split if warranted */ 492 /* split if warranted */
526 if (head || tail) { 493 if (head || tail) {
527 pcpu_split_block(chunk, i, head, tail); 494 int nr_extra = !!head + !!tail;
495
496 /* insert new subblocks */
497 memmove(p + nr_extra + 1, p + 1,
498 sizeof(chunk->map[0]) * (chunk->map_used - i));
499 chunk->map_used += nr_extra;
500
528 if (head) { 501 if (head) {
529 i++; 502 if (!seen_free) {
530 off += head; 503 chunk->first_free = i;
531 max_contig = max(chunk->map[i - 1], max_contig); 504 seen_free = true;
505 }
506 *++p = off += head;
507 ++i;
508 max_contig = max(head, max_contig);
509 }
510 if (tail) {
511 p[1] = off + size;
512 max_contig = max(tail, max_contig);
532 } 513 }
533 if (tail)
534 max_contig = max(chunk->map[i + 1], max_contig);
535 } 514 }
536 515
516 if (!seen_free)
517 chunk->first_free = i + 1;
518
537 /* update hint and mark allocated */ 519 /* update hint and mark allocated */
538 if (is_last) 520 if (i + 1 == chunk->map_used)
539 chunk->contig_hint = max_contig; /* fully scanned */ 521 chunk->contig_hint = max_contig; /* fully scanned */
540 else 522 else
541 chunk->contig_hint = max(chunk->contig_hint, 523 chunk->contig_hint = max(chunk->contig_hint,
542 max_contig); 524 max_contig);
543 525
544 chunk->free_size -= chunk->map[i]; 526 chunk->free_size -= size;
545 chunk->map[i] = -chunk->map[i]; 527 *p |= 1;
546 528
547 pcpu_chunk_relocate(chunk, oslot); 529 pcpu_chunk_relocate(chunk, oslot);
548 return off; 530 return off;
@@ -570,34 +552,50 @@ static int pcpu_alloc_area(struct pcpu_chunk *chunk, int size, int align)
570static void pcpu_free_area(struct pcpu_chunk *chunk, int freeme) 552static void pcpu_free_area(struct pcpu_chunk *chunk, int freeme)
571{ 553{
572 int oslot = pcpu_chunk_slot(chunk); 554 int oslot = pcpu_chunk_slot(chunk);
573 int i, off; 555 int off = 0;
574 556 unsigned i, j;
575 for (i = 0, off = 0; i < chunk->map_used; off += abs(chunk->map[i++])) 557 int to_free = 0;
576 if (off == freeme) 558 int *p;
577 break; 559
560 freeme |= 1; /* we are searching for <given offset, in use> pair */
561
562 i = 0;
563 j = chunk->map_used;
564 while (i != j) {
565 unsigned k = (i + j) / 2;
566 off = chunk->map[k];
567 if (off < freeme)
568 i = k + 1;
569 else if (off > freeme)
570 j = k;
571 else
572 i = j = k;
573 }
578 BUG_ON(off != freeme); 574 BUG_ON(off != freeme);
579 BUG_ON(chunk->map[i] > 0);
580 575
581 chunk->map[i] = -chunk->map[i]; 576 if (i < chunk->first_free)
582 chunk->free_size += chunk->map[i]; 577 chunk->first_free = i;
583 578
579 p = chunk->map + i;
580 *p = off &= ~1;
581 chunk->free_size += (p[1] & ~1) - off;
582
583 /* merge with next? */
584 if (!(p[1] & 1))
585 to_free++;
584 /* merge with previous? */ 586 /* merge with previous? */
585 if (i > 0 && chunk->map[i - 1] >= 0) { 587 if (i > 0 && !(p[-1] & 1)) {
586 chunk->map[i - 1] += chunk->map[i]; 588 to_free++;
587 chunk->map_used--;
588 memmove(&chunk->map[i], &chunk->map[i + 1],
589 (chunk->map_used - i) * sizeof(chunk->map[0]));
590 i--; 589 i--;
590 p--;
591 } 591 }
592 /* merge with next? */ 592 if (to_free) {
593 if (i + 1 < chunk->map_used && chunk->map[i + 1] >= 0) { 593 chunk->map_used -= to_free;
594 chunk->map[i] += chunk->map[i + 1]; 594 memmove(p + 1, p + 1 + to_free,
595 chunk->map_used--; 595 (chunk->map_used - i) * sizeof(chunk->map[0]));
596 memmove(&chunk->map[i + 1], &chunk->map[i + 2],
597 (chunk->map_used - (i + 1)) * sizeof(chunk->map[0]));
598 } 596 }
599 597
600 chunk->contig_hint = max(chunk->map[i], chunk->contig_hint); 598 chunk->contig_hint = max(chunk->map[i + 1] - chunk->map[i] - 1, chunk->contig_hint);
601 pcpu_chunk_relocate(chunk, oslot); 599 pcpu_chunk_relocate(chunk, oslot);
602} 600}
603 601
@@ -617,7 +615,9 @@ static struct pcpu_chunk *pcpu_alloc_chunk(void)
617 } 615 }
618 616
619 chunk->map_alloc = PCPU_DFL_MAP_ALLOC; 617 chunk->map_alloc = PCPU_DFL_MAP_ALLOC;
620 chunk->map[chunk->map_used++] = pcpu_unit_size; 618 chunk->map[0] = 0;
619 chunk->map[1] = pcpu_unit_size | 1;
620 chunk->map_used = 1;
621 621
622 INIT_LIST_HEAD(&chunk->list); 622 INIT_LIST_HEAD(&chunk->list);
623 chunk->free_size = pcpu_unit_size; 623 chunk->free_size = pcpu_unit_size;
@@ -713,6 +713,16 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved)
713 unsigned long flags; 713 unsigned long flags;
714 void __percpu *ptr; 714 void __percpu *ptr;
715 715
716 /*
717 * We want the lowest bit of offset available for in-use/free
718 * indicator, so force >= 16bit alignment and make size even.
719 */
720 if (unlikely(align < 2))
721 align = 2;
722
723 if (unlikely(size & 1))
724 size++;
725
716 if (unlikely(!size || size > PCPU_MIN_UNIT_SIZE || align > PAGE_SIZE)) { 726 if (unlikely(!size || size > PCPU_MIN_UNIT_SIZE || align > PAGE_SIZE)) {
717 WARN(true, "illegal size (%zu) or align (%zu) for " 727 WARN(true, "illegal size (%zu) or align (%zu) for "
718 "percpu allocation\n", size, align); 728 "percpu allocation\n", size, align);
@@ -1343,9 +1353,13 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
1343 } 1353 }
1344 schunk->contig_hint = schunk->free_size; 1354 schunk->contig_hint = schunk->free_size;
1345 1355
1346 schunk->map[schunk->map_used++] = -ai->static_size; 1356 schunk->map[0] = 1;
1357 schunk->map[1] = ai->static_size;
1358 schunk->map_used = 1;
1347 if (schunk->free_size) 1359 if (schunk->free_size)
1348 schunk->map[schunk->map_used++] = schunk->free_size; 1360 schunk->map[++schunk->map_used] = 1 | (ai->static_size + schunk->free_size);
1361 else
1362 schunk->map[1] |= 1;
1349 1363
1350 /* init dynamic chunk if necessary */ 1364 /* init dynamic chunk if necessary */
1351 if (dyn_size) { 1365 if (dyn_size) {
@@ -1358,8 +1372,10 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
1358 bitmap_fill(dchunk->populated, pcpu_unit_pages); 1372 bitmap_fill(dchunk->populated, pcpu_unit_pages);
1359 1373
1360 dchunk->contig_hint = dchunk->free_size = dyn_size; 1374 dchunk->contig_hint = dchunk->free_size = dyn_size;
1361 dchunk->map[dchunk->map_used++] = -pcpu_reserved_chunk_limit; 1375 dchunk->map[0] = 1;
1362 dchunk->map[dchunk->map_used++] = dchunk->free_size; 1376 dchunk->map[1] = pcpu_reserved_chunk_limit;
1377 dchunk->map[2] = (pcpu_reserved_chunk_limit + dchunk->free_size) | 1;
1378 dchunk->map_used = 2;
1363 } 1379 }
1364 1380
1365 /* link the first chunk in */ 1381 /* link the first chunk in */
diff --git a/mm/process_vm_access.c b/mm/process_vm_access.c
index fd26d0433509..3c5cf68566ec 100644
--- a/mm/process_vm_access.c
+++ b/mm/process_vm_access.c
@@ -456,25 +456,23 @@ free_iovecs:
456 return rc; 456 return rc;
457} 457}
458 458
459asmlinkage ssize_t 459COMPAT_SYSCALL_DEFINE6(process_vm_readv, compat_pid_t, pid,
460compat_sys_process_vm_readv(compat_pid_t pid, 460 const struct compat_iovec __user *, lvec,
461 const struct compat_iovec __user *lvec, 461 compat_ulong_t, liovcnt,
462 unsigned long liovcnt, 462 const struct compat_iovec __user *, rvec,
463 const struct compat_iovec __user *rvec, 463 compat_ulong_t, riovcnt,
464 unsigned long riovcnt, 464 compat_ulong_t, flags)
465 unsigned long flags)
466{ 465{
467 return compat_process_vm_rw(pid, lvec, liovcnt, rvec, 466 return compat_process_vm_rw(pid, lvec, liovcnt, rvec,
468 riovcnt, flags, 0); 467 riovcnt, flags, 0);
469} 468}
470 469
471asmlinkage ssize_t 470COMPAT_SYSCALL_DEFINE6(process_vm_writev, compat_pid_t, pid,
472compat_sys_process_vm_writev(compat_pid_t pid, 471 const struct compat_iovec __user *, lvec,
473 const struct compat_iovec __user *lvec, 472 compat_ulong_t, liovcnt,
474 unsigned long liovcnt, 473 const struct compat_iovec __user *, rvec,
475 const struct compat_iovec __user *rvec, 474 compat_ulong_t, riovcnt,
476 unsigned long riovcnt, 475 compat_ulong_t, flags)
477 unsigned long flags)
478{ 476{
479 return compat_process_vm_rw(pid, lvec, liovcnt, rvec, 477 return compat_process_vm_rw(pid, lvec, liovcnt, rvec,
480 riovcnt, flags, 1); 478 riovcnt, flags, 1);
diff --git a/mm/rmap.c b/mm/rmap.c
index 8fc049f9a5a6..11cf322f8133 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1165,6 +1165,16 @@ int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
1165 } 1165 }
1166 set_pte_at(mm, address, pte, 1166 set_pte_at(mm, address, pte,
1167 swp_entry_to_pte(make_hwpoison_entry(page))); 1167 swp_entry_to_pte(make_hwpoison_entry(page)));
1168 } else if (pte_unused(pteval)) {
1169 /*
1170 * The guest indicated that the page content is of no
1171 * interest anymore. Simply discard the pte, vmscan
1172 * will take care of the rest.
1173 */
1174 if (PageAnon(page))
1175 dec_mm_counter(mm, MM_ANONPAGES);
1176 else
1177 dec_mm_counter(mm, MM_FILEPAGES);
1168 } else if (PageAnon(page)) { 1178 } else if (PageAnon(page)) {
1169 swp_entry_t entry = { .val = page_private(page) }; 1179 swp_entry_t entry = { .val = page_private(page) };
1170 pte_t swp_pte; 1180 pte_t swp_pte;
diff --git a/net/compat.c b/net/compat.c
index f50161fb812e..9a76eaf63184 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -384,8 +384,8 @@ static int compat_sock_setsockopt(struct socket *sock, int level, int optname,
384 return sock_setsockopt(sock, level, optname, optval, optlen); 384 return sock_setsockopt(sock, level, optname, optval, optlen);
385} 385}
386 386
387asmlinkage long compat_sys_setsockopt(int fd, int level, int optname, 387COMPAT_SYSCALL_DEFINE5(setsockopt, int, fd, int, level, int, optname,
388 char __user *optval, unsigned int optlen) 388 char __user *, optval, unsigned int, optlen)
389{ 389{
390 int err; 390 int err;
391 struct socket *sock = sockfd_lookup(fd, &err); 391 struct socket *sock = sockfd_lookup(fd, &err);
@@ -504,8 +504,8 @@ int compat_sock_get_timestampns(struct sock *sk, struct timespec __user *usersta
504} 504}
505EXPORT_SYMBOL(compat_sock_get_timestampns); 505EXPORT_SYMBOL(compat_sock_get_timestampns);
506 506
507asmlinkage long compat_sys_getsockopt(int fd, int level, int optname, 507COMPAT_SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname,
508 char __user *optval, int __user *optlen) 508 char __user *, optval, int __user *, optlen)
509{ 509{
510 int err; 510 int err;
511 struct socket *sock = sockfd_lookup(fd, &err); 511 struct socket *sock = sockfd_lookup(fd, &err);
@@ -735,15 +735,15 @@ static unsigned char nas[21] = {
735}; 735};
736#undef AL 736#undef AL
737 737
738asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags) 738COMPAT_SYSCALL_DEFINE3(sendmsg, int, fd, struct compat_msghdr __user *, msg, unsigned int, flags)
739{ 739{
740 if (flags & MSG_CMSG_COMPAT) 740 if (flags & MSG_CMSG_COMPAT)
741 return -EINVAL; 741 return -EINVAL;
742 return __sys_sendmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT); 742 return __sys_sendmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT);
743} 743}
744 744
745asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg, 745COMPAT_SYSCALL_DEFINE4(sendmmsg, int, fd, struct compat_mmsghdr __user *, mmsg,
746 unsigned int vlen, unsigned int flags) 746 unsigned int, vlen, unsigned int, flags)
747{ 747{
748 if (flags & MSG_CMSG_COMPAT) 748 if (flags & MSG_CMSG_COMPAT)
749 return -EINVAL; 749 return -EINVAL;
@@ -751,28 +751,28 @@ asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg,
751 flags | MSG_CMSG_COMPAT); 751 flags | MSG_CMSG_COMPAT);
752} 752}
753 753
754asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags) 754COMPAT_SYSCALL_DEFINE3(recvmsg, int, fd, struct compat_msghdr __user *, msg, unsigned int, flags)
755{ 755{
756 if (flags & MSG_CMSG_COMPAT) 756 if (flags & MSG_CMSG_COMPAT)
757 return -EINVAL; 757 return -EINVAL;
758 return __sys_recvmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT); 758 return __sys_recvmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT);
759} 759}
760 760
761asmlinkage long compat_sys_recv(int fd, void __user *buf, size_t len, unsigned int flags) 761COMPAT_SYSCALL_DEFINE4(recv, int, fd, void __user *, buf, compat_size_t, len, unsigned int, flags)
762{ 762{
763 return sys_recv(fd, buf, len, flags | MSG_CMSG_COMPAT); 763 return sys_recv(fd, buf, len, flags | MSG_CMSG_COMPAT);
764} 764}
765 765
766asmlinkage long compat_sys_recvfrom(int fd, void __user *buf, size_t len, 766COMPAT_SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, buf, compat_size_t, len,
767 unsigned int flags, struct sockaddr __user *addr, 767 unsigned int, flags, struct sockaddr __user *, addr,
768 int __user *addrlen) 768 int __user *, addrlen)
769{ 769{
770 return sys_recvfrom(fd, buf, len, flags | MSG_CMSG_COMPAT, addr, addrlen); 770 return sys_recvfrom(fd, buf, len, flags | MSG_CMSG_COMPAT, addr, addrlen);
771} 771}
772 772
773asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, 773COMPAT_SYSCALL_DEFINE5(recvmmsg, int, fd, struct compat_mmsghdr __user *, mmsg,
774 unsigned int vlen, unsigned int flags, 774 unsigned int, vlen, unsigned int, flags,
775 struct compat_timespec __user *timeout) 775 struct compat_timespec __user *, timeout)
776{ 776{
777 int datagrams; 777 int datagrams;
778 struct timespec ktspec; 778 struct timespec ktspec;
@@ -795,7 +795,7 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
795 return datagrams; 795 return datagrams;
796} 796}
797 797
798asmlinkage long compat_sys_socketcall(int call, u32 __user *args) 798COMPAT_SYSCALL_DEFINE2(socketcall, int, call, u32 __user *, args)
799{ 799{
800 int ret; 800 int ret;
801 u32 a[6]; 801 u32 a[6];
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 85d9d94c0a3c..c83827e7c324 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -2016,7 +2016,7 @@ static int __init l2tp_init(void)
2016 if (rc) 2016 if (rc)
2017 goto out; 2017 goto out;
2018 2018
2019 l2tp_wq = alloc_workqueue("l2tp", WQ_NON_REENTRANT | WQ_UNBOUND, 0); 2019 l2tp_wq = alloc_workqueue("l2tp", WQ_UNBOUND, 0);
2020 if (!l2tp_wq) { 2020 if (!l2tp_wq) {
2021 pr_err("alloc_workqueue failed\n"); 2021 pr_err("alloc_workqueue failed\n");
2022 rc = -ENOMEM; 2022 rc = -ENOMEM;
diff --git a/security/keys/compat.c b/security/keys/compat.c
index bbd32c729dbb..347896548ad3 100644
--- a/security/keys/compat.c
+++ b/security/keys/compat.c
@@ -65,8 +65,8 @@ no_payload:
65 * taking a 32-bit syscall are zero. If you can, you should call sys_keyctl() 65 * taking a 32-bit syscall are zero. If you can, you should call sys_keyctl()
66 * directly. 66 * directly.
67 */ 67 */
68asmlinkage long compat_sys_keyctl(u32 option, 68COMPAT_SYSCALL_DEFINE5(keyctl, u32, option,
69 u32 arg2, u32 arg3, u32 arg4, u32 arg5) 69 u32, arg2, u32, arg3, u32, arg4, u32, arg5)
70{ 70{
71 switch (option) { 71 switch (option) {
72 case KEYCTL_GET_KEYRING_ID: 72 case KEYCTL_GET_KEYRING_ID: