aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/include/asm/Kbuild8
-rw-r--r--arch/alpha/include/asm/cputime.h6
-rw-r--r--arch/alpha/kernel/pci.c6
-rw-r--r--arch/arc/include/asm/Kbuild7
-rw-r--r--arch/arc/mm/cache_arc700.c4
-rw-r--r--arch/arm/Kconfig3
-rw-r--r--arch/arm/boot/compressed/.gitignore1
-rw-r--r--arch/arm/boot/dts/bcm11351.dtsi2
-rw-r--r--arch/arm/boot/dts/keystone-clocks.dtsi2
-rw-r--r--arch/arm/boot/dts/omap3-gta04.dts2
-rw-r--r--arch/arm/boot/dts/omap3-igep0020.dts2
-rw-r--r--arch/arm/boot/dts/omap3-igep0030.dts2
-rw-r--r--arch/arm/boot/dts/r8a7791.dtsi2
-rw-r--r--arch/arm/boot/dts/sama5d36.dtsi2
-rw-r--r--arch/arm/boot/dts/sun4i-a10.dtsi8
-rw-r--r--arch/arm/boot/dts/sun5i-a10s.dtsi8
-rw-r--r--arch/arm/boot/dts/sun5i-a13.dtsi8
-rw-r--r--arch/arm/boot/dts/sun6i-a31.dtsi10
-rw-r--r--arch/arm/boot/dts/sun7i-a20.dtsi22
-rw-r--r--arch/arm/boot/dts/zynq-7000.dtsi6
-rw-r--r--arch/arm/configs/tegra_defconfig3
-rw-r--r--arch/arm/include/asm/Kbuild5
-rw-r--r--arch/arm/include/asm/memory.h9
-rw-r--r--arch/arm/include/asm/topology.h3
-rw-r--r--arch/arm/kernel/bios32.c9
-rw-r--r--arch/arm/kernel/head-common.S12
-rw-r--r--arch/arm/kernel/head.S2
-rw-r--r--arch/arm/kernel/process.c16
-rw-r--r--arch/arm/kernel/smp.c3
-rw-r--r--arch/arm/kernel/smp_twd.c2
-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-omap2/cclock3xxx_data.c2
-rw-r--r--arch/arm/mach-omap2/cpuidle44xx.c8
-rw-r--r--arch/arm/mach-omap2/dpll3xxx.c92
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c20
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_7xx_data.c9
-rw-r--r--arch/arm/mach-omap2/pdata-quirks.c21
-rw-r--r--arch/arm/mach-omap2/prminst44xx.c4
-rw-r--r--arch/arm/mach-pxa/viper.c3
-rw-r--r--arch/arm/mach-sa1100/include/mach/collie.h2
-rw-r--r--arch/arm/mach-shmobile/Kconfig36
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c4
-rw-r--r--arch/arm/mach-shmobile/board-bockw.c16
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c4
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c6
-rw-r--r--arch/arm/mach-spear/spear1310.c1
-rw-r--r--arch/arm/mach-spear/spear1340.c1
-rw-r--r--arch/arm/mach-u300/Makefile2
-rw-r--r--arch/arm/mach-u300/timer.c451
-rw-r--r--arch/arm/mach-zynq/Kconfig4
-rw-r--r--arch/arm/mach-zynq/common.c3
-rw-r--r--arch/arm/mm/dump.c3
-rw-r--r--arch/arm64/Kconfig34
-rw-r--r--arch/arm64/boot/dts/apm-storm.dtsi152
-rw-r--r--arch/arm64/include/asm/Kbuild8
-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.c18
-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/boards/mimc200/Makefile2
-rw-r--r--arch/avr32/boards/mimc200/fram.c82
-rw-r--r--arch/avr32/include/asm/Kbuild41
-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/blackfin/include/asm/Kbuild7
-rw-r--r--arch/blackfin/include/asm/irq.h9
-rw-r--r--arch/c6x/include/asm/Kbuild5
-rw-r--r--arch/c6x/include/asm/cache.h1
-rw-r--r--arch/cris/include/asm/Kbuild4
-rw-r--r--arch/cris/include/asm/bitops.h2
-rw-r--r--arch/cris/include/asm/cputime.h6
-rw-r--r--arch/frv/include/asm/Kbuild6
-rw-r--r--arch/frv/include/asm/cputime.h6
-rw-r--r--arch/frv/mb93090-mb00/pci-frv.c2
-rw-r--r--arch/hexagon/include/asm/Kbuild7
-rw-r--r--arch/ia64/configs/generic_defconfig5
-rw-r--r--arch/ia64/configs/tiger_defconfig1
-rw-r--r--arch/ia64/configs/zx1_defconfig1
-rw-r--r--arch/ia64/hp/common/sba_iommu.c38
-rw-r--r--arch/ia64/include/asm/Kbuild5
-rw-r--r--arch/ia64/include/asm/pci.h2
-rw-r--r--arch/ia64/include/asm/topology.h1
-rw-r--r--arch/ia64/kernel/acpi.c32
-rw-r--r--arch/ia64/kernel/efi.c7
-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/kernel/uncached.c2
-rw-r--r--arch/ia64/pci/fixup.c25
-rw-r--r--arch/ia64/pci/pci.c10
-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/Kbuild6
-rw-r--r--arch/m32r/include/asm/cputime.h6
-rw-r--r--arch/m68k/Kconfig1
-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/include/asm/Kbuild3
-rw-r--r--arch/m68k/kernel/head.S70
-rw-r--r--arch/m68k/kernel/ints.c2
-rw-r--r--arch/metag/include/asm/Kbuild5
-rw-r--r--arch/microblaze/include/asm/Kbuild6
-rw-r--r--arch/microblaze/include/asm/cputime.h1
-rw-r--r--arch/microblaze/pci/pci-common.c5
-rw-r--r--arch/mips/Kconfig24
-rw-r--r--arch/mips/alchemy/board-gpr.c4
-rw-r--r--arch/mips/alchemy/board-mtx1.c4
-rw-r--r--arch/mips/bcm47xx/board.c1
-rw-r--r--arch/mips/bcm47xx/nvram.c2
-rw-r--r--arch/mips/cavium-octeon/octeon-irq.c22
-rw-r--r--arch/mips/include/asm/Kbuild5
-rw-r--r--arch/mips/include/asm/asmmacro.h15
-rw-r--r--arch/mips/include/asm/fpu.h2
-rw-r--r--arch/mips/include/asm/ftrace.h20
-rw-r--r--arch/mips/include/asm/syscall.h10
-rw-r--r--arch/mips/include/asm/topology.h4
-rw-r--r--arch/mips/include/asm/unistd.h1
-rw-r--r--arch/mips/include/uapi/asm/inst.h4
-rw-r--r--arch/mips/kernel/ftrace.c5
-rw-r--r--arch/mips/kernel/r4k_fpu.S16
-rw-r--r--arch/mips/kernel/rtlx-cmp.c3
-rw-r--r--arch/mips/kernel/rtlx-mt.c3
-rw-r--r--arch/mips/kernel/smtc.c2
-rw-r--r--arch/mips/math-emu/cp1emu.c6
-rw-r--r--arch/mips/mti-malta/malta-amon.c2
-rw-r--r--arch/mips/mti-malta/malta-int.c4
-rw-r--r--arch/mips/pci/msi-octeon.c1
-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/Kbuild4
-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/openrisc/include/asm/Kbuild11
-rw-r--r--arch/parisc/include/asm/Kbuild32
-rw-r--r--arch/parisc/include/asm/page.h11
-rw-r--r--arch/parisc/include/asm/spinlock.h4
-rw-r--r--arch/parisc/include/uapi/asm/unistd.h4
-rw-r--r--arch/parisc/kernel/cache.c64
-rw-r--r--arch/parisc/kernel/irq.c2
-rw-r--r--arch/parisc/kernel/syscall_table.S1
-rw-r--r--arch/powerpc/Kconfig4
-rw-r--r--arch/powerpc/include/asm/Kbuild5
-rw-r--r--arch/powerpc/include/asm/fsl_ifc.h838
-rw-r--r--arch/powerpc/include/asm/topology.h1
-rw-r--r--arch/powerpc/kernel/eeh_driver.c25
-rw-r--r--arch/powerpc/kernel/irq.c8
-rw-r--r--arch/powerpc/kernel/pci_64.c4
-rw-r--r--arch/powerpc/kernel/process.c9
-rw-r--r--arch/powerpc/kernel/reloc_64.S1
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S71
-rw-r--r--arch/powerpc/oprofile/op_model_cell.c3
-rw-r--r--arch/powerpc/platforms/cell/ras.c3
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c1
-rw-r--r--arch/powerpc/platforms/powernv/setup.c13
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c6
-rw-r--r--arch/powerpc/platforms/pseries/setup.c34
-rw-r--r--arch/powerpc/sysdev/Makefile1
-rw-r--r--arch/powerpc/sysdev/ehv_pic.c10
-rw-r--r--arch/powerpc/sysdev/fsl_ifc.c305
-rw-r--r--arch/s390/Kconfig6
-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/Kbuild5
-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.c16
-rw-r--r--arch/s390/pci/pci_debug.c2
-rw-r--r--arch/score/include/asm/Kbuild6
-rw-r--r--arch/score/include/asm/cputime.h6
-rw-r--r--arch/sh/Kconfig76
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c4
-rw-r--r--arch/sh/boards/mach-se/7724/setup.c4
-rw-r--r--arch/sh/drivers/pci/pci.c5
-rw-r--r--arch/sh/include/asm/Kbuild9
-rw-r--r--arch/sh/include/cpu-sh2/cpu/cache.h2
-rw-r--r--arch/sh/include/cpu-sh2a/cpu/cache.h4
-rw-r--r--arch/sh/include/cpu-sh3/cpu/cache.h2
-rw-r--r--arch/sh/include/cpu-sh4/cpu/cache.h2
-rw-r--r--arch/sh/kernel/cpu/init.c4
-rw-r--r--arch/sh/kernel/idle.c4
-rw-r--r--arch/sh/kernel/irq.c18
-rw-r--r--arch/sh/mm/cache-debugfs.c2
-rw-r--r--arch/sh/mm/cache-sh2.c4
-rw-r--r--arch/sh/mm/cache-sh2a.c6
-rw-r--r--arch/sh/mm/cache-sh4.c4
-rw-r--r--arch/sh/mm/cache-shx3.c4
-rw-r--r--arch/sh/mm/cache.c4
-rw-r--r--arch/sparc/include/asm/Kbuild11
-rw-r--r--arch/sparc/include/asm/smp_64.h1
-rw-r--r--arch/sparc/include/asm/topology_64.h2
-rw-r--r--arch/sparc/kernel/leon_pci.c5
-rw-r--r--arch/sparc/kernel/mdesc.c4
-rw-r--r--arch/sparc/kernel/process_64.c4
-rw-r--r--arch/sparc/kernel/prom_64.c3
-rw-r--r--arch/sparc/kernel/smp_64.c2
-rw-r--r--arch/sparc/kernel/syscalls.S4
-rw-r--r--arch/sparc/kernel/time_64.c5
-rw-r--r--arch/sparc/mm/tsb.c2
-rw-r--r--arch/tile/include/asm/Kbuild5
-rw-r--r--arch/tile/kernel/pci_gx.c12
-rw-r--r--arch/um/include/asm/Kbuild34
-rw-r--r--arch/unicore32/include/asm/Kbuild5
-rw-r--r--arch/x86/Kconfig14
-rw-r--r--arch/x86/Kconfig.cpu4
-rw-r--r--arch/x86/Kconfig.debug9
-rw-r--r--arch/x86/Makefile5
-rw-r--r--arch/x86/boot/Makefile2
-rw-r--r--arch/x86/boot/compressed/eboot.c1017
-rw-r--r--arch/x86/boot/compressed/eboot.h60
-rw-r--r--arch/x86/boot/compressed/efi_stub_64.S29
-rw-r--r--arch/x86/boot/compressed/head_32.S52
-rw-r--r--arch/x86/boot/compressed/head_64.S111
-rw-r--r--arch/x86/boot/cpucheck.c20
-rw-r--r--arch/x86/boot/header.S25
-rw-r--r--arch/x86/boot/tools/build.c77
-rw-r--r--arch/x86/configs/i386_defconfig1
-rw-r--r--arch/x86/configs/x86_64_defconfig1
-rw-r--r--arch/x86/include/asm/Kbuild2
-rw-r--r--arch/x86/include/asm/apic.h14
-rw-r--r--arch/x86/include/asm/barrier.h8
-rw-r--r--arch/x86/include/asm/cpufeature.h9
-rw-r--r--arch/x86/include/asm/cputime.h1
-rw-r--r--arch/x86/include/asm/efi.h44
-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/io.h2
-rw-r--r--arch/x86/include/asm/mshyperv.h4
-rw-r--r--arch/x86/include/asm/msr.h2
-rw-r--r--arch/x86/include/asm/nmi.h3
-rw-r--r--arch/x86/include/asm/pci.h7
-rw-r--r--arch/x86/include/asm/pgtable.h17
-rw-r--r--arch/x86/include/asm/pgtable_types.h4
-rw-r--r--arch/x86/include/asm/processor.h9
-rw-r--r--arch/x86/include/asm/special_insns.h8
-rw-r--r--arch/x86/include/asm/spinlock.h5
-rw-r--r--arch/x86/include/asm/thread_info.h53
-rw-r--r--arch/x86/include/asm/topology.h23
-rw-r--r--arch/x86/include/asm/unistd.h3
-rw-r--r--arch/x86/include/asm/xsave.h16
-rw-r--r--arch/x86/include/uapi/asm/msr-index.h75
-rw-r--r--arch/x86/kernel/acpi/boot.c12
-rw-r--r--arch/x86/kernel/amd_nb.c2
-rw-r--r--arch/x86/kernel/aperture_64.c20
-rw-r--r--arch/x86/kernel/apic/apic.c13
-rw-r--r--arch/x86/kernel/apic/apic_flat_64.c4
-rw-r--r--arch/x86/kernel/apic/apic_noop.c3
-rw-r--r--arch/x86/kernel/apic/apic_numachip.c2
-rw-r--r--arch/x86/kernel/apic/bigsmp_32.c3
-rw-r--r--arch/x86/kernel/apic/es7000_32.c12
-rw-r--r--arch/x86/kernel/apic/numaq_32.c3
-rw-r--r--arch/x86/kernel/apic/probe_32.c3
-rw-r--r--arch/x86/kernel/apic/summit_32.c3
-rw-r--r--arch/x86/kernel/apic/x2apic_cluster.c2
-rw-r--r--arch/x86/kernel/apic/x2apic_phys.c2
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c2
-rw-r--r--arch/x86/kernel/cpu/amd.c50
-rw-r--r--arch/x86/kernel/cpu/centaur.c272
-rw-r--r--arch/x86/kernel/cpu/common.c11
-rw-r--r--arch/x86/kernel/cpu/intel.c53
-rw-r--r--arch/x86/kernel/cpu/mshyperv.c84
-rw-r--r--arch/x86/kernel/cpu/perf_event.c47
-rw-r--r--arch/x86/kernel/cpu/perf_event.h8
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore.c547
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore.h5
-rw-r--r--arch/x86/kernel/cpu/perf_event_p4.c34
-rw-r--r--arch/x86/kernel/crash.c2
-rw-r--r--arch/x86/kernel/dumpstack_32.c46
-rw-r--r--arch/x86/kernel/dumpstack_64.c117
-rw-r--r--arch/x86/kernel/early-quirks.c15
-rw-r--r--arch/x86/kernel/head_32.S7
-rw-r--r--arch/x86/kernel/head_64.S6
-rw-r--r--arch/x86/kernel/hpet.c4
-rw-r--r--arch/x86/kernel/i387.c15
-rw-r--r--arch/x86/kernel/irq.c6
-rw-r--r--arch/x86/kernel/irq_32.c83
-rw-r--r--arch/x86/kernel/module.c46
-rw-r--r--arch/x86/kernel/nmi.c37
-rw-r--r--arch/x86/kernel/process.c5
-rw-r--r--arch/x86/kernel/process_32.c4
-rw-r--r--arch/x86/kernel/ptrace.c8
-rw-r--r--arch/x86/kernel/quirks.c2
-rw-r--r--arch/x86/kernel/reboot.c15
-rw-r--r--arch/x86/kernel/setup.c16
-rw-r--r--arch/x86/kernel/smpboot.c20
-rw-r--r--arch/x86/kernel/time.c4
-rw-r--r--arch/x86/kernel/tsc.c3
-rw-r--r--arch/x86/kvm/cpuid.c2
-rw-r--r--arch/x86/kvm/svm.c6
-rw-r--r--arch/x86/lib/hash.c22
-rw-r--r--arch/x86/lib/memcpy_32.c6
-rw-r--r--arch/x86/lib/msr.c89
-rw-r--r--arch/x86/mm/dump_pagetables.c84
-rw-r--r--arch/x86/mm/fault.c54
-rw-r--r--arch/x86/mm/pageattr.c70
-rw-r--r--arch/x86/mm/srat.c12
-rw-r--r--arch/x86/net/bpf_jit.S2
-rw-r--r--arch/x86/pci/acpi.c59
-rw-r--r--arch/x86/pci/amd_bus.c10
-rw-r--r--arch/x86/pci/bus_numa.c13
-rw-r--r--arch/x86/pci/common.c128
-rw-r--r--arch/x86/pci/fixup.c24
-rw-r--r--arch/x86/pci/irq.c6
-rw-r--r--arch/x86/pci/legacy.c4
-rw-r--r--arch/x86/pci/numaq_32.c6
-rw-r--r--arch/x86/pci/visws.c4
-rw-r--r--arch/x86/platform/efi/Makefile1
-rw-r--r--arch/x86/platform/efi/efi.c431
-rw-r--r--arch/x86/platform/efi/efi_32.c7
-rw-r--r--arch/x86/platform/efi/efi_64.c368
-rw-r--r--arch/x86/platform/efi/efi_stub_64.S166
-rw-r--r--arch/x86/platform/efi/efi_thunk_64.S65
-rw-r--r--arch/x86/platform/ts5500/ts5500.c2
-rw-r--r--arch/x86/um/asm/barrier.h4
-rw-r--r--arch/x86/vdso/Makefile10
-rw-r--r--arch/x86/xen/mmu.c4
-rw-r--r--arch/x86/xen/spinlock.c2
-rw-r--r--arch/xtensa/include/asm/Kbuild5
-rw-r--r--arch/xtensa/kernel/irq.c22
430 files changed, 7175 insertions, 6788 deletions
diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
index a73a8e208a4a..96e54bed5088 100644
--- a/arch/alpha/include/asm/Kbuild
+++ b/arch/alpha/include/asm/Kbuild
@@ -1,7 +1,9 @@
1 1
2generic-y += clkdev.h
3 2
3generic-y += clkdev.h
4generic-y += cputime.h
4generic-y += exec.h 5generic-y += exec.h
5generic-y += trace_clock.h
6generic-y += preempt.h
7generic-y += hash.h 6generic-y += hash.h
7generic-y += mcs_spinlock.h
8generic-y += preempt.h
9generic-y += trace_clock.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/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index edb4e0097b75..076c35cd6cde 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -254,12 +254,6 @@ void pcibios_fixup_bus(struct pci_bus *bus)
254 } 254 }
255} 255}
256 256
257int
258pcibios_enable_device(struct pci_dev *dev, int mask)
259{
260 return pci_enable_resources(dev, mask);
261}
262
263/* 257/*
264 * If we set up a device for bus mastering, we need to check the latency 258 * If we set up a device for bus mastering, we need to check the latency
265 * timer as certain firmware forgets to set it properly, as seen 259 * timer as certain firmware forgets to set it properly, as seen
diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild
index 0d3362991c31..e76fd79f32b0 100644
--- a/arch/arc/include/asm/Kbuild
+++ b/arch/arc/include/asm/Kbuild
@@ -1,15 +1,15 @@
1generic-y += auxvec.h 1generic-y += auxvec.h
2generic-y += barrier.h 2generic-y += barrier.h
3generic-y += bugs.h
4generic-y += bitsperlong.h 3generic-y += bitsperlong.h
4generic-y += bugs.h
5generic-y += clkdev.h 5generic-y += clkdev.h
6generic-y += cputime.h 6generic-y += cputime.h
7generic-y += device.h 7generic-y += device.h
8generic-y += div64.h 8generic-y += div64.h
9generic-y += emergency-restart.h 9generic-y += emergency-restart.h
10generic-y += errno.h 10generic-y += errno.h
11generic-y += fcntl.h
12generic-y += fb.h 11generic-y += fb.h
12generic-y += fcntl.h
13generic-y += ftrace.h 13generic-y += ftrace.h
14generic-y += hardirq.h 14generic-y += hardirq.h
15generic-y += hash.h 15generic-y += hash.h
@@ -22,6 +22,7 @@ generic-y += kmap_types.h
22generic-y += kvm_para.h 22generic-y += kvm_para.h
23generic-y += local.h 23generic-y += local.h
24generic-y += local64.h 24generic-y += local64.h
25generic-y += mcs_spinlock.h
25generic-y += mman.h 26generic-y += mman.h
26generic-y += msgbuf.h 27generic-y += msgbuf.h
27generic-y += param.h 28generic-y += param.h
@@ -30,6 +31,7 @@ generic-y += pci.h
30generic-y += percpu.h 31generic-y += percpu.h
31generic-y += poll.h 32generic-y += poll.h
32generic-y += posix_types.h 33generic-y += posix_types.h
34generic-y += preempt.h
33generic-y += resource.h 35generic-y += resource.h
34generic-y += scatterlist.h 36generic-y += scatterlist.h
35generic-y += sembuf.h 37generic-y += sembuf.h
@@ -48,4 +50,3 @@ generic-y += ucontext.h
48generic-y += user.h 50generic-y += user.h
49generic-y += vga.h 51generic-y += vga.h
50generic-y += xor.h 52generic-y += xor.h
51generic-y += preempt.h
diff --git a/arch/arc/mm/cache_arc700.c b/arch/arc/mm/cache_arc700.c
index 6b58c1de7577..400c663b21c2 100644
--- a/arch/arc/mm/cache_arc700.c
+++ b/arch/arc/mm/cache_arc700.c
@@ -282,7 +282,7 @@ static inline void __cache_line_loop(unsigned long paddr, unsigned long vaddr,
282#else 282#else
283 /* if V-P const for loop, PTAG can be written once outside loop */ 283 /* if V-P const for loop, PTAG can be written once outside loop */
284 if (full_page_op) 284 if (full_page_op)
285 write_aux_reg(ARC_REG_DC_PTAG, paddr); 285 write_aux_reg(aux_tag, paddr);
286#endif 286#endif
287 287
288 while (num_lines-- > 0) { 288 while (num_lines-- > 0) {
@@ -296,7 +296,7 @@ static inline void __cache_line_loop(unsigned long paddr, unsigned long vaddr,
296 write_aux_reg(aux_cmd, vaddr); 296 write_aux_reg(aux_cmd, vaddr);
297 vaddr += L1_CACHE_BYTES; 297 vaddr += L1_CACHE_BYTES;
298#else 298#else
299 write_aux_reg(aux, paddr); 299 write_aux_reg(aux_cmd, paddr);
300 paddr += L1_CACHE_BYTES; 300 paddr += L1_CACHE_BYTES;
301#endif 301#endif
302 } 302 }
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e25419817791..15949459611f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1578,6 +1578,7 @@ config BL_SWITCHER_DUMMY_IF
1578 1578
1579choice 1579choice
1580 prompt "Memory split" 1580 prompt "Memory split"
1581 depends on MMU
1581 default VMSPLIT_3G 1582 default VMSPLIT_3G
1582 help 1583 help
1583 Select the desired split between kernel and user memory. 1584 Select the desired split between kernel and user memory.
@@ -1595,6 +1596,7 @@ endchoice
1595 1596
1596config PAGE_OFFSET 1597config PAGE_OFFSET
1597 hex 1598 hex
1599 default PHYS_OFFSET if !MMU
1598 default 0x40000000 if VMSPLIT_1G 1600 default 0x40000000 if VMSPLIT_1G
1599 default 0x80000000 if VMSPLIT_2G 1601 default 0x80000000 if VMSPLIT_2G
1600 default 0xC0000000 1602 default 0xC0000000
@@ -1903,6 +1905,7 @@ config XEN
1903 depends on ARM && AEABI && OF 1905 depends on ARM && AEABI && OF
1904 depends on CPU_V7 && !CPU_V6 1906 depends on CPU_V7 && !CPU_V6
1905 depends on !GENERIC_ATOMIC64 1907 depends on !GENERIC_ATOMIC64
1908 depends on MMU
1906 select ARM_PSCI 1909 select ARM_PSCI
1907 select SWIOTLB_XEN 1910 select SWIOTLB_XEN
1908 select ARCH_DMA_ADDR_T_64BIT 1911 select ARCH_DMA_ADDR_T_64BIT
diff --git a/arch/arm/boot/compressed/.gitignore b/arch/arm/boot/compressed/.gitignore
index 47279aa96a6a..0714e0334e33 100644
--- a/arch/arm/boot/compressed/.gitignore
+++ b/arch/arm/boot/compressed/.gitignore
@@ -1,4 +1,5 @@
1ashldi3.S 1ashldi3.S
2bswapsdi2.S
2font.c 3font.c
3lib1funcs.S 4lib1funcs.S
4hyp-stub.S 5hyp-stub.S
diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi
index e491b82f8d67..792fde1b7f75 100644
--- a/arch/arm/boot/dts/bcm11351.dtsi
+++ b/arch/arm/boot/dts/bcm11351.dtsi
@@ -147,7 +147,7 @@
147 }; 147 };
148 148
149 pinctrl@35004800 { 149 pinctrl@35004800 {
150 compatible = "brcm,capri-pinctrl"; 150 compatible = "brcm,bcm11351-pinctrl";
151 reg = <0x35004800 0x430>; 151 reg = <0x35004800 0x430>;
152 }; 152 };
153 153
diff --git a/arch/arm/boot/dts/keystone-clocks.dtsi b/arch/arm/boot/dts/keystone-clocks.dtsi
index 2363593e1050..ef58d1c24313 100644
--- a/arch/arm/boot/dts/keystone-clocks.dtsi
+++ b/arch/arm/boot/dts/keystone-clocks.dtsi
@@ -612,7 +612,7 @@ clocks {
612 compatible = "ti,keystone,psc-clock"; 612 compatible = "ti,keystone,psc-clock";
613 clocks = <&chipclk13>; 613 clocks = <&chipclk13>;
614 clock-output-names = "vcp-3"; 614 clock-output-names = "vcp-3";
615 reg = <0x0235000a8 0xb00>, <0x02350060 0x400>; 615 reg = <0x023500a8 0xb00>, <0x02350060 0x400>;
616 reg-names = "control", "domain"; 616 reg-names = "control", "domain";
617 domain-id = <24>; 617 domain-id = <24>;
618 }; 618 };
diff --git a/arch/arm/boot/dts/omap3-gta04.dts b/arch/arm/boot/dts/omap3-gta04.dts
index c551e4af4d83..d3b253bbc885 100644
--- a/arch/arm/boot/dts/omap3-gta04.dts
+++ b/arch/arm/boot/dts/omap3-gta04.dts
@@ -13,7 +13,7 @@
13 13
14/ { 14/ {
15 model = "OMAP3 GTA04"; 15 model = "OMAP3 GTA04";
16 compatible = "ti,omap3-gta04", "ti,omap3"; 16 compatible = "ti,omap3-gta04", "ti,omap36xx", "ti,omap3";
17 17
18 cpus { 18 cpus {
19 cpu@0 { 19 cpu@0 {
diff --git a/arch/arm/boot/dts/omap3-igep0020.dts b/arch/arm/boot/dts/omap3-igep0020.dts
index 25a2b5f652fd..f2779ac75872 100644
--- a/arch/arm/boot/dts/omap3-igep0020.dts
+++ b/arch/arm/boot/dts/omap3-igep0020.dts
@@ -14,7 +14,7 @@
14 14
15/ { 15/ {
16 model = "IGEPv2 (TI OMAP AM/DM37x)"; 16 model = "IGEPv2 (TI OMAP AM/DM37x)";
17 compatible = "isee,omap3-igep0020", "ti,omap3"; 17 compatible = "isee,omap3-igep0020", "ti,omap36xx", "ti,omap3";
18 18
19 leds { 19 leds {
20 pinctrl-names = "default"; 20 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/omap3-igep0030.dts b/arch/arm/boot/dts/omap3-igep0030.dts
index 145c58cfc8ac..2793749eb1ba 100644
--- a/arch/arm/boot/dts/omap3-igep0030.dts
+++ b/arch/arm/boot/dts/omap3-igep0030.dts
@@ -13,7 +13,7 @@
13 13
14/ { 14/ {
15 model = "IGEP COM MODULE (TI OMAP AM/DM37x)"; 15 model = "IGEP COM MODULE (TI OMAP AM/DM37x)";
16 compatible = "isee,omap3-igep0030", "ti,omap3"; 16 compatible = "isee,omap3-igep0030", "ti,omap36xx", "ti,omap3";
17 17
18 leds { 18 leds {
19 pinctrl-names = "default"; 19 pinctrl-names = "default";
diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index 19c65509a22d..3b075dd19b51 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -429,7 +429,7 @@
429 R8A7791_CLK_MSIOF1 R8A7791_CLK_SCIFB2 429 R8A7791_CLK_MSIOF1 R8A7791_CLK_SCIFB2
430 >; 430 >;
431 clock-output-names = 431 clock-output-names =
432 "scifa2", "scifa1", "scifa0", "misof2", "scifb0", 432 "scifa2", "scifa1", "scifa0", "msiof2", "scifb0",
433 "scifb1", "msiof1", "scifb2"; 433 "scifb1", "msiof1", "scifb2";
434 }; 434 };
435 mstp3_clks: mstp3_clks@e615013c { 435 mstp3_clks: mstp3_clks@e615013c {
diff --git a/arch/arm/boot/dts/sama5d36.dtsi b/arch/arm/boot/dts/sama5d36.dtsi
index 6c31c26e6cc0..db58cad6acd3 100644
--- a/arch/arm/boot/dts/sama5d36.dtsi
+++ b/arch/arm/boot/dts/sama5d36.dtsi
@@ -8,8 +8,8 @@
8 */ 8 */
9#include "sama5d3.dtsi" 9#include "sama5d3.dtsi"
10#include "sama5d3_can.dtsi" 10#include "sama5d3_can.dtsi"
11#include "sama5d3_emac.dtsi"
12#include "sama5d3_gmac.dtsi" 11#include "sama5d3_gmac.dtsi"
12#include "sama5d3_emac.dtsi"
13#include "sama5d3_lcd.dtsi" 13#include "sama5d3_lcd.dtsi"
14#include "sama5d3_mci2.dtsi" 14#include "sama5d3_mci2.dtsi"
15#include "sama5d3_tcb1.dtsi" 15#include "sama5d3_tcb1.dtsi"
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index 10666ca8aee1..7753be0c86d7 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>;
@@ -421,12 +421,12 @@
421 }; 421 };
422 422
423 sid: eeprom@01c23800 { 423 sid: eeprom@01c23800 {
424 compatible = "allwinner,sun4i-sid"; 424 compatible = "allwinner,sun4i-a10-sid";
425 reg = <0x01c23800 0x10>; 425 reg = <0x01c23800 0x10>;
426 }; 426 };
427 427
428 rtp: rtp@01c25000 { 428 rtp: rtp@01c25000 {
429 compatible = "allwinner,sun4i-ts"; 429 compatible = "allwinner,sun4i-a10-ts";
430 reg = <0x01c25000 0x100>; 430 reg = <0x01c25000 0x100>;
431 interrupts = <29>; 431 interrupts = <29>;
432 }; 432 };
diff --git a/arch/arm/boot/dts/sun5i-a10s.dtsi b/arch/arm/boot/dts/sun5i-a10s.dtsi
index 64961595e8d6..ee17b1c379e3 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>;
@@ -378,12 +378,12 @@
378 }; 378 };
379 379
380 sid: eeprom@01c23800 { 380 sid: eeprom@01c23800 {
381 compatible = "allwinner,sun4i-sid"; 381 compatible = "allwinner,sun4i-a10-sid";
382 reg = <0x01c23800 0x10>; 382 reg = <0x01c23800 0x10>;
383 }; 383 };
384 384
385 rtp: rtp@01c25000 { 385 rtp: rtp@01c25000 {
386 compatible = "allwinner,sun4i-ts"; 386 compatible = "allwinner,sun4i-a10-ts";
387 reg = <0x01c25000 0x100>; 387 reg = <0x01c25000 0x100>;
388 interrupts = <29>; 388 interrupts = <29>;
389 }; 389 };
diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi
index 320335abfccd..3490ef9ec603 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>;
@@ -341,12 +341,12 @@
341 }; 341 };
342 342
343 sid: eeprom@01c23800 { 343 sid: eeprom@01c23800 {
344 compatible = "allwinner,sun4i-sid"; 344 compatible = "allwinner,sun4i-a10-sid";
345 reg = <0x01c23800 0x10>; 345 reg = <0x01c23800 0x10>;
346 }; 346 };
347 347
348 rtp: rtp@01c25000 { 348 rtp: rtp@01c25000 {
349 compatible = "allwinner,sun4i-ts"; 349 compatible = "allwinner,sun4i-a10-ts";
350 reg = <0x01c25000 0x100>; 350 reg = <0x01c25000 0x100>;
351 interrupts = <29>; 351 interrupts = <29>;
352 }; 352 };
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 9ff09484847b..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>,
@@ -454,7 +462,7 @@
454 rtc: rtc@01c20d00 { 462 rtc: rtc@01c20d00 {
455 compatible = "allwinner,sun7i-a20-rtc"; 463 compatible = "allwinner,sun7i-a20-rtc";
456 reg = <0x01c20d00 0x20>; 464 reg = <0x01c20d00 0x20>;
457 interrupts = <0 24 1>; 465 interrupts = <0 24 4>;
458 }; 466 };
459 467
460 sid: eeprom@01c23800 { 468 sid: eeprom@01c23800 {
@@ -463,7 +471,7 @@
463 }; 471 };
464 472
465 rtp: rtp@01c25000 { 473 rtp: rtp@01c25000 {
466 compatible = "allwinner,sun4i-ts"; 474 compatible = "allwinner,sun4i-a10-ts";
467 reg = <0x01c25000 0x100>; 475 reg = <0x01c25000 0x100>;
468 interrupts = <0 29 4>; 476 interrupts = <0 29 4>;
469 }; 477 };
@@ -596,10 +604,10 @@
596 hstimer@01c60000 { 604 hstimer@01c60000 {
597 compatible = "allwinner,sun7i-a20-hstimer"; 605 compatible = "allwinner,sun7i-a20-hstimer";
598 reg = <0x01c60000 0x1000>; 606 reg = <0x01c60000 0x1000>;
599 interrupts = <0 81 1>, 607 interrupts = <0 81 4>,
600 <0 82 1>, 608 <0 82 4>,
601 <0 83 1>, 609 <0 83 4>,
602 <0 84 1>; 610 <0 84 4>;
603 clocks = <&ahb_gates 28>; 611 clocks = <&ahb_gates 28>;
604 }; 612 };
605 613
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/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig
index 00fe9e9710fd..27d69b558c5d 100644
--- a/arch/arm/configs/tegra_defconfig
+++ b/arch/arm/configs/tegra_defconfig
@@ -204,7 +204,10 @@ CONFIG_MMC_BLOCK_MINORS=16
204CONFIG_MMC_SDHCI=y 204CONFIG_MMC_SDHCI=y
205CONFIG_MMC_SDHCI_PLTFM=y 205CONFIG_MMC_SDHCI_PLTFM=y
206CONFIG_MMC_SDHCI_TEGRA=y 206CONFIG_MMC_SDHCI_TEGRA=y
207CONFIG_NEW_LEDS=y
208CONFIG_LEDS_CLASS=y
207CONFIG_LEDS_GPIO=y 209CONFIG_LEDS_GPIO=y
210CONFIG_LEDS_TRIGGERS=y
208CONFIG_LEDS_TRIGGER_TIMER=y 211CONFIG_LEDS_TRIGGER_TIMER=y
209CONFIG_LEDS_TRIGGER_ONESHOT=y 212CONFIG_LEDS_TRIGGER_ONESHOT=y
210CONFIG_LEDS_TRIGGER_HEARTBEAT=y 213CONFIG_LEDS_TRIGGER_HEARTBEAT=y
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index 3278afe2c3ab..23e728ecf8ab 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -7,16 +7,19 @@ generic-y += current.h
7generic-y += emergency-restart.h 7generic-y += emergency-restart.h
8generic-y += errno.h 8generic-y += errno.h
9generic-y += exec.h 9generic-y += exec.h
10generic-y += hash.h
10generic-y += ioctl.h 11generic-y += ioctl.h
11generic-y += ipcbuf.h 12generic-y += ipcbuf.h
12generic-y += irq_regs.h 13generic-y += irq_regs.h
13generic-y += kdebug.h 14generic-y += kdebug.h
14generic-y += local.h 15generic-y += local.h
15generic-y += local64.h 16generic-y += local64.h
17generic-y += mcs_spinlock.h
16generic-y += msgbuf.h 18generic-y += msgbuf.h
17generic-y += param.h 19generic-y += param.h
18generic-y += parport.h 20generic-y += parport.h
19generic-y += poll.h 21generic-y += poll.h
22generic-y += preempt.h
20generic-y += resource.h 23generic-y += resource.h
21generic-y += sections.h 24generic-y += sections.h
22generic-y += segment.h 25generic-y += segment.h
@@ -33,5 +36,3 @@ generic-y += termios.h
33generic-y += timex.h 36generic-y += timex.h
34generic-y += trace_clock.h 37generic-y += trace_clock.h
35generic-y += unaligned.h 38generic-y += unaligned.h
36generic-y += preempt.h
37generic-y += hash.h
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 8756e4bcdba0..4afb376d9c7c 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -30,14 +30,15 @@
30 */ 30 */
31#define UL(x) _AC(x, UL) 31#define UL(x) _AC(x, UL)
32 32
33/* PAGE_OFFSET - the virtual address of the start of the kernel image */
34#define PAGE_OFFSET UL(CONFIG_PAGE_OFFSET)
35
33#ifdef CONFIG_MMU 36#ifdef CONFIG_MMU
34 37
35/* 38/*
36 * PAGE_OFFSET - the virtual address of the start of the kernel image
37 * TASK_SIZE - the maximum size of a user space task. 39 * TASK_SIZE - the maximum size of a user space task.
38 * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area 40 * TASK_UNMAPPED_BASE - the lower boundary of the mmap VM area
39 */ 41 */
40#define PAGE_OFFSET UL(CONFIG_PAGE_OFFSET)
41#define TASK_SIZE (UL(CONFIG_PAGE_OFFSET) - UL(SZ_16M)) 42#define TASK_SIZE (UL(CONFIG_PAGE_OFFSET) - UL(SZ_16M))
42#define TASK_UNMAPPED_BASE ALIGN(TASK_SIZE / 3, SZ_16M) 43#define TASK_UNMAPPED_BASE ALIGN(TASK_SIZE / 3, SZ_16M)
43 44
@@ -104,10 +105,6 @@
104#define END_MEM (UL(CONFIG_DRAM_BASE) + CONFIG_DRAM_SIZE) 105#define END_MEM (UL(CONFIG_DRAM_BASE) + CONFIG_DRAM_SIZE)
105#endif 106#endif
106 107
107#ifndef PAGE_OFFSET
108#define PAGE_OFFSET PLAT_PHYS_OFFSET
109#endif
110
111/* 108/*
112 * The module can be at any place in ram in nommu mode. 109 * The module can be at any place in ram in nommu mode.
113 */ 110 */
diff --git a/arch/arm/include/asm/topology.h b/arch/arm/include/asm/topology.h
index 58b8b84adcd2..2fe85fff5cca 100644
--- a/arch/arm/include/asm/topology.h
+++ b/arch/arm/include/asm/topology.h
@@ -20,9 +20,6 @@ extern struct cputopo_arm cpu_topology[NR_CPUS];
20#define topology_core_cpumask(cpu) (&cpu_topology[cpu].core_sibling) 20#define topology_core_cpumask(cpu) (&cpu_topology[cpu].core_sibling)
21#define topology_thread_cpumask(cpu) (&cpu_topology[cpu].thread_sibling) 21#define topology_thread_cpumask(cpu) (&cpu_topology[cpu].thread_sibling)
22 22
23#define mc_capable() (cpu_topology[0].socket_id != -1)
24#define smt_capable() (cpu_topology[0].thread_id != -1)
25
26void init_cpu_topology(void); 23void init_cpu_topology(void);
27void store_cpu_topology(unsigned int cpuid); 24void store_cpu_topology(unsigned int cpuid);
28const struct cpumask *cpu_coregroup_mask(int cpu); 25const struct cpumask *cpu_coregroup_mask(int cpu);
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 317da88ae65b..d0d46786892c 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -19,7 +19,7 @@
19static int debug_pci; 19static int debug_pci;
20 20
21/* 21/*
22 * We can't use pci_find_device() here since we are 22 * We can't use pci_get_device() here since we are
23 * called from interrupt context. 23 * called from interrupt context.
24 */ 24 */
25static void pcibios_bus_report_status(struct pci_bus *bus, u_int status_mask, int warn) 25static void pcibios_bus_report_status(struct pci_bus *bus, u_int status_mask, int warn)
@@ -57,13 +57,10 @@ static void pcibios_bus_report_status(struct pci_bus *bus, u_int status_mask, in
57 57
58void pcibios_report_status(u_int status_mask, int warn) 58void pcibios_report_status(u_int status_mask, int warn)
59{ 59{
60 struct list_head *l; 60 struct pci_bus *bus;
61
62 list_for_each(l, &pci_root_buses) {
63 struct pci_bus *bus = pci_bus_b(l);
64 61
62 list_for_each_entry(bus, &pci_root_buses, node)
65 pcibios_bus_report_status(bus, status_mask, warn); 63 pcibios_bus_report_status(bus, status_mask, warn);
66 }
67} 64}
68 65
69/* 66/*
diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S
index 47cd974e57ea..c96ecacb2021 100644
--- a/arch/arm/kernel/head-common.S
+++ b/arch/arm/kernel/head-common.S
@@ -177,6 +177,18 @@ __lookup_processor_type_data:
177 .long __proc_info_end 177 .long __proc_info_end
178 .size __lookup_processor_type_data, . - __lookup_processor_type_data 178 .size __lookup_processor_type_data, . - __lookup_processor_type_data
179 179
180__error_lpae:
181#ifdef CONFIG_DEBUG_LL
182 adr r0, str_lpae
183 bl printascii
184 b __error
185str_lpae: .asciz "\nError: Kernel with LPAE support, but CPU does not support LPAE.\n"
186#else
187 b __error
188#endif
189 .align
190ENDPROC(__error_lpae)
191
180__error_p: 192__error_p:
181#ifdef CONFIG_DEBUG_LL 193#ifdef CONFIG_DEBUG_LL
182 adr r0, str_p1 194 adr r0, str_p1
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 914616e0bdcd..f5f381d91556 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -102,7 +102,7 @@ ENTRY(stext)
102 and r3, r3, #0xf @ extract VMSA support 102 and r3, r3, #0xf @ extract VMSA support
103 cmp r3, #5 @ long-descriptor translation table format? 103 cmp r3, #5 @ long-descriptor translation table format?
104 THUMB( it lo ) @ force fixup-able long branch encoding 104 THUMB( it lo ) @ force fixup-able long branch encoding
105 blo __error_p @ only classic page table format 105 blo __error_lpae @ only classic page table format
106#endif 106#endif
107 107
108#ifndef CONFIG_XIP_KERNEL 108#ifndef CONFIG_XIP_KERNEL
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 92f7b15dd221..adabeababeb0 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -30,7 +30,6 @@
30#include <linux/uaccess.h> 30#include <linux/uaccess.h>
31#include <linux/random.h> 31#include <linux/random.h>
32#include <linux/hw_breakpoint.h> 32#include <linux/hw_breakpoint.h>
33#include <linux/cpuidle.h>
34#include <linux/leds.h> 33#include <linux/leds.h>
35#include <linux/reboot.h> 34#include <linux/reboot.h>
36 35
@@ -133,7 +132,11 @@ EXPORT_SYMBOL_GPL(arm_pm_restart);
133 132
134void (*arm_pm_idle)(void); 133void (*arm_pm_idle)(void);
135 134
136static void default_idle(void) 135/*
136 * Called from the core idle loop.
137 */
138
139void arch_cpu_idle(void)
137{ 140{
138 if (arm_pm_idle) 141 if (arm_pm_idle)
139 arm_pm_idle(); 142 arm_pm_idle();
@@ -168,15 +171,6 @@ void arch_cpu_idle_dead(void)
168#endif 171#endif
169 172
170/* 173/*
171 * Called from the core idle loop.
172 */
173void arch_cpu_idle(void)
174{
175 if (cpuidle_idle_call())
176 default_idle();
177}
178
179/*
180 * Called by kexec, immediately prior to machine_kexec(). 174 * Called by kexec, immediately prior to machine_kexec().
181 * 175 *
182 * This must completely disable all secondary CPUs; simply causing those CPUs 176 * This must completely disable all secondary CPUs; simply causing those CPUs
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index b7b4c86e338b..7c4fada440f0 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -674,8 +674,7 @@ static int cpufreq_callback(struct notifier_block *nb,
674 } 674 }
675 675
676 if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) || 676 if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) ||
677 (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) || 677 (val == CPUFREQ_POSTCHANGE && freq->old > freq->new)) {
678 (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) {
679 loops_per_jiffy = cpufreq_scale(global_l_p_j_ref, 678 loops_per_jiffy = cpufreq_scale(global_l_p_j_ref,
680 global_l_p_j_ref_freq, 679 global_l_p_j_ref_freq,
681 freq->new); 680 freq->new);
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index 6591e26fc13f..dfc32130bc44 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -166,7 +166,7 @@ static int twd_cpufreq_transition(struct notifier_block *nb,
166 * frequency. The timer is local to a cpu, so cross-call to the 166 * frequency. The timer is local to a cpu, so cross-call to the
167 * changing cpu. 167 * changing cpu.
168 */ 168 */
169 if (state == CPUFREQ_POSTCHANGE || state == CPUFREQ_RESUMECHANGE) 169 if (state == CPUFREQ_POSTCHANGE)
170 smp_call_function_single(freqs->cpu, twd_update_frequency, 170 smp_call_function_single(freqs->cpu, twd_update_frequency,
171 NULL, 1); 171 NULL, 1);
172 172
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-omap2/cclock3xxx_data.c b/arch/arm/mach-omap2/cclock3xxx_data.c
index 3b05aea56d1f..11ed9152e665 100644
--- a/arch/arm/mach-omap2/cclock3xxx_data.c
+++ b/arch/arm/mach-omap2/cclock3xxx_data.c
@@ -433,7 +433,9 @@ static const struct clk_ops dpll4_m5x2_ck_ops = {
433 .enable = &omap2_dflt_clk_enable, 433 .enable = &omap2_dflt_clk_enable,
434 .disable = &omap2_dflt_clk_disable, 434 .disable = &omap2_dflt_clk_disable,
435 .is_enabled = &omap2_dflt_clk_is_enabled, 435 .is_enabled = &omap2_dflt_clk_is_enabled,
436 .set_rate = &omap3_clkoutx2_set_rate,
436 .recalc_rate = &omap3_clkoutx2_recalc, 437 .recalc_rate = &omap3_clkoutx2_recalc,
438 .round_rate = &omap3_clkoutx2_round_rate,
437}; 439};
438 440
439static const struct clk_ops dpll4_m5x2_ck_3630_ops = { 441static const struct clk_ops dpll4_m5x2_ck_3630_ops = {
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c
index 4c158c838d40..01fc710c8181 100644
--- a/arch/arm/mach-omap2/cpuidle44xx.c
+++ b/arch/arm/mach-omap2/cpuidle44xx.c
@@ -23,6 +23,8 @@
23#include "prm.h" 23#include "prm.h"
24#include "clockdomain.h" 24#include "clockdomain.h"
25 25
26#define MAX_CPUS 2
27
26/* Machine specific information */ 28/* Machine specific information */
27struct idle_statedata { 29struct idle_statedata {
28 u32 cpu_state; 30 u32 cpu_state;
@@ -48,11 +50,11 @@ static struct idle_statedata omap4_idle_data[] = {
48 }, 50 },
49}; 51};
50 52
51static struct powerdomain *mpu_pd, *cpu_pd[NR_CPUS]; 53static struct powerdomain *mpu_pd, *cpu_pd[MAX_CPUS];
52static struct clockdomain *cpu_clkdm[NR_CPUS]; 54static struct clockdomain *cpu_clkdm[MAX_CPUS];
53 55
54static atomic_t abort_barrier; 56static atomic_t abort_barrier;
55static bool cpu_done[NR_CPUS]; 57static bool cpu_done[MAX_CPUS];
56static struct idle_statedata *state_ptr = &omap4_idle_data[0]; 58static struct idle_statedata *state_ptr = &omap4_idle_data[0];
57 59
58/* Private functions */ 60/* Private functions */
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index 3185ced807c9..3c418ea54bbe 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -623,6 +623,32 @@ void omap3_dpll_deny_idle(struct clk_hw_omap *clk)
623 623
624/* Clock control for DPLL outputs */ 624/* Clock control for DPLL outputs */
625 625
626/* Find the parent DPLL for the given clkoutx2 clock */
627static struct clk_hw_omap *omap3_find_clkoutx2_dpll(struct clk_hw *hw)
628{
629 struct clk_hw_omap *pclk = NULL;
630 struct clk *parent;
631
632 /* Walk up the parents of clk, looking for a DPLL */
633 do {
634 do {
635 parent = __clk_get_parent(hw->clk);
636 hw = __clk_get_hw(parent);
637 } while (hw && (__clk_get_flags(hw->clk) & CLK_IS_BASIC));
638 if (!hw)
639 break;
640 pclk = to_clk_hw_omap(hw);
641 } while (pclk && !pclk->dpll_data);
642
643 /* clk does not have a DPLL as a parent? error in the clock data */
644 if (!pclk) {
645 WARN_ON(1);
646 return NULL;
647 }
648
649 return pclk;
650}
651
626/** 652/**
627 * omap3_clkoutx2_recalc - recalculate DPLL X2 output virtual clock rate 653 * omap3_clkoutx2_recalc - recalculate DPLL X2 output virtual clock rate
628 * @clk: DPLL output struct clk 654 * @clk: DPLL output struct clk
@@ -637,27 +663,14 @@ unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,
637 unsigned long rate; 663 unsigned long rate;
638 u32 v; 664 u32 v;
639 struct clk_hw_omap *pclk = NULL; 665 struct clk_hw_omap *pclk = NULL;
640 struct clk *parent;
641 666
642 if (!parent_rate) 667 if (!parent_rate)
643 return 0; 668 return 0;
644 669
645 /* Walk up the parents of clk, looking for a DPLL */ 670 pclk = omap3_find_clkoutx2_dpll(hw);
646 do {
647 do {
648 parent = __clk_get_parent(hw->clk);
649 hw = __clk_get_hw(parent);
650 } while (hw && (__clk_get_flags(hw->clk) & CLK_IS_BASIC));
651 if (!hw)
652 break;
653 pclk = to_clk_hw_omap(hw);
654 } while (pclk && !pclk->dpll_data);
655 671
656 /* clk does not have a DPLL as a parent? error in the clock data */ 672 if (!pclk)
657 if (!pclk) {
658 WARN_ON(1);
659 return 0; 673 return 0;
660 }
661 674
662 dd = pclk->dpll_data; 675 dd = pclk->dpll_data;
663 676
@@ -672,6 +685,55 @@ unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,
672 return rate; 685 return rate;
673} 686}
674 687
688int omap3_clkoutx2_set_rate(struct clk_hw *hw, unsigned long rate,
689 unsigned long parent_rate)
690{
691 return 0;
692}
693
694long omap3_clkoutx2_round_rate(struct clk_hw *hw, unsigned long rate,
695 unsigned long *prate)
696{
697 const struct dpll_data *dd;
698 u32 v;
699 struct clk_hw_omap *pclk = NULL;
700
701 if (!*prate)
702 return 0;
703
704 pclk = omap3_find_clkoutx2_dpll(hw);
705
706 if (!pclk)
707 return 0;
708
709 dd = pclk->dpll_data;
710
711 /* TYPE J does not have a clkoutx2 */
712 if (dd->flags & DPLL_J_TYPE) {
713 *prate = __clk_round_rate(__clk_get_parent(pclk->hw.clk), rate);
714 return *prate;
715 }
716
717 WARN_ON(!dd->enable_mask);
718
719 v = omap2_clk_readl(pclk, dd->control_reg) & dd->enable_mask;
720 v >>= __ffs(dd->enable_mask);
721
722 /* If in bypass, the rate is fixed to the bypass rate*/
723 if (v != OMAP3XXX_EN_DPLL_LOCKED)
724 return *prate;
725
726 if (__clk_get_flags(hw->clk) & CLK_SET_RATE_PARENT) {
727 unsigned long best_parent;
728
729 best_parent = (rate / 2);
730 *prate = __clk_round_rate(__clk_get_parent(hw->clk),
731 best_parent);
732 }
733
734 return *prate * 2;
735}
736
675/* OMAP3/4 non-CORE DPLL clkops */ 737/* OMAP3/4 non-CORE DPLL clkops */
676const struct clk_hw_omap_ops clkhwops_omap3_dpll = { 738const struct clk_hw_omap_ops clkhwops_omap3_dpll = {
677 .allow_idle = omap3_dpll_allow_idle, 739 .allow_idle = omap3_dpll_allow_idle,
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 42d81885c700..1f33f5db10d5 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1947,29 +1947,31 @@ static int _ocp_softreset(struct omap_hwmod *oh)
1947 goto dis_opt_clks; 1947 goto dis_opt_clks;
1948 1948
1949 _write_sysconfig(v, oh); 1949 _write_sysconfig(v, oh);
1950 ret = _clear_softreset(oh, &v);
1951 if (ret)
1952 goto dis_opt_clks;
1953
1954 _write_sysconfig(v, oh);
1955 1950
1956 if (oh->class->sysc->srst_udelay) 1951 if (oh->class->sysc->srst_udelay)
1957 udelay(oh->class->sysc->srst_udelay); 1952 udelay(oh->class->sysc->srst_udelay);
1958 1953
1959 c = _wait_softreset_complete(oh); 1954 c = _wait_softreset_complete(oh);
1960 if (c == MAX_MODULE_SOFTRESET_WAIT) 1955 if (c == MAX_MODULE_SOFTRESET_WAIT) {
1961 pr_warning("omap_hwmod: %s: softreset failed (waited %d usec)\n", 1956 pr_warning("omap_hwmod: %s: softreset failed (waited %d usec)\n",
1962 oh->name, MAX_MODULE_SOFTRESET_WAIT); 1957 oh->name, MAX_MODULE_SOFTRESET_WAIT);
1963 else 1958 ret = -ETIMEDOUT;
1959 goto dis_opt_clks;
1960 } else {
1964 pr_debug("omap_hwmod: %s: softreset in %d usec\n", oh->name, c); 1961 pr_debug("omap_hwmod: %s: softreset in %d usec\n", oh->name, c);
1962 }
1963
1964 ret = _clear_softreset(oh, &v);
1965 if (ret)
1966 goto dis_opt_clks;
1967
1968 _write_sysconfig(v, oh);
1965 1969
1966 /* 1970 /*
1967 * XXX add _HWMOD_STATE_WEDGED for modules that don't come back from 1971 * XXX add _HWMOD_STATE_WEDGED for modules that don't come back from
1968 * _wait_target_ready() or _reset() 1972 * _wait_target_ready() or _reset()
1969 */ 1973 */
1970 1974
1971 ret = (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT : 0;
1972
1973dis_opt_clks: 1975dis_opt_clks:
1974 if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET) 1976 if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET)
1975 _disable_optional_clocks(oh); 1977 _disable_optional_clocks(oh);
diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
index 18f333c440db..810c205d668b 100644
--- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
@@ -1365,11 +1365,10 @@ static struct omap_hwmod_class_sysconfig dra7xx_spinlock_sysc = {
1365 .rev_offs = 0x0000, 1365 .rev_offs = 0x0000,
1366 .sysc_offs = 0x0010, 1366 .sysc_offs = 0x0010,
1367 .syss_offs = 0x0014, 1367 .syss_offs = 0x0014,
1368 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY | 1368 .sysc_flags = (SYSC_HAS_AUTOIDLE | SYSC_HAS_ENAWAKEUP |
1369 SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE | 1369 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
1370 SYSC_HAS_SOFTRESET | SYSS_HAS_RESET_STATUS), 1370 SYSS_HAS_RESET_STATUS),
1371 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 1371 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
1372 SIDLE_SMART_WKUP),
1373 .sysc_fields = &omap_hwmod_sysc_type1, 1372 .sysc_fields = &omap_hwmod_sysc_type1,
1374}; 1373};
1375 1374
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index 3d5b24dcd9a4..c33e07e2f0d4 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -22,6 +22,8 @@
22#include "common-board-devices.h" 22#include "common-board-devices.h"
23#include "dss-common.h" 23#include "dss-common.h"
24#include "control.h" 24#include "control.h"
25#include "omap-secure.h"
26#include "soc.h"
25 27
26struct pdata_init { 28struct pdata_init {
27 const char *compatible; 29 const char *compatible;
@@ -169,6 +171,22 @@ static void __init am3517_evm_legacy_init(void)
169 omap_ctrl_writel(v, AM35XX_CONTROL_IP_SW_RESET); 171 omap_ctrl_writel(v, AM35XX_CONTROL_IP_SW_RESET);
170 omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); /* OCP barrier */ 172 omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); /* OCP barrier */
171} 173}
174
175static void __init nokia_n900_legacy_init(void)
176{
177 hsmmc2_internal_input_clk();
178
179 if (omap_type() == OMAP2_DEVICE_TYPE_SEC) {
180 if (IS_ENABLED(CONFIG_ARM_ERRATA_430973)) {
181 pr_info("RX-51: Enabling ARM errata 430973 workaround\n");
182 /* set IBE to 1 */
183 rx51_secure_update_aux_cr(BIT(6), 0);
184 } else {
185 pr_warning("RX-51: Not enabling ARM errata 430973 workaround\n");
186 pr_warning("Thumb binaries may crash randomly without this workaround\n");
187 }
188 }
189}
172#endif /* CONFIG_ARCH_OMAP3 */ 190#endif /* CONFIG_ARCH_OMAP3 */
173 191
174#ifdef CONFIG_ARCH_OMAP4 192#ifdef CONFIG_ARCH_OMAP4
@@ -239,6 +257,7 @@ struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
239#endif 257#endif
240#ifdef CONFIG_ARCH_OMAP3 258#ifdef CONFIG_ARCH_OMAP3
241 OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002030, "48002030.pinmux", &pcs_pdata), 259 OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002030, "48002030.pinmux", &pcs_pdata),
260 OF_DEV_AUXDATA("ti,omap3-padconf", 0x480025a0, "480025a0.pinmux", &pcs_pdata),
242 OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002a00, "48002a00.pinmux", &pcs_pdata), 261 OF_DEV_AUXDATA("ti,omap3-padconf", 0x48002a00, "48002a00.pinmux", &pcs_pdata),
243 /* Only on am3517 */ 262 /* Only on am3517 */
244 OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL), 263 OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL),
@@ -259,7 +278,7 @@ struct of_dev_auxdata omap_auxdata_lookup[] __initdata = {
259static struct pdata_init pdata_quirks[] __initdata = { 278static struct pdata_init pdata_quirks[] __initdata = {
260#ifdef CONFIG_ARCH_OMAP3 279#ifdef CONFIG_ARCH_OMAP3
261 { "compulab,omap3-sbc-t3730", omap3_sbc_t3730_legacy_init, }, 280 { "compulab,omap3-sbc-t3730", omap3_sbc_t3730_legacy_init, },
262 { "nokia,omap3-n900", hsmmc2_internal_input_clk, }, 281 { "nokia,omap3-n900", nokia_n900_legacy_init, },
263 { "nokia,omap3-n9", hsmmc2_internal_input_clk, }, 282 { "nokia,omap3-n9", hsmmc2_internal_input_clk, },
264 { "nokia,omap3-n950", hsmmc2_internal_input_clk, }, 283 { "nokia,omap3-n950", hsmmc2_internal_input_clk, },
265 { "isee,omap3-igep0020", omap3_igep0020_legacy_init, }, 284 { "isee,omap3-igep0020", omap3_igep0020_legacy_init, },
diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c
index 6334b96b4097..280f3c58abe5 100644
--- a/arch/arm/mach-omap2/prminst44xx.c
+++ b/arch/arm/mach-omap2/prminst44xx.c
@@ -183,11 +183,11 @@ void omap4_prminst_global_warm_sw_reset(void)
183 OMAP4_PRM_RSTCTRL_OFFSET); 183 OMAP4_PRM_RSTCTRL_OFFSET);
184 v |= OMAP4430_RST_GLOBAL_WARM_SW_MASK; 184 v |= OMAP4430_RST_GLOBAL_WARM_SW_MASK;
185 omap4_prminst_write_inst_reg(v, OMAP4430_PRM_PARTITION, 185 omap4_prminst_write_inst_reg(v, OMAP4430_PRM_PARTITION,
186 OMAP4430_PRM_DEVICE_INST, 186 dev_inst,
187 OMAP4_PRM_RSTCTRL_OFFSET); 187 OMAP4_PRM_RSTCTRL_OFFSET);
188 188
189 /* OCP barrier */ 189 /* OCP barrier */
190 v = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, 190 v = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION,
191 OMAP4430_PRM_DEVICE_INST, 191 dev_inst,
192 OMAP4_PRM_RSTCTRL_OFFSET); 192 OMAP4_PRM_RSTCTRL_OFFSET);
193} 193}
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c
index 29905b127ad9..41f27f667ca8 100644
--- a/arch/arm/mach-pxa/viper.c
+++ b/arch/arm/mach-pxa/viper.c
@@ -885,9 +885,6 @@ static int viper_cpufreq_notifier(struct notifier_block *nb,
885 viper_set_core_cpu_voltage(freq->new, 0); 885 viper_set_core_cpu_voltage(freq->new, 0);
886 } 886 }
887 break; 887 break;
888 case CPUFREQ_RESUMECHANGE:
889 viper_set_core_cpu_voltage(freq->new, 0);
890 break;
891 default: 888 default:
892 /* ignore */ 889 /* ignore */
893 break; 890 break;
diff --git a/arch/arm/mach-sa1100/include/mach/collie.h b/arch/arm/mach-sa1100/include/mach/collie.h
index f33679d2d3ee..50e1d850ee2e 100644
--- a/arch/arm/mach-sa1100/include/mach/collie.h
+++ b/arch/arm/mach-sa1100/include/mach/collie.h
@@ -13,6 +13,8 @@
13#ifndef __ASM_ARCH_COLLIE_H 13#ifndef __ASM_ARCH_COLLIE_H
14#define __ASM_ARCH_COLLIE_H 14#define __ASM_ARCH_COLLIE_H
15 15
16#include "hardware.h" /* Gives GPIO_MAX */
17
16extern void locomolcd_power(int on); 18extern void locomolcd_power(int on);
17 19
18#define COLLIE_SCOOP_GPIO_BASE (GPIO_MAX + 1) 20#define COLLIE_SCOOP_GPIO_BASE (GPIO_MAX + 1)
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-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 93533e2710a8..9323854242ca 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -988,14 +988,12 @@ static struct asoc_simple_card_info fsi_wm8978_info = {
988 .card = "FSI2A-WM8978", 988 .card = "FSI2A-WM8978",
989 .codec = "wm8978.0-001a", 989 .codec = "wm8978.0-001a",
990 .platform = "sh_fsi2", 990 .platform = "sh_fsi2",
991 .daifmt = SND_SOC_DAIFMT_I2S, 991 .daifmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
992 .cpu_dai = { 992 .cpu_dai = {
993 .name = "fsia-dai", 993 .name = "fsia-dai",
994 .fmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
995 }, 994 },
996 .codec_dai = { 995 .codec_dai = {
997 .name = "wm8978-hifi", 996 .name = "wm8978-hifi",
998 .fmt = SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF,
999 .sysclk = 12288000, 997 .sysclk = 12288000,
1000 }, 998 },
1001}; 999};
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index c475220545f2..74c27d9d6900 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -429,14 +429,12 @@ static struct asoc_simple_card_info rsnd_card_info[] = {
429 .card = "SSI56-AK4643", 429 .card = "SSI56-AK4643",
430 .codec = "ak4642-codec.0-0012", 430 .codec = "ak4642-codec.0-0012",
431 .platform = "rcar_sound", 431 .platform = "rcar_sound",
432 .daifmt = SND_SOC_DAIFMT_LEFT_J, 432 .daifmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM,
433 .cpu_dai = { 433 .cpu_dai = {
434 .name = "rsnd-dai.0", 434 .name = "rsnd-dai.0",
435 .fmt = SND_SOC_DAIFMT_CBS_CFS,
436 }, 435 },
437 .codec_dai = { 436 .codec_dai = {
438 .name = "ak4642-hifi", 437 .name = "ak4642-hifi",
439 .fmt = SND_SOC_DAIFMT_CBM_CFM,
440 .sysclk = 11289600, 438 .sysclk = 11289600,
441 }, 439 },
442 }, 440 },
@@ -446,10 +444,9 @@ static struct asoc_simple_card_info rsnd_card_info[] = {
446 .card = "SSI3-AK4554(playback)", 444 .card = "SSI3-AK4554(playback)",
447 .codec = "ak4554-adc-dac.0", 445 .codec = "ak4554-adc-dac.0",
448 .platform = "rcar_sound", 446 .platform = "rcar_sound",
447 .daifmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_RIGHT_J,
449 .cpu_dai = { 448 .cpu_dai = {
450 .name = "rsnd-dai.1", 449 .name = "rsnd-dai.1",
451 .fmt = SND_SOC_DAIFMT_CBM_CFM |
452 SND_SOC_DAIFMT_RIGHT_J,
453 }, 450 },
454 .codec_dai = { 451 .codec_dai = {
455 .name = "ak4554-hifi", 452 .name = "ak4554-hifi",
@@ -461,10 +458,9 @@ static struct asoc_simple_card_info rsnd_card_info[] = {
461 .card = "SSI4-AK4554(capture)", 458 .card = "SSI4-AK4554(capture)",
462 .codec = "ak4554-adc-dac.0", 459 .codec = "ak4554-adc-dac.0",
463 .platform = "rcar_sound", 460 .platform = "rcar_sound",
461 .daifmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_LEFT_J,
464 .cpu_dai = { 462 .cpu_dai = {
465 .name = "rsnd-dai.2", 463 .name = "rsnd-dai.2",
466 .fmt = SND_SOC_DAIFMT_CBM_CFM |
467 SND_SOC_DAIFMT_LEFT_J,
468 }, 464 },
469 .codec_dai = { 465 .codec_dai = {
470 .name = "ak4554-hifi", 466 .name = "ak4554-hifi",
@@ -476,10 +472,9 @@ static struct asoc_simple_card_info rsnd_card_info[] = {
476 .card = "SSI7-AK4554(playback)", 472 .card = "SSI7-AK4554(playback)",
477 .codec = "ak4554-adc-dac.1", 473 .codec = "ak4554-adc-dac.1",
478 .platform = "rcar_sound", 474 .platform = "rcar_sound",
475 .daifmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_RIGHT_J,
479 .cpu_dai = { 476 .cpu_dai = {
480 .name = "rsnd-dai.3", 477 .name = "rsnd-dai.3",
481 .fmt = SND_SOC_DAIFMT_CBM_CFM |
482 SND_SOC_DAIFMT_RIGHT_J,
483 }, 478 },
484 .codec_dai = { 479 .codec_dai = {
485 .name = "ak4554-hifi", 480 .name = "ak4554-hifi",
@@ -491,10 +486,9 @@ static struct asoc_simple_card_info rsnd_card_info[] = {
491 .card = "SSI8-AK4554(capture)", 486 .card = "SSI8-AK4554(capture)",
492 .codec = "ak4554-adc-dac.1", 487 .codec = "ak4554-adc-dac.1",
493 .platform = "rcar_sound", 488 .platform = "rcar_sound",
489 .daifmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_LEFT_J,
494 .cpu_dai = { 490 .cpu_dai = {
495 .name = "rsnd-dai.4", 491 .name = "rsnd-dai.4",
496 .fmt = SND_SOC_DAIFMT_CBM_CFM |
497 SND_SOC_DAIFMT_LEFT_J,
498 }, 492 },
499 .codec_dai = { 493 .codec_dai = {
500 .name = "ak4554-hifi", 494 .name = "ak4554-hifi",
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index bc40b853ffd3..03dc3ac84502 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -589,14 +589,12 @@ static struct asoc_simple_card_info fsi2_ak4648_info = {
589 .card = "FSI2A-AK4648", 589 .card = "FSI2A-AK4648",
590 .codec = "ak4642-codec.0-0012", 590 .codec = "ak4642-codec.0-0012",
591 .platform = "sh_fsi2", 591 .platform = "sh_fsi2",
592 .daifmt = SND_SOC_DAIFMT_LEFT_J, 592 .daifmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM,
593 .cpu_dai = { 593 .cpu_dai = {
594 .name = "fsia-dai", 594 .name = "fsia-dai",
595 .fmt = SND_SOC_DAIFMT_CBS_CFS,
596 }, 595 },
597 .codec_dai = { 596 .codec_dai = {
598 .name = "ak4642-hifi", 597 .name = "ak4642-hifi",
599 .fmt = SND_SOC_DAIFMT_CBM_CFM,
600 .sysclk = 11289600, 598 .sysclk = 11289600,
601 }, 599 },
602}; 600};
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 3aba0372f630..0ff4d8e45cf7 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -509,9 +509,9 @@ static struct asoc_simple_card_info fsi2_hdmi_info = {
509 .card = "FSI2B-HDMI", 509 .card = "FSI2B-HDMI",
510 .codec = "sh-mobile-hdmi", 510 .codec = "sh-mobile-hdmi",
511 .platform = "sh_fsi2", 511 .platform = "sh_fsi2",
512 .daifmt = SND_SOC_DAIFMT_CBS_CFS,
512 .cpu_dai = { 513 .cpu_dai = {
513 .name = "fsib-dai", 514 .name = "fsib-dai",
514 .fmt = SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF,
515 }, 515 },
516 .codec_dai = { 516 .codec_dai = {
517 .name = "sh_mobile_hdmi-hifi", 517 .name = "sh_mobile_hdmi-hifi",
@@ -905,14 +905,12 @@ static struct asoc_simple_card_info fsi2_ak4643_info = {
905 .card = "FSI2A-AK4643", 905 .card = "FSI2A-AK4643",
906 .codec = "ak4642-codec.0-0013", 906 .codec = "ak4642-codec.0-0013",
907 .platform = "sh_fsi2", 907 .platform = "sh_fsi2",
908 .daifmt = SND_SOC_DAIFMT_LEFT_J, 908 .daifmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM,
909 .cpu_dai = { 909 .cpu_dai = {
910 .name = "fsia-dai", 910 .name = "fsia-dai",
911 .fmt = SND_SOC_DAIFMT_CBS_CFS,
912 }, 911 },
913 .codec_dai = { 912 .codec_dai = {
914 .name = "ak4642-hifi", 913 .name = "ak4642-hifi",
915 .fmt = SND_SOC_DAIFMT_CBM_CFM,
916 .sysclk = 11289600, 914 .sysclk = 11289600,
917 }, 915 },
918}; 916};
diff --git a/arch/arm/mach-spear/spear1310.c b/arch/arm/mach-spear/spear1310.c
index 7ad003001ab7..824b12a56a42 100644
--- a/arch/arm/mach-spear/spear1310.c
+++ b/arch/arm/mach-spear/spear1310.c
@@ -28,6 +28,7 @@
28static void __init spear1310_dt_init(void) 28static void __init spear1310_dt_init(void)
29{ 29{
30 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 30 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
31 platform_device_register_simple("spear-cpufreq", -1, NULL, 0);
31} 32}
32 33
33static const char * const spear1310_dt_board_compat[] = { 34static const char * const spear1310_dt_board_compat[] = {
diff --git a/arch/arm/mach-spear/spear1340.c b/arch/arm/mach-spear/spear1340.c
index 3fb683424729..7b6bff7154e1 100644
--- a/arch/arm/mach-spear/spear1340.c
+++ b/arch/arm/mach-spear/spear1340.c
@@ -143,6 +143,7 @@ static void __init spear1340_dt_init(void)
143{ 143{
144 of_platform_populate(NULL, of_default_bus_match_table, 144 of_platform_populate(NULL, of_default_bus_match_table,
145 spear1340_auxdata_lookup, NULL); 145 spear1340_auxdata_lookup, NULL);
146 platform_device_register_simple("spear-cpufreq", -1, NULL, 0);
146} 147}
147 148
148static const char * const spear1340_dt_board_compat[] = { 149static const char * const spear1340_dt_board_compat[] = {
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-u300/timer.c b/arch/arm/mach-u300/timer.c
deleted file mode 100644
index fe08fd34c0ce..000000000000
--- a/arch/arm/mach-u300/timer.c
+++ /dev/null
@@ -1,451 +0,0 @@
1/*
2 *
3 * arch/arm/mach-u300/timer.c
4 *
5 *
6 * Copyright (C) 2007-2009 ST-Ericsson AB
7 * License terms: GNU General Public License (GPL) version 2
8 * Timer COH 901 328, runs the OS timer interrupt.
9 * Author: Linus Walleij <linus.walleij@stericsson.com>
10 */
11#include <linux/interrupt.h>
12#include <linux/time.h>
13#include <linux/timex.h>
14#include <linux/clockchips.h>
15#include <linux/clocksource.h>
16#include <linux/types.h>
17#include <linux/io.h>
18#include <linux/clk.h>
19#include <linux/err.h>
20#include <linux/irq.h>
21#include <linux/delay.h>
22#include <linux/of_address.h>
23#include <linux/of_irq.h>
24#include <linux/sched_clock.h>
25
26/* Generic stuff */
27#include <asm/mach/map.h>
28#include <asm/mach/time.h>
29
30/*
31 * APP side special timer registers
32 * This timer contains four timers which can fire an interrupt each.
33 * OS (operating system) timer @ 32768 Hz
34 * DD (device driver) timer @ 1 kHz
35 * GP1 (general purpose 1) timer @ 1MHz
36 * GP2 (general purpose 2) timer @ 1MHz
37 */
38
39/* Reset OS Timer 32bit (-/W) */
40#define U300_TIMER_APP_ROST (0x0000)
41#define U300_TIMER_APP_ROST_TIMER_RESET (0x00000000)
42/* Enable OS Timer 32bit (-/W) */
43#define U300_TIMER_APP_EOST (0x0004)
44#define U300_TIMER_APP_EOST_TIMER_ENABLE (0x00000000)
45/* Disable OS Timer 32bit (-/W) */
46#define U300_TIMER_APP_DOST (0x0008)
47#define U300_TIMER_APP_DOST_TIMER_DISABLE (0x00000000)
48/* OS Timer Mode Register 32bit (-/W) */
49#define U300_TIMER_APP_SOSTM (0x000c)
50#define U300_TIMER_APP_SOSTM_MODE_CONTINUOUS (0x00000000)
51#define U300_TIMER_APP_SOSTM_MODE_ONE_SHOT (0x00000001)
52/* OS Timer Status Register 32bit (R/-) */
53#define U300_TIMER_APP_OSTS (0x0010)
54#define U300_TIMER_APP_OSTS_TIMER_STATE_MASK (0x0000000F)
55#define U300_TIMER_APP_OSTS_TIMER_STATE_IDLE (0x00000001)
56#define U300_TIMER_APP_OSTS_TIMER_STATE_ACTIVE (0x00000002)
57#define U300_TIMER_APP_OSTS_ENABLE_IND (0x00000010)
58#define U300_TIMER_APP_OSTS_MODE_MASK (0x00000020)
59#define U300_TIMER_APP_OSTS_MODE_CONTINUOUS (0x00000000)
60#define U300_TIMER_APP_OSTS_MODE_ONE_SHOT (0x00000020)
61#define U300_TIMER_APP_OSTS_IRQ_ENABLED_IND (0x00000040)
62#define U300_TIMER_APP_OSTS_IRQ_PENDING_IND (0x00000080)
63/* OS Timer Current Count Register 32bit (R/-) */
64#define U300_TIMER_APP_OSTCC (0x0014)
65/* OS Timer Terminal Count Register 32bit (R/W) */
66#define U300_TIMER_APP_OSTTC (0x0018)
67/* OS Timer Interrupt Enable Register 32bit (-/W) */
68#define U300_TIMER_APP_OSTIE (0x001c)
69#define U300_TIMER_APP_OSTIE_IRQ_DISABLE (0x00000000)
70#define U300_TIMER_APP_OSTIE_IRQ_ENABLE (0x00000001)
71/* OS Timer Interrupt Acknowledge Register 32bit (-/W) */
72#define U300_TIMER_APP_OSTIA (0x0020)
73#define U300_TIMER_APP_OSTIA_IRQ_ACK (0x00000080)
74
75/* Reset DD Timer 32bit (-/W) */
76#define U300_TIMER_APP_RDDT (0x0040)
77#define U300_TIMER_APP_RDDT_TIMER_RESET (0x00000000)
78/* Enable DD Timer 32bit (-/W) */
79#define U300_TIMER_APP_EDDT (0x0044)
80#define U300_TIMER_APP_EDDT_TIMER_ENABLE (0x00000000)
81/* Disable DD Timer 32bit (-/W) */
82#define U300_TIMER_APP_DDDT (0x0048)
83#define U300_TIMER_APP_DDDT_TIMER_DISABLE (0x00000000)
84/* DD Timer Mode Register 32bit (-/W) */
85#define U300_TIMER_APP_SDDTM (0x004c)
86#define U300_TIMER_APP_SDDTM_MODE_CONTINUOUS (0x00000000)
87#define U300_TIMER_APP_SDDTM_MODE_ONE_SHOT (0x00000001)
88/* DD Timer Status Register 32bit (R/-) */
89#define U300_TIMER_APP_DDTS (0x0050)
90#define U300_TIMER_APP_DDTS_TIMER_STATE_MASK (0x0000000F)
91#define U300_TIMER_APP_DDTS_TIMER_STATE_IDLE (0x00000001)
92#define U300_TIMER_APP_DDTS_TIMER_STATE_ACTIVE (0x00000002)
93#define U300_TIMER_APP_DDTS_ENABLE_IND (0x00000010)
94#define U300_TIMER_APP_DDTS_MODE_MASK (0x00000020)
95#define U300_TIMER_APP_DDTS_MODE_CONTINUOUS (0x00000000)
96#define U300_TIMER_APP_DDTS_MODE_ONE_SHOT (0x00000020)
97#define U300_TIMER_APP_DDTS_IRQ_ENABLED_IND (0x00000040)
98#define U300_TIMER_APP_DDTS_IRQ_PENDING_IND (0x00000080)
99/* DD Timer Current Count Register 32bit (R/-) */
100#define U300_TIMER_APP_DDTCC (0x0054)
101/* DD Timer Terminal Count Register 32bit (R/W) */
102#define U300_TIMER_APP_DDTTC (0x0058)
103/* DD Timer Interrupt Enable Register 32bit (-/W) */
104#define U300_TIMER_APP_DDTIE (0x005c)
105#define U300_TIMER_APP_DDTIE_IRQ_DISABLE (0x00000000)
106#define U300_TIMER_APP_DDTIE_IRQ_ENABLE (0x00000001)
107/* DD Timer Interrupt Acknowledge Register 32bit (-/W) */
108#define U300_TIMER_APP_DDTIA (0x0060)
109#define U300_TIMER_APP_DDTIA_IRQ_ACK (0x00000080)
110
111/* Reset GP1 Timer 32bit (-/W) */
112#define U300_TIMER_APP_RGPT1 (0x0080)
113#define U300_TIMER_APP_RGPT1_TIMER_RESET (0x00000000)
114/* Enable GP1 Timer 32bit (-/W) */
115#define U300_TIMER_APP_EGPT1 (0x0084)
116#define U300_TIMER_APP_EGPT1_TIMER_ENABLE (0x00000000)
117/* Disable GP1 Timer 32bit (-/W) */
118#define U300_TIMER_APP_DGPT1 (0x0088)
119#define U300_TIMER_APP_DGPT1_TIMER_DISABLE (0x00000000)
120/* GP1 Timer Mode Register 32bit (-/W) */
121#define U300_TIMER_APP_SGPT1M (0x008c)
122#define U300_TIMER_APP_SGPT1M_MODE_CONTINUOUS (0x00000000)
123#define U300_TIMER_APP_SGPT1M_MODE_ONE_SHOT (0x00000001)
124/* GP1 Timer Status Register 32bit (R/-) */
125#define U300_TIMER_APP_GPT1S (0x0090)
126#define U300_TIMER_APP_GPT1S_TIMER_STATE_MASK (0x0000000F)
127#define U300_TIMER_APP_GPT1S_TIMER_STATE_IDLE (0x00000001)
128#define U300_TIMER_APP_GPT1S_TIMER_STATE_ACTIVE (0x00000002)
129#define U300_TIMER_APP_GPT1S_ENABLE_IND (0x00000010)
130#define U300_TIMER_APP_GPT1S_MODE_MASK (0x00000020)
131#define U300_TIMER_APP_GPT1S_MODE_CONTINUOUS (0x00000000)
132#define U300_TIMER_APP_GPT1S_MODE_ONE_SHOT (0x00000020)
133#define U300_TIMER_APP_GPT1S_IRQ_ENABLED_IND (0x00000040)
134#define U300_TIMER_APP_GPT1S_IRQ_PENDING_IND (0x00000080)
135/* GP1 Timer Current Count Register 32bit (R/-) */
136#define U300_TIMER_APP_GPT1CC (0x0094)
137/* GP1 Timer Terminal Count Register 32bit (R/W) */
138#define U300_TIMER_APP_GPT1TC (0x0098)
139/* GP1 Timer Interrupt Enable Register 32bit (-/W) */
140#define U300_TIMER_APP_GPT1IE (0x009c)
141#define U300_TIMER_APP_GPT1IE_IRQ_DISABLE (0x00000000)
142#define U300_TIMER_APP_GPT1IE_IRQ_ENABLE (0x00000001)
143/* GP1 Timer Interrupt Acknowledge Register 32bit (-/W) */
144#define U300_TIMER_APP_GPT1IA (0x00a0)
145#define U300_TIMER_APP_GPT1IA_IRQ_ACK (0x00000080)
146
147/* Reset GP2 Timer 32bit (-/W) */
148#define U300_TIMER_APP_RGPT2 (0x00c0)
149#define U300_TIMER_APP_RGPT2_TIMER_RESET (0x00000000)
150/* Enable GP2 Timer 32bit (-/W) */
151#define U300_TIMER_APP_EGPT2 (0x00c4)
152#define U300_TIMER_APP_EGPT2_TIMER_ENABLE (0x00000000)
153/* Disable GP2 Timer 32bit (-/W) */
154#define U300_TIMER_APP_DGPT2 (0x00c8)
155#define U300_TIMER_APP_DGPT2_TIMER_DISABLE (0x00000000)
156/* GP2 Timer Mode Register 32bit (-/W) */
157#define U300_TIMER_APP_SGPT2M (0x00cc)
158#define U300_TIMER_APP_SGPT2M_MODE_CONTINUOUS (0x00000000)
159#define U300_TIMER_APP_SGPT2M_MODE_ONE_SHOT (0x00000001)
160/* GP2 Timer Status Register 32bit (R/-) */
161#define U300_TIMER_APP_GPT2S (0x00d0)
162#define U300_TIMER_APP_GPT2S_TIMER_STATE_MASK (0x0000000F)
163#define U300_TIMER_APP_GPT2S_TIMER_STATE_IDLE (0x00000001)
164#define U300_TIMER_APP_GPT2S_TIMER_STATE_ACTIVE (0x00000002)
165#define U300_TIMER_APP_GPT2S_ENABLE_IND (0x00000010)
166#define U300_TIMER_APP_GPT2S_MODE_MASK (0x00000020)
167#define U300_TIMER_APP_GPT2S_MODE_CONTINUOUS (0x00000000)
168#define U300_TIMER_APP_GPT2S_MODE_ONE_SHOT (0x00000020)
169#define U300_TIMER_APP_GPT2S_IRQ_ENABLED_IND (0x00000040)
170#define U300_TIMER_APP_GPT2S_IRQ_PENDING_IND (0x00000080)
171/* GP2 Timer Current Count Register 32bit (R/-) */
172#define U300_TIMER_APP_GPT2CC (0x00d4)
173/* GP2 Timer Terminal Count Register 32bit (R/W) */
174#define U300_TIMER_APP_GPT2TC (0x00d8)
175/* GP2 Timer Interrupt Enable Register 32bit (-/W) */
176#define U300_TIMER_APP_GPT2IE (0x00dc)
177#define U300_TIMER_APP_GPT2IE_IRQ_DISABLE (0x00000000)
178#define U300_TIMER_APP_GPT2IE_IRQ_ENABLE (0x00000001)
179/* GP2 Timer Interrupt Acknowledge Register 32bit (-/W) */
180#define U300_TIMER_APP_GPT2IA (0x00e0)
181#define U300_TIMER_APP_GPT2IA_IRQ_ACK (0x00000080)
182
183/* Clock request control register - all four timers */
184#define U300_TIMER_APP_CRC (0x100)
185#define U300_TIMER_APP_CRC_CLOCK_REQUEST_ENABLE (0x00000001)
186
187static void __iomem *u300_timer_base;
188
189struct u300_clockevent_data {
190 struct clock_event_device cevd;
191 unsigned ticks_per_jiffy;
192};
193
194/*
195 * The u300_set_mode() function is always called first, if we
196 * have oneshot timer active, the oneshot scheduling function
197 * u300_set_next_event() is called immediately after.
198 */
199static void u300_set_mode(enum clock_event_mode mode,
200 struct clock_event_device *evt)
201{
202 struct u300_clockevent_data *cevdata =
203 container_of(evt, struct u300_clockevent_data, cevd);
204
205 switch (mode) {
206 case CLOCK_EVT_MODE_PERIODIC:
207 /* Disable interrupts on GPT1 */
208 writel(U300_TIMER_APP_GPT1IE_IRQ_DISABLE,
209 u300_timer_base + U300_TIMER_APP_GPT1IE);
210 /* Disable GP1 while we're reprogramming it. */
211 writel(U300_TIMER_APP_DGPT1_TIMER_DISABLE,
212 u300_timer_base + U300_TIMER_APP_DGPT1);
213 /*
214 * Set the periodic mode to a certain number of ticks per
215 * jiffy.
216 */
217 writel(cevdata->ticks_per_jiffy,
218 u300_timer_base + U300_TIMER_APP_GPT1TC);
219 /*
220 * Set continuous mode, so the timer keeps triggering
221 * interrupts.
222 */
223 writel(U300_TIMER_APP_SGPT1M_MODE_CONTINUOUS,
224 u300_timer_base + U300_TIMER_APP_SGPT1M);
225 /* Enable timer interrupts */
226 writel(U300_TIMER_APP_GPT1IE_IRQ_ENABLE,
227 u300_timer_base + U300_TIMER_APP_GPT1IE);
228 /* Then enable the OS timer again */
229 writel(U300_TIMER_APP_EGPT1_TIMER_ENABLE,
230 u300_timer_base + U300_TIMER_APP_EGPT1);
231 break;
232 case CLOCK_EVT_MODE_ONESHOT:
233 /* Just break; here? */
234 /*
235 * The actual event will be programmed by the next event hook,
236 * so we just set a dummy value somewhere at the end of the
237 * universe here.
238 */
239 /* Disable interrupts on GPT1 */
240 writel(U300_TIMER_APP_GPT1IE_IRQ_DISABLE,
241 u300_timer_base + U300_TIMER_APP_GPT1IE);
242 /* Disable GP1 while we're reprogramming it. */
243 writel(U300_TIMER_APP_DGPT1_TIMER_DISABLE,
244 u300_timer_base + U300_TIMER_APP_DGPT1);
245 /*
246 * Expire far in the future, u300_set_next_event() will be
247 * called soon...
248 */
249 writel(0xFFFFFFFF, u300_timer_base + U300_TIMER_APP_GPT1TC);
250 /* We run one shot per tick here! */
251 writel(U300_TIMER_APP_SGPT1M_MODE_ONE_SHOT,
252 u300_timer_base + U300_TIMER_APP_SGPT1M);
253 /* Enable interrupts for this timer */
254 writel(U300_TIMER_APP_GPT1IE_IRQ_ENABLE,
255 u300_timer_base + U300_TIMER_APP_GPT1IE);
256 /* Enable timer */
257 writel(U300_TIMER_APP_EGPT1_TIMER_ENABLE,
258 u300_timer_base + U300_TIMER_APP_EGPT1);
259 break;
260 case CLOCK_EVT_MODE_UNUSED:
261 case CLOCK_EVT_MODE_SHUTDOWN:
262 /* Disable interrupts on GP1 */
263 writel(U300_TIMER_APP_GPT1IE_IRQ_DISABLE,
264 u300_timer_base + U300_TIMER_APP_GPT1IE);
265 /* Disable GP1 */
266 writel(U300_TIMER_APP_DGPT1_TIMER_DISABLE,
267 u300_timer_base + U300_TIMER_APP_DGPT1);
268 break;
269 case CLOCK_EVT_MODE_RESUME:
270 /* Ignore this call */
271 break;
272 }
273}
274
275/*
276 * The app timer in one shot mode obviously has to be reprogrammed
277 * in EXACTLY this sequence to work properly. Do NOT try to e.g. replace
278 * the interrupt disable + timer disable commands with a reset command,
279 * it will fail miserably. Apparently (and I found this the hard way)
280 * the timer is very sensitive to the instruction order, though you don't
281 * get that impression from the data sheet.
282 */
283static int u300_set_next_event(unsigned long cycles,
284 struct clock_event_device *evt)
285
286{
287 /* Disable interrupts on GPT1 */
288 writel(U300_TIMER_APP_GPT1IE_IRQ_DISABLE,
289 u300_timer_base + U300_TIMER_APP_GPT1IE);
290 /* Disable GP1 while we're reprogramming it. */
291 writel(U300_TIMER_APP_DGPT1_TIMER_DISABLE,
292 u300_timer_base + U300_TIMER_APP_DGPT1);
293 /* Reset the General Purpose timer 1. */
294 writel(U300_TIMER_APP_RGPT1_TIMER_RESET,
295 u300_timer_base + U300_TIMER_APP_RGPT1);
296 /* IRQ in n * cycles */
297 writel(cycles, u300_timer_base + U300_TIMER_APP_GPT1TC);
298 /*
299 * We run one shot per tick here! (This is necessary to reconfigure,
300 * the timer will tilt if you don't!)
301 */
302 writel(U300_TIMER_APP_SGPT1M_MODE_ONE_SHOT,
303 u300_timer_base + U300_TIMER_APP_SGPT1M);
304 /* Enable timer interrupts */
305 writel(U300_TIMER_APP_GPT1IE_IRQ_ENABLE,
306 u300_timer_base + U300_TIMER_APP_GPT1IE);
307 /* Then enable the OS timer again */
308 writel(U300_TIMER_APP_EGPT1_TIMER_ENABLE,
309 u300_timer_base + U300_TIMER_APP_EGPT1);
310 return 0;
311}
312
313static struct u300_clockevent_data u300_clockevent_data = {
314 /* Use general purpose timer 1 as clock event */
315 .cevd = {
316 .name = "GPT1",
317 /* Reasonably fast and accurate clock event */
318 .rating = 300,
319 .features = CLOCK_EVT_FEAT_PERIODIC |
320 CLOCK_EVT_FEAT_ONESHOT,
321 .set_next_event = u300_set_next_event,
322 .set_mode = u300_set_mode,
323 },
324};
325
326/* Clock event timer interrupt handler */
327static irqreturn_t u300_timer_interrupt(int irq, void *dev_id)
328{
329 struct clock_event_device *evt = &u300_clockevent_data.cevd;
330 /* ACK/Clear timer IRQ for the APP GPT1 Timer */
331
332 writel(U300_TIMER_APP_GPT1IA_IRQ_ACK,
333 u300_timer_base + U300_TIMER_APP_GPT1IA);
334 evt->event_handler(evt);
335 return IRQ_HANDLED;
336}
337
338static struct irqaction u300_timer_irq = {
339 .name = "U300 Timer Tick",
340 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
341 .handler = u300_timer_interrupt,
342};
343
344/*
345 * Override the global weak sched_clock symbol with this
346 * local implementation which uses the clocksource to get some
347 * better resolution when scheduling the kernel. We accept that
348 * this wraps around for now, since it is just a relative time
349 * stamp. (Inspired by OMAP implementation.)
350 */
351
352static u64 notrace u300_read_sched_clock(void)
353{
354 return readl(u300_timer_base + U300_TIMER_APP_GPT2CC);
355}
356
357static unsigned long u300_read_current_timer(void)
358{
359 return readl(u300_timer_base + U300_TIMER_APP_GPT2CC);
360}
361
362static struct delay_timer u300_delay_timer;
363
364/*
365 * This sets up the system timers, clock source and clock event.
366 */
367static void __init u300_timer_init_of(struct device_node *np)
368{
369 unsigned int irq;
370 struct clk *clk;
371 unsigned long rate;
372
373 u300_timer_base = of_iomap(np, 0);
374 if (!u300_timer_base)
375 panic("could not ioremap system timer\n");
376
377 /* Get the IRQ for the GP1 timer */
378 irq = irq_of_parse_and_map(np, 2);
379 if (!irq)
380 panic("no IRQ for system timer\n");
381
382 pr_info("U300 GP1 timer @ base: %p, IRQ: %u\n", u300_timer_base, irq);
383
384 /* Clock the interrupt controller */
385 clk = of_clk_get(np, 0);
386 BUG_ON(IS_ERR(clk));
387 clk_prepare_enable(clk);
388 rate = clk_get_rate(clk);
389
390 u300_clockevent_data.ticks_per_jiffy = DIV_ROUND_CLOSEST(rate, HZ);
391
392 sched_clock_register(u300_read_sched_clock, 32, rate);
393
394 u300_delay_timer.read_current_timer = &u300_read_current_timer;
395 u300_delay_timer.freq = rate;
396 register_current_timer_delay(&u300_delay_timer);
397
398 /*
399 * Disable the "OS" and "DD" timers - these are designed for Symbian!
400 * Example usage in cnh1601578 cpu subsystem pd_timer_app.c
401 */
402 writel(U300_TIMER_APP_CRC_CLOCK_REQUEST_ENABLE,
403 u300_timer_base + U300_TIMER_APP_CRC);
404 writel(U300_TIMER_APP_ROST_TIMER_RESET,
405 u300_timer_base + U300_TIMER_APP_ROST);
406 writel(U300_TIMER_APP_DOST_TIMER_DISABLE,
407 u300_timer_base + U300_TIMER_APP_DOST);
408 writel(U300_TIMER_APP_RDDT_TIMER_RESET,
409 u300_timer_base + U300_TIMER_APP_RDDT);
410 writel(U300_TIMER_APP_DDDT_TIMER_DISABLE,
411 u300_timer_base + U300_TIMER_APP_DDDT);
412
413 /* Reset the General Purpose timer 1. */
414 writel(U300_TIMER_APP_RGPT1_TIMER_RESET,
415 u300_timer_base + U300_TIMER_APP_RGPT1);
416
417 /* Set up the IRQ handler */
418 setup_irq(irq, &u300_timer_irq);
419
420 /* Reset the General Purpose timer 2 */
421 writel(U300_TIMER_APP_RGPT2_TIMER_RESET,
422 u300_timer_base + U300_TIMER_APP_RGPT2);
423 /* Set this timer to run around forever */
424 writel(0xFFFFFFFFU, u300_timer_base + U300_TIMER_APP_GPT2TC);
425 /* Set continuous mode so it wraps around */
426 writel(U300_TIMER_APP_SGPT2M_MODE_CONTINUOUS,
427 u300_timer_base + U300_TIMER_APP_SGPT2M);
428 /* Disable timer interrupts */
429 writel(U300_TIMER_APP_GPT2IE_IRQ_DISABLE,
430 u300_timer_base + U300_TIMER_APP_GPT2IE);
431 /* Then enable the GP2 timer to use as a free running us counter */
432 writel(U300_TIMER_APP_EGPT2_TIMER_ENABLE,
433 u300_timer_base + U300_TIMER_APP_EGPT2);
434
435 /* Use general purpose timer 2 as clock source */
436 if (clocksource_mmio_init(u300_timer_base + U300_TIMER_APP_GPT2CC,
437 "GPT2", rate, 300, 32, clocksource_mmio_readl_up))
438 pr_err("timer: failed to initialize U300 clock source\n");
439
440 /* Configure and register the clockevent */
441 clockevents_config_and_register(&u300_clockevent_data.cevd, rate,
442 1, 0xffffffff);
443
444 /*
445 * TODO: init and register the rest of the timers too, they can be
446 * used by hrtimers!
447 */
448}
449
450CLOCKSOURCE_OF_DECLARE(u300_timer, "stericsson,u300-apptimer",
451 u300_timer_init_of);
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/arm/mm/dump.c b/arch/arm/mm/dump.c
index 2b3a56414271..ef69152f9b52 100644
--- a/arch/arm/mm/dump.c
+++ b/arch/arm/mm/dump.c
@@ -264,6 +264,9 @@ static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start)
264 note_page(st, addr, 3, pmd_val(*pmd)); 264 note_page(st, addr, 3, pmd_val(*pmd));
265 else 265 else
266 walk_pte(st, pmd, addr); 266 walk_pte(st, pmd, addr);
267
268 if (SECTION_SIZE < PMD_SIZE && pmd_large(pmd[1]))
269 note_page(st, addr + SECTION_SIZE, 3, pmd_val(pmd[1]));
267 } 270 }
268} 271}
269 272
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 27bbcfc7202a..07aa3556952c 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,16 @@ menu "CPU Power Management"
301 321
302source "drivers/cpuidle/Kconfig" 322source "drivers/cpuidle/Kconfig"
303 323
324source "drivers/cpufreq/Kconfig"
325
326endmenu
327
328menu "Power management options"
329
330source "kernel/power/Kconfig"
331
332source "drivers/cpufreq/Kconfig"
333
304endmenu 334endmenu
305 335
306source "net/Kconfig" 336source "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 71c53ecfcc3a..4bca4923fc0b 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -12,6 +12,7 @@ generic-y += dma.h
12generic-y += emergency-restart.h 12generic-y += emergency-restart.h
13generic-y += errno.h 13generic-y += errno.h
14generic-y += ftrace.h 14generic-y += ftrace.h
15generic-y += hash.h
15generic-y += hw_irq.h 16generic-y += hw_irq.h
16generic-y += ioctl.h 17generic-y += ioctl.h
17generic-y += ioctls.h 18generic-y += ioctls.h
@@ -22,13 +23,16 @@ generic-y += kmap_types.h
22generic-y += kvm_para.h 23generic-y += kvm_para.h
23generic-y += local.h 24generic-y += local.h
24generic-y += local64.h 25generic-y += local64.h
26generic-y += mcs_spinlock.h
25generic-y += mman.h 27generic-y += mman.h
26generic-y += msgbuf.h 28generic-y += msgbuf.h
27generic-y += mutex.h 29generic-y += mutex.h
28generic-y += pci.h 30generic-y += pci.h
29generic-y += poll.h 31generic-y += poll.h
30generic-y += posix_types.h 32generic-y += posix_types.h
33generic-y += preempt.h
31generic-y += resource.h 34generic-y += resource.h
35generic-y += rwsem.h
32generic-y += scatterlist.h 36generic-y += scatterlist.h
33generic-y += sections.h 37generic-y += sections.h
34generic-y += segment.h 38generic-y += segment.h
@@ -38,8 +42,8 @@ generic-y += shmbuf.h
38generic-y += sizes.h 42generic-y += sizes.h
39generic-y += socket.h 43generic-y += socket.h
40generic-y += sockios.h 44generic-y += sockios.h
41generic-y += switch_to.h
42generic-y += swab.h 45generic-y += swab.h
46generic-y += switch_to.h
43generic-y += termbits.h 47generic-y += termbits.h
44generic-y += termios.h 48generic-y += termios.h
45generic-y += topology.h 49generic-y += topology.h
@@ -49,5 +53,3 @@ generic-y += unaligned.h
49generic-y += user.h 53generic-y += user.h
50generic-y += vga.h 54generic-y += vga.h
51generic-y += xor.h 55generic-y += xor.h
52generic-y += preempt.h
53generic-y += hash.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 1c0a9be2ffa8..6391485f342d 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -33,7 +33,6 @@
33#include <linux/kallsyms.h> 33#include <linux/kallsyms.h>
34#include <linux/init.h> 34#include <linux/init.h>
35#include <linux/cpu.h> 35#include <linux/cpu.h>
36#include <linux/cpuidle.h>
37#include <linux/elfcore.h> 36#include <linux/elfcore.h>
38#include <linux/pm.h> 37#include <linux/pm.h>
39#include <linux/tick.h> 38#include <linux/tick.h>
@@ -72,8 +71,17 @@ static void setup_restart(void)
72 71
73void soft_restart(unsigned long addr) 72void soft_restart(unsigned long addr)
74{ 73{
74 typedef void (*phys_reset_t)(unsigned long);
75 phys_reset_t phys_reset;
76
75 setup_restart(); 77 setup_restart();
76 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();
77} 85}
78 86
79/* 87/*
@@ -94,10 +102,8 @@ void arch_cpu_idle(void)
94 * This should do all the clock switching and wait for interrupt 102 * This should do all the clock switching and wait for interrupt
95 * tricks 103 * tricks
96 */ 104 */
97 if (cpuidle_idle_call()) { 105 cpu_do_idle();
98 cpu_do_idle(); 106 local_irq_enable();
99 local_irq_enable();
100 }
101} 107}
102 108
103#ifdef CONFIG_HOTPLUG_CPU 109#ifdef CONFIG_HOTPLUG_CPU
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/boards/mimc200/Makefile b/arch/avr32/boards/mimc200/Makefile
index 79c076e168a8..c740aa116755 100644
--- a/arch/avr32/boards/mimc200/Makefile
+++ b/arch/avr32/boards/mimc200/Makefile
@@ -1 +1 @@
obj-y += setup.o flash.o fram.o obj-y += setup.o flash.o
diff --git a/arch/avr32/boards/mimc200/fram.c b/arch/avr32/boards/mimc200/fram.c
deleted file mode 100644
index c1466a872b9c..000000000000
--- a/arch/avr32/boards/mimc200/fram.c
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2 * FRAM driver for MIMC200 board
3 *
4 * Copyright 2008 Mark Jackson <mpfj@mimc.co.uk>
5 *
6 * This module adds *very* simply support for the system's FRAM device.
7 * At the moment, this is hard-coded to the MIMC200 platform, and only
8 * supports mmap().
9 */
10
11#define FRAM_VERSION "1.0"
12
13#include <linux/miscdevice.h>
14#include <linux/module.h>
15#include <linux/proc_fs.h>
16#include <linux/mm.h>
17#include <linux/io.h>
18
19#define FRAM_BASE 0xac000000
20#define FRAM_SIZE 0x20000
21
22/*
23 * The are the file operation function for user access to /dev/fram
24 */
25
26static int fram_mmap(struct file *filp, struct vm_area_struct *vma)
27{
28 int ret;
29
30 ret = remap_pfn_range(vma,
31 vma->vm_start,
32 virt_to_phys((void *)((unsigned long)FRAM_BASE)) >> PAGE_SHIFT,
33 vma->vm_end-vma->vm_start,
34 PAGE_SHARED);
35
36 if (ret != 0)
37 return -EAGAIN;
38
39 return 0;
40}
41
42static const struct file_operations fram_fops = {
43 .owner = THIS_MODULE,
44 .mmap = fram_mmap,
45 .llseek = noop_llseek,
46};
47
48#define FRAM_MINOR 0
49
50static struct miscdevice fram_dev = {
51 FRAM_MINOR,
52 "fram",
53 &fram_fops
54};
55
56static int __init
57fram_init(void)
58{
59 int ret;
60
61 ret = misc_register(&fram_dev);
62 if (ret) {
63 printk(KERN_ERR "fram: can't misc_register on minor=%d\n",
64 FRAM_MINOR);
65 return ret;
66 }
67 printk(KERN_INFO "FRAM memory driver v" FRAM_VERSION "\n");
68 return 0;
69}
70
71static void __exit
72fram_cleanup_module(void)
73{
74 misc_deregister(&fram_dev);
75}
76
77module_init(fram_init);
78module_exit(fram_cleanup_module);
79
80MODULE_LICENSE("GPL");
81
82MODULE_ALIAS_MISCDEV(FRAM_MINOR);
diff --git a/arch/avr32/include/asm/Kbuild b/arch/avr32/include/asm/Kbuild
index c7c64a63c29f..00a0f3ccd6eb 100644
--- a/arch/avr32/include/asm/Kbuild
+++ b/arch/avr32/include/asm/Kbuild
@@ -1,22 +1,23 @@
1 1
2generic-y += clkdev.h 2generic-y += clkdev.h
3generic-y += cputime.h 3generic-y += cputime.h
4generic-y += delay.h 4generic-y += delay.h
5generic-y += device.h 5generic-y += device.h
6generic-y += div64.h 6generic-y += div64.h
7generic-y += emergency-restart.h 7generic-y += emergency-restart.h
8generic-y += exec.h 8generic-y += exec.h
9generic-y += futex.h 9generic-y += futex.h
10generic-y += preempt.h 10generic-y += hash.h
11generic-y += irq_regs.h 11generic-y += irq_regs.h
12generic-y += param.h 12generic-y += local.h
13generic-y += local.h 13generic-y += local64.h
14generic-y += local64.h 14generic-y += mcs_spinlock.h
15generic-y += percpu.h 15generic-y += param.h
16generic-y += scatterlist.h 16generic-y += percpu.h
17generic-y += sections.h 17generic-y += preempt.h
18generic-y += topology.h 18generic-y += scatterlist.h
19generic-y += trace_clock.h 19generic-y += sections.h
20generic-y += topology.h
21generic-y += trace_clock.h
20generic-y += vga.h 22generic-y += vga.h
21generic-y += xor.h 23generic-y += xor.h
22generic-y += hash.h
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/blackfin/include/asm/Kbuild b/arch/blackfin/include/asm/Kbuild
index 359d36fdc247..0d93b9a79ca9 100644
--- a/arch/blackfin/include/asm/Kbuild
+++ b/arch/blackfin/include/asm/Kbuild
@@ -10,6 +10,7 @@ generic-y += emergency-restart.h
10generic-y += errno.h 10generic-y += errno.h
11generic-y += fb.h 11generic-y += fb.h
12generic-y += futex.h 12generic-y += futex.h
13generic-y += hash.h
13generic-y += hw_irq.h 14generic-y += hw_irq.h
14generic-y += ioctl.h 15generic-y += ioctl.h
15generic-y += ipcbuf.h 16generic-y += ipcbuf.h
@@ -17,14 +18,16 @@ generic-y += irq_regs.h
17generic-y += kdebug.h 18generic-y += kdebug.h
18generic-y += kmap_types.h 19generic-y += kmap_types.h
19generic-y += kvm_para.h 20generic-y += kvm_para.h
20generic-y += local64.h
21generic-y += local.h 21generic-y += local.h
22generic-y += local64.h
23generic-y += mcs_spinlock.h
22generic-y += mman.h 24generic-y += mman.h
23generic-y += msgbuf.h 25generic-y += msgbuf.h
24generic-y += mutex.h 26generic-y += mutex.h
25generic-y += param.h 27generic-y += param.h
26generic-y += percpu.h 28generic-y += percpu.h
27generic-y += pgalloc.h 29generic-y += pgalloc.h
30generic-y += preempt.h
28generic-y += resource.h 31generic-y += resource.h
29generic-y += scatterlist.h 32generic-y += scatterlist.h
30generic-y += sembuf.h 33generic-y += sembuf.h
@@ -44,5 +47,3 @@ generic-y += ucontext.h
44generic-y += unaligned.h 47generic-y += unaligned.h
45generic-y += user.h 48generic-y += user.h
46generic-y += xor.h 49generic-y += xor.h
47generic-y += preempt.h
48generic-y += hash.h
diff --git a/arch/blackfin/include/asm/irq.h b/arch/blackfin/include/asm/irq.h
index 2fd04f10cc26..89de539ed010 100644
--- a/arch/blackfin/include/asm/irq.h
+++ b/arch/blackfin/include/asm/irq.h
@@ -20,15 +20,6 @@
20/* SYS_IRQS and NR_IRQS are defined in <mach-bf5xx/irq.h> */ 20/* SYS_IRQS and NR_IRQS are defined in <mach-bf5xx/irq.h> */
21#include <mach/irq.h> 21#include <mach/irq.h>
22 22
23/*
24 * pm save bfin pint registers
25 */
26struct adi_pm_pint_save {
27 u32 assign;
28 u32 edge_set;
29 u32 invert_set;
30};
31
32#if ANOMALY_05000244 && defined(CONFIG_BFIN_ICACHE) 23#if ANOMALY_05000244 && defined(CONFIG_BFIN_ICACHE)
33# define NOP_PAD_ANOMALY_05000244 "nop; nop;" 24# define NOP_PAD_ANOMALY_05000244 "nop; nop;"
34#else 25#else
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild
index d73bb85ccdd3..8dbdce8421b0 100644
--- a/arch/c6x/include/asm/Kbuild
+++ b/arch/c6x/include/asm/Kbuild
@@ -15,6 +15,7 @@ generic-y += exec.h
15generic-y += fb.h 15generic-y += fb.h
16generic-y += fcntl.h 16generic-y += fcntl.h
17generic-y += futex.h 17generic-y += futex.h
18generic-y += hash.h
18generic-y += hw_irq.h 19generic-y += hw_irq.h
19generic-y += io.h 20generic-y += io.h
20generic-y += ioctl.h 21generic-y += ioctl.h
@@ -24,6 +25,7 @@ generic-y += irq_regs.h
24generic-y += kdebug.h 25generic-y += kdebug.h
25generic-y += kmap_types.h 26generic-y += kmap_types.h
26generic-y += local.h 27generic-y += local.h
28generic-y += mcs_spinlock.h
27generic-y += mman.h 29generic-y += mman.h
28generic-y += mmu.h 30generic-y += mmu.h
29generic-y += mmu_context.h 31generic-y += mmu_context.h
@@ -34,6 +36,7 @@ generic-y += percpu.h
34generic-y += pgalloc.h 36generic-y += pgalloc.h
35generic-y += poll.h 37generic-y += poll.h
36generic-y += posix_types.h 38generic-y += posix_types.h
39generic-y += preempt.h
37generic-y += resource.h 40generic-y += resource.h
38generic-y += scatterlist.h 41generic-y += scatterlist.h
39generic-y += segment.h 42generic-y += segment.h
@@ -56,5 +59,3 @@ generic-y += ucontext.h
56generic-y += user.h 59generic-y += user.h
57generic-y += vga.h 60generic-y += vga.h
58generic-y += xor.h 61generic-y += xor.h
59generic-y += preempt.h
60generic-y += hash.h
diff --git a/arch/c6x/include/asm/cache.h b/arch/c6x/include/asm/cache.h
index 09c5a0f5f4d1..86648c083bb4 100644
--- a/arch/c6x/include/asm/cache.h
+++ b/arch/c6x/include/asm/cache.h
@@ -12,6 +12,7 @@
12#define _ASM_C6X_CACHE_H 12#define _ASM_C6X_CACHE_H
13 13
14#include <linux/irqflags.h> 14#include <linux/irqflags.h>
15#include <linux/init.h>
15 16
16/* 17/*
17 * Cache line size 18 * Cache line size
diff --git a/arch/cris/include/asm/Kbuild b/arch/cris/include/asm/Kbuild
index f3fd8768f095..afff5105909d 100644
--- a/arch/cris/include/asm/Kbuild
+++ b/arch/cris/include/asm/Kbuild
@@ -5,12 +5,14 @@ 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
11generic-y += linkage.h 12generic-y += linkage.h
13generic-y += mcs_spinlock.h
12generic-y += module.h 14generic-y += module.h
15generic-y += preempt.h
13generic-y += trace_clock.h 16generic-y += trace_clock.h
14generic-y += vga.h 17generic-y += vga.h
15generic-y += xor.h 18generic-y += xor.h
16generic-y += preempt.h
diff --git a/arch/cris/include/asm/bitops.h b/arch/cris/include/asm/bitops.h
index 184066ceb1f6..053c17b36559 100644
--- a/arch/cris/include/asm/bitops.h
+++ b/arch/cris/include/asm/bitops.h
@@ -144,7 +144,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
144 * definition, which doesn't have the same semantics. We don't want to 144 * definition, which doesn't have the same semantics. We don't want to
145 * use -fno-builtin, so just hide the name ffs. 145 * use -fno-builtin, so just hide the name ffs.
146 */ 146 */
147#define ffs kernel_ffs 147#define ffs(x) kernel_ffs(x)
148 148
149#include <asm-generic/bitops/fls.h> 149#include <asm-generic/bitops/fls.h>
150#include <asm-generic/bitops/__fls.h> 150#include <asm-generic/bitops/__fls.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 bc42f14c9c2e..87b95eb8aee5 100644
--- a/arch/frv/include/asm/Kbuild
+++ b/arch/frv/include/asm/Kbuild
@@ -1,6 +1,8 @@
1 1
2generic-y += clkdev.h 2generic-y += clkdev.h
3generic-y += cputime.h
3generic-y += exec.h 4generic-y += exec.h
4generic-y += trace_clock.h
5generic-y += preempt.h
6generic-y += hash.h 5generic-y += hash.h
6generic-y += mcs_spinlock.h
7generic-y += preempt.h
8generic-y += trace_clock.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/frv/mb93090-mb00/pci-frv.c b/arch/frv/mb93090-mb00/pci-frv.c
index c28121765448..67b1d1685759 100644
--- a/arch/frv/mb93090-mb00/pci-frv.c
+++ b/arch/frv/mb93090-mb00/pci-frv.c
@@ -88,7 +88,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
88 88
89 /* Depth-First Search on bus tree */ 89 /* Depth-First Search on bus tree */
90 for (ln=bus_list->next; ln != bus_list; ln=ln->next) { 90 for (ln=bus_list->next; ln != bus_list; ln=ln->next) {
91 bus = pci_bus_b(ln); 91 bus = list_entry(ln, struct pci_bus, node);
92 if ((dev = bus->self)) { 92 if ((dev = bus->self)) {
93 for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) { 93 for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {
94 r = &dev->resource[idx]; 94 r = &dev->resource[idx];
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild
index 38ca45d3df1e..eadcc118f950 100644
--- a/arch/hexagon/include/asm/Kbuild
+++ b/arch/hexagon/include/asm/Kbuild
@@ -25,14 +25,16 @@ generic-y += ipcbuf.h
25generic-y += irq_regs.h 25generic-y += irq_regs.h
26generic-y += kdebug.h 26generic-y += kdebug.h
27generic-y += kmap_types.h 27generic-y += kmap_types.h
28generic-y += local64.h
29generic-y += local.h 28generic-y += local.h
29generic-y += local64.h
30generic-y += mcs_spinlock.h
30generic-y += mman.h 31generic-y += mman.h
31generic-y += msgbuf.h 32generic-y += msgbuf.h
32generic-y += pci.h 33generic-y += pci.h
33generic-y += percpu.h 34generic-y += percpu.h
34generic-y += poll.h 35generic-y += poll.h
35generic-y += posix_types.h 36generic-y += posix_types.h
37generic-y += preempt.h
36generic-y += resource.h 38generic-y += resource.h
37generic-y += rwsem.h 39generic-y += rwsem.h
38generic-y += scatterlist.h 40generic-y += scatterlist.h
@@ -45,8 +47,8 @@ generic-y += siginfo.h
45generic-y += sizes.h 47generic-y += sizes.h
46generic-y += socket.h 48generic-y += socket.h
47generic-y += sockios.h 49generic-y += sockios.h
48generic-y += statfs.h
49generic-y += stat.h 50generic-y += stat.h
51generic-y += statfs.h
50generic-y += termbits.h 52generic-y += termbits.h
51generic-y += termios.h 53generic-y += termios.h
52generic-y += topology.h 54generic-y += topology.h
@@ -55,4 +57,3 @@ generic-y += types.h
55generic-y += ucontext.h 57generic-y += ucontext.h
56generic-y += unaligned.h 58generic-y += unaligned.h
57generic-y += xor.h 59generic-y += xor.h
58generic-y += preempt.h
diff --git a/arch/ia64/configs/generic_defconfig b/arch/ia64/configs/generic_defconfig
index efbd2929aeb7..b4efaf2bc13e 100644
--- a/arch/ia64/configs/generic_defconfig
+++ b/arch/ia64/configs/generic_defconfig
@@ -25,14 +25,13 @@ CONFIG_KEXEC=y
25CONFIG_CRASH_DUMP=y 25CONFIG_CRASH_DUMP=y
26CONFIG_EFI_VARS=y 26CONFIG_EFI_VARS=y
27CONFIG_BINFMT_MISC=m 27CONFIG_BINFMT_MISC=m
28CONFIG_ACPI_PROCFS=y
29CONFIG_ACPI_BUTTON=m 28CONFIG_ACPI_BUTTON=m
30CONFIG_ACPI_FAN=m 29CONFIG_ACPI_FAN=m
31CONFIG_ACPI_DOCK=y 30CONFIG_ACPI_DOCK=y
32CONFIG_ACPI_PROCESSOR=m 31CONFIG_ACPI_PROCESSOR=m
33CONFIG_ACPI_CONTAINER=m 32CONFIG_ACPI_CONTAINER=y
34CONFIG_HOTPLUG_PCI=y 33CONFIG_HOTPLUG_PCI=y
35CONFIG_HOTPLUG_PCI_ACPI=m 34CONFIG_HOTPLUG_PCI_ACPI=y
36CONFIG_PACKET=y 35CONFIG_PACKET=y
37CONFIG_UNIX=y 36CONFIG_UNIX=y
38CONFIG_INET=y 37CONFIG_INET=y
diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig
index 0f4e9e41f130..0fed9ae5a42a 100644
--- a/arch/ia64/configs/tiger_defconfig
+++ b/arch/ia64/configs/tiger_defconfig
@@ -26,7 +26,6 @@ CONFIG_IA64_PALINFO=y
26CONFIG_KEXEC=y 26CONFIG_KEXEC=y
27CONFIG_EFI_VARS=y 27CONFIG_EFI_VARS=y
28CONFIG_BINFMT_MISC=m 28CONFIG_BINFMT_MISC=m
29CONFIG_ACPI_PROCFS=y
30CONFIG_ACPI_BUTTON=m 29CONFIG_ACPI_BUTTON=m
31CONFIG_ACPI_FAN=m 30CONFIG_ACPI_FAN=m
32CONFIG_ACPI_PROCESSOR=m 31CONFIG_ACPI_PROCESSOR=m
diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig
index fc7aba07c2b4..54bc72eda30d 100644
--- a/arch/ia64/configs/zx1_defconfig
+++ b/arch/ia64/configs/zx1_defconfig
@@ -16,7 +16,6 @@ CONFIG_IA64_PALINFO=y
16CONFIG_CRASH_DUMP=y 16CONFIG_CRASH_DUMP=y
17CONFIG_EFI_VARS=y 17CONFIG_EFI_VARS=y
18CONFIG_BINFMT_MISC=y 18CONFIG_BINFMT_MISC=y
19CONFIG_ACPI_PROCFS=y
20CONFIG_HOTPLUG_PCI=y 19CONFIG_HOTPLUG_PCI=y
21CONFIG_HOTPLUG_PCI_ACPI=y 20CONFIG_HOTPLUG_PCI_ACPI=y
22CONFIG_PACKET=y 21CONFIG_PACKET=y
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 8e858b593e4f..1a871b78e570 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -1140,11 +1140,13 @@ sba_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
1140 1140
1141#ifdef CONFIG_NUMA 1141#ifdef CONFIG_NUMA
1142 { 1142 {
1143 int node = ioc->node;
1143 struct page *page; 1144 struct page *page;
1144 page = alloc_pages_exact_node(ioc->node == MAX_NUMNODES ?
1145 numa_node_id() : ioc->node, flags,
1146 get_order(size));
1147 1145
1146 if (node == NUMA_NO_NODE)
1147 node = numa_node_id();
1148
1149 page = alloc_pages_exact_node(node, flags, get_order(size));
1148 if (unlikely(!page)) 1150 if (unlikely(!page))
1149 return NULL; 1151 return NULL;
1150 1152
@@ -1596,7 +1598,7 @@ static void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist,
1596* 1598*
1597***************************************************************/ 1599***************************************************************/
1598 1600
1599static void __init 1601static void
1600ioc_iova_init(struct ioc *ioc) 1602ioc_iova_init(struct ioc *ioc)
1601{ 1603{
1602 int tcnfg; 1604 int tcnfg;
@@ -1807,7 +1809,7 @@ static struct ioc_iommu ioc_iommu_info[] __initdata = {
1807 { SX2000_IOC_ID, "sx2000", NULL }, 1809 { SX2000_IOC_ID, "sx2000", NULL },
1808}; 1810};
1809 1811
1810static struct ioc * __init 1812static struct ioc *
1811ioc_init(unsigned long hpa, void *handle) 1813ioc_init(unsigned long hpa, void *handle)
1812{ 1814{
1813 struct ioc *ioc; 1815 struct ioc *ioc;
@@ -1914,7 +1916,7 @@ ioc_show(struct seq_file *s, void *v)
1914 seq_printf(s, "Hewlett Packard %s IOC rev %d.%d\n", 1916 seq_printf(s, "Hewlett Packard %s IOC rev %d.%d\n",
1915 ioc->name, ((ioc->rev >> 4) & 0xF), (ioc->rev & 0xF)); 1917 ioc->name, ((ioc->rev >> 4) & 0xF), (ioc->rev & 0xF));
1916#ifdef CONFIG_NUMA 1918#ifdef CONFIG_NUMA
1917 if (ioc->node != MAX_NUMNODES) 1919 if (ioc->node != NUMA_NO_NODE)
1918 seq_printf(s, "NUMA node : %d\n", ioc->node); 1920 seq_printf(s, "NUMA node : %d\n", ioc->node);
1919#endif 1921#endif
1920 seq_printf(s, "IOVA size : %ld MB\n", ((ioc->pdir_size >> 3) * iovp_size)/(1024*1024)); 1922 seq_printf(s, "IOVA size : %ld MB\n", ((ioc->pdir_size >> 3) * iovp_size)/(1024*1024));
@@ -2015,33 +2017,21 @@ sba_connect_bus(struct pci_bus *bus)
2015 printk(KERN_WARNING "No IOC for PCI Bus %04x:%02x in ACPI\n", pci_domain_nr(bus), bus->number); 2017 printk(KERN_WARNING "No IOC for PCI Bus %04x:%02x in ACPI\n", pci_domain_nr(bus), bus->number);
2016} 2018}
2017 2019
2018#ifdef CONFIG_NUMA
2019static void __init 2020static void __init
2020sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle) 2021sba_map_ioc_to_node(struct ioc *ioc, acpi_handle handle)
2021{ 2022{
2023#ifdef CONFIG_NUMA
2022 unsigned int node; 2024 unsigned int node;
2023 int pxm;
2024
2025 ioc->node = MAX_NUMNODES;
2026
2027 pxm = acpi_get_pxm(handle);
2028
2029 if (pxm < 0)
2030 return;
2031
2032 node = pxm_to_node(pxm);
2033 2025
2034 if (node >= MAX_NUMNODES || !node_online(node)) 2026 node = acpi_get_node(handle);
2035 return; 2027 if (node != NUMA_NO_NODE && !node_online(node))
2028 node = NUMA_NO_NODE;
2036 2029
2037 ioc->node = node; 2030 ioc->node = node;
2038 return;
2039}
2040#else
2041#define sba_map_ioc_to_node(ioc, handle)
2042#endif 2031#endif
2032}
2043 2033
2044static int __init 2034static int
2045acpi_sba_ioc_add(struct acpi_device *device, 2035acpi_sba_ioc_add(struct acpi_device *device,
2046 const struct acpi_device_id *not_used) 2036 const struct acpi_device_id *not_used)
2047{ 2037{
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild
index 283a83154b5e..0da4aa2602ae 100644
--- a/arch/ia64/include/asm/Kbuild
+++ b/arch/ia64/include/asm/Kbuild
@@ -1,8 +1,9 @@
1 1
2generic-y += clkdev.h 2generic-y += clkdev.h
3generic-y += exec.h 3generic-y += exec.h
4generic-y += hash.h
4generic-y += kvm_para.h 5generic-y += kvm_para.h
5generic-y += trace_clock.h 6generic-y += mcs_spinlock.h
6generic-y += preempt.h 7generic-y += preempt.h
8generic-y += trace_clock.h
7generic-y += vtime.h 9generic-y += vtime.h
8generic-y += hash.h
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 71fbaaa495cc..7d41cc089822 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -98,7 +98,7 @@ struct pci_controller {
98 struct acpi_device *companion; 98 struct acpi_device *companion;
99 void *iommu; 99 void *iommu;
100 int segment; 100 int segment;
101 int node; /* nearest node with memory or -1 for global allocation */ 101 int node; /* nearest node with memory or NUMA_NO_NODE for global allocation */
102 102
103 void *platform_data; 103 void *platform_data;
104}; 104};
diff --git a/arch/ia64/include/asm/topology.h b/arch/ia64/include/asm/topology.h
index a2496e449b75..5cb55a1e606b 100644
--- a/arch/ia64/include/asm/topology.h
+++ b/arch/ia64/include/asm/topology.h
@@ -77,7 +77,6 @@ void build_cpu_to_node_map(void);
77#define topology_core_id(cpu) (cpu_data(cpu)->core_id) 77#define topology_core_id(cpu) (cpu_data(cpu)->core_id)
78#define topology_core_cpumask(cpu) (&cpu_core_map[cpu]) 78#define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
79#define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu)) 79#define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu))
80#define smt_capable() (smp_num_siblings > 1)
81#endif 80#endif
82 81
83extern void arch_fix_phys_package_id(int num, u32 slot); 82extern void arch_fix_phys_package_id(int num, u32 slot);
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 07d209c9507f..0d407b300762 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -54,10 +54,6 @@
54#include <asm/sal.h> 54#include <asm/sal.h>
55#include <asm/cyclone.h> 55#include <asm/cyclone.h>
56 56
57#define BAD_MADT_ENTRY(entry, end) ( \
58 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
59 ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
60
61#define PREFIX "ACPI: " 57#define PREFIX "ACPI: "
62 58
63unsigned int acpi_cpei_override; 59unsigned int acpi_cpei_override;
@@ -803,14 +799,9 @@ int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi)
803 * ACPI based hotplug CPU support 799 * ACPI based hotplug CPU support
804 */ 800 */
805#ifdef CONFIG_ACPI_HOTPLUG_CPU 801#ifdef CONFIG_ACPI_HOTPLUG_CPU
806static 802static int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
807int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
808{ 803{
809#ifdef CONFIG_ACPI_NUMA 804#ifdef CONFIG_ACPI_NUMA
810 int pxm_id;
811 int nid;
812
813 pxm_id = acpi_get_pxm(handle);
814 /* 805 /*
815 * We don't have cpu-only-node hotadd. But if the system equips 806 * We don't have cpu-only-node hotadd. But if the system equips
816 * SRAT table, pxm is already found and node is ready. 807 * SRAT table, pxm is already found and node is ready.
@@ -818,11 +809,10 @@ int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
818 * This code here is for the system which doesn't have full SRAT 809 * This code here is for the system which doesn't have full SRAT
819 * table for possible cpus. 810 * table for possible cpus.
820 */ 811 */
821 nid = acpi_map_pxm_to_node(pxm_id);
822 node_cpuid[cpu].phys_id = physid; 812 node_cpuid[cpu].phys_id = physid;
823 node_cpuid[cpu].nid = nid; 813 node_cpuid[cpu].nid = acpi_get_node(handle);
824#endif 814#endif
825 return (0); 815 return 0;
826} 816}
827 817
828int additional_cpus __initdata = -1; 818int additional_cpus __initdata = -1;
@@ -929,7 +919,7 @@ static acpi_status acpi_map_iosapic(acpi_handle handle, u32 depth,
929 union acpi_object *obj; 919 union acpi_object *obj;
930 struct acpi_madt_io_sapic *iosapic; 920 struct acpi_madt_io_sapic *iosapic;
931 unsigned int gsi_base; 921 unsigned int gsi_base;
932 int pxm, node; 922 int node;
933 923
934 /* Only care about objects w/ a method that returns the MADT */ 924 /* Only care about objects w/ a method that returns the MADT */
935 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer))) 925 if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
@@ -956,17 +946,9 @@ static acpi_status acpi_map_iosapic(acpi_handle handle, u32 depth,
956 946
957 kfree(buffer.pointer); 947 kfree(buffer.pointer);
958 948
959 /* 949 /* OK, it's an IOSAPIC MADT entry; associate it with a node */
960 * OK, it's an IOSAPIC MADT entry, look for a _PXM value to tell 950 node = acpi_get_node(handle);
961 * us which node to associate this with. 951 if (node == NUMA_NO_NODE || !node_online(node) ||
962 */
963 pxm = acpi_get_pxm(handle);
964 if (pxm < 0)
965 return AE_OK;
966
967 node = pxm_to_node(pxm);
968
969 if (node >= MAX_NUMNODES || !node_online(node) ||
970 cpumask_empty(cpumask_of_node(node))) 952 cpumask_empty(cpumask_of_node(node)))
971 return AE_OK; 953 return AE_OK;
972 954
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index da5b462e6de6..741b99c1a0b1 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -477,6 +477,9 @@ efi_init (void)
477 char *cp, vendor[100] = "unknown"; 477 char *cp, vendor[100] = "unknown";
478 int i; 478 int i;
479 479
480 set_bit(EFI_BOOT, &efi.flags);
481 set_bit(EFI_64BIT, &efi.flags);
482
480 /* 483 /*
481 * It's too early to be able to use the standard kernel command line 484 * It's too early to be able to use the standard kernel command line
482 * support... 485 * support...
@@ -529,6 +532,8 @@ efi_init (void)
529 efi.systab->hdr.revision >> 16, 532 efi.systab->hdr.revision >> 16,
530 efi.systab->hdr.revision & 0xffff, vendor); 533 efi.systab->hdr.revision & 0xffff, vendor);
531 534
535 set_bit(EFI_SYSTEM_TABLES, &efi.flags);
536
532 palo_phys = EFI_INVALID_TABLE_ADDR; 537 palo_phys = EFI_INVALID_TABLE_ADDR;
533 538
534 if (efi_config_init(arch_tables) != 0) 539 if (efi_config_init(arch_tables) != 0)
@@ -657,6 +662,8 @@ efi_enter_virtual_mode (void)
657 return; 662 return;
658 } 663 }
659 664
665 set_bit(EFI_RUNTIME_SERVICES, &efi.flags);
666
660 /* 667 /*
661 * Now that EFI is in virtual mode, we call the EFI functions more 668 * Now that EFI is in virtual mode, we call the EFI functions more
662 * efficiently: 669 * efficiently:
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/kernel/uncached.c b/arch/ia64/kernel/uncached.c
index a96bcf83a735..20e8a9b21d75 100644
--- a/arch/ia64/kernel/uncached.c
+++ b/arch/ia64/kernel/uncached.c
@@ -98,7 +98,7 @@ static int uncached_add_chunk(struct uncached_pool *uc_pool, int nid)
98 /* attempt to allocate a granule's worth of cached memory pages */ 98 /* attempt to allocate a granule's worth of cached memory pages */
99 99
100 page = alloc_pages_exact_node(nid, 100 page = alloc_pages_exact_node(nid,
101 GFP_KERNEL | __GFP_ZERO | GFP_THISNODE, 101 GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE,
102 IA64_GRANULE_SHIFT-PAGE_SHIFT); 102 IA64_GRANULE_SHIFT-PAGE_SHIFT);
103 if (!page) { 103 if (!page) {
104 mutex_unlock(&uc_pool->add_chunk_mutex); 104 mutex_unlock(&uc_pool->add_chunk_mutex);
diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c
index 5dc969dd4ac0..eee069a0b539 100644
--- a/arch/ia64/pci/fixup.c
+++ b/arch/ia64/pci/fixup.c
@@ -5,6 +5,7 @@
5 5
6#include <linux/pci.h> 6#include <linux/pci.h>
7#include <linux/init.h> 7#include <linux/init.h>
8#include <linux/vgaarb.h>
8 9
9#include <asm/machvec.h> 10#include <asm/machvec.h>
10 11
@@ -19,9 +20,10 @@
19 * IORESOURCE_ROM_SHADOW is used to associate the boot video 20 * IORESOURCE_ROM_SHADOW is used to associate the boot video
20 * card with this copy. On laptops this copy has to be used since 21 * card with this copy. On laptops this copy has to be used since
21 * the main ROM may be compressed or combined with another image. 22 * the main ROM may be compressed or combined with another image.
22 * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW 23 * See pci_map_rom() for use of this flag. Before marking the device
23 * is marked here since the boot video device will be the only enabled 24 * with IORESOURCE_ROM_SHADOW check if a vga_default_device is already set
24 * video device at this point. 25 * by either arch cde or vga-arbitration, if so only apply the fixup to this
26 * already determined primary video card.
25 */ 27 */
26 28
27static void pci_fixup_video(struct pci_dev *pdev) 29static void pci_fixup_video(struct pci_dev *pdev)
@@ -35,9 +37,6 @@ static void pci_fixup_video(struct pci_dev *pdev)
35 return; 37 return;
36 /* Maybe, this machine supports legacy memory map. */ 38 /* Maybe, this machine supports legacy memory map. */
37 39
38 if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
39 return;
40
41 /* Is VGA routed to us? */ 40 /* Is VGA routed to us? */
42 bus = pdev->bus; 41 bus = pdev->bus;
43 while (bus) { 42 while (bus) {
@@ -60,10 +59,14 @@ static void pci_fixup_video(struct pci_dev *pdev)
60 } 59 }
61 bus = bus->parent; 60 bus = bus->parent;
62 } 61 }
63 pci_read_config_word(pdev, PCI_COMMAND, &config); 62 if (!vga_default_device() || pdev == vga_default_device()) {
64 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { 63 pci_read_config_word(pdev, PCI_COMMAND, &config);
65 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; 64 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
66 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); 65 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
66 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n");
67 vga_set_default_device(pdev);
68 }
67 } 69 }
68} 70}
69DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_video); 71DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
72 PCI_CLASS_DISPLAY_VGA, 8, pci_fixup_video);
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 9e4938d8ca4d..291a582777cf 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -126,7 +126,6 @@ static struct pci_controller *alloc_pci_controller(int seg)
126 return NULL; 126 return NULL;
127 127
128 controller->segment = seg; 128 controller->segment = seg;
129 controller->node = -1;
130 return controller; 129 return controller;
131} 130}
132 131
@@ -430,19 +429,14 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
430 struct pci_root_info *info = NULL; 429 struct pci_root_info *info = NULL;
431 int busnum = root->secondary.start; 430 int busnum = root->secondary.start;
432 struct pci_bus *pbus; 431 struct pci_bus *pbus;
433 int pxm, ret; 432 int ret;
434 433
435 controller = alloc_pci_controller(domain); 434 controller = alloc_pci_controller(domain);
436 if (!controller) 435 if (!controller)
437 return NULL; 436 return NULL;
438 437
439 controller->companion = device; 438 controller->companion = device;
440 439 controller->node = acpi_get_node(device->handle);
441 pxm = acpi_get_pxm(device->handle);
442#ifdef CONFIG_NUMA
443 if (pxm >= 0)
444 controller->node = pxm_to_node(pxm);
445#endif
446 440
447 info = kzalloc(sizeof(*info), GFP_KERNEL); 441 info = kzalloc(sizeof(*info), GFP_KERNEL);
448 if (!info) { 442 if (!info) {
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 932435ac4e5c..67779a74b62d 100644
--- a/arch/m32r/include/asm/Kbuild
+++ b/arch/m32r/include/asm/Kbuild
@@ -1,7 +1,9 @@
1 1
2generic-y += clkdev.h 2generic-y += clkdev.h
3generic-y += cputime.h
3generic-y += exec.h 4generic-y += exec.h
5generic-y += hash.h
6generic-y += mcs_spinlock.h
4generic-y += module.h 7generic-y += module.h
5generic-y += trace_clock.h
6generic-y += preempt.h 8generic-y += preempt.h
7generic-y += hash.h 9generic-y += trace_clock.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/Kconfig b/arch/m68k/Kconfig
index dbdd2231c75d..b2e322939256 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -17,6 +17,7 @@ config M68K
17 select FPU if MMU 17 select FPU if MMU
18 select ARCH_WANT_IPC_PARSE_VERSION 18 select ARCH_WANT_IPC_PARSE_VERSION
19 select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE 19 select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE
20 select HAVE_FUTEX_CMPXCHG if MMU && FUTEX
20 select HAVE_MOD_ARCH_SPECIFIC 21 select HAVE_MOD_ARCH_SPECIFIC
21 select MODULES_USE_ELF_REL 22 select MODULES_USE_ELF_REL
22 select MODULES_USE_ELF_RELA 23 select MODULES_USE_ELF_RELA
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/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild
index 6fb9e813a910..c67c94a2d672 100644
--- a/arch/m68k/include/asm/Kbuild
+++ b/arch/m68k/include/asm/Kbuild
@@ -14,8 +14,9 @@ generic-y += irq_regs.h
14generic-y += kdebug.h 14generic-y += kdebug.h
15generic-y += kmap_types.h 15generic-y += kmap_types.h
16generic-y += kvm_para.h 16generic-y += kvm_para.h
17generic-y += local64.h
18generic-y += local.h 17generic-y += local.h
18generic-y += local64.h
19generic-y += mcs_spinlock.h
19generic-y += mman.h 20generic-y += mman.h
20generic-y += mutex.h 21generic-y += mutex.h
21generic-y += percpu.h 22generic-y += percpu.h
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/metag/include/asm/Kbuild b/arch/metag/include/asm/Kbuild
index b716d807c2ec..c29ead89a317 100644
--- a/arch/metag/include/asm/Kbuild
+++ b/arch/metag/include/asm/Kbuild
@@ -13,6 +13,7 @@ generic-y += fb.h
13generic-y += fcntl.h 13generic-y += fcntl.h
14generic-y += futex.h 14generic-y += futex.h
15generic-y += hardirq.h 15generic-y += hardirq.h
16generic-y += hash.h
16generic-y += hw_irq.h 17generic-y += hw_irq.h
17generic-y += ioctl.h 18generic-y += ioctl.h
18generic-y += ioctls.h 19generic-y += ioctls.h
@@ -23,6 +24,7 @@ generic-y += kmap_types.h
23generic-y += kvm_para.h 24generic-y += kvm_para.h
24generic-y += local.h 25generic-y += local.h
25generic-y += local64.h 26generic-y += local64.h
27generic-y += mcs_spinlock.h
26generic-y += msgbuf.h 28generic-y += msgbuf.h
27generic-y += mutex.h 29generic-y += mutex.h
28generic-y += param.h 30generic-y += param.h
@@ -30,6 +32,7 @@ generic-y += pci.h
30generic-y += percpu.h 32generic-y += percpu.h
31generic-y += poll.h 33generic-y += poll.h
32generic-y += posix_types.h 34generic-y += posix_types.h
35generic-y += preempt.h
33generic-y += scatterlist.h 36generic-y += scatterlist.h
34generic-y += sections.h 37generic-y += sections.h
35generic-y += sembuf.h 38generic-y += sembuf.h
@@ -52,5 +55,3 @@ generic-y += unaligned.h
52generic-y += user.h 55generic-y += user.h
53generic-y += vga.h 56generic-y += vga.h
54generic-y += xor.h 57generic-y += xor.h
55generic-y += preempt.h
56generic-y += hash.h
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index 2b98bc73642a..c98ed95c0541 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -1,8 +1,10 @@
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 += trace_clock.h 7generic-y += mcs_spinlock.h
7generic-y += syscalls.h
8generic-y += preempt.h 8generic-y += preempt.h
9generic-y += syscalls.h
10generic-y += trace_clock.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/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 66804adcacf0..70996cc66aa2 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1294,11 +1294,6 @@ void pcibios_finish_adding_to_bus(struct pci_bus *bus)
1294} 1294}
1295EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus); 1295EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus);
1296 1296
1297int pcibios_enable_device(struct pci_dev *dev, int mask)
1298{
1299 return pci_enable_resources(dev, mask);
1300}
1301
1302static void pcibios_setup_phb_resources(struct pci_controller *hose, 1297static void pcibios_setup_phb_resources(struct pci_controller *hose,
1303 struct list_head *resources) 1298 struct list_head *resources)
1304{ 1299{
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index dcae3a7035db..95fa1f1d5c8b 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1776,12 +1776,12 @@ endchoice
1776 1776
1777config FORCE_MAX_ZONEORDER 1777config FORCE_MAX_ZONEORDER
1778 int "Maximum zone order" 1778 int "Maximum zone order"
1779 range 14 64 if HUGETLB_PAGE && PAGE_SIZE_64KB 1779 range 14 64 if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_64KB
1780 default "14" if HUGETLB_PAGE && PAGE_SIZE_64KB 1780 default "14" if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_64KB
1781 range 13 64 if HUGETLB_PAGE && PAGE_SIZE_32KB 1781 range 13 64 if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_32KB
1782 default "13" if HUGETLB_PAGE && PAGE_SIZE_32KB 1782 default "13" if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_32KB
1783 range 12 64 if HUGETLB_PAGE && PAGE_SIZE_16KB 1783 range 12 64 if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_16KB
1784 default "12" if HUGETLB_PAGE && PAGE_SIZE_16KB 1784 default "12" if MIPS_HUGE_TLB_SUPPORT && PAGE_SIZE_16KB
1785 range 11 64 1785 range 11 64
1786 default "11" 1786 default "11"
1787 help 1787 help
@@ -2353,9 +2353,8 @@ config SECCOMP
2353 If unsure, say Y. Only embedded should say N here. 2353 If unsure, say Y. Only embedded should say N here.
2354 2354
2355config MIPS_O32_FP64_SUPPORT 2355config MIPS_O32_FP64_SUPPORT
2356 bool "Support for O32 binaries using 64-bit FP" 2356 bool "Support for O32 binaries using 64-bit FP (EXPERIMENTAL)"
2357 depends on 32BIT || MIPS32_O32 2357 depends on 32BIT || MIPS32_O32
2358 default y
2359 help 2358 help
2360 When this is enabled, the kernel will support use of 64-bit floating 2359 When this is enabled, the kernel will support use of 64-bit floating
2361 point registers with binaries using the O32 ABI along with the 2360 point registers with binaries using the O32 ABI along with the
@@ -2367,7 +2366,14 @@ config MIPS_O32_FP64_SUPPORT
2367 of your kernel & potentially improve FP emulation performance by 2366 of your kernel & potentially improve FP emulation performance by
2368 saying N here. 2367 saying N here.
2369 2368
2370 If unsure, say Y. 2369 Although binutils currently supports use of this flag the details
2370 concerning its effect upon the O32 ABI in userland are still being
2371 worked on. In order to avoid userland becoming dependant upon current
2372 behaviour before the details have been finalised, this option should
2373 be considered experimental and only enabled by those working upon
2374 said details.
2375
2376 If unsure, say N.
2371 2377
2372config USE_OF 2378config USE_OF
2373 bool 2379 bool
diff --git a/arch/mips/alchemy/board-gpr.c b/arch/mips/alchemy/board-gpr.c
index 9edc35ff8cf1..acf9a2a37f5a 100644
--- a/arch/mips/alchemy/board-gpr.c
+++ b/arch/mips/alchemy/board-gpr.c
@@ -53,10 +53,8 @@ void __init prom_init(void)
53 prom_init_cmdline(); 53 prom_init_cmdline();
54 54
55 memsize_str = prom_getenv("memsize"); 55 memsize_str = prom_getenv("memsize");
56 if (!memsize_str) 56 if (!memsize_str || kstrtoul(memsize_str, 0, &memsize))
57 memsize = 0x04000000; 57 memsize = 0x04000000;
58 else
59 strict_strtoul(memsize_str, 0, &memsize);
60 add_memory_region(0, memsize, BOOT_MEM_RAM); 58 add_memory_region(0, memsize, BOOT_MEM_RAM);
61} 59}
62 60
diff --git a/arch/mips/alchemy/board-mtx1.c b/arch/mips/alchemy/board-mtx1.c
index 9969dbab19e3..25a59a23547e 100644
--- a/arch/mips/alchemy/board-mtx1.c
+++ b/arch/mips/alchemy/board-mtx1.c
@@ -52,10 +52,8 @@ void __init prom_init(void)
52 prom_init_cmdline(); 52 prom_init_cmdline();
53 53
54 memsize_str = prom_getenv("memsize"); 54 memsize_str = prom_getenv("memsize");
55 if (!memsize_str) 55 if (!memsize_str || kstrtoul(memsize_str, 0, &memsize))
56 memsize = 0x04000000; 56 memsize = 0x04000000;
57 else
58 strict_strtoul(memsize_str, 0, &memsize);
59 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 add_memory_region(0, memsize, BOOT_MEM_RAM);
60} 58}
61 59
diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c
index 6d612e2b949b..cdd8246f92b3 100644
--- a/arch/mips/bcm47xx/board.c
+++ b/arch/mips/bcm47xx/board.c
@@ -1,3 +1,4 @@
1#include <linux/errno.h>
1#include <linux/export.h> 2#include <linux/export.h>
2#include <linux/string.h> 3#include <linux/string.h>
3#include <bcm47xx_board.h> 4#include <bcm47xx_board.h>
diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
index 6decb27cf48b..2bed73a684ae 100644
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -196,7 +196,7 @@ int bcm47xx_nvram_gpio_pin(const char *name)
196 char nvram_var[10]; 196 char nvram_var[10];
197 char buf[30]; 197 char buf[30];
198 198
199 for (i = 0; i < 16; i++) { 199 for (i = 0; i < 32; i++) {
200 err = snprintf(nvram_var, sizeof(nvram_var), "gpio%i", i); 200 err = snprintf(nvram_var, sizeof(nvram_var), "gpio%i", i);
201 if (err <= 0) 201 if (err <= 0)
202 continue; 202 continue;
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index 25fbfae06c1f..c2bb4f896ce7 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -975,10 +975,6 @@ static int octeon_irq_ciu_xlat(struct irq_domain *d,
975 if (ciu > 1 || bit > 63) 975 if (ciu > 1 || bit > 63)
976 return -EINVAL; 976 return -EINVAL;
977 977
978 /* These are the GPIO lines */
979 if (ciu == 0 && bit >= 16 && bit < 32)
980 return -EINVAL;
981
982 *out_hwirq = (ciu << 6) | bit; 978 *out_hwirq = (ciu << 6) | bit;
983 *out_type = 0; 979 *out_type = 0;
984 980
@@ -1007,6 +1003,10 @@ static int octeon_irq_ciu_map(struct irq_domain *d,
1007 if (!octeon_irq_virq_in_range(virq)) 1003 if (!octeon_irq_virq_in_range(virq))
1008 return -EINVAL; 1004 return -EINVAL;
1009 1005
1006 /* Don't map irq if it is reserved for GPIO. */
1007 if (line == 0 && bit >= 16 && bit <32)
1008 return 0;
1009
1010 if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0) 1010 if (line > 1 || octeon_irq_ciu_to_irq[line][bit] != 0)
1011 return -EINVAL; 1011 return -EINVAL;
1012 1012
@@ -1525,10 +1525,6 @@ static int octeon_irq_ciu2_xlat(struct irq_domain *d,
1525 ciu = intspec[0]; 1525 ciu = intspec[0];
1526 bit = intspec[1]; 1526 bit = intspec[1];
1527 1527
1528 /* Line 7 are the GPIO lines */
1529 if (ciu > 6 || bit > 63)
1530 return -EINVAL;
1531
1532 *out_hwirq = (ciu << 6) | bit; 1528 *out_hwirq = (ciu << 6) | bit;
1533 *out_type = 0; 1529 *out_type = 0;
1534 1530
@@ -1570,8 +1566,14 @@ static int octeon_irq_ciu2_map(struct irq_domain *d,
1570 if (!octeon_irq_virq_in_range(virq)) 1566 if (!octeon_irq_virq_in_range(virq))
1571 return -EINVAL; 1567 return -EINVAL;
1572 1568
1573 /* Line 7 are the GPIO lines */ 1569 /*
1574 if (line > 6 || octeon_irq_ciu_to_irq[line][bit] != 0) 1570 * Don't map irq if it is reserved for GPIO.
1571 * (Line 7 are the GPIO lines.)
1572 */
1573 if (line == 7)
1574 return 0;
1575
1576 if (line > 7 || octeon_irq_ciu_to_irq[line][bit] != 0)
1575 return -EINVAL; 1577 return -EINVAL;
1576 1578
1577 if (octeon_irq_ciu2_is_edge(line, bit)) 1579 if (octeon_irq_ciu2_is_edge(line, bit))
diff --git a/arch/mips/include/asm/Kbuild b/arch/mips/include/asm/Kbuild
index 2d7f65052c1f..05439187891d 100644
--- a/arch/mips/include/asm/Kbuild
+++ b/arch/mips/include/asm/Kbuild
@@ -2,16 +2,17 @@
2generic-y += cputime.h 2generic-y += cputime.h
3generic-y += current.h 3generic-y += current.h
4generic-y += emergency-restart.h 4generic-y += emergency-restart.h
5generic-y += hash.h
5generic-y += local64.h 6generic-y += local64.h
7generic-y += mcs_spinlock.h
6generic-y += mutex.h 8generic-y += mutex.h
7generic-y += parport.h 9generic-y += parport.h
8generic-y += percpu.h 10generic-y += percpu.h
11generic-y += preempt.h
9generic-y += scatterlist.h 12generic-y += scatterlist.h
10generic-y += sections.h 13generic-y += sections.h
11generic-y += segment.h 14generic-y += segment.h
12generic-y += serial.h 15generic-y += serial.h
13generic-y += trace_clock.h 16generic-y += trace_clock.h
14generic-y += preempt.h
15generic-y += ucontext.h 17generic-y += ucontext.h
16generic-y += xor.h 18generic-y += xor.h
17generic-y += hash.h
diff --git a/arch/mips/include/asm/asmmacro.h b/arch/mips/include/asm/asmmacro.h
index 3220c93ea981..4225e99bd7bf 100644
--- a/arch/mips/include/asm/asmmacro.h
+++ b/arch/mips/include/asm/asmmacro.h
@@ -9,6 +9,7 @@
9#define _ASM_ASMMACRO_H 9#define _ASM_ASMMACRO_H
10 10
11#include <asm/hazards.h> 11#include <asm/hazards.h>
12#include <asm/asm-offsets.h>
12 13
13#ifdef CONFIG_32BIT 14#ifdef CONFIG_32BIT
14#include <asm/asmmacro-32.h> 15#include <asm/asmmacro-32.h>
@@ -54,11 +55,21 @@
54 .endm 55 .endm
55 56
56 .macro local_irq_disable reg=t0 57 .macro local_irq_disable reg=t0
58#ifdef CONFIG_PREEMPT
59 lw \reg, TI_PRE_COUNT($28)
60 addi \reg, \reg, 1
61 sw \reg, TI_PRE_COUNT($28)
62#endif
57 mfc0 \reg, CP0_STATUS 63 mfc0 \reg, CP0_STATUS
58 ori \reg, \reg, 1 64 ori \reg, \reg, 1
59 xori \reg, \reg, 1 65 xori \reg, \reg, 1
60 mtc0 \reg, CP0_STATUS 66 mtc0 \reg, CP0_STATUS
61 irq_disable_hazard 67 irq_disable_hazard
68#ifdef CONFIG_PREEMPT
69 lw \reg, TI_PRE_COUNT($28)
70 addi \reg, \reg, -1
71 sw \reg, TI_PRE_COUNT($28)
72#endif
62 .endm 73 .endm
63#endif /* CONFIG_MIPS_MT_SMTC */ 74#endif /* CONFIG_MIPS_MT_SMTC */
64 75
@@ -106,7 +117,7 @@
106 .endm 117 .endm
107 118
108 .macro fpu_save_double thread status tmp 119 .macro fpu_save_double thread status tmp
109#if defined(CONFIG_MIPS64) || defined(CONFIG_CPU_MIPS32_R2) 120#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2)
110 sll \tmp, \status, 5 121 sll \tmp, \status, 5
111 bgez \tmp, 10f 122 bgez \tmp, 10f
112 fpu_save_16odd \thread 123 fpu_save_16odd \thread
@@ -159,7 +170,7 @@
159 .endm 170 .endm
160 171
161 .macro fpu_restore_double thread status tmp 172 .macro fpu_restore_double thread status tmp
162#if defined(CONFIG_MIPS64) || defined(CONFIG_CPU_MIPS32_R2) 173#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2)
163 sll \tmp, \status, 5 174 sll \tmp, \status, 5
164 bgez \tmp, 10f # 16 register mode? 175 bgez \tmp, 10f # 16 register mode?
165 176
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h
index 6b9749540edf..58e50cbdb1a6 100644
--- a/arch/mips/include/asm/fpu.h
+++ b/arch/mips/include/asm/fpu.h
@@ -57,7 +57,7 @@ static inline int __enable_fpu(enum fpu_mode mode)
57 return 0; 57 return 0;
58 58
59 case FPU_64BIT: 59 case FPU_64BIT:
60#if !(defined(CONFIG_CPU_MIPS32_R2) || defined(CONFIG_MIPS64)) 60#if !(defined(CONFIG_CPU_MIPS32_R2) || defined(CONFIG_64BIT))
61 /* we only have a 32-bit FPU */ 61 /* we only have a 32-bit FPU */
62 return SIGFPE; 62 return SIGFPE;
63#endif 63#endif
diff --git a/arch/mips/include/asm/ftrace.h b/arch/mips/include/asm/ftrace.h
index ce35c9af0c28..992aaba603b5 100644
--- a/arch/mips/include/asm/ftrace.h
+++ b/arch/mips/include/asm/ftrace.h
@@ -22,12 +22,12 @@ extern void _mcount(void);
22#define safe_load(load, src, dst, error) \ 22#define safe_load(load, src, dst, error) \
23do { \ 23do { \
24 asm volatile ( \ 24 asm volatile ( \
25 "1: " load " %[" STR(dst) "], 0(%[" STR(src) "])\n"\ 25 "1: " load " %[tmp_dst], 0(%[tmp_src])\n" \
26 " li %[" STR(error) "], 0\n" \ 26 " li %[tmp_err], 0\n" \
27 "2:\n" \ 27 "2:\n" \
28 \ 28 \
29 ".section .fixup, \"ax\"\n" \ 29 ".section .fixup, \"ax\"\n" \
30 "3: li %[" STR(error) "], 1\n" \ 30 "3: li %[tmp_err], 1\n" \
31 " j 2b\n" \ 31 " j 2b\n" \
32 ".previous\n" \ 32 ".previous\n" \
33 \ 33 \
@@ -35,8 +35,8 @@ do { \
35 STR(PTR) "\t1b, 3b\n\t" \ 35 STR(PTR) "\t1b, 3b\n\t" \
36 ".previous\n" \ 36 ".previous\n" \
37 \ 37 \
38 : [dst] "=&r" (dst), [error] "=r" (error)\ 38 : [tmp_dst] "=&r" (dst), [tmp_err] "=r" (error)\
39 : [src] "r" (src) \ 39 : [tmp_src] "r" (src) \
40 : "memory" \ 40 : "memory" \
41 ); \ 41 ); \
42} while (0) 42} while (0)
@@ -44,12 +44,12 @@ do { \
44#define safe_store(store, src, dst, error) \ 44#define safe_store(store, src, dst, error) \
45do { \ 45do { \
46 asm volatile ( \ 46 asm volatile ( \
47 "1: " store " %[" STR(src) "], 0(%[" STR(dst) "])\n"\ 47 "1: " store " %[tmp_src], 0(%[tmp_dst])\n"\
48 " li %[" STR(error) "], 0\n" \ 48 " li %[tmp_err], 0\n" \
49 "2:\n" \ 49 "2:\n" \
50 \ 50 \
51 ".section .fixup, \"ax\"\n" \ 51 ".section .fixup, \"ax\"\n" \
52 "3: li %[" STR(error) "], 1\n" \ 52 "3: li %[tmp_err], 1\n" \
53 " j 2b\n" \ 53 " j 2b\n" \
54 ".previous\n" \ 54 ".previous\n" \
55 \ 55 \
@@ -57,8 +57,8 @@ do { \
57 STR(PTR) "\t1b, 3b\n\t" \ 57 STR(PTR) "\t1b, 3b\n\t" \
58 ".previous\n" \ 58 ".previous\n" \
59 \ 59 \
60 : [error] "=r" (error) \ 60 : [tmp_err] "=r" (error) \
61 : [dst] "r" (dst), [src] "r" (src)\ 61 : [tmp_dst] "r" (dst), [tmp_src] "r" (src)\
62 : "memory" \ 62 : "memory" \
63 ); \ 63 ); \
64} while (0) 64} while (0)
diff --git a/arch/mips/include/asm/syscall.h b/arch/mips/include/asm/syscall.h
index 33e8dbfc1b63..f35b131977e6 100644
--- a/arch/mips/include/asm/syscall.h
+++ b/arch/mips/include/asm/syscall.h
@@ -13,6 +13,7 @@
13#ifndef __ASM_MIPS_SYSCALL_H 13#ifndef __ASM_MIPS_SYSCALL_H
14#define __ASM_MIPS_SYSCALL_H 14#define __ASM_MIPS_SYSCALL_H
15 15
16#include <linux/compiler.h>
16#include <linux/audit.h> 17#include <linux/audit.h>
17#include <linux/elf-em.h> 18#include <linux/elf-em.h>
18#include <linux/kernel.h> 19#include <linux/kernel.h>
@@ -39,14 +40,14 @@ static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
39 40
40#ifdef CONFIG_32BIT 41#ifdef CONFIG_32BIT
41 case 4: case 5: case 6: case 7: 42 case 4: case 5: case 6: case 7:
42 return get_user(*arg, (int *)usp + 4 * n); 43 return get_user(*arg, (int *)usp + n);
43#endif 44#endif
44 45
45#ifdef CONFIG_64BIT 46#ifdef CONFIG_64BIT
46 case 4: case 5: case 6: case 7: 47 case 4: case 5: case 6: case 7:
47#ifdef CONFIG_MIPS32_O32 48#ifdef CONFIG_MIPS32_O32
48 if (test_thread_flag(TIF_32BIT_REGS)) 49 if (test_thread_flag(TIF_32BIT_REGS))
49 return get_user(*arg, (int *)usp + 4 * n); 50 return get_user(*arg, (int *)usp + n);
50 else 51 else
51#endif 52#endif
52 *arg = regs->regs[4 + n]; 53 *arg = regs->regs[4 + n];
@@ -57,6 +58,8 @@ static inline unsigned long mips_get_syscall_arg(unsigned long *arg,
57 default: 58 default:
58 BUG(); 59 BUG();
59 } 60 }
61
62 unreachable();
60} 63}
61 64
62static inline long syscall_get_return_value(struct task_struct *task, 65static inline long syscall_get_return_value(struct task_struct *task,
@@ -83,11 +86,10 @@ static inline void syscall_get_arguments(struct task_struct *task,
83 unsigned int i, unsigned int n, 86 unsigned int i, unsigned int n,
84 unsigned long *args) 87 unsigned long *args)
85{ 88{
86 unsigned long arg;
87 int ret; 89 int ret;
88 90
89 while (n--) 91 while (n--)
90 ret |= mips_get_syscall_arg(&arg, task, regs, i++); 92 ret |= mips_get_syscall_arg(args++, task, regs, i++);
91 93
92 /* 94 /*
93 * No way to communicate an error because this is a void function. 95 * No way to communicate an error because this is a void function.
diff --git a/arch/mips/include/asm/topology.h b/arch/mips/include/asm/topology.h
index 12609a17dc8b..20ea4859c822 100644
--- a/arch/mips/include/asm/topology.h
+++ b/arch/mips/include/asm/topology.h
@@ -10,8 +10,4 @@
10 10
11#include <topology.h> 11#include <topology.h>
12 12
13#ifdef CONFIG_SMP
14#define smt_capable() (smp_num_siblings > 1)
15#endif
16
17#endif /* __ASM_TOPOLOGY_H */ 13#endif /* __ASM_TOPOLOGY_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/include/uapi/asm/inst.h b/arch/mips/include/uapi/asm/inst.h
index b39ba25b41cc..f25181b19941 100644
--- a/arch/mips/include/uapi/asm/inst.h
+++ b/arch/mips/include/uapi/asm/inst.h
@@ -163,8 +163,8 @@ enum cop1_sdw_func {
163 */ 163 */
164enum cop1x_func { 164enum cop1x_func {
165 lwxc1_op = 0x00, ldxc1_op = 0x01, 165 lwxc1_op = 0x00, ldxc1_op = 0x01,
166 pfetch_op = 0x07, swxc1_op = 0x08, 166 swxc1_op = 0x08, sdxc1_op = 0x09,
167 sdxc1_op = 0x09, madd_s_op = 0x20, 167 pfetch_op = 0x0f, madd_s_op = 0x20,
168 madd_d_op = 0x21, madd_e_op = 0x22, 168 madd_d_op = 0x21, madd_e_op = 0x22,
169 msub_s_op = 0x28, msub_d_op = 0x29, 169 msub_s_op = 0x28, msub_d_op = 0x29,
170 msub_e_op = 0x2a, nmadd_s_op = 0x30, 170 msub_e_op = 0x2a, nmadd_s_op = 0x30,
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index 185ba258361b..374ed74cd516 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
@@ -111,11 +111,10 @@ static int ftrace_modify_code_2(unsigned long ip, unsigned int new_code1,
111 safe_store_code(new_code1, ip, faulted); 111 safe_store_code(new_code1, ip, faulted);
112 if (unlikely(faulted)) 112 if (unlikely(faulted))
113 return -EFAULT; 113 return -EFAULT;
114 ip += 4; 114 safe_store_code(new_code2, ip + 4, faulted);
115 safe_store_code(new_code2, ip, faulted);
116 if (unlikely(faulted)) 115 if (unlikely(faulted))
117 return -EFAULT; 116 return -EFAULT;
118 flush_icache_range(ip, ip + 8); /* original ip + 12 */ 117 flush_icache_range(ip, ip + 8);
119 return 0; 118 return 0;
120} 119}
121#endif 120#endif
diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S
index 253b2fb52026..73b0ddf910d4 100644
--- a/arch/mips/kernel/r4k_fpu.S
+++ b/arch/mips/kernel/r4k_fpu.S
@@ -35,9 +35,9 @@
35LEAF(_save_fp_context) 35LEAF(_save_fp_context)
36 cfc1 t1, fcr31 36 cfc1 t1, fcr31
37 37
38#if defined(CONFIG_64BIT) || defined(CONFIG_MIPS32_R2) 38#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2)
39 .set push 39 .set push
40#ifdef CONFIG_MIPS32_R2 40#ifdef CONFIG_CPU_MIPS32_R2
41 .set mips64r2 41 .set mips64r2
42 mfc0 t0, CP0_STATUS 42 mfc0 t0, CP0_STATUS
43 sll t0, t0, 5 43 sll t0, t0, 5
@@ -146,11 +146,11 @@ LEAF(_save_fp_context32)
146 * - cp1 status/control register 146 * - cp1 status/control register
147 */ 147 */
148LEAF(_restore_fp_context) 148LEAF(_restore_fp_context)
149 EX lw t0, SC_FPC_CSR(a0) 149 EX lw t1, SC_FPC_CSR(a0)
150 150
151#if defined(CONFIG_64BIT) || defined(CONFIG_MIPS32_R2) 151#if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2)
152 .set push 152 .set push
153#ifdef CONFIG_MIPS32_R2 153#ifdef CONFIG_CPU_MIPS32_R2
154 .set mips64r2 154 .set mips64r2
155 mfc0 t0, CP0_STATUS 155 mfc0 t0, CP0_STATUS
156 sll t0, t0, 5 156 sll t0, t0, 5
@@ -191,7 +191,7 @@ LEAF(_restore_fp_context)
191 EX ldc1 $f26, SC_FPREGS+208(a0) 191 EX ldc1 $f26, SC_FPREGS+208(a0)
192 EX ldc1 $f28, SC_FPREGS+224(a0) 192 EX ldc1 $f28, SC_FPREGS+224(a0)
193 EX ldc1 $f30, SC_FPREGS+240(a0) 193 EX ldc1 $f30, SC_FPREGS+240(a0)
194 ctc1 t0, fcr31 194 ctc1 t1, fcr31
195 jr ra 195 jr ra
196 li v0, 0 # success 196 li v0, 0 # success
197 END(_restore_fp_context) 197 END(_restore_fp_context)
@@ -199,7 +199,7 @@ LEAF(_restore_fp_context)
199#ifdef CONFIG_MIPS32_COMPAT 199#ifdef CONFIG_MIPS32_COMPAT
200LEAF(_restore_fp_context32) 200LEAF(_restore_fp_context32)
201 /* Restore an o32 sigcontext. */ 201 /* Restore an o32 sigcontext. */
202 EX lw t0, SC32_FPC_CSR(a0) 202 EX lw t1, SC32_FPC_CSR(a0)
203 203
204 mfc0 t0, CP0_STATUS 204 mfc0 t0, CP0_STATUS
205 sll t0, t0, 5 205 sll t0, t0, 5
@@ -239,7 +239,7 @@ LEAF(_restore_fp_context32)
239 EX ldc1 $f26, SC32_FPREGS+208(a0) 239 EX ldc1 $f26, SC32_FPREGS+208(a0)
240 EX ldc1 $f28, SC32_FPREGS+224(a0) 240 EX ldc1 $f28, SC32_FPREGS+224(a0)
241 EX ldc1 $f30, SC32_FPREGS+240(a0) 241 EX ldc1 $f30, SC32_FPREGS+240(a0)
242 ctc1 t0, fcr31 242 ctc1 t1, fcr31
243 jr ra 243 jr ra
244 li v0, 0 # success 244 li v0, 0 # success
245 END(_restore_fp_context32) 245 END(_restore_fp_context32)
diff --git a/arch/mips/kernel/rtlx-cmp.c b/arch/mips/kernel/rtlx-cmp.c
index 56dc69635153..758fb3cd2326 100644
--- a/arch/mips/kernel/rtlx-cmp.c
+++ b/arch/mips/kernel/rtlx-cmp.c
@@ -112,5 +112,8 @@ void __exit rtlx_module_exit(void)
112 112
113 for (i = 0; i < RTLX_CHANNELS; i++) 113 for (i = 0; i < RTLX_CHANNELS; i++)
114 device_destroy(mt_class, MKDEV(major, i)); 114 device_destroy(mt_class, MKDEV(major, i));
115
115 unregister_chrdev(major, RTLX_MODULE_NAME); 116 unregister_chrdev(major, RTLX_MODULE_NAME);
117
118 aprp_hook = NULL;
116} 119}
diff --git a/arch/mips/kernel/rtlx-mt.c b/arch/mips/kernel/rtlx-mt.c
index 91d61ba422b4..9c1aca00fd54 100644
--- a/arch/mips/kernel/rtlx-mt.c
+++ b/arch/mips/kernel/rtlx-mt.c
@@ -144,5 +144,8 @@ void __exit rtlx_module_exit(void)
144 144
145 for (i = 0; i < RTLX_CHANNELS; i++) 145 for (i = 0; i < RTLX_CHANNELS; i++)
146 device_destroy(mt_class, MKDEV(major, i)); 146 device_destroy(mt_class, MKDEV(major, i));
147
147 unregister_chrdev(major, RTLX_MODULE_NAME); 148 unregister_chrdev(major, RTLX_MODULE_NAME);
149
150 aprp_hook = NULL;
148} 151}
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/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index 506925b2c3f3..0b4e2e38294b 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -1538,10 +1538,10 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
1538 break; 1538 break;
1539 } 1539 }
1540 1540
1541 case 0x7: /* 7 */ 1541 case 0x3:
1542 if (MIPSInst_FUNC(ir) != pfetch_op) { 1542 if (MIPSInst_FUNC(ir) != pfetch_op)
1543 return SIGILL; 1543 return SIGILL;
1544 } 1544
1545 /* ignore prefx operation */ 1545 /* ignore prefx operation */
1546 break; 1546 break;
1547 1547
diff --git a/arch/mips/mti-malta/malta-amon.c b/arch/mips/mti-malta/malta-amon.c
index 592ac0427426..84ac523b0ce0 100644
--- a/arch/mips/mti-malta/malta-amon.c
+++ b/arch/mips/mti-malta/malta-amon.c
@@ -72,7 +72,7 @@ int amon_cpu_start(int cpu,
72 return 0; 72 return 0;
73} 73}
74 74
75#ifdef CONFIG_MIPS_VPE_LOADER 75#ifdef CONFIG_MIPS_VPE_LOADER_CMP
76int vpe_run(struct vpe *v) 76int vpe_run(struct vpe *v)
77{ 77{
78 struct vpe_notifications *n; 78 struct vpe_notifications *n;
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index ca3e3a46a42f..2242181a6284 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -119,7 +119,7 @@ static void malta_hw0_irqdispatch(void)
119 119
120 do_IRQ(MALTA_INT_BASE + irq); 120 do_IRQ(MALTA_INT_BASE + irq);
121 121
122#ifdef MIPS_VPE_APSP_API 122#ifdef CONFIG_MIPS_VPE_APSP_API_MT
123 if (aprp_hook) 123 if (aprp_hook)
124 aprp_hook(); 124 aprp_hook();
125#endif 125#endif
@@ -310,7 +310,7 @@ static void ipi_call_dispatch(void)
310 310
311static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) 311static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id)
312{ 312{
313#ifdef MIPS_VPE_APSP_API 313#ifdef CONFIG_MIPS_VPE_APSP_API_CMP
314 if (aprp_hook) 314 if (aprp_hook)
315 aprp_hook(); 315 aprp_hook();
316#endif 316#endif
diff --git a/arch/mips/pci/msi-octeon.c b/arch/mips/pci/msi-octeon.c
index d37be36dc659..2b91b0e61566 100644
--- a/arch/mips/pci/msi-octeon.c
+++ b/arch/mips/pci/msi-octeon.c
@@ -150,6 +150,7 @@ msi_irq_allocated:
150 msg.address_lo = 150 msg.address_lo =
151 ((128ul << 20) + CVMX_PCI_MSI_RCV) & 0xffffffff; 151 ((128ul << 20) + CVMX_PCI_MSI_RCV) & 0xffffffff;
152 msg.address_hi = ((128ul << 20) + CVMX_PCI_MSI_RCV) >> 32; 152 msg.address_hi = ((128ul << 20) + CVMX_PCI_MSI_RCV) >> 32;
153 break;
153 case OCTEON_DMA_BAR_TYPE_BIG: 154 case OCTEON_DMA_BAR_TYPE_BIG:
154 /* When using big bar, Bar 0 is based at 0 */ 155 /* When using big bar, Bar 0 is based at 0 */
155 msg.address_lo = (0 + CVMX_PCI_MSI_RCV) & 0xffffffff; 156 msg.address_lo = (0 + CVMX_PCI_MSI_RCV) & 0xffffffff;
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 992e989ab785..654d5ba6e310 100644
--- a/arch/mn10300/include/asm/Kbuild
+++ b/arch/mn10300/include/asm/Kbuild
@@ -1,7 +1,9 @@
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 += trace_clock.h 7generic-y += mcs_spinlock.h
7generic-y += preempt.h 8generic-y += preempt.h
9generic-y += trace_clock.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/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index 2e40f1ca8667..480af0d9c2f5 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -10,8 +10,8 @@ generic-y += bugs.h
10generic-y += cacheflush.h 10generic-y += cacheflush.h
11generic-y += checksum.h 11generic-y += checksum.h
12generic-y += clkdev.h 12generic-y += clkdev.h
13generic-y += cmpxchg.h
14generic-y += cmpxchg-local.h 13generic-y += cmpxchg-local.h
14generic-y += cmpxchg.h
15generic-y += cputime.h 15generic-y += cputime.h
16generic-y += current.h 16generic-y += current.h
17generic-y += device.h 17generic-y += device.h
@@ -25,6 +25,7 @@ generic-y += fcntl.h
25generic-y += ftrace.h 25generic-y += ftrace.h
26generic-y += futex.h 26generic-y += futex.h
27generic-y += hardirq.h 27generic-y += hardirq.h
28generic-y += hash.h
28generic-y += hw_irq.h 29generic-y += hw_irq.h
29generic-y += ioctl.h 30generic-y += ioctl.h
30generic-y += ioctls.h 31generic-y += ioctls.h
@@ -34,6 +35,7 @@ generic-y += kdebug.h
34generic-y += kmap_types.h 35generic-y += kmap_types.h
35generic-y += kvm_para.h 36generic-y += kvm_para.h
36generic-y += local.h 37generic-y += local.h
38generic-y += mcs_spinlock.h
37generic-y += mman.h 39generic-y += mman.h
38generic-y += module.h 40generic-y += module.h
39generic-y += msgbuf.h 41generic-y += msgbuf.h
@@ -41,6 +43,7 @@ generic-y += pci.h
41generic-y += percpu.h 43generic-y += percpu.h
42generic-y += poll.h 44generic-y += poll.h
43generic-y += posix_types.h 45generic-y += posix_types.h
46generic-y += preempt.h
44generic-y += resource.h 47generic-y += resource.h
45generic-y += scatterlist.h 48generic-y += scatterlist.h
46generic-y += sections.h 49generic-y += sections.h
@@ -53,11 +56,11 @@ generic-y += siginfo.h
53generic-y += signal.h 56generic-y += signal.h
54generic-y += socket.h 57generic-y += socket.h
55generic-y += sockios.h 58generic-y += sockios.h
56generic-y += statfs.h
57generic-y += stat.h 59generic-y += stat.h
60generic-y += statfs.h
58generic-y += string.h 61generic-y += string.h
59generic-y += switch_to.h
60generic-y += swab.h 62generic-y += swab.h
63generic-y += switch_to.h
61generic-y += termbits.h 64generic-y += termbits.h
62generic-y += termios.h 65generic-y += termios.h
63generic-y += topology.h 66generic-y += topology.h
@@ -68,5 +71,3 @@ generic-y += user.h
68generic-y += vga.h 71generic-y += vga.h
69generic-y += word-at-a-time.h 72generic-y += word-at-a-time.h
70generic-y += xor.h 73generic-y += xor.h
71generic-y += preempt.h
72generic-y += hash.h
diff --git a/arch/parisc/include/asm/Kbuild b/arch/parisc/include/asm/Kbuild
index 752c981bc3c7..ecf25e6678ad 100644
--- a/arch/parisc/include/asm/Kbuild
+++ b/arch/parisc/include/asm/Kbuild
@@ -1,9 +1,29 @@
1 1
2generic-y += auxvec.h
2generic-y += barrier.h 3generic-y += barrier.h
3generic-y += word-at-a-time.h auxvec.h user.h cputime.h emergency-restart.h \ 4generic-y += clkdev.h
4 segment.h topology.h vga.h device.h percpu.h hw_irq.h mutex.h \ 5generic-y += cputime.h
5 div64.h irq_regs.h kdebug.h kvm_para.h local64.h local.h param.h \ 6generic-y += device.h
6 poll.h xor.h clkdev.h exec.h 7generic-y += div64.h
7generic-y += trace_clock.h 8generic-y += emergency-restart.h
8generic-y += preempt.h 9generic-y += exec.h
9generic-y += hash.h 10generic-y += hash.h
11generic-y += hw_irq.h
12generic-y += irq_regs.h
13generic-y += kdebug.h
14generic-y += kvm_para.h
15generic-y += local.h
16generic-y += local64.h
17generic-y += mcs_spinlock.h
18generic-y += mutex.h
19generic-y += param.h
20generic-y += percpu.h
21generic-y += poll.h
22generic-y += preempt.h
23generic-y += segment.h
24generic-y += topology.h
25generic-y += trace_clock.h
26generic-y += user.h
27generic-y += vga.h
28generic-y += word-at-a-time.h
29generic-y += xor.h
diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h
index 637fe031aa84..60d5d174dfe4 100644
--- a/arch/parisc/include/asm/page.h
+++ b/arch/parisc/include/asm/page.h
@@ -32,17 +32,6 @@ void copy_page_asm(void *to, void *from);
32void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, 32void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
33 struct page *pg); 33 struct page *pg);
34 34
35/* #define CONFIG_PARISC_TMPALIAS */
36
37#ifdef CONFIG_PARISC_TMPALIAS
38void clear_user_highpage(struct page *page, unsigned long vaddr);
39#define clear_user_highpage clear_user_highpage
40struct vm_area_struct;
41void copy_user_highpage(struct page *to, struct page *from,
42 unsigned long vaddr, struct vm_area_struct *vma);
43#define __HAVE_ARCH_COPY_USER_HIGHPAGE
44#endif
45
46/* 35/*
47 * These are used to make use of C type-checking.. 36 * These are used to make use of C type-checking..
48 */ 37 */
diff --git a/arch/parisc/include/asm/spinlock.h b/arch/parisc/include/asm/spinlock.h
index 3516e0b27044..64f2992e439f 100644
--- a/arch/parisc/include/asm/spinlock.h
+++ b/arch/parisc/include/asm/spinlock.h
@@ -191,8 +191,4 @@ static __inline__ int arch_write_can_lock(arch_rwlock_t *rw)
191#define arch_read_lock_flags(lock, flags) arch_read_lock(lock) 191#define arch_read_lock_flags(lock, flags) arch_read_lock(lock)
192#define arch_write_lock_flags(lock, flags) arch_write_lock(lock) 192#define arch_write_lock_flags(lock, flags) arch_write_lock(lock)
193 193
194#define arch_spin_relax(lock) cpu_relax()
195#define arch_read_relax(lock) cpu_relax()
196#define arch_write_relax(lock) cpu_relax()
197
198#endif /* __ASM_SPINLOCK_H */ 194#endif /* __ASM_SPINLOCK_H */
diff --git a/arch/parisc/include/uapi/asm/unistd.h b/arch/parisc/include/uapi/asm/unistd.h
index 42706794a36f..265ae5190b0a 100644
--- a/arch/parisc/include/uapi/asm/unistd.h
+++ b/arch/parisc/include/uapi/asm/unistd.h
@@ -828,13 +828,13 @@
828#define __NR_finit_module (__NR_Linux + 333) 828#define __NR_finit_module (__NR_Linux + 333)
829#define __NR_sched_setattr (__NR_Linux + 334) 829#define __NR_sched_setattr (__NR_Linux + 334)
830#define __NR_sched_getattr (__NR_Linux + 335) 830#define __NR_sched_getattr (__NR_Linux + 335)
831#define __NR_utimes (__NR_Linux + 336)
831 832
832#define __NR_Linux_syscalls (__NR_sched_getattr + 1) 833#define __NR_Linux_syscalls (__NR_utimes + 1)
833 834
834 835
835#define __IGNORE_select /* newselect */ 836#define __IGNORE_select /* newselect */
836#define __IGNORE_fadvise64 /* fadvise64_64 */ 837#define __IGNORE_fadvise64 /* fadvise64_64 */
837#define __IGNORE_utimes /* utime */
838 838
839 839
840#define HPUX_GATEWAY_ADDR 0xC0000004 840#define HPUX_GATEWAY_ADDR 0xC0000004
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
index ac87a40502e6..a6ffc775a9f8 100644
--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -581,67 +581,3 @@ flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long
581 __flush_cache_page(vma, vmaddr, PFN_PHYS(pfn)); 581 __flush_cache_page(vma, vmaddr, PFN_PHYS(pfn));
582 } 582 }
583} 583}
584
585#ifdef CONFIG_PARISC_TMPALIAS
586
587void clear_user_highpage(struct page *page, unsigned long vaddr)
588{
589 void *vto;
590 unsigned long flags;
591
592 /* Clear using TMPALIAS region. The page doesn't need to
593 be flushed but the kernel mapping needs to be purged. */
594
595 vto = kmap_atomic(page);
596
597 /* The PA-RISC 2.0 Architecture book states on page F-6:
598 "Before a write-capable translation is enabled, *all*
599 non-equivalently-aliased translations must be removed
600 from the page table and purged from the TLB. (Note
601 that the caches are not required to be flushed at this
602 time.) Before any non-equivalent aliased translation
603 is re-enabled, the virtual address range for the writeable
604 page (the entire page) must be flushed from the cache,
605 and the write-capable translation removed from the page
606 table and purged from the TLB." */
607
608 purge_kernel_dcache_page_asm((unsigned long)vto);
609 purge_tlb_start(flags);
610 pdtlb_kernel(vto);
611 purge_tlb_end(flags);
612 preempt_disable();
613 clear_user_page_asm(vto, vaddr);
614 preempt_enable();
615
616 pagefault_enable(); /* kunmap_atomic(addr, KM_USER0); */
617}
618
619void copy_user_highpage(struct page *to, struct page *from,
620 unsigned long vaddr, struct vm_area_struct *vma)
621{
622 void *vfrom, *vto;
623 unsigned long flags;
624
625 /* Copy using TMPALIAS region. This has the advantage
626 that the `from' page doesn't need to be flushed. However,
627 the `to' page must be flushed in copy_user_page_asm since
628 it can be used to bring in executable code. */
629
630 vfrom = kmap_atomic(from);
631 vto = kmap_atomic(to);
632
633 purge_kernel_dcache_page_asm((unsigned long)vto);
634 purge_tlb_start(flags);
635 pdtlb_kernel(vto);
636 pdtlb_kernel(vfrom);
637 purge_tlb_end(flags);
638 preempt_disable();
639 copy_user_page_asm(vto, vfrom, vaddr);
640 flush_dcache_page_asm(__pa(vto), vaddr);
641 preempt_enable();
642
643 pagefault_enable(); /* kunmap_atomic(addr, KM_USER1); */
644 pagefault_enable(); /* kunmap_atomic(addr, KM_USER0); */
645}
646
647#endif /* CONFIG_PARISC_TMPALIAS */
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/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index 8fa3fbb3e4d3..80e5dd248934 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -431,6 +431,7 @@
431 ENTRY_SAME(finit_module) 431 ENTRY_SAME(finit_module)
432 ENTRY_SAME(sched_setattr) 432 ENTRY_SAME(sched_setattr)
433 ENTRY_SAME(sched_getattr) /* 335 */ 433 ENTRY_SAME(sched_getattr) /* 335 */
434 ENTRY_COMP(utimes)
434 435
435 /* Nothing yet */ 436 /* Nothing yet */
436 437
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 957bf344c0f5..b9fcecc706ab 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -736,10 +736,6 @@ config FSL_LBC
736 controller. Also contains some common code used by 736 controller. Also contains some common code used by
737 drivers for specific local bus peripherals. 737 drivers for specific local bus peripherals.
738 738
739config FSL_IFC
740 bool
741 depends on FSL_SOC
742
743config FSL_GTM 739config FSL_GTM
744 bool 740 bool
745 depends on PPC_83xx || QUICC_ENGINE || CPM2 741 depends on PPC_83xx || QUICC_ENGINE || CPM2
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index 6c0a955a1b06..3fb1bc432f4f 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -1,7 +1,8 @@
1 1
2generic-y += clkdev.h 2generic-y += clkdev.h
3generic-y += hash.h
4generic-y += mcs_spinlock.h
5generic-y += preempt.h
3generic-y += rwsem.h 6generic-y += rwsem.h
4generic-y += trace_clock.h 7generic-y += trace_clock.h
5generic-y += preempt.h
6generic-y += vtime.h 8generic-y += vtime.h
7generic-y += hash.h
diff --git a/arch/powerpc/include/asm/fsl_ifc.h b/arch/powerpc/include/asm/fsl_ifc.h
deleted file mode 100644
index f49ddb1b2273..000000000000
--- a/arch/powerpc/include/asm/fsl_ifc.h
+++ /dev/null
@@ -1,838 +0,0 @@
1/* Freescale Integrated Flash Controller
2 *
3 * Copyright 2011 Freescale Semiconductor, Inc
4 *
5 * Author: Dipen Dudhat <dipen.dudhat@freescale.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 as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef __ASM_FSL_IFC_H
23#define __ASM_FSL_IFC_H
24
25#include <linux/compiler.h>
26#include <linux/types.h>
27#include <linux/io.h>
28
29#include <linux/of_platform.h>
30#include <linux/interrupt.h>
31
32#define FSL_IFC_BANK_COUNT 4
33
34/*
35 * CSPR - Chip Select Property Register
36 */
37#define CSPR_BA 0xFFFF0000
38#define CSPR_BA_SHIFT 16
39#define CSPR_PORT_SIZE 0x00000180
40#define CSPR_PORT_SIZE_SHIFT 7
41/* Port Size 8 bit */
42#define CSPR_PORT_SIZE_8 0x00000080
43/* Port Size 16 bit */
44#define CSPR_PORT_SIZE_16 0x00000100
45/* Port Size 32 bit */
46#define CSPR_PORT_SIZE_32 0x00000180
47/* Write Protect */
48#define CSPR_WP 0x00000040
49#define CSPR_WP_SHIFT 6
50/* Machine Select */
51#define CSPR_MSEL 0x00000006
52#define CSPR_MSEL_SHIFT 1
53/* NOR */
54#define CSPR_MSEL_NOR 0x00000000
55/* NAND */
56#define CSPR_MSEL_NAND 0x00000002
57/* GPCM */
58#define CSPR_MSEL_GPCM 0x00000004
59/* Bank Valid */
60#define CSPR_V 0x00000001
61#define CSPR_V_SHIFT 0
62
63/*
64 * Address Mask Register
65 */
66#define IFC_AMASK_MASK 0xFFFF0000
67#define IFC_AMASK_SHIFT 16
68#define IFC_AMASK(n) (IFC_AMASK_MASK << \
69 (__ilog2(n) - IFC_AMASK_SHIFT))
70
71/*
72 * Chip Select Option Register IFC_NAND Machine
73 */
74/* Enable ECC Encoder */
75#define CSOR_NAND_ECC_ENC_EN 0x80000000
76#define CSOR_NAND_ECC_MODE_MASK 0x30000000
77/* 4 bit correction per 520 Byte sector */
78#define CSOR_NAND_ECC_MODE_4 0x00000000
79/* 8 bit correction per 528 Byte sector */
80#define CSOR_NAND_ECC_MODE_8 0x10000000
81/* Enable ECC Decoder */
82#define CSOR_NAND_ECC_DEC_EN 0x04000000
83/* Row Address Length */
84#define CSOR_NAND_RAL_MASK 0x01800000
85#define CSOR_NAND_RAL_SHIFT 20
86#define CSOR_NAND_RAL_1 0x00000000
87#define CSOR_NAND_RAL_2 0x00800000
88#define CSOR_NAND_RAL_3 0x01000000
89#define CSOR_NAND_RAL_4 0x01800000
90/* Page Size 512b, 2k, 4k */
91#define CSOR_NAND_PGS_MASK 0x00180000
92#define CSOR_NAND_PGS_SHIFT 16
93#define CSOR_NAND_PGS_512 0x00000000
94#define CSOR_NAND_PGS_2K 0x00080000
95#define CSOR_NAND_PGS_4K 0x00100000
96#define CSOR_NAND_PGS_8K 0x00180000
97/* Spare region Size */
98#define CSOR_NAND_SPRZ_MASK 0x0000E000
99#define CSOR_NAND_SPRZ_SHIFT 13
100#define CSOR_NAND_SPRZ_16 0x00000000
101#define CSOR_NAND_SPRZ_64 0x00002000
102#define CSOR_NAND_SPRZ_128 0x00004000
103#define CSOR_NAND_SPRZ_210 0x00006000
104#define CSOR_NAND_SPRZ_218 0x00008000
105#define CSOR_NAND_SPRZ_224 0x0000A000
106#define CSOR_NAND_SPRZ_CSOR_EXT 0x0000C000
107/* Pages Per Block */
108#define CSOR_NAND_PB_MASK 0x00000700
109#define CSOR_NAND_PB_SHIFT 8
110#define CSOR_NAND_PB(n) ((__ilog2(n) - 5) << CSOR_NAND_PB_SHIFT)
111/* Time for Read Enable High to Output High Impedance */
112#define CSOR_NAND_TRHZ_MASK 0x0000001C
113#define CSOR_NAND_TRHZ_SHIFT 2
114#define CSOR_NAND_TRHZ_20 0x00000000
115#define CSOR_NAND_TRHZ_40 0x00000004
116#define CSOR_NAND_TRHZ_60 0x00000008
117#define CSOR_NAND_TRHZ_80 0x0000000C
118#define CSOR_NAND_TRHZ_100 0x00000010
119/* Buffer control disable */
120#define CSOR_NAND_BCTLD 0x00000001
121
122/*
123 * Chip Select Option Register - NOR Flash Mode
124 */
125/* Enable Address shift Mode */
126#define CSOR_NOR_ADM_SHFT_MODE_EN 0x80000000
127/* Page Read Enable from NOR device */
128#define CSOR_NOR_PGRD_EN 0x10000000
129/* AVD Toggle Enable during Burst Program */
130#define CSOR_NOR_AVD_TGL_PGM_EN 0x01000000
131/* Address Data Multiplexing Shift */
132#define CSOR_NOR_ADM_MASK 0x0003E000
133#define CSOR_NOR_ADM_SHIFT_SHIFT 13
134#define CSOR_NOR_ADM_SHIFT(n) ((n) << CSOR_NOR_ADM_SHIFT_SHIFT)
135/* Type of the NOR device hooked */
136#define CSOR_NOR_NOR_MODE_AYSNC_NOR 0x00000000
137#define CSOR_NOR_NOR_MODE_AVD_NOR 0x00000020
138/* Time for Read Enable High to Output High Impedance */
139#define CSOR_NOR_TRHZ_MASK 0x0000001C
140#define CSOR_NOR_TRHZ_SHIFT 2
141#define CSOR_NOR_TRHZ_20 0x00000000
142#define CSOR_NOR_TRHZ_40 0x00000004
143#define CSOR_NOR_TRHZ_60 0x00000008
144#define CSOR_NOR_TRHZ_80 0x0000000C
145#define CSOR_NOR_TRHZ_100 0x00000010
146/* Buffer control disable */
147#define CSOR_NOR_BCTLD 0x00000001
148
149/*
150 * Chip Select Option Register - GPCM Mode
151 */
152/* GPCM Mode - Normal */
153#define CSOR_GPCM_GPMODE_NORMAL 0x00000000
154/* GPCM Mode - GenericASIC */
155#define CSOR_GPCM_GPMODE_ASIC 0x80000000
156/* Parity Mode odd/even */
157#define CSOR_GPCM_PARITY_EVEN 0x40000000
158/* Parity Checking enable/disable */
159#define CSOR_GPCM_PAR_EN 0x20000000
160/* GPCM Timeout Count */
161#define CSOR_GPCM_GPTO_MASK 0x0F000000
162#define CSOR_GPCM_GPTO_SHIFT 24
163#define CSOR_GPCM_GPTO(n) ((__ilog2(n) - 8) << CSOR_GPCM_GPTO_SHIFT)
164/* GPCM External Access Termination mode for read access */
165#define CSOR_GPCM_RGETA_EXT 0x00080000
166/* GPCM External Access Termination mode for write access */
167#define CSOR_GPCM_WGETA_EXT 0x00040000
168/* Address Data Multiplexing Shift */
169#define CSOR_GPCM_ADM_MASK 0x0003E000
170#define CSOR_GPCM_ADM_SHIFT_SHIFT 13
171#define CSOR_GPCM_ADM_SHIFT(n) ((n) << CSOR_GPCM_ADM_SHIFT_SHIFT)
172/* Generic ASIC Parity error indication delay */
173#define CSOR_GPCM_GAPERRD_MASK 0x00000180
174#define CSOR_GPCM_GAPERRD_SHIFT 7
175#define CSOR_GPCM_GAPERRD(n) (((n) - 1) << CSOR_GPCM_GAPERRD_SHIFT)
176/* Time for Read Enable High to Output High Impedance */
177#define CSOR_GPCM_TRHZ_MASK 0x0000001C
178#define CSOR_GPCM_TRHZ_20 0x00000000
179#define CSOR_GPCM_TRHZ_40 0x00000004
180#define CSOR_GPCM_TRHZ_60 0x00000008
181#define CSOR_GPCM_TRHZ_80 0x0000000C
182#define CSOR_GPCM_TRHZ_100 0x00000010
183/* Buffer control disable */
184#define CSOR_GPCM_BCTLD 0x00000001
185
186/*
187 * Ready Busy Status Register (RB_STAT)
188 */
189/* CSn is READY */
190#define IFC_RB_STAT_READY_CS0 0x80000000
191#define IFC_RB_STAT_READY_CS1 0x40000000
192#define IFC_RB_STAT_READY_CS2 0x20000000
193#define IFC_RB_STAT_READY_CS3 0x10000000
194
195/*
196 * General Control Register (GCR)
197 */
198#define IFC_GCR_MASK 0x8000F800
199/* reset all IFC hardware */
200#define IFC_GCR_SOFT_RST_ALL 0x80000000
201/* Turnaroud Time of external buffer */
202#define IFC_GCR_TBCTL_TRN_TIME 0x0000F800
203#define IFC_GCR_TBCTL_TRN_TIME_SHIFT 11
204
205/*
206 * Common Event and Error Status Register (CM_EVTER_STAT)
207 */
208/* Chip select error */
209#define IFC_CM_EVTER_STAT_CSER 0x80000000
210
211/*
212 * Common Event and Error Enable Register (CM_EVTER_EN)
213 */
214/* Chip select error checking enable */
215#define IFC_CM_EVTER_EN_CSEREN 0x80000000
216
217/*
218 * Common Event and Error Interrupt Enable Register (CM_EVTER_INTR_EN)
219 */
220/* Chip select error interrupt enable */
221#define IFC_CM_EVTER_INTR_EN_CSERIREN 0x80000000
222
223/*
224 * Common Transfer Error Attribute Register-0 (CM_ERATTR0)
225 */
226/* transaction type of error Read/Write */
227#define IFC_CM_ERATTR0_ERTYP_READ 0x80000000
228#define IFC_CM_ERATTR0_ERAID 0x0FF00000
229#define IFC_CM_ERATTR0_ERAID_SHIFT 20
230#define IFC_CM_ERATTR0_ESRCID 0x0000FF00
231#define IFC_CM_ERATTR0_ESRCID_SHIFT 8
232
233/*
234 * Clock Control Register (CCR)
235 */
236#define IFC_CCR_MASK 0x0F0F8800
237/* Clock division ratio */
238#define IFC_CCR_CLK_DIV_MASK 0x0F000000
239#define IFC_CCR_CLK_DIV_SHIFT 24
240#define IFC_CCR_CLK_DIV(n) ((n-1) << IFC_CCR_CLK_DIV_SHIFT)
241/* IFC Clock Delay */
242#define IFC_CCR_CLK_DLY_MASK 0x000F0000
243#define IFC_CCR_CLK_DLY_SHIFT 16
244#define IFC_CCR_CLK_DLY(n) ((n) << IFC_CCR_CLK_DLY_SHIFT)
245/* Invert IFC clock before sending out */
246#define IFC_CCR_INV_CLK_EN 0x00008000
247/* Fedback IFC Clock */
248#define IFC_CCR_FB_IFC_CLK_SEL 0x00000800
249
250/*
251 * Clock Status Register (CSR)
252 */
253/* Clk is stable */
254#define IFC_CSR_CLK_STAT_STABLE 0x80000000
255
256/*
257 * IFC_NAND Machine Specific Registers
258 */
259/*
260 * NAND Configuration Register (NCFGR)
261 */
262/* Auto Boot Mode */
263#define IFC_NAND_NCFGR_BOOT 0x80000000
264/* Addressing Mode-ROW0+n/COL0 */
265#define IFC_NAND_NCFGR_ADDR_MODE_RC0 0x00000000
266/* Addressing Mode-ROW0+n/COL0+n */
267#define IFC_NAND_NCFGR_ADDR_MODE_RC1 0x00400000
268/* Number of loop iterations of FIR sequences for multi page operations */
269#define IFC_NAND_NCFGR_NUM_LOOP_MASK 0x0000F000
270#define IFC_NAND_NCFGR_NUM_LOOP_SHIFT 12
271#define IFC_NAND_NCFGR_NUM_LOOP(n) ((n) << IFC_NAND_NCFGR_NUM_LOOP_SHIFT)
272/* Number of wait cycles */
273#define IFC_NAND_NCFGR_NUM_WAIT_MASK 0x000000FF
274#define IFC_NAND_NCFGR_NUM_WAIT_SHIFT 0
275
276/*
277 * NAND Flash Command Registers (NAND_FCR0/NAND_FCR1)
278 */
279/* General purpose FCM flash command bytes CMD0-CMD7 */
280#define IFC_NAND_FCR0_CMD0 0xFF000000
281#define IFC_NAND_FCR0_CMD0_SHIFT 24
282#define IFC_NAND_FCR0_CMD1 0x00FF0000
283#define IFC_NAND_FCR0_CMD1_SHIFT 16
284#define IFC_NAND_FCR0_CMD2 0x0000FF00
285#define IFC_NAND_FCR0_CMD2_SHIFT 8
286#define IFC_NAND_FCR0_CMD3 0x000000FF
287#define IFC_NAND_FCR0_CMD3_SHIFT 0
288#define IFC_NAND_FCR1_CMD4 0xFF000000
289#define IFC_NAND_FCR1_CMD4_SHIFT 24
290#define IFC_NAND_FCR1_CMD5 0x00FF0000
291#define IFC_NAND_FCR1_CMD5_SHIFT 16
292#define IFC_NAND_FCR1_CMD6 0x0000FF00
293#define IFC_NAND_FCR1_CMD6_SHIFT 8
294#define IFC_NAND_FCR1_CMD7 0x000000FF
295#define IFC_NAND_FCR1_CMD7_SHIFT 0
296
297/*
298 * Flash ROW and COL Address Register (ROWn, COLn)
299 */
300/* Main/spare region locator */
301#define IFC_NAND_COL_MS 0x80000000
302/* Column Address */
303#define IFC_NAND_COL_CA_MASK 0x00000FFF
304
305/*
306 * NAND Flash Byte Count Register (NAND_BC)
307 */
308/* Byte Count for read/Write */
309#define IFC_NAND_BC 0x000001FF
310
311/*
312 * NAND Flash Instruction Registers (NAND_FIR0/NAND_FIR1/NAND_FIR2)
313 */
314/* NAND Machine specific opcodes OP0-OP14*/
315#define IFC_NAND_FIR0_OP0 0xFC000000
316#define IFC_NAND_FIR0_OP0_SHIFT 26
317#define IFC_NAND_FIR0_OP1 0x03F00000
318#define IFC_NAND_FIR0_OP1_SHIFT 20
319#define IFC_NAND_FIR0_OP2 0x000FC000
320#define IFC_NAND_FIR0_OP2_SHIFT 14
321#define IFC_NAND_FIR0_OP3 0x00003F00
322#define IFC_NAND_FIR0_OP3_SHIFT 8
323#define IFC_NAND_FIR0_OP4 0x000000FC
324#define IFC_NAND_FIR0_OP4_SHIFT 2
325#define IFC_NAND_FIR1_OP5 0xFC000000
326#define IFC_NAND_FIR1_OP5_SHIFT 26
327#define IFC_NAND_FIR1_OP6 0x03F00000
328#define IFC_NAND_FIR1_OP6_SHIFT 20
329#define IFC_NAND_FIR1_OP7 0x000FC000
330#define IFC_NAND_FIR1_OP7_SHIFT 14
331#define IFC_NAND_FIR1_OP8 0x00003F00
332#define IFC_NAND_FIR1_OP8_SHIFT 8
333#define IFC_NAND_FIR1_OP9 0x000000FC
334#define IFC_NAND_FIR1_OP9_SHIFT 2
335#define IFC_NAND_FIR2_OP10 0xFC000000
336#define IFC_NAND_FIR2_OP10_SHIFT 26
337#define IFC_NAND_FIR2_OP11 0x03F00000
338#define IFC_NAND_FIR2_OP11_SHIFT 20
339#define IFC_NAND_FIR2_OP12 0x000FC000
340#define IFC_NAND_FIR2_OP12_SHIFT 14
341#define IFC_NAND_FIR2_OP13 0x00003F00
342#define IFC_NAND_FIR2_OP13_SHIFT 8
343#define IFC_NAND_FIR2_OP14 0x000000FC
344#define IFC_NAND_FIR2_OP14_SHIFT 2
345
346/*
347 * Instruction opcodes to be programmed
348 * in FIR registers- 6bits
349 */
350enum ifc_nand_fir_opcodes {
351 IFC_FIR_OP_NOP,
352 IFC_FIR_OP_CA0,
353 IFC_FIR_OP_CA1,
354 IFC_FIR_OP_CA2,
355 IFC_FIR_OP_CA3,
356 IFC_FIR_OP_RA0,
357 IFC_FIR_OP_RA1,
358 IFC_FIR_OP_RA2,
359 IFC_FIR_OP_RA3,
360 IFC_FIR_OP_CMD0,
361 IFC_FIR_OP_CMD1,
362 IFC_FIR_OP_CMD2,
363 IFC_FIR_OP_CMD3,
364 IFC_FIR_OP_CMD4,
365 IFC_FIR_OP_CMD5,
366 IFC_FIR_OP_CMD6,
367 IFC_FIR_OP_CMD7,
368 IFC_FIR_OP_CW0,
369 IFC_FIR_OP_CW1,
370 IFC_FIR_OP_CW2,
371 IFC_FIR_OP_CW3,
372 IFC_FIR_OP_CW4,
373 IFC_FIR_OP_CW5,
374 IFC_FIR_OP_CW6,
375 IFC_FIR_OP_CW7,
376 IFC_FIR_OP_WBCD,
377 IFC_FIR_OP_RBCD,
378 IFC_FIR_OP_BTRD,
379 IFC_FIR_OP_RDSTAT,
380 IFC_FIR_OP_NWAIT,
381 IFC_FIR_OP_WFR,
382 IFC_FIR_OP_SBRD,
383 IFC_FIR_OP_UA,
384 IFC_FIR_OP_RB,
385};
386
387/*
388 * NAND Chip Select Register (NAND_CSEL)
389 */
390#define IFC_NAND_CSEL 0x0C000000
391#define IFC_NAND_CSEL_SHIFT 26
392#define IFC_NAND_CSEL_CS0 0x00000000
393#define IFC_NAND_CSEL_CS1 0x04000000
394#define IFC_NAND_CSEL_CS2 0x08000000
395#define IFC_NAND_CSEL_CS3 0x0C000000
396
397/*
398 * NAND Operation Sequence Start (NANDSEQ_STRT)
399 */
400/* NAND Flash Operation Start */
401#define IFC_NAND_SEQ_STRT_FIR_STRT 0x80000000
402/* Automatic Erase */
403#define IFC_NAND_SEQ_STRT_AUTO_ERS 0x00800000
404/* Automatic Program */
405#define IFC_NAND_SEQ_STRT_AUTO_PGM 0x00100000
406/* Automatic Copyback */
407#define IFC_NAND_SEQ_STRT_AUTO_CPB 0x00020000
408/* Automatic Read Operation */
409#define IFC_NAND_SEQ_STRT_AUTO_RD 0x00004000
410/* Automatic Status Read */
411#define IFC_NAND_SEQ_STRT_AUTO_STAT_RD 0x00000800
412
413/*
414 * NAND Event and Error Status Register (NAND_EVTER_STAT)
415 */
416/* Operation Complete */
417#define IFC_NAND_EVTER_STAT_OPC 0x80000000
418/* Flash Timeout Error */
419#define IFC_NAND_EVTER_STAT_FTOER 0x08000000
420/* Write Protect Error */
421#define IFC_NAND_EVTER_STAT_WPER 0x04000000
422/* ECC Error */
423#define IFC_NAND_EVTER_STAT_ECCER 0x02000000
424/* RCW Load Done */
425#define IFC_NAND_EVTER_STAT_RCW_DN 0x00008000
426/* Boot Loadr Done */
427#define IFC_NAND_EVTER_STAT_BOOT_DN 0x00004000
428/* Bad Block Indicator search select */
429#define IFC_NAND_EVTER_STAT_BBI_SRCH_SE 0x00000800
430
431/*
432 * NAND Flash Page Read Completion Event Status Register
433 * (PGRDCMPL_EVT_STAT)
434 */
435#define PGRDCMPL_EVT_STAT_MASK 0xFFFF0000
436/* Small Page 0-15 Done */
437#define PGRDCMPL_EVT_STAT_SECTION_SP(n) (1 << (31 - (n)))
438/* Large Page(2K) 0-3 Done */
439#define PGRDCMPL_EVT_STAT_LP_2K(n) (0xF << (28 - (n)*4))
440/* Large Page(4K) 0-1 Done */
441#define PGRDCMPL_EVT_STAT_LP_4K(n) (0xFF << (24 - (n)*8))
442
443/*
444 * NAND Event and Error Enable Register (NAND_EVTER_EN)
445 */
446/* Operation complete event enable */
447#define IFC_NAND_EVTER_EN_OPC_EN 0x80000000
448/* Page read complete event enable */
449#define IFC_NAND_EVTER_EN_PGRDCMPL_EN 0x20000000
450/* Flash Timeout error enable */
451#define IFC_NAND_EVTER_EN_FTOER_EN 0x08000000
452/* Write Protect error enable */
453#define IFC_NAND_EVTER_EN_WPER_EN 0x04000000
454/* ECC error logging enable */
455#define IFC_NAND_EVTER_EN_ECCER_EN 0x02000000
456
457/*
458 * NAND Event and Error Interrupt Enable Register (NAND_EVTER_INTR_EN)
459 */
460/* Enable interrupt for operation complete */
461#define IFC_NAND_EVTER_INTR_OPCIR_EN 0x80000000
462/* Enable interrupt for Page read complete */
463#define IFC_NAND_EVTER_INTR_PGRDCMPLIR_EN 0x20000000
464/* Enable interrupt for Flash timeout error */
465#define IFC_NAND_EVTER_INTR_FTOERIR_EN 0x08000000
466/* Enable interrupt for Write protect error */
467#define IFC_NAND_EVTER_INTR_WPERIR_EN 0x04000000
468/* Enable interrupt for ECC error*/
469#define IFC_NAND_EVTER_INTR_ECCERIR_EN 0x02000000
470
471/*
472 * NAND Transfer Error Attribute Register-0 (NAND_ERATTR0)
473 */
474#define IFC_NAND_ERATTR0_MASK 0x0C080000
475/* Error on CS0-3 for NAND */
476#define IFC_NAND_ERATTR0_ERCS_CS0 0x00000000
477#define IFC_NAND_ERATTR0_ERCS_CS1 0x04000000
478#define IFC_NAND_ERATTR0_ERCS_CS2 0x08000000
479#define IFC_NAND_ERATTR0_ERCS_CS3 0x0C000000
480/* Transaction type of error Read/Write */
481#define IFC_NAND_ERATTR0_ERTTYPE_READ 0x00080000
482
483/*
484 * NAND Flash Status Register (NAND_FSR)
485 */
486/* First byte of data read from read status op */
487#define IFC_NAND_NFSR_RS0 0xFF000000
488/* Second byte of data read from read status op */
489#define IFC_NAND_NFSR_RS1 0x00FF0000
490
491/*
492 * ECC Error Status Registers (ECCSTAT0-ECCSTAT3)
493 */
494/* Number of ECC errors on sector n (n = 0-15) */
495#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR0_MASK 0x0F000000
496#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR0_SHIFT 24
497#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR1_MASK 0x000F0000
498#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR1_SHIFT 16
499#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR2_MASK 0x00000F00
500#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR2_SHIFT 8
501#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR3_MASK 0x0000000F
502#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR3_SHIFT 0
503#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR4_MASK 0x0F000000
504#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR4_SHIFT 24
505#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR5_MASK 0x000F0000
506#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR5_SHIFT 16
507#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR6_MASK 0x00000F00
508#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR6_SHIFT 8
509#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR7_MASK 0x0000000F
510#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR7_SHIFT 0
511#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR8_MASK 0x0F000000
512#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR8_SHIFT 24
513#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR9_MASK 0x000F0000
514#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR9_SHIFT 16
515#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR10_MASK 0x00000F00
516#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR10_SHIFT 8
517#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR11_MASK 0x0000000F
518#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR11_SHIFT 0
519#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR12_MASK 0x0F000000
520#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR12_SHIFT 24
521#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR13_MASK 0x000F0000
522#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR13_SHIFT 16
523#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR14_MASK 0x00000F00
524#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR14_SHIFT 8
525#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR15_MASK 0x0000000F
526#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR15_SHIFT 0
527
528/*
529 * NAND Control Register (NANDCR)
530 */
531#define IFC_NAND_NCR_FTOCNT_MASK 0x1E000000
532#define IFC_NAND_NCR_FTOCNT_SHIFT 25
533#define IFC_NAND_NCR_FTOCNT(n) ((_ilog2(n) - 8) << IFC_NAND_NCR_FTOCNT_SHIFT)
534
535/*
536 * NAND_AUTOBOOT_TRGR
537 */
538/* Trigger RCW load */
539#define IFC_NAND_AUTOBOOT_TRGR_RCW_LD 0x80000000
540/* Trigget Auto Boot */
541#define IFC_NAND_AUTOBOOT_TRGR_BOOT_LD 0x20000000
542
543/*
544 * NAND_MDR
545 */
546/* 1st read data byte when opcode SBRD */
547#define IFC_NAND_MDR_RDATA0 0xFF000000
548/* 2nd read data byte when opcode SBRD */
549#define IFC_NAND_MDR_RDATA1 0x00FF0000
550
551/*
552 * NOR Machine Specific Registers
553 */
554/*
555 * NOR Event and Error Status Register (NOR_EVTER_STAT)
556 */
557/* NOR Command Sequence Operation Complete */
558#define IFC_NOR_EVTER_STAT_OPC_NOR 0x80000000
559/* Write Protect Error */
560#define IFC_NOR_EVTER_STAT_WPER 0x04000000
561/* Command Sequence Timeout Error */
562#define IFC_NOR_EVTER_STAT_STOER 0x01000000
563
564/*
565 * NOR Event and Error Enable Register (NOR_EVTER_EN)
566 */
567/* NOR Command Seq complete event enable */
568#define IFC_NOR_EVTER_EN_OPCEN_NOR 0x80000000
569/* Write Protect Error Checking Enable */
570#define IFC_NOR_EVTER_EN_WPEREN 0x04000000
571/* Timeout Error Enable */
572#define IFC_NOR_EVTER_EN_STOEREN 0x01000000
573
574/*
575 * NOR Event and Error Interrupt Enable Register (NOR_EVTER_INTR_EN)
576 */
577/* Enable interrupt for OPC complete */
578#define IFC_NOR_EVTER_INTR_OPCEN_NOR 0x80000000
579/* Enable interrupt for write protect error */
580#define IFC_NOR_EVTER_INTR_WPEREN 0x04000000
581/* Enable interrupt for timeout error */
582#define IFC_NOR_EVTER_INTR_STOEREN 0x01000000
583
584/*
585 * NOR Transfer Error Attribute Register-0 (NOR_ERATTR0)
586 */
587/* Source ID for error transaction */
588#define IFC_NOR_ERATTR0_ERSRCID 0xFF000000
589/* AXI ID for error transation */
590#define IFC_NOR_ERATTR0_ERAID 0x000FF000
591/* Chip select corresponds to NOR error */
592#define IFC_NOR_ERATTR0_ERCS_CS0 0x00000000
593#define IFC_NOR_ERATTR0_ERCS_CS1 0x00000010
594#define IFC_NOR_ERATTR0_ERCS_CS2 0x00000020
595#define IFC_NOR_ERATTR0_ERCS_CS3 0x00000030
596/* Type of transaction read/write */
597#define IFC_NOR_ERATTR0_ERTYPE_READ 0x00000001
598
599/*
600 * NOR Transfer Error Attribute Register-2 (NOR_ERATTR2)
601 */
602#define IFC_NOR_ERATTR2_ER_NUM_PHASE_EXP 0x000F0000
603#define IFC_NOR_ERATTR2_ER_NUM_PHASE_PER 0x00000F00
604
605/*
606 * NOR Control Register (NORCR)
607 */
608#define IFC_NORCR_MASK 0x0F0F0000
609/* No. of Address/Data Phase */
610#define IFC_NORCR_NUM_PHASE_MASK 0x0F000000
611#define IFC_NORCR_NUM_PHASE_SHIFT 24
612#define IFC_NORCR_NUM_PHASE(n) ((n-1) << IFC_NORCR_NUM_PHASE_SHIFT)
613/* Sequence Timeout Count */
614#define IFC_NORCR_STOCNT_MASK 0x000F0000
615#define IFC_NORCR_STOCNT_SHIFT 16
616#define IFC_NORCR_STOCNT(n) ((__ilog2(n) - 8) << IFC_NORCR_STOCNT_SHIFT)
617
618/*
619 * GPCM Machine specific registers
620 */
621/*
622 * GPCM Event and Error Status Register (GPCM_EVTER_STAT)
623 */
624/* Timeout error */
625#define IFC_GPCM_EVTER_STAT_TOER 0x04000000
626/* Parity error */
627#define IFC_GPCM_EVTER_STAT_PER 0x01000000
628
629/*
630 * GPCM Event and Error Enable Register (GPCM_EVTER_EN)
631 */
632/* Timeout error enable */
633#define IFC_GPCM_EVTER_EN_TOER_EN 0x04000000
634/* Parity error enable */
635#define IFC_GPCM_EVTER_EN_PER_EN 0x01000000
636
637/*
638 * GPCM Event and Error Interrupt Enable Register (GPCM_EVTER_INTR_EN)
639 */
640/* Enable Interrupt for timeout error */
641#define IFC_GPCM_EEIER_TOERIR_EN 0x04000000
642/* Enable Interrupt for Parity error */
643#define IFC_GPCM_EEIER_PERIR_EN 0x01000000
644
645/*
646 * GPCM Transfer Error Attribute Register-0 (GPCM_ERATTR0)
647 */
648/* Source ID for error transaction */
649#define IFC_GPCM_ERATTR0_ERSRCID 0xFF000000
650/* AXI ID for error transaction */
651#define IFC_GPCM_ERATTR0_ERAID 0x000FF000
652/* Chip select corresponds to GPCM error */
653#define IFC_GPCM_ERATTR0_ERCS_CS0 0x00000000
654#define IFC_GPCM_ERATTR0_ERCS_CS1 0x00000040
655#define IFC_GPCM_ERATTR0_ERCS_CS2 0x00000080
656#define IFC_GPCM_ERATTR0_ERCS_CS3 0x000000C0
657/* Type of transaction read/Write */
658#define IFC_GPCM_ERATTR0_ERTYPE_READ 0x00000001
659
660/*
661 * GPCM Transfer Error Attribute Register-2 (GPCM_ERATTR2)
662 */
663/* On which beat of address/data parity error is observed */
664#define IFC_GPCM_ERATTR2_PERR_BEAT 0x00000C00
665/* Parity Error on byte */
666#define IFC_GPCM_ERATTR2_PERR_BYTE 0x000000F0
667/* Parity Error reported in addr or data phase */
668#define IFC_GPCM_ERATTR2_PERR_DATA_PHASE 0x00000001
669
670/*
671 * GPCM Status Register (GPCM_STAT)
672 */
673#define IFC_GPCM_STAT_BSY 0x80000000 /* GPCM is busy */
674
675/*
676 * IFC Controller NAND Machine registers
677 */
678struct fsl_ifc_nand {
679 __be32 ncfgr;
680 u32 res1[0x4];
681 __be32 nand_fcr0;
682 __be32 nand_fcr1;
683 u32 res2[0x8];
684 __be32 row0;
685 u32 res3;
686 __be32 col0;
687 u32 res4;
688 __be32 row1;
689 u32 res5;
690 __be32 col1;
691 u32 res6;
692 __be32 row2;
693 u32 res7;
694 __be32 col2;
695 u32 res8;
696 __be32 row3;
697 u32 res9;
698 __be32 col3;
699 u32 res10[0x24];
700 __be32 nand_fbcr;
701 u32 res11;
702 __be32 nand_fir0;
703 __be32 nand_fir1;
704 __be32 nand_fir2;
705 u32 res12[0x10];
706 __be32 nand_csel;
707 u32 res13;
708 __be32 nandseq_strt;
709 u32 res14;
710 __be32 nand_evter_stat;
711 u32 res15;
712 __be32 pgrdcmpl_evt_stat;
713 u32 res16[0x2];
714 __be32 nand_evter_en;
715 u32 res17[0x2];
716 __be32 nand_evter_intr_en;
717 u32 res18[0x2];
718 __be32 nand_erattr0;
719 __be32 nand_erattr1;
720 u32 res19[0x10];
721 __be32 nand_fsr;
722 u32 res20;
723 __be32 nand_eccstat[4];
724 u32 res21[0x20];
725 __be32 nanndcr;
726 u32 res22[0x2];
727 __be32 nand_autoboot_trgr;
728 u32 res23;
729 __be32 nand_mdr;
730 u32 res24[0x5C];
731};
732
733/*
734 * IFC controller NOR Machine registers
735 */
736struct fsl_ifc_nor {
737 __be32 nor_evter_stat;
738 u32 res1[0x2];
739 __be32 nor_evter_en;
740 u32 res2[0x2];
741 __be32 nor_evter_intr_en;
742 u32 res3[0x2];
743 __be32 nor_erattr0;
744 __be32 nor_erattr1;
745 __be32 nor_erattr2;
746 u32 res4[0x4];
747 __be32 norcr;
748 u32 res5[0xEF];
749};
750
751/*
752 * IFC controller GPCM Machine registers
753 */
754struct fsl_ifc_gpcm {
755 __be32 gpcm_evter_stat;
756 u32 res1[0x2];
757 __be32 gpcm_evter_en;
758 u32 res2[0x2];
759 __be32 gpcm_evter_intr_en;
760 u32 res3[0x2];
761 __be32 gpcm_erattr0;
762 __be32 gpcm_erattr1;
763 __be32 gpcm_erattr2;
764 __be32 gpcm_stat;
765 u32 res4[0x1F3];
766};
767
768/*
769 * IFC Controller Registers
770 */
771struct fsl_ifc_regs {
772 __be32 ifc_rev;
773 u32 res1[0x2];
774 struct {
775 __be32 cspr_ext;
776 __be32 cspr;
777 u32 res2;
778 } cspr_cs[FSL_IFC_BANK_COUNT];
779 u32 res3[0x19];
780 struct {
781 __be32 amask;
782 u32 res4[0x2];
783 } amask_cs[FSL_IFC_BANK_COUNT];
784 u32 res5[0x17];
785 struct {
786 __be32 csor_ext;
787 __be32 csor;
788 u32 res6;
789 } csor_cs[FSL_IFC_BANK_COUNT];
790 u32 res7[0x19];
791 struct {
792 __be32 ftim[4];
793 u32 res8[0x8];
794 } ftim_cs[FSL_IFC_BANK_COUNT];
795 u32 res9[0x60];
796 __be32 rb_stat;
797 u32 res10[0x2];
798 __be32 ifc_gcr;
799 u32 res11[0x2];
800 __be32 cm_evter_stat;
801 u32 res12[0x2];
802 __be32 cm_evter_en;
803 u32 res13[0x2];
804 __be32 cm_evter_intr_en;
805 u32 res14[0x2];
806 __be32 cm_erattr0;
807 __be32 cm_erattr1;
808 u32 res15[0x2];
809 __be32 ifc_ccr;
810 __be32 ifc_csr;
811 u32 res16[0x2EB];
812 struct fsl_ifc_nand ifc_nand;
813 struct fsl_ifc_nor ifc_nor;
814 struct fsl_ifc_gpcm ifc_gpcm;
815};
816
817extern unsigned int convert_ifc_address(phys_addr_t addr_base);
818extern int fsl_ifc_find(phys_addr_t addr_base);
819
820/* overview of the fsl ifc controller */
821
822struct fsl_ifc_ctrl {
823 /* device info */
824 struct device *dev;
825 struct fsl_ifc_regs __iomem *regs;
826 int irq;
827 int nand_irq;
828 spinlock_t lock;
829 void *nand;
830
831 u32 nand_stat;
832 wait_queue_head_t nand_wait;
833};
834
835extern struct fsl_ifc_ctrl *fsl_ifc_ctrl_dev;
836
837
838#endif /* __ASM_FSL_IFC_H */
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index d0b5fca6b077..c9202151079f 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -99,7 +99,6 @@ static inline int prrn_is_enabled(void)
99 99
100#ifdef CONFIG_SMP 100#ifdef CONFIG_SMP
101#include <asm/cputable.h> 101#include <asm/cputable.h>
102#define smt_capable() (cpu_has_feature(CPU_FTR_SMT))
103 102
104#ifdef CONFIG_PPC64 103#ifdef CONFIG_PPC64
105#include <asm/smp.h> 104#include <asm/smp.h>
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/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index a9e311f7a9dd..2a4779091a58 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -208,7 +208,6 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
208 unsigned long in_devfn) 208 unsigned long in_devfn)
209{ 209{
210 struct pci_controller* hose; 210 struct pci_controller* hose;
211 struct list_head *ln;
212 struct pci_bus *bus = NULL; 211 struct pci_bus *bus = NULL;
213 struct device_node *hose_node; 212 struct device_node *hose_node;
214 213
@@ -230,8 +229,7 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus,
230 * used on pre-domains setup. We return the first match 229 * used on pre-domains setup. We return the first match
231 */ 230 */
232 231
233 for (ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) { 232 list_for_each_entry(bus, &pci_root_buses, node) {
234 bus = pci_bus_b(ln);
235 if (in_bus >= bus->number && in_bus <= bus->busn_res.end) 233 if (in_bus >= bus->number && in_bus <= bus->busn_res.end)
236 break; 234 break;
237 bus = NULL; 235 bus = NULL;
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 8d4c247f1738..af064d28b365 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1048,6 +1048,15 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
1048 flush_altivec_to_thread(src); 1048 flush_altivec_to_thread(src);
1049 flush_vsx_to_thread(src); 1049 flush_vsx_to_thread(src);
1050 flush_spe_to_thread(src); 1050 flush_spe_to_thread(src);
1051 /*
1052 * Flush TM state out so we can copy it. __switch_to_tm() does this
1053 * flush but it removes the checkpointed state from the current CPU and
1054 * transitions the CPU out of TM mode. Hence we need to call
1055 * tm_recheckpoint_new_task() (on the same task) to restore the
1056 * checkpointed state back and the TM mode.
1057 */
1058 __switch_to_tm(src);
1059 tm_recheckpoint_new_task(src);
1051 1060
1052 *dst = *src; 1061 *dst = *src;
1053 1062
diff --git a/arch/powerpc/kernel/reloc_64.S b/arch/powerpc/kernel/reloc_64.S
index 1482327cfeba..d88736fbece6 100644
--- a/arch/powerpc/kernel/reloc_64.S
+++ b/arch/powerpc/kernel/reloc_64.S
@@ -81,6 +81,7 @@ _GLOBAL(relocate)
81 81
826: blr 826: blr
83 83
84.balign 8
84p_dyn: .llong __dynamic_start - 0b 85p_dyn: .llong __dynamic_start - 0b
85p_rela: .llong __rela_dyn_start - 0b 86p_rela: .llong __rela_dyn_start - 0b
86p_st: .llong _stext - 0b 87p_st: .llong _stext - 0b
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index e66d4ec04d95..818dce344e82 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -1504,73 +1504,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
15041: addi r8,r8,16 15041: addi r8,r8,16
1505 .endr 1505 .endr
1506 1506
1507 /* Save DEC */
1508 mfspr r5,SPRN_DEC
1509 mftb r6
1510 extsw r5,r5
1511 add r5,r5,r6
1512 std r5,VCPU_DEC_EXPIRES(r9)
1513
1514BEGIN_FTR_SECTION
1515 b 8f
1516END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
1517 /* Turn on TM so we can access TFHAR/TFIAR/TEXASR */
1518 mfmsr r8
1519 li r0, 1
1520 rldimi r8, r0, MSR_TM_LG, 63-MSR_TM_LG
1521 mtmsrd r8
1522
1523 /* Save POWER8-specific registers */
1524 mfspr r5, SPRN_IAMR
1525 mfspr r6, SPRN_PSPB
1526 mfspr r7, SPRN_FSCR
1527 std r5, VCPU_IAMR(r9)
1528 stw r6, VCPU_PSPB(r9)
1529 std r7, VCPU_FSCR(r9)
1530 mfspr r5, SPRN_IC
1531 mfspr r6, SPRN_VTB
1532 mfspr r7, SPRN_TAR
1533 std r5, VCPU_IC(r9)
1534 std r6, VCPU_VTB(r9)
1535 std r7, VCPU_TAR(r9)
1536#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1537 mfspr r5, SPRN_TFHAR
1538 mfspr r6, SPRN_TFIAR
1539 mfspr r7, SPRN_TEXASR
1540 std r5, VCPU_TFHAR(r9)
1541 std r6, VCPU_TFIAR(r9)
1542 std r7, VCPU_TEXASR(r9)
1543#endif
1544 mfspr r8, SPRN_EBBHR
1545 std r8, VCPU_EBBHR(r9)
1546 mfspr r5, SPRN_EBBRR
1547 mfspr r6, SPRN_BESCR
1548 mfspr r7, SPRN_CSIGR
1549 mfspr r8, SPRN_TACR
1550 std r5, VCPU_EBBRR(r9)
1551 std r6, VCPU_BESCR(r9)
1552 std r7, VCPU_CSIGR(r9)
1553 std r8, VCPU_TACR(r9)
1554 mfspr r5, SPRN_TCSCR
1555 mfspr r6, SPRN_ACOP
1556 mfspr r7, SPRN_PID
1557 mfspr r8, SPRN_WORT
1558 std r5, VCPU_TCSCR(r9)
1559 std r6, VCPU_ACOP(r9)
1560 stw r7, VCPU_GUEST_PID(r9)
1561 std r8, VCPU_WORT(r9)
15628:
1563
1564 /* Save and reset AMR and UAMOR before turning on the MMU */
1565BEGIN_FTR_SECTION
1566 mfspr r5,SPRN_AMR
1567 mfspr r6,SPRN_UAMOR
1568 std r5,VCPU_AMR(r9)
1569 std r6,VCPU_UAMOR(r9)
1570 li r6,0
1571 mtspr SPRN_AMR,r6
1572END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
1573
1574 /* Unset guest mode */ 1507 /* Unset guest mode */
1575 li r0, KVM_GUEST_MODE_NONE 1508 li r0, KVM_GUEST_MODE_NONE
1576 stb r0, HSTATE_IN_GUEST(r13) 1509 stb r0, HSTATE_IN_GUEST(r13)
@@ -2203,7 +2136,7 @@ BEGIN_FTR_SECTION
2203END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 2136END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
2204#endif 2137#endif
2205 mfspr r6,SPRN_VRSAVE 2138 mfspr r6,SPRN_VRSAVE
2206 stw r6,VCPU_VRSAVE(r3) 2139 stw r6,VCPU_VRSAVE(r31)
2207 mtlr r30 2140 mtlr r30
2208 mtmsrd r5 2141 mtmsrd r5
2209 isync 2142 isync
@@ -2240,7 +2173,7 @@ BEGIN_FTR_SECTION
2240 bl .load_vr_state 2173 bl .load_vr_state
2241END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 2174END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
2242#endif 2175#endif
2243 lwz r7,VCPU_VRSAVE(r4) 2176 lwz r7,VCPU_VRSAVE(r31)
2244 mtspr SPRN_VRSAVE,r7 2177 mtspr SPRN_VRSAVE,r7
2245 mtlr r30 2178 mtlr r30
2246 mr r4,r31 2179 mr r4,r31
diff --git a/arch/powerpc/oprofile/op_model_cell.c b/arch/powerpc/oprofile/op_model_cell.c
index 1f0ebdeea5f7..863d89386f60 100644
--- a/arch/powerpc/oprofile/op_model_cell.c
+++ b/arch/powerpc/oprofile/op_model_cell.c
@@ -1121,8 +1121,7 @@ oprof_cpufreq_notify(struct notifier_block *nb, unsigned long val, void *data)
1121 int ret = 0; 1121 int ret = 0;
1122 struct cpufreq_freqs *frq = data; 1122 struct cpufreq_freqs *frq = data;
1123 if ((val == CPUFREQ_PRECHANGE && frq->old < frq->new) || 1123 if ((val == CPUFREQ_PRECHANGE && frq->old < frq->new) ||
1124 (val == CPUFREQ_POSTCHANGE && frq->old > frq->new) || 1124 (val == CPUFREQ_POSTCHANGE && frq->old > frq->new))
1125 (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE))
1126 set_spu_profiling_frequency(frq->new, spu_cycle_reset); 1125 set_spu_profiling_frequency(frq->new, spu_cycle_reset);
1127 return ret; 1126 return ret;
1128} 1127}
diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c
index 5ec1e47a0d77..e865d748179b 100644
--- a/arch/powerpc/platforms/cell/ras.c
+++ b/arch/powerpc/platforms/cell/ras.c
@@ -123,7 +123,8 @@ static int __init cbe_ptcal_enable_on_node(int nid, int order)
123 123
124 area->nid = nid; 124 area->nid = nid;
125 area->order = order; 125 area->order = order;
126 area->pages = alloc_pages_exact_node(area->nid, GFP_KERNEL|GFP_THISNODE, 126 area->pages = alloc_pages_exact_node(area->nid,
127 GFP_KERNEL|__GFP_THISNODE,
127 area->order); 128 area->order);
128 129
129 if (!area->pages) { 130 if (!area->pages) {
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 49318385d4fa..4a0a64fe25df 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -83,7 +83,6 @@ static struct timer_list spuloadavg_timer;
83#define MIN_SPU_TIMESLICE max(5 * HZ / (1000 * SPUSCHED_TICK), 1) 83#define MIN_SPU_TIMESLICE max(5 * HZ / (1000 * SPUSCHED_TICK), 1)
84#define DEF_SPU_TIMESLICE (100 * HZ / (1000 * SPUSCHED_TICK)) 84#define DEF_SPU_TIMESLICE (100 * HZ / (1000 * SPUSCHED_TICK))
85 85
86#define MAX_USER_PRIO (MAX_PRIO - MAX_RT_PRIO)
87#define SCALE_PRIO(x, prio) \ 86#define SCALE_PRIO(x, prio) \
88 max(x * (MAX_PRIO - prio) / (MAX_USER_PRIO / 2), MIN_SPU_TIMESLICE) 87 max(x * (MAX_PRIO - prio) / (MAX_USER_PRIO / 2), MIN_SPU_TIMESLICE)
89 88
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index 110f4fbd319f..81a7a0a79be7 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -26,7 +26,6 @@
26#include <linux/of_fdt.h> 26#include <linux/of_fdt.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/bug.h> 28#include <linux/bug.h>
29#include <linux/cpuidle.h>
30#include <linux/pci.h> 29#include <linux/pci.h>
31 30
32#include <asm/machdep.h> 31#include <asm/machdep.h>
@@ -225,16 +224,6 @@ static int __init pnv_probe(void)
225 return 1; 224 return 1;
226} 225}
227 226
228void powernv_idle(void)
229{
230 /* Hook to cpuidle framework if available, else
231 * call on default platform idle code
232 */
233 if (cpuidle_idle_call()) {
234 power7_idle();
235 }
236}
237
238define_machine(powernv) { 227define_machine(powernv) {
239 .name = "PowerNV", 228 .name = "PowerNV",
240 .probe = pnv_probe, 229 .probe = pnv_probe,
@@ -244,7 +233,7 @@ define_machine(powernv) {
244 .show_cpuinfo = pnv_show_cpuinfo, 233 .show_cpuinfo = pnv_show_cpuinfo,
245 .progress = pnv_progress, 234 .progress = pnv_progress,
246 .machine_shutdown = pnv_shutdown, 235 .machine_shutdown = pnv_shutdown,
247 .power_save = powernv_idle, 236 .power_save = power7_idle,
248 .calibrate_decr = generic_calibrate_decr, 237 .calibrate_decr = generic_calibrate_decr,
249 .dma_set_mask = pnv_dma_set_mask, 238 .dma_set_mask = pnv_dma_set_mask,
250#ifdef CONFIG_KEXEC 239#ifdef CONFIG_KEXEC
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index efe61374f6ea..203cbf0dc101 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -37,15 +37,15 @@ find_bus_among_children(struct pci_bus *bus,
37 struct device_node *dn) 37 struct device_node *dn)
38{ 38{
39 struct pci_bus *child = NULL; 39 struct pci_bus *child = NULL;
40 struct list_head *tmp; 40 struct pci_bus *tmp;
41 struct device_node *busdn; 41 struct device_node *busdn;
42 42
43 busdn = pci_bus_to_OF_node(bus); 43 busdn = pci_bus_to_OF_node(bus);
44 if (busdn == dn) 44 if (busdn == dn)
45 return bus; 45 return bus;
46 46
47 list_for_each(tmp, &bus->children) { 47 list_for_each_entry(tmp, &bus->children, node) {
48 child = find_bus_among_children(pci_bus_b(tmp), dn); 48 child = find_bus_among_children(tmp, dn);
49 if (child) 49 if (child)
50 break; 50 break;
51 }; 51 };
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 972df0ffd4dc..2db8cc691bf4 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -39,7 +39,6 @@
39#include <linux/irq.h> 39#include <linux/irq.h>
40#include <linux/seq_file.h> 40#include <linux/seq_file.h>
41#include <linux/root_dev.h> 41#include <linux/root_dev.h>
42#include <linux/cpuidle.h>
43#include <linux/of.h> 42#include <linux/of.h>
44#include <linux/kexec.h> 43#include <linux/kexec.h>
45 44
@@ -356,29 +355,24 @@ early_initcall(alloc_dispatch_log_kmem_cache);
356 355
357static void pseries_lpar_idle(void) 356static void pseries_lpar_idle(void)
358{ 357{
359 /* This would call on the cpuidle framework, and the back-end pseries 358 /*
360 * driver to go to idle states 359 * Default handler to go into low thread priority and possibly
360 * low power mode by cedeing processor to hypervisor
361 */ 361 */
362 if (cpuidle_idle_call()) {
363 /* On error, execute default handler
364 * to go into low thread priority and possibly
365 * low power mode by cedeing processor to hypervisor
366 */
367 362
368 /* Indicate to hypervisor that we are idle. */ 363 /* Indicate to hypervisor that we are idle. */
369 get_lppaca()->idle = 1; 364 get_lppaca()->idle = 1;
370 365
371 /* 366 /*
372 * Yield the processor to the hypervisor. We return if 367 * Yield the processor to the hypervisor. We return if
373 * an external interrupt occurs (which are driven prior 368 * an external interrupt occurs (which are driven prior
374 * to returning here) or if a prod occurs from another 369 * to returning here) or if a prod occurs from another
375 * processor. When returning here, external interrupts 370 * processor. When returning here, external interrupts
376 * are enabled. 371 * are enabled.
377 */ 372 */
378 cede_processor(); 373 cede_processor();
379 374
380 get_lppaca()->idle = 0; 375 get_lppaca()->idle = 0;
381 }
382} 376}
383 377
384/* 378/*
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index f67ac900d870..afbcc37aa094 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -21,7 +21,6 @@ obj-$(CONFIG_FSL_SOC) += fsl_soc.o fsl_mpic_err.o
21obj-$(CONFIG_FSL_PCI) += fsl_pci.o $(fsl-msi-obj-y) 21obj-$(CONFIG_FSL_PCI) += fsl_pci.o $(fsl-msi-obj-y)
22obj-$(CONFIG_FSL_PMC) += fsl_pmc.o 22obj-$(CONFIG_FSL_PMC) += fsl_pmc.o
23obj-$(CONFIG_FSL_LBC) += fsl_lbc.o 23obj-$(CONFIG_FSL_LBC) += fsl_lbc.o
24obj-$(CONFIG_FSL_IFC) += fsl_ifc.o
25obj-$(CONFIG_FSL_GTM) += fsl_gtm.o 24obj-$(CONFIG_FSL_GTM) += fsl_gtm.o
26obj-$(CONFIG_FSL_85XX_CACHE_SRAM) += fsl_85xx_l2ctlr.o fsl_85xx_cache_sram.o 25obj-$(CONFIG_FSL_85XX_CACHE_SRAM) += fsl_85xx_l2ctlr.o fsl_85xx_cache_sram.o
27obj-$(CONFIG_SIMPLE_GPIO) += simple_gpio.o 26obj-$(CONFIG_SIMPLE_GPIO) += simple_gpio.o
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/powerpc/sysdev/fsl_ifc.c b/arch/powerpc/sysdev/fsl_ifc.c
deleted file mode 100644
index fbc885b31946..000000000000
--- a/arch/powerpc/sysdev/fsl_ifc.c
+++ /dev/null
@@ -1,305 +0,0 @@
1/*
2 * Copyright 2011 Freescale Semiconductor, Inc
3 *
4 * Freescale Integrated Flash Controller
5 *
6 * Author: Dipen Dudhat <Dipen.Dudhat@freescale.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
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, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22#include <linux/module.h>
23#include <linux/kernel.h>
24#include <linux/compiler.h>
25#include <linux/spinlock.h>
26#include <linux/types.h>
27#include <linux/slab.h>
28#include <linux/io.h>
29#include <linux/of.h>
30#include <linux/of_device.h>
31#include <linux/platform_device.h>
32#include <asm/prom.h>
33#include <asm/fsl_ifc.h>
34
35struct fsl_ifc_ctrl *fsl_ifc_ctrl_dev;
36EXPORT_SYMBOL(fsl_ifc_ctrl_dev);
37
38/*
39 * convert_ifc_address - convert the base address
40 * @addr_base: base address of the memory bank
41 */
42unsigned int convert_ifc_address(phys_addr_t addr_base)
43{
44 return addr_base & CSPR_BA;
45}
46EXPORT_SYMBOL(convert_ifc_address);
47
48/*
49 * fsl_ifc_find - find IFC bank
50 * @addr_base: base address of the memory bank
51 *
52 * This function walks IFC banks comparing "Base address" field of the CSPR
53 * registers with the supplied addr_base argument. When bases match this
54 * function returns bank number (starting with 0), otherwise it returns
55 * appropriate errno value.
56 */
57int fsl_ifc_find(phys_addr_t addr_base)
58{
59 int i = 0;
60
61 if (!fsl_ifc_ctrl_dev || !fsl_ifc_ctrl_dev->regs)
62 return -ENODEV;
63
64 for (i = 0; i < ARRAY_SIZE(fsl_ifc_ctrl_dev->regs->cspr_cs); i++) {
65 u32 cspr = in_be32(&fsl_ifc_ctrl_dev->regs->cspr_cs[i].cspr);
66 if (cspr & CSPR_V && (cspr & CSPR_BA) ==
67 convert_ifc_address(addr_base))
68 return i;
69 }
70
71 return -ENOENT;
72}
73EXPORT_SYMBOL(fsl_ifc_find);
74
75static int fsl_ifc_ctrl_init(struct fsl_ifc_ctrl *ctrl)
76{
77 struct fsl_ifc_regs __iomem *ifc = ctrl->regs;
78
79 /*
80 * Clear all the common status and event registers
81 */
82 if (in_be32(&ifc->cm_evter_stat) & IFC_CM_EVTER_STAT_CSER)
83 out_be32(&ifc->cm_evter_stat, IFC_CM_EVTER_STAT_CSER);
84
85 /* enable all error and events */
86 out_be32(&ifc->cm_evter_en, IFC_CM_EVTER_EN_CSEREN);
87
88 /* enable all error and event interrupts */
89 out_be32(&ifc->cm_evter_intr_en, IFC_CM_EVTER_INTR_EN_CSERIREN);
90 out_be32(&ifc->cm_erattr0, 0x0);
91 out_be32(&ifc->cm_erattr1, 0x0);
92
93 return 0;
94}
95
96static int fsl_ifc_ctrl_remove(struct platform_device *dev)
97{
98 struct fsl_ifc_ctrl *ctrl = dev_get_drvdata(&dev->dev);
99
100 free_irq(ctrl->nand_irq, ctrl);
101 free_irq(ctrl->irq, ctrl);
102
103 irq_dispose_mapping(ctrl->nand_irq);
104 irq_dispose_mapping(ctrl->irq);
105
106 iounmap(ctrl->regs);
107
108 dev_set_drvdata(&dev->dev, NULL);
109 kfree(ctrl);
110
111 return 0;
112}
113
114/*
115 * NAND events are split between an operational interrupt which only
116 * receives OPC, and an error interrupt that receives everything else,
117 * including non-NAND errors. Whichever interrupt gets to it first
118 * records the status and wakes the wait queue.
119 */
120static DEFINE_SPINLOCK(nand_irq_lock);
121
122static u32 check_nand_stat(struct fsl_ifc_ctrl *ctrl)
123{
124 struct fsl_ifc_regs __iomem *ifc = ctrl->regs;
125 unsigned long flags;
126 u32 stat;
127
128 spin_lock_irqsave(&nand_irq_lock, flags);
129
130 stat = in_be32(&ifc->ifc_nand.nand_evter_stat);
131 if (stat) {
132 out_be32(&ifc->ifc_nand.nand_evter_stat, stat);
133 ctrl->nand_stat = stat;
134 wake_up(&ctrl->nand_wait);
135 }
136
137 spin_unlock_irqrestore(&nand_irq_lock, flags);
138
139 return stat;
140}
141
142static irqreturn_t fsl_ifc_nand_irq(int irqno, void *data)
143{
144 struct fsl_ifc_ctrl *ctrl = data;
145
146 if (check_nand_stat(ctrl))
147 return IRQ_HANDLED;
148
149 return IRQ_NONE;
150}
151
152/*
153 * NOTE: This interrupt is used to report ifc events of various kinds,
154 * such as transaction errors on the chipselects.
155 */
156static irqreturn_t fsl_ifc_ctrl_irq(int irqno, void *data)
157{
158 struct fsl_ifc_ctrl *ctrl = data;
159 struct fsl_ifc_regs __iomem *ifc = ctrl->regs;
160 u32 err_axiid, err_srcid, status, cs_err, err_addr;
161 irqreturn_t ret = IRQ_NONE;
162
163 /* read for chip select error */
164 cs_err = in_be32(&ifc->cm_evter_stat);
165 if (cs_err) {
166 dev_err(ctrl->dev, "transaction sent to IFC is not mapped to"
167 "any memory bank 0x%08X\n", cs_err);
168 /* clear the chip select error */
169 out_be32(&ifc->cm_evter_stat, IFC_CM_EVTER_STAT_CSER);
170
171 /* read error attribute registers print the error information */
172 status = in_be32(&ifc->cm_erattr0);
173 err_addr = in_be32(&ifc->cm_erattr1);
174
175 if (status & IFC_CM_ERATTR0_ERTYP_READ)
176 dev_err(ctrl->dev, "Read transaction error"
177 "CM_ERATTR0 0x%08X\n", status);
178 else
179 dev_err(ctrl->dev, "Write transaction error"
180 "CM_ERATTR0 0x%08X\n", status);
181
182 err_axiid = (status & IFC_CM_ERATTR0_ERAID) >>
183 IFC_CM_ERATTR0_ERAID_SHIFT;
184 dev_err(ctrl->dev, "AXI ID of the error"
185 "transaction 0x%08X\n", err_axiid);
186
187 err_srcid = (status & IFC_CM_ERATTR0_ESRCID) >>
188 IFC_CM_ERATTR0_ESRCID_SHIFT;
189 dev_err(ctrl->dev, "SRC ID of the error"
190 "transaction 0x%08X\n", err_srcid);
191
192 dev_err(ctrl->dev, "Transaction Address corresponding to error"
193 "ERADDR 0x%08X\n", err_addr);
194
195 ret = IRQ_HANDLED;
196 }
197
198 if (check_nand_stat(ctrl))
199 ret = IRQ_HANDLED;
200
201 return ret;
202}
203
204/*
205 * fsl_ifc_ctrl_probe
206 *
207 * called by device layer when it finds a device matching
208 * one our driver can handled. This code allocates all of
209 * the resources needed for the controller only. The
210 * resources for the NAND banks themselves are allocated
211 * in the chip probe function.
212*/
213static int fsl_ifc_ctrl_probe(struct platform_device *dev)
214{
215 int ret = 0;
216
217
218 dev_info(&dev->dev, "Freescale Integrated Flash Controller\n");
219
220 fsl_ifc_ctrl_dev = kzalloc(sizeof(*fsl_ifc_ctrl_dev), GFP_KERNEL);
221 if (!fsl_ifc_ctrl_dev)
222 return -ENOMEM;
223
224 dev_set_drvdata(&dev->dev, fsl_ifc_ctrl_dev);
225
226 /* IOMAP the entire IFC region */
227 fsl_ifc_ctrl_dev->regs = of_iomap(dev->dev.of_node, 0);
228 if (!fsl_ifc_ctrl_dev->regs) {
229 dev_err(&dev->dev, "failed to get memory region\n");
230 ret = -ENODEV;
231 goto err;
232 }
233
234 /* get the Controller level irq */
235 fsl_ifc_ctrl_dev->irq = irq_of_parse_and_map(dev->dev.of_node, 0);
236 if (fsl_ifc_ctrl_dev->irq == NO_IRQ) {
237 dev_err(&dev->dev, "failed to get irq resource "
238 "for IFC\n");
239 ret = -ENODEV;
240 goto err;
241 }
242
243 /* get the nand machine irq */
244 fsl_ifc_ctrl_dev->nand_irq =
245 irq_of_parse_and_map(dev->dev.of_node, 1);
246
247 fsl_ifc_ctrl_dev->dev = &dev->dev;
248
249 ret = fsl_ifc_ctrl_init(fsl_ifc_ctrl_dev);
250 if (ret < 0)
251 goto err;
252
253 init_waitqueue_head(&fsl_ifc_ctrl_dev->nand_wait);
254
255 ret = request_irq(fsl_ifc_ctrl_dev->irq, fsl_ifc_ctrl_irq, IRQF_SHARED,
256 "fsl-ifc", fsl_ifc_ctrl_dev);
257 if (ret != 0) {
258 dev_err(&dev->dev, "failed to install irq (%d)\n",
259 fsl_ifc_ctrl_dev->irq);
260 goto err_irq;
261 }
262
263 if (fsl_ifc_ctrl_dev->nand_irq) {
264 ret = request_irq(fsl_ifc_ctrl_dev->nand_irq, fsl_ifc_nand_irq,
265 0, "fsl-ifc-nand", fsl_ifc_ctrl_dev);
266 if (ret != 0) {
267 dev_err(&dev->dev, "failed to install irq (%d)\n",
268 fsl_ifc_ctrl_dev->nand_irq);
269 goto err_nandirq;
270 }
271 }
272
273 return 0;
274
275err_nandirq:
276 free_irq(fsl_ifc_ctrl_dev->nand_irq, fsl_ifc_ctrl_dev);
277 irq_dispose_mapping(fsl_ifc_ctrl_dev->nand_irq);
278err_irq:
279 free_irq(fsl_ifc_ctrl_dev->irq, fsl_ifc_ctrl_dev);
280 irq_dispose_mapping(fsl_ifc_ctrl_dev->irq);
281err:
282 return ret;
283}
284
285static const struct of_device_id fsl_ifc_match[] = {
286 {
287 .compatible = "fsl,ifc",
288 },
289 {},
290};
291
292static struct platform_driver fsl_ifc_ctrl_driver = {
293 .driver = {
294 .name = "fsl-ifc",
295 .of_match_table = fsl_ifc_match,
296 },
297 .probe = fsl_ifc_ctrl_probe,
298 .remove = fsl_ifc_ctrl_remove,
299};
300
301module_platform_driver(fsl_ifc_ctrl_driver);
302
303MODULE_LICENSE("GPL");
304MODULE_AUTHOR("Freescale Semiconductor");
305MODULE_DESCRIPTION("Freescale Integrated Flash Controller driver");
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 65a07750f4f9..953f17c8d17c 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -117,6 +117,7 @@ config S390
117 select HAVE_FUNCTION_GRAPH_TRACER 117 select HAVE_FUNCTION_GRAPH_TRACER
118 select HAVE_FUNCTION_TRACER 118 select HAVE_FUNCTION_TRACER
119 select HAVE_FUNCTION_TRACE_MCOUNT_TEST 119 select HAVE_FUNCTION_TRACE_MCOUNT_TEST
120 select HAVE_FUTEX_CMPXCHG if FUTEX
120 select HAVE_KERNEL_BZIP2 121 select HAVE_KERNEL_BZIP2
121 select HAVE_KERNEL_GZIP 122 select HAVE_KERNEL_GZIP
122 select HAVE_KERNEL_LZ4 123 select HAVE_KERNEL_LZ4
@@ -140,6 +141,7 @@ config S390
140 select OLD_SIGACTION 141 select OLD_SIGACTION
141 select OLD_SIGSUSPEND3 142 select OLD_SIGSUSPEND3
142 select SYSCTL_EXCEPTION_TRACE 143 select SYSCTL_EXCEPTION_TRACE
144 select TTY
143 select VIRT_CPU_ACCOUNTING 145 select VIRT_CPU_ACCOUNTING
144 select VIRT_TO_BUS 146 select VIRT_TO_BUS
145 147
@@ -415,6 +417,10 @@ config ARCH_ENABLE_MEMORY_HOTPLUG
415config ARCH_ENABLE_MEMORY_HOTREMOVE 417config ARCH_ENABLE_MEMORY_HOTREMOVE
416 def_bool y 418 def_bool y
417 419
420config ARCH_ENABLE_SPLIT_PMD_PTLOCK
421 def_bool y
422 depends on 64BIT
423
418config FORCE_MAX_ZONEORDER 424config FORCE_MAX_ZONEORDER
419 int 425 int
420 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/Kbuild b/arch/s390/include/asm/Kbuild
index 8386a4a1f19a..57892a8a9055 100644
--- a/arch/s390/include/asm/Kbuild
+++ b/arch/s390/include/asm/Kbuild
@@ -1,6 +1,7 @@
1 1
2 2
3generic-y += clkdev.h 3generic-y += clkdev.h
4generic-y += trace_clock.h
5generic-y += preempt.h
6generic-y += hash.h 4generic-y += hash.h
5generic-y += mcs_spinlock.h
6generic-y += preempt.h
7generic-y += trace_clock.h
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.c b/arch/s390/pci/pci.c
index 66670ff262a0..1df1d29ac81d 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -686,27 +686,13 @@ int pcibios_add_device(struct pci_dev *pdev)
686int pcibios_enable_device(struct pci_dev *pdev, int mask) 686int pcibios_enable_device(struct pci_dev *pdev, int mask)
687{ 687{
688 struct zpci_dev *zdev = get_zdev(pdev); 688 struct zpci_dev *zdev = get_zdev(pdev);
689 struct resource *res;
690 u16 cmd;
691 int i;
692 689
693 zdev->pdev = pdev; 690 zdev->pdev = pdev;
694 zpci_debug_init_device(zdev); 691 zpci_debug_init_device(zdev);
695 zpci_fmb_enable_device(zdev); 692 zpci_fmb_enable_device(zdev);
696 zpci_map_resources(zdev); 693 zpci_map_resources(zdev);
697 694
698 pci_read_config_word(pdev, PCI_COMMAND, &cmd); 695 return pci_enable_resources(pdev, mask);
699 for (i = 0; i < PCI_BAR_COUNT; i++) {
700 res = &pdev->resource[i];
701
702 if (res->flags & IORESOURCE_IO)
703 return -EINVAL;
704
705 if (res->flags & IORESOURCE_MEM)
706 cmd |= PCI_COMMAND_MEMORY;
707 }
708 pci_write_config_word(pdev, PCI_COMMAND, cmd);
709 return 0;
710} 696}
711 697
712void pcibios_disable_device(struct pci_dev *pdev) 698void pcibios_disable_device(struct pci_dev *pdev)
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 146b9d5e89f8..2f947aba4bd4 100644
--- a/arch/score/include/asm/Kbuild
+++ b/arch/score/include/asm/Kbuild
@@ -1,10 +1,12 @@
1 1
2header-y += 2header-y +=
3 3
4
4generic-y += barrier.h 5generic-y += barrier.h
5generic-y += clkdev.h 6generic-y += clkdev.h
7generic-y += cputime.h
6generic-y += hash.h 8generic-y += hash.h
9generic-y += mcs_spinlock.h
10generic-y += preempt.h
7generic-y += trace_clock.h 11generic-y += trace_clock.h
8generic-y += xor.h 12generic-y += xor.h
9generic-y += preempt.h
10
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/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 5bc3a15465c7..85d5255d259f 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -861,14 +861,12 @@ static struct asoc_simple_card_info fsi_da7210_info = {
861 .card = "FSIB-DA7210", 861 .card = "FSIB-DA7210",
862 .codec = "da7210.0-001a", 862 .codec = "da7210.0-001a",
863 .platform = "sh_fsi.0", 863 .platform = "sh_fsi.0",
864 .daifmt = SND_SOC_DAIFMT_I2S, 864 .daifmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
865 .cpu_dai = { 865 .cpu_dai = {
866 .name = "fsib-dai", 866 .name = "fsib-dai",
867 .fmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
868 }, 867 },
869 .codec_dai = { 868 .codec_dai = {
870 .name = "da7210-hifi", 869 .name = "da7210-hifi",
871 .fmt = SND_SOC_DAIFMT_CBM_CFM,
872 }, 870 },
873}; 871};
874 872
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index 21e4230659a5..1162bc6945a3 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -304,14 +304,12 @@ static struct asoc_simple_card_info fsi_ak4642_info = {
304 .card = "FSIA-AK4642", 304 .card = "FSIA-AK4642",
305 .codec = "ak4642-codec.0-0012", 305 .codec = "ak4642-codec.0-0012",
306 .platform = "sh_fsi.0", 306 .platform = "sh_fsi.0",
307 .daifmt = SND_SOC_DAIFMT_LEFT_J, 307 .daifmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM,
308 .cpu_dai = { 308 .cpu_dai = {
309 .name = "fsia-dai", 309 .name = "fsia-dai",
310 .fmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
311 }, 310 },
312 .codec_dai = { 311 .codec_dai = {
313 .name = "ak4642-hifi", 312 .name = "ak4642-hifi",
314 .fmt = SND_SOC_DAIFMT_CBM_CFM,
315 .sysclk = 11289600, 313 .sysclk = 11289600,
316 }, 314 },
317}; 315};
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 60ed3e1c4b75..1bc09ee7948f 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -186,11 +186,6 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
186 return start; 186 return start;
187} 187}
188 188
189int pcibios_enable_device(struct pci_dev *dev, int mask)
190{
191 return pci_enable_resources(dev, mask);
192}
193
194static void __init 189static void __init
195pcibios_bus_report_status_early(struct pci_channel *hose, 190pcibios_bus_report_status_early(struct pci_channel *hose,
196 int top_bus, int current_bus, 191 int top_bus, int current_bus,
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index 0cd7198a4524..c19e47dacb31 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -8,18 +8,21 @@ generic-y += emergency-restart.h
8generic-y += errno.h 8generic-y += errno.h
9generic-y += exec.h 9generic-y += exec.h
10generic-y += fcntl.h 10generic-y += fcntl.h
11generic-y += hash.h
11generic-y += ioctl.h 12generic-y += ioctl.h
12generic-y += ipcbuf.h 13generic-y += ipcbuf.h
13generic-y += irq_regs.h 14generic-y += irq_regs.h
14generic-y += kvm_para.h 15generic-y += kvm_para.h
15generic-y += local.h 16generic-y += local.h
16generic-y += local64.h 17generic-y += local64.h
18generic-y += mcs_spinlock.h
19generic-y += mman.h
20generic-y += msgbuf.h
17generic-y += param.h 21generic-y += param.h
18generic-y += parport.h 22generic-y += parport.h
19generic-y += percpu.h 23generic-y += percpu.h
20generic-y += poll.h 24generic-y += poll.h
21generic-y += mman.h 25generic-y += preempt.h
22generic-y += msgbuf.h
23generic-y += resource.h 26generic-y += resource.h
24generic-y += scatterlist.h 27generic-y += scatterlist.h
25generic-y += sembuf.h 28generic-y += sembuf.h
@@ -34,5 +37,3 @@ generic-y += termios.h
34generic-y += trace_clock.h 37generic-y += trace_clock.h
35generic-y += ucontext.h 38generic-y += ucontext.h
36generic-y += xor.h 39generic-y += xor.h
37generic-y += preempt.h
38generic-y += hash.h
diff --git a/arch/sh/include/cpu-sh2/cpu/cache.h b/arch/sh/include/cpu-sh2/cpu/cache.h
index 673515bc4135..aa1b2b9088a7 100644
--- a/arch/sh/include/cpu-sh2/cpu/cache.h
+++ b/arch/sh/include/cpu-sh2/cpu/cache.h
@@ -18,7 +18,7 @@
18#define SH_CACHE_ASSOC 8 18#define SH_CACHE_ASSOC 8
19 19
20#if defined(CONFIG_CPU_SUBTYPE_SH7619) 20#if defined(CONFIG_CPU_SUBTYPE_SH7619)
21#define CCR 0xffffffec 21#define SH_CCR 0xffffffec
22 22
23#define CCR_CACHE_CE 0x01 /* Cache enable */ 23#define CCR_CACHE_CE 0x01 /* Cache enable */
24#define CCR_CACHE_WT 0x02 /* CCR[bit1=1,bit2=1] */ 24#define CCR_CACHE_WT 0x02 /* CCR[bit1=1,bit2=1] */
diff --git a/arch/sh/include/cpu-sh2a/cpu/cache.h b/arch/sh/include/cpu-sh2a/cpu/cache.h
index defb0baa5a06..b27ce92cb600 100644
--- a/arch/sh/include/cpu-sh2a/cpu/cache.h
+++ b/arch/sh/include/cpu-sh2a/cpu/cache.h
@@ -17,8 +17,8 @@
17#define SH_CACHE_COMBINED 4 17#define SH_CACHE_COMBINED 4
18#define SH_CACHE_ASSOC 8 18#define SH_CACHE_ASSOC 8
19 19
20#define CCR 0xfffc1000 /* CCR1 */ 20#define SH_CCR 0xfffc1000 /* CCR1 */
21#define CCR2 0xfffc1004 21#define SH_CCR2 0xfffc1004
22 22
23/* 23/*
24 * Most of the SH-2A CCR1 definitions resemble the SH-4 ones. All others not 24 * Most of the SH-2A CCR1 definitions resemble the SH-4 ones. All others not
diff --git a/arch/sh/include/cpu-sh3/cpu/cache.h b/arch/sh/include/cpu-sh3/cpu/cache.h
index bee2d81c56bf..29700fd88c75 100644
--- a/arch/sh/include/cpu-sh3/cpu/cache.h
+++ b/arch/sh/include/cpu-sh3/cpu/cache.h
@@ -17,7 +17,7 @@
17#define SH_CACHE_COMBINED 4 17#define SH_CACHE_COMBINED 4
18#define SH_CACHE_ASSOC 8 18#define SH_CACHE_ASSOC 8
19 19
20#define CCR 0xffffffec /* Address of Cache Control Register */ 20#define SH_CCR 0xffffffec /* Address of Cache Control Register */
21 21
22#define CCR_CACHE_CE 0x01 /* Cache Enable */ 22#define CCR_CACHE_CE 0x01 /* Cache Enable */
23#define CCR_CACHE_WT 0x02 /* Write-Through (for P0,U0,P3) (else writeback) */ 23#define CCR_CACHE_WT 0x02 /* Write-Through (for P0,U0,P3) (else writeback) */
diff --git a/arch/sh/include/cpu-sh4/cpu/cache.h b/arch/sh/include/cpu-sh4/cpu/cache.h
index 7bfb9e8b069c..92c4cd119b66 100644
--- a/arch/sh/include/cpu-sh4/cpu/cache.h
+++ b/arch/sh/include/cpu-sh4/cpu/cache.h
@@ -17,7 +17,7 @@
17#define SH_CACHE_COMBINED 4 17#define SH_CACHE_COMBINED 4
18#define SH_CACHE_ASSOC 8 18#define SH_CACHE_ASSOC 8
19 19
20#define CCR 0xff00001c /* Address of Cache Control Register */ 20#define SH_CCR 0xff00001c /* Address of Cache Control Register */
21#define CCR_CACHE_OCE 0x0001 /* Operand Cache Enable */ 21#define CCR_CACHE_OCE 0x0001 /* Operand Cache Enable */
22#define CCR_CACHE_WT 0x0002 /* Write-Through (for P0,U0,P3) (else writeback)*/ 22#define CCR_CACHE_WT 0x0002 /* Write-Through (for P0,U0,P3) (else writeback)*/
23#define CCR_CACHE_CB 0x0004 /* Copy-Back (for P1) (else writethrough) */ 23#define CCR_CACHE_CB 0x0004 /* Copy-Back (for P1) (else writethrough) */
diff --git a/arch/sh/kernel/cpu/init.c b/arch/sh/kernel/cpu/init.c
index ecf83cd158dc..0d7360d549c1 100644
--- a/arch/sh/kernel/cpu/init.c
+++ b/arch/sh/kernel/cpu/init.c
@@ -112,7 +112,7 @@ static void cache_init(void)
112 unsigned long ccr, flags; 112 unsigned long ccr, flags;
113 113
114 jump_to_uncached(); 114 jump_to_uncached();
115 ccr = __raw_readl(CCR); 115 ccr = __raw_readl(SH_CCR);
116 116
117 /* 117 /*
118 * At this point we don't know whether the cache is enabled or not - a 118 * At this point we don't know whether the cache is enabled or not - a
@@ -189,7 +189,7 @@ static void cache_init(void)
189 189
190 l2_cache_init(); 190 l2_cache_init();
191 191
192 __raw_writel(flags, CCR); 192 __raw_writel(flags, SH_CCR);
193 back_to_cached(); 193 back_to_cached();
194} 194}
195#else 195#else
diff --git a/arch/sh/kernel/idle.c b/arch/sh/kernel/idle.c
index 2ea4483fd722..be616ee0cf87 100644
--- a/arch/sh/kernel/idle.c
+++ b/arch/sh/kernel/idle.c
@@ -16,7 +16,6 @@
16#include <linux/thread_info.h> 16#include <linux/thread_info.h>
17#include <linux/irqflags.h> 17#include <linux/irqflags.h>
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/cpuidle.h>
20#include <linux/atomic.h> 19#include <linux/atomic.h>
21#include <asm/pgalloc.h> 20#include <asm/pgalloc.h>
22#include <asm/smp.h> 21#include <asm/smp.h>
@@ -40,8 +39,7 @@ void arch_cpu_idle_dead(void)
40 39
41void arch_cpu_idle(void) 40void arch_cpu_idle(void)
42{ 41{
43 if (cpuidle_idle_call()) 42 sh_idle();
44 sh_idle();
45} 43}
46 44
47void __init select_idle_routine(void) 45void __init select_idle_routine(void)
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/sh/mm/cache-debugfs.c b/arch/sh/mm/cache-debugfs.c
index 115725198038..777e50f33c00 100644
--- a/arch/sh/mm/cache-debugfs.c
+++ b/arch/sh/mm/cache-debugfs.c
@@ -36,7 +36,7 @@ static int cache_seq_show(struct seq_file *file, void *iter)
36 */ 36 */
37 jump_to_uncached(); 37 jump_to_uncached();
38 38
39 ccr = __raw_readl(CCR); 39 ccr = __raw_readl(SH_CCR);
40 if ((ccr & CCR_CACHE_ENABLE) == 0) { 40 if ((ccr & CCR_CACHE_ENABLE) == 0) {
41 back_to_cached(); 41 back_to_cached();
42 42
diff --git a/arch/sh/mm/cache-sh2.c b/arch/sh/mm/cache-sh2.c
index defcf719f2e8..a74259f2f981 100644
--- a/arch/sh/mm/cache-sh2.c
+++ b/arch/sh/mm/cache-sh2.c
@@ -63,9 +63,9 @@ static void sh2__flush_invalidate_region(void *start, int size)
63 local_irq_save(flags); 63 local_irq_save(flags);
64 jump_to_uncached(); 64 jump_to_uncached();
65 65
66 ccr = __raw_readl(CCR); 66 ccr = __raw_readl(SH_CCR);
67 ccr |= CCR_CACHE_INVALIDATE; 67 ccr |= CCR_CACHE_INVALIDATE;
68 __raw_writel(ccr, CCR); 68 __raw_writel(ccr, SH_CCR);
69 69
70 back_to_cached(); 70 back_to_cached();
71 local_irq_restore(flags); 71 local_irq_restore(flags);
diff --git a/arch/sh/mm/cache-sh2a.c b/arch/sh/mm/cache-sh2a.c
index 949e2d3138a0..ee87d081259b 100644
--- a/arch/sh/mm/cache-sh2a.c
+++ b/arch/sh/mm/cache-sh2a.c
@@ -134,7 +134,8 @@ static void sh2a__flush_invalidate_region(void *start, int size)
134 134
135 /* If there are too many pages then just blow the cache */ 135 /* If there are too many pages then just blow the cache */
136 if (((end - begin) >> PAGE_SHIFT) >= MAX_OCACHE_PAGES) { 136 if (((end - begin) >> PAGE_SHIFT) >= MAX_OCACHE_PAGES) {
137 __raw_writel(__raw_readl(CCR) | CCR_OCACHE_INVALIDATE, CCR); 137 __raw_writel(__raw_readl(SH_CCR) | CCR_OCACHE_INVALIDATE,
138 SH_CCR);
138 } else { 139 } else {
139 for (v = begin; v < end; v += L1_CACHE_BYTES) 140 for (v = begin; v < end; v += L1_CACHE_BYTES)
140 sh2a_invalidate_line(CACHE_OC_ADDRESS_ARRAY, v); 141 sh2a_invalidate_line(CACHE_OC_ADDRESS_ARRAY, v);
@@ -167,7 +168,8 @@ static void sh2a_flush_icache_range(void *args)
167 /* I-Cache invalidate */ 168 /* I-Cache invalidate */
168 /* If there are too many pages then just blow the cache */ 169 /* If there are too many pages then just blow the cache */
169 if (((end - start) >> PAGE_SHIFT) >= MAX_ICACHE_PAGES) { 170 if (((end - start) >> PAGE_SHIFT) >= MAX_ICACHE_PAGES) {
170 __raw_writel(__raw_readl(CCR) | CCR_ICACHE_INVALIDATE, CCR); 171 __raw_writel(__raw_readl(SH_CCR) | CCR_ICACHE_INVALIDATE,
172 SH_CCR);
171 } else { 173 } else {
172 for (v = start; v < end; v += L1_CACHE_BYTES) 174 for (v = start; v < end; v += L1_CACHE_BYTES)
173 sh2a_invalidate_line(CACHE_IC_ADDRESS_ARRAY, v); 175 sh2a_invalidate_line(CACHE_IC_ADDRESS_ARRAY, v);
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c
index 0e529285b28d..51d8f7f31d1d 100644
--- a/arch/sh/mm/cache-sh4.c
+++ b/arch/sh/mm/cache-sh4.c
@@ -133,9 +133,9 @@ static void flush_icache_all(void)
133 jump_to_uncached(); 133 jump_to_uncached();
134 134
135 /* Flush I-cache */ 135 /* Flush I-cache */
136 ccr = __raw_readl(CCR); 136 ccr = __raw_readl(SH_CCR);
137 ccr |= CCR_CACHE_ICI; 137 ccr |= CCR_CACHE_ICI;
138 __raw_writel(ccr, CCR); 138 __raw_writel(ccr, SH_CCR);
139 139
140 /* 140 /*
141 * back_to_cached() will take care of the barrier for us, don't add 141 * back_to_cached() will take care of the barrier for us, don't add
diff --git a/arch/sh/mm/cache-shx3.c b/arch/sh/mm/cache-shx3.c
index c0adbee97b5f..24c58b7dc022 100644
--- a/arch/sh/mm/cache-shx3.c
+++ b/arch/sh/mm/cache-shx3.c
@@ -19,7 +19,7 @@ void __init shx3_cache_init(void)
19{ 19{
20 unsigned int ccr; 20 unsigned int ccr;
21 21
22 ccr = __raw_readl(CCR); 22 ccr = __raw_readl(SH_CCR);
23 23
24 /* 24 /*
25 * If we've got cache aliases, resolve them in hardware. 25 * If we've got cache aliases, resolve them in hardware.
@@ -40,5 +40,5 @@ void __init shx3_cache_init(void)
40 ccr |= CCR_CACHE_IBE; 40 ccr |= CCR_CACHE_IBE;
41#endif 41#endif
42 42
43 writel_uncached(ccr, CCR); 43 writel_uncached(ccr, SH_CCR);
44} 44}
diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c
index 616966a96cba..097c2cdd117f 100644
--- a/arch/sh/mm/cache.c
+++ b/arch/sh/mm/cache.c
@@ -285,8 +285,8 @@ void __init cpu_cache_init(void)
285{ 285{
286 unsigned int cache_disabled = 0; 286 unsigned int cache_disabled = 0;
287 287
288#ifdef CCR 288#ifdef SH_CCR
289 cache_disabled = !(__raw_readl(CCR) & CCR_CACHE_ENABLE); 289 cache_disabled = !(__raw_readl(SH_CCR) & CCR_CACHE_ENABLE);
290#endif 290#endif
291 291
292 compute_alias(&boot_cpu_data.icache); 292 compute_alias(&boot_cpu_data.icache);
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index 4b60a0c325ec..a45821818003 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -6,15 +6,16 @@ generic-y += cputime.h
6generic-y += div64.h 6generic-y += div64.h
7generic-y += emergency-restart.h 7generic-y += emergency-restart.h
8generic-y += exec.h 8generic-y += exec.h
9generic-y += linkage.h 9generic-y += hash.h
10generic-y += local64.h
11generic-y += mutex.h
12generic-y += irq_regs.h 10generic-y += irq_regs.h
11generic-y += linkage.h
13generic-y += local.h 12generic-y += local.h
13generic-y += local64.h
14generic-y += mcs_spinlock.h
14generic-y += module.h 15generic-y += module.h
16generic-y += mutex.h
17generic-y += preempt.h
15generic-y += serial.h 18generic-y += serial.h
16generic-y += trace_clock.h 19generic-y += trace_clock.h
17generic-y += types.h 20generic-y += types.h
18generic-y += word-at-a-time.h 21generic-y += word-at-a-time.h
19generic-y += preempt.h
20generic-y += hash.h
diff --git a/arch/sparc/include/asm/smp_64.h b/arch/sparc/include/asm/smp_64.h
index dd3bef4b9896..05710393959f 100644
--- a/arch/sparc/include/asm/smp_64.h
+++ b/arch/sparc/include/asm/smp_64.h
@@ -32,7 +32,6 @@
32 32
33DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); 33DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
34extern cpumask_t cpu_core_map[NR_CPUS]; 34extern cpumask_t cpu_core_map[NR_CPUS];
35extern int sparc64_multi_core;
36 35
37extern void arch_send_call_function_single_ipi(int cpu); 36extern void arch_send_call_function_single_ipi(int cpu);
38extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 37extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
diff --git a/arch/sparc/include/asm/topology_64.h b/arch/sparc/include/asm/topology_64.h
index 1754390a426f..a2d10fc64faf 100644
--- a/arch/sparc/include/asm/topology_64.h
+++ b/arch/sparc/include/asm/topology_64.h
@@ -42,8 +42,6 @@ static inline int pcibus_to_node(struct pci_bus *pbus)
42#define topology_core_id(cpu) (cpu_data(cpu).core_id) 42#define topology_core_id(cpu) (cpu_data(cpu).core_id)
43#define topology_core_cpumask(cpu) (&cpu_core_map[cpu]) 43#define topology_core_cpumask(cpu) (&cpu_core_map[cpu])
44#define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu)) 44#define topology_thread_cpumask(cpu) (&per_cpu(cpu_sibling_map, cpu))
45#define mc_capable() (sparc64_multi_core)
46#define smt_capable() (sparc64_multi_core)
47#endif /* CONFIG_SMP */ 45#endif /* CONFIG_SMP */
48 46
49extern cpumask_t cpu_core_map[NR_CPUS]; 47extern cpumask_t cpu_core_map[NR_CPUS];
diff --git a/arch/sparc/kernel/leon_pci.c b/arch/sparc/kernel/leon_pci.c
index 88aaaa57bb64..e16c4157e1ae 100644
--- a/arch/sparc/kernel/leon_pci.c
+++ b/arch/sparc/kernel/leon_pci.c
@@ -99,11 +99,6 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
99 return res->start; 99 return res->start;
100} 100}
101 101
102int pcibios_enable_device(struct pci_dev *dev, int mask)
103{
104 return pci_enable_resources(dev, mask);
105}
106
107/* in/out routines taken from pcic.c 102/* in/out routines taken from pcic.c
108 * 103 *
109 * This probably belongs here rather than ioport.c because 104 * This probably belongs here rather than ioport.c because
diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
index b90bf23e3aab..a1a4400d4025 100644
--- a/arch/sparc/kernel/mdesc.c
+++ b/arch/sparc/kernel/mdesc.c
@@ -896,10 +896,6 @@ void mdesc_fill_in_cpu_data(cpumask_t *mask)
896 896
897 mdesc_iterate_over_cpus(fill_in_one_cpu, NULL, mask); 897 mdesc_iterate_over_cpus(fill_in_one_cpu, NULL, mask);
898 898
899#ifdef CONFIG_SMP
900 sparc64_multi_core = 1;
901#endif
902
903 hp = mdesc_grab(); 899 hp = mdesc_grab();
904 900
905 set_core_ids(hp); 901 set_core_ids(hp);
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index 32a280ec38c1..d7b4967f8fa6 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -58,9 +58,12 @@ void arch_cpu_idle(void)
58{ 58{
59 if (tlb_type != hypervisor) { 59 if (tlb_type != hypervisor) {
60 touch_nmi_watchdog(); 60 touch_nmi_watchdog();
61 local_irq_enable();
61 } else { 62 } else {
62 unsigned long pstate; 63 unsigned long pstate;
63 64
65 local_irq_enable();
66
64 /* The sun4v sleeping code requires that we have PSTATE.IE cleared over 67 /* The sun4v sleeping code requires that we have PSTATE.IE cleared over
65 * the cpu sleep hypervisor call. 68 * the cpu sleep hypervisor call.
66 */ 69 */
@@ -82,7 +85,6 @@ void arch_cpu_idle(void)
82 : "=&r" (pstate) 85 : "=&r" (pstate)
83 : "i" (PSTATE_IE)); 86 : "i" (PSTATE_IE));
84 } 87 }
85 local_irq_enable();
86} 88}
87 89
88#ifdef CONFIG_HOTPLUG_CPU 90#ifdef CONFIG_HOTPLUG_CPU
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
index 6b39125eb927..9a690d39c01b 100644
--- a/arch/sparc/kernel/prom_64.c
+++ b/arch/sparc/kernel/prom_64.c
@@ -555,9 +555,6 @@ static void *fill_in_one_cpu(struct device_node *dp, int cpuid, int arg)
555 555
556 cpu_data(cpuid).core_id = portid + 1; 556 cpu_data(cpuid).core_id = portid + 1;
557 cpu_data(cpuid).proc_id = portid; 557 cpu_data(cpuid).proc_id = portid;
558#ifdef CONFIG_SMP
559 sparc64_multi_core = 1;
560#endif
561 } else { 558 } else {
562 cpu_data(cpuid).dcache_size = 559 cpu_data(cpuid).dcache_size =
563 of_getintprop_default(dp, "dcache-size", 16 * 1024); 560 of_getintprop_default(dp, "dcache-size", 16 * 1024);
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index b085311dcd0e..9781048161ab 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -53,8 +53,6 @@
53 53
54#include "cpumap.h" 54#include "cpumap.h"
55 55
56int sparc64_multi_core __read_mostly;
57
58DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE; 56DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE;
59cpumask_t cpu_core_map[NR_CPUS] __read_mostly = 57cpumask_t cpu_core_map[NR_CPUS] __read_mostly =
60 { [0 ... NR_CPUS-1] = CPU_MASK_NONE }; 58 { [0 ... NR_CPUS-1] = CPU_MASK_NONE };
diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S
index 87729fff13b9..33a17e7b3ccd 100644
--- a/arch/sparc/kernel/syscalls.S
+++ b/arch/sparc/kernel/syscalls.S
@@ -189,7 +189,8 @@ linux_sparc_syscall32:
189 mov %i0, %l5 ! IEU1 189 mov %i0, %l5 ! IEU1
1905: call %l7 ! CTI Group brk forced 1905: call %l7 ! CTI Group brk forced
191 srl %i5, 0, %o5 ! IEU1 191 srl %i5, 0, %o5 ! IEU1
192 ba,a,pt %xcc, 3f 192 ba,pt %xcc, 3f
193 sra %o0, 0, %o0
193 194
194 /* Linux native system calls enter here... */ 195 /* Linux native system calls enter here... */
195 .align 32 196 .align 32
@@ -217,7 +218,6 @@ linux_sparc_syscall:
2173: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] 2183: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
218ret_sys_call: 219ret_sys_call:
219 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3 220 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3
220 sra %o0, 0, %o0
221 mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2 221 mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2
222 sllx %g2, 32, %g2 222 sllx %g2, 32, %g2
223 223
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index c3d82b5f54ca..3fddf64c7fc6 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -659,8 +659,7 @@ static int sparc64_cpufreq_notifier(struct notifier_block *nb, unsigned long val
659 ft->clock_tick_ref = cpu_data(cpu).clock_tick; 659 ft->clock_tick_ref = cpu_data(cpu).clock_tick;
660 } 660 }
661 if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) || 661 if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) ||
662 (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) || 662 (val == CPUFREQ_POSTCHANGE && freq->old > freq->new)) {
663 (val == CPUFREQ_RESUMECHANGE)) {
664 cpu_data(cpu).clock_tick = 663 cpu_data(cpu).clock_tick =
665 cpufreq_scale(ft->clock_tick_ref, 664 cpufreq_scale(ft->clock_tick_ref,
666 ft->ref_freq, 665 ft->ref_freq,
@@ -733,7 +732,7 @@ void __irq_entry timer_interrupt(int irq, struct pt_regs *regs)
733 irq_enter(); 732 irq_enter();
734 733
735 local_cpu_data().irq0_irqs++; 734 local_cpu_data().irq0_irqs++;
736 kstat_incr_irqs_this_cpu(0, irq_to_desc(0)); 735 kstat_incr_irq_this_cpu(0);
737 736
738 if (unlikely(!evt->event_handler)) { 737 if (unlikely(!evt->event_handler)) {
739 printk(KERN_WARNING 738 printk(KERN_WARNING
diff --git a/arch/sparc/mm/tsb.c b/arch/sparc/mm/tsb.c
index 3b3a360b429a..f5d506fdddad 100644
--- a/arch/sparc/mm/tsb.c
+++ b/arch/sparc/mm/tsb.c
@@ -273,7 +273,7 @@ void __init pgtable_cache_init(void)
273 prom_halt(); 273 prom_halt();
274 } 274 }
275 275
276 for (i = 0; i < 8; i++) { 276 for (i = 0; i < ARRAY_SIZE(tsb_cache_names); i++) {
277 unsigned long size = 8192 << i; 277 unsigned long size = 8192 << i;
278 const char *name = tsb_cache_names[i]; 278 const char *name = tsb_cache_names[i];
279 279
diff --git a/arch/tile/include/asm/Kbuild b/arch/tile/include/asm/Kbuild
index 3793c75e45d9..0aa5675e7025 100644
--- a/arch/tile/include/asm/Kbuild
+++ b/arch/tile/include/asm/Kbuild
@@ -11,6 +11,7 @@ generic-y += errno.h
11generic-y += exec.h 11generic-y += exec.h
12generic-y += fb.h 12generic-y += fb.h
13generic-y += fcntl.h 13generic-y += fcntl.h
14generic-y += hash.h
14generic-y += hw_irq.h 15generic-y += hw_irq.h
15generic-y += ioctl.h 16generic-y += ioctl.h
16generic-y += ioctls.h 17generic-y += ioctls.h
@@ -18,12 +19,14 @@ generic-y += ipcbuf.h
18generic-y += irq_regs.h 19generic-y += irq_regs.h
19generic-y += local.h 20generic-y += local.h
20generic-y += local64.h 21generic-y += local64.h
22generic-y += mcs_spinlock.h
21generic-y += msgbuf.h 23generic-y += msgbuf.h
22generic-y += mutex.h 24generic-y += mutex.h
23generic-y += param.h 25generic-y += param.h
24generic-y += parport.h 26generic-y += parport.h
25generic-y += poll.h 27generic-y += poll.h
26generic-y += posix_types.h 28generic-y += posix_types.h
29generic-y += preempt.h
27generic-y += resource.h 30generic-y += resource.h
28generic-y += scatterlist.h 31generic-y += scatterlist.h
29generic-y += sembuf.h 32generic-y += sembuf.h
@@ -38,5 +41,3 @@ generic-y += termios.h
38generic-y += trace_clock.h 41generic-y += trace_clock.h
39generic-y += types.h 42generic-y += types.h
40generic-y += xor.h 43generic-y += xor.h
41generic-y += preempt.h
42generic-y += hash.h
diff --git a/arch/tile/kernel/pci_gx.c b/arch/tile/kernel/pci_gx.c
index a97a6452b812..077b7bc437e5 100644
--- a/arch/tile/kernel/pci_gx.c
+++ b/arch/tile/kernel/pci_gx.c
@@ -1065,18 +1065,6 @@ char *__init pcibios_setup(char *str)
1065} 1065}
1066 1066
1067/* 1067/*
1068 * Enable memory address decoding, as appropriate, for the
1069 * device described by the 'dev' struct.
1070 *
1071 * This is called from the generic PCI layer, and can be called
1072 * for bridges or endpoints.
1073 */
1074int pcibios_enable_device(struct pci_dev *dev, int mask)
1075{
1076 return pci_enable_resources(dev, mask);
1077}
1078
1079/*
1080 * Called for each device after PCI setup is done. 1068 * Called for each device after PCI setup is done.
1081 * We initialize the PCI device capabilities conservatively, assuming that 1069 * We initialize the PCI device capabilities conservatively, assuming that
1082 * all devices can only address the 32-bit DMA space. The exception here is 1070 * all devices can only address the 32-bit DMA space. The exception here is
diff --git a/arch/um/include/asm/Kbuild b/arch/um/include/asm/Kbuild
index 88a330dcdede..a5e4b6068213 100644
--- a/arch/um/include/asm/Kbuild
+++ b/arch/um/include/asm/Kbuild
@@ -1,8 +1,28 @@
1generic-y += bug.h cputime.h device.h emergency-restart.h futex.h hardirq.h
2generic-y += hw_irq.h irq_regs.h kdebug.h percpu.h sections.h topology.h xor.h
3generic-y += ftrace.h pci.h io.h param.h delay.h mutex.h current.h exec.h
4generic-y += switch_to.h clkdev.h
5generic-y += trace_clock.h
6generic-y += preempt.h
7generic-y += hash.h
8generic-y += barrier.h 1generic-y += barrier.h
2generic-y += bug.h
3generic-y += clkdev.h
4generic-y += cputime.h
5generic-y += current.h
6generic-y += delay.h
7generic-y += device.h
8generic-y += emergency-restart.h
9generic-y += exec.h
10generic-y += ftrace.h
11generic-y += futex.h
12generic-y += hardirq.h
13generic-y += hash.h
14generic-y += hw_irq.h
15generic-y += io.h
16generic-y += irq_regs.h
17generic-y += kdebug.h
18generic-y += mcs_spinlock.h
19generic-y += mutex.h
20generic-y += param.h
21generic-y += pci.h
22generic-y += percpu.h
23generic-y += preempt.h
24generic-y += sections.h
25generic-y += switch_to.h
26generic-y += topology.h
27generic-y += trace_clock.h
28generic-y += xor.h
diff --git a/arch/unicore32/include/asm/Kbuild b/arch/unicore32/include/asm/Kbuild
index 3ef4f9d9bf5d..1e5fb872a4aa 100644
--- a/arch/unicore32/include/asm/Kbuild
+++ b/arch/unicore32/include/asm/Kbuild
@@ -16,6 +16,7 @@ generic-y += fcntl.h
16generic-y += ftrace.h 16generic-y += ftrace.h
17generic-y += futex.h 17generic-y += futex.h
18generic-y += hardirq.h 18generic-y += hardirq.h
19generic-y += hash.h
19generic-y += hw_irq.h 20generic-y += hw_irq.h
20generic-y += ioctl.h 21generic-y += ioctl.h
21generic-y += ioctls.h 22generic-y += ioctls.h
@@ -24,6 +25,7 @@ generic-y += irq_regs.h
24generic-y += kdebug.h 25generic-y += kdebug.h
25generic-y += kmap_types.h 26generic-y += kmap_types.h
26generic-y += local.h 27generic-y += local.h
28generic-y += mcs_spinlock.h
27generic-y += mman.h 29generic-y += mman.h
28generic-y += module.h 30generic-y += module.h
29generic-y += msgbuf.h 31generic-y += msgbuf.h
@@ -32,6 +34,7 @@ generic-y += parport.h
32generic-y += percpu.h 34generic-y += percpu.h
33generic-y += poll.h 35generic-y += poll.h
34generic-y += posix_types.h 36generic-y += posix_types.h
37generic-y += preempt.h
35generic-y += resource.h 38generic-y += resource.h
36generic-y += scatterlist.h 39generic-y += scatterlist.h
37generic-y += sections.h 40generic-y += sections.h
@@ -60,5 +63,3 @@ generic-y += unaligned.h
60generic-y += user.h 63generic-y += user.h
61generic-y += vga.h 64generic-y += vga.h
62generic-y += xor.h 65generic-y += xor.h
63generic-y += preempt.h
64generic-y += hash.h
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 7fab7e0b1a72..26237934ac87 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1583,6 +1583,20 @@ config EFI_STUB
1583 1583
1584 See Documentation/efi-stub.txt for more information. 1584 See Documentation/efi-stub.txt for more information.
1585 1585
1586config EFI_MIXED
1587 bool "EFI mixed-mode support"
1588 depends on EFI_STUB && X86_64
1589 ---help---
1590 Enabling this feature allows a 64-bit kernel to be booted
1591 on a 32-bit firmware, provided that your CPU supports 64-bit
1592 mode.
1593
1594 Note that it is not possible to boot a mixed-mode enabled
1595 kernel via the EFI boot stub - a bootloader that supports
1596 the EFI handover protocol must be used.
1597
1598 If unsure, say N.
1599
1586config SECCOMP 1600config SECCOMP
1587 def_bool y 1601 def_bool y
1588 prompt "Enable seccomp to safely compute untrusted bytecode" 1602 prompt "Enable seccomp to safely compute untrusted bytecode"
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index c026cca5602c..f3aaf231b4e5 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -341,10 +341,6 @@ config X86_USE_3DNOW
341 def_bool y 341 def_bool y
342 depends on (MCYRIXIII || MK7 || MGEODE_LX) && !UML 342 depends on (MCYRIXIII || MK7 || MGEODE_LX) && !UML
343 343
344config X86_OOSTORE
345 def_bool y
346 depends on (MWINCHIP3D || MWINCHIPC6) && MTRR
347
348# 344#
349# P6_NOPs are a relatively minor optimization that require a family >= 345# P6_NOPs are a relatively minor optimization that require a family >=
350# 6 processor, except that it is broken on certain VIA chips. 346# 6 processor, except that it is broken on certain VIA chips.
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 321a52ccf63a..61bd2ad94281 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -81,6 +81,15 @@ config X86_PTDUMP
81 kernel. 81 kernel.
82 If in doubt, say "N" 82 If in doubt, say "N"
83 83
84config EFI_PGT_DUMP
85 bool "Dump the EFI pagetable"
86 depends on EFI && X86_PTDUMP
87 ---help---
88 Enable this if you want to dump the EFI page table before
89 enabling virtual mode. This can be used to debug miscellaneous
90 issues with the mapping of the EFI runtime regions into that
91 table.
92
84config DEBUG_RODATA 93config DEBUG_RODATA
85 bool "Write protect kernel read-only data structures" 94 bool "Write protect kernel read-only data structures"
86 default y 95 default y
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index eeda43abed6e..3b9348a0c1a4 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -82,8 +82,8 @@ else
82 KBUILD_AFLAGS += -m64 82 KBUILD_AFLAGS += -m64
83 KBUILD_CFLAGS += -m64 83 KBUILD_CFLAGS += -m64
84 84
85 # Don't autogenerate MMX or SSE instructions 85 # Don't autogenerate traditional x87, MMX or SSE instructions
86 KBUILD_CFLAGS += -mno-mmx -mno-sse 86 KBUILD_CFLAGS += -mno-mmx -mno-sse -mno-80387 -mno-fp-ret-in-387
87 87
88 # Use -mpreferred-stack-boundary=3 if supported. 88 # Use -mpreferred-stack-boundary=3 if supported.
89 KBUILD_CFLAGS += $(call cc-option,-mpreferred-stack-boundary=3) 89 KBUILD_CFLAGS += $(call cc-option,-mpreferred-stack-boundary=3)
@@ -152,6 +152,7 @@ cfi-sections := $(call as-instr,.cfi_sections .debug_frame,-DCONFIG_AS_CFI_SECTI
152 152
153# does binutils support specific instructions? 153# does binutils support specific instructions?
154asinstr := $(call as-instr,fxsaveq (%rax),-DCONFIG_AS_FXSAVEQ=1) 154asinstr := $(call as-instr,fxsaveq (%rax),-DCONFIG_AS_FXSAVEQ=1)
155asinstr += $(call as-instr,crc32l %eax$(comma)%eax,-DCONFIG_AS_CRC32=1)
155avx_instr := $(call as-instr,vxorps %ymm0$(comma)%ymm1$(comma)%ymm2,-DCONFIG_AS_AVX=1) 156avx_instr := $(call as-instr,vxorps %ymm0$(comma)%ymm1$(comma)%ymm2,-DCONFIG_AS_AVX=1)
156avx2_instr :=$(call as-instr,vpbroadcastb %xmm0$(comma)%ymm1,-DCONFIG_AS_AVX2=1) 157avx2_instr :=$(call as-instr,vpbroadcastb %xmm0$(comma)%ymm1,-DCONFIG_AS_AVX2=1)
157 158
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index 878df7e88cd4..abb9eba61b50 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -80,7 +80,7 @@ targets += voffset.h
80$(obj)/voffset.h: vmlinux FORCE 80$(obj)/voffset.h: vmlinux FORCE
81 $(call if_changed,voffset) 81 $(call if_changed,voffset)
82 82
83sed-zoffset := -e 's/^\([0-9a-fA-F]*\) . \(startup_32\|startup_64\|efi_pe_entry\|efi_stub_entry\|input_data\|_end\|z_.*\)$$/\#define ZO_\2 0x\1/p' 83sed-zoffset := -e 's/^\([0-9a-fA-F]*\) . \(startup_32\|startup_64\|efi32_stub_entry\|efi64_stub_entry\|efi_pe_entry\|input_data\|_end\|z_.*\)$$/\#define ZO_\2 0x\1/p'
84 84
85quiet_cmd_zoffset = ZOFFSET $@ 85quiet_cmd_zoffset = ZOFFSET $@
86 cmd_zoffset = $(NM) $< | sed -n $(sed-zoffset) > $@ 86 cmd_zoffset = $(NM) $< | sed -n $(sed-zoffset) > $@
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index a7677babf946..1e6146137f8e 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -19,10 +19,272 @@
19 19
20static efi_system_table_t *sys_table; 20static efi_system_table_t *sys_table;
21 21
22static struct efi_config *efi_early;
23
24#define efi_call_early(f, ...) \
25 efi_early->call(efi_early->f, __VA_ARGS__);
26
27#define BOOT_SERVICES(bits) \
28static void setup_boot_services##bits(struct efi_config *c) \
29{ \
30 efi_system_table_##bits##_t *table; \
31 efi_boot_services_##bits##_t *bt; \
32 \
33 table = (typeof(table))sys_table; \
34 \
35 c->text_output = table->con_out; \
36 \
37 bt = (typeof(bt))(unsigned long)(table->boottime); \
38 \
39 c->allocate_pool = bt->allocate_pool; \
40 c->allocate_pages = bt->allocate_pages; \
41 c->get_memory_map = bt->get_memory_map; \
42 c->free_pool = bt->free_pool; \
43 c->free_pages = bt->free_pages; \
44 c->locate_handle = bt->locate_handle; \
45 c->handle_protocol = bt->handle_protocol; \
46 c->exit_boot_services = bt->exit_boot_services; \
47}
48BOOT_SERVICES(32);
49BOOT_SERVICES(64);
22 50
23#include "../../../../drivers/firmware/efi/efi-stub-helper.c" 51static void efi_printk(efi_system_table_t *, char *);
52static void efi_char16_printk(efi_system_table_t *, efi_char16_t *);
53
54static efi_status_t
55__file_size32(void *__fh, efi_char16_t *filename_16,
56 void **handle, u64 *file_sz)
57{
58 efi_file_handle_32_t *h, *fh = __fh;
59 efi_file_info_t *info;
60 efi_status_t status;
61 efi_guid_t info_guid = EFI_FILE_INFO_ID;
62 u32 info_sz;
63
64 status = efi_early->call((unsigned long)fh->open, fh, &h, filename_16,
65 EFI_FILE_MODE_READ, (u64)0);
66 if (status != EFI_SUCCESS) {
67 efi_printk(sys_table, "Failed to open file: ");
68 efi_char16_printk(sys_table, filename_16);
69 efi_printk(sys_table, "\n");
70 return status;
71 }
72
73 *handle = h;
74
75 info_sz = 0;
76 status = efi_early->call((unsigned long)h->get_info, h, &info_guid,
77 &info_sz, NULL);
78 if (status != EFI_BUFFER_TOO_SMALL) {
79 efi_printk(sys_table, "Failed to get file info size\n");
80 return status;
81 }
82
83grow:
84 status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
85 info_sz, (void **)&info);
86 if (status != EFI_SUCCESS) {
87 efi_printk(sys_table, "Failed to alloc mem for file info\n");
88 return status;
89 }
90
91 status = efi_early->call((unsigned long)h->get_info, h, &info_guid,
92 &info_sz, info);
93 if (status == EFI_BUFFER_TOO_SMALL) {
94 efi_call_early(free_pool, info);
95 goto grow;
96 }
97
98 *file_sz = info->file_size;
99 efi_call_early(free_pool, info);
100
101 if (status != EFI_SUCCESS)
102 efi_printk(sys_table, "Failed to get initrd info\n");
103
104 return status;
105}
106
107static efi_status_t
108__file_size64(void *__fh, efi_char16_t *filename_16,
109 void **handle, u64 *file_sz)
110{
111 efi_file_handle_64_t *h, *fh = __fh;
112 efi_file_info_t *info;
113 efi_status_t status;
114 efi_guid_t info_guid = EFI_FILE_INFO_ID;
115 u32 info_sz;
24 116
117 status = efi_early->call((unsigned long)fh->open, fh, &h, filename_16,
118 EFI_FILE_MODE_READ, (u64)0);
119 if (status != EFI_SUCCESS) {
120 efi_printk(sys_table, "Failed to open file: ");
121 efi_char16_printk(sys_table, filename_16);
122 efi_printk(sys_table, "\n");
123 return status;
124 }
25 125
126 *handle = h;
127
128 info_sz = 0;
129 status = efi_early->call((unsigned long)h->get_info, h, &info_guid,
130 &info_sz, NULL);
131 if (status != EFI_BUFFER_TOO_SMALL) {
132 efi_printk(sys_table, "Failed to get file info size\n");
133 return status;
134 }
135
136grow:
137 status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
138 info_sz, (void **)&info);
139 if (status != EFI_SUCCESS) {
140 efi_printk(sys_table, "Failed to alloc mem for file info\n");
141 return status;
142 }
143
144 status = efi_early->call((unsigned long)h->get_info, h, &info_guid,
145 &info_sz, info);
146 if (status == EFI_BUFFER_TOO_SMALL) {
147 efi_call_early(free_pool, info);
148 goto grow;
149 }
150
151 *file_sz = info->file_size;
152 efi_call_early(free_pool, info);
153
154 if (status != EFI_SUCCESS)
155 efi_printk(sys_table, "Failed to get initrd info\n");
156
157 return status;
158}
159static efi_status_t
160efi_file_size(efi_system_table_t *sys_table, void *__fh,
161 efi_char16_t *filename_16, void **handle, u64 *file_sz)
162{
163 if (efi_early->is64)
164 return __file_size64(__fh, filename_16, handle, file_sz);
165
166 return __file_size32(__fh, filename_16, handle, file_sz);
167}
168
169static inline efi_status_t
170efi_file_read(void *__fh, void *handle, unsigned long *size, void *addr)
171{
172 unsigned long func;
173
174 if (efi_early->is64) {
175 efi_file_handle_64_t *fh = __fh;
176
177 func = (unsigned long)fh->read;
178 return efi_early->call(func, handle, size, addr);
179 } else {
180 efi_file_handle_32_t *fh = __fh;
181
182 func = (unsigned long)fh->read;
183 return efi_early->call(func, handle, size, addr);
184 }
185}
186
187static inline efi_status_t efi_file_close(void *__fh, void *handle)
188{
189 if (efi_early->is64) {
190 efi_file_handle_64_t *fh = __fh;
191
192 return efi_early->call((unsigned long)fh->close, handle);
193 } else {
194 efi_file_handle_32_t *fh = __fh;
195
196 return efi_early->call((unsigned long)fh->close, handle);
197 }
198}
199
200static inline efi_status_t __open_volume32(void *__image, void **__fh)
201{
202 efi_file_io_interface_t *io;
203 efi_loaded_image_32_t *image = __image;
204 efi_file_handle_32_t *fh;
205 efi_guid_t fs_proto = EFI_FILE_SYSTEM_GUID;
206 efi_status_t status;
207 void *handle = (void *)(unsigned long)image->device_handle;
208 unsigned long func;
209
210 status = efi_call_early(handle_protocol, handle,
211 &fs_proto, (void **)&io);
212 if (status != EFI_SUCCESS) {
213 efi_printk(sys_table, "Failed to handle fs_proto\n");
214 return status;
215 }
216
217 func = (unsigned long)io->open_volume;
218 status = efi_early->call(func, io, &fh);
219 if (status != EFI_SUCCESS)
220 efi_printk(sys_table, "Failed to open volume\n");
221
222 *__fh = fh;
223 return status;
224}
225
226static inline efi_status_t __open_volume64(void *__image, void **__fh)
227{
228 efi_file_io_interface_t *io;
229 efi_loaded_image_64_t *image = __image;
230 efi_file_handle_64_t *fh;
231 efi_guid_t fs_proto = EFI_FILE_SYSTEM_GUID;
232 efi_status_t status;
233 void *handle = (void *)(unsigned long)image->device_handle;
234 unsigned long func;
235
236 status = efi_call_early(handle_protocol, handle,
237 &fs_proto, (void **)&io);
238 if (status != EFI_SUCCESS) {
239 efi_printk(sys_table, "Failed to handle fs_proto\n");
240 return status;
241 }
242
243 func = (unsigned long)io->open_volume;
244 status = efi_early->call(func, io, &fh);
245 if (status != EFI_SUCCESS)
246 efi_printk(sys_table, "Failed to open volume\n");
247
248 *__fh = fh;
249 return status;
250}
251
252static inline efi_status_t
253efi_open_volume(efi_system_table_t *sys_table, void *__image, void **__fh)
254{
255 if (efi_early->is64)
256 return __open_volume64(__image, __fh);
257
258 return __open_volume32(__image, __fh);
259}
260
261static void efi_char16_printk(efi_system_table_t *table, efi_char16_t *str)
262{
263 unsigned long output_string;
264 size_t offset;
265
266 if (efi_early->is64) {
267 struct efi_simple_text_output_protocol_64 *out;
268 u64 *func;
269
270 offset = offsetof(typeof(*out), output_string);
271 output_string = efi_early->text_output + offset;
272 func = (u64 *)output_string;
273
274 efi_early->call(*func, efi_early->text_output, str);
275 } else {
276 struct efi_simple_text_output_protocol_32 *out;
277 u32 *func;
278
279 offset = offsetof(typeof(*out), output_string);
280 output_string = efi_early->text_output + offset;
281 func = (u32 *)output_string;
282
283 efi_early->call(*func, efi_early->text_output, str);
284 }
285}
286
287#include "../../../../drivers/firmware/efi/efi-stub-helper.c"
26 288
27static void find_bits(unsigned long mask, u8 *pos, u8 *size) 289static void find_bits(unsigned long mask, u8 *pos, u8 *size)
28{ 290{
@@ -47,105 +309,97 @@ static void find_bits(unsigned long mask, u8 *pos, u8 *size)
47 *size = len; 309 *size = len;
48} 310}
49 311
50static efi_status_t setup_efi_pci(struct boot_params *params) 312static efi_status_t
313__setup_efi_pci32(efi_pci_io_protocol_32 *pci, struct pci_setup_rom **__rom)
51{ 314{
52 efi_pci_io_protocol *pci; 315 struct pci_setup_rom *rom = NULL;
53 efi_status_t status; 316 efi_status_t status;
54 void **pci_handle; 317 unsigned long size;
55 efi_guid_t pci_proto = EFI_PCI_IO_PROTOCOL_GUID; 318 uint64_t attributes;
56 unsigned long nr_pci, size = 0;
57 int i;
58 struct setup_data *data;
59 319
60 data = (struct setup_data *)(unsigned long)params->hdr.setup_data; 320 status = efi_early->call(pci->attributes, pci,
321 EfiPciIoAttributeOperationGet, 0, 0,
322 &attributes);
323 if (status != EFI_SUCCESS)
324 return status;
61 325
62 while (data && data->next) 326 if (!pci->romimage || !pci->romsize)
63 data = (struct setup_data *)(unsigned long)data->next; 327 return EFI_INVALID_PARAMETER;
64 328
65 status = efi_call_phys5(sys_table->boottime->locate_handle, 329 size = pci->romsize + sizeof(*rom);
66 EFI_LOCATE_BY_PROTOCOL, &pci_proto,
67 NULL, &size, pci_handle);
68 330
69 if (status == EFI_BUFFER_TOO_SMALL) { 331 status = efi_call_early(allocate_pool, EFI_LOADER_DATA, size, &rom);
70 status = efi_call_phys3(sys_table->boottime->allocate_pool, 332 if (status != EFI_SUCCESS)
71 EFI_LOADER_DATA, size, &pci_handle); 333 return status;
72 334
73 if (status != EFI_SUCCESS) 335 memset(rom, 0, sizeof(*rom));
74 return status;
75 336
76 status = efi_call_phys5(sys_table->boottime->locate_handle, 337 rom->data.type = SETUP_PCI;
77 EFI_LOCATE_BY_PROTOCOL, &pci_proto, 338 rom->data.len = size - sizeof(struct setup_data);
78 NULL, &size, pci_handle); 339 rom->data.next = 0;
79 } 340 rom->pcilen = pci->romsize;
341 *__rom = rom;
80 342
81 if (status != EFI_SUCCESS) 343 status = efi_early->call(pci->pci.read, pci, EfiPciIoWidthUint16,
82 goto free_handle; 344 PCI_VENDOR_ID, 1, &(rom->vendor));
83
84 nr_pci = size / sizeof(void *);
85 for (i = 0; i < nr_pci; i++) {
86 void *h = pci_handle[i];
87 uint64_t attributes;
88 struct pci_setup_rom *rom;
89 345
90 status = efi_call_phys3(sys_table->boottime->handle_protocol, 346 if (status != EFI_SUCCESS)
91 h, &pci_proto, &pci); 347 goto free_struct;
92 348
93 if (status != EFI_SUCCESS) 349 status = efi_early->call(pci->pci.read, pci, EfiPciIoWidthUint16,
94 continue; 350 PCI_DEVICE_ID, 1, &(rom->devid));
95 351
96 if (!pci) 352 if (status != EFI_SUCCESS)
97 continue; 353 goto free_struct;
98 354
99#ifdef CONFIG_X86_64 355 status = efi_early->call(pci->get_location, pci, &(rom->segment),
100 status = efi_call_phys4(pci->attributes, pci, 356 &(rom->bus), &(rom->device), &(rom->function));
101 EfiPciIoAttributeOperationGet, 0,
102 &attributes);
103#else
104 status = efi_call_phys5(pci->attributes, pci,
105 EfiPciIoAttributeOperationGet, 0, 0,
106 &attributes);
107#endif
108 if (status != EFI_SUCCESS)
109 continue;
110 357
111 if (!pci->romimage || !pci->romsize) 358 if (status != EFI_SUCCESS)
112 continue; 359 goto free_struct;
113 360
114 size = pci->romsize + sizeof(*rom); 361 memcpy(rom->romdata, pci->romimage, pci->romsize);
362 return status;
115 363
116 status = efi_call_phys3(sys_table->boottime->allocate_pool, 364free_struct:
117 EFI_LOADER_DATA, size, &rom); 365 efi_call_early(free_pool, rom);
366 return status;
367}
118 368
119 if (status != EFI_SUCCESS) 369static efi_status_t
120 continue; 370setup_efi_pci32(struct boot_params *params, void **pci_handle,
371 unsigned long size)
372{
373 efi_pci_io_protocol_32 *pci = NULL;
374 efi_guid_t pci_proto = EFI_PCI_IO_PROTOCOL_GUID;
375 u32 *handles = (u32 *)(unsigned long)pci_handle;
376 efi_status_t status;
377 unsigned long nr_pci;
378 struct setup_data *data;
379 int i;
121 380
122 rom->data.type = SETUP_PCI; 381 data = (struct setup_data *)(unsigned long)params->hdr.setup_data;
123 rom->data.len = size - sizeof(struct setup_data);
124 rom->data.next = 0;
125 rom->pcilen = pci->romsize;
126 382
127 status = efi_call_phys5(pci->pci.read, pci, 383 while (data && data->next)
128 EfiPciIoWidthUint16, PCI_VENDOR_ID, 384 data = (struct setup_data *)(unsigned long)data->next;
129 1, &(rom->vendor));
130 385
131 if (status != EFI_SUCCESS) 386 nr_pci = size / sizeof(u32);
132 goto free_struct; 387 for (i = 0; i < nr_pci; i++) {
388 struct pci_setup_rom *rom = NULL;
389 u32 h = handles[i];
133 390
134 status = efi_call_phys5(pci->pci.read, pci, 391 status = efi_call_early(handle_protocol, h,
135 EfiPciIoWidthUint16, PCI_DEVICE_ID, 392 &pci_proto, (void **)&pci);
136 1, &(rom->devid));
137 393
138 if (status != EFI_SUCCESS) 394 if (status != EFI_SUCCESS)
139 goto free_struct; 395 continue;
140 396
141 status = efi_call_phys5(pci->get_location, pci, 397 if (!pci)
142 &(rom->segment), &(rom->bus), 398 continue;
143 &(rom->device), &(rom->function));
144 399
400 status = __setup_efi_pci32(pci, &rom);
145 if (status != EFI_SUCCESS) 401 if (status != EFI_SUCCESS)
146 goto free_struct; 402 continue;
147
148 memcpy(rom->romdata, pci->romimage, pci->romsize);
149 403
150 if (data) 404 if (data)
151 data->next = (unsigned long)rom; 405 data->next = (unsigned long)rom;
@@ -154,105 +408,155 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
154 408
155 data = (struct setup_data *)rom; 409 data = (struct setup_data *)rom;
156 410
157 continue;
158 free_struct:
159 efi_call_phys1(sys_table->boottime->free_pool, rom);
160 } 411 }
161 412
162free_handle:
163 efi_call_phys1(sys_table->boottime->free_pool, pci_handle);
164 return status; 413 return status;
165} 414}
166 415
167/* 416static efi_status_t
168 * See if we have Graphics Output Protocol 417__setup_efi_pci64(efi_pci_io_protocol_64 *pci, struct pci_setup_rom **__rom)
169 */
170static efi_status_t setup_gop(struct screen_info *si, efi_guid_t *proto,
171 unsigned long size)
172{ 418{
173 struct efi_graphics_output_protocol *gop, *first_gop; 419 struct pci_setup_rom *rom;
174 struct efi_pixel_bitmask pixel_info;
175 unsigned long nr_gops;
176 efi_status_t status; 420 efi_status_t status;
177 void **gop_handle; 421 unsigned long size;
178 u16 width, height; 422 uint64_t attributes;
179 u32 fb_base, fb_size;
180 u32 pixels_per_scan_line;
181 int pixel_format;
182 int i;
183 423
184 status = efi_call_phys3(sys_table->boottime->allocate_pool, 424 status = efi_early->call(pci->attributes, pci,
185 EFI_LOADER_DATA, size, &gop_handle); 425 EfiPciIoAttributeOperationGet, 0,
426 &attributes);
186 if (status != EFI_SUCCESS) 427 if (status != EFI_SUCCESS)
187 return status; 428 return status;
188 429
189 status = efi_call_phys5(sys_table->boottime->locate_handle, 430 if (!pci->romimage || !pci->romsize)
190 EFI_LOCATE_BY_PROTOCOL, proto, 431 return EFI_INVALID_PARAMETER;
191 NULL, &size, gop_handle); 432
433 size = pci->romsize + sizeof(*rom);
434
435 status = efi_call_early(allocate_pool, EFI_LOADER_DATA, size, &rom);
192 if (status != EFI_SUCCESS) 436 if (status != EFI_SUCCESS)
193 goto free_handle; 437 return status;
194 438
195 first_gop = NULL; 439 rom->data.type = SETUP_PCI;
440 rom->data.len = size - sizeof(struct setup_data);
441 rom->data.next = 0;
442 rom->pcilen = pci->romsize;
443 *__rom = rom;
196 444
197 nr_gops = size / sizeof(void *); 445 status = efi_early->call(pci->pci.read, pci, EfiPciIoWidthUint16,
198 for (i = 0; i < nr_gops; i++) { 446 PCI_VENDOR_ID, 1, &(rom->vendor));
199 struct efi_graphics_output_mode_info *info; 447
200 efi_guid_t conout_proto = EFI_CONSOLE_OUT_DEVICE_GUID; 448 if (status != EFI_SUCCESS)
201 bool conout_found = false; 449 goto free_struct;
202 void *dummy; 450
203 void *h = gop_handle[i]; 451 status = efi_early->call(pci->pci.read, pci, EfiPciIoWidthUint16,
452 PCI_DEVICE_ID, 1, &(rom->devid));
453
454 if (status != EFI_SUCCESS)
455 goto free_struct;
456
457 status = efi_early->call(pci->get_location, pci, &(rom->segment),
458 &(rom->bus), &(rom->device), &(rom->function));
459
460 if (status != EFI_SUCCESS)
461 goto free_struct;
462
463 memcpy(rom->romdata, pci->romimage, pci->romsize);
464 return status;
465
466free_struct:
467 efi_call_early(free_pool, rom);
468 return status;
469
470}
471
472static efi_status_t
473setup_efi_pci64(struct boot_params *params, void **pci_handle,
474 unsigned long size)
475{
476 efi_pci_io_protocol_64 *pci = NULL;
477 efi_guid_t pci_proto = EFI_PCI_IO_PROTOCOL_GUID;
478 u64 *handles = (u64 *)(unsigned long)pci_handle;
479 efi_status_t status;
480 unsigned long nr_pci;
481 struct setup_data *data;
482 int i;
483
484 data = (struct setup_data *)(unsigned long)params->hdr.setup_data;
485
486 while (data && data->next)
487 data = (struct setup_data *)(unsigned long)data->next;
488
489 nr_pci = size / sizeof(u64);
490 for (i = 0; i < nr_pci; i++) {
491 struct pci_setup_rom *rom = NULL;
492 u64 h = handles[i];
493
494 status = efi_call_early(handle_protocol, h,
495 &pci_proto, (void **)&pci);
204 496
205 status = efi_call_phys3(sys_table->boottime->handle_protocol,
206 h, proto, &gop);
207 if (status != EFI_SUCCESS) 497 if (status != EFI_SUCCESS)
208 continue; 498 continue;
209 499
210 status = efi_call_phys3(sys_table->boottime->handle_protocol, 500 if (!pci)
211 h, &conout_proto, &dummy); 501 continue;
212 502
213 if (status == EFI_SUCCESS) 503 status = __setup_efi_pci64(pci, &rom);
214 conout_found = true; 504 if (status != EFI_SUCCESS)
505 continue;
215 506
216 status = efi_call_phys4(gop->query_mode, gop, 507 if (data)
217 gop->mode->mode, &size, &info); 508 data->next = (unsigned long)rom;
218 if (status == EFI_SUCCESS && (!first_gop || conout_found)) { 509 else
219 /* 510 params->hdr.setup_data = (unsigned long)rom;
220 * Systems that use the UEFI Console Splitter may 511
221 * provide multiple GOP devices, not all of which are 512 data = (struct setup_data *)rom;
222 * backed by real hardware. The workaround is to search
223 * for a GOP implementing the ConOut protocol, and if
224 * one isn't found, to just fall back to the first GOP.
225 */
226 width = info->horizontal_resolution;
227 height = info->vertical_resolution;
228 fb_base = gop->mode->frame_buffer_base;
229 fb_size = gop->mode->frame_buffer_size;
230 pixel_format = info->pixel_format;
231 pixel_info = info->pixel_information;
232 pixels_per_scan_line = info->pixels_per_scan_line;
233 513
234 /*
235 * Once we've found a GOP supporting ConOut,
236 * don't bother looking any further.
237 */
238 first_gop = gop;
239 if (conout_found)
240 break;
241 }
242 } 514 }
243 515
244 /* Did we find any GOPs? */ 516 return status;
245 if (!first_gop) 517}
518
519static efi_status_t setup_efi_pci(struct boot_params *params)
520{
521 efi_status_t status;
522 void **pci_handle = NULL;
523 efi_guid_t pci_proto = EFI_PCI_IO_PROTOCOL_GUID;
524 unsigned long size = 0;
525
526 status = efi_call_early(locate_handle,
527 EFI_LOCATE_BY_PROTOCOL,
528 &pci_proto, NULL, &size, pci_handle);
529
530 if (status == EFI_BUFFER_TOO_SMALL) {
531 status = efi_call_early(allocate_pool,
532 EFI_LOADER_DATA,
533 size, (void **)&pci_handle);
534
535 if (status != EFI_SUCCESS)
536 return status;
537
538 status = efi_call_early(locate_handle,
539 EFI_LOCATE_BY_PROTOCOL, &pci_proto,
540 NULL, &size, pci_handle);
541 }
542
543 if (status != EFI_SUCCESS)
246 goto free_handle; 544 goto free_handle;
247 545
248 /* EFI framebuffer */ 546 if (efi_early->is64)
249 si->orig_video_isVGA = VIDEO_TYPE_EFI; 547 status = setup_efi_pci64(params, pci_handle, size);
548 else
549 status = setup_efi_pci32(params, pci_handle, size);
250 550
251 si->lfb_width = width; 551free_handle:
252 si->lfb_height = height; 552 efi_call_early(free_pool, pci_handle);
253 si->lfb_base = fb_base; 553 return status;
254 si->pages = 1; 554}
255 555
556static void
557setup_pixel_info(struct screen_info *si, u32 pixels_per_scan_line,
558 struct efi_pixel_bitmask pixel_info, int pixel_format)
559{
256 if (pixel_format == PIXEL_RGB_RESERVED_8BIT_PER_COLOR) { 560 if (pixel_format == PIXEL_RGB_RESERVED_8BIT_PER_COLOR) {
257 si->lfb_depth = 32; 561 si->lfb_depth = 32;
258 si->lfb_linelength = pixels_per_scan_line * 4; 562 si->lfb_linelength = pixels_per_scan_line * 4;
@@ -297,62 +601,319 @@ static efi_status_t setup_gop(struct screen_info *si, efi_guid_t *proto,
297 si->rsvd_size = 0; 601 si->rsvd_size = 0;
298 si->rsvd_pos = 0; 602 si->rsvd_pos = 0;
299 } 603 }
604}
605
606static efi_status_t
607__gop_query32(struct efi_graphics_output_protocol_32 *gop32,
608 struct efi_graphics_output_mode_info **info,
609 unsigned long *size, u32 *fb_base)
610{
611 struct efi_graphics_output_protocol_mode_32 *mode;
612 efi_status_t status;
613 unsigned long m;
614
615 m = gop32->mode;
616 mode = (struct efi_graphics_output_protocol_mode_32 *)m;
617
618 status = efi_early->call(gop32->query_mode, gop32,
619 mode->mode, size, info);
620 if (status != EFI_SUCCESS)
621 return status;
622
623 *fb_base = mode->frame_buffer_base;
624 return status;
625}
626
627static efi_status_t
628setup_gop32(struct screen_info *si, efi_guid_t *proto,
629 unsigned long size, void **gop_handle)
630{
631 struct efi_graphics_output_protocol_32 *gop32, *first_gop;
632 unsigned long nr_gops;
633 u16 width, height;
634 u32 pixels_per_scan_line;
635 u32 fb_base;
636 struct efi_pixel_bitmask pixel_info;
637 int pixel_format;
638 efi_status_t status;
639 u32 *handles = (u32 *)(unsigned long)gop_handle;
640 int i;
641
642 first_gop = NULL;
643 gop32 = NULL;
644
645 nr_gops = size / sizeof(u32);
646 for (i = 0; i < nr_gops; i++) {
647 struct efi_graphics_output_mode_info *info = NULL;
648 efi_guid_t conout_proto = EFI_CONSOLE_OUT_DEVICE_GUID;
649 bool conout_found = false;
650 void *dummy = NULL;
651 u32 h = handles[i];
652
653 status = efi_call_early(handle_protocol, h,
654 proto, (void **)&gop32);
655 if (status != EFI_SUCCESS)
656 continue;
657
658 status = efi_call_early(handle_protocol, h,
659 &conout_proto, &dummy);
660 if (status == EFI_SUCCESS)
661 conout_found = true;
662
663 status = __gop_query32(gop32, &info, &size, &fb_base);
664 if (status == EFI_SUCCESS && (!first_gop || conout_found)) {
665 /*
666 * Systems that use the UEFI Console Splitter may
667 * provide multiple GOP devices, not all of which are
668 * backed by real hardware. The workaround is to search
669 * for a GOP implementing the ConOut protocol, and if
670 * one isn't found, to just fall back to the first GOP.
671 */
672 width = info->horizontal_resolution;
673 height = info->vertical_resolution;
674 pixel_format = info->pixel_format;
675 pixel_info = info->pixel_information;
676 pixels_per_scan_line = info->pixels_per_scan_line;
677
678 /*
679 * Once we've found a GOP supporting ConOut,
680 * don't bother looking any further.
681 */
682 first_gop = gop32;
683 if (conout_found)
684 break;
685 }
686 }
687
688 /* Did we find any GOPs? */
689 if (!first_gop)
690 goto out;
691
692 /* EFI framebuffer */
693 si->orig_video_isVGA = VIDEO_TYPE_EFI;
694
695 si->lfb_width = width;
696 si->lfb_height = height;
697 si->lfb_base = fb_base;
698 si->pages = 1;
699
700 setup_pixel_info(si, pixels_per_scan_line, pixel_info, pixel_format);
300 701
301 si->lfb_size = si->lfb_linelength * si->lfb_height; 702 si->lfb_size = si->lfb_linelength * si->lfb_height;
302 703
303 si->capabilities |= VIDEO_CAPABILITY_SKIP_QUIRKS; 704 si->capabilities |= VIDEO_CAPABILITY_SKIP_QUIRKS;
705out:
706 return status;
707}
304 708
305free_handle: 709static efi_status_t
306 efi_call_phys1(sys_table->boottime->free_pool, gop_handle); 710__gop_query64(struct efi_graphics_output_protocol_64 *gop64,
711 struct efi_graphics_output_mode_info **info,
712 unsigned long *size, u32 *fb_base)
713{
714 struct efi_graphics_output_protocol_mode_64 *mode;
715 efi_status_t status;
716 unsigned long m;
717
718 m = gop64->mode;
719 mode = (struct efi_graphics_output_protocol_mode_64 *)m;
720
721 status = efi_early->call(gop64->query_mode, gop64,
722 mode->mode, size, info);
723 if (status != EFI_SUCCESS)
724 return status;
725
726 *fb_base = mode->frame_buffer_base;
727 return status;
728}
729
730static efi_status_t
731setup_gop64(struct screen_info *si, efi_guid_t *proto,
732 unsigned long size, void **gop_handle)
733{
734 struct efi_graphics_output_protocol_64 *gop64, *first_gop;
735 unsigned long nr_gops;
736 u16 width, height;
737 u32 pixels_per_scan_line;
738 u32 fb_base;
739 struct efi_pixel_bitmask pixel_info;
740 int pixel_format;
741 efi_status_t status;
742 u64 *handles = (u64 *)(unsigned long)gop_handle;
743 int i;
744
745 first_gop = NULL;
746 gop64 = NULL;
747
748 nr_gops = size / sizeof(u64);
749 for (i = 0; i < nr_gops; i++) {
750 struct efi_graphics_output_mode_info *info = NULL;
751 efi_guid_t conout_proto = EFI_CONSOLE_OUT_DEVICE_GUID;
752 bool conout_found = false;
753 void *dummy = NULL;
754 u64 h = handles[i];
755
756 status = efi_call_early(handle_protocol, h,
757 proto, (void **)&gop64);
758 if (status != EFI_SUCCESS)
759 continue;
760
761 status = efi_call_early(handle_protocol, h,
762 &conout_proto, &dummy);
763 if (status == EFI_SUCCESS)
764 conout_found = true;
765
766 status = __gop_query64(gop64, &info, &size, &fb_base);
767 if (status == EFI_SUCCESS && (!first_gop || conout_found)) {
768 /*
769 * Systems that use the UEFI Console Splitter may
770 * provide multiple GOP devices, not all of which are
771 * backed by real hardware. The workaround is to search
772 * for a GOP implementing the ConOut protocol, and if
773 * one isn't found, to just fall back to the first GOP.
774 */
775 width = info->horizontal_resolution;
776 height = info->vertical_resolution;
777 pixel_format = info->pixel_format;
778 pixel_info = info->pixel_information;
779 pixels_per_scan_line = info->pixels_per_scan_line;
780
781 /*
782 * Once we've found a GOP supporting ConOut,
783 * don't bother looking any further.
784 */
785 first_gop = gop64;
786 if (conout_found)
787 break;
788 }
789 }
790
791 /* Did we find any GOPs? */
792 if (!first_gop)
793 goto out;
794
795 /* EFI framebuffer */
796 si->orig_video_isVGA = VIDEO_TYPE_EFI;
797
798 si->lfb_width = width;
799 si->lfb_height = height;
800 si->lfb_base = fb_base;
801 si->pages = 1;
802
803 setup_pixel_info(si, pixels_per_scan_line, pixel_info, pixel_format);
804
805 si->lfb_size = si->lfb_linelength * si->lfb_height;
806
807 si->capabilities |= VIDEO_CAPABILITY_SKIP_QUIRKS;
808out:
307 return status; 809 return status;
308} 810}
309 811
310/* 812/*
311 * See if we have Universal Graphics Adapter (UGA) protocol 813 * See if we have Graphics Output Protocol
312 */ 814 */
313static efi_status_t setup_uga(struct screen_info *si, efi_guid_t *uga_proto, 815static efi_status_t setup_gop(struct screen_info *si, efi_guid_t *proto,
314 unsigned long size) 816 unsigned long size)
315{ 817{
316 struct efi_uga_draw_protocol *uga, *first_uga;
317 unsigned long nr_ugas;
318 efi_status_t status; 818 efi_status_t status;
319 u32 width, height; 819 void **gop_handle = NULL;
320 void **uga_handle = NULL;
321 int i;
322 820
323 status = efi_call_phys3(sys_table->boottime->allocate_pool, 821 status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
324 EFI_LOADER_DATA, size, &uga_handle); 822 size, (void **)&gop_handle);
325 if (status != EFI_SUCCESS) 823 if (status != EFI_SUCCESS)
326 return status; 824 return status;
327 825
328 status = efi_call_phys5(sys_table->boottime->locate_handle, 826 status = efi_call_early(locate_handle,
329 EFI_LOCATE_BY_PROTOCOL, uga_proto, 827 EFI_LOCATE_BY_PROTOCOL,
330 NULL, &size, uga_handle); 828 proto, NULL, &size, gop_handle);
331 if (status != EFI_SUCCESS) 829 if (status != EFI_SUCCESS)
332 goto free_handle; 830 goto free_handle;
333 831
832 if (efi_early->is64)
833 status = setup_gop64(si, proto, size, gop_handle);
834 else
835 status = setup_gop32(si, proto, size, gop_handle);
836
837free_handle:
838 efi_call_early(free_pool, gop_handle);
839 return status;
840}
841
842static efi_status_t
843setup_uga32(void **uga_handle, unsigned long size, u32 *width, u32 *height)
844{
845 struct efi_uga_draw_protocol *uga = NULL, *first_uga;
846 efi_guid_t uga_proto = EFI_UGA_PROTOCOL_GUID;
847 unsigned long nr_ugas;
848 u32 *handles = (u32 *)uga_handle;;
849 efi_status_t status;
850 int i;
851
334 first_uga = NULL; 852 first_uga = NULL;
853 nr_ugas = size / sizeof(u32);
854 for (i = 0; i < nr_ugas; i++) {
855 efi_guid_t pciio_proto = EFI_PCI_IO_PROTOCOL_GUID;
856 u32 w, h, depth, refresh;
857 void *pciio;
858 u32 handle = handles[i];
859
860 status = efi_call_early(handle_protocol, handle,
861 &uga_proto, (void **)&uga);
862 if (status != EFI_SUCCESS)
863 continue;
864
865 efi_call_early(handle_protocol, handle, &pciio_proto, &pciio);
866
867 status = efi_early->call((unsigned long)uga->get_mode, uga,
868 &w, &h, &depth, &refresh);
869 if (status == EFI_SUCCESS && (!first_uga || pciio)) {
870 *width = w;
871 *height = h;
872
873 /*
874 * Once we've found a UGA supporting PCIIO,
875 * don't bother looking any further.
876 */
877 if (pciio)
878 break;
335 879
336 nr_ugas = size / sizeof(void *); 880 first_uga = uga;
881 }
882 }
883
884 return status;
885}
886
887static efi_status_t
888setup_uga64(void **uga_handle, unsigned long size, u32 *width, u32 *height)
889{
890 struct efi_uga_draw_protocol *uga = NULL, *first_uga;
891 efi_guid_t uga_proto = EFI_UGA_PROTOCOL_GUID;
892 unsigned long nr_ugas;
893 u64 *handles = (u64 *)uga_handle;;
894 efi_status_t status;
895 int i;
896
897 first_uga = NULL;
898 nr_ugas = size / sizeof(u64);
337 for (i = 0; i < nr_ugas; i++) { 899 for (i = 0; i < nr_ugas; i++) {
338 efi_guid_t pciio_proto = EFI_PCI_IO_PROTOCOL_GUID; 900 efi_guid_t pciio_proto = EFI_PCI_IO_PROTOCOL_GUID;
339 void *handle = uga_handle[i];
340 u32 w, h, depth, refresh; 901 u32 w, h, depth, refresh;
341 void *pciio; 902 void *pciio;
903 u64 handle = handles[i];
342 904
343 status = efi_call_phys3(sys_table->boottime->handle_protocol, 905 status = efi_call_early(handle_protocol, handle,
344 handle, uga_proto, &uga); 906 &uga_proto, (void **)&uga);
345 if (status != EFI_SUCCESS) 907 if (status != EFI_SUCCESS)
346 continue; 908 continue;
347 909
348 efi_call_phys3(sys_table->boottime->handle_protocol, 910 efi_call_early(handle_protocol, handle, &pciio_proto, &pciio);
349 handle, &pciio_proto, &pciio);
350 911
351 status = efi_call_phys5(uga->get_mode, uga, &w, &h, 912 status = efi_early->call((unsigned long)uga->get_mode, uga,
352 &depth, &refresh); 913 &w, &h, &depth, &refresh);
353 if (status == EFI_SUCCESS && (!first_uga || pciio)) { 914 if (status == EFI_SUCCESS && (!first_uga || pciio)) {
354 width = w; 915 *width = w;
355 height = h; 916 *height = h;
356 917
357 /* 918 /*
358 * Once we've found a UGA supporting PCIIO, 919 * Once we've found a UGA supporting PCIIO,
@@ -365,7 +926,39 @@ static efi_status_t setup_uga(struct screen_info *si, efi_guid_t *uga_proto,
365 } 926 }
366 } 927 }
367 928
368 if (!first_uga) 929 return status;
930}
931
932/*
933 * See if we have Universal Graphics Adapter (UGA) protocol
934 */
935static efi_status_t setup_uga(struct screen_info *si, efi_guid_t *uga_proto,
936 unsigned long size)
937{
938 efi_status_t status;
939 u32 width, height;
940 void **uga_handle = NULL;
941
942 status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
943 size, (void **)&uga_handle);
944 if (status != EFI_SUCCESS)
945 return status;
946
947 status = efi_call_early(locate_handle,
948 EFI_LOCATE_BY_PROTOCOL,
949 uga_proto, NULL, &size, uga_handle);
950 if (status != EFI_SUCCESS)
951 goto free_handle;
952
953 height = 0;
954 width = 0;
955
956 if (efi_early->is64)
957 status = setup_uga64(uga_handle, size, &width, &height);
958 else
959 status = setup_uga32(uga_handle, size, &width, &height);
960
961 if (!width && !height)
369 goto free_handle; 962 goto free_handle;
370 963
371 /* EFI framebuffer */ 964 /* EFI framebuffer */
@@ -384,9 +977,8 @@ static efi_status_t setup_uga(struct screen_info *si, efi_guid_t *uga_proto,
384 si->rsvd_size = 8; 977 si->rsvd_size = 8;
385 si->rsvd_pos = 24; 978 si->rsvd_pos = 24;
386 979
387
388free_handle: 980free_handle:
389 efi_call_phys1(sys_table->boottime->free_pool, uga_handle); 981 efi_call_early(free_pool, uga_handle);
390 return status; 982 return status;
391} 983}
392 984
@@ -404,29 +996,28 @@ void setup_graphics(struct boot_params *boot_params)
404 memset(si, 0, sizeof(*si)); 996 memset(si, 0, sizeof(*si));
405 997
406 size = 0; 998 size = 0;
407 status = efi_call_phys5(sys_table->boottime->locate_handle, 999 status = efi_call_early(locate_handle,
408 EFI_LOCATE_BY_PROTOCOL, &graphics_proto, 1000 EFI_LOCATE_BY_PROTOCOL,
409 NULL, &size, gop_handle); 1001 &graphics_proto, NULL, &size, gop_handle);
410 if (status == EFI_BUFFER_TOO_SMALL) 1002 if (status == EFI_BUFFER_TOO_SMALL)
411 status = setup_gop(si, &graphics_proto, size); 1003 status = setup_gop(si, &graphics_proto, size);
412 1004
413 if (status != EFI_SUCCESS) { 1005 if (status != EFI_SUCCESS) {
414 size = 0; 1006 size = 0;
415 status = efi_call_phys5(sys_table->boottime->locate_handle, 1007 status = efi_call_early(locate_handle,
416 EFI_LOCATE_BY_PROTOCOL, &uga_proto, 1008 EFI_LOCATE_BY_PROTOCOL,
417 NULL, &size, uga_handle); 1009 &uga_proto, NULL, &size, uga_handle);
418 if (status == EFI_BUFFER_TOO_SMALL) 1010 if (status == EFI_BUFFER_TOO_SMALL)
419 setup_uga(si, &uga_proto, size); 1011 setup_uga(si, &uga_proto, size);
420 } 1012 }
421} 1013}
422 1014
423
424/* 1015/*
425 * Because the x86 boot code expects to be passed a boot_params we 1016 * Because the x86 boot code expects to be passed a boot_params we
426 * need to create one ourselves (usually the bootloader would create 1017 * need to create one ourselves (usually the bootloader would create
427 * one for us). 1018 * one for us).
428 */ 1019 */
429struct boot_params *make_boot_params(void *handle, efi_system_table_t *_table) 1020struct boot_params *make_boot_params(struct efi_config *c)
430{ 1021{
431 struct boot_params *boot_params; 1022 struct boot_params *boot_params;
432 struct sys_desc_table *sdt; 1023 struct sys_desc_table *sdt;
@@ -434,7 +1025,7 @@ struct boot_params *make_boot_params(void *handle, efi_system_table_t *_table)
434 struct setup_header *hdr; 1025 struct setup_header *hdr;
435 struct efi_info *efi; 1026 struct efi_info *efi;
436 efi_loaded_image_t *image; 1027 efi_loaded_image_t *image;
437 void *options; 1028 void *options, *handle;
438 efi_guid_t proto = LOADED_IMAGE_PROTOCOL_GUID; 1029 efi_guid_t proto = LOADED_IMAGE_PROTOCOL_GUID;
439 int options_size = 0; 1030 int options_size = 0;
440 efi_status_t status; 1031 efi_status_t status;
@@ -445,14 +1036,21 @@ struct boot_params *make_boot_params(void *handle, efi_system_table_t *_table)
445 unsigned long ramdisk_addr; 1036 unsigned long ramdisk_addr;
446 unsigned long ramdisk_size; 1037 unsigned long ramdisk_size;
447 1038
448 sys_table = _table; 1039 efi_early = c;
1040 sys_table = (efi_system_table_t *)(unsigned long)efi_early->table;
1041 handle = (void *)(unsigned long)efi_early->image_handle;
449 1042
450 /* Check if we were booted by the EFI firmware */ 1043 /* Check if we were booted by the EFI firmware */
451 if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE) 1044 if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
452 return NULL; 1045 return NULL;
453 1046
454 status = efi_call_phys3(sys_table->boottime->handle_protocol, 1047 if (efi_early->is64)
455 handle, &proto, (void *)&image); 1048 setup_boot_services64(efi_early);
1049 else
1050 setup_boot_services32(efi_early);
1051
1052 status = efi_call_early(handle_protocol, handle,
1053 &proto, (void *)&image);
456 if (status != EFI_SUCCESS) { 1054 if (status != EFI_SUCCESS) {
457 efi_printk(sys_table, "Failed to get handle for LOADED_IMAGE_PROTOCOL\n"); 1055 efi_printk(sys_table, "Failed to get handle for LOADED_IMAGE_PROTOCOL\n");
458 return NULL; 1056 return NULL;
@@ -641,14 +1239,13 @@ static efi_status_t alloc_e820ext(u32 nr_desc, struct setup_data **e820ext,
641 sizeof(struct e820entry) * nr_desc; 1239 sizeof(struct e820entry) * nr_desc;
642 1240
643 if (*e820ext) { 1241 if (*e820ext) {
644 efi_call_phys1(sys_table->boottime->free_pool, *e820ext); 1242 efi_call_early(free_pool, *e820ext);
645 *e820ext = NULL; 1243 *e820ext = NULL;
646 *e820ext_size = 0; 1244 *e820ext_size = 0;
647 } 1245 }
648 1246
649 status = efi_call_phys3(sys_table->boottime->allocate_pool, 1247 status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
650 EFI_LOADER_DATA, size, e820ext); 1248 size, (void **)e820ext);
651
652 if (status == EFI_SUCCESS) 1249 if (status == EFI_SUCCESS)
653 *e820ext_size = size; 1250 *e820ext_size = size;
654 1251
@@ -656,12 +1253,13 @@ static efi_status_t alloc_e820ext(u32 nr_desc, struct setup_data **e820ext,
656} 1253}
657 1254
658static efi_status_t exit_boot(struct boot_params *boot_params, 1255static efi_status_t exit_boot(struct boot_params *boot_params,
659 void *handle) 1256 void *handle, bool is64)
660{ 1257{
661 struct efi_info *efi = &boot_params->efi_info; 1258 struct efi_info *efi = &boot_params->efi_info;
662 unsigned long map_sz, key, desc_size; 1259 unsigned long map_sz, key, desc_size;
663 efi_memory_desc_t *mem_map; 1260 efi_memory_desc_t *mem_map;
664 struct setup_data *e820ext; 1261 struct setup_data *e820ext;
1262 const char *signature;
665 __u32 e820ext_size; 1263 __u32 e820ext_size;
666 __u32 nr_desc, prev_nr_desc; 1264 __u32 nr_desc, prev_nr_desc;
667 efi_status_t status; 1265 efi_status_t status;
@@ -691,11 +1289,13 @@ get_map:
691 if (status != EFI_SUCCESS) 1289 if (status != EFI_SUCCESS)
692 goto free_mem_map; 1290 goto free_mem_map;
693 1291
694 efi_call_phys1(sys_table->boottime->free_pool, mem_map); 1292 efi_call_early(free_pool, mem_map);
695 goto get_map; /* Allocated memory, get map again */ 1293 goto get_map; /* Allocated memory, get map again */
696 } 1294 }
697 1295
698 memcpy(&efi->efi_loader_signature, EFI_LOADER_SIGNATURE, sizeof(__u32)); 1296 signature = is64 ? EFI64_LOADER_SIGNATURE : EFI32_LOADER_SIGNATURE;
1297 memcpy(&efi->efi_loader_signature, signature, sizeof(__u32));
1298
699 efi->efi_systab = (unsigned long)sys_table; 1299 efi->efi_systab = (unsigned long)sys_table;
700 efi->efi_memdesc_size = desc_size; 1300 efi->efi_memdesc_size = desc_size;
701 efi->efi_memdesc_version = desc_version; 1301 efi->efi_memdesc_version = desc_version;
@@ -708,8 +1308,7 @@ get_map:
708#endif 1308#endif
709 1309
710 /* Might as well exit boot services now */ 1310 /* Might as well exit boot services now */
711 status = efi_call_phys2(sys_table->boottime->exit_boot_services, 1311 status = efi_call_early(exit_boot_services, handle, key);
712 handle, key);
713 if (status != EFI_SUCCESS) { 1312 if (status != EFI_SUCCESS) {
714 /* 1313 /*
715 * ExitBootServices() will fail if any of the event 1314 * ExitBootServices() will fail if any of the event
@@ -722,7 +1321,7 @@ get_map:
722 goto free_mem_map; 1321 goto free_mem_map;
723 1322
724 called_exit = true; 1323 called_exit = true;
725 efi_call_phys1(sys_table->boottime->free_pool, mem_map); 1324 efi_call_early(free_pool, mem_map);
726 goto get_map; 1325 goto get_map;
727 } 1326 }
728 1327
@@ -736,23 +1335,31 @@ get_map:
736 return EFI_SUCCESS; 1335 return EFI_SUCCESS;
737 1336
738free_mem_map: 1337free_mem_map:
739 efi_call_phys1(sys_table->boottime->free_pool, mem_map); 1338 efi_call_early(free_pool, mem_map);
740 return status; 1339 return status;
741} 1340}
742 1341
743
744/* 1342/*
745 * On success we return a pointer to a boot_params structure, and NULL 1343 * On success we return a pointer to a boot_params structure, and NULL
746 * on failure. 1344 * on failure.
747 */ 1345 */
748struct boot_params *efi_main(void *handle, efi_system_table_t *_table, 1346struct boot_params *efi_main(struct efi_config *c,
749 struct boot_params *boot_params) 1347 struct boot_params *boot_params)
750{ 1348{
751 struct desc_ptr *gdt; 1349 struct desc_ptr *gdt = NULL;
752 efi_loaded_image_t *image; 1350 efi_loaded_image_t *image;
753 struct setup_header *hdr = &boot_params->hdr; 1351 struct setup_header *hdr = &boot_params->hdr;
754 efi_status_t status; 1352 efi_status_t status;
755 struct desc_struct *desc; 1353 struct desc_struct *desc;
1354 void *handle;
1355 efi_system_table_t *_table;
1356 bool is64;
1357
1358 efi_early = c;
1359
1360 _table = (efi_system_table_t *)(unsigned long)efi_early->table;
1361 handle = (void *)(unsigned long)efi_early->image_handle;
1362 is64 = efi_early->is64;
756 1363
757 sys_table = _table; 1364 sys_table = _table;
758 1365
@@ -760,13 +1367,17 @@ struct boot_params *efi_main(void *handle, efi_system_table_t *_table,
760 if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE) 1367 if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
761 goto fail; 1368 goto fail;
762 1369
1370 if (is64)
1371 setup_boot_services64(efi_early);
1372 else
1373 setup_boot_services32(efi_early);
1374
763 setup_graphics(boot_params); 1375 setup_graphics(boot_params);
764 1376
765 setup_efi_pci(boot_params); 1377 setup_efi_pci(boot_params);
766 1378
767 status = efi_call_phys3(sys_table->boottime->allocate_pool, 1379 status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
768 EFI_LOADER_DATA, sizeof(*gdt), 1380 sizeof(*gdt), (void **)&gdt);
769 (void **)&gdt);
770 if (status != EFI_SUCCESS) { 1381 if (status != EFI_SUCCESS) {
771 efi_printk(sys_table, "Failed to alloc mem for gdt structure\n"); 1382 efi_printk(sys_table, "Failed to alloc mem for gdt structure\n");
772 goto fail; 1383 goto fail;
@@ -797,7 +1408,7 @@ struct boot_params *efi_main(void *handle, efi_system_table_t *_table,
797 hdr->code32_start = bzimage_addr; 1408 hdr->code32_start = bzimage_addr;
798 } 1409 }
799 1410
800 status = exit_boot(boot_params, handle); 1411 status = exit_boot(boot_params, handle, is64);
801 if (status != EFI_SUCCESS) 1412 if (status != EFI_SUCCESS)
802 goto fail; 1413 goto fail;
803 1414
diff --git a/arch/x86/boot/compressed/eboot.h b/arch/x86/boot/compressed/eboot.h
index 81b6b652b46a..c88c31ecad12 100644
--- a/arch/x86/boot/compressed/eboot.h
+++ b/arch/x86/boot/compressed/eboot.h
@@ -37,6 +37,24 @@ struct efi_graphics_output_mode_info {
37 u32 pixels_per_scan_line; 37 u32 pixels_per_scan_line;
38} __packed; 38} __packed;
39 39
40struct efi_graphics_output_protocol_mode_32 {
41 u32 max_mode;
42 u32 mode;
43 u32 info;
44 u32 size_of_info;
45 u64 frame_buffer_base;
46 u32 frame_buffer_size;
47} __packed;
48
49struct efi_graphics_output_protocol_mode_64 {
50 u32 max_mode;
51 u32 mode;
52 u64 info;
53 u64 size_of_info;
54 u64 frame_buffer_base;
55 u64 frame_buffer_size;
56} __packed;
57
40struct efi_graphics_output_protocol_mode { 58struct efi_graphics_output_protocol_mode {
41 u32 max_mode; 59 u32 max_mode;
42 u32 mode; 60 u32 mode;
@@ -46,6 +64,20 @@ struct efi_graphics_output_protocol_mode {
46 unsigned long frame_buffer_size; 64 unsigned long frame_buffer_size;
47} __packed; 65} __packed;
48 66
67struct efi_graphics_output_protocol_32 {
68 u32 query_mode;
69 u32 set_mode;
70 u32 blt;
71 u32 mode;
72};
73
74struct efi_graphics_output_protocol_64 {
75 u64 query_mode;
76 u64 set_mode;
77 u64 blt;
78 u64 mode;
79};
80
49struct efi_graphics_output_protocol { 81struct efi_graphics_output_protocol {
50 void *query_mode; 82 void *query_mode;
51 unsigned long set_mode; 83 unsigned long set_mode;
@@ -53,10 +85,38 @@ struct efi_graphics_output_protocol {
53 struct efi_graphics_output_protocol_mode *mode; 85 struct efi_graphics_output_protocol_mode *mode;
54}; 86};
55 87
88struct efi_uga_draw_protocol_32 {
89 u32 get_mode;
90 u32 set_mode;
91 u32 blt;
92};
93
94struct efi_uga_draw_protocol_64 {
95 u64 get_mode;
96 u64 set_mode;
97 u64 blt;
98};
99
56struct efi_uga_draw_protocol { 100struct efi_uga_draw_protocol {
57 void *get_mode; 101 void *get_mode;
58 void *set_mode; 102 void *set_mode;
59 void *blt; 103 void *blt;
60}; 104};
61 105
106struct efi_config {
107 u64 image_handle;
108 u64 table;
109 u64 allocate_pool;
110 u64 allocate_pages;
111 u64 get_memory_map;
112 u64 free_pool;
113 u64 free_pages;
114 u64 locate_handle;
115 u64 handle_protocol;
116 u64 exit_boot_services;
117 u64 text_output;
118 efi_status_t (*call)(unsigned long, ...);
119 bool is64;
120} __packed;
121
62#endif /* BOOT_COMPRESSED_EBOOT_H */ 122#endif /* BOOT_COMPRESSED_EBOOT_H */
diff --git a/arch/x86/boot/compressed/efi_stub_64.S b/arch/x86/boot/compressed/efi_stub_64.S
index cedc60de86eb..7ff3632806b1 100644
--- a/arch/x86/boot/compressed/efi_stub_64.S
+++ b/arch/x86/boot/compressed/efi_stub_64.S
@@ -1 +1,30 @@
1#include <asm/segment.h>
2#include <asm/msr.h>
3#include <asm/processor-flags.h>
4
1#include "../../platform/efi/efi_stub_64.S" 5#include "../../platform/efi/efi_stub_64.S"
6
7#ifdef CONFIG_EFI_MIXED
8 .code64
9 .text
10ENTRY(efi64_thunk)
11 push %rbp
12 push %rbx
13
14 subq $16, %rsp
15 leaq efi_exit32(%rip), %rax
16 movl %eax, 8(%rsp)
17 leaq efi_gdt64(%rip), %rax
18 movl %eax, 4(%rsp)
19 movl %eax, 2(%rax) /* Fixup the gdt base address */
20 leaq efi32_boot_gdt(%rip), %rax
21 movl %eax, (%rsp)
22
23 call __efi64_thunk
24
25 addq $16, %rsp
26 pop %rbx
27 pop %rbp
28 ret
29ENDPROC(efi64_thunk)
30#endif /* CONFIG_EFI_MIXED */
diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S
index 9116aac232c7..de9d4200d305 100644
--- a/arch/x86/boot/compressed/head_32.S
+++ b/arch/x86/boot/compressed/head_32.S
@@ -42,26 +42,53 @@ ENTRY(startup_32)
42ENTRY(efi_pe_entry) 42ENTRY(efi_pe_entry)
43 add $0x4, %esp 43 add $0x4, %esp
44 44
45 call 1f
461: popl %esi
47 subl $1b, %esi
48
49 popl %ecx
50 movl %ecx, efi32_config(%esi) /* Handle */
51 popl %ecx
52 movl %ecx, efi32_config+8(%esi) /* EFI System table pointer */
53
54 /* Relocate efi_config->call() */
55 leal efi32_config(%esi), %eax
56 add %esi, 88(%eax)
57 pushl %eax
58
45 call make_boot_params 59 call make_boot_params
46 cmpl $0, %eax 60 cmpl $0, %eax
47 je 1f 61 je fail
48 movl 0x4(%esp), %esi 62 popl %ecx
49 movl (%esp), %ecx
50 pushl %eax 63 pushl %eax
51 pushl %esi
52 pushl %ecx 64 pushl %ecx
53 sub $0x4, %esp 65 jmp 2f /* Skip efi_config initialization */
54 66
55ENTRY(efi_stub_entry) 67ENTRY(efi32_stub_entry)
56 add $0x4, %esp 68 add $0x4, %esp
69 popl %ecx
70 popl %edx
71
72 call 1f
731: popl %esi
74 subl $1b, %esi
75
76 movl %ecx, efi32_config(%esi) /* Handle */
77 movl %edx, efi32_config+8(%esi) /* EFI System table pointer */
78
79 /* Relocate efi_config->call() */
80 leal efi32_config(%esi), %eax
81 add %esi, 88(%eax)
82 pushl %eax
832:
57 call efi_main 84 call efi_main
58 cmpl $0, %eax 85 cmpl $0, %eax
59 movl %eax, %esi 86 movl %eax, %esi
60 jne 2f 87 jne 2f
611: 88fail:
62 /* EFI init failed, so hang. */ 89 /* EFI init failed, so hang. */
63 hlt 90 hlt
64 jmp 1b 91 jmp fail
652: 922:
66 call 3f 93 call 3f
673: 943:
@@ -202,6 +229,15 @@ relocated:
202 xorl %ebx, %ebx 229 xorl %ebx, %ebx
203 jmp *%eax 230 jmp *%eax
204 231
232#ifdef CONFIG_EFI_STUB
233 .data
234efi32_config:
235 .fill 11,8,0
236 .long efi_call_phys
237 .long 0
238 .byte 0
239#endif
240
205/* 241/*
206 * Stack and heap for uncompression 242 * Stack and heap for uncompression
207 */ 243 */
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index c5c1ae0997e7..57e58a5fa210 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -113,7 +113,8 @@ ENTRY(startup_32)
113 lgdt gdt(%ebp) 113 lgdt gdt(%ebp)
114 114
115 /* Enable PAE mode */ 115 /* Enable PAE mode */
116 movl $(X86_CR4_PAE), %eax 116 movl %cr4, %eax
117 orl $X86_CR4_PAE, %eax
117 movl %eax, %cr4 118 movl %eax, %cr4
118 119
119 /* 120 /*
@@ -178,6 +179,13 @@ ENTRY(startup_32)
178 */ 179 */
179 pushl $__KERNEL_CS 180 pushl $__KERNEL_CS
180 leal startup_64(%ebp), %eax 181 leal startup_64(%ebp), %eax
182#ifdef CONFIG_EFI_MIXED
183 movl efi32_config(%ebp), %ebx
184 cmp $0, %ebx
185 jz 1f
186 leal handover_entry(%ebp), %eax
1871:
188#endif
181 pushl %eax 189 pushl %eax
182 190
183 /* Enter paged protected Mode, activating Long Mode */ 191 /* Enter paged protected Mode, activating Long Mode */
@@ -188,6 +196,30 @@ ENTRY(startup_32)
188 lret 196 lret
189ENDPROC(startup_32) 197ENDPROC(startup_32)
190 198
199#ifdef CONFIG_EFI_MIXED
200 .org 0x190
201ENTRY(efi32_stub_entry)
202 add $0x4, %esp /* Discard return address */
203 popl %ecx
204 popl %edx
205 popl %esi
206
207 leal (BP_scratch+4)(%esi), %esp
208 call 1f
2091: pop %ebp
210 subl $1b, %ebp
211
212 movl %ecx, efi32_config(%ebp)
213 movl %edx, efi32_config+8(%ebp)
214 sgdtl efi32_boot_gdt(%ebp)
215
216 leal efi32_config(%ebp), %eax
217 movl %eax, efi_config(%ebp)
218
219 jmp startup_32
220ENDPROC(efi32_stub_entry)
221#endif
222
191 .code64 223 .code64
192 .org 0x200 224 .org 0x200
193ENTRY(startup_64) 225ENTRY(startup_64)
@@ -209,26 +241,48 @@ ENTRY(startup_64)
209 jmp preferred_addr 241 jmp preferred_addr
210 242
211ENTRY(efi_pe_entry) 243ENTRY(efi_pe_entry)
212 mov %rcx, %rdi 244 movq %rcx, efi64_config(%rip) /* Handle */
213 mov %rdx, %rsi 245 movq %rdx, efi64_config+8(%rip) /* EFI System table pointer */
214 pushq %rdi 246
215 pushq %rsi 247 leaq efi64_config(%rip), %rax
248 movq %rax, efi_config(%rip)
249
250 call 1f
2511: popq %rbp
252 subq $1b, %rbp
253
254 /*
255 * Relocate efi_config->call().
256 */
257 addq %rbp, efi64_config+88(%rip)
258
259 movq %rax, %rdi
216 call make_boot_params 260 call make_boot_params
217 cmpq $0,%rax 261 cmpq $0,%rax
218 je 1f 262 je fail
219 mov %rax, %rdx 263 mov %rax, %rsi
220 popq %rsi 264 jmp 2f /* Skip the relocation */
221 popq %rdi
222 265
223ENTRY(efi_stub_entry) 266handover_entry:
267 call 1f
2681: popq %rbp
269 subq $1b, %rbp
270
271 /*
272 * Relocate efi_config->call().
273 */
274 movq efi_config(%rip), %rax
275 addq %rbp, 88(%rax)
2762:
277 movq efi_config(%rip), %rdi
224 call efi_main 278 call efi_main
225 movq %rax,%rsi 279 movq %rax,%rsi
226 cmpq $0,%rax 280 cmpq $0,%rax
227 jne 2f 281 jne 2f
2281: 282fail:
229 /* EFI init failed, so hang. */ 283 /* EFI init failed, so hang. */
230 hlt 284 hlt
231 jmp 1b 285 jmp fail
2322: 2862:
233 call 3f 287 call 3f
2343: 2883:
@@ -307,6 +361,20 @@ preferred_addr:
307 leaq relocated(%rbx), %rax 361 leaq relocated(%rbx), %rax
308 jmp *%rax 362 jmp *%rax
309 363
364#ifdef CONFIG_EFI_STUB
365 .org 0x390
366ENTRY(efi64_stub_entry)
367 movq %rdi, efi64_config(%rip) /* Handle */
368 movq %rsi, efi64_config+8(%rip) /* EFI System table pointer */
369
370 leaq efi64_config(%rip), %rax
371 movq %rax, efi_config(%rip)
372
373 movq %rdx, %rsi
374 jmp handover_entry
375ENDPROC(efi64_stub_entry)
376#endif
377
310 .text 378 .text
311relocated: 379relocated:
312 380
@@ -372,6 +440,25 @@ gdt:
372 .quad 0x0000000000000000 /* TS continued */ 440 .quad 0x0000000000000000 /* TS continued */
373gdt_end: 441gdt_end:
374 442
443#ifdef CONFIG_EFI_STUB
444efi_config:
445 .quad 0
446
447#ifdef CONFIG_EFI_MIXED
448 .global efi32_config
449efi32_config:
450 .fill 11,8,0
451 .quad efi64_thunk
452 .byte 0
453#endif
454
455 .global efi64_config
456efi64_config:
457 .fill 11,8,0
458 .quad efi_call6
459 .byte 1
460#endif /* CONFIG_EFI_STUB */
461
375/* 462/*
376 * Stack and heap for uncompression 463 * Stack and heap for uncompression
377 */ 464 */
diff --git a/arch/x86/boot/cpucheck.c b/arch/x86/boot/cpucheck.c
index 100a9a10076a..f0d0b20fe149 100644
--- a/arch/x86/boot/cpucheck.c
+++ b/arch/x86/boot/cpucheck.c
@@ -67,6 +67,13 @@ static int is_transmeta(void)
67 cpu_vendor[2] == A32('M', 'x', '8', '6'); 67 cpu_vendor[2] == A32('M', 'x', '8', '6');
68} 68}
69 69
70static int is_intel(void)
71{
72 return cpu_vendor[0] == A32('G', 'e', 'n', 'u') &&
73 cpu_vendor[1] == A32('i', 'n', 'e', 'I') &&
74 cpu_vendor[2] == A32('n', 't', 'e', 'l');
75}
76
70/* Returns a bitmask of which words we have error bits in */ 77/* Returns a bitmask of which words we have error bits in */
71static int check_cpuflags(void) 78static int check_cpuflags(void)
72{ 79{
@@ -153,6 +160,19 @@ int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr)
153 asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx)); 160 asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
154 161
155 err = check_cpuflags(); 162 err = check_cpuflags();
163 } else if (err == 0x01 &&
164 !(err_flags[0] & ~(1 << X86_FEATURE_PAE)) &&
165 is_intel() && cpu.level == 6 &&
166 (cpu.model == 9 || cpu.model == 13)) {
167 /* PAE is disabled on this Pentium M but can be forced */
168 if (cmdline_find_option_bool("forcepae")) {
169 puts("WARNING: Forcing PAE in CPU flags\n");
170 set_bit(X86_FEATURE_PAE, cpu.flags);
171 err = check_cpuflags();
172 }
173 else {
174 puts("WARNING: PAE disabled. Use parameter 'forcepae' to enable at your own risk!\n");
175 }
156 } 176 }
157 177
158 if (err_flags_ptr) 178 if (err_flags_ptr)
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index ec3b8ba68096..0ca9a5c362bc 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -283,7 +283,7 @@ _start:
283 # Part 2 of the header, from the old setup.S 283 # Part 2 of the header, from the old setup.S
284 284
285 .ascii "HdrS" # header signature 285 .ascii "HdrS" # header signature
286 .word 0x020c # header version number (>= 0x0105) 286 .word 0x020d # header version number (>= 0x0105)
287 # or else old loadlin-1.5 will fail) 287 # or else old loadlin-1.5 will fail)
288 .globl realmode_swtch 288 .globl realmode_swtch
289realmode_swtch: .word 0, 0 # default_switch, SETUPSEG 289realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
@@ -350,7 +350,7 @@ cmd_line_ptr: .long 0 # (Header version 0x0202 or later)
350 # can be located anywhere in 350 # can be located anywhere in
351 # low memory 0x10000 or higher. 351 # low memory 0x10000 or higher.
352 352
353ramdisk_max: .long 0x7fffffff 353initrd_addr_max: .long 0x7fffffff
354 # (Header version 0x0203 or later) 354 # (Header version 0x0203 or later)
355 # The highest safe address for 355 # The highest safe address for
356 # the contents of an initrd 356 # the contents of an initrd
@@ -375,7 +375,8 @@ xloadflags:
375# define XLF0 0 375# define XLF0 0
376#endif 376#endif
377 377
378#if defined(CONFIG_RELOCATABLE) && defined(CONFIG_X86_64) 378#if defined(CONFIG_RELOCATABLE) && defined(CONFIG_X86_64) && \
379 !defined(CONFIG_EFI_MIXED)
379 /* kernel/boot_param/ramdisk could be loaded above 4g */ 380 /* kernel/boot_param/ramdisk could be loaded above 4g */
380# define XLF1 XLF_CAN_BE_LOADED_ABOVE_4G 381# define XLF1 XLF_CAN_BE_LOADED_ABOVE_4G
381#else 382#else
@@ -383,10 +384,14 @@ xloadflags:
383#endif 384#endif
384 385
385#ifdef CONFIG_EFI_STUB 386#ifdef CONFIG_EFI_STUB
386# ifdef CONFIG_X86_64 387# ifdef CONFIG_EFI_MIXED
387# define XLF23 XLF_EFI_HANDOVER_64 /* 64-bit EFI handover ok */ 388# define XLF23 (XLF_EFI_HANDOVER_32|XLF_EFI_HANDOVER_64)
388# else 389# else
389# define XLF23 XLF_EFI_HANDOVER_32 /* 32-bit EFI handover ok */ 390# ifdef CONFIG_X86_64
391# define XLF23 XLF_EFI_HANDOVER_64 /* 64-bit EFI handover ok */
392# else
393# define XLF23 XLF_EFI_HANDOVER_32 /* 32-bit EFI handover ok */
394# endif
390# endif 395# endif
391#else 396#else
392# define XLF23 0 397# define XLF23 0
@@ -426,13 +431,7 @@ pref_address: .quad LOAD_PHYSICAL_ADDR # preferred load addr
426#define INIT_SIZE VO_INIT_SIZE 431#define INIT_SIZE VO_INIT_SIZE
427#endif 432#endif
428init_size: .long INIT_SIZE # kernel initialization size 433init_size: .long INIT_SIZE # kernel initialization size
429handover_offset: 434handover_offset: .long 0 # Filled in by build.c
430#ifdef CONFIG_EFI_STUB
431 .long 0x30 # offset to the handover
432 # protocol entry point
433#else
434 .long 0
435#endif
436 435
437# End of setup header ##################################################### 436# End of setup header #####################################################
438 437
diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c
index 8e15b22391fc..1a2f2121cada 100644
--- a/arch/x86/boot/tools/build.c
+++ b/arch/x86/boot/tools/build.c
@@ -53,7 +53,8 @@ int is_big_kernel;
53 53
54#define PECOFF_RELOC_RESERVE 0x20 54#define PECOFF_RELOC_RESERVE 0x20
55 55
56unsigned long efi_stub_entry; 56unsigned long efi32_stub_entry;
57unsigned long efi64_stub_entry;
57unsigned long efi_pe_entry; 58unsigned long efi_pe_entry;
58unsigned long startup_64; 59unsigned long startup_64;
59 60
@@ -219,6 +220,52 @@ static void update_pecoff_text(unsigned int text_start, unsigned int file_sz)
219 update_pecoff_section_header(".text", text_start, text_sz); 220 update_pecoff_section_header(".text", text_start, text_sz);
220} 221}
221 222
223static int reserve_pecoff_reloc_section(int c)
224{
225 /* Reserve 0x20 bytes for .reloc section */
226 memset(buf+c, 0, PECOFF_RELOC_RESERVE);
227 return PECOFF_RELOC_RESERVE;
228}
229
230static void efi_stub_defaults(void)
231{
232 /* Defaults for old kernel */
233#ifdef CONFIG_X86_32
234 efi_pe_entry = 0x10;
235#else
236 efi_pe_entry = 0x210;
237 startup_64 = 0x200;
238#endif
239}
240
241static void efi_stub_entry_update(void)
242{
243 unsigned long addr = efi32_stub_entry;
244
245#ifdef CONFIG_X86_64
246 /* Yes, this is really how we defined it :( */
247 addr = efi64_stub_entry - 0x200;
248#endif
249
250#ifdef CONFIG_EFI_MIXED
251 if (efi32_stub_entry != addr)
252 die("32-bit and 64-bit EFI entry points do not match\n");
253#endif
254 put_unaligned_le32(addr, &buf[0x264]);
255}
256
257#else
258
259static inline void update_pecoff_setup_and_reloc(unsigned int size) {}
260static inline void update_pecoff_text(unsigned int text_start,
261 unsigned int file_sz) {}
262static inline void efi_stub_defaults(void) {}
263static inline void efi_stub_entry_update(void) {}
264
265static inline int reserve_pecoff_reloc_section(int c)
266{
267 return 0;
268}
222#endif /* CONFIG_EFI_STUB */ 269#endif /* CONFIG_EFI_STUB */
223 270
224 271
@@ -250,7 +297,8 @@ static void parse_zoffset(char *fname)
250 p = (char *)buf; 297 p = (char *)buf;
251 298
252 while (p && *p) { 299 while (p && *p) {
253 PARSE_ZOFS(p, efi_stub_entry); 300 PARSE_ZOFS(p, efi32_stub_entry);
301 PARSE_ZOFS(p, efi64_stub_entry);
254 PARSE_ZOFS(p, efi_pe_entry); 302 PARSE_ZOFS(p, efi_pe_entry);
255 PARSE_ZOFS(p, startup_64); 303 PARSE_ZOFS(p, startup_64);
256 304
@@ -271,15 +319,7 @@ int main(int argc, char ** argv)
271 void *kernel; 319 void *kernel;
272 u32 crc = 0xffffffffUL; 320 u32 crc = 0xffffffffUL;
273 321
274 /* Defaults for old kernel */ 322 efi_stub_defaults();
275#ifdef CONFIG_X86_32
276 efi_pe_entry = 0x10;
277 efi_stub_entry = 0x30;
278#else
279 efi_pe_entry = 0x210;
280 efi_stub_entry = 0x230;
281 startup_64 = 0x200;
282#endif
283 323
284 if (argc != 5) 324 if (argc != 5)
285 usage(); 325 usage();
@@ -302,11 +342,7 @@ int main(int argc, char ** argv)
302 die("Boot block hasn't got boot flag (0xAA55)"); 342 die("Boot block hasn't got boot flag (0xAA55)");
303 fclose(file); 343 fclose(file);
304 344
305#ifdef CONFIG_EFI_STUB 345 c += reserve_pecoff_reloc_section(c);
306 /* Reserve 0x20 bytes for .reloc section */
307 memset(buf+c, 0, PECOFF_RELOC_RESERVE);
308 c += PECOFF_RELOC_RESERVE;
309#endif
310 346
311 /* Pad unused space with zeros */ 347 /* Pad unused space with zeros */
312 setup_sectors = (c + 511) / 512; 348 setup_sectors = (c + 511) / 512;
@@ -315,9 +351,7 @@ int main(int argc, char ** argv)
315 i = setup_sectors*512; 351 i = setup_sectors*512;
316 memset(buf+c, 0, i-c); 352 memset(buf+c, 0, i-c);
317 353
318#ifdef CONFIG_EFI_STUB
319 update_pecoff_setup_and_reloc(i); 354 update_pecoff_setup_and_reloc(i);
320#endif
321 355
322 /* Set the default root device */ 356 /* Set the default root device */
323 put_unaligned_le16(DEFAULT_ROOT_DEV, &buf[508]); 357 put_unaligned_le16(DEFAULT_ROOT_DEV, &buf[508]);
@@ -342,14 +376,9 @@ int main(int argc, char ** argv)
342 buf[0x1f1] = setup_sectors-1; 376 buf[0x1f1] = setup_sectors-1;
343 put_unaligned_le32(sys_size, &buf[0x1f4]); 377 put_unaligned_le32(sys_size, &buf[0x1f4]);
344 378
345#ifdef CONFIG_EFI_STUB
346 update_pecoff_text(setup_sectors * 512, sz + i + ((sys_size * 16) - sz)); 379 update_pecoff_text(setup_sectors * 512, sz + i + ((sys_size * 16) - sz));
347 380
348#ifdef CONFIG_X86_64 /* Yes, this is really how we defined it :( */ 381 efi_stub_entry_update();
349 efi_stub_entry -= 0x200;
350#endif
351 put_unaligned_le32(efi_stub_entry, &buf[0x264]);
352#endif
353 382
354 crc = partial_crc32(buf, i, crc); 383 crc = partial_crc32(buf, i, crc);
355 if (fwrite(buf, 1, i, dest) != i) 384 if (fwrite(buf, 1, i, dest) != i)
diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig
index a7fef2621cc9..619e7f7426c6 100644
--- a/arch/x86/configs/i386_defconfig
+++ b/arch/x86/configs/i386_defconfig
@@ -60,7 +60,6 @@ CONFIG_CRASH_DUMP=y
60CONFIG_HIBERNATION=y 60CONFIG_HIBERNATION=y
61CONFIG_PM_DEBUG=y 61CONFIG_PM_DEBUG=y
62CONFIG_PM_TRACE_RTC=y 62CONFIG_PM_TRACE_RTC=y
63CONFIG_ACPI_PROCFS=y
64CONFIG_ACPI_DOCK=y 63CONFIG_ACPI_DOCK=y
65CONFIG_CPU_FREQ=y 64CONFIG_CPU_FREQ=y
66# CONFIG_CPU_FREQ_STAT is not set 65# CONFIG_CPU_FREQ_STAT is not set
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index c1119d4c1281..6181c69b786b 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -58,7 +58,6 @@ CONFIG_CRASH_DUMP=y
58CONFIG_HIBERNATION=y 58CONFIG_HIBERNATION=y
59CONFIG_PM_DEBUG=y 59CONFIG_PM_DEBUG=y
60CONFIG_PM_TRACE_RTC=y 60CONFIG_PM_TRACE_RTC=y
61CONFIG_ACPI_PROCFS=y
62CONFIG_ACPI_DOCK=y 61CONFIG_ACPI_DOCK=y
63CONFIG_CPU_FREQ=y 62CONFIG_CPU_FREQ=y
64# CONFIG_CPU_FREQ_STAT is not set 63# CONFIG_CPU_FREQ_STAT is not set
diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild
index 7f669853317a..4acddc43ee0c 100644
--- a/arch/x86/include/asm/Kbuild
+++ b/arch/x86/include/asm/Kbuild
@@ -5,3 +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
9generic-y += mcs_spinlock.h
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 1d2091a226bc..19b0ebafcd3e 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -93,9 +93,6 @@ static inline int is_vsmp_box(void)
93 return 0; 93 return 0;
94} 94}
95#endif 95#endif
96extern void xapic_wait_icr_idle(void);
97extern u32 safe_xapic_wait_icr_idle(void);
98extern void xapic_icr_write(u32, u32);
99extern int setup_profiling_timer(unsigned int); 96extern int setup_profiling_timer(unsigned int);
100 97
101static inline void native_apic_mem_write(u32 reg, u32 v) 98static inline void native_apic_mem_write(u32 reg, u32 v)
@@ -184,7 +181,6 @@ extern int x2apic_phys;
184extern int x2apic_preenabled; 181extern int x2apic_preenabled;
185extern void check_x2apic(void); 182extern void check_x2apic(void);
186extern void enable_x2apic(void); 183extern void enable_x2apic(void);
187extern void x2apic_icr_write(u32 low, u32 id);
188static inline int x2apic_enabled(void) 184static inline int x2apic_enabled(void)
189{ 185{
190 u64 msr; 186 u64 msr;
@@ -221,7 +217,6 @@ static inline void x2apic_force_phys(void)
221{ 217{
222} 218}
223 219
224#define nox2apic 0
225#define x2apic_preenabled 0 220#define x2apic_preenabled 0
226#define x2apic_supported() 0 221#define x2apic_supported() 0
227#endif 222#endif
@@ -351,7 +346,7 @@ struct apic {
351 int trampoline_phys_low; 346 int trampoline_phys_low;
352 int trampoline_phys_high; 347 int trampoline_phys_high;
353 348
354 void (*wait_for_init_deassert)(atomic_t *deassert); 349 bool wait_for_init_deassert;
355 void (*smp_callin_clear_local_apic)(void); 350 void (*smp_callin_clear_local_apic)(void);
356 void (*inquire_remote_apic)(int apicid); 351 void (*inquire_remote_apic)(int apicid);
357 352
@@ -517,13 +512,6 @@ extern int default_cpu_present_to_apicid(int mps_cpu);
517extern int default_check_phys_apicid_present(int phys_apicid); 512extern int default_check_phys_apicid_present(int phys_apicid);
518#endif 513#endif
519 514
520static inline void default_wait_for_init_deassert(atomic_t *deassert)
521{
522 while (!atomic_read(deassert))
523 cpu_relax();
524 return;
525}
526
527extern void generic_bigsmp_probe(void); 515extern void generic_bigsmp_probe(void);
528 516
529 517
diff --git a/arch/x86/include/asm/barrier.h b/arch/x86/include/asm/barrier.h
index 04a48903b2eb..69bbb4845020 100644
--- a/arch/x86/include/asm/barrier.h
+++ b/arch/x86/include/asm/barrier.h
@@ -85,11 +85,7 @@
85#else 85#else
86# define smp_rmb() barrier() 86# define smp_rmb() barrier()
87#endif 87#endif
88#ifdef CONFIG_X86_OOSTORE 88#define smp_wmb() barrier()
89# define smp_wmb() wmb()
90#else
91# define smp_wmb() barrier()
92#endif
93#define smp_read_barrier_depends() read_barrier_depends() 89#define smp_read_barrier_depends() read_barrier_depends()
94#define set_mb(var, value) do { (void)xchg(&var, value); } while (0) 90#define set_mb(var, value) do { (void)xchg(&var, value); } while (0)
95#else /* !SMP */ 91#else /* !SMP */
@@ -100,7 +96,7 @@
100#define set_mb(var, value) do { var = value; barrier(); } while (0) 96#define set_mb(var, value) do { var = value; barrier(); } while (0)
101#endif /* SMP */ 97#endif /* SMP */
102 98
103#if defined(CONFIG_X86_OOSTORE) || defined(CONFIG_X86_PPRO_FENCE) 99#if defined(CONFIG_X86_PPRO_FENCE)
104 100
105/* 101/*
106 * For either of these options x86 doesn't have a strong TSO memory 102 * For either of these options x86 doesn't have a strong TSO memory
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index d86dc3deea6a..e265ff95d16d 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 */
@@ -217,9 +217,14 @@
217#define X86_FEATURE_INVPCID (9*32+10) /* Invalidate Processor Context ID */ 217#define X86_FEATURE_INVPCID (9*32+10) /* Invalidate Processor Context ID */
218#define X86_FEATURE_RTM (9*32+11) /* Restricted Transactional Memory */ 218#define X86_FEATURE_RTM (9*32+11) /* Restricted Transactional Memory */
219#define X86_FEATURE_MPX (9*32+14) /* Memory Protection Extension */ 219#define X86_FEATURE_MPX (9*32+14) /* Memory Protection Extension */
220#define X86_FEATURE_AVX512F (9*32+16) /* AVX-512 Foundation */
220#define X86_FEATURE_RDSEED (9*32+18) /* The RDSEED instruction */ 221#define X86_FEATURE_RDSEED (9*32+18) /* The RDSEED instruction */
221#define X86_FEATURE_ADX (9*32+19) /* The ADCX and ADOX instructions */ 222#define X86_FEATURE_ADX (9*32+19) /* The ADCX and ADOX instructions */
222#define X86_FEATURE_SMAP (9*32+20) /* Supervisor Mode Access Prevention */ 223#define X86_FEATURE_SMAP (9*32+20) /* Supervisor Mode Access Prevention */
224#define X86_FEATURE_CLFLUSHOPT (9*32+23) /* CLFLUSHOPT instruction */
225#define X86_FEATURE_AVX512PF (9*32+26) /* AVX-512 Prefetch */
226#define X86_FEATURE_AVX512ER (9*32+27) /* AVX-512 Exponential and Reciprocal */
227#define X86_FEATURE_AVX512CD (9*32+28) /* AVX-512 Conflict Detection */
223 228
224/* 229/*
225 * BUG word(s) 230 * BUG word(s)
@@ -313,7 +318,7 @@ extern const char * const x86_power_flags[32];
313#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)
314#define cpu_has_ds boot_cpu_has(X86_FEATURE_DS) 319#define cpu_has_ds boot_cpu_has(X86_FEATURE_DS)
315#define cpu_has_pebs boot_cpu_has(X86_FEATURE_PEBS) 320#define cpu_has_pebs boot_cpu_has(X86_FEATURE_PEBS)
316#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLSH) 321#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLUSH)
317#define cpu_has_bts boot_cpu_has(X86_FEATURE_BTS) 322#define cpu_has_bts boot_cpu_has(X86_FEATURE_BTS)
318#define cpu_has_gbpages boot_cpu_has(X86_FEATURE_GBPAGES) 323#define cpu_has_gbpages boot_cpu_has(X86_FEATURE_GBPAGES)
319#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/efi.h b/arch/x86/include/asm/efi.h
index 3d6b9f81cc68..0869434eaf72 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -19,9 +19,11 @@
19 */ 19 */
20#define EFI_OLD_MEMMAP EFI_ARCH_1 20#define EFI_OLD_MEMMAP EFI_ARCH_1
21 21
22#define EFI32_LOADER_SIGNATURE "EL32"
23#define EFI64_LOADER_SIGNATURE "EL64"
24
22#ifdef CONFIG_X86_32 25#ifdef CONFIG_X86_32
23 26
24#define EFI_LOADER_SIGNATURE "EL32"
25 27
26extern unsigned long asmlinkage efi_call_phys(void *, ...); 28extern unsigned long asmlinkage efi_call_phys(void *, ...);
27 29
@@ -57,8 +59,6 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...);
57 59
58#else /* !CONFIG_X86_32 */ 60#else /* !CONFIG_X86_32 */
59 61
60#define EFI_LOADER_SIGNATURE "EL64"
61
62extern u64 efi_call0(void *fp); 62extern u64 efi_call0(void *fp);
63extern u64 efi_call1(void *fp, u64 arg1); 63extern u64 efi_call1(void *fp, u64 arg1);
64extern u64 efi_call2(void *fp, u64 arg1, u64 arg2); 64extern u64 efi_call2(void *fp, u64 arg1, u64 arg2);
@@ -119,7 +119,6 @@ extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size,
119#endif /* CONFIG_X86_32 */ 119#endif /* CONFIG_X86_32 */
120 120
121extern int add_efi_memmap; 121extern int add_efi_memmap;
122extern unsigned long x86_efi_facility;
123extern struct efi_scratch efi_scratch; 122extern struct efi_scratch efi_scratch;
124extern void efi_set_executable(efi_memory_desc_t *md, bool executable); 123extern void efi_set_executable(efi_memory_desc_t *md, bool executable);
125extern int efi_memblock_x86_reserve_range(void); 124extern int efi_memblock_x86_reserve_range(void);
@@ -130,10 +129,13 @@ extern void efi_memory_uc(u64 addr, unsigned long size);
130extern void __init efi_map_region(efi_memory_desc_t *md); 129extern void __init efi_map_region(efi_memory_desc_t *md);
131extern void __init efi_map_region_fixed(efi_memory_desc_t *md); 130extern void __init efi_map_region_fixed(efi_memory_desc_t *md);
132extern void efi_sync_low_kernel_mappings(void); 131extern void efi_sync_low_kernel_mappings(void);
133extern void efi_setup_page_tables(void); 132extern int efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages);
133extern void efi_cleanup_page_tables(unsigned long pa_memmap, unsigned num_pages);
134extern void __init old_map_region(efi_memory_desc_t *md); 134extern void __init old_map_region(efi_memory_desc_t *md);
135extern void __init runtime_code_page_mkexec(void); 135extern void __init runtime_code_page_mkexec(void);
136extern void __init efi_runtime_mkexec(void); 136extern void __init efi_runtime_mkexec(void);
137extern void __init efi_dump_pagetable(void);
138extern void __init efi_apply_memmap_quirks(void);
137 139
138struct efi_setup_data { 140struct efi_setup_data {
139 u64 fw_vendor; 141 u64 fw_vendor;
@@ -152,8 +154,40 @@ static inline bool efi_is_native(void)
152 return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT); 154 return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT);
153} 155}
154 156
157static inline bool efi_runtime_supported(void)
158{
159 if (efi_is_native())
160 return true;
161
162 if (IS_ENABLED(CONFIG_EFI_MIXED) && !efi_enabled(EFI_OLD_MEMMAP))
163 return true;
164
165 return false;
166}
167
155extern struct console early_efi_console; 168extern struct console early_efi_console;
156extern void parse_efi_setup(u64 phys_addr, u32 data_len); 169extern void parse_efi_setup(u64 phys_addr, u32 data_len);
170
171#ifdef CONFIG_EFI_MIXED
172extern void efi_thunk_runtime_setup(void);
173extern efi_status_t efi_thunk_set_virtual_address_map(
174 void *phys_set_virtual_address_map,
175 unsigned long memory_map_size,
176 unsigned long descriptor_size,
177 u32 descriptor_version,
178 efi_memory_desc_t *virtual_map);
179#else
180static inline void efi_thunk_runtime_setup(void) {}
181static inline efi_status_t efi_thunk_set_virtual_address_map(
182 void *phys_set_virtual_address_map,
183 unsigned long memory_map_size,
184 unsigned long descriptor_size,
185 u32 descriptor_version,
186 efi_memory_desc_t *virtual_map)
187{
188 return EFI_SUCCESS;
189}
190#endif /* CONFIG_EFI_MIXED */
157#else 191#else
158/* 192/*
159 * IF EFI is not configured, have the EFI calls return -ENOSYS. 193 * IF EFI is not configured, have the EFI calls return -ENOSYS.
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/io.h b/arch/x86/include/asm/io.h
index 34f69cb9350a..91d9c69a629e 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -237,7 +237,7 @@ memcpy_toio(volatile void __iomem *dst, const void *src, size_t count)
237 237
238static inline void flush_write_buffers(void) 238static inline void flush_write_buffers(void)
239{ 239{
240#if defined(CONFIG_X86_OOSTORE) || defined(CONFIG_X86_PPRO_FENCE) 240#if defined(CONFIG_X86_PPRO_FENCE)
241 asm volatile("lock; addl $0,0(%%esp)": : :"memory"); 241 asm volatile("lock; addl $0,0(%%esp)": : :"memory");
242#endif 242#endif
243} 243}
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/msr.h b/arch/x86/include/asm/msr.h
index e139b13f2a33..de36f22eb0b9 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -214,6 +214,8 @@ do { \
214 214
215struct msr *msrs_alloc(void); 215struct msr *msrs_alloc(void);
216void msrs_free(struct msr *msrs); 216void msrs_free(struct msr *msrs);
217int msr_set_bit(u32 msr, u8 bit);
218int msr_clear_bit(u32 msr, u8 bit);
217 219
218#ifdef CONFIG_SMP 220#ifdef CONFIG_SMP
219int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); 221int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
diff --git a/arch/x86/include/asm/nmi.h b/arch/x86/include/asm/nmi.h
index 86f9301903c8..5f2fc4441b11 100644
--- a/arch/x86/include/asm/nmi.h
+++ b/arch/x86/include/asm/nmi.h
@@ -1,6 +1,7 @@
1#ifndef _ASM_X86_NMI_H 1#ifndef _ASM_X86_NMI_H
2#define _ASM_X86_NMI_H 2#define _ASM_X86_NMI_H
3 3
4#include <linux/irq_work.h>
4#include <linux/pm.h> 5#include <linux/pm.h>
5#include <asm/irq.h> 6#include <asm/irq.h>
6#include <asm/io.h> 7#include <asm/io.h>
@@ -38,6 +39,8 @@ typedef int (*nmi_handler_t)(unsigned int, struct pt_regs *);
38struct nmiaction { 39struct nmiaction {
39 struct list_head list; 40 struct list_head list;
40 nmi_handler_t handler; 41 nmi_handler_t handler;
42 u64 max_duration;
43 struct irq_work irq_work;
41 unsigned long flags; 44 unsigned long flags;
42 const char *name; 45 const char *name;
43}; 46};
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 1ac6114c9ea5..96ae4f4040bb 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -26,11 +26,6 @@ extern int pci_routeirq;
26extern int noioapicquirk; 26extern int noioapicquirk;
27extern int noioapicreroute; 27extern int noioapicreroute;
28 28
29/* scan a bus after allocating a pci_sysdata for it */
30extern struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops,
31 int node);
32extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
33
34#ifdef CONFIG_PCI 29#ifdef CONFIG_PCI
35 30
36#ifdef CONFIG_PCI_DOMAINS 31#ifdef CONFIG_PCI_DOMAINS
@@ -70,7 +65,7 @@ extern unsigned long pci_mem_start;
70 65
71extern int pcibios_enabled; 66extern int pcibios_enabled;
72void pcibios_config_init(void); 67void pcibios_config_init(void);
73struct pci_bus *pcibios_scan_root(int bus); 68void pcibios_scan_root(int bus);
74 69
75void pcibios_set_master(struct pci_dev *dev); 70void pcibios_set_master(struct pci_dev *dev);
76void pcibios_penalize_isa_irq(int irq, int active); 71void pcibios_penalize_isa_irq(int irq, int active);
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 5ad38ad07890..b459ddf27d64 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -15,9 +15,10 @@
15 : (prot)) 15 : (prot))
16 16
17#ifndef __ASSEMBLY__ 17#ifndef __ASSEMBLY__
18
19#include <asm/x86_init.h> 18#include <asm/x86_init.h>
20 19
20void ptdump_walk_pgd_level(struct seq_file *m, pgd_t *pgd);
21
21/* 22/*
22 * ZERO_PAGE is a global shared page that is always zero: used 23 * ZERO_PAGE is a global shared page that is always zero: used
23 * for zero-mapped memory areas etc.. 24 * for zero-mapped memory areas etc..
@@ -445,20 +446,10 @@ static inline int pte_same(pte_t a, pte_t b)
445 return a.pte == b.pte; 446 return a.pte == b.pte;
446} 447}
447 448
448static inline int pteval_present(pteval_t pteval)
449{
450 /*
451 * Yes Linus, _PAGE_PROTNONE == _PAGE_NUMA. Expressing it this
452 * way clearly states that the intent is that protnone and numa
453 * hinting ptes are considered present for the purposes of
454 * pagetable operations like zapping, protection changes, gup etc.
455 */
456 return pteval & (_PAGE_PRESENT | _PAGE_PROTNONE | _PAGE_NUMA);
457}
458
459static inline int pte_present(pte_t a) 449static inline int pte_present(pte_t a)
460{ 450{
461 return pteval_present(pte_flags(a)); 451 return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE |
452 _PAGE_NUMA);
462} 453}
463 454
464#define pte_accessible pte_accessible 455#define pte_accessible pte_accessible
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index 1aa9ccd43223..708f19fb4fc7 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -382,9 +382,13 @@ static inline void update_page_count(int level, unsigned long pages) { }
382 * as a pte too. 382 * as a pte too.
383 */ 383 */
384extern pte_t *lookup_address(unsigned long address, unsigned int *level); 384extern pte_t *lookup_address(unsigned long address, unsigned int *level);
385extern pte_t *lookup_address_in_pgd(pgd_t *pgd, unsigned long address,
386 unsigned int *level);
385extern phys_addr_t slow_virt_to_phys(void *__address); 387extern phys_addr_t slow_virt_to_phys(void *__address);
386extern int kernel_map_pages_in_pgd(pgd_t *pgd, u64 pfn, unsigned long address, 388extern int kernel_map_pages_in_pgd(pgd_t *pgd, u64 pfn, unsigned long address,
387 unsigned numpages, unsigned long page_flags); 389 unsigned numpages, unsigned long page_flags);
390void kernel_unmap_pages_in_pgd(pgd_t *root, unsigned long address,
391 unsigned numpages);
388#endif /* !__ASSEMBLY__ */ 392#endif /* !__ASSEMBLY__ */
389 393
390#endif /* _ASM_X86_PGTABLE_DEFS_H */ 394#endif /* _ASM_X86_PGTABLE_DEFS_H */
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/special_insns.h b/arch/x86/include/asm/special_insns.h
index 645cad2c95ff..e820c080a4e9 100644
--- a/arch/x86/include/asm/special_insns.h
+++ b/arch/x86/include/asm/special_insns.h
@@ -191,6 +191,14 @@ static inline void clflush(volatile void *__p)
191 asm volatile("clflush %0" : "+m" (*(volatile char __force *)__p)); 191 asm volatile("clflush %0" : "+m" (*(volatile char __force *)__p));
192} 192}
193 193
194static inline void clflushopt(volatile void *__p)
195{
196 alternative_io(".byte " __stringify(NOP_DS_PREFIX) "; clflush %P0",
197 ".byte 0x66; clflush %P0",
198 X86_FEATURE_CLFLUSHOPT,
199 "+m" (*(volatile char __force *)__p));
200}
201
194#define nop() asm volatile ("nop") 202#define nop() asm volatile ("nop")
195 203
196 204
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h
index bf156ded74b5..0f62f5482d91 100644
--- a/arch/x86/include/asm/spinlock.h
+++ b/arch/x86/include/asm/spinlock.h
@@ -26,10 +26,9 @@
26# define LOCK_PTR_REG "D" 26# define LOCK_PTR_REG "D"
27#endif 27#endif
28 28
29#if defined(CONFIG_X86_32) && \ 29#if defined(CONFIG_X86_32) && (defined(CONFIG_X86_PPRO_FENCE))
30 (defined(CONFIG_X86_OOSTORE) || defined(CONFIG_X86_PPRO_FENCE))
31/* 30/*
32 * On PPro SMP or if we are using OOSTORE, we use a locked operation to unlock 31 * On PPro SMP, we use a locked operation to unlock
33 * (PPro errata 66, 92) 32 * (PPro errata 66, 92)
34 */ 33 */
35# define UNLOCK_LOCK_PREFIX LOCK_PREFIX 34# define UNLOCK_LOCK_PREFIX LOCK_PREFIX
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/topology.h b/arch/x86/include/asm/topology.h
index d35f24e231cd..0e8f04f2c26f 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -119,9 +119,10 @@ static inline void setup_node_to_cpumask_map(void) { }
119 119
120extern const struct cpumask *cpu_coregroup_mask(int cpu); 120extern const struct cpumask *cpu_coregroup_mask(int cpu);
121 121
122#ifdef ENABLE_TOPO_DEFINES
123#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id) 122#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id)
124#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id) 123#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)
124
125#ifdef ENABLE_TOPO_DEFINES
125#define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu)) 126#define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu))
126#define topology_thread_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu)) 127#define topology_thread_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu))
127#endif 128#endif
@@ -131,25 +132,7 @@ static inline void arch_fix_phys_package_id(int num, u32 slot)
131} 132}
132 133
133struct pci_bus; 134struct pci_bus;
135int x86_pci_root_bus_node(int bus);
134void x86_pci_root_bus_resources(int bus, struct list_head *resources); 136void x86_pci_root_bus_resources(int bus, struct list_head *resources);
135 137
136#ifdef CONFIG_SMP
137#define mc_capable() ((boot_cpu_data.x86_max_cores > 1) && \
138 (cpumask_weight(cpu_core_mask(0)) != nr_cpu_ids))
139#define smt_capable() (smp_num_siblings > 1)
140#endif
141
142#ifdef CONFIG_NUMA
143extern int get_mp_bus_to_node(int busnum);
144extern void set_mp_bus_to_node(int busnum, int node);
145#else
146static inline int get_mp_bus_to_node(int busnum)
147{
148 return 0;
149}
150static inline void set_mp_bus_to_node(int busnum, int node)
151{
152}
153#endif
154
155#endif /* _ASM_X86_TOPOLOGY_H */ 138#endif /* _ASM_X86_TOPOLOGY_H */
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/include/asm/xsave.h b/arch/x86/include/asm/xsave.h
index 554738963b28..6c1d7411eb00 100644
--- a/arch/x86/include/asm/xsave.h
+++ b/arch/x86/include/asm/xsave.h
@@ -6,11 +6,14 @@
6 6
7#define XSTATE_CPUID 0x0000000d 7#define XSTATE_CPUID 0x0000000d
8 8
9#define XSTATE_FP 0x1 9#define XSTATE_FP 0x1
10#define XSTATE_SSE 0x2 10#define XSTATE_SSE 0x2
11#define XSTATE_YMM 0x4 11#define XSTATE_YMM 0x4
12#define XSTATE_BNDREGS 0x8 12#define XSTATE_BNDREGS 0x8
13#define XSTATE_BNDCSR 0x10 13#define XSTATE_BNDCSR 0x10
14#define XSTATE_OPMASK 0x20
15#define XSTATE_ZMM_Hi256 0x40
16#define XSTATE_Hi16_ZMM 0x80
14 17
15#define XSTATE_FPSSE (XSTATE_FP | XSTATE_SSE) 18#define XSTATE_FPSSE (XSTATE_FP | XSTATE_SSE)
16 19
@@ -23,7 +26,8 @@
23#define XSAVE_YMM_OFFSET (XSAVE_HDR_SIZE + XSAVE_HDR_OFFSET) 26#define XSAVE_YMM_OFFSET (XSAVE_HDR_SIZE + XSAVE_HDR_OFFSET)
24 27
25/* Supported features which support lazy state saving */ 28/* Supported features which support lazy state saving */
26#define XSTATE_LAZY (XSTATE_FP | XSTATE_SSE | XSTATE_YMM) 29#define XSTATE_LAZY (XSTATE_FP | XSTATE_SSE | XSTATE_YMM \
30 | XSTATE_OPMASK | XSTATE_ZMM_Hi256 | XSTATE_Hi16_ZMM)
27 31
28/* Supported features which require eager state saving */ 32/* Supported features which require eager state saving */
29#define XSTATE_EAGER (XSTATE_BNDREGS | XSTATE_BNDCSR) 33#define XSTATE_EAGER (XSTATE_BNDREGS | XSTATE_BNDCSR)
diff --git a/arch/x86/include/uapi/asm/msr-index.h b/arch/x86/include/uapi/asm/msr-index.h
index c19fc60ff062..4924f4be2b99 100644
--- a/arch/x86/include/uapi/asm/msr-index.h
+++ b/arch/x86/include/uapi/asm/msr-index.h
@@ -368,33 +368,58 @@
368#define THERM_LOG_THRESHOLD1 (1 << 9) 368#define THERM_LOG_THRESHOLD1 (1 << 9)
369 369
370/* MISC_ENABLE bits: architectural */ 370/* MISC_ENABLE bits: architectural */
371#define MSR_IA32_MISC_ENABLE_FAST_STRING (1ULL << 0) 371#define MSR_IA32_MISC_ENABLE_FAST_STRING_BIT 0
372#define MSR_IA32_MISC_ENABLE_TCC (1ULL << 1) 372#define MSR_IA32_MISC_ENABLE_FAST_STRING (1ULL << MSR_IA32_MISC_ENABLE_FAST_STRING_BIT)
373#define MSR_IA32_MISC_ENABLE_EMON (1ULL << 7) 373#define MSR_IA32_MISC_ENABLE_TCC_BIT 1
374#define MSR_IA32_MISC_ENABLE_BTS_UNAVAIL (1ULL << 11) 374#define MSR_IA32_MISC_ENABLE_TCC (1ULL << MSR_IA32_MISC_ENABLE_TCC_BIT)
375#define MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL (1ULL << 12) 375#define MSR_IA32_MISC_ENABLE_EMON_BIT 7
376#define MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP (1ULL << 16) 376#define MSR_IA32_MISC_ENABLE_EMON (1ULL << MSR_IA32_MISC_ENABLE_EMON_BIT)
377#define MSR_IA32_MISC_ENABLE_MWAIT (1ULL << 18) 377#define MSR_IA32_MISC_ENABLE_BTS_UNAVAIL_BIT 11
378#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1ULL << 22) 378#define MSR_IA32_MISC_ENABLE_BTS_UNAVAIL (1ULL << MSR_IA32_MISC_ENABLE_BTS_UNAVAIL_BIT)
379#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE (1ULL << 23) 379#define MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL_BIT 12
380#define MSR_IA32_MISC_ENABLE_XD_DISABLE (1ULL << 34) 380#define MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL (1ULL << MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL_BIT)
381#define MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP_BIT 16
382#define MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP (1ULL << MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP_BIT)
383#define MSR_IA32_MISC_ENABLE_MWAIT_BIT 18
384#define MSR_IA32_MISC_ENABLE_MWAIT (1ULL << MSR_IA32_MISC_ENABLE_MWAIT_BIT)
385#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT 22
386#define MSR_IA32_MISC_ENABLE_LIMIT_CPUID (1ULL << MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT);
387#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE_BIT 23
388#define MSR_IA32_MISC_ENABLE_XTPR_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_XTPR_DISABLE_BIT)
389#define MSR_IA32_MISC_ENABLE_XD_DISABLE_BIT 34
390#define MSR_IA32_MISC_ENABLE_XD_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_XD_DISABLE_BIT)
381 391
382/* MISC_ENABLE bits: model-specific, meaning may vary from core to core */ 392/* MISC_ENABLE bits: model-specific, meaning may vary from core to core */
383#define MSR_IA32_MISC_ENABLE_X87_COMPAT (1ULL << 2) 393#define MSR_IA32_MISC_ENABLE_X87_COMPAT_BIT 2
384#define MSR_IA32_MISC_ENABLE_TM1 (1ULL << 3) 394#define MSR_IA32_MISC_ENABLE_X87_COMPAT (1ULL << MSR_IA32_MISC_ENABLE_X87_COMPAT_BIT)
385#define MSR_IA32_MISC_ENABLE_SPLIT_LOCK_DISABLE (1ULL << 4) 395#define MSR_IA32_MISC_ENABLE_TM1_BIT 3
386#define MSR_IA32_MISC_ENABLE_L3CACHE_DISABLE (1ULL << 6) 396#define MSR_IA32_MISC_ENABLE_TM1 (1ULL << MSR_IA32_MISC_ENABLE_TM1_BIT)
387#define MSR_IA32_MISC_ENABLE_SUPPRESS_LOCK (1ULL << 8) 397#define MSR_IA32_MISC_ENABLE_SPLIT_LOCK_DISABLE_BIT 4
388#define MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE (1ULL << 9) 398#define MSR_IA32_MISC_ENABLE_SPLIT_LOCK_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_SPLIT_LOCK_DISABLE_BIT)
389#define MSR_IA32_MISC_ENABLE_FERR (1ULL << 10) 399#define MSR_IA32_MISC_ENABLE_L3CACHE_DISABLE_BIT 6
390#define MSR_IA32_MISC_ENABLE_FERR_MULTIPLEX (1ULL << 10) 400#define MSR_IA32_MISC_ENABLE_L3CACHE_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_L3CACHE_DISABLE_BIT)
391#define MSR_IA32_MISC_ENABLE_TM2 (1ULL << 13) 401#define MSR_IA32_MISC_ENABLE_SUPPRESS_LOCK_BIT 8
392#define MSR_IA32_MISC_ENABLE_ADJ_PREF_DISABLE (1ULL << 19) 402#define MSR_IA32_MISC_ENABLE_SUPPRESS_LOCK (1ULL << MSR_IA32_MISC_ENABLE_SUPPRESS_LOCK_BIT)
393#define MSR_IA32_MISC_ENABLE_SPEEDSTEP_LOCK (1ULL << 20) 403#define MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE_BIT 9
394#define MSR_IA32_MISC_ENABLE_L1D_CONTEXT (1ULL << 24) 404#define MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE_BIT)
395#define MSR_IA32_MISC_ENABLE_DCU_PREF_DISABLE (1ULL << 37) 405#define MSR_IA32_MISC_ENABLE_FERR_BIT 10
396#define MSR_IA32_MISC_ENABLE_TURBO_DISABLE (1ULL << 38) 406#define MSR_IA32_MISC_ENABLE_FERR (1ULL << MSR_IA32_MISC_ENABLE_FERR_BIT)
397#define MSR_IA32_MISC_ENABLE_IP_PREF_DISABLE (1ULL << 39) 407#define MSR_IA32_MISC_ENABLE_FERR_MULTIPLEX_BIT 10
408#define MSR_IA32_MISC_ENABLE_FERR_MULTIPLEX (1ULL << MSR_IA32_MISC_ENABLE_FERR_MULTIPLEX_BIT)
409#define MSR_IA32_MISC_ENABLE_TM2_BIT 13
410#define MSR_IA32_MISC_ENABLE_TM2 (1ULL << MSR_IA32_MISC_ENABLE_TM2_BIT)
411#define MSR_IA32_MISC_ENABLE_ADJ_PREF_DISABLE_BIT 19
412#define MSR_IA32_MISC_ENABLE_ADJ_PREF_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_ADJ_PREF_DISABLE_BIT)
413#define MSR_IA32_MISC_ENABLE_SPEEDSTEP_LOCK_BIT 20
414#define MSR_IA32_MISC_ENABLE_SPEEDSTEP_LOCK (1ULL << MSR_IA32_MISC_ENABLE_SPEEDSTEP_LOCK_BIT)
415#define MSR_IA32_MISC_ENABLE_L1D_CONTEXT_BIT 24
416#define MSR_IA32_MISC_ENABLE_L1D_CONTEXT (1ULL << MSR_IA32_MISC_ENABLE_L1D_CONTEXT_BIT)
417#define MSR_IA32_MISC_ENABLE_DCU_PREF_DISABLE_BIT 37
418#define MSR_IA32_MISC_ENABLE_DCU_PREF_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_DCU_PREF_DISABLE_BIT)
419#define MSR_IA32_MISC_ENABLE_TURBO_DISABLE_BIT 38
420#define MSR_IA32_MISC_ENABLE_TURBO_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_TURBO_DISABLE_BIT)
421#define MSR_IA32_MISC_ENABLE_IP_PREF_DISABLE_BIT 39
422#define MSR_IA32_MISC_ENABLE_IP_PREF_DISABLE (1ULL << MSR_IA32_MISC_ENABLE_IP_PREF_DISABLE_BIT)
398 423
399#define MSR_IA32_TSC_DEADLINE 0x000006E0 424#define MSR_IA32_TSC_DEADLINE 0x000006E0
400 425
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 1dac94265b59..8e61d23b8f64 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -53,10 +53,6 @@ EXPORT_SYMBOL(acpi_disabled);
53# include <asm/proto.h> 53# include <asm/proto.h>
54#endif /* X86 */ 54#endif /* X86 */
55 55
56#define BAD_MADT_ENTRY(entry, end) ( \
57 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
58 ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
59
60#define PREFIX "ACPI: " 56#define PREFIX "ACPI: "
61 57
62int acpi_noirq; /* skip ACPI IRQ initialization */ 58int acpi_noirq; /* skip ACPI IRQ initialization */
@@ -613,10 +609,10 @@ static void acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
613 int nid; 609 int nid;
614 610
615 nid = acpi_get_node(handle); 611 nid = acpi_get_node(handle);
616 if (nid == -1 || !node_online(nid)) 612 if (nid != -1) {
617 return; 613 set_apicid_to_node(physid, nid);
618 set_apicid_to_node(physid, nid); 614 numa_set_node(cpu, nid);
619 numa_set_node(cpu, nid); 615 }
620#endif 616#endif
621} 617}
622 618
diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c
index dec8de4e1663..f04dbb3069b8 100644
--- a/arch/x86/kernel/amd_nb.c
+++ b/arch/x86/kernel/amd_nb.c
@@ -22,6 +22,7 @@ const struct pci_device_id amd_nb_misc_ids[] = {
22 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M10H_F3) }, 22 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M10H_F3) },
23 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F3) }, 23 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F3) },
24 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) }, 24 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) },
25 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) },
25 {} 26 {}
26}; 27};
27EXPORT_SYMBOL(amd_nb_misc_ids); 28EXPORT_SYMBOL(amd_nb_misc_ids);
@@ -30,6 +31,7 @@ static const struct pci_device_id amd_nb_link_ids[] = {
30 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, 31 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
31 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F4) }, 32 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F4) },
32 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) }, 33 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) },
34 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F4) },
33 {} 35 {}
34}; 36};
35 37
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index fd972a3e4cbb..9fa8aa051f54 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -18,7 +18,6 @@
18#include <linux/pci_ids.h> 18#include <linux/pci_ids.h>
19#include <linux/pci.h> 19#include <linux/pci.h>
20#include <linux/bitops.h> 20#include <linux/bitops.h>
21#include <linux/ioport.h>
22#include <linux/suspend.h> 21#include <linux/suspend.h>
23#include <asm/e820.h> 22#include <asm/e820.h>
24#include <asm/io.h> 23#include <asm/io.h>
@@ -54,18 +53,6 @@ int fallback_aper_force __initdata;
54 53
55int fix_aperture __initdata = 1; 54int fix_aperture __initdata = 1;
56 55
57static struct resource gart_resource = {
58 .name = "GART",
59 .flags = IORESOURCE_MEM,
60};
61
62static void __init insert_aperture_resource(u32 aper_base, u32 aper_size)
63{
64 gart_resource.start = aper_base;
65 gart_resource.end = aper_base + aper_size - 1;
66 insert_resource(&iomem_resource, &gart_resource);
67}
68
69/* This code runs before the PCI subsystem is initialized, so just 56/* This code runs before the PCI subsystem is initialized, so just
70 access the northbridge directly. */ 57 access the northbridge directly. */
71 58
@@ -96,7 +83,6 @@ static u32 __init allocate_aperture(void)
96 memblock_reserve(addr, aper_size); 83 memblock_reserve(addr, aper_size);
97 printk(KERN_INFO "Mapping aperture over %d KB of RAM @ %lx\n", 84 printk(KERN_INFO "Mapping aperture over %d KB of RAM @ %lx\n",
98 aper_size >> 10, addr); 85 aper_size >> 10, addr);
99 insert_aperture_resource((u32)addr, aper_size);
100 register_nosave_region(addr >> PAGE_SHIFT, 86 register_nosave_region(addr >> PAGE_SHIFT,
101 (addr+aper_size) >> PAGE_SHIFT); 87 (addr+aper_size) >> PAGE_SHIFT);
102 88
@@ -444,12 +430,8 @@ int __init gart_iommu_hole_init(void)
444 430
445out: 431out:
446 if (!fix && !fallback_aper_force) { 432 if (!fix && !fallback_aper_force) {
447 if (last_aper_base) { 433 if (last_aper_base)
448 unsigned long n = (32 * 1024 * 1024) << last_aper_order;
449
450 insert_aperture_resource((u32)last_aper_base, n);
451 return 1; 434 return 1;
452 }
453 return 0; 435 return 0;
454 } 436 }
455 437
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 7f26c9a70a9e..53e20531470e 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -133,6 +133,10 @@ static inline void imcr_apic_to_pic(void)
133 * +1=force-enable 133 * +1=force-enable
134 */ 134 */
135static int force_enable_local_apic __initdata; 135static int force_enable_local_apic __initdata;
136
137/* Control whether x2APIC mode is enabled or not */
138static bool nox2apic __initdata;
139
136/* 140/*
137 * APIC command line parameters 141 * APIC command line parameters
138 */ 142 */
@@ -162,8 +166,7 @@ int x2apic_mode;
162/* x2apic enabled before OS handover */ 166/* x2apic enabled before OS handover */
163int x2apic_preenabled; 167int x2apic_preenabled;
164static int x2apic_disabled; 168static int x2apic_disabled;
165static int nox2apic; 169static int __init setup_nox2apic(char *str)
166static __init int setup_nox2apic(char *str)
167{ 170{
168 if (x2apic_enabled()) { 171 if (x2apic_enabled()) {
169 int apicid = native_apic_msr_read(APIC_ID); 172 int apicid = native_apic_msr_read(APIC_ID);
@@ -178,7 +181,7 @@ static __init int setup_nox2apic(char *str)
178 } else 181 } else
179 setup_clear_cpu_cap(X86_FEATURE_X2APIC); 182 setup_clear_cpu_cap(X86_FEATURE_X2APIC);
180 183
181 nox2apic = 1; 184 nox2apic = true;
182 185
183 return 0; 186 return 0;
184} 187}
@@ -283,8 +286,12 @@ u32 native_safe_apic_wait_icr_idle(void)
283 286
284void native_apic_icr_write(u32 low, u32 id) 287void native_apic_icr_write(u32 low, u32 id)
285{ 288{
289 unsigned long flags;
290
291 local_irq_save(flags);
286 apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(id)); 292 apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(id));
287 apic_write(APIC_ICR, low); 293 apic_write(APIC_ICR, low);
294 local_irq_restore(flags);
288} 295}
289 296
290u64 native_apic_icr_read(void) 297u64 native_apic_icr_read(void)
diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c
index 2c621a6b901a..7c1b29479513 100644
--- a/arch/x86/kernel/apic/apic_flat_64.c
+++ b/arch/x86/kernel/apic/apic_flat_64.c
@@ -198,7 +198,7 @@ static struct apic apic_flat = {
198 198
199 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, 199 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
200 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, 200 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
201 .wait_for_init_deassert = NULL, 201 .wait_for_init_deassert = false,
202 .smp_callin_clear_local_apic = NULL, 202 .smp_callin_clear_local_apic = NULL,
203 .inquire_remote_apic = default_inquire_remote_apic, 203 .inquire_remote_apic = default_inquire_remote_apic,
204 204
@@ -314,7 +314,7 @@ static struct apic apic_physflat = {
314 314
315 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, 315 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
316 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, 316 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
317 .wait_for_init_deassert = NULL, 317 .wait_for_init_deassert = false,
318 .smp_callin_clear_local_apic = NULL, 318 .smp_callin_clear_local_apic = NULL,
319 .inquire_remote_apic = default_inquire_remote_apic, 319 .inquire_remote_apic = default_inquire_remote_apic,
320 320
diff --git a/arch/x86/kernel/apic/apic_noop.c b/arch/x86/kernel/apic/apic_noop.c
index 191ce75c0e54..8c7c98249c20 100644
--- a/arch/x86/kernel/apic/apic_noop.c
+++ b/arch/x86/kernel/apic/apic_noop.c
@@ -172,8 +172,7 @@ struct apic apic_noop = {
172 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, 172 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
173 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, 173 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
174 174
175 .wait_for_init_deassert = NULL, 175 .wait_for_init_deassert = false,
176
177 .smp_callin_clear_local_apic = NULL, 176 .smp_callin_clear_local_apic = NULL,
178 .inquire_remote_apic = NULL, 177 .inquire_remote_apic = NULL,
179 178
diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c
index 3e67f9e3d7ef..a5b45df8bc88 100644
--- a/arch/x86/kernel/apic/apic_numachip.c
+++ b/arch/x86/kernel/apic/apic_numachip.c
@@ -248,7 +248,7 @@ static const struct apic apic_numachip __refconst = {
248 .wakeup_secondary_cpu = numachip_wakeup_secondary, 248 .wakeup_secondary_cpu = numachip_wakeup_secondary,
249 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, 249 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
250 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, 250 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
251 .wait_for_init_deassert = NULL, 251 .wait_for_init_deassert = false,
252 .smp_callin_clear_local_apic = NULL, 252 .smp_callin_clear_local_apic = NULL,
253 .inquire_remote_apic = NULL, /* REMRD not supported */ 253 .inquire_remote_apic = NULL, /* REMRD not supported */
254 254
diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c
index d50e3640d5ae..e4840aa7a255 100644
--- a/arch/x86/kernel/apic/bigsmp_32.c
+++ b/arch/x86/kernel/apic/bigsmp_32.c
@@ -199,8 +199,7 @@ static struct apic apic_bigsmp = {
199 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, 199 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
200 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, 200 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
201 201
202 .wait_for_init_deassert = default_wait_for_init_deassert, 202 .wait_for_init_deassert = true,
203
204 .smp_callin_clear_local_apic = NULL, 203 .smp_callin_clear_local_apic = NULL,
205 .inquire_remote_apic = default_inquire_remote_apic, 204 .inquire_remote_apic = default_inquire_remote_apic,
206 205
diff --git a/arch/x86/kernel/apic/es7000_32.c b/arch/x86/kernel/apic/es7000_32.c
index c55224731b2d..6f8f8b348a39 100644
--- a/arch/x86/kernel/apic/es7000_32.c
+++ b/arch/x86/kernel/apic/es7000_32.c
@@ -394,12 +394,6 @@ static void es7000_enable_apic_mode(void)
394 WARN(1, "Command failed, status = %x\n", mip_status); 394 WARN(1, "Command failed, status = %x\n", mip_status);
395} 395}
396 396
397static void es7000_wait_for_init_deassert(atomic_t *deassert)
398{
399 while (!atomic_read(deassert))
400 cpu_relax();
401}
402
403static unsigned int es7000_get_apic_id(unsigned long x) 397static unsigned int es7000_get_apic_id(unsigned long x)
404{ 398{
405 return (x >> 24) & 0xFF; 399 return (x >> 24) & 0xFF;
@@ -658,8 +652,7 @@ static struct apic __refdata apic_es7000_cluster = {
658 .trampoline_phys_low = 0x467, 652 .trampoline_phys_low = 0x467,
659 .trampoline_phys_high = 0x469, 653 .trampoline_phys_high = 0x469,
660 654
661 .wait_for_init_deassert = NULL, 655 .wait_for_init_deassert = false,
662
663 /* Nothing to do for most platforms, since cleared by the INIT cycle: */ 656 /* Nothing to do for most platforms, since cleared by the INIT cycle: */
664 .smp_callin_clear_local_apic = NULL, 657 .smp_callin_clear_local_apic = NULL,
665 .inquire_remote_apic = default_inquire_remote_apic, 658 .inquire_remote_apic = default_inquire_remote_apic,
@@ -722,8 +715,7 @@ static struct apic __refdata apic_es7000 = {
722 .trampoline_phys_low = 0x467, 715 .trampoline_phys_low = 0x467,
723 .trampoline_phys_high = 0x469, 716 .trampoline_phys_high = 0x469,
724 717
725 .wait_for_init_deassert = es7000_wait_for_init_deassert, 718 .wait_for_init_deassert = true,
726
727 /* Nothing to do for most platforms, since cleared by the INIT cycle: */ 719 /* Nothing to do for most platforms, since cleared by the INIT cycle: */
728 .smp_callin_clear_local_apic = NULL, 720 .smp_callin_clear_local_apic = NULL,
729 .inquire_remote_apic = default_inquire_remote_apic, 721 .inquire_remote_apic = default_inquire_remote_apic,
diff --git a/arch/x86/kernel/apic/numaq_32.c b/arch/x86/kernel/apic/numaq_32.c
index 1e42e8f305ee..030ea1c04f72 100644
--- a/arch/x86/kernel/apic/numaq_32.c
+++ b/arch/x86/kernel/apic/numaq_32.c
@@ -505,8 +505,7 @@ static struct apic __refdata apic_numaq = {
505 .trampoline_phys_high = NUMAQ_TRAMPOLINE_PHYS_HIGH, 505 .trampoline_phys_high = NUMAQ_TRAMPOLINE_PHYS_HIGH,
506 506
507 /* We don't do anything here because we use NMI's to boot instead */ 507 /* We don't do anything here because we use NMI's to boot instead */
508 .wait_for_init_deassert = NULL, 508 .wait_for_init_deassert = false,
509
510 .smp_callin_clear_local_apic = numaq_smp_callin_clear_local_apic, 509 .smp_callin_clear_local_apic = numaq_smp_callin_clear_local_apic,
511 .inquire_remote_apic = NULL, 510 .inquire_remote_apic = NULL,
512 511
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
index eb35ef9ee63f..cceb352c968c 100644
--- a/arch/x86/kernel/apic/probe_32.c
+++ b/arch/x86/kernel/apic/probe_32.c
@@ -119,8 +119,7 @@ static struct apic apic_default = {
119 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, 119 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
120 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, 120 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
121 121
122 .wait_for_init_deassert = default_wait_for_init_deassert, 122 .wait_for_init_deassert = true,
123
124 .smp_callin_clear_local_apic = NULL, 123 .smp_callin_clear_local_apic = NULL,
125 .inquire_remote_apic = default_inquire_remote_apic, 124 .inquire_remote_apic = default_inquire_remote_apic,
126 125
diff --git a/arch/x86/kernel/apic/summit_32.c b/arch/x86/kernel/apic/summit_32.c
index 00146f9b0254..b656128611cd 100644
--- a/arch/x86/kernel/apic/summit_32.c
+++ b/arch/x86/kernel/apic/summit_32.c
@@ -532,8 +532,7 @@ static struct apic apic_summit = {
532 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, 532 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
533 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, 533 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
534 534
535 .wait_for_init_deassert = default_wait_for_init_deassert, 535 .wait_for_init_deassert = true,
536
537 .smp_callin_clear_local_apic = NULL, 536 .smp_callin_clear_local_apic = NULL,
538 .inquire_remote_apic = default_inquire_remote_apic, 537 .inquire_remote_apic = default_inquire_remote_apic,
539 538
diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
index cac85ee6913f..e66766bf1641 100644
--- a/arch/x86/kernel/apic/x2apic_cluster.c
+++ b/arch/x86/kernel/apic/x2apic_cluster.c
@@ -279,7 +279,7 @@ static struct apic apic_x2apic_cluster = {
279 279
280 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, 280 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
281 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, 281 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
282 .wait_for_init_deassert = NULL, 282 .wait_for_init_deassert = false,
283 .smp_callin_clear_local_apic = NULL, 283 .smp_callin_clear_local_apic = NULL,
284 .inquire_remote_apic = NULL, 284 .inquire_remote_apic = NULL,
285 285
diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c
index de231e328cae..6d600ebf6c12 100644
--- a/arch/x86/kernel/apic/x2apic_phys.c
+++ b/arch/x86/kernel/apic/x2apic_phys.c
@@ -133,7 +133,7 @@ static struct apic apic_x2apic_phys = {
133 133
134 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, 134 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
135 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, 135 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
136 .wait_for_init_deassert = NULL, 136 .wait_for_init_deassert = false,
137 .smp_callin_clear_local_apic = NULL, 137 .smp_callin_clear_local_apic = NULL,
138 .inquire_remote_apic = NULL, 138 .inquire_remote_apic = NULL,
139 139
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index d263b1307de1..7834389ba5be 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -396,7 +396,7 @@ static struct apic __refdata apic_x2apic_uv_x = {
396 .wakeup_secondary_cpu = uv_wakeup_secondary, 396 .wakeup_secondary_cpu = uv_wakeup_secondary,
397 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW, 397 .trampoline_phys_low = DEFAULT_TRAMPOLINE_PHYS_LOW,
398 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH, 398 .trampoline_phys_high = DEFAULT_TRAMPOLINE_PHYS_HIGH,
399 .wait_for_init_deassert = NULL, 399 .wait_for_init_deassert = false,
400 .smp_callin_clear_local_apic = NULL, 400 .smp_callin_clear_local_apic = NULL,
401 .inquire_remote_apic = NULL, 401 .inquire_remote_apic = NULL,
402 402
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index c67ffa686064..ce8b8ff0e0ef 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -218,7 +218,7 @@ static void amd_k7_smp_check(struct cpuinfo_x86 *c)
218 */ 218 */
219 WARN_ONCE(1, "WARNING: This combination of AMD" 219 WARN_ONCE(1, "WARNING: This combination of AMD"
220 " processors is not suitable for SMP.\n"); 220 " processors is not suitable for SMP.\n");
221 add_taint(TAINT_UNSAFE_SMP, LOCKDEP_NOW_UNRELIABLE); 221 add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_NOW_UNRELIABLE);
222} 222}
223 223
224static void init_amd_k7(struct cpuinfo_x86 *c) 224static void init_amd_k7(struct cpuinfo_x86 *c)
@@ -233,9 +233,7 @@ static void init_amd_k7(struct cpuinfo_x86 *c)
233 if (c->x86_model >= 6 && c->x86_model <= 10) { 233 if (c->x86_model >= 6 && c->x86_model <= 10) {
234 if (!cpu_has(c, X86_FEATURE_XMM)) { 234 if (!cpu_has(c, X86_FEATURE_XMM)) {
235 printk(KERN_INFO "Enabling disabled K7/SSE Support.\n"); 235 printk(KERN_INFO "Enabling disabled K7/SSE Support.\n");
236 rdmsr(MSR_K7_HWCR, l, h); 236 msr_clear_bit(MSR_K7_HWCR, 15);
237 l &= ~0x00008000;
238 wrmsr(MSR_K7_HWCR, l, h);
239 set_cpu_cap(c, X86_FEATURE_XMM); 237 set_cpu_cap(c, X86_FEATURE_XMM);
240 } 238 }
241 } 239 }
@@ -509,14 +507,8 @@ static void early_init_amd(struct cpuinfo_x86 *c)
509#endif 507#endif
510 508
511 /* F16h erratum 793, CVE-2013-6885 */ 509 /* F16h erratum 793, CVE-2013-6885 */
512 if (c->x86 == 0x16 && c->x86_model <= 0xf) { 510 if (c->x86 == 0x16 && c->x86_model <= 0xf)
513 u64 val; 511 msr_set_bit(MSR_AMD64_LS_CFG, 15);
514
515 rdmsrl(MSR_AMD64_LS_CFG, val);
516 if (!(val & BIT(15)))
517 wrmsrl(MSR_AMD64_LS_CFG, val | BIT(15));
518 }
519
520} 512}
521 513
522static const int amd_erratum_383[]; 514static const int amd_erratum_383[];
@@ -536,11 +528,8 @@ static void init_amd(struct cpuinfo_x86 *c)
536 * Errata 63 for SH-B3 steppings 528 * Errata 63 for SH-B3 steppings
537 * Errata 122 for all steppings (F+ have it disabled by default) 529 * Errata 122 for all steppings (F+ have it disabled by default)
538 */ 530 */
539 if (c->x86 == 0xf) { 531 if (c->x86 == 0xf)
540 rdmsrl(MSR_K7_HWCR, value); 532 msr_set_bit(MSR_K7_HWCR, 6);
541 value |= 1 << 6;
542 wrmsrl(MSR_K7_HWCR, value);
543 }
544#endif 533#endif
545 534
546 early_init_amd(c); 535 early_init_amd(c);
@@ -623,14 +612,11 @@ static void init_amd(struct cpuinfo_x86 *c)
623 (c->x86_model >= 0x10) && (c->x86_model <= 0x1f) && 612 (c->x86_model >= 0x10) && (c->x86_model <= 0x1f) &&
624 !cpu_has(c, X86_FEATURE_TOPOEXT)) { 613 !cpu_has(c, X86_FEATURE_TOPOEXT)) {
625 614
626 if (!rdmsrl_safe(0xc0011005, &value)) { 615 if (msr_set_bit(0xc0011005, 54) > 0) {
627 value |= 1ULL << 54;
628 wrmsrl_safe(0xc0011005, value);
629 rdmsrl(0xc0011005, value); 616 rdmsrl(0xc0011005, value);
630 if (value & (1ULL << 54)) { 617 if (value & BIT_64(54)) {
631 set_cpu_cap(c, X86_FEATURE_TOPOEXT); 618 set_cpu_cap(c, X86_FEATURE_TOPOEXT);
632 printk(KERN_INFO FW_INFO "CPU: Re-enabling " 619 pr_info(FW_INFO "CPU: Re-enabling disabled Topology Extensions Support.\n");
633 "disabled Topology Extensions Support\n");
634 } 620 }
635 } 621 }
636 } 622 }
@@ -709,19 +695,12 @@ static void init_amd(struct cpuinfo_x86 *c)
709 * Disable GART TLB Walk Errors on Fam10h. We do this here 695 * Disable GART TLB Walk Errors on Fam10h. We do this here
710 * because this is always needed when GART is enabled, even in a 696 * because this is always needed when GART is enabled, even in a
711 * kernel which has no MCE support built in. 697 * kernel which has no MCE support built in.
712 * BIOS should disable GartTlbWlk Errors themself. If 698 * BIOS should disable GartTlbWlk Errors already. If
713 * it doesn't do it here as suggested by the BKDG. 699 * it doesn't, do it here as suggested by the BKDG.
714 * 700 *
715 * Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=33012 701 * Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=33012
716 */ 702 */
717 u64 mask; 703 msr_set_bit(MSR_AMD64_MCx_MASK(4), 10);
718 int err;
719
720 err = rdmsrl_safe(MSR_AMD64_MCx_MASK(4), &mask);
721 if (err == 0) {
722 mask |= (1 << 10);
723 wrmsrl_safe(MSR_AMD64_MCx_MASK(4), mask);
724 }
725 704
726 /* 705 /*
727 * On family 10h BIOS may not have properly enabled WC+ support, 706 * On family 10h BIOS may not have properly enabled WC+ support,
@@ -733,10 +712,7 @@ static void init_amd(struct cpuinfo_x86 *c)
733 * NOTE: we want to use the _safe accessors so as not to #GP kvm 712 * NOTE: we want to use the _safe accessors so as not to #GP kvm
734 * guests on older kvm hosts. 713 * guests on older kvm hosts.
735 */ 714 */
736 715 msr_clear_bit(MSR_AMD64_BU_CFG2, 24);
737 rdmsrl_safe(MSR_AMD64_BU_CFG2, &value);
738 value &= ~(1ULL << 24);
739 wrmsrl_safe(MSR_AMD64_BU_CFG2, value);
740 716
741 if (cpu_has_amd_erratum(c, amd_erratum_383)) 717 if (cpu_has_amd_erratum(c, amd_erratum_383))
742 set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH); 718 set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH);
diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c
index 8779edab684e..d8fba5c15fbd 100644
--- a/arch/x86/kernel/cpu/centaur.c
+++ b/arch/x86/kernel/cpu/centaur.c
@@ -8,236 +8,6 @@
8 8
9#include "cpu.h" 9#include "cpu.h"
10 10
11#ifdef CONFIG_X86_OOSTORE
12
13static u32 power2(u32 x)
14{
15 u32 s = 1;
16
17 while (s <= x)
18 s <<= 1;
19
20 return s >>= 1;
21}
22
23
24/*
25 * Set up an actual MCR
26 */
27static void centaur_mcr_insert(int reg, u32 base, u32 size, int key)
28{
29 u32 lo, hi;
30
31 hi = base & ~0xFFF;
32 lo = ~(size-1); /* Size is a power of 2 so this makes a mask */
33 lo &= ~0xFFF; /* Remove the ctrl value bits */
34 lo |= key; /* Attribute we wish to set */
35 wrmsr(reg+MSR_IDT_MCR0, lo, hi);
36 mtrr_centaur_report_mcr(reg, lo, hi); /* Tell the mtrr driver */
37}
38
39/*
40 * Figure what we can cover with MCR's
41 *
42 * Shortcut: We know you can't put 4Gig of RAM on a winchip
43 */
44static u32 ramtop(void)
45{
46 u32 clip = 0xFFFFFFFFUL;
47 u32 top = 0;
48 int i;
49
50 for (i = 0; i < e820.nr_map; i++) {
51 unsigned long start, end;
52
53 if (e820.map[i].addr > 0xFFFFFFFFUL)
54 continue;
55 /*
56 * Don't MCR over reserved space. Ignore the ISA hole
57 * we frob around that catastrophe already
58 */
59 if (e820.map[i].type == E820_RESERVED) {
60 if (e820.map[i].addr >= 0x100000UL &&
61 e820.map[i].addr < clip)
62 clip = e820.map[i].addr;
63 continue;
64 }
65 start = e820.map[i].addr;
66 end = e820.map[i].addr + e820.map[i].size;
67 if (start >= end)
68 continue;
69 if (end > top)
70 top = end;
71 }
72 /*
73 * Everything below 'top' should be RAM except for the ISA hole.
74 * Because of the limited MCR's we want to map NV/ACPI into our
75 * MCR range for gunk in RAM
76 *
77 * Clip might cause us to MCR insufficient RAM but that is an
78 * acceptable failure mode and should only bite obscure boxes with
79 * a VESA hole at 15Mb
80 *
81 * The second case Clip sometimes kicks in is when the EBDA is marked
82 * as reserved. Again we fail safe with reasonable results
83 */
84 if (top > clip)
85 top = clip;
86
87 return top;
88}
89
90/*
91 * Compute a set of MCR's to give maximum coverage
92 */
93static int centaur_mcr_compute(int nr, int key)
94{
95 u32 mem = ramtop();
96 u32 root = power2(mem);
97 u32 base = root;
98 u32 top = root;
99 u32 floor = 0;
100 int ct = 0;
101
102 while (ct < nr) {
103 u32 fspace = 0;
104 u32 high;
105 u32 low;
106
107 /*
108 * Find the largest block we will fill going upwards
109 */
110 high = power2(mem-top);
111
112 /*
113 * Find the largest block we will fill going downwards
114 */
115 low = base/2;
116
117 /*
118 * Don't fill below 1Mb going downwards as there
119 * is an ISA hole in the way.
120 */
121 if (base <= 1024*1024)
122 low = 0;
123
124 /*
125 * See how much space we could cover by filling below
126 * the ISA hole
127 */
128
129 if (floor == 0)
130 fspace = 512*1024;
131 else if (floor == 512*1024)
132 fspace = 128*1024;
133
134 /* And forget ROM space */
135
136 /*
137 * Now install the largest coverage we get
138 */
139 if (fspace > high && fspace > low) {
140 centaur_mcr_insert(ct, floor, fspace, key);
141 floor += fspace;
142 } else if (high > low) {
143 centaur_mcr_insert(ct, top, high, key);
144 top += high;
145 } else if (low > 0) {
146 base -= low;
147 centaur_mcr_insert(ct, base, low, key);
148 } else
149 break;
150 ct++;
151 }
152 /*
153 * We loaded ct values. We now need to set the mask. The caller
154 * must do this bit.
155 */
156 return ct;
157}
158
159static void centaur_create_optimal_mcr(void)
160{
161 int used;
162 int i;
163
164 /*
165 * Allocate up to 6 mcrs to mark as much of ram as possible
166 * as write combining and weak write ordered.
167 *
168 * To experiment with: Linux never uses stack operations for
169 * mmio spaces so we could globally enable stack operation wc
170 *
171 * Load the registers with type 31 - full write combining, all
172 * writes weakly ordered.
173 */
174 used = centaur_mcr_compute(6, 31);
175
176 /*
177 * Wipe unused MCRs
178 */
179 for (i = used; i < 8; i++)
180 wrmsr(MSR_IDT_MCR0+i, 0, 0);
181}
182
183static void winchip2_create_optimal_mcr(void)
184{
185 u32 lo, hi;
186 int used;
187 int i;
188
189 /*
190 * Allocate up to 6 mcrs to mark as much of ram as possible
191 * as write combining, weak store ordered.
192 *
193 * Load the registers with type 25
194 * 8 - weak write ordering
195 * 16 - weak read ordering
196 * 1 - write combining
197 */
198 used = centaur_mcr_compute(6, 25);
199
200 /*
201 * Mark the registers we are using.
202 */
203 rdmsr(MSR_IDT_MCR_CTRL, lo, hi);
204 for (i = 0; i < used; i++)
205 lo |= 1<<(9+i);
206 wrmsr(MSR_IDT_MCR_CTRL, lo, hi);
207
208 /*
209 * Wipe unused MCRs
210 */
211
212 for (i = used; i < 8; i++)
213 wrmsr(MSR_IDT_MCR0+i, 0, 0);
214}
215
216/*
217 * Handle the MCR key on the Winchip 2.
218 */
219static void winchip2_unprotect_mcr(void)
220{
221 u32 lo, hi;
222 u32 key;
223
224 rdmsr(MSR_IDT_MCR_CTRL, lo, hi);
225 lo &= ~0x1C0; /* blank bits 8-6 */
226 key = (lo>>17) & 7;
227 lo |= key<<6; /* replace with unlock key */
228 wrmsr(MSR_IDT_MCR_CTRL, lo, hi);
229}
230
231static void winchip2_protect_mcr(void)
232{
233 u32 lo, hi;
234
235 rdmsr(MSR_IDT_MCR_CTRL, lo, hi);
236 lo &= ~0x1C0; /* blank bits 8-6 */
237 wrmsr(MSR_IDT_MCR_CTRL, lo, hi);
238}
239#endif /* CONFIG_X86_OOSTORE */
240
241#define ACE_PRESENT (1 << 6) 11#define ACE_PRESENT (1 << 6)
242#define ACE_ENABLED (1 << 7) 12#define ACE_ENABLED (1 << 7)
243#define ACE_FCR (1 << 28) /* MSR_VIA_FCR */ 13#define ACE_FCR (1 << 28) /* MSR_VIA_FCR */
@@ -362,20 +132,6 @@ static void init_centaur(struct cpuinfo_x86 *c)
362 fcr_clr = DPDC; 132 fcr_clr = DPDC;
363 printk(KERN_NOTICE "Disabling bugged TSC.\n"); 133 printk(KERN_NOTICE "Disabling bugged TSC.\n");
364 clear_cpu_cap(c, X86_FEATURE_TSC); 134 clear_cpu_cap(c, X86_FEATURE_TSC);
365#ifdef CONFIG_X86_OOSTORE
366 centaur_create_optimal_mcr();
367 /*
368 * Enable:
369 * write combining on non-stack, non-string
370 * write combining on string, all types
371 * weak write ordering
372 *
373 * The C6 original lacks weak read order
374 *
375 * Note 0x120 is write only on Winchip 1
376 */
377 wrmsr(MSR_IDT_MCR_CTRL, 0x01F0001F, 0);
378#endif
379 break; 135 break;
380 case 8: 136 case 8:
381 switch (c->x86_mask) { 137 switch (c->x86_mask) {
@@ -392,40 +148,12 @@ static void init_centaur(struct cpuinfo_x86 *c)
392 fcr_set = ECX8|DSMC|DTLOCK|EMMX|EBRPRED|ERETSTK| 148 fcr_set = ECX8|DSMC|DTLOCK|EMMX|EBRPRED|ERETSTK|
393 E2MMX|EAMD3D; 149 E2MMX|EAMD3D;
394 fcr_clr = DPDC; 150 fcr_clr = DPDC;
395#ifdef CONFIG_X86_OOSTORE
396 winchip2_unprotect_mcr();
397 winchip2_create_optimal_mcr();
398 rdmsr(MSR_IDT_MCR_CTRL, lo, hi);
399 /*
400 * Enable:
401 * write combining on non-stack, non-string
402 * write combining on string, all types
403 * weak write ordering
404 */
405 lo |= 31;
406 wrmsr(MSR_IDT_MCR_CTRL, lo, hi);
407 winchip2_protect_mcr();
408#endif
409 break; 151 break;
410 case 9: 152 case 9:
411 name = "3"; 153 name = "3";
412 fcr_set = ECX8|DSMC|DTLOCK|EMMX|EBRPRED|ERETSTK| 154 fcr_set = ECX8|DSMC|DTLOCK|EMMX|EBRPRED|ERETSTK|
413 E2MMX|EAMD3D; 155 E2MMX|EAMD3D;
414 fcr_clr = DPDC; 156 fcr_clr = DPDC;
415#ifdef CONFIG_X86_OOSTORE
416 winchip2_unprotect_mcr();
417 winchip2_create_optimal_mcr();
418 rdmsr(MSR_IDT_MCR_CTRL, lo, hi);
419 /*
420 * Enable:
421 * write combining on non-stack, non-string
422 * write combining on string, all types
423 * weak write ordering
424 */
425 lo |= 31;
426 wrmsr(MSR_IDT_MCR_CTRL, lo, hi);
427 winchip2_protect_mcr();
428#endif
429 break; 157 break;
430 default: 158 default:
431 name = "??"; 159 name = "??";
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/intel.c b/arch/x86/kernel/cpu/intel.c
index 5cd9bfabd645..897d6201ef10 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -31,11 +31,8 @@ static void early_init_intel(struct cpuinfo_x86 *c)
31 31
32 /* Unmask CPUID levels if masked: */ 32 /* Unmask CPUID levels if masked: */
33 if (c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xd)) { 33 if (c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xd)) {
34 rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable); 34 if (msr_clear_bit(MSR_IA32_MISC_ENABLE,
35 35 MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT) > 0) {
36 if (misc_enable & MSR_IA32_MISC_ENABLE_LIMIT_CPUID) {
37 misc_enable &= ~MSR_IA32_MISC_ENABLE_LIMIT_CPUID;
38 wrmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
39 c->cpuid_level = cpuid_eax(0); 36 c->cpuid_level = cpuid_eax(0);
40 get_cpu_cap(c); 37 get_cpu_cap(c);
41 } 38 }
@@ -129,16 +126,10 @@ static void early_init_intel(struct cpuinfo_x86 *c)
129 * Ingo Molnar reported a Pentium D (model 6) and a Xeon 126 * Ingo Molnar reported a Pentium D (model 6) and a Xeon
130 * (model 2) with the same problem. 127 * (model 2) with the same problem.
131 */ 128 */
132 if (c->x86 == 15) { 129 if (c->x86 == 15)
133 rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable); 130 if (msr_clear_bit(MSR_IA32_MISC_ENABLE,
134 131 MSR_IA32_MISC_ENABLE_FAST_STRING_BIT) > 0)
135 if (misc_enable & MSR_IA32_MISC_ENABLE_FAST_STRING) { 132 pr_info("kmemcheck: Disabling fast string operations\n");
136 printk(KERN_INFO "kmemcheck: Disabling fast string operations\n");
137
138 misc_enable &= ~MSR_IA32_MISC_ENABLE_FAST_STRING;
139 wrmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
140 }
141 }
142#endif 133#endif
143 134
144 /* 135 /*
@@ -195,10 +186,16 @@ static void intel_smp_check(struct cpuinfo_x86 *c)
195 } 186 }
196} 187}
197 188
198static void intel_workarounds(struct cpuinfo_x86 *c) 189static int forcepae;
190static int __init forcepae_setup(char *__unused)
199{ 191{
200 unsigned long lo, hi; 192 forcepae = 1;
193 return 1;
194}
195__setup("forcepae", forcepae_setup);
201 196
197static void intel_workarounds(struct cpuinfo_x86 *c)
198{
202#ifdef CONFIG_X86_F00F_BUG 199#ifdef CONFIG_X86_F00F_BUG
203 /* 200 /*
204 * All current models of Pentium and Pentium with MMX technology CPUs 201 * All current models of Pentium and Pentium with MMX technology CPUs
@@ -225,16 +222,26 @@ static void intel_workarounds(struct cpuinfo_x86 *c)
225 clear_cpu_cap(c, X86_FEATURE_SEP); 222 clear_cpu_cap(c, X86_FEATURE_SEP);
226 223
227 /* 224 /*
225 * PAE CPUID issue: many Pentium M report no PAE but may have a
226 * functionally usable PAE implementation.
227 * Forcefully enable PAE if kernel parameter "forcepae" is present.
228 */
229 if (forcepae) {
230 printk(KERN_WARNING "PAE forced!\n");
231 set_cpu_cap(c, X86_FEATURE_PAE);
232 add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_NOW_UNRELIABLE);
233 }
234
235 /*
228 * P4 Xeon errata 037 workaround. 236 * P4 Xeon errata 037 workaround.
229 * Hardware prefetcher may cause stale data to be loaded into the cache. 237 * Hardware prefetcher may cause stale data to be loaded into the cache.
230 */ 238 */
231 if ((c->x86 == 15) && (c->x86_model == 1) && (c->x86_mask == 1)) { 239 if ((c->x86 == 15) && (c->x86_model == 1) && (c->x86_mask == 1)) {
232 rdmsr(MSR_IA32_MISC_ENABLE, lo, hi); 240 if (msr_set_bit(MSR_IA32_MISC_ENABLE,
233 if ((lo & MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE) == 0) { 241 MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE_BIT)
234 printk (KERN_INFO "CPU: C0 stepping P4 Xeon detected.\n"); 242 > 0) {
235 printk (KERN_INFO "CPU: Disabling hardware prefetching (Errata 037)\n"); 243 pr_info("CPU: C0 stepping P4 Xeon detected.\n");
236 lo |= MSR_IA32_MISC_ENABLE_PREFETCH_DISABLE; 244 pr_info("CPU: Disabling hardware prefetching (Errata 037)\n");
237 wrmsr(MSR_IA32_MISC_ENABLE, lo, hi);
238 } 245 }
239 } 246 }
240 247
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 9f7ca266864a..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>
@@ -26,10 +27,50 @@
26#include <asm/irq_regs.h> 27#include <asm/irq_regs.h>
27#include <asm/i8259.h> 28#include <asm/i8259.h>
28#include <asm/apic.h> 29#include <asm/apic.h>
30#include <asm/timer.h>
29 31
30struct ms_hyperv_info ms_hyperv; 32struct ms_hyperv_info ms_hyperv;
31EXPORT_SYMBOL_GPL(ms_hyperv); 33EXPORT_SYMBOL_GPL(ms_hyperv);
32 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
33static uint32_t __init ms_hyperv_platform(void) 74static uint32_t __init ms_hyperv_platform(void)
34{ 75{
35 u32 eax; 76 u32 eax;
@@ -105,6 +146,11 @@ static void __init ms_hyperv_init_platform(void)
105 146
106 if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE) 147 if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE)
107 clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100); 148 clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100);
149
150#ifdef CONFIG_X86_IO_APIC
151 no_timer_check = 1;
152#endif
153
108} 154}
109 155
110const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { 156const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
@@ -113,41 +159,3 @@ const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
113 .init_platform = ms_hyperv_init_platform, 159 .init_platform = ms_hyperv_init_platform,
114}; 160};
115EXPORT_SYMBOL(x86_hyper_ms_hyperv); 161EXPORT_SYMBOL(x86_hyper_ms_hyperv);
116
117#if IS_ENABLED(CONFIG_HYPERV)
118static int vmbus_irq = -1;
119static irq_handler_t vmbus_isr;
120
121void hv_register_vmbus_handler(int irq, irq_handler_t handler)
122{
123 /*
124 * Setup the IDT for hypervisor callback.
125 */
126 alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, hyperv_callback_vector);
127
128 vmbus_irq = irq;
129 vmbus_isr = handler;
130}
131
132void hyperv_vector_handler(struct pt_regs *regs)
133{
134 struct pt_regs *old_regs = set_irq_regs(regs);
135 struct irq_desc *desc;
136
137 irq_enter();
138 exit_idle();
139
140 desc = irq_to_desc(vmbus_irq);
141
142 if (desc)
143 generic_handle_irq_desc(vmbus_irq, desc);
144
145 irq_exit();
146 set_irq_regs(old_regs);
147}
148#else
149void hv_register_vmbus_handler(int irq, irq_handler_t handler)
150{
151}
152#endif
153EXPORT_SYMBOL_GPL(hv_register_vmbus_handler);
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 79f9f848bee4..ae407f7226c8 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -892,7 +892,6 @@ static void x86_pmu_enable(struct pmu *pmu)
892 * hw_perf_group_sched_in() or x86_pmu_enable() 892 * hw_perf_group_sched_in() or x86_pmu_enable()
893 * 893 *
894 * step1: save events moving to new counters 894 * step1: save events moving to new counters
895 * step2: reprogram moved events into new counters
896 */ 895 */
897 for (i = 0; i < n_running; i++) { 896 for (i = 0; i < n_running; i++) {
898 event = cpuc->event_list[i]; 897 event = cpuc->event_list[i];
@@ -918,6 +917,9 @@ static void x86_pmu_enable(struct pmu *pmu)
918 x86_pmu_stop(event, PERF_EF_UPDATE); 917 x86_pmu_stop(event, PERF_EF_UPDATE);
919 } 918 }
920 919
920 /*
921 * step2: reprogram moved events into new counters
922 */
921 for (i = 0; i < cpuc->n_events; i++) { 923 for (i = 0; i < cpuc->n_events; i++) {
922 event = cpuc->event_list[i]; 924 event = cpuc->event_list[i];
923 hwc = &event->hw; 925 hwc = &event->hw;
@@ -1043,7 +1045,7 @@ static int x86_pmu_add(struct perf_event *event, int flags)
1043 /* 1045 /*
1044 * If group events scheduling transaction was started, 1046 * If group events scheduling transaction was started,
1045 * skip the schedulability test here, it will be performed 1047 * skip the schedulability test here, it will be performed
1046 * at commit time (->commit_txn) as a whole 1048 * at commit time (->commit_txn) as a whole.
1047 */ 1049 */
1048 if (cpuc->group_flag & PERF_EVENT_TXN) 1050 if (cpuc->group_flag & PERF_EVENT_TXN)
1049 goto done_collect; 1051 goto done_collect;
@@ -1058,6 +1060,10 @@ static int x86_pmu_add(struct perf_event *event, int flags)
1058 memcpy(cpuc->assign, assign, n*sizeof(int)); 1060 memcpy(cpuc->assign, assign, n*sizeof(int));
1059 1061
1060done_collect: 1062done_collect:
1063 /*
1064 * Commit the collect_events() state. See x86_pmu_del() and
1065 * x86_pmu_*_txn().
1066 */
1061 cpuc->n_events = n; 1067 cpuc->n_events = n;
1062 cpuc->n_added += n - n0; 1068 cpuc->n_added += n - n0;
1063 cpuc->n_txn += n - n0; 1069 cpuc->n_txn += n - n0;
@@ -1183,28 +1189,38 @@ static void x86_pmu_del(struct perf_event *event, int flags)
1183 * If we're called during a txn, we don't need to do anything. 1189 * If we're called during a txn, we don't need to do anything.
1184 * The events never got scheduled and ->cancel_txn will truncate 1190 * The events never got scheduled and ->cancel_txn will truncate
1185 * the event_list. 1191 * the event_list.
1192 *
1193 * XXX assumes any ->del() called during a TXN will only be on
1194 * an event added during that same TXN.
1186 */ 1195 */
1187 if (cpuc->group_flag & PERF_EVENT_TXN) 1196 if (cpuc->group_flag & PERF_EVENT_TXN)
1188 return; 1197 return;
1189 1198
1199 /*
1200 * Not a TXN, therefore cleanup properly.
1201 */
1190 x86_pmu_stop(event, PERF_EF_UPDATE); 1202 x86_pmu_stop(event, PERF_EF_UPDATE);
1191 1203
1192 for (i = 0; i < cpuc->n_events; i++) { 1204 for (i = 0; i < cpuc->n_events; i++) {
1193 if (event == cpuc->event_list[i]) { 1205 if (event == cpuc->event_list[i])
1206 break;
1207 }
1194 1208
1195 if (i >= cpuc->n_events - cpuc->n_added) 1209 if (WARN_ON_ONCE(i == cpuc->n_events)) /* called ->del() without ->add() ? */
1196 --cpuc->n_added; 1210 return;
1197 1211
1198 if (x86_pmu.put_event_constraints) 1212 /* If we have a newly added event; make sure to decrease n_added. */
1199 x86_pmu.put_event_constraints(cpuc, event); 1213 if (i >= cpuc->n_events - cpuc->n_added)
1214 --cpuc->n_added;
1200 1215
1201 while (++i < cpuc->n_events) 1216 if (x86_pmu.put_event_constraints)
1202 cpuc->event_list[i-1] = cpuc->event_list[i]; 1217 x86_pmu.put_event_constraints(cpuc, event);
1218
1219 /* Delete the array entry. */
1220 while (++i < cpuc->n_events)
1221 cpuc->event_list[i-1] = cpuc->event_list[i];
1222 --cpuc->n_events;
1203 1223
1204 --cpuc->n_events;
1205 break;
1206 }
1207 }
1208 perf_event_update_userpage(event); 1224 perf_event_update_userpage(event);
1209} 1225}
1210 1226
@@ -1598,7 +1614,8 @@ static void x86_pmu_cancel_txn(struct pmu *pmu)
1598{ 1614{
1599 __this_cpu_and(cpu_hw_events.group_flag, ~PERF_EVENT_TXN); 1615 __this_cpu_and(cpu_hw_events.group_flag, ~PERF_EVENT_TXN);
1600 /* 1616 /*
1601 * Truncate the collected events. 1617 * Truncate collected array by the number of events added in this
1618 * transaction. See x86_pmu_add() and x86_pmu_*_txn().
1602 */ 1619 */
1603 __this_cpu_sub(cpu_hw_events.n_added, __this_cpu_read(cpu_hw_events.n_txn)); 1620 __this_cpu_sub(cpu_hw_events.n_added, __this_cpu_read(cpu_hw_events.n_txn));
1604 __this_cpu_sub(cpu_hw_events.n_events, __this_cpu_read(cpu_hw_events.n_txn)); 1621 __this_cpu_sub(cpu_hw_events.n_events, __this_cpu_read(cpu_hw_events.n_txn));
@@ -1609,6 +1626,8 @@ static void x86_pmu_cancel_txn(struct pmu *pmu)
1609 * Commit group events scheduling transaction 1626 * Commit group events scheduling transaction
1610 * Perform the group schedulability test as a whole 1627 * Perform the group schedulability test as a whole
1611 * Return 0 if success 1628 * Return 0 if success
1629 *
1630 * Does not cancel the transaction on failure; expects the caller to do this.
1612 */ 1631 */
1613static int x86_pmu_commit_txn(struct pmu *pmu) 1632static int x86_pmu_commit_txn(struct pmu *pmu)
1614{ 1633{
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
index 4972c244d0bc..3b2f9bdd974b 100644
--- a/arch/x86/kernel/cpu/perf_event.h
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -130,9 +130,11 @@ struct cpu_hw_events {
130 unsigned long running[BITS_TO_LONGS(X86_PMC_IDX_MAX)]; 130 unsigned long running[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
131 int enabled; 131 int enabled;
132 132
133 int n_events; 133 int n_events; /* the # of events in the below arrays */
134 int n_added; 134 int n_added; /* the # last events in the below arrays;
135 int n_txn; 135 they've never been enabled yet */
136 int n_txn; /* the # last events in the below arrays;
137 added in the current transaction */
136 int assign[X86_PMC_IDX_MAX]; /* event to counter assignment */ 138 int assign[X86_PMC_IDX_MAX]; /* event to counter assignment */
137 u64 tags[X86_PMC_IDX_MAX]; 139 u64 tags[X86_PMC_IDX_MAX];
138 struct perf_event *event_list[X86_PMC_IDX_MAX]; /* in enabled order */ 140 struct perf_event *event_list[X86_PMC_IDX_MAX]; /* in enabled order */
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index c88f7f4b03ee..bd2253d40cff 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -66,6 +66,47 @@ DEFINE_UNCORE_FORMAT_ATTR(mask_vnw, mask_vnw, "config2:3-4");
66DEFINE_UNCORE_FORMAT_ATTR(mask0, mask0, "config2:0-31"); 66DEFINE_UNCORE_FORMAT_ATTR(mask0, mask0, "config2:0-31");
67DEFINE_UNCORE_FORMAT_ATTR(mask1, mask1, "config2:32-63"); 67DEFINE_UNCORE_FORMAT_ATTR(mask1, mask1, "config2:32-63");
68 68
69static void uncore_pmu_start_hrtimer(struct intel_uncore_box *box);
70static void uncore_pmu_cancel_hrtimer(struct intel_uncore_box *box);
71static void uncore_perf_event_update(struct intel_uncore_box *box, struct perf_event *event);
72static void uncore_pmu_event_read(struct perf_event *event);
73
74static struct intel_uncore_pmu *uncore_event_to_pmu(struct perf_event *event)
75{
76 return container_of(event->pmu, struct intel_uncore_pmu, pmu);
77}
78
79static struct intel_uncore_box *
80uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu)
81{
82 struct intel_uncore_box *box;
83
84 box = *per_cpu_ptr(pmu->box, cpu);
85 if (box)
86 return box;
87
88 raw_spin_lock(&uncore_box_lock);
89 list_for_each_entry(box, &pmu->box_list, list) {
90 if (box->phys_id == topology_physical_package_id(cpu)) {
91 atomic_inc(&box->refcnt);
92 *per_cpu_ptr(pmu->box, cpu) = box;
93 break;
94 }
95 }
96 raw_spin_unlock(&uncore_box_lock);
97
98 return *per_cpu_ptr(pmu->box, cpu);
99}
100
101static struct intel_uncore_box *uncore_event_to_box(struct perf_event *event)
102{
103 /*
104 * perf core schedules event on the basis of cpu, uncore events are
105 * collected by one of the cpus inside a physical package.
106 */
107 return uncore_pmu_to_box(uncore_event_to_pmu(event), smp_processor_id());
108}
109
69static u64 uncore_msr_read_counter(struct intel_uncore_box *box, struct perf_event *event) 110static u64 uncore_msr_read_counter(struct intel_uncore_box *box, struct perf_event *event)
70{ 111{
71 u64 count; 112 u64 count;
@@ -1639,6 +1680,349 @@ static struct intel_uncore_type *snb_msr_uncores[] = {
1639 &snb_uncore_cbox, 1680 &snb_uncore_cbox,
1640 NULL, 1681 NULL,
1641}; 1682};
1683
1684enum {
1685 SNB_PCI_UNCORE_IMC,
1686};
1687
1688static struct uncore_event_desc snb_uncore_imc_events[] = {
1689 INTEL_UNCORE_EVENT_DESC(data_reads, "event=0x01"),
1690 INTEL_UNCORE_EVENT_DESC(data_reads.scale, "6.103515625e-5"),
1691 INTEL_UNCORE_EVENT_DESC(data_reads.unit, "MiB"),
1692
1693 INTEL_UNCORE_EVENT_DESC(data_writes, "event=0x02"),
1694 INTEL_UNCORE_EVENT_DESC(data_writes.scale, "6.103515625e-5"),
1695 INTEL_UNCORE_EVENT_DESC(data_writes.unit, "MiB"),
1696
1697 { /* end: all zeroes */ },
1698};
1699
1700#define SNB_UNCORE_PCI_IMC_EVENT_MASK 0xff
1701#define SNB_UNCORE_PCI_IMC_BAR_OFFSET 0x48
1702
1703/* page size multiple covering all config regs */
1704#define SNB_UNCORE_PCI_IMC_MAP_SIZE 0x6000
1705
1706#define SNB_UNCORE_PCI_IMC_DATA_READS 0x1
1707#define SNB_UNCORE_PCI_IMC_DATA_READS_BASE 0x5050
1708#define SNB_UNCORE_PCI_IMC_DATA_WRITES 0x2
1709#define SNB_UNCORE_PCI_IMC_DATA_WRITES_BASE 0x5054
1710#define SNB_UNCORE_PCI_IMC_CTR_BASE SNB_UNCORE_PCI_IMC_DATA_READS_BASE
1711
1712static struct attribute *snb_uncore_imc_formats_attr[] = {
1713 &format_attr_event.attr,
1714 NULL,
1715};
1716
1717static struct attribute_group snb_uncore_imc_format_group = {
1718 .name = "format",
1719 .attrs = snb_uncore_imc_formats_attr,
1720};
1721
1722static void snb_uncore_imc_init_box(struct intel_uncore_box *box)
1723{
1724 struct pci_dev *pdev = box->pci_dev;
1725 int where = SNB_UNCORE_PCI_IMC_BAR_OFFSET;
1726 resource_size_t addr;
1727 u32 pci_dword;
1728
1729 pci_read_config_dword(pdev, where, &pci_dword);
1730 addr = pci_dword;
1731
1732#ifdef CONFIG_PHYS_ADDR_T_64BIT
1733 pci_read_config_dword(pdev, where + 4, &pci_dword);
1734 addr |= ((resource_size_t)pci_dword << 32);
1735#endif
1736
1737 addr &= ~(PAGE_SIZE - 1);
1738
1739 box->io_addr = ioremap(addr, SNB_UNCORE_PCI_IMC_MAP_SIZE);
1740 box->hrtimer_duration = UNCORE_SNB_IMC_HRTIMER_INTERVAL;
1741}
1742
1743static void snb_uncore_imc_enable_box(struct intel_uncore_box *box)
1744{}
1745
1746static void snb_uncore_imc_disable_box(struct intel_uncore_box *box)
1747{}
1748
1749static void snb_uncore_imc_enable_event(struct intel_uncore_box *box, struct perf_event *event)
1750{}
1751
1752static void snb_uncore_imc_disable_event(struct intel_uncore_box *box, struct perf_event *event)
1753{}
1754
1755static u64 snb_uncore_imc_read_counter(struct intel_uncore_box *box, struct perf_event *event)
1756{
1757 struct hw_perf_event *hwc = &event->hw;
1758
1759 return (u64)*(unsigned int *)(box->io_addr + hwc->event_base);
1760}
1761
1762/*
1763 * custom event_init() function because we define our own fixed, free
1764 * running counters, so we do not want to conflict with generic uncore
1765 * logic. Also simplifies processing
1766 */
1767static int snb_uncore_imc_event_init(struct perf_event *event)
1768{
1769 struct intel_uncore_pmu *pmu;
1770 struct intel_uncore_box *box;
1771 struct hw_perf_event *hwc = &event->hw;
1772 u64 cfg = event->attr.config & SNB_UNCORE_PCI_IMC_EVENT_MASK;
1773 int idx, base;
1774
1775 if (event->attr.type != event->pmu->type)
1776 return -ENOENT;
1777
1778 pmu = uncore_event_to_pmu(event);
1779 /* no device found for this pmu */
1780 if (pmu->func_id < 0)
1781 return -ENOENT;
1782
1783 /* Sampling not supported yet */
1784 if (hwc->sample_period)
1785 return -EINVAL;
1786
1787 /* unsupported modes and filters */
1788 if (event->attr.exclude_user ||
1789 event->attr.exclude_kernel ||
1790 event->attr.exclude_hv ||
1791 event->attr.exclude_idle ||
1792 event->attr.exclude_host ||
1793 event->attr.exclude_guest ||
1794 event->attr.sample_period) /* no sampling */
1795 return -EINVAL;
1796
1797 /*
1798 * Place all uncore events for a particular physical package
1799 * onto a single cpu
1800 */
1801 if (event->cpu < 0)
1802 return -EINVAL;
1803
1804 /* check only supported bits are set */
1805 if (event->attr.config & ~SNB_UNCORE_PCI_IMC_EVENT_MASK)
1806 return -EINVAL;
1807
1808 box = uncore_pmu_to_box(pmu, event->cpu);
1809 if (!box || box->cpu < 0)
1810 return -EINVAL;
1811
1812 event->cpu = box->cpu;
1813
1814 event->hw.idx = -1;
1815 event->hw.last_tag = ~0ULL;
1816 event->hw.extra_reg.idx = EXTRA_REG_NONE;
1817 event->hw.branch_reg.idx = EXTRA_REG_NONE;
1818 /*
1819 * check event is known (whitelist, determines counter)
1820 */
1821 switch (cfg) {
1822 case SNB_UNCORE_PCI_IMC_DATA_READS:
1823 base = SNB_UNCORE_PCI_IMC_DATA_READS_BASE;
1824 idx = UNCORE_PMC_IDX_FIXED;
1825 break;
1826 case SNB_UNCORE_PCI_IMC_DATA_WRITES:
1827 base = SNB_UNCORE_PCI_IMC_DATA_WRITES_BASE;
1828 idx = UNCORE_PMC_IDX_FIXED + 1;
1829 break;
1830 default:
1831 return -EINVAL;
1832 }
1833
1834 /* must be done before validate_group */
1835 event->hw.event_base = base;
1836 event->hw.config = cfg;
1837 event->hw.idx = idx;
1838
1839 /* no group validation needed, we have free running counters */
1840
1841 return 0;
1842}
1843
1844static int snb_uncore_imc_hw_config(struct intel_uncore_box *box, struct perf_event *event)
1845{
1846 return 0;
1847}
1848
1849static void snb_uncore_imc_event_start(struct perf_event *event, int flags)
1850{
1851 struct intel_uncore_box *box = uncore_event_to_box(event);
1852 u64 count;
1853
1854 if (WARN_ON_ONCE(!(event->hw.state & PERF_HES_STOPPED)))
1855 return;
1856
1857 event->hw.state = 0;
1858 box->n_active++;
1859
1860 list_add_tail(&event->active_entry, &box->active_list);
1861
1862 count = snb_uncore_imc_read_counter(box, event);
1863 local64_set(&event->hw.prev_count, count);
1864
1865 if (box->n_active == 1)
1866 uncore_pmu_start_hrtimer(box);
1867}
1868
1869static void snb_uncore_imc_event_stop(struct perf_event *event, int flags)
1870{
1871 struct intel_uncore_box *box = uncore_event_to_box(event);
1872 struct hw_perf_event *hwc = &event->hw;
1873
1874 if (!(hwc->state & PERF_HES_STOPPED)) {
1875 box->n_active--;
1876
1877 WARN_ON_ONCE(hwc->state & PERF_HES_STOPPED);
1878 hwc->state |= PERF_HES_STOPPED;
1879
1880 list_del(&event->active_entry);
1881
1882 if (box->n_active == 0)
1883 uncore_pmu_cancel_hrtimer(box);
1884 }
1885
1886 if ((flags & PERF_EF_UPDATE) && !(hwc->state & PERF_HES_UPTODATE)) {
1887 /*
1888 * Drain the remaining delta count out of a event
1889 * that we are disabling:
1890 */
1891 uncore_perf_event_update(box, event);
1892 hwc->state |= PERF_HES_UPTODATE;
1893 }
1894}
1895
1896static int snb_uncore_imc_event_add(struct perf_event *event, int flags)
1897{
1898 struct intel_uncore_box *box = uncore_event_to_box(event);
1899 struct hw_perf_event *hwc = &event->hw;
1900
1901 if (!box)
1902 return -ENODEV;
1903
1904 hwc->state = PERF_HES_UPTODATE | PERF_HES_STOPPED;
1905 if (!(flags & PERF_EF_START))
1906 hwc->state |= PERF_HES_ARCH;
1907
1908 snb_uncore_imc_event_start(event, 0);
1909
1910 box->n_events++;
1911
1912 return 0;
1913}
1914
1915static void snb_uncore_imc_event_del(struct perf_event *event, int flags)
1916{
1917 struct intel_uncore_box *box = uncore_event_to_box(event);
1918 int i;
1919
1920 snb_uncore_imc_event_stop(event, PERF_EF_UPDATE);
1921
1922 for (i = 0; i < box->n_events; i++) {
1923 if (event == box->event_list[i]) {
1924 --box->n_events;
1925 break;
1926 }
1927 }
1928}
1929
1930static int snb_pci2phy_map_init(int devid)
1931{
1932 struct pci_dev *dev = NULL;
1933 int bus;
1934
1935 dev = pci_get_device(PCI_VENDOR_ID_INTEL, devid, dev);
1936 if (!dev)
1937 return -ENOTTY;
1938
1939 bus = dev->bus->number;
1940
1941 pcibus_to_physid[bus] = 0;
1942
1943 pci_dev_put(dev);
1944
1945 return 0;
1946}
1947
1948static struct pmu snb_uncore_imc_pmu = {
1949 .task_ctx_nr = perf_invalid_context,
1950 .event_init = snb_uncore_imc_event_init,
1951 .add = snb_uncore_imc_event_add,
1952 .del = snb_uncore_imc_event_del,
1953 .start = snb_uncore_imc_event_start,
1954 .stop = snb_uncore_imc_event_stop,
1955 .read = uncore_pmu_event_read,
1956};
1957
1958static struct intel_uncore_ops snb_uncore_imc_ops = {
1959 .init_box = snb_uncore_imc_init_box,
1960 .enable_box = snb_uncore_imc_enable_box,
1961 .disable_box = snb_uncore_imc_disable_box,
1962 .disable_event = snb_uncore_imc_disable_event,
1963 .enable_event = snb_uncore_imc_enable_event,
1964 .hw_config = snb_uncore_imc_hw_config,
1965 .read_counter = snb_uncore_imc_read_counter,
1966};
1967
1968static struct intel_uncore_type snb_uncore_imc = {
1969 .name = "imc",
1970 .num_counters = 2,
1971 .num_boxes = 1,
1972 .fixed_ctr_bits = 32,
1973 .fixed_ctr = SNB_UNCORE_PCI_IMC_CTR_BASE,
1974 .event_descs = snb_uncore_imc_events,
1975 .format_group = &snb_uncore_imc_format_group,
1976 .perf_ctr = SNB_UNCORE_PCI_IMC_DATA_READS_BASE,
1977 .event_mask = SNB_UNCORE_PCI_IMC_EVENT_MASK,
1978 .ops = &snb_uncore_imc_ops,
1979 .pmu = &snb_uncore_imc_pmu,
1980};
1981
1982static struct intel_uncore_type *snb_pci_uncores[] = {
1983 [SNB_PCI_UNCORE_IMC] = &snb_uncore_imc,
1984 NULL,
1985};
1986
1987static DEFINE_PCI_DEVICE_TABLE(snb_uncore_pci_ids) = {
1988 { /* IMC */
1989 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SNB_IMC),
1990 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
1991 },
1992 { /* end: all zeroes */ },
1993};
1994
1995static DEFINE_PCI_DEVICE_TABLE(ivb_uncore_pci_ids) = {
1996 { /* IMC */
1997 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IVB_IMC),
1998 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
1999 },
2000 { /* end: all zeroes */ },
2001};
2002
2003static DEFINE_PCI_DEVICE_TABLE(hsw_uncore_pci_ids) = {
2004 { /* IMC */
2005 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HSW_IMC),
2006 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
2007 },
2008 { /* end: all zeroes */ },
2009};
2010
2011static struct pci_driver snb_uncore_pci_driver = {
2012 .name = "snb_uncore",
2013 .id_table = snb_uncore_pci_ids,
2014};
2015
2016static struct pci_driver ivb_uncore_pci_driver = {
2017 .name = "ivb_uncore",
2018 .id_table = ivb_uncore_pci_ids,
2019};
2020
2021static struct pci_driver hsw_uncore_pci_driver = {
2022 .name = "hsw_uncore",
2023 .id_table = hsw_uncore_pci_ids,
2024};
2025
1642/* end of Sandy Bridge uncore support */ 2026/* end of Sandy Bridge uncore support */
1643 2027
1644/* Nehalem uncore support */ 2028/* Nehalem uncore support */
@@ -2789,6 +3173,7 @@ again:
2789static enum hrtimer_restart uncore_pmu_hrtimer(struct hrtimer *hrtimer) 3173static enum hrtimer_restart uncore_pmu_hrtimer(struct hrtimer *hrtimer)
2790{ 3174{
2791 struct intel_uncore_box *box; 3175 struct intel_uncore_box *box;
3176 struct perf_event *event;
2792 unsigned long flags; 3177 unsigned long flags;
2793 int bit; 3178 int bit;
2794 3179
@@ -2801,19 +3186,27 @@ static enum hrtimer_restart uncore_pmu_hrtimer(struct hrtimer *hrtimer)
2801 */ 3186 */
2802 local_irq_save(flags); 3187 local_irq_save(flags);
2803 3188
3189 /*
3190 * handle boxes with an active event list as opposed to active
3191 * counters
3192 */
3193 list_for_each_entry(event, &box->active_list, active_entry) {
3194 uncore_perf_event_update(box, event);
3195 }
3196
2804 for_each_set_bit(bit, box->active_mask, UNCORE_PMC_IDX_MAX) 3197 for_each_set_bit(bit, box->active_mask, UNCORE_PMC_IDX_MAX)
2805 uncore_perf_event_update(box, box->events[bit]); 3198 uncore_perf_event_update(box, box->events[bit]);
2806 3199
2807 local_irq_restore(flags); 3200 local_irq_restore(flags);
2808 3201
2809 hrtimer_forward_now(hrtimer, ns_to_ktime(UNCORE_PMU_HRTIMER_INTERVAL)); 3202 hrtimer_forward_now(hrtimer, ns_to_ktime(box->hrtimer_duration));
2810 return HRTIMER_RESTART; 3203 return HRTIMER_RESTART;
2811} 3204}
2812 3205
2813static void uncore_pmu_start_hrtimer(struct intel_uncore_box *box) 3206static void uncore_pmu_start_hrtimer(struct intel_uncore_box *box)
2814{ 3207{
2815 __hrtimer_start_range_ns(&box->hrtimer, 3208 __hrtimer_start_range_ns(&box->hrtimer,
2816 ns_to_ktime(UNCORE_PMU_HRTIMER_INTERVAL), 0, 3209 ns_to_ktime(box->hrtimer_duration), 0,
2817 HRTIMER_MODE_REL_PINNED, 0); 3210 HRTIMER_MODE_REL_PINNED, 0);
2818} 3211}
2819 3212
@@ -2847,43 +3240,12 @@ static struct intel_uncore_box *uncore_alloc_box(struct intel_uncore_type *type,
2847 box->cpu = -1; 3240 box->cpu = -1;
2848 box->phys_id = -1; 3241 box->phys_id = -1;
2849 3242
2850 return box; 3243 /* set default hrtimer timeout */
2851} 3244 box->hrtimer_duration = UNCORE_PMU_HRTIMER_INTERVAL;
2852
2853static struct intel_uncore_box *
2854uncore_pmu_to_box(struct intel_uncore_pmu *pmu, int cpu)
2855{
2856 struct intel_uncore_box *box;
2857
2858 box = *per_cpu_ptr(pmu->box, cpu);
2859 if (box)
2860 return box;
2861
2862 raw_spin_lock(&uncore_box_lock);
2863 list_for_each_entry(box, &pmu->box_list, list) {
2864 if (box->phys_id == topology_physical_package_id(cpu)) {
2865 atomic_inc(&box->refcnt);
2866 *per_cpu_ptr(pmu->box, cpu) = box;
2867 break;
2868 }
2869 }
2870 raw_spin_unlock(&uncore_box_lock);
2871
2872 return *per_cpu_ptr(pmu->box, cpu);
2873}
2874 3245
2875static struct intel_uncore_pmu *uncore_event_to_pmu(struct perf_event *event) 3246 INIT_LIST_HEAD(&box->active_list);
2876{
2877 return container_of(event->pmu, struct intel_uncore_pmu, pmu);
2878}
2879 3247
2880static struct intel_uncore_box *uncore_event_to_box(struct perf_event *event) 3248 return box;
2881{
2882 /*
2883 * perf core schedules event on the basis of cpu, uncore events are
2884 * collected by one of the cpus inside a physical package.
2885 */
2886 return uncore_pmu_to_box(uncore_event_to_pmu(event), smp_processor_id());
2887} 3249}
2888 3250
2889static int 3251static int
@@ -3279,16 +3641,21 @@ static int __init uncore_pmu_register(struct intel_uncore_pmu *pmu)
3279{ 3641{
3280 int ret; 3642 int ret;
3281 3643
3282 pmu->pmu = (struct pmu) { 3644 if (!pmu->type->pmu) {
3283 .attr_groups = pmu->type->attr_groups, 3645 pmu->pmu = (struct pmu) {
3284 .task_ctx_nr = perf_invalid_context, 3646 .attr_groups = pmu->type->attr_groups,
3285 .event_init = uncore_pmu_event_init, 3647 .task_ctx_nr = perf_invalid_context,
3286 .add = uncore_pmu_event_add, 3648 .event_init = uncore_pmu_event_init,
3287 .del = uncore_pmu_event_del, 3649 .add = uncore_pmu_event_add,
3288 .start = uncore_pmu_event_start, 3650 .del = uncore_pmu_event_del,
3289 .stop = uncore_pmu_event_stop, 3651 .start = uncore_pmu_event_start,
3290 .read = uncore_pmu_event_read, 3652 .stop = uncore_pmu_event_stop,
3291 }; 3653 .read = uncore_pmu_event_read,
3654 };
3655 } else {
3656 pmu->pmu = *pmu->type->pmu;
3657 pmu->pmu.attr_groups = pmu->type->attr_groups;
3658 }
3292 3659
3293 if (pmu->type->num_boxes == 1) { 3660 if (pmu->type->num_boxes == 1) {
3294 if (strlen(pmu->type->name) > 0) 3661 if (strlen(pmu->type->name) > 0)
@@ -3334,6 +3701,8 @@ static int __init uncore_type_init(struct intel_uncore_type *type)
3334 if (!pmus) 3701 if (!pmus)
3335 return -ENOMEM; 3702 return -ENOMEM;
3336 3703
3704 type->pmus = pmus;
3705
3337 type->unconstrainted = (struct event_constraint) 3706 type->unconstrainted = (struct event_constraint)
3338 __EVENT_CONSTRAINT(0, (1ULL << type->num_counters) - 1, 3707 __EVENT_CONSTRAINT(0, (1ULL << type->num_counters) - 1,
3339 0, type->num_counters, 0, 0); 3708 0, type->num_counters, 0, 0);
@@ -3369,7 +3738,6 @@ static int __init uncore_type_init(struct intel_uncore_type *type)
3369 } 3738 }
3370 3739
3371 type->pmu_group = &uncore_pmu_attr_group; 3740 type->pmu_group = &uncore_pmu_attr_group;
3372 type->pmus = pmus;
3373 return 0; 3741 return 0;
3374fail: 3742fail:
3375 uncore_type_exit(type); 3743 uncore_type_exit(type);
@@ -3501,6 +3869,28 @@ static int __init uncore_pci_init(void)
3501 pci_uncores = ivt_pci_uncores; 3869 pci_uncores = ivt_pci_uncores;
3502 uncore_pci_driver = &ivt_uncore_pci_driver; 3870 uncore_pci_driver = &ivt_uncore_pci_driver;
3503 break; 3871 break;
3872 case 42: /* Sandy Bridge */
3873 ret = snb_pci2phy_map_init(PCI_DEVICE_ID_INTEL_SNB_IMC);
3874 if (ret)
3875 return ret;
3876 pci_uncores = snb_pci_uncores;
3877 uncore_pci_driver = &snb_uncore_pci_driver;
3878 break;
3879 case 58: /* Ivy Bridge */
3880 ret = snb_pci2phy_map_init(PCI_DEVICE_ID_INTEL_IVB_IMC);
3881 if (ret)
3882 return ret;
3883 pci_uncores = snb_pci_uncores;
3884 uncore_pci_driver = &ivb_uncore_pci_driver;
3885 break;
3886 case 60: /* Haswell */
3887 case 69: /* Haswell Celeron */
3888 ret = snb_pci2phy_map_init(PCI_DEVICE_ID_INTEL_HSW_IMC);
3889 if (ret)
3890 return ret;
3891 pci_uncores = snb_pci_uncores;
3892 uncore_pci_driver = &hsw_uncore_pci_driver;
3893 break;
3504 default: 3894 default:
3505 return 0; 3895 return 0;
3506 } 3896 }
@@ -3772,7 +4162,7 @@ static void __init uncore_cpu_setup(void *dummy)
3772 4162
3773static int __init uncore_cpu_init(void) 4163static int __init uncore_cpu_init(void)
3774{ 4164{
3775 int ret, cpu, max_cores; 4165 int ret, max_cores;
3776 4166
3777 max_cores = boot_cpu_data.x86_max_cores; 4167 max_cores = boot_cpu_data.x86_max_cores;
3778 switch (boot_cpu_data.x86_model) { 4168 switch (boot_cpu_data.x86_model) {
@@ -3816,29 +4206,6 @@ static int __init uncore_cpu_init(void)
3816 if (ret) 4206 if (ret)
3817 return ret; 4207 return ret;
3818 4208
3819 get_online_cpus();
3820
3821 for_each_online_cpu(cpu) {
3822 int i, phys_id = topology_physical_package_id(cpu);
3823
3824 for_each_cpu(i, &uncore_cpu_mask) {
3825 if (phys_id == topology_physical_package_id(i)) {
3826 phys_id = -1;
3827 break;
3828 }
3829 }
3830 if (phys_id < 0)
3831 continue;
3832
3833 uncore_cpu_prepare(cpu, phys_id);
3834 uncore_event_init_cpu(cpu);
3835 }
3836 on_each_cpu(uncore_cpu_setup, NULL, 1);
3837
3838 register_cpu_notifier(&uncore_cpu_nb);
3839
3840 put_online_cpus();
3841
3842 return 0; 4209 return 0;
3843} 4210}
3844 4211
@@ -3867,6 +4234,41 @@ static int __init uncore_pmus_register(void)
3867 return 0; 4234 return 0;
3868} 4235}
3869 4236
4237static void __init uncore_cpumask_init(void)
4238{
4239 int cpu;
4240
4241 /*
4242 * ony invoke once from msr or pci init code
4243 */
4244 if (!cpumask_empty(&uncore_cpu_mask))
4245 return;
4246
4247 get_online_cpus();
4248
4249 for_each_online_cpu(cpu) {
4250 int i, phys_id = topology_physical_package_id(cpu);
4251
4252 for_each_cpu(i, &uncore_cpu_mask) {
4253 if (phys_id == topology_physical_package_id(i)) {
4254 phys_id = -1;
4255 break;
4256 }
4257 }
4258 if (phys_id < 0)
4259 continue;
4260
4261 uncore_cpu_prepare(cpu, phys_id);
4262 uncore_event_init_cpu(cpu);
4263 }
4264 on_each_cpu(uncore_cpu_setup, NULL, 1);
4265
4266 register_cpu_notifier(&uncore_cpu_nb);
4267
4268 put_online_cpus();
4269}
4270
4271
3870static int __init intel_uncore_init(void) 4272static int __init intel_uncore_init(void)
3871{ 4273{
3872 int ret; 4274 int ret;
@@ -3885,6 +4287,7 @@ static int __init intel_uncore_init(void)
3885 uncore_pci_exit(); 4287 uncore_pci_exit();
3886 goto fail; 4288 goto fail;
3887 } 4289 }
4290 uncore_cpumask_init();
3888 4291
3889 uncore_pmus_register(); 4292 uncore_pmus_register();
3890 return 0; 4293 return 0;
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.h b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
index a80ab71a883d..90236f0c94a9 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.h
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
@@ -6,6 +6,7 @@
6 6
7#define UNCORE_PMU_NAME_LEN 32 7#define UNCORE_PMU_NAME_LEN 32
8#define UNCORE_PMU_HRTIMER_INTERVAL (60LL * NSEC_PER_SEC) 8#define UNCORE_PMU_HRTIMER_INTERVAL (60LL * NSEC_PER_SEC)
9#define UNCORE_SNB_IMC_HRTIMER_INTERVAL (5ULL * NSEC_PER_SEC)
9 10
10#define UNCORE_FIXED_EVENT 0xff 11#define UNCORE_FIXED_EVENT 0xff
11#define UNCORE_PMC_IDX_MAX_GENERIC 8 12#define UNCORE_PMC_IDX_MAX_GENERIC 8
@@ -440,6 +441,7 @@ struct intel_uncore_type {
440 struct intel_uncore_ops *ops; 441 struct intel_uncore_ops *ops;
441 struct uncore_event_desc *event_descs; 442 struct uncore_event_desc *event_descs;
442 const struct attribute_group *attr_groups[4]; 443 const struct attribute_group *attr_groups[4];
444 struct pmu *pmu; /* for custom pmu ops */
443}; 445};
444 446
445#define pmu_group attr_groups[0] 447#define pmu_group attr_groups[0]
@@ -488,8 +490,11 @@ struct intel_uncore_box {
488 u64 tags[UNCORE_PMC_IDX_MAX]; 490 u64 tags[UNCORE_PMC_IDX_MAX];
489 struct pci_dev *pci_dev; 491 struct pci_dev *pci_dev;
490 struct intel_uncore_pmu *pmu; 492 struct intel_uncore_pmu *pmu;
493 u64 hrtimer_duration; /* hrtimer timeout for this box */
491 struct hrtimer hrtimer; 494 struct hrtimer hrtimer;
492 struct list_head list; 495 struct list_head list;
496 struct list_head active_list;
497 void *io_addr;
493 struct intel_uncore_extra_reg shared_regs[0]; 498 struct intel_uncore_extra_reg shared_regs[0];
494}; 499};
495 500
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c
index 3486e6660357..5d466b7d8609 100644
--- a/arch/x86/kernel/cpu/perf_event_p4.c
+++ b/arch/x86/kernel/cpu/perf_event_p4.c
@@ -1257,7 +1257,24 @@ again:
1257 pass++; 1257 pass++;
1258 goto again; 1258 goto again;
1259 } 1259 }
1260 1260 /*
1261 * Perf does test runs to see if a whole group can be assigned
1262 * together succesfully. There can be multiple rounds of this.
1263 * Unfortunately, p4_pmu_swap_config_ts touches the hwc->config
1264 * bits, such that the next round of group assignments will
1265 * cause the above p4_should_swap_ts to pass instead of fail.
1266 * This leads to counters exclusive to thread0 being used by
1267 * thread1.
1268 *
1269 * Solve this with a cheap hack, reset the idx back to -1 to
1270 * force a new lookup (p4_next_cntr) to get the right counter
1271 * for the right thread.
1272 *
1273 * This probably doesn't comply with the general spirit of how
1274 * perf wants to work, but P4 is special. :-(
1275 */
1276 if (p4_should_swap_ts(hwc->config, cpu))
1277 hwc->idx = -1;
1261 p4_pmu_swap_config_ts(hwc, cpu); 1278 p4_pmu_swap_config_ts(hwc, cpu);
1262 if (assign) 1279 if (assign)
1263 assign[i] = cntr_idx; 1280 assign[i] = cntr_idx;
@@ -1322,6 +1339,7 @@ static __initconst const struct x86_pmu p4_pmu = {
1322__init int p4_pmu_init(void) 1339__init int p4_pmu_init(void)
1323{ 1340{
1324 unsigned int low, high; 1341 unsigned int low, high;
1342 int i, reg;
1325 1343
1326 /* If we get stripped -- indexing fails */ 1344 /* If we get stripped -- indexing fails */
1327 BUILD_BUG_ON(ARCH_P4_MAX_CCCR > INTEL_PMC_MAX_GENERIC); 1345 BUILD_BUG_ON(ARCH_P4_MAX_CCCR > INTEL_PMC_MAX_GENERIC);
@@ -1340,5 +1358,19 @@ __init int p4_pmu_init(void)
1340 1358
1341 x86_pmu = p4_pmu; 1359 x86_pmu = p4_pmu;
1342 1360
1361 /*
1362 * Even though the counters are configured to interrupt a particular
1363 * logical processor when an overflow happens, testing has shown that
1364 * on kdump kernels (which uses a single cpu), thread1's counter
1365 * continues to run and will report an NMI on thread0. Due to the
1366 * overflow bug, this leads to a stream of unknown NMIs.
1367 *
1368 * Solve this by zero'ing out the registers to mimic a reset.
1369 */
1370 for (i = 0; i < x86_pmu.num_counters; i++) {
1371 reg = x86_pmu_config_addr(i);
1372 wrmsrl_safe(reg, 0ULL);
1373 }
1374
1343 return 0; 1375 return 0;
1344} 1376}
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index a57902efe2d5..507de8066594 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -57,9 +57,7 @@ static void kdump_nmi_callback(int cpu, struct pt_regs *regs)
57{ 57{
58#ifdef CONFIG_X86_32 58#ifdef CONFIG_X86_32
59 struct pt_regs fixed_regs; 59 struct pt_regs fixed_regs;
60#endif
61 60
62#ifdef CONFIG_X86_32
63 if (!user_mode_vm(regs)) { 61 if (!user_mode_vm(regs)) {
64 crash_fixup_ss_esp(&fixed_regs, regs); 62 crash_fixup_ss_esp(&fixed_regs, regs);
65 regs = &fixed_regs; 63 regs = &fixed_regs;
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index f2a1770ca176..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;
@@ -30,7 +53,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
30 unsigned long dummy; 53 unsigned long dummy;
31 54
32 stack = &dummy; 55 stack = &dummy;
33 if (task && task != current) 56 if (task != current)
34 stack = (unsigned long *)task->thread.sp; 57 stack = (unsigned long *)task->thread.sp;
35 } 58 }
36 59
@@ -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/head_32.S b/arch/x86/kernel/head_32.S
index 81ba27679f18..f36bd42d6f0c 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -544,6 +544,10 @@ ENDPROC(early_idt_handlers)
544 /* This is global to keep gas from relaxing the jumps */ 544 /* This is global to keep gas from relaxing the jumps */
545ENTRY(early_idt_handler) 545ENTRY(early_idt_handler)
546 cld 546 cld
547
548 cmpl $2,(%esp) # X86_TRAP_NMI
549 je is_nmi # Ignore NMI
550
547 cmpl $2,%ss:early_recursion_flag 551 cmpl $2,%ss:early_recursion_flag
548 je hlt_loop 552 je hlt_loop
549 incl %ss:early_recursion_flag 553 incl %ss:early_recursion_flag
@@ -594,8 +598,9 @@ ex_entry:
594 pop %edx 598 pop %edx
595 pop %ecx 599 pop %ecx
596 pop %eax 600 pop %eax
597 addl $8,%esp /* drop vector number and error code */
598 decl %ss:early_recursion_flag 601 decl %ss:early_recursion_flag
602is_nmi:
603 addl $8,%esp /* drop vector number and error code */
599 iret 604 iret
600ENDPROC(early_idt_handler) 605ENDPROC(early_idt_handler)
601 606
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index e1aabdb314c8..a468c0a65c42 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -343,6 +343,9 @@ early_idt_handlers:
343ENTRY(early_idt_handler) 343ENTRY(early_idt_handler)
344 cld 344 cld
345 345
346 cmpl $2,(%rsp) # X86_TRAP_NMI
347 je is_nmi # Ignore NMI
348
346 cmpl $2,early_recursion_flag(%rip) 349 cmpl $2,early_recursion_flag(%rip)
347 jz 1f 350 jz 1f
348 incl early_recursion_flag(%rip) 351 incl early_recursion_flag(%rip)
@@ -405,8 +408,9 @@ ENTRY(early_idt_handler)
405 popq %rdx 408 popq %rdx
406 popq %rcx 409 popq %rcx
407 popq %rax 410 popq %rax
408 addq $16,%rsp # drop vector number and error code
409 decl early_recursion_flag(%rip) 411 decl early_recursion_flag(%rip)
412is_nmi:
413 addq $16,%rsp # drop vector number and error code
410 INTERRUPT_RETURN 414 INTERRUPT_RETURN
411ENDPROC(early_idt_handler) 415ENDPROC(early_idt_handler)
412 416
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/i387.c b/arch/x86/kernel/i387.c
index e8368c6dd2a2..d5dd80814419 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -86,10 +86,19 @@ EXPORT_SYMBOL(__kernel_fpu_begin);
86 86
87void __kernel_fpu_end(void) 87void __kernel_fpu_end(void)
88{ 88{
89 if (use_eager_fpu()) 89 if (use_eager_fpu()) {
90 math_state_restore(); 90 /*
91 else 91 * For eager fpu, most the time, tsk_used_math() is true.
92 * Restore the user math as we are done with the kernel usage.
93 * At few instances during thread exit, signal handling etc,
94 * tsk_used_math() is false. Those few places will take proper
95 * actions, so we don't need to restore the math here.
96 */
97 if (likely(tsk_used_math(current)))
98 math_state_restore();
99 } else {
92 stts(); 100 stts();
101 }
93} 102}
94EXPORT_SYMBOL(__kernel_fpu_end); 103EXPORT_SYMBOL(__kernel_fpu_end);
95 104
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/module.c b/arch/x86/kernel/module.c
index 18be189368bb..e69f9882bf95 100644
--- a/arch/x86/kernel/module.c
+++ b/arch/x86/kernel/module.c
@@ -28,6 +28,7 @@
28#include <linux/mm.h> 28#include <linux/mm.h>
29#include <linux/gfp.h> 29#include <linux/gfp.h>
30#include <linux/jump_label.h> 30#include <linux/jump_label.h>
31#include <linux/random.h>
31 32
32#include <asm/page.h> 33#include <asm/page.h>
33#include <asm/pgtable.h> 34#include <asm/pgtable.h>
@@ -43,13 +44,52 @@ do { \
43} while (0) 44} while (0)
44#endif 45#endif
45 46
47#ifdef CONFIG_RANDOMIZE_BASE
48static unsigned long module_load_offset;
49static int randomize_modules = 1;
50
51/* Mutex protects the module_load_offset. */
52static DEFINE_MUTEX(module_kaslr_mutex);
53
54static int __init parse_nokaslr(char *p)
55{
56 randomize_modules = 0;
57 return 0;
58}
59early_param("nokaslr", parse_nokaslr);
60
61static unsigned long int get_module_load_offset(void)
62{
63 if (randomize_modules) {
64 mutex_lock(&module_kaslr_mutex);
65 /*
66 * Calculate the module_load_offset the first time this
67 * code is called. Once calculated it stays the same until
68 * reboot.
69 */
70 if (module_load_offset == 0)
71 module_load_offset =
72 (get_random_int() % 1024 + 1) * PAGE_SIZE;
73 mutex_unlock(&module_kaslr_mutex);
74 }
75 return module_load_offset;
76}
77#else
78static unsigned long int get_module_load_offset(void)
79{
80 return 0;
81}
82#endif
83
46void *module_alloc(unsigned long size) 84void *module_alloc(unsigned long size)
47{ 85{
48 if (PAGE_ALIGN(size) > MODULES_LEN) 86 if (PAGE_ALIGN(size) > MODULES_LEN)
49 return NULL; 87 return NULL;
50 return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, 88 return __vmalloc_node_range(size, 1,
51 GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL_EXEC, 89 MODULES_VADDR + get_module_load_offset(),
52 NUMA_NO_NODE, __builtin_return_address(0)); 90 MODULES_END, GFP_KERNEL | __GFP_HIGHMEM,
91 PAGE_KERNEL_EXEC, NUMA_NO_NODE,
92 __builtin_return_address(0));
53} 93}
54 94
55#ifdef CONFIG_X86_32 95#ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index 6fcb49ce50a1..b4872b999a71 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -87,6 +87,7 @@ __setup("unknown_nmi_panic", setup_unknown_nmi_panic);
87#define nmi_to_desc(type) (&nmi_desc[type]) 87#define nmi_to_desc(type) (&nmi_desc[type])
88 88
89static u64 nmi_longest_ns = 1 * NSEC_PER_MSEC; 89static u64 nmi_longest_ns = 1 * NSEC_PER_MSEC;
90
90static int __init nmi_warning_debugfs(void) 91static int __init nmi_warning_debugfs(void)
91{ 92{
92 debugfs_create_u64("nmi_longest_ns", 0644, 93 debugfs_create_u64("nmi_longest_ns", 0644,
@@ -95,6 +96,20 @@ static int __init nmi_warning_debugfs(void)
95} 96}
96fs_initcall(nmi_warning_debugfs); 97fs_initcall(nmi_warning_debugfs);
97 98
99static void nmi_max_handler(struct irq_work *w)
100{
101 struct nmiaction *a = container_of(w, struct nmiaction, irq_work);
102 int remainder_ns, decimal_msecs;
103 u64 whole_msecs = ACCESS_ONCE(a->max_duration);
104
105 remainder_ns = do_div(whole_msecs, (1000 * 1000));
106 decimal_msecs = remainder_ns / 1000;
107
108 printk_ratelimited(KERN_INFO
109 "INFO: NMI handler (%ps) took too long to run: %lld.%03d msecs\n",
110 a->handler, whole_msecs, decimal_msecs);
111}
112
98static int __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2b) 113static int __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2b)
99{ 114{
100 struct nmi_desc *desc = nmi_to_desc(type); 115 struct nmi_desc *desc = nmi_to_desc(type);
@@ -110,26 +125,20 @@ static int __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2
110 * to handle those situations. 125 * to handle those situations.
111 */ 126 */
112 list_for_each_entry_rcu(a, &desc->head, list) { 127 list_for_each_entry_rcu(a, &desc->head, list) {
113 u64 before, delta, whole_msecs; 128 int thishandled;
114 int remainder_ns, decimal_msecs, thishandled; 129 u64 delta;
115 130
116 before = sched_clock(); 131 delta = sched_clock();
117 thishandled = a->handler(type, regs); 132 thishandled = a->handler(type, regs);
118 handled += thishandled; 133 handled += thishandled;
119 delta = sched_clock() - before; 134 delta = sched_clock() - delta;
120 trace_nmi_handler(a->handler, (int)delta, thishandled); 135 trace_nmi_handler(a->handler, (int)delta, thishandled);
121 136
122 if (delta < nmi_longest_ns) 137 if (delta < nmi_longest_ns || delta < a->max_duration)
123 continue; 138 continue;
124 139
125 nmi_longest_ns = delta; 140 a->max_duration = delta;
126 whole_msecs = delta; 141 irq_work_queue(&a->irq_work);
127 remainder_ns = do_div(whole_msecs, (1000 * 1000));
128 decimal_msecs = remainder_ns / 1000;
129 printk_ratelimited(KERN_INFO
130 "INFO: NMI handler (%ps) took too long to run: "
131 "%lld.%03d msecs\n", a->handler, whole_msecs,
132 decimal_msecs);
133 } 142 }
134 143
135 rcu_read_unlock(); 144 rcu_read_unlock();
@@ -146,6 +155,8 @@ int __register_nmi_handler(unsigned int type, struct nmiaction *action)
146 if (!action->handler) 155 if (!action->handler)
147 return -EINVAL; 156 return -EINVAL;
148 157
158 init_irq_work(&action->irq_work, nmi_max_handler);
159
149 spin_lock_irqsave(&desc->lock, flags); 160 spin_lock_irqsave(&desc->lock, flags);
150 161
151 /* 162 /*
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 3fb8d95ab8b5..4505e2a950d8 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -298,10 +298,7 @@ void arch_cpu_idle_dead(void)
298 */ 298 */
299void arch_cpu_idle(void) 299void arch_cpu_idle(void)
300{ 300{
301 if (cpuidle_idle_call()) 301 x86_idle();
302 x86_idle();
303 else
304 local_irq_enable();
305} 302}
306 303
307/* 304/*
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/quirks.c b/arch/x86/kernel/quirks.c
index 7c6acd4b8995..ff898bbf579d 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -529,7 +529,7 @@ static void quirk_amd_nb_node(struct pci_dev *dev)
529 return; 529 return;
530 530
531 pci_read_config_dword(nb_ht, 0x60, &val); 531 pci_read_config_dword(nb_ht, 0x60, &val);
532 node = val & 7; 532 node = pcibus_to_node(dev->bus) | (val & 7);
533 /* 533 /*
534 * Some hardware may return an invalid node ID, 534 * Some hardware may return an invalid node ID,
535 * so check it first: 535 * so check it first:
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/setup.c b/arch/x86/kernel/setup.c
index 06853e670354..fa511acff7e6 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -926,11 +926,11 @@ void __init setup_arch(char **cmdline_p)
926#ifdef CONFIG_EFI 926#ifdef CONFIG_EFI
927 if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, 927 if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
928 "EL32", 4)) { 928 "EL32", 4)) {
929 set_bit(EFI_BOOT, &x86_efi_facility); 929 set_bit(EFI_BOOT, &efi.flags);
930 } else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, 930 } else if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
931 "EL64", 4)) { 931 "EL64", 4)) {
932 set_bit(EFI_BOOT, &x86_efi_facility); 932 set_bit(EFI_BOOT, &efi.flags);
933 set_bit(EFI_64BIT, &x86_efi_facility); 933 set_bit(EFI_64BIT, &efi.flags);
934 } 934 }
935 935
936 if (efi_enabled(EFI_BOOT)) 936 if (efi_enabled(EFI_BOOT))
@@ -1239,14 +1239,8 @@ void __init setup_arch(char **cmdline_p)
1239 register_refined_jiffies(CLOCK_TICK_RATE); 1239 register_refined_jiffies(CLOCK_TICK_RATE);
1240 1240
1241#ifdef CONFIG_EFI 1241#ifdef CONFIG_EFI
1242 /* Once setup is done above, unmap the EFI memory map on 1242 if (efi_enabled(EFI_BOOT))
1243 * mismatched firmware/kernel archtectures since there is no 1243 efi_apply_memmap_quirks();
1244 * support for runtime services.
1245 */
1246 if (efi_enabled(EFI_BOOT) && !efi_is_native()) {
1247 pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n");
1248 efi_unmap_memmap();
1249 }
1250#endif 1244#endif
1251} 1245}
1252 1246
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index a32da804252e..34826934d4a7 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -122,8 +122,9 @@ static void smp_callin(void)
122 * Since CPU0 is not wakened up by INIT, it doesn't wait for the IPI. 122 * Since CPU0 is not wakened up by INIT, it doesn't wait for the IPI.
123 */ 123 */
124 cpuid = smp_processor_id(); 124 cpuid = smp_processor_id();
125 if (apic->wait_for_init_deassert && cpuid != 0) 125 if (apic->wait_for_init_deassert && cpuid)
126 apic->wait_for_init_deassert(&init_deasserted); 126 while (!atomic_read(&init_deasserted))
127 cpu_relax();
127 128
128 /* 129 /*
129 * (This works even if the APIC is not enabled.) 130 * (This works even if the APIC is not enabled.)
@@ -701,11 +702,15 @@ wakeup_cpu_via_init_nmi(int cpu, unsigned long start_ip, int apicid,
701 int id; 702 int id;
702 int boot_error; 703 int boot_error;
703 704
705 preempt_disable();
706
704 /* 707 /*
705 * Wake up AP by INIT, INIT, STARTUP sequence. 708 * Wake up AP by INIT, INIT, STARTUP sequence.
706 */ 709 */
707 if (cpu) 710 if (cpu) {
708 return wakeup_secondary_cpu_via_init(apicid, start_ip); 711 boot_error = wakeup_secondary_cpu_via_init(apicid, start_ip);
712 goto out;
713 }
709 714
710 /* 715 /*
711 * Wake up BSP by nmi. 716 * Wake up BSP by nmi.
@@ -725,6 +730,9 @@ wakeup_cpu_via_init_nmi(int cpu, unsigned long start_ip, int apicid,
725 boot_error = wakeup_secondary_cpu_via_nmi(id, start_ip); 730 boot_error = wakeup_secondary_cpu_via_nmi(id, start_ip);
726 } 731 }
727 732
733out:
734 preempt_enable();
735
728 return boot_error; 736 return boot_error;
729} 737}
730 738
@@ -758,10 +766,10 @@ static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
758#else 766#else
759 clear_tsk_thread_flag(idle, TIF_FORK); 767 clear_tsk_thread_flag(idle, TIF_FORK);
760 initial_gs = per_cpu_offset(cpu); 768 initial_gs = per_cpu_offset(cpu);
769#endif
761 per_cpu(kernel_stack, cpu) = 770 per_cpu(kernel_stack, cpu) =
762 (unsigned long)task_stack_page(idle) - 771 (unsigned long)task_stack_page(idle) -
763 KERNEL_STACK_OFFSET + THREAD_SIZE; 772 KERNEL_STACK_OFFSET + THREAD_SIZE;
764#endif
765 early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu); 773 early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu);
766 initial_code = (unsigned long)start_secondary; 774 initial_code = (unsigned long)start_secondary;
767 stack_start = idle->thread.sp; 775 stack_start = idle->thread.sp;
@@ -1379,7 +1387,7 @@ static inline void mwait_play_dead(void)
1379 1387
1380 if (!this_cpu_has(X86_FEATURE_MWAIT)) 1388 if (!this_cpu_has(X86_FEATURE_MWAIT))
1381 return; 1389 return;
1382 if (!this_cpu_has(X86_FEATURE_CLFLSH)) 1390 if (!this_cpu_has(X86_FEATURE_CLFLUSH))
1383 return; 1391 return;
1384 if (__this_cpu_read(cpu_info.cpuid_level) < CPUID_MWAIT_LEAF) 1392 if (__this_cpu_read(cpu_info.cpuid_level) < CPUID_MWAIT_LEAF)
1385 return; 1393 return;
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
index 24d3c91e9812..bf7ef5ce29df 100644
--- a/arch/x86/kernel/time.c
+++ b/arch/x86/kernel/time.c
@@ -23,7 +23,7 @@
23#include <asm/time.h> 23#include <asm/time.h>
24 24
25#ifdef CONFIG_X86_64 25#ifdef CONFIG_X86_64
26DEFINE_VVAR(volatile unsigned long, jiffies) = INITIAL_JIFFIES; 26__visible DEFINE_VVAR(volatile unsigned long, jiffies) = INITIAL_JIFFIES;
27#endif 27#endif
28 28
29unsigned long profile_pc(struct pt_regs *regs) 29unsigned long profile_pc(struct pt_regs *regs)
@@ -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/kernel/tsc.c b/arch/x86/kernel/tsc.c
index cfbe99f88830..7a9296ab8834 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -914,8 +914,7 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
914 tsc_khz_ref = tsc_khz; 914 tsc_khz_ref = tsc_khz;
915 } 915 }
916 if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) || 916 if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) ||
917 (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) || 917 (val == CPUFREQ_POSTCHANGE && freq->old > freq->new)) {
918 (val == CPUFREQ_RESUMECHANGE)) {
919 *lpj = cpufreq_scale(loops_per_jiffy_ref, ref_freq, freq->new); 918 *lpj = cpufreq_scale(loops_per_jiffy_ref, ref_freq, freq->new);
920 919
921 tsc_khz = cpufreq_scale(tsc_khz_ref, ref_freq, freq->new); 920 tsc_khz = cpufreq_scale(tsc_khz_ref, ref_freq, freq->new);
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/kvm/svm.c b/arch/x86/kvm/svm.c
index e81df8fce027..2de1bc09a8d4 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -3002,10 +3002,8 @@ static int cr8_write_interception(struct vcpu_svm *svm)
3002 u8 cr8_prev = kvm_get_cr8(&svm->vcpu); 3002 u8 cr8_prev = kvm_get_cr8(&svm->vcpu);
3003 /* instruction emulation calls kvm_set_cr8() */ 3003 /* instruction emulation calls kvm_set_cr8() */
3004 r = cr_interception(svm); 3004 r = cr_interception(svm);
3005 if (irqchip_in_kernel(svm->vcpu.kvm)) { 3005 if (irqchip_in_kernel(svm->vcpu.kvm))
3006 clr_cr_intercept(svm, INTERCEPT_CR8_WRITE);
3007 return r; 3006 return r;
3008 }
3009 if (cr8_prev <= kvm_get_cr8(&svm->vcpu)) 3007 if (cr8_prev <= kvm_get_cr8(&svm->vcpu))
3010 return r; 3008 return r;
3011 kvm_run->exit_reason = KVM_EXIT_SET_TPR; 3009 kvm_run->exit_reason = KVM_EXIT_SET_TPR;
@@ -3567,6 +3565,8 @@ static void update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr)
3567 if (is_guest_mode(vcpu) && (vcpu->arch.hflags & HF_VINTR_MASK)) 3565 if (is_guest_mode(vcpu) && (vcpu->arch.hflags & HF_VINTR_MASK))
3568 return; 3566 return;
3569 3567
3568 clr_cr_intercept(svm, INTERCEPT_CR8_WRITE);
3569
3570 if (irr == -1) 3570 if (irr == -1)
3571 return; 3571 return;
3572 3572
diff --git a/arch/x86/lib/hash.c b/arch/x86/lib/hash.c
index 3056702e81fb..ff4fa51a5b1f 100644
--- a/arch/x86/lib/hash.c
+++ b/arch/x86/lib/hash.c
@@ -32,6 +32,7 @@
32 */ 32 */
33 33
34#include <linux/hash.h> 34#include <linux/hash.h>
35#include <linux/init.h>
35 36
36#include <asm/processor.h> 37#include <asm/processor.h>
37#include <asm/cpufeature.h> 38#include <asm/cpufeature.h>
@@ -39,7 +40,11 @@
39 40
40static inline u32 crc32_u32(u32 crc, u32 val) 41static inline u32 crc32_u32(u32 crc, u32 val)
41{ 42{
43#ifdef CONFIG_AS_CRC32
42 asm ("crc32l %1,%0\n" : "+r" (crc) : "rm" (val)); 44 asm ("crc32l %1,%0\n" : "+r" (crc) : "rm" (val));
45#else
46 asm (".byte 0xf2, 0x0f, 0x38, 0xf1, 0xc1" : "+a" (crc) : "c" (val));
47#endif
43 return crc; 48 return crc;
44} 49}
45 50
@@ -49,19 +54,18 @@ static u32 intel_crc4_2_hash(const void *data, u32 len, u32 seed)
49 u32 i, tmp = 0; 54 u32 i, tmp = 0;
50 55
51 for (i = 0; i < len / 4; i++) 56 for (i = 0; i < len / 4; i++)
52 seed = crc32_u32(*p32++, seed); 57 seed = crc32_u32(seed, *p32++);
53 58
54 switch (3 - (len & 0x03)) { 59 switch (len & 3) {
55 case 0: 60 case 3:
56 tmp |= *((const u8 *) p32 + 2) << 16; 61 tmp |= *((const u8 *) p32 + 2) << 16;
57 /* fallthrough */ 62 /* fallthrough */
58 case 1: 63 case 2:
59 tmp |= *((const u8 *) p32 + 1) << 8; 64 tmp |= *((const u8 *) p32 + 1) << 8;
60 /* fallthrough */ 65 /* fallthrough */
61 case 2: 66 case 1:
62 tmp |= *((const u8 *) p32); 67 tmp |= *((const u8 *) p32);
63 seed = crc32_u32(tmp, seed); 68 seed = crc32_u32(seed, tmp);
64 default:
65 break; 69 break;
66 } 70 }
67 71
@@ -74,12 +78,12 @@ static u32 intel_crc4_2_hash2(const u32 *data, u32 len, u32 seed)
74 u32 i; 78 u32 i;
75 79
76 for (i = 0; i < len; i++) 80 for (i = 0; i < len; i++)
77 seed = crc32_u32(*p32++, seed); 81 seed = crc32_u32(seed, *p32++);
78 82
79 return seed; 83 return seed;
80} 84}
81 85
82void setup_arch_fast_hash(struct fast_hash_ops *ops) 86void __init setup_arch_fast_hash(struct fast_hash_ops *ops)
83{ 87{
84 if (cpu_has_xmm4_2) { 88 if (cpu_has_xmm4_2) {
85 ops->hash = intel_crc4_2_hash; 89 ops->hash = intel_crc4_2_hash;
diff --git a/arch/x86/lib/memcpy_32.c b/arch/x86/lib/memcpy_32.c
index e78761d6b7f8..a404b4b75533 100644
--- a/arch/x86/lib/memcpy_32.c
+++ b/arch/x86/lib/memcpy_32.c
@@ -4,7 +4,7 @@
4#undef memcpy 4#undef memcpy
5#undef memset 5#undef memset
6 6
7void *memcpy(void *to, const void *from, size_t n) 7__visible void *memcpy(void *to, const void *from, size_t n)
8{ 8{
9#ifdef CONFIG_X86_USE_3DNOW 9#ifdef CONFIG_X86_USE_3DNOW
10 return __memcpy3d(to, from, n); 10 return __memcpy3d(to, from, n);
@@ -14,13 +14,13 @@ void *memcpy(void *to, const void *from, size_t n)
14} 14}
15EXPORT_SYMBOL(memcpy); 15EXPORT_SYMBOL(memcpy);
16 16
17void *memset(void *s, int c, size_t count) 17__visible void *memset(void *s, int c, size_t count)
18{ 18{
19 return __memset(s, c, count); 19 return __memset(s, c, count);
20} 20}
21EXPORT_SYMBOL(memset); 21EXPORT_SYMBOL(memset);
22 22
23void *memmove(void *dest, const void *src, size_t n) 23__visible void *memmove(void *dest, const void *src, size_t n)
24{ 24{
25 int d0,d1,d2,d3,d4,d5; 25 int d0,d1,d2,d3,d4,d5;
26 char *ret = dest; 26 char *ret = dest;
diff --git a/arch/x86/lib/msr.c b/arch/x86/lib/msr.c
index 8f8eebdca7d4..db9db446b71a 100644
--- a/arch/x86/lib/msr.c
+++ b/arch/x86/lib/msr.c
@@ -8,7 +8,7 @@ struct msr *msrs_alloc(void)
8 8
9 msrs = alloc_percpu(struct msr); 9 msrs = alloc_percpu(struct msr);
10 if (!msrs) { 10 if (!msrs) {
11 pr_warning("%s: error allocating msrs\n", __func__); 11 pr_warn("%s: error allocating msrs\n", __func__);
12 return NULL; 12 return NULL;
13 } 13 }
14 14
@@ -21,3 +21,90 @@ void msrs_free(struct msr *msrs)
21 free_percpu(msrs); 21 free_percpu(msrs);
22} 22}
23EXPORT_SYMBOL(msrs_free); 23EXPORT_SYMBOL(msrs_free);
24
25/**
26 * Read an MSR with error handling
27 *
28 * @msr: MSR to read
29 * @m: value to read into
30 *
31 * It returns read data only on success, otherwise it doesn't change the output
32 * argument @m.
33 *
34 */
35int msr_read(u32 msr, struct msr *m)
36{
37 int err;
38 u64 val;
39
40 err = rdmsrl_safe(msr, &val);
41 if (!err)
42 m->q = val;
43
44 return err;
45}
46
47/**
48 * Write an MSR with error handling
49 *
50 * @msr: MSR to write
51 * @m: value to write
52 */
53int msr_write(u32 msr, struct msr *m)
54{
55 return wrmsrl_safe(msr, m->q);
56}
57
58static inline int __flip_bit(u32 msr, u8 bit, bool set)
59{
60 struct msr m, m1;
61 int err = -EINVAL;
62
63 if (bit > 63)
64 return err;
65
66 err = msr_read(msr, &m);
67 if (err)
68 return err;
69
70 m1 = m;
71 if (set)
72 m1.q |= BIT_64(bit);
73 else
74 m1.q &= ~BIT_64(bit);
75
76 if (m1.q == m.q)
77 return 0;
78
79 err = msr_write(msr, &m);
80 if (err)
81 return err;
82
83 return 1;
84}
85
86/**
87 * Set @bit in a MSR @msr.
88 *
89 * Retval:
90 * < 0: An error was encountered.
91 * = 0: Bit was already set.
92 * > 0: Hardware accepted the MSR write.
93 */
94int msr_set_bit(u32 msr, u8 bit)
95{
96 return __flip_bit(msr, bit, true);
97}
98
99/**
100 * Clear @bit in a MSR @msr.
101 *
102 * Retval:
103 * < 0: An error was encountered.
104 * = 0: Bit was already cleared.
105 * > 0: Hardware accepted the MSR write.
106 */
107int msr_clear_bit(u32 msr, u8 bit)
108{
109 return __flip_bit(msr, bit, false);
110}
diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
index 0002a3a33081..20621d753d5f 100644
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -30,6 +30,7 @@ struct pg_state {
30 unsigned long start_address; 30 unsigned long start_address;
31 unsigned long current_address; 31 unsigned long current_address;
32 const struct addr_marker *marker; 32 const struct addr_marker *marker;
33 bool to_dmesg;
33}; 34};
34 35
35struct addr_marker { 36struct addr_marker {
@@ -88,10 +89,28 @@ static struct addr_marker address_markers[] = {
88#define PUD_LEVEL_MULT (PTRS_PER_PMD * PMD_LEVEL_MULT) 89#define PUD_LEVEL_MULT (PTRS_PER_PMD * PMD_LEVEL_MULT)
89#define PGD_LEVEL_MULT (PTRS_PER_PUD * PUD_LEVEL_MULT) 90#define PGD_LEVEL_MULT (PTRS_PER_PUD * PUD_LEVEL_MULT)
90 91
92#define pt_dump_seq_printf(m, to_dmesg, fmt, args...) \
93({ \
94 if (to_dmesg) \
95 printk(KERN_INFO fmt, ##args); \
96 else \
97 if (m) \
98 seq_printf(m, fmt, ##args); \
99})
100
101#define pt_dump_cont_printf(m, to_dmesg, fmt, args...) \
102({ \
103 if (to_dmesg) \
104 printk(KERN_CONT fmt, ##args); \
105 else \
106 if (m) \
107 seq_printf(m, fmt, ##args); \
108})
109
91/* 110/*
92 * Print a readable form of a pgprot_t to the seq_file 111 * Print a readable form of a pgprot_t to the seq_file
93 */ 112 */
94static void printk_prot(struct seq_file *m, pgprot_t prot, int level) 113static void printk_prot(struct seq_file *m, pgprot_t prot, int level, bool dmsg)
95{ 114{
96 pgprotval_t pr = pgprot_val(prot); 115 pgprotval_t pr = pgprot_val(prot);
97 static const char * const level_name[] = 116 static const char * const level_name[] =
@@ -99,47 +118,47 @@ static void printk_prot(struct seq_file *m, pgprot_t prot, int level)
99 118
100 if (!pgprot_val(prot)) { 119 if (!pgprot_val(prot)) {
101 /* Not present */ 120 /* Not present */
102 seq_printf(m, " "); 121 pt_dump_cont_printf(m, dmsg, " ");
103 } else { 122 } else {
104 if (pr & _PAGE_USER) 123 if (pr & _PAGE_USER)
105 seq_printf(m, "USR "); 124 pt_dump_cont_printf(m, dmsg, "USR ");
106 else 125 else
107 seq_printf(m, " "); 126 pt_dump_cont_printf(m, dmsg, " ");
108 if (pr & _PAGE_RW) 127 if (pr & _PAGE_RW)
109 seq_printf(m, "RW "); 128 pt_dump_cont_printf(m, dmsg, "RW ");
110 else 129 else
111 seq_printf(m, "ro "); 130 pt_dump_cont_printf(m, dmsg, "ro ");
112 if (pr & _PAGE_PWT) 131 if (pr & _PAGE_PWT)
113 seq_printf(m, "PWT "); 132 pt_dump_cont_printf(m, dmsg, "PWT ");
114 else 133 else
115 seq_printf(m, " "); 134 pt_dump_cont_printf(m, dmsg, " ");
116 if (pr & _PAGE_PCD) 135 if (pr & _PAGE_PCD)
117 seq_printf(m, "PCD "); 136 pt_dump_cont_printf(m, dmsg, "PCD ");
118 else 137 else
119 seq_printf(m, " "); 138 pt_dump_cont_printf(m, dmsg, " ");
120 139
121 /* Bit 9 has a different meaning on level 3 vs 4 */ 140 /* Bit 9 has a different meaning on level 3 vs 4 */
122 if (level <= 3) { 141 if (level <= 3) {
123 if (pr & _PAGE_PSE) 142 if (pr & _PAGE_PSE)
124 seq_printf(m, "PSE "); 143 pt_dump_cont_printf(m, dmsg, "PSE ");
125 else 144 else
126 seq_printf(m, " "); 145 pt_dump_cont_printf(m, dmsg, " ");
127 } else { 146 } else {
128 if (pr & _PAGE_PAT) 147 if (pr & _PAGE_PAT)
129 seq_printf(m, "pat "); 148 pt_dump_cont_printf(m, dmsg, "pat ");
130 else 149 else
131 seq_printf(m, " "); 150 pt_dump_cont_printf(m, dmsg, " ");
132 } 151 }
133 if (pr & _PAGE_GLOBAL) 152 if (pr & _PAGE_GLOBAL)
134 seq_printf(m, "GLB "); 153 pt_dump_cont_printf(m, dmsg, "GLB ");
135 else 154 else
136 seq_printf(m, " "); 155 pt_dump_cont_printf(m, dmsg, " ");
137 if (pr & _PAGE_NX) 156 if (pr & _PAGE_NX)
138 seq_printf(m, "NX "); 157 pt_dump_cont_printf(m, dmsg, "NX ");
139 else 158 else
140 seq_printf(m, "x "); 159 pt_dump_cont_printf(m, dmsg, "x ");
141 } 160 }
142 seq_printf(m, "%s\n", level_name[level]); 161 pt_dump_cont_printf(m, dmsg, "%s\n", level_name[level]);
143} 162}
144 163
145/* 164/*
@@ -178,7 +197,8 @@ static void note_page(struct seq_file *m, struct pg_state *st,
178 st->current_prot = new_prot; 197 st->current_prot = new_prot;
179 st->level = level; 198 st->level = level;
180 st->marker = address_markers; 199 st->marker = address_markers;
181 seq_printf(m, "---[ %s ]---\n", st->marker->name); 200 pt_dump_seq_printf(m, st->to_dmesg, "---[ %s ]---\n",
201 st->marker->name);
182 } else if (prot != cur || level != st->level || 202 } else if (prot != cur || level != st->level ||
183 st->current_address >= st->marker[1].start_address) { 203 st->current_address >= st->marker[1].start_address) {
184 const char *unit = units; 204 const char *unit = units;
@@ -188,17 +208,17 @@ static void note_page(struct seq_file *m, struct pg_state *st,
188 /* 208 /*
189 * Now print the actual finished series 209 * Now print the actual finished series
190 */ 210 */
191 seq_printf(m, "0x%0*lx-0x%0*lx ", 211 pt_dump_seq_printf(m, st->to_dmesg, "0x%0*lx-0x%0*lx ",
192 width, st->start_address, 212 width, st->start_address,
193 width, st->current_address); 213 width, st->current_address);
194 214
195 delta = (st->current_address - st->start_address) >> 10; 215 delta = (st->current_address - st->start_address) >> 10;
196 while (!(delta & 1023) && unit[1]) { 216 while (!(delta & 1023) && unit[1]) {
197 delta >>= 10; 217 delta >>= 10;
198 unit++; 218 unit++;
199 } 219 }
200 seq_printf(m, "%9lu%c ", delta, *unit); 220 pt_dump_cont_printf(m, st->to_dmesg, "%9lu%c ", delta, *unit);
201 printk_prot(m, st->current_prot, st->level); 221 printk_prot(m, st->current_prot, st->level, st->to_dmesg);
202 222
203 /* 223 /*
204 * We print markers for special areas of address space, 224 * We print markers for special areas of address space,
@@ -207,7 +227,8 @@ static void note_page(struct seq_file *m, struct pg_state *st,
207 */ 227 */
208 if (st->current_address >= st->marker[1].start_address) { 228 if (st->current_address >= st->marker[1].start_address) {
209 st->marker++; 229 st->marker++;
210 seq_printf(m, "---[ %s ]---\n", st->marker->name); 230 pt_dump_seq_printf(m, st->to_dmesg, "---[ %s ]---\n",
231 st->marker->name);
211 } 232 }
212 233
213 st->start_address = st->current_address; 234 st->start_address = st->current_address;
@@ -296,7 +317,7 @@ static void walk_pud_level(struct seq_file *m, struct pg_state *st, pgd_t addr,
296#define pgd_none(a) pud_none(__pud(pgd_val(a))) 317#define pgd_none(a) pud_none(__pud(pgd_val(a)))
297#endif 318#endif
298 319
299static void walk_pgd_level(struct seq_file *m) 320void ptdump_walk_pgd_level(struct seq_file *m, pgd_t *pgd)
300{ 321{
301#ifdef CONFIG_X86_64 322#ifdef CONFIG_X86_64
302 pgd_t *start = (pgd_t *) &init_level4_pgt; 323 pgd_t *start = (pgd_t *) &init_level4_pgt;
@@ -304,9 +325,12 @@ static void walk_pgd_level(struct seq_file *m)
304 pgd_t *start = swapper_pg_dir; 325 pgd_t *start = swapper_pg_dir;
305#endif 326#endif
306 int i; 327 int i;
307 struct pg_state st; 328 struct pg_state st = {};
308 329
309 memset(&st, 0, sizeof(st)); 330 if (pgd) {
331 start = pgd;
332 st.to_dmesg = true;
333 }
310 334
311 for (i = 0; i < PTRS_PER_PGD; i++) { 335 for (i = 0; i < PTRS_PER_PGD; i++) {
312 st.current_address = normalize_addr(i * PGD_LEVEL_MULT); 336 st.current_address = normalize_addr(i * PGD_LEVEL_MULT);
@@ -331,7 +355,7 @@ static void walk_pgd_level(struct seq_file *m)
331 355
332static int ptdump_show(struct seq_file *m, void *v) 356static int ptdump_show(struct seq_file *m, void *v)
333{ 357{
334 walk_pgd_level(m); 358 ptdump_walk_pgd_level(m, NULL);
335 return 0; 359 return 0;
336} 360}
337 361
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 6dea040cc3a1..8e5722992677 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -584,8 +584,13 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code,
584 584
585 if (error_code & PF_INSTR) { 585 if (error_code & PF_INSTR) {
586 unsigned int level; 586 unsigned int level;
587 pgd_t *pgd;
588 pte_t *pte;
587 589
588 pte_t *pte = lookup_address(address, &level); 590 pgd = __va(read_cr3() & PHYSICAL_PAGE_MASK);
591 pgd += pgd_index(address);
592
593 pte = lookup_address_in_pgd(pgd, address, &level);
589 594
590 if (pte && pte_present(*pte) && !pte_exec(*pte)) 595 if (pte && pte_present(*pte) && !pte_exec(*pte))
591 printk(nx_warning, from_kuid(&init_user_ns, current_uid())); 596 printk(nx_warning, from_kuid(&init_user_ns, current_uid()));
@@ -1020,13 +1025,17 @@ static inline bool smap_violation(int error_code, struct pt_regs *regs)
1020 * This routine handles page faults. It determines the address, 1025 * This routine handles page faults. It determines the address,
1021 * and the problem, and then passes it off to one of the appropriate 1026 * and the problem, and then passes it off to one of the appropriate
1022 * routines. 1027 * routines.
1028 *
1029 * This function must have noinline because both callers
1030 * {,trace_}do_page_fault() have notrace on. Having this an actual function
1031 * guarantees there's a function trace entry.
1023 */ 1032 */
1024static void __kprobes 1033static void __kprobes noinline
1025__do_page_fault(struct pt_regs *regs, unsigned long error_code) 1034__do_page_fault(struct pt_regs *regs, unsigned long error_code,
1035 unsigned long address)
1026{ 1036{
1027 struct vm_area_struct *vma; 1037 struct vm_area_struct *vma;
1028 struct task_struct *tsk; 1038 struct task_struct *tsk;
1029 unsigned long address;
1030 struct mm_struct *mm; 1039 struct mm_struct *mm;
1031 int fault; 1040 int fault;
1032 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; 1041 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
@@ -1034,9 +1043,6 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code)
1034 tsk = current; 1043 tsk = current;
1035 mm = tsk->mm; 1044 mm = tsk->mm;
1036 1045
1037 /* Get the faulting address: */
1038 address = read_cr2();
1039
1040 /* 1046 /*
1041 * Detect and handle instructions that would cause a page fault for 1047 * Detect and handle instructions that would cause a page fault for
1042 * both a tracked kernel page and a userspace page. 1048 * both a tracked kernel page and a userspace page.
@@ -1248,32 +1254,50 @@ good_area:
1248 up_read(&mm->mmap_sem); 1254 up_read(&mm->mmap_sem);
1249} 1255}
1250 1256
1251dotraplinkage void __kprobes 1257dotraplinkage void __kprobes notrace
1252do_page_fault(struct pt_regs *regs, unsigned long error_code) 1258do_page_fault(struct pt_regs *regs, unsigned long error_code)
1253{ 1259{
1260 unsigned long address = read_cr2(); /* Get the faulting address */
1254 enum ctx_state prev_state; 1261 enum ctx_state prev_state;
1255 1262
1263 /*
1264 * We must have this function tagged with __kprobes, notrace and call
1265 * read_cr2() before calling anything else. To avoid calling any kind
1266 * of tracing machinery before we've observed the CR2 value.
1267 *
1268 * exception_{enter,exit}() contain all sorts of tracepoints.
1269 */
1270
1256 prev_state = exception_enter(); 1271 prev_state = exception_enter();
1257 __do_page_fault(regs, error_code); 1272 __do_page_fault(regs, error_code, address);
1258 exception_exit(prev_state); 1273 exception_exit(prev_state);
1259} 1274}
1260 1275
1261static void trace_page_fault_entries(struct pt_regs *regs, 1276#ifdef CONFIG_TRACING
1277static void trace_page_fault_entries(unsigned long address, struct pt_regs *regs,
1262 unsigned long error_code) 1278 unsigned long error_code)
1263{ 1279{
1264 if (user_mode(regs)) 1280 if (user_mode(regs))
1265 trace_page_fault_user(read_cr2(), regs, error_code); 1281 trace_page_fault_user(address, regs, error_code);
1266 else 1282 else
1267 trace_page_fault_kernel(read_cr2(), regs, error_code); 1283 trace_page_fault_kernel(address, regs, error_code);
1268} 1284}
1269 1285
1270dotraplinkage void __kprobes 1286dotraplinkage void __kprobes notrace
1271trace_do_page_fault(struct pt_regs *regs, unsigned long error_code) 1287trace_do_page_fault(struct pt_regs *regs, unsigned long error_code)
1272{ 1288{
1289 /*
1290 * The exception_enter and tracepoint processing could
1291 * trigger another page faults (user space callchain
1292 * reading) and destroy the original cr2 value, so read
1293 * the faulting address now.
1294 */
1295 unsigned long address = read_cr2();
1273 enum ctx_state prev_state; 1296 enum ctx_state prev_state;
1274 1297
1275 prev_state = exception_enter(); 1298 prev_state = exception_enter();
1276 trace_page_fault_entries(regs, error_code); 1299 trace_page_fault_entries(address, regs, error_code);
1277 __do_page_fault(regs, error_code); 1300 __do_page_fault(regs, error_code, address);
1278 exception_exit(prev_state); 1301 exception_exit(prev_state);
1279} 1302}
1303#endif /* CONFIG_TRACING */
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index b3b19f46c016..ae242a7c11c7 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -126,8 +126,8 @@ within(unsigned long addr, unsigned long start, unsigned long end)
126 * @vaddr: virtual start address 126 * @vaddr: virtual start address
127 * @size: number of bytes to flush 127 * @size: number of bytes to flush
128 * 128 *
129 * clflush is an unordered instruction which needs fencing with mfence 129 * clflushopt is an unordered instruction which needs fencing with mfence or
130 * to avoid ordering issues. 130 * sfence to avoid ordering issues.
131 */ 131 */
132void clflush_cache_range(void *vaddr, unsigned int size) 132void clflush_cache_range(void *vaddr, unsigned int size)
133{ 133{
@@ -136,11 +136,11 @@ void clflush_cache_range(void *vaddr, unsigned int size)
136 mb(); 136 mb();
137 137
138 for (; vaddr < vend; vaddr += boot_cpu_data.x86_clflush_size) 138 for (; vaddr < vend; vaddr += boot_cpu_data.x86_clflush_size)
139 clflush(vaddr); 139 clflushopt(vaddr);
140 /* 140 /*
141 * Flush any possible final partial cacheline: 141 * Flush any possible final partial cacheline:
142 */ 142 */
143 clflush(vend); 143 clflushopt(vend);
144 144
145 mb(); 145 mb();
146} 146}
@@ -323,8 +323,12 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address,
323 return prot; 323 return prot;
324} 324}
325 325
326static pte_t *__lookup_address_in_pgd(pgd_t *pgd, unsigned long address, 326/*
327 unsigned int *level) 327 * Lookup the page table entry for a virtual address in a specific pgd.
328 * Return a pointer to the entry and the level of the mapping.
329 */
330pte_t *lookup_address_in_pgd(pgd_t *pgd, unsigned long address,
331 unsigned int *level)
328{ 332{
329 pud_t *pud; 333 pud_t *pud;
330 pmd_t *pmd; 334 pmd_t *pmd;
@@ -365,7 +369,7 @@ static pte_t *__lookup_address_in_pgd(pgd_t *pgd, unsigned long address,
365 */ 369 */
366pte_t *lookup_address(unsigned long address, unsigned int *level) 370pte_t *lookup_address(unsigned long address, unsigned int *level)
367{ 371{
368 return __lookup_address_in_pgd(pgd_offset_k(address), address, level); 372 return lookup_address_in_pgd(pgd_offset_k(address), address, level);
369} 373}
370EXPORT_SYMBOL_GPL(lookup_address); 374EXPORT_SYMBOL_GPL(lookup_address);
371 375
@@ -373,7 +377,7 @@ static pte_t *_lookup_address_cpa(struct cpa_data *cpa, unsigned long address,
373 unsigned int *level) 377 unsigned int *level)
374{ 378{
375 if (cpa->pgd) 379 if (cpa->pgd)
376 return __lookup_address_in_pgd(cpa->pgd + pgd_index(address), 380 return lookup_address_in_pgd(cpa->pgd + pgd_index(address),
377 address, level); 381 address, level);
378 382
379 return lookup_address(address, level); 383 return lookup_address(address, level);
@@ -692,6 +696,18 @@ static bool try_to_free_pmd_page(pmd_t *pmd)
692 return true; 696 return true;
693} 697}
694 698
699static bool try_to_free_pud_page(pud_t *pud)
700{
701 int i;
702
703 for (i = 0; i < PTRS_PER_PUD; i++)
704 if (!pud_none(pud[i]))
705 return false;
706
707 free_page((unsigned long)pud);
708 return true;
709}
710
695static bool unmap_pte_range(pmd_t *pmd, unsigned long start, unsigned long end) 711static bool unmap_pte_range(pmd_t *pmd, unsigned long start, unsigned long end)
696{ 712{
697 pte_t *pte = pte_offset_kernel(pmd, start); 713 pte_t *pte = pte_offset_kernel(pmd, start);
@@ -805,6 +821,16 @@ static void unmap_pud_range(pgd_t *pgd, unsigned long start, unsigned long end)
805 */ 821 */
806} 822}
807 823
824static void unmap_pgd_range(pgd_t *root, unsigned long addr, unsigned long end)
825{
826 pgd_t *pgd_entry = root + pgd_index(addr);
827
828 unmap_pud_range(pgd_entry, addr, end);
829
830 if (try_to_free_pud_page((pud_t *)pgd_page_vaddr(*pgd_entry)))
831 pgd_clear(pgd_entry);
832}
833
808static int alloc_pte_page(pmd_t *pmd) 834static int alloc_pte_page(pmd_t *pmd)
809{ 835{
810 pte_t *pte = (pte_t *)get_zeroed_page(GFP_KERNEL | __GFP_NOTRACK); 836 pte_t *pte = (pte_t *)get_zeroed_page(GFP_KERNEL | __GFP_NOTRACK);
@@ -999,9 +1025,8 @@ static int populate_pud(struct cpa_data *cpa, unsigned long start, pgd_t *pgd,
999static int populate_pgd(struct cpa_data *cpa, unsigned long addr) 1025static int populate_pgd(struct cpa_data *cpa, unsigned long addr)
1000{ 1026{
1001 pgprot_t pgprot = __pgprot(_KERNPG_TABLE); 1027 pgprot_t pgprot = __pgprot(_KERNPG_TABLE);
1002 bool allocd_pgd = false;
1003 pgd_t *pgd_entry;
1004 pud_t *pud = NULL; /* shut up gcc */ 1028 pud_t *pud = NULL; /* shut up gcc */
1029 pgd_t *pgd_entry;
1005 int ret; 1030 int ret;
1006 1031
1007 pgd_entry = cpa->pgd + pgd_index(addr); 1032 pgd_entry = cpa->pgd + pgd_index(addr);
@@ -1015,7 +1040,6 @@ static int populate_pgd(struct cpa_data *cpa, unsigned long addr)
1015 return -1; 1040 return -1;
1016 1041
1017 set_pgd(pgd_entry, __pgd(__pa(pud) | _KERNPG_TABLE)); 1042 set_pgd(pgd_entry, __pgd(__pa(pud) | _KERNPG_TABLE));
1018 allocd_pgd = true;
1019 } 1043 }
1020 1044
1021 pgprot_val(pgprot) &= ~pgprot_val(cpa->mask_clr); 1045 pgprot_val(pgprot) &= ~pgprot_val(cpa->mask_clr);
@@ -1023,19 +1047,11 @@ static int populate_pgd(struct cpa_data *cpa, unsigned long addr)
1023 1047
1024 ret = populate_pud(cpa, addr, pgd_entry, pgprot); 1048 ret = populate_pud(cpa, addr, pgd_entry, pgprot);
1025 if (ret < 0) { 1049 if (ret < 0) {
1026 unmap_pud_range(pgd_entry, addr, 1050 unmap_pgd_range(cpa->pgd, addr,
1027 addr + (cpa->numpages << PAGE_SHIFT)); 1051 addr + (cpa->numpages << PAGE_SHIFT));
1028
1029 if (allocd_pgd) {
1030 /*
1031 * If I allocated this PUD page, I can just as well
1032 * free it in this error path.
1033 */
1034 pgd_clear(pgd_entry);
1035 free_page((unsigned long)pud);
1036 }
1037 return ret; 1052 return ret;
1038 } 1053 }
1054
1039 cpa->numpages = ret; 1055 cpa->numpages = ret;
1040 return 0; 1056 return 0;
1041} 1057}
@@ -1377,10 +1393,10 @@ static int change_page_attr_set_clr(unsigned long *addr, int numpages,
1377 cache = cache_attr(mask_set); 1393 cache = cache_attr(mask_set);
1378 1394
1379 /* 1395 /*
1380 * On success we use clflush, when the CPU supports it to 1396 * On success we use CLFLUSH, when the CPU supports it to
1381 * avoid the wbindv. If the CPU does not support it and in the 1397 * avoid the WBINVD. If the CPU does not support it and in the
1382 * error case we fall back to cpa_flush_all (which uses 1398 * error case we fall back to cpa_flush_all (which uses
1383 * wbindv): 1399 * WBINVD):
1384 */ 1400 */
1385 if (!ret && cpu_has_clflush) { 1401 if (!ret && cpu_has_clflush) {
1386 if (cpa.flags & (CPA_PAGES_ARRAY | CPA_ARRAY)) { 1402 if (cpa.flags & (CPA_PAGES_ARRAY | CPA_ARRAY)) {
@@ -1861,6 +1877,12 @@ out:
1861 return retval; 1877 return retval;
1862} 1878}
1863 1879
1880void kernel_unmap_pages_in_pgd(pgd_t *root, unsigned long address,
1881 unsigned numpages)
1882{
1883 unmap_pgd_range(root, address, address + (numpages << PAGE_SHIFT));
1884}
1885
1864/* 1886/*
1865 * The testcases use internal knowledge of the implementation that shouldn't 1887 * The testcases use internal knowledge of the implementation that shouldn't
1866 * be exposed to the rest of the kernel. Include these directly here. 1888 * be exposed to the rest of the kernel. Include these directly here.
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/net/bpf_jit.S b/arch/x86/net/bpf_jit.S
index 877b9a1b2152..01495755701b 100644
--- a/arch/x86/net/bpf_jit.S
+++ b/arch/x86/net/bpf_jit.S
@@ -140,7 +140,7 @@ bpf_slow_path_byte_msh:
140 push %r9; \ 140 push %r9; \
141 push SKBDATA; \ 141 push SKBDATA; \
142/* rsi already has offset */ \ 142/* rsi already has offset */ \
143 mov $SIZE,%ecx; /* size */ \ 143 mov $SIZE,%edx; /* size */ \
144 call bpf_internal_load_pointer_neg_helper; \ 144 call bpf_internal_load_pointer_neg_helper; \
145 test %rax,%rax; \ 145 test %rax,%rax; \
146 pop SKBDATA; \ 146 pop SKBDATA; \
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 4f25ec077552..01edac6c5e18 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -218,9 +218,8 @@ static void teardown_mcfg_map(struct pci_root_info *info)
218} 218}
219#endif 219#endif
220 220
221static acpi_status 221static acpi_status resource_to_addr(struct acpi_resource *resource,
222resource_to_addr(struct acpi_resource *resource, 222 struct acpi_resource_address64 *addr)
223 struct acpi_resource_address64 *addr)
224{ 223{
225 acpi_status status; 224 acpi_status status;
226 struct acpi_resource_memory24 *memory24; 225 struct acpi_resource_memory24 *memory24;
@@ -265,8 +264,7 @@ resource_to_addr(struct acpi_resource *resource,
265 return AE_ERROR; 264 return AE_ERROR;
266} 265}
267 266
268static acpi_status 267static acpi_status count_resource(struct acpi_resource *acpi_res, void *data)
269count_resource(struct acpi_resource *acpi_res, void *data)
270{ 268{
271 struct pci_root_info *info = data; 269 struct pci_root_info *info = data;
272 struct acpi_resource_address64 addr; 270 struct acpi_resource_address64 addr;
@@ -278,8 +276,7 @@ count_resource(struct acpi_resource *acpi_res, void *data)
278 return AE_OK; 276 return AE_OK;
279} 277}
280 278
281static acpi_status 279static acpi_status setup_resource(struct acpi_resource *acpi_res, void *data)
282setup_resource(struct acpi_resource *acpi_res, void *data)
283{ 280{
284 struct pci_root_info *info = data; 281 struct pci_root_info *info = data;
285 struct resource *res; 282 struct resource *res;
@@ -435,9 +432,9 @@ static void release_pci_root_info(struct pci_host_bridge *bridge)
435 __release_pci_root_info(info); 432 __release_pci_root_info(info);
436} 433}
437 434
438static void 435static void probe_pci_root_info(struct pci_root_info *info,
439probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device, 436 struct acpi_device *device,
440 int busnum, int domain) 437 int busnum, int domain)
441{ 438{
442 size_t size; 439 size_t size;
443 440
@@ -473,16 +470,13 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device,
473struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) 470struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
474{ 471{
475 struct acpi_device *device = root->device; 472 struct acpi_device *device = root->device;
476 struct pci_root_info *info = NULL; 473 struct pci_root_info *info;
477 int domain = root->segment; 474 int domain = root->segment;
478 int busnum = root->secondary.start; 475 int busnum = root->secondary.start;
479 LIST_HEAD(resources); 476 LIST_HEAD(resources);
480 struct pci_bus *bus = NULL; 477 struct pci_bus *bus;
481 struct pci_sysdata *sd; 478 struct pci_sysdata *sd;
482 int node; 479 int node;
483#ifdef CONFIG_ACPI_NUMA
484 int pxm;
485#endif
486 480
487 if (pci_ignore_seg) 481 if (pci_ignore_seg)
488 domain = 0; 482 domain = 0;
@@ -494,19 +488,12 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
494 return NULL; 488 return NULL;
495 } 489 }
496 490
497 node = -1; 491 node = acpi_get_node(device->handle);
498#ifdef CONFIG_ACPI_NUMA 492 if (node == NUMA_NO_NODE)
499 pxm = acpi_get_pxm(device->handle); 493 node = x86_pci_root_bus_node(busnum);
500 if (pxm >= 0)
501 node = pxm_to_node(pxm);
502 if (node != -1)
503 set_mp_bus_to_node(busnum, node);
504 else
505#endif
506 node = get_mp_bus_to_node(busnum);
507 494
508 if (node != -1 && !node_online(node)) 495 if (node != NUMA_NO_NODE && !node_online(node))
509 node = -1; 496 node = NUMA_NO_NODE;
510 497
511 info = kzalloc(sizeof(*info), GFP_KERNEL); 498 info = kzalloc(sizeof(*info), GFP_KERNEL);
512 if (!info) { 499 if (!info) {
@@ -519,15 +506,12 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
519 sd->domain = domain; 506 sd->domain = domain;
520 sd->node = node; 507 sd->node = node;
521 sd->companion = device; 508 sd->companion = device;
522 /* 509
523 * Maybe the desired pci bus has been already scanned. In such case
524 * it is unnecessary to scan the pci bus with the given domain,busnum.
525 */
526 bus = pci_find_bus(domain, busnum); 510 bus = pci_find_bus(domain, busnum);
527 if (bus) { 511 if (bus) {
528 /* 512 /*
529 * If the desired bus exits, the content of bus->sysdata will 513 * If the desired bus has been scanned already, replace
530 * be replaced by sd. 514 * its bus->sysdata.
531 */ 515 */
532 memcpy(bus->sysdata, sd, sizeof(*sd)); 516 memcpy(bus->sysdata, sd, sizeof(*sd));
533 kfree(info); 517 kfree(info);
@@ -572,15 +556,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
572 pcie_bus_configure_settings(child); 556 pcie_bus_configure_settings(child);
573 } 557 }
574 558
575 if (bus && node != -1) { 559 if (bus && node != NUMA_NO_NODE)
576#ifdef CONFIG_ACPI_NUMA
577 if (pxm >= 0)
578 dev_printk(KERN_DEBUG, &bus->dev,
579 "on NUMA node %d (pxm %d)\n", node, pxm);
580#else
581 dev_printk(KERN_DEBUG, &bus->dev, "on NUMA node %d\n", node); 560 dev_printk(KERN_DEBUG, &bus->dev, "on NUMA node %d\n", node);
582#endif
583 }
584 561
585 return bus; 562 return bus;
586} 563}
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
index a48be98e9ded..a313a7fb6b86 100644
--- a/arch/x86/pci/amd_bus.c
+++ b/arch/x86/pci/amd_bus.c
@@ -44,15 +44,6 @@ static struct pci_root_info __init *find_pci_root_info(int node, int link)
44 return NULL; 44 return NULL;
45} 45}
46 46
47static void __init set_mp_bus_range_to_node(int min_bus, int max_bus, int node)
48{
49#ifdef CONFIG_NUMA
50 int j;
51
52 for (j = min_bus; j <= max_bus; j++)
53 set_mp_bus_to_node(j, node);
54#endif
55}
56/** 47/**
57 * early_fill_mp_bus_to_node() 48 * early_fill_mp_bus_to_node()
58 * called before pcibios_scan_root and pci_scan_bus 49 * called before pcibios_scan_root and pci_scan_bus
@@ -117,7 +108,6 @@ static int __init early_fill_mp_bus_info(void)
117 min_bus = (reg >> 16) & 0xff; 108 min_bus = (reg >> 16) & 0xff;
118 max_bus = (reg >> 24) & 0xff; 109 max_bus = (reg >> 24) & 0xff;
119 node = (reg >> 4) & 0x07; 110 node = (reg >> 4) & 0x07;
120 set_mp_bus_range_to_node(min_bus, max_bus, node);
121 link = (reg >> 8) & 0x03; 111 link = (reg >> 8) & 0x03;
122 112
123 info = alloc_pci_root_info(min_bus, max_bus, node, link); 113 info = alloc_pci_root_info(min_bus, max_bus, node, link);
diff --git a/arch/x86/pci/bus_numa.c b/arch/x86/pci/bus_numa.c
index c2735feb2508..f3a2cfc14125 100644
--- a/arch/x86/pci/bus_numa.c
+++ b/arch/x86/pci/bus_numa.c
@@ -10,9 +10,6 @@ static struct pci_root_info *x86_find_pci_root_info(int bus)
10{ 10{
11 struct pci_root_info *info; 11 struct pci_root_info *info;
12 12
13 if (list_empty(&pci_root_infos))
14 return NULL;
15
16 list_for_each_entry(info, &pci_root_infos, list) 13 list_for_each_entry(info, &pci_root_infos, list)
17 if (info->busn.start == bus) 14 if (info->busn.start == bus)
18 return info; 15 return info;
@@ -20,6 +17,16 @@ static struct pci_root_info *x86_find_pci_root_info(int bus)
20 return NULL; 17 return NULL;
21} 18}
22 19
20int x86_pci_root_bus_node(int bus)
21{
22 struct pci_root_info *info = x86_find_pci_root_info(bus);
23
24 if (!info)
25 return NUMA_NO_NODE;
26
27 return info->node;
28}
29
23void x86_pci_root_bus_resources(int bus, struct list_head *resources) 30void x86_pci_root_bus_resources(int bus, struct list_head *resources)
24{ 31{
25 struct pci_root_info *info = x86_find_pci_root_info(bus); 32 struct pci_root_info *info = x86_find_pci_root_info(bus);
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 981c2dbd72cc..d491deddebae 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -456,19 +456,25 @@ void __init dmi_check_pciprobe(void)
456 dmi_check_system(pciprobe_dmi_table); 456 dmi_check_system(pciprobe_dmi_table);
457} 457}
458 458
459struct pci_bus *pcibios_scan_root(int busnum) 459void pcibios_scan_root(int busnum)
460{ 460{
461 struct pci_bus *bus = NULL; 461 struct pci_bus *bus;
462 struct pci_sysdata *sd;
463 LIST_HEAD(resources);
462 464
463 while ((bus = pci_find_next_bus(bus)) != NULL) { 465 sd = kzalloc(sizeof(*sd), GFP_KERNEL);
464 if (bus->number == busnum) { 466 if (!sd) {
465 /* Already scanned */ 467 printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busnum);
466 return bus; 468 return;
467 } 469 }
470 sd->node = x86_pci_root_bus_node(busnum);
471 x86_pci_root_bus_resources(busnum, &resources);
472 printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
473 bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);
474 if (!bus) {
475 pci_free_resource_list(&resources);
476 kfree(sd);
468 } 477 }
469
470 return pci_scan_bus_on_node(busnum, &pci_root_ops,
471 get_mp_bus_to_node(busnum));
472} 478}
473 479
474void __init pcibios_set_cache_line_size(void) 480void __init pcibios_set_cache_line_size(void)
@@ -677,105 +683,3 @@ int pci_ext_cfg_avail(void)
677 else 683 else
678 return 0; 684 return 0;
679} 685}
680
681struct pci_bus *pci_scan_bus_on_node(int busno, struct pci_ops *ops, int node)
682{
683 LIST_HEAD(resources);
684 struct pci_bus *bus = NULL;
685 struct pci_sysdata *sd;
686
687 /*
688 * Allocate per-root-bus (not per bus) arch-specific data.
689 * TODO: leak; this memory is never freed.
690 * It's arguable whether it's worth the trouble to care.
691 */
692 sd = kzalloc(sizeof(*sd), GFP_KERNEL);
693 if (!sd) {
694 printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busno);
695 return NULL;
696 }
697 sd->node = node;
698 x86_pci_root_bus_resources(busno, &resources);
699 printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busno);
700 bus = pci_scan_root_bus(NULL, busno, ops, sd, &resources);
701 if (!bus) {
702 pci_free_resource_list(&resources);
703 kfree(sd);
704 }
705
706 return bus;
707}
708
709struct pci_bus *pci_scan_bus_with_sysdata(int busno)
710{
711 return pci_scan_bus_on_node(busno, &pci_root_ops, -1);
712}
713
714/*
715 * NUMA info for PCI busses
716 *
717 * Early arch code is responsible for filling in reasonable values here.
718 * A node id of "-1" means "use current node". In other words, if a bus
719 * has a -1 node id, it's not tightly coupled to any particular chunk
720 * of memory (as is the case on some Nehalem systems).
721 */
722#ifdef CONFIG_NUMA
723
724#define BUS_NR 256
725
726#ifdef CONFIG_X86_64
727
728static int mp_bus_to_node[BUS_NR] = {
729 [0 ... BUS_NR - 1] = -1
730};
731
732void set_mp_bus_to_node(int busnum, int node)
733{
734 if (busnum >= 0 && busnum < BUS_NR)
735 mp_bus_to_node[busnum] = node;
736}
737
738int get_mp_bus_to_node(int busnum)
739{
740 int node = -1;
741
742 if (busnum < 0 || busnum > (BUS_NR - 1))
743 return node;
744
745 node = mp_bus_to_node[busnum];
746
747 /*
748 * let numa_node_id to decide it later in dma_alloc_pages
749 * if there is no ram on that node
750 */
751 if (node != -1 && !node_online(node))
752 node = -1;
753
754 return node;
755}
756
757#else /* CONFIG_X86_32 */
758
759static int mp_bus_to_node[BUS_NR] = {
760 [0 ... BUS_NR - 1] = -1
761};
762
763void set_mp_bus_to_node(int busnum, int node)
764{
765 if (busnum >= 0 && busnum < BUS_NR)
766 mp_bus_to_node[busnum] = (unsigned char) node;
767}
768
769int get_mp_bus_to_node(int busnum)
770{
771 int node;
772
773 if (busnum < 0 || busnum > (BUS_NR - 1))
774 return 0;
775 node = mp_bus_to_node[busnum];
776 return node;
777}
778
779#endif /* CONFIG_X86_32 */
780
781#endif /* CONFIG_NUMA */
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index bca9e85daaa5..94ae9ae9574f 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -25,9 +25,9 @@ static void pci_fixup_i450nx(struct pci_dev *d)
25 dev_dbg(&d->dev, "i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, 25 dev_dbg(&d->dev, "i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno,
26 suba, subb); 26 suba, subb);
27 if (busno) 27 if (busno)
28 pci_scan_bus_with_sysdata(busno); /* Bus A */ 28 pcibios_scan_root(busno); /* Bus A */
29 if (suba < subb) 29 if (suba < subb)
30 pci_scan_bus_with_sysdata(suba+1); /* Bus B */ 30 pcibios_scan_root(suba+1); /* Bus B */
31 } 31 }
32 pcibios_last_bus = -1; 32 pcibios_last_bus = -1;
33} 33}
@@ -42,7 +42,7 @@ static void pci_fixup_i450gx(struct pci_dev *d)
42 u8 busno; 42 u8 busno;
43 pci_read_config_byte(d, 0x4a, &busno); 43 pci_read_config_byte(d, 0x4a, &busno);
44 dev_info(&d->dev, "i440KX/GX host bridge; secondary bus %02x\n", busno); 44 dev_info(&d->dev, "i440KX/GX host bridge; secondary bus %02x\n", busno);
45 pci_scan_bus_with_sysdata(busno); 45 pcibios_scan_root(busno);
46 pcibios_last_bus = -1; 46 pcibios_last_bus = -1;
47} 47}
48DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454GX, pci_fixup_i450gx); 48DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454GX, pci_fixup_i450gx);
@@ -313,9 +313,10 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MCH_PC1, pcie_r
313 * IORESOURCE_ROM_SHADOW is used to associate the boot video 313 * IORESOURCE_ROM_SHADOW is used to associate the boot video
314 * card with this copy. On laptops this copy has to be used since 314 * card with this copy. On laptops this copy has to be used since
315 * the main ROM may be compressed or combined with another image. 315 * the main ROM may be compressed or combined with another image.
316 * See pci_map_rom() for use of this flag. IORESOURCE_ROM_SHADOW 316 * See pci_map_rom() for use of this flag. Before marking the device
317 * is marked here since the boot video device will be the only enabled 317 * with IORESOURCE_ROM_SHADOW check if a vga_default_device is already set
318 * video device at this point. 318 * by either arch cde or vga-arbitration, if so only apply the fixup to this
319 * already determined primary video card.
319 */ 320 */
320 321
321static void pci_fixup_video(struct pci_dev *pdev) 322static void pci_fixup_video(struct pci_dev *pdev)
@@ -346,12 +347,13 @@ static void pci_fixup_video(struct pci_dev *pdev)
346 } 347 }
347 bus = bus->parent; 348 bus = bus->parent;
348 } 349 }
349 pci_read_config_word(pdev, PCI_COMMAND, &config); 350 if (!vga_default_device() || pdev == vga_default_device()) {
350 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { 351 pci_read_config_word(pdev, PCI_COMMAND, &config);
351 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; 352 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
352 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); 353 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW;
353 if (!vga_default_device()) 354 dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n");
354 vga_set_default_device(pdev); 355 vga_set_default_device(pdev);
356 }
355 } 357 }
356} 358}
357DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID, 359DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index 372e9b8989b3..84112f55dd7a 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -136,13 +136,9 @@ static void __init pirq_peer_trick(void)
136 busmap[e->bus] = 1; 136 busmap[e->bus] = 1;
137 } 137 }
138 for (i = 1; i < 256; i++) { 138 for (i = 1; i < 256; i++) {
139 int node;
140 if (!busmap[i] || pci_find_bus(0, i)) 139 if (!busmap[i] || pci_find_bus(0, i))
141 continue; 140 continue;
142 node = get_mp_bus_to_node(i); 141 pcibios_scan_root(i);
143 if (pci_scan_bus_on_node(i, &pci_root_ops, node))
144 printk(KERN_INFO "PCI: Discovered primary peer "
145 "bus %02x [IRQ]\n", i);
146 } 142 }
147 pcibios_last_bus = -1; 143 pcibios_last_bus = -1;
148} 144}
diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c
index 4db96fb1c232..5b662c0faf8c 100644
--- a/arch/x86/pci/legacy.c
+++ b/arch/x86/pci/legacy.c
@@ -37,19 +37,17 @@ int __init pci_legacy_init(void)
37void pcibios_scan_specific_bus(int busn) 37void pcibios_scan_specific_bus(int busn)
38{ 38{
39 int devfn; 39 int devfn;
40 long node;
41 u32 l; 40 u32 l;
42 41
43 if (pci_find_bus(0, busn)) 42 if (pci_find_bus(0, busn))
44 return; 43 return;
45 44
46 node = get_mp_bus_to_node(busn);
47 for (devfn = 0; devfn < 256; devfn += 8) { 45 for (devfn = 0; devfn < 256; devfn += 8) {
48 if (!raw_pci_read(0, busn, devfn, PCI_VENDOR_ID, 2, &l) && 46 if (!raw_pci_read(0, busn, devfn, PCI_VENDOR_ID, 2, &l) &&
49 l != 0x0000 && l != 0xffff) { 47 l != 0x0000 && l != 0xffff) {
50 DBG("Found device at %02x:%02x [%04x]\n", busn, devfn, l); 48 DBG("Found device at %02x:%02x [%04x]\n", busn, devfn, l);
51 printk(KERN_INFO "PCI: Discovered peer bus %02x\n", busn); 49 printk(KERN_INFO "PCI: Discovered peer bus %02x\n", busn);
52 pci_scan_bus_on_node(busn, &pci_root_ops, node); 50 pcibios_scan_root(busn);
53 return; 51 return;
54 } 52 }
55 } 53 }
diff --git a/arch/x86/pci/numaq_32.c b/arch/x86/pci/numaq_32.c
index 72c229f9ebcf..080eb0374fff 100644
--- a/arch/x86/pci/numaq_32.c
+++ b/arch/x86/pci/numaq_32.c
@@ -135,11 +135,11 @@ static void pci_fixup_i450nx(struct pci_dev *d)
135 pxb, busno, suba, subb); 135 pxb, busno, suba, subb);
136 if (busno) { 136 if (busno) {
137 /* Bus A */ 137 /* Bus A */
138 pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, busno)); 138 pcibios_scan_root(QUADLOCAL2BUS(quad, busno));
139 } 139 }
140 if (suba < subb) { 140 if (suba < subb) {
141 /* Bus B */ 141 /* Bus B */
142 pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, suba+1)); 142 pcibios_scan_root(QUADLOCAL2BUS(quad, suba+1));
143 } 143 }
144 } 144 }
145 pcibios_last_bus = -1; 145 pcibios_last_bus = -1;
@@ -159,7 +159,7 @@ int __init pci_numaq_init(void)
159 continue; 159 continue;
160 printk("Scanning PCI bus %d for quad %d\n", 160 printk("Scanning PCI bus %d for quad %d\n",
161 QUADLOCAL2BUS(quad,0), quad); 161 QUADLOCAL2BUS(quad,0), quad);
162 pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, 0)); 162 pcibios_scan_root(QUADLOCAL2BUS(quad, 0));
163 } 163 }
164 return 0; 164 return 0;
165} 165}
diff --git a/arch/x86/pci/visws.c b/arch/x86/pci/visws.c
index 3e6d2a6db866..cd9d4d1681d2 100644
--- a/arch/x86/pci/visws.c
+++ b/arch/x86/pci/visws.c
@@ -78,8 +78,8 @@ int __init pci_visws_init(void)
78 "bridge B (PIIX4) bus: %u\n", pci_bus1, pci_bus0); 78 "bridge B (PIIX4) bus: %u\n", pci_bus1, pci_bus0);
79 79
80 raw_pci_ops = &pci_direct_conf1; 80 raw_pci_ops = &pci_direct_conf1;
81 pci_scan_bus_with_sysdata(pci_bus0); 81 pcibios_scan_root(pci_bus0);
82 pci_scan_bus_with_sysdata(pci_bus1); 82 pcibios_scan_root(pci_bus1);
83 pci_fixup_irqs(pci_common_swizzle, visws_map_irq); 83 pci_fixup_irqs(pci_common_swizzle, visws_map_irq);
84 pcibios_resource_survey(); 84 pcibios_resource_survey();
85 /* Request bus scan */ 85 /* Request bus scan */
diff --git a/arch/x86/platform/efi/Makefile b/arch/x86/platform/efi/Makefile
index b7b0b35c1981..d51045afcaaf 100644
--- a/arch/x86/platform/efi/Makefile
+++ b/arch/x86/platform/efi/Makefile
@@ -1,3 +1,4 @@
1obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o 1obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o
2obj-$(CONFIG_ACPI_BGRT) += efi-bgrt.o 2obj-$(CONFIG_ACPI_BGRT) += efi-bgrt.o
3obj-$(CONFIG_EARLY_PRINTK_EFI) += early_printk.o 3obj-$(CONFIG_EARLY_PRINTK_EFI) += early_printk.o
4obj-$(CONFIG_EFI_MIXED) += efi_thunk_$(BITS).o
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 1a201ac7cef8..3781dd39e8bd 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -52,6 +52,7 @@
52#include <asm/tlbflush.h> 52#include <asm/tlbflush.h>
53#include <asm/x86_init.h> 53#include <asm/x86_init.h>
54#include <asm/rtc.h> 54#include <asm/rtc.h>
55#include <asm/uv/uv.h>
55 56
56#define EFI_DEBUG 57#define EFI_DEBUG
57 58
@@ -67,9 +68,7 @@ struct efi_memory_map memmap;
67static struct efi efi_phys __initdata; 68static struct efi efi_phys __initdata;
68static efi_system_table_t efi_systab __initdata; 69static efi_system_table_t efi_systab __initdata;
69 70
70unsigned long x86_efi_facility; 71static efi_config_table_type_t arch_tables[] __initdata = {
71
72static __initdata efi_config_table_type_t arch_tables[] = {
73#ifdef CONFIG_X86_UV 72#ifdef CONFIG_X86_UV
74 {UV_SYSTEM_TABLE_GUID, "UVsystab", &efi.uv_systab}, 73 {UV_SYSTEM_TABLE_GUID, "UVsystab", &efi.uv_systab},
75#endif 74#endif
@@ -78,16 +77,7 @@ static __initdata efi_config_table_type_t arch_tables[] = {
78 77
79u64 efi_setup; /* efi setup_data physical address */ 78u64 efi_setup; /* efi setup_data physical address */
80 79
81/* 80static bool disable_runtime __initdata = false;
82 * Returns 1 if 'facility' is enabled, 0 otherwise.
83 */
84int efi_enabled(int facility)
85{
86 return test_bit(facility, &x86_efi_facility) != 0;
87}
88EXPORT_SYMBOL(efi_enabled);
89
90static bool __initdata disable_runtime = false;
91static int __init setup_noefi(char *arg) 81static int __init setup_noefi(char *arg)
92{ 82{
93 disable_runtime = true; 83 disable_runtime = true;
@@ -256,27 +246,12 @@ static efi_status_t __init phys_efi_set_virtual_address_map(
256 return status; 246 return status;
257} 247}
258 248
259static efi_status_t __init phys_efi_get_time(efi_time_t *tm,
260 efi_time_cap_t *tc)
261{
262 unsigned long flags;
263 efi_status_t status;
264
265 spin_lock_irqsave(&rtc_lock, flags);
266 efi_call_phys_prelog();
267 status = efi_call_phys2(efi_phys.get_time, virt_to_phys(tm),
268 virt_to_phys(tc));
269 efi_call_phys_epilog();
270 spin_unlock_irqrestore(&rtc_lock, flags);
271 return status;
272}
273
274int efi_set_rtc_mmss(const struct timespec *now) 249int efi_set_rtc_mmss(const struct timespec *now)
275{ 250{
276 unsigned long nowtime = now->tv_sec; 251 unsigned long nowtime = now->tv_sec;
277 efi_status_t status; 252 efi_status_t status;
278 efi_time_t eft; 253 efi_time_t eft;
279 efi_time_cap_t cap; 254 efi_time_cap_t cap;
280 struct rtc_time tm; 255 struct rtc_time tm;
281 256
282 status = efi.get_time(&eft, &cap); 257 status = efi.get_time(&eft, &cap);
@@ -294,9 +269,8 @@ int efi_set_rtc_mmss(const struct timespec *now)
294 eft.second = tm.tm_sec; 269 eft.second = tm.tm_sec;
295 eft.nanosecond = 0; 270 eft.nanosecond = 0;
296 } else { 271 } else {
297 printk(KERN_ERR 272 pr_err("%s: Invalid EFI RTC value: write of %lx to EFI RTC failed\n",
298 "%s: Invalid EFI RTC value: write of %lx to EFI RTC failed\n", 273 __func__, nowtime);
299 __FUNCTION__, nowtime);
300 return -1; 274 return -1;
301 } 275 }
302 276
@@ -412,8 +386,7 @@ static void __init print_efi_memmap(void)
412 p < memmap.map_end; 386 p < memmap.map_end;
413 p += memmap.desc_size, i++) { 387 p += memmap.desc_size, i++) {
414 md = p; 388 md = p;
415 pr_info("mem%02u: type=%u, attr=0x%llx, " 389 pr_info("mem%02u: type=%u, attr=0x%llx, range=[0x%016llx-0x%016llx) (%lluMB)\n",
416 "range=[0x%016llx-0x%016llx) (%lluMB)\n",
417 i, md->type, md->attribute, md->phys_addr, 390 i, md->type, md->attribute, md->phys_addr,
418 md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT), 391 md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT),
419 (md->num_pages >> (20 - EFI_PAGE_SHIFT))); 392 (md->num_pages >> (20 - EFI_PAGE_SHIFT)));
@@ -445,9 +418,8 @@ void __init efi_reserve_boot_services(void)
445 memblock_is_region_reserved(start, size)) { 418 memblock_is_region_reserved(start, size)) {
446 /* Could not reserve, skip it */ 419 /* Could not reserve, skip it */
447 md->num_pages = 0; 420 md->num_pages = 0;
448 memblock_dbg("Could not reserve boot range " 421 memblock_dbg("Could not reserve boot range [0x%010llx-0x%010llx]\n",
449 "[0x%010llx-0x%010llx]\n", 422 start, start+size-1);
450 start, start+size-1);
451 } else 423 } else
452 memblock_reserve(start, size); 424 memblock_reserve(start, size);
453 } 425 }
@@ -455,7 +427,7 @@ void __init efi_reserve_boot_services(void)
455 427
456void __init efi_unmap_memmap(void) 428void __init efi_unmap_memmap(void)
457{ 429{
458 clear_bit(EFI_MEMMAP, &x86_efi_facility); 430 clear_bit(EFI_MEMMAP, &efi.flags);
459 if (memmap.map) { 431 if (memmap.map) {
460 early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size); 432 early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size);
461 memmap.map = NULL; 433 memmap.map = NULL;
@@ -466,9 +438,6 @@ void __init efi_free_boot_services(void)
466{ 438{
467 void *p; 439 void *p;
468 440
469 if (!efi_is_native())
470 return;
471
472 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { 441 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
473 efi_memory_desc_t *md = p; 442 efi_memory_desc_t *md = p;
474 unsigned long long start = md->phys_addr; 443 unsigned long long start = md->phys_addr;
@@ -583,45 +552,82 @@ static int __init efi_systab_init(void *phys)
583 return -EINVAL; 552 return -EINVAL;
584 } 553 }
585 if ((efi.systab->hdr.revision >> 16) == 0) 554 if ((efi.systab->hdr.revision >> 16) == 0)
586 pr_err("Warning: System table version " 555 pr_err("Warning: System table version %d.%02d, expected 1.00 or greater!\n",
587 "%d.%02d, expected 1.00 or greater!\n",
588 efi.systab->hdr.revision >> 16, 556 efi.systab->hdr.revision >> 16,
589 efi.systab->hdr.revision & 0xffff); 557 efi.systab->hdr.revision & 0xffff);
590 558
559 set_bit(EFI_SYSTEM_TABLES, &efi.flags);
560
591 return 0; 561 return 0;
592} 562}
593 563
594static int __init efi_runtime_init(void) 564static int __init efi_runtime_init32(void)
595{ 565{
596 efi_runtime_services_t *runtime; 566 efi_runtime_services_32_t *runtime;
567
568 runtime = early_ioremap((unsigned long)efi.systab->runtime,
569 sizeof(efi_runtime_services_32_t));
570 if (!runtime) {
571 pr_err("Could not map the runtime service table!\n");
572 return -ENOMEM;
573 }
597 574
598 /* 575 /*
599 * Check out the runtime services table. We need to map 576 * We will only need *early* access to the following two
600 * the runtime services table so that we can grab the physical 577 * EFI runtime services before set_virtual_address_map
601 * address of several of the EFI runtime functions, needed to 578 * is invoked.
602 * set the firmware into virtual mode.
603 */ 579 */
580 efi_phys.set_virtual_address_map =
581 (efi_set_virtual_address_map_t *)
582 (unsigned long)runtime->set_virtual_address_map;
583 early_iounmap(runtime, sizeof(efi_runtime_services_32_t));
584
585 return 0;
586}
587
588static int __init efi_runtime_init64(void)
589{
590 efi_runtime_services_64_t *runtime;
591
604 runtime = early_ioremap((unsigned long)efi.systab->runtime, 592 runtime = early_ioremap((unsigned long)efi.systab->runtime,
605 sizeof(efi_runtime_services_t)); 593 sizeof(efi_runtime_services_64_t));
606 if (!runtime) { 594 if (!runtime) {
607 pr_err("Could not map the runtime service table!\n"); 595 pr_err("Could not map the runtime service table!\n");
608 return -ENOMEM; 596 return -ENOMEM;
609 } 597 }
598
610 /* 599 /*
611 * We will only need *early* access to the following 600 * We will only need *early* access to the following two
612 * two EFI runtime services before set_virtual_address_map 601 * EFI runtime services before set_virtual_address_map
613 * is invoked. 602 * is invoked.
614 */ 603 */
615 efi_phys.get_time = (efi_get_time_t *)runtime->get_time;
616 efi_phys.set_virtual_address_map = 604 efi_phys.set_virtual_address_map =
617 (efi_set_virtual_address_map_t *) 605 (efi_set_virtual_address_map_t *)
618 runtime->set_virtual_address_map; 606 (unsigned long)runtime->set_virtual_address_map;
607 early_iounmap(runtime, sizeof(efi_runtime_services_64_t));
608
609 return 0;
610}
611
612static int __init efi_runtime_init(void)
613{
614 int rv;
615
619 /* 616 /*
620 * Make efi_get_time can be called before entering 617 * Check out the runtime services table. We need to map
621 * virtual mode. 618 * the runtime services table so that we can grab the physical
619 * address of several of the EFI runtime functions, needed to
620 * set the firmware into virtual mode.
622 */ 621 */
623 efi.get_time = phys_efi_get_time; 622 if (efi_enabled(EFI_64BIT))
624 early_iounmap(runtime, sizeof(efi_runtime_services_t)); 623 rv = efi_runtime_init64();
624 else
625 rv = efi_runtime_init32();
626
627 if (rv)
628 return rv;
629
630 set_bit(EFI_RUNTIME_SERVICES, &efi.flags);
625 631
626 return 0; 632 return 0;
627} 633}
@@ -640,6 +646,8 @@ static int __init efi_memmap_init(void)
640 if (add_efi_memmap) 646 if (add_efi_memmap)
641 do_add_efi_memmap(); 647 do_add_efi_memmap();
642 648
649 set_bit(EFI_MEMMAP, &efi.flags);
650
643 return 0; 651 return 0;
644} 652}
645 653
@@ -722,7 +730,7 @@ void __init efi_init(void)
722 if (efi_systab_init(efi_phys.systab)) 730 if (efi_systab_init(efi_phys.systab))
723 return; 731 return;
724 732
725 set_bit(EFI_SYSTEM_TABLES, &x86_efi_facility); 733 set_bit(EFI_SYSTEM_TABLES, &efi.flags);
726 734
727 efi.config_table = (unsigned long)efi.systab->tables; 735 efi.config_table = (unsigned long)efi.systab->tables;
728 efi.fw_vendor = (unsigned long)efi.systab->fw_vendor; 736 efi.fw_vendor = (unsigned long)efi.systab->fw_vendor;
@@ -750,24 +758,21 @@ void __init efi_init(void)
750 if (efi_config_init(arch_tables)) 758 if (efi_config_init(arch_tables))
751 return; 759 return;
752 760
753 set_bit(EFI_CONFIG_TABLES, &x86_efi_facility);
754
755 /* 761 /*
756 * Note: We currently don't support runtime services on an EFI 762 * Note: We currently don't support runtime services on an EFI
757 * that doesn't match the kernel 32/64-bit mode. 763 * that doesn't match the kernel 32/64-bit mode.
758 */ 764 */
759 765
760 if (!efi_is_native()) 766 if (!efi_runtime_supported())
761 pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n"); 767 pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n");
762 else { 768 else {
763 if (disable_runtime || efi_runtime_init()) 769 if (disable_runtime || efi_runtime_init())
764 return; 770 return;
765 set_bit(EFI_RUNTIME_SERVICES, &x86_efi_facility);
766 } 771 }
767 if (efi_memmap_init()) 772 if (efi_memmap_init())
768 return; 773 return;
769 774
770 set_bit(EFI_MEMMAP, &x86_efi_facility); 775 set_bit(EFI_MEMMAP, &efi.flags);
771 776
772 print_efi_memmap(); 777 print_efi_memmap();
773} 778}
@@ -844,6 +849,22 @@ void __init old_map_region(efi_memory_desc_t *md)
844 (unsigned long long)md->phys_addr); 849 (unsigned long long)md->phys_addr);
845} 850}
846 851
852static void native_runtime_setup(void)
853{
854 efi.get_time = virt_efi_get_time;
855 efi.set_time = virt_efi_set_time;
856 efi.get_wakeup_time = virt_efi_get_wakeup_time;
857 efi.set_wakeup_time = virt_efi_set_wakeup_time;
858 efi.get_variable = virt_efi_get_variable;
859 efi.get_next_variable = virt_efi_get_next_variable;
860 efi.set_variable = virt_efi_set_variable;
861 efi.get_next_high_mono_count = virt_efi_get_next_high_mono_count;
862 efi.reset_system = virt_efi_reset_system;
863 efi.query_variable_info = virt_efi_query_variable_info;
864 efi.update_capsule = virt_efi_update_capsule;
865 efi.query_capsule_caps = virt_efi_query_capsule_caps;
866}
867
847/* Merge contiguous regions of the same type and attribute */ 868/* Merge contiguous regions of the same type and attribute */
848static void __init efi_merge_regions(void) 869static void __init efi_merge_regions(void)
849{ 870{
@@ -891,8 +912,9 @@ static void __init get_systab_virt_addr(efi_memory_desc_t *md)
891 } 912 }
892} 913}
893 914
894static int __init save_runtime_map(void) 915static void __init save_runtime_map(void)
895{ 916{
917#ifdef CONFIG_KEXEC
896 efi_memory_desc_t *md; 918 efi_memory_desc_t *md;
897 void *tmp, *p, *q = NULL; 919 void *tmp, *p, *q = NULL;
898 int count = 0; 920 int count = 0;
@@ -914,38 +936,44 @@ static int __init save_runtime_map(void)
914 } 936 }
915 937
916 efi_runtime_map_setup(q, count, memmap.desc_size); 938 efi_runtime_map_setup(q, count, memmap.desc_size);
939 return;
917 940
918 return 0;
919out: 941out:
920 kfree(q); 942 kfree(q);
921 return -ENOMEM; 943 pr_err("Error saving runtime map, efi runtime on kexec non-functional!!\n");
944#endif
922} 945}
923 946
924/* 947static void *realloc_pages(void *old_memmap, int old_shift)
925 * Map efi regions which were passed via setup_data. The virt_addr is a fixed
926 * addr which was used in first kernel of a kexec boot.
927 */
928static void __init efi_map_regions_fixed(void)
929{ 948{
930 void *p; 949 void *ret;
931 efi_memory_desc_t *md;
932 950
933 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { 951 ret = (void *)__get_free_pages(GFP_KERNEL, old_shift + 1);
934 md = p; 952 if (!ret)
935 efi_map_region_fixed(md); /* FIXME: add error handling */ 953 goto out;
936 get_systab_virt_addr(md);
937 }
938 954
955 /*
956 * A first-time allocation doesn't have anything to copy.
957 */
958 if (!old_memmap)
959 return ret;
960
961 memcpy(ret, old_memmap, PAGE_SIZE << old_shift);
962
963out:
964 free_pages((unsigned long)old_memmap, old_shift);
965 return ret;
939} 966}
940 967
941/* 968/*
942 * Map efi memory ranges for runtime serivce and update new_memmap with virtual 969 * Map the efi memory ranges of the runtime services and update new_mmap with
943 * addresses. 970 * virtual addresses.
944 */ 971 */
945static void * __init efi_map_regions(int *count) 972static void * __init efi_map_regions(int *count, int *pg_shift)
946{ 973{
974 void *p, *new_memmap = NULL;
975 unsigned long left = 0;
947 efi_memory_desc_t *md; 976 efi_memory_desc_t *md;
948 void *p, *tmp, *new_memmap = NULL;
949 977
950 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { 978 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
951 md = p; 979 md = p;
@@ -960,20 +988,80 @@ static void * __init efi_map_regions(int *count)
960 efi_map_region(md); 988 efi_map_region(md);
961 get_systab_virt_addr(md); 989 get_systab_virt_addr(md);
962 990
963 tmp = krealloc(new_memmap, (*count + 1) * memmap.desc_size, 991 if (left < memmap.desc_size) {
964 GFP_KERNEL); 992 new_memmap = realloc_pages(new_memmap, *pg_shift);
965 if (!tmp) 993 if (!new_memmap)
966 goto out; 994 return NULL;
967 new_memmap = tmp; 995
996 left += PAGE_SIZE << *pg_shift;
997 (*pg_shift)++;
998 }
999
968 memcpy(new_memmap + (*count * memmap.desc_size), md, 1000 memcpy(new_memmap + (*count * memmap.desc_size), md,
969 memmap.desc_size); 1001 memmap.desc_size);
1002
1003 left -= memmap.desc_size;
970 (*count)++; 1004 (*count)++;
971 } 1005 }
972 1006
973 return new_memmap; 1007 return new_memmap;
974out: 1008}
975 kfree(new_memmap); 1009
976 return NULL; 1010static void __init kexec_enter_virtual_mode(void)
1011{
1012#ifdef CONFIG_KEXEC
1013 efi_memory_desc_t *md;
1014 void *p;
1015
1016 efi.systab = NULL;
1017
1018 /*
1019 * We don't do virtual mode, since we don't do runtime services, on
1020 * non-native EFI
1021 */
1022 if (!efi_is_native()) {
1023 efi_unmap_memmap();
1024 return;
1025 }
1026
1027 /*
1028 * Map efi regions which were passed via setup_data. The virt_addr is a
1029 * fixed addr which was used in first kernel of a kexec boot.
1030 */
1031 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
1032 md = p;
1033 efi_map_region_fixed(md); /* FIXME: add error handling */
1034 get_systab_virt_addr(md);
1035 }
1036
1037 save_runtime_map();
1038
1039 BUG_ON(!efi.systab);
1040
1041 efi_sync_low_kernel_mappings();
1042
1043 /*
1044 * Now that EFI is in virtual mode, update the function
1045 * pointers in the runtime service table to the new virtual addresses.
1046 *
1047 * Call EFI services through wrapper functions.
1048 */
1049 efi.runtime_version = efi_systab.hdr.revision;
1050
1051 native_runtime_setup();
1052
1053 efi.set_virtual_address_map = NULL;
1054
1055 if (efi_enabled(EFI_OLD_MEMMAP) && (__supported_pte_mask & _PAGE_NX))
1056 runtime_code_page_mkexec();
1057
1058 /* clean DUMMY object */
1059 efi.set_variable(efi_dummy_name, &EFI_DUMMY_GUID,
1060 EFI_VARIABLE_NON_VOLATILE |
1061 EFI_VARIABLE_BOOTSERVICE_ACCESS |
1062 EFI_VARIABLE_RUNTIME_ACCESS,
1063 0, NULL);
1064#endif
977} 1065}
978 1066
979/* 1067/*
@@ -995,57 +1083,53 @@ out:
995 * 1083 *
996 * Specially for kexec boot, efi runtime maps in previous kernel should 1084 * Specially for kexec boot, efi runtime maps in previous kernel should
997 * be passed in via setup_data. In that case runtime ranges will be mapped 1085 * be passed in via setup_data. In that case runtime ranges will be mapped
998 * to the same virtual addresses as the first kernel. 1086 * to the same virtual addresses as the first kernel, see
1087 * kexec_enter_virtual_mode().
999 */ 1088 */
1000void __init efi_enter_virtual_mode(void) 1089static void __init __efi_enter_virtual_mode(void)
1001{ 1090{
1002 efi_status_t status; 1091 int count = 0, pg_shift = 0;
1003 void *new_memmap = NULL; 1092 void *new_memmap = NULL;
1004 int err, count = 0; 1093 efi_status_t status;
1005 1094
1006 efi.systab = NULL; 1095 efi.systab = NULL;
1007 1096
1008 /* 1097 efi_merge_regions();
1009 * We don't do virtual mode, since we don't do runtime services, on 1098 new_memmap = efi_map_regions(&count, &pg_shift);
1010 * non-native EFI 1099 if (!new_memmap) {
1011 */ 1100 pr_err("Error reallocating memory, EFI runtime non-functional!\n");
1012 if (!efi_is_native()) {
1013 efi_unmap_memmap();
1014 return; 1101 return;
1015 } 1102 }
1016 1103
1017 if (efi_setup) { 1104 save_runtime_map();
1018 efi_map_regions_fixed();
1019 } else {
1020 efi_merge_regions();
1021 new_memmap = efi_map_regions(&count);
1022 if (!new_memmap) {
1023 pr_err("Error reallocating memory, EFI runtime non-functional!\n");
1024 return;
1025 }
1026 }
1027
1028 err = save_runtime_map();
1029 if (err)
1030 pr_err("Error saving runtime map, efi runtime on kexec non-functional!!\n");
1031 1105
1032 BUG_ON(!efi.systab); 1106 BUG_ON(!efi.systab);
1033 1107
1034 efi_setup_page_tables(); 1108 if (efi_setup_page_tables(__pa(new_memmap), 1 << pg_shift))
1109 return;
1110
1035 efi_sync_low_kernel_mappings(); 1111 efi_sync_low_kernel_mappings();
1112 efi_dump_pagetable();
1036 1113
1037 if (!efi_setup) { 1114 if (efi_is_native()) {
1038 status = phys_efi_set_virtual_address_map( 1115 status = phys_efi_set_virtual_address_map(
1039 memmap.desc_size * count, 1116 memmap.desc_size * count,
1040 memmap.desc_size, 1117 memmap.desc_size,
1041 memmap.desc_version, 1118 memmap.desc_version,
1042 (efi_memory_desc_t *)__pa(new_memmap)); 1119 (efi_memory_desc_t *)__pa(new_memmap));
1043 1120 } else {
1044 if (status != EFI_SUCCESS) { 1121 status = efi_thunk_set_virtual_address_map(
1045 pr_alert("Unable to switch EFI into virtual mode (status=%lx)!\n", 1122 efi_phys.set_virtual_address_map,
1046 status); 1123 memmap.desc_size * count,
1047 panic("EFI call to SetVirtualAddressMap() failed!"); 1124 memmap.desc_size,
1048 } 1125 memmap.desc_version,
1126 (efi_memory_desc_t *)__pa(new_memmap));
1127 }
1128
1129 if (status != EFI_SUCCESS) {
1130 pr_alert("Unable to switch EFI into virtual mode (status=%lx)!\n",
1131 status);
1132 panic("EFI call to SetVirtualAddressMap() failed!");
1049 } 1133 }
1050 1134
1051 /* 1135 /*
@@ -1055,23 +1139,43 @@ void __init efi_enter_virtual_mode(void)
1055 * Call EFI services through wrapper functions. 1139 * Call EFI services through wrapper functions.
1056 */ 1140 */
1057 efi.runtime_version = efi_systab.hdr.revision; 1141 efi.runtime_version = efi_systab.hdr.revision;
1058 efi.get_time = virt_efi_get_time; 1142
1059 efi.set_time = virt_efi_set_time; 1143 if (efi_is_native())
1060 efi.get_wakeup_time = virt_efi_get_wakeup_time; 1144 native_runtime_setup();
1061 efi.set_wakeup_time = virt_efi_set_wakeup_time; 1145 else
1062 efi.get_variable = virt_efi_get_variable; 1146 efi_thunk_runtime_setup();
1063 efi.get_next_variable = virt_efi_get_next_variable; 1147
1064 efi.set_variable = virt_efi_set_variable;
1065 efi.get_next_high_mono_count = virt_efi_get_next_high_mono_count;
1066 efi.reset_system = virt_efi_reset_system;
1067 efi.set_virtual_address_map = NULL; 1148 efi.set_virtual_address_map = NULL;
1068 efi.query_variable_info = virt_efi_query_variable_info;
1069 efi.update_capsule = virt_efi_update_capsule;
1070 efi.query_capsule_caps = virt_efi_query_capsule_caps;
1071 1149
1072 efi_runtime_mkexec(); 1150 efi_runtime_mkexec();
1073 1151
1074 kfree(new_memmap); 1152 /*
1153 * We mapped the descriptor array into the EFI pagetable above but we're
1154 * not unmapping it here. Here's why:
1155 *
1156 * We're copying select PGDs from the kernel page table to the EFI page
1157 * table and when we do so and make changes to those PGDs like unmapping
1158 * stuff from them, those changes appear in the kernel page table and we
1159 * go boom.
1160 *
1161 * From setup_real_mode():
1162 *
1163 * ...
1164 * trampoline_pgd[0] = init_level4_pgt[pgd_index(__PAGE_OFFSET)].pgd;
1165 *
1166 * In this particular case, our allocation is in PGD 0 of the EFI page
1167 * table but we've copied that PGD from PGD[272] of the EFI page table:
1168 *
1169 * pgd_index(__PAGE_OFFSET = 0xffff880000000000) = 272
1170 *
1171 * where the direct memory mapping in kernel space is.
1172 *
1173 * new_memmap's VA comes from that direct mapping and thus clearing it,
1174 * it would get cleared in the kernel page table too.
1175 *
1176 * efi_cleanup_page_tables(__pa(new_memmap), 1 << pg_shift);
1177 */
1178 free_pages((unsigned long)new_memmap, pg_shift);
1075 1179
1076 /* clean DUMMY object */ 1180 /* clean DUMMY object */
1077 efi.set_variable(efi_dummy_name, &EFI_DUMMY_GUID, 1181 efi.set_variable(efi_dummy_name, &EFI_DUMMY_GUID,
@@ -1081,6 +1185,14 @@ void __init efi_enter_virtual_mode(void)
1081 0, NULL); 1185 0, NULL);
1082} 1186}
1083 1187
1188void __init efi_enter_virtual_mode(void)
1189{
1190 if (efi_setup)
1191 kexec_enter_virtual_mode();
1192 else
1193 __efi_enter_virtual_mode();
1194}
1195
1084/* 1196/*
1085 * Convenience functions to obtain memory types and attributes 1197 * Convenience functions to obtain memory types and attributes
1086 */ 1198 */
@@ -1118,9 +1230,8 @@ u64 efi_mem_attributes(unsigned long phys_addr)
1118} 1230}
1119 1231
1120/* 1232/*
1121 * Some firmware has serious problems when using more than 50% of the EFI 1233 * Some firmware implementations refuse to boot if there's insufficient space
1122 * variable store, i.e. it triggers bugs that can brick machines. Ensure that 1234 * in the variable store. Ensure that we never use more than a safe limit.
1123 * we never use more than this safe limit.
1124 * 1235 *
1125 * Return EFI_SUCCESS if it is safe to write 'size' bytes to the variable 1236 * Return EFI_SUCCESS if it is safe to write 'size' bytes to the variable
1126 * store. 1237 * store.
@@ -1139,10 +1250,9 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size)
1139 return status; 1250 return status;
1140 1251
1141 /* 1252 /*
1142 * Some firmware implementations refuse to boot if there's insufficient 1253 * We account for that by refusing the write if permitting it would
1143 * space in the variable store. We account for that by refusing the 1254 * reduce the available space to under 5KB. This figure was provided by
1144 * write if permitting it would reduce the available space to under 1255 * Samsung, so should be safe.
1145 * 5KB. This figure was provided by Samsung, so should be safe.
1146 */ 1256 */
1147 if ((remaining_size - size < EFI_MIN_RESERVE) && 1257 if ((remaining_size - size < EFI_MIN_RESERVE) &&
1148 !efi_no_storage_paranoia) { 1258 !efi_no_storage_paranoia) {
@@ -1205,8 +1315,27 @@ static int __init parse_efi_cmdline(char *str)
1205 str++; 1315 str++;
1206 1316
1207 if (!strncmp(str, "old_map", 7)) 1317 if (!strncmp(str, "old_map", 7))
1208 set_bit(EFI_OLD_MEMMAP, &x86_efi_facility); 1318 set_bit(EFI_OLD_MEMMAP, &efi.flags);
1209 1319
1210 return 0; 1320 return 0;
1211} 1321}
1212early_param("efi", parse_efi_cmdline); 1322early_param("efi", parse_efi_cmdline);
1323
1324void __init efi_apply_memmap_quirks(void)
1325{
1326 /*
1327 * Once setup is done earlier, unmap the EFI memory map on mismatched
1328 * firmware/kernel architectures since there is no support for runtime
1329 * services.
1330 */
1331 if (!efi_runtime_supported()) {
1332 pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n");
1333 efi_unmap_memmap();
1334 }
1335
1336 /*
1337 * UV doesn't support the new EFI pagetable mapping yet.
1338 */
1339 if (is_uv_system())
1340 set_bit(EFI_OLD_MEMMAP, &efi.flags);
1341}
diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c
index 0b74cdf7f816..9ee3491e31fb 100644
--- a/arch/x86/platform/efi/efi_32.c
+++ b/arch/x86/platform/efi/efi_32.c
@@ -40,7 +40,12 @@
40static unsigned long efi_rt_eflags; 40static unsigned long efi_rt_eflags;
41 41
42void efi_sync_low_kernel_mappings(void) {} 42void efi_sync_low_kernel_mappings(void) {}
43void efi_setup_page_tables(void) {} 43void __init efi_dump_pagetable(void) {}
44int efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
45{
46 return 0;
47}
48void efi_cleanup_page_tables(unsigned long pa_memmap, unsigned num_pages) {}
44 49
45void __init efi_map_region(efi_memory_desc_t *md) 50void __init efi_map_region(efi_memory_desc_t *md)
46{ 51{
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 0c2a234fef1e..290d397e1dd9 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -39,6 +39,7 @@
39#include <asm/cacheflush.h> 39#include <asm/cacheflush.h>
40#include <asm/fixmap.h> 40#include <asm/fixmap.h>
41#include <asm/realmode.h> 41#include <asm/realmode.h>
42#include <asm/time.h>
42 43
43static pgd_t *save_pgd __initdata; 44static pgd_t *save_pgd __initdata;
44static unsigned long efi_flags __initdata; 45static unsigned long efi_flags __initdata;
@@ -58,7 +59,8 @@ struct efi_scratch {
58 u64 prev_cr3; 59 u64 prev_cr3;
59 pgd_t *efi_pgt; 60 pgd_t *efi_pgt;
60 bool use_pgd; 61 bool use_pgd;
61}; 62 u64 phys_stack;
63} __packed;
62 64
63static void __init early_code_mapping_set_exec(int executable) 65static void __init early_code_mapping_set_exec(int executable)
64{ 66{
@@ -137,12 +139,64 @@ void efi_sync_low_kernel_mappings(void)
137 sizeof(pgd_t) * num_pgds); 139 sizeof(pgd_t) * num_pgds);
138} 140}
139 141
140void efi_setup_page_tables(void) 142int efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
141{ 143{
144 unsigned long text;
145 struct page *page;
146 unsigned npages;
147 pgd_t *pgd;
148
149 if (efi_enabled(EFI_OLD_MEMMAP))
150 return 0;
151
142 efi_scratch.efi_pgt = (pgd_t *)(unsigned long)real_mode_header->trampoline_pgd; 152 efi_scratch.efi_pgt = (pgd_t *)(unsigned long)real_mode_header->trampoline_pgd;
153 pgd = __va(efi_scratch.efi_pgt);
143 154
144 if (!efi_enabled(EFI_OLD_MEMMAP)) 155 /*
145 efi_scratch.use_pgd = true; 156 * It can happen that the physical address of new_memmap lands in memory
157 * which is not mapped in the EFI page table. Therefore we need to go
158 * and ident-map those pages containing the map before calling
159 * phys_efi_set_virtual_address_map().
160 */
161 if (kernel_map_pages_in_pgd(pgd, pa_memmap, pa_memmap, num_pages, _PAGE_NX)) {
162 pr_err("Error ident-mapping new memmap (0x%lx)!\n", pa_memmap);
163 return 1;
164 }
165
166 efi_scratch.use_pgd = true;
167
168 /*
169 * When making calls to the firmware everything needs to be 1:1
170 * mapped and addressable with 32-bit pointers. Map the kernel
171 * text and allocate a new stack because we can't rely on the
172 * stack pointer being < 4GB.
173 */
174 if (!IS_ENABLED(CONFIG_EFI_MIXED))
175 return 0;
176
177 page = alloc_page(GFP_KERNEL|__GFP_DMA32);
178 if (!page)
179 panic("Unable to allocate EFI runtime stack < 4GB\n");
180
181 efi_scratch.phys_stack = virt_to_phys(page_address(page));
182 efi_scratch.phys_stack += PAGE_SIZE; /* stack grows down */
183
184 npages = (_end - _text) >> PAGE_SHIFT;
185 text = __pa(_text);
186
187 if (kernel_map_pages_in_pgd(pgd, text >> PAGE_SHIFT, text, npages, 0)) {
188 pr_err("Failed to map kernel text 1:1\n");
189 return 1;
190 }
191
192 return 0;
193}
194
195void efi_cleanup_page_tables(unsigned long pa_memmap, unsigned num_pages)
196{
197 pgd_t *pgd = (pgd_t *)__va(real_mode_header->trampoline_pgd);
198
199 kernel_unmap_pages_in_pgd(pgd, pa_memmap, num_pages);
146} 200}
147 201
148static void __init __map_region(efi_memory_desc_t *md, u64 va) 202static void __init __map_region(efi_memory_desc_t *md, u64 va)
@@ -173,6 +227,16 @@ void __init efi_map_region(efi_memory_desc_t *md)
173 */ 227 */
174 __map_region(md, md->phys_addr); 228 __map_region(md, md->phys_addr);
175 229
230 /*
231 * Enforce the 1:1 mapping as the default virtual address when
232 * booting in EFI mixed mode, because even though we may be
233 * running a 64-bit kernel, the firmware may only be 32-bit.
234 */
235 if (!efi_is_native () && IS_ENABLED(CONFIG_EFI_MIXED)) {
236 md->virt_addr = md->phys_addr;
237 return;
238 }
239
176 efi_va -= size; 240 efi_va -= size;
177 241
178 /* Is PA 2M-aligned? */ 242 /* Is PA 2M-aligned? */
@@ -242,3 +306,299 @@ void __init efi_runtime_mkexec(void)
242 if (__supported_pte_mask & _PAGE_NX) 306 if (__supported_pte_mask & _PAGE_NX)
243 runtime_code_page_mkexec(); 307 runtime_code_page_mkexec();
244} 308}
309
310void __init efi_dump_pagetable(void)
311{
312#ifdef CONFIG_EFI_PGT_DUMP
313 pgd_t *pgd = (pgd_t *)__va(real_mode_header->trampoline_pgd);
314
315 ptdump_walk_pgd_level(NULL, pgd);
316#endif
317}
318
319#ifdef CONFIG_EFI_MIXED
320extern efi_status_t efi64_thunk(u32, ...);
321
322#define runtime_service32(func) \
323({ \
324 u32 table = (u32)(unsigned long)efi.systab; \
325 u32 *rt, *___f; \
326 \
327 rt = (u32 *)(table + offsetof(efi_system_table_32_t, runtime)); \
328 ___f = (u32 *)(*rt + offsetof(efi_runtime_services_32_t, func)); \
329 *___f; \
330})
331
332/*
333 * Switch to the EFI page tables early so that we can access the 1:1
334 * runtime services mappings which are not mapped in any other page
335 * tables. This function must be called before runtime_service32().
336 *
337 * Also, disable interrupts because the IDT points to 64-bit handlers,
338 * which aren't going to function correctly when we switch to 32-bit.
339 */
340#define efi_thunk(f, ...) \
341({ \
342 efi_status_t __s; \
343 unsigned long flags; \
344 u32 func; \
345 \
346 efi_sync_low_kernel_mappings(); \
347 local_irq_save(flags); \
348 \
349 efi_scratch.prev_cr3 = read_cr3(); \
350 write_cr3((unsigned long)efi_scratch.efi_pgt); \
351 __flush_tlb_all(); \
352 \
353 func = runtime_service32(f); \
354 __s = efi64_thunk(func, __VA_ARGS__); \
355 \
356 write_cr3(efi_scratch.prev_cr3); \
357 __flush_tlb_all(); \
358 local_irq_restore(flags); \
359 \
360 __s; \
361})
362
363efi_status_t efi_thunk_set_virtual_address_map(
364 void *phys_set_virtual_address_map,
365 unsigned long memory_map_size,
366 unsigned long descriptor_size,
367 u32 descriptor_version,
368 efi_memory_desc_t *virtual_map)
369{
370 efi_status_t status;
371 unsigned long flags;
372 u32 func;
373
374 efi_sync_low_kernel_mappings();
375 local_irq_save(flags);
376
377 efi_scratch.prev_cr3 = read_cr3();
378 write_cr3((unsigned long)efi_scratch.efi_pgt);
379 __flush_tlb_all();
380
381 func = (u32)(unsigned long)phys_set_virtual_address_map;
382 status = efi64_thunk(func, memory_map_size, descriptor_size,
383 descriptor_version, virtual_map);
384
385 write_cr3(efi_scratch.prev_cr3);
386 __flush_tlb_all();
387 local_irq_restore(flags);
388
389 return status;
390}
391
392static efi_status_t efi_thunk_get_time(efi_time_t *tm, efi_time_cap_t *tc)
393{
394 efi_status_t status;
395 u32 phys_tm, phys_tc;
396
397 spin_lock(&rtc_lock);
398
399 phys_tm = virt_to_phys(tm);
400 phys_tc = virt_to_phys(tc);
401
402 status = efi_thunk(get_time, phys_tm, phys_tc);
403
404 spin_unlock(&rtc_lock);
405
406 return status;
407}
408
409static efi_status_t efi_thunk_set_time(efi_time_t *tm)
410{
411 efi_status_t status;
412 u32 phys_tm;
413
414 spin_lock(&rtc_lock);
415
416 phys_tm = virt_to_phys(tm);
417
418 status = efi_thunk(set_time, phys_tm);
419
420 spin_unlock(&rtc_lock);
421
422 return status;
423}
424
425static efi_status_t
426efi_thunk_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
427 efi_time_t *tm)
428{
429 efi_status_t status;
430 u32 phys_enabled, phys_pending, phys_tm;
431
432 spin_lock(&rtc_lock);
433
434 phys_enabled = virt_to_phys(enabled);
435 phys_pending = virt_to_phys(pending);
436 phys_tm = virt_to_phys(tm);
437
438 status = efi_thunk(get_wakeup_time, phys_enabled,
439 phys_pending, phys_tm);
440
441 spin_unlock(&rtc_lock);
442
443 return status;
444}
445
446static efi_status_t
447efi_thunk_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
448{
449 efi_status_t status;
450 u32 phys_tm;
451
452 spin_lock(&rtc_lock);
453
454 phys_tm = virt_to_phys(tm);
455
456 status = efi_thunk(set_wakeup_time, enabled, phys_tm);
457
458 spin_unlock(&rtc_lock);
459
460 return status;
461}
462
463
464static efi_status_t
465efi_thunk_get_variable(efi_char16_t *name, efi_guid_t *vendor,
466 u32 *attr, unsigned long *data_size, void *data)
467{
468 efi_status_t status;
469 u32 phys_name, phys_vendor, phys_attr;
470 u32 phys_data_size, phys_data;
471
472 phys_data_size = virt_to_phys(data_size);
473 phys_vendor = virt_to_phys(vendor);
474 phys_name = virt_to_phys(name);
475 phys_attr = virt_to_phys(attr);
476 phys_data = virt_to_phys(data);
477
478 status = efi_thunk(get_variable, phys_name, phys_vendor,
479 phys_attr, phys_data_size, phys_data);
480
481 return status;
482}
483
484static efi_status_t
485efi_thunk_set_variable(efi_char16_t *name, efi_guid_t *vendor,
486 u32 attr, unsigned long data_size, void *data)
487{
488 u32 phys_name, phys_vendor, phys_data;
489 efi_status_t status;
490
491 phys_name = virt_to_phys(name);
492 phys_vendor = virt_to_phys(vendor);
493 phys_data = virt_to_phys(data);
494
495 /* If data_size is > sizeof(u32) we've got problems */
496 status = efi_thunk(set_variable, phys_name, phys_vendor,
497 attr, data_size, phys_data);
498
499 return status;
500}
501
502static efi_status_t
503efi_thunk_get_next_variable(unsigned long *name_size,
504 efi_char16_t *name,
505 efi_guid_t *vendor)
506{
507 efi_status_t status;
508 u32 phys_name_size, phys_name, phys_vendor;
509
510 phys_name_size = virt_to_phys(name_size);
511 phys_vendor = virt_to_phys(vendor);
512 phys_name = virt_to_phys(name);
513
514 status = efi_thunk(get_next_variable, phys_name_size,
515 phys_name, phys_vendor);
516
517 return status;
518}
519
520static efi_status_t
521efi_thunk_get_next_high_mono_count(u32 *count)
522{
523 efi_status_t status;
524 u32 phys_count;
525
526 phys_count = virt_to_phys(count);
527 status = efi_thunk(get_next_high_mono_count, phys_count);
528
529 return status;
530}
531
532static void
533efi_thunk_reset_system(int reset_type, efi_status_t status,
534 unsigned long data_size, efi_char16_t *data)
535{
536 u32 phys_data;
537
538 phys_data = virt_to_phys(data);
539
540 efi_thunk(reset_system, reset_type, status, data_size, phys_data);
541}
542
543static efi_status_t
544efi_thunk_update_capsule(efi_capsule_header_t **capsules,
545 unsigned long count, unsigned long sg_list)
546{
547 /*
548 * To properly support this function we would need to repackage
549 * 'capsules' because the firmware doesn't understand 64-bit
550 * pointers.
551 */
552 return EFI_UNSUPPORTED;
553}
554
555static efi_status_t
556efi_thunk_query_variable_info(u32 attr, u64 *storage_space,
557 u64 *remaining_space,
558 u64 *max_variable_size)
559{
560 efi_status_t status;
561 u32 phys_storage, phys_remaining, phys_max;
562
563 if (efi.runtime_version < EFI_2_00_SYSTEM_TABLE_REVISION)
564 return EFI_UNSUPPORTED;
565
566 phys_storage = virt_to_phys(storage_space);
567 phys_remaining = virt_to_phys(remaining_space);
568 phys_max = virt_to_phys(max_variable_size);
569
570 status = efi_thunk(query_variable_info, attr, phys_storage,
571 phys_remaining, phys_max);
572
573 return status;
574}
575
576static efi_status_t
577efi_thunk_query_capsule_caps(efi_capsule_header_t **capsules,
578 unsigned long count, u64 *max_size,
579 int *reset_type)
580{
581 /*
582 * To properly support this function we would need to repackage
583 * 'capsules' because the firmware doesn't understand 64-bit
584 * pointers.
585 */
586 return EFI_UNSUPPORTED;
587}
588
589void efi_thunk_runtime_setup(void)
590{
591 efi.get_time = efi_thunk_get_time;
592 efi.set_time = efi_thunk_set_time;
593 efi.get_wakeup_time = efi_thunk_get_wakeup_time;
594 efi.set_wakeup_time = efi_thunk_set_wakeup_time;
595 efi.get_variable = efi_thunk_get_variable;
596 efi.get_next_variable = efi_thunk_get_next_variable;
597 efi.set_variable = efi_thunk_set_variable;
598 efi.get_next_high_mono_count = efi_thunk_get_next_high_mono_count;
599 efi.reset_system = efi_thunk_reset_system;
600 efi.query_variable_info = efi_thunk_query_variable_info;
601 efi.update_capsule = efi_thunk_update_capsule;
602 efi.query_capsule_caps = efi_thunk_query_capsule_caps;
603}
604#endif /* CONFIG_EFI_MIXED */
diff --git a/arch/x86/platform/efi/efi_stub_64.S b/arch/x86/platform/efi/efi_stub_64.S
index 88073b140298..e0984ef0374b 100644
--- a/arch/x86/platform/efi/efi_stub_64.S
+++ b/arch/x86/platform/efi/efi_stub_64.S
@@ -7,6 +7,10 @@
7 */ 7 */
8 8
9#include <linux/linkage.h> 9#include <linux/linkage.h>
10#include <asm/segment.h>
11#include <asm/msr.h>
12#include <asm/processor-flags.h>
13#include <asm/page_types.h>
10 14
11#define SAVE_XMM \ 15#define SAVE_XMM \
12 mov %rsp, %rax; \ 16 mov %rsp, %rax; \
@@ -164,7 +168,169 @@ ENTRY(efi_call6)
164 ret 168 ret
165ENDPROC(efi_call6) 169ENDPROC(efi_call6)
166 170
171#ifdef CONFIG_EFI_MIXED
172
173/*
174 * We run this function from the 1:1 mapping.
175 *
176 * This function must be invoked with a 1:1 mapped stack.
177 */
178ENTRY(__efi64_thunk)
179 movl %ds, %eax
180 push %rax
181 movl %es, %eax
182 push %rax
183 movl %ss, %eax
184 push %rax
185
186 subq $32, %rsp
187 movl %esi, 0x0(%rsp)
188 movl %edx, 0x4(%rsp)
189 movl %ecx, 0x8(%rsp)
190 movq %r8, %rsi
191 movl %esi, 0xc(%rsp)
192 movq %r9, %rsi
193 movl %esi, 0x10(%rsp)
194
195 sgdt save_gdt(%rip)
196
197 leaq 1f(%rip), %rbx
198 movq %rbx, func_rt_ptr(%rip)
199
200 /* Switch to gdt with 32-bit segments */
201 movl 64(%rsp), %eax
202 lgdt (%rax)
203
204 leaq efi_enter32(%rip), %rax
205 pushq $__KERNEL_CS
206 pushq %rax
207 lretq
208
2091: addq $32, %rsp
210
211 lgdt save_gdt(%rip)
212
213 pop %rbx
214 movl %ebx, %ss
215 pop %rbx
216 movl %ebx, %es
217 pop %rbx
218 movl %ebx, %ds
219
220 /*
221 * Convert 32-bit status code into 64-bit.
222 */
223 test %rax, %rax
224 jz 1f
225 movl %eax, %ecx
226 andl $0x0fffffff, %ecx
227 andl $0xf0000000, %eax
228 shl $32, %rax
229 or %rcx, %rax
2301:
231 ret
232ENDPROC(__efi64_thunk)
233
234ENTRY(efi_exit32)
235 movq func_rt_ptr(%rip), %rax
236 push %rax
237 mov %rdi, %rax
238 ret
239ENDPROC(efi_exit32)
240
241 .code32
242/*
243 * EFI service pointer must be in %edi.
244 *
245 * The stack should represent the 32-bit calling convention.
246 */
247ENTRY(efi_enter32)
248 movl $__KERNEL_DS, %eax
249 movl %eax, %ds
250 movl %eax, %es
251 movl %eax, %ss
252
253 /* Reload pgtables */
254 movl %cr3, %eax
255 movl %eax, %cr3
256
257 /* Disable paging */
258 movl %cr0, %eax
259 btrl $X86_CR0_PG_BIT, %eax
260 movl %eax, %cr0
261
262 /* Disable long mode via EFER */
263 movl $MSR_EFER, %ecx
264 rdmsr
265 btrl $_EFER_LME, %eax
266 wrmsr
267
268 call *%edi
269
270 /* We must preserve return value */
271 movl %eax, %edi
272
273 /*
274 * Some firmware will return with interrupts enabled. Be sure to
275 * disable them before we switch GDTs.
276 */
277 cli
278
279 movl 68(%esp), %eax
280 movl %eax, 2(%eax)
281 lgdtl (%eax)
282
283 movl %cr4, %eax
284 btsl $(X86_CR4_PAE_BIT), %eax
285 movl %eax, %cr4
286
287 movl %cr3, %eax
288 movl %eax, %cr3
289
290 movl $MSR_EFER, %ecx
291 rdmsr
292 btsl $_EFER_LME, %eax
293 wrmsr
294
295 xorl %eax, %eax
296 lldt %ax
297
298 movl 72(%esp), %eax
299 pushl $__KERNEL_CS
300 pushl %eax
301
302 /* Enable paging */
303 movl %cr0, %eax
304 btsl $X86_CR0_PG_BIT, %eax
305 movl %eax, %cr0
306 lret
307ENDPROC(efi_enter32)
308
309 .data
310 .balign 8
311 .global efi32_boot_gdt
312efi32_boot_gdt: .word 0
313 .quad 0
314
315save_gdt: .word 0
316 .quad 0
317func_rt_ptr: .quad 0
318
319 .global efi_gdt64
320efi_gdt64:
321 .word efi_gdt64_end - efi_gdt64
322 .long 0 /* Filled out by user */
323 .word 0
324 .quad 0x0000000000000000 /* NULL descriptor */
325 .quad 0x00af9a000000ffff /* __KERNEL_CS */
326 .quad 0x00cf92000000ffff /* __KERNEL_DS */
327 .quad 0x0080890000000000 /* TS descriptor */
328 .quad 0x0000000000000000 /* TS continued */
329efi_gdt64_end:
330#endif /* CONFIG_EFI_MIXED */
331
167 .data 332 .data
168ENTRY(efi_scratch) 333ENTRY(efi_scratch)
169 .fill 3,8,0 334 .fill 3,8,0
170 .byte 0 335 .byte 0
336 .quad 0
diff --git a/arch/x86/platform/efi/efi_thunk_64.S b/arch/x86/platform/efi/efi_thunk_64.S
new file mode 100644
index 000000000000..8806fa73e6e6
--- /dev/null
+++ b/arch/x86/platform/efi/efi_thunk_64.S
@@ -0,0 +1,65 @@
1/*
2 * Copyright (C) 2014 Intel Corporation; author Matt Fleming
3 */
4
5#include <linux/linkage.h>
6#include <asm/page_types.h>
7
8 .text
9 .code64
10ENTRY(efi64_thunk)
11 push %rbp
12 push %rbx
13
14 /*
15 * Switch to 1:1 mapped 32-bit stack pointer.
16 */
17 movq %rsp, efi_saved_sp(%rip)
18 movq efi_scratch+25(%rip), %rsp
19
20 /*
21 * Calculate the physical address of the kernel text.
22 */
23 movq $__START_KERNEL_map, %rax
24 subq phys_base(%rip), %rax
25
26 /*
27 * Push some physical addresses onto the stack. This is easier
28 * to do now in a code64 section while the assembler can address
29 * 64-bit values. Note that all the addresses on the stack are
30 * 32-bit.
31 */
32 subq $16, %rsp
33 leaq efi_exit32(%rip), %rbx
34 subq %rax, %rbx
35 movl %ebx, 8(%rsp)
36 leaq efi_gdt64(%rip), %rbx
37 subq %rax, %rbx
38 movl %ebx, 2(%ebx)
39 movl %ebx, 4(%rsp)
40 leaq efi_gdt32(%rip), %rbx
41 subq %rax, %rbx
42 movl %ebx, 2(%ebx)
43 movl %ebx, (%rsp)
44
45 leaq __efi64_thunk(%rip), %rbx
46 subq %rax, %rbx
47 call *%rbx
48
49 movq efi_saved_sp(%rip), %rsp
50 pop %rbx
51 pop %rbp
52 retq
53ENDPROC(efi64_thunk)
54
55 .data
56efi_gdt32:
57 .word efi_gdt32_end - efi_gdt32
58 .long 0 /* Filled out above */
59 .word 0
60 .quad 0x0000000000000000 /* NULL descriptor */
61 .quad 0x00cf9a000000ffff /* __KERNEL_CS */
62 .quad 0x00cf93000000ffff /* __KERNEL_DS */
63efi_gdt32_end:
64
65efi_saved_sp: .quad 0
diff --git a/arch/x86/platform/ts5500/ts5500.c b/arch/x86/platform/ts5500/ts5500.c
index 39febb214e8c..9471b9456f25 100644
--- a/arch/x86/platform/ts5500/ts5500.c
+++ b/arch/x86/platform/ts5500/ts5500.c
@@ -88,7 +88,7 @@ struct ts5500_sbc {
88static const struct { 88static const struct {
89 const char * const string; 89 const char * const string;
90 const ssize_t offset; 90 const ssize_t offset;
91} ts5500_signatures[] __initdata = { 91} ts5500_signatures[] __initconst = {
92 { "TS-5x00 AMD Elan", 0xb14 }, 92 { "TS-5x00 AMD Elan", 0xb14 },
93}; 93};
94 94
diff --git a/arch/x86/um/asm/barrier.h b/arch/x86/um/asm/barrier.h
index 7d01b8c56c00..cc04e67bfd05 100644
--- a/arch/x86/um/asm/barrier.h
+++ b/arch/x86/um/asm/barrier.h
@@ -40,11 +40,7 @@
40#define smp_rmb() barrier() 40#define smp_rmb() barrier()
41#endif /* CONFIG_X86_PPRO_FENCE */ 41#endif /* CONFIG_X86_PPRO_FENCE */
42 42
43#ifdef CONFIG_X86_OOSTORE
44#define smp_wmb() wmb()
45#else /* CONFIG_X86_OOSTORE */
46#define smp_wmb() barrier() 43#define smp_wmb() barrier()
47#endif /* CONFIG_X86_OOSTORE */
48 44
49#define smp_read_barrier_depends() read_barrier_depends() 45#define smp_read_barrier_depends() read_barrier_depends()
50#define set_mb(var, value) do { (void)xchg(&var, value); } while (0) 46#define set_mb(var, value) do { (void)xchg(&var, value); } while (0)
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index fd14be1d1472..9206ac7961a5 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -2,6 +2,8 @@
2# Building vDSO images for x86. 2# Building vDSO images for x86.
3# 3#
4 4
5KBUILD_CFLAGS += $(DISABLE_LTO)
6
5VDSO64-$(CONFIG_X86_64) := y 7VDSO64-$(CONFIG_X86_64) := y
6VDSOX32-$(CONFIG_X86_X32_ABI) := y 8VDSOX32-$(CONFIG_X86_X32_ABI) := y
7VDSO32-$(CONFIG_X86_32) := y 9VDSO32-$(CONFIG_X86_32) := y
@@ -35,7 +37,8 @@ export CPPFLAGS_vdso.lds += -P -C
35 37
36VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \ 38VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \
37 -Wl,--no-undefined \ 39 -Wl,--no-undefined \
38 -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 40 -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 \
41 $(DISABLE_LTO)
39 42
40$(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so 43$(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so
41 44
@@ -127,7 +130,7 @@ vdso32.so-$(VDSO32-y) += sysenter
127vdso32-images = $(vdso32.so-y:%=vdso32-%.so) 130vdso32-images = $(vdso32.so-y:%=vdso32-%.so)
128 131
129CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds) 132CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds)
130VDSO_LDFLAGS_vdso32.lds = -m32 -Wl,-soname=linux-gate.so.1 133VDSO_LDFLAGS_vdso32.lds = -m32 -Wl,-m,elf_i386 -Wl,-soname=linux-gate.so.1
131 134
132# This makes sure the $(obj) subdirectory exists even though vdso32/ 135# This makes sure the $(obj) subdirectory exists even though vdso32/
133# is not a kbuild sub-make subdirectory. 136# is not a kbuild sub-make subdirectory.
@@ -181,7 +184,8 @@ quiet_cmd_vdso = VDSO $@
181 -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \ 184 -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \
182 sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' 185 sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
183 186
184VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) 187VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \
188 $(LTO_CFLAGS)
185GCOV_PROFILE := n 189GCOV_PROFILE := n
186 190
187# 191#
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 256282e7888b..2423ef04ffea 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -365,7 +365,7 @@ void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
365/* Assume pteval_t is equivalent to all the other *val_t types. */ 365/* Assume pteval_t is equivalent to all the other *val_t types. */
366static pteval_t pte_mfn_to_pfn(pteval_t val) 366static pteval_t pte_mfn_to_pfn(pteval_t val)
367{ 367{
368 if (pteval_present(val)) { 368 if (val & _PAGE_PRESENT) {
369 unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; 369 unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT;
370 unsigned long pfn = mfn_to_pfn(mfn); 370 unsigned long pfn = mfn_to_pfn(mfn);
371 371
@@ -381,7 +381,7 @@ static pteval_t pte_mfn_to_pfn(pteval_t val)
381 381
382static pteval_t pte_pfn_to_mfn(pteval_t val) 382static pteval_t pte_pfn_to_mfn(pteval_t val)
383{ 383{
384 if (pteval_present(val)) { 384 if (val & _PAGE_PRESENT) {
385 unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; 385 unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT;
386 pteval_t flags = val & PTE_FLAGS_MASK; 386 pteval_t flags = val & PTE_FLAGS_MASK;
387 unsigned long mfn; 387 unsigned long mfn;
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/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index 0a337e4a8370..c3d20ba6eb86 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -9,6 +9,7 @@ generic-y += errno.h
9generic-y += exec.h 9generic-y += exec.h
10generic-y += fcntl.h 10generic-y += fcntl.h
11generic-y += hardirq.h 11generic-y += hardirq.h
12generic-y += hash.h
12generic-y += ioctl.h 13generic-y += ioctl.h
13generic-y += irq_regs.h 14generic-y += irq_regs.h
14generic-y += kdebug.h 15generic-y += kdebug.h
@@ -17,7 +18,9 @@ generic-y += kvm_para.h
17generic-y += linkage.h 18generic-y += linkage.h
18generic-y += local.h 19generic-y += local.h
19generic-y += local64.h 20generic-y += local64.h
21generic-y += mcs_spinlock.h
20generic-y += percpu.h 22generic-y += percpu.h
23generic-y += preempt.h
21generic-y += resource.h 24generic-y += resource.h
22generic-y += scatterlist.h 25generic-y += scatterlist.h
23generic-y += sections.h 26generic-y += sections.h
@@ -27,5 +30,3 @@ generic-y += termios.h
27generic-y += topology.h 30generic-y += topology.h
28generic-y += trace_clock.h 31generic-y += trace_clock.h
29generic-y += xor.h 32generic-y += xor.h
30generic-y += preempt.h
31generic-y += hash.h
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 */